node-appwrite 22.1.3 → 23.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 (100) hide show
  1. package/README.md +2 -2
  2. package/dist/client.d.mts +33 -0
  3. package/dist/client.d.ts +33 -0
  4. package/dist/client.js +52 -4
  5. package/dist/client.js.map +1 -1
  6. package/dist/client.mjs +52 -4
  7. package/dist/client.mjs.map +1 -1
  8. package/dist/enums/backup-services.d.mts +3 -0
  9. package/dist/enums/backup-services.d.ts +3 -0
  10. package/dist/enums/backup-services.js +3 -0
  11. package/dist/enums/backup-services.js.map +1 -1
  12. package/dist/enums/backup-services.mjs +3 -0
  13. package/dist/enums/backup-services.mjs.map +1 -1
  14. package/dist/enums/database-type.d.mts +3 -1
  15. package/dist/enums/database-type.d.ts +3 -1
  16. package/dist/enums/database-type.js +2 -0
  17. package/dist/enums/database-type.js.map +1 -1
  18. package/dist/enums/database-type.mjs +2 -0
  19. package/dist/enums/database-type.mjs.map +1 -1
  20. package/dist/enums/databases-index-type.d.mts +8 -0
  21. package/dist/enums/databases-index-type.d.ts +8 -0
  22. package/dist/enums/databases-index-type.js +13 -0
  23. package/dist/enums/databases-index-type.js.map +1 -0
  24. package/dist/enums/databases-index-type.mjs +12 -0
  25. package/dist/enums/databases-index-type.mjs.map +1 -0
  26. package/dist/enums/scopes.d.mts +4 -0
  27. package/dist/enums/scopes.d.ts +4 -0
  28. package/dist/enums/scopes.js +4 -0
  29. package/dist/enums/scopes.js.map +1 -1
  30. package/dist/enums/scopes.mjs +4 -0
  31. package/dist/enums/scopes.mjs.map +1 -1
  32. package/dist/enums/{index-type.d.mts → tables-db-index-type.d.mts} +2 -2
  33. package/dist/enums/{index-type.d.ts → tables-db-index-type.d.ts} +2 -2
  34. package/dist/enums/tables-db-index-type.js +13 -0
  35. package/dist/enums/tables-db-index-type.js.map +1 -0
  36. package/dist/enums/tables-db-index-type.mjs +12 -0
  37. package/dist/enums/tables-db-index-type.mjs.map +1 -0
  38. package/dist/enums/template-reference-type.d.mts +1 -1
  39. package/dist/enums/template-reference-type.d.ts +1 -1
  40. package/dist/enums/template-reference-type.js +1 -1
  41. package/dist/enums/template-reference-type.js.map +1 -1
  42. package/dist/enums/template-reference-type.mjs +1 -1
  43. package/dist/enums/template-reference-type.mjs.map +1 -1
  44. package/dist/index.d.mts +4 -1
  45. package/dist/index.d.ts +4 -1
  46. package/dist/index.js +18 -3
  47. package/dist/index.js.map +1 -1
  48. package/dist/index.mjs +4 -1
  49. package/dist/index.mjs.map +1 -1
  50. package/dist/models.d.mts +107 -9
  51. package/dist/models.d.ts +107 -9
  52. package/dist/services/databases.d.mts +5 -5
  53. package/dist/services/databases.d.ts +5 -5
  54. package/dist/services/databases.js.map +1 -1
  55. package/dist/services/databases.mjs.map +1 -1
  56. package/dist/services/functions.d.mts +20 -8
  57. package/dist/services/functions.d.ts +20 -8
  58. package/dist/services/functions.js +28 -8
  59. package/dist/services/functions.js.map +1 -1
  60. package/dist/services/functions.mjs +28 -8
  61. package/dist/services/functions.mjs.map +1 -1
  62. package/dist/services/health.d.mts +0 -95
  63. package/dist/services/health.d.ts +0 -95
  64. package/dist/services/health.js +0 -120
  65. package/dist/services/health.js.map +1 -1
  66. package/dist/services/health.mjs +0 -120
  67. package/dist/services/health.mjs.map +1 -1
  68. package/dist/services/project.d.mts +136 -0
  69. package/dist/services/project.d.ts +136 -0
  70. package/dist/services/project.js +183 -0
  71. package/dist/services/project.js.map +1 -0
  72. package/dist/services/project.mjs +182 -0
  73. package/dist/services/project.mjs.map +1 -0
  74. package/dist/services/sites.d.mts +26 -8
  75. package/dist/services/sites.d.ts +26 -8
  76. package/dist/services/sites.js +55 -25
  77. package/dist/services/sites.js.map +1 -1
  78. package/dist/services/sites.mjs +55 -25
  79. package/dist/services/sites.mjs.map +1 -1
  80. package/dist/services/tables-db.d.mts +5 -5
  81. package/dist/services/tables-db.d.ts +5 -5
  82. package/dist/services/tables-db.js.map +1 -1
  83. package/dist/services/tables-db.mjs.map +1 -1
  84. package/dist/services/users.d.mts +26 -2
  85. package/dist/services/users.d.ts +26 -2
  86. package/dist/services/users.js +34 -0
  87. package/dist/services/users.js.map +1 -1
  88. package/dist/services/users.mjs +34 -0
  89. package/dist/services/users.mjs.map +1 -1
  90. package/dist/services/webhooks.d.mts +179 -0
  91. package/dist/services/webhooks.d.ts +179 -0
  92. package/dist/services/webhooks.js +261 -0
  93. package/dist/services/webhooks.js.map +1 -0
  94. package/dist/services/webhooks.mjs +260 -0
  95. package/dist/services/webhooks.mjs.map +1 -0
  96. package/package.json +5 -3
  97. package/dist/enums/index-type.js +0 -13
  98. package/dist/enums/index-type.js.map +0 -1
  99. package/dist/enums/index-type.mjs +0 -12
  100. package/dist/enums/index-type.mjs.map +0 -1
