@appwrite.io/console 2.0.0 → 2.1.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 (49) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +2 -2
  3. package/dist/cjs/sdk.js +81 -15
  4. package/dist/cjs/sdk.js.map +1 -1
  5. package/dist/esm/sdk.js +77 -15
  6. package/dist/esm/sdk.js.map +1 -1
  7. package/dist/iife/sdk.js +3838 -15
  8. package/docs/examples/account/update-payment-method.md +1 -1
  9. package/docs/examples/projects/update-labels.md +14 -0
  10. package/package.json +7 -1
  11. package/rollup.config.js +40 -24
  12. package/src/client.ts +49 -10
  13. package/src/models.ts +432 -424
  14. package/src/query.ts +14 -11
  15. package/src/services/account.ts +20 -20
  16. package/src/services/avatars.ts +117 -117
  17. package/src/services/backups.ts +18 -18
  18. package/src/services/console.ts +24 -24
  19. package/src/services/databases.ts +119 -119
  20. package/src/services/domains.ts +204 -204
  21. package/src/services/functions.ts +30 -30
  22. package/src/services/health.ts +146 -146
  23. package/src/services/messaging.ts +54 -54
  24. package/src/services/migrations.ts +36 -36
  25. package/src/services/organizations.ts +42 -42
  26. package/src/services/projects.ts +146 -83
  27. package/src/services/sites.ts +30 -30
  28. package/src/services/storage.ts +49 -49
  29. package/src/services/tables-db.ts +119 -119
  30. package/src/services/users.ts +39 -39
  31. package/types/client.d.ts +27 -1
  32. package/types/models.d.ts +432 -424
  33. package/types/query.d.ts +8 -8
  34. package/types/services/account.d.ts +11 -11
  35. package/types/services/avatars.d.ts +82 -82
  36. package/types/services/backups.d.ts +8 -8
  37. package/types/services/console.d.ts +14 -14
  38. package/types/services/databases.d.ts +70 -70
  39. package/types/services/domains.d.ts +104 -104
  40. package/types/services/functions.d.ts +15 -15
  41. package/types/services/health.d.ts +72 -72
  42. package/types/services/messaging.d.ts +24 -24
  43. package/types/services/migrations.d.ts +16 -16
  44. package/types/services/organizations.d.ts +22 -22
  45. package/types/services/projects.d.ts +60 -38
  46. package/types/services/sites.d.ts +15 -15
  47. package/types/services/storage.d.ts +34 -34
  48. package/types/services/tables-db.d.ts +70 -70
  49. package/types/services/users.d.ts +24 -24
@@ -621,15 +621,15 @@ export class Users {
621
621
  * @param {string} params.email - User email.
622
622
  * @param {string} params.password - User password hashed using Scrypt.
623
623
  * @param {string} params.passwordSalt - Optional salt used to hash password.
624
- * @param {number} params.passwordCpu - Optional CPU cost used to hash password.
625
- * @param {number} params.passwordMemory - Optional memory cost used to hash password.
626
- * @param {number} params.passwordParallel - Optional parallelization cost used to hash password.
627
- * @param {number} params.passwordLength - Optional hash length used to hash password.
624
+ * @param {number | bigint} params.passwordCpu - Optional CPU cost used to hash password.
625
+ * @param {number | bigint} params.passwordMemory - Optional memory cost used to hash password.
626
+ * @param {number | bigint} params.passwordParallel - Optional parallelization cost used to hash password.
627
+ * @param {number | bigint} params.passwordLength - Optional hash length used to hash password.
628
628
  * @param {string} params.name - User name. Max length: 128 chars.
629
629
  * @throws {AppwriteException}
630
630
  * @returns {Promise<Models.User<Preferences>>}
631
631
  */
632
- createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }): Promise<Models.User<Preferences>>;
632
+ createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number | bigint, passwordMemory: number | bigint, passwordParallel: number | bigint, passwordLength: number | bigint, name?: string }): Promise<Models.User<Preferences>>;
633
633
  /**
634
634
  * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
635
635
  *
@@ -637,34 +637,34 @@ export class Users {
637
637
  * @param {string} email - User email.
638
638
  * @param {string} password - User password hashed using Scrypt.
639
639
  * @param {string} passwordSalt - Optional salt used to hash password.
640
- * @param {number} passwordCpu - Optional CPU cost used to hash password.
641
- * @param {number} passwordMemory - Optional memory cost used to hash password.
642
- * @param {number} passwordParallel - Optional parallelization cost used to hash password.
643
- * @param {number} passwordLength - Optional hash length used to hash password.
640
+ * @param {number | bigint} passwordCpu - Optional CPU cost used to hash password.
641
+ * @param {number | bigint} passwordMemory - Optional memory cost used to hash password.
642
+ * @param {number | bigint} passwordParallel - Optional parallelization cost used to hash password.
643
+ * @param {number | bigint} passwordLength - Optional hash length used to hash password.
644
644
  * @param {string} name - User name. Max length: 128 chars.
645
645
  * @throws {AppwriteException}
646
646
  * @returns {Promise<Models.User<Preferences>>}
647
647
  * @deprecated Use the object parameter style method for a better developer experience.
648
648
  */
