appwrite-cli 13.0.0-rc.1 → 13.0.0-rc.2

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 (868) hide show
  1. package/.github/workflows/build-verify.yml +71 -0
  2. package/.github/workflows/npm-publish.yml +41 -22
  3. package/CHANGELOG.md +106 -102
  4. package/LICENSE.md +1 -1
  5. package/README.md +58 -35
  6. package/bun.lock +625 -0
  7. package/dist/bundle.cjs +94853 -0
  8. package/dist/index.js +99 -99
  9. package/dist/index.js.map +1 -1
  10. package/dist/lib/client.d.ts +2 -3
  11. package/dist/lib/client.d.ts.map +1 -1
  12. package/dist/lib/client.js +56 -45
  13. package/dist/lib/client.js.map +1 -1
  14. package/dist/lib/commands/generic.d.ts +2 -2
  15. package/dist/lib/commands/generic.d.ts.map +1 -1
  16. package/dist/lib/commands/generic.js +170 -157
  17. package/dist/lib/commands/generic.js.map +1 -1
  18. package/dist/lib/commands/init.d.ts +1 -1
  19. package/dist/lib/commands/init.d.ts.map +1 -1
  20. package/dist/lib/commands/init.js +197 -189
  21. package/dist/lib/commands/init.js.map +1 -1
  22. package/dist/lib/commands/pull.d.ts +2 -2
  23. package/dist/lib/commands/pull.d.ts.map +1 -1
  24. package/dist/lib/commands/pull.js +215 -244
  25. package/dist/lib/commands/pull.js.map +1 -1
  26. package/dist/lib/commands/push.d.ts.map +1 -1
  27. package/dist/lib/commands/push.js +814 -841
  28. package/dist/lib/commands/push.js.map +1 -1
  29. package/dist/lib/commands/run.d.ts +1 -1
  30. package/dist/lib/commands/run.d.ts.map +1 -1
  31. package/dist/lib/commands/run.js +129 -127
  32. package/dist/lib/commands/run.js.map +1 -1
  33. package/dist/lib/commands/services/account.d.ts +3 -0
  34. package/dist/lib/commands/services/account.d.ts.map +1 -0
  35. package/dist/lib/commands/services/account.js +306 -0
  36. package/dist/lib/commands/services/account.js.map +1 -0
  37. package/dist/lib/commands/services/avatars.d.ts +3 -0
  38. package/dist/lib/commands/services/avatars.d.ts.map +1 -0
  39. package/dist/lib/commands/services/avatars.js +118 -0
  40. package/dist/lib/commands/services/avatars.js.map +1 -0
  41. package/dist/lib/commands/services/console.d.ts +3 -0
  42. package/dist/lib/commands/services/console.d.ts.map +1 -0
  43. package/dist/lib/commands/services/console.js +41 -0
  44. package/dist/lib/commands/services/console.js.map +1 -0
  45. package/dist/lib/commands/services/databases.d.ts +3 -0
  46. package/dist/lib/commands/services/databases.d.ts.map +1 -0
  47. package/dist/lib/commands/services/databases.js +612 -0
  48. package/dist/lib/commands/services/databases.js.map +1 -0
  49. package/dist/lib/commands/services/functions.d.ts +3 -0
  50. package/dist/lib/commands/services/functions.d.ts.map +1 -0
  51. package/dist/lib/commands/services/functions.js +258 -0
  52. package/dist/lib/commands/services/functions.js.map +1 -0
  53. package/dist/lib/commands/services/graphql.d.ts +3 -0
  54. package/dist/lib/commands/services/graphql.d.ts.map +1 -0
  55. package/dist/lib/commands/services/graphql.js +28 -0
  56. package/dist/lib/commands/services/graphql.js.map +1 -0
  57. package/dist/lib/commands/services/health.d.ts +3 -0
  58. package/dist/lib/commands/services/health.d.ts.map +1 -0
  59. package/dist/lib/commands/services/health.js +123 -0
  60. package/dist/lib/commands/services/health.js.map +1 -0
  61. package/dist/lib/commands/services/locale.d.ts +3 -0
  62. package/dist/lib/commands/services/locale.d.ts.map +1 -0
  63. package/dist/lib/commands/services/locale.js +52 -0
  64. package/dist/lib/commands/services/locale.js.map +1 -0
  65. package/dist/lib/commands/services/messaging.d.ts +3 -0
  66. package/dist/lib/commands/services/messaging.d.ts.map +1 -0
  67. package/dist/lib/commands/services/messaging.js +505 -0
  68. package/dist/lib/commands/services/messaging.js.map +1 -0
  69. package/dist/lib/commands/services/migrations.d.ts +3 -0
  70. package/dist/lib/commands/services/migrations.d.ts.map +1 -0
  71. package/dist/lib/commands/services/migrations.js +135 -0
  72. package/dist/lib/commands/services/migrations.js.map +1 -0
  73. package/dist/lib/commands/services/project.d.ts +3 -0
  74. package/dist/lib/commands/services/project.d.ts.map +1 -0
  75. package/dist/lib/commands/services/project.js +54 -0
  76. package/dist/lib/commands/services/project.js.map +1 -0
  77. package/dist/lib/commands/services/projects.d.ts +3 -0
  78. package/dist/lib/commands/services/projects.d.ts.map +1 -0
  79. package/dist/lib/commands/services/projects.js +415 -0
  80. package/dist/lib/commands/services/projects.js.map +1 -0
  81. package/dist/lib/commands/services/proxy.d.ts +3 -0
  82. package/dist/lib/commands/services/proxy.d.ts.map +1 -0
  83. package/dist/lib/commands/services/proxy.js +68 -0
  84. package/dist/lib/commands/services/proxy.js.map +1 -0
  85. package/dist/lib/commands/services/sites.d.ts +3 -0
  86. package/dist/lib/commands/services/sites.d.ts.map +1 -0
  87. package/dist/lib/commands/services/sites.js +242 -0
  88. package/dist/lib/commands/services/sites.js.map +1 -0
  89. package/dist/lib/commands/services/storage.d.ts +3 -0
  90. package/dist/lib/commands/services/storage.d.ts.map +1 -0
  91. package/dist/lib/commands/services/storage.js +153 -0
  92. package/dist/lib/commands/services/storage.js.map +1 -0
  93. package/dist/lib/commands/services/tablesdb.d.ts +3 -0
  94. package/dist/lib/commands/services/tablesdb.d.ts.map +1 -0
  95. package/dist/lib/commands/services/tablesdb.js +605 -0
  96. package/dist/lib/commands/services/tablesdb.js.map +1 -0
  97. package/dist/lib/commands/services/teams.d.ts +3 -0
  98. package/dist/lib/commands/services/teams.d.ts.map +1 -0
  99. package/dist/lib/commands/services/teams.js +123 -0
  100. package/dist/lib/commands/services/teams.js.map +1 -0
  101. package/dist/lib/commands/services/tokens.d.ts +3 -0
  102. package/dist/lib/commands/services/tokens.d.ts.map +1 -0
  103. package/dist/lib/commands/services/tokens.js +49 -0
  104. package/dist/lib/commands/services/tokens.js.map +1 -0
  105. package/dist/lib/commands/services/users.d.ts +3 -0
  106. package/dist/lib/commands/services/users.d.ts.map +1 -0
  107. package/dist/lib/commands/services/users.js +312 -0
  108. package/dist/lib/commands/services/users.js.map +1 -0
  109. package/dist/lib/commands/services/vcs.d.ts +3 -0
  110. package/dist/lib/commands/services/vcs.d.ts.map +1 -0
  111. package/dist/lib/commands/services/vcs.js +87 -0
  112. package/dist/lib/commands/services/vcs.js.map +1 -0
  113. package/dist/lib/commands/types.d.ts +1 -1
  114. package/dist/lib/commands/types.d.ts.map +1 -1
  115. package/dist/lib/commands/types.js +53 -57
  116. package/dist/lib/commands/types.js.map +1 -1
  117. package/dist/lib/commands/update.d.ts +1 -1
  118. package/dist/lib/commands/update.d.ts.map +1 -1
  119. package/dist/lib/commands/update.js +65 -66
  120. package/dist/lib/commands/update.js.map +1 -1
  121. package/dist/lib/config.d.ts +39 -39
  122. package/dist/lib/config.d.ts.map +1 -1
  123. package/dist/lib/config.js +264 -202
  124. package/dist/lib/config.js.map +1 -1
  125. package/dist/lib/emulation/docker.d.ts +1 -9
  126. package/dist/lib/emulation/docker.d.ts.map +1 -1
  127. package/dist/lib/emulation/docker.js +111 -107
  128. package/dist/lib/emulation/docker.js.map +1 -1
  129. package/dist/lib/emulation/utils.d.ts +1 -1
  130. package/dist/lib/emulation/utils.d.ts.map +1 -1
  131. package/dist/lib/emulation/utils.js +55 -58
  132. package/dist/lib/emulation/utils.js.map +1 -1
  133. package/dist/lib/id.d.ts +1 -1
  134. package/dist/lib/id.d.ts.map +1 -1
  135. package/dist/lib/id.js +13 -18
  136. package/dist/lib/id.js.map +1 -1
  137. package/dist/lib/paginate.d.ts +3 -4
  138. package/dist/lib/paginate.d.ts.map +1 -1
  139. package/dist/lib/paginate.js +7 -10
  140. package/dist/lib/paginate.js.map +1 -1
  141. package/dist/lib/parser.d.ts +1 -1
  142. package/dist/lib/parser.d.ts.map +1 -1
  143. package/dist/lib/parser.js +84 -96
  144. package/dist/lib/parser.js.map +1 -1
  145. package/dist/lib/questions.d.ts +1 -1
  146. package/dist/lib/questions.d.ts.map +1 -1
  147. package/dist/lib/questions.js +364 -368
  148. package/dist/lib/questions.js.map +1 -1
  149. package/dist/lib/sdks.d.ts +1 -1
  150. package/dist/lib/sdks.d.ts.map +1 -1
  151. package/dist/lib/sdks.js +40 -30
  152. package/dist/lib/sdks.js.map +1 -1
  153. package/dist/lib/services.d.ts +13 -0
  154. package/dist/lib/services.d.ts.map +1 -0
  155. package/dist/lib/services.js +47 -0
  156. package/dist/lib/services.js.map +1 -0
  157. package/dist/lib/spinner.d.ts +1 -1
  158. package/dist/lib/spinner.d.ts.map +1 -1
  159. package/dist/lib/spinner.js +25 -27
  160. package/dist/lib/spinner.js.map +1 -1
  161. package/dist/lib/type-generation/attribute.d.ts +1 -1
  162. package/dist/lib/type-generation/attribute.d.ts.map +1 -1
  163. package/dist/lib/type-generation/attribute.js +14 -17
  164. package/dist/lib/type-generation/attribute.js.map +1 -1
  165. package/dist/lib/type-generation/languages/csharp.d.ts +1 -1
  166. package/dist/lib/type-generation/languages/csharp.d.ts.map +1 -1
  167. package/dist/lib/type-generation/languages/csharp.js +34 -34
  168. package/dist/lib/type-generation/languages/csharp.js.map +1 -1
  169. package/dist/lib/type-generation/languages/dart.d.ts +1 -1
  170. package/dist/lib/type-generation/languages/dart.d.ts.map +1 -1
  171. package/dist/lib/type-generation/languages/dart.js +57 -57
  172. package/dist/lib/type-generation/languages/dart.js.map +1 -1
  173. package/dist/lib/type-generation/languages/java.d.ts +1 -1
  174. package/dist/lib/type-generation/languages/java.d.ts.map +1 -1
  175. package/dist/lib/type-generation/languages/java.js +35 -35
  176. package/dist/lib/type-generation/languages/java.js.map +1 -1
  177. package/dist/lib/type-generation/languages/javascript.d.ts +1 -1
  178. package/dist/lib/type-generation/languages/javascript.d.ts.map +1 -1
  179. package/dist/lib/type-generation/languages/javascript.js +45 -44
  180. package/dist/lib/type-generation/languages/javascript.js.map +1 -1
  181. package/dist/lib/type-generation/languages/kotlin.d.ts +1 -1
  182. package/dist/lib/type-generation/languages/kotlin.d.ts.map +1 -1
  183. package/dist/lib/type-generation/languages/kotlin.js +35 -35
  184. package/dist/lib/type-generation/languages/kotlin.js.map +1 -1
  185. package/dist/lib/type-generation/languages/language.d.ts.map +1 -1
  186. package/dist/lib/type-generation/languages/language.js +32 -37
  187. package/dist/lib/type-generation/languages/language.js.map +1 -1
  188. package/dist/lib/type-generation/languages/php.d.ts +1 -1
  189. package/dist/lib/type-generation/languages/php.d.ts.map +1 -1
  190. package/dist/lib/type-generation/languages/php.js +34 -34
  191. package/dist/lib/type-generation/languages/php.js.map +1 -1
  192. package/dist/lib/type-generation/languages/swift.d.ts +1 -1
  193. package/dist/lib/type-generation/languages/swift.d.ts.map +1 -1
  194. package/dist/lib/type-generation/languages/swift.js +35 -35
  195. package/dist/lib/type-generation/languages/swift.js.map +1 -1
  196. package/dist/lib/type-generation/languages/typescript.d.ts +1 -1
  197. package/dist/lib/type-generation/languages/typescript.d.ts.map +1 -1
  198. package/dist/lib/type-generation/languages/typescript.js +49 -46
  199. package/dist/lib/type-generation/languages/typescript.js.map +1 -1
  200. package/dist/lib/types.d.ts +189 -45
  201. package/dist/lib/types.d.ts.map +1 -1
  202. package/dist/lib/types.js +1 -2
  203. package/dist/lib/utils.d.ts.map +1 -1
  204. package/dist/lib/utils.js +102 -98
  205. package/dist/lib/utils.js.map +1 -1
  206. package/dist/lib/validations.d.ts.map +1 -1
  207. package/dist/lib/validations.js +2 -6
  208. package/dist/lib/validations.js.map +1 -1
  209. package/dist/package.json +67 -0
  210. package/dist/scripts/generate-commands.d.ts +2 -0
  211. package/dist/scripts/generate-commands.d.ts.map +1 -0
  212. package/dist/scripts/generate-commands.js +398 -0
  213. package/dist/scripts/generate-commands.js.map +1 -0
  214. package/index.ts +146 -130
  215. package/install.ps1 +2 -2
  216. package/install.sh +1 -1
  217. package/lib/client.ts +253 -220
  218. package/lib/commands/generic.ts +371 -269
  219. package/lib/commands/init.ts +620 -519
  220. package/lib/commands/pull.ts +581 -470
  221. package/lib/commands/push.ts +2838 -2269
  222. package/lib/commands/run.ts +382 -302
  223. package/lib/commands/services/account.ts +832 -0
  224. package/lib/commands/services/avatars.ts +400 -0
  225. package/lib/commands/services/console.ts +73 -0
  226. package/lib/commands/services/databases.ts +2080 -0
  227. package/lib/commands/services/functions.ts +855 -0
  228. package/lib/commands/services/graphql.ts +47 -0
  229. package/lib/commands/services/health.ts +322 -0
  230. package/lib/commands/services/locale.ts +99 -0
  231. package/lib/commands/services/messaging.ts +1871 -0
  232. package/lib/commands/services/migrations.ts +421 -0
  233. package/lib/commands/services/project.ts +116 -0
  234. package/lib/commands/services/projects.ts +1317 -0
  235. package/lib/commands/services/proxy.ts +163 -0
  236. package/lib/commands/services/sites.ts +777 -0
  237. package/lib/commands/services/storage.ts +547 -0
  238. package/lib/commands/services/tablesdb.ts +1928 -0
  239. package/lib/commands/services/teams.ts +294 -0
  240. package/lib/commands/services/tokens.ts +106 -0
  241. package/lib/commands/services/users.ts +886 -0
  242. package/lib/commands/services/vcs.ts +268 -0
  243. package/lib/commands/types.ts +144 -117
  244. package/lib/commands/update.ts +198 -159
  245. package/lib/config.ts +815 -700
  246. package/lib/emulation/docker.ts +291 -244
  247. package/lib/emulation/utils.ts +188 -174
  248. package/lib/id.ts +23 -23
  249. package/lib/paginate.ts +69 -55
  250. package/lib/parser.ts +215 -189
  251. package/lib/questions.ts +1025 -948
  252. package/lib/sdks.ts +80 -51
  253. package/lib/services.ts +72 -0
  254. package/lib/spinner.ts +112 -99
  255. package/lib/type-generation/attribute.ts +15 -14
  256. package/lib/type-generation/languages/csharp.ts +71 -60
  257. package/lib/type-generation/languages/dart.ts +106 -93
  258. package/lib/type-generation/languages/java.ts +69 -58
  259. package/lib/type-generation/languages/javascript.ts +84 -73
  260. package/lib/type-generation/languages/kotlin.ts +71 -60
  261. package/lib/type-generation/languages/language.ts +103 -95
  262. package/lib/type-generation/languages/php.ts +67 -56
  263. package/lib/type-generation/languages/swift.ts +71 -60
  264. package/lib/type-generation/languages/typescript.ts +93 -76
  265. package/lib/types.ts +261 -107
  266. package/lib/utils.ts +263 -233
  267. package/lib/validations.ts +17 -14
  268. package/package.json +27 -19
  269. package/scoop/appwrite.config.json +19 -29
  270. package/scripts/generate-commands.ts +539 -0
  271. package/tsconfig.json +7 -13
  272. package/.github/workflows/autoclose.yml +0 -11
  273. package/dist/lib/commands/account.d.ts +0 -379
  274. package/dist/lib/commands/account.d.ts.map +0 -1
  275. package/dist/lib/commands/account.js +0 -1228
  276. package/dist/lib/commands/account.js.map +0 -1
  277. package/dist/lib/commands/console.d.ts +0 -20
  278. package/dist/lib/commands/console.d.ts.map +0 -1
  279. package/dist/lib/commands/console.js +0 -78
  280. package/dist/lib/commands/console.js.map +0 -1
  281. package/dist/lib/commands/databases.d.ts +0 -732
  282. package/dist/lib/commands/databases.d.ts.map +0 -1
  283. package/dist/lib/commands/databases.js +0 -2196
  284. package/dist/lib/commands/databases.js.map +0 -1
  285. package/dist/lib/commands/functions.d.ts +0 -310
  286. package/dist/lib/commands/functions.d.ts.map +0 -1
  287. package/dist/lib/commands/functions.js +0 -1100
  288. package/dist/lib/commands/functions.js.map +0 -1
  289. package/dist/lib/commands/graphql.d.ts +0 -19
  290. package/dist/lib/commands/graphql.d.ts.map +0 -1
  291. package/dist/lib/commands/graphql.js +0 -77
  292. package/dist/lib/commands/graphql.js.map +0 -1
  293. package/dist/lib/commands/health.d.ts +0 -153
  294. package/dist/lib/commands/health.d.ts.map +0 -1
  295. package/dist/lib/commands/health.js +0 -464
  296. package/dist/lib/commands/health.js.map +0 -1
  297. package/dist/lib/commands/locale.d.ts +0 -53
  298. package/dist/lib/commands/locale.d.ts.map +0 -1
  299. package/dist/lib/commands/locale.js +0 -165
  300. package/dist/lib/commands/locale.js.map +0 -1
  301. package/dist/lib/commands/messaging.d.ts +0 -588
  302. package/dist/lib/commands/messaging.d.ts.map +0 -1
  303. package/dist/lib/commands/messaging.js +0 -2042
  304. package/dist/lib/commands/messaging.js.map +0 -1
  305. package/dist/lib/commands/migrations.d.ts +0 -150
  306. package/dist/lib/commands/migrations.d.ts.map +0 -1
  307. package/dist/lib/commands/migrations.js +0 -524
  308. package/dist/lib/commands/migrations.js.map +0 -1
  309. package/dist/lib/commands/organizations.d.ts +0 -11
  310. package/dist/lib/commands/organizations.d.ts.map +0 -1
  311. package/dist/lib/commands/organizations.js +0 -31
  312. package/dist/lib/commands/organizations.js.map +0 -1
  313. package/dist/lib/commands/project.d.ts +0 -53
  314. package/dist/lib/commands/project.d.ts.map +0 -1
  315. package/dist/lib/commands/project.js +0 -176
  316. package/dist/lib/commands/project.js.map +0 -1
  317. package/dist/lib/commands/projects.d.ts +0 -516
  318. package/dist/lib/commands/projects.d.ts.map +0 -1
  319. package/dist/lib/commands/projects.js +0 -1590
  320. package/dist/lib/commands/projects.js.map +0 -1
  321. package/dist/lib/commands/proxy.d.ts +0 -71
  322. package/dist/lib/commands/proxy.d.ts.map +0 -1
  323. package/dist/lib/commands/proxy.js +0 -240
  324. package/dist/lib/commands/proxy.js.map +0 -1
  325. package/dist/lib/commands/sites.d.ts +0 -296
  326. package/dist/lib/commands/sites.d.ts.map +0 -1
  327. package/dist/lib/commands/sites.js +0 -1046
  328. package/dist/lib/commands/sites.js.map +0 -1
  329. package/dist/lib/commands/storage.d.ts +0 -170
  330. package/dist/lib/commands/storage.d.ts.map +0 -1
  331. package/dist/lib/commands/storage.js +0 -651
  332. package/dist/lib/commands/storage.js.map +0 -1
  333. package/dist/lib/commands/tables-db.d.ts +0 -728
  334. package/dist/lib/commands/tables-db.d.ts.map +0 -1
  335. package/dist/lib/commands/tables-db.js +0 -2198
  336. package/dist/lib/commands/tables-db.js.map +0 -1
  337. package/dist/lib/commands/teams.d.ts +0 -129
  338. package/dist/lib/commands/teams.d.ts.map +0 -1
  339. package/dist/lib/commands/teams.js +0 -403
  340. package/dist/lib/commands/teams.js.map +0 -1
  341. package/dist/lib/commands/tokens.d.ts +0 -48
  342. package/dist/lib/commands/tokens.d.ts.map +0 -1
  343. package/dist/lib/commands/tokens.js +0 -156
  344. package/dist/lib/commands/tokens.js.map +0 -1
  345. package/dist/lib/commands/users.d.ts +0 -382
  346. package/dist/lib/commands/users.d.ts.map +0 -1
  347. package/dist/lib/commands/users.js +0 -1195
  348. package/dist/lib/commands/users.js.map +0 -1
  349. package/dist/lib/commands/vcs.d.ts +0 -92
  350. package/dist/lib/commands/vcs.d.ts.map +0 -1
  351. package/dist/lib/commands/vcs.js +0 -276
  352. package/dist/lib/commands/vcs.js.map +0 -1
  353. package/dist/lib/exception.d.ts +0 -8
  354. package/dist/lib/exception.d.ts.map +0 -1
  355. package/dist/lib/exception.js +0 -16
  356. package/dist/lib/exception.js.map +0 -1
  357. package/docs/examples/account/create-anonymous-session.md +0 -1
  358. package/docs/examples/account/create-email-password-session.md +0 -3
  359. package/docs/examples/account/create-email-token.md +0 -3
  360. package/docs/examples/account/create-email-verification.md +0 -2
  361. package/docs/examples/account/create-jwt.md +0 -1
  362. package/docs/examples/account/create-magic-url-token.md +0 -3
  363. package/docs/examples/account/create-mfa-authenticator.md +0 -2
  364. package/docs/examples/account/create-mfa-challenge.md +0 -2
  365. package/docs/examples/account/create-mfa-recovery-codes.md +0 -1
  366. package/docs/examples/account/create-o-auth-2-session.md +0 -2
  367. package/docs/examples/account/create-o-auth-2-token.md +0 -2
  368. package/docs/examples/account/create-phone-token.md +0 -3
  369. package/docs/examples/account/create-phone-verification.md +0 -1
  370. package/docs/examples/account/create-push-target.md +0 -3
  371. package/docs/examples/account/create-recovery.md +0 -3
  372. package/docs/examples/account/create-session.md +0 -3
  373. package/docs/examples/account/create-verification.md +0 -2
  374. package/docs/examples/account/create.md +0 -4
  375. package/docs/examples/account/delete-identity.md +0 -2
  376. package/docs/examples/account/delete-mfa-authenticator.md +0 -2
  377. package/docs/examples/account/delete-push-target.md +0 -2
  378. package/docs/examples/account/delete-session.md +0 -2
  379. package/docs/examples/account/delete-sessions.md +0 -1
  380. package/docs/examples/account/delete.md +0 -1
  381. package/docs/examples/account/get-mfa-recovery-codes.md +0 -1
  382. package/docs/examples/account/get-prefs.md +0 -1
  383. package/docs/examples/account/get-session.md +0 -2
  384. package/docs/examples/account/get.md +0 -1
  385. package/docs/examples/account/list-identities.md +0 -1
  386. package/docs/examples/account/list-logs.md +0 -1
  387. package/docs/examples/account/list-mfa-factors.md +0 -1
  388. package/docs/examples/account/list-sessions.md +0 -1
  389. package/docs/examples/account/update-email-verification.md +0 -3
  390. package/docs/examples/account/update-email.md +0 -3
  391. package/docs/examples/account/update-magic-url-session.md +0 -3
  392. package/docs/examples/account/update-mfa-authenticator.md +0 -3
  393. package/docs/examples/account/update-mfa-challenge.md +0 -3
  394. package/docs/examples/account/update-mfa-recovery-codes.md +0 -1
  395. package/docs/examples/account/update-mfa.md +0 -2
  396. package/docs/examples/account/update-name.md +0 -2
  397. package/docs/examples/account/update-password.md +0 -2
  398. package/docs/examples/account/update-phone-session.md +0 -3
  399. package/docs/examples/account/update-phone-verification.md +0 -3
  400. package/docs/examples/account/update-phone.md +0 -3
  401. package/docs/examples/account/update-prefs.md +0 -2
  402. package/docs/examples/account/update-push-target.md +0 -3
  403. package/docs/examples/account/update-recovery.md +0 -4
  404. package/docs/examples/account/update-session.md +0 -2
  405. package/docs/examples/account/update-status.md +0 -1
  406. package/docs/examples/account/update-verification.md +0 -3
  407. package/docs/examples/console/get-resource.md +0 -3
  408. package/docs/examples/console/variables.md +0 -1
  409. package/docs/examples/databases/create-boolean-attribute.md +0 -5
  410. package/docs/examples/databases/create-collection.md +0 -4
  411. package/docs/examples/databases/create-datetime-attribute.md +0 -5
  412. package/docs/examples/databases/create-document.md +0 -5
  413. package/docs/examples/databases/create-documents.md +0 -4
  414. package/docs/examples/databases/create-email-attribute.md +0 -5
  415. package/docs/examples/databases/create-enum-attribute.md +0 -6
  416. package/docs/examples/databases/create-float-attribute.md +0 -5
  417. package/docs/examples/databases/create-index.md +0 -6
  418. package/docs/examples/databases/create-integer-attribute.md +0 -5
  419. package/docs/examples/databases/create-ip-attribute.md +0 -5
  420. package/docs/examples/databases/create-line-attribute.md +0 -5
  421. package/docs/examples/databases/create-operations.md +0 -2
  422. package/docs/examples/databases/create-point-attribute.md +0 -5
  423. package/docs/examples/databases/create-polygon-attribute.md +0 -5
  424. package/docs/examples/databases/create-relationship-attribute.md +0 -5
  425. package/docs/examples/databases/create-string-attribute.md +0 -6
  426. package/docs/examples/databases/create-transaction.md +0 -1
  427. package/docs/examples/databases/create-url-attribute.md +0 -5
  428. package/docs/examples/databases/create.md +0 -3
  429. package/docs/examples/databases/decrement-document-attribute.md +0 -5
  430. package/docs/examples/databases/delete-attribute.md +0 -4
  431. package/docs/examples/databases/delete-collection.md +0 -3
  432. package/docs/examples/databases/delete-document.md +0 -4
  433. package/docs/examples/databases/delete-documents.md +0 -3
  434. package/docs/examples/databases/delete-index.md +0 -4
  435. package/docs/examples/databases/delete-transaction.md +0 -2
  436. package/docs/examples/databases/delete.md +0 -2
  437. package/docs/examples/databases/get-attribute.md +0 -4
  438. package/docs/examples/databases/get-collection-usage.md +0 -3
  439. package/docs/examples/databases/get-collection.md +0 -3
  440. package/docs/examples/databases/get-document.md +0 -4
  441. package/docs/examples/databases/get-index.md +0 -4
  442. package/docs/examples/databases/get-transaction.md +0 -2
  443. package/docs/examples/databases/get-usage.md +0 -2
  444. package/docs/examples/databases/get.md +0 -2
  445. package/docs/examples/databases/increment-document-attribute.md +0 -5
  446. package/docs/examples/databases/list-attributes.md +0 -3
  447. package/docs/examples/databases/list-collection-logs.md +0 -3
  448. package/docs/examples/databases/list-collections.md +0 -2
  449. package/docs/examples/databases/list-document-logs.md +0 -4
  450. package/docs/examples/databases/list-documents.md +0 -3
  451. package/docs/examples/databases/list-indexes.md +0 -3
  452. package/docs/examples/databases/list-logs.md +0 -2
  453. package/docs/examples/databases/list-transactions.md +0 -1
  454. package/docs/examples/databases/list-usage.md +0 -1
  455. package/docs/examples/databases/list.md +0 -1
  456. package/docs/examples/databases/update-boolean-attribute.md +0 -6
  457. package/docs/examples/databases/update-collection.md +0 -4
  458. package/docs/examples/databases/update-datetime-attribute.md +0 -6
  459. package/docs/examples/databases/update-document.md +0 -4
  460. package/docs/examples/databases/update-documents.md +0 -3
  461. package/docs/examples/databases/update-email-attribute.md +0 -6
  462. package/docs/examples/databases/update-enum-attribute.md +0 -7
  463. package/docs/examples/databases/update-float-attribute.md +0 -6
  464. package/docs/examples/databases/update-integer-attribute.md +0 -6
  465. package/docs/examples/databases/update-ip-attribute.md +0 -6
  466. package/docs/examples/databases/update-line-attribute.md +0 -5
  467. package/docs/examples/databases/update-point-attribute.md +0 -5
  468. package/docs/examples/databases/update-polygon-attribute.md +0 -5
  469. package/docs/examples/databases/update-relationship-attribute.md +0 -4
  470. package/docs/examples/databases/update-string-attribute.md +0 -6
  471. package/docs/examples/databases/update-transaction.md +0 -2
  472. package/docs/examples/databases/update-url-attribute.md +0 -6
  473. package/docs/examples/databases/update.md +0 -3
  474. package/docs/examples/databases/upsert-document.md +0 -4
  475. package/docs/examples/databases/upsert-documents.md +0 -4
  476. package/docs/examples/functions/create-deployment.md +0 -4
  477. package/docs/examples/functions/create-duplicate-deployment.md +0 -3
  478. package/docs/examples/functions/create-execution.md +0 -2
  479. package/docs/examples/functions/create-template-deployment.md +0 -7
  480. package/docs/examples/functions/create-variable.md +0 -4
  481. package/docs/examples/functions/create-vcs-deployment.md +0 -4
  482. package/docs/examples/functions/create.md +0 -4
  483. package/docs/examples/functions/delete-deployment.md +0 -3
  484. package/docs/examples/functions/delete-execution.md +0 -3
  485. package/docs/examples/functions/delete-variable.md +0 -3
  486. package/docs/examples/functions/delete.md +0 -2
  487. package/docs/examples/functions/get-deployment-download.md +0 -3
  488. package/docs/examples/functions/get-deployment.md +0 -3
  489. package/docs/examples/functions/get-execution.md +0 -3
  490. package/docs/examples/functions/get-template.md +0 -2
  491. package/docs/examples/functions/get-usage.md +0 -2
  492. package/docs/examples/functions/get-variable.md +0 -3
  493. package/docs/examples/functions/get.md +0 -2
  494. package/docs/examples/functions/list-deployments.md +0 -2
  495. package/docs/examples/functions/list-executions.md +0 -2
  496. package/docs/examples/functions/list-runtimes.md +0 -1
  497. package/docs/examples/functions/list-specifications.md +0 -1
  498. package/docs/examples/functions/list-templates.md +0 -1
  499. package/docs/examples/functions/list-usage.md +0 -1
  500. package/docs/examples/functions/list-variables.md +0 -2
  501. package/docs/examples/functions/list.md +0 -1
  502. package/docs/examples/functions/update-deployment-status.md +0 -3
  503. package/docs/examples/functions/update-function-deployment.md +0 -3
  504. package/docs/examples/functions/update-variable.md +0 -4
  505. package/docs/examples/functions/update.md +0 -3
  506. package/docs/examples/graphql/mutation.md +0 -2
  507. package/docs/examples/graphql/query.md +0 -2
  508. package/docs/examples/health/get-antivirus.md +0 -1
  509. package/docs/examples/health/get-cache.md +0 -1
  510. package/docs/examples/health/get-certificate.md +0 -1
  511. package/docs/examples/health/get-db.md +0 -1
  512. package/docs/examples/health/get-failed-jobs.md +0 -2
  513. package/docs/examples/health/get-pub-sub.md +0 -1
  514. package/docs/examples/health/get-queue-builds.md +0 -1
  515. package/docs/examples/health/get-queue-certificates.md +0 -1
  516. package/docs/examples/health/get-queue-databases.md +0 -1
  517. package/docs/examples/health/get-queue-deletes.md +0 -1
  518. package/docs/examples/health/get-queue-functions.md +0 -1
  519. package/docs/examples/health/get-queue-logs.md +0 -1
  520. package/docs/examples/health/get-queue-mails.md +0 -1
  521. package/docs/examples/health/get-queue-messaging.md +0 -1
  522. package/docs/examples/health/get-queue-migrations.md +0 -1
  523. package/docs/examples/health/get-queue-stats-resources.md +0 -1
  524. package/docs/examples/health/get-queue-usage.md +0 -1
  525. package/docs/examples/health/get-queue-webhooks.md +0 -1
  526. package/docs/examples/health/get-storage-local.md +0 -1
  527. package/docs/examples/health/get-storage.md +0 -1
  528. package/docs/examples/health/get-time.md +0 -1
  529. package/docs/examples/health/get.md +0 -1
  530. package/docs/examples/locale/get.md +0 -1
  531. package/docs/examples/locale/list-codes.md +0 -1
  532. package/docs/examples/locale/list-continents.md +0 -1
  533. package/docs/examples/locale/list-countries-eu.md +0 -1
  534. package/docs/examples/locale/list-countries-phones.md +0 -1
  535. package/docs/examples/locale/list-countries.md +0 -1
  536. package/docs/examples/locale/list-currencies.md +0 -1
  537. package/docs/examples/locale/list-languages.md +0 -1
  538. package/docs/examples/messaging/create-apns-provider.md +0 -3
  539. package/docs/examples/messaging/create-email.md +0 -4
  540. package/docs/examples/messaging/create-fcm-provider.md +0 -3
  541. package/docs/examples/messaging/create-mailgun-provider.md +0 -3
  542. package/docs/examples/messaging/create-msg-91-provider.md +0 -3
  543. package/docs/examples/messaging/create-push.md +0 -2
  544. package/docs/examples/messaging/create-resend-provider.md +0 -3
  545. package/docs/examples/messaging/create-sendgrid-provider.md +0 -3
  546. package/docs/examples/messaging/create-sms.md +0 -3
  547. package/docs/examples/messaging/create-smtp-provider.md +0 -4
  548. package/docs/examples/messaging/create-subscriber.md +0 -4
  549. package/docs/examples/messaging/create-telesign-provider.md +0 -3
  550. package/docs/examples/messaging/create-textmagic-provider.md +0 -3
  551. package/docs/examples/messaging/create-topic.md +0 -3
  552. package/docs/examples/messaging/create-twilio-provider.md +0 -3
  553. package/docs/examples/messaging/create-vonage-provider.md +0 -3
  554. package/docs/examples/messaging/delete-provider.md +0 -2
  555. package/docs/examples/messaging/delete-subscriber.md +0 -3
  556. package/docs/examples/messaging/delete-topic.md +0 -2
  557. package/docs/examples/messaging/delete.md +0 -2
  558. package/docs/examples/messaging/get-message.md +0 -2
  559. package/docs/examples/messaging/get-provider.md +0 -2
  560. package/docs/examples/messaging/get-subscriber.md +0 -3
  561. package/docs/examples/messaging/get-topic.md +0 -2
  562. package/docs/examples/messaging/list-message-logs.md +0 -2
  563. package/docs/examples/messaging/list-messages.md +0 -1
  564. package/docs/examples/messaging/list-provider-logs.md +0 -2
  565. package/docs/examples/messaging/list-providers.md +0 -1
  566. package/docs/examples/messaging/list-subscriber-logs.md +0 -2
  567. package/docs/examples/messaging/list-subscribers.md +0 -2
  568. package/docs/examples/messaging/list-targets.md +0 -2
  569. package/docs/examples/messaging/list-topic-logs.md +0 -2
  570. package/docs/examples/messaging/list-topics.md +0 -1
  571. package/docs/examples/messaging/update-apns-provider.md +0 -2
  572. package/docs/examples/messaging/update-email.md +0 -2
  573. package/docs/examples/messaging/update-fcm-provider.md +0 -2
  574. package/docs/examples/messaging/update-mailgun-provider.md +0 -2
  575. package/docs/examples/messaging/update-msg-91-provider.md +0 -2
  576. package/docs/examples/messaging/update-push.md +0 -2
  577. package/docs/examples/messaging/update-resend-provider.md +0 -2
  578. package/docs/examples/messaging/update-sendgrid-provider.md +0 -2
  579. package/docs/examples/messaging/update-sms.md +0 -2
  580. package/docs/examples/messaging/update-smtp-provider.md +0 -2
  581. package/docs/examples/messaging/update-telesign-provider.md +0 -2
  582. package/docs/examples/messaging/update-textmagic-provider.md +0 -2
  583. package/docs/examples/messaging/update-topic.md +0 -2
  584. package/docs/examples/messaging/update-twilio-provider.md +0 -2
  585. package/docs/examples/messaging/update-vonage-provider.md +0 -2
  586. package/docs/examples/migrations/create-appwrite-migration.md +0 -5
  587. package/docs/examples/migrations/create-csv-export.md +0 -3
  588. package/docs/examples/migrations/create-csv-import.md +0 -4
  589. package/docs/examples/migrations/create-firebase-migration.md +0 -3
  590. package/docs/examples/migrations/create-n-host-migration.md +0 -8
  591. package/docs/examples/migrations/create-supabase-migration.md +0 -7
  592. package/docs/examples/migrations/delete.md +0 -2
  593. package/docs/examples/migrations/get-appwrite-report.md +0 -5
  594. package/docs/examples/migrations/get-firebase-report.md +0 -3
  595. package/docs/examples/migrations/get-n-host-report.md +0 -8
  596. package/docs/examples/migrations/get-supabase-report.md +0 -7
  597. package/docs/examples/migrations/get.md +0 -2
  598. package/docs/examples/migrations/list.md +0 -1
  599. package/docs/examples/migrations/retry.md +0 -2
  600. package/docs/examples/project/create-variable.md +0 -3
  601. package/docs/examples/project/delete-variable.md +0 -2
  602. package/docs/examples/project/get-usage.md +0 -3
  603. package/docs/examples/project/get-variable.md +0 -2
  604. package/docs/examples/project/list-variables.md +0 -1
  605. package/docs/examples/project/update-variable.md +0 -3
  606. package/docs/examples/projects/create-dev-key.md +0 -4
  607. package/docs/examples/projects/create-jwt.md +0 -3
  608. package/docs/examples/projects/create-key.md +0 -4
  609. package/docs/examples/projects/create-platform.md +0 -4
  610. package/docs/examples/projects/create-smtp-test.md +0 -6
  611. package/docs/examples/projects/create-webhook.md +0 -6
  612. package/docs/examples/projects/create.md +0 -4
  613. package/docs/examples/projects/delete-dev-key.md +0 -3
  614. package/docs/examples/projects/delete-email-template.md +0 -4
  615. package/docs/examples/projects/delete-key.md +0 -3
  616. package/docs/examples/projects/delete-platform.md +0 -3
  617. package/docs/examples/projects/delete-sms-template.md +0 -4
  618. package/docs/examples/projects/delete-webhook.md +0 -3
  619. package/docs/examples/projects/delete.md +0 -2
  620. package/docs/examples/projects/get-dev-key.md +0 -3
  621. package/docs/examples/projects/get-email-template.md +0 -4
  622. package/docs/examples/projects/get-key.md +0 -3
  623. package/docs/examples/projects/get-platform.md +0 -3
  624. package/docs/examples/projects/get-sms-template.md +0 -4
  625. package/docs/examples/projects/get-webhook.md +0 -3
  626. package/docs/examples/projects/get.md +0 -2
  627. package/docs/examples/projects/list-dev-keys.md +0 -2
  628. package/docs/examples/projects/list-keys.md +0 -2
  629. package/docs/examples/projects/list-platforms.md +0 -2
  630. package/docs/examples/projects/list-webhooks.md +0 -2
  631. package/docs/examples/projects/list.md +0 -1
  632. package/docs/examples/projects/update-api-status-all.md +0 -3
  633. package/docs/examples/projects/update-api-status.md +0 -4
  634. package/docs/examples/projects/update-auth-duration.md +0 -3
  635. package/docs/examples/projects/update-auth-limit.md +0 -3
  636. package/docs/examples/projects/update-auth-password-dictionary.md +0 -3
  637. package/docs/examples/projects/update-auth-password-history.md +0 -3
  638. package/docs/examples/projects/update-auth-sessions-limit.md +0 -3
  639. package/docs/examples/projects/update-auth-status.md +0 -4
  640. package/docs/examples/projects/update-dev-key.md +0 -5
  641. package/docs/examples/projects/update-email-template.md +0 -6
  642. package/docs/examples/projects/update-key.md +0 -5
  643. package/docs/examples/projects/update-memberships-privacy.md +0 -5
  644. package/docs/examples/projects/update-mock-numbers.md +0 -3
  645. package/docs/examples/projects/update-o-auth-2.md +0 -3
  646. package/docs/examples/projects/update-personal-data-check.md +0 -3
  647. package/docs/examples/projects/update-platform.md +0 -4
  648. package/docs/examples/projects/update-service-status-all.md +0 -3
  649. package/docs/examples/projects/update-service-status.md +0 -4
  650. package/docs/examples/projects/update-session-alerts.md +0 -3
  651. package/docs/examples/projects/update-session-invalidation.md +0 -3
  652. package/docs/examples/projects/update-sms-template.md +0 -5
  653. package/docs/examples/projects/update-smtp.md +0 -3
  654. package/docs/examples/projects/update-team.md +0 -3
  655. package/docs/examples/projects/update-webhook-signature.md +0 -3
  656. package/docs/examples/projects/update-webhook.md +0 -7
  657. package/docs/examples/projects/update.md +0 -3
  658. package/docs/examples/proxy/create-api-rule.md +0 -2
  659. package/docs/examples/proxy/create-function-rule.md +0 -3
  660. package/docs/examples/proxy/create-redirect-rule.md +0 -6
  661. package/docs/examples/proxy/create-site-rule.md +0 -3
  662. package/docs/examples/proxy/delete-rule.md +0 -2
  663. package/docs/examples/proxy/get-rule.md +0 -2
  664. package/docs/examples/proxy/list-rules.md +0 -1
  665. package/docs/examples/proxy/update-rule-verification.md +0 -2
  666. package/docs/examples/sites/create-deployment.md +0 -4
  667. package/docs/examples/sites/create-duplicate-deployment.md +0 -3
  668. package/docs/examples/sites/create-template-deployment.md +0 -7
  669. package/docs/examples/sites/create-variable.md +0 -4
  670. package/docs/examples/sites/create-vcs-deployment.md +0 -4
  671. package/docs/examples/sites/create.md +0 -5
  672. package/docs/examples/sites/delete-deployment.md +0 -3
  673. package/docs/examples/sites/delete-log.md +0 -3
  674. package/docs/examples/sites/delete-variable.md +0 -3
  675. package/docs/examples/sites/delete.md +0 -2
  676. package/docs/examples/sites/get-deployment-download.md +0 -3
  677. package/docs/examples/sites/get-deployment.md +0 -3
  678. package/docs/examples/sites/get-log.md +0 -3
  679. package/docs/examples/sites/get-template.md +0 -2
  680. package/docs/examples/sites/get-usage.md +0 -2
  681. package/docs/examples/sites/get-variable.md +0 -3
  682. package/docs/examples/sites/get.md +0 -2
  683. package/docs/examples/sites/list-deployments.md +0 -2
  684. package/docs/examples/sites/list-frameworks.md +0 -1
  685. package/docs/examples/sites/list-logs.md +0 -2
  686. package/docs/examples/sites/list-specifications.md +0 -1
  687. package/docs/examples/sites/list-templates.md +0 -1
  688. package/docs/examples/sites/list-usage.md +0 -1
  689. package/docs/examples/sites/list-variables.md +0 -2
  690. package/docs/examples/sites/list.md +0 -1
  691. package/docs/examples/sites/update-deployment-status.md +0 -3
  692. package/docs/examples/sites/update-site-deployment.md +0 -3
  693. package/docs/examples/sites/update-variable.md +0 -4
  694. package/docs/examples/sites/update.md +0 -4
  695. package/docs/examples/storage/create-bucket.md +0 -3
  696. package/docs/examples/storage/create-file.md +0 -4
  697. package/docs/examples/storage/delete-bucket.md +0 -2
  698. package/docs/examples/storage/delete-file.md +0 -3
  699. package/docs/examples/storage/get-bucket-usage.md +0 -2
  700. package/docs/examples/storage/get-bucket.md +0 -2
  701. package/docs/examples/storage/get-file-download.md +0 -3
  702. package/docs/examples/storage/get-file-preview.md +0 -3
  703. package/docs/examples/storage/get-file-view.md +0 -3
  704. package/docs/examples/storage/get-file.md +0 -3
  705. package/docs/examples/storage/get-usage.md +0 -1
  706. package/docs/examples/storage/list-buckets.md +0 -1
  707. package/docs/examples/storage/list-files.md +0 -2
  708. package/docs/examples/storage/update-bucket.md +0 -3
  709. package/docs/examples/storage/update-file.md +0 -3
  710. package/docs/examples/tablesdb/create-boolean-column.md +0 -5
  711. package/docs/examples/tablesdb/create-datetime-column.md +0 -5
  712. package/docs/examples/tablesdb/create-email-column.md +0 -5
  713. package/docs/examples/tablesdb/create-enum-column.md +0 -6
  714. package/docs/examples/tablesdb/create-float-column.md +0 -5
  715. package/docs/examples/tablesdb/create-index.md +0 -6
  716. package/docs/examples/tablesdb/create-integer-column.md +0 -5
  717. package/docs/examples/tablesdb/create-ip-column.md +0 -5
  718. package/docs/examples/tablesdb/create-line-column.md +0 -5
  719. package/docs/examples/tablesdb/create-operations.md +0 -2
  720. package/docs/examples/tablesdb/create-point-column.md +0 -5
  721. package/docs/examples/tablesdb/create-polygon-column.md +0 -5
  722. package/docs/examples/tablesdb/create-relationship-column.md +0 -5
  723. package/docs/examples/tablesdb/create-row.md +0 -5
  724. package/docs/examples/tablesdb/create-rows.md +0 -4
  725. package/docs/examples/tablesdb/create-string-column.md +0 -6
  726. package/docs/examples/tablesdb/create-table.md +0 -4
  727. package/docs/examples/tablesdb/create-transaction.md +0 -1
  728. package/docs/examples/tablesdb/create-url-column.md +0 -5
  729. package/docs/examples/tablesdb/create.md +0 -3
  730. package/docs/examples/tablesdb/decrement-row-column.md +0 -5
  731. package/docs/examples/tablesdb/delete-column.md +0 -4
  732. package/docs/examples/tablesdb/delete-index.md +0 -4
  733. package/docs/examples/tablesdb/delete-row.md +0 -4
  734. package/docs/examples/tablesdb/delete-rows.md +0 -3
  735. package/docs/examples/tablesdb/delete-table.md +0 -3
  736. package/docs/examples/tablesdb/delete-transaction.md +0 -2
  737. package/docs/examples/tablesdb/delete.md +0 -2
  738. package/docs/examples/tablesdb/get-column.md +0 -4
  739. package/docs/examples/tablesdb/get-index.md +0 -4
  740. package/docs/examples/tablesdb/get-row.md +0 -4
  741. package/docs/examples/tablesdb/get-table-usage.md +0 -3
  742. package/docs/examples/tablesdb/get-table.md +0 -3
  743. package/docs/examples/tablesdb/get-transaction.md +0 -2
  744. package/docs/examples/tablesdb/get-usage.md +0 -2
  745. package/docs/examples/tablesdb/get.md +0 -2
  746. package/docs/examples/tablesdb/increment-row-column.md +0 -5
  747. package/docs/examples/tablesdb/list-columns.md +0 -3
  748. package/docs/examples/tablesdb/list-indexes.md +0 -3
  749. package/docs/examples/tablesdb/list-row-logs.md +0 -4
  750. package/docs/examples/tablesdb/list-rows.md +0 -3
  751. package/docs/examples/tablesdb/list-table-logs.md +0 -3
  752. package/docs/examples/tablesdb/list-tables.md +0 -2
  753. package/docs/examples/tablesdb/list-transactions.md +0 -1
  754. package/docs/examples/tablesdb/list-usage.md +0 -1
  755. package/docs/examples/tablesdb/list.md +0 -1
  756. package/docs/examples/tablesdb/update-boolean-column.md +0 -6
  757. package/docs/examples/tablesdb/update-datetime-column.md +0 -6
  758. package/docs/examples/tablesdb/update-email-column.md +0 -6
  759. package/docs/examples/tablesdb/update-enum-column.md +0 -7
  760. package/docs/examples/tablesdb/update-float-column.md +0 -6
  761. package/docs/examples/tablesdb/update-integer-column.md +0 -6
  762. package/docs/examples/tablesdb/update-ip-column.md +0 -6
  763. package/docs/examples/tablesdb/update-line-column.md +0 -5
  764. package/docs/examples/tablesdb/update-point-column.md +0 -5
  765. package/docs/examples/tablesdb/update-polygon-column.md +0 -5
  766. package/docs/examples/tablesdb/update-relationship-column.md +0 -4
  767. package/docs/examples/tablesdb/update-row.md +0 -4
  768. package/docs/examples/tablesdb/update-rows.md +0 -3
  769. package/docs/examples/tablesdb/update-string-column.md +0 -6
  770. package/docs/examples/tablesdb/update-table.md +0 -4
  771. package/docs/examples/tablesdb/update-transaction.md +0 -2
  772. package/docs/examples/tablesdb/update-url-column.md +0 -6
  773. package/docs/examples/tablesdb/update.md +0 -3
  774. package/docs/examples/tablesdb/upsert-row.md +0 -4
  775. package/docs/examples/tablesdb/upsert-rows.md +0 -4
  776. package/docs/examples/teams/create-membership.md +0 -3
  777. package/docs/examples/teams/create.md +0 -3
  778. package/docs/examples/teams/delete-membership.md +0 -3
  779. package/docs/examples/teams/delete.md +0 -2
  780. package/docs/examples/teams/get-membership.md +0 -3
  781. package/docs/examples/teams/get-prefs.md +0 -2
  782. package/docs/examples/teams/get.md +0 -2
  783. package/docs/examples/teams/list-logs.md +0 -2
  784. package/docs/examples/teams/list-memberships.md +0 -2
  785. package/docs/examples/teams/list.md +0 -1
  786. package/docs/examples/teams/update-membership-status.md +0 -5
  787. package/docs/examples/teams/update-membership.md +0 -4
  788. package/docs/examples/teams/update-name.md +0 -3
  789. package/docs/examples/teams/update-prefs.md +0 -3
  790. package/docs/examples/tokens/create-file-token.md +0 -3
  791. package/docs/examples/tokens/delete.md +0 -2
  792. package/docs/examples/tokens/get.md +0 -2
  793. package/docs/examples/tokens/list.md +0 -3
  794. package/docs/examples/tokens/update.md +0 -2
  795. package/docs/examples/users/create-argon-2-user.md +0 -4
  796. package/docs/examples/users/create-bcrypt-user.md +0 -4
  797. package/docs/examples/users/create-jwt.md +0 -2
  798. package/docs/examples/users/create-md-5-user.md +0 -4
  799. package/docs/examples/users/create-mfa-recovery-codes.md +0 -2
  800. package/docs/examples/users/create-ph-pass-user.md +0 -4
  801. package/docs/examples/users/create-scrypt-modified-user.md +0 -7
  802. package/docs/examples/users/create-scrypt-user.md +0 -9
  803. package/docs/examples/users/create-session.md +0 -2
  804. package/docs/examples/users/create-sha-user.md +0 -4
  805. package/docs/examples/users/create-target.md +0 -5
  806. package/docs/examples/users/create-token.md +0 -2
  807. package/docs/examples/users/create.md +0 -2
  808. package/docs/examples/users/delete-identity.md +0 -2
  809. package/docs/examples/users/delete-mfa-authenticator.md +0 -3
  810. package/docs/examples/users/delete-session.md +0 -3
  811. package/docs/examples/users/delete-sessions.md +0 -2
  812. package/docs/examples/users/delete-target.md +0 -3
  813. package/docs/examples/users/delete.md +0 -2
  814. package/docs/examples/users/get-mfa-recovery-codes.md +0 -2
  815. package/docs/examples/users/get-prefs.md +0 -2
  816. package/docs/examples/users/get-target.md +0 -3
  817. package/docs/examples/users/get-usage.md +0 -1
  818. package/docs/examples/users/get.md +0 -2
  819. package/docs/examples/users/list-identities.md +0 -1
  820. package/docs/examples/users/list-logs.md +0 -2
  821. package/docs/examples/users/list-memberships.md +0 -2
  822. package/docs/examples/users/list-mfa-factors.md +0 -2
  823. package/docs/examples/users/list-sessions.md +0 -2
  824. package/docs/examples/users/list-targets.md +0 -2
  825. package/docs/examples/users/list.md +0 -1
  826. package/docs/examples/users/update-email-verification.md +0 -3
  827. package/docs/examples/users/update-email.md +0 -3
  828. package/docs/examples/users/update-labels.md +0 -3
  829. package/docs/examples/users/update-mfa-recovery-codes.md +0 -2
  830. package/docs/examples/users/update-mfa.md +0 -3
  831. package/docs/examples/users/update-name.md +0 -3
  832. package/docs/examples/users/update-password.md +0 -3
  833. package/docs/examples/users/update-phone-verification.md +0 -3
  834. package/docs/examples/users/update-phone.md +0 -3
  835. package/docs/examples/users/update-prefs.md +0 -3
  836. package/docs/examples/users/update-status.md +0 -3
  837. package/docs/examples/users/update-target.md +0 -3
  838. package/docs/examples/vcs/create-repository-detection.md +0 -4
  839. package/docs/examples/vcs/create-repository.md +0 -4
  840. package/docs/examples/vcs/delete-installation.md +0 -2
  841. package/docs/examples/vcs/get-installation.md +0 -2
  842. package/docs/examples/vcs/get-repository-contents.md +0 -3
  843. package/docs/examples/vcs/get-repository.md +0 -3
  844. package/docs/examples/vcs/list-installations.md +0 -1
  845. package/docs/examples/vcs/list-repositories.md +0 -3
  846. package/docs/examples/vcs/list-repository-branches.md +0 -3
  847. package/docs/examples/vcs/update-external-deployments.md +0 -4
  848. package/lib/commands/account.ts +0 -1867
  849. package/lib/commands/console.ts +0 -112
  850. package/lib/commands/databases.ts +0 -3272
  851. package/lib/commands/functions.ts +0 -1587
  852. package/lib/commands/graphql.ts +0 -110
  853. package/lib/commands/health.ts +0 -753
  854. package/lib/commands/locale.ts +0 -270
  855. package/lib/commands/messaging.ts +0 -2878
  856. package/lib/commands/migrations.ts +0 -754
  857. package/lib/commands/organizations.ts +0 -46
  858. package/lib/commands/project.ts +0 -266
  859. package/lib/commands/projects.ts +0 -2370
  860. package/lib/commands/proxy.ts +0 -357
  861. package/lib/commands/sites.ts +0 -1514
  862. package/lib/commands/storage.ts +0 -919
  863. package/lib/commands/tables-db.ts +0 -3260
  864. package/lib/commands/teams.ts +0 -609
  865. package/lib/commands/tokens.ts +0 -232
  866. package/lib/commands/users.ts +0 -1804
  867. package/lib/commands/vcs.ts +0 -428
  868. package/lib/exception.ts +0 -20
