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
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log

## 26.1.0

* Added: `createSesProvider` and `updateSesProvider` to `messaging`
* Added: `updateOAuth2Server` to `project` for OAuth2 server settings
* Added: `updatePasswordStrengthPolicy` and `PolicyPasswordStrength` to `project`
* Added: `getAuditsDB` health check to `health`
* Added: `password-strength` to `ProjectPolicyId`
* Added: `apps.read` and `apps.write` to `ProjectKeyScopes`


## 26.0.0

* Breaking: Removed generic type parameters from `presences` service methods
Expand All @@ -9,7 +19,7 @@
* 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
* Replaced: `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
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/update-password.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ const account = new sdk.Account(client);

const result = await account.updatePassword({
password: '',
oldPassword: 'password' // optional
oldPassword: '<OLD_PASSWORD>' // optional
});
```
12 changes: 12 additions & 0 deletions docs/examples/health/get-audits-db.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
```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 health = new sdk.Health(client);

const result = await health.getAuditsDB();
```
23 changes: 23 additions & 0 deletions docs/examples/messaging/create-ses-provider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
```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 messaging = new sdk.Messaging(client);

const result = await messaging.createSesProvider({
providerId: '<PROVIDER_ID>',
name: '<NAME>',
accessKey: '<ACCESS_KEY>', // optional
secretKey: '<SECRET_KEY>', // optional
region: '<REGION>', // optional
fromName: '<FROM_NAME>', // optional
fromEmail: 'email@example.com', // optional
replyToName: '<REPLY_TO_NAME>', // optional
replyToEmail: 'email@example.com', // optional
enabled: false // optional
});
```
23 changes: 23 additions & 0 deletions docs/examples/messaging/update-ses-provider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
```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 messaging = new sdk.Messaging(client);

const result = await messaging.updateSesProvider({
providerId: '<PROVIDER_ID>',
name: '<NAME>', // optional
enabled: false, // optional
accessKey: '<ACCESS_KEY>', // optional
secretKey: '<SECRET_KEY>', // optional
region: '<REGION>', // optional
fromName: '<FROM_NAME>', // optional
fromEmail: 'email@example.com', // optional
replyToName: '<REPLY_TO_NAME>', // optional
replyToEmail: '<REPLY_TO_EMAIL>' // optional
});
```
21 changes: 21 additions & 0 deletions docs/examples/project/update-o-auth-2-server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```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 project = new sdk.Project(client);

const result = await project.updateOAuth2Server({
enabled: false,
authorizationUrl: 'https://example.com',
scopes: [], // optional
accessTokenDuration: 60, // optional
refreshTokenDuration: 60, // optional
publicAccessTokenDuration: 60, // optional
publicRefreshTokenDuration: 60, // optional
confidentialPkce: false // optional
});
```
18 changes: 18 additions & 0 deletions docs/examples/project/update-password-strength-policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```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 project = new sdk.Project(client);

const result = await project.updatePasswordStrengthPolicy({
min: 8, // optional
uppercase: false, // optional
lowercase: false, // optional
number: false, // optional
symbols: false // optional
});
```
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": "26.0.0",
"version": "26.1.0",
"license": "BSD-3-Clause",
"main": "dist/index.js",
"type": "commonjs",
Expand Down
9 changes: 5 additions & 4 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/26.0.0';
let ua = 'AppwriteNodeJSSDK/26.1.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': '26.0.0',
'x-sdk-version': '26.1.0',
'user-agent' : getUserAgent(),
'X-Appwrite-Response-Format': '1.9.5',
};
Expand Down Expand Up @@ -209,7 +209,6 @@ class Client {
* @return {this}
*/
setProject(value: string): this {
this.headers['X-Appwrite-Project'] = value;
this.config.project = value;
return this;
}
Comment on lines 211 to 214

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 getHeaders() no longer includes X-Appwrite-Project

setKey(), setJWT(), setLocale(), and several other setters still write to this.headers, so getHeaders() continues to return those values. setProject() now only writes to this.config.project, so getHeaders() will silently omit the project header. Any consumer that calls client.getHeaders() to build a downstream request (e.g., forwarding headers or diagnostic logging) will receive an incomplete set and may produce requests that are rejected by the server for missing the project context. The asymmetry with the other setter methods makes this easy to miss.

Expand Down Expand Up @@ -644,7 +643,9 @@ class Client {
}

async ping(): Promise<unknown> {
return this.call('GET', new URL(this.config.endpoint + '/ping'));
return this.call('GET', new URL(this.config.endpoint + '/ping'), {
'X-Appwrite-Project': this.config.project,
});
}

async redirect(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise<string> {
Expand Down
2 changes: 2 additions & 0 deletions src/enums/project-key-scopes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,7 @@ export enum ProjectKeyScopes {
DomainsRead = 'domains.read',
DomainsWrite = 'domains.write',
EventsRead = 'events.read',
AppsRead = 'apps.read',
AppsWrite = 'apps.write',
UsageRead = 'usage.read',
}
1 change: 1 addition & 0 deletions src/enums/project-policy-id.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export enum ProjectPolicyId {
Passworddictionary = 'password-dictionary',
Passwordhistory = 'password-history',
Passwordstrength = 'password-strength',
Passwordpersonaldata = 'password-personal-data',
Sessionalert = 'session-alert',
Sessionduration = 'session-duration',
Expand Down
80 changes: 73 additions & 7 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ export namespace Models {
/**
* List of policies.
*/
policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail)[];
policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordStrength | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail)[];
}

/**
Expand Down Expand Up @@ -4164,6 +4164,10 @@ export namespace Models {
* Project team ID.
*/
teamId: string;
/**
* Project region
*/
region: string;
/**
* Deprecated since 1.9.5: List of dev keys.
*/
Expand Down Expand Up @@ -4237,21 +4241,53 @@ export namespace Models {
*/
protocols: ProjectProtocol[];
/**
* Project region
* Project blocks information
*/
region: string;
blocks: Block[];
/**
* Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused.
*/
consoleAccessedAt: string;
/**
* Billing limits reached
*/
billingLimits?: BillingLimits;
/**
* Project blocks information
* OAuth2 server status
*/
blocks: Block[];
oAuth2ServerEnabled: boolean;
/**
* Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused.
* OAuth2 server authorization URL
*/
consoleAccessedAt: string;
oAuth2ServerAuthorizationUrl: string;
/**
* OAuth2 server allowed scopes
*/
oAuth2ServerScopes: string[];
/**
* OAuth2 server access token duration in seconds for confidential clients
*/
oAuth2ServerAccessTokenDuration: number;
/**
* OAuth2 server refresh token duration in seconds for confidential clients
*/
oAuth2ServerRefreshTokenDuration: number;
/**
* OAuth2 server access token duration in seconds for public clients (SPAs, mobile, native)
*/
oAuth2ServerPublicAccessTokenDuration: number;
/**
* OAuth2 server refresh token duration in seconds for public clients (SPAs, mobile, native)
*/
oAuth2ServerPublicRefreshTokenDuration: number;
/**
* When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting.
*/
oAuth2ServerConfidentialPkce: boolean;
/**
* OAuth2 server discovery URL
*/
oAuth2ServerDiscoveryUrl: string;
}

/**
Expand Down Expand Up @@ -5484,6 +5520,36 @@ export namespace Models {
total: number;
}

/**
* Policy Password Strength
*/
export type PolicyPasswordStrength = {
/**
* Policy ID.
*/
$id: string;
/**
* Minimum password length required for user passwords.
*/
min: number;
/**
* Whether passwords must include at least one uppercase letter.
*/
uppercase: boolean;
/**
* Whether passwords must include at least one lowercase letter.
*/
lowercase: boolean;
/**
* Whether passwords must include at least one number.
*/
number: boolean;
/**
* Whether passwords must include at least one symbol.
*/
symbols: boolean;
}

/**
* Policy Password Personal Data
*/
Expand Down
Loading
Loading