Skip to content
Open
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 README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# 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.1-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.0-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 latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-react-native/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-react-native/releases).**

Comment on lines +4 to 10
Copy link

Choose a reason for hiding this comment

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

P2 API version badge and compatibility note are inconsistent

The badge was updated to api%20version-1.9.0, but the compatibility line now reads "compatible with Appwrite server version 1.8.x". These two statements contradict each other — users targeting server version 1.8.x would expect the API version badge to reflect that same line. Please align both to the intended target version (either 1.8.x or 1.9.x).

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)

Expand Down
18 changes: 18 additions & 0 deletions docs/examples/databases/upsert-documents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```javascript
import { Client, Databases } from "react-native-appwrite";

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

const databases = new Databases(client);

const result = await databases.upsertDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documents: [],
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
```
25 changes: 25 additions & 0 deletions docs/examples/documentsdb/create-document.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
```javascript
import { Client, DocumentsDB, Permission, Role } from "react-native-appwrite";

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.createDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {
"username": "walter.obrien",
"email": "walter.obrien@example.com",
"fullName": "Walter O'Brien",
"age": 30,
"isAdmin": false
},
permissions: ["read("any")"] // optional
Copy link

Choose a reason for hiding this comment

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

P2 Invalid JavaScript string syntax for permissions

The permission string "read("any")" uses double quotes inside a double-quoted string, which produces invalid JavaScript. The inner double quotes terminate the outer string literal early, resulting in a syntax error when this example is copied and run.

The same issue appears in the following files as well:

  • docs/examples/documentsdb/update-document.md:15
  • docs/examples/documentsdb/upsert-document.md:15
  • docs/examples/vectorsdb/create-document.md:25
  • docs/examples/vectorsdb/update-document.md:15
  • docs/examples/vectorsdb/upsert-document.md:15

Since Permission and Role are already imported in these examples, the recommended fix is to use the helper:

Suggested change
permissions: ["read("any")"] // optional
permissions: [Permission.read(Role.any())] // optional

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

🧩 Analysis chain

🏁 Script executed:

cat -n docs/examples/documentsdb/create-document.md | head -30

Repository: appwrite/sdk-for-react-native

Length of output: 966


🌐 Web query:

Appwrite Permission Role read() method syntax JavaScript

💡 Result:

The syntax for Appwrite's Permission.read method in JavaScript is Permission.read(role), where role is an instance from the Role class, such as Role.any, Role.user('user-id'), Role.users, or Role.team('team-id'). Example usage when creating a document: import { Client, Databases, Permission, Role, ID } from 'node-appwrite' || 'appwrite'; const client = new Client.setEndpoint('https://cloud.appwrite.io/v1').setProject('project-id'); const databases = new Databases(client); const result = await databases.createDocument( 'database-id', 'collection-id', ID.unique, { key: 'value' }, [ Permission.read(Role.any), // Anyone can read Permission.read(Role.user('user-id')), // Specific user can read Permission.update(Role.team('team-id')), // Team can update ] ); This grants read access to the specified role(s). Permissions are combined in an array for create/updateDocument methods. Server SDKs bypass permissions checks.

Citations:


Correct the permissions syntax to use valid Appwrite API.

Line 21 has invalid nested quotes that won't parse. The correct Appwrite syntax uses Permission.read() with a Role property, not a method call.

Proposed fix
-    permissions: ["read("any")"] // optional
+    permissions: [Permission.read(Role.any)] // optional
📝 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
permissions: ["read("any")"] // optional
permissions: [Permission.read(Role.any)] // optional
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/examples/documentsdb/create-document.md` at line 21, The permissions
syntax is invalid; replace the incorrect permissions entry (permissions:
["read("any")"]) with the Appwrite API call using Permission.read and Role,
e.g., use Permission.read(Role.any()) so the permissions array contains the
proper Permission.read(Role.any()) expression instead of the nested-quoted
string; update the permissions value where it is set in the document creation
example.

});

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

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.createDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documents: []
});

console.log(result);
```
26 changes: 26 additions & 0 deletions docs/examples/documentsdb/create-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```javascript
import { Client, DocumentsDB } from "react-native-appwrite";

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.createOperations({
transactionId: '<TRANSACTION_ID>',
operations: [
{
"action": "create",
"databaseId": "<DATABASE_ID>",
"collectionId": "<COLLECTION_ID>",
"documentId": "<DOCUMENT_ID>",
"data": {
"name": "Walter O'Brien"
}
}
] // optional
});

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

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.createTransaction({
ttl: 60 // optional
});

console.log(result);
```
21 changes: 21 additions & 0 deletions docs/examples/documentsdb/decrement-document-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```javascript
import { Client, DocumentsDB } from "react-native-appwrite";

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.decrementDocumentAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
attribute: '',
value: 0, // optional
min: 0, // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
```
18 changes: 18 additions & 0 deletions docs/examples/documentsdb/delete-document.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```javascript
import { Client, DocumentsDB } from "react-native-appwrite";

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.deleteDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
transactionId: '<TRANSACTION_ID>' // optional
});

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

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.deleteTransaction({
transactionId: '<TRANSACTION_ID>'
});

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

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.getDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>' // optional
});

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

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.getTransaction({
transactionId: '<TRANSACTION_ID>'
});