@@ -1,51 +1,38 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.deploy = exports.push = void 0;
7
- const fs = require("fs");
8
- const dotenv_1 = require("dotenv");
9
- const chalk_1 = __importDefault(require("chalk"));
10
- const inquirer_1 = __importDefault(require("inquirer"));
11
- const json_bigint_1 = __importDefault(require("json-bigint"));
12
- const commander_1 = require("commander");
13
- const id_1 = __importDefault(require("../id"));
14
- const config_1 = require("../config");
15
- const spinner_1 = require("../spinner");
16
- const paginate_1 = require("../paginate");
17
- const questions_1 = require("../questions");
18
- const parser_1 = require("../parser");
19
- const proxy_1 = require("./proxy");
20
- const console_1 = require("./console");
21
- const sdks_1 = require("../sdks");
22
- const functions_1 = require("./functions");
23
- const sites_1 = require("./sites");
24
- const databases_1 = require("./databases");
25
- const tables_db_1 = require("./tables-db");
26
- const storage_1 = require("./storage");
27
- const messaging_1 = require("./messaging");
28
- const teams_1 = require("./teams");
29
- const projects_1 = require("./projects");
30
- const utils_1 = require("../utils");
31
- const JSONbigNative = (0, json_bigint_1.default)({ storeAsString: false });
1
+ import fs from "fs";
2
+ import { parse as parseDotenv } from "dotenv";
3
+ import chalk from "chalk";
4
+ import inquirer from "inquirer";
5
+ import { Command } from "commander";
6
+ import ID from "../id.js";
7
+ import { localConfig, globalConfig, KeysAttributes, KeysFunction, KeysSite, whitelistKeys, KeysTopics, KeysStorage, KeysTeams, KeysCollection, KeysTable, } from "../config.js";
8
+ import { Spinner, SPINNER_ARC, SPINNER_DOTS } from "../spinner.js";
9
+ import { paginate } from "../paginate.js";
10
+ import { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsPushSites, questionsGetEntrypoint, questionsPushCollections, questionsPushTables, questionPushChanges, questionPushChangesConfirmation, questionsPushMessagingTopics, questionsPushResources, } from "../questions.js";
11
+ import { cliConfig, actionRunner, success, warn, log, hint, error, commandDescriptions, drawTable, } from "../parser.js";
12
+ import { getProxyService, getConsoleService, getFunctionsService, getSitesService, getDatabasesService, getTablesDBService, getStorageService, getMessagingService, getTeamsService, getProjectsService, } from "../services.js";
13
+ import { checkDeployConditions } from "../utils.js";
32
14
  const STEP_SIZE = 100; // Resources
