Skip to content

Commit a51cddc

Browse files
authored
Merge pull request #143 from appwrite/dev
feat: Web SDK update for version 21.2.0
2 parents 0c95b17 + 4a219c9 commit a51cddc

35 files changed

+1155
-131
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 21.2.0
4+
5+
* Add transaction support for Databases and TablesDB
6+
37
## 21.1.0
48

59
* Deprecate `createVerification` method in `Account` service

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { Client, Account } from "appwrite";
3333
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:
3434

3535
```html
36-
<script src="https://cdn.jsdelivr.net/npm/appwrite@21.1.0"></script>
36+
<script src="https://cdn.jsdelivr.net/npm/appwrite@21.2.0"></script>
3737
```
3838

3939

docs/examples/databases/create-document.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ const result = await databases.createDocument({
1717
"age": 30,
1818
"isAdmin": false
1919
},
20-
permissions: ["read("any")"] // optional
20+
permissions: ["read("any")"], // optional
21+
transactionId: '<TRANSACTION_ID>' // optional
2122
});
2223

2324
console.log(result);
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Client, Databases } from "appwrite";
2+
3+
const client = new Client()
4+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
6+
7+
const databases = new Databases(client);
8+
9+
const result = await databases.createOperations({
10+
transactionId: '<TRANSACTION_ID>',
11+
operations: [
12+
{
13+
"action": "create",
14+
"databaseId": "<DATABASE_ID>",
15+
"collectionId": "<COLLECTION_ID>",
16+
"documentId": "<DOCUMENT_ID>",
17+
"data": {
18+
"name": "Walter O'Brien"
19+
}
20+
}
21+
] // optional
22+
});
23+
24+
console.log(result);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Client, Databases } from "appwrite";
2+
3+
const client = new Client()
4+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
6+
7+
const databases = new Databases(client);
8+
9+
const result = await databases.createTransaction({
10+
ttl: 60 // optional
11+
});
12+
13+
console.log(result);

docs/examples/databases/decrement-document-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const result = await databases.decrementDocumentAttribute({
1212
documentId: '<DOCUMENT_ID>',
1313
attribute: '',
1414
value: null, // optional
15-
min: null // optional
15+
min: null, // optional
16+
transactionId: '<TRANSACTION_ID>' // optional
1617
});
1718

1819
console.log(result);

docs/examples/databases/delete-document.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const databases = new Databases(client);
99
const result = await databases.deleteDocument({
1010
databaseId: '<DATABASE_ID>',
1111
collectionId: '<COLLECTION_ID>',
12-
documentId: '<DOCUMENT_ID>'
12+
documentId: '<DOCUMENT_ID>',
13+
transactionId: '<TRANSACTION_ID>' // optional
1314
});
1415

1516
console.log(result);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Client, Databases } from "appwrite";
2+
3+
const client = new Client()
4+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
6+
7+
const databases = new Databases(client);
8+
9+
const result = await databases.deleteTransaction({
10+
transactionId: '<TRANSACTION_ID>'
11+
});
12+
13+
console.log(result);

docs/examples/databases/get-document.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ const result = await databases.getDocument({
1010
databaseId: '<DATABASE_ID>',
1111
collectionId: '<COLLECTION_ID>',
1212
documentId: '<DOCUMENT_ID>',
13-
queries: [] // optional
13+
queries: [], // optional
14+
transactionId: '<TRANSACTION_ID>' // optional
1415
});
1516

1617
console.log(result);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Client, Databases } from "appwrite";
2+
3+
const client = new Client()
4+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
6+
7+
const databases = new Databases(client);
8+
9+
const result = await databases.getTransaction({
10+
transactionId: '<TRANSACTION_ID>'
11+
});
12+
13+
console.log(result);

0 commit comments

Comments
 (0)