console.log(result);
```
21 changes: 21 additions & 0 deletions docs/examples/documentsdb/increment-document-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```javascript
import { Client, DocumentsDB } from "react-native-appwrite";

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.incrementDocumentAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
attribute: '',
value: 0, // optional
max: 0, // optional
transactionId: '<TRANSACTION_ID>' // optional
});

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

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.listDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>', // optional
total: false, // optional
ttl: 0 // optional
});

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

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.listTransactions({
queries: [] // optional
});

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

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.updateDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {}, // optional
permissions: ["read("any")"], // optional
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

Fix syntax error in permissions string literal.

The permissions string has unescaped quotes that will cause a JavaScript parse error:

permissions: ["read("any")"]

The inner quotes terminate the string prematurely. Choose one of these solutions:

  1. Recommended: Use the Permission and Role helper classes (already imported):

    permissions: [Permission.read(Role.any())]
  2. Escape the inner quotes:

    permissions: ["read(\"any\")"]
  3. Use single quotes for the outer string:

    permissions: ['read("any")']
🐛 Proposed fix using helper classes (recommended)
-    permissions: ["read("any")"], // optional
+    permissions: [Permission.read(Role.any())], // optional
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/examples/documentsdb/update-document.md` at line 15, The permissions
string contains unescaped inner quotes and will cause a parse error; update the
permissions entry (the permissions property) to a valid expression—preferably
use the helper classes Permission and Role by replacing permissions:
["read("any")"] with permissions: [Permission.read(Role.any())]; alternatively
escape inner quotes (permissions: ["read(\"any\")"]) or switch to single outer
quotes (permissions: ['read("any")']) so the code parses correctly.

transactionId: '<TRANSACTION_ID>' // optional
});

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

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.updateTransaction({
transactionId: '<TRANSACTION_ID>',
commit: false, // optional
rollback: false // optional
});
Comment on lines +10 to +14
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

For Appwrite DocumentsDB transaction update in API 1.9.0, should docs examples pass only one of commitorrollback per request? Please confirm the canonical example from official docs.

💡 Result:

Yes, Appwrite DocumentsDB (now TablesDB) transaction updates in API 1.9.0 require passing only one of commit or rollback per updateTransaction request. The official documentation shows mutually exclusive examples: either {commit: true} to commit or {rollback: true} to rollback, never both in the same call. Passing both would likely result in an error, as they represent opposing actions.

Citations:


Update example to show only one of commit or rollback per request.

The example shows both flags set to false, creating ambiguity about proper usage. Appwrite DocumentsDB API requires commit and rollback to be mutually exclusive—only one should be passed per updateTransaction request.

Suggested fix
 const result = await documentsDB.updateTransaction({
     transactionId: '<TRANSACTION_ID>',
-    commit: false, // optional
-    rollback: false // optional
+    rollback: true // optional (use either `commit` or `rollback`)
 });
📝 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
const result = await documentsDB.updateTransaction({
transactionId: '<TRANSACTION_ID>',
commit: false, // optional
rollback: false // optional
});
const result = await documentsDB.updateTransaction({
transactionId: '<TRANSACTION_ID>',
rollback: true // optional (use either `commit` or `rollback`)
});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/examples/documentsdb/update-transaction.md` around lines 10 - 14, The
example for documentsDB.updateTransaction currently passes both commit and
rollback flags which are mutually exclusive; update the sample call to pass only
one of the flags (either commit or rollback) alongside the transactionId in the
documentsDB.updateTransaction invocation so the example demonstrates proper
usage (e.g., show one example with commit: true and remove the rollback flag OR
show one example with rollback: true and remove the commit flag).


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

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

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.upsertDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {}, // optional
permissions: ["read("any")"], // optional
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

🧩 Analysis chain

🏁 Script executed:

cat -n docs/examples/documentsdb/upsert-document.md | head -30

Repository: appwrite/sdk-for-react-native

Length of output: 824


🏁 Script executed:

# Search for Permission and Role usage patterns in the codebase
rg "Permission\.|Role\." --type md -A 2 -B 2 | head -50

Repository: appwrite/sdk-for-react-native

Length of output: 481


🌐 Web query:

Appwrite Permission.read Role.any() syntax documentation

💡 Result:

The syntax for Appwrite Permission.read Role.any is Permission.read(Role.any), used in SDKs to grant read access to any user for resources like database rows, documents, files, etc. This is a static method call from the Permission and Role classes. Example from official docs for creating a database row readable by anyone: import { Client, Databases, Permission, Role } from "node-appwrite"; const client = new Client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('<PROJECT_ID>'); // Your project ID const databases = new Databases(client); databases.createDocument( '<DATABASE_ID>', '<COLLECTION_ID>', 'unique', { 'actorName': 'Chris Evans', 'height': 183 }, [ Permission.read(Role.any), // Anyone can read this row // Additional permissions... ] ); Similar syntax applies across Client and Server SDKs (Web, Node.js, etc.). Permissions are arrays passed to create/update methods for resources. Role.any grants access to anyone (wildcard), while Permission.read specifies read access. Users can only grant permissions they own.