@@ -21,7 +21,7 @@ declare class Users {
21
21
  /**
22
22
  * Get a list of all the project's users. You can use the query params to filter your results.
23
23
  *
24
- * @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
24
+ * @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
25
25
  * @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
26
26
  * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
27
27
  * @throws {AppwriteException}
@@ -35,7 +35,7 @@ declare class Users {
35
35
  /**
36
36
  * Get a list of all the project's users. You can use the query params to filter your results.
37
37
  *
38
- * @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
38
+ * @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
39
39
  * @param {string} search - Search term to filter your list results. Max length: 256 chars.
40
40
  * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
41
41
  * @throws {AppwriteException}
@@ -401,6 +401,30 @@ declare class Users {
401
401
  * @deprecated Use the object parameter style method for a better developer experience.
402
402
  */
403
403
  updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string): Promise<Models.User<Preferences>>;
404
+ /**
405
+ * 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.
406
+ *
407
+ *
408
+ * @param {string} params.userId - User ID.
409
+ * @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.
410
+ * @throws {AppwriteException}
411
+ * @returns {Promise<Models.User<Preferences>>}
412
+ */
413
+ updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
414
+ userId: string;
415
+ impersonator: boolean;
416
+ }): Promise<Models.User<Preferences>>;
417
+ /**
418
+ * 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.
419
+ *
420
+ *
421
+ * @param {string} userId - User ID.
422
+ * @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.
423
+ * @throws {AppwriteException}
424
+ * @returns {Promise<Models.User<Preferences>>}
425
+ * @deprecated Use the object parameter style method for a better developer experience.
426
+ */
427
+ updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, impersonator: boolean): Promise<Models.User<Preferences>>;
404
428
  /**
405
429
  * 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.
406
430
  *
@@ -21,7 +21,7 @@ declare class Users {
21
21
  /**
22
22
  * Get a list of all the project's users. You can use the query params to filter your results.
23
23
  *
24
- * @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
24
+ * @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
25
25
  * @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
26
26
  * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
27
27
  * @throws {AppwriteException}
@@ -35,7 +35,7 @@ declare class Users {
35
35
  /**
36
36
  * Get a list of all the project's users. You can use the query params to filter your results.
37
37
  *
38
- * @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
38
+ * @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
39
39
  * @param {string} search - Search term to filter your list results. Max length: 256 chars.
40
40
  * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
41
41
  * @throws {AppwriteException}
@@ -401,6 +401,30 @@ declare class Users {
401
401
  * @deprecated Use the object parameter style method for a better developer experience.
402
402
  */
403
403
  updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string): Promise<Models.User<Preferences>>;
404
+ /**
405
+ * 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.
406
+ *
407
+ *
408
+ * @param {string} params.userId - User ID.
409
+ * @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.
410
+ * @throws {AppwriteException}
411
+ * @returns {Promise<Models.User<Preferences>>}
412
+ */
413
+ updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
414
+ userId: string;
415
+ impersonator: boolean;
416
+ }): Promise<Models.User<Preferences>>;
417
+ /**
418
+ * 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.
419
+ *
420
+ *
421
+ * @param {string} userId - User ID.
422
+ * @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.
423
+ * @throws {AppwriteException}
424
+ * @returns {Promise<Models.User<Preferences>>}
425
+ * @deprecated Use the object parameter style method for a better developer experience.
426
+ */
427
+ updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, impersonator: boolean): Promise<Models.User<Preferences>>;
404
428
  /**
405
429
  * 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.
406
430
  *
@@ -652,6 +652,40 @@ class Users {
652
652
  payload
653
653
  );
654
654
  }
655
+ updateImpersonator(paramsOrFirst, ...rest) {
656
+ let params;
657
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
658
+ params = paramsOrFirst || {};
659
+ } else {
660
+ params = {
661
+ userId: paramsOrFirst,
662
+ impersonator: rest[0]
663
+ };
664
+ }
665
+ const userId = params.userId;
666
+ const impersonator = params.impersonator;
667
+ if (typeof userId === "undefined") {
668
+ throw new client.AppwriteException('Missing required parameter: "userId"');
669
+ }
670
+ if (typeof impersonator === "undefined") {
671
+ throw new client.AppwriteException('Missing required parameter: "impersonator"');
672
+ }
673
+ const apiPath = "/users/{userId}/impersonator".replace("{userId}", userId);
674
+ const payload = {};
675
+ if (typeof impersonator !== "undefined") {
676
+ payload["impersonator"] = impersonator;
677
+ }
678
+ const uri = new URL(this.client.config.endpoint + apiPath);
679
+ const apiHeaders = {
680
+ "content-type": "application/json"
681
+ };
682
+ return this.client.call(
683
+ "patch",
684
+ uri,
685
+ apiHeaders,
686
+ payload
687
+ );
688
+ }
655
689
  createJWT(paramsOrFirst, ...rest) {
656
690
  let params;
657
691
  if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {