@powersync/web 1.35.0 → 1.36.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/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/web",
3
- "version": "1.35.0",
3
+ "version": "1.36.0",
4
4
  "description": "PowerSync Web SDK",
5
5
  "main": "lib/src/index.js",
6
6
  "module": "lib/src/index.js",
@@ -67,7 +67,7 @@
67
67
  "license": "Apache-2.0",
68
68
  "peerDependencies": {
69
69
  "@journeyapps/wa-sqlite": "catalog:",
70
- "@powersync/common": "workspace:^1.48.0"
70
+ "@powersync/common": "workspace:^1.49.0"
71
71
  },
72
72
  "dependencies": {
73
73
  "@powersync/common": "workspace:*",
@@ -50,7 +50,8 @@ export class LockedAsyncDatabaseAdapter extends BaseObserver {
50
50
  }
51
51
  this.dbGetHelpers = this.generateDBHelpers({
52
52
  execute: (query, params) => this.acquireLock(() => this._execute(query, params)),
53
- executeRaw: (query, params) => this.acquireLock(() => this._executeRaw(query, params))
53
+ executeRaw: (query, params) => this.acquireLock(() => this._executeRaw(query, params)),
54
+ executeBatch: (query, params) => this.acquireLock(() => this._executeBatch(query, params))
54
55
  });
55
56
  this.initPromise = this._init();
56
57
  }
@@ -211,14 +212,16 @@ export class LockedAsyncDatabaseAdapter extends BaseObserver {
211
212
  return this.dbGetHelpers.get(sql, parameters);
212
213
  }
213
214
  async readLock(fn, options) {
214
- await this.waitForInitialized();
215
- return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw })), {
216
- timeoutMs: options?.timeoutMs ?? this.options.defaultLockTimeoutMs
217
- });
215
+ // Read and write locks are the same because we only have one underlying connection.
216
+ return this.writeLock(fn, options);
218
217
  }
219
218
  async writeLock(fn, options) {
220
219
  await this.waitForInitialized();
221
- return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw })), {
220
+ return this.acquireLock(async () => fn(this.generateDBHelpers({
221
+ execute: this._execute,
222
+ executeRaw: this._executeRaw,
223
+ executeBatch: this._executeBatch
224
+ })), {
222
225
  timeoutMs: options?.timeoutMs ?? this.options.defaultLockTimeoutMs
223
226
  });
224
227
  }