@appwrite.io/console 7.0.0 → 8.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 (60) hide show
  1. package/CHANGELOG.md +22 -6
  2. package/README.md +2 -2
  3. package/dist/cjs/sdk.js +211 -303
  4. package/dist/cjs/sdk.js.map +1 -1
  5. package/dist/esm/sdk.js +209 -297
  6. package/dist/esm/sdk.js.map +1 -1
  7. package/dist/iife/sdk.js +227 -306
  8. package/docs/examples/databases/create-index.md +2 -2
  9. package/docs/examples/domains/create-purchase.md +2 -1
  10. package/docs/examples/domains/create-transfer-in.md +2 -1
  11. package/docs/examples/domains/update-auto-renewal.md +16 -0
  12. package/docs/examples/project/create-variable.md +1 -0
  13. package/docs/examples/project/list-variables.md +4 -1
  14. package/docs/examples/project/update-variable.md +1 -1
  15. package/docs/examples/tablesdb/create-index.md +2 -2
  16. package/docs/examples/users/update-impersonator.md +16 -0
  17. package/package.json +7 -7
  18. package/rollup.config.js +2 -1
  19. package/src/client.ts +49 -1
  20. package/src/enums/appwrite-migration-resource.ts +2 -0
  21. package/src/enums/backup-services.ts +3 -0
  22. package/src/enums/build-runtime.ts +0 -86
  23. package/src/enums/database-type.ts +2 -0
  24. package/src/enums/databases-index-type.ts +6 -0
  25. package/src/enums/runtime.ts +0 -86
  26. package/src/enums/runtimes.ts +0 -86
  27. package/src/enums/scopes.ts +13 -2
  28. package/src/enums/{index-type.ts → tables-db-index-type.ts} +1 -1
  29. package/src/enums/template-reference-type.ts +1 -1
  30. package/src/enums/use-cases.ts +7 -2
  31. package/src/index.ts +2 -1
  32. package/src/models.ts +136 -90
  33. package/src/services/databases.ts +10 -10
  34. package/src/services/domains.ts +103 -26
  35. package/src/services/project.ts +76 -33
  36. package/src/services/tables-db.ts +10 -10
  37. package/src/services/users.ts +67 -2
  38. package/types/channel.d.ts +3 -3
  39. package/types/client.d.ts +37 -4
  40. package/types/enums/appwrite-migration-resource.d.ts +2 -0
  41. package/types/enums/backup-services.d.ts +3 -0
  42. package/types/enums/build-runtime.d.ts +1 -87
  43. package/types/enums/database-type.d.ts +3 -1
  44. package/types/enums/databases-index-type.d.ts +6 -0
  45. package/types/enums/runtime.d.ts +1 -87
  46. package/types/enums/runtimes.d.ts +1 -87
  47. package/types/enums/scopes.d.ts +14 -3
  48. package/types/enums/{index-type.d.ts → tables-db-index-type.d.ts} +1 -1
  49. package/types/enums/template-reference-type.d.ts +1 -1
  50. package/types/enums/use-cases.d.ts +7 -2
  51. package/types/index.d.ts +2 -1
  52. package/types/models.d.ts +136 -87
  53. package/types/operator.d.ts +3 -3
  54. package/types/query.d.ts +4 -4
  55. package/types/services/databases.d.ts +5 -5
  56. package/types/services/domains.d.ts +42 -14
  57. package/types/services/project.d.ts +37 -19
  58. package/types/services/realtime.d.ts +6 -6
  59. package/types/services/tables-db.d.ts +5 -5
  60. package/types/services/users.d.ts +26 -2
@@ -84,15 +84,51 @@ export class Project {
84
84
  }
85
85
 
86
86
  /**
87
- * Get a list of all project variables. These variables will be accessible in all Appwrite Functions at runtime.
87
+ * Get a list of all project environment variables.
88
88
  *
89
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret
90
+ * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
89
91
  * @throws {AppwriteException}
90
92
  * @returns {Promise<Models.VariableList>}
91
93
  */
