appwrite-cli 4.2.1 → 5.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 (320) hide show
  1. package/.github/workflows/npm-publish.yml +1 -1
  2. package/README.md +6 -9
  3. package/docs/examples/account/{create-email-session.md → create-email-password-session.md} +1 -1
  4. package/docs/examples/account/create-email-token.md +4 -0
  5. package/docs/examples/account/create-magic-u-r-l-token.md +5 -0
  6. package/docs/examples/account/create-mfa-authenticator.md +2 -0
  7. package/docs/examples/account/create-mfa-challenge.md +2 -0
  8. package/docs/examples/account/create-mfa-recovery-codes.md +1 -0
  9. package/docs/examples/account/create-o-auth2token.md +5 -0
  10. package/docs/examples/account/create-phone-token.md +3 -0
  11. package/docs/examples/account/create-push-target.md +4 -0
  12. package/docs/examples/account/create-session.md +3 -0
  13. package/docs/examples/account/create.md +1 -1
  14. package/docs/examples/account/delete-identity.md +1 -1
  15. package/docs/examples/account/delete-mfa-authenticator.md +3 -0
  16. package/docs/examples/account/delete-push-target.md +2 -0
  17. package/docs/examples/account/delete-session.md +1 -1
  18. package/docs/examples/account/delete.md +1 -0
  19. package/docs/examples/account/get-mfa-recovery-codes.md +1 -0
  20. package/docs/examples/account/get-session.md +1 -1
  21. package/docs/examples/account/list-mfa-factors.md +1 -0
  22. package/docs/examples/account/update-m-f-a.md +2 -0
  23. package/docs/examples/account/update-magic-u-r-l-session.md +2 -2
  24. package/docs/examples/account/update-mfa-authenticator.md +3 -0
  25. package/docs/examples/account/update-mfa-challenge.md +3 -0
  26. package/docs/examples/account/update-mfa-recovery-codes.md +1 -0
  27. package/docs/examples/account/update-name.md +1 -1
  28. package/docs/examples/account/update-phone-session.md +2 -2
  29. package/docs/examples/account/update-phone-verification.md +2 -2
  30. package/docs/examples/account/update-push-target.md +3 -0
  31. package/docs/examples/account/update-recovery.md +3 -4
  32. package/docs/examples/account/update-session.md +1 -1
  33. package/docs/examples/account/update-verification.md +2 -2
  34. package/docs/examples/assistant/chat.md +1 -1
  35. package/docs/examples/avatars/get-q-r.md +1 -1
  36. package/docs/examples/databases/create-boolean-attribute.md +2 -2
  37. package/docs/examples/databases/create-collection.md +3 -3
  38. package/docs/examples/databases/create-datetime-attribute.md +2 -2
  39. package/docs/examples/databases/create-document.md +3 -3
  40. package/docs/examples/databases/create-email-attribute.md +2 -2
  41. package/docs/examples/databases/create-enum-attribute.md +2 -2
  42. package/docs/examples/databases/create-float-attribute.md +2 -2
  43. package/docs/examples/databases/create-index.md +2 -2
  44. package/docs/examples/databases/create-integer-attribute.md +2 -2
  45. package/docs/examples/databases/create-ip-attribute.md +2 -2
  46. package/docs/examples/databases/create-relationship-attribute.md +3 -3
  47. package/docs/examples/databases/create-string-attribute.md +2 -2
  48. package/docs/examples/databases/create-url-attribute.md +2 -2
  49. package/docs/examples/databases/create.md +2 -2
  50. package/docs/examples/databases/delete-attribute.md +2 -2
  51. package/docs/examples/databases/delete-collection.md +2 -2
  52. package/docs/examples/databases/delete-document.md +3 -3
  53. package/docs/examples/databases/delete-index.md +2 -2
  54. package/docs/examples/databases/delete.md +1 -1
  55. package/docs/examples/databases/get-attribute.md +2 -2
  56. package/docs/examples/databases/get-collection-usage.md +2 -2
  57. package/docs/examples/databases/get-collection.md +2 -2
  58. package/docs/examples/databases/get-database-usage.md +1 -1
  59. package/docs/examples/databases/get-document.md +3 -3
  60. package/docs/examples/databases/get-index.md +2 -2
  61. package/docs/examples/databases/get.md +1 -1
  62. package/docs/examples/databases/list-attributes.md +2 -2
  63. package/docs/examples/databases/list-collection-logs.md +2 -2
  64. package/docs/examples/databases/list-collections.md +1 -1
  65. package/docs/examples/databases/list-document-logs.md +3 -3
  66. package/docs/examples/databases/list-documents.md +2 -2
  67. package/docs/examples/databases/list-indexes.md +2 -2
  68. package/docs/examples/databases/list-logs.md +1 -1
  69. package/docs/examples/databases/update-boolean-attribute.md +2 -2
  70. package/docs/examples/databases/update-collection.md +3 -3
  71. package/docs/examples/databases/update-datetime-attribute.md +2 -2
  72. package/docs/examples/databases/update-document.md +3 -3
  73. package/docs/examples/databases/update-email-attribute.md +2 -2
  74. package/docs/examples/databases/update-enum-attribute.md +3 -3
  75. package/docs/examples/databases/update-float-attribute.md +2 -2
  76. package/docs/examples/databases/update-integer-attribute.md +2 -2
  77. package/docs/examples/databases/update-ip-attribute.md +2 -2
  78. package/docs/examples/databases/update-relationship-attribute.md +2 -2
  79. package/docs/examples/databases/update-string-attribute.md +3 -3
  80. package/docs/examples/databases/update-url-attribute.md +2 -2
  81. package/docs/examples/databases/update.md +2 -2
  82. package/docs/examples/functions/create-build.md +3 -3
  83. package/docs/examples/functions/create-deployment.md +1 -1
  84. package/docs/examples/functions/create-execution.md +1 -1
  85. package/docs/examples/functions/create-variable.md +3 -3
  86. package/docs/examples/functions/create.md +3 -3
  87. package/docs/examples/functions/delete-deployment.md +2 -2
  88. package/docs/examples/functions/delete-variable.md +2 -2
  89. package/docs/examples/functions/delete.md +1 -1
  90. package/docs/examples/functions/download-deployment.md +2 -2
  91. package/docs/examples/functions/get-deployment.md +2 -2
  92. package/docs/examples/functions/get-execution.md +2 -2
  93. package/docs/examples/functions/get-function-usage.md +1 -1
  94. package/docs/examples/functions/get-variable.md +2 -2
  95. package/docs/examples/functions/get.md +1 -1
  96. package/docs/examples/functions/list-deployments.md +1 -1
  97. package/docs/examples/functions/list-executions.md +1 -1
  98. package/docs/examples/functions/list-variables.md +1 -1
  99. package/docs/examples/functions/update-deployment.md +2 -2
  100. package/docs/examples/functions/update-variable.md +3 -3
  101. package/docs/examples/functions/update.md +2 -2
  102. package/docs/examples/health/get-certificate.md +2 -0
  103. package/docs/examples/health/get-failed-jobs.md +3 -0
  104. package/docs/examples/health/get-queue-usage-dump.md +2 -0
  105. package/docs/examples/health/get-queue-usage.md +2 -0
  106. package/docs/examples/health/get-storage.md +1 -0
  107. package/docs/examples/messaging/create-apns-provider.md +9 -0
  108. package/docs/examples/messaging/create-email.md +13 -0
  109. package/docs/examples/messaging/create-fcm-provider.md +5 -0
  110. package/docs/examples/messaging/create-mailgun-provider.md +11 -0
  111. package/docs/examples/messaging/create-msg91provider.md +7 -0
  112. package/docs/examples/messaging/create-push.md +17 -0
  113. package/docs/examples/messaging/create-sendgrid-provider.md +9 -0
  114. package/docs/examples/messaging/create-sms.md +8 -0
  115. package/docs/examples/messaging/create-smtp-provider.md +15 -0
  116. package/docs/examples/messaging/create-subscriber.md +4 -0
  117. package/docs/examples/messaging/create-telesign-provider.md +7 -0
  118. package/docs/examples/messaging/create-textmagic-provider.md +7 -0
  119. package/docs/examples/messaging/create-topic.md +4 -0
  120. package/docs/examples/messaging/create-twilio-provider.md +7 -0
  121. package/docs/examples/messaging/create-vonage-provider.md +7 -0
  122. package/docs/examples/messaging/delete-provider.md +2 -0
  123. package/docs/examples/messaging/delete-subscriber.md +3 -0
  124. package/docs/examples/messaging/delete-topic.md +2 -0
  125. package/docs/examples/messaging/delete.md +2 -0
  126. package/docs/examples/messaging/get-message.md +2 -0
  127. package/docs/examples/messaging/get-provider.md +2 -0
  128. package/docs/examples/messaging/get-subscriber.md +3 -0
  129. package/docs/examples/messaging/get-topic.md +2 -0
  130. package/docs/examples/messaging/list-message-logs.md +3 -0
  131. package/docs/examples/messaging/list-messages.md +3 -0
  132. package/docs/examples/messaging/list-provider-logs.md +3 -0
  133. package/docs/examples/messaging/list-providers.md +3 -0
  134. package/docs/examples/messaging/list-subscriber-logs.md +3 -0
  135. package/docs/examples/messaging/list-subscribers.md +4 -0
  136. package/docs/examples/messaging/list-targets.md +3 -0
  137. package/docs/examples/messaging/list-topic-logs.md +3 -0
  138. package/docs/examples/messaging/list-topics.md +3 -0
  139. package/docs/examples/messaging/update-apns-provider.md +9 -0
  140. package/docs/examples/messaging/update-email.md +12 -0
  141. package/docs/examples/messaging/update-fcm-provider.md +5 -0
  142. package/docs/examples/messaging/update-mailgun-provider.md +11 -0
  143. package/docs/examples/messaging/update-msg91provider.md +7 -0
  144. package/docs/examples/messaging/update-push.md +17 -0
  145. package/docs/examples/messaging/update-sendgrid-provider.md +9 -0
  146. package/docs/examples/messaging/update-sms.md +8 -0
  147. package/docs/examples/messaging/update-smtp-provider.md +15 -0
  148. package/docs/examples/messaging/update-telesign-provider.md +7 -0
  149. package/docs/examples/messaging/update-textmagic-provider.md +7 -0
  150. package/docs/examples/messaging/update-topic.md +4 -0
  151. package/docs/examples/messaging/update-twilio-provider.md +7 -0
  152. package/docs/examples/messaging/update-vonage-provider.md +7 -0
  153. package/docs/examples/migrations/create-appwrite-migration.md +2 -2
  154. package/docs/examples/migrations/create-firebase-migration.md +1 -1
  155. package/docs/examples/migrations/create-firebase-o-auth-migration.md +1 -1
  156. package/docs/examples/migrations/create-n-host-migration.md +6 -6
  157. package/docs/examples/migrations/create-supabase-migration.md +4 -4
  158. package/docs/examples/migrations/delete.md +1 -1
  159. package/docs/examples/migrations/get-appwrite-report.md +2 -2
  160. package/docs/examples/migrations/get-firebase-report-o-auth.md +1 -1
  161. package/docs/examples/migrations/get-firebase-report.md +1 -1
  162. package/docs/examples/migrations/get-n-host-report.md +6 -6
  163. package/docs/examples/migrations/get-supabase-report.md +4 -4
  164. package/docs/examples/migrations/get.md +1 -1
  165. package/docs/examples/migrations/retry.md +1 -1
  166. package/docs/examples/project/create-variable.md +2 -2
  167. package/docs/examples/project/delete-variable.md +1 -1
  168. package/docs/examples/project/get-usage.md +2 -0
  169. package/docs/examples/project/get-variable.md +1 -1
  170. package/docs/examples/project/update-variable.md +2 -2
  171. package/docs/examples/projects/create-key.md +2 -2
  172. package/docs/examples/projects/create-platform.md +2 -2
  173. package/docs/examples/projects/create-smtp-test.md +11 -0
  174. package/docs/examples/projects/create-webhook.md +4 -3
  175. package/docs/examples/projects/create.md +2 -2
  176. package/docs/examples/projects/delete-email-template.md +1 -1
  177. package/docs/examples/projects/delete-key.md +2 -2
  178. package/docs/examples/projects/delete-platform.md +2 -2
  179. package/docs/examples/projects/delete-sms-template.md +1 -1
  180. package/docs/examples/projects/delete-webhook.md +2 -2
  181. package/docs/examples/projects/delete.md +1 -1
  182. package/docs/examples/projects/get-email-template.md +1 -1
  183. package/docs/examples/projects/get-key.md +2 -2
  184. package/docs/examples/projects/get-platform.md +2 -2
  185. package/docs/examples/projects/get-sms-template.md +1 -1
  186. package/docs/examples/projects/get-webhook.md +2 -2
  187. package/docs/examples/projects/get.md +1 -1
  188. package/docs/examples/projects/list-keys.md +1 -1
  189. package/docs/examples/projects/list-platforms.md +1 -1
  190. package/docs/examples/projects/list-webhooks.md +1 -1
  191. package/docs/examples/projects/update-api-status-all.md +3 -0
  192. package/docs/examples/projects/update-api-status.md +4 -0
  193. package/docs/examples/projects/update-auth-duration.md +1 -1
  194. package/docs/examples/projects/update-auth-limit.md +1 -1
  195. package/docs/examples/projects/update-auth-password-dictionary.md +1 -1
  196. package/docs/examples/projects/update-auth-password-history.md +1 -1
  197. package/docs/examples/projects/update-auth-sessions-limit.md +1 -1
  198. package/docs/examples/projects/update-auth-status.md +1 -1
  199. package/docs/examples/projects/update-email-template.md +3 -3
  200. package/docs/examples/projects/update-key.md +3 -3
  201. package/docs/examples/projects/update-o-auth2.md +1 -1
  202. package/docs/examples/projects/update-personal-data-check.md +1 -1
  203. package/docs/examples/projects/update-platform.md +3 -3
  204. package/docs/examples/projects/update-service-status-all.md +1 -1
  205. package/docs/examples/projects/update-service-status.md +1 -1
  206. package/docs/examples/projects/update-sms-template.md +2 -2
  207. package/docs/examples/projects/update-smtp.md +11 -0
  208. package/docs/examples/projects/update-team.md +2 -2
  209. package/docs/examples/projects/update-webhook-signature.md +2 -2
  210. package/docs/examples/projects/update-webhook.md +5 -4
  211. package/docs/examples/projects/update.md +2 -2
  212. package/docs/examples/proxy/delete-rule.md +1 -1
  213. package/docs/examples/proxy/get-rule.md +1 -1
  214. package/docs/examples/proxy/update-rule-verification.md +1 -1
  215. package/docs/examples/storage/create-bucket.md +2 -2
  216. package/docs/examples/storage/create-file.md +2 -2
  217. package/docs/examples/storage/delete-bucket.md +1 -1
  218. package/docs/examples/storage/delete-file.md +2 -2
  219. package/docs/examples/storage/get-bucket-usage.md +1 -1
  220. package/docs/examples/storage/get-bucket.md +1 -1
  221. package/docs/examples/storage/get-file-download.md +2 -2
  222. package/docs/examples/storage/get-file-preview.md +2 -2
  223. package/docs/examples/storage/get-file-view.md +2 -2
  224. package/docs/examples/storage/get-file.md +2 -2
  225. package/docs/examples/storage/list-files.md +1 -1
  226. package/docs/examples/storage/update-bucket.md +2 -2
  227. package/docs/examples/storage/update-file.md +2 -2
  228. package/docs/examples/teams/create-membership.md +1 -1
  229. package/docs/examples/teams/create.md +2 -2
  230. package/docs/examples/teams/delete-membership.md +2 -2
  231. package/docs/examples/teams/delete.md +1 -1
  232. package/docs/examples/teams/get-membership.md +2 -2
  233. package/docs/examples/teams/get-prefs.md +1 -1
  234. package/docs/examples/teams/get.md +1 -1
  235. package/docs/examples/teams/list-logs.md +1 -1
  236. package/docs/examples/teams/list-memberships.md +1 -1
  237. package/docs/examples/teams/update-membership-status.md +4 -4
  238. package/docs/examples/teams/update-membership.md +2 -2
  239. package/docs/examples/teams/update-name.md +2 -2
  240. package/docs/examples/teams/update-prefs.md +1 -1
  241. package/docs/examples/users/create-argon2user.md +1 -1
  242. package/docs/examples/users/create-bcrypt-user.md +1 -1
  243. package/docs/examples/users/create-m-d5user.md +1 -1
  244. package/docs/examples/users/create-mfa-recovery-codes.md +2 -0
  245. package/docs/examples/users/create-p-h-pass-user.md +1 -1
  246. package/docs/examples/users/create-s-h-a-user.md +1 -1
  247. package/docs/examples/users/create-scrypt-modified-user.md +4 -4
  248. package/docs/examples/users/create-scrypt-user.md +2 -2
  249. package/docs/examples/users/create-session.md +2 -0
  250. package/docs/examples/users/create-target.md +7 -0
  251. package/docs/examples/users/create-token.md +4 -0
  252. package/docs/examples/users/create.md +1 -1
  253. package/docs/examples/users/delete-identity.md +1 -1
  254. package/docs/examples/users/delete-mfa-authenticator.md +3 -0
  255. package/docs/examples/users/delete-session.md +2 -2
  256. package/docs/examples/users/delete-sessions.md +1 -1
  257. package/docs/examples/users/delete-target.md +3 -0
  258. package/docs/examples/users/delete.md +1 -1
  259. package/docs/examples/users/get-mfa-recovery-codes.md +2 -0
  260. package/docs/examples/users/get-prefs.md +1 -1
  261. package/docs/examples/users/get-target.md +3 -0
  262. package/docs/examples/users/get-usage.md +0 -1
  263. package/docs/examples/users/get.md +1 -1
  264. package/docs/examples/users/list-logs.md +1 -1
  265. package/docs/examples/users/list-memberships.md +1 -1
  266. package/docs/examples/users/list-mfa-factors.md +2 -0
  267. package/docs/examples/users/list-sessions.md +1 -1
  268. package/docs/examples/users/list-targets.md +3 -0
  269. package/docs/examples/users/update-email-verification.md +1 -1
  270. package/docs/examples/users/update-email.md +1 -1
  271. package/docs/examples/users/update-labels.md +1 -1
  272. package/docs/examples/users/update-mfa-recovery-codes.md +2 -0
  273. package/docs/examples/users/update-mfa.md +3 -0
  274. package/docs/examples/users/update-name.md +2 -2
  275. package/docs/examples/users/update-password.md +1 -1
  276. package/docs/examples/users/update-phone-verification.md +1 -1
  277. package/docs/examples/users/update-phone.md +1 -1
  278. package/docs/examples/users/update-prefs.md +1 -1
  279. package/docs/examples/users/update-status.md +1 -1
  280. package/docs/examples/users/update-target.md +6 -0
  281. package/docs/examples/vcs/create-repository-detection.md +2 -2
  282. package/docs/examples/vcs/create-repository.md +2 -2
  283. package/docs/examples/vcs/delete-installation.md +1 -1
  284. package/docs/examples/vcs/get-installation.md +1 -1
  285. package/docs/examples/vcs/get-repository.md +2 -2
  286. package/docs/examples/vcs/list-repositories.md +1 -1
  287. package/docs/examples/vcs/list-repository-branches.md +2 -2
  288. package/docs/examples/vcs/update-external-deployments.md +3 -3
  289. package/index.js +2 -0
  290. package/install.ps1 +2 -2
  291. package/install.sh +1 -1
  292. package/lib/client.js +9 -4
  293. package/lib/commands/account.js +966 -381
  294. package/lib/commands/assistant.js +3 -8
  295. package/lib/commands/avatars.js +32 -48
  296. package/lib/commands/console.js +3 -8
  297. package/lib/commands/databases.js +119 -265
  298. package/lib/commands/deploy.js +45 -6
  299. package/lib/commands/functions.js +59 -124
  300. package/lib/commands/generic.js +0 -1
  301. package/lib/commands/graphql.js +5 -13
  302. package/lib/commands/health.js +225 -89
  303. package/lib/commands/locale.js +17 -43
  304. package/lib/commands/messaging.js +2815 -0
  305. package/lib/commands/migrations.js +35 -85
  306. package/lib/commands/project.js +28 -38
  307. package/lib/commands/projects.js +286 -270
  308. package/lib/commands/proxy.js +12 -29
  309. package/lib/commands/storage.js +42 -87
  310. package/lib/commands/teams.js +31 -75
  311. package/lib/commands/users.js +677 -235
  312. package/lib/commands/vcs.js +19 -48
  313. package/lib/paginate.js +2 -2
  314. package/lib/parser.js +1 -0
  315. package/package.json +1 -1
  316. package/scoop/appwrite.json +3 -3
  317. package/docs/examples/account/create-magic-u-r-l-session.md +0 -4
  318. package/docs/examples/account/create-phone-session.md +0 -3
  319. package/docs/examples/projects/get-usage.md +0 -3
  320. package/docs/examples/projects/update-smtp-configuration.md +0 -11
