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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change log

## 0.17.0

* Add transaction support for Databases and TablesDB

## 0.16.0

* Deprecate `createVerification` method in `Account` service
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/databases/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const result = await databases.createDocument({
"age": 30,
"isAdmin": false
},
permissions: ["read("any")"] // optional
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>' // optional
Comment on lines +20 to +21
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

Correct the permissions string literal.

["read("any")"] is syntactically invalid—copying this snippet will throw. Use single quotes (or escape the inner quotes) so developers can paste and run the example as-is.

-    permissions: ["read("any")"], // optional
+    permissions: ['read("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
transactionId: '<TRANSACTION_ID>' // optional
permissions: ['read("any")'], // optional
transactionId: '<TRANSACTION_ID>' // optional
🤖 Prompt for AI Agents
In docs/examples/databases/create-document.md around lines 20 to 21, the
permissions entry uses invalid nested double quotes ("read("any")"); fix it by
using single quotes for the inner string or by escaping the inner quotes so the
permissions array contains a valid string (for example read('any')), keeping the
transactionId line unchanged.

});

console.log(result);
24 changes: 24 additions & 0 deletions docs/examples/databases/create-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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.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);
13 changes: 13 additions & 0 deletions docs/examples/databases/create-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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.createTransaction({
ttl: 60 // optional
});

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/databases/decrement-document-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const result = await databases.decrementDocumentAttribute({
documentId: '<DOCUMENT_ID>',
attribute: '',
value: 0, // optional
min: 0 // optional
min: 0, // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/databases/delete-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const databases = new Databases(client);
const result = await databases.deleteDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>'
documentId: '<DOCUMENT_ID>',
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
13 changes: 13 additions & 0 deletions docs/examples/databases/delete-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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.deleteTransaction({
transactionId: '<TRANSACTION_ID>'
});

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/databases/get-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const result = await databases.getDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
queries: [] // optional
queries: [], // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
13 changes: 13 additions & 0 deletions docs/examples/databases/get-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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.getTransaction({
transactionId: '<TRANSACTION_ID>'
});

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/databases/increment-document-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const result = await databases.incrementDocumentAttribute({
documentId: '<DOCUMENT_ID>',
attribute: '',
value: 0, // optional
max: 0 // optional
max: 0, // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/databases/list-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const databases = new Databases(client);
const result = await databases.listDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [] // optional
queries: [], // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
13 changes: 13 additions & 0 deletions docs/examples/databases/list-transactions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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.listTransactions({
queries: [] // optional
});

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/databases/update-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const result = await databases.updateDocument({
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {}, // optional
permissions: ["read("any")"] // optional
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
15 changes: 15 additions & 0 deletions docs/examples/databases/update-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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.updateTransaction({
transactionId: '<TRANSACTION_ID>',
commit: false, // optional
rollback: false // optional
});

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/databases/upsert-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const result = await databases.upsertDocument({
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {},
permissions: ["read("any")"] // optional
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>' // optional
Comment on lines +14 to +15
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

Correct the permissions string literal.

"read("any")" is malformed JavaScript; escaping or switching quote types keeps the example usable.

Apply this diff:

-    permissions: ["read("any")"], // optional
+    permissions: ['read("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
transactionId: '<TRANSACTION_ID>' // optional
permissions: ['read("any")'], // optional
transactionId: '<TRANSACTION_ID>' // optional
🤖 Prompt for AI Agents
docs/examples/databases/upsert-document.md lines 14-15: the permissions string
literal is malformed ("read("any")"); change it to a valid JS string by either
using single outer quotes with double inner quotes like ['read("any")'], using
double outer quotes and single inner quotes like ["read('any')"], or escaping
the inner quotes like "read(\"any\")", and update the example accordingly so it
parses.

});

console.log(result);
24 changes: 24 additions & 0 deletions docs/examples/tablesdb/create-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Client, TablesDB } 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 tablesDB = new TablesDB(client);

const result = await tablesDB.createOperations({
transactionId: '<TRANSACTION_ID>',
operations: [
{
"action": "create",
"databaseId": "<DATABASE_ID>",
"tableId": "<TABLE_ID>",
"rowId": "<ROW_ID>",
"data": {
"name": "Walter O'Brien"
}
}
] // optional
});

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/create-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const result = await tablesDB.createRow({
"age": 30,
"isAdmin": false
},
permissions: ["read("any")"] // optional
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>' // optional
Comment on lines +20 to +21
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

Fix invalid string literal in example.

"read("any")" terminates early and breaks copy/paste. Use single quotes outside or escape the inner quotes so the snippet stays valid.

Apply this diff:

-    permissions: ["read("any")"], // optional
+    permissions: ['read("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
transactionId: '<TRANSACTION_ID>' // optional
permissions: ['read("any")'], // optional
transactionId: '<TRANSACTION_ID>' // optional
🤖 Prompt for AI Agents
In docs/examples/tablesdb/create-row.md around lines 20 to 21 the example has an
invalid string literal permissions: ["read("any")"] which terminates early;
replace it with a valid quoted string such as permissions: ['read("any")'] or
escape the inner quotes permissions: ["read(\"any\")"] so the snippet is
syntactically correct and copy/paste-safe.

});

console.log(result);
13 changes: 13 additions & 0 deletions docs/examples/tablesdb/create-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Client, TablesDB } 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 tablesDB = new TablesDB(client);

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

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/decrement-row-column.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const result = await tablesDB.decrementRowColumn({
rowId: '<ROW_ID>',
column: '',
value: 0, // optional
min: 0 // optional
min: 0, // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/delete-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const tablesDB = new TablesDB(client);
const result = await tablesDB.deleteRow({
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>'
rowId: '<ROW_ID>',
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
13 changes: 13 additions & 0 deletions docs/examples/tablesdb/delete-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Client, TablesDB } 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 tablesDB = new TablesDB(client);

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

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/get-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const result = await tablesDB.getRow({
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
queries: [] // optional
queries: [], // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
13 changes: 13 additions & 0 deletions docs/examples/tablesdb/get-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Client, TablesDB } 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 tablesDB = new TablesDB(client);

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

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/increment-row-column.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const result = await tablesDB.incrementRowColumn({
rowId: '<ROW_ID>',
column: '',
value: 0, // optional
max: 0 // optional
max: 0, // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/list-rows.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const tablesDB = new TablesDB(client);
const result = await tablesDB.listRows({
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
queries: [] // optional
queries: [], // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
13 changes: 13 additions & 0 deletions docs/examples/tablesdb/list-transactions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Client, TablesDB } 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 tablesDB = new TablesDB(client);

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

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/update-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const result = await tablesDB.updateRow({
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
data: {}, // optional
permissions: ["read("any")"] // optional
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>' // optional
Comment on lines +14 to +15
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

Fix invalid permissions string literal.

["read("any")"] is not valid JavaScript/TypeScript because the inner quotes terminate the string. The snippet breaks if copied verbatim. Please switch to single quotes (or escape the inner quotes) to keep the example runnable.

-    permissions: ["read("any")"], // optional
+    permissions: ['read("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
transactionId: '<TRANSACTION_ID>' // optional
permissions: ['read("any")'], // optional
transactionId: '<TRANSACTION_ID>' // optional
🤖 Prompt for AI Agents
In docs/examples/tablesdb/update-row.md around lines 14 to 15, the example uses
an invalid string literal permissions: ["read("any")"] which breaks JS/TS;
change it to use valid quoting or escaping such as permissions: ['read("any")']
or permissions: ["read(\"any\")"] so the inner quotes do not terminate the
string, and update the example accordingly to keep it runnable.

});

console.log(result);
15 changes: 15 additions & 0 deletions docs/examples/tablesdb/update-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Client, TablesDB } 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 tablesDB = new TablesDB(client);

const result = await tablesDB.updateTransaction({
transactionId: '<TRANSACTION_ID>',
commit: false, // optional
rollback: false // optional
});

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/upsert-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const result = await tablesDB.upsertRow({
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
data: {}, // optional
permissions: ["read("any")"] // optional
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
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": "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.16.0",
"version": "0.17.0",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class Client {
'x-sdk-name': 'React Native',
'x-sdk-platform': 'client',
'x-sdk-language': 'reactnative',
'x-sdk-version': '0.16.0',
'x-sdk-version': '0.17.0',
'X-Appwrite-Response-Format': '1.8.0',
};

Expand Down
Loading