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
20 changes: 14 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Change Log

## 25.1.0

* Added `sizeActual` property to file model for actual stored size after compression
* Added `Deno121`, `Deno124`, and `Deno135` runtime options to `BuildRuntime` and `Runtime` enums
* Updated advisor authentication examples to use API key instead of session
* Updated billing limits properties to be optional in project models
## 26.0.0

* Breaking: Removed generic type parameters from `presences` service methods
* Breaking: Removed `githubImagine` and `googleImagine` from `ProjectOAuthProviderId`
* Breaking: Removed `deno-1.21`, `deno-1.24`, and `deno-1.35` from `Runtime` and `BuildRuntime`
* Breaking: Dropped numeric suffixes from `StatusCode` redirect members
* Added: `Organization` service for managing projects and API keys
* Added: `PolicyDenyAliasedEmail`, `PolicyDenyDisposableEmail`, and `PolicyDenyFreeEmail` policy models
* Added: `deny-aliased-email`, `deny-disposable-email`, and `deny-free-email` to `ProjectPolicyId`
* Added: `BrowserTheme`, `HealthQueueName`, `OrganizationKeyScopes`, and `Region` enums
* Added: `dart-3.12` and `flutter-3.44` runtimes
* Added: `ProjectList` model and new attributes on `Function`, `Site`, and `UsageGauge`
* Updated: `functions`, `sites`, `usage`, `health`, and `avatars` services
* Updated: Renamed `updatePresence` to `update` in the `presences` service