@@ -37,7 +37,7 @@ function convertReadStreamToReadableStream(readStream) {
37
37
 
38
38
  const health = new Command("health").description(commandDescriptions['health']).configureHelp({
39
39
  helpWidth: process.stdout.columns || 80
40
- })
40
+ })
41
41
 
42
42
  /**
43
43
  * @typedef {Object} HealthGetRequestParams
@@ -50,18 +50,15 @@ const health = new Command("health").description(commandDescriptions['health']).
50
50
  */
51
51
  const healthGet = async ({ parseOutput = true, sdk = undefined}) => {
52
52
  let client = !sdk ? await sdkForProject() : sdk;
53
-
54
53
  let apiPath = '/health';
55
54
  let payload = {};
56
55
 
57
-
58
56
  let response = undefined;
59
-
57
+
60
58
  response = await client.call('get', apiPath, {
61
59
  'content-type': 'application/json',
62
60
  }, payload);
63
61
 
64
-
65
62
  if (parseOutput) {
66
63
  parse(response)
67
64
  success()
@@ -81,18 +78,15 @@ const healthGet = async ({ parseOutput = true, sdk = undefined}) => {
81
78
  */
82
79
  const healthGetAntivirus = async ({ parseOutput = true, sdk = undefined}) => {
83
80
  let client = !sdk ? await sdkForProject() : sdk;
84
-
85
81
  let apiPath = '/health/anti-virus';
86
82
  let payload = {};
87
83
 
88
-
89
84
  let response = undefined;
90
-
85
+
91
86
  response = await client.call('get', apiPath, {
92
87
  'content-type': 'application/json',
93
88
  }, payload);
94
89
 
95
-
96
90
  if (parseOutput) {
97
91
  parse(response)
98
92
  success()
@@ -112,18 +106,47 @@ const healthGetAntivirus = async ({ parseOutput = true, sdk = undefined}) => {
112
106
  */
113
107
  const healthGetCache = async ({ parseOutput = true, sdk = undefined}) => {
114
108
  let client = !sdk ? await sdkForProject() : sdk;
115
-
116
109
  let apiPath = '/health/cache';
117
110
  let payload = {};
118
111
 
119
-
120
112
  let response = undefined;
121
-
113
+
122
114
  response = await client.call('get', apiPath, {
123
115
  'content-type': 'application/json',
124
116
  }, payload);
125
117
 
118
+ if (parseOutput) {
119
+ parse(response)
120
+ success()
121
+ }
126
122
 
123
+ return response;
124
+ }
125
+
126
+ /**
127
+ * @typedef {Object} HealthGetCertificateRequestParams
128
+ * @property {string} domain string
129
+ * @property {boolean} parseOutput
130
+ * @property {libClient | undefined} sdk
131
+ */
132
+
133
+ /**
134
+ * @param {HealthGetCertificateRequestParams} params
135
+ */
136
+ const healthGetCertificate = async ({ domain, parseOutput = true, sdk = undefined}) => {
137
+ let client = !sdk ? await sdkForProject() : sdk;
138
+ let apiPath = '/health/certificate';
139
+ let payload = {};
140
+ if (typeof domain !== 'undefined') {
141
+ payload['domain'] = domain;
142
+ }
143
+
144
+ let response = undefined;
145
+
146
+ response = await client.call('get', apiPath, {
147
+ 'content-type': 'application/json',
148
+ }, payload);
149
+
127
150
  if (parseOutput) {
128
151
  parse(response)
129
152
  success()
@@ -143,18 +166,15 @@ const healthGetCache = async ({ parseOutput = true, sdk = undefined}) => {
143
166
  */
144
167
  const healthGetDB = async ({ parseOutput = true, sdk = undefined}) => {
145
168
  let client = !sdk ? await sdkForProject() : sdk;
146
-
147
169
  let apiPath = '/health/db';
148
170
  let payload = {};
149
171
 
150
-
151
172
  let response = undefined;
152
-
173
+
153
174
  response = await client.call('get', apiPath, {
154
175
  'content-type': 'application/json',
155
176
  }, payload);
156
177
 
157
-
158
178
  if (parseOutput) {
159
179
  parse(response)
160
180
  success()
@@ -174,18 +194,15 @@ const healthGetDB = async ({ parseOutput = true, sdk = undefined}) => {
174
194
  */
175
195
  const healthGetPubSub = async ({ parseOutput = true, sdk = undefined}) => {
176
196
  let client = !sdk ? await sdkForProject() : sdk;
177
-
178
197
  let apiPath = '/health/pubsub';
179
198
  let payload = {};
180
199
 
181
-
182
200
  let response = undefined;
183
-
201
+
184
202
  response = await client.call('get', apiPath, {
185
203
  'content-type': 'application/json',
186
204
  }, payload);
187
205
 
188
-
189
206
  if (parseOutput) {
190
207
  parse(response)
191
208
  success()
@@ -205,18 +222,15 @@ const healthGetPubSub = async ({ parseOutput = true, sdk = undefined}) => {
205
222
  */
206
223
  const healthGetQueue = async ({ parseOutput = true, sdk = undefined}) => {
207
224
  let client = !sdk ? await sdkForProject() : sdk;
208
-
209
225
  let apiPath = '/health/queue';
210
226
  let payload = {};
211
227
 
212
-
213
228
  let response = undefined;
214
-
229
+
215
230
  response = await client.call('get', apiPath, {
216
231
  'content-type': 'application/json',
217
232
  }, payload);
218
233
 
219
-
220
234
  if (parseOutput) {
221
235
  parse(response)
222
236
  success()
@@ -237,21 +251,18 @@ const healthGetQueue = async ({ parseOutput = true, sdk = undefined}) => {
237
251
  */
238
252
  const healthGetQueueBuilds = async ({ threshold, parseOutput = true, sdk = undefined}) => {
239
253
  let client = !sdk ? await sdkForProject() : sdk;
240
-
241
254
  let apiPath = '/health/queue/builds';
242
255
  let payload = {};
243
256
  if (typeof threshold !== 'undefined') {
244
257
  payload['threshold'] = threshold;
245
258
  }
246
259
 
247
-
248
260
  let response = undefined;
249
-
261
+
250
262
  response = await client.call('get', apiPath, {
251
263
  'content-type': 'application/json',
252
264
  }, payload);
253
265
 
254
-
255
266
  if (parseOutput) {
256
267
  parse(response)
257
268
  success()
@@ -272,21 +283,18 @@ const healthGetQueueBuilds = async ({ threshold, parseOutput = true, sdk = undef
272
283
  */
273
284
  const healthGetQueueCertificates = async ({ threshold, parseOutput = true, sdk = undefined}) => {
274
285
  let client = !sdk ? await sdkForProject() : sdk;
275
-
276
286
  let apiPath = '/health/queue/certificates';
277
287
  let payload = {};
278
288
  if (typeof threshold !== 'undefined') {
279
289
  payload['threshold'] = threshold;
280
290
  }
281
291
 
282
-
283
292
  let response = undefined;
284
-
293
+
285
294
  response = await client.call('get', apiPath, {
286
295
  'content-type': 'application/json',
287
296
  }, payload);
288
297
 
289
-
290
298
  if (parseOutput) {
291
299
  parse(response)
292
300
  success()
@@ -308,7 +316,6 @@ const healthGetQueueCertificates = async ({ threshold, parseOutput = true, sdk =
308
316
  */
309
317
  const healthGetQueueDatabases = async ({ name, threshold, parseOutput = true, sdk = undefined}) => {
310
318
  let client = !sdk ? await sdkForProject() : sdk;
311
-
312
319
  let apiPath = '/health/queue/databases';
313
320
  let payload = {};
314
321
  if (typeof name !== 'undefined') {
@@ -318,14 +325,12 @@ const healthGetQueueDatabases = async ({ name, threshold, parseOutput = true, sd
318
325
  payload['threshold'] = threshold;
319
326
  }
320
327
 
321
-
322
328
  let response = undefined;
323
-
329
+
324
330
  response = await client.call('get', apiPath, {
325
331
  'content-type': 'application/json',
326
332
  }, payload);
327
333
 
328
-
329
334
  if (parseOutput) {
330
335
  parse(response)
331
336
  success()
@@ -346,21 +351,51 @@ const healthGetQueueDatabases = async ({ name, threshold, parseOutput = true, sd
346
351
  */
347
352
  const healthGetQueueDeletes = async ({ threshold, parseOutput = true, sdk = undefined}) => {
348
353
  let client = !sdk ? await sdkForProject() : sdk;
349
-
350
354
  let apiPath = '/health/queue/deletes';
351
355
  let payload = {};
352
356
  if (typeof threshold !== 'undefined') {
353
357
  payload['threshold'] = threshold;
354
358
  }
355
359
 
356
-
357
360
  let response = undefined;
358
-
361
+
359
362
  response = await client.call('get', apiPath, {
360
363
  'content-type': 'application/json',
361
364
  }, payload);
362
365
 
366
+ if (parseOutput) {
367
+ parse(response)
368
+ success()
369
+ }
363
370
 
371
+ return response;
372
+ }
373
+
374
+ /**
375
+ * @typedef {Object} HealthGetFailedJobsRequestParams
376
+ * @property {Name} name The name of the queue
377
+ * @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
378
+ * @property {boolean} parseOutput
379
+ * @property {libClient | undefined} sdk
380
+ */
381
+
382
+ /**
383
+ * @param {HealthGetFailedJobsRequestParams} params
384
+ */
385
+ const healthGetFailedJobs = async ({ name, threshold, parseOutput = true, sdk = undefined}) => {
386
+ let client = !sdk ? await sdkForProject() : sdk;
387
+ let apiPath = '/health/queue/failed/{name}'.replace('{name}', name);
388
+ let payload = {};
389
+ if (typeof threshold !== 'undefined') {
390
+ payload['threshold'] = threshold;
391
+ }
392
+
393
+ let response = undefined;
394
+
395
+ response = await client.call('get', apiPath, {
396
+ 'content-type': 'application/json',
397
+ }, payload);
398
+
364
399
  if (parseOutput) {
365
400
  parse(response)
366
401
  success()
@@ -381,21 +416,18 @@ const healthGetQueueDeletes = async ({ threshold, parseOutput = true, sdk = unde
381
416
  */
382
417
  const healthGetQueueFunctions = async ({ threshold, parseOutput = true, sdk = undefined}) => {
383
418
  let client = !sdk ? await sdkForProject() : sdk;
384
-
385
419
  let apiPath = '/health/queue/functions';
386
420
  let payload = {};
387
421
  if (typeof threshold !== 'undefined') {
388
422
  payload['threshold'] = threshold;
389
423
  }
390
424
 
391
-
392
425
  let response = undefined;
393
-
426
+
394
427
  response = await client.call('get', apiPath, {
395
428
  'content-type': 'application/json',
396
429
  }, payload);
397
430
 
398
-
399
431
  if (parseOutput) {
400
432
  parse(response)
401
433
  success()
@@ -416,21 +448,18 @@ const healthGetQueueFunctions = async ({ threshold, parseOutput = true, sdk = un
416
448
  */
417
449
  const healthGetQueueLogs = async ({ threshold, parseOutput = true, sdk = undefined}) => {
418
450
  let client = !sdk ? await sdkForProject() : sdk;
419
-
420
451
  let apiPath = '/health/queue/logs';
421
452
  let payload = {};
422
453
  if (typeof threshold !== 'undefined') {
423
454
  payload['threshold'] = threshold;
424
455
  }
425
456
 
426
-
427
457
  let response = undefined;
428
-
458
+
429
459
  response = await client.call('get', apiPath, {
430
460
  'content-type': 'application/json',
431
461
  }, payload);
432
462
 
433
-
434
463
  if (parseOutput) {
435
464
  parse(response)
436
465
  success()
@@ -451,21 +480,18 @@ const healthGetQueueLogs = async ({ threshold, parseOutput = true, sdk = undefin
451
480
  */
452
481
  const healthGetQueueMails = async ({ threshold, parseOutput = true, sdk = undefined}) => {
453
482
  let client = !sdk ? await sdkForProject() : sdk;
454
-
455
483
  let apiPath = '/health/queue/mails';
456
484
  let payload = {};
457
485
  if (typeof threshold !== 'undefined') {
458
486
  payload['threshold'] = threshold;
459
487
  }
460
488
 
461
-
462
489
  let response = undefined;
463
-
490
+
464
491
  response = await client.call('get', apiPath, {
465
492
  'content-type': 'application/json',
466
493
  }, payload);
467
494
 
468
-
469
495
  if (parseOutput) {
470
496
  parse(response)
471
497
  success()
@@ -486,21 +512,18 @@ const healthGetQueueMails = async ({ threshold, parseOutput = true, sdk = undefi
486
512
  */
487
513
  const healthGetQueueMessaging = async ({ threshold, parseOutput = true, sdk = undefined}) => {
488
514
  let client = !sdk ? await sdkForProject() : sdk;
489
-
490
515
  let apiPath = '/health/queue/messaging';
491
516
  let payload = {};
492
517
  if (typeof threshold !== 'undefined') {
493
518
  payload['threshold'] = threshold;
494
519
  }
495
520
 
496
-
497
521
  let response = undefined;
498
-
522
+
499
523
  response = await client.call('get', apiPath, {
500
524
  'content-type': 'application/json',
501
525
  }, payload);
502
526
 
503
-
504
527
  if (parseOutput) {
505
528
  parse(response)
506
529
  success()
@@ -521,21 +544,82 @@ const healthGetQueueMessaging = async ({ threshold, parseOutput = true, sdk = un
521
544
  */
522
545
  const healthGetQueueMigrations = async ({ threshold, parseOutput = true, sdk = undefined}) => {
523
546
  let client = !sdk ? await sdkForProject() : sdk;
524
-
525
547
  let apiPath = '/health/queue/migrations';
526
548
  let payload = {};
527
549
  if (typeof threshold !== 'undefined') {
528
550
  payload['threshold'] = threshold;
529
551
  }
530
552
 
531
-
532
553
  let response = undefined;
554
+
555
+ response = await client.call('get', apiPath, {
556
+ 'content-type': 'application/json',
557
+ }, payload);
558
+
559
+ if (parseOutput) {
560
+ parse(response)
561
+ success()
562
+ }
533
563
 
564
+ return response;
565
+ }
566
+
567
+ /**
568
+ * @typedef {Object} HealthGetQueueUsageRequestParams
569
+ * @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
570
+ * @property {boolean} parseOutput
571
+ * @property {libClient | undefined} sdk
572
+ */
573
+
574
+ /**
575
+ * @param {HealthGetQueueUsageRequestParams} params
576
+ */
577
+ const healthGetQueueUsage = async ({ threshold, parseOutput = true, sdk = undefined}) => {
578
+ let client = !sdk ? await sdkForProject() : sdk;
579
+ let apiPath = '/health/queue/usage';
580
+ let payload = {};
581
+ if (typeof threshold !== 'undefined') {
582
+ payload['threshold'] = threshold;
583
+ }
584
+
585
+ let response = undefined;
586
+
534
587
  response = await client.call('get', apiPath, {
535
588
  'content-type': 'application/json',
536
589
  }, payload);
537
590
 
591
+ if (parseOutput) {
592
+ parse(response)
593
+ success()
594
+ }
538
595
 
596
+ return response;
597
+ }
598
+
599
+ /**
600
+ * @typedef {Object} HealthGetQueueUsageDumpRequestParams
601
+ * @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
602
+ * @property {boolean} parseOutput
603
+ * @property {libClient | undefined} sdk
604
+ */
605
+
606
+ /**
607
+ * @param {HealthGetQueueUsageDumpRequestParams} params
608
+ */
609
+ const healthGetQueueUsageDump = async ({ threshold, parseOutput = true, sdk = undefined}) => {
610
+ let client = !sdk ? await sdkForProject() : sdk;
611
+ let apiPath = '/health/queue/usage-dump';
612
+ let payload = {};
613
+ if (typeof threshold !== 'undefined') {
614
+ payload['threshold'] = threshold;
615
+ }
616
+
617
+ let response = undefined;
618
+
619
+ response = await client.call('get', apiPath, {
620
+ 'content-type': 'application/json',
621
+ }, payload);
622
+
539
623
  if (parseOutput) {
540
624
  parse(response)
541
625
  success()
@@ -556,21 +640,46 @@ const healthGetQueueMigrations = async ({ threshold, parseOutput = true, sdk = u
556
640
  */
557
641
  const healthGetQueueWebhooks = async ({ threshold, parseOutput = true, sdk = undefined}) => {
558
642
  let client = !sdk ? await sdkForProject() : sdk;
559
-
560
643
  let apiPath = '/health/queue/webhooks';
561
644
  let payload = {};
562
645
  if (typeof threshold !== 'undefined') {
563
646
  payload['threshold'] = threshold;
564
647
  }
565
648
 
566
-
567
649
  let response = undefined;
568
-
650
+
569
651
  response = await client.call('get', apiPath, {
570
652
  'content-type': 'application/json',
571
653
  }, payload);
572
654
 
655
+ if (parseOutput) {
656
+ parse(response)
657
+ success()
658
+ }
573
659
 
660
+ return response;
661
+ }
662
+
663
+ /**
664
+ * @typedef {Object} HealthGetStorageRequestParams
665
+ * @property {boolean} parseOutput
666
+ * @property {libClient | undefined} sdk
667
+ */
668
+
669
+ /**
670
+ * @param {HealthGetStorageRequestParams} params
671
+ */
672
+ const healthGetStorage = async ({ parseOutput = true, sdk = undefined}) => {
673
+ let client = !sdk ? await sdkForProject() : sdk;
674
+ let apiPath = '/health/storage';
675
+ let payload = {};
676
+
677
+ let response = undefined;
678
+
679
+ response = await client.call('get', apiPath, {
680
+ 'content-type': 'application/json',
681
+ }, payload);
682
+
574
683
  if (parseOutput) {
575
684
  parse(response)
576
685
  success()
@@ -590,18 +699,15 @@ const healthGetQueueWebhooks = async ({ threshold, parseOutput = true, sdk = und
590
699
  */
591
700
  const healthGetStorageLocal = async ({ parseOutput = true, sdk = undefined}) => {
592
701
  let client = !sdk ? await sdkForProject() : sdk;
593
-
594
702
  let apiPath = '/health/storage/local';
595
703
  let payload = {};
596
704
 
597
-
598
705
  let response = undefined;
599
-
706
+
600
707
  response = await client.call('get', apiPath, {
601
708
  'content-type': 'application/json',
602
709
  }, payload);
603
710
 
604
-
605
711
  if (parseOutput) {
606
712
  parse(response)
607
713
  success()
@@ -621,18 +727,15 @@ const healthGetStorageLocal = async ({ parseOutput = true, sdk = undefined}) =>
621
727
  */
622
728
  const healthGetTime = async ({ parseOutput = true, sdk = undefined}) => {
623
729
  let client = !sdk ? await sdkForProject() : sdk;
624
-
625
730
  let apiPath = '/health/time';
626
731
  let payload = {};
627
732
 
628
-
629
733
  let response = undefined;
630
-
734
+
631
735
  response = await client.call('get', apiPath, {
632
736
  'content-type': 'application/json',
633
737
  }, payload);
634
738
 
635
-
636
739
  if (parseOutput) {
637
740
  parse(response)
638
741
  success()
@@ -641,7 +744,6 @@ const healthGetTime = async ({ parseOutput = true, sdk = undefined}) => {
641
744
  return response;
642
745
  }
643
746
 
644
-
645
747
  health
646
748
  .command(`get`)
647
749
  .description(`Check the Appwrite HTTP server is up and responsive.`)
@@ -657,6 +759,12 @@ health
657
759
  .description(`Check the Appwrite in-memory cache servers are up and connection is successful.`)
658
760
  .action(actionRunner(healthGetCache))
659
761
 
762
+ health
763
+ .command(`getCertificate`)
764
+ .description(`Get the SSL certificate for a domain`)
765
+ .option(`--domain <domain>`, `string`)
766
+ .action(actionRunner(healthGetCertificate))
767
+
660
768
  health
661
769
  .command(`getDB`)
662
770
  .description(`Check the Appwrite database servers are up and connection is successful.`)
@@ -697,9 +805,16 @@ health
697
805
  .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
698
806
  .action(actionRunner(healthGetQueueDeletes))
699
807
 
808
+ health
809
+ .command(`getFailedJobs`)
810
+ .description(`Returns the amount of failed jobs in a given queue. `)
811
+ .requiredOption(`--name <name>`, `The name of the queue`)
812
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
813
+ .action(actionRunner(healthGetFailedJobs))
814
+
700
815
  health
701
816
  .command(`getQueueFunctions`)
702
- .description(``)
817
+ .description(`Get the number of function executions that are waiting to be processed in the Appwrite internal queue server.`)
703
818
  .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
704
819
  .action(actionRunner(healthGetQueueFunctions))
705
820
 
@@ -727,12 +842,29 @@ health
727
842
  .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
728
843
  .action(actionRunner(healthGetQueueMigrations))
729
844
 
845
+ health
846
+ .command(`getQueueUsage`)
847
+ .description(`Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.`)
848
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
849
+ .action(actionRunner(healthGetQueueUsage))
850
+
851
+ health
852
+ .command(`getQueueUsageDump`)
853
+ .description(`Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server.`)
854
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
855
+ .action(actionRunner(healthGetQueueUsageDump))
856
+
730
857
  health
731
858
  .command(`getQueueWebhooks`)
732
859
  .description(`Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.`)
733
860
  .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
734
861
  .action(actionRunner(healthGetQueueWebhooks))
735
862
 
863
+ health
864
+ .command(`getStorage`)
865
+ .description(`Check the Appwrite storage device is up and connection is successful.`)
866
+ .action(actionRunner(healthGetStorage))
867
+
736
868
  health
737
869
  .command(`getStorageLocal`)
738
870
  .description(`Check the Appwrite local storage device is up and connection is successful.`)
@@ -743,25 +875,29 @@ health
743
875
  .description(`Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.`)
744
876
  .action(actionRunner(healthGetTime))
745
877
 
746
-
747
878
  module.exports = {
748
879
  health,
749
- healthGet,
750
- healthGetAntivirus,
751
- healthGetCache,
752
- healthGetDB,
753
- healthGetPubSub,
754
- healthGetQueue,
755
- healthGetQueueBuilds,
756
- healthGetQueueCertificates,
757
- healthGetQueueDatabases,
758
- healthGetQueueDeletes,
759
- healthGetQueueFunctions,
760
- healthGetQueueLogs,
761
- healthGetQueueMails,
762
- healthGetQueueMessaging,
763
- healthGetQueueMigrations,
764
- healthGetQueueWebhooks,
765
- healthGetStorageLocal,
766
- healthGetTime
880
+ healthGet,
881
+ healthGetAntivirus,
882
+ healthGetCache,
883
+ healthGetCertificate,
884
+ healthGetDB,
885
+ healthGetPubSub,
886
+ healthGetQueue,
887
+ healthGetQueueBuilds,
888
+ healthGetQueueCertificates,
889
+ healthGetQueueDatabases,
890
+ healthGetQueueDeletes,
891
+ healthGetFailedJobs,
892
+ healthGetQueueFunctions,
893
+ healthGetQueueLogs,
894
+ healthGetQueueMails,
895
+ healthGetQueueMessaging,
896
+ healthGetQueueMigrations,
897
+ healthGetQueueUsage,
898
+ healthGetQueueUsageDump,
899
+ healthGetQueueWebhooks,
900
+ healthGetStorage,
901
+ healthGetStorageLocal,
902
+ healthGetTime
767
903
  };