@appwrite.io/console 0.3.0 → 0.4.1

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 (54) hide show
  1. package/.github/workflows/publish.yml +2 -2
  2. package/README.md +3 -3
  3. package/dist/cjs/sdk.js +1354 -1197
  4. package/dist/cjs/sdk.js.map +1 -1
  5. package/dist/esm/sdk.js +1354 -1197
  6. package/dist/esm/sdk.js.map +1 -1
  7. package/dist/iife/sdk.js +1354 -1197
  8. package/docs/examples/functions/create.md +1 -1
  9. package/docs/examples/functions/update.md +1 -1
  10. package/docs/examples/{projects/get-usage.md → health/get-queue-builds.md} +3 -3
  11. package/docs/examples/{account/create-with-invite-code.md → health/get-queue-databases.md} +3 -3
  12. package/docs/examples/health/get-queue-deletes.md +18 -0
  13. package/docs/examples/health/get-queue-mails.md +18 -0
  14. package/docs/examples/health/get-queue-messaging.md +18 -0
  15. package/docs/examples/health/get-queue-migrations.md +18 -0
  16. package/docs/examples/project/get-usage.md +1 -1
  17. package/docs/examples/teams/create-membership.md +1 -1
  18. package/package.json +3 -2
  19. package/src/client.ts +1 -1
  20. package/src/models.ts +147 -279
  21. package/src/query.ts +1 -1
  22. package/src/role.ts +72 -6
  23. package/src/services/account.ts +154 -204
  24. package/src/services/assistant.ts +3 -3
  25. package/src/services/avatars.ts +32 -31
  26. package/src/services/console.ts +4 -4
  27. package/src/services/databases.ts +195 -195
  28. package/src/services/functions.ts +117 -126
  29. package/src/services/graphql.ts +8 -8
  30. package/src/services/health.ts +219 -50
  31. package/src/services/locale.ts +31 -31
  32. package/src/services/migrations.ts +48 -48
  33. package/src/services/project.ts +40 -22
  34. package/src/services/projects.ts +143 -170
  35. package/src/services/proxy.ts +15 -15
  36. package/src/services/storage.ts +74 -84
  37. package/src/services/teams.ts +62 -66
  38. package/src/services/users.ts +132 -135
  39. package/src/services/vcs.ts +27 -27
  40. package/types/models.d.ts +147 -279
  41. package/types/role.d.ts +62 -0
  42. package/types/services/account.d.ts +61 -70
  43. package/types/services/avatars.d.ts +11 -10
  44. package/types/services/console.d.ts +1 -1
  45. package/types/services/databases.d.ts +51 -51
  46. package/types/services/functions.d.ts +32 -27
  47. package/types/services/graphql.d.ts +2 -2
  48. package/types/services/health.d.ts +85 -14
  49. package/types/services/locale.d.ts +7 -7
  50. package/types/services/project.d.ts +4 -2
  51. package/types/services/projects.d.ts +26 -36
  52. package/types/services/storage.d.ts +13 -13
  53. package/types/services/teams.d.ts +20 -20
  54. package/types/services/users.d.ts +45 -44
package/src/role.ts CHANGED
@@ -1,34 +1,100 @@
1
+ /**
2
+ * Helper class to generate role strings for `Permission`.
3
+ */
1
4
  export class Role {
5
+
6
+ /**
7
+ * Grants access to anyone.
8
+ *
9
+ * This includes authenticated and unauthenticated users.
10
+ *
11
+ * @returns {string}
12
+ */
2
13
  public static any(): string {
3
14
  return 'any'
4
15
  }
5
16
 
17
+ /**
18
+ * Grants access to a specific user by user ID.
19
+ *
20
+ * You can optionally pass verified or unverified for
21
+ * `status` to target specific types of users.
22
+ *
23
+ * @param {string} id
24
+ * @param {string} status
25
+ * @returns {string}
26
+ */
6
27
  public static user(id: string, status: string = ''): string {
7
- if(status === '') {
28
+ if (status === '') {
8
29
  return `user:${id}`
9
30
  }
10
31
  return `user:${id}/${status}`
11
32
  }
12
-
33
+
34
+ /**
35
+ * Grants access to any authenticated or anonymous user.
36
+ *
37
+ * You can optionally pass verified or unverified for
38
+ * `status` to target specific types of users.
39
+ *
40
+ * @param {string} status
41
+ * @returns {string}
42
+ */
13
43
  public static users(status: string = ''): string {
14
- if(status === '') {
44
+ if (status === '') {
15
45
  return 'users'
16
46
  }
17
47
  return `users/${status}`
18
48
  }
19
-
49
+
50
+ /**
51
+ * Grants access to any guest user without a session.
52
+ *
53
+ * Authenticated users don't have access to this role.
54
+ *
55
+ * @returns {string}
56
+ */
20
57
  public static guests(): string {
21
58
  return 'guests'
22
59
  }
23
-
60
+
61
+ /**
62
+ * Grants access to a team by team ID.
63
+ *
64
+ * You can optionally pass a role for `role` to target
65
+ * team members with the specified role.
66
+ *
67
+ * @param {string} id
68
+ * @param {string} role
69
+ * @returns {string}
70
+ */
24
71
  public static team(id: string, role: string = ''): string {
25
- if(role === '') {
72
+ if (role === '') {
26
73
  return `team:${id}`
27
74
  }
28
75
  return `team:${id}/${role}`
29
76
  }
30
77
 
78
+ /**
79
+ * Grants access to a specific member of a team.
80
+ *
81
+ * When the member is removed from the team, they will
82
+ * no longer have access.
83
+ *
84
+ * @param {string} id
85
+ * @returns {string}
86
+ */
31
87
  public static member(id: string): string {
32
88
  return `member:${id}`
33
89
  }
90
+
91
+ /**
92
+ * Grants access to a user with the specified label.
93
+ *
94
+ * @param {string} name
95
+ * @returns {string}
96
+ */
97
+ public static label(name: string): string {
98
+ return `label:${name}`
99
+ }
34
100
  }