## 25.0.0

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/avatars/get-screenshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ const result = await avatars.getScreenshot({
viewportWidth: 1920, // optional
viewportHeight: 1080, // optional
scale: 2, // optional
theme: sdk.Theme.Dark, // optional
theme: sdk.BrowserTheme.Dark, // optional
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional
fullpage: true, // optional
locale: 'en-US', // optional
timezone: sdk.Timezone.AmericaNewYork, // optional
timezone: sdk.Timezone.AfricaAbidjan, // optional
latitude: 37.7749, // optional
longitude: -122.4194, // optional
accuracy: 100, // optional
Expand Down
4 changes: 3 additions & 1 deletion docs/examples/functions/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ const result = await functions.create({
logging: false, // optional
entrypoint: '<ENTRYPOINT>', // optional
commands: '<COMMANDS>', // optional
scopes: [sdk.Scopes.ProjectRead], // optional
scopes: [sdk.ProjectKeyScopes.ProjectRead], // optional
installationId: '<INSTALLATION_ID>', // optional
providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional
providerBranch: '<PROVIDER_BRANCH>', // optional
providerSilentMode: false, // optional
providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional
providerBranches: [], // optional
providerPaths: [], // optional
buildSpecification: '', // optional
runtimeSpecification: '', // optional
deploymentRetention: 0 // optional
Expand Down
4 changes: 3 additions & 1 deletion docs/examples/functions/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ const result = await functions.update({
logging: false, // optional
entrypoint: '<ENTRYPOINT>', // optional
commands: '<COMMANDS>', // optional
scopes: [sdk.Scopes.ProjectRead], // optional
scopes: [sdk.ProjectKeyScopes.ProjectRead], // optional
installationId: '<INSTALLATION_ID>', // optional
providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional
providerBranch: '<PROVIDER_BRANCH>', // optional
providerSilentMode: false, // optional
providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional
providerBranches: [], // optional
providerPaths: [], // optional
buildSpecification: '', // optional
runtimeSpecification: '', // optional
deploymentRetention: 0 // optional
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/health/get-failed-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const client = new sdk.Client()
const health = new sdk.Health(client);

const result = await health.getFailedJobs({
name: sdk.Name.V1Database,
name: sdk.HealthQueueName.V1Database,
threshold: null // optional
});
```
17 changes: 17 additions & 0 deletions docs/examples/organization/create-key.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const organization = new sdk.Organization(client);

const result = await organization.createKey({
keyId: '<KEY_ID>',
name: '<NAME>',
scopes: [sdk.OrganizationKeyScopes.ProjectsRead],
expire: '2020-10-15T06:38:00.000+00:00' // optional
});
```
16 changes: 16 additions & 0 deletions docs/examples/organization/create-project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const organization = new sdk.Organization(client);

const result = await organization.createProject({
projectId: '',
name: '<NAME>',
region: sdk.Region.Fra // optional
});
```
14 changes: 14 additions & 0 deletions docs/examples/organization/delete-key.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const organization = new sdk.Organization(client);

const result = await organization.deleteKey({
keyId: '<KEY_ID>'
});
```
14 changes: 14 additions & 0 deletions docs/examples/organization/delete-project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const organization = new sdk.Organization(client);

const result = await organization.deleteProject({
projectId: '<PROJECT_ID>'
});
```
14 changes: 14 additions & 0 deletions docs/examples/organization/get-key.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const organization = new sdk.Organization(client);

const result = await organization.getKey({
keyId: '<KEY_ID>'
});
```
14 changes: 14 additions & 0 deletions docs/examples/organization/get-project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const organization = new sdk.Organization(client);

const result = await organization.getProject({
projectId: '<PROJECT_ID>'
});
```
15 changes: 15 additions & 0 deletions docs/examples/organization/list-keys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const organization = new sdk.Organization(client);

const result = await organization.listKeys({
queries: [], // optional
total: false // optional
});
```
16 changes: 16 additions & 0 deletions docs/examples/organization/list-projects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const organization = new sdk.Organization(client);

const result = await organization.listProjects({
queries: [], // optional
search: '<SEARCH>', // optional
total: false // optional
});
```
17 changes: 17 additions & 0 deletions docs/examples/organization/update-key.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const organization = new sdk.Organization(client);

const result = await organization.updateKey({
keyId: '<KEY_ID>',
name: '<NAME>',
scopes: [sdk.OrganizationKeyScopes.ProjectsRead],
expire: '2020-10-15T06:38:00.000+00:00' // optional
});
```
15 changes: 15 additions & 0 deletions docs/examples/organization/update-project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const organization = new sdk.Organization(client);

const result = await organization.updateProject({
projectId: '<PROJECT_ID>',
name: '<NAME>'
});
```
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const client = new sdk.Client()

const presences = new sdk.Presences(client);

const result = await presences.updatePresence({
const result = await presences.update({
presenceId: '<PRESENCE_ID>',
userId: '<USER_ID>',
status: '<STATUS>', // optional
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/proxy/create-redirect-rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const proxy = new sdk.Proxy(client);
const result = await proxy.createRedirectRule({
domain: '',
url: 'https://example.com',
statusCode: sdk.StatusCode.MovedPermanently301,
statusCode: sdk.StatusCode.MovedPermanently,
resourceId: '<RESOURCE_ID>',
resourceType: sdk.ProxyResourceType.Site
});
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/sites/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const result = await sites.create({
providerBranch: '<PROVIDER_BRANCH>', // optional
providerSilentMode: false, // optional
providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional
providerBranches: [], // optional
providerPaths: [], // optional
buildSpecification: '', // optional
runtimeSpecification: '', // optional
deploymentRetention: 0 // optional
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/sites/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const result = await sites.update({
providerBranch: '<PROVIDER_BRANCH>', // optional
providerSilentMode: false, // optional
providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional
providerBranches: [], // optional
providerPaths: [], // optional
buildSpecification: '', // optional
runtimeSpecification: '', // optional
deploymentRetention: 0 // optional
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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": "25.2.0",
"version": "26.0.0",
"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 @@ -74,7 +74,7 @@ class AppwriteException extends Error {
}

function getUserAgent() {
let ua = 'AppwriteNodeJSSDK/25.2.0';
let ua = 'AppwriteNodeJSSDK/26.0.0';

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

if (data && typeof data === 'object') {
data.toString = () => JSONbig.stringify(data);
Object.defineProperty(data, 'toString', {
value: () => JSONbig.stringify(data),
writable: true,
enumerable: false,
configurable: true,
});
}

return data;
Expand Down
1 change: 1 addition & 0 deletions src/enums/backup-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export enum BackupServices {
Tablesdb = 'tablesdb',
Documentsdb = 'documentsdb',
Vectorsdb = 'vectorsdb',
DedicatedDatabases = 'dedicatedDatabases',
Functions = 'functions',
Storage = 'storage',
}
2 changes: 1 addition & 1 deletion src/enums/theme.ts → src/enums/browser-theme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum Theme {
export enum BrowserTheme {
Light = 'light',
Dark = 'dark',
}
5 changes: 2 additions & 3 deletions src/enums/build-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ export enum BuildRuntime {
Pythonml311 = 'python-ml-3.11',
Pythonml312 = 'python-ml-3.12',
Pythonml313 = 'python-ml-3.13',
Deno121 = 'deno-1.21',
Deno124 = 'deno-1.24',
Deno135 = 'deno-1.35',
Deno140 = 'deno-1.40',
Deno146 = 'deno-1.46',
Deno20 = 'deno-2.0',
Expand All @@ -51,6 +48,7 @@ export enum BuildRuntime {
Dart39 = 'dart-3.9',
Dart310 = 'dart-3.10',
Dart311 = 'dart-3.11',
Dart312 = 'dart-3.12',
Dotnet60 = 'dotnet-6.0',
Dotnet70 = 'dotnet-7.0',
Dotnet80 = 'dotnet-8.0',
Expand Down Expand Up @@ -91,4 +89,5 @@ export enum BuildRuntime {
Flutter335 = 'flutter-3.35',
Flutter338 = 'flutter-3.38',
Flutter341 = 'flutter-3.41',
Flutter344 = 'flutter-3.44',
}
2 changes: 1 addition & 1 deletion src/enums/name.ts → src/enums/health-queue-name.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum Name {
export enum HealthQueueName {
V1database = 'v1-database',
V1deletes = 'v1-deletes',
V1audits = 'v1-audits',
Expand Down
12 changes: 12 additions & 0 deletions src/enums/organization-key-scopes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export enum OrganizationKeyScopes {
ProjectsRead = 'projects.read',
ProjectsWrite = 'projects.write',
DevKeysRead = 'devKeys.read',
DevKeysWrite = 'devKeys.write',
OrganizationKeysRead = 'organization.keys.read',
OrganizationKeysWrite = 'organization.keys.write',
DomainsRead = 'domains.read',
DomainsWrite = 'domains.write',
KeysRead = 'keys.read',
KeysWrite = 'keys.write',
}
Loading