Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 22.1.2

* Fix very large double values (for example 1.7976931348623157e+308) from being expanded into giant integer literals

## 22.1.1

* Removed unused BigNumber import from src/client.ts to clean up dependencies
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "node-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": "22.1.1",
"version": "22.1.2",
"license": "BSD-3-Clause",
"main": "dist/index.js",
"type": "commonjs",
Expand Down
11 changes: 8 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,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
Expand All @@ -25,7 +27,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();
}
Expand Down Expand Up @@ -68,7 +73,7 @@ class AppwriteException extends Error {
}

function getUserAgent() {
let ua = 'AppwriteNodeJSSDK/22.1.1';
let ua = 'AppwriteNodeJSSDK/22.1.2';

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