@powersync/react-native 1.22.0 → 1.22.2
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
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
|
|
5
|
-
//
|
|
6
|
-
|
|
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": "1.22.
|
|
3
|
+
"version": "1.22.2",
|
|
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": "^1.33.
|
|
28
|
+
"@powersync/common": "^1.33.2",
|
|
29
29
|
"react": "*",
|
|
30
30
|
"react-native": "*"
|
|
31
31
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@powersync/common": "1.33.
|
|
38
|
+
"@powersync/common": "1.33.2",
|
|
39
39
|
"@powersync/react": "1.5.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|