appwrite-cli 8.2.2 → 9.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 (529) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +5 -5
  3. package/docs/examples/account/create-anonymous-session.md +1 -1
  4. package/docs/examples/account/create-email-password-session.md +3 -3
  5. package/docs/examples/account/create-email-token.md +3 -4
  6. package/docs/examples/account/create-jwt.md +1 -0
  7. package/docs/examples/account/create-magic-url-token.md +3 -0
  8. package/docs/examples/account/create-mfa-authenticator.md +2 -2
  9. package/docs/examples/account/create-mfa-challenge.md +2 -2
  10. package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
  11. package/docs/examples/account/create-o-auth-2-session.md +2 -0
  12. package/docs/examples/account/create-o-auth-2-token.md +2 -0
  13. package/docs/examples/account/create-phone-token.md +3 -3
  14. package/docs/examples/account/create-phone-verification.md +1 -1
  15. package/docs/examples/account/create-push-target.md +3 -4
  16. package/docs/examples/account/create-recovery.md +3 -3
  17. package/docs/examples/account/create-session.md +3 -3
  18. package/docs/examples/account/create-verification.md +2 -2
  19. package/docs/examples/account/create.md +3 -4
  20. package/docs/examples/account/delete-identity.md +2 -2
  21. package/docs/examples/account/delete-mfa-authenticator.md +2 -2
  22. package/docs/examples/account/delete-push-target.md +2 -2
  23. package/docs/examples/account/delete-session.md +2 -2
  24. package/docs/examples/account/delete-sessions.md +1 -1
  25. package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
  26. package/docs/examples/account/get-prefs.md +1 -1
  27. package/docs/examples/account/get-session.md +2 -2
  28. package/docs/examples/account/list-identities.md +1 -2
  29. package/docs/examples/account/list-logs.md +1 -2
  30. package/docs/examples/account/list-mfa-factors.md +1 -1
  31. package/docs/examples/account/list-sessions.md +1 -1
  32. package/docs/examples/account/update-email.md +3 -3
  33. package/docs/examples/account/update-magic-url-session.md +3 -0
  34. package/docs/examples/account/update-mfa-authenticator.md +3 -3
  35. package/docs/examples/account/update-mfa-challenge.md +3 -3
  36. package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
  37. package/docs/examples/account/update-mfa.md +2 -0
  38. package/docs/examples/account/update-name.md +2 -2
  39. package/docs/examples/account/update-password.md +2 -3
  40. package/docs/examples/account/update-phone-session.md +3 -3
  41. package/docs/examples/account/update-phone-verification.md +3 -3
  42. package/docs/examples/account/update-phone.md +3 -3
  43. package/docs/examples/account/update-prefs.md +2 -2
  44. package/docs/examples/account/update-push-target.md +3 -3
  45. package/docs/examples/account/update-recovery.md +4 -4
  46. package/docs/examples/account/update-session.md +2 -2
  47. package/docs/examples/account/update-status.md +1 -1
  48. package/docs/examples/account/update-verification.md +3 -3
  49. package/docs/examples/avatars/get-browser.md +2 -5
  50. package/docs/examples/avatars/get-credit-card.md +2 -5
  51. package/docs/examples/avatars/get-favicon.md +2 -2
  52. package/docs/examples/avatars/get-flag.md +2 -5
  53. package/docs/examples/avatars/get-image.md +2 -4
  54. package/docs/examples/avatars/get-initials.md +1 -5
  55. package/docs/examples/avatars/get-qr.md +2 -0
  56. package/docs/examples/console/get-resource.md +3 -3
  57. package/docs/examples/databases/create-boolean-attribute.md +5 -7
  58. package/docs/examples/databases/create-collection.md +4 -7
  59. package/docs/examples/databases/create-datetime-attribute.md +5 -7
  60. package/docs/examples/databases/create-document.md +5 -6
  61. package/docs/examples/databases/create-documents.md +4 -4
  62. package/docs/examples/databases/create-email-attribute.md +5 -7
  63. package/docs/examples/databases/create-enum-attribute.md +6 -8
  64. package/docs/examples/databases/create-float-attribute.md +5 -9
  65. package/docs/examples/databases/create-index.md +6 -8
  66. package/docs/examples/databases/create-integer-attribute.md +5 -9
  67. package/docs/examples/databases/create-ip-attribute.md +5 -7
  68. package/docs/examples/databases/create-relationship-attribute.md +5 -9
  69. package/docs/examples/databases/create-string-attribute.md +6 -9
  70. package/docs/examples/databases/create-url-attribute.md +5 -7
  71. package/docs/examples/databases/create.md +2 -3
  72. package/docs/examples/databases/decrement-document-attribute.md +5 -0
  73. package/docs/examples/databases/delete-attribute.md +4 -4
  74. package/docs/examples/databases/delete-collection.md +3 -3
  75. package/docs/examples/databases/delete-document.md +4 -4
  76. package/docs/examples/databases/delete-documents.md +3 -4
  77. package/docs/examples/databases/delete-index.md +4 -4
  78. package/docs/examples/databases/delete.md +1 -1
  79. package/docs/examples/databases/get-attribute.md +4 -4
  80. package/docs/examples/databases/get-collection-usage.md +3 -4
  81. package/docs/examples/databases/get-collection.md +3 -3
  82. package/docs/examples/databases/get-document.md +4 -5
  83. package/docs/examples/databases/get-index.md +4 -4
  84. package/docs/examples/databases/get-usage.md +2 -2
  85. package/docs/examples/databases/get.md +1 -1
  86. package/docs/examples/databases/increment-document-attribute.md +5 -0
  87. package/docs/examples/databases/list-attributes.md +3 -4
  88. package/docs/examples/databases/list-collection-logs.md +3 -4
  89. package/docs/examples/databases/list-collections.md +2 -4
  90. package/docs/examples/databases/list-document-logs.md +4 -5
  91. package/docs/examples/databases/list-documents.md +3 -4
  92. package/docs/examples/databases/list-indexes.md +3 -4
  93. package/docs/examples/databases/list-logs.md +2 -3
  94. package/docs/examples/databases/list-usage.md +1 -0
  95. package/docs/examples/databases/list.md +1 -3
  96. package/docs/examples/databases/update-boolean-attribute.md +6 -7
  97. package/docs/examples/databases/update-collection.md +4 -7
  98. package/docs/examples/databases/update-datetime-attribute.md +6 -7
  99. package/docs/examples/databases/update-document.md +4 -6
  100. package/docs/examples/databases/update-documents.md +3 -5
  101. package/docs/examples/databases/update-email-attribute.md +6 -7
  102. package/docs/examples/databases/update-enum-attribute.md +7 -8
  103. package/docs/examples/databases/update-float-attribute.md +6 -9
  104. package/docs/examples/databases/update-integer-attribute.md +6 -9
  105. package/docs/examples/databases/update-ip-attribute.md +6 -7
  106. package/docs/examples/databases/update-relationship-attribute.md +4 -6
  107. package/docs/examples/databases/update-string-attribute.md +6 -8
  108. package/docs/examples/databases/update-url-attribute.md +6 -7
  109. package/docs/examples/databases/update.md +2 -3
  110. package/docs/examples/databases/upsert-document.md +5 -6
  111. package/docs/examples/databases/upsert-documents.md +4 -4
  112. package/docs/examples/functions/create-deployment.md +4 -6
  113. package/docs/examples/functions/create-duplicate-deployment.md +3 -4
  114. package/docs/examples/functions/create-execution.md +2 -8
  115. package/docs/examples/functions/create-template-deployment.md +6 -7
  116. package/docs/examples/functions/create-variable.md +4 -5
  117. package/docs/examples/functions/create-vcs-deployment.md +4 -5
  118. package/docs/examples/functions/create.md +3 -18
  119. package/docs/examples/functions/delete-deployment.md +3 -3
  120. package/docs/examples/functions/delete-execution.md +3 -3
  121. package/docs/examples/functions/delete-variable.md +3 -3
  122. package/docs/examples/functions/delete.md +1 -1
  123. package/docs/examples/functions/get-deployment-download.md +3 -4
  124. package/docs/examples/functions/get-deployment.md +3 -3
  125. package/docs/examples/functions/get-execution.md +3 -3
  126. package/docs/examples/functions/get-template.md +2 -2
  127. package/docs/examples/functions/get-usage.md +2 -3
  128. package/docs/examples/functions/get-variable.md +3 -3
  129. package/docs/examples/functions/get.md +1 -1
  130. package/docs/examples/functions/list-deployments.md +2 -4
  131. package/docs/examples/functions/list-executions.md +2 -3
  132. package/docs/examples/functions/list-runtimes.md +1 -1
  133. package/docs/examples/functions/list-specifications.md +1 -1
  134. package/docs/examples/functions/list-templates.md +1 -5
  135. package/docs/examples/functions/list-usage.md +1 -2
  136. package/docs/examples/functions/list-variables.md +2 -2
  137. package/docs/examples/functions/list.md +1 -3
  138. package/docs/examples/functions/update-deployment-status.md +3 -3
  139. package/docs/examples/functions/update-function-deployment.md +3 -3
  140. package/docs/examples/functions/update-variable.md +4 -6
  141. package/docs/examples/functions/update.md +2 -18
  142. package/docs/examples/graphql/mutation.md +1 -1
  143. package/docs/examples/graphql/query.md +1 -1
  144. package/docs/examples/health/get-antivirus.md +1 -1
  145. package/docs/examples/health/get-cache.md +1 -1
  146. package/docs/examples/health/get-certificate.md +1 -2
  147. package/docs/examples/health/get-db.md +1 -0
  148. package/docs/examples/health/get-failed-jobs.md +2 -3
  149. package/docs/examples/health/get-pub-sub.md +1 -1
  150. package/docs/examples/health/get-queue-builds.md +1 -2
  151. package/docs/examples/health/get-queue-certificates.md +1 -2
  152. package/docs/examples/health/get-queue-databases.md +1 -3
  153. package/docs/examples/health/get-queue-deletes.md +1 -2
  154. package/docs/examples/health/get-queue-functions.md +1 -2
  155. package/docs/examples/health/get-queue-logs.md +1 -2
  156. package/docs/examples/health/get-queue-mails.md +1 -2
  157. package/docs/examples/health/get-queue-messaging.md +1 -2
  158. package/docs/examples/health/get-queue-migrations.md +1 -2
  159. package/docs/examples/health/get-queue-stats-resources.md +1 -2
  160. package/docs/examples/health/get-queue-usage.md +1 -2
  161. package/docs/examples/health/get-queue-webhooks.md +1 -2
  162. package/docs/examples/health/get-storage-local.md +1 -1
  163. package/docs/examples/health/get-storage.md +1 -1
  164. package/docs/examples/health/get-time.md +1 -1
  165. package/docs/examples/locale/list-codes.md +1 -1
  166. package/docs/examples/locale/list-continents.md +1 -1
  167. package/docs/examples/locale/list-countries-eu.md +1 -0
  168. package/docs/examples/locale/list-countries-phones.md +1 -1
  169. package/docs/examples/locale/list-countries.md +1 -1
  170. package/docs/examples/locale/list-currencies.md +1 -1
  171. package/docs/examples/locale/list-languages.md +1 -1
  172. package/docs/examples/messaging/create-apns-provider.md +3 -9
  173. package/docs/examples/messaging/create-email.md +4 -13
  174. package/docs/examples/messaging/create-fcm-provider.md +3 -5
  175. package/docs/examples/messaging/create-mailgun-provider.md +3 -11
  176. package/docs/examples/messaging/create-msg-91-provider.md +3 -0
  177. package/docs/examples/messaging/create-push.md +2 -20
  178. package/docs/examples/messaging/create-sendgrid-provider.md +3 -9
  179. package/docs/examples/messaging/create-sms.md +3 -8
  180. package/docs/examples/messaging/create-smtp-provider.md +4 -15
  181. package/docs/examples/messaging/create-subscriber.md +4 -4
  182. package/docs/examples/messaging/create-telesign-provider.md +3 -7
  183. package/docs/examples/messaging/create-textmagic-provider.md +3 -7
  184. package/docs/examples/messaging/create-topic.md +3 -4
  185. package/docs/examples/messaging/create-twilio-provider.md +3 -7
  186. package/docs/examples/messaging/create-vonage-provider.md +3 -7
  187. package/docs/examples/messaging/delete-provider.md +2 -2
  188. package/docs/examples/messaging/delete-subscriber.md +3 -3
  189. package/docs/examples/messaging/delete-topic.md +2 -2
  190. package/docs/examples/messaging/delete.md +1 -1
  191. package/docs/examples/messaging/get-message.md +2 -2
  192. package/docs/examples/messaging/get-provider.md +2 -2
  193. package/docs/examples/messaging/get-subscriber.md +3 -3
  194. package/docs/examples/messaging/get-topic.md +2 -2
  195. package/docs/examples/messaging/list-message-logs.md +2 -3
  196. package/docs/examples/messaging/list-messages.md +1 -3
  197. package/docs/examples/messaging/list-provider-logs.md +2 -3
  198. package/docs/examples/messaging/list-providers.md +1 -3
  199. package/docs/examples/messaging/list-subscriber-logs.md +2 -3
  200. package/docs/examples/messaging/list-subscribers.md +2 -4
  201. package/docs/examples/messaging/list-targets.md +2 -3
  202. package/docs/examples/messaging/list-topic-logs.md +2 -3
  203. package/docs/examples/messaging/list-topics.md +1 -3
  204. package/docs/examples/messaging/update-apns-provider.md +2 -9
  205. package/docs/examples/messaging/update-email.md +2 -13
  206. package/docs/examples/messaging/update-fcm-provider.md +2 -5
  207. package/docs/examples/messaging/update-mailgun-provider.md +2 -11
  208. package/docs/examples/messaging/update-msg-91-provider.md +2 -0
  209. package/docs/examples/messaging/update-push.md +2 -20
  210. package/docs/examples/messaging/update-sendgrid-provider.md +2 -9
  211. package/docs/examples/messaging/update-sms.md +2 -8
  212. package/docs/examples/messaging/update-smtp-provider.md +2 -15
  213. package/docs/examples/messaging/update-telesign-provider.md +2 -7
  214. package/docs/examples/messaging/update-textmagic-provider.md +2 -7
  215. package/docs/examples/messaging/update-topic.md +2 -4
  216. package/docs/examples/messaging/update-twilio-provider.md +2 -7
  217. package/docs/examples/messaging/update-vonage-provider.md +2 -7
  218. package/docs/examples/migrations/create-appwrite-migration.md +5 -5
  219. package/docs/examples/migrations/create-csv-migration.md +4 -4
  220. package/docs/examples/migrations/create-firebase-migration.md +3 -3
  221. package/docs/examples/migrations/create-n-host-migration.md +8 -9
  222. package/docs/examples/migrations/create-supabase-migration.md +7 -8
  223. package/docs/examples/migrations/delete.md +1 -1
  224. package/docs/examples/migrations/get-appwrite-report.md +5 -5
  225. package/docs/examples/migrations/get-firebase-report.md +3 -3
  226. package/docs/examples/migrations/get-n-host-report.md +8 -9
  227. package/docs/examples/migrations/get-supabase-report.md +7 -8
  228. package/docs/examples/migrations/get.md +1 -1
  229. package/docs/examples/migrations/list.md +1 -3
  230. package/docs/examples/migrations/retry.md +1 -1
  231. package/docs/examples/project/create-variable.md +3 -4
  232. package/docs/examples/project/delete-variable.md +2 -2
  233. package/docs/examples/project/get-usage.md +3 -4
  234. package/docs/examples/project/get-variable.md +2 -2
  235. package/docs/examples/project/list-variables.md +1 -1
  236. package/docs/examples/project/update-variable.md +3 -5
  237. package/docs/examples/projects/create-dev-key.md +4 -4
  238. package/docs/examples/projects/create-jwt.md +3 -0
  239. package/docs/examples/projects/create-key.md +4 -5
  240. package/docs/examples/projects/create-platform.md +4 -7
  241. package/docs/examples/projects/create-smtp-test.md +6 -11
  242. package/docs/examples/projects/create-webhook.md +6 -9
  243. package/docs/examples/projects/create.md +3 -13
  244. package/docs/examples/projects/delete-dev-key.md +3 -3
  245. package/docs/examples/projects/delete-email-template.md +4 -4
  246. package/docs/examples/projects/delete-key.md +3 -3
  247. package/docs/examples/projects/delete-platform.md +3 -3
  248. package/docs/examples/projects/delete-sms-template.md +4 -4
  249. package/docs/examples/projects/delete-webhook.md +3 -3
  250. package/docs/examples/projects/delete.md +1 -1
  251. package/docs/examples/projects/get-dev-key.md +3 -3
  252. package/docs/examples/projects/get-email-template.md +4 -4
  253. package/docs/examples/projects/get-key.md +3 -3
  254. package/docs/examples/projects/get-platform.md +3 -3
  255. package/docs/examples/projects/get-sms-template.md +4 -4
  256. package/docs/examples/projects/get-webhook.md +3 -3
  257. package/docs/examples/projects/get.md +1 -1
  258. package/docs/examples/projects/list-dev-keys.md +2 -3
  259. package/docs/examples/projects/list-keys.md +2 -2
  260. package/docs/examples/projects/list-platforms.md +2 -2
  261. package/docs/examples/projects/list-webhooks.md +2 -2
  262. package/docs/examples/projects/list.md +1 -3
  263. package/docs/examples/projects/update-api-status-all.md +3 -3
  264. package/docs/examples/projects/update-api-status.md +4 -4
  265. package/docs/examples/projects/update-auth-duration.md +3 -3
  266. package/docs/examples/projects/update-auth-limit.md +3 -3
  267. package/docs/examples/projects/update-auth-password-dictionary.md +3 -3
  268. package/docs/examples/projects/update-auth-password-history.md +3 -3
  269. package/docs/examples/projects/update-auth-sessions-limit.md +3 -3
  270. package/docs/examples/projects/update-auth-status.md +4 -4
  271. package/docs/examples/projects/update-dev-key.md +5 -5
  272. package/docs/examples/projects/update-email-template.md +6 -9
  273. package/docs/examples/projects/update-key.md +5 -6
  274. package/docs/examples/projects/update-memberships-privacy.md +5 -5
  275. package/docs/examples/projects/update-mock-numbers.md +3 -3
  276. package/docs/examples/projects/update-o-auth-2.md +3 -0
  277. package/docs/examples/projects/update-personal-data-check.md +3 -3
  278. package/docs/examples/projects/update-platform.md +4 -7
  279. package/docs/examples/projects/update-service-status-all.md +3 -3
  280. package/docs/examples/projects/update-service-status.md +4 -4
  281. package/docs/examples/projects/update-session-alerts.md +3 -3
  282. package/docs/examples/projects/update-session-invalidation.md +3 -0
  283. package/docs/examples/projects/update-sms-template.md +5 -5
  284. package/docs/examples/projects/update-smtp.md +3 -11
  285. package/docs/examples/projects/update-team.md +3 -3
  286. package/docs/examples/projects/update-webhook-signature.md +3 -3
  287. package/docs/examples/projects/update-webhook.md +7 -10
  288. package/docs/examples/projects/update.md +2 -11
  289. package/docs/examples/proxy/create-api-rule.md +2 -0
  290. package/docs/examples/proxy/create-function-rule.md +3 -4
  291. package/docs/examples/proxy/create-redirect-rule.md +6 -6
  292. package/docs/examples/proxy/create-site-rule.md +3 -4
  293. package/docs/examples/proxy/delete-rule.md +2 -2
  294. package/docs/examples/proxy/get-rule.md +2 -2
  295. package/docs/examples/proxy/list-rules.md +1 -3
  296. package/docs/examples/proxy/update-rule-verification.md +2 -2
  297. package/docs/examples/sites/create-deployment.md +4 -7
  298. package/docs/examples/sites/create-duplicate-deployment.md +3 -3
  299. package/docs/examples/sites/create-template-deployment.md +6 -7
  300. package/docs/examples/sites/create-variable.md +4 -5
  301. package/docs/examples/sites/create-vcs-deployment.md +4 -5
  302. package/docs/examples/sites/create.md +4 -18
  303. package/docs/examples/sites/delete-deployment.md +3 -3
  304. package/docs/examples/sites/delete-log.md +3 -3
  305. package/docs/examples/sites/delete-variable.md +3 -3
  306. package/docs/examples/sites/delete.md +1 -1
  307. package/docs/examples/sites/get-deployment-download.md +3 -4
  308. package/docs/examples/sites/get-deployment.md +3 -3
  309. package/docs/examples/sites/get-log.md +3 -3
  310. package/docs/examples/sites/get-template.md +2 -2
  311. package/docs/examples/sites/get-usage.md +2 -3
  312. package/docs/examples/sites/get-variable.md +3 -3
  313. package/docs/examples/sites/get.md +1 -1
  314. package/docs/examples/sites/list-deployments.md +2 -4
  315. package/docs/examples/sites/list-frameworks.md +1 -1
  316. package/docs/examples/sites/list-logs.md +2 -3
  317. package/docs/examples/sites/list-specifications.md +1 -1
  318. package/docs/examples/sites/list-templates.md +1 -5
  319. package/docs/examples/sites/list-usage.md +1 -2
  320. package/docs/examples/sites/list-variables.md +2 -2
  321. package/docs/examples/sites/list.md +1 -3
  322. package/docs/examples/sites/update-deployment-status.md +3 -3
  323. package/docs/examples/sites/update-site-deployment.md +3 -3
  324. package/docs/examples/sites/update-variable.md +4 -6
  325. package/docs/examples/sites/update.md +3 -18
  326. package/docs/examples/storage/create-bucket.md +3 -11
  327. package/docs/examples/storage/create-file.md +4 -5
  328. package/docs/examples/storage/delete-bucket.md +2 -2
  329. package/docs/examples/storage/delete-file.md +3 -3
  330. package/docs/examples/storage/get-bucket-usage.md +2 -3
  331. package/docs/examples/storage/get-bucket.md +2 -2
  332. package/docs/examples/storage/get-file-download.md +3 -4
  333. package/docs/examples/storage/get-file-preview.md +3 -15
  334. package/docs/examples/storage/get-file-view.md +3 -4
  335. package/docs/examples/storage/get-file.md +3 -3
  336. package/docs/examples/storage/get-usage.md +1 -2
  337. package/docs/examples/storage/list-buckets.md +1 -3
  338. package/docs/examples/storage/list-files.md +2 -4
  339. package/docs/examples/storage/update-bucket.md +3 -11
  340. package/docs/examples/storage/update-file.md +3 -5
  341. package/docs/examples/tablesdb/create-boolean-column.md +5 -0
  342. package/docs/examples/tablesdb/create-datetime-column.md +5 -0
  343. package/docs/examples/tablesdb/create-email-column.md +5 -0
  344. package/docs/examples/tablesdb/create-enum-column.md +6 -0
  345. package/docs/examples/tablesdb/create-float-column.md +5 -0
  346. package/docs/examples/tablesdb/create-index.md +6 -0
  347. package/docs/examples/tablesdb/create-integer-column.md +5 -0
  348. package/docs/examples/tablesdb/create-ip-column.md +5 -0
  349. package/docs/examples/tablesdb/create-relationship-column.md +5 -0
  350. package/docs/examples/tablesdb/create-row.md +5 -0
  351. package/docs/examples/tablesdb/create-rows.md +4 -0
  352. package/docs/examples/tablesdb/create-string-column.md +6 -0
  353. package/docs/examples/tablesdb/create-table.md +4 -0
  354. package/docs/examples/tablesdb/create-url-column.md +5 -0
  355. package/docs/examples/tablesdb/create.md +3 -0
  356. package/docs/examples/tablesdb/decrement-row-column.md +5 -0
  357. package/docs/examples/tablesdb/delete-column.md +4 -0
  358. package/docs/examples/tablesdb/delete-index.md +4 -0
  359. package/docs/examples/tablesdb/delete-row.md +4 -0
  360. package/docs/examples/tablesdb/delete-rows.md +3 -0
  361. package/docs/examples/tablesdb/delete-table.md +3 -0
  362. package/docs/examples/tablesdb/delete.md +2 -0
  363. package/docs/examples/tablesdb/get-column.md +4 -0
  364. package/docs/examples/tablesdb/get-index.md +4 -0
  365. package/docs/examples/tablesdb/get-row.md +4 -0
  366. package/docs/examples/tablesdb/get-table-usage.md +3 -0
  367. package/docs/examples/tablesdb/get-table.md +3 -0
  368. package/docs/examples/tablesdb/get-usage.md +2 -0
  369. package/docs/examples/tablesdb/get.md +2 -0
  370. package/docs/examples/tablesdb/increment-row-column.md +5 -0
  371. package/docs/examples/tablesdb/list-columns.md +3 -0
  372. package/docs/examples/tablesdb/list-indexes.md +3 -0
  373. package/docs/examples/tablesdb/list-row-logs.md +4 -0
  374. package/docs/examples/tablesdb/list-rows.md +3 -0
  375. package/docs/examples/tablesdb/list-table-logs.md +3 -0
  376. package/docs/examples/tablesdb/list-tables.md +2 -0
  377. package/docs/examples/tablesdb/list-usage.md +1 -0
  378. package/docs/examples/tablesdb/list.md +1 -0
  379. package/docs/examples/tablesdb/update-boolean-column.md +6 -0
  380. package/docs/examples/tablesdb/update-datetime-column.md +6 -0
  381. package/docs/examples/tablesdb/update-email-column.md +6 -0
  382. package/docs/examples/tablesdb/update-enum-column.md +7 -0
  383. package/docs/examples/tablesdb/update-float-column.md +6 -0
  384. package/docs/examples/tablesdb/update-integer-column.md +6 -0
  385. package/docs/examples/tablesdb/update-ip-column.md +6 -0
  386. package/docs/examples/tablesdb/update-relationship-column.md +4 -0
  387. package/docs/examples/tablesdb/update-row.md +4 -0
  388. package/docs/examples/tablesdb/update-rows.md +3 -0
  389. package/docs/examples/tablesdb/update-string-column.md +6 -0
  390. package/docs/examples/tablesdb/update-table.md +4 -0
  391. package/docs/examples/tablesdb/update-url-column.md +6 -0
  392. package/docs/examples/tablesdb/update.md +3 -0
  393. package/docs/examples/tablesdb/upsert-row.md +4 -0
  394. package/docs/examples/tablesdb/upsert-rows.md +4 -0
  395. package/docs/examples/teams/create-membership.md +3 -8
  396. package/docs/examples/teams/create.md +2 -3
  397. package/docs/examples/teams/delete-membership.md +3 -3
  398. package/docs/examples/teams/delete.md +1 -1
  399. package/docs/examples/teams/get-membership.md +3 -3
  400. package/docs/examples/teams/get-prefs.md +2 -2
  401. package/docs/examples/teams/get.md +1 -1
  402. package/docs/examples/teams/list-logs.md +2 -3
  403. package/docs/examples/teams/list-memberships.md +2 -4
  404. package/docs/examples/teams/list.md +1 -3
  405. package/docs/examples/teams/update-membership-status.md +5 -5
  406. package/docs/examples/teams/update-membership.md +4 -4
  407. package/docs/examples/teams/update-name.md +3 -3
  408. package/docs/examples/teams/update-prefs.md +3 -3
  409. package/docs/examples/tokens/create-file-token.md +3 -4
  410. package/docs/examples/tokens/delete.md +1 -1
  411. package/docs/examples/tokens/get.md +1 -1
  412. package/docs/examples/tokens/list.md +2 -3
  413. package/docs/examples/tokens/update.md +1 -2
  414. package/docs/examples/users/create-argon-2-user.md +4 -0
  415. package/docs/examples/users/create-bcrypt-user.md +4 -5
  416. package/docs/examples/users/create-jwt.md +2 -0
  417. package/docs/examples/users/create-md-5-user.md +4 -0
  418. package/docs/examples/users/create-mfa-recovery-codes.md +2 -2
  419. package/docs/examples/users/create-ph-pass-user.md +4 -0
  420. package/docs/examples/users/create-scrypt-modified-user.md +7 -8
  421. package/docs/examples/users/create-scrypt-user.md +9 -10
  422. package/docs/examples/users/create-session.md +2 -2
  423. package/docs/examples/users/create-sha-user.md +4 -0
  424. package/docs/examples/users/create-target.md +5 -7
  425. package/docs/examples/users/create-token.md +2 -4
  426. package/docs/examples/users/create.md +1 -5
  427. package/docs/examples/users/delete-identity.md +2 -2
  428. package/docs/examples/users/delete-mfa-authenticator.md +3 -3
  429. package/docs/examples/users/delete-session.md +3 -3
  430. package/docs/examples/users/delete-sessions.md +2 -2
  431. package/docs/examples/users/delete-target.md +3 -3
  432. package/docs/examples/users/delete.md +1 -1
  433. package/docs/examples/users/get-mfa-recovery-codes.md +2 -2
  434. package/docs/examples/users/get-prefs.md +2 -2
  435. package/docs/examples/users/get-target.md +3 -3
  436. package/docs/examples/users/get-usage.md +1 -2
  437. package/docs/examples/users/get.md +1 -1
  438. package/docs/examples/users/list-identities.md +1 -3
  439. package/docs/examples/users/list-logs.md +2 -3
  440. package/docs/examples/users/list-memberships.md +2 -4
  441. package/docs/examples/users/list-mfa-factors.md +2 -2
  442. package/docs/examples/users/list-sessions.md +2 -2
  443. package/docs/examples/users/list-targets.md +2 -3
  444. package/docs/examples/users/list.md +1 -3
  445. package/docs/examples/users/update-email-verification.md +3 -3
  446. package/docs/examples/users/update-email.md +3 -3
  447. package/docs/examples/users/update-labels.md +3 -3
  448. package/docs/examples/users/update-mfa-recovery-codes.md +2 -2
  449. package/docs/examples/users/update-mfa.md +3 -3
  450. package/docs/examples/users/update-name.md +3 -3
  451. package/docs/examples/users/update-password.md +3 -3
  452. package/docs/examples/users/update-phone-verification.md +3 -3
  453. package/docs/examples/users/update-phone.md +3 -3
  454. package/docs/examples/users/update-prefs.md +3 -3
  455. package/docs/examples/users/update-status.md +3 -3
  456. package/docs/examples/users/update-target.md +3 -6
  457. package/docs/examples/vcs/create-repository-detection.md +4 -5
  458. package/docs/examples/vcs/create-repository.md +4 -4
  459. package/docs/examples/vcs/delete-installation.md +2 -2
  460. package/docs/examples/vcs/get-installation.md +2 -2
  461. package/docs/examples/vcs/get-repository-contents.md +3 -5
  462. package/docs/examples/vcs/get-repository.md +3 -3
  463. package/docs/examples/vcs/list-installations.md +1 -3
  464. package/docs/examples/vcs/list-repositories.md +3 -4
  465. package/docs/examples/vcs/list-repository-branches.md +3 -3
  466. package/docs/examples/vcs/update-external-deployments.md +4 -4
  467. package/index.js +40 -0
  468. package/install.ps1 +2 -2
  469. package/install.sh +1 -1
  470. package/lib/client.js +3 -8
  471. package/lib/commands/account.js +55 -103
  472. package/lib/commands/avatars.js +1 -8
  473. package/lib/commands/console.js +1 -3
  474. package/lib/commands/databases.js +279 -226
  475. package/lib/commands/functions.js +3 -33
  476. package/lib/commands/graphql.js +1 -3
  477. package/lib/commands/health.js +1 -23
  478. package/lib/commands/init.js +1 -1
  479. package/lib/commands/locale.js +1 -9
  480. package/lib/commands/messaging.js +41 -87
  481. package/lib/commands/migrations.js +7 -15
  482. package/lib/commands/project.js +1 -7
  483. package/lib/commands/projects.js +77 -86
  484. package/lib/commands/proxy.js +1 -9
  485. package/lib/commands/pull.js +62 -1
  486. package/lib/commands/push.js +163 -8
  487. package/lib/commands/run.js +1 -1
  488. package/lib/commands/sites.js +3 -32
  489. package/lib/commands/storage.js +3 -18
  490. package/lib/commands/tables-db.js +2896 -0
  491. package/lib/commands/teams.js +1 -15
  492. package/lib/commands/tokens.js +1 -6
  493. package/lib/commands/types.js +7 -9
  494. package/lib/commands/update.js +218 -0
  495. package/lib/commands/users.js +34 -77
  496. package/lib/commands/vcs.js +2 -12
  497. package/lib/config.js +99 -14
  498. package/lib/parser.js +2 -1
  499. package/lib/questions.js +32 -7
  500. package/lib/type-generation/languages/dart.js +13 -13
  501. package/lib/type-generation/languages/java.js +13 -13
  502. package/lib/type-generation/languages/javascript.js +14 -14
  503. package/lib/type-generation/languages/kotlin.js +11 -10
  504. package/lib/type-generation/languages/php.js +15 -14
  505. package/lib/type-generation/languages/swift.js +13 -13
  506. package/lib/type-generation/languages/typescript.js +8 -8
  507. package/lib/utils.js +39 -2
  508. package/package.json +1 -1
  509. package/scoop/{appwrite.json → appwrite.config.json} +3 -3
  510. package/docs/examples/account/create-j-w-t.md +0 -1
  511. package/docs/examples/account/create-magic-u-r-l-token.md +0 -5
  512. package/docs/examples/account/create-o-auth2session.md +0 -5
  513. package/docs/examples/account/create-o-auth2token.md +0 -5
  514. package/docs/examples/account/update-m-f-a.md +0 -2
  515. package/docs/examples/account/update-magic-u-r-l-session.md +0 -3
  516. package/docs/examples/avatars/get-q-r.md +0 -5
  517. package/docs/examples/databases/get-database-usage.md +0 -3
  518. package/docs/examples/health/get-d-b.md +0 -1
  519. package/docs/examples/locale/list-countries-e-u.md +0 -1
  520. package/docs/examples/messaging/create-msg91provider.md +0 -7
  521. package/docs/examples/messaging/update-msg91provider.md +0 -7
  522. package/docs/examples/projects/create-j-w-t.md +0 -4
  523. package/docs/examples/projects/update-o-auth2.md +0 -6
  524. package/docs/examples/proxy/create-a-p-i-rule.md +0 -2
  525. package/docs/examples/users/create-argon2user.md +0 -5
  526. package/docs/examples/users/create-j-w-t.md +0 -4
  527. package/docs/examples/users/create-m-d5user.md +0 -5
  528. package/docs/examples/users/create-p-h-pass-user.md +0 -5
  529. package/docs/examples/users/create-s-h-a-user.md +0 -6
