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 functions = new Command("functions").description(commandDescriptions['functions']).configureHelp({
39
39
  helpWidth: process.stdout.columns || 80
40
- })
40
+ })
41
41
 
42
42
  /**
43
43
  * @typedef {Object} FunctionsListRequestParams
@@ -52,7 +52,6 @@ const functions = new Command("functions").description(commandDescriptions['func
52
52
  */
53
53
  const functionsList = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
54
54
  let client = !sdk ? await sdkForProject() : sdk;
55
-
56
55
  let apiPath = '/functions';
57
56
  let payload = {};
58
57
  if (typeof queries !== 'undefined') {
@@ -62,14 +61,12 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
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()
@@ -82,7 +79,7 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
82
79
  * @typedef {Object} FunctionsCreateRequestParams
83
80
  * @property {string} functionId Function ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
84
81
  * @property {string} name Function name. Max length: 128 chars.
85
- * @property {string} runtime Execution runtime.
82
+ * @property {Runtime} runtime Execution runtime.
86
83
  * @property {string[]} execute An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
87
84
  * @property {string[]} events Events list. Maximum of 100 events are allowed.
88
85
  * @property {string} schedule Schedule CRON syntax.
@@ -109,7 +106,6 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
109
106
  */
110
107
  const functionsCreate = async ({ functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, templateRepository, templateOwner, templateRootDirectory, templateBranch, parseOutput = true, sdk = undefined}) => {
111
108
  let client = !sdk ? await sdkForProject() : sdk;
112
-
113
109
  let apiPath = '/functions';
114
110
  let payload = {};
115
111
  if (typeof functionId !== 'undefined') {
@@ -175,14 +171,12 @@ const functionsCreate = async ({ functionId, name, runtime, execute, events, sch
175
171
  payload['templateBranch'] = templateBranch;
176
172
  }
177
173
 
178
-
179
174
  let response = undefined;
180
-
175
+
181
176
  response = await client.call('post', apiPath, {
182
177
  'content-type': 'application/json',
183
178
  }, payload);
184
179
 
185
-
186
180
  if (parseOutput) {
187
181
  parse(response)
188
182
  success()
@@ -202,18 +196,15 @@ const functionsCreate = async ({ functionId, name, runtime, execute, events, sch
202
196
  */
203
197
  const functionsListRuntimes = async ({ parseOutput = true, sdk = undefined}) => {
204
198
  let client = !sdk ? await sdkForProject() : sdk;
205
-
206
199
  let apiPath = '/functions/runtimes';
207
200
  let payload = {};
208
201
 
209
-
210
202
  let response = undefined;
211
-
203
+
212
204
  response = await client.call('get', apiPath, {
213
205
  'content-type': 'application/json',
214
206
  }, payload);
215
207
 
216
-
217
208
  if (parseOutput) {
218
209
  parse(response)
219
210
  success()
@@ -224,7 +215,7 @@ const functionsListRuntimes = async ({ parseOutput = true, sdk = undefined}) =>
224
215
 
225
216
  /**
226
217
  * @typedef {Object} FunctionsGetUsageRequestParams
227
- * @property {string} range Date range.
218
+ * @property {FunctionUsageRange} range Date range.
228
219
  * @property {boolean} parseOutput
229
220
  * @property {libClient | undefined} sdk
230
221
  */
@@ -234,21 +225,18 @@ const functionsListRuntimes = async ({ parseOutput = true, sdk = undefined}) =>
234
225
  */
235
226
  const functionsGetUsage = async ({ range, parseOutput = true, sdk = undefined}) => {
236
227
  let client = !sdk ? await sdkForProject() : sdk;
237
-
238
228
  let apiPath = '/functions/usage';
239
229
  let payload = {};
240
230
  if (typeof range !== 'undefined') {
241
231
  payload['range'] = range;
242
232
  }
243
233
 
244
-
245
234
  let response = undefined;
246
-
235
+
247
236
  response = await client.call('get', apiPath, {
248
237
  'content-type': 'application/json',
249
238
  }, payload);
250
239
 
251
-
252
240
  if (parseOutput) {
253
241
  parse(response)
254
242
  success()
@@ -269,18 +257,15 @@ const functionsGetUsage = async ({ range, parseOutput = true, sdk = undefined})
269
257
  */
270
258
  const functionsGet = async ({ functionId, parseOutput = true, sdk = undefined}) => {
271
259
  let client = !sdk ? await sdkForProject() : sdk;
272
-
273
260
  let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
274
261
  let payload = {};
275
262
 
276
-
277
263
  let response = undefined;
278
-
264
+
279
265
  response = await client.call('get', apiPath, {
280
266
  'content-type': 'application/json',
281
267
  }, payload);
282
268
 
283
-
284
269
  if (parseOutput) {
285
270
  parse(response)
286
271
  success()
@@ -293,7 +278,7 @@ const functionsGet = async ({ functionId, parseOutput = true, sdk = undefined})
293
278
  * @typedef {Object} FunctionsUpdateRequestParams
294
279
  * @property {string} functionId Function ID.
295
280
  * @property {string} name Function name. Max length: 128 chars.
296
- * @property {string} runtime Execution runtime.
281
+ * @property {Runtime} runtime Execution runtime.
297
282
  * @property {string[]} execute An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
298
283
  * @property {string[]} events Events list. Maximum of 100 events are allowed.
299
284
  * @property {string} schedule Schedule CRON syntax.
@@ -316,7 +301,6 @@ const functionsGet = async ({ functionId, parseOutput = true, sdk = undefined})
316
301
  */
317
302
  const functionsUpdate = async ({ functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, parseOutput = true, sdk = undefined}) => {
318
303
  let client = !sdk ? await sdkForProject() : sdk;
319
-
320
304
  let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
321
305
  let payload = {};
322
306
  if (typeof name !== 'undefined') {
@@ -367,14 +351,12 @@ const functionsUpdate = async ({ functionId, name, runtime, execute, events, sch
367
351
  payload['providerRootDirectory'] = providerRootDirectory;
368
352
  }
369
353
 
370
-
371
354
  let response = undefined;
372
-
355
+
373
356
  response = await client.call('put', apiPath, {
374
357
  'content-type': 'application/json',
375
358
  }, payload);
376
359
 
377
-
378
360
  if (parseOutput) {
379
361
  parse(response)
380
362
  success()
@@ -395,18 +377,15 @@ const functionsUpdate = async ({ functionId, name, runtime, execute, events, sch
395
377
  */
396
378
  const functionsDelete = async ({ functionId, parseOutput = true, sdk = undefined}) => {
397
379
  let client = !sdk ? await sdkForProject() : sdk;
398
-
399
380
  let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
400
381
  let payload = {};
401
382
 
402
-
403
383
  let response = undefined;
404
-
384
+
405
385
  response = await client.call('delete', apiPath, {
406
386
  'content-type': 'application/json',
407
387
  }, payload);
408
388
 
409
-
410
389
  if (parseOutput) {
411
390
  parse(response)
412
391
  success()
@@ -429,7 +408,6 @@ const functionsDelete = async ({ functionId, parseOutput = true, sdk = undefined
429
408
  */
430
409
  const functionsListDeployments = async ({ functionId, queries, search, parseOutput = true, sdk = undefined}) => {
431
410
  let client = !sdk ? await sdkForProject() : sdk;
432
-
433
411
  let apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
434
412
  let payload = {};
435
413
  if (typeof queries !== 'undefined') {
@@ -439,14 +417,12 @@ const functionsListDeployments = async ({ functionId, queries, search, parseOutp
439
417
  payload['search'] = search;
440
418
  }
441
419
 
442
-
443
420
  let response = undefined;
444
-
421
+
445
422
  response = await client.call('get', apiPath, {
446
423
  'content-type': 'application/json',
447
424
  }, payload);
448
425
 
449
-
450
426
  if (parseOutput) {
451
427
  parse(response)
452
428
  success()
@@ -472,7 +448,6 @@ const functionsListDeployments = async ({ functionId, queries, search, parseOutp
472
448
  */
473
449
  const functionsCreateDeployment = async ({ functionId, code, activate, entrypoint, commands, parseOutput = true, sdk = undefined, onProgress = () => {}}) => {
474
450
  let client = !sdk ? await sdkForProject() : sdk;
475
-
476
451
  let apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
477
452
  let payload = {};
478
453
  if (typeof entrypoint !== 'undefined') {
@@ -508,6 +483,12 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
508
483
  file: 'code.tar.gz'
509
484
  }, files);
510
485
 
486
+ let archivePath = fs.realpathSync('code.tar.gz')
487
+ if (typeof archivePath !== 'undefined') {
488
+ payload['code'] = archivePath;
489
+ code = archivePath;
490
+ }
491
+
511
492
  const filePath = fs.realpathSync(code);
512
493
  const nodeStream = fs.createReadStream(filePath);
513
494
  const stream = convertReadStreamToReadableStream(nodeStream);
@@ -520,8 +501,6 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
520
501
  payload['activate'] = activate;
521
502
  }
522
503
 
523
-
524
-
525
504
  const size = code.size;
526
505
 
527
506
  const apiHeaders = {
@@ -611,7 +590,6 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
611
590
  }
612
591
 
613
592
  return response;
614
-
615
593
  }
616
594
 
617
595
  /**
@@ -627,18 +605,15 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
627
605
  */
628
606
  const functionsGetDeployment = async ({ functionId, deploymentId, parseOutput = true, sdk = undefined}) => {
629
607
  let client = !sdk ? await sdkForProject() : sdk;
630
-
631
608
  let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
632
609
  let payload = {};
633
610
 
634
-
635
611
  let response = undefined;
636
-
612
+
637
613
  response = await client.call('get', apiPath, {
638
614
  'content-type': 'application/json',
639
615
  }, payload);
640
616
 
641
-
642
617
  if (parseOutput) {
643
618
  parse(response)
644
619
  success()
@@ -660,18 +635,15 @@ const functionsGetDeployment = async ({ functionId, deploymentId, parseOutput =
660
635
  */
661
636
  const functionsUpdateDeployment = async ({ functionId, deploymentId, parseOutput = true, sdk = undefined}) => {
662
637
  let client = !sdk ? await sdkForProject() : sdk;
663
-
664
638
  let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
665
639
  let payload = {};
666
640
 
667
-
668
641
  let response = undefined;
669
-
642
+
670
643
  response = await client.call('patch', apiPath, {
671
644
  'content-type': 'application/json',
672
645
  }, payload);
673
646
 
674
-
675
647
  if (parseOutput) {
676
648
  parse(response)
677
649
  success()
@@ -693,18 +665,15 @@ const functionsUpdateDeployment = async ({ functionId, deploymentId, parseOutput
693
665
  */
694
666
  const functionsDeleteDeployment = async ({ functionId, deploymentId, parseOutput = true, sdk = undefined}) => {
695
667
  let client = !sdk ? await sdkForProject() : sdk;
696
-
697
668
  let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
698
669
  let payload = {};
699
670
 
700
-
701
671
  let response = undefined;
702
-
672
+
703
673
  response = await client.call('delete', apiPath, {
704
674
  'content-type': 'application/json',
705
675
  }, payload);
706
676
 
707
-
708
677
  if (parseOutput) {
709
678
  parse(response)
710
679
  success()
@@ -727,18 +696,15 @@ const functionsDeleteDeployment = async ({ functionId, deploymentId, parseOutput
727
696
  */
728
697
  const functionsCreateBuild = async ({ functionId, deploymentId, buildId, parseOutput = true, sdk = undefined}) => {
729
698
  let client = !sdk ? await sdkForProject() : sdk;
730
-
731
699
  let apiPath = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
732
700
  let payload = {};
733
701
 
734
-
735
702
  let response = undefined;
736
-
703
+
737
704
  response = await client.call('post', apiPath, {
738
705
  'content-type': 'application/json',
739
706
  }, payload);
740
707
 
741
-
742
708
  if (parseOutput) {
743
709
  parse(response)
744
710
  success()
@@ -753,7 +719,7 @@ const functionsCreateBuild = async ({ functionId, deploymentId, buildId, parseOu
753
719
  * @property {string} deploymentId Deployment ID.
754
720
  * @property {boolean} parseOutput
755
721
  * @property {libClient | undefined} sdk
756
- * @property {string} destination
722
+ * @property {string} destination
757
723
  */
758
724
 
759
725
  /**
@@ -761,23 +727,21 @@ const functionsCreateBuild = async ({ functionId, deploymentId, buildId, parseOu
761
727
  */
762
728
  const functionsDownloadDeployment = async ({ functionId, deploymentId, parseOutput = true, sdk = undefined, destination}) => {
763
729
  let client = !sdk ? await sdkForProject() : sdk;
764
-
765
730
  let apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
766
731
  let payload = {};
767
-
768
732
  payload['project'] = localConfig.getProject().projectId
769
733
  payload['key'] = globalConfig.getKey();
770
734
  const queryParams = new URLSearchParams(payload);
771
735
  apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
772
736
 
773
737
  let response = undefined;
774
-
738
+
775
739
  response = await client.call('get', apiPath, {
776
740
  'content-type': 'application/json',
777
741
  }, payload, 'arraybuffer');
778
742
 
779
743
  fs.writeFileSync(destination, response);
780
-
744
+
781
745
  if (parseOutput) {
782
746
  parse(response)
783
747
  success()
@@ -800,7 +764,6 @@ const functionsDownloadDeployment = async ({ functionId, deploymentId, parseOutp
800
764
  */
801
765
  const functionsListExecutions = async ({ functionId, queries, search, parseOutput = true, sdk = undefined}) => {
802
766
  let client = !sdk ? await sdkForProject() : sdk;
803
-
804
767
  let apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
805
768
  let payload = {};
806
769
  if (typeof queries !== 'undefined') {
@@ -810,14 +773,12 @@ const functionsListExecutions = async ({ functionId, queries, search, parseOutpu
810
773
  payload['search'] = search;
811
774
  }
812
775
 
813
-
814
776
  let response = undefined;
815
-
777
+
816
778
  response = await client.call('get', apiPath, {
817
779
  'content-type': 'application/json',
818
780
  }, payload);
819
781
 
820
-
821
782
  if (parseOutput) {
822
783
  parse(response)
823
784
  success()
@@ -832,7 +793,7 @@ const functionsListExecutions = async ({ functionId, queries, search, parseOutpu
832
793
  * @property {string} body HTTP body of execution. Default value is empty string.
833
794
  * @property {boolean} async Execute code in the background. Default value is false.
834
795
  * @property {string} xpath HTTP path of execution. Path can include query params. Default value is /
835
- * @property {string} method HTTP method of execution. Default value is GET.
796
+ * @property {ExecutionMethod} method HTTP method of execution. Default value is GET.
836
797
  * @property {object} headers HTTP headers of execution. Defaults to empty.
837
798
  * @property {boolean} parseOutput
838
799
  * @property {libClient | undefined} sdk
@@ -843,7 +804,6 @@ const functionsListExecutions = async ({ functionId, queries, search, parseOutpu
843
804
  */
844
805
  const functionsCreateExecution = async ({ functionId, body, async, xpath, method, headers, parseOutput = true, sdk = undefined}) => {
845
806
  let client = !sdk ? await sdkForProject() : sdk;
846
-
847
807
  let apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
848
808
  let payload = {};
849
809
  if (typeof body !== 'undefined') {
@@ -862,14 +822,12 @@ const functionsCreateExecution = async ({ functionId, body, async, xpath, method
862
822
  payload['headers'] = JSON.parse(headers);
863
823
  }
864
824
 
865
-
866
825
  let response = undefined;
867
-
826
+
868
827
  response = await client.call('post', apiPath, {
869
828
  'content-type': 'application/json',
870
829
  }, payload);
871
830
 
872
-
873
831
  if (parseOutput) {
874
832
  parse(response)
875
833
  success()
@@ -891,18 +849,15 @@ const functionsCreateExecution = async ({ functionId, body, async, xpath, method
891
849
  */
892
850
  const functionsGetExecution = async ({ functionId, executionId, parseOutput = true, sdk = undefined}) => {
893
851
  let client = !sdk ? await sdkForProject() : sdk;
894
-
895
852
  let apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
896
853
  let payload = {};
897
854
 
898
-
899
855
  let response = undefined;
900
-
856
+
901
857
  response = await client.call('get', apiPath, {
902
858
  'content-type': 'application/json',
903
859
  }, payload);
904
860
 
905
-
906
861
  if (parseOutput) {
907
862
  parse(response)
908
863
  success()
@@ -914,7 +869,7 @@ const functionsGetExecution = async ({ functionId, executionId, parseOutput = tr
914
869
  /**
915
870
  * @typedef {Object} FunctionsGetFunctionUsageRequestParams
916
871
  * @property {string} functionId Function ID.
917
- * @property {string} range Date range.
872
+ * @property {FunctionUsageRange} range Date range.
918
873
  * @property {boolean} parseOutput
919
874
  * @property {libClient | undefined} sdk
920
875
  */
@@ -924,21 +879,18 @@ const functionsGetExecution = async ({ functionId, executionId, parseOutput = tr
924
879
  */
925
880
  const functionsGetFunctionUsage = async ({ functionId, range, parseOutput = true, sdk = undefined}) => {
926
881
  let client = !sdk ? await sdkForProject() : sdk;
927
-
928
882
  let apiPath = '/functions/{functionId}/usage'.replace('{functionId}', functionId);
929
883
  let payload = {};
930
884
  if (typeof range !== 'undefined') {
931
885
  payload['range'] = range;
932
886
  }
933
887
 
934
-
935
888
  let response = undefined;
936
-
889
+
937
890
  response = await client.call('get', apiPath, {
938
891
  'content-type': 'application/json',
939
892
  }, payload);
940
893
 
941
-
942
894
  if (parseOutput) {
943
895
  parse(response)
944
896
  success()
@@ -959,18 +911,15 @@ const functionsGetFunctionUsage = async ({ functionId, range, parseOutput = true
959
911
  */
960
912
  const functionsListVariables = async ({ functionId, parseOutput = true, sdk = undefined}) => {
961
913
  let client = !sdk ? await sdkForProject() : sdk;
962
-
963
914
  let apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
964
915
  let payload = {};
965
916
 
966
-
967
917
  let response = undefined;
968
-
918
+
969
919
  response = await client.call('get', apiPath, {
970
920
  'content-type': 'application/json',
971
921
  }, payload);
972
922
 
973
-
974
923
  if (parseOutput) {
975
924
  parse(response)
976
925
  success()
@@ -993,7 +942,6 @@ const functionsListVariables = async ({ functionId, parseOutput = true, sdk = un
993
942
  */
994
943
  const functionsCreateVariable = async ({ functionId, key, value, parseOutput = true, sdk = undefined}) => {
995
944
  let client = !sdk ? await sdkForProject() : sdk;
996
-
997
945
  let apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
998
946
  let payload = {};
999
947
  if (typeof key !== 'undefined') {
@@ -1003,14 +951,12 @@ const functionsCreateVariable = async ({ functionId, key, value, parseOutput = t
1003
951
  payload['value'] = value;
1004
952
  }
1005
953
 
1006
-
1007
954
  let response = undefined;
1008
-
955
+
1009
956
  response = await client.call('post', apiPath, {
1010
957
  'content-type': 'application/json',
1011
958
  }, payload);
1012
959
 
1013
-
1014
960
  if (parseOutput) {
1015
961
  parse(response)
1016
962
  success()
@@ -1032,18 +978,15 @@ const functionsCreateVariable = async ({ functionId, key, value, parseOutput = t
1032
978
  */
1033
979
  const functionsGetVariable = async ({ functionId, variableId, parseOutput = true, sdk = undefined}) => {
1034
980
  let client = !sdk ? await sdkForProject() : sdk;
1035
-
1036
981
  let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
1037
982
  let payload = {};
1038
983
 
1039
-
1040
984
  let response = undefined;
1041
-
985
+
1042
986
  response = await client.call('get', apiPath, {
1043
987
  'content-type': 'application/json',
1044
988
  }, payload);
1045
989
 
1046
-
1047
990
  if (parseOutput) {
1048
991
  parse(response)
1049
992
  success()
@@ -1067,7 +1010,6 @@ const functionsGetVariable = async ({ functionId, variableId, parseOutput = true
1067
1010
  */
1068
1011
  const functionsUpdateVariable = async ({ functionId, variableId, key, value, parseOutput = true, sdk = undefined}) => {
1069
1012
  let client = !sdk ? await sdkForProject() : sdk;
1070
-
1071
1013
  let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
1072
1014
  let payload = {};
1073
1015
  if (typeof key !== 'undefined') {
@@ -1077,14 +1019,12 @@ const functionsUpdateVariable = async ({ functionId, variableId, key, value, par
1077
1019
  payload['value'] = value;
1078
1020
  }
1079
1021
 
1080
-
1081
1022
  let response = undefined;
1082
-
1023
+
1083
1024
  response = await client.call('put', apiPath, {
1084
1025
  'content-type': 'application/json',
1085
1026
  }, payload);
1086
1027
 
1087
-
1088
1028
  if (parseOutput) {
1089
1029
  parse(response)
1090
1030
  success()
@@ -1106,18 +1046,15 @@ const functionsUpdateVariable = async ({ functionId, variableId, key, value, par
1106
1046
  */
1107
1047
  const functionsDeleteVariable = async ({ functionId, variableId, parseOutput = true, sdk = undefined}) => {
1108
1048
  let client = !sdk ? await sdkForProject() : sdk;
1109
-
1110
1049
  let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
1111
1050
  let payload = {};
1112
1051
 
1113
-
1114
1052
  let response = undefined;
1115
-
1053
+
1116
1054
  response = await client.call('delete', apiPath, {
1117
1055
  'content-type': 'application/json',
1118
1056
  }, payload);
1119
1057
 
1120
-
1121
1058
  if (parseOutput) {
1122
1059
  parse(response)
1123
1060
  success()
@@ -1126,7 +1063,6 @@ const functionsDeleteVariable = async ({ functionId, variableId, parseOutput = t
1126
1063
  return response;
1127
1064
  }
1128
1065
 
1129
-
1130
1066
  functions
1131
1067
  .command(`list`)
1132
1068
  .description(`Get a list of all the project's functions. You can use the query params to filter your results.`)
@@ -1328,30 +1264,29 @@ functions
1328
1264
  .requiredOption(`--variableId <variableId>`, `Variable unique ID.`)
1329
1265
  .action(actionRunner(functionsDeleteVariable))
1330
1266
 
1331
-
1332
1267
  module.exports = {
1333
1268
  functions,
1334
- functionsList,
1335
- functionsCreate,
1336
- functionsListRuntimes,
1337
- functionsGetUsage,
1338
- functionsGet,
1339
- functionsUpdate,
1340
- functionsDelete,
1341
- functionsListDeployments,
1342
- functionsCreateDeployment,
1343
- functionsGetDeployment,
1344
- functionsUpdateDeployment,
1345
- functionsDeleteDeployment,
1346
- functionsCreateBuild,
1347
- functionsDownloadDeployment,
1348
- functionsListExecutions,
1349
- functionsCreateExecution,
1350
- functionsGetExecution,
1351
- functionsGetFunctionUsage,
1352
- functionsListVariables,
1353
- functionsCreateVariable,
1354
- functionsGetVariable,
1355
- functionsUpdateVariable,
1356
- functionsDeleteVariable
1269
+ functionsList,
1270
+ functionsCreate,
1271
+ functionsListRuntimes,
1272
+ functionsGetUsage,
1273
+ functionsGet,
1274
+ functionsUpdate,
1275
+ functionsDelete,
1276
+ functionsListDeployments,
1277
+ functionsCreateDeployment,
1278
+ functionsGetDeployment,
1279
+ functionsUpdateDeployment,
1280
+ functionsDeleteDeployment,
1281
+ functionsCreateBuild,
1282
+ functionsDownloadDeployment,
1283
+ functionsListExecutions,
1284
+ functionsCreateExecution,
1285
+ functionsGetExecution,
1286
+ functionsGetFunctionUsage,
1287
+ functionsListVariables,
1288
+ functionsCreateVariable,
1289
+ functionsGetVariable,
1290
+ functionsUpdateVariable,
1291
+ functionsDeleteVariable
1357
1292
  };
@@ -118,7 +118,6 @@ const client = new Command("client")
118
118
  success()
119
119
  }));
120
120
 
121
-
122
121
  module.exports = {
123
122
  login,
124
123
  logout,