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
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Change Log

## 22.1.0
## 22.1.1

* Removed unused BigNumber import from src/client.ts to clean up dependencies
* Updated documentation examples to include the new encrypt option for text-like attributes (encrypt: false) across multiple examples
* Updated README to specify Appwrite server compatibility with 1.8.x
* Repo cleanup: removed obsolete GitHub workflow and issue template files as part of repository cleanup (non-breaking)

## 22.0.1

* Fix doc examples with proper formatting
* Add support for the new `Backups` service
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).**
**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).**

> This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code.
If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const client = new sdk.Client()
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const health = new sdk.Health(client);
const activities = new sdk.Activities(client);

const result = await health.getQueueThreats({
threshold: null // optional
const result = await activities.getEvent({
eventId: '<EVENT_ID>'
});
```
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const client = new sdk.Client()
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const health = new sdk.Health(client);
const activities = new sdk.Activities(client);

const result = await health.getQueueRegionManager({
threshold: null // optional
const result = await activities.listEvents({
queries: '' // optional
});
```
3 changes: 2 additions & 1 deletion docs/examples/databases/create-longtext-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const result = await databases.createLongtextAttribute({
key: '',
required: false,
default: '<DEFAULT>', // optional
array: false // optional
array: false, // optional
encrypt: false // optional
});
```
3 changes: 2 additions & 1 deletion docs/examples/databases/create-mediumtext-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const result = await databases.createMediumtextAttribute({
key: '',
required: false,
default: '<DEFAULT>', // optional
array: false // optional
array: false, // optional
encrypt: false // optional
});
```
3 changes: 2 additions & 1 deletion docs/examples/databases/create-text-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const result = await databases.createTextAttribute({
key: '',
required: false,
default: '<DEFAULT>', // optional
array: false // optional
array: false, // optional
encrypt: false // optional
});
```
3 changes: 2 additions & 1 deletion docs/examples/databases/create-varchar-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const result = await databases.createVarcharAttribute({
size: 1,
required: false,
default: '<DEFAULT>', // optional
array: false // optional
array: false, // optional
encrypt: false // optional
});
```
14 changes: 0 additions & 14 deletions docs/examples/health/get-queue-billing-project-aggregation.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/examples/health/get-queue-billing-team-aggregation.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/examples/health/get-queue-priority-builds.md

This file was deleted.

3 changes: 2 additions & 1 deletion docs/examples/tablesdb/create-longtext-column.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const result = await tablesDB.createLongtextColumn({
key: '',
required: false,
default: '<DEFAULT>', // optional
array: false // optional
array: false, // optional
encrypt: false // optional
});
```
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/create-mediumtext-column.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const result = await tablesDB.createMediumtextColumn({
key: '',
required: false,
default: '<DEFAULT>', // optional
array: false // optional
array: false, // optional
encrypt: false // optional
});
```
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/create-text-column.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const result = await tablesDB.createTextColumn({
key: '',
required: false,
default: '<DEFAULT>', // optional
array: false // optional
array: false, // optional
encrypt: false // optional
});
```
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/create-varchar-column.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const result = await tablesDB.createVarcharColumn({
size: 1,
required: false,
default: '<DEFAULT>', // optional
array: false // optional
array: false, // optional
encrypt: false // optional
});
```
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.0",
"version": "22.1.1",
"license": "BSD-3-Clause",
"main": "dist/index.js",
"type": "commonjs",
Expand Down
16 changes: 12 additions & 4 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@ import { fetch, FormData, File } from 'node-fetch-native-with-agent';
import { createAgent } from 'node-fetch-native-with-agent/agent';
import { Models } from './models';
import JSONbigModule from 'json-bigint';
import BigNumber from 'bignumber.js';
const JSONbigParser = JSONbigModule({ storeAsString: false });
const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true });

const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);

