@powersync/node 0.0.0-dev-20260503073249 → 0.0.0-dev-20260504100448
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.cjs
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var common = require('@powersync/common');
|
|
4
4
|
var os = require('node:os');
|
|
5
|
-
var bson = require('bson');
|
|
6
5
|
var undici = require('undici');
|
|
7
6
|
var Comlink = require('comlink');
|
|
8
7
|
var fs = require('node:fs/promises');
|
|
@@ -88,9 +87,6 @@ class NodeRemote extends common.AbstractRemote {
|
|
|
88
87
|
`${os__namespace.platform()}/${os__namespace.release()}`
|
|
89
88
|
].join(' ');
|
|
90
89
|
}
|
|
91
|
-
async getBSON() {
|
|
92
|
-
return bson.BSON;
|
|
93
|
-
}
|
|
94
90
|
}
|
|
95
91
|
function defaultFetchDispatcher() {
|
|
96
92
|
// EnvHttpProxyAgent automatically uses HTTP_PROXY, HTTPS_PROXY and NO_PROXY env vars by default.
|
package/dist/bundle.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.cjs","sources":["../lib/sync/stream/NodeRemote.js","../lib/sync/stream/NodeStreamingSyncImplementation.js","../lib/db/RemoteConnection.js","../lib/db/WorkerConnectionPool.js","../lib/db/PowerSyncDatabase.js","../lib/attachments/NodeFileSystemAdapter.js"],"sourcesContent":["import * as os from 'node:os';\nimport { AbstractRemote, DEFAULT_REMOTE_LOGGER, FetchImplementationProvider } from '@powersync/common';\nimport { BSON } from 'bson';\nimport { EnvHttpProxyAgent, getGlobalDispatcher, ProxyAgent, WebSocket as UndiciWebSocket } from 'undici';\nexport const STREAMING_POST_TIMEOUT_MS = 30_000;\nclass NodeFetchProvider extends FetchImplementationProvider {\n getFetch() {\n return fetch.bind(globalThis);\n }\n}\nexport class NodeRemote extends AbstractRemote {\n connector;\n logger;\n wsDispatcher;\n constructor(connector, logger = DEFAULT_REMOTE_LOGGER, options) {\n const fetchDispatcher = options?.dispatcher ?? defaultFetchDispatcher();\n super(connector, logger, {\n fetchImplementation: options?.fetchImplementation ?? new NodeFetchProvider(),\n fetchOptions: {\n dispatcher: fetchDispatcher\n },\n ...(options ?? {})\n });\n this.connector = connector;\n this.logger = logger;\n this.wsDispatcher = options?.dispatcher;\n }\n createSocket(url) {\n // Create dedicated dispatcher for this WebSocket\n const baseDispatcher = this.getWebsocketDispatcher(url);\n // Create WebSocket with dedicated dispatcher\n const ws = new UndiciWebSocket(url, {\n dispatcher: baseDispatcher,\n headers: {\n 'User-Agent': this.getUserAgent()\n }\n });\n return ws;\n }\n getWebsocketDispatcher(url) {\n if (this.wsDispatcher != null) {\n return this.wsDispatcher;\n }\n const protocol = new URL(url).protocol.replace(':', '');\n const proxy = getProxyForProtocol(protocol);\n if (proxy != null) {\n return new ProxyAgent(proxy);\n }\n else {\n return getGlobalDispatcher();\n }\n }\n getUserAgent() {\n return [\n super.getUserAgent(),\n `powersync-node`,\n `node/${process.versions.node}`,\n `${os.platform()}/${os.release()}`\n ].join(' ');\n }\n async getBSON() {\n return BSON;\n }\n}\nfunction defaultFetchDispatcher() {\n // EnvHttpProxyAgent automatically uses HTTP_PROXY, HTTPS_PROXY and NO_PROXY env vars by default.\n // We add ALL_PROXY support.\n return new EnvHttpProxyAgent({\n httpProxy: getProxyForProtocol('http'),\n httpsProxy: getProxyForProtocol('https')\n });\n}\nfunction getProxyForProtocol(protocol) {\n return (process.env[`${protocol.toLowerCase()}_proxy`] ??\n process.env[`${protocol.toUpperCase()}_PROXY`] ??\n process.env[`all_proxy`] ??\n process.env[`ALL_PROXY`]);\n}\n//# sourceMappingURL=NodeRemote.js.map","import { AbstractStreamingSyncImplementation, LockType, Mutex } from '@powersync/common';\n/**\n * Global locks which prevent multiple instances from syncing\n * concurrently.\n */\nconst LOCKS = new Map();\nexport class NodeStreamingSyncImplementation extends AbstractStreamingSyncImplementation {\n locks;\n constructor(options) {\n super(options);\n this.initLocks();\n }\n /**\n * Configures global locks on sync process\n */\n initLocks() {\n const { identifier } = this.options;\n if (identifier && LOCKS.has(identifier)) {\n this.locks = LOCKS.get(identifier);\n return;\n }\n this.locks = new Map();\n this.locks.set(LockType.CRUD, new Mutex());\n this.locks.set(LockType.SYNC, new Mutex());\n if (identifier) {\n LOCKS.set(identifier, this.locks);\n }\n }\n obtainLock(lockOptions) {\n const lock = this.locks.get(lockOptions.type);\n if (!lock) {\n throw new Error(`Lock type ${lockOptions.type} not found`);\n }\n return lock.runExclusive(async () => {\n return lockOptions.callback();\n }, lockOptions.signal);\n }\n}\n//# sourceMappingURL=NodeStreamingSyncImplementation.js.map","import { ConnectionClosedError, DBGetUtilsDefaultMixin } from '@powersync/common';\nimport { releaseProxy } from 'comlink';\n/**\n * A PowerSync database connection implemented with RPC calls to a background worker.\n */\nclass BaseRemoteConnection {\n worker;\n comlink;\n database;\n notifyWorkerClosed = new AbortController();\n constructor(worker, comlink, database) {\n this.worker = worker;\n this.comlink = comlink;\n this.database = database;\n this.worker.once('exit', (_) => {\n this.notifyWorkerClosed.abort();\n });\n }\n /**\n * Runs the inner function, but appends the stack trace where this function was called. This is useful for workers\n * because stack traces from worker errors are otherwise unrelated to the application issue that has caused them.\n */\n withRemote(inner) {\n const trace = {};\n Error.captureStackTrace(trace);\n const controller = this.notifyWorkerClosed;\n return new Promise((resolve, reject) => {\n if (controller.signal.aborted) {\n reject(new ConnectionClosedError('Called operation on closed remote'));\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 inner()\n .then((data) => completePromise(() => resolve(data)))\n .catch((e) => {\n if (e instanceof Error && e.stack) {\n e.stack += trace.stack;\n }\n return completePromise(() => reject(e));\n });\n });\n }\n executeBatch(query, params = []) {\n return this.withRemote(async () => {\n const result = await this.database.executeBatch(query, params ?? []);\n return BaseRemoteConnection.wrapQueryResult(result);\n });\n }\n execute(query, params) {\n return this.withRemote(async () => {\n const result = await this.database.execute(query, params ?? []);\n return BaseRemoteConnection.wrapQueryResult(result);\n });\n }\n executeRaw(query, params) {\n return this.withRemote(async () => {\n return await this.database.executeRaw(query, params ?? []);\n });\n }\n async refreshSchema() {\n await this.execute(\"pragma table_info('sqlite_master')\");\n }\n async close() {\n await this.database.close();\n this.database[releaseProxy]();\n this.comlink[releaseProxy]();\n await this.worker.terminate();\n }\n static wrapQueryResult(result) {\n let rows = undefined;\n if (result.rows) {\n rows = {\n ...result.rows,\n item: (idx) => result.rows?._array[idx]\n };\n }\n return {\n ...result,\n rows\n };\n }\n}\nexport class RemoteConnection extends DBGetUtilsDefaultMixin(BaseRemoteConnection) {\n}\n//# sourceMappingURL=RemoteConnection.js.map","import * as Comlink from 'comlink';\nimport fs from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { Worker } from 'node:worker_threads';\nimport { BaseObserver, DBAdapterDefaultMixin, Semaphore, timeoutSignal } from '@powersync/common';\nimport { isBundledToCommonJs } from '../utils/modules.js';\nimport { RemoteConnection } from './RemoteConnection.js';\nconst READ_CONNECTIONS = 5;\nconst defaultDatabaseImplementation = {\n type: 'better-sqlite3'\n};\n/**\n * Adapter for better-sqlite3\n */\nexport class WorkerConnectionPool extends BaseObserver {\n options;\n name;\n writeConnection;\n readConnections;\n constructor(options) {\n super();\n if (options.readWorkerCount != null && options.readWorkerCount < 1) {\n throw `Needs at least one worker for reads, got ${options.readWorkerCount}`;\n }\n this.options = options;\n this.name = options.dbFilename;\n }\n async initialize() {\n let dbFilePath = this.options.dbFilename;\n if (this.options.dbLocation !== undefined) {\n // Make sure the dbLocation exists, we get a TypeError from better-sqlite3 otherwise.\n let directoryExists = false;\n try {\n const stat = await fs.stat(this.options.dbLocation);\n directoryExists = stat.isDirectory();\n }\n catch (_) {\n // If we can't even stat, the directory won't be accessible to SQLite either.\n }\n if (!directoryExists) {\n throw new Error(`The dbLocation directory at \"${this.options.dbLocation}\" does not exist. Please create it before opening the PowerSync database!`);\n }\n dbFilePath = path.join(this.options.dbLocation, dbFilePath);\n }\n const openWorker = async (isWriter) => {\n const isCommonJsModule = isBundledToCommonJs;\n let worker;\n const workerName = isWriter ? `write ${dbFilePath}` : `read ${dbFilePath}`;\n const workerFactory = this.options.openWorker ?? ((...args) => new Worker(...args));\n if (isCommonJsModule) {\n worker = workerFactory(path.resolve(__dirname, 'DefaultWorker.cjs'), { name: workerName });\n }\n else {\n worker = workerFactory(new URL('./DefaultWorker.js', import.meta.url), { name: workerName });\n }\n const listeners = new WeakMap();\n const comlink = Comlink.wrap({\n postMessage: worker.postMessage.bind(worker),\n addEventListener: (type, listener) => {\n let resolved = 'handleEvent' in listener ? listener.handleEvent.bind(listener) : listener;\n // Comlink wants message events, but the message event on workers in Node returns the data only.\n if (type === 'message') {\n const original = resolved;\n resolved = (data) => {\n original({ data });\n };\n }\n listeners.set(listener, resolved);\n worker.addListener(type, resolved);\n },\n removeEventListener: (type, listener) => {\n const resolved = listeners.get(listener);\n if (!resolved) {\n return;\n }\n worker.removeListener(type, resolved);\n }\n });\n worker.once('error', (e) => {\n console.error('Unexpected PowerSync database worker error', e);\n });\n const database = (await comlink.open({\n path: dbFilePath,\n isWriter,\n implementation: this.options.implementation ?? defaultDatabaseImplementation\n }));\n if (isWriter) {\n await database.execute(\"SELECT powersync_update_hooks('install');\", []);\n }\n const connection = new RemoteConnection(worker, comlink, database);\n if (this.options.initializeConnection) {\n await this.options.initializeConnection(connection, isWriter);\n }\n if (!isWriter) {\n await connection.execute('pragma query_only = true');\n }\n else {\n // We only need to enable this on the writer connection.\n // We can get `database is locked` errors if we enable this on concurrently opening read connections.\n await connection.execute('pragma journal_mode = WAL');\n }\n return connection;\n };\n // Open the writer first to avoid multiple threads enabling WAL concurrently (causing \"database is locked\" errors).\n this.writeConnection = new Semaphore([await openWorker(true)]);\n const createWorkers = [];\n const amountOfReaders = this.options.readWorkerCount ?? READ_CONNECTIONS;\n for (let i = 0; i < amountOfReaders; i++) {\n createWorkers.push(openWorker(false));\n }\n this.readConnections = new Semaphore(await Promise.all(createWorkers));\n }\n async close() {\n const { item: writeConnection, release: returnWrite } = await this.writeConnection.requestOne();\n const { items: readers, release: returnReaders } = await this.readConnections.requestAll();\n try {\n await writeConnection.close();\n await Promise.all(readers.map((r) => r.close()));\n }\n finally {\n returnWrite();\n returnReaders();\n }\n }\n async readLock(fn, options) {\n const lease = await this.readConnections.requestOne(timeoutSignal(options?.timeoutMs));\n try {\n return await fn(lease.item);\n }\n finally {\n lease.release();\n }\n }\n async writeLock(fn, options) {\n const { item, release } = await this.writeConnection.requestOne(timeoutSignal(options?.timeoutMs));\n try {\n try {\n return await fn(item);\n }\n finally {\n const serializedUpdates = await item.executeRaw(\"SELECT powersync_update_hooks('get');\", []);\n const updates = JSON.parse(serializedUpdates[0][0]);\n if (updates.length > 0) {\n const event = {\n tables: updates,\n groupedUpdates: {},\n rawUpdates: []\n };\n this.iterateListeners((cb) => cb.tablesUpdated?.(event));\n }\n }\n }\n finally {\n release();\n }\n }\n async refreshSchema() {\n await this.writeLock((l) => l.refreshSchema());\n const { items, release } = await this.readConnections.requestAll();\n try {\n await Promise.all(items.map((c) => c.refreshSchema()));\n }\n finally {\n release();\n }\n }\n}\nexport class WorkerPoolDatabaseAdapter extends DBAdapterDefaultMixin(WorkerConnectionPool) {\n}\n//# sourceMappingURL=WorkerConnectionPool.js.map","import { AbstractPowerSyncDatabase, SqliteBucketStorage } from '@powersync/common';\nimport { NodeRemote } from '../sync/stream/NodeRemote.js';\nimport { NodeStreamingSyncImplementation } from '../sync/stream/NodeStreamingSyncImplementation.js';\nimport { WorkerPoolDatabaseAdapter } from './WorkerConnectionPool.js';\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 */\nexport class PowerSyncDatabase extends AbstractPowerSyncDatabase {\n constructor(options) {\n super(options);\n }\n async _initialize() {\n if ('initialize' in this.database) {\n await this.database.initialize();\n }\n }\n /**\n * Opens a DBAdapter using better-sqlite3 as the default SQLite open factory.\n */\n openDBAdapter(options) {\n return new WorkerPoolDatabaseAdapter(options.database);\n }\n generateBucketStorageAdapter() {\n return new SqliteBucketStorage(this.database, this.logger);\n }\n connect(connector, options) {\n return super.connect(connector, options);\n }\n generateSyncStreamImplementation(connector, options) {\n const logger = this.logger;\n const remote = new NodeRemote(connector, logger, {\n dispatcher: options.dispatcher,\n ...this.options.remoteOptions\n });\n return new NodeStreamingSyncImplementation({\n adapter: this.bucketStorageAdapter,\n remote,\n uploadCrud: async () => {\n await this.waitForReady();\n await connector.uploadData(this);\n },\n ...options,\n identifier: this.database.name,\n logger\n });\n }\n}\n//# sourceMappingURL=PowerSyncDatabase.js.map","import { promises as fs } from 'fs';\nimport * as path from 'path';\nimport { EncodingType } from '@powersync/common';\n/**\n * NodeFileSystemAdapter implements LocalStorageAdapter using Node.js filesystem.\n * Suitable for Node.js environments and Electron applications.\n */\nexport class NodeFileSystemAdapter {\n storageDirectory;\n constructor(storageDirectory = './user_data') {\n this.storageDirectory = storageDirectory;\n }\n async initialize() {\n const dir = path.resolve(this.storageDirectory);\n await fs.mkdir(dir, { recursive: true });\n }\n async clear() {\n const dir = path.resolve(this.storageDirectory);\n await fs.rmdir(dir, { recursive: true });\n }\n getLocalUri(filename) {\n return path.join(path.resolve(this.storageDirectory), filename);\n }\n async uploadFile(filePath, data, options) {\n const buffer = Buffer.from(data);\n await fs.writeFile(filePath, buffer, {\n encoding: options?.encoding\n });\n }\n async downloadFile(filePath) {\n const data = await fs.readFile(filePath);\n return new Blob([new Uint8Array(data)]);\n }\n async saveFile(filePath, data, options) {\n let buffer;\n if (typeof data === 'string') {\n buffer = Buffer.from(data, options?.encoding ?? EncodingType.Base64);\n }\n else {\n buffer = Buffer.from(data);\n }\n await fs.writeFile(filePath, buffer);\n return buffer.length;\n }\n async readFile(filePath, options) {\n const data = await fs.readFile(filePath);\n if (options?.encoding === EncodingType.Base64) {\n return Buffer.from(data.toString(), 'base64').buffer;\n }\n else {\n return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);\n }\n }\n async deleteFile(path, options) {\n await fs.unlink(path).catch((err) => {\n if (err.code !== 'ENOENT') {\n throw err;\n }\n });\n }\n async fileExists(filePath) {\n try {\n await fs.access(filePath);\n return true;\n }\n catch {\n return false;\n }\n }\n async makeDir(path) {\n await fs.mkdir(path, { recursive: true });\n }\n async rmDir(path) {\n await fs.rmdir(path, { recursive: true });\n }\n}\n//# sourceMappingURL=NodeFileSystemAdapter.js.map"],"names":["FetchImplementationProvider","AbstractRemote","DEFAULT_REMOTE_LOGGER","UndiciWebSocket","ProxyAgent","getGlobalDispatcher","os","BSON","EnvHttpProxyAgent","AbstractStreamingSyncImplementation","LockType","Mutex","ConnectionClosedError","releaseProxy","DBGetUtilsDefaultMixin","BaseObserver","path","Worker","Comlink","Semaphore","timeoutSignal","DBAdapterDefaultMixin","AbstractPowerSyncDatabase","SqliteBucketStorage","fs","EncodingType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,iBAAiB,SAASA,kCAA2B,CAAC;AAC5D,IAAI,QAAQ,GAAG;AACf,QAAQ,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;AACrC,IAAI;AACJ;AACO,MAAM,UAAU,SAASC,qBAAc,CAAC;AAC/C,IAAI,SAAS;AACb,IAAI,MAAM;AACV,IAAI,YAAY;AAChB,IAAI,WAAW,CAAC,SAAS,EAAE,MAAM,GAAGC,4BAAqB,EAAE,OAAO,EAAE;AACpE,QAAQ,MAAM,eAAe,GAAG,OAAO,EAAE,UAAU,IAAI,sBAAsB,EAAE;AAC/E,QAAQ,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE;AACjC,YAAY,mBAAmB,EAAE,OAAO,EAAE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AAgB,MAAM,GAAG;AACzB,YAAY;AACZ,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B,QAAQ,IAAI;AACZ,YAAY,MAAMA,aAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;AACrC,YAAY,OAAO,IAAI;AACvB,QAAQ;AACR,QAAQ,MAAM;AACd,YAAY,OAAO,KAAK;AACxB,QAAQ;AACR,IAAI;AACJ,IAAI,MAAM,OAAO,CAAC,IAAI,EAAE;AACxB,QAAQ,MAAMA,aAAE,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACjD,IAAI;AACJ,IAAI,MAAM,KAAK,CAAC,IAAI,EAAE;AACtB,QAAQ,MAAMA,aAAE,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACjD,IAAI;AACJ;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"bundle.cjs","sources":["../lib/sync/stream/NodeRemote.js","../lib/sync/stream/NodeStreamingSyncImplementation.js","../lib/db/RemoteConnection.js","../lib/db/WorkerConnectionPool.js","../lib/db/PowerSyncDatabase.js","../lib/attachments/NodeFileSystemAdapter.js"],"sourcesContent":["import * as os from 'node:os';\nimport { AbstractRemote, DEFAULT_REMOTE_LOGGER, FetchImplementationProvider } from '@powersync/common';\nimport { EnvHttpProxyAgent, getGlobalDispatcher, ProxyAgent, WebSocket as UndiciWebSocket } from 'undici';\nexport const STREAMING_POST_TIMEOUT_MS = 30_000;\nclass NodeFetchProvider extends FetchImplementationProvider {\n getFetch() {\n return fetch.bind(globalThis);\n }\n}\nexport class NodeRemote extends AbstractRemote {\n connector;\n logger;\n wsDispatcher;\n constructor(connector, logger = DEFAULT_REMOTE_LOGGER, options) {\n const fetchDispatcher = options?.dispatcher ?? defaultFetchDispatcher();\n super(connector, logger, {\n fetchImplementation: options?.fetchImplementation ?? new NodeFetchProvider(),\n fetchOptions: {\n dispatcher: fetchDispatcher\n },\n ...(options ?? {})\n });\n this.connector = connector;\n this.logger = logger;\n this.wsDispatcher = options?.dispatcher;\n }\n createSocket(url) {\n // Create dedicated dispatcher for this WebSocket\n const baseDispatcher = this.getWebsocketDispatcher(url);\n // Create WebSocket with dedicated dispatcher\n const ws = new UndiciWebSocket(url, {\n dispatcher: baseDispatcher,\n headers: {\n 'User-Agent': this.getUserAgent()\n }\n });\n return ws;\n }\n getWebsocketDispatcher(url) {\n if (this.wsDispatcher != null) {\n return this.wsDispatcher;\n }\n const protocol = new URL(url).protocol.replace(':', '');\n const proxy = getProxyForProtocol(protocol);\n if (proxy != null) {\n return new ProxyAgent(proxy);\n }\n else {\n return getGlobalDispatcher();\n }\n }\n getUserAgent() {\n return [\n super.getUserAgent(),\n `powersync-node`,\n `node/${process.versions.node}`,\n `${os.platform()}/${os.release()}`\n ].join(' ');\n }\n}\nfunction defaultFetchDispatcher() {\n // EnvHttpProxyAgent automatically uses HTTP_PROXY, HTTPS_PROXY and NO_PROXY env vars by default.\n // We add ALL_PROXY support.\n return new EnvHttpProxyAgent({\n httpProxy: getProxyForProtocol('http'),\n httpsProxy: getProxyForProtocol('https')\n });\n}\nfunction getProxyForProtocol(protocol) {\n return (process.env[`${protocol.toLowerCase()}_proxy`] ??\n process.env[`${protocol.toUpperCase()}_PROXY`] ??\n process.env[`all_proxy`] ??\n process.env[`ALL_PROXY`]);\n}\n//# sourceMappingURL=NodeRemote.js.map","import { AbstractStreamingSyncImplementation, LockType, Mutex } from '@powersync/common';\n/**\n * Global locks which prevent multiple instances from syncing\n * concurrently.\n */\nconst LOCKS = new Map();\nexport class NodeStreamingSyncImplementation extends AbstractStreamingSyncImplementation {\n locks;\n constructor(options) {\n super(options);\n this.initLocks();\n }\n /**\n * Configures global locks on sync process\n */\n initLocks() {\n const { identifier } = this.options;\n if (identifier && LOCKS.has(identifier)) {\n this.locks = LOCKS.get(identifier);\n return;\n }\n this.locks = new Map();\n this.locks.set(LockType.CRUD, new Mutex());\n this.locks.set(LockType.SYNC, new Mutex());\n if (identifier) {\n LOCKS.set(identifier, this.locks);\n }\n }\n obtainLock(lockOptions) {\n const lock = this.locks.get(lockOptions.type);\n if (!lock) {\n throw new Error(`Lock type ${lockOptions.type} not found`);\n }\n return lock.runExclusive(async () => {\n return lockOptions.callback();\n }, lockOptions.signal);\n }\n}\n//# sourceMappingURL=NodeStreamingSyncImplementation.js.map","import { ConnectionClosedError, DBGetUtilsDefaultMixin } from '@powersync/common';\nimport { releaseProxy } from 'comlink';\n/**\n * A PowerSync database connection implemented with RPC calls to a background worker.\n */\nclass BaseRemoteConnection {\n worker;\n comlink;\n database;\n notifyWorkerClosed = new AbortController();\n constructor(worker, comlink, database) {\n this.worker = worker;\n this.comlink = comlink;\n this.database = database;\n this.worker.once('exit', (_) => {\n this.notifyWorkerClosed.abort();\n });\n }\n /**\n * Runs the inner function, but appends the stack trace where this function was called. This is useful for workers\n * because stack traces from worker errors are otherwise unrelated to the application issue that has caused them.\n */\n withRemote(inner) {\n const trace = {};\n Error.captureStackTrace(trace);\n const controller = this.notifyWorkerClosed;\n return new Promise((resolve, reject) => {\n if (controller.signal.aborted) {\n reject(new ConnectionClosedError('Called operation on closed remote'));\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 inner()\n .then((data) => completePromise(() => resolve(data)))\n .catch((e) => {\n if (e instanceof Error && e.stack) {\n e.stack += trace.stack;\n }\n return completePromise(() => reject(e));\n });\n });\n }\n executeBatch(query, params = []) {\n return this.withRemote(async () => {\n const result = await this.database.executeBatch(query, params ?? []);\n return BaseRemoteConnection.wrapQueryResult(result);\n });\n }\n execute(query, params) {\n return this.withRemote(async () => {\n const result = await this.database.execute(query, params ?? []);\n return BaseRemoteConnection.wrapQueryResult(result);\n });\n }\n executeRaw(query, params) {\n return this.withRemote(async () => {\n return await this.database.executeRaw(query, params ?? []);\n });\n }\n async refreshSchema() {\n await this.execute(\"pragma table_info('sqlite_master')\");\n }\n async close() {\n await this.database.close();\n this.database[releaseProxy]();\n this.comlink[releaseProxy]();\n await this.worker.terminate();\n }\n static wrapQueryResult(result) {\n let rows = undefined;\n if (result.rows) {\n rows = {\n ...result.rows,\n item: (idx) => result.rows?._array[idx]\n };\n }\n return {\n ...result,\n rows\n };\n }\n}\nexport class RemoteConnection extends DBGetUtilsDefaultMixin(BaseRemoteConnection) {\n}\n//# sourceMappingURL=RemoteConnection.js.map","import * as Comlink from 'comlink';\nimport fs from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { Worker } from 'node:worker_threads';\nimport { BaseObserver, DBAdapterDefaultMixin, Semaphore, timeoutSignal } from '@powersync/common';\nimport { isBundledToCommonJs } from '../utils/modules.js';\nimport { RemoteConnection } from './RemoteConnection.js';\nconst READ_CONNECTIONS = 5;\nconst defaultDatabaseImplementation = {\n type: 'better-sqlite3'\n};\n/**\n * Adapter for better-sqlite3\n */\nexport class WorkerConnectionPool extends BaseObserver {\n options;\n name;\n writeConnection;\n readConnections;\n constructor(options) {\n super();\n if (options.readWorkerCount != null && options.readWorkerCount < 1) {\n throw `Needs at least one worker for reads, got ${options.readWorkerCount}`;\n }\n this.options = options;\n this.name = options.dbFilename;\n }\n async initialize() {\n let dbFilePath = this.options.dbFilename;\n if (this.options.dbLocation !== undefined) {\n // Make sure the dbLocation exists, we get a TypeError from better-sqlite3 otherwise.\n let directoryExists = false;\n try {\n const stat = await fs.stat(this.options.dbLocation);\n directoryExists = stat.isDirectory();\n }\n catch (_) {\n // If we can't even stat, the directory won't be accessible to SQLite either.\n }\n if (!directoryExists) {\n throw new Error(`The dbLocation directory at \"${this.options.dbLocation}\" does not exist. Please create it before opening the PowerSync database!`);\n }\n dbFilePath = path.join(this.options.dbLocation, dbFilePath);\n }\n const openWorker = async (isWriter) => {\n const isCommonJsModule = isBundledToCommonJs;\n let worker;\n const workerName = isWriter ? `write ${dbFilePath}` : `read ${dbFilePath}`;\n const workerFactory = this.options.openWorker ?? ((...args) => new Worker(...args));\n if (isCommonJsModule) {\n worker = workerFactory(path.resolve(__dirname, 'DefaultWorker.cjs'), { name: workerName });\n }\n else {\n worker = workerFactory(new URL('./DefaultWorker.js', import.meta.url), { name: workerName });\n }\n const listeners = new WeakMap();\n const comlink = Comlink.wrap({\n postMessage: worker.postMessage.bind(worker),\n addEventListener: (type, listener) => {\n let resolved = 'handleEvent' in listener ? listener.handleEvent.bind(listener) : listener;\n // Comlink wants message events, but the message event on workers in Node returns the data only.\n if (type === 'message') {\n const original = resolved;\n resolved = (data) => {\n original({ data });\n };\n }\n listeners.set(listener, resolved);\n worker.addListener(type, resolved);\n },\n removeEventListener: (type, listener) => {\n const resolved = listeners.get(listener);\n if (!resolved) {\n return;\n }\n worker.removeListener(type, resolved);\n }\n });\n worker.once('error', (e) => {\n console.error('Unexpected PowerSync database worker error', e);\n });\n const database = (await comlink.open({\n path: dbFilePath,\n isWriter,\n implementation: this.options.implementation ?? defaultDatabaseImplementation\n }));\n if (isWriter) {\n await database.execute(\"SELECT powersync_update_hooks('install');\", []);\n }\n const connection = new RemoteConnection(worker, comlink, database);\n if (this.options.initializeConnection) {\n await this.options.initializeConnection(connection, isWriter);\n }\n if (!isWriter) {\n await connection.execute('pragma query_only = true');\n }\n else {\n // We only need to enable this on the writer connection.\n // We can get `database is locked` errors if we enable this on concurrently opening read connections.\n await connection.execute('pragma journal_mode = WAL');\n }\n return connection;\n };\n // Open the writer first to avoid multiple threads enabling WAL concurrently (causing \"database is locked\" errors).\n this.writeConnection = new Semaphore([await openWorker(true)]);\n const createWorkers = [];\n const amountOfReaders = this.options.readWorkerCount ?? READ_CONNECTIONS;\n for (let i = 0; i < amountOfReaders; i++) {\n createWorkers.push(openWorker(false));\n }\n this.readConnections = new Semaphore(await Promise.all(createWorkers));\n }\n async close() {\n const { item: writeConnection, release: returnWrite } = await this.writeConnection.requestOne();\n const { items: readers, release: returnReaders } = await this.readConnections.requestAll();\n try {\n await writeConnection.close();\n await Promise.all(readers.map((r) => r.close()));\n }\n finally {\n returnWrite();\n returnReaders();\n }\n }\n async readLock(fn, options) {\n const lease = await this.readConnections.requestOne(timeoutSignal(options?.timeoutMs));\n try {\n return await fn(lease.item);\n }\n finally {\n lease.release();\n }\n }\n async writeLock(fn, options) {\n const { item, release } = await this.writeConnection.requestOne(timeoutSignal(options?.timeoutMs));\n try {\n try {\n return await fn(item);\n }\n finally {\n const serializedUpdates = await item.executeRaw(\"SELECT powersync_update_hooks('get');\", []);\n const updates = JSON.parse(serializedUpdates[0][0]);\n if (updates.length > 0) {\n const event = {\n tables: updates,\n groupedUpdates: {},\n rawUpdates: []\n };\n this.iterateListeners((cb) => cb.tablesUpdated?.(event));\n }\n }\n }\n finally {\n release();\n }\n }\n async refreshSchema() {\n await this.writeLock((l) => l.refreshSchema());\n const { items, release } = await this.readConnections.requestAll();\n try {\n await Promise.all(items.map((c) => c.refreshSchema()));\n }\n finally {\n release();\n }\n }\n}\nexport class WorkerPoolDatabaseAdapter extends DBAdapterDefaultMixin(WorkerConnectionPool) {\n}\n//# sourceMappingURL=WorkerConnectionPool.js.map","import { AbstractPowerSyncDatabase, SqliteBucketStorage } from '@powersync/common';\nimport { NodeRemote } from '../sync/stream/NodeRemote.js';\nimport { NodeStreamingSyncImplementation } from '../sync/stream/NodeStreamingSyncImplementation.js';\nimport { WorkerPoolDatabaseAdapter } from './WorkerConnectionPool.js';\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 */\nexport class PowerSyncDatabase extends AbstractPowerSyncDatabase {\n constructor(options) {\n super(options);\n }\n async _initialize() {\n if ('initialize' in this.database) {\n await this.database.initialize();\n }\n }\n /**\n * Opens a DBAdapter using better-sqlite3 as the default SQLite open factory.\n */\n openDBAdapter(options) {\n return new WorkerPoolDatabaseAdapter(options.database);\n }\n generateBucketStorageAdapter() {\n return new SqliteBucketStorage(this.database, this.logger);\n }\n connect(connector, options) {\n return super.connect(connector, options);\n }\n generateSyncStreamImplementation(connector, options) {\n const logger = this.logger;\n const remote = new NodeRemote(connector, logger, {\n dispatcher: options.dispatcher,\n ...this.options.remoteOptions\n });\n return new NodeStreamingSyncImplementation({\n adapter: this.bucketStorageAdapter,\n remote,\n uploadCrud: async () => {\n await this.waitForReady();\n await connector.uploadData(this);\n },\n ...options,\n identifier: this.database.name,\n logger\n });\n }\n}\n//# sourceMappingURL=PowerSyncDatabase.js.map","import { promises as fs } from 'fs';\nimport * as path from 'path';\nimport { EncodingType } from '@powersync/common';\n/**\n * NodeFileSystemAdapter implements LocalStorageAdapter using Node.js filesystem.\n * Suitable for Node.js environments and Electron applications.\n */\nexport class NodeFileSystemAdapter {\n storageDirectory;\n constructor(storageDirectory = './user_data') {\n this.storageDirectory = storageDirectory;\n }\n async initialize() {\n const dir = path.resolve(this.storageDirectory);\n await fs.mkdir(dir, { recursive: true });\n }\n async clear() {\n const dir = path.resolve(this.storageDirectory);\n await fs.rmdir(dir, { recursive: true });\n }\n getLocalUri(filename) {\n return path.join(path.resolve(this.storageDirectory), filename);\n }\n async uploadFile(filePath, data, options) {\n const buffer = Buffer.from(data);\n await fs.writeFile(filePath, buffer, {\n encoding: options?.encoding\n });\n }\n async downloadFile(filePath) {\n const data = await fs.readFile(filePath);\n return new Blob([new Uint8Array(data)]);\n }\n async saveFile(filePath, data, options) {\n let buffer;\n if (typeof data === 'string') {\n buffer = Buffer.from(data, options?.encoding ?? EncodingType.Base64);\n }\n else {\n buffer = Buffer.from(data);\n }\n await fs.writeFile(filePath, buffer);\n return buffer.length;\n }\n async readFile(filePath, options) {\n const data = await fs.readFile(filePath);\n if (options?.encoding === EncodingType.Base64) {\n return Buffer.from(data.toString(), 'base64').buffer;\n }\n else {\n return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);\n }\n }\n async deleteFile(path, options) {\n await fs.unlink(path).catch((err) => {\n if (err.code !== 'ENOENT') {\n throw err;\n }\n });\n }\n async fileExists(filePath) {\n try {\n await fs.access(filePath);\n return true;\n }\n catch {\n return false;\n }\n }\n async makeDir(path) {\n await fs.mkdir(path, { recursive: true });\n }\n async rmDir(path) {\n await fs.rmdir(path, { recursive: true });\n }\n}\n//# sourceMappingURL=NodeFileSystemAdapter.js.map"],"names":["FetchImplementationProvider","AbstractRemote","DEFAULT_REMOTE_LOGGER","UndiciWebSocket","ProxyAgent","getGlobalDispatcher","os","EnvHttpProxyAgent","AbstractStreamingSyncImplementation","LockType","Mutex","ConnectionClosedError","releaseProxy","DBGetUtilsDefaultMixin","BaseObserver","path","Worker","Comlink","Semaphore","timeoutSignal","DBAdapterDefaultMixin","AbstractPowerSyncDatabase","SqliteBucketStorage","fs","EncodingType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAM,iBAAiB,SAASA,kCAA2B,CAAC;AAC5D,IAAI,QAAQ,GAAG;AACf,QAAQ,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;AACrC,IAAI;AACJ;AACO,MAAM,UAAU,SAASC,qBAAc,CAAC;AAC/C,IAAI,SAAS;AACb,IAAI,MAAM;AACV,IAAI,YAAY;AAChB,IAAI,WAAW,CAAC,SAAS,EAAE,MAAM,GAAGC,4BAAqB,EAAE,OAAO,EAAE;AACpE,QAAQ,MAAM,eAAe,GAAG,OAAO,EAAE,UAAU,IAAI,sBAAsB,EAAE;AAC/E,QAAQ,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE;AACjC,YAAY,mBAAmB,EAAE,OAAO,EAAE,mBAAmB,IAAI,IAAI,iBAAiB,EAAE;AACxF,YAAY,YAAY,EAAE;AAC1B,gBAAgB,UAAU,EAAE;AAC5B,aAAa;AACb,YAAY,IAAI,OAAO,IAAI,EAAE;AAC7B,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ACvB,QAAQ;AACR,QAAQ,MAAM;AACd,YAAY,OAAO,KAAK;AACxB,QAAQ;AACR,IAAI;AACJ,IAAI,MAAM,OAAO,CAAC,IAAI,EAAE;AACxB,QAAQ,MAAMA,aAAE,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACjD,IAAI;AACJ,IAAI,MAAM,KAAK,CAAC,IAAI,EAAE;AACtB,QAAQ,MAAMA,aAAE,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACjD,IAAI;AACJ;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ILogger, AbstractRemote, AbstractRemoteOptions,
|
|
1
|
+
import { type ILogger, AbstractRemote, AbstractRemoteOptions, RemoteConnector } from '@powersync/common';
|
|
2
2
|
import { Dispatcher } from 'undici';
|
|
3
3
|
export declare const STREAMING_POST_TIMEOUT_MS = 30000;
|
|
4
4
|
export type NodeCustomConnectionOptions = {
|
|
@@ -19,5 +19,4 @@ export declare class NodeRemote extends AbstractRemote {
|
|
|
19
19
|
protected createSocket(url: string): globalThis.WebSocket;
|
|
20
20
|
protected getWebsocketDispatcher(url: string): Dispatcher;
|
|
21
21
|
getUserAgent(): string;
|
|
22
|
-
getBSON(): Promise<BSONImplementation>;
|
|
23
22
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as os from 'node:os';
|
|
2
2
|
import { AbstractRemote, DEFAULT_REMOTE_LOGGER, FetchImplementationProvider } from '@powersync/common';
|
|
3
|
-
import { BSON } from 'bson';
|
|
4
3
|
import { EnvHttpProxyAgent, getGlobalDispatcher, ProxyAgent, WebSocket as UndiciWebSocket } from 'undici';
|
|
5
4
|
export const STREAMING_POST_TIMEOUT_MS = 30_000;
|
|
6
5
|
class NodeFetchProvider extends FetchImplementationProvider {
|
|
@@ -58,9 +57,6 @@ export class NodeRemote extends AbstractRemote {
|
|
|
58
57
|
`${os.platform()}/${os.release()}`
|
|
59
58
|
].join(' ');
|
|
60
59
|
}
|
|
61
|
-
async getBSON() {
|
|
62
|
-
return BSON;
|
|
63
|
-
}
|
|
64
60
|
}
|
|
65
61
|
function defaultFetchDispatcher() {
|
|
66
62
|
// EnvHttpProxyAgent automatically uses HTTP_PROXY, HTTPS_PROXY and NO_PROXY env vars by default.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeRemote.js","sourceRoot":"","sources":["../../../src/sync/stream/NodeRemote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAEL,cAAc,
|
|
1
|
+
{"version":3,"file":"NodeRemote.js","sourceRoot":"","sources":["../../../src/sync/stream/NodeRemote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAEL,cAAc,EAEd,qBAAqB,EAErB,2BAA2B,EAE5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAc,iBAAiB,EAAE,mBAAmB,EAAE,UAAU,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEtH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEhD,MAAM,iBAAkB,SAAQ,2BAA2B;IACzD,QAAQ;QACN,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;CACF;AAcD,MAAM,OAAO,UAAW,SAAQ,cAAc;IAIhC;IACA;IAJJ,YAAY,CAAyB;IAE7C,YACY,SAA0B,EAC1B,SAAkB,qBAAqB,EACjD,OAAoC;QAEpC,MAAM,eAAe,GAAG,OAAO,EAAE,UAAU,IAAI,sBAAsB,EAAE,CAAC;QAExE,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE;YACvB,mBAAmB,EAAE,OAAO,EAAE,mBAAmB,IAAI,IAAI,iBAAiB,EAAE;YAC5E,YAAY,EAAE;gB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GAAG,CAAC,CAAC;IACd,CAAC;CACF;AAED,SAAS,sBAAsB;IAC7B,iGAAiG;IACjG,4BAA4B;IAC5B,OAAO,IAAI,iBAAiB,CAAC;QAC3B,SAAS,EAAE,mBAAmB,CAAC,MAAM,CAAC;QACtC,UAAU,EAAE,mBAAmB,CAAC,OAAO,CAAC;KACzC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,mBAAmB,CAAC,QAAgB;IAC3C,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CACzB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/node",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260504100448",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://docs.powersync.com/",
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@powersync/common": "0.0.0-dev-
|
|
51
|
+
"@powersync/common": "0.0.0-dev-20260504100448",
|
|
52
52
|
"better-sqlite3": "12.x"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
@@ -57,14 +57,14 @@
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"bson": "^6.10.4",
|
|
61
60
|
"comlink": "^4.4.2",
|
|
62
61
|
"undici": "^7.11.0",
|
|
63
|
-
"@powersync/common": "0.0.0-dev-
|
|
62
|
+
"@powersync/common": "0.0.0-dev-20260504100448"
|
|
64
63
|
},
|
|
65
64
|
"devDependencies": {
|
|
66
65
|
"@types/node": "^24.0.0",
|
|
67
66
|
"better-sqlite3": "^12.2.0",
|
|
67
|
+
"bson": "^6.10.4",
|
|
68
68
|
"drizzle-orm": "^0.44.7",
|
|
69
69
|
"js-logger": "^1.6.1",
|
|
70
70
|
"rollup": "^4.52.5",
|
|
@@ -4,21 +4,12 @@ import {
|
|
|
4
4
|
type ILogger,
|
|
5
5
|
AbstractRemote,
|
|
6
6
|
AbstractRemoteOptions,
|
|
7
|
-
BSONImplementation,
|
|
8
7
|
DEFAULT_REMOTE_LOGGER,
|
|
9
8
|
FetchImplementation,
|
|
10
9
|
FetchImplementationProvider,
|
|
11
10
|
RemoteConnector
|
|
12
11
|
} from '@powersync/common';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
Dispatcher,
|
|
16
|
-
EnvHttpProxyAgent,
|
|
17
|
-
ErrorEvent,
|
|
18
|
-
getGlobalDispatcher,
|
|
19
|
-
ProxyAgent,
|
|
20
|
-
WebSocket as UndiciWebSocket
|
|
21
|
-
} from 'undici';
|
|
12
|
+
import { Dispatcher, EnvHttpProxyAgent, getGlobalDispatcher, ProxyAgent, WebSocket as UndiciWebSocket } from 'undici';
|
|
22
13
|
|
|
23
14
|
export const STREAMING_POST_TIMEOUT_MS = 30_000;
|
|
24
15
|
|
|
@@ -98,10 +89,6 @@ export class NodeRemote extends AbstractRemote {
|
|
|
98
89
|
`${os.platform()}/${os.release()}`
|
|
99
90
|
].join(' ');
|
|
100
91
|
}
|
|
101
|
-
|
|
102
|
-
async getBSON(): Promise<BSONImplementation> {
|
|
103
|
-
return BSON;
|
|
104
|
-
}
|
|
105
92
|
}
|
|
106
93
|
|
|
107
94
|
function defaultFetchDispatcher(): Dispatcher {
|