@appwrite.io/console 0.0.1 → 0.1.0-preview-0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.travis.yml +32 -0
  2. package/README.md +2 -2
  3. package/dist/cjs/sdk.js +7743 -0
  4. package/dist/cjs/sdk.js.map +1 -0
  5. package/dist/esm/sdk.js +7725 -0
  6. package/dist/esm/sdk.js.map +1 -0
  7. package/dist/iife/sdk.js +7744 -0
  8. package/docs/examples/account/create.md +1 -1
  9. package/docs/examples/account/update-password.md +1 -1
  10. package/docs/examples/databases/update-boolean-attribute.md +18 -0
  11. package/docs/examples/databases/update-datetime-attribute.md +18 -0
  12. package/docs/examples/databases/update-email-attribute.md +18 -0
  13. package/docs/examples/databases/update-enum-attribute.md +18 -0
  14. package/docs/examples/databases/update-float-attribute.md +18 -0
  15. package/docs/examples/databases/update-integer-attribute.md +18 -0
  16. package/docs/examples/databases/update-ip-attribute.md +18 -0
  17. package/docs/examples/databases/update-string-attribute.md +18 -0
  18. package/docs/examples/databases/update-url-attribute.md +18 -0
  19. package/docs/examples/functions/create.md +1 -1
  20. package/docs/examples/functions/update.md +1 -1
  21. package/docs/examples/projects/update-auth-password-dictionary.md +18 -0
  22. package/docs/examples/projects/update-auth-password-history.md +18 -0
  23. package/docs/examples/teams/create-membership.md +1 -1
  24. package/docs/examples/teams/get-prefs.md +18 -0
  25. package/docs/examples/teams/update-name.md +18 -0
  26. package/docs/examples/teams/update-prefs.md +18 -0
  27. package/docs/examples/teams/update.md +1 -1
  28. package/docs/examples/users/update-password.md +1 -1
  29. package/package.json +1 -1
  30. package/src/client.ts +1 -1
  31. package/src/models.ts +15 -3
  32. package/src/services/account.ts +7 -7
  33. package/src/services/databases.ts +516 -0
  34. package/src/services/functions.ts +3 -11
  35. package/src/services/projects.ts +62 -0
  36. package/src/services/teams.ts +92 -22
  37. package/types/client.d.ts +135 -0
  38. package/types/id.d.ts +4 -0
  39. package/types/index.d.ts +17 -0
  40. package/types/models.d.ts +2552 -0
  41. package/types/permission.d.ts +7 -0
  42. package/types/query.d.ts +21 -0
  43. package/types/role.d.ts +8 -0
  44. package/types/service.d.ts +8 -0
  45. package/types/services/account.d.ts +442 -0
  46. package/types/services/avatars.d.ts +145 -0
  47. package/types/services/databases.d.ts +637 -0
  48. package/types/services/functions.d.ts +280 -0
  49. package/types/services/graphql.d.ts +25 -0
  50. package/types/services/health.d.ts +106 -0
  51. package/types/services/locale.d.ts +81 -0
  52. package/types/services/projects.d.ts +400 -0
  53. package/types/services/storage.d.ts +229 -0
  54. package/types/services/teams.d.ts +207 -0
  55. package/types/services/users.d.ts +340 -0
  56. package/.github/workflows/publish.yml +0 -18
@@ -9,7 +9,7 @@ client
9
9
  .setProject('5df5acd0d48c2') // Your project ID
10
10
  ;
11
11
 
12
- const promise = account.create('[USER_ID]', 'email@example.com', 'password');
12
+ const promise = account.create('[USER_ID]', 'email@example.com', '');
13
13
 
