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
17 changes: 9 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@ on:
types: [published]
workflow_dispatch:

permissions:
id-token: write
contents: read

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

# Setup Node.js environment
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
node-version: '22'
registry-url: 'https://registry.npmjs.org'

# Determine release tag based on the tag name
- name: Update npm to latest version for OIDC support
run: npm install -g npm@latest

- name: Determine release tag
id: release_tag
run: |
Expand All @@ -29,14 +34,10 @@ jobs:
echo "tag=latest" >> "$GITHUB_OUTPUT"
fi

# Install dependencies (if any) and build your project (if necessary)
- name: Install dependencies and build
run: |
npm install
npm run build

# Publish to NPM with the appropriate tag
- name: Publish
run: npm publish --tag ${{ steps.release_tag.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_NO_ORG }}
run: npm publish --provenance --access public --tag ${{ steps.release_tag.outputs.tag }}
Comment on lines 42 to +43
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Missing NODE_AUTH_TOKEN environment variable for npm authentication.

The publish step requires the NODE_AUTH_TOKEN environment variable to authenticate with the npm registry. Without it, the publish will fail with an authentication error.

🐛 Proposed fix
     - name: Publish
       run: npm publish --provenance --access public --tag ${{ steps.release_tag.outputs.tag }}
+      env:
+        NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Publish
run: npm publish --tag ${{ steps.release_tag.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_NO_ORG }}
run: npm publish --provenance --access public --tag ${{ steps.release_tag.outputs.tag }}
- name: Publish
run: npm publish --provenance --access public --tag ${{ steps.release_tag.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
🤖 Prompt for AI Agents
In @.github/workflows/publish.yml around lines 42 - 43, The "Publish" step
running `npm publish --provenance --access public --tag ${{
steps.release_tag.outputs.tag }}` is missing the NODE_AUTH_TOKEN environment
variable so npm cannot authenticate; update the "Publish" step to set env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} (or whatever secret holds your npm
token) so npm picks up the token at runtime, and ensure the corresponding
repository secret (e.g., NPM_TOKEN) exists in GitHub Secrets; keep the step name
"Publish" and the publish command unchanged.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change log

## 0.20.0

* Add array-based enum parameters (e.g., `permissions: BrowserPermission[]`).
* Breaking change: `Output` enum has been removed; use `ImageFormat` instead.
* Add `Channel` helpers for Realtime.

Comment on lines +3 to +8
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Changelog is incomplete—several significant changes are missing.

The AI summary indicates this release includes multiple important changes not documented in the changelog:

  1. JSON parsing changes: Integration of json-bigint and bignumber.js affects how JSON payloads are parsed/stringified throughout the SDK (WebSocket, HTTP, Query).
  2. Query enhancements: New helper methods (regex, exists, notExists, elemMatch) and bigint support.
  3. API signature changes:
    • Account.createJWT now accepts duration overloads
    • upsertDocument data parameter is now optional
  4. Additional enum: Roles enum was added but only BrowserPermission is mentioned.

Users upgrading need complete documentation of all features and breaking changes to understand the full scope of changes and migration requirements.

📝 Suggested additions to the changelog
 ## 0.20.0
 
 * Add array-based enum parameters (e.g., `permissions: BrowserPermission[]`).
+* Add `Roles` enum for role-based permissions.
 * Breaking change: `Output` enum has been removed; use `ImageFormat` instead.
 * Add `Channel` helpers for Realtime.
+* Add `Query` helper methods: `regex`, `exists`, `notExists`, `elemMatch` with bigint support.
+* Update `Account.createJWT` to accept duration parameter.
+* Update `upsertDocument` to make data parameter optional.
+* Integrate `json-bigint` and `bignumber.js` for handling large integers in JSON payloads.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## 0.20.0
* Add array-based enum parameters (e.g., `permissions: BrowserPermission[]`).
* Breaking change: `Output` enum has been removed; use `ImageFormat` instead.
* Add `Channel` helpers for Realtime.
## 0.20.0
* Add array-based enum parameters (e.g., `permissions: BrowserPermission[]`).
* Add `Roles` enum for role-based permissions.
* Breaking change: `Output` enum has been removed; use `ImageFormat` instead.
* Add `Channel` helpers for Realtime.
* Add `Query` helper methods: `regex`, `exists`, `notExists`, `elemMatch` with bigint support.
* Update `Account.createJWT` to accept duration parameter.
* Update `upsertDocument` to make data parameter optional.
* Integrate `json-bigint` and `bignumber.js` for handling large integers in JSON payloads.
🤖 Prompt for AI Agents
In `@CHANGELOG.md` around lines 3 - 8, Update the changelog to include all missing
breaking changes and new features: add a note that JSON parsing was switched to
json-bigint with bignumber.js and describe impact on WebSocket/HTTP/Query
payloads; list added Query helpers and bigint support (regex, exists, notExists,
elemMatch); document API signature changes for Account.createJWT (duration
overloads) and that upsertDocument's data parameter is now optional; add the new
Roles enum to the enums section and clarify that Output was removed in favor of
ImageFormat (in addition to the existing BrowserPermission mention). Ensure each
item references the exact symbols (json-bigint, bignumber.js, regex, exists,
notExists, elemMatch, Account.createJWT, upsertDocument, Roles,
BrowserPermission, Output -> ImageFormat) so users can find related code and
migration steps.

## 0.19.0

* Add `getScreenshot` method to `Avatars` service
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors.
Copyright (c) 2026 Appwrite (https://appwrite.io) and individual contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Appwrite React Native SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-react-native.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.8.1-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)

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

Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the React Native SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the React Native SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)

![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png)

Expand Down
4 changes: 3 additions & 1 deletion docs/examples/account/create-jwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const client = new Client()

const account = new Account(client);

const result = await account.createJWT();
const result = await account.createJWT({
duration: 0 // optional
});

console.log(result);
10 changes: 5 additions & 5 deletions docs/examples/avatars/get-screenshot.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Avatars, Theme, Timezone, Output } from "react-native-appwrite";
import { Client, Avatars, Theme, Timezone, BrowserPermission, ImageFormat } from "react-native-appwrite";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -15,21 +15,21 @@ const result = avatars.getScreenshot({
viewportWidth: 1920, // optional
viewportHeight: 1080, // optional
scale: 2, // optional
theme: Theme.Light, // optional
theme: Theme.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: Timezone.AfricaAbidjan, // optional
timezone: Timezone.AmericaNewYork, // optional
latitude: 37.7749, // optional
longitude: -122.4194, // optional
accuracy: 100, // optional
touch: true, // optional
permissions: ["geolocation","notifications"], // optional
permissions: [BrowserPermission.Geolocation, BrowserPermission.Notifications], // optional
sleep: 3, // optional
width: 800, // optional
height: 600, // optional
quality: 85, // optional
output: Output.Jpg // optional
output: ImageFormat.Jpeg // optional
});