function isBigNumber(value: any): boolean {
return value !== null
&& typeof value === 'object'
&& value._isBigNumber === true
&& typeof value.isInteger === 'function'
&& typeof value.toFixed === 'function'
&& typeof value.toNumber === 'function';
}

function reviver(_key: string, value: any): any {
if (BigNumber.isBigNumber(value)) {
if (isBigNumber(value)) {
if (value.isInteger()) {
const str = value.toFixed();
const bi = BigInt(str);
Expand Down Expand Up @@ -60,7 +68,7 @@ class AppwriteException extends Error {
}

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

// `process` is a global in Node.js, but not fully available in all runtimes.
const platform: string[] = [];
Expand Down Expand Up @@ -109,7 +117,7 @@ class Client {
'x-sdk-name': 'Node.js',
'x-sdk-platform': 'server',
'x-sdk-language': 'nodejs',
'x-sdk-version': '22.1.0',
'x-sdk-version': '22.1.1',
'user-agent' : getUserAgent(),
'X-Appwrite-Response-Format': '1.8.0',
};
Expand Down
20 changes: 20 additions & 0 deletions src/enums/build-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,35 @@ export enum BuildRuntime {
Node200 = 'node-20.0',
Node210 = 'node-21.0',
Node22 = 'node-22',
Node23 = 'node-23',
Node24 = 'node-24',
Node25 = 'node-25',
Php80 = 'php-8.0',
Php81 = 'php-8.1',
Php82 = 'php-8.2',
Php83 = 'php-8.3',
Php84 = 'php-8.4',
Ruby30 = 'ruby-3.0',
Ruby31 = 'ruby-3.1',
Ruby32 = 'ruby-3.2',
Ruby33 = 'ruby-3.3',
Ruby34 = 'ruby-3.4',
Ruby40 = 'ruby-4.0',
Python38 = 'python-3.8',
Python39 = 'python-3.9',
Python310 = 'python-3.10',
Python311 = 'python-3.11',
Python312 = 'python-3.12',
Python313 = 'python-3.13',
Python314 = 'python-3.14',
Pythonml311 = 'python-ml-3.11',
Pythonml312 = 'python-ml-3.12',
Pythonml313 = 'python-ml-3.13',
Deno140 = 'deno-1.40',
Deno146 = 'deno-1.46',
Deno20 = 'deno-2.0',
Deno25 = 'deno-2.5',
Deno26 = 'deno-2.6',
Dart215 = 'dart-2.15',
Dart216 = 'dart-2.16',
Dart217 = 'dart-2.17',
Expand All @@ -39,25 +50,34 @@ export enum BuildRuntime {
Dotnet60 = 'dotnet-6.0',
Dotnet70 = 'dotnet-7.0',
Dotnet80 = 'dotnet-8.0',
Dotnet10 = 'dotnet-10',
Java80 = 'java-8.0',
Java110 = 'java-11.0',
Java170 = 'java-17.0',
Java180 = 'java-18.0',
Java210 = 'java-21.0',
Java22 = 'java-22',
Java25 = 'java-25',
Swift55 = 'swift-5.5',
Swift58 = 'swift-5.8',
Swift59 = 'swift-5.9',
Swift510 = 'swift-5.10',
Swift62 = 'swift-6.2',
Kotlin16 = 'kotlin-1.6',
Kotlin18 = 'kotlin-1.8',
Kotlin19 = 'kotlin-1.9',
Kotlin20 = 'kotlin-2.0',
Kotlin23 = 'kotlin-2.3',
Cpp17 = 'cpp-17',
Cpp20 = 'cpp-20',
Bun10 = 'bun-1.0',
Bun11 = 'bun-1.1',
Bun12 = 'bun-1.2',
Bun13 = 'bun-1.3',
Go123 = 'go-1.23',
Go124 = 'go-1.24',
Go125 = 'go-1.25',
Go126 = 'go-1.26',
Static1 = 'static-1',
Flutter324 = 'flutter-3.24',
Flutter327 = 'flutter-3.27',
Expand Down
20 changes: 20 additions & 0 deletions src/enums/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,35 @@ export enum Runtime {
Node200 = 'node-20.0',
Node210 = 'node-21.0',
Node22 = 'node-22',
Node23 = 'node-23',
Node24 = 'node-24',
Node25 = 'node-25',
Php80 = 'php-8.0',
Php81 = 'php-8.1',
Php82 = 'php-8.2',
Php83 = 'php-8.3',
Php84 = 'php-8.4',
Ruby30 = 'ruby-3.0',
Ruby31 = 'ruby-3.1',
Ruby32 = 'ruby-3.2',
Ruby33 = 'ruby-3.3',
Ruby34 = 'ruby-3.4',
Ruby40 = 'ruby-4.0',
Python38 = 'python-3.8',
Python39 = 'python-3.9',
Python310 = 'python-3.10',
Python311 = 'python-3.11',
Python312 = 'python-3.12',
Python313 = 'python-3.13',
Python314 = 'python-3.14',
Pythonml311 = 'python-ml-3.11',
Pythonml312 = 'python-ml-3.12',
Pythonml313 = 'python-ml-3.13',
Deno140 = 'deno-1.40',
Deno146 = 'deno-1.46',
Deno20 = 'deno-2.0',
Deno25 = 'deno-2.5',
Deno26 = 'deno-2.6',
Dart215 = 'dart-2.15',
Dart216 = 'dart-2.16',
Dart217 = 'dart-2.17',
Expand All @@ -39,25 +50,34 @@ export enum Runtime {
Dotnet60 = 'dotnet-6.0',
Dotnet70 = 'dotnet-7.0',
Dotnet80 = 'dotnet-8.0',
Dotnet10 = 'dotnet-10',
Java80 = 'java-8.0',
Java110 = 'java-11.0',
Java170 = 'java-17.0',
Java180 = 'java-18.0',
Java210 = 'java-21.0',
Java22 = 'java-22',
Java25 = 'java-25',
Swift55 = 'swift-5.5',
Swift58 = 'swift-5.8',
Swift59 = 'swift-5.9',
Swift510 = 'swift-5.10',
Swift62 = 'swift-6.2',
Kotlin16 = 'kotlin-1.6',
Kotlin18 = 'kotlin-1.8',
Kotlin19 = 'kotlin-1.9',
Kotlin20 = 'kotlin-2.0',
Kotlin23 = 'kotlin-2.3',
Cpp17 = 'cpp-17',
Cpp20 = 'cpp-20',
Bun10 = 'bun-1.0',
Bun11 = 'bun-1.1',
Bun12 = 'bun-1.2',
Bun13 = 'bun-1.3',
Go123 = 'go-1.23',
Go124 = 'go-1.24',
Go125 = 'go-1.25',
Go126 = 'go-1.26',
Static1 = 'static-1',
Flutter324 = 'flutter-3.24',
Flutter327 = 'flutter-3.27',
Expand Down
3 changes: 3 additions & 0 deletions src/enums/scopes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export enum Scopes {
TargetsWrite = 'targets.write',
RulesRead = 'rules.read',
RulesWrite = 'rules.write',
SchedulesRead = 'schedules.read',
SchedulesWrite = 'schedules.write',
MigrationsRead = 'migrations.read',
MigrationsWrite = 'migrations.write',
VcsRead = 'vcs.read',
Expand All @@ -62,4 +64,5 @@ export enum Scopes {
RestorationsWrite = 'restorations.write',
DomainsRead = 'domains.read',
DomainsWrite = 'domains.write',
EventsRead = 'events.read',
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export { Client, Query, AppwriteException } from './client';
export { Account } from './services/account';
export { Activities } from './services/activities';
export { Avatars } from './services/avatars';
export { Backups } from './services/backups';
export { Databases } from './services/databases';
Expand Down
Loading