diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a2e91a9..fe74f4a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change log +## 0.24.1 + +* Fix very large double values (for example 1.7976931348623157e+308) from being expanded into giant integer literals. + ## 0.24.0 * Added Query.contains, Query.containsAny, and Query.containsAll for enhanced filtering capabilities. diff --git a/package.json b/package.json index 47a8cebb..96ea92f6 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "react-native-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "0.24.0", + "version": "0.24.1", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 816d86a7..20c48d23 100644 --- a/src/client.ts +++ b/src/client.ts @@ -8,6 +8,8 @@ const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true }); const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER); const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER); +const MAX_INT64 = BigInt('9223372036854775807'); +const MIN_INT64 = BigInt('-9223372036854775808'); function isBigNumber(value: any): boolean { return value !== null @@ -26,7 +28,10 @@ function reviver(_key: string, value: any): any { if (bi >= MIN_SAFE && bi <= MAX_SAFE) { return Number(str); } - return bi; + if (bi >= MIN_INT64 && bi <= MAX_INT64) { + return bi; + } + return value.toNumber(); } return value.toNumber(); } @@ -153,7 +158,7 @@ class Client { 'x-sdk-name': 'React Native', 'x-sdk-platform': 'client', 'x-sdk-language': 'reactnative', - 'x-sdk-version': '0.24.0', + 'x-sdk-version': '0.24.1', 'X-Appwrite-Response-Format': '1.8.0', };