92
- listVariables(): Promise<Models.VariableList> {
94
+ listVariables(params?: { queries?: string[], total?: boolean }): Promise<Models.VariableList>;
95
+ /**
96
+ * Get a list of all project environment variables.
97
+ *
98
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret
99
+ * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
100
+ * @throws {AppwriteException}
101
+ * @returns {Promise<Models.VariableList>}
102
+ * @deprecated Use the object parameter style method for a better developer experience.
103
+ */
104
+ listVariables(queries?: string[], total?: boolean): Promise<Models.VariableList>;
105
+ listVariables(
106
+ paramsOrFirst?: { queries?: string[], total?: boolean } | string[],
107
+ ...rest: [(boolean)?]
108
+ ): Promise<Models.VariableList> {
109
+ let params: { queries?: string[], total?: boolean };
110
+
111
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
112
+ params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean };
113
+ } else {
114
+ params = {
115
+ queries: paramsOrFirst as string[],
116
+ total: rest[0] as boolean
117
+ };
118
+ }
119
+
120
+ const queries = params.queries;
121
+ const total = params.total;
122
+
93
123
 
94
124
  const apiPath = '/project/variables';
95
125
  const payload: Payload = {};
126
+ if (typeof queries !== 'undefined') {
127
+ payload['queries'] = queries;
128
+ }
129
+ if (typeof total !== 'undefined') {
130
+ payload['total'] = total;
131
+ }
96
132
  const uri = new URL(this.client.config.endpoint + apiPath);
97
133
 