33
15
  const POLL_DEBOUNCE = 2000; // Milliseconds
34
- const POLL_MAX_DEBOUNCE = 1800; // Times of POLL_DEBOUNCE (1 hour)
35
16
  const POLL_DEFAULT_VALUE = 30;
36
17
  let pollMaxDebounces = POLL_DEFAULT_VALUE;
37
- const changeableKeys = ['status', 'required', 'xdefault', 'elements', 'min', 'max', 'default', 'error'];
18
+ const changeableKeys = [
19
+ "status",
20
+ "required",
21
+ "xdefault",
22
+ "elements",
23
+ "min",
24
+ "max",
25
+ "default",
26
+ "error",
27
+ ];
38
28
  const awaitPools = {
39
29
  wipeAttributes: async (databaseId, collectionId, iteration = 1) => {
40
30
  if (iteration > pollMaxDebounces) {
41
31
  return false;
42
32
  }
43
- const { total } = await (0, databases_1.databasesListAttributes)({
44
- databaseId,
45
- collectionId,
46
- queries: [JSON.stringify({ method: 'limit', values: [1] })],
47
- parseOutput: false
48
- });
33
+ const databasesService = await getDatabasesService();
34
+ const response = await databasesService.listAttributes(databaseId, collectionId, [JSON.stringify({ method: "limit", values: [1] })]);
35
+ const { total } = response;
49
36
  if (total === 0) {
50
37
  return true;
51
38
  }
@@ -53,22 +40,21 @@ const awaitPools = {
53
40
  let steps = Math.max(1, Math.ceil(total / STEP_SIZE));
54
41
  if (steps > 1 && iteration === 1) {
55
42
  pollMaxDebounces *= steps;
56
- (0, parser_1.log)('Found a large number of attributes, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes');
43
+ log("Found a large number of attributes, increasing timeout to " +
44
+ (pollMaxDebounces * POLL_DEBOUNCE) / 1000 / 60 +
45
+ " minutes");
57
46
  }
58
47
  }
59
- await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE));
48
+ await new Promise((resolve) => setTimeout(resolve, POLL_DEBOUNCE));
60
49
  return await awaitPools.wipeAttributes(databaseId, collectionId, iteration + 1);
61
50
  },
62
51
  wipeIndexes: async (databaseId, collectionId, iteration = 1) => {
63
52
  if (iteration > pollMaxDebounces) {
64
53
  return false;
65
54
  }
66
- const { total } = await (0, databases_1.databasesListIndexes)({
67
- databaseId,
68
- collectionId,
69
- queries: [JSON.stringify({ method: 'limit', values: [1] })],
70
- parseOutput: false
71
- });
55
+ const databasesService = await getDatabasesService();
56
+ const response = await databasesService.listIndexes(databaseId, collectionId, [JSON.stringify({ method: "limit", values: [1] })]);
57
+ const { total } = response;
72
58
  if (total === 0) {
73
59
  return true;
74
60
  }
@@ -76,10 +62,12 @@ const awaitPools = {
76
62
  let steps = Math.max(1, Math.ceil(total / STEP_SIZE));
77
63
  if (steps > 1 && iteration === 1) {
78
64
  pollMaxDebounces *= steps;
79
- (0, parser_1.log)('Found a large number of indexes, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes');
65
+ log("Found a large number of indexes, increasing timeout to " +
66
+ (pollMaxDebounces * POLL_DEBOUNCE) / 1000 / 60 +
67
+ " minutes");
80
68
  }
81
69
  }
82
- await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE));
70
+ await new Promise((resolve) => setTimeout(resolve, POLL_DEBOUNCE));
83
71
  return await awaitPools.wipeIndexes(databaseId, collectionId, iteration + 1);
84
72
  },
85
73
  deleteAttributes: async (databaseId, collectionId, attributeKeys, iteration = 1) => {
@@ -90,19 +78,23 @@ const awaitPools = {
90
78
  let steps = Math.max(1, Math.ceil(attributeKeys.length / STEP_SIZE));
91
79
  if (steps > 1 && iteration === 1) {
92
80
  pollMaxDebounces *= steps;
93
- (0, parser_1.log)('Found a large number of attributes to be deleted. Increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes');
81
+ log("Found a large number of attributes to be deleted. Increasing timeout to " +
82
+ (pollMaxDebounces * POLL_DEBOUNCE) / 1000 / 60 +
83
+ " minutes");
94
84
  }
95
85
  }
96
- const { attributes } = await (0, paginate_1.paginate)(databases_1.databasesListAttributes, {
86
+ const { attributes } = await paginate(async (args) => {
87
+ const databasesService = await getDatabasesService();
88
+ return await databasesService.listAttributes(args.databaseId, args.collectionId, args.queries || []);
89
+ }, {
97
90
  databaseId,
98
91
  collectionId,
99
- parseOutput: false
100
- }, 100, 'attributes');
92
+ }, 100, "attributes");
101
93
  const ready = attributeKeys.filter((attribute) => attributes.includes(attribute.key));
102
94
  if (ready.length === 0) {
103
95
  return true;
104
96
  }
105
- await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE));
97
+ await new Promise((resolve) => setTimeout(resolve, POLL_DEBOUNCE));
106
98
  return await awaitPools.expectAttributes(databaseId, collectionId, attributeKeys, iteration + 1);
107
99
  },
108
100
  expectAttributes: async (databaseId, collectionId, attributeKeys, iteration = 1) => {
@@ -113,21 +105,25 @@ const awaitPools = {
113
105
  let steps = Math.max(1, Math.ceil(attributeKeys.length / STEP_SIZE));
114
106
  if (steps > 1 && iteration === 1) {
115
107
  pollMaxDebounces *= steps;
116
- (0, parser_1.log)('Creating a large number of attributes, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes');
108
+ log("Creating a large number of attributes, increasing timeout to " +
109
+ (pollMaxDebounces * POLL_DEBOUNCE) / 1000 / 60 +
110
+ " minutes");
117
111
  }
118
112
  }
119
- const { attributes } = await (0, paginate_1.paginate)(databases_1.databasesListAttributes, {
113
+ const { attributes } = await paginate(async (args) => {
114
+ const databasesService = await getDatabasesService();
115
+ return await databasesService.listAttributes(args.databaseId, args.collectionId, args.queries || []);
116
+ }, {
120
117
  databaseId,
121
118
  collectionId,
122
- parseOutput: false
123
- }, 100, 'attributes');
119
+ }, 100, "attributes");
124
120
  const ready = attributes
125
121
  .filter((attribute) => {
126
122
  if (attributeKeys.includes(attribute.key)) {
127
- if (['stuck', 'failed'].includes(attribute.status)) {
123
+ if (["stuck", "failed"].includes(attribute.status)) {
128
124
  throw new Error(`Attribute '${attribute.key}' failed!`);
129
125
  }
130
- return attribute.status === 'available';
126
+ return attribute.status === "available";
131
127
  }
132
128
  return false;
133
129
  })
@@ -135,7 +131,7 @@ const awaitPools = {
135
131
  if (ready.length === attributeKeys.length) {
136
132
  return true;
137
133
  }
138
- await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE));
134
+ await new Promise((resolve) => setTimeout(resolve, POLL_DEBOUNCE));
139
135
  return await awaitPools.expectAttributes(databaseId, collectionId, attributeKeys, iteration + 1);
140
136
  },
141
137
  deleteIndexes: async (databaseId, collectionId, indexesKeys, iteration = 1) => {
@@ -146,19 +142,23 @@ const awaitPools = {
146
142
  let steps = Math.max(1, Math.ceil(indexesKeys.length / STEP_SIZE));
147
143
  if (steps > 1 && iteration === 1) {
148
144
  pollMaxDebounces *= steps;
149
- (0, parser_1.log)('Found a large number of indexes to be deleted. Increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes');
145
+ log("Found a large number of indexes to be deleted. Increasing timeout to " +
146
+ (pollMaxDebounces * POLL_DEBOUNCE) / 1000 / 60 +
147
+ " minutes");
150
148
  }
151
149
  }
152
- const { indexes } = await (0, paginate_1.paginate)(databases_1.databasesListIndexes, {
150
+ const { indexes } = await paginate(async (args) => {
151
+ const databasesService = await getDatabasesService();
152
+ return await databasesService.listIndexes(args.databaseId, args.collectionId, args.queries || []);
153
+ }, {
153
154
  databaseId,
154
155
  collectionId,
155
- parseOutput: false
156
- }, 100, 'indexes');
156
+ }, 100, "indexes");
157
157
  const ready = indexesKeys.filter((index) => indexes.includes(index.key));
158
158
  if (ready.length === 0) {
159
159
  return true;
160
160
  }
161
- await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE));
161
+ await new Promise((resolve) => setTimeout(resolve, POLL_DEBOUNCE));
162
162
  return await awaitPools.expectIndexes(databaseId, collectionId, indexesKeys, iteration + 1);
163
163
  },
164
164
  expectIndexes: async (databaseId, collectionId, indexKeys, iteration = 1) => {
@@ -169,21 +169,25 @@ const awaitPools = {
169
169
  let steps = Math.max(1, Math.ceil(indexKeys.length / STEP_SIZE));
170
170
  if (steps > 1 && iteration === 1) {
171
171
  pollMaxDebounces *= steps;
172
- (0, parser_1.log)('Creating a large number of indexes, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes');
172
+ log("Creating a large number of indexes, increasing timeout to " +
173
+ (pollMaxDebounces * POLL_DEBOUNCE) / 1000 / 60 +
174
+ " minutes");
173
175
  }
174
176
  }
175
- const { indexes } = await (0, paginate_1.paginate)(databases_1.databasesListIndexes, {
177
+ const { indexes } = await paginate(async (args) => {
178
+ const databasesService = await getDatabasesService();
179
+ return await databasesService.listIndexes(args.databaseId, args.collectionId, args.queries || []);
180
+ }, {
176
181
  databaseId,
177
182
  collectionId,
178
- parseOutput: false
179
- }, 100, 'indexes');
183
+ }, 100, "indexes");
180
184
  const ready = indexes
181
185
  .filter((index) => {
182
186
  if (indexKeys.includes(index.key)) {
183
- if (['stuck', 'failed'].includes(index.status)) {
187
+ if (["stuck", "failed"].includes(index.status)) {
184
188
  throw new Error(`Index '${index.key}' failed!`);
185
189
  }
186
- return index.status === 'available';
190
+ return index.status === "available";
187
191
  }
188
192
  return false;
189
193
  })
@@ -191,46 +195,48 @@ const awaitPools = {
191
195
  if (ready.length >= indexKeys.length) {
192
196
  return true;
193
197
  }
194
- await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE));
198
+ await new Promise((resolve) => setTimeout(resolve, POLL_DEBOUNCE));
195
199
  return await awaitPools.expectIndexes(databaseId, collectionId, indexKeys, iteration + 1);
196
200
  },
197
201
  };