Citations:


Permissions example has broken JavaScript syntax.

Line 15 uses invalid nested quoting that won't parse. The string "read("any")" has unescaped inner quotes that terminate the string prematurely.

Fix
-    permissions: ["read("any")"], // optional
+    permissions: [Permission.read(Role.any())], // optional

The fix uses the correct Appwrite Permission and Role API (already imported at line 2).

📝 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
permissions: ["read("any")"], // optional
permissions: [Permission.read(Role.any())], // optional
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/examples/documentsdb/upsert-document.md` at line 15, The permissions
array uses invalid nested quoting ("read("any")"); replace the broken string
with a proper Appwrite Permission/Role construct by using the Permission and
Role helpers (referenced as Permission and Role) to build the permission entry
for the permissions field (i.e., use Permission.read with Role.any rather than a
raw quoted string) so the permissions property is valid JavaScript and follows
Appwrite's Permission/Role API.

transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
```
29 changes: 29 additions & 0 deletions docs/examples/vectorsdb/create-document.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
```javascript
import { Client, VectorsDB, Permission, Role } from "react-native-appwrite";

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

const vectorsDB = new VectorsDB(client);

const result = await vectorsDB.createDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {
"embeddings": [
0.12,
-0.55,
0.88,
1.02
],
"metadata": {
"key": "value"
}
},
permissions: ["read("any")"] // optional
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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify all docs examples still containing the invalid nested-quote permission literal.
rg -n --type=md 'permissions:\s*\["read\("any"\)"\]'

Repository: appwrite/sdk-for-react-native

Length of output: 1332


🏁 Script executed:

cat -n docs/examples/vectorsdb/create-document.md

Repository: appwrite/sdk-for-react-native

Length of output: 987


🏁 Script executed:

rg -n --type=md 'Permission\.' docs/examples/ -A 1 -B 1 | head -50

Repository: appwrite/sdk-for-react-native

Length of output: 351


🏁 Script executed:

rg -n 'Permission\.read' docs/examples/ -B 2 -A 2

Repository: appwrite/sdk-for-react-native

Length of output: 55


🏁 Script executed:

find . -type f -name "*.md" | xargs rg -l "Permission\|permissions" | head -5

Repository: appwrite/sdk-for-react-native

Length of output: 55


🏁 Script executed:

rg -n "Permission\s*\(" --type=typescript --type=javascript . | head -20

Repository: appwrite/sdk-for-react-native

Length of output: 107


🏁 Script executed:

cat -n README.md | head -100

Repository: appwrite/sdk-for-react-native

Length of output: 4723


🏁 Script executed:

find . -type f -name "*.ts" -o -name "*.js" | grep -E "(Permission|Role)" | head -10

Repository: appwrite/sdk-for-react-native

Length of output: 55


🏁 Script executed:

fd -t f "Permission\|Role" src/ --type f | head -20

Repository: appwrite/sdk-for-react-native

Length of output: 55


🏁 Script executed:

ls -la src/ 2>/dev/null || find . -type d -name src | head -5

Repository: appwrite/sdk-for-react-native

Length of output: 902


🏁 Script executed:

cat -n src/permission.ts

Repository: appwrite/sdk-for-react-native

Length of output: 698


🏁 Script executed:

cat -n src/role.ts

Repository: appwrite/sdk-for-react-native

Length of output: 3160


Fix invalid permissions syntax in the example.

Line 25 uses an invalid JavaScript string (["read("any")"]) with unescaped nested quotes, causing a syntax error. The correct approach is to use the helper functions.

Proposed fix
-    permissions: ["read("any")"] // optional
+    permissions: [Permission.read(Role.any())] // optional

This same issue appears in 14 documentation files across the examples directory (databases, documents, storage, tables, and vectors examples).

📝 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
permissions: ["read("any")"] // optional
permissions: [Permission.read(Role.any())] // optional
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/examples/vectorsdb/create-document.md` at line 25, The examples use an
invalid string literal permissions: ["read("any")"] which causes a syntax error;
locate occurrences of the permissions key in the examples (the literal
["read("any")"]) and replace them with the proper helper invocation (e.g.,
permissions: [read("any")] or permissions: [permissionsHelper.read("any")]
depending on the examples' helper import), ensuring the helper is
imported/available in each file; apply this fix across all example docs that
contain the invalid string.

});

console.log(result);
```
26 changes: 26 additions & 0 deletions docs/examples/vectorsdb/create-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```javascript
import { Client, VectorsDB } from "react-native-appwrite";

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

const vectorsDB = new VectorsDB(client);

const result = await vectorsDB.createOperations({
transactionId: '<TRANSACTION_ID>',
operations: [
{
"action": "create",
"databaseId": "<DATABASE_ID>",
"collectionId": "<COLLECTION_ID>",
"documentId": "<DOCUMENT_ID>",
"data": {
"name": "Walter O'Brien"
}
}
] // optional
});

console.log(result);
```
Loading
Loading