14
14
  promise.then(function (response) {
15
15
  console.log(response); // Success
@@ -9,7 +9,7 @@ client
9
9
  .setProject('5df5acd0d48c2') // Your project ID
10
10
  ;
11
11
 
12
- const promise = account.updatePassword('password');
12
+ const promise = account.updatePassword('');
13
13
 
14
14
  promise.then(function (response) {
15
15
  console.log(response); // Success
@@ -0,0 +1,18 @@
1
+ import { Client, Databases } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const databases = new Databases(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 = databases.updateBooleanAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, false);
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -0,0 +1,18 @@
1
+ import { Client, Databases } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const databases = new Databases(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 = databases.updateDatetimeAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, '');
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -0,0 +1,18 @@
1
+ import { Client, Databases } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const databases = new Databases(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 = databases.updateEmailAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, 'email@example.com');
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -0,0 +1,18 @@
1
+ import { Client, Databases } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const databases = new Databases(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 = databases.updateEnumAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', [], false, '[DEFAULT]');
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -0,0 +1,18 @@
1
+ import { Client, Databases } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const databases = new Databases(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 = databases.updateFloatAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, null, null, null);
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -0,0 +1,18 @@
1
+ import { Client, Databases } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const databases = new Databases(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 = databases.updateIntegerAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, null, null, null);
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -0,0 +1,18 @@
1
+ import { Client, Databases } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const databases = new Databases(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 = databases.updateIpAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, '');
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -0,0 +1,18 @@
1
+ import { Client, Databases } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const databases = new Databases(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 = databases.updateStringAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, '[DEFAULT]');
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -0,0 +1,18 @@
1
+ import { Client, Databases } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const databases = new Databases(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 = databases.updateUrlAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', false, 'https://example.com');
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -9,7 +9,7 @@ client
9
9
  .setProject('5df5acd0d48c2') // Your project ID
10
10
  ;
11
11
 
12
- const promise = functions.create('[FUNCTION_ID]', '[NAME]', ["any"], 'node-14.5');
12
+ const promise = functions.create('[FUNCTION_ID]', '[NAME]', 'node-14.5');
13
13
 
14
14
  promise.then(function (response) {
15
15
  console.log(response); // Success
@@ -9,7 +9,7 @@ client
9
9
  .setProject('5df5acd0d48c2') // Your project ID
10
10
  ;
11
11
 
12
- const promise = functions.update('[FUNCTION_ID]', '[NAME]', ["any"]);
12
+ const promise = functions.update('[FUNCTION_ID]', '[NAME]');
13
13
 
14
14
  promise.then(function (response) {
15
15
  console.log(response); // Success
@@ -0,0 +1,18 @@
1
+ import { Client, Projects } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const projects = new Projects(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 = projects.updateAuthPasswordDictionary('[PROJECT_ID]', false);
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -0,0 +1,18 @@
1
+ import { Client, Projects } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const projects = new Projects(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 = projects.updateAuthPasswordHistory('[PROJECT_ID]', 0);
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -9,7 +9,7 @@ client
9
9
  .setProject('5df5acd0d48c2') // Your project ID
10
10
  ;
11
11
 
12
- const promise = teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com');
12
+ const promise = teams.createMembership('[TEAM_ID]', [], 'https://example.com');
13
13
 
14
14
  promise.then(function (response) {
15
15
  console.log(response); // Success
@@ -0,0 +1,18 @@
1
+ import { Client, Teams } from "@appwrite.io/console";
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.getPrefs('[TEAM_ID]');
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -0,0 +1,18 @@
1
+ import { Client, Teams } from "@appwrite.io/console";
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
+ });
@@ -0,0 +1,18 @@
1
+ import { Client, Teams } from "@appwrite.io/console";
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
+ });
@@ -1,4 +1,4 @@
1
- import { Client, Teams } from "@appwrite.io/console";
1
+ import { Client, Teams } from "appwrite";
2
2
 
3
3
  const client = new Client();
4
4
 
@@ -9,7 +9,7 @@ client
9
9
  .setProject('5df5acd0d48c2') // Your project ID
10
10
  ;
11
11
 
12
- const promise = users.updatePassword('[USER_ID]', 'password');
12
+ const promise = users.updatePassword('[USER_ID]', '');
13
13
 
14
14
  promise.then(function (response) {
15
15
  console.log(response); // Success
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@appwrite.io/console",
3
3
  "homepage": "https://appwrite.io/support",
4
4
  "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": "0.0.1",
5
+ "version": "0.1.0-preview-0.0",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "dist/cjs/sdk.js",
8
8
  "exports": {
package/src/client.ts CHANGED
@@ -104,7 +104,7 @@ class Client {
104
104
  'x-sdk-name': 'Console',
105
105
  'x-sdk-platform': 'console',
106
106
  'x-sdk-language': 'web',
107
- 'x-sdk-version': '0.0.1',
107
+ 'x-sdk-version': '0.1.0-preview-0.0',
108
108
  'X-Appwrite-Response-Format': '1.0.0',
109
109
  };
110
110
 
package/src/models.ts CHANGED
@@ -119,7 +119,7 @@ export namespace Models {
119
119
  /**
120
120
  * Teams List
121
121
  */
122
- export type TeamList = {
122
+ export type TeamList<Preferences extends Models.Preferences> = {
123
123
  /**
124
124
  * Total number of teams documents that matched your query.
125
125
  */
@@ -127,7 +127,7 @@ export namespace Models {
127
127
  /**
128
128
  * List of teams.
129
129
  */
130
- teams: Team[];
130
+ teams: Team<Preferences>[];
131
131
  }
132
132
  /**
133
133
  * Memberships List
@@ -1369,7 +1369,7 @@ export namespace Models {
1369
1369
  /**
1370
1370
  * Team
1371
1371
  */
1372
- export type Team = {
1372
+ export type Team<Preferences extends Models.Preferences> = {
1373
1373
  /**
1374
1374
  * Team ID.
1375
1375
  */
@@ -1390,6 +1390,10 @@ export namespace Models {
1390
1390
  * Total number of team members.
1391
1391
  */
1392
1392
  total: number;
1393
+ /**
1394
+ * Team preferences as a key-value object
1395
+ */
1396
+ prefs: Preferences;
1393
1397
  }
1394
1398
  /**
1395
1399
  * Membership
@@ -1720,6 +1724,14 @@ export namespace Models {
1720
1724
  * Max sessions allowed per user. 100 maximum.
1721
1725
  */
1722
1726
  authSessionsLimit: number;
1727
+ /**
1728
+ * Max allowed passwords in the history list per user. Max passwords limit allowed in history is 20. Use 0 for disabling password history.
1729
+ */
1730
+ authPasswordHistory: number;
1731
+ /**
1732
+ * Whether or not to check user&#039;s password against most commonly used passwords.
1733
+ */
1734
+ authPasswordDictionary: boolean;
1723
1735
  /**
1724
1736
  * List of Providers.
1725
1737
  */
@@ -18,7 +18,7 @@ export class Account extends Service {
18
18
  * @throws {AppwriteException}
19
19
  * @returns {Promise}
20
20
  */
21
- async get<Preferences extends Models.Preferences>(): Promise<Models.Account<Preferences>> {
21
+ async get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
22
22
  let path = '/account';
23
23
  let payload: Payload = {};
24
24
 
@@ -45,7 +45,7 @@ export class Account extends Service {
45
45
  * @throws {AppwriteException}
46
46
  * @returns {Promise}
47
47
  */
48
- async create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.Account<Preferences>> {
48
+ async create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
49
49
  if (typeof userId === 'undefined') {
50
50
  throw new AppwriteException('Missing required parameter: "userId"');
51
51
  }
@@ -100,7 +100,7 @@ export class Account extends Service {
100
100
  * @throws {AppwriteException}
101
101
  * @returns {Promise}
102
102
  */
103
- async updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.Account<Preferences>> {
103
+ async updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.User<Preferences>> {
104
104
  if (typeof email === 'undefined') {
105
105
  throw new AppwriteException('Missing required parameter: "email"');
106
106
  }
@@ -181,7 +181,7 @@ export class Account extends Service {
181
181
  * @throws {AppwriteException}
182
182
  * @returns {Promise}
183
183
  */
184
- async updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.Account<Preferences>> {
184
+ async updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.User<Preferences>> {
185
185
  if (typeof name === 'undefined') {
186
186
  throw new AppwriteException('Missing required parameter: "name"');
187
187
  }
@@ -247,7 +247,7 @@ export class Account extends Service {
247
247
  * @throws {AppwriteException}
248
248
  * @returns {Promise}
249
249
  */
250
- async updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.Account<Preferences>> {
250
+ async updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.User<Preferences>> {
251
251
  if (typeof phone === 'undefined') {
252
252
  throw new AppwriteException('Missing required parameter: "phone"');
253
253
  }
@@ -298,11 +298,11 @@ export class Account extends Service {
298
298
  * stored as is, and replaces any previous value. The maximum allowed prefs
299
299
  * size is 64kB and throws error if exceeded.
300
300
  *
301
- * @param {object} prefs
301
+ * @param {Partial<Preferences>} prefs
302
302
  * @throws {AppwriteException}
303
303
  * @returns {Promise}
304
304
  */
305
- async updatePrefs<Preferences extends Models.Preferences>(prefs: object): Promise<Models.Account<Preferences>> {
305
+ async updatePrefs<Preferences extends Models.Preferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>> {
306
306
  if (typeof prefs === 'undefined') {
307
307
  throw new AppwriteException('Missing required parameter: "prefs"');
308
308
  }