@powersync/react-native 1.16.2 → 1.17.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.
@@ -1,4 +1,4 @@
1
- import { AbstractPowerSyncDatabase, AbstractStreamingSyncImplementation, BucketStorageAdapter, DBAdapter, PowerSyncBackendConnector, PowerSyncDatabaseOptionsWithSettings } from '@powersync/common';
1
+ import { AbstractPowerSyncDatabase, AbstractStreamingSyncImplementation, BucketStorageAdapter, DBAdapter, PowerSyncBackendConnector, PowerSyncDatabaseOptionsWithSettings, type RequiredAdditionalConnectionOptions } from '@powersync/common';
2
2
  /**
3
3
  * A PowerSync database which provides SQLite functionality
4
4
  * which is automatically synced.
@@ -21,5 +21,7 @@ export declare class PowerSyncDatabase extends AbstractPowerSyncDatabase {
21
21
  */
22
22
  protected openDBAdapter(options: PowerSyncDatabaseOptionsWithSettings): DBAdapter;
23
23
  protected generateBucketStorageAdapter(): BucketStorageAdapter;
24
- protected generateSyncStreamImplementation(connector: PowerSyncBackendConnector): AbstractStreamingSyncImplementation;
24
+ protected generateSyncStreamImplementation(connector: PowerSyncBackendConnector, options: RequiredAdditionalConnectionOptions): AbstractStreamingSyncImplementation;
25
+ readLock<T>(callback: (db: DBAdapter) => Promise<T>): Promise<T>;
26
+ writeLock<T>(callback: (db: DBAdapter) => Promise<T>): Promise<T>;
25
27
  }
@@ -29,7 +29,7 @@ export class PowerSyncDatabase extends AbstractPowerSyncDatabase {
29
29
  generateBucketStorageAdapter() {
30
30
  return new SqliteBucketStorage(this.database, AbstractPowerSyncDatabase.transactionMutex);
31
31
  }
32
- generateSyncStreamImplementation(connector) {
32
+ generateSyncStreamImplementation(connector, options) {
33
33
  const remote = new ReactNativeRemote(connector);
34
34
  return new ReactNativeStreamingSyncImplementation({
35
35
  adapter: this.bucketStorageAdapter,
@@ -38,9 +38,17 @@ export class PowerSyncDatabase extends AbstractPowerSyncDatabase {
38
38
  await this.waitForReady();
39
39
  await connector.uploadData(this);
40
40
  },
41
- retryDelayMs: this.options.retryDelay,
42
- crudUploadThrottleMs: this.options.crudUploadThrottleMs,
41
+ retryDelayMs: options.retryDelayMs,
42
+ crudUploadThrottleMs: options.crudUploadThrottleMs,
43
43
  identifier: this.database.name
44
44
  });
45
45
  }
46
+ async readLock(callback) {
47
+ await this.waitForReady();
48
+ return this.database.readLock(callback);
49
+ }
50
+ async writeLock(callback) {
51
+ await this.waitForReady();
52
+ return this.database.writeLock(callback);
53
+ }
46
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/react-native",
3
- "version": "1.16.2",
3
+ "version": "1.17.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "homepage": "https://docs.powersync.com/",
26
26
  "peerDependencies": {
27
- "@journeyapps/react-native-quick-sqlite": "^2.2.0",
28
- "@powersync/common": "^1.22.1",
27
+ "@journeyapps/react-native-quick-sqlite": "^2.3.0",
28
+ "@powersync/common": "^1.23.0",
29
29
  "react": "*",
30
30
  "react-native": "*"
31
31
  },
@@ -35,12 +35,12 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@powersync/common": "1.22.1",
38
+ "@powersync/common": "1.23.0",
39
39
  "@powersync/react": "1.5.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@craftzdog/react-native-buffer": "^6.0.5",
43
- "@journeyapps/react-native-quick-sqlite": "^2.2.0",
43
+ "@journeyapps/react-native-quick-sqlite": "^2.3.0",
44
44
  "@rollup/plugin-alias": "^5.1.0",
45
45
  "@rollup/plugin-commonjs": "^25.0.7",
46
46
  "@rollup/plugin-inject": "^5.0.5",
@@ -69,7 +69,7 @@
69
69
  "scripts": {
70
70
  "build": "tsc -b && rollup -c rollup.config.mjs",
71
71
  "build:prod": "tsc -b --sourceMap false && rollup -c rollup.config.mjs --sourceMap false",
72
- "clean": "rm -rf lib dist tsconfig.tsbuildinfo dist",
72
+ "clean": "rm -rf lib dist tsconfig.tsbuildinfo dist node_modules",
73
73
  "watch": "tsc -b -w"
74
74
  }
75
75
  }