console.log(result);
8 changes: 7 additions & 1 deletion docs/examples/databases/update-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ const result = await databases.updateDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {}, // optional
data: {
"username": "walter.obrien",
"email": "walter.obrien@example.com",
"fullName": "Walter O'Brien",
"age": 33,
"isAdmin": false
}, // optional
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>' // optional
});
Expand Down
8 changes: 7 additions & 1 deletion docs/examples/databases/upsert-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ const result = await databases.upsertDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {},
data: {
"username": "walter.obrien",
"email": "walter.obrien@example.com",
"fullName": "Walter O'Brien",
"age": 30,
"isAdmin": false
}, // optional
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>' // optional
});
Expand Down
8 changes: 7 additions & 1 deletion docs/examples/tablesdb/update-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ const result = await tablesDB.updateRow({
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
data: {}, // optional
data: {
"username": "walter.obrien",
"email": "walter.obrien@example.com",
"fullName": "Walter O'Brien",
"age": 33,
"isAdmin": false
}, // optional
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>' // optional
});
Expand Down
8 changes: 7 additions & 1 deletion docs/examples/tablesdb/upsert-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ const result = await tablesDB.upsertRow({
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
data: {}, // optional
data: {
"username": "walter.obrien",
"email": "walter.obrien@example.com",
"fullName": "Walter O'Brien",
"age": 33,
"isAdmin": false
}, // optional
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>' // optional
});
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/teams/create-membership.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Teams } from "react-native-appwrite";
import { Client, Teams, Roles } from "react-native-appwrite";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -8,7 +8,7 @@ const teams = new Teams(client);

const result = await teams.createMembership({
teamId: '<TEAM_ID>',
roles: [],
roles: [Roles.Admin],
email: 'email@example.com', // optional
userId: '<USER_ID>', // optional
phone: '+12065550100', // optional
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/teams/update-membership.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Teams } from "react-native-appwrite";
import { Client, Teams, Roles } from "react-native-appwrite";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -9,7 +9,7 @@ const teams = new Teams(client);
const result = await teams.updateMembership({
teamId: '<TEAM_ID>',
membershipId: '<MEMBERSHIP_ID>',
roles: []
roles: [Roles.Admin]
});

console.log(result);
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "react-native-appwrite",
"homepage": "https://appwrite.io/support",
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
"version": "0.19.0",
"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": "0.20.0",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
Expand All @@ -26,6 +26,7 @@
},
"devDependencies": {
"@rollup/plugin-typescript": "8.3.2",
"@types/json-bigint": "1.0.4",
"playwright": "1.56.1",
"rollup": "2.75.4",
"serve-handler": "6.1.0",
Expand All @@ -34,7 +35,9 @@
},
"dependencies": {
"expo-file-system": "18.*.*",
"react-native": ">=0.76.7 <1.0.0"
"json-bigint": "1.0.0",
"react-native": ">=0.76.7 <1.0.0",
"bignumber.js": "^9.0.0"
},
"peerDependencies": {
"expo": "*"
Expand Down
14 changes: 13 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import pkg from "./package.json";
import typescript from "@rollup/plugin-typescript";

const external = Object.keys(pkg.dependencies ?? {});

export default {
external: Object.keys(pkg.dependencies),
input: "src/index.ts",
external,
plugins: [typescript()],
output: [
{
Expand All @@ -17,5 +19,15 @@ export default {
file: pkg.module,
sourcemap: true,
},
{
format: "iife",
file: pkg.jsdelivr,
name: "Appwrite",
extend: true,
globals: {
"json-bigint": "JSONbig",
"bignumber.js": "BigNumber",
},
},
],
};
Loading