Skip to content

Commit 7b37a2b

Browse files
Merge pull request #52 from appwrite/dev
update to appwrite 1.3.0
2 parents 1dde5c7 + 97913bf commit 7b37a2b

File tree

15 files changed

+300
-52
lines changed

15 files changed

+300
-52
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2022 Appwrite (https://appwrite.io) and individual contributors.
1+
Copyright (c) 2023 Appwrite (https://appwrite.io) and individual contributors.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Appwrite Web SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-web.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-1.2.0-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.3.0-blue.svg?style=flat-square)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
88

9-
**This SDK is compatible with Appwrite server version 1.2.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/releases).**
9+
**This SDK is compatible with Appwrite server version 1.3.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/releases).**
1010

1111
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 Web 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)
1212

@@ -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@10.2.0"></script>
36+
<script src="https://cdn.jsdelivr.net/npm/appwrite@11.0.0"></script>
3737
```
3838

3939

docs/examples/account/create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ client
99
.setProject('5df5acd0d48c2') // Your project ID
1010
;
1111

12-
const promise = account.create('[USER_ID]', '[email protected]', 'password');
12+
const promise = account.create('[USER_ID]', '[email protected]', '');
1313

1414
promise.then(function (response) {
1515
console.log(response); // Success

docs/examples/account/update-password.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ client
99
.setProject('5df5acd0d48c2') // Your project ID
1010
;
1111

12-
const promise = account.updatePassword('password');
12+
const promise = account.updatePassword('');
1313

1414
promise.then(function (response) {
1515
console.log(response); // Success

docs/examples/teams/create-membership.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ client
99
.setProject('5df5acd0d48c2') // Your project ID
1010
;
1111

12-
const promise = teams.createMembership('[TEAM_ID]', '[email protected]', [], 'https://example.com');
12+
const promise = teams.createMembership('[TEAM_ID]', [], 'https://example.com');
1313

1414
promise.then(function (response) {
1515
console.log(response); // Success

docs/examples/teams/update.md renamed to docs/examples/teams/get-prefs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ client
99
.setProject('5df5acd0d48c2') // Your project ID
1010
;
1111

12-
const promise = teams.update('[TEAM_ID]', '[NAME]');
12+
const promise = teams.getPrefs('[TEAM_ID]');
1313

1414
promise.then(function (response) {
1515
console.log(response); // Success

docs/examples/teams/update-name.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Client, Teams } from "appwrite";
2+
3+
const client = new Client();
4+
5+
const teams = new Teams(client);
6+
7+
client
8+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
;
11+
12+
const promise = teams.updateName('[TEAM_ID]', '[NAME]');
13+
14+
promise.then(function (response) {
15+
console.log(response); // Success
16+
}, function (error) {
17+
console.log(error); // Failure
18+
});

docs/examples/teams/update-prefs.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Client, Teams } from "appwrite";
2+
3+
const client = new Client();
4+
5+
const teams = new Teams(client);
6+
7+
client
8+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
;
11+
12+
const promise = teams.updatePrefs('[TEAM_ID]', {});
13+
14+
promise.then(function (response) {
15+
console.log(response); // Success
16+
}, function (error) {
17+
console.log(error); // Failure
18+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "appwrite",
33
"homepage": "https://appwrite.io/support",
44
"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",
5-
"version": "10.2.0",
5+
"version": "11.0.0",
66
"license": "BSD-3-Clause",
77
"main": "dist/cjs/sdk.js",
88
"exports": {

src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class Client {
102102
'x-sdk-name': 'Web',
103103
'x-sdk-platform': 'client',
104104
'x-sdk-language': 'web',
105-
'x-sdk-version': '10.2.0',
105+
'x-sdk-version': '11.0.0',
106106
'X-Appwrite-Response-Format': '1.0.0',
107107
};
108108

src/models.ts

Lines changed: 125 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ export namespace Models {
5454
/**
5555
* Teams List
5656
*/
57-
export type TeamList = {
57+
export type TeamList<Preferences extends Models.Preferences> = {
5858
/**
5959
* Total number of teams documents that matched your query.
6060
*/
6161
total: number;
6262
/**
6363
* List of teams.
6464
*/
65-
teams: Team[];
65+
teams: Team<Preferences>[];
6666
}
6767
/**
6868
* Memberships List
@@ -275,9 +275,9 @@ export namespace Models {
275275
countryName: string;
276276
}
277277
/**
278-
* Account
278+
* User
279279
*/
280-
export type Account<Preferences extends Models.Preferences> = {
280+
export type User<Preferences extends Models.Preferences> = {
281281
/**
282282
* User ID.
283283
*/
@@ -294,6 +294,18 @@ export namespace Models {
294294
* User name.
295295
*/
296296
name: string;
297+
/**
298+
* Hashed user password.
299+
*/
300+
password?: string;
301+
/**
302+
* Password hashing algorithm.
303+
*/
304+
hash?: string;
305+
/**
306+
* Password hashing algorithm configuration.
307+
*/
308+
hashOptions?: object;
297309
/**
298310
* User registration date in ISO 8601 format.
299311
*/
@@ -327,6 +339,109 @@ export namespace Models {
327339
*/
328340
prefs: Preferences;
329341
}
342+
/**
343+
* AlgoMD5
344+
*/
345+
export type AlgoMd5 = {
346+
/**
347+
* Algo type.
348+
*/
349+
type: string;
350+
}
351+
/**
352+
* AlgoSHA
353+
*/
354+
export type AlgoSha = {
355+
/**
356+
* Algo type.
357+
*/
358+
type: string;
359+
}
360+
/**
361+
* AlgoPHPass
362+
*/
363+
export type AlgoPhpass = {
364+
/**
365+
* Algo type.
366+
*/
367+
type: string;
368+
}
369+
/**
370+
* AlgoBcrypt
371+
*/
372+
export type AlgoBcrypt = {
373+
/**
374+
* Algo type.
375+
*/
376+
type: string;
377+
}
378+
/**
379+
* AlgoScrypt
380+
*/
381+
export type AlgoScrypt = {
382+
/**
383+
* Algo type.
384+
*/
385+
type: string;
386+
/**
387+
* CPU complexity of computed hash.
388+
*/
389+
costCpu: number;
390+
/**
391+
* Memory complexity of computed hash.
392+
*/
393+
costMemory: number;
394+
/**
395+
* Parallelization of computed hash.
396+
*/
397+
costParallel: number;
398+
/**
399+
* Length used to compute hash.
400+
*/
401+
length: number;
402+
}
403+
/**
404+
* AlgoScryptModified
405+
*/
406+
export type AlgoScryptModified = {
407+
/**
408+
* Algo type.
409+
*/
410+
type: string;
411+
/**
412+
* Salt used to compute hash.
413+
*/
414+
salt: string;
415+
/**
416+
* Separator used to compute hash.
417+
*/
418+
saltSeparator: string;
419+
/**
420+
* Key used to compute hash.
421+
*/
422+
signerKey: string;
423+
}
424+
/**
425+
* AlgoArgon2
426+
*/
427+
export type AlgoArgon2 = {
428+
/**
429+
* Algo type.
430+
*/
431+
type: string;
432+
/**
433+
* Memory used to compute hash.
434+
*/
435+
memoryCost: number;
436+
/**
437+
* Amount of time consumed to compute hash
438+
*/
439+
timeCost: number;
440+
/**
441+
* Number of threads used to compute hash.
442+
*/
443+
threads: number;
444+
}
330445
/**
331446
* Preferences
332447
*/
@@ -497,7 +612,7 @@ export namespace Models {
497612
*/
498613
continent: string;
499614
/**
500-
* True if country is part of the Europian Union.
615+
* True if country is part of the European Union.
501616
*/
502617
eu: boolean;
503618
/**
@@ -557,7 +672,7 @@ export namespace Models {
557672
/**
558673
* Team
559674
*/
560-
export type Team = {
675+
export type Team<Preferences extends Models.Preferences> = {
561676
/**
562677
* Team ID.
563678
*/
@@ -578,6 +693,10 @@ export namespace Models {
578693
* Total number of team members.
579694
*/
580695
total: number;
696+
/**
697+
* Team preferences as a key-value object
698+
*/
699+
prefs: Preferences;
581700
}
582701
/**
583702
* Membership

src/query.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,24 @@ export class Query {
2121
static greaterThanEqual = (attribute: string, value: QueryTypes): string =>
2222
Query.addQuery(attribute, "greaterThanEqual", value);
2323

24+
static isNull = (attribute: string): string =>
25+
`isNull("${attribute}")`;
26+
27+
static isNotNull = (attribute: string): string =>
28+
`isNotNull("${attribute}")`;
29+
30+
static between = (attribute: string, start: string|number, end: string|number): string =>
31+
`between("${attribute}", [${Query.parseValues(start)},${Query.parseValues(end)}])`;
32+
33+
static startsWith = (attribute: string, value: string): string =>
34+
Query.addQuery(attribute, "startsWith", value);
35+
36+
static endsWith = (attribute: string, value: string): string =>
37+
Query.addQuery(attribute, "endsWith", value);
38+
39+
static select = (attributes: string[]): string =>
40+
`select([${attributes.map((attr: string) => `"${attr}"`).join(",")}])`;
41+
2442
static search = (attribute: string, value: string): string =>
2543
Query.addQuery(attribute, "search", value);
2644

0 commit comments

Comments
 (0)