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: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Use Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '24.14.1'
registry-url: 'https://registry.npmjs.org'
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
min-release-age=7
15 changes: 12 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# Change Log

## 25.1.0

* Added: Realtime `presences` channel and `RealtimePresence` types for presence subscriptions
* Added: `Advisor` and `Presences` services
* Added: `Insight`, `Presence`, and `Report` models with list variants
* Added: `fusionauth`, `keycloak`, and `kick` providers to `OAuthProvider` enum
* Added: `Client.setCookie()` method for forwarding cookies in server-side runtimes
* Updated: `X-Appwrite-Response-Format` header to `1.9.5`

## 25.0.0

* Breaking: Added `unsubscribe()`, `update()`, and `close()` for Realtime subscription lifecycle.
* Added: Added `userPhone` to the `Membership` model.
* Updated: Updated `X-Appwrite-Response-Format` header to `1.9.2`.
* Breaking: Added `unsubscribe()`, `update()`, and `close()` to Realtime subscriptions
* Added: Added `userPhone` field to `Membership` model
* Updated: Updated `X-Appwrite-Response-Format` header to `1.9.2`

## 24.2.0

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Appwrite Web SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-web.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.2-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.5-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![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)
Expand Down Expand Up @@ -33,7 +33,7 @@ import { Client, Account } from "appwrite";
To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:

```html
<script src="https://cdn.jsdelivr.net/npm/appwrite@25.0.0"></script>
<script src="https://cdn.jsdelivr.net/npm/appwrite@25.1.0"></script>
```


Expand Down
16 changes: 16 additions & 0 deletions docs/examples/advisor/get-insight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
import { Client, Advisor } from "appwrite";

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

const advisor = new Advisor(client);

const result = await advisor.getInsight({
reportId: '<REPORT_ID>',
insightId: '<INSIGHT_ID>'
});

console.log(result);
```
15 changes: 15 additions & 0 deletions docs/examples/advisor/get-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
import { Client, Advisor } from "appwrite";

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

const advisor = new Advisor(client);

const result = await advisor.getReport({
reportId: '<REPORT_ID>'
});

console.log(result);
```
17 changes: 17 additions & 0 deletions docs/examples/advisor/list-insights.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
import { Client, Advisor } from "appwrite";

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

const advisor = new Advisor(client);

const result = await advisor.listInsights({
reportId: '<REPORT_ID>',
queries: [], // optional
total: false // optional
});