98
134
  const apiHeaders: { [header: string]: string } = {
@@ -107,18 +143,20 @@ export class Project {
107
143
  }
108
144
 
109
145
  /**
110
- * Create a new project variable. This variable will be accessible in all Appwrite Functions at runtime.
146
+ * Create a new project environment variable. These variables can be accessed by all functions and sites in the project.
111
147
  *
148
+ * @param {string} params.variableId - Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
112
149
  * @param {string} params.key - Variable key. Max length: 255 chars.
113
150
  * @param {string} params.value - Variable value. Max length: 8192 chars.
114
151
  * @param {boolean} params.secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime.
115
152
  * @throws {AppwriteException}
116
153
  * @returns {Promise<Models.Variable>}
117
154
  */
118
- createVariable(params: { key: string, value: string, secret?: boolean }): Promise<Models.Variable>;
155
+ createVariable(params: { variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>;
119
156
  /**
120
- * Create a new project variable. This variable will be accessible in all Appwrite Functions at runtime.
157
+ * Create a new project environment variable. These variables can be accessed by all functions and sites in the project.
121
158
  *
159
+ * @param {string} variableId - Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
122
160
  * @param {string} key - Variable key. Max length: 255 chars.
123
161
  * @param {string} value - Variable value. Max length: 8192 chars.
124
162
  * @param {boolean} secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime.
@@ -126,27 +164,32 @@ export class Project {
126
164
  * @returns {Promise<Models.Variable>}
127
165
  * @deprecated Use the object parameter style method for a better developer experience.
128
166
  */
129
- createVariable(key: string, value: string, secret?: boolean): Promise<Models.Variable>;
167
+ createVariable(variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>;
130
168
  createVariable(
131
- paramsOrFirst: { key: string, value: string, secret?: boolean } | string,
132
- ...rest: [(string)?, (boolean)?]
169
+ paramsOrFirst: { variableId: string, key: string, value: string, secret?: boolean } | string,
170
+ ...rest: [(string)?, (string)?, (boolean)?]
133
171
  ): Promise<Models.Variable> {
134
- let params: { key: string, value: string, secret?: boolean };
172
+ let params: { variableId: string, key: string, value: string, secret?: boolean };
135
173
 
136
174
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
137
- params = (paramsOrFirst || {}) as { key: string, value: string, secret?: boolean };
175
+ params = (paramsOrFirst || {}) as { variableId: string, key: string, value: string, secret?: boolean };
138
176
  } else {
139
177
  params = {
140
- key: paramsOrFirst as string,
141
- value: rest[0] as string,
142
- secret: rest[1] as boolean
178
+ variableId: paramsOrFirst as string,
179
+ key: rest[0] as string,
180
+ value: rest[1] as string,
181
+ secret: rest[2] as boolean
143
182
  };
144
183
  }
145
184
 
185
+ const variableId = params.variableId;
146
186
  const key = params.key;
147
187
  const value = params.value;
148
188
  const secret = params.secret;
149
189
 
190
+ if (typeof variableId === 'undefined') {
191
+ throw new AppwriteException('Missing required parameter: "variableId"');
192
+ }
150
193
  if (typeof key === 'undefined') {
151
194
  throw new AppwriteException('Missing required parameter: "key"');
152
195
  }
@@ -156,6 +199,9 @@ export class Project {
156
199
 
157
200
  const apiPath = '/project/variables';
158
201
  const payload: Payload = {};
202
+ if (typeof variableId !== 'undefined') {
203
+ payload['variableId'] = variableId;
204
+ }
159
205
  if (typeof key !== 'undefined') {
160
206
  payload['key'] = key;
161
207
  }
@@ -180,17 +226,17 @@ export class Project {
180
226
  }
181
227
 
182
228
  /**
183
- * Get a project variable by its unique ID.
229
+ * Get a variable by its unique ID.
184
230
  *
185
- * @param {string} params.variableId - Variable unique ID.
231
+ * @param {string} params.variableId - Variable ID.
186
232
  * @throws {AppwriteException}
187
233
  * @returns {Promise<Models.Variable>}
188
234
  */
189
235
  getVariable(params: { variableId: string }): Promise<Models.Variable>;
190
236
  /**
191
- * Get a project variable by its unique ID.
237
+ * Get a variable by its unique ID.
192
238
  *
193
- * @param {string} variableId - Variable unique ID.
239
+ * @param {string} variableId - Variable ID.
194
240
  * @throws {AppwriteException}
195
241
  * @returns {Promise<Models.Variable>}
196
242
  * @deprecated Use the object parameter style method for a better developer experience.
@@ -231,20 +277,20 @@ export class Project {
231
277
  }
232
278
 
233
279
  /**
234
- * Update project variable by its unique ID. This variable will be accessible in all Appwrite Functions at runtime.
280
+ * Update variable by its unique ID.
235
281
  *
236
- * @param {string} params.variableId - Variable unique ID.
282
+ * @param {string} params.variableId - Variable ID.
237
283
  * @param {string} params.key - Variable key. Max length: 255 chars.
238
284
  * @param {string} params.value - Variable value. Max length: 8192 chars.
239
285
  * @param {boolean} params.secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime.
240
286
  * @throws {AppwriteException}
241
287
  * @returns {Promise<Models.Variable>}
242
288
  */
243
- updateVariable(params: { variableId: string, key: string, value?: string, secret?: boolean }): Promise<Models.Variable>;
289
+ updateVariable(params: { variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>;
244
290
  /**
245
- * Update project variable by its unique ID. This variable will be accessible in all Appwrite Functions at runtime.
291
+ * Update variable by its unique ID.
246
292
  *
247
- * @param {string} variableId - Variable unique ID.
293
+ * @param {string} variableId - Variable ID.
248
294
  * @param {string} key - Variable key. Max length: 255 chars.
249
295
  * @param {string} value - Variable value. Max length: 8192 chars.
250
296
  * @param {boolean} secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime.
@@ -252,15 +298,15 @@ export class Project {
252
298
  * @returns {Promise<Models.Variable>}
253
299
  * @deprecated Use the object parameter style method for a better developer experience.
254
300
  */
255
- updateVariable(variableId: string, key: string, value?: string, secret?: boolean): Promise<Models.Variable>;
301
+ updateVariable(variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>;
256
302
  updateVariable(
257
- paramsOrFirst: { variableId: string, key: string, value?: string, secret?: boolean } | string,
303
+ paramsOrFirst: { variableId: string, key?: string, value?: string, secret?: boolean } | string,
258
304
  ...rest: [(string)?, (string)?, (boolean)?]
259
305
  ): Promise<Models.Variable> {
260
- let params: { variableId: string, key: string, value?: string, secret?: boolean };
306
+ let params: { variableId: string, key?: string, value?: string, secret?: boolean };
261
307
 
262
308
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
263
- params = (paramsOrFirst || {}) as { variableId: string, key: string, value?: string, secret?: boolean };
309
+ params = (paramsOrFirst || {}) as { variableId: string, key?: string, value?: string, secret?: boolean };
264
310
  } else {
265
311
  params = {
266
312
  variableId: paramsOrFirst as string,
@@ -278,9 +324,6 @@ export class Project {
278
324
  if (typeof variableId === 'undefined') {
279
325
  throw new AppwriteException('Missing required parameter: "variableId"');
280
326
  }
281
- if (typeof key === 'undefined') {
282
- throw new AppwriteException('Missing required parameter: "key"');
283
- }
284
327
 
285
328
  const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId);
286
329
  const payload: Payload = {};
@@ -308,17 +351,17 @@ export class Project {
308
351
  }
309
352
 
310
353
  /**
311
- * Delete a project variable by its unique ID.
354
+ * Delete a variable by its unique ID.
312
355
  *
313
- * @param {string} params.variableId - Variable unique ID.
356
+ * @param {string} params.variableId - Variable ID.
314
357
  * @throws {AppwriteException}
315
358
  * @returns {Promise<{}>}
316
359
  */
317
360
  deleteVariable(params: { variableId: string }): Promise<{}>;
318
361
  /**
319
- * Delete a project variable by its unique ID.
362
+ * Delete a variable by its unique ID.
320
363
  *
321
- * @param {string} variableId - Variable unique ID.
364
+ * @param {string} variableId - Variable ID.
322
365
  * @throws {AppwriteException}
323
366
  * @returns {Promise<{}>}
324
367
  * @deprecated Use the object parameter style method for a better developer experience.
@@ -5,7 +5,7 @@ import type { Models } from '../models';
5
5
  import { UsageRange } from '../enums/usage-range';
6
6
  import { RelationshipType } from '../enums/relationship-type';
7
7
  import { RelationMutate } from '../enums/relation-mutate';
8
- import { IndexType } from '../enums/index-type';
8
+ import { TablesDBIndexType } from '../enums/tables-db-index-type';
9
9
  import { OrderBy } from '../enums/order-by';
10
10
 
11
11
  export class TablesDB {
@@ -4746,14 +4746,14 @@ export class TablesDB {
4746
4746
  * @param {string} params.databaseId - Database ID.
4747
4747
  * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
4748
4748
  * @param {string} params.key - Index Key.
4749
- * @param {IndexType} params.type - Index type.
4749
+ * @param {TablesDBIndexType} params.type - Index type.
4750
4750
  * @param {string[]} params.columns - Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long.
4751
4751
  * @param {OrderBy[]} params.orders - Array of index orders. Maximum of 100 orders are allowed.
4752
4752
  * @param {number[]} params.lengths - Length of index. Maximum of 100
4753
4753
  * @throws {AppwriteException}
4754
4754
  * @returns {Promise<Models.ColumnIndex>}
4755
4755
  */
4756
- createIndex(params: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.ColumnIndex>;
4756
+ createIndex(params: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.ColumnIndex>;
4757
4757
  /**
4758
4758
  * Creates an index on the columns listed. Your index should include all the columns you will query in a single request.
4759
4759
  * Type can be `key`, `fulltext`, or `unique`.
@@ -4761,7 +4761,7 @@ export class TablesDB {
4761
4761
  * @param {string} databaseId - Database ID.
4762
4762
  * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
4763
4763
  * @param {string} key - Index Key.
4764
- * @param {IndexType} type - Index type.
4764
+ * @param {TablesDBIndexType} type - Index type.
4765
4765
  * @param {string[]} columns - Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long.
4766
4766
  * @param {OrderBy[]} orders - Array of index orders. Maximum of 100 orders are allowed.
4767
4767
  * @param {number[]} lengths - Length of index. Maximum of 100
@@ -4769,21 +4769,21 @@ export class TablesDB {
4769
4769
  * @returns {Promise<Models.ColumnIndex>}
4770
4770
  * @deprecated Use the object parameter style method for a better developer experience.
4771
4771
  */
4772
- createIndex(databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.ColumnIndex>;
4772
+ createIndex(databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.ColumnIndex>;
4773
4773
  createIndex(
4774
- paramsOrFirst: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: OrderBy[], lengths?: number[] } | string,
4775
- ...rest: [(string)?, (string)?, (IndexType)?, (string[])?, (OrderBy[])?, (number[])?]
4774
+ paramsOrFirst: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] } | string,
4775
+ ...rest: [(string)?, (string)?, (TablesDBIndexType)?, (string[])?, (OrderBy[])?, (number[])?]
4776
4776
  ): Promise<Models.ColumnIndex> {
4777
- let params: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: OrderBy[], lengths?: number[] };
4777
+ let params: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] };
4778
4778
 
4779
4779
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4780
- params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: OrderBy[], lengths?: number[] };
4780
+ params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] };
4781
4781
  } else {
4782
4782
  params = {
4783
4783
  databaseId: paramsOrFirst as string,
4784
4784
  tableId: rest[0] as string,
4785
4785
  key: rest[1] as string,
4786
- type: rest[2] as IndexType,
4786
+ type: rest[2] as TablesDBIndexType,
4787
4787
  columns: rest[3] as string[],
4788
4788
  orders: rest[4] as OrderBy[],
4789
4789
  lengths: rest[5] as number[]
@@ -17,7 +17,7 @@ export class Users {
17
17
  /**
18
18
  * Get a list of all the project's users. You can use the query params to filter your results.
19
19
  *
20
- * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels
20
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator
21
21
  * @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
22
22
  * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
23
23
  * @throws {AppwriteException}
@@ -27,7 +27,7 @@ export class Users {
27
27
  /**
28
28
  * Get a list of all the project's users. You can use the query params to filter your results.
29
29
  *
30
- * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels
30
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator
31
31
  * @param {string} search - Search term to filter your list results. Max length: 256 chars.
32
32
  * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
33
33
  * @throws {AppwriteException}
@@ -1169,6 +1169,71 @@ export class Users {
1169
1169
  );
1170
1170
  }
1171
1171
 
1172
+ /**
1173
+ * Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data.
1174
+ *
1175
+ *
1176
+ * @param {string} params.userId - User ID.
1177
+ * @param {boolean} params.impersonator - Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data.
1178
+ * @throws {AppwriteException}
1179
+ * @returns {Promise<Models.User<Preferences>>}
1180
+ */
1181
+ updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, impersonator: boolean }): Promise<Models.User<Preferences>>;
1182
+ /**
1183
+ * Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data.
1184
+ *
1185
+ *
1186
+ * @param {string} userId - User ID.
1187
+ * @param {boolean} impersonator - Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data.
1188
+ * @throws {AppwriteException}
1189
+ * @returns {Promise<Models.User<Preferences>>}
1190
+ * @deprecated Use the object parameter style method for a better developer experience.
1191
+ */
1192
+ updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, impersonator: boolean): Promise<Models.User<Preferences>>;
1193
+ updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(
1194
+ paramsOrFirst: { userId: string, impersonator: boolean } | string,
1195
+ ...rest: [(boolean)?]
1196
+ ): Promise<Models.User<Preferences>> {
1197
+ let params: { userId: string, impersonator: boolean };
1198
+
1199
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1200
+ params = (paramsOrFirst || {}) as { userId: string, impersonator: boolean };
1201
+ } else {
1202
+ params = {
1203
+ userId: paramsOrFirst as string,
1204
+ impersonator: rest[0] as boolean
1205
+ };
1206
+ }
1207
+
1208
+ const userId = params.userId;
1209
+ const impersonator = params.impersonator;
1210
+
1211
+ if (typeof userId === 'undefined') {
1212
+ throw new AppwriteException('Missing required parameter: "userId"');
1213
+ }
1214
+ if (typeof impersonator === 'undefined') {
1215
+ throw new AppwriteException('Missing required parameter: "impersonator"');
1216
+ }
1217
+
1218
+ const apiPath = '/users/{userId}/impersonator'.replace('{userId}', userId);
1219
+ const payload: Payload = {};
1220
+ if (typeof impersonator !== 'undefined') {
1221
+ payload['impersonator'] = impersonator;
1222
+ }
1223
+ const uri = new URL(this.client.config.endpoint + apiPath);
1224
+
1225
+ const apiHeaders: { [header: string]: string } = {
1226
+ 'content-type': 'application/json',
1227
+ }
1228
+
1229
+ return this.client.call(
1230
+ 'patch',
1231
+ uri,
1232
+ apiHeaders,
1233
+ payload
1234
+ );
1235
+ }
1236
+
1172
1237
  /**
1173
1238
  * 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.
1174
1239
  *
@@ -37,7 +37,7 @@ interface Membership {
37
37
  interface Resolved {
38
38
  _res: any;
39
39
  }
40
- declare type Actionable = Document | Row | File | Team | Membership;
40
+ type Actionable = Document | Row | File | Team | Membership;
41
41
  export declare class Channel<T> {
42
42
  private readonly segments;
43
43
  _type: T;
@@ -69,6 +69,6 @@ export declare class Channel<T> {
69
69
  static teams(): string;
70
70
  static memberships(): string;
71
71
  }
72
- export declare type ActionableChannel = Channel<Document> | Channel<Row> | Channel<File> | Channel<Execution> | Channel<Team> | Channel<Membership>;
73
- export declare type ResolvedChannel = Channel<Resolved>;
72
+ export type ActionableChannel = Channel<Document> | Channel<Row> | Channel<File> | Channel<Execution> | Channel<Team> | Channel<Membership>;
73
+ export type ResolvedChannel = Channel<Resolved>;
74
74
  export {};
package/types/client.d.ts CHANGED
@@ -4,19 +4,19 @@ import { Query } from './query';
4
4
  /**
5
5
  * Payload type representing a key-value pair with string keys and any values.
6
6
  */
7
- declare type Payload = {
7
+ type Payload = {
8
8
  [key: string]: any;
9
9
  };
10
10
  /**
11
11
  * Headers type representing a key-value pair with string keys and string values.
12
12
  */
13
- declare type Headers = {
13
+ type Headers = {
14
14
  [key: string]: string;
15
15
  };
16
16
  /**
17
17
  * Realtime event response structure with generic payload type.
18
18
  */
19
- declare type RealtimeResponseEvent<T extends unknown> = {
19
+ type RealtimeResponseEvent<T extends unknown> = {
20
20
  /**
21
21
  * List of event names associated with the response.
22
22
  */
@@ -41,7 +41,7 @@ declare type RealtimeResponseEvent<T extends unknown> = {
41
41
  /**
42
42
  * Type representing upload progress information.
43
43
  */
44
- declare type UploadProgress = {
44
+ type UploadProgress = {
45
45
  /**
46
46
  * Identifier for the upload progress.
47
47
  */
@@ -107,6 +107,9 @@ declare class Client {
107
107
  locale: string;
108
108
  mode: string;
109
109
  cookie: string;
110
+ impersonateuserid: string;
111
+ impersonateuseremail: string;
112
+ impersonateuserphone: string;
110
113
  platform: string;
111
114
  selfSigned: boolean;
112
115
  session?: string;
@@ -197,6 +200,36 @@ declare class Client {
197
200
  * @return {this}
198
201
  */
199
202
  setCookie(value: string): this;
203
+ /**
204
+ * Set ImpersonateUserId
205
+ *
206
+ * Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
207
+ *
208
+ * @param value string
209
+ *
210
+ * @return {this}
211
+ */
212
+ setImpersonateUserId(value: string): this;
213
+ /**
214
+ * Set ImpersonateUserEmail
215
+ *
216
+ * Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
217
+ *
218
+ * @param value string
219
+ *
220
+ * @return {this}
221
+ */
222
+ setImpersonateUserEmail(value: string): this;
223
+ /**
224
+ * Set ImpersonateUserPhone
225
+ *
226
+ * Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
227
+ *
228
+ * @param value string
229
+ *
230
+ * @return {this}
231
+ */
232
+ setImpersonateUserPhone(value: string): this;
200
233
  /**
201
234
  * Set Platform
202
235
  *
@@ -10,6 +10,8 @@ export declare enum AppwriteMigrationResource {
10
10
  Document = "document",
11
11
  Attribute = "attribute",
12
12
  Collection = "collection",
13
+ Documentsdb = "documentsdb",
14
+ Vectorsdb = "vectorsdb",
13
15
  Bucket = "bucket",
14
16
  File = "file",
15
17
  Function = "function",
@@ -1,5 +1,8 @@
1
1
  export declare enum BackupServices {
2
2
  Databases = "databases",
3
+ Tablesdb = "tablesdb",
4
+ Documentsdb = "documentsdb",
5
+ Vectorsdb = "vectorsdb",
3
6
  Functions = "functions",
4
7
  Storage = "storage"
5
8
  }
@@ -84,91 +84,5 @@ export declare enum BuildRuntime {
84
84
  Flutter329 = "flutter-3.29",
85
85
  Flutter332 = "flutter-3.32",
86
86
  Flutter335 = "flutter-3.35",
87
- Flutter338 = "flutter-3.38",
88
- Node145rc = "node-14.5-rc",
89
- Node160rc = "node-16.0-rc",
90
- Node180rc = "node-18.0-rc",
91
- Node190rc = "node-19.0-rc",
92
- Node200rc = "node-20.0-rc",
93
- Node210rc = "node-21.0-rc",
94
- Node22rc = "node-22-rc",
95
- Node23rc = "node-23-rc",
96
- Node24rc = "node-24-rc",
97
- Node25rc = "node-25-rc",
98
- Php80rc = "php-8.0-rc",
99
- Php81rc = "php-8.1-rc",
100
- Php82rc = "php-8.2-rc",
101
- Php83rc = "php-8.3-rc",
102
- Php84rc = "php-8.4-rc",
103
- Ruby30rc = "ruby-3.0-rc",
104
- Ruby31rc = "ruby-3.1-rc",
105
- Ruby32rc = "ruby-3.2-rc",
106
- Ruby33rc = "ruby-3.3-rc",
107
- Ruby34rc = "ruby-3.4-rc",
108
- Ruby40rc = "ruby-4.0-rc",
109
- Python38rc = "python-3.8-rc",
110
- Python39rc = "python-3.9-rc",
111
- Python310rc = "python-3.10-rc",
112
- Python311rc = "python-3.11-rc",
113
- Python312rc = "python-3.12-rc",
114
- Python313rc = "python-3.13-rc",
115
- Python314rc = "python-3.14-rc",
116
- Pythonml311rc = "python-ml-3.11-rc",
117
- Pythonml312rc = "python-ml-3.12-rc",
118
- Pythonml313rc = "python-ml-3.13-rc",
119
- Deno140rc = "deno-1.40-rc",
120
- Deno146rc = "deno-1.46-rc",
121
- Deno20rc = "deno-2.0-rc",
122
- Deno25rc = "deno-2.5-rc",
123
- Deno26rc = "deno-2.6-rc",
124
- Dart215rc = "dart-2.15-rc",
125
- Dart216rc = "dart-2.16-rc",
126
- Dart217rc = "dart-2.17-rc",
127
- Dart218rc = "dart-2.18-rc",
128
- Dart219rc = "dart-2.19-rc",
129
- Dart30rc = "dart-3.0-rc",
130
- Dart31rc = "dart-3.1-rc",
131
- Dart33rc = "dart-3.3-rc",
132
- Dart35rc = "dart-3.5-rc",
133
- Dart38rc = "dart-3.8-rc",
134
- Dart39rc = "dart-3.9-rc",
135
- Dart310rc = "dart-3.10-rc",
136
- Dotnet60rc = "dotnet-6.0-rc",
137
- Dotnet70rc = "dotnet-7.0-rc",
138
- Dotnet80rc = "dotnet-8.0-rc",
139
- Dotnet10rc = "dotnet-10-rc",
140
- Java80rc = "java-8.0-rc",
141
- Java110rc = "java-11.0-rc",
142
- Java170rc = "java-17.0-rc",
143
- Java180rc = "java-18.0-rc",
144
- Java210rc = "java-21.0-rc",
145
- Java22rc = "java-22-rc",
146
- Java25rc = "java-25-rc",
147
- Swift55rc = "swift-5.5-rc",
148
- Swift58rc = "swift-5.8-rc",
149
- Swift59rc = "swift-5.9-rc",
150
- Swift510rc = "swift-5.10-rc",
151
- Swift62rc = "swift-6.2-rc",
152
- Kotlin16rc = "kotlin-1.6-rc",
153
- Kotlin18rc = "kotlin-1.8-rc",
154
- Kotlin19rc = "kotlin-1.9-rc",
155
- Kotlin20rc = "kotlin-2.0-rc",
156
- Kotlin23rc = "kotlin-2.3-rc",
157
- Cpp17rc = "cpp-17-rc",
158
- Cpp20rc = "cpp-20-rc",
159
- Bun10rc = "bun-1.0-rc",
160
- Bun11rc = "bun-1.1-rc",
161
- Bun12rc = "bun-1.2-rc",
162
- Bun13rc = "bun-1.3-rc",
163
- Go123rc = "go-1.23-rc",
164
- Go124rc = "go-1.24-rc",
165
- Go125rc = "go-1.25-rc",
166
- Go126rc = "go-1.26-rc",
167
- Static1rc = "static-1-rc",
168
- Flutter324rc = "flutter-3.24-rc",
169
- Flutter327rc = "flutter-3.27-rc",
170
- Flutter329rc = "flutter-3.29-rc",
171
- Flutter332rc = "flutter-3.32-rc",
172
- Flutter335rc = "flutter-3.35-rc",
173
- Flutter338rc = "flutter-3.38-rc"
87
+ Flutter338 = "flutter-3.38"
174
88
  }
@@ -1,4 +1,6 @@
1
1
  export declare enum DatabaseType {
2
2
  Legacy = "legacy",
3
- Tablesdb = "tablesdb"
3
+ Tablesdb = "tablesdb",
4
+ Documentsdb = "documentsdb",
5
+ Vectorsdb = "vectorsdb"
4
6
  }
@@ -0,0 +1,6 @@
1
+ export declare enum DatabasesIndexType {
2
+ Key = "key",
3
+ Fulltext = "fulltext",
4
+ Unique = "unique",
5
+ Spatial = "spatial"
6
+ }