@powersync/react-native 0.0.0-dev-20250625140957 → 0.0.0-dev-20250710151329

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.
@@ -31,7 +31,7 @@ export class PowerSyncDatabase extends AbstractPowerSyncDatabase {
31
31
  return new ReactNativeBucketStorageAdapter(this.database, AbstractPowerSyncDatabase.transactionMutex);
32
32
  }
33
33
  generateSyncStreamImplementation(connector, options) {
34
- const remote = new ReactNativeRemote(connector);
34
+ const remote = new ReactNativeRemote(connector, this.logger);
35
35
  return new ReactNativeStreamingSyncImplementation({
36
36
  adapter: this.bucketStorageAdapter,
37
37
  remote,
@@ -41,7 +41,8 @@ export class PowerSyncDatabase extends AbstractPowerSyncDatabase {
41
41
  },
42
42
  retryDelayMs: options.retryDelayMs,
43
43
  crudUploadThrottleMs: options.crudUploadThrottleMs,
44
- identifier: this.database.name
44
+ identifier: this.database.name,
45
+ logger: this.logger
45
46
  });
46
47
  }
47
48
  async readLock(callback) {
@@ -1,4 +1,4 @@
1
1
  import { PowerSyncControlCommand, SqliteBucketStorage } from '@powersync/common';
2
2
  export declare class ReactNativeBucketStorageAdapter extends SqliteBucketStorage {
3
- control(op: PowerSyncControlCommand, payload: string | ArrayBuffer | null): Promise<string>;
3
+ control(op: PowerSyncControlCommand, payload: string | Uint8Array | ArrayBuffer | null): Promise<string>;
4
4
  }
@@ -1,11 +1,22 @@
1
1
  import { SqliteBucketStorage } from '@powersync/common';
2
2
  export class ReactNativeBucketStorageAdapter extends SqliteBucketStorage {
3
3
  control(op, payload) {
4
- if (payload != null && typeof payload != 'string') {
5
- // For some reason, we need to copy array buffers for RNQS to recognize them. We're doing that here because we
6
- // don't want to pay the cost of a copy on platforms where it's not necessary.
7
- payload = new Uint8Array(payload).buffer;
4
+ if (payload instanceof Uint8Array) {
5
+ // RNQS doesn't accept Uint8Array arguments - convert to ArrayBuffer first.
6
+ payload = uint8ArrayToArrayBuffer(payload);
8
7
  }
9
8
  return super.control(op, payload);
10
9
  }
11
10
  }
11
+ function uint8ArrayToArrayBuffer(array) {
12
+ // SharedArrayBuffer isn't defined on ReactNative, so don't need to cater for that.
13
+ const arrayBuffer = array.buffer;
14
+ if (array.byteOffset == 0 && array.byteLength == arrayBuffer.byteLength) {
15
+ // No copying needed - can use ArrayBuffer as-is
16
+ return arrayBuffer;
17
+ }
18
+ else {
19
+ // Need to make a copy
20
+ return arrayBuffer.slice(array.byteOffset, array.byteOffset + array.byteLength);
21
+ }
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/react-native",
3
- "version": "0.0.0-dev-20250625140957",
3
+ "version": "0.0.0-dev-20250710151329",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -25,7 +25,7 @@
25
25
  "homepage": "https://docs.powersync.com/",
26
26
  "peerDependencies": {
27
27
  "@journeyapps/react-native-quick-sqlite": "^2.4.5",
28
- "@powersync/common": "0.0.0-dev-20250625140957",
28
+ "@powersync/common": "0.0.0-dev-20250710151329",
29
29
  "react": "*",
30
30
  "react-native": "*"
31
31
  },
@@ -35,7 +35,7 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@powersync/common": "0.0.0-dev-20250625140957",
38
+ "@powersync/common": "0.0.0-dev-20250710151329",
39
39
  "@powersync/react": "1.5.3"
40
40
  },
41
41
  "devDependencies": {