Skip to content

Commit 4e282f2

Browse files
authored
Merge pull request #142 from appwrite/dev
2 parents fdf1504 + f03b8a7 commit 4e282f2

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 22.1.2
4+
5+
* Fix very large double values (for example 1.7976931348623157e+308) from being expanded into giant integer literals
6+
37
## 22.1.1
48

59
* Removed unused BigNumber import from src/client.ts to clean up dependencies

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "node-appwrite",
33
"homepage": "https://appwrite.io/support",
44
"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",
5-
"version": "22.1.1",
5+
"version": "22.1.2",
66
"license": "BSD-3-Clause",
77
"main": "dist/index.js",
88
"type": "commonjs",

src/client.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true });
77

88
const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
99
const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
10+
const MAX_INT64 = BigInt('9223372036854775807');
11+
const MIN_INT64 = BigInt('-9223372036854775808');
1012

1113
function isBigNumber(value: any): boolean {
1214
return value !== null
@@ -25,7 +27,10 @@ function reviver(_key: string, value: any): any {
2527
if (bi >= MIN_SAFE && bi <= MAX_SAFE) {
2628
return Number(str);
2729
}
28-
return bi;
30+
if (bi >= MIN_INT64 && bi <= MAX_INT64) {
31+
return bi;
32+
}
33+
return value.toNumber();
2934
}
3035
return value.toNumber();
3136
}
@@ -68,7 +73,7 @@ class AppwriteException extends Error {
6873
}
6974

7075
function getUserAgent() {
71-
let ua = 'AppwriteNodeJSSDK/22.1.1';
76+
let ua = 'AppwriteNodeJSSDK/22.1.2';
7277

7378
// `process` is a global in Node.js, but not fully available in all runtimes.
7479
const platform: string[] = [];
@@ -117,7 +122,7 @@ class Client {
117122
'x-sdk-name': 'Node.js',
118123
'x-sdk-platform': 'server',
119124
'x-sdk-language': 'nodejs',
120-
'x-sdk-version': '22.1.1',
125+
'x-sdk-version': '22.1.2',
121126
'user-agent' : getUserAgent(),
122127
'X-Appwrite-Response-Format': '1.8.0',
123128
};

0 commit comments

Comments
 (0)