649
- createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise<Models.User<Preferences>>;
649
+ createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number | bigint, passwordMemory: number | bigint, passwordParallel: number | bigint, passwordLength: number | bigint, name?: string): Promise<Models.User<Preferences>>;
650
650
  createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(
651
- paramsOrFirst: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string } | string,
652
- ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (number)?, (number)?, (string)?]
651
+ paramsOrFirst: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number | bigint, passwordMemory: number | bigint, passwordParallel: number | bigint, passwordLength: number | bigint, name?: string } | string,
652
+ ...rest: [(string)?, (string)?, (string)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?]
653
653
  ): Promise<Models.User<Preferences>> {
654
- let params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string };
654
+ let params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number | bigint, passwordMemory: number | bigint, passwordParallel: number | bigint, passwordLength: number | bigint, name?: string };
655
655
 
656
656
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
657
- params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string };
657
+ params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number | bigint, passwordMemory: number | bigint, passwordParallel: number | bigint, passwordLength: number | bigint, name?: string };
658
658
  } else {
659
659
  params = {
660
660
  userId: paramsOrFirst as string,
661
661
  email: rest[0] as string,
662
662
  password: rest[1] as string,
663
663
  passwordSalt: rest[2] as string,
664
- passwordCpu: rest[3] as number,
665
- passwordMemory: rest[4] as number,
666
- passwordParallel: rest[5] as number,
667
- passwordLength: rest[6] as number,
664
+ passwordCpu: rest[3] as number | bigint,
665
+ passwordMemory: rest[4] as number | bigint,
666
+ passwordParallel: rest[5] as number | bigint,
667
+ passwordLength: rest[6] as number | bigint,
668
668
  name: rest[7] as string
669
669
  };
670
670
  }