console.log(result);
```
16 changes: 16 additions & 0 deletions docs/examples/advisor/list-reports.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
import { Client, Advisor } from "appwrite";

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

const advisor = new Advisor(client);

const result = await advisor.listReports({
queries: [], // optional
total: false // optional
});

console.log(result);
```
2 changes: 1 addition & 1 deletion docs/examples/functions/create-execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const result = await functions.createExecution({
functionId: '<FUNCTION_ID>',
body: '<BODY>', // optional
async: false, // optional
path: '<PATH>', // optional
xpath: '<PATH>', // optional
method: ExecutionMethod.GET, // optional
headers: {}, // optional
scheduledAt: '<SCHEDULED_AT>' // optional
Expand Down
15 changes: 15 additions & 0 deletions docs/examples/presences/delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
import { Client, Presences } from "appwrite";

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

const presences = new Presences(client);

const result = await presences.delete({
presenceId: '<PRESENCE_ID>'
});

console.log(result);
```
15 changes: 15 additions & 0 deletions docs/examples/presences/get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
import { Client, Presences } from "appwrite";

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

const presences = new Presences(client);

const result = await presences.get({
presenceId: '<PRESENCE_ID>'
});

console.log(result);
```
17 changes: 17 additions & 0 deletions docs/examples/presences/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
import { Client, Presences } from "appwrite";

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

const presences = new Presences(client);

const result = await presences.list({
queries: [], // optional
total: false, // optional
ttl: 0 // optional
});

console.log(result);
```
20 changes: 20 additions & 0 deletions docs/examples/presences/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```javascript
import { Client, Presences, Permission, Role } from "appwrite";

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

const presences = new Presences(client);

const result = await presences.update({
presenceId: '<PRESENCE_ID>',
status: '<STATUS>', // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
metadata: {}, // optional
permissions: [Permission.read(Role.any())], // optional
purge: false // optional
});

console.log(result);
```
19 changes: 19 additions & 0 deletions docs/examples/presences/upsert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```javascript
import { Client, Presences, Permission, Role } from "appwrite";

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

const presences = new Presences(client);

const result = await presences.upsert({
presenceId: '<PRESENCE_ID>',
status: '<STATUS>',
permissions: [Permission.read(Role.any())], // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
metadata: {} // optional
});

console.log(result);
```
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": "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.0.0",
"version": "25.1.0",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Breaking rename shipped as a minor version bump

The PR title calls this "26.0.0" and the description explicitly lists breaking changes, but package.json (and CHANGELOG.md) record the release as 25.1.0 — a minor bump. This matters because createExecution's path parameter was renamed to xpath in the object-style overload: any caller passing { ..., path: '/endpoint' } will silently stop sending the parameter (it becomes undefined), and functions will execute against the default / path instead. Callers who pin to ^25.0.0 would pick up this change automatically, so a major version is needed to respect semver.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

no where 26.0.0 is present

"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
Expand Down
15 changes: 12 additions & 3 deletions src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ interface Func { _fn: any }
interface Execution { _exec: any }
interface Team { _team: any }
interface Membership { _mem: any }
interface Presence { _presence: any }
interface Resolved { _res: any }

type Actionable = Document | Row | File | Team | Membership;
type Actionable = Document | Row | File | Team | Membership | Presence;

function normalize(id: string): string {
if (id === undefined || id === null) {
Expand Down Expand Up @@ -82,7 +83,7 @@ export class Channel<T> {
return this.resolve("create");
}

upsert(this: Channel<Document | Row>): Channel<Resolved> {
upsert(this: Channel<Document | Row | Presence>): Channel<Resolved> {
return this.resolve("upsert");
}

Expand Down Expand Up @@ -123,6 +124,10 @@ export class Channel<T> {
return new Channel<Membership>(["memberships", normalize(id)]);
}

static presence(id: string) {
return new Channel<Presence>(["presences", normalize(id)]);
}

static account(): string {
return "account";
}
Expand Down Expand Up @@ -151,8 +156,12 @@ export class Channel<T> {
static memberships(): string {
return "memberships";
}

static presences(): string {
return "presences";
}
}

// Export types for backward compatibility with realtime
export type ActionableChannel = Channel<Document> | Channel<Row> | Channel<File> | Channel<Execution> | Channel<Team> | Channel<Membership>;
export type ActionableChannel = Channel<Document> | Channel<Row> | Channel<File> | Channel<Execution> | Channel<Team> | Channel<Membership> | Channel<Presence>;
export type ResolvedChannel = Channel<Resolved>;
20 changes: 18 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ class Client {
locale: string;
session: string;
devkey: string;
cookie: string;
impersonateuserid: string;
impersonateuseremail: string;
impersonateuserphone: string;
Expand All @@ -369,6 +370,7 @@ class Client {
locale: '',
session: '',
devkey: '',
cookie: '',
impersonateuserid: '',
impersonateuseremail: '',
impersonateuserphone: '',
Expand All @@ -380,8 +382,8 @@ class Client {
'x-sdk-name': 'Web',
'x-sdk-platform': 'client',
'x-sdk-language': 'web',
'x-sdk-version': '25.0.0',
'X-Appwrite-Response-Format': '1.9.2',
'x-sdk-version': '25.1.0',
'X-Appwrite-Response-Format': '1.9.5',
};

/**
Expand Down Expand Up @@ -508,6 +510,20 @@ class Client {
this.config.devkey = value;
return this;
}
/**
* Set Cookie
*
* The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes.
*
* @param value string
*
* @return {this}
*/
setCookie(value: string): this {
this.headers['Cookie'] = value;
this.config.cookie = value;
return this;
}
/**
* Set ImpersonateUserId
*
Expand Down
3 changes: 3 additions & 0 deletions src/enums/o-auth-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ export enum OAuthProvider {
Etsy = 'etsy',
Facebook = 'facebook',
Figma = 'figma',
Fusionauth = 'fusionauth',
Github = 'github',
Gitlab = 'gitlab',
Google = 'google',
Keycloak = 'keycloak',
Kick = 'kick',
Linkedin = 'linkedin',
Microsoft = 'microsoft',
Notion = 'notion',
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export { Functions } from './services/functions';
export { Graphql } from './services/graphql';
export { Locale } from './services/locale';
export { Messaging } from './services/messaging';
export { Presences } from './services/presences';
export { Advisor } from './services/advisor';
export { Storage } from './services/storage';
export { TablesDB } from './services/tables-db';
export { Teams } from './services/teams';
Expand Down
Loading