@powersync/node 0.18.8 → 0.19.1

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 (57) hide show
  1. package/lib/attachments/NodeFileSystemAdapter.d.ts +1 -0
  2. package/lib/attachments/NodeFileSystemAdapter.d.ts.map +1 -0
  3. package/lib/db/AsyncDatabase.d.ts +1 -0
  4. package/lib/db/AsyncDatabase.d.ts.map +1 -0
  5. package/lib/db/BetterSqliteWorker.d.ts +1 -0
  6. package/lib/db/BetterSqliteWorker.d.ts.map +1 -0
  7. package/lib/db/DefaultWorker.d.ts +1 -0
  8. package/lib/db/DefaultWorker.d.ts.map +1 -0
  9. package/lib/db/NodeSqliteWorker.d.ts +1 -0
  10. package/lib/db/NodeSqliteWorker.d.ts.map +1 -0
  11. package/lib/db/NodeSqliteWorker.js +2 -2
  12. package/lib/db/NodeSqliteWorker.js.map +1 -1
  13. package/lib/db/PowerSyncDatabase.d.ts +1 -0
  14. package/lib/db/PowerSyncDatabase.d.ts.map +1 -0
  15. package/lib/db/RemoteConnection.d.ts +1 -0
  16. package/lib/db/RemoteConnection.d.ts.map +1 -0
  17. package/lib/db/SqliteWorker.d.ts +1 -0
  18. package/lib/db/SqliteWorker.d.ts.map +1 -0
  19. package/lib/db/SqliteWorker.js +3 -13
  20. package/lib/db/SqliteWorker.js.map +1 -1
  21. package/lib/db/WorkerConnectionPool.d.ts +1 -0
  22. package/lib/db/WorkerConnectionPool.d.ts.map +1 -0
  23. package/lib/db/WorkerConnectionPool.js +1 -9
  24. package/lib/db/WorkerConnectionPool.js.map +1 -1
  25. package/lib/db/options.d.ts +1 -0
  26. package/lib/db/options.d.ts.map +1 -0
  27. package/lib/index.d.ts +2 -0
  28. package/lib/index.d.ts.map +1 -0
  29. package/lib/index.js +1 -0
  30. package/lib/index.js.map +1 -1
  31. package/lib/sync/stream/NodeRemote.d.ts +1 -0
  32. package/lib/sync/stream/NodeRemote.d.ts.map +1 -0
  33. package/lib/sync/stream/NodeStreamingSyncImplementation.d.ts +1 -0
  34. package/lib/sync/stream/NodeStreamingSyncImplementation.d.ts.map +1 -0
  35. package/lib/worker.d.ts +1 -0
  36. package/lib/worker.d.ts.map +1 -0
  37. package/package.json +13 -25
  38. package/src/db/NodeSqliteWorker.ts +2 -2
  39. package/src/db/SqliteWorker.ts +3 -13
  40. package/src/db/WorkerConnectionPool.ts +1 -8
  41. package/src/index.ts +2 -1
  42. package/dist/DefaultWorker.cjs +0 -232
  43. package/dist/DefaultWorker.cjs.map +0 -1
  44. package/dist/bundle.cjs +0 -531
  45. package/dist/bundle.cjs.map +0 -1
  46. package/dist/bundle.d.cts +0 -127
  47. package/dist/worker.cjs +0 -233
  48. package/dist/worker.cjs.map +0 -1
  49. package/dist/worker.d.cts +0 -20
  50. package/lib/utils/modules.d.ts +0 -2
  51. package/lib/utils/modules.js +0 -6
  52. package/lib/utils/modules.js.map +0 -1
  53. package/lib/utils/modules_commonjs.d.ts +0 -2
  54. package/lib/utils/modules_commonjs.js +0 -7
  55. package/lib/utils/modules_commonjs.js.map +0 -1
  56. package/src/utils/modules.ts +0 -6
  57. package/src/utils/modules_commonjs.ts +0 -7