198
202
  const getConfirmation = async () => {
199
- if (parser_1.cliConfig.force) {
203
+ if (cliConfig.force) {
200
204
  return true;
201
205
  }
202
206
  async function fixConfirmation() {
203
- const answers = await inquirer_1.default.prompt(questions_1.questionPushChangesConfirmation);
204
- if (answers.changes !== 'YES' && answers.changes !== 'NO') {
207
+ const answers = await inquirer.prompt(questionPushChangesConfirmation);
208
+ if (answers.changes !== "YES" && answers.changes !== "NO") {
205
209
  return await fixConfirmation();
206
210
  }
207
211
  return answers.changes;
208
212
  }
209
- let answers = await inquirer_1.default.prompt(questions_1.questionPushChanges);
210
- if (answers.changes !== 'YES' && answers.changes !== 'NO') {
213
+ let answers = await inquirer.prompt(questionPushChanges);
214
+ if (answers.changes !== "YES" && answers.changes !== "NO") {
211
215
  answers.changes = await fixConfirmation();
212
216
  }
213
- if (answers.changes === 'YES') {
217
+ if (answers.changes === "YES") {
214
218
  return true;
215
219
  }
216
- (0, parser_1.warn)('Skipping push action. Changes were not applied.');
220
+ warn("Skipping push action. Changes were not applied.");
217
221
  return false;
218
222
  };
219
- const isEmpty = (value) => (value === null || value === undefined || (typeof value === "string" && value.trim().length === 0) || (Array.isArray(value) && value.length === 0));
220
- const approveChanges = async (resource, resourceGetFunction, keys, resourceName, resourcePlural, skipKeys = [], secondId = '', secondResourceName = '') => {
221
- (0, parser_1.log)('Checking for changes ...');
223
+ const isEmpty = (value) => value === null ||
224
+ value === undefined ||
225
+ (typeof value === "string" && value.trim().length === 0) ||
226
+ (Array.isArray(value) && value.length === 0);
227
+ const approveChanges = async (resource, resourceGetFunction, keys, resourceName, resourcePlural, skipKeys = [], secondId = "", secondResourceName = "") => {
228
+ log("Checking for changes ...");
222
229
  const changes = [];
223
230
  await Promise.all(resource.map(async (localResource) => {
224
231
  try {
225
232
  const options = {
226
- [resourceName]: localResource['$id'],
227
- parseOutput: false,
233
+ [resourceName]: localResource["$id"],
228
234
  };
229
- if (secondId !== '' && secondResourceName !== '') {
235
+ if (secondId !== "" && secondResourceName !== "") {
230
236
  options[secondResourceName] = localResource[secondId];
231
237
  }
232
238
  const remoteResource = await resourceGetFunction(options);
233
- for (let [key, value] of Object.entries((0, config_1.whitelistKeys)(remoteResource, keys))) {
239
+ for (let [key, value] of Object.entries(whitelistKeys(remoteResource, keys))) {
234
240
  if (skipKeys.includes(key)) {
235
241
  continue;
236
242
  }
@@ -240,19 +246,19 @@ const approveChanges = async (resource, resourceGetFunction, keys, resourceName,
240
246
  if (Array.isArray(value) && Array.isArray(localResource[key])) {
241
247
  if (JSON.stringify(value) !== JSON.stringify(localResource[key])) {
242
248
  changes.push({
243
- id: localResource['$id'],
249
+ id: localResource["$id"],
244
250
  key,
245
- remote: chalk_1.default.red(value.join('\n')),
246
- local: chalk_1.default.green(localResource[key].join('\n'))
251
+ remote: chalk.red(value.join("\n")),
252
+ local: chalk.green(localResource[key].join("\n")),
247
253
  });
248
254
  }
249
255
  }
250
256
  else if (value !== localResource[key]) {
251
257
  changes.push({
252
- id: localResource['$id'],
258
+ id: localResource["$id"],
253
259
  key,
254
- remote: chalk_1.default.red(value),
255
- local: chalk_1.default.green(localResource[key])
260
+ remote: chalk.red(value),
261
+ local: chalk.green(localResource[key]),
256
262
  });
257
263
  }
258
264
  }
@@ -266,18 +272,27 @@ const approveChanges = async (resource, resourceGetFunction, keys, resourceName,
266
272
  if (changes.length === 0) {
267
273
  return true;
268
274
  }
269
- (0, parser_1.drawTable)(changes);
275
+ drawTable(changes);
270
276
  if ((await getConfirmation()) === true) {
271
277
  return true;
272
278
  }
273
- (0, parser_1.success)(`Successfully pushed 0 ${resourcePlural}.`);
279
+ success(`Successfully pushed 0 ${resourcePlural}.`);
274
280
  return false;
275
281
  };
276
282
  const getObjectChanges = (remote, local, index, what) => {
277
283
  const changes = [];
278
- if (remote[index] && local[index]) {
279
- for (let [service, status] of Object.entries(remote[index])) {
280
- const localValue = local[index][service];
284
+ const remoteNested = remote[index];
285
+ const localNested = local[index];
286
+ if (remoteNested &&
287
+ localNested &&
288
+ typeof remoteNested === "object" &&
289
+ !Array.isArray(remoteNested) &&
290
+ typeof localNested === "object" &&
291
+ !Array.isArray(localNested)) {
292
+ const remoteObj = remoteNested;
293
+ const localObj = localNested;
294
+ for (const [service, status] of Object.entries(remoteObj)) {
295
+ const localValue = localObj[service];
281
296
  let valuesEqual = false;
282
297
  if (Array.isArray(status) && Array.isArray(localValue)) {
283
298
  valuesEqual = JSON.stringify(status) === JSON.stringify(localValue);
@@ -286,48 +301,51 @@ const getObjectChanges = (remote, local, index, what) => {
286
301
  valuesEqual = status === localValue;
287
302
  }
288
303
  if (!valuesEqual) {
289
- changes.push({ group: what, setting: service, remote: chalk_1.default.red(status), local: chalk_1.default.green(localValue) });
304
+ changes.push({
305
+ group: what,
306
+ setting: service,
307
+ remote: chalk.red(String(status ?? "")),
308
+ local: chalk.green(String(localValue ?? "")),
309
+ });
290
310
  }
291
311
  }
292
312
  }
293
313
  return changes;
294
314
  };
295
- const createAttribute = (databaseId, collectionId, attribute) => {
315
+ const createAttribute = async (databaseId, collectionId, attribute) => {
316
+ const databasesService = await getDatabasesService();
296
317
  switch (attribute.type) {
297
- case 'string':
318
+ case "string":
298
319
  switch (attribute.format) {
299
- case 'email':
300
- return (0, databases_1.databasesCreateEmailAttribute)({
320
+ case "email":
321
+ return databasesService.createEmailAttribute({
301
322
  databaseId,
302
323
  collectionId,
303
324
  key: attribute.key,
304
325
  required: attribute.required,
305
326
  xdefault: attribute.default,
306
327
  array: attribute.array,
307
- parseOutput: false
308
328
  });
309
- case 'url':
310
- return (0, databases_1.databasesCreateUrlAttribute)({
329
+ case "url":
330
+ return databasesService.createUrlAttribute({
311
331
  databaseId,
312
332
  collectionId,
313
333
  key: attribute.key,
314
334
  required: attribute.required,
315
335
  xdefault: attribute.default,
316
336
  array: attribute.array,
317
- parseOutput: false
318
337
  });
319
- case 'ip':
320
- return (0, databases_1.databasesCreateIpAttribute)({
338
+ case "ip":
339
+ return databasesService.createIpAttribute({
321
340
  databaseId,
322
341
  collectionId,
323
342
  key: attribute.key,
324
343
  required: attribute.required,
325
344
  xdefault: attribute.default,
326
345
  array: attribute.array,
327
- parseOutput: false
328
346
  });
329
- case 'enum':
330
- return (0, databases_1.databasesCreateEnumAttribute)({
347
+ case "enum":
348
+ return databasesService.createEnumAttribute({
331
349
  databaseId,
332
350
  collectionId,
333
351
  key: attribute.key,
@@ -335,10 +353,9 @@ const createAttribute = (databaseId, collectionId, attribute) => {
335
353
  required: attribute.required,
336
354
  xdefault: attribute.default,
337
355
  array: attribute.array,
338
- parseOutput: false
339
356
  });
340
357
  default:
341
- return (0, databases_1.databasesCreateStringAttribute)({
358
+ return databasesService.createStringAttribute({
342
359
  databaseId,
343
360
  collectionId,
344
361
  key: attribute.key,
@@ -347,11 +364,10 @@ const createAttribute = (databaseId, collectionId, attribute) => {
347
364
  xdefault: attribute.default,
348
365
  array: attribute.array,
349
366
  encrypt: attribute.encrypt,
350
- parseOutput: false
351
367
  });
352
368
  }
353
- case 'integer':
354
- return (0, databases_1.databasesCreateIntegerAttribute)({
369
+ case "integer":
370
+ return databasesService.createIntegerAttribute({
355
371
  databaseId,
356
372
  collectionId,
357
373
  key: attribute.key,
@@ -360,10 +376,9 @@ const createAttribute = (databaseId, collectionId, attribute) => {
360
376
  max: attribute.max,
361
377
  xdefault: attribute.default,
362
378
  array: attribute.array,
363
- parseOutput: false
364
379
  });
365
- case 'double':
366
- return (0, databases_1.databasesCreateFloatAttribute)({
380
+ case "double":
381
+ return databasesService.createFloatAttribute({
367
382
  databaseId,
368
383
  collectionId,
369
384
  key: attribute.key,
@@ -372,30 +387,27 @@ const createAttribute = (databaseId, collectionId, attribute) => {
372
387
  max: attribute.max,
373
388
  xdefault: attribute.default,
374
389
  array: attribute.array,
375
- parseOutput: false
376
390
  });
377
- case 'boolean':
378
- return (0, databases_1.databasesCreateBooleanAttribute)({
391
+ case "boolean":
392
+ return databasesService.createBooleanAttribute({
379
393
  databaseId,
380
394
  collectionId,
381
395
  key: attribute.key,
382
396
  required: attribute.required,
383
397
  xdefault: attribute.default,
384
398
  array: attribute.array,
385
- parseOutput: false
386
399
  });
387
- case 'datetime':
388
- return (0, databases_1.databasesCreateDatetimeAttribute)({
400
+ case "datetime":
401
+ return databasesService.createDatetimeAttribute({
389
402
  databaseId,
390
403
  collectionId,
391
404
  key: attribute.key,
392
405
  required: attribute.required,
393
406
  xdefault: attribute.default,
394
407
  array: attribute.array,
395
- parseOutput: false
396
408
  });
397
- case 'relationship':
398
- return (0, databases_1.databasesCreateRelationshipAttribute)({
409
+ case "relationship":
410
+ return databasesService.createRelationshipAttribute({
399
411
  databaseId,
400
412
  collectionId,
401
413
  relatedCollectionId: attribute.relatedTable ?? attribute.relatedCollection,
@@ -404,98 +416,84 @@ const createAttribute = (databaseId, collectionId, attribute) => {
404
416
  key: attribute.key,
405
417
  twoWayKey: attribute.twoWayKey,
406
418
  onDelete: attribute.onDelete,
407
- parseOutput: false
408
419
  });
409
- case 'point':
410
- return (0, databases_1.databasesCreatePointAttribute)({
420
+ case "point":
421
+ return databasesService.createPointAttribute({
411
422
  databaseId,
412
423
  collectionId,
413
424
  key: attribute.key,
414
425
  required: attribute.required,
415
426
  xdefault: attribute.default,
416
- parseOutput: false
417
427
  });
418
- case 'linestring':
419
- return (0, databases_1.databasesCreateLineAttribute)({
428
+ case "linestring":
429
+ return databasesService.createLineAttribute({
420
430
  databaseId,
421
431
  collectionId,
422
432
  key: attribute.key,
423
433
  required: attribute.required,
424
434
  xdefault: attribute.default,
425
- parseOutput: false
426
435
  });
427
- case 'polygon':
428
- return (0, databases_1.databasesCreatePolygonAttribute)({
436
+ case "polygon":
437
+ return databasesService.createPolygonAttribute({
429
438
  databaseId,
430
439
  collectionId,
431
440
  key: attribute.key,
432
441
  required: attribute.required,
433
442
  xdefault: attribute.default,
434
- parseOutput: false
435
443
  });
436
444
  default:
437
445
  throw new Error(`Unsupported attribute type: ${attribute.type}`);
438
446
  }
439
447
  };
440
- const updateAttribute = (databaseId, collectionId, attribute) => {
448
+ const updateAttribute = async (databaseId, collectionId, attribute) => {
449
+ const databasesService = await getDatabasesService();
441
450
  switch (attribute.type) {
442
- case 'string':
451
+ case "string":
443
452
  switch (attribute.format) {
444
- case 'email':
445
- return (0, databases_1.databasesUpdateEmailAttribute)({
453
+ case "email":
454
+ return databasesService.updateEmailAttribute({
446
455
  databaseId,
447
456
  collectionId,
448
457
  key: attribute.key,
449
458
  required: attribute.required,
450
459
  xdefault: attribute.default,
451
- array: attribute.array,
452
- parseOutput: false
453
460
  });
454
- case 'url':
455
- return (0, databases_1.databasesUpdateUrlAttribute)({
461
+ case "url":
462
+ return databasesService.updateUrlAttribute({
456
463
  databaseId,
457
464
  collectionId,
458
465
  key: attribute.key,
459
466
  required: attribute.required,
460
467
  xdefault: attribute.default,
461
- array: attribute.array,
462
- parseOutput: false
463
468
  });
464
- case 'ip':
465
- return (0, databases_1.databasesUpdateIpAttribute)({
469
+ case "ip":
470
+ return databasesService.updateIpAttribute({
466
471
  databaseId,
467
472
  collectionId,
468
473
  key: attribute.key,
469
474
  required: attribute.required,
470
475
  xdefault: attribute.default,
471
- array: attribute.array,
472
- parseOutput: false
473
476
  });
474
- case 'enum':
475
- return (0, databases_1.databasesUpdateEnumAttribute)({
477
+ case "enum":
478
+ return databasesService.updateEnumAttribute({
476
479
  databaseId,
477
480
  collectionId,
478
481
  key: attribute.key,
479
482
  elements: attribute.elements,
480
483
  required: attribute.required,
481
484
  xdefault: attribute.default,
482
- array: attribute.array,
483
- parseOutput: false
484
485
  });
485
486
  default:
486
- return (0, databases_1.databasesUpdateStringAttribute)({
487
+ return databasesService.updateStringAttribute({
487
488
  databaseId,
488
489
  collectionId,
489
490
  key: attribute.key,
490
- size: attribute.size,
491
491
  required: attribute.required,
492
492
  xdefault: attribute.default,
493
- array: attribute.array,
494
- parseOutput: false
495
493
  });
496
494
  }
497
- case 'integer':
498
- return (0, databases_1.databasesUpdateIntegerAttribute)({
495
+ case "integer":
496
+ return databasesService.updateIntegerAttribute({
499
497
  databaseId,
500
498
  collectionId,
501
499
  key: attribute.key,
@@ -503,11 +501,9 @@ const updateAttribute = (databaseId, collectionId, attribute) => {
503
501
  min: attribute.min,
504
502
  max: attribute.max,
505
503
  xdefault: attribute.default,
506
- array: attribute.array,
507
- parseOutput: false
508
504
  });
509
- case 'double':
510
- return (0, databases_1.databasesUpdateFloatAttribute)({
505
+ case "double":
506
+ return databasesService.updateFloatAttribute({
511
507
  databaseId,
512
508
  collectionId,
513
509
  key: attribute.key,
@@ -515,106 +511,85 @@ const updateAttribute = (databaseId, collectionId, attribute) => {
515
511
  min: attribute.min,
516
512
  max: attribute.max,
517
513
  xdefault: attribute.default,
518
- array: attribute.array,
519
- parseOutput: false
520
514
  });
521
- case 'boolean':
522
- return (0, databases_1.databasesUpdateBooleanAttribute)({
515
+ case "boolean":
516
+ return databasesService.updateBooleanAttribute({
523
517
  databaseId,
524
518
  collectionId,
525
519
  key: attribute.key,
526
520
  required: attribute.required,
527
521
  xdefault: attribute.default,
528
- array: attribute.array,
529
- parseOutput: false
530
522
  });
531
- case 'datetime':
532
- return (0, databases_1.databasesUpdateDatetimeAttribute)({
523
+ case "datetime":
524
+ return databasesService.updateDatetimeAttribute({
533
525
  databaseId,
534
526
  collectionId,
535
527
  key: attribute.key,
536
528
  required: attribute.required,
537
529
  xdefault: attribute.default,
538
- array: attribute.array,
539
- parseOutput: false
540
530
  });
541
- case 'relationship':
542
- return (0, databases_1.databasesUpdateRelationshipAttribute)({
531
+ case "relationship":
532
+ return databasesService.updateRelationshipAttribute({
543
533
  databaseId,
544
534
  collectionId,
545
- relatedCollectionId: attribute.relatedTable ?? attribute.relatedCollection,
546
- type: attribute.relationType,
547
- twoWay: attribute.twoWay,
548
535
  key: attribute.key,
549
- twoWayKey: attribute.twoWayKey,
550
536
  onDelete: attribute.onDelete,
551
- parseOutput: false
552
537
  });
553
- case 'point':
554
- return (0, databases_1.databasesUpdatePointAttribute)({
538
+ case "point":
539
+ return databasesService.updatePointAttribute({
555
540
  databaseId,
556
541
  collectionId,
557
542
  key: attribute.key,
558
543
  required: attribute.required,
559
544
  xdefault: attribute.default,
560
- parseOutput: false
561
545
  });
562
- case 'linestring':
563
- return (0, databases_1.databasesUpdateLineAttribute)({
546
+ case "linestring":
547
+ return databasesService.updateLineAttribute({
564
548
  databaseId,
565
549
  collectionId,
566
550
  key: attribute.key,
567
551
  required: attribute.required,
568
552
  xdefault: attribute.default,
569
- parseOutput: false
570
553
  });
571
- case 'polygon':
572
- return (0, databases_1.databasesUpdatePolygonAttribute)({
554
+ case "polygon":
555
+ return databasesService.updatePolygonAttribute({
573
556
  databaseId,
574
557
  collectionId,
575
558
  key: attribute.key,
576
559
  required: attribute.required,
577
560
  xdefault: attribute.default,
578
- parseOutput: false
579
561
  });
580
562
  default:
581
563
  throw new Error(`Unsupported attribute type: ${attribute.type}`);
582
564
  }
583
565
  };
584
566
  const deleteAttribute = async (collection, attribute, isIndex = false) => {
585
- (0, parser_1.log)(`Deleting ${isIndex ? 'index' : 'attribute'} ${attribute.key} of ${collection.name} ( ${collection['$id']} )`);
567
+ log(`Deleting ${isIndex ? "index" : "attribute"} ${attribute.key} of ${collection.name} ( ${collection["$id"]} )`);
568
+ const databasesService = await getDatabasesService();
586
569
  if (isIndex) {
587
- await (0, databases_1.databasesDeleteIndex)({
588
- databaseId: collection['databaseId'],
589
- collectionId: collection['$id'],
590
- key: attribute.key,
591
- parseOutput: false
592
- });
570
+ await databasesService.deleteIndex(collection["databaseId"], collection["$id"], attribute.key);
593
571
  return;
594
572
  }
595
- await (0, databases_1.databasesDeleteAttribute)({
596
- databaseId: collection['databaseId'],
597
- collectionId: collection['$id'],
598
- key: attribute.key,
599
- parseOutput: false
600
- });
573
+ await databasesService.deleteAttribute(collection["databaseId"], collection["$id"], attribute.key);
601
574
  };
602
575
  const isEqual = (a, b) => {
603
576
  if (a === b)
604
577
  return true;
605
- if (a && b && typeof a === 'object' && typeof b === 'object') {
606
- if (a.constructor && a.constructor.name === 'BigNumber' &&
607
- b.constructor && b.constructor.name === 'BigNumber') {
578
+ if (a && b && typeof a === "object" && typeof b === "object") {
579
+ if (a.constructor &&
580
+ a.constructor.name === "BigNumber" &&
581
+ b.constructor &&
582
+ b.constructor.name === "BigNumber") {
608
583
  return a.eq(b);
609
584
  }
610
- if (typeof a.equals === 'function') {
585
+ if (typeof a.equals === "function") {
611
586
  return a.equals(b);
612
587
  }
613
- if (typeof a.eq === 'function') {
588
+ if (typeof a.eq === "function") {
614
589
  return a.eq(b);
615
590
  }
616
591
  }
617
- if (typeof a === 'number' && typeof b === 'number') {
592
+ if (typeof a === "number" && typeof b === "number") {
618
593
  if (isNaN(a) && isNaN(b))
619
594
  return true;
620
595
  if (!isFinite(a) && !isFinite(b))
@@ -629,13 +604,13 @@ const compareAttribute = (remote, local, reason, key) => {
629
604
  }
630
605
  if (Array.isArray(remote) && Array.isArray(local)) {
631
606
  if (JSON.stringify(remote) !== JSON.stringify(local)) {
632
- const bol = reason === '' ? '' : '\n';
633
- reason += `${bol}${key} changed from ${chalk_1.default.red(remote)} to ${chalk_1.default.green(local)}`;
607
+ const bol = reason === "" ? "" : "\n";
608
+ reason += `${bol}${key} changed from ${chalk.red(remote)} to ${chalk.green(local)}`;
634
609
  }
635
610
  }
636
611
  else if (!isEqual(remote, local)) {
637
- const bol = reason === '' ? '' : '\n';
638
- reason += `${bol}${key} changed from ${chalk_1.default.red(remote)} to ${chalk_1.default.green(local)}`;
612
+ const bol = reason === "" ? "" : "\n";
613
+ reason += `${bol}${key} changed from ${chalk.red(remote)} to ${chalk.green(local)}`;
639
614
  }
640
615
  return reason;
641
616
  };
@@ -647,12 +622,12 @@ const checkAttributeChanges = (remote, local, collection, recreating = true) =>
647
622
  if (local === undefined) {
648
623
  return undefined;
649
624
  }
650
- const keyName = `${chalk_1.default.yellow(local.key)} in ${collection.name} (${collection['$id']})`;
651
- const action = chalk_1.default.cyan(recreating ? 'recreating' : 'changing');
652
- let reason = '';
625
+ const keyName = `${chalk.yellow(local.key)} in ${collection.name} (${collection["$id"]})`;
626
+ const action = chalk.cyan(recreating ? "recreating" : "changing");
627
+ let reason = "";
653
628
  let attribute = recreating ? remote : local;
654
629
  for (let key of Object.keys(remote)) {
655
- if (!config_1.KeysAttributes.has(key)) {
630
+ if (!KeysAttributes.has(key)) {
656
631
  continue;
657
632
  }
658
633
  if (changeableKeys.includes(key)) {
@@ -666,7 +641,9 @@ const checkAttributeChanges = (remote, local, collection, recreating = true) =>
666
641
  }
667
642
  reason = compareAttribute(remote[key], local[key], reason, key);
668
643
  }
669
- return reason === '' ? undefined : { key: keyName, attribute, reason, action };
644
+ return reason === ""
645
+ ? undefined
646
+ : { key: keyName, attribute, reason, action };
670
647
  };
671
648
  /**
672
649
  * Check if attributes contain the given attribute
@@ -674,10 +651,12 @@ const checkAttributeChanges = (remote, local, collection, recreating = true) =>
674
651
  const attributesContains = (attribute, attributes) => attributes.find((attr) => attr.key === attribute.key);
675
652
  const generateChangesObject = (attribute, collection, isAdding) => {
676
653
  return {
677
- key: `${chalk_1.default.yellow(attribute.key)} in ${collection.name} (${collection['$id']})`,
654
+ key: `${chalk.yellow(attribute.key)} in ${collection.name} (${collection["$id"]})`,
678
655
  attribute: attribute,
679
- reason: isAdding ? 'Field isn\'t present on the remote server' : 'Field isn\'t present on the appwrite.config.json file',
680
- action: isAdding ? chalk_1.default.green('adding') : chalk_1.default.red('deleting')
656
+ reason: isAdding
657
+ ? "Field isn't present on the remote server"
658
+ : "Field isn't present on the appwrite.config.json file",
659
+ action: isAdding ? chalk.green("adding") : chalk.red("deleting"),
681
660
  };
682
661
  };
683
662
  /**
@@ -685,32 +664,41 @@ const generateChangesObject = (attribute, collection, isAdding) => {
685
664
  * return list of attributes to create
686
665
  */
687
666
  const attributesToCreate = async (remoteAttributes, localAttributes, collection, isIndex = false) => {
688
- const deleting = remoteAttributes.filter((attribute) => !attributesContains(attribute, localAttributes)).map((attr) => generateChangesObject(attr, collection, false));
689
- const adding = localAttributes.filter((attribute) => !attributesContains(attribute, remoteAttributes)).map((attr) => generateChangesObject(attr, collection, true));
690
- const conflicts = remoteAttributes.map((attribute) => checkAttributeChanges(attribute, attributesContains(attribute, localAttributes), collection)).filter(attribute => attribute !== undefined);
691
- const changes = remoteAttributes.map((attribute) => checkAttributeChanges(attribute, attributesContains(attribute, localAttributes), collection, false))
692
- .filter(attribute => attribute !== undefined)
693
- .filter(attribute => conflicts.filter(attr => attribute.key === attr.key).length !== 1);
667
+ const deleting = remoteAttributes
668
+ .filter((attribute) => !attributesContains(attribute, localAttributes))
669
+ .map((attr) => generateChangesObject(attr, collection, false));
670
+ const adding = localAttributes
671
+ .filter((attribute) => !attributesContains(attribute, remoteAttributes))
672
+ .map((attr) => generateChangesObject(attr, collection, true));
673
+ const conflicts = remoteAttributes
674
+ .map((attribute) => checkAttributeChanges(attribute, attributesContains(attribute, localAttributes), collection))
675
+ .filter((attribute) => attribute !== undefined);
676
+ const changes = remoteAttributes
677
+ .map((attribute) => checkAttributeChanges(attribute, attributesContains(attribute, localAttributes), collection, false))
678
+ .filter((attribute) => attribute !== undefined)
679
+ .filter((attribute) => conflicts.filter((attr) => attribute.key === attr.key).length !== 1);
694
680
  let changedAttributes = [];
695
681
  const changing = [...deleting, ...adding, ...conflicts, ...changes];
696
682
  if (changing.length === 0) {
697
683
  return changedAttributes;
698
684
  }
699
- (0, parser_1.log)(!parser_1.cliConfig.force ? 'There are pending changes in your collection deployment' : 'List of applied changes');
700
- (0, parser_1.drawTable)(changing.map((change) => {
701
- return { Key: change.key, Action: change.action, Reason: change.reason, };
685
+ log(!cliConfig.force
686
+ ? "There are pending changes in your collection deployment"
687
+ : "List of applied changes");
688
+ drawTable(changing.map((change) => {
689
+ return { Key: change.key, Action: change.action, Reason: change.reason };
702
690
  }));
703
- if (!parser_1.cliConfig.force) {
691
+ if (!cliConfig.force) {
704
692
  if (deleting.length > 0 && !isIndex) {
705
- console.log(`${chalk_1.default.red('------------------------------------------------------')}`);
706
- console.log(`${chalk_1.default.red('| WARNING: Attribute deletion may cause loss of data |')}`);
707
- console.log(`${chalk_1.default.red('------------------------------------------------------')}`);
693
+ console.log(`${chalk.red("------------------------------------------------------")}`);
694
+ console.log(`${chalk.red("| WARNING: Attribute deletion may cause loss of data |")}`);
695
+ console.log(`${chalk.red("------------------------------------------------------")}`);
708
696
  console.log();
709
697
  }
710
698
  if (conflicts.length > 0 && !isIndex) {
711
- console.log(`${chalk_1.default.red('--------------------------------------------------------')}`);
712
- console.log(`${chalk_1.default.red('| WARNING: Attribute recreation may cause loss of data |')}`);
713
- console.log(`${chalk_1.default.red('--------------------------------------------------------')}`);
699
+ console.log(`${chalk.red("--------------------------------------------------------")}`);
700
+ console.log(`${chalk.red("| WARNING: Attribute recreation may cause loss of data |")}`);
701
+ console.log(`${chalk.red("--------------------------------------------------------")}`);
714
702
  console.log();
715
703
  }
716
704
  if ((await getConfirmation()) !== true) {
@@ -724,13 +712,16 @@ const attributesToCreate = async (remoteAttributes, localAttributes, collection,
724
712
  }
725
713
  if (changes.length > 0) {
726
714
  changedAttributes = changes.map((change) => change.attribute);
727
- await Promise.all(changedAttributes.map((changed) => updateAttribute(collection['databaseId'], collection['$id'], changed)));
715
+ await Promise.all(changedAttributes.map((changed) => updateAttribute(collection["databaseId"], collection["$id"], changed)));
728
716
  }
729
717
  const deletingAttributes = deleting.map((change) => change.attribute);
730
718
  await Promise.all(deletingAttributes.map((attribute) => deleteAttribute(collection, attribute, isIndex)));
731
- const attributeKeys = [...remoteAttributes.map((attribute) => attribute.key), ...deletingAttributes.map((attribute) => attribute.key)];
719
+ const attributeKeys = [
720
+ ...remoteAttributes.map((attribute) => attribute.key),
721
+ ...deletingAttributes.map((attribute) => attribute.key),
722
+ ];
732
723
  if (attributeKeys.length) {
733
- const deleteAttributesPoolStatus = await awaitPools.deleteAttributes(collection['databaseId'], collection['$id'], attributeKeys);
724
+ const deleteAttributesPoolStatus = await awaitPools.deleteAttributes(collection["databaseId"], collection["$id"], attributeKeys);
734
725
  if (!deleteAttributesPoolStatus) {
735
726
  throw new Error("Attribute deletion timed out.");
736
727
  }
@@ -738,49 +729,46 @@ const attributesToCreate = async (remoteAttributes, localAttributes, collection,
738
729
  return localAttributes.filter((attribute) => !attributesContains(attribute, remoteAttributes));
739
730
  };
740
731
  const createIndexes = async (indexes, collection) => {
741
- (0, parser_1.log)(`Creating indexes ...`);
732
+ log(`Creating indexes ...`);
733
+ const databasesService = await getDatabasesService();
742
734
  for (let index of indexes) {
743
- await (0, databases_1.databasesCreateIndex)({
744
- databaseId: collection['databaseId'],
745
- collectionId: collection['$id'],
746
- key: index.key,
747
- type: index.type,
748
- attributes: index.columns ?? index.attributes,
749
- orders: index.orders,
750
- parseOutput: false
751
- });
735
+ await databasesService.createIndex(collection["databaseId"], collection["$id"], index.key, index.type, index.columns ?? index.attributes, index.orders);
752
736
  }
753
- const result = await awaitPools.expectIndexes(collection['databaseId'], collection['$id'], indexes.map((index) => index.key));
737
+ const result = await awaitPools.expectIndexes(collection["databaseId"], collection["$id"], indexes.map((index) => index.key));
754
738
  if (!result) {
755
- throw new Error('Index creation timed out.');
739
+ throw new Error("Index creation timed out.");
756
740
  }
757
- (0, parser_1.success)(`Created ${indexes.length} indexes`);
741
+ success(`Created ${indexes.length} indexes`);
758
742
  };
759
743
  const createAttributes = async (attributes, collection) => {
760
744
  for (let attribute of attributes) {
761
- if (attribute.side !== 'child') {
762
- await createAttribute(collection['databaseId'], collection['$id'], attribute);
745
+ if (attribute.side !== "child") {
746
+ await createAttribute(collection["databaseId"], collection["$id"], attribute);
763
747
  }
764
748
  }
765
- const result = await awaitPools.expectAttributes(collection['databaseId'], collection['$id'], collection.attributes.filter((attribute) => attribute.side !== 'child').map((attribute) => attribute.key));
749
+ const result = await awaitPools.expectAttributes(collection["databaseId"], collection["$id"], collection.attributes
750
+ .filter((attribute) => attribute.side !== "child")
751
+ .map((attribute) => attribute.key));
766
752
  if (!result) {
767
753
  throw new Error(`Attribute creation timed out.`);
768
754
  }
769
- (0, parser_1.success)(`Created ${attributes.length} attributes`);
755
+ success(`Created ${attributes.length} attributes`);
770
756
  };
771
757
  const createColumns = async (columns, table) => {
772
758
  for (let column of columns) {
773
- if (column.side !== 'child') {
774
- await createAttribute(table['databaseId'], table['$id'], column);
759
+ if (column.side !== "child") {
760
+ await createAttribute(table["databaseId"], table["$id"], column);
775
761
  }
776
762
  }
777
- const result = await awaitPools.expectAttributes(table['databaseId'], table['$id'], table.columns.filter((column) => column.side !== 'child').map((column) => column.key));
763
+ const result = await awaitPools.expectAttributes(table["databaseId"], table["$id"], table.columns
764
+ .filter((column) => column.side !== "child")
765
+ .map((column) => column.key));
778
766
  if (!result) {
779
767
  throw new Error(`Column creation timed out.`);
780
768
  }
781
- (0, parser_1.success)(`Created ${columns.length} columns`);
769
+ success(`Created ${columns.length} columns`);
782
770
  };
783
- const pushResources = async () => {
771
+ const pushResources = async ({ skipDeprecated = false, } = {}) => {
784
772
  const actions = {
785
773
  settings: pushSettings,
786
774
  functions: pushFunction,
@@ -789,184 +777,176 @@ const pushResources = async () => {
789
777
  tables: pushTable,
790
778
  buckets: pushBucket,
791
779
  teams: pushTeam,
792
- messages: pushMessagingTopic
780
+ messages: pushMessagingTopic,
793
781
  };
794
- if (parser_1.cliConfig.all) {
782
+ if (skipDeprecated) {
783
+ delete actions.collections;
784
+ }
785
+ if (cliConfig.all) {
795
786
  for (let action of Object.values(actions)) {
796
- await action({ returnOnZero: true });
787
+ await action();
797
788
  }
798
789
  }
799
790
  else {
800
- const answers = await inquirer_1.default.prompt(questions_1.questionsPushResources[0]);
791
+ const answers = await inquirer.prompt(questionsPushResources);
801
792
  const action = actions[answers.resource];
802
793
  if (action !== undefined) {
803
- await action({ returnOnZero: true });
794
+ await action();
804
795
  }
805
796
  }
806
797
  };
807
798
  const pushSettings = async () => {
808
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
799
+ checkDeployConditions(localConfig);
809
800
  try {
810
- let response = await (0, projects_1.projectsGet)({
811
- parseOutput: false,
812
- projectId: config_1.localConfig.getProject().projectId
813
- });
814
- const remoteSettings = config_1.localConfig.createSettingsObject(response ?? {});
815
- const localSettings = config_1.localConfig.getProject().projectSettings ?? {};
816
- (0, parser_1.log)('Checking for changes ...');
801
+ const projectsService = await getProjectsService();
802
+ let response = await projectsService.get(localConfig.getProject().projectId);
803
+ const remoteSettings = localConfig.createSettingsObject(response ?? {});
804
+ const localSettings = localConfig.getProject().projectSettings ?? {};
805
+ log("Checking for changes ...");
817
806
  const changes = [];
818
- changes.push(...(getObjectChanges(remoteSettings, localSettings, 'services', 'Service')));
819
- changes.push(...(getObjectChanges(remoteSettings['auth'] ?? {}, localSettings['auth'] ?? {}, 'methods', 'Auth method')));
820
- changes.push(...(getObjectChanges(remoteSettings['auth'] ?? {}, localSettings['auth'] ?? {}, 'security', 'Auth security')));
807
+ changes.push(...getObjectChanges(remoteSettings, localSettings, "services", "Service"));
808
+ changes.push(...getObjectChanges(remoteSettings["auth"] ?? {}, localSettings["auth"] ?? {}, "methods", "Auth method"));
809
+ changes.push(...getObjectChanges(remoteSettings["auth"] ?? {}, localSettings["auth"] ?? {}, "security", "Auth security"));
821
810
  if (changes.length > 0) {
822
- (0, parser_1.drawTable)(changes);
811
+ drawTable(changes);
823
812
  if ((await getConfirmation()) !== true) {
824
- (0, parser_1.success)(`Successfully pushed 0 project settings.`);
813
+ success(`Successfully pushed 0 project settings.`);
825
814
  return;
826
815
  }
827
816
  }
828
817
  }
829
- catch (e) {
830
- }
818
+ catch (e) { }
831
819
  try {
832
- (0, parser_1.log)("Pushing project settings ...");
833
- const projectId = config_1.localConfig.getProject().projectId;
834
- const projectName = config_1.localConfig.getProject().projectName;
835
- const settings = config_1.localConfig.getProject().projectSettings ?? {};
820
+ log("Pushing project settings ...");
821
+ const projectsService = await getProjectsService();
822
+ const projectId = localConfig.getProject().projectId;
823
+ const projectName = localConfig.getProject().projectName;
824
+ const settings = localConfig.getProject().projectSettings ?? {};
836
825
  if (projectName) {
837
- (0, parser_1.log)("Applying project name ...");
838
- await (0, projects_1.projectsUpdate)({
839
- projectId,
840
- name: projectName,
841
- parseOutput: false
842
- });
826
+ log("Applying project name ...");
827
+ await projectsService.update(projectId, projectName);
843
828
  }
844
829
  if (settings.services) {
845
- (0, parser_1.log)("Applying service statuses ...");
830
+ log("Applying service statuses ...");
846
831
  for (let [service, status] of Object.entries(settings.services)) {
847
- await (0, projects_1.projectsUpdateServiceStatus)({
848
- projectId,
849
- service,
850
- status,
851
- parseOutput: false
852
- });
832
+ await projectsService.updateServiceStatus(projectId, service, status);
853
833
  }
854
834
  }
855
835
  if (settings.auth) {
856
836
  if (settings.auth.security) {
857
- (0, parser_1.log)("Applying auth security settings ...");
858
- await (0, projects_1.projectsUpdateAuthDuration)({ projectId, duration: settings.auth.security.duration, parseOutput: false });
859
- await (0, projects_1.projectsUpdateAuthLimit)({ projectId, limit: settings.auth.security.limit, parseOutput: false });
860
- await (0, projects_1.projectsUpdateAuthSessionsLimit)({ projectId, limit: settings.auth.security.sessionsLimit, parseOutput: false });
861
- await (0, projects_1.projectsUpdateAuthPasswordDictionary)({ projectId, enabled: settings.auth.security.passwordDictionary, parseOutput: false });
862
- await (0, projects_1.projectsUpdateAuthPasswordHistory)({ projectId, limit: settings.auth.security.passwordHistory, parseOutput: false });
863
- await (0, projects_1.projectsUpdatePersonalDataCheck)({ projectId, enabled: settings.auth.security.personalDataCheck, parseOutput: false });
864
- await (0, projects_1.projectsUpdateSessionAlerts)({ projectId, alerts: settings.auth.security.sessionAlerts, parseOutput: false });
865
- await (0, projects_1.projectsUpdateMockNumbers)({ projectId, numbers: settings.auth.security.mockNumbers, parseOutput: false });
837
+ log("Applying auth security settings ...");
838
+ await projectsService.updateAuthDuration(projectId, settings.auth.security.duration);
839
+ await projectsService.updateAuthLimit(projectId, settings.auth.security.limit);
840
+ await projectsService.updateAuthSessionsLimit(projectId, settings.auth.security.sessionsLimit);
841
+ await projectsService.updateAuthPasswordDictionary(projectId, settings.auth.security.passwordDictionary);
842
+ await projectsService.updateAuthPasswordHistory(projectId, settings.auth.security.passwordHistory);
843
+ await projectsService.updatePersonalDataCheck(projectId, settings.auth.security.personalDataCheck);
844
+ await projectsService.updateSessionAlerts(projectId, settings.auth.security.sessionAlerts);
845
+ await projectsService.updateMockNumbers(projectId, settings.auth.security.mockNumbers);
866
846
  }
867
847
  if (settings.auth.methods) {
868
- (0, parser_1.log)("Applying auth methods statuses ...");
848
+ log("Applying auth methods statuses ...");
869
849
  for (let [method, status] of Object.entries(settings.auth.methods)) {
870
- await (0, projects_1.projectsUpdateAuthStatus)({
871
- projectId,
872
- method,
873
- status,
874
- parseOutput: false
875
- });
850
+ await projectsService.updateAuthStatus(projectId, method, status);
876
851
  }
877
852
  }
878
853
  }
879
- (0, parser_1.success)(`Successfully pushed ${chalk_1.default.bold('all')} project settings.`);
854
+ success(`Successfully pushed ${chalk.bold("all")} project settings.`);
880
855
  }
881
856
  catch (e) {
882
857
  throw e;
883
858
  }
884
859
  };
885
- const pushSite = async ({ siteId, async: asyncDeploy, code, withVariables } = { returnOnZero: false }) => {
886
- process.chdir(config_1.localConfig.configDirectoryPath);
860
+ const pushSite = async ({ siteId, async: asyncDeploy, code, withVariables, } = {}) => {
861
+ process.chdir(localConfig.configDirectoryPath);
887
862
  const siteIds = [];
888
863
  if (siteId) {
889
864
  siteIds.push(siteId);
890
865
  }
891
- else if (parser_1.cliConfig.all) {
892
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
893
- const sites = config_1.localConfig.getSites();
866
+ else if (cliConfig.all) {
867
+ checkDeployConditions(localConfig);
868
+ const sites = localConfig.getSites();
894
869
  siteIds.push(...sites.map((site) => {
895
870
  return site.$id;
896
871
  }));
897
872
  }
898
873
  if (siteIds.length <= 0) {
899
- const answers = await inquirer_1.default.prompt(questions_1.questionsPushSites[0]);
874
+ const answers = await inquirer.prompt(questionsPushSites);
900
875
  if (answers.sites) {
901
876
  siteIds.push(...answers.sites);
902
877
  }
903
878
  }
904
879
  if (siteIds.length === 0) {
905
- (0, parser_1.log)("No sites found.");
906
- (0, parser_1.hint)("Use 'appwrite pull sites' to synchronize existing one, or use 'appwrite init site' to create a new one.");
880
+ log("No sites found.");
881
+ hint("Use 'appwrite pull sites' to synchronize existing one, or use 'appwrite init site' to create a new one.");
907
882
  return;
908
883
  }
909
884
  let sites = siteIds.map((id) => {
910
- const sites = config_1.localConfig.getSites();
885
+ const sites = localConfig.getSites();
911
886
  const site = sites.find((s) => s.$id === id);
912
887
  if (!site) {
913
888
  throw new Error("Site '" + id + "' not found.");
914
889
  }
915
890
  return site;
916
891
  });
917
- (0, parser_1.log)('Validating sites ...');
892
+ log("Validating sites ...");
918
893
  // Validation is done BEFORE pushing so the deployment process can be run in async with progress update
919
894
  for (let site of sites) {
920
895
  if (!site.buildCommand) {
921
- (0, parser_1.log)(`Site ${site.name} is missing build command.`);
922
- const answers = await inquirer_1.default.prompt(questions_1.questionsGetEntrypoint);
896
+ log(`Site ${site.name} is missing build command.`);
897
+ const answers = await inquirer.prompt(questionsGetEntrypoint);
923
898
  site.buildCommand = answers.entrypoint;
924
- config_1.localConfig.addSite(site);
899
+ localConfig.addSite(site);
925
900
  }
926
901
  }
927
- if (!(await approveChanges(sites, sites_1.sitesGet, config_1.KeysSite, 'siteId', 'sites', ['vars']))) {
902
+ if (!(await approveChanges(sites, async (args) => {
903
+ const sitesService = await getSitesService();
904
+ return await sitesService.get({ siteId: args.siteId });
905
+ }, KeysSite, "siteId", "sites", ["vars"]))) {
928
906
  return;
929
907
  }
930
- (0, parser_1.log)('Pushing sites ...');
931
- spinner_1.Spinner.start(false);
908
+ log("Pushing sites ...");
909
+ Spinner.start(false);
932
910
  let successfullyPushed = 0;
933
911
  let successfullyDeployed = 0;
934
912
  const failedDeployments = [];
935
913
  const errors = [];
936
914
  await Promise.all(sites.map(async (site) => {
937
915
  let response = {};
938
- const ignore = site.ignore ? 'appwrite.config.json' : '.gitignore';
916
+ const ignore = site.ignore ? "appwrite.config.json" : ".gitignore";
939
917
  let siteExists = false;
940
918
  let deploymentCreated = false;
941
- const updaterRow = new spinner_1.Spinner({ status: '', resource: site.name, id: site['$id'], end: `Ignoring using: ${ignore}` });
942
- updaterRow.update({ status: 'Getting' }).startSpinner(spinner_1.SPINNER_DOTS);
919
+ const updaterRow = new Spinner({
920
+ status: "",
921
+ resource: site.name,
922
+ id: site["$id"],
923
+ end: `Ignoring using: ${ignore}`,
924
+ });
925
+ updaterRow.update({ status: "Getting" }).startSpinner(SPINNER_DOTS);
926
+ const sitesService = await getSitesService();
943
927
  try {
944
- response = await (0, sites_1.sitesGet)({
945
- siteId: site['$id'],
946
- parseOutput: false,
947
- });
928
+ response = await sitesService.get({ siteId: site["$id"] });
948
929
  siteExists = true;
949
930
  if (response.framework !== site.framework) {
950
- updaterRow.fail({ errorMessage: `Framework mismatch! (local=${site.framework},remote=${response.framework}) Please delete remote site or update your appwrite.config.json` });
931
+ updaterRow.fail({
932
+ errorMessage: `Framework mismatch! (local=${site.framework},remote=${response.framework}) Please delete remote site or update your appwrite.config.json`,
933
+ });
951
934
  return;
952
935
  }
953
- updaterRow.update({ status: 'Updating' }).replaceSpinner(spinner_1.SPINNER_ARC);
954
- response = await (0, sites_1.sitesUpdate)({
955
- siteId: site['$id'],
936
+ updaterRow.update({ status: "Updating" }).replaceSpinner(SPINNER_ARC);
937
+ response = await sitesService.update({
938
+ siteId: site["$id"],
956
939
  name: site.name,
957
940
  framework: site.framework,
958
- buildRuntime: site.buildRuntime,
959
- specification: site.specification,
960
- timeout: site.timeout,
961
941
  enabled: site.enabled,
962
942
  logging: site.logging,
963
- adapter: site.adapter,
964
- buildCommand: site.buildCommand,
943
+ timeout: site.timeout,
965
944
  installCommand: site.installCommand,
945
+ buildCommand: site.buildCommand,
966
946
  outputDirectory: site.outputDirectory,
967
- fallbackFile: site.fallbackFile,
968
- vars: JSON.stringify(response.vars),
969
- parseOutput: false
947
+ buildRuntime: site.buildRuntime,
948
+ adapter: site.adapter,
949
+ specification: site.specification,
970
950
  });
971
951
  }
972
952
  catch (e) {
@@ -975,74 +955,79 @@ const pushSite = async ({ siteId, async: asyncDeploy, code, withVariables } = {
975
955
  }
976
956
  else {
977
957
  errors.push(e);
978
- updaterRow.fail({ errorMessage: e.message ?? 'General error occurs please try again' });
958
+ updaterRow.fail({
959
+ errorMessage: e.message ?? "General error occurs please try again",
960
+ });
979
961
  return;
980
962
  }
981
963
  }
982
964
  if (!siteExists) {
983
- updaterRow.update({ status: 'Creating' }).replaceSpinner(spinner_1.SPINNER_DOTS);
965
+ updaterRow.update({ status: "Creating" }).replaceSpinner(SPINNER_DOTS);
984
966
  try {
985
- response = await (0, sites_1.sitesCreate)({
967
+ response = await sitesService.create({
986
968
  siteId: site.$id,
987
969
  name: site.name,
988
970
  framework: site.framework,
989
- specification: site.specification,
990
- buildRuntime: site.buildRuntime,
991
- buildCommand: site.buildCommand,
971
+ enabled: site.enabled,
972
+ logging: site.logging,
973
+ timeout: site.timeout,
992
974
  installCommand: site.installCommand,
975
+ buildCommand: site.buildCommand,
993
976
  outputDirectory: site.outputDirectory,
994
- fallbackFile: site.fallbackFile,
977
+ buildRuntime: site.buildRuntime,
995
978
  adapter: site.adapter,
996
- timeout: site.timeout,
997
- enabled: site.enabled,
998
- logging: site.logging,
999
- parseOutput: false
979
+ specification: site.specification,
1000
980
  });
1001
- let domain = '';
981
+ let domain = "";
1002
982
  try {
1003
- const variables = await (0, console_1.consoleVariables)({ parseOutput: false, sdk: await (0, sdks_1.sdkForConsole)() });
1004
- domain = id_1.default.unique() + '.' + variables['_APP_DOMAIN_SITES'];
983
+ const consoleService = await getConsoleService();
984
+ const variables = await consoleService.variables();
985
+ domain = ID.unique() + "." + variables["_APP_DOMAIN_SITES"];
1005
986
  }
1006
987
  catch (error) {
1007
- console.error('Error fetching console variables.');
988
+ console.error("Error fetching console variables.");
1008
989
  throw error;
1009
990
  }
1010
991
  try {
1011
- const rule = await (0, proxy_1.proxyCreateSiteRule)({
1012
- domain: domain,
1013
- siteId: site.$id
1014
- });
992
+ const proxyService = await getProxyService();
993
+ const rule = await proxyService.createSiteRule(domain, site.$id);
1015
994
  }
1016
995
  catch (error) {
1017
- console.error('Error creating site rule.');
996
+ console.error("Error creating site rule.");
1018
997
  throw error;
1019
998
  }
1020
- updaterRow.update({ status: 'Created' });
999
+ updaterRow.update({ status: "Created" });
1021
1000
  }
1022
1001
  catch (e) {
1023
1002
  errors.push(e);
1024
- updaterRow.fail({ errorMessage: e.message ?? 'General error occurs please try again' });
1003
+ updaterRow.fail({
1004
+ errorMessage: e.message ?? "General error occurs please try again",
1005
+ });
1025
1006
  return;
1026
1007
  }
1027
1008
  }
1028
1009
  if (withVariables) {
1029
- updaterRow.update({ status: 'Creating variables' }).replaceSpinner(spinner_1.SPINNER_ARC);
1030
- const { variables } = await (0, paginate_1.paginate)(sites_1.sitesListVariables, {
1031
- siteId: site['$id'],
1032
- parseOutput: false
1033
- }, 100, 'variables');
1010
+ updaterRow
1011
+ .update({ status: "Creating variables" })
1012
+ .replaceSpinner(SPINNER_ARC);
1013
+ const sitesService = await getSitesService();
1014
+ const { variables } = await paginate(async (args) => {
1015
+ return await sitesService.listVariables({ siteId: args.siteId });
1016
+ }, {
1017
+ siteId: site["$id"],
1018
+ }, 100, "variables");
1034
1019
  await Promise.all(variables.map(async (variable) => {
1035
- await (0, sites_1.sitesDeleteVariable)({
1036
- siteId: site['$id'],
1037
- variableId: variable['$id'],
1038
- parseOutput: false
1020
+ const sitesService = await getSitesService();
1021
+ await sitesService.deleteVariable({
1022
+ siteId: site["$id"],
1023
+ variableId: variable["$id"],
1039
1024
  });
1040
1025
  }));
1041
- const envFileLocation = `${site['path']}/.env`;
1026
+ const envFileLocation = `${site["path"]}/.env`;
1042
1027
  let envVariables = [];
1043
1028
  try {
1044
1029
  if (fs.existsSync(envFileLocation)) {
1045
- const envObject = (0, dotenv_1.parse)(fs.readFileSync(envFileLocation, 'utf8'));
1030
+ const envObject = parseDotenv(fs.readFileSync(envFileLocation, "utf8"));
1046
1031
  envVariables = Object.entries(envObject || {}).map(([key, value]) => ({ key, value }));
1047
1032
  }
1048
1033
  }
@@ -1051,196 +1036,229 @@ const pushSite = async ({ siteId, async: asyncDeploy, code, withVariables } = {
1051
1036
  envVariables = [];
1052
1037
  }
1053
1038
  await Promise.all(envVariables.map(async (variable) => {
1054
- await (0, sites_1.sitesCreateVariable)({
1055
- siteId: site['$id'],
1039
+ const sitesService = await getSitesService();
1040
+ await sitesService.createVariable({
1041
+ siteId: site["$id"],
1056
1042
  key: variable.key,
1057
1043
  value: variable.value,
1058
- parseOutput: false,
1059
- secret: false
1044
+ secret: false,
1060
1045
  });
1061
1046
  }));
1062
1047
  }
1063
1048
  if (code === false) {
1064
1049
  successfullyPushed++;
1065
1050
  successfullyDeployed++;
1066
- updaterRow.update({ status: 'Pushed' });
1051
+ updaterRow.update({ status: "Pushed" });
1067
1052
  updaterRow.stopSpinner();
1068
1053
  return;
1069
1054
  }
1070
1055
  try {
1071
- updaterRow.update({ status: 'Pushing' }).replaceSpinner(spinner_1.SPINNER_ARC);
1072
- response = await (0, sites_1.sitesCreateDeployment)({
1073
- siteId: site['$id'],
1074
- buildCommand: site.buildCommand,
1056
+ updaterRow.update({ status: "Pushing" }).replaceSpinner(SPINNER_ARC);
1057
+ const sitesService = await getSitesService();
1058
+ response = await sitesService.createDeployment({
1059
+ siteId: site["$id"],
1075
1060
  installCommand: site.installCommand,
1061
+ buildCommand: site.buildCommand,
1076
1062
  outputDirectory: site.outputDirectory,
1077
- fallbackFile: site.fallbackFile,
1078
1063
  code: site.path,
1079
1064
  activate: true,
1080
- parseOutput: false
1081
1065
  });
1082
- updaterRow.update({ status: 'Pushed' });
1066
+ updaterRow.update({ status: "Pushed" });
1083
1067
  deploymentCreated = true;
1084
1068
  successfullyPushed++;
1085
1069
  }
1086
1070
  catch (e) {
1087
1071
  errors.push(e);
1088
1072
  switch (e.code) {
1089
- case 'ENOENT':
1090
- updaterRow.fail({ errorMessage: 'Not found in the current directory. Skipping...' });
1073
+ case "ENOENT":
1074
+ updaterRow.fail({
1075
+ errorMessage: "Not found in the current directory. Skipping...",
1076
+ });
1091
1077
  break;
1092
1078
  default:
1093
- updaterRow.fail({ errorMessage: e.message ?? 'An unknown error occurred. Please try again.' });
1079
+ updaterRow.fail({
1080
+ errorMessage: e.message ?? "An unknown error occurred. Please try again.",
1081
+ });
1094
1082
  }
1095
1083
  }
1096
1084
  if (deploymentCreated && !asyncDeploy) {
1097
1085
  try {
1098
- const deploymentId = response['$id'];
1099
- updaterRow.update({ status: 'Deploying', end: 'Checking deployment status...' });
1086
+ const deploymentId = response["$id"];
1087
+ updaterRow.update({
1088
+ status: "Deploying",
1089
+ end: "Checking deployment status...",
1090
+ });
1100
1091
  let pollChecks = 0;
1101
1092
  while (true) {
1102
- response = await (0, sites_1.sitesGetDeployment)({
1103
- siteId: site['$id'],
1093
+ const sitesService = await getSitesService();
1094
+ response = await sitesService.getDeployment({
1095
+ siteId: site["$id"],
1104
1096
  deploymentId: deploymentId,
1105
- parseOutput: false
1106
1097
  });
1107
- const status = response['status'];
1108
- if (status === 'ready') {
1098
+ const status = response["status"];
1099
+ if (status === "ready") {
1109
1100
  successfullyDeployed++;
1110
- let url = '';
1111
- const res = await (0, proxy_1.proxyListRules)({
1112
- parseOutput: false,
1113
- queries: [
1114
- JSON.stringify({ method: 'limit', values: [1] }),
1115
- JSON.stringify({ method: 'equal', "attribute": "deploymentResourceType", "values": ["site"] }),
1116
- JSON.stringify({ method: 'equal', "attribute": "deploymentResourceId", "values": [site['$id']] }),
1117
- JSON.stringify({ method: 'equal', "attribute": "trigger", "values": ["manual"] }),
1118
- ],
1119
- });
1101
+ let url = "";
1102
+ const proxyService = await getProxyService();
1103
+ const res = await proxyService.listRules([
1104
+ JSON.stringify({ method: "limit", values: [1] }),
1105
+ JSON.stringify({
1106
+ method: "equal",
1107
+ attribute: "deploymentResourceType",
1108
+ values: ["site"],
1109
+ }),
1110
+ JSON.stringify({
1111
+ method: "equal",
1112
+ attribute: "deploymentResourceId",
1113
+ values: [site["$id"]],
1114
+ }),
1115
+ JSON.stringify({
1116
+ method: "equal",
1117
+ attribute: "trigger",
1118
+ values: ["manual"],
1119
+ }),
1120
+ ]);
1120
1121
  if (Number(res.total) === 1) {
1121
1122
  url = res.rules[0].domain;
1122
1123
  }
1123
- updaterRow.update({ status: 'Deployed', end: url });
1124
+ updaterRow.update({ status: "Deployed", end: url });
1124
1125
  break;
1125
1126
  }
1126
- else if (status === 'failed') {
1127
- failedDeployments.push({ name: site['name'], $id: site['$id'], deployment: response['$id'] });
1127
+ else if (status === "failed") {
1128
+ failedDeployments.push({
1129
+ name: site["name"],
1130
+ $id: site["$id"],
1131
+ deployment: response["$id"],
1132
+ });
1128
1133
  updaterRow.fail({ errorMessage: `Failed to deploy` });
1129
1134
  break;
1130
1135
  }
1131
1136
  else {
1132
- updaterRow.update({ status: 'Deploying', end: `Current status: ${status}` });
1137
+ updaterRow.update({
1138
+ status: "Deploying",
1139
+ end: `Current status: ${status}`,
1140
+ });
1133
1141
  }
1134
1142
  pollChecks++;
1135
- await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE * 1.5));
1143
+ await new Promise((resolve) => setTimeout(resolve, POLL_DEBOUNCE * 1.5));
1136
1144
  }
1137
1145
  }
1138
1146
  catch (e) {
1139
1147
  errors.push(e);
1140
- updaterRow.fail({ errorMessage: e.message ?? 'Unknown error occurred. Please try again' });
1148
+ updaterRow.fail({
1149
+ errorMessage: e.message ?? "Unknown error occurred. Please try again",
1150
+ });
1141
1151
  }
1142
1152
  }
1143
1153
  updaterRow.stopSpinner();
1144
1154
  }));
1145
- spinner_1.Spinner.stop();
1155
+ Spinner.stop();
1146
1156
  failedDeployments.forEach((failed) => {
1147
1157
  const { name, deployment, $id } = failed;
1148
- const failUrl = `${config_1.globalConfig.getEndpoint().slice(0, -3)}/console/project-${config_1.localConfig.getProject().projectId}/sites/site-${$id}/deployments/deployment-${deployment}`;
1149
- (0, parser_1.error)(`Deployment of ${name} has failed. Check at ${failUrl} for more details\n`);
1158
+ const failUrl = `${globalConfig.getEndpoint().slice(0, -3)}/console/project-${localConfig.getProject().projectId}/sites/site-${$id}/deployments/deployment-${deployment}`;
1159
+ error(`Deployment of ${name} has failed. Check at ${failUrl} for more details\n`);
1150
1160
  });
1151
1161
  if (!asyncDeploy) {
1152
1162
  if (successfullyPushed === 0) {
1153
- (0, parser_1.error)('No sites were pushed.');
1163
+ error("No sites were pushed.");
1154
1164
  }
1155
1165
  else if (successfullyDeployed !== successfullyPushed) {
1156
- (0, parser_1.warn)(`Successfully pushed ${successfullyDeployed} of ${successfullyPushed} sites`);
1166
+ warn(`Successfully pushed ${successfullyDeployed} of ${successfullyPushed} sites`);
1157
1167
  }
1158
1168
  else {
1159
- (0, parser_1.success)(`Successfully pushed ${successfullyPushed} sites.`);
1169
+ success(`Successfully pushed ${successfullyPushed} sites.`);
1160
1170
  }
1161
1171
  }
1162
1172
  else {
1163
- (0, parser_1.success)(`Successfully pushed ${successfullyPushed} sites.`);
1173
+ success(`Successfully pushed ${successfullyPushed} sites.`);
1164
1174
  }
1165
- if (parser_1.cliConfig.verbose) {
1166
- errors.forEach(e => {
1175
+ if (cliConfig.verbose) {
1176
+ errors.forEach((e) => {
1167
1177
  console.error(e);
1168
1178
  });
1169
1179
  }
1170
1180
  };
1171
- const pushFunction = async ({ functionId, async: asyncDeploy, code, withVariables } = { returnOnZero: false }) => {
1172
- process.chdir(config_1.localConfig.configDirectoryPath);
1181
+ const pushFunction = async ({ functionId, async: asyncDeploy, code, withVariables, } = {}) => {
1182
+ process.chdir(localConfig.configDirectoryPath);
1173
1183
  const functionIds = [];
1174
1184
  if (functionId) {
1175
1185
  functionIds.push(functionId);
1176
1186
  }
1177
- else if (parser_1.cliConfig.all) {
1178
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
1179
- const functions = config_1.localConfig.getFunctions();
1187
+ else if (cliConfig.all) {
1188
+ checkDeployConditions(localConfig);
1189
+ const functions = localConfig.getFunctions();
1180
1190
  functionIds.push(...functions.map((func) => {
1181
1191
  return func.$id;
1182
1192
  }));
1183
1193
  }
1184
1194
  if (functionIds.length <= 0) {
1185
- const answers = await inquirer_1.default.prompt(questions_1.questionsPushFunctions[0]);
1195
+ const answers = await inquirer.prompt(questionsPushFunctions);
1186
1196
  if (answers.functions) {
1187
1197
  functionIds.push(...answers.functions);
1188
1198
  }
1189
1199
  }
1190
1200
  if (functionIds.length === 0) {
1191
- (0, parser_1.log)("No functions found.");
1192
- (0, parser_1.hint)("Use 'appwrite pull functions' to synchronize existing one, or use 'appwrite init function' to create a new one.");
1201
+ log("No functions found.");
1202
+ hint("Use 'appwrite pull functions' to synchronize existing one, or use 'appwrite init function' to create a new one.");
1193
1203
  return;
1194
1204
  }
1195
1205
  let functions = functionIds.map((id) => {
1196
- const functions = config_1.localConfig.getFunctions();
1206
+ const functions = localConfig.getFunctions();
1197
1207
  const func = functions.find((f) => f.$id === id);
1198
1208
  if (!func) {
1199
1209
  throw new Error("Function '" + id + "' not found.");
1200
1210
  }
1201
1211
  return func;
1202
1212
  });
1203
- (0, parser_1.log)('Validating functions ...');
1213
+ log("Validating functions ...");
1204
1214
  // Validation is done BEFORE pushing so the deployment process can be run in async with progress update
1205
1215
  for (let func of functions) {
1206
1216
  if (!func.entrypoint) {
1207
- (0, parser_1.log)(`Function ${func.name} is missing an entrypoint.`);
1208
- const answers = await inquirer_1.default.prompt(questions_1.questionsGetEntrypoint);
1217
+ log(`Function ${func.name} is missing an entrypoint.`);
1218
+ const answers = await inquirer.prompt(questionsGetEntrypoint);
1209
1219
  func.entrypoint = answers.entrypoint;
1210
- config_1.localConfig.addFunction(func);
1220
+ localConfig.addFunction(func);
1211
1221
  }
1212
1222
  }
1213
- if (!(await approveChanges(functions, functions_1.functionsGet, config_1.KeysFunction, 'functionId', 'functions', ['vars']))) {
1223
+ if (!(await approveChanges(functions, async (args) => {
1224
+ const functionsService = await getFunctionsService();
1225
+ return await functionsService.get({ functionId: args.functionId });
1226
+ }, KeysFunction, "functionId", "functions", ["vars"]))) {
1214
1227
  return;
1215
1228
  }
1216
- (0, parser_1.log)('Pushing functions ...');
1217
- spinner_1.Spinner.start(false);
1229
+ log("Pushing functions ...");
1230
+ Spinner.start(false);
1218
1231
  let successfullyPushed = 0;
1219
1232
  let successfullyDeployed = 0;
1220
1233
  const failedDeployments = [];
1221
1234
  const errors = [];
1222
1235
  await Promise.all(functions.map(async (func) => {
1223
1236
  let response = {};
1224
- const ignore = func.ignore ? 'appwrite.config.json' : '.gitignore';
1237
+ const ignore = func.ignore ? "appwrite.config.json" : ".gitignore";
1225
1238
  let functionExists = false;
1226
1239
  let deploymentCreated = false;
1227
- const updaterRow = new spinner_1.Spinner({ status: '', resource: func.name, id: func['$id'], end: `Ignoring using: ${ignore}` });
1228
- updaterRow.update({ status: 'Getting' }).startSpinner(spinner_1.SPINNER_DOTS);
1240
+ const updaterRow = new Spinner({
1241
+ status: "",
1242
+ resource: func.name,
1243
+ id: func["$id"],
1244
+ end: `Ignoring using: ${ignore}`,
1245
+ });
1246
+ updaterRow.update({ status: "Getting" }).startSpinner(SPINNER_DOTS);
1247
+ const functionsService = await getFunctionsService();
1229
1248
  try {
1230
- response = await (0, functions_1.functionsGet)({
1231
- functionId: func['$id'],
1232
- parseOutput: false,
1233
- });
1249
+ response = await functionsService.get({ functionId: func["$id"] });
1234
1250
  functionExists = true;
1235
1251
  if (response.runtime !== func.runtime) {
1236
- updaterRow.fail({ errorMessage: `Runtime mismatch! (local=${func.runtime},remote=${response.runtime}) Please delete remote function or update your appwrite.config.json` });
1252
+ updaterRow.fail({
1253
+ errorMessage: `Runtime mismatch! (local=${func.runtime},remote=${response.runtime}) Please delete remote function or update your appwrite.config.json`,
1254
+ });
1237
1255
  return;
1238
1256
  }
1239
- updaterRow.update({ status: 'Updating' }).replaceSpinner(spinner_1.SPINNER_ARC);
1240
- response = await (0, functions_1.functionsUpdate)({
1241
- functionId: func['$id'],
1257
+ updaterRow.update({ status: "Updating" }).replaceSpinner(SPINNER_ARC);
1258
+ response = await functionsService.update({
1259
+ functionId: func["$id"],
1242
1260
  name: func.name,
1243
- specification: func.specification,
1261
+ runtime: func.runtime,
1244
1262
  execute: func.execute,
1245
1263
  events: func.events,
1246
1264
  schedule: func.schedule,
@@ -1250,8 +1268,7 @@ const pushFunction = async ({ functionId, async: asyncDeploy, code, withVariable
1250
1268
  entrypoint: func.entrypoint,
1251
1269
  commands: func.commands,
1252
1270
  scopes: func.scopes,
1253
- vars: JSON.stringify(response.vars),
1254
- parseOutput: false
1271
+ specification: func.specification,
1255
1272
  });
1256
1273
  }
1257
1274
  catch (e) {
@@ -1260,18 +1277,19 @@ const pushFunction = async ({ functionId, async: asyncDeploy, code, withVariable
1260
1277
  }
1261
1278
  else {
1262
1279
  errors.push(e);
1263
- updaterRow.fail({ errorMessage: e.message ?? 'General error occurs please try again' });
1280
+ updaterRow.fail({
1281
+ errorMessage: e.message ?? "General error occurs please try again",
1282
+ });
1264
1283
  return;
1265
1284
  }
1266
1285
  }
1267
1286
  if (!functionExists) {
1268
- updaterRow.update({ status: 'Creating' }).replaceSpinner(spinner_1.SPINNER_DOTS);
1287
+ updaterRow.update({ status: "Creating" }).replaceSpinner(SPINNER_DOTS);
1269
1288
  try {
1270
- response = await (0, functions_1.functionsCreate)({
1289
+ response = await functionsService.create({
1271
1290
  functionId: func.$id,
1272
1291
  name: func.name,
1273
1292
  runtime: func.runtime,
1274
- specification: func.specification,
1275
1293
  execute: func.execute,
1276
1294
  events: func.events,
1277
1295
  schedule: func.schedule,
@@ -1281,53 +1299,60 @@ const pushFunction = async ({ functionId, async: asyncDeploy, code, withVariable
1281
1299
  entrypoint: func.entrypoint,
1282
1300
  commands: func.commands,
1283
1301
  scopes: func.scopes,
1284
- parseOutput: false
1302
+ specification: func.specification,
1285
1303
  });
1286
- let domain = '';
1304
+ let domain = "";
1287
1305
  try {
1288
- const variables = await (0, console_1.consoleVariables)({ parseOutput: false, sdk: await (0, sdks_1.sdkForConsole)() });
1289
- domain = id_1.default.unique() + '.' + variables['_APP_DOMAIN_FUNCTIONS'];
1306
+ const consoleService = await getConsoleService();
1307
+ const variables = await consoleService.variables();
1308
+ domain = ID.unique() + "." + variables["_APP_DOMAIN_FUNCTIONS"];
1290
1309
  }
1291
1310
  catch (error) {
1292
- console.error('Error fetching console variables.');
1311
+ console.error("Error fetching console variables.");
1293
1312
  throw error;
1294
1313
  }
1295
1314
  try {
1296
- const rule = await (0, proxy_1.proxyCreateFunctionRule)({
1297
- domain: domain,
1298
- functionId: func.$id
1299
- });
1315
+ const proxyService = await getProxyService();
1316
+ const rule = await proxyService.createFunctionRule(domain, func.$id);
1300
1317
  }
1301
1318
  catch (error) {
1302
- console.error('Error creating function rule.');
1319
+ console.error("Error creating function rule.");
1303
1320
  throw error;
1304
1321
  }
1305
- updaterRow.update({ status: 'Created' });
1322
+ updaterRow.update({ status: "Created" });
1306
1323
  }
1307
1324
  catch (e) {
1308
1325
  errors.push(e);
1309
- updaterRow.fail({ errorMessage: e.message ?? 'General error occurs please try again' });
1326
+ updaterRow.fail({
1327
+ errorMessage: e.message ?? "General error occurs please try again",
1328
+ });
1310
1329
  return;
1311
1330
  }
1312
1331
  }
1313
1332
  if (withVariables) {
1314
- updaterRow.update({ status: 'Updating variables' }).replaceSpinner(spinner_1.SPINNER_ARC);
1315
- const { variables } = await (0, paginate_1.paginate)(functions_1.functionsListVariables, {
1316
- functionId: func['$id'],
1317
- parseOutput: false
1318
- }, 100, 'variables');
1333
+ updaterRow
1334
+ .update({ status: "Updating variables" })
1335
+ .replaceSpinner(SPINNER_ARC);
1336
+ const functionsService = await getFunctionsService();
1337
+ const { variables } = await paginate(async (args) => {
1338
+ return await functionsService.listVariables({
1339
+ functionId: args.functionId,
1340
+ });
1341
+ }, {
1342
+ functionId: func["$id"],
1343
+ }, 100, "variables");
1319
1344
  await Promise.all(variables.map(async (variable) => {
1320
- await (0, functions_1.functionsDeleteVariable)({
1321
- functionId: func['$id'],
1322
- variableId: variable['$id'],
1323
- parseOutput: false
1345
+ const functionsService = await getFunctionsService();
1346
+ await functionsService.deleteVariable({
1347
+ functionId: func["$id"],
1348
+ variableId: variable["$id"],
1324
1349
  });
1325
1350
  }));
1326
- const envFileLocation = `${func['path']}/.env`;
1351
+ const envFileLocation = `${func["path"]}/.env`;
1327
1352
  let envVariables = [];
1328
1353
  try {
1329
1354
  if (fs.existsSync(envFileLocation)) {
1330
- const envObject = (0, dotenv_1.parse)(fs.readFileSync(envFileLocation, 'utf8'));
1355
+ const envObject = parseDotenv(fs.readFileSync(envFileLocation, "utf8"));
1331
1356
  envVariables = Object.entries(envObject || {}).map(([key, value]) => ({ key, value }));
1332
1357
  }
1333
1358
  }
@@ -1336,126 +1361,154 @@ const pushFunction = async ({ functionId, async: asyncDeploy, code, withVariable
1336
1361
  envVariables = [];
1337
1362
  }
1338
1363
  await Promise.all(envVariables.map(async (variable) => {
1339
- await (0, functions_1.functionsCreateVariable)({
1340
- functionId: func['$id'],
1341
- variableId: id_1.default.unique(),
1364
+ const functionsService = await getFunctionsService();
1365
+ await functionsService.createVariable({
1366
+ functionId: func["$id"],
1342
1367
  key: variable.key,
1343
1368
  value: variable.value,
1344
- parseOutput: false,
1345
- secret: false
1369
+ secret: false,
1346
1370
  });
1347
1371
  }));
1348
1372
  }
1349
1373
  if (code === false) {
1350
1374
  successfullyPushed++;
1351
1375
  successfullyDeployed++;
1352
- updaterRow.update({ status: 'Pushed' });
1376
+ updaterRow.update({ status: "Pushed" });
1353
1377
  updaterRow.stopSpinner();
1354
1378
  return;
1355
1379
  }
1356
1380
  try {
1357
- updaterRow.update({ status: 'Pushing' }).replaceSpinner(spinner_1.SPINNER_ARC);
1358
- response = await (0, functions_1.functionsCreateDeployment)({
1359
- functionId: func['$id'],
1381
+ updaterRow.update({ status: "Pushing" }).replaceSpinner(SPINNER_ARC);
1382
+ const functionsService = await getFunctionsService();
1383
+ response = await functionsService.createDeployment({
1384
+ functionId: func["$id"],
1360
1385
  entrypoint: func.entrypoint,
1361
1386
  commands: func.commands,
1362
1387
  code: func.path,
1363
1388
  activate: true,
1364
- parseOutput: false
1365
1389
  });
1366
- updaterRow.update({ status: 'Pushed' });
1390
+ updaterRow.update({ status: "Pushed" });
1367
1391
  deploymentCreated = true;
1368
1392
  successfullyPushed++;
1369
1393
  }
1370
1394
  catch (e) {
1371
1395
  errors.push(e);
1372
1396
  switch (e.code) {
1373
- case 'ENOENT':
1374
- updaterRow.fail({ errorMessage: 'Not found in the current directory. Skipping...' });
1397
+ case "ENOENT":
1398
+ updaterRow.fail({
1399
+ errorMessage: "Not found in the current directory. Skipping...",
1400
+ });
1375
1401
  break;
1376
1402
  default:
1377
- updaterRow.fail({ errorMessage: e.message ?? 'An unknown error occurred. Please try again.' });
1403
+ updaterRow.fail({
1404
+ errorMessage: e.message ?? "An unknown error occurred. Please try again.",
1405
+ });
1378
1406
  }
1379
1407
  }
1380
1408
  if (deploymentCreated && !asyncDeploy) {
1381
1409
  try {
1382
- const deploymentId = response['$id'];
1383
- updaterRow.update({ status: 'Deploying', end: 'Checking deployment status...' });
1410
+ const deploymentId = response["$id"];
1411
+ updaterRow.update({
1412
+ status: "Deploying",
1413
+ end: "Checking deployment status...",
1414
+ });
1384
1415
  let pollChecks = 0;
1385
1416
  while (true) {
1386
- response = await (0, functions_1.functionsGetDeployment)({
1387
- functionId: func['$id'],
1417
+ const functionsService = await getFunctionsService();
1418
+ response = await functionsService.getDeployment({
1419
+ functionId: func["$id"],
1388
1420
  deploymentId: deploymentId,
1389
- parseOutput: false
1390
1421
  });
1391
- const status = response['status'];
1392
- if (status === 'ready') {
1422
+ const status = response["status"];
1423
+ if (status === "ready") {
1393
1424
  successfullyDeployed++;
1394
- let url = '';
1395
- const res = await (0, proxy_1.proxyListRules)({
1396
- parseOutput: false,
1397
- queries: [
1398
- JSON.stringify({ method: 'limit', values: [1] }),
1399
- JSON.stringify({ method: 'equal', "attribute": "deploymentResourceType", "values": ["function"] }),
1400
- JSON.stringify({ method: 'equal', "attribute": "deploymentResourceId", "values": [func['$id']] }),
1401
- JSON.stringify({ method: 'equal', "attribute": "trigger", "values": ["manual"] }),
1402
- ],
1403
- });
1425
+ let url = "";
1426
+ const proxyService = await getProxyService();
1427
+ const res = await proxyService.listRules([
1428
+ JSON.stringify({ method: "limit", values: [1] }),
1429
+ JSON.stringify({
1430
+ method: "equal",
1431
+ attribute: "deploymentResourceType",
1432
+ values: ["function"],
1433
+ }),
1434
+ JSON.stringify({
1435
+ method: "equal",
1436
+ attribute: "deploymentResourceId",
1437
+ values: [func["$id"]],
1438
+ }),
1439
+ JSON.stringify({
1440
+ method: "equal",
1441
+ attribute: "trigger",
1442
+ values: ["manual"],
1443
+ }),
1444
+ ]);
1404
1445
  if (Number(res.total) === 1) {
1405
1446
  url = res.rules[0].domain;
1406
1447
  }
1407
- updaterRow.update({ status: 'Deployed', end: url });
1448
+ updaterRow.update({ status: "Deployed", end: url });
1408
1449
  break;
1409
1450
  }
1410
- else if (status === 'failed') {
1411
- failedDeployments.push({ name: func['name'], $id: func['$id'], deployment: response['$id'] });
1451
+ else if (status === "failed") {
1452
+ failedDeployments.push({
1453
+ name: func["name"],
1454
+ $id: func["$id"],
1455
+ deployment: response["$id"],
1456
+ });
1412
1457
  updaterRow.fail({ errorMessage: `Failed to deploy` });
1413
1458
  break;
1414
1459
  }
1415
1460
  else {
1416
- updaterRow.update({ status: 'Deploying', end: `Current status: ${status}` });
1461
+ updaterRow.update({
1462
+ status: "Deploying",
1463
+ end: `Current status: ${status}`,
1464
+ });
1417
1465
  }
1418
1466
  pollChecks++;
1419
- await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE * 1.5));
1467
+ await new Promise((resolve) => setTimeout(resolve, POLL_DEBOUNCE * 1.5));
1420
1468
  }
1421
1469
  }
1422
1470
  catch (e) {
1423
1471
  errors.push(e);
1424
- updaterRow.fail({ errorMessage: e.message ?? 'Unknown error occurred. Please try again' });
1472
+ updaterRow.fail({
1473
+ errorMessage: e.message ?? "Unknown error occurred. Please try again",
1474
+ });
1425
1475
  }
1426
1476
  }
1427
1477
  updaterRow.stopSpinner();
1428
1478
  }));
1429
- spinner_1.Spinner.stop();
1479
+ Spinner.stop();
1430
1480
  failedDeployments.forEach((failed) => {
1431
1481
  const { name, deployment, $id } = failed;
1432
- const failUrl = `${config_1.globalConfig.getEndpoint().slice(0, -3)}/console/project-${config_1.localConfig.getProject().projectId}/functions/function-${$id}/deployment-${deployment}`;
1433
- (0, parser_1.error)(`Deployment of ${name} has failed. Check at ${failUrl} for more details\n`);
1482
+ const failUrl = `${globalConfig.getEndpoint().slice(0, -3)}/console/project-${localConfig.getProject().projectId}/functions/function-${$id}/deployment-${deployment}`;
1483
+ error(`Deployment of ${name} has failed. Check at ${failUrl} for more details\n`);
1434
1484
  });
1435
1485
  if (!asyncDeploy) {
1436
1486
  if (successfullyPushed === 0) {
1437
- (0, parser_1.error)('No functions were pushed.');
1487
+ error("No functions were pushed.");
1438
1488
  }
1439
1489
  else if (successfullyDeployed !== successfullyPushed) {
1440
- (0, parser_1.warn)(`Successfully pushed ${successfullyDeployed} of ${successfullyPushed} functions`);
1490
+ warn(`Successfully pushed ${successfullyDeployed} of ${successfullyPushed} functions`);
1441
1491
  }
1442
1492
  else {
1443
- (0, parser_1.success)(`Successfully pushed ${successfullyPushed} functions.`);
1493
+ success(`Successfully pushed ${successfullyPushed} functions.`);
1444
1494
  }
1445
1495
  }
1446
1496
  else {
1447
- (0, parser_1.success)(`Successfully pushed ${successfullyPushed} functions.`);
1497
+ success(`Successfully pushed ${successfullyPushed} functions.`);
1448
1498
  }
1449
- if (parser_1.cliConfig.verbose) {
1450
- errors.forEach(e => {
1499
+ if (cliConfig.verbose) {
1500
+ errors.forEach((e) => {
1451
1501
  console.error(e);
1452
1502
  });
1453
1503
  }
1454
1504
  };
1455
1505
  const checkAndApplyTablesDBChanges = async () => {
1456
- (0, parser_1.log)('Checking for tablesDB changes ...');
1457
- const localTablesDBs = config_1.localConfig.getTablesDBs();
1458
- const { databases: remoteTablesDBs } = await (0, paginate_1.paginate)(tables_db_1.tablesDBList, { parseOutput: false }, 100, 'databases');
1506
+ log("Checking for tablesDB changes ...");
1507
+ const localTablesDBs = localConfig.getTablesDBs();
1508
+ const { databases: remoteTablesDBs } = await paginate(async (args) => {
1509
+ const tablesDBService = await getTablesDBService();
1510
+ return await tablesDBService.list(args.queries || []);
1511
+ }, {}, 100, "databases");
1459
1512
  if (localTablesDBs.length === 0 && remoteTablesDBs.length === 0) {
1460
1513
  return { applied: false, resyncNeeded: false };
1461
1514
  }
@@ -1470,10 +1523,10 @@ const checkAndApplyTablesDBChanges = async () => {
1470
1523
  toDelete.push(remoteDB);
1471
1524
  changes.push({
1472
1525
  id: remoteDB.$id,
1473
- action: chalk_1.default.red('deleting'),
1474
- key: 'Database',
1526
+ action: chalk.red("deleting"),
1527
+ key: "Database",
1475
1528
  remote: remoteDB.name,
1476
- local: '(deleted locally)'
1529
+ local: "(deleted locally)",
1477
1530
  });
1478
1531
  }
1479
1532
  }
@@ -1484,10 +1537,10 @@ const checkAndApplyTablesDBChanges = async () => {
1484
1537
  toCreate.push(localDB);
1485
1538
  changes.push({
1486
1539
  id: localDB.$id,
1487
- action: chalk_1.default.green('creating'),
1488
- key: 'Database',
1489
- remote: '(does not exist)',
1490
- local: localDB.name
1540
+ action: chalk.green("creating"),
1541
+ key: "Database",
1542
+ remote: "(does not exist)",
1543
+ local: localDB.name,
1491
1544
  });
1492
1545
  }
1493
1546
  else {
@@ -1496,20 +1549,20 @@ const checkAndApplyTablesDBChanges = async () => {
1496
1549
  hasChanges = true;
1497
1550
  changes.push({
1498
1551
  id: localDB.$id,
1499
- action: chalk_1.default.yellow('updating'),
1500
- key: 'Name',
1552
+ action: chalk.yellow("updating"),
1553
+ key: "Name",
1501
1554
  remote: remoteDB.name,
1502
- local: localDB.name
1555
+ local: localDB.name,
1503
1556
  });
1504
1557
  }
1505
1558
  if (remoteDB.enabled !== localDB.enabled) {
1506
1559
  hasChanges = true;
1507
1560
  changes.push({
1508
1561
  id: localDB.$id,
1509
- action: chalk_1.default.yellow('updating'),
1510
- key: 'Enabled',
1562
+ action: chalk.yellow("updating"),
1563
+ key: "Enabled",
1511
1564
  remote: remoteDB.enabled,
1512
- local: localDB.enabled
1565
+ local: localDB.enabled,
1513
1566
  });
1514
1567
  }
1515
1568
  if (hasChanges) {
@@ -1518,16 +1571,14 @@ const checkAndApplyTablesDBChanges = async () => {
1518
1571
  }
1519
1572
  }
1520
1573
  if (changes.length === 0) {
1521
- console.log('No changes found in tablesDB resource');
1522
- console.log();
1523
1574
  return { applied: false, resyncNeeded: false };
1524
1575
  }
1525
- (0, parser_1.log)('Found changes in tablesDB resource:');
1526
- (0, parser_1.drawTable)(changes);
1576
+ log("Found changes in tablesDB resource:");
1577
+ drawTable(changes);
1527
1578
  if (toDelete.length > 0) {
1528
- console.log(`${chalk_1.default.red('------------------------------------------------------------------')}`);
1529
- console.log(`${chalk_1.default.red('| WARNING: Database deletion will also delete all related tables |')}`);
1530
- console.log(`${chalk_1.default.red('------------------------------------------------------------------')}`);
1579
+ console.log(`${chalk.red("------------------------------------------------------------------")}`);
1580
+ console.log(`${chalk.red("| WARNING: Database deletion will also delete all related tables |")}`);
1581
+ console.log(`${chalk.red("------------------------------------------------------------------")}`);
1531
1582
  console.log();
1532
1583
  }
1533
1584
  if ((await getConfirmation()) !== true) {
@@ -1537,50 +1588,40 @@ const checkAndApplyTablesDBChanges = async () => {
1537
1588
  let needsResync = false;
1538
1589
  for (const db of toDelete) {
1539
1590
  try {
1540
- (0, parser_1.log)(`Deleting database ${db.name} ( ${db.$id} ) ...`);
1541
- await (0, tables_db_1.tablesDBDelete)({
1542
- databaseId: db.$id,
1543
- parseOutput: false
1544
- });
1545
- (0, parser_1.success)(`Deleted ${db.name} ( ${db.$id} )`);
1591
+ log(`Deleting database ${db.name} ( ${db.$id} ) ...`);
1592
+ const tablesDBService = await getTablesDBService();
1593
+ await tablesDBService.delete(db.$id);
1594
+ success(`Deleted ${db.name} ( ${db.$id} )`);
1546
1595
  needsResync = true;
1547
1596
  }
1548
1597
  catch (e) {
1549
- (0, parser_1.error)(`Failed to delete database ${db.name} ( ${db.$id} ): ${e.message}`);
1598
+ error(`Failed to delete database ${db.name} ( ${db.$id} ): ${e.message}`);
1550
1599
  throw new Error(`Database sync failed during deletion of ${db.$id}. Some changes may have been applied.`);
1551
1600
  }
1552
1601
  }
1553
1602
  // Apply creations
1554
1603
  for (const db of toCreate) {
1555
1604
  try {
1556
- (0, parser_1.log)(`Creating database ${db.name} ( ${db.$id} ) ...`);
1557
- await (0, tables_db_1.tablesDBCreate)({
1558
- databaseId: db.$id,
1559
- name: db.name,
1560
- enabled: db.enabled,
1561
- parseOutput: false
1562
- });
1563
- (0, parser_1.success)(`Created ${db.name} ( ${db.$id} )`);
1605
+ log(`Creating database ${db.name} ( ${db.$id} ) ...`);
1606
+ const tablesDBService = await getTablesDBService();
1607
+ await tablesDBService.create(db.$id, db.name, db.enabled);
1608
+ success(`Created ${db.name} ( ${db.$id} )`);
1564
1609
  }
1565
1610
  catch (e) {
1566
- (0, parser_1.error)(`Failed to create database ${db.name} ( ${db.$id} ): ${e.message}`);
1611
+ error(`Failed to create database ${db.name} ( ${db.$id} ): ${e.message}`);
1567
1612
  throw new Error(`Database sync failed during creation of ${db.$id}. Some changes may have been applied.`);
1568
1613
  }
1569
1614
  }
1570
1615
  // Apply updates
1571
1616
  for (const db of toUpdate) {
1572
1617
  try {
1573
- (0, parser_1.log)(`Updating database ${db.name} ( ${db.$id} ) ...`);
1574
- await (0, tables_db_1.tablesDBUpdate)({
1575
- databaseId: db.$id,
1576
- name: db.name,
1577
- enabled: db.enabled,
1578
- parseOutput: false
1579
- });
1580
- (0, parser_1.success)(`Updated ${db.name} ( ${db.$id} )`);
1618
+ log(`Updating database ${db.name} ( ${db.$id} ) ...`);
1619
+ const tablesDBService = await getTablesDBService();
1620
+ await tablesDBService.update(db.$id, db.name, db.enabled);
1621
+ success(`Updated ${db.name} ( ${db.$id} )`);
1581
1622
  }
1582
1623
  catch (e) {
1583
- (0, parser_1.error)(`Failed to update database ${db.name} ( ${db.$id} ): ${e.message}`);
1624
+ error(`Failed to update database ${db.name} ( ${db.$id} ): ${e.message}`);
1584
1625
  throw new Error(`Database sync failed during update of ${db.$id}. Some changes may have been applied.`);
1585
1626
  }
1586
1627
  }
@@ -1589,42 +1630,47 @@ const checkAndApplyTablesDBChanges = async () => {
1589
1630
  }
1590
1631
  return { applied: true, resyncNeeded: needsResync };
1591
1632
  };
1592
- const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) => {
1633
+ const pushTable = async ({ attempts, } = {}) => {
1593
1634
  const tables = [];
1594
1635
  if (attempts) {
1595
1636
  pollMaxDebounces = attempts;
1596
1637
  }
1597
1638
  const { applied: tablesDBApplied, resyncNeeded } = await checkAndApplyTablesDBChanges();
1598
1639
  if (resyncNeeded) {
1599
- (0, parser_1.log)('Resyncing configuration due to tablesDB deletions ...');
1600
- const remoteTablesDBs = (await (0, paginate_1.paginate)(tables_db_1.tablesDBList, { parseOutput: false }, 100, 'databases')).databases;
1601
- const localTablesDBs = config_1.localConfig.getTablesDBs();
1640
+ log("Resyncing configuration due to tablesDB deletions ...");
1641
+ const remoteTablesDBs = (await paginate(async (args) => {
1642
+ const tablesDBService = await getTablesDBService();
1643
+ return await tablesDBService.list(args.queries || []);
1644
+ }, {}, 100, "databases")).databases;
1645
+ const localTablesDBs = localConfig.getTablesDBs();
1602
1646
  const remoteDatabaseIds = new Set(remoteTablesDBs.map((db) => db.$id));
1603
- const localTables = config_1.localConfig.getTables();
1647
+ const localTables = localConfig.getTables();
1604
1648
  const validTables = localTables.filter((table) => remoteDatabaseIds.has(table.databaseId));
1605
- config_1.localConfig.set('tables', validTables);
1649
+ localConfig.set("tables", validTables);
1606
1650
  const validTablesDBs = localTablesDBs.filter((db) => remoteDatabaseIds.has(db.$id));
1607
- config_1.localConfig.set('tablesDB', validTablesDBs);
1608
- (0, parser_1.success)('Configuration resynced successfully.');
1651
+ localConfig.set("tablesDB", validTablesDBs);
1652
+ success("Configuration resynced successfully.");
1609
1653
  console.log();
1610
1654
  }
1611
- (0, parser_1.log)('Checking for deleted tables ...');
1612
- const localTablesDBs = config_1.localConfig.getTablesDBs();
1613
- const localTables = config_1.localConfig.getTables();
1655
+ log("Checking for deleted tables ...");
1656
+ const localTablesDBs = localConfig.getTablesDBs();
1657
+ const localTables = localConfig.getTables();
1614
1658
  const tablesToDelete = [];
1615
1659
  for (const db of localTablesDBs) {
1616
1660
  try {
1617
- const { tables: remoteTables } = await (0, paginate_1.paginate)(tables_db_1.tablesDBListTables, {
1661
+ const { tables: remoteTables } = await paginate(async (args) => {
1662
+ const tablesDBService = await getTablesDBService();
1663
+ return await tablesDBService.listTables(args.databaseId, args.queries || []);
1664
+ }, {
1618
1665
  databaseId: db.$id,
1619
- parseOutput: false
1620
- }, 100, 'tables');
1666
+ }, 100, "tables");
1621
1667
  for (const remoteTable of remoteTables) {
1622
1668
  const localTable = localTables.find((t) => t.$id === remoteTable.$id && t.databaseId === db.$id);
1623
1669
  if (!localTable) {
1624
1670
  tablesToDelete.push({
1625
1671
  ...remoteTable,
1626
1672
  databaseId: db.$id,
1627
- databaseName: db.name
1673
+ databaseName: db.name,
1628
1674
  });
1629
1675
  }
1630
1676
  }
@@ -1634,47 +1680,40 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1634
1680
  }
1635
1681
  }
1636
1682
  if (tablesToDelete.length > 0) {
1637
- (0, parser_1.log)('Found tables that exist remotely but not locally:');
1683
+ log("Found tables that exist remotely but not locally:");
1638
1684
  const deletionChanges = tablesToDelete.map((table) => ({
1639
1685
  id: table.$id,
1640
- action: chalk_1.default.red('deleting'),
1641
- key: 'Table',
1686
+ action: chalk.red("deleting"),
1687
+ key: "Table",
1642
1688
  database: table.databaseName,
1643
1689
  remote: table.name,
1644
- local: '(deleted locally)'
1690
+ local: "(deleted locally)",
1645
1691
  }));
1646
- (0, parser_1.drawTable)(deletionChanges);
1692
+ drawTable(deletionChanges);
1647
1693
  if ((await getConfirmation()) === true) {
1648
1694
  for (const table of tablesToDelete) {
1649
1695
  try {
1650
- (0, parser_1.log)(`Deleting table ${table.name} ( ${table.$id} ) from database ${table.databaseName} ...`);
1651
- await (0, tables_db_1.tablesDBDeleteTable)({
1652
- databaseId: table.databaseId,
1653
- tableId: table.$id,
1654
- parseOutput: false
1655
- });
1656
- (0, parser_1.success)(`Deleted ${table.name} ( ${table.$id} )`);
1696
+ log(`Deleting table ${table.name} ( ${table.$id} ) from database ${table.databaseName} ...`);
1697
+ const tablesDBService = await getTablesDBService();
1698
+ await tablesDBService.deleteTable(table.databaseId, table.$id);
1699
+ success(`Deleted ${table.name} ( ${table.$id} )`);
1657
1700
  }
1658
1701
  catch (e) {
1659
- (0, parser_1.error)(`Failed to delete table ${table.name} ( ${table.$id} ): ${e.message}`);
1702
+ error(`Failed to delete table ${table.name} ( ${table.$id} ): ${e.message}`);
1660
1703
  }
1661
1704
  }
1662
1705
  }
1663
1706
  }
1664
- else {
1665
- console.log('No tables found to delete');
1666
- }
1667
- console.log();
1668
- if (parser_1.cliConfig.all) {
1669
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
1670
- tables.push(...config_1.localConfig.getTables());
1707
+ if (cliConfig.all) {
1708
+ checkDeployConditions(localConfig);
1709
+ tables.push(...localConfig.getTables());
1671
1710
  }
1672
1711
  else {
1673
- const answers = await inquirer_1.default.prompt(questions_1.questionsPushTables);
1712
+ const answers = await inquirer.prompt(questionsPushTables);
1674
1713
  if (answers.tables) {
1675
1714
  const configTables = new Map();
1676
- config_1.localConfig.getTables().forEach((c) => {
1677
- configTables.set(`${c['databaseId']}|${c['$id']}`, c);
1715
+ localConfig.getTables().forEach((c) => {
1716
+ configTables.set(`${c["databaseId"]}|${c["$id"]}`, c);
1678
1717
  });
1679
1718
  answers.tables.forEach((a) => {
1680
1719
  const table = configTables.get(a);
@@ -1683,59 +1722,47 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1683
1722
  }
1684
1723
  }
1685
1724
  if (tables.length === 0) {
1686
- (0, parser_1.log)("No tables found.");
1687
- (0, parser_1.hint)("Use 'appwrite pull tables' to synchronize existing one, or use 'appwrite init table' to create a new one.");
1725
+ log("No tables found.");
1726
+ hint("Use 'appwrite pull tables' to synchronize existing one, or use 'appwrite init table' to create a new one.");
1688
1727
  return;
1689
1728
  }
1690
- if (!(await approveChanges(tables, tables_db_1.tablesDBGetTable, config_1.KeysTable, 'tableId', 'tables', ['columns', 'indexes'], 'databaseId', 'databaseId'))) {
1729
+ if (!(await approveChanges(tables, async (args) => {
1730
+ const tablesDBService = await getTablesDBService();
1731
+ return await tablesDBService.getTable(args.databaseId, args.tableId);
1732
+ }, KeysTable, "tableId", "tables", ["columns", "indexes"], "databaseId", "databaseId"))) {
1691
1733
  return;
1692
1734
  }
1693
1735
  let tablesChanged = new Set();
1694
1736
  // Parallel tables actions
1695
1737
  await Promise.all(tables.map(async (table) => {
1696
1738
  try {
1697
- const remoteTable = await (0, tables_db_1.tablesDBGetTable)({
1698
- databaseId: table['databaseId'],
1699
- tableId: table['$id'],
1700
- parseOutput: false,
1701
- });
1739
+ const tablesDBService = await getTablesDBService();
1740
+ const remoteTable = await tablesDBService.getTable(table["databaseId"], table["$id"]);
1702
1741
  const changes = [];
1703
1742
  if (remoteTable.name !== table.name)
1704
- changes.push('name');
1743
+ changes.push("name");
1705
1744
  if (remoteTable.rowSecurity !== table.rowSecurity)
1706
- changes.push('rowSecurity');
1745
+ changes.push("rowSecurity");
1707
1746
  if (remoteTable.enabled !== table.enabled)
1708
- changes.push('enabled');
1709
- if (JSON.stringify(remoteTable['$permissions']) !== JSON.stringify(table['$permissions']))
1710
- changes.push('permissions');
1747
+ changes.push("enabled");
1748
+ if (JSON.stringify(remoteTable["$permissions"]) !==
1749
+ JSON.stringify(table["$permissions"]))
1750
+ changes.push("permissions");
1711
1751
  if (changes.length > 0) {
1712
- await (0, tables_db_1.tablesDBUpdateTable)({
1713
- databaseId: table['databaseId'],
1714
- tableId: table['$id'],
1715
- name: table.name,
1716
- parseOutput: false,
1717
- rowSecurity: table.rowSecurity,
1718
- permissions: table['$permissions']
1719
- });
1720
- (0, parser_1.success)(`Updated ${table.name} ( ${table['$id']} ) - ${changes.join(', ')}`);
1721
- tablesChanged.add(table['$id']);
1752
+ await tablesDBService.updateTable(table["databaseId"], table["$id"], table.name, table.rowSecurity, table["$permissions"]);
1753
+ success(`Updated ${table.name} ( ${table["$id"]} ) - ${changes.join(", ")}`);
1754
+ tablesChanged.add(table["$id"]);
1722
1755
  }
1723
1756
  table.remoteVersion = remoteTable;
1724
1757
  table.isExisted = true;
1725
1758
  }
1726
1759
  catch (e) {
1727
1760
  if (Number(e.code) === 404) {
1728
- (0, parser_1.log)(`Table ${table.name} does not exist in the project. Creating ... `);
1729
- await (0, tables_db_1.tablesDBCreateTable)({
1730
- databaseId: table['databaseId'],
1731
- tableId: table['$id'],
1732
- name: table.name,
1733
- rowSecurity: table.rowSecurity,
1734
- permissions: table['$permissions'],
1735
- parseOutput: false
1736
- });
1737
- (0, parser_1.success)(`Created ${table.name} ( ${table['$id']} )`);
1738
- tablesChanged.add(table['$id']);
1761
+ log(`Table ${table.name} does not exist in the project. Creating ... `);
1762
+ const tablesDBService = await getTablesDBService();
1763
+ await tablesDBService.createTable(table["databaseId"], table["$id"], table.name, table.rowSecurity, table["$permissions"]);
1764
+ success(`Created ${table.name} ( ${table["$id"]} )`);
1765
+ tablesChanged.add(table["$id"]);
1739
1766
  }
1740
1767
  else {
1741
1768
  throw e;
@@ -1749,11 +1776,14 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1749
1776
  if (table.isExisted) {
1750
1777
  columns = await attributesToCreate(table.remoteVersion.columns, table.columns, table);
1751
1778
  indexes = await attributesToCreate(table.remoteVersion.indexes, table.indexes, table, true);
1752
- if ((Array.isArray(columns) && columns.length <= 0) && (Array.isArray(indexes) && indexes.length <= 0)) {
1779
+ if (Array.isArray(columns) &&
1780
+ columns.length <= 0 &&
1781
+ Array.isArray(indexes) &&
1782
+ indexes.length <= 0) {
1753
1783
  continue;
1754
1784
  }
1755
1785
  }
1756
- (0, parser_1.log)(`Pushing table ${table.name} ( ${table['databaseId']} - ${table['$id']} ) attributes`);
1786
+ log(`Pushing table ${table.name} ( ${table["databaseId"]} - ${table["$id"]} ) attributes`);
1757
1787
  try {
1758
1788
  await createColumns(columns, table);
1759
1789
  }
@@ -1766,27 +1796,27 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1766
1796
  catch (e) {
1767
1797
  throw e;
1768
1798
  }
1769
- tablesChanged.add(table['$id']);
1770
- (0, parser_1.success)(`Successfully pushed ${table.name} ( ${table['$id']} )`);
1799
+ tablesChanged.add(table["$id"]);
1800
+ success(`Successfully pushed ${table.name} ( ${table["$id"]} )`);
1771
1801
  }
1772
- (0, parser_1.success)(`Successfully pushed ${tablesChanged.size} tables`);
1802
+ success(`Successfully pushed ${tablesChanged.size} tables`);
1773
1803
  };
1774
- const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false }) => {
1775
- (0, parser_1.warn)("appwrite push collection has been deprecated. Please consider using 'appwrite push tables' instead");
1804
+ const pushCollection = async ({ attempts }) => {
1805
+ warn("appwrite push collection has been deprecated. Please consider using 'appwrite push tables' instead");
1776
1806
  const collections = [];
1777
1807
  if (attempts) {
1778
1808
  pollMaxDebounces = attempts;
1779
1809
  }
1780
- if (parser_1.cliConfig.all) {
1781
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
1782
- collections.push(...config_1.localConfig.getCollections());
1810
+ if (cliConfig.all) {
1811
+ checkDeployConditions(localConfig);
1812
+ collections.push(...localConfig.getCollections());
1783
1813
  }
1784
1814
  else {
1785
- const answers = await inquirer_1.default.prompt(questions_1.questionsPushCollections);
1815
+ const answers = await inquirer.prompt(questionsPushCollections);
1786
1816
  if (answers.collections) {
1787
1817
  const configCollections = new Map();
1788
- config_1.localConfig.getCollections().forEach((c) => {
1789
- configCollections.set(`${c['databaseId']}|${c['$id']}`, c);
1818
+ localConfig.getCollections().forEach((c) => {
1819
+ configCollections.set(`${c["databaseId"]}|${c["$id"]}`, c);
1790
1820
  });
1791
1821
  answers.collections.forEach((a) => {
1792
1822
  const collection = configCollections.get(a);
@@ -1795,71 +1825,50 @@ const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false
1795
1825
  }
1796
1826
  }
1797
1827
  if (collections.length === 0) {
1798
- (0, parser_1.log)("No collections found.");
1799
- (0, parser_1.hint)("Use 'appwrite pull collections' to synchronize existing one, or use 'appwrite init collection' to create a new one.");
1828
+ log("No collections found.");
1829
+ hint("Use 'appwrite pull collections' to synchronize existing one, or use 'appwrite init collection' to create a new one.");
1800
1830
  return;
1801
1831
  }
1802
- const databases = Array.from(new Set(collections.map((collection) => collection['databaseId'])));
1832
+ const databases = Array.from(new Set(collections.map((collection) => collection["databaseId"])));
1803
1833
  // Parallel db actions
1804
1834
  await Promise.all(databases.map(async (databaseId) => {
1805
- const localDatabase = config_1.localConfig.getDatabase(databaseId);
1835
+ const localDatabase = localConfig.getDatabase(databaseId);
1836
+ const databasesService = await getDatabasesService();
1806
1837
  try {
1807
- const database = await (0, databases_1.databasesGet)({
1808
- databaseId: databaseId,
1809
- parseOutput: false,
1810
- });
1838
+ const database = await databasesService.get(databaseId);
1811
1839
  if (database.name !== (localDatabase.name ?? databaseId)) {
1812
- await (0, databases_1.databasesUpdate)({
1813
- databaseId: databaseId,
1814
- name: localDatabase.name ?? databaseId,
1815
- parseOutput: false
1816
- });
1817
- (0, parser_1.success)(`Updated ${localDatabase.name} ( ${databaseId} ) name`);
1840
+ await databasesService.update(databaseId, localDatabase.name ?? databaseId);
1841
+ success(`Updated ${localDatabase.name} ( ${databaseId} ) name`);
1818
1842
  }
1819
1843
  }
1820
1844
  catch (err) {
1821
- (0, parser_1.log)(`Database ${databaseId} not found. Creating it now ...`);
1822
- await (0, databases_1.databasesCreate)({
1823
- databaseId: databaseId,
1824
- name: localDatabase.name ?? databaseId,
1825
- parseOutput: false,
1826
- });
1845
+ log(`Database ${databaseId} not found. Creating it now ...`);
1846
+ await databasesService.create(databaseId, localDatabase.name ?? databaseId);
1827
1847
  }
1828
1848
  }));
1829
- if (!(await approveChanges(collections, databases_1.databasesGetCollection, config_1.KeysCollection, 'collectionId', 'collections', ['attributes', 'indexes'], 'databaseId', 'databaseId'))) {
1849
+ if (!(await approveChanges(collections, async (args) => {
1850
+ const databasesService = await getDatabasesService();
1851
+ return await databasesService.getCollection(args.databaseId, args.collectionId);
1852
+ }, KeysCollection, "collectionId", "collections", ["attributes", "indexes"], "databaseId", "databaseId"))) {
1830
1853
  return;
1831
1854
  }
1832
1855
  // Parallel collection actions
1833
1856
  await Promise.all(collections.map(async (collection) => {
1834
1857
  try {
1835
- const remoteCollection = await (0, databases_1.databasesGetCollection)({
1836
- databaseId: collection['databaseId'],
1837
- collectionId: collection['$id'],
1838
- parseOutput: false,
1839
- });
1858
+ const databasesService = await getDatabasesService();
1859
+ const remoteCollection = await databasesService.getCollection(collection["databaseId"], collection["$id"]);
1840
1860
  if (remoteCollection.name !== collection.name) {
1841
- await (0, databases_1.databasesUpdateCollection)({
1842
- databaseId: collection['databaseId'],
1843
- collectionId: collection['$id'],
1844
- name: collection.name,
1845
- parseOutput: false
1846
- });
1847
- (0, parser_1.success)(`Updated ${collection.name} ( ${collection['$id']} ) name`);
1861
+ await databasesService.updateCollection(collection["databaseId"], collection["$id"], collection.name);
1862
+ success(`Updated ${collection.name} ( ${collection["$id"]} ) name`);
1848
1863
  }
1849
1864
  collection.remoteVersion = remoteCollection;
1850
1865
  collection.isExisted = true;
1851
1866
  }
1852
1867
  catch (e) {
1853
1868
  if (Number(e.code) === 404) {
1854
- (0, parser_1.log)(`Collection ${collection.name} does not exist in the project. Creating ... `);
1855
- await (0, databases_1.databasesCreateCollection)({
1856
- databaseId: collection['databaseId'],
1857
- collectionId: collection['$id'],
1858
- name: collection.name,
1859
- documentSecurity: collection.documentSecurity,
1860
- permissions: collection['$permissions'],
1861
- parseOutput: false
1862
- });
1869
+ log(`Collection ${collection.name} does not exist in the project. Creating ... `);
1870
+ const databasesService = await getDatabasesService();
1871
+ await databasesService.createCollection(collection["databaseId"], collection["$id"], collection.name, collection.documentSecurity, collection["$permissions"]);
1863
1872
  }
1864
1873
  else {
1865
1874
  throw e;
@@ -1874,11 +1883,14 @@ const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false
1874
1883
  if (collection.isExisted) {
1875
1884
  attributes = await attributesToCreate(collection.remoteVersion.attributes, collection.attributes, collection);
1876
1885
  indexes = await attributesToCreate(collection.remoteVersion.indexes, collection.indexes, collection, true);
1877
- if ((Array.isArray(attributes) && attributes.length <= 0) && (Array.isArray(indexes) && indexes.length <= 0)) {
1886
+ if (Array.isArray(attributes) &&
1887
+ attributes.length <= 0 &&
1888
+ Array.isArray(indexes) &&
1889
+ indexes.length <= 0) {
1878
1890
  continue;
1879
1891
  }
1880
1892
  }
1881
- (0, parser_1.log)(`Pushing collection ${collection.name} ( ${collection['databaseId']} - ${collection['$id']} ) attributes`);
1893
+ log(`Pushing collection ${collection.name} ( ${collection["databaseId"]} - ${collection["$id"]} ) attributes`);
1882
1894
  try {
1883
1895
  await createAttributes(attributes, collection);
1884
1896
  }
@@ -1892,27 +1904,27 @@ const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false
1892
1904
  throw e;
1893
1905
  }
1894
1906
  numberOfCollections++;
1895
- (0, parser_1.success)(`Successfully pushed ${collection.name} ( ${collection['$id']} )`);
1907
+ success(`Successfully pushed ${collection.name} ( ${collection["$id"]} )`);
1896
1908
  }
1897
- (0, parser_1.success)(`Successfully pushed ${numberOfCollections} collections`);
1909
+ success(`Successfully pushed ${numberOfCollections} collections`);
1898
1910
  };
1899
- const pushBucket = async ({ returnOnZero } = { returnOnZero: false }) => {
1911
+ const pushBucket = async () => {
1900
1912
  let response = {};
1901
1913
  let bucketIds = [];
1902
- const configBuckets = config_1.localConfig.getBuckets();
1903
- if (parser_1.cliConfig.all) {
1904
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
1914
+ const configBuckets = localConfig.getBuckets();
1915
+ if (cliConfig.all) {
1916
+ checkDeployConditions(localConfig);
1905
1917
  bucketIds.push(...configBuckets.map((b) => b.$id));
1906
1918
  }
1907
1919
  if (bucketIds.length === 0) {
1908
- const answers = await inquirer_1.default.prompt(questions_1.questionsPushBuckets[0]);
1920
+ const answers = await inquirer.prompt(questionsPushBuckets);
1909
1921
  if (answers.buckets) {
1910
1922
  bucketIds.push(...answers.buckets);
1911
1923
  }
1912
1924
  }
1913
1925
  if (bucketIds.length === 0) {
1914
- (0, parser_1.log)("No buckets found.");
1915
- (0, parser_1.hint)("Use 'appwrite pull buckets' to synchronize existing one, or use 'appwrite init bucket' to create a new one.");
1926
+ log("No buckets found.");
1927
+ hint("Use 'appwrite pull buckets' to synchronize existing one, or use 'appwrite init bucket' to create a new one.");
1916
1928
  return;
1917
1929
  }
1918
1930
  let buckets = [];
@@ -1920,72 +1932,49 @@ const pushBucket = async ({ returnOnZero } = { returnOnZero: false }) => {
1920
1932
  const idBuckets = configBuckets.filter((b) => b.$id === bucketId);
1921
1933
  buckets.push(...idBuckets);
1922
1934
  }
1923
- if (!(await approveChanges(buckets, storage_1.storageGetBucket, config_1.KeysStorage, 'bucketId', 'buckets'))) {
1935
+ if (!(await approveChanges(buckets, async (args) => {
1936
+ const storageService = await getStorageService();
1937
+ return await storageService.getBucket(args.bucketId);
1938
+ }, KeysStorage, "bucketId", "buckets"))) {
1924
1939
  return;
1925
1940
  }
1926
- (0, parser_1.log)('Pushing buckets ...');
1941
+ log("Pushing buckets ...");
1927
1942
  for (let bucket of buckets) {
1928
- (0, parser_1.log)(`Pushing bucket ${chalk_1.default.bold(bucket['name'])} ...`);
1943
+ log(`Pushing bucket ${chalk.bold(bucket["name"])} ...`);
1944
+ const storageService = await getStorageService();
1929
1945
  try {
1930
- response = await (0, storage_1.storageGetBucket)({
1931
- bucketId: bucket['$id'],
1932
- parseOutput: false,
1933
- });
1934
- await (0, storage_1.storageUpdateBucket)({
1935
- bucketId: bucket['$id'],
1936
- name: bucket.name,
1937
- permissions: bucket['$permissions'],
1938
- fileSecurity: bucket.fileSecurity,
1939
- enabled: bucket.enabled,
1940
- maximumFileSize: bucket.maximumFileSize,
1941
- allowedFileExtensions: bucket.allowedFileExtensions,
1942
- encryption: bucket.encryption,
1943
- antivirus: bucket.antivirus,
1944
- compression: bucket.compression,
1945
- parseOutput: false
1946
- });
1946
+ response = await storageService.getBucket(bucket["$id"]);
1947
+ await storageService.updateBucket(bucket["$id"], bucket.name, bucket["$permissions"], bucket.fileSecurity, bucket.enabled, bucket.maximumFileSize, bucket.allowedFileExtensions, bucket.encryption, bucket.antivirus, bucket.compression);
1947
1948
  }
1948
1949
  catch (e) {
1949
1950
  if (Number(e.code) === 404) {
1950
- (0, parser_1.log)(`Bucket ${bucket.name} does not exist in the project. Creating ... `);
1951
- response = await (0, storage_1.storageCreateBucket)({
1952
- bucketId: bucket['$id'],
1953
- name: bucket.name,
1954
- permissions: bucket['$permissions'],
1955
- fileSecurity: bucket.fileSecurity,
1956
- enabled: bucket.enabled,
1957
- maximumFileSize: bucket.maximumFileSize,
1958
- allowedFileExtensions: bucket.allowedFileExtensions,
1959
- compression: bucket.compression,
1960
- encryption: bucket.encryption,
1961
- antivirus: bucket.antivirus,
1962
- parseOutput: false
1963
- });
1951
+ log(`Bucket ${bucket.name} does not exist in the project. Creating ... `);
1952
+ response = await storageService.createBucket(bucket["$id"], bucket.name, bucket["$permissions"], bucket.fileSecurity, bucket.enabled, bucket.maximumFileSize, bucket.allowedFileExtensions, bucket.compression, bucket.encryption, bucket.antivirus);
1964
1953
  }
1965
1954
  else {
1966
1955
  throw e;
1967
1956
  }
1968
1957
  }
1969
1958
  }
1970
- (0, parser_1.success)(`Successfully pushed ${buckets.length} buckets.`);
1959
+ success(`Successfully pushed ${buckets.length} buckets.`);
1971
1960
  };
1972
- const pushTeam = async ({ returnOnZero } = { returnOnZero: false }) => {
1961
+ const pushTeam = async () => {
1973
1962
  let response = {};
1974
1963
  let teamIds = [];
1975
- const configTeams = config_1.localConfig.getTeams();
1976
- if (parser_1.cliConfig.all) {
1977
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
1964
+ const configTeams = localConfig.getTeams();
1965
+ if (cliConfig.all) {
1966
+ checkDeployConditions(localConfig);
1978
1967
  teamIds.push(...configTeams.map((t) => t.$id));
1979
1968
  }
1980
1969
  if (teamIds.length === 0) {
1981
- const answers = await inquirer_1.default.prompt(questions_1.questionsPushTeams[0]);
1970
+ const answers = await inquirer.prompt(questionsPushTeams);
1982
1971
  if (answers.teams) {
1983
1972
  teamIds.push(...answers.teams);
1984
1973
  }
1985
1974
  }
1986
1975
  if (teamIds.length === 0) {
1987
- (0, parser_1.log)("No teams found.");
1988
- (0, parser_1.hint)("Use 'appwrite pull teams' to synchronize existing one, or use 'appwrite init team' to create a new one.");
1976
+ log("No teams found.");
1977
+ hint("Use 'appwrite pull teams' to synchronize existing one, or use 'appwrite init team' to create a new one.");
1989
1978
  return;
1990
1979
  }
1991
1980
  let teams = [];
@@ -1993,56 +1982,49 @@ const pushTeam = async ({ returnOnZero } = { returnOnZero: false }) => {
1993
1982
  const idTeams = configTeams.filter((t) => t.$id === teamId);
1994
1983
  teams.push(...idTeams);
1995
1984
  }
1996
- if (!(await approveChanges(teams, teams_1.teamsGet, config_1.KeysTeams, 'teamId', 'teams'))) {
1985
+ if (!(await approveChanges(teams, async (args) => {
1986
+ const teamsService = await getTeamsService();
1987
+ return await teamsService.get(args.teamId);
1988
+ }, KeysTeams, "teamId", "teams"))) {
1997
1989
  return;
1998
1990
  }
1999
- (0, parser_1.log)('Pushing teams ...');
1991
+ log("Pushing teams ...");
2000
1992
  for (let team of teams) {
2001
- (0, parser_1.log)(`Pushing team ${chalk_1.default.bold(team['name'])} ...`);
1993
+ log(`Pushing team ${chalk.bold(team["name"])} ...`);
1994
+ const teamsService = await getTeamsService();
2002
1995
  try {
2003
- response = await (0, teams_1.teamsGet)({
2004
- teamId: team['$id'],
2005
- parseOutput: false,
2006
- });
2007
- await (0, teams_1.teamsUpdateName)({
2008
- teamId: team['$id'],
2009
- name: team.name,
2010
- parseOutput: false
2011
- });
1996
+ response = await teamsService.get(team["$id"]);
1997
+ await teamsService.updateName(team["$id"], team.name);
2012
1998
  }
2013
1999
  catch (e) {
2014
2000
  if (Number(e.code) === 404) {
2015
- (0, parser_1.log)(`Team ${team.name} does not exist in the project. Creating ... `);
2016
- response = await (0, teams_1.teamsCreate)({
2017
- teamId: team['$id'],
2018
- name: team.name,
2019
- parseOutput: false
2020
- });
2001
+ log(`Team ${team.name} does not exist in the project. Creating ... `);
2002
+ response = await teamsService.create(team["$id"], team.name);
2021
2003
  }
2022
2004
  else {
2023
2005
  throw e;
2024
2006
  }
2025
2007
  }
2026
2008
  }
2027
- (0, parser_1.success)(`Successfully pushed ${teams.length} teams.`);
2009
+ success(`Successfully pushed ${teams.length} teams.`);
2028
2010
  };
2029
- const pushMessagingTopic = async ({ returnOnZero } = { returnOnZero: false }) => {
2011
+ const pushMessagingTopic = async () => {
2030
2012
  let response = {};
2031
2013
  let topicsIds = [];
2032
- const configTopics = config_1.localConfig.getMessagingTopics();
2033
- if (parser_1.cliConfig.all) {
2034
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
2014
+ const configTopics = localConfig.getMessagingTopics();
2015
+ if (cliConfig.all) {
2016
+ checkDeployConditions(localConfig);
2035
2017
  topicsIds.push(...configTopics.map((b) => b.$id));
2036
2018
  }
2037
2019
  if (topicsIds.length === 0) {
2038
- const answers = await inquirer_1.default.prompt(questions_1.questionsPushMessagingTopics[0]);
2020
+ const answers = await inquirer.prompt(questionsPushMessagingTopics);
2039
2021
  if (answers.topics) {
2040
2022
  topicsIds.push(...answers.topics);
2041
2023
  }
2042
2024
  }
2043
2025
  if (topicsIds.length === 0) {
2044
- (0, parser_1.log)("No topics found.");
2045
- (0, parser_1.hint)("Use 'appwrite pull topics' to synchronize existing one, or use 'appwrite init topic' to create a new one.");
2026
+ log("No topics found.");
2027
+ hint("Use 'appwrite pull topics' to synchronize existing one, or use 'appwrite init topic' to create a new one.");
2046
2028
  return;
2047
2029
  }
2048
2030
  let topics = [];
@@ -2050,58 +2032,49 @@ const pushMessagingTopic = async ({ returnOnZero } = { returnOnZero: false }) =>
2050
2032
  const idTopic = configTopics.filter((b) => b.$id === topicId);
2051
2033
  topics.push(...idTopic);
2052
2034
  }
2053
- if (!(await approveChanges(topics, messaging_1.messagingGetTopic, config_1.KeysTopics, 'topicId', 'topics'))) {
2035
+ if (!(await approveChanges(topics, async (args) => {
2036
+ const messagingService = await getMessagingService();
2037
+ return await messagingService.getTopic(args.topicId);
2038
+ }, KeysTopics, "topicId", "topics"))) {
2054
2039
  return;
2055
2040
  }
2056
- (0, parser_1.log)('Pushing topics ...');
2041
+ log("Pushing topics ...");
2057
2042
  for (let topic of topics) {
2058
- (0, parser_1.log)(`Pushing topic ${chalk_1.default.bold(topic['name'])} ...`);
2043
+ log(`Pushing topic ${chalk.bold(topic["name"])} ...`);
2044
+ const messagingService = await getMessagingService();
2059
2045
  try {
2060
- response = await (0, messaging_1.messagingGetTopic)({
2061
- topicId: topic['$id'],
2062
- parseOutput: false
2063
- });
2064
- (0, parser_1.log)(`Topic ${topic.name} ( ${topic['$id']} ) already exists.`);
2065
- await (0, messaging_1.messagingUpdateTopic)({
2066
- topicId: topic['$id'],
2067
- name: topic.name,
2068
- subscribe: topic.subscribe,
2069
- parseOutput: false
2070
- });
2046
+ response = await messagingService.getTopic(topic["$id"]);
2047
+ log(`Topic ${topic.name} ( ${topic["$id"]} ) already exists.`);
2048
+ await messagingService.updateTopic(topic["$id"], topic.name, topic.subscribe);
2071
2049
  }
2072
2050
  catch (e) {
2073
2051
  if (Number(e.code) === 404) {
2074
- (0, parser_1.log)(`Topic ${topic.name} does not exist in the project. Creating ... `);
2075
- response = await (0, messaging_1.messagingCreateTopic)({
2076
- topicId: topic['$id'],
2077
- name: topic.name,
2078
- subscribe: topic.subscribe,
2079
- parseOutput: false
2080
- });
2081
- (0, parser_1.success)(`Created ${topic.name} ( ${topic['$id']} )`);
2052
+ log(`Topic ${topic.name} does not exist in the project. Creating ... `);
2053
+ response = await messagingService.createTopic(topic["$id"], topic.name, topic.subscribe);
2054
+ success(`Created ${topic.name} ( ${topic["$id"]} )`);
2082
2055
  }
2083
2056
  else {
2084
2057
  throw e;
2085
2058
  }
2086
2059
  }
2087
2060
  }
2088
- (0, parser_1.success)(`Successfully pushed ${topics.length} topics.`);
2061
+ success(`Successfully pushed ${topics.length} topics.`);
2089
2062
  };
2090
- exports.push = new commander_1.Command("push")
2091
- .description(parser_1.commandDescriptions['push'])
2092
- .action((0, parser_1.actionRunner)(pushResources));
2093
- exports.push
2063
+ export const push = new Command("push")
2064
+ .description(commandDescriptions["push"])
2065
+ .action(actionRunner(() => pushResources({ skipDeprecated: true })));
2066
+ push
2094
2067
  .command("all")
2095
2068
  .description("Push all resource.")
2096
- .action((0, parser_1.actionRunner)(() => {
2097
- parser_1.cliConfig.all = true;
2098
- return pushResources();
2069
+ .action(actionRunner(() => {
2070
+ cliConfig.all = true;
2071
+ return pushResources({ skipDeprecated: true });
2099
2072
  }));
2100
- exports.push
2073
+ push
2101
2074
  .command("settings")
2102
2075
  .description("Push project name, services and auth settings")
2103
- .action((0, parser_1.actionRunner)(pushSettings));
2104
- exports.push
2076
+ .action(actionRunner(pushSettings));
2077
+ push
2105
2078
  .command("function")
2106
2079
  .alias("functions")
2107
2080
  .description("Push functions in the current directory.")
@@ -2109,8 +2082,8 @@ exports.push
2109
2082
  .option(`-A, --async`, `Don't wait for functions deployments status`)
2110
2083
  .option("--no-code", "Don't push the function's code")
2111
2084
  .option("--with-variables", `Push function variables.`)
2112
- .action((0, parser_1.actionRunner)(pushFunction));
2113
- exports.push
2085
+ .action(actionRunner(pushFunction));
2086
+ push
2114
2087
  .command("site")
2115
2088
  .alias("sites")
2116
2089
  .description("Push sites in the current directory.")
@@ -2118,37 +2091,37 @@ exports.push
2118
2091
  .option(`-A, --async`, `Don't wait for sites deployments status`)
2119
2092
  .option("--no-code", "Don't push the site's code")
2120
2093
  .option("--with-variables", `Push site variables.`)
2121
- .action((0, parser_1.actionRunner)(pushSite));
2122
- exports.push
2094
+ .action(actionRunner(pushSite));
2095
+ push
2123
2096
  .command("collection")
2124
2097
  .alias("collections")
2125
2098
  .description("Push collections in the current project. (deprecated, please use 'push tables' instead)")
2126
2099
  .option(`-a, --attempts <numberOfAttempts>`, `Max number of attempts before timing out. default: 30.`)
2127
- .action((0, parser_1.actionRunner)(pushCollection));
2128
- exports.push
2100
+ .action(actionRunner(pushCollection));
2101
+ push
2129
2102
  .command("table")
2130
2103
  .alias("tables")
2131
2104
  .description("Push tables in the current project.")
2132
2105
  .option(`-a, --attempts <numberOfAttempts>`, `Max number of attempts before timing out. default: 30.`)
2133
- .action((0, parser_1.actionRunner)(pushTable));
2134
- exports.push
2106
+ .action(actionRunner(pushTable));
2107
+ push
2135
2108
  .command("bucket")
2136
2109
  .alias("buckets")
2137
2110
  .description("Push buckets in the current project.")
2138
- .action((0, parser_1.actionRunner)(pushBucket));
2139
- exports.push
2111
+ .action(actionRunner(pushBucket));
2112
+ push
2140
2113
  .command("team")
2141
2114
  .alias("teams")
2142
2115
  .description("Push teams in the current project.")
2143
- .action((0, parser_1.actionRunner)(pushTeam));
2144
- exports.push
2116
+ .action(actionRunner(pushTeam));
2117
+ push
2145
2118
  .command("topic")
2146
2119
  .alias("topics")
2147
2120
  .description("Push messaging topics in the current project.")
2148
- .action((0, parser_1.actionRunner)(pushMessagingTopic));
2149
- exports.deploy = new commander_1.Command("deploy")
2150
- .description('Removed. Use appwrite push instead')
2151
- .action((0, parser_1.actionRunner)(async () => {
2152
- (0, parser_1.warn)("appwrite deploy has been removed. Please use 'appwrite push' instead");
2121
+ .action(actionRunner(pushMessagingTopic));
2122
+ export const deploy = new Command("deploy")
2123
+ .description("Removed. Use appwrite push instead")
2124
+ .action(actionRunner(async () => {
2125
+ warn("appwrite deploy has been removed. Please use 'appwrite push' instead");
2153
2126
  }));
2154
2127
  //# sourceMappingURL=push.js.map