@powersync/web 1.13.0 → 1.14.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.
package/dist/index.umd.js CHANGED
@@ -33585,10 +33585,12 @@ class PowerSyncDatabase extends _powersync_common__WEBPACK_IMPORTED_MODULE_0__.A
33585
33585
  }
33586
33586
  return (0,_shared_navigator__WEBPACK_IMPORTED_MODULE_2__.getNavigatorLocks)().request(`lock-${this.database.name}`, cb);
33587
33587
  }
33588
- generateSyncStreamImplementation(connector) {
33588
+ generateSyncStreamImplementation(connector, options) {
33589
33589
  const remote = new _sync_WebRemote__WEBPACK_IMPORTED_MODULE_7__.WebRemote(connector);
33590
33590
  const syncOptions = {
33591
33591
  ...this.options,
33592
+ retryDelayMs: options.retryDelayMs,
33593
+ crudUploadThrottleMs: options.crudUploadThrottleMs,
33592
33594
  flags: this.resolvedFlags,
33593
33595
  adapter: this.bucketStorageAdapter,
33594
33596
  remote,
@@ -34336,6 +34338,7 @@ class WASqliteConnection extends _powersync_common__WEBPACK_IMPORTED_MODULE_1__.
34336
34338
  await this.openDB();
34337
34339
  this.registerBroadcastListeners();
34338
34340
  await this.executeSingleStatement(`PRAGMA temp_store = ${this.options.temporaryStorage};`);
34341
+ await this.executeSingleStatement(`PRAGMA cache_size = -${this.options.cacheSizeKb};`);
34339
34342
  await this.executeEncryptionPragma();
34340
34343
  this.sqliteAPI.update_hook(this.dbP, (updateType, dbName, tableName) => {
34341
34344
  if (!tableName) {
@@ -34529,7 +34532,7 @@ class WASQLiteDBAdapter extends _LockedAsyncDatabaseAdapter__WEBPACK_IMPORTED_MO
34529
34532
  super({
34530
34533
  name: options.dbFilename,
34531
34534
  openConnection: async () => {
34532
- const { workerPort, temporaryStorage } = options;
34535
+ const { workerPort, temporaryStorage, cacheSizeKb } = options;
34533
34536
  if (workerPort) {
34534
34537
  const remote = comlink__WEBPACK_IMPORTED_MODULE_0__.wrap(workerPort);
34535
34538
  return new _WorkerWrappedAsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_4__.WorkerWrappedAsyncDatabaseConnection({
@@ -34538,6 +34541,7 @@ class WASQLiteDBAdapter extends _LockedAsyncDatabaseAdapter__WEBPACK_IMPORTED_MO
34538
34541
  baseConnection: await remote({
34539
34542
  ...options,
34540
34543
  temporaryStorage: temporaryStorage ?? _web_sql_flags__WEBPACK_IMPORTED_MODULE_3__.TemporaryStorageOption.MEMORY,
34544
+ cacheSizeKb: cacheSizeKb ?? _web_sql_flags__WEBPACK_IMPORTED_MODULE_3__.DEFAULT_CACHE_SIZE_KB,
34541
34545
  flags: (0,_PowerSyncDatabase__WEBPACK_IMPORTED_MODULE_1__.resolveWebPowerSyncFlags)(options.flags),
34542
34546
  encryptionKey: options.encryptionKey
34543
34547
  })
@@ -34549,6 +34553,7 @@ class WASQLiteDBAdapter extends _LockedAsyncDatabaseAdapter__WEBPACK_IMPORTED_MO
34549
34553
  debugMode: options.debugMode,
34550
34554
  flags: options.flags,
34551
34555
  temporaryStorage,
34556
+ cacheSizeKb,
34552
34557
  logger: options.logger,
34553
34558
  vfs: options.vfs,
34554
34559
  encryptionKey: options.encryptionKey,
@@ -34613,7 +34618,7 @@ class WASQLiteOpenFactory extends _AbstractWebSQLOpenFactory__WEBPACK_IMPORTED_M
34613
34618
  }
34614
34619
  async openConnection() {
34615
34620
  const { enableMultiTabs, useWebWorker } = this.resolvedFlags;
34616
- const { vfs = _WASQLiteConnection__WEBPACK_IMPORTED_MODULE_6__.WASQLiteVFS.IDBBatchAtomicVFS, temporaryStorage = _web_sql_flags__WEBPACK_IMPORTED_MODULE_4__.TemporaryStorageOption.MEMORY, encryptionKey } = this.waOptions;
34621
+ const { vfs = _WASQLiteConnection__WEBPACK_IMPORTED_MODULE_6__.WASQLiteVFS.IDBBatchAtomicVFS, temporaryStorage = _web_sql_flags__WEBPACK_IMPORTED_MODULE_4__.TemporaryStorageOption.MEMORY, cacheSizeKb = _web_sql_flags__WEBPACK_IMPORTED_MODULE_4__.DEFAULT_CACHE_SIZE_KB, encryptionKey } = this.waOptions;
34617
34622
  if (!enableMultiTabs) {
34618
34623
  this.logger.warn('Multiple tabs are not enabled in this browser');
34619
34624
  }
@@ -34623,6 +34628,7 @@ class WASQLiteOpenFactory extends _AbstractWebSQLOpenFactory__WEBPACK_IMPORTED_M
34623
34628
  ? (0,_worker_db_open_worker_database__WEBPACK_IMPORTED_MODULE_1__.resolveWorkerDatabasePortFactory)(() => optionsDbWorker({
34624
34629
  ...this.options,
34625
34630
  temporaryStorage,
34631
+ cacheSizeKb,
34626
34632
  flags: this.resolvedFlags,
34627
34633
  encryptionKey
34628
34634
  }))
@@ -34634,6 +34640,7 @@ class WASQLiteOpenFactory extends _AbstractWebSQLOpenFactory__WEBPACK_IMPORTED_M
34634
34640
  dbFilename: this.options.dbFilename,
34635
34641
  vfs,
34636
34642
  temporaryStorage,
34643
+ cacheSizeKb,
34637
34644
  flags: this.resolvedFlags,
34638
34645
  encryptionKey: encryptionKey
34639
34646
  }),
@@ -34656,6 +34663,7 @@ class WASQLiteOpenFactory extends _AbstractWebSQLOpenFactory__WEBPACK_IMPORTED_M
34656
34663
  debugMode: this.options.debugMode,
34657
34664
  vfs,
34658
34665
  temporaryStorage,
34666
+ cacheSizeKb,
34659
34667
  flags: this.resolvedFlags,
34660
34668
  encryptionKey: encryptionKey
34661
34669
  });
@@ -34726,6 +34734,7 @@ class WASQLitePowerSyncDatabaseOpenFactory extends _AbstractWebPowerSyncDatabase
34726
34734
  "use strict";
34727
34735
  __webpack_require__.r(__webpack_exports__);
34728
34736
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
34737
+ /* harmony export */ DEFAULT_CACHE_SIZE_KB: () => (/* binding */ DEFAULT_CACHE_SIZE_KB),
34729
34738
  /* harmony export */ DEFAULT_WEB_SQL_FLAGS: () => (/* binding */ DEFAULT_WEB_SQL_FLAGS),
34730
34739
  /* harmony export */ TemporaryStorageOption: () => (/* binding */ TemporaryStorageOption),
34731
34740
  /* harmony export */ isServerSide: () => (/* binding */ isServerSide),
@@ -34736,6 +34745,7 @@ var TemporaryStorageOption;
34736
34745
  TemporaryStorageOption["MEMORY"] = "memory";
34737
34746
  TemporaryStorageOption["FILESYSTEM"] = "file";
34738
34747
  })(TemporaryStorageOption || (TemporaryStorageOption = {}));
34748
+ const DEFAULT_CACHE_SIZE_KB = 50 * 1024;
34739
34749
  function isServerSide() {
34740
34750
  return typeof window == 'undefined';
34741
34751
  }
@@ -34949,10 +34959,10 @@ class SharedWebStreamingSyncImplementation extends _WebStreamingSyncImplementati
34949
34959
  * This worker will manage all syncing operations remotely.
34950
34960
  */
34951
34961
  const resolvedWorkerOptions = {
34952
- ...options,
34953
34962
  dbFilename: this.options.identifier,
34954
- // TODO
34955
34963
  temporaryStorage: _adapters_web_sql_flags__WEBPACK_IMPORTED_MODULE_3__.TemporaryStorageOption.MEMORY,
34964
+ cacheSizeKb: _adapters_web_sql_flags__WEBPACK_IMPORTED_MODULE_3__.DEFAULT_CACHE_SIZE_KB,
34965
+ ...options,
34956
34966
  flags: (0,_adapters_web_sql_flags__WEBPACK_IMPORTED_MODULE_3__.resolveWebSQLFlags)(options.flags)
34957
34967
  };
34958
34968
  const syncWorker = options.sync?.worker;
@@ -43414,6 +43424,7 @@ __webpack_require__.r(__webpack_exports__);
43414
43424
  /* harmony export */ AbstractWebPowerSyncDatabaseOpenFactory: () => (/* reexport safe */ _db_adapters_AbstractWebPowerSyncDatabaseOpenFactory__WEBPACK_IMPORTED_MODULE_1__.AbstractWebPowerSyncDatabaseOpenFactory),
43415
43425
  /* harmony export */ AbstractWebSQLOpenFactory: () => (/* reexport safe */ _db_adapters_AbstractWebSQLOpenFactory__WEBPACK_IMPORTED_MODULE_2__.AbstractWebSQLOpenFactory),
43416
43426
  /* harmony export */ AsyncWASQLiteModuleFactory: () => (/* reexport safe */ _db_adapters_wa_sqlite_WASQLiteConnection__WEBPACK_IMPORTED_MODULE_3__.AsyncWASQLiteModuleFactory),
43427
+ /* harmony export */ DEFAULT_CACHE_SIZE_KB: () => (/* reexport safe */ _db_adapters_web_sql_flags__WEBPACK_IMPORTED_MODULE_7__.DEFAULT_CACHE_SIZE_KB),
43417
43428
  /* harmony export */ DEFAULT_MODULE_FACTORIES: () => (/* reexport safe */ _db_adapters_wa_sqlite_WASQLiteConnection__WEBPACK_IMPORTED_MODULE_3__.DEFAULT_MODULE_FACTORIES),
43418
43429
  /* harmony export */ DEFAULT_POWERSYNC_FLAGS: () => (/* reexport safe */ _db_PowerSyncDatabase__WEBPACK_IMPORTED_MODULE_8__.DEFAULT_POWERSYNC_FLAGS),
43419
43430
  /* harmony export */ DEFAULT_WEB_SQL_FLAGS: () => (/* reexport safe */ _db_adapters_web_sql_flags__WEBPACK_IMPORTED_MODULE_7__.DEFAULT_WEB_SQL_FLAGS),