@@ -1174,35 +1174,35 @@ export class Users {
1174
1174
  *
1175
1175
  * @param {string} params.userId - User ID.
1176
1176
  * @param {string} params.sessionId - Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session.
1177
- * @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
1177
+ * @param {number | bigint} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
1178
1178
  * @throws {AppwriteException}
1179
1179
  * @returns {Promise<Models.Jwt>}
1180
1180
  */
1181
- createJWT(params: { userId: string, sessionId?: string, duration?: number }): Promise<Models.Jwt>;
1181
+ createJWT(params: { userId: string, sessionId?: string, duration?: number | bigint }): Promise<Models.Jwt>;
1182
1182
  /**
1183
1183
  * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted.
1184
1184
  *
1185
1185
  * @param {string} userId - User ID.
1186
1186
  * @param {string} sessionId - Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session.
1187
- * @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
1187
+ * @param {number | bigint} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
1188
1188
  * @throws {AppwriteException}
1189
1189
  * @returns {Promise<Models.Jwt>}
1190
1190
  * @deprecated Use the object parameter style method for a better developer experience.
1191
1191
  */
1192
- createJWT(userId: string, sessionId?: string, duration?: number): Promise<Models.Jwt>;
1192
+ createJWT(userId: string, sessionId?: string, duration?: number | bigint): Promise<Models.Jwt>;
1193
1193
  createJWT(
1194
- paramsOrFirst: { userId: string, sessionId?: string, duration?: number } | string,
1195
- ...rest: [(string)?, (number)?]
1194
+ paramsOrFirst: { userId: string, sessionId?: string, duration?: number | bigint } | string,
1195
+ ...rest: [(string)?, (number | bigint)?]
1196
1196
  ): Promise<Models.Jwt> {
1197
- let params: { userId: string, sessionId?: string, duration?: number };
1197
+ let params: { userId: string, sessionId?: string, duration?: number | bigint };
1198
1198
 
1199
1199
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1200
- params = (paramsOrFirst || {}) as { userId: string, sessionId?: string, duration?: number };
1200
+ params = (paramsOrFirst || {}) as { userId: string, sessionId?: string, duration?: number | bigint };
1201
1201
  } else {
1202
1202
  params = {
1203
1203
  userId: paramsOrFirst as string,
1204
1204
  sessionId: rest[0] as string,
1205
- duration: rest[1] as number
1205
+ duration: rest[1] as number | bigint
1206
1206
  };
1207
1207
  }
1208
1208
 
@@ -3067,37 +3067,37 @@ export class Users {
3067
3067
  *
3068
3068
  *
3069
3069
  * @param {string} params.userId - User ID.
3070
- * @param {number} params.length - Token length in characters. The default length is 6 characters
3071
- * @param {number} params.expire - Token expiration period in seconds. The default expiration is 15 minutes.
3070
+ * @param {number | bigint} params.length - Token length in characters. The default length is 6 characters
3071
+ * @param {number | bigint} params.expire - Token expiration period in seconds. The default expiration is 15 minutes.
3072
3072
  * @throws {AppwriteException}
3073
3073
  * @returns {Promise<Models.Token>}
3074
3074
  */
3075
- createToken(params: { userId: string, length?: number, expire?: number }): Promise<Models.Token>;
3075
+ createToken(params: { userId: string, length?: number | bigint, expire?: number | bigint }): Promise<Models.Token>;
3076
3076
  /**
3077
3077
  * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process.
3078
3078
  *
3079
3079
  *
3080
3080
  * @param {string} userId - User ID.
3081
- * @param {number} length - Token length in characters. The default length is 6 characters
3082
- * @param {number} expire - Token expiration period in seconds. The default expiration is 15 minutes.
3081
+ * @param {number | bigint} length - Token length in characters. The default length is 6 characters
3082
+ * @param {number | bigint} expire - Token expiration period in seconds. The default expiration is 15 minutes.
3083
3083
  * @throws {AppwriteException}
3084
3084
  * @returns {Promise<Models.Token>}
3085
3085
  * @deprecated Use the object parameter style method for a better developer experience.
3086
3086
  */
3087
- createToken(userId: string, length?: number, expire?: number): Promise<Models.Token>;
3087
+ createToken(userId: string, length?: number | bigint, expire?: number | bigint): Promise<Models.Token>;
3088
3088
  createToken(
3089
- paramsOrFirst: { userId: string, length?: number, expire?: number } | string,
3090
- ...rest: [(number)?, (number)?]
3089
+ paramsOrFirst: { userId: string, length?: number | bigint, expire?: number | bigint } | string,
3090
+ ...rest: [(number | bigint)?, (number | bigint)?]
3091
3091
  ): Promise<Models.Token> {
3092
- let params: { userId: string, length?: number, expire?: number };
3092
+ let params: { userId: string, length?: number | bigint, expire?: number | bigint };
3093
3093
 
3094
3094
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3095
- params = (paramsOrFirst || {}) as { userId: string, length?: number, expire?: number };
3095
+ params = (paramsOrFirst || {}) as { userId: string, length?: number | bigint, expire?: number | bigint };
3096
3096
  } else {
3097
3097
  params = {
3098
3098
  userId: paramsOrFirst as string,
3099
- length: rest[0] as number,
3100
- expire: rest[1] as number
3099
+ length: rest[0] as number | bigint,
3100
+ expire: rest[1] as number | bigint
3101
3101
  };
3102
3102
  }
3103
3103
 
package/types/client.d.ts CHANGED
@@ -95,7 +95,15 @@ declare class Client {
95
95
  config: {
96
96
  endpoint: string;
97
97
  endpointRealtime: string;
98
- [key: string]: string | undefined;
98
+ project: string;
99
+ key: string;
100
+ jwt: string;
101
+ locale: string;
102
+ mode: string;
103
+ cookie: string;
104
+ platform: string;
105
+ selfSigned: boolean;
106
+ session?: string;
99
107
  };
100
108
  /**
101
109
  * Custom headers for API requests.
@@ -119,6 +127,14 @@ declare class Client {
119
127
  * @returns {this}
120
128
  */
121
129
  setEndpointRealtime(endpointRealtime: string): this;
130
+ /**
131
+ * Set self-signed
132
+ *
133
+ * @param {boolean} selfSigned
134
+ *
135
+ * @returns {this}
136
+ */
137
+ setSelfSigned(selfSigned: boolean): this;
122
138
  /**
123
139
  * Set Project
124
140
  *
@@ -165,6 +181,16 @@ declare class Client {
165
181
  * @return {this}
166
182
  */
167
183
  setMode(value: string): this;
184
+ /**
185
+ * Set Cookie
186
+ *
187
+ * The user cookie to authenticate with
188
+ *
189
+ * @param value string
190
+ *
191
+ * @return {this}
192
+ */
193
+ setCookie(value: string): this;
168
194
  /**
169
195
  * Set Platform
170
196
  *