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,11 +37,11 @@ function convertReadStreamToReadableStream(readStream) {
37
37
 
38
38
  const migrations = new Command("migrations").description(commandDescriptions['migrations']).configureHelp({
39
39
  helpWidth: process.stdout.columns || 80
40
- })
40
+ })
41
41
 
42
42
  /**
43
43
  * @typedef {Object} MigrationsListRequestParams
44
- * @property {string} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, stage, source, resources, statusCounters, resourceData, errors
44
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, stage, source, resources, statusCounters, resourceData, errors
45
45
  * @property {string} search Search term to filter your list results. Max length: 256 chars.
46
46
  * @property {boolean} parseOutput
47
47
  * @property {libClient | undefined} sdk
@@ -52,7 +52,6 @@ const migrations = new Command("migrations").description(commandDescriptions['mi
52
52
  */
53
53
  const migrationsList = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
54
54
  let client = !sdk ? await sdkForProject() : sdk;
55
-
56
55
  let apiPath = '/migrations';
57
56
  let payload = {};
58
57
  if (typeof queries !== 'undefined') {
@@ -62,14 +61,12 @@ const migrationsList = async ({ queries, search, parseOutput = true, sdk = undef
62
61
  payload['search'] = search;
63
62
  }
64
63
 
65
-
66
64
  let response = undefined;
67
-
65
+
68
66
  response = await client.call('get', apiPath, {
69
67
  'content-type': 'application/json',
70
68
  }, payload);
71
69
 
72
-
73
70
  if (parseOutput) {
74
71
  parse(response)
75
72
  success()
@@ -93,7 +90,6 @@ const migrationsList = async ({ queries, search, parseOutput = true, sdk = undef
93
90
  */
94
91
  const migrationsCreateAppwriteMigration = async ({ resources, endpoint, projectId, apiKey, parseOutput = true, sdk = undefined}) => {
95
92
  let client = !sdk ? await sdkForProject() : sdk;
96
-
97
93
  let apiPath = '/migrations/appwrite';
98
94
  let payload = {};
99
95
  resources = resources === true ? [] : resources;
@@ -110,14 +106,12 @@ const migrationsCreateAppwriteMigration = async ({ resources, endpoint, projectI
110
106
  payload['apiKey'] = apiKey;
111
107
  }
112
108
 
113
-
114
109
  let response = undefined;
115
-
110
+
116
111
  response = await client.call('post', apiPath, {
117
112
  'content-type': 'application/json',
118
113
  }, payload);
119
114
 
120
-
121
115
  if (parseOutput) {
122
116
  parse(response)
123
117
  success()
@@ -141,7 +135,6 @@ const migrationsCreateAppwriteMigration = async ({ resources, endpoint, projectI
141
135
  */
142
136
  const migrationsGetAppwriteReport = async ({ resources, endpoint, projectID, key, parseOutput = true, sdk = undefined}) => {
143
137
  let client = !sdk ? await sdkForProject() : sdk;
144
-
145
138
  let apiPath = '/migrations/appwrite/report';
146
139
  let payload = {};
147
140
  if (typeof resources !== 'undefined') {
@@ -157,14 +150,12 @@ const migrationsGetAppwriteReport = async ({ resources, endpoint, projectID, key
157
150
  payload['key'] = key;
158
151
  }
159
152
 
160
-
161
153
  let response = undefined;
162
-
154
+
163
155
  response = await client.call('get', apiPath, {
164
156
  'content-type': 'application/json',
165
157
  }, payload);
166
158
 
167
-
168
159
  if (parseOutput) {
169
160
  parse(response)
170
161
  success()
@@ -186,7 +177,6 @@ const migrationsGetAppwriteReport = async ({ resources, endpoint, projectID, key
186
177
  */
187
178
  const migrationsCreateFirebaseMigration = async ({ resources, serviceAccount, parseOutput = true, sdk = undefined}) => {
188
179
  let client = !sdk ? await sdkForProject() : sdk;
189
-
190
180
  let apiPath = '/migrations/firebase';
191
181
  let payload = {};
192
182
  resources = resources === true ? [] : resources;
@@ -197,14 +187,12 @@ const migrationsCreateFirebaseMigration = async ({ resources, serviceAccount, pa
197
187
  payload['serviceAccount'] = serviceAccount;
198
188
  }
199
189
 
200
-
201
190
  let response = undefined;
202
-
191
+
203
192
  response = await client.call('post', apiPath, {
204
193
  'content-type': 'application/json',
205
194
  }, payload);
206
195
 
207
-
208
196
  if (parseOutput) {
209
197
  parse(response)
210
198
  success()
@@ -224,18 +212,15 @@ const migrationsCreateFirebaseMigration = async ({ resources, serviceAccount, pa
224
212
  */
225
213
  const migrationsDeleteFirebaseAuth = async ({ parseOutput = true, sdk = undefined}) => {
226
214
  let client = !sdk ? await sdkForProject() : sdk;
227
-
228
215
  let apiPath = '/migrations/firebase/deauthorize';
229
216
  let payload = {};
230
217
 
231
-
232
218
  let response = undefined;
233
-
219
+
234
220
  response = await client.call('get', apiPath, {
235
221
  'content-type': 'application/json',
236
222
  }, payload);
237
223
 
238
-
239
224
  if (parseOutput) {
240
225
  parse(response)
241
226
  success()
@@ -257,7 +242,6 @@ const migrationsDeleteFirebaseAuth = async ({ parseOutput = true, sdk = undefine
257
242
  */
258
243
  const migrationsCreateFirebaseOAuthMigration = async ({ resources, projectId, parseOutput = true, sdk = undefined}) => {
259
244
  let client = !sdk ? await sdkForProject() : sdk;
260
-
261
245
  let apiPath = '/migrations/firebase/oauth';
262
246
  let payload = {};
263
247
  resources = resources === true ? [] : resources;
@@ -268,14 +252,12 @@ const migrationsCreateFirebaseOAuthMigration = async ({ resources, projectId, pa
268
252
  payload['projectId'] = projectId;
269
253
  }
270
254
 
271
-
272
255
  let response = undefined;
273
-
256
+
274
257
  response = await client.call('post', apiPath, {
275
258
  'content-type': 'application/json',
276
259
  }, payload);
277
260
 
278
-
279
261
  if (parseOutput) {
280
262
  parse(response)
281
263
  success()
@@ -295,18 +277,15 @@ const migrationsCreateFirebaseOAuthMigration = async ({ resources, projectId, pa
295
277
  */
296
278
  const migrationsListFirebaseProjects = async ({ parseOutput = true, sdk = undefined}) => {
297
279
  let client = !sdk ? await sdkForProject() : sdk;
298
-
299
280
  let apiPath = '/migrations/firebase/projects';
300
281
  let payload = {};
301
282
 
302
-
303
283
  let response = undefined;
304
-
284
+
305
285
  response = await client.call('get', apiPath, {
306
286
  'content-type': 'application/json',
307
287
  }, payload);
308
288
 
309
-
310
289
  if (parseOutput) {
311
290
  parse(response)
312
291
  success()
@@ -328,7 +307,6 @@ const migrationsListFirebaseProjects = async ({ parseOutput = true, sdk = undefi
328
307
  */
329
308
  const migrationsGetFirebaseReport = async ({ resources, serviceAccount, parseOutput = true, sdk = undefined}) => {
330
309
  let client = !sdk ? await sdkForProject() : sdk;
331
-
332
310
  let apiPath = '/migrations/firebase/report';
333
311
  let payload = {};
334
312
  if (typeof resources !== 'undefined') {
@@ -338,14 +316,12 @@ const migrationsGetFirebaseReport = async ({ resources, serviceAccount, parseOut
338
316
  payload['serviceAccount'] = serviceAccount;
339
317
  }
340
318
 
341
-
342
319
  let response = undefined;
343
-
320
+
344
321
  response = await client.call('get', apiPath, {
345
322
  'content-type': 'application/json',
346
323
  }, payload);
347
324
 
348
-
349
325
  if (parseOutput) {
350
326
  parse(response)
351
327
  success()
@@ -367,7 +343,6 @@ const migrationsGetFirebaseReport = async ({ resources, serviceAccount, parseOut
367
343
  */
368
344
  const migrationsGetFirebaseReportOAuth = async ({ resources, projectId, parseOutput = true, sdk = undefined}) => {
369
345
  let client = !sdk ? await sdkForProject() : sdk;
370
-
371
346
  let apiPath = '/migrations/firebase/report/oauth';
372
347
  let payload = {};
373
348
  if (typeof resources !== 'undefined') {
@@ -377,14 +352,12 @@ const migrationsGetFirebaseReportOAuth = async ({ resources, projectId, parseOut
377
352
  payload['projectId'] = projectId;
378
353
  }
379
354
 
380
-
381
355
  let response = undefined;
382
-
356
+
383
357
  response = await client.call('get', apiPath, {
384
358
  'content-type': 'application/json',
385
359
  }, payload);
386
360
 
387
-
388
361
  if (parseOutput) {
389
362
  parse(response)
390
363
  success()
@@ -412,7 +385,6 @@ const migrationsGetFirebaseReportOAuth = async ({ resources, projectId, parseOut
412
385
  */
413
386
  const migrationsCreateNHostMigration = async ({ resources, subdomain, region, adminSecret, database, username, password, port, parseOutput = true, sdk = undefined}) => {
414
387
  let client = !sdk ? await sdkForProject() : sdk;
415
-
416
388
  let apiPath = '/migrations/nhost';
417
389
  let payload = {};
418
390
  resources = resources === true ? [] : resources;
@@ -441,14 +413,12 @@ const migrationsCreateNHostMigration = async ({ resources, subdomain, region, ad
441
413
  payload['port'] = port;
442
414
  }
443
415
 
444
-
445
416
  let response = undefined;
446
-
417
+
447
418
  response = await client.call('post', apiPath, {
448
419
  'content-type': 'application/json',
449
420
  }, payload);
450
421
 
451
-
452
422
  if (parseOutput) {
453
423
  parse(response)
454
424
  success()
@@ -476,7 +446,6 @@ const migrationsCreateNHostMigration = async ({ resources, subdomain, region, ad
476
446
  */
477
447
  const migrationsGetNHostReport = async ({ resources, subdomain, region, adminSecret, database, username, password, port, parseOutput = true, sdk = undefined}) => {
478
448
  let client = !sdk ? await sdkForProject() : sdk;
479
-
480
449
  let apiPath = '/migrations/nhost/report';
481
450
  let payload = {};
482
451
  if (typeof resources !== 'undefined') {
@@ -504,14 +473,12 @@ const migrationsGetNHostReport = async ({ resources, subdomain, region, adminSec
504
473
  payload['port'] = port;
505
474
  }
506
475
 
507
-
508
476
  let response = undefined;
509
-
477
+
510
478
  response = await client.call('get', apiPath, {
511
479
  'content-type': 'application/json',
512
480
  }, payload);
513
481
 
514
-
515
482
  if (parseOutput) {
516
483
  parse(response)
517
484
  success()
@@ -538,7 +505,6 @@ const migrationsGetNHostReport = async ({ resources, subdomain, region, adminSec
538
505
  */
539
506
  const migrationsCreateSupabaseMigration = async ({ resources, endpoint, apiKey, databaseHost, username, password, port, parseOutput = true, sdk = undefined}) => {
540
507
  let client = !sdk ? await sdkForProject() : sdk;
541
-
542
508
  let apiPath = '/migrations/supabase';
543
509
  let payload = {};
544
510
  resources = resources === true ? [] : resources;
@@ -564,14 +530,12 @@ const migrationsCreateSupabaseMigration = async ({ resources, endpoint, apiKey,
564
530
  payload['port'] = port;
565
531
  }
566
532
 
567
-
568
533
  let response = undefined;
569
-
534
+
570
535
  response = await client.call('post', apiPath, {
571
536
  'content-type': 'application/json',
572
537
  }, payload);
573
538
 
574
-
575
539
  if (parseOutput) {
576
540
  parse(response)
577
541
  success()
@@ -598,7 +562,6 @@ const migrationsCreateSupabaseMigration = async ({ resources, endpoint, apiKey,
598
562
  */
599
563
  const migrationsGetSupabaseReport = async ({ resources, endpoint, apiKey, databaseHost, username, password, port, parseOutput = true, sdk = undefined}) => {
600
564
  let client = !sdk ? await sdkForProject() : sdk;
601
-
602
565
  let apiPath = '/migrations/supabase/report';
603
566
  let payload = {};
604
567
  if (typeof resources !== 'undefined') {
@@ -623,14 +586,12 @@ const migrationsGetSupabaseReport = async ({ resources, endpoint, apiKey, databa
623
586
  payload['port'] = port;
624
587
  }
625
588
 
626
-
627
589
  let response = undefined;
628
-
590
+
629
591
  response = await client.call('get', apiPath, {
630
592
  'content-type': 'application/json',
631
593
  }, payload);
632
594
 
633
-
634
595
  if (parseOutput) {
635
596
  parse(response)
636
597
  success()
@@ -651,18 +612,15 @@ const migrationsGetSupabaseReport = async ({ resources, endpoint, apiKey, databa
651
612
  */
652
613
  const migrationsGet = async ({ migrationId, parseOutput = true, sdk = undefined}) => {
653
614
  let client = !sdk ? await sdkForProject() : sdk;
654
-
655
615
  let apiPath = '/migrations/{migrationId}'.replace('{migrationId}', migrationId);
656
616
  let payload = {};
657
617
 
658
-
659
618
  let response = undefined;
660
-
619
+
661
620
  response = await client.call('get', apiPath, {
662
621
  'content-type': 'application/json',
663
622
  }, payload);
664
623
 
665
-
666
624
  if (parseOutput) {
667
625
  parse(response)
668
626
  success()
@@ -683,18 +641,15 @@ const migrationsGet = async ({ migrationId, parseOutput = true, sdk = undefined}
683
641
  */
684
642
  const migrationsRetry = async ({ migrationId, parseOutput = true, sdk = undefined}) => {
685
643
  let client = !sdk ? await sdkForProject() : sdk;
686
-
687
644
  let apiPath = '/migrations/{migrationId}'.replace('{migrationId}', migrationId);
688
645
  let payload = {};
689
646
 
690
-
691
647
  let response = undefined;
692
-
648
+
693
649
  response = await client.call('patch', apiPath, {
694
650
  'content-type': 'application/json',
695
651
  }, payload);
696
652
 
697
-
698
653
  if (parseOutput) {
699
654
  parse(response)
700
655
  success()
@@ -715,18 +670,15 @@ const migrationsRetry = async ({ migrationId, parseOutput = true, sdk = undefine
715
670
  */
716
671
  const migrationsDelete = async ({ migrationId, parseOutput = true, sdk = undefined}) => {
717
672
  let client = !sdk ? await sdkForProject() : sdk;
718
-
719
673
  let apiPath = '/migrations/{migrationId}'.replace('{migrationId}', migrationId);
720
674
  let payload = {};
721
675
 
722
-
723
676
  let response = undefined;
724
-
677
+
725
678
  response = await client.call('delete', apiPath, {
726
679
  'content-type': 'application/json',
727
680
  }, payload);
728
681
 
729
-
730
682
  if (parseOutput) {
731
683
  parse(response)
732
684
  success()
@@ -735,11 +687,10 @@ const migrationsDelete = async ({ migrationId, parseOutput = true, sdk = undefin
735
687
  return response;
736
688
  }
737
689
 
738
-
739
690
  migrations
740
691
  .command(`list`)
741
692
  .description(``)
742
- .option(`--queries <queries>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, stage, source, resources, statusCounters, resourceData, errors`)
693
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, stage, source, resources, statusCounters, resourceData, errors`)
743
694
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
744
695
  .action(actionRunner(migrationsList))
745
696
 
@@ -867,23 +818,22 @@ migrations
867
818
  .requiredOption(`--migrationId <migrationId>`, `Migration ID.`)
868
819
  .action(actionRunner(migrationsDelete))
869
820
 
870
-
871
821
  module.exports = {
872
822
  migrations,
873
- migrationsList,
874
- migrationsCreateAppwriteMigration,
875
- migrationsGetAppwriteReport,
876
- migrationsCreateFirebaseMigration,
877
- migrationsDeleteFirebaseAuth,
878
- migrationsCreateFirebaseOAuthMigration,
879
- migrationsListFirebaseProjects,
880
- migrationsGetFirebaseReport,
881
- migrationsGetFirebaseReportOAuth,
882
- migrationsCreateNHostMigration,
883
- migrationsGetNHostReport,
884
- migrationsCreateSupabaseMigration,
885
- migrationsGetSupabaseReport,
886
- migrationsGet,
887
- migrationsRetry,
888
- migrationsDelete
823
+ migrationsList,
824
+ migrationsCreateAppwriteMigration,
825
+ migrationsGetAppwriteReport,
826
+ migrationsCreateFirebaseMigration,
827
+ migrationsDeleteFirebaseAuth,
828
+ migrationsCreateFirebaseOAuthMigration,
829
+ migrationsListFirebaseProjects,
830
+ migrationsGetFirebaseReport,
831
+ migrationsGetFirebaseReportOAuth,
832
+ migrationsCreateNHostMigration,
833
+ migrationsGetNHostReport,
834
+ migrationsCreateSupabaseMigration,
835
+ migrationsGetSupabaseReport,
836
+ migrationsGet,
837
+ migrationsRetry,
838
+ migrationsDelete
889
839
  };
@@ -37,11 +37,13 @@ function convertReadStreamToReadableStream(readStream) {
37
37
 
38
38
  const project = new Command("project").description(commandDescriptions['project']).configureHelp({
39
39
  helpWidth: process.stdout.columns || 80
40
- })
40
+ })
41
41
 
42
42
  /**
43
43
  * @typedef {Object} ProjectGetUsageRequestParams
44
- * @property {string} range Date range.
44
+ * @property {string} startDate Starting date for the usage
45
+ * @property {string} endDate End date for the usage
46
+ * @property {ProjectUsageRange} period Period used
45
47
  * @property {boolean} parseOutput
46
48
  * @property {libClient | undefined} sdk
47
49
  */
@@ -49,23 +51,26 @@ const project = new Command("project").description(commandDescriptions['project'
49
51
  /**
50
52
  * @param {ProjectGetUsageRequestParams} params
51
53
  */
52
- const projectGetUsage = async ({ range, parseOutput = true, sdk = undefined}) => {
54
+ const projectGetUsage = async ({ startDate, endDate, period, parseOutput = true, sdk = undefined}) => {
53
55
  let client = !sdk ? await sdkForProject() : sdk;
54
-
55
56
  let apiPath = '/project/usage';
56
57
  let payload = {};
57
- if (typeof range !== 'undefined') {
58
- payload['range'] = range;
58
+ if (typeof startDate !== 'undefined') {
59
+ payload['startDate'] = startDate;
60
+ }
61
+ if (typeof endDate !== 'undefined') {
62
+ payload['endDate'] = endDate;
63
+ }
64
+ if (typeof period !== 'undefined') {
65
+ payload['period'] = period;
59
66
  }
60
-
61
67
 
62
68
  let response = undefined;
63
-
69
+
64
70
  response = await client.call('get', apiPath, {
65
71
  'content-type': 'application/json',
66
72
  }, payload);
67
73
 
68
-
69
74
  if (parseOutput) {
70
75
  parse(response)
71
76
  success()
@@ -85,18 +90,15 @@ const projectGetUsage = async ({ range, parseOutput = true, sdk = undefined}) =>
85
90
  */
86
91
  const projectListVariables = async ({ parseOutput = true, sdk = undefined}) => {
87
92
  let client = !sdk ? await sdkForProject() : sdk;
88
-
89
93
  let apiPath = '/project/variables';
90
94
  let payload = {};
91
95
 
92
-
93
96
  let response = undefined;
94
-
97
+
95
98
  response = await client.call('get', apiPath, {
96
99
  'content-type': 'application/json',
97
100
  }, payload);
98
101
 
99
-
100
102
  if (parseOutput) {
101
103
  parse(response)
102
104
  success()
@@ -118,7 +120,6 @@ const projectListVariables = async ({ parseOutput = true, sdk = undefined}) => {
118
120
  */
119
121
  const projectCreateVariable = async ({ key, value, parseOutput = true, sdk = undefined}) => {
120
122
  let client = !sdk ? await sdkForProject() : sdk;
121
-
122
123
  let apiPath = '/project/variables';
123
124
  let payload = {};
124
125
  if (typeof key !== 'undefined') {
@@ -128,14 +129,12 @@ const projectCreateVariable = async ({ key, value, parseOutput = true, sdk = und
128
129
  payload['value'] = value;
129
130
  }
130
131
 
131
-
132
132
  let response = undefined;
133
-
133
+
134
134
  response = await client.call('post', apiPath, {
135
135
  'content-type': 'application/json',
136
136
  }, payload);
137
137
 
138
-
139
138
  if (parseOutput) {
140
139
  parse(response)
141
140
  success()
@@ -156,18 +155,15 @@ const projectCreateVariable = async ({ key, value, parseOutput = true, sdk = und
156
155
  */
157
156
  const projectGetVariable = async ({ variableId, parseOutput = true, sdk = undefined}) => {
158
157
  let client = !sdk ? await sdkForProject() : sdk;
159
-
160
158
  let apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId);
161
159
  let payload = {};
162
160
 
163
-
164
161
  let response = undefined;
165
-
162
+
166
163
  response = await client.call('get', apiPath, {
167
164
  'content-type': 'application/json',
168
165
  }, payload);
169
166
 
170
-
171
167
  if (parseOutput) {
172
168
  parse(response)
173
169
  success()
@@ -190,7 +186,6 @@ const projectGetVariable = async ({ variableId, parseOutput = true, sdk = undefi
190
186
  */
191
187
  const projectUpdateVariable = async ({ variableId, key, value, parseOutput = true, sdk = undefined}) => {
192
188
  let client = !sdk ? await sdkForProject() : sdk;
193
-
194
189
  let apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId);
195
190
  let payload = {};
196
191
  if (typeof key !== 'undefined') {
@@ -200,14 +195,12 @@ const projectUpdateVariable = async ({ variableId, key, value, parseOutput = tru
200
195
  payload['value'] = value;
201
196
  }
202
197
 
203
-
204
198
  let response = undefined;
205
-
199
+
206
200
  response = await client.call('put', apiPath, {
207
201
  'content-type': 'application/json',
208
202
  }, payload);
209
203
 
210
-
211
204
  if (parseOutput) {
212
205
  parse(response)
213
206
  success()
@@ -228,18 +221,15 @@ const projectUpdateVariable = async ({ variableId, key, value, parseOutput = tru
228
221
  */
229
222
  const projectDeleteVariable = async ({ variableId, parseOutput = true, sdk = undefined}) => {
230
223
  let client = !sdk ? await sdkForProject() : sdk;
231
-
232
224
  let apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId);
233
225
  let payload = {};
234
226
 
235
-
236
227
  let response = undefined;
237
-
228
+
238
229
  response = await client.call('delete', apiPath, {
239
230
  'content-type': 'application/json',
240
231
  }, payload);
241
232
 
242
-
243
233
  if (parseOutput) {
244
234
  parse(response)
245
235
  success()
@@ -248,11 +238,12 @@ const projectDeleteVariable = async ({ variableId, parseOutput = true, sdk = und
248
238
  return response;
249
239
  }
250
240
 
251
-
252
241
  project
253
242
  .command(`getUsage`)
254
243
  .description(``)
255
- .option(`--range <range>`, `Date range.`)
244
+ .requiredOption(`--startDate <startDate>`, `Starting date for the usage`)
245
+ .requiredOption(`--endDate <endDate>`, `End date for the usage`)
246
+ .option(`--period <period>`, `Period used`)
256
247
  .action(actionRunner(projectGetUsage))
257
248
 
258
249
  project
@@ -287,13 +278,12 @@ project
287
278
  .requiredOption(`--variableId <variableId>`, `Variable unique ID.`)
288
279
  .action(actionRunner(projectDeleteVariable))
289
280
 
290
-
291
281
  module.exports = {
292
282
  project,
293
- projectGetUsage,
294
- projectListVariables,
295
- projectCreateVariable,
296
- projectGetVariable,
297
- projectUpdateVariable,
298
- projectDeleteVariable
283
+ projectGetUsage,
284
+ projectListVariables,
285
+ projectCreateVariable,
286
+ projectGetVariable,
287
+ projectUpdateVariable,
288
+ projectDeleteVariable
299
289
  };