package/dist/bundle.cjs DELETED
@@ -1,531 +0,0 @@
1
- 'use strict';
2
-
3
- var common = require('@powersync/common');
4
- var os = require('node:os');
5
- var undici = require('undici');
6
- var Comlink = require('comlink');
7
- var fs = require('node:fs/promises');
8
- var path = require('node:path');
9
- var node_worker_threads = require('node:worker_threads');
10
- var fs$1 = require('fs');
11
- var path$1 = require('path');
12
-
13
- function _interopNamespaceDefault(e) {
14
- var n = Object.create(null);
15
- if (e) {
16
- Object.keys(e).forEach(function (k) {
17
- if (k !== 'default') {
18
- var d = Object.getOwnPropertyDescriptor(e, k);
19
- Object.defineProperty(n, k, d.get ? d : {
20
- enumerable: true,
21
- get: function () { return e[k]; }
22
- });
23
- }
24
- });
25
- }
26
- n.default = e;
27
- return Object.freeze(n);
28
- }
29
-
30
- var os__namespace = /*#__PURE__*/_interopNamespaceDefault(os);
31
- var Comlink__namespace = /*#__PURE__*/_interopNamespaceDefault(Comlink);
32
- var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
33
- var path__namespace$1 = /*#__PURE__*/_interopNamespaceDefault(path$1);
34
-
35
- class NodeFetchProvider extends common.FetchImplementationProvider {
36
- getFetch() {
37
- return fetch.bind(globalThis);
38
- }
39
- }
40
- class NodeRemote extends common.AbstractRemote {
41
- connector;
42
- logger;
43
- wsDispatcher;
44
- constructor(connector, logger = common.DEFAULT_REMOTE_LOGGER, options) {
45
- const fetchDispatcher = options?.dispatcher ?? defaultFetchDispatcher();
46
- super(connector, logger, {
47
- fetchImplementation: options?.fetchImplementation ?? new NodeFetchProvider(),
48
- fetchOptions: {
49
- dispatcher: fetchDispatcher
50
- },
51
- ...(options ?? {})
52
- });
53
- this.connector = connector;
54
- this.logger = logger;
55
- this.wsDispatcher = options?.dispatcher;
56
- }
57
- createSocket(url) {
58
- // Create dedicated dispatcher for this WebSocket
59
- const baseDispatcher = this.getWebsocketDispatcher(url);
60
- // Create WebSocket with dedicated dispatcher
61
- const ws = new undici.WebSocket(url, {
62
- dispatcher: baseDispatcher,
63
- headers: {
64
- 'User-Agent': this.getUserAgent()
65
- }
66
- });
67
- return ws;
68
- }
69
- getWebsocketDispatcher(url) {
70
- if (this.wsDispatcher != null) {
71
- return this.wsDispatcher;
72
- }
73
- const protocol = new URL(url).protocol.replace(':', '');
74
- const proxy = getProxyForProtocol(protocol);
75
- if (proxy != null) {
76
- return new undici.ProxyAgent(proxy);
77
- }
78
- else {
79
- return undici.getGlobalDispatcher();
80
- }
81
- }
82
- getUserAgent() {
83
- return [
84
- super.getUserAgent(),
85
- `powersync-node`,
86
- `node/${process.versions.node}`,
87
- `${os__namespace.platform()}/${os__namespace.release()}`
88
- ].join(' ');
89
- }
90
- }
91
- function defaultFetchDispatcher() {
92
- // EnvHttpProxyAgent automatically uses HTTP_PROXY, HTTPS_PROXY and NO_PROXY env vars by default.
93
- // We add ALL_PROXY support.
94
- return new undici.EnvHttpProxyAgent({
95
- httpProxy: getProxyForProtocol('http'),
96
- httpsProxy: getProxyForProtocol('https')
97
- });
98
- }
99
- function getProxyForProtocol(protocol) {
100
- return (process.env[`${protocol.toLowerCase()}_proxy`] ??
101
- process.env[`${protocol.toUpperCase()}_PROXY`] ??
102
- process.env[`all_proxy`] ??
103
- process.env[`ALL_PROXY`]);
104
- }
105
-
106
- /**
107
- * Global locks which prevent multiple instances from syncing
108
- * concurrently.
109
- */
110
- const LOCKS = new Map();
111
- class NodeStreamingSyncImplementation extends common.AbstractStreamingSyncImplementation {
112
- locks; // initialized by initLocks()
113
- constructor(options) {
114
- super(options);
115
- this.initLocks();
116
- }
117
- /**
118
- * Configures global locks on sync process
119
- */
120
- initLocks() {
121
- const { identifier } = this.options;
122
- if (identifier && LOCKS.has(identifier)) {
123
- this.locks = LOCKS.get(identifier);
124
- return;
125
- }
126
- this.locks = new Map();
127
- this.locks.set(common.LockType.CRUD, new common.Mutex());
128
- this.locks.set(common.LockType.SYNC, new common.Mutex());
129
- if (identifier) {
130
- LOCKS.set(identifier, this.locks);
131
- }
132
- }
133
- obtainLock(lockOptions) {
134
- const lock = this.locks.get(lockOptions.type);
135
- if (!lock) {
136
- throw new Error(`Lock type ${lockOptions.type} not found`);
137
- }
138
- return lock.runExclusive(async () => {
139
- return lockOptions.callback();
140
- }, lockOptions.signal);
141
- }
142
- }
143
-
144
- /**
145
- * A PowerSync database connection implemented with RPC calls to a background worker.
146
- */
147
- class BaseRemoteConnection {
148
- readonly;
149
- worker;
150
- comlink;
151
- database;
152
- notifyWorkerClosed = new AbortController();
153
- constructor(worker, comlink, database, readonly) {
154
- this.readonly = readonly;
155
- this.worker = worker;
156
- this.comlink = comlink;
157
- this.database = database;
158
- this.worker.once('exit', (_) => {
159
- this.notifyWorkerClosed.abort();
160
- });
161
- }
162
- get connectionType() {
163
- return this.readonly ? 'readOnly' : 'writer';
164
- }
165
- /**
166
- * Runs the inner function, but appends the stack trace where this function was called. This is useful for workers
167
- * because stack traces from worker errors are otherwise unrelated to the application issue that has caused them.
168
- */
169
- withRemote(inner) {
170
- const trace = {};
171
- Error.captureStackTrace(trace);
172
- const controller = this.notifyWorkerClosed;
173
- return new Promise((resolve, reject) => {
174
- if (controller.signal.aborted) {
175
- reject(new common.ConnectionClosedError('Called operation on closed remote'));
176
- }
177
- function handleAbort() {
178
- reject(new common.ConnectionClosedError('Remote peer closed with request in flight'));
179
- }
180
- function completePromise(action) {
181
- controller.signal.removeEventListener('abort', handleAbort);
182
- action();
183
- }
184
- controller.signal.addEventListener('abort', handleAbort);
185
- inner()
186
- .then((data) => completePromise(() => resolve(data)))
187
- .catch((e) => {
188
- if (e instanceof Error && e.stack) {
189
- e.stack += trace.stack;
190
- }
191
- return completePromise(() => reject(e));
192
- });
193
- });
194
- }
195
- executeBatch(query, params = []) {
196
- return this.withRemote(async () => {
197
- const result = await this.database.executeBatch(query, params ?? []);
198
- return BaseRemoteConnection.wrapQueryResult(result);
199
- });
200
- }
201
- execute(query, params) {
202
- return this.withRemote(async () => {
203
- const result = await this.database.execute(query, params ?? []);
204
- return BaseRemoteConnection.wrapQueryResult(result);
205
- });
206
- }
207
- executeRaw(query, params) {
208
- return this.withRemote(async () => {
209
- return await this.database.executeRaw(query, params ?? []);
210
- });
211
- }
212
- async refreshSchema() {
213
- await this.execute("pragma table_info('sqlite_master')");
214
- }
215
- async close() {
216
- await this.database.close();
217
- this.database[Comlink.releaseProxy]();
218
- this.comlink[Comlink.releaseProxy]();
219
- await this.worker.terminate();
220
- }
221
- static wrapQueryResult(result) {
222
- let rows = undefined;
223
- if (result.rows) {
224
- rows = {
225
- ...result.rows,
226
- item: (idx) => result.rows?._array[idx]
227
- };
228
- }
229
- return {
230
- ...result,
231
- rows
232
- };
233
- }
234
- }
235
- class RemoteConnection extends common.DBGetUtilsDefaultMixin(BaseRemoteConnection) {
236
- }
237
-
238
- const READ_CONNECTIONS = 5;
239
- const defaultDatabaseImplementation = {
240
- type: 'better-sqlite3'
241
- };
242
- /**
243
- * Adapter for better-sqlite3
244
- */
245
- class WorkerConnectionPool extends common.BaseObserver {
246
- options;
247
- name;
248
- writeConnection;
249
- readConnections;
250
- constructor(options) {
251
- super();
252
- if (options.readWorkerCount != null && options.readWorkerCount < 1) {
253
- throw `Needs at least one worker for reads, got ${options.readWorkerCount}`;
254
- }
255
- this.options = options;
256
- this.name = options.dbFilename;
257
- }
258
- async initialize() {
259
- let dbFilePath = this.options.dbFilename;
260
- if (this.options.dbLocation !== undefined) {
261
- // Make sure the dbLocation exists, we get a TypeError from better-sqlite3 otherwise.
262
- let directoryExists = false;
263
- try {
264
- const stat = await fs.stat(this.options.dbLocation);
265
- directoryExists = stat.isDirectory();
266
- }
267
- catch (_) {
268
- // If we can't even stat, the directory won't be accessible to SQLite either.
269
- }
270
- if (!directoryExists) {
271
- throw new Error(`The dbLocation directory at "${this.options.dbLocation}" does not exist. Please create it before opening the PowerSync database!`);
272
- }
273
- dbFilePath = path__namespace.join(this.options.dbLocation, dbFilePath);
274
- }
275
- const openWorker = async (isWriter) => {
276
- let worker;
277
- const workerName = isWriter ? `write ${dbFilePath}` : `read ${dbFilePath}`;
278
- const workerFactory = this.options.openWorker ?? ((...args) => new node_worker_threads.Worker(...args));
279
- {
280
- worker = workerFactory(path__namespace.resolve(__dirname, 'DefaultWorker.cjs'), { name: workerName });
281
- }
282
- const listeners = new WeakMap();
283
- const comlink = Comlink__namespace.wrap({
284
- postMessage: worker.postMessage.bind(worker),
285
- addEventListener: (type, listener) => {
286
- let resolved = 'handleEvent' in listener ? listener.handleEvent.bind(listener) : listener;
287
- // Comlink wants message events, but the message event on workers in Node returns the data only.
288
- if (type === 'message') {
289
- const original = resolved;
290
- resolved = (data) => {
291
- original({ data });
292
- };
293
- }
294
- listeners.set(listener, resolved);
295
- worker.addListener(type, resolved);
296
- },
297
- removeEventListener: (type, listener) => {
298
- const resolved = listeners.get(listener);
299
- if (!resolved) {
300
- return;
301
- }
302
- worker.removeListener(type, resolved);
303
- }
304
- });
305
- worker.once('error', (e) => {
306
- console.error('Unexpected PowerSync database worker error', e);
307
- });
308
- const database = (await comlink.open({
309
- path: dbFilePath,
310
- isWriter,
311
- implementation: this.options.implementation ?? defaultDatabaseImplementation
312
- }));
313
- if (isWriter) {
314
- await database.execute("SELECT powersync_update_hooks('install');", []);
315
- }
316
- const connection = new RemoteConnection(worker, comlink, database, !isWriter);
317
- if (this.options.initializeConnection) {
318
- await this.options.initializeConnection(connection, isWriter);
319
- }
320
- if (isWriter) {
321
- // We only need to enable this on the writer connection.
322
- // We can get `database is locked` errors if we enable this on concurrently opening read connections.
323
- await connection.execute('pragma journal_mode = WAL');
324
- }
325
- return connection;
326
- };
327
- // Open the writer first to avoid multiple threads enabling WAL concurrently (causing "database is locked" errors).
328
- this.writeConnection = new common.Semaphore([await openWorker(true)]);
329
- const createWorkers = [];
330
- const amountOfReaders = this.options.readWorkerCount ?? READ_CONNECTIONS;
331
- for (let i = 0; i < amountOfReaders; i++) {
332
- createWorkers.push(openWorker(false));
333
- }
334
- this.readConnections = new common.Semaphore(await Promise.all(createWorkers));
335
- }
336
- async close() {
337
- const { item: writeConnection, release: returnWrite } = await this.writeConnection.requestOne();
338
- const { items: readers, release: returnReaders } = await this.readConnections.requestAll();
339
- try {
340
- await writeConnection.close();
341
- await Promise.all(readers.map((r) => r.close()));
342
- }
343
- finally {
344
- returnWrite();
345
- returnReaders();
346
- }
347
- }
348
- async readLock(fn, options) {
349
- const lease = await this.readConnections.requestOne(common.timeoutSignal(options?.timeoutMs));
350
- try {
351
- return await fn(lease.item);
352
- }
353
- finally {
354
- lease.release();
355
- }
356
- }
357
- async writeLock(fn, options) {
358
- const { item, release } = await this.writeConnection.requestOne(common.timeoutSignal(options?.timeoutMs));
359
- try {
360
- try {
361
- return await fn(item);
362
- }
363
- finally {
364
- const serializedUpdates = await item.executeRaw("SELECT powersync_update_hooks('get');", []);
365
- const updates = JSON.parse(serializedUpdates[0][0]);
366
- if (updates.length > 0) {
367
- const event = {
368
- tables: updates,
369
- groupedUpdates: {},
370
- rawUpdates: []
371
- };
372
- this.iterateListeners((cb) => cb.tablesUpdated?.(event));
373
- }
374
- }
375
- }
376
- finally {
377
- release();
378
- }
379
- }
380
- async refreshSchema() {
381
- await this.writeLock((l) => l.refreshSchema());
382
- const { items, release } = await this.readConnections.requestAll();
383
- try {
384
- await Promise.all(items.map((c) => c.refreshSchema()));
385
- }
386
- finally {
387
- release();
388
- }
389
- }
390
- }
391
- class WorkerPoolDatabaseAdapter extends common.DBAdapterDefaultMixin(WorkerConnectionPool) {
392
- }
393
-
394
- /**
395
- * A PowerSync database which provides SQLite functionality
396
- * which is automatically synced.
397
- *
398
- * @example
399
- * ```typescript
400
- * export const db = new PowerSyncDatabase({
401
- * schema: AppSchema,
402
- * database: {
403
- * dbFilename: 'example.db'
404
- * }
405
- * });
406
- * ```
407
- */
408
- class PowerSyncDatabase extends common.AbstractPowerSyncDatabase {
409
- constructor(options) {
410
- super(options);
411
- }
412
- async _initialize() {
413
- if ('initialize' in this.database) {
414
- await this.database.initialize();
415
- }
416
- }
417
- /**
418
- * Opens a DBAdapter using better-sqlite3 as the default SQLite open factory.
419
- */
420
- openDBAdapter(options) {
421
- return new WorkerPoolDatabaseAdapter(options.database);
422
- }
423
- generateBucketStorageAdapter() {
424
- return new common.SqliteBucketStorage(this.database, this.logger);
425
- }
426
- connect(connector, options) {
427
- return super.connect(connector, options);
428
- }
429
- generateSyncStreamImplementation(connector, options) {
430
- const logger = this.logger;
431
- const remote = new NodeRemote(connector, logger, {
432
- dispatcher: options.dispatcher,
433
- ...this.options.remoteOptions
434
- });
435
- return new NodeStreamingSyncImplementation({
436
- adapter: this.bucketStorageAdapter,
437
- remote,
438
- uploadCrud: async () => {
439
- await this.waitForReady();
440
- await connector.uploadData(this);
441
- },
442
- ...options,
443
- identifier: this.database.name,
444
- logger
445
- });
446
- }
447
- }
448
-
449
- /**
450
- * NodeFileSystemAdapter implements LocalStorageAdapter using Node.js filesystem.
451
- * Suitable for Node.js environments and Electron applications.
452
- */
453
- class NodeFileSystemAdapter {
454
- storageDirectory;
455
- constructor(storageDirectory = './user_data') {
456
- this.storageDirectory = storageDirectory;
457
- }
458
- async initialize() {
459
- const dir = path__namespace$1.resolve(this.storageDirectory);
460
- await fs$1.promises.mkdir(dir, { recursive: true });
461
- }
462
- async clear() {
463
- const dir = path__namespace$1.resolve(this.storageDirectory);
464
- await fs$1.promises.rmdir(dir, { recursive: true });
465
- }
466
- getLocalUri(filename) {
467
- return path__namespace$1.join(path__namespace$1.resolve(this.storageDirectory), filename);
468
- }
469
- async uploadFile(filePath, data, options) {
470
- const buffer = Buffer.from(data);
471
- await fs$1.promises.writeFile(filePath, buffer, {
472
- encoding: options?.encoding
473
- });
474
- }
475
- async downloadFile(filePath) {
476
- const data = await fs$1.promises.readFile(filePath);
477
- return new Blob([new Uint8Array(data)]);
478
- }
479
- async saveFile(filePath, data, options) {
480
- let buffer;
481
- if (typeof data === 'string') {
482
- buffer = Buffer.from(data, options?.encoding ?? common.EncodingType.Base64);
483
- }
484
- else {
485
- buffer = Buffer.from(data);
486
- }
487
- await fs$1.promises.writeFile(filePath, buffer);
488
- return buffer.length;
489
- }
490
- async readFile(filePath, options) {
491
- const data = await fs$1.promises.readFile(filePath);
492
- if (options?.encoding === common.EncodingType.Base64) {
493
- return Buffer.from(data.toString(), 'base64').buffer;
494
- }
495
- else {
496
- return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
497
- }
498
- }
499
- async deleteFile(path, options) {
500
- await fs$1.promises.unlink(path).catch((err) => {
501
- if (err.code !== 'ENOENT') {
502
- throw err;
503
- }
504
- });
505
- }
506
- async fileExists(filePath) {
507
- try {
508
- await fs$1.promises.access(filePath);
509
- return true;
510
- }
511
- catch {
512
- return false;
513
- }
514
- }
515
- async makeDir(path) {
516
- await fs$1.promises.mkdir(path, { recursive: true });
517
- }
518
- async rmDir(path) {
519
- await fs$1.promises.rmdir(path, { recursive: true });
520
- }
521
- }
522
-
523
- exports.NodeFileSystemAdapter = NodeFileSystemAdapter;
524
- exports.PowerSyncDatabase = PowerSyncDatabase;
525
- Object.keys(common).forEach(function (k) {
526
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
527
- enumerable: true,
528
- get: function () { return common[k]; }
529
- });
530
- });
531
- //# sourceMappingURL=bundle.cjs.map
@@ -1 +0,0 @@
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; // initialized by initLocks()\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 readonly;\n worker;\n comlink;\n database;\n notifyWorkerClosed = new AbortController();\n constructor(worker, comlink, database, readonly) {\n this.readonly = readonly;\n this.worker = worker;\n this.comlink = comlink;\n this.database = database;\n this.worker.once('exit', (_) => {\n this.notifyWorkerClosed.abort();\n });\n }\n get connectionType() {\n return this.readonly ? 'readOnly' : 'writer';\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, !isWriter);\n if (this.options.initializeConnection) {\n await this.options.initializeConnection(connection, isWriter);\n }\n if (isWriter) {\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,SAAS,CAAC;AACV,QAAQ,IAAI,CAAC,SAAS,GAAG,SAAS;AAClC,QAAQ,IAAI,CAAC,MAAM,GAAG,MAAM;AAC5B,QAAQ,IAAI,CAAC,YAAY,GAAG,OAAO,EAAE,UAAU;AAC/C,IAAI;AACJ,IAAI,YAAY,CAAC,GAAG,EAAE;AACtB;AACA,QAAQ,MAAM,cAAc,GAAG,IAAI,CAAC,s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