@@ -7,7 +7,7 @@ const libClient = require('../client.js');
7
7
  const { getAllFiles, showConsoleLink } = require('../utils.js');
8
8
  const { Command } = require('commander');
9
9
  const { sdkForProject, sdkForConsole } = require('../sdks')
10
- const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
10
+ const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log, warn } = require('../parser')
11
11
  const { localConfig, globalConfig } = require("../config");
12
12
  const { File } = require('undici');
13
13
  const { ReadableStream } = require('stream/web');
@@ -75,7 +75,6 @@ const proxyListRules = async ({queries,search,parseOutput = true, overrideForCli
75
75
  return response;
76
76
 
77
77
  }
78
-
79
78
  /**
80
79
  * @typedef {Object} ProxyCreateAPIRuleRequestParams
81
80
  * @property {string} domain Domain name.
@@ -109,7 +108,6 @@ const proxyCreateAPIRule = async ({domain,parseOutput = true, overrideForCli = f
109
108
  return response;
110
109
 
111
110
  }
112
-
113
111
  /**
114
112
  * @typedef {Object} ProxyCreateFunctionRuleRequestParams
115
113
  * @property {string} domain Domain name.
@@ -151,7 +149,6 @@ const proxyCreateFunctionRule = async ({domain,functionId,branch,parseOutput = t
151
149
  return response;
152
150
 
153
151
  }
154
-
155
152
  /**
156
153
  * @typedef {Object} ProxyCreateRedirectRuleRequestParams
157
154
  * @property {string} domain Domain name.
@@ -201,7 +198,6 @@ const proxyCreateRedirectRule = async ({domain,url,statusCode,resourceId,resourc
201
198
  return response;
202
199
 
203
200
  }
204
-
205
201
  /**
206
202
  * @typedef {Object} ProxyCreateSiteRuleRequestParams
207
203
  * @property {string} domain Domain name.
@@ -243,7 +239,6 @@ const proxyCreateSiteRule = async ({domain,siteId,branch,parseOutput = true, ove
243
239
  return response;
244
240
 
245
241
  }
246
-
247
242
  /**
248
243
  * @typedef {Object} ProxyGetRuleRequestParams
249
244
  * @property {string} ruleId Rule ID.
@@ -273,7 +268,6 @@ const proxyGetRule = async ({ruleId,parseOutput = true, overrideForCli = false,
273
268
  return response;
274
269
 
275
270
  }
276
-
277
271
  /**
278
272
  * @typedef {Object} ProxyDeleteRuleRequestParams
279
273
  * @property {string} ruleId Rule ID.
@@ -304,7 +298,6 @@ const proxyDeleteRule = async ({ruleId,parseOutput = true, overrideForCli = fals
304
298
  return response;
305
299
 
306
300
  }
307
-
308
301
  /**
309
302
  * @typedef {Object} ProxyUpdateRuleVerificationRequestParams
310
303
  * @property {string} ruleId Rule ID.
@@ -335,7 +328,6 @@ const proxyUpdateRuleVerification = async ({ruleId,parseOutput = true, overrideF
335
328
  return response;
336
329
 
337
330
  }
338
-
339
331
  proxy
340
332
  .command(`list-rules`)
341
333
  .description(`Get a list of all the proxy rules. You can use the query params to filter your results.`)
@@ -9,6 +9,7 @@ const { projectsGet } = require("./projects");
9
9
  const { functionsList, functionsGetDeploymentDownload, functionsListDeployments } = require("./functions");
10
10
  const { sitesList, sitesGetDeploymentDownload, sitesListDeployments } = require("./sites");
11
11
  const { databasesGet, databasesListCollections, databasesList } = require("./databases");
12
+ const { gridsListDatabases, gridsGetDatabase, gridsListTables } = require("./grids");
12
13
  const { storageListBuckets } = require("./storage");
13
14
  const { localConfig } = require("../config");
14
15
  const { paginate } = require("../paginate");
@@ -21,6 +22,7 @@ const pullResources = async () => {
21
22
  functions: pullFunctions,
22
23
  sites: pullSites,
23
24
  collections: pullCollection,
25
+ tables: pullTable,
24
26
  buckets: pullBucket,
25
27
  teams: pullTeam,
26
28
  messages: pullMessagingTopic
@@ -285,6 +287,7 @@ const pullSites = async ({ code, withVariables }) => {
285
287
  }
286
288
 
287
289
  const pullCollection = async () => {
290
+ warn("appwrite pull collection has been deprecated. Please consider using 'appwrite pull tables' instead");
288
291
  log("Fetching collections ...");
289
292
  let total = 0;
290
293
 
@@ -336,6 +339,58 @@ const pullCollection = async () => {
336
339
  success(`Successfully pulled ${chalk.bold(total)} collections.`);
337
340
  }
338
341
 
342
+ const pullTable = async () => {
343
+ log("Fetching tables ...");
344
+ let total = 0;
345
+
346
+ const fetchResponse = await gridsListDatabases({
347
+ queries: [JSON.stringify({ method: 'limit', values: [1] })],
348
+ parseOutput: false
349
+ });
350
+ if (fetchResponse["databases"].length <= 0) {
351
+ log("No tables found.");
352
+ success(`Successfully pulled ${chalk.bold(total)} tables.`);
353
+ return;
354
+ }
355
+
356
+ let databases = cliConfig.ids;
357
+
358
+ if (databases.length === 0) {
359
+ if (cliConfig.all) {
360
+ databases = (await paginate(gridsListDatabases, { parseOutput: false }, 100, 'databases')).databases.map(database => database.$id);
361
+ } else {
362
+ databases = (await inquirer.prompt(questionsPullCollection)).databases;
363
+ }
364
+ }
365
+
366
+ for (const databaseId of databases) {
367
+ const database = await gridsGetDatabase({
368
+ databaseId,
369
+ parseOutput: false
370
+ });
371
+
372
+ total++;
373
+ log(`Pulling all tables from ${chalk.bold(database['name'])} database ...`);
374
+
375
+ localConfig.addDatabase(database);
376
+
377
+ const { tables } = await paginate(gridsListTables, {
378
+ databaseId,
379
+ parseOutput: false
380
+ }, 100, 'tables');
381
+
382
+ for (const table of tables) {
383
+ localConfig.addTable({
384
+ ...table,
385
+ '$createdAt': undefined,
386
+ '$updatedAt': undefined
387
+ });
388
+ }
389
+ }
390
+
391
+ success(`Successfully pulled ${chalk.bold(total)} tables.`);
392
+ }
393
+
339
394
  const pullBucket = async () => {
340
395
  log("Fetching buckets ...");
341
396
  let total = 0;
@@ -447,9 +502,15 @@ pull
447
502
  pull
448
503
  .command("collection")
449
504
  .alias("collections")
450
- .description("Pull your Appwrite collections")
505
+ .description("Pull your Appwrite collections (deprecated, please use 'pull tables' instead)")
451
506
  .action(actionRunner(pullCollection))
452
507
 
508
+ pull
509
+ .command("table")
510
+ .alias("tables")
511
+ .description("Pull your Appwrite tables")
512
+ .action(actionRunner(pullTable))
513
+
453
514
  pull
454
515
  .command("bucket")
455
516
  .alias("buckets")
@@ -6,10 +6,10 @@ const inquirer = require("inquirer");
6
6
  const JSONbig = require("json-bigint")({ storeAsString: false });
7
7
  const { Command } = require("commander");
8
8
  const ID = require("../id");
9
- const { localConfig, globalConfig, KeysAttributes, KeysFunction, KeysSite, whitelistKeys, KeysTopics, KeysStorage, KeysTeams, KeysCollection } = require("../config");
9
+ const { localConfig, globalConfig, KeysAttributes, KeysFunction, KeysSite, whitelistKeys, KeysTopics, KeysStorage, KeysTeams, KeysCollection, KeysTable } = require("../config");
10
10
  const { Spinner, SPINNER_ARC, SPINNER_DOTS } = require('../spinner');
11
11
  const { paginate } = require('../paginate');
12
- const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsPushSites, questionsGetEntrypoint, questionsPushCollections, questionPushChanges, questionPushChangesConfirmation, questionsPushMessagingTopics, questionsPushResources } = require("../questions");
12
+ const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsPushSites, questionsGetEntrypoint, questionsPushCollections, questionsPushTables, questionPushChanges, questionPushChangesConfirmation, questionsPushMessagingTopics, questionsPushResources } = require("../questions");
13
13
  const { cliConfig, actionRunner, success, warn, log, hint, error, commandDescriptions, drawTable } = require("../parser");
14
14
  const { proxyCreateFunctionRule, proxyCreateSiteRule, proxyListRules } = require('./proxy');
15
15
  const { consoleVariables } = require('./console');
@@ -49,6 +49,10 @@ const {
49
49
  databasesListIndexes,
50
50
  databasesUpdateCollection
51
51
  } = require("./databases");
52
+ const {
53
+ gridsGetDatabase,
54
+ gridsGetTable
55
+ } = require("./grids");
52
56
  const {
53
57
  storageGetBucket, storageUpdateBucket, storageCreateBucket
54
58
  } = require("./storage");
@@ -792,7 +796,7 @@ const generateChangesObject = (attribute, collection, isAdding) => {
792
796
  return {
793
797
  key: `${chalk.yellow(attribute.key)} in ${collection.name} (${collection['$id']})`,
794
798
  attribute: attribute,
795
- reason: isAdding ? 'Field isn\'t present on the remote server' : 'Field isn\'t present on the appwrite.json file',
799
+ reason: isAdding ? 'Field isn\'t present on the remote server' : 'Field isn\'t present on the appwrite.config.json file',
796
800
  action: isAdding ? chalk.green('adding') : chalk.red('deleting')
797
801
  };
798
802
 
@@ -919,6 +923,7 @@ const pushResources = async () => {
919
923
  functions: pushFunction,
920
924
  sites: pushSite,
921
925
  collections: pushCollection,
926
+ tables: pushTable,
922
927
  buckets: pushBucket,
923
928
  teams: pushTeam,
924
929
  messages: pushMessagingTopic
@@ -1094,7 +1099,7 @@ const pushSite = async({ siteId, async, code, withVariables } = { returnOnZero:
1094
1099
  await Promise.all(sites.map(async (site) => {
1095
1100
  let response = {};
1096
1101
 
1097
- const ignore = site.ignore ? 'appwrite.json' : '.gitignore';
1102
+ const ignore = site.ignore ? 'appwrite.config.json' : '.gitignore';
1098
1103
  let siteExists = false;
1099
1104
  let deploymentCreated = false;
1100
1105
 
@@ -1109,7 +1114,7 @@ const pushSite = async({ siteId, async, code, withVariables } = { returnOnZero:
1109
1114
  });
1110
1115
  siteExists = true;
1111
1116
  if (response.framework !== site.framework) {
1112
- updaterRow.fail({ errorMessage: `Framework mismatch! (local=${site.framework},remote=${response.framework}) Please delete remote site or update your appwrite.json` })
1117
+ updaterRow.fail({ errorMessage: `Framework mismatch! (local=${site.framework},remote=${response.framework}) Please delete remote site or update your appwrite.config.json` })
1113
1118
  return;
1114
1119
  }
1115
1120
 
@@ -1417,7 +1422,7 @@ const pushFunction = async ({ functionId, async, code, withVariables } = { retur
1417
1422
  await Promise.all(functions.map(async (func) => {
1418
1423
  let response = {};
1419
1424
 
1420
- const ignore = func.ignore ? 'appwrite.json' : '.gitignore';
1425
+ const ignore = func.ignore ? 'appwrite.config.json' : '.gitignore';
1421
1426
  let functionExists = false;
1422
1427
  let deploymentCreated = false;
1423
1428
 
@@ -1431,7 +1436,7 @@ const pushFunction = async ({ functionId, async, code, withVariables } = { retur
1431
1436
  });
1432
1437
  functionExists = true;
1433
1438
  if (response.runtime !== func.runtime) {
1434
- updaterRow.fail({ errorMessage: `Runtime mismatch! (local=${func.runtime},remote=${response.runtime}) Please delete remote function or update your appwrite.json` })
1439
+ updaterRow.fail({ errorMessage: `Runtime mismatch! (local=${func.runtime},remote=${response.runtime}) Please delete remote function or update your appwrite.config.json` })
1435
1440
  return;
1436
1441
  }
1437
1442
 
@@ -1672,7 +1677,150 @@ const pushFunction = async ({ functionId, async, code, withVariables } = { retur
1672
1677
  }
1673
1678
  }
1674
1679
 
1680
+ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) => {
1681
+ const tables = [];
1682
+
1683
+ if (attempts) {
1684
+ pollMaxDebounces = attempts;
1685
+ }
1686
+
1687
+ if (cliConfig.all) {
1688
+ checkDeployConditions(localConfig);
1689
+ tables.push(...localConfig.getTables());
1690
+ } else {
1691
+ const answers = await inquirer.prompt(questionsPushTables)
1692
+ if (answers.tables) {
1693
+ const configTables = new Map();
1694
+ localConfig.getTables().forEach((c) => {
1695
+ configTables.set(`${c['databaseId']}|${c['$id']}`, c);
1696
+ });
1697
+ answers.tables.forEach((a) => {
1698
+ const table = configTables.get(a);
1699
+ tables.push(table);
1700
+ })
1701
+ }
1702
+ }
1703
+
1704
+ if (tables.length === 0) {
1705
+ log("No tables found.");
1706
+ hint("Use 'appwrite pull tables' to synchronize existing one, or use 'appwrite init table' to create a new one.");
1707
+ return;
1708
+ }
1709
+
1710
+ const databases = Array.from(new Set(tables.map(table => table['databaseId'])));
1711
+
1712
+ // Parallel db actions
1713
+ await Promise.all(databases.map(async (databaseId) => {
1714
+ const localDatabase = localConfig.getDatabase(databaseId);
1715
+
1716
+ try {
1717
+ const database = await gridsGetDatabase({
1718
+ databaseId: databaseId,
1719
+ parseOutput: false,
1720
+ });
1721
+
1722
+ if (database.name !== (localDatabase.name ?? databaseId)) {
1723
+ await databasesUpdate({
1724
+ databaseId: databaseId,
1725
+ name: localDatabase.name ?? databaseId,
1726
+ parseOutput: false
1727
+ })
1728
+
1729
+ success(`Updated ${localDatabase.name} ( ${databaseId} ) name`);
1730
+ }
1731
+ } catch (err) {
1732
+ log(`Database ${databaseId} not found. Creating it now ...`);
1733
+
1734
+ await databasesCreate({
1735
+ databaseId: databaseId,
1736
+ name: localDatabase.name ?? databaseId,
1737
+ parseOutput: false,
1738
+ });
1739
+ }
1740
+ }));
1741
+
1742
+
1743
+ if (!(await approveChanges(tables, gridsGetTable, KeysTable, 'tableId', 'tables', ['columns', 'indexes'], 'databaseId', 'databaseId',))) {
1744
+ return;
1745
+ }
1746
+ // Parallel collection actions
1747
+ await Promise.all(tables.map(async (table) => {
1748
+ try {
1749
+ const remoteTable = await gridsGetTable({
1750
+ databaseId: table['databaseId'],
1751
+ tableId: table['$id'],
1752
+ parseOutput: false,
1753
+ });
1754
+
1755
+ if (remoteTable.name !== table.name) {
1756
+ await databasesUpdateTable({
1757
+ databaseId: table['databaseId'],
1758
+ tableId: table['$id'],
1759
+ name: table.name,
1760
+ name: table.name,
1761
+ parseOutput: false
1762
+ })
1763
+
1764
+ success(`Updated ${table.name} ( ${table['$id']} ) name`);
1765
+ }
1766
+ table.remoteVersion = remoteTable;
1767
+
1768
+ table.isExisted = true;
1769
+ } catch
1770
+ (e) {
1771
+ if (Number(e.code) === 404) {
1772
+ log(`Table ${table.name} does not exist in the project. Creating ... `);
1773
+ await databasesCreateTable({
1774
+ databaseId: table['databaseId'],
1775
+ tableId: table['$id'],
1776
+ name: table.name,
1777
+ documentSecurity: table.documentSecurity,
1778
+ permissions: table['$permissions'],
1779
+ parseOutput: false
1780
+ })
1781
+ } else {
1782
+ throw e;
1783
+ }
1784
+ }
1785
+ }))
1786
+ let numberOfTables = 0;
1787
+ // Serialize attribute actions
1788
+ for (let table of tables) {
1789
+ let columns = table.columns;
1790
+ let indexes = table.indexes;
1791
+
1792
+ if (table.isExisted) {
1793
+ columns = await attributesToCreate(table.remoteVersion.columns, table.columns, table);
1794
+ indexes = await attributesToCreate(table.remoteVersion.indexes, table.indexes, table, true);
1795
+
1796
+ if ((Array.isArray(columns) && columns.length <= 0) && (Array.isArray(indexes) && indexes.length <= 0)) {
1797
+ continue;
1798
+ }
1799
+
1800
+ }
1801
+
1802
+ log(`Pushing table ${table.name} ( ${table['databaseId']} - ${table['$id']} ) attributes`)
1803
+
1804
+ try {
1805
+ await createAttributes(columns, table)
1806
+ } catch (e) {
1807
+ throw e;
1808
+ }
1809
+
1810
+ try {
1811
+ await createIndexes(indexes, table);
1812
+ } catch (e) {
1813
+ throw e;
1814
+ }
1815
+ numberOfTables++;
1816
+ success(`Successfully pushed ${table.name} ( ${table['$id']} )`);
1817
+ }
1818
+
1819
+ success(`Successfully pushed ${numberOfTables} tables`);
1820
+ }
1821
+
1675
1822
  const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false }) => {
1823
+ warn("appwrite push collection has been deprecated. Please consider using 'appwrite push tables' instead");
1676
1824
  const collections = [];
1677
1825
 
1678
1826
  if (attempts) {
@@ -2083,10 +2231,17 @@ push
2083
2231
  push
2084
2232
  .command("collection")
2085
2233
  .alias("collections")
2086
- .description("Push collections in the current project.")
2234
+ .description("Push collections in the current project. (deprecated, please use 'push tables' instead)")
2087
2235
  .option(`-a, --attempts <numberOfAttempts>`, `Max number of attempts before timing out. default: 30.`)
2088
2236
  .action(actionRunner(pushCollection));
2089
2237
 
2238
+ push
2239
+ .command("table")
2240
+ .alias("tables")
2241
+ .description("Push tables in the current project.")
2242
+ .option(`-a, --attempts <numberOfAttempts>`, `Max number of attempts before timing out. default: 30.`)
2243
+ .action(actionRunner(pushTable));
2244
+
2090
2245
  push
2091
2246
  .command("bucket")
2092
2247
  .alias("buckets")
@@ -85,7 +85,7 @@ const runFunction = async ({ port, functionId, withVariables, reload, userId } =
85
85
  };
86
86
 
87
87
  drawTable([settings]);
88
- log("If you wish to change your local settings, update the appwrite.json file and rerun the 'appwrite run' command.");
88
+ log("If you wish to change your local settings, update the appwrite.config.json file and rerun the 'appwrite run' command.");
89
89
  hint("Permissions, events, CRON and timeouts dont apply when running locally.");
90
90
 
91
91
  await dockerCleanup(func.$id);
@@ -7,7 +7,7 @@ const libClient = require('../client.js');
7
7
  const { getAllFiles, showConsoleLink } = require('../utils.js');
8
8
  const { Command } = require('commander');
9
9
  const { sdkForProject, sdkForConsole } = require('../sdks')
10
- const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
10
+ const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log, warn } = require('../parser')
11
11
  const { localConfig, globalConfig } = require("../config");
12
12
  const { File } = require('undici');
13
13
  const { ReadableStream } = require('stream/web');
@@ -79,7 +79,6 @@ const sitesList = async ({queries,search,parseOutput = true, overrideForCli = fa
79
79
  return response;
80
80
 
81
81
  }
82
-
83
82
  /**
84
83
  * @typedef {Object} SitesCreateRequestParams
85
84
  * @property {string} siteId Site ID. Choose a custom ID or generate a random ID with &#039;ID.unique()&#039;. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;t start with a special char. Max length is 36 chars.
@@ -181,7 +180,6 @@ const sitesCreate = async ({siteId,name,framework,buildRuntime,enabled,logging,t
181
180
  return response;
182
181
 
183
182
  }
184
-
185
183
  /**
186
184
  * @typedef {Object} SitesListFrameworksRequestParams
187
185
  * @property {boolean} overrideForCli
@@ -214,7 +212,6 @@ const sitesListFrameworks = async ({parseOutput = true, overrideForCli = false,
214
212
  return response;
215
213
 
216
214
  }
217
-
218
215
  /**
219
216
  * @typedef {Object} SitesListSpecificationsRequestParams
220
217
  * @property {boolean} overrideForCli
@@ -247,7 +244,6 @@ const sitesListSpecifications = async ({parseOutput = true, overrideForCli = fal
247
244
  return response;
248
245
 
249
246
  }
250
-
251
247
  /**
252
248
  * @typedef {Object} SitesListTemplatesRequestParams
253
249
  * @property {string[]} frameworks List of frameworks allowed for filtering site templates. Maximum of 100 frameworks are allowed.
@@ -296,7 +292,6 @@ const sitesListTemplates = async ({frameworks,useCases,limit,offset,parseOutput
296
292
  return response;
297
293
 
298
294
  }
299
-
300
295
  /**
301
296
  * @typedef {Object} SitesGetTemplateRequestParams
302
297
  * @property {string} templateId Template ID.
@@ -330,10 +325,9 @@ const sitesGetTemplate = async ({templateId,parseOutput = true, overrideForCli =
330
325
  return response;
331
326
 
332
327
  }
333
-
334
328
  /**
335
329
  * @typedef {Object} SitesListUsageRequestParams
336
- * @property {SiteUsageRange} range Date range.
330
+ * @property {UsageRange} range Date range.
337
331
  * @property {boolean} overrideForCli
338
332
  * @property {boolean} parseOutput
339
333
  * @property {libClient | undefined} sdk
@@ -367,7 +361,6 @@ const sitesListUsage = async ({range,parseOutput = true, overrideForCli = false,
367
361
  return response;
368
362
 
369
363
  }
370
-
371
364
  /**
372
365
  * @typedef {Object} SitesGetRequestParams
373
366
  * @property {string} siteId Site ID.
@@ -401,7 +394,6 @@ const sitesGet = async ({siteId,parseOutput = true, overrideForCli = false, sdk
401
394
  return response;
402
395
 
403
396
  }
404
-
405
397
  /**
406
398
  * @typedef {Object} SitesUpdateRequestParams
407
399
  * @property {string} siteId Site ID.
@@ -500,7 +492,6 @@ const sitesUpdate = async ({siteId,name,framework,enabled,logging,timeout,instal
500
492
  return response;
501
493
 
502
494
  }
503
-
504
495
  /**
505
496
  * @typedef {Object} SitesDeleteRequestParams
506
497
  * @property {string} siteId Site ID.
@@ -531,7 +522,6 @@ const sitesDelete = async ({siteId,parseOutput = true, overrideForCli = false, s
531
522
  return response;
532
523
 
533
524
  }
534
-
535
525
  /**
536
526
  * @typedef {Object} SitesUpdateSiteDeploymentRequestParams
537
527
  * @property {string} siteId Site ID.
@@ -566,7 +556,6 @@ const sitesUpdateSiteDeployment = async ({siteId,deploymentId,parseOutput = true
566
556
  return response;
567
557
 
568
558
  }
569
-
570
559
  /**
571
560
  * @typedef {Object} SitesListDeploymentsRequestParams
572
561
  * @property {string} siteId Site ID.
@@ -608,7 +597,6 @@ const sitesListDeployments = async ({siteId,queries,search,parseOutput = true, o
608
597
  return response;
609
598
 
610
599
  }
611
-
612
600
  /**
613
601
  * @typedef {Object} SitesCreateDeploymentRequestParams
614
602
  * @property {string} siteId Site ID.
@@ -777,7 +765,6 @@ const sitesCreateDeployment = async ({siteId,code,activate,installCommand,buildC
777
765
 
778
766
  return response;
779
767
  }
780
-
781
768
  /**
782
769
  * @typedef {Object} SitesCreateDuplicateDeploymentRequestParams
783
770
  * @property {string} siteId Site ID.
@@ -812,7 +799,6 @@ const sitesCreateDuplicateDeployment = async ({siteId,deploymentId,parseOutput =
812
799
  return response;
813
800
 
814
801
  }
815
-
816
802
  /**
817
803
  * @typedef {Object} SitesCreateTemplateDeploymentRequestParams
818
804
  * @property {string} siteId Site ID.
@@ -863,7 +849,6 @@ const sitesCreateTemplateDeployment = async ({siteId,repository,owner,rootDirect
863
849
  return response;
864
850
 
865
851
  }
866
-
867
852
  /**
868
853
  * @typedef {Object} SitesCreateVcsDeploymentRequestParams
869
854
  * @property {string} siteId Site ID.
@@ -906,7 +891,6 @@ const sitesCreateVcsDeployment = async ({siteId,type,reference,activate,parseOut
906
891
  return response;
907
892
 
908
893
  }
909
-
910
894
  /**
911
895
  * @typedef {Object} SitesGetDeploymentRequestParams
912
896
  * @property {string} siteId Site ID.
@@ -941,7 +925,6 @@ const sitesGetDeployment = async ({siteId,deploymentId,parseOutput = true, overr
941
925
  return response;
942
926
 
943
927
  }
944
-
945
928
  /**
946
929
  * @typedef {Object} SitesDeleteDeploymentRequestParams
947
930
  * @property {string} siteId Site ID.
@@ -973,7 +956,6 @@ const sitesDeleteDeployment = async ({siteId,deploymentId,parseOutput = true, ov
973
956
  return response;
974
957
 
975
958
  }
976
-
977
959
  /**
978
960
  * @typedef {Object} SitesGetDeploymentDownloadRequestParams
979
961
  * @property {string} siteId Site ID.
@@ -1024,7 +1006,6 @@ const sitesGetDeploymentDownload = async ({siteId,deploymentId,type,parseOutput
1024
1006
  return response;
1025
1007
 
1026
1008
  }
1027
-
1028
1009
  /**
1029
1010
  * @typedef {Object} SitesUpdateDeploymentStatusRequestParams
1030
1011
  * @property {string} siteId Site ID.
@@ -1056,7 +1037,6 @@ const sitesUpdateDeploymentStatus = async ({siteId,deploymentId,parseOutput = tr
1056
1037
  return response;
1057
1038
 
1058
1039
  }
1059
-
1060
1040
  /**
1061
1041
  * @typedef {Object} SitesListLogsRequestParams
1062
1042
  * @property {string} siteId Site ID.
@@ -1090,7 +1070,6 @@ const sitesListLogs = async ({siteId,queries,parseOutput = true, overrideForCli
1090
1070
  return response;
1091
1071
 
1092
1072
  }
1093
-
1094
1073
  /**
1095
1074
  * @typedef {Object} SitesGetLogRequestParams
1096
1075
  * @property {string} siteId Site ID.
@@ -1125,7 +1104,6 @@ const sitesGetLog = async ({siteId,logId,parseOutput = true, overrideForCli = fa
1125
1104
  return response;
1126
1105
 
1127
1106
  }
1128
-
1129
1107
  /**
1130
1108
  * @typedef {Object} SitesDeleteLogRequestParams
1131
1109
  * @property {string} siteId Site ID.
@@ -1157,11 +1135,10 @@ const sitesDeleteLog = async ({siteId,logId,parseOutput = true, overrideForCli =
1157
1135
  return response;
1158
1136
 
1159
1137
  }
1160
-
1161
1138
  /**
1162
1139
  * @typedef {Object} SitesGetUsageRequestParams
1163
1140
  * @property {string} siteId Site ID.
1164
- * @property {SiteUsageRange} range Date range.
1141
+ * @property {UsageRange} range Date range.
1165
1142
  * @property {boolean} overrideForCli
1166
1143
  * @property {boolean} parseOutput
1167
1144
  * @property {libClient | undefined} sdk
@@ -1191,7 +1168,6 @@ const sitesGetUsage = async ({siteId,range,parseOutput = true, overrideForCli =
1191
1168
  return response;
1192
1169
 
1193
1170
  }
1194
-
1195
1171
  /**
1196
1172
  * @typedef {Object} SitesListVariablesRequestParams
1197
1173
  * @property {string} siteId Site unique ID.
@@ -1221,7 +1197,6 @@ const sitesListVariables = async ({siteId,parseOutput = true, overrideForCli = f
1221
1197
  return response;
1222
1198
 
1223
1199
  }
1224
-
1225
1200
  /**
1226
1201
  * @typedef {Object} SitesCreateVariableRequestParams
1227
1202
  * @property {string} siteId Site unique ID.
@@ -1264,7 +1239,6 @@ const sitesCreateVariable = async ({siteId,key,value,secret,parseOutput = true,
1264
1239
  return response;
1265
1240
 
1266
1241
  }
1267
-
1268
1242
  /**
1269
1243
  * @typedef {Object} SitesGetVariableRequestParams
1270
1244
  * @property {string} siteId Site unique ID.
@@ -1295,7 +1269,6 @@ const sitesGetVariable = async ({siteId,variableId,parseOutput = true, overrideF
1295
1269
  return response;
1296
1270
 
1297
1271
  }
1298
-
1299
1272
  /**
1300
1273
  * @typedef {Object} SitesUpdateVariableRequestParams
1301
1274
  * @property {string} siteId Site unique ID.
@@ -1339,7 +1312,6 @@ const sitesUpdateVariable = async ({siteId,variableId,key,value,secret,parseOutp
1339
1312
  return response;
1340
1313
 
1341
1314
  }
1342
-
1343
1315
  /**
1344
1316
  * @typedef {Object} SitesDeleteVariableRequestParams
1345
1317
  * @property {string} siteId Site unique ID.
@@ -1371,7 +1343,6 @@ const sitesDeleteVariable = async ({siteId,variableId,parseOutput = true, overri
1371
1343
  return response;
1372
1344
 
1373
1345
  }
1374
-
1375
1346
  sites
1376
1347
  .command(`list`)
1377
1348
  .description(`Get a list of all the project's sites. You can use the query params to filter your results.`)