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

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 (430) hide show
  1. package/.github/workflows/publish.yml +68 -0
  2. package/CHANGELOG.md +10 -1
  3. package/LICENSE.md +1 -1
  4. package/README.md +3 -3
  5. package/cli.ts +152 -0
  6. package/dist/bundle.cjs +95813 -0
  7. package/dist/cli.d.ts +3 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +145 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/index.d.ts +10 -2
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +7 -142
  14. package/dist/index.js.map +1 -1
  15. package/dist/lib/client.d.ts +2 -3
  16. package/dist/lib/client.d.ts.map +1 -1
  17. package/dist/lib/client.js +57 -45
  18. package/dist/lib/client.js.map +1 -1
  19. package/dist/lib/commands/config.d.ts +562 -0
  20. package/dist/lib/commands/config.d.ts.map +1 -0
  21. package/dist/lib/commands/config.js +416 -0
  22. package/dist/lib/commands/config.js.map +1 -0
  23. package/dist/lib/commands/db.d.ts +34 -0
  24. package/dist/lib/commands/db.d.ts.map +1 -0
  25. package/dist/lib/commands/db.js +247 -0
  26. package/dist/lib/commands/db.js.map +1 -0
  27. package/dist/lib/commands/errors.d.ts +68 -0
  28. package/dist/lib/commands/errors.d.ts.map +1 -0
  29. package/dist/lib/commands/errors.js +72 -0
  30. package/dist/lib/commands/errors.js.map +1 -0
  31. package/dist/lib/commands/generic.d.ts +2 -2
  32. package/dist/lib/commands/generic.d.ts.map +1 -1
  33. package/dist/lib/commands/generic.js +170 -157
  34. package/dist/lib/commands/generic.js.map +1 -1
  35. package/dist/lib/commands/init.d.ts +1 -1
  36. package/dist/lib/commands/init.d.ts.map +1 -1
  37. package/dist/lib/commands/init.js +201 -192
  38. package/dist/lib/commands/init.js.map +1 -1
  39. package/dist/lib/commands/pull.d.ts +105 -3
  40. package/dist/lib/commands/pull.d.ts.map +1 -1
  41. package/dist/lib/commands/pull.js +530 -370
  42. package/dist/lib/commands/pull.js.map +1 -1
  43. package/dist/lib/commands/push.d.ts +106 -0
  44. package/dist/lib/commands/push.d.ts.map +1 -1
  45. package/dist/lib/commands/push.js +1432 -1830
  46. package/dist/lib/commands/push.js.map +1 -1
  47. package/dist/lib/commands/run.d.ts +1 -1
  48. package/dist/lib/commands/run.d.ts.map +1 -1
  49. package/dist/lib/commands/run.js +129 -127
  50. package/dist/lib/commands/run.js.map +1 -1
  51. package/dist/lib/commands/schema.d.ts +59 -0
  52. package/dist/lib/commands/schema.d.ts.map +1 -0
  53. package/dist/lib/commands/schema.js +86 -0
  54. package/dist/lib/commands/schema.js.map +1 -0
  55. package/dist/lib/commands/services/account.d.ts +3 -0
  56. package/dist/lib/commands/services/account.d.ts.map +1 -0
  57. package/dist/lib/commands/services/account.js +328 -0
  58. package/dist/lib/commands/services/account.js.map +1 -0
  59. package/dist/lib/commands/services/console.d.ts +3 -0
  60. package/dist/lib/commands/services/console.d.ts.map +1 -0
  61. package/dist/lib/commands/services/console.js +28 -0
  62. package/dist/lib/commands/services/console.js.map +1 -0
  63. package/dist/lib/commands/services/databases.d.ts +3 -0
  64. package/dist/lib/commands/services/databases.d.ts.map +1 -0
  65. package/dist/lib/commands/services/databases.js +620 -0
  66. package/dist/lib/commands/services/databases.js.map +1 -0
  67. package/dist/lib/commands/services/functions.d.ts +3 -0
  68. package/dist/lib/commands/services/functions.d.ts.map +1 -0
  69. package/dist/lib/commands/services/functions.js +266 -0
  70. package/dist/lib/commands/services/functions.js.map +1 -0
  71. package/dist/lib/commands/services/graphql.d.ts +3 -0
  72. package/dist/lib/commands/services/graphql.d.ts.map +1 -0
  73. package/dist/lib/commands/services/graphql.js +28 -0
  74. package/dist/lib/commands/services/graphql.js.map +1 -0
  75. package/dist/lib/commands/services/health.d.ts +3 -0
  76. package/dist/lib/commands/services/health.d.ts.map +1 -0
  77. package/dist/lib/commands/services/health.js +123 -0
  78. package/dist/lib/commands/services/health.js.map +1 -0
  79. package/dist/lib/commands/services/locale.d.ts +3 -0
  80. package/dist/lib/commands/services/locale.d.ts.map +1 -0
  81. package/dist/lib/commands/services/locale.js +52 -0
  82. package/dist/lib/commands/services/locale.js.map +1 -0
  83. package/dist/lib/commands/services/messaging.d.ts +3 -0
  84. package/dist/lib/commands/services/messaging.d.ts.map +1 -0
  85. package/dist/lib/commands/services/messaging.js +505 -0
  86. package/dist/lib/commands/services/messaging.js.map +1 -0
  87. package/dist/lib/commands/services/migrations.d.ts +3 -0
  88. package/dist/lib/commands/services/migrations.d.ts.map +1 -0
  89. package/dist/lib/commands/services/migrations.js +135 -0
  90. package/dist/lib/commands/services/migrations.js.map +1 -0
  91. package/dist/lib/commands/services/project.d.ts +3 -0
  92. package/dist/lib/commands/services/project.d.ts.map +1 -0
  93. package/dist/lib/commands/services/project.js +54 -0
  94. package/dist/lib/commands/services/project.js.map +1 -0
  95. package/dist/lib/commands/services/projects.d.ts +3 -0
  96. package/dist/lib/commands/services/projects.d.ts.map +1 -0
  97. package/dist/lib/commands/services/projects.js +415 -0
  98. package/dist/lib/commands/services/projects.js.map +1 -0
  99. package/dist/lib/commands/services/proxy.d.ts +3 -0
  100. package/dist/lib/commands/services/proxy.d.ts.map +1 -0
  101. package/dist/lib/commands/services/proxy.js +68 -0
  102. package/dist/lib/commands/services/proxy.js.map +1 -0
  103. package/dist/lib/commands/services/sites.d.ts +3 -0
  104. package/dist/lib/commands/services/sites.d.ts.map +1 -0
  105. package/dist/lib/commands/services/sites.js +250 -0
  106. package/dist/lib/commands/services/sites.js.map +1 -0
  107. package/dist/lib/commands/services/storage.d.ts +3 -0
  108. package/dist/lib/commands/services/storage.d.ts.map +1 -0
  109. package/dist/lib/commands/services/storage.js +175 -0
  110. package/dist/lib/commands/services/storage.js.map +1 -0
  111. package/dist/lib/commands/services/tables-db.d.ts +3 -0
  112. package/dist/lib/commands/services/tables-db.d.ts.map +1 -0
  113. package/dist/lib/commands/services/tables-db.js +613 -0
  114. package/dist/lib/commands/services/tables-db.js.map +1 -0
  115. package/dist/lib/commands/services/teams.d.ts +3 -0
  116. package/dist/lib/commands/services/teams.d.ts.map +1 -0
  117. package/dist/lib/commands/services/teams.js +123 -0
  118. package/dist/lib/commands/services/teams.js.map +1 -0
  119. package/dist/lib/commands/services/tokens.d.ts +3 -0
  120. package/dist/lib/commands/services/tokens.d.ts.map +1 -0
  121. package/dist/lib/commands/services/tokens.js +49 -0
  122. package/dist/lib/commands/services/tokens.js.map +1 -0
  123. package/dist/lib/commands/services/users.d.ts +3 -0
  124. package/dist/lib/commands/services/users.d.ts.map +1 -0
  125. package/dist/lib/commands/services/users.js +312 -0
  126. package/dist/lib/commands/services/users.js.map +1 -0
  127. package/dist/lib/commands/services/vcs.d.ts +3 -0
  128. package/dist/lib/commands/services/vcs.d.ts.map +1 -0
  129. package/dist/lib/commands/services/vcs.js +87 -0
  130. package/dist/lib/commands/services/vcs.js.map +1 -0
  131. package/dist/lib/commands/types.d.ts +1 -1
  132. package/dist/lib/commands/types.d.ts.map +1 -1
  133. package/dist/lib/commands/types.js +53 -57
  134. package/dist/lib/commands/types.js.map +1 -1
  135. package/dist/lib/commands/update.d.ts +1 -1
  136. package/dist/lib/commands/update.d.ts.map +1 -1
  137. package/dist/lib/commands/update.js +69 -69
  138. package/dist/lib/commands/update.js.map +1 -1
  139. package/dist/lib/commands/utils/attributes.d.ts +47 -0
  140. package/dist/lib/commands/utils/attributes.d.ts.map +1 -0
  141. package/dist/lib/commands/utils/attributes.js +514 -0
  142. package/dist/lib/commands/utils/attributes.js.map +1 -0
  143. package/dist/lib/commands/utils/change-approval.d.ts +25 -0
  144. package/dist/lib/commands/utils/change-approval.d.ts.map +1 -0
  145. package/dist/lib/commands/utils/change-approval.js +129 -0
  146. package/dist/lib/commands/utils/change-approval.js.map +1 -0
  147. package/dist/lib/commands/utils/database-sync.d.ts +10 -0
  148. package/dist/lib/commands/utils/database-sync.d.ts.map +1 -0
  149. package/dist/lib/commands/utils/database-sync.js +136 -0
  150. package/dist/lib/commands/utils/database-sync.js.map +1 -0
  151. package/dist/lib/commands/utils/deployment.d.ts +34 -0
  152. package/dist/lib/commands/utils/deployment.d.ts.map +1 -0
  153. package/dist/lib/commands/utils/deployment.js +109 -0
  154. package/dist/lib/commands/utils/deployment.js.map +1 -0
  155. package/dist/lib/commands/utils/error-formatter.d.ts +19 -0
  156. package/dist/lib/commands/utils/error-formatter.d.ts.map +1 -0
  157. package/dist/lib/commands/utils/error-formatter.js +333 -0
  158. package/dist/lib/commands/utils/error-formatter.js.map +1 -0
  159. package/dist/lib/commands/utils/pools.d.ts +16 -0
  160. package/dist/lib/commands/utils/pools.d.ts.map +1 -0
  161. package/dist/lib/commands/utils/pools.js +198 -0
  162. package/dist/lib/commands/utils/pools.js.map +1 -0
  163. package/dist/lib/config.d.ts +41 -40
  164. package/dist/lib/config.d.ts.map +1 -1
  165. package/dist/lib/config.js +264 -239
  166. package/dist/lib/config.js.map +1 -1
  167. package/dist/lib/constants.d.ts +14 -0
  168. package/dist/lib/constants.d.ts.map +1 -0
  169. package/dist/lib/constants.js +19 -0
  170. package/dist/lib/constants.js.map +1 -0
  171. package/dist/lib/emulation/docker.d.ts +4 -12
  172. package/dist/lib/emulation/docker.d.ts.map +1 -1
  173. package/dist/lib/emulation/docker.js +159 -142
  174. package/dist/lib/emulation/docker.js.map +1 -1
  175. package/dist/lib/emulation/utils.d.ts +1 -1
  176. package/dist/lib/emulation/utils.d.ts.map +1 -1
  177. package/dist/lib/emulation/utils.js +55 -58
  178. package/dist/lib/emulation/utils.js.map +1 -1
  179. package/dist/lib/id.d.ts +1 -1
  180. package/dist/lib/id.d.ts.map +1 -1
  181. package/dist/lib/id.js +13 -18
  182. package/dist/lib/id.js.map +1 -1
  183. package/dist/lib/paginate.d.ts +3 -4
  184. package/dist/lib/paginate.d.ts.map +1 -1
  185. package/dist/lib/paginate.js +7 -10
  186. package/dist/lib/paginate.js.map +1 -1
  187. package/dist/lib/parser.d.ts +1 -1
  188. package/dist/lib/parser.d.ts.map +1 -1
  189. package/dist/lib/parser.js +92 -103
  190. package/dist/lib/parser.js.map +1 -1
  191. package/dist/lib/questions.d.ts +1 -1
  192. package/dist/lib/questions.d.ts.map +1 -1
  193. package/dist/lib/questions.js +381 -385
  194. package/dist/lib/questions.js.map +1 -1
  195. package/dist/lib/sdks.d.ts +1 -1
  196. package/dist/lib/sdks.d.ts.map +1 -1
  197. package/dist/lib/sdks.js +39 -30
  198. package/dist/lib/sdks.js.map +1 -1
  199. package/dist/lib/services.d.ts +13 -0
  200. package/dist/lib/services.d.ts.map +1 -0
  201. package/dist/lib/services.js +47 -0
  202. package/dist/lib/services.js.map +1 -0
  203. package/dist/lib/spinner.d.ts +1 -1
  204. package/dist/lib/spinner.d.ts.map +1 -1
  205. package/dist/lib/spinner.js +25 -27
  206. package/dist/lib/spinner.js.map +1 -1
  207. package/dist/lib/type-generation/attribute.d.ts +1 -1
  208. package/dist/lib/type-generation/attribute.d.ts.map +1 -1
  209. package/dist/lib/type-generation/attribute.js +14 -17
  210. package/dist/lib/type-generation/attribute.js.map +1 -1
  211. package/dist/lib/type-generation/languages/csharp.d.ts +1 -1
  212. package/dist/lib/type-generation/languages/csharp.d.ts.map +1 -1
  213. package/dist/lib/type-generation/languages/csharp.js +34 -34
  214. package/dist/lib/type-generation/languages/csharp.js.map +1 -1
  215. package/dist/lib/type-generation/languages/dart.d.ts +1 -1
  216. package/dist/lib/type-generation/languages/dart.d.ts.map +1 -1
  217. package/dist/lib/type-generation/languages/dart.js +57 -57
  218. package/dist/lib/type-generation/languages/dart.js.map +1 -1
  219. package/dist/lib/type-generation/languages/java.d.ts +1 -1
  220. package/dist/lib/type-generation/languages/java.d.ts.map +1 -1
  221. package/dist/lib/type-generation/languages/java.js +35 -35
  222. package/dist/lib/type-generation/languages/java.js.map +1 -1
  223. package/dist/lib/type-generation/languages/javascript.d.ts +1 -1
  224. package/dist/lib/type-generation/languages/javascript.d.ts.map +1 -1
  225. package/dist/lib/type-generation/languages/javascript.js +45 -44
  226. package/dist/lib/type-generation/languages/javascript.js.map +1 -1
  227. package/dist/lib/type-generation/languages/kotlin.d.ts +1 -1
  228. package/dist/lib/type-generation/languages/kotlin.d.ts.map +1 -1
  229. package/dist/lib/type-generation/languages/kotlin.js +35 -35
  230. package/dist/lib/type-generation/languages/kotlin.js.map +1 -1
  231. package/dist/lib/type-generation/languages/language.d.ts.map +1 -1
  232. package/dist/lib/type-generation/languages/language.js +32 -37
  233. package/dist/lib/type-generation/languages/language.js.map +1 -1
  234. package/dist/lib/type-generation/languages/php.d.ts +1 -1
  235. package/dist/lib/type-generation/languages/php.d.ts.map +1 -1
  236. package/dist/lib/type-generation/languages/php.js +34 -34
  237. package/dist/lib/type-generation/languages/php.js.map +1 -1
  238. package/dist/lib/type-generation/languages/swift.d.ts +1 -1
  239. package/dist/lib/type-generation/languages/swift.d.ts.map +1 -1
  240. package/dist/lib/type-generation/languages/swift.js +35 -35
  241. package/dist/lib/type-generation/languages/swift.js.map +1 -1
  242. package/dist/lib/type-generation/languages/typescript.d.ts +1 -1
  243. package/dist/lib/type-generation/languages/typescript.d.ts.map +1 -1
  244. package/dist/lib/type-generation/languages/typescript.js +49 -46
  245. package/dist/lib/type-generation/languages/typescript.js.map +1 -1
  246. package/dist/lib/types.d.ts +38 -108
  247. package/dist/lib/types.d.ts.map +1 -1
  248. package/dist/lib/types.js +1 -2
  249. package/dist/lib/utils.d.ts +3 -0
  250. package/dist/lib/utils.d.ts.map +1 -1
  251. package/dist/lib/utils.js +142 -98
  252. package/dist/lib/utils.js.map +1 -1
  253. package/dist/lib/validations.d.ts.map +1 -1
  254. package/dist/lib/validations.js +2 -6
  255. package/dist/lib/validations.js.map +1 -1
  256. package/dist/package.json +68 -0
  257. package/index.ts +25 -149
  258. package/install.ps1 +2 -2
  259. package/install.sh +1 -1
  260. package/lib/client.ts +261 -220
  261. package/lib/commands/config.ts +494 -0
  262. package/lib/commands/db.ts +324 -0
  263. package/lib/commands/errors.ts +93 -0
  264. package/lib/commands/generic.ts +371 -269
  265. package/lib/commands/init.ts +631 -519
  266. package/lib/commands/pull.ts +827 -453
  267. package/lib/commands/push.ts +2191 -2349
  268. package/lib/commands/run.ts +382 -302
  269. package/lib/commands/schema.ts +122 -0
  270. package/lib/commands/services/account.ts +647 -0
  271. package/lib/commands/services/console.ts +52 -0
  272. package/lib/commands/services/databases.ts +1163 -0
  273. package/lib/commands/services/functions.ts +536 -0
  274. package/lib/commands/services/graphql.ts +50 -0
  275. package/lib/commands/services/health.ts +260 -0
  276. package/lib/commands/services/locale.ts +102 -0
  277. package/lib/commands/services/messaging.ts +1052 -0
  278. package/lib/commands/services/migrations.ts +249 -0
  279. package/lib/commands/services/project.ts +112 -0
  280. package/lib/commands/services/projects.ts +785 -0
  281. package/lib/commands/services/proxy.ts +135 -0
  282. package/lib/commands/services/sites.ts +505 -0
  283. package/lib/commands/services/storage.ts +338 -0
  284. package/lib/commands/services/tables-db.ts +1150 -0
  285. package/lib/commands/services/teams.ts +232 -0
  286. package/lib/commands/services/tokens.ts +94 -0
  287. package/lib/commands/services/users.ts +616 -0
  288. package/lib/commands/services/vcs.ts +165 -0
  289. package/lib/commands/types.ts +145 -118
  290. package/lib/commands/update.ts +189 -159
  291. package/lib/commands/utils/attributes.ts +719 -0
  292. package/lib/commands/utils/change-approval.ts +186 -0
  293. package/lib/commands/utils/database-sync.ts +180 -0
  294. package/lib/commands/utils/deployment.ts +184 -0
  295. package/lib/commands/utils/error-formatter.ts +417 -0
  296. package/lib/commands/utils/pools.ts +355 -0
  297. package/lib/config.ts +766 -687
  298. package/lib/constants.ts +22 -0
  299. package/lib/emulation/docker.ts +277 -216
  300. package/lib/emulation/utils.ts +188 -174
  301. package/lib/id.ts +23 -23
  302. package/lib/paginate.ts +69 -55
  303. package/lib/parser.ts +220 -189
  304. package/lib/questions.ts +1024 -948
  305. package/lib/sdks.ts +84 -51
  306. package/lib/services.ts +72 -0
  307. package/lib/spinner.ts +112 -99
  308. package/lib/type-generation/attribute.ts +15 -14
  309. package/lib/type-generation/languages/csharp.ts +71 -60
  310. package/lib/type-generation/languages/dart.ts +106 -93
  311. package/lib/type-generation/languages/java.ts +69 -58
  312. package/lib/type-generation/languages/javascript.ts +84 -73
  313. package/lib/type-generation/languages/kotlin.ts +71 -60
  314. package/lib/type-generation/languages/language.ts +103 -95
  315. package/lib/type-generation/languages/php.ts +67 -56
  316. package/lib/type-generation/languages/swift.ts +71 -60
  317. package/lib/type-generation/languages/typescript.ts +93 -76
  318. package/lib/types.ts +50 -125
  319. package/lib/utils.ts +304 -233
  320. package/lib/validations.ts +17 -14
  321. package/package.json +31 -22
  322. package/scoop/appwrite.config.json +3 -3
  323. package/tsconfig.json +7 -13
  324. package/.github/workflows/autoclose.yml +0 -11
  325. package/.github/workflows/npm-publish.yml +0 -49
  326. package/dist/lib/commands/account.d.ts +0 -379
  327. package/dist/lib/commands/account.d.ts.map +0 -1
  328. package/dist/lib/commands/account.js +0 -1228
  329. package/dist/lib/commands/account.js.map +0 -1
  330. package/dist/lib/commands/console.d.ts +0 -20
  331. package/dist/lib/commands/console.d.ts.map +0 -1
  332. package/dist/lib/commands/console.js +0 -78
  333. package/dist/lib/commands/console.js.map +0 -1
  334. package/dist/lib/commands/databases.d.ts +0 -732
  335. package/dist/lib/commands/databases.d.ts.map +0 -1
  336. package/dist/lib/commands/databases.js +0 -2196
  337. package/dist/lib/commands/databases.js.map +0 -1
  338. package/dist/lib/commands/functions.d.ts +0 -310
  339. package/dist/lib/commands/functions.d.ts.map +0 -1
  340. package/dist/lib/commands/functions.js +0 -1100
  341. package/dist/lib/commands/functions.js.map +0 -1
  342. package/dist/lib/commands/graphql.d.ts +0 -19
  343. package/dist/lib/commands/graphql.d.ts.map +0 -1
  344. package/dist/lib/commands/graphql.js +0 -77
  345. package/dist/lib/commands/graphql.js.map +0 -1
  346. package/dist/lib/commands/health.d.ts +0 -153
  347. package/dist/lib/commands/health.d.ts.map +0 -1
  348. package/dist/lib/commands/health.js +0 -464
  349. package/dist/lib/commands/health.js.map +0 -1
  350. package/dist/lib/commands/locale.d.ts +0 -53
  351. package/dist/lib/commands/locale.d.ts.map +0 -1
  352. package/dist/lib/commands/locale.js +0 -165
  353. package/dist/lib/commands/locale.js.map +0 -1
  354. package/dist/lib/commands/messaging.d.ts +0 -588
  355. package/dist/lib/commands/messaging.d.ts.map +0 -1
  356. package/dist/lib/commands/messaging.js +0 -2042
  357. package/dist/lib/commands/messaging.js.map +0 -1
  358. package/dist/lib/commands/migrations.d.ts +0 -150
  359. package/dist/lib/commands/migrations.d.ts.map +0 -1
  360. package/dist/lib/commands/migrations.js +0 -524
  361. package/dist/lib/commands/migrations.js.map +0 -1
  362. package/dist/lib/commands/organizations.d.ts +0 -11
  363. package/dist/lib/commands/organizations.d.ts.map +0 -1
  364. package/dist/lib/commands/organizations.js +0 -31
  365. package/dist/lib/commands/organizations.js.map +0 -1
  366. package/dist/lib/commands/project.d.ts +0 -53
  367. package/dist/lib/commands/project.d.ts.map +0 -1
  368. package/dist/lib/commands/project.js +0 -176
  369. package/dist/lib/commands/project.js.map +0 -1
  370. package/dist/lib/commands/projects.d.ts +0 -516
  371. package/dist/lib/commands/projects.d.ts.map +0 -1
  372. package/dist/lib/commands/projects.js +0 -1590
  373. package/dist/lib/commands/projects.js.map +0 -1
  374. package/dist/lib/commands/proxy.d.ts +0 -71
  375. package/dist/lib/commands/proxy.d.ts.map +0 -1
  376. package/dist/lib/commands/proxy.js +0 -240
  377. package/dist/lib/commands/proxy.js.map +0 -1
  378. package/dist/lib/commands/sites.d.ts +0 -296
  379. package/dist/lib/commands/sites.d.ts.map +0 -1
  380. package/dist/lib/commands/sites.js +0 -1046
  381. package/dist/lib/commands/sites.js.map +0 -1
  382. package/dist/lib/commands/storage.d.ts +0 -170
  383. package/dist/lib/commands/storage.d.ts.map +0 -1
  384. package/dist/lib/commands/storage.js +0 -651
  385. package/dist/lib/commands/storage.js.map +0 -1
  386. package/dist/lib/commands/tables-db.d.ts +0 -728
  387. package/dist/lib/commands/tables-db.d.ts.map +0 -1
  388. package/dist/lib/commands/tables-db.js +0 -2198
  389. package/dist/lib/commands/tables-db.js.map +0 -1
  390. package/dist/lib/commands/teams.d.ts +0 -129
  391. package/dist/lib/commands/teams.d.ts.map +0 -1
  392. package/dist/lib/commands/teams.js +0 -403
  393. package/dist/lib/commands/teams.js.map +0 -1
  394. package/dist/lib/commands/tokens.d.ts +0 -48
  395. package/dist/lib/commands/tokens.d.ts.map +0 -1
  396. package/dist/lib/commands/tokens.js +0 -156
  397. package/dist/lib/commands/tokens.js.map +0 -1
  398. package/dist/lib/commands/users.d.ts +0 -382
  399. package/dist/lib/commands/users.d.ts.map +0 -1
  400. package/dist/lib/commands/users.js +0 -1195
  401. package/dist/lib/commands/users.js.map +0 -1
  402. package/dist/lib/commands/vcs.d.ts +0 -92
  403. package/dist/lib/commands/vcs.d.ts.map +0 -1
  404. package/dist/lib/commands/vcs.js +0 -276
  405. package/dist/lib/commands/vcs.js.map +0 -1
  406. package/dist/lib/exception.d.ts +0 -8
  407. package/dist/lib/exception.d.ts.map +0 -1
  408. package/dist/lib/exception.js +0 -16
  409. package/dist/lib/exception.js.map +0 -1
  410. package/lib/commands/account.ts +0 -1867
  411. package/lib/commands/console.ts +0 -112
  412. package/lib/commands/databases.ts +0 -3272
  413. package/lib/commands/functions.ts +0 -1587
  414. package/lib/commands/graphql.ts +0 -110
  415. package/lib/commands/health.ts +0 -753
  416. package/lib/commands/locale.ts +0 -270
  417. package/lib/commands/messaging.ts +0 -2878
  418. package/lib/commands/migrations.ts +0 -754
  419. package/lib/commands/organizations.ts +0 -46
  420. package/lib/commands/project.ts +0 -266
  421. package/lib/commands/projects.ts +0 -2370
  422. package/lib/commands/proxy.ts +0 -357
  423. package/lib/commands/sites.ts +0 -1514
  424. package/lib/commands/storage.ts +0 -919
  425. package/lib/commands/tables-db.ts +0 -3260
  426. package/lib/commands/teams.ts +0 -609
  427. package/lib/commands/tokens.ts +0 -232
  428. package/lib/commands/users.ts +0 -1804
  429. package/lib/commands/vcs.ts +0 -428
  430. package/lib/exception.ts +0 -20
@@ -1,429 +1,514 @@
1
- import fs = require('fs');
2
- import path = require('path');
3
- import childProcess = require('child_process');
4
- import { Command } from 'commander';
5
- import inquirer from 'inquirer';
6
- import { projectsCreate, projectsGet } from './projects';
7
- import { storageCreateBucket } from './storage';
8
- import { messagingCreateTopic } from './messaging';
9
- import { functionsCreate } from './functions';
10
- import { databasesCreateCollection } from './databases';
11
- import { pullResources } from './pull';
12
- import ID from '../id';
13
- import { localConfig, globalConfig } from '../config';
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import childProcess from "child_process";
4
+ import { Command } from "commander";
5
+ import inquirer from "inquirer";
6
+ import { getProjectsService, getSitesService } from "../services.js";
7
+ import { pullResources } from "./pull.js";
8
+ import ID from "../id.js";
9
+ import { localConfig, globalConfig } from "../config.js";
14
10
  import {
15
- questionsCreateFunction,
16
- questionsCreateFunctionSelectTemplate,
17
- questionsCreateSite,
18
- questionsCreateBucket,
19
- questionsCreateMessagingTopic,
20
- questionsCreateCollection,
21
- questionsCreateTable,
22
- questionsInitProject,
23
- questionsInitProjectAutopull,
24
- questionsInitResources,
25
- questionsCreateTeam
26
- } from '../questions';
27
- import { cliConfig, success, log, hint, error, actionRunner, commandDescriptions } from '../parser';
28
- import { accountGet } from './account';
29
- import { sitesListTemplates } from './sites';
30
- import { sdkForConsole } from '../sdks';
31
- import { isCloud } from '../utils';
11
+ questionsCreateFunction,
12
+ questionsCreateFunctionSelectTemplate,
13
+ questionsCreateSite,
14
+ questionsCreateBucket,
15
+ questionsCreateMessagingTopic,
16
+ questionsCreateCollection,
17
+ questionsCreateTable,
18
+ questionsInitProject,
19
+ questionsInitProjectAutopull,
20
+ questionsInitResources,
21
+ questionsCreateTeam,
22
+ } from "../questions.js";
23
+ import {
24
+ cliConfig,
25
+ success,
26
+ log,
27
+ hint,
28
+ error,
29
+ actionRunner,
30
+ commandDescriptions,
31
+ } from "../parser.js";
32
+ import { sdkForConsole } from "../sdks.js";
33
+ import { isCloud } from "../utils.js";
34
+ import { Account } from "@appwrite.io/console";
35
+ import { DEFAULT_ENDPOINT, EXECUTABLE_NAME } from "../constants.js";
32
36
 
33
37
  const initResources = async (): Promise<void> => {
34
- const actions: Record<string, (options?: any) => Promise<void>> = {
35
- function: initFunction,
36
- site: initSite,
37
- table: initTable,
38
- bucket: initBucket,
39
- team: initTeam,
40
- message: initTopic,
41
- collection: initCollection
42
- }
43
-
44
- const answers = await inquirer.prompt(questionsInitResources[0]);
45
-
46
- const action = actions[answers.resource];
47
- if (action !== undefined) {
48
- await action({ returnOnZero: true });
49
- }
38
+ const actions: Record<string, (options?: any) => Promise<void>> = {
39
+ function: initFunction,
40
+ site: initSite,
41
+ table: initTable,
42
+ bucket: initBucket,
43
+ team: initTeam,
44
+ message: initTopic,
45
+ collection: initCollection,
46
+ };
47
+
48
+ const answers = await inquirer.prompt([questionsInitResources[0]]);
49
+
50
+ const action = actions[answers.resource];
51
+ if (action !== undefined) {
52
+ await action({ returnOnZero: true });
53
+ }
50
54
  };
51
55
 
52
56
  interface InitProjectOptions {
53
- organizationId?: string;
54
- projectId?: string;
55
- projectName?: string;
57
+ organizationId?: string;
58
+ projectId?: string;
59
+ projectName?: string;
56
60
  }
57
61
 
58
- const initProject = async ({ organizationId, projectId, projectName }: InitProjectOptions = {}): Promise<void> => {
59
- let response: any = {};
62
+ const initProject = async ({
63
+ organizationId,
64
+ projectId,
65
+ projectName,
66
+ }: InitProjectOptions = {}): Promise<void> => {
67
+ let response: any = {};
68
+
69
+ try {
70
+ if (globalConfig.getEndpoint() === "" || globalConfig.getCookie() === "") {
71
+ throw new Error(
72
+ `Missing endpoint or cookie configuration. Please run '${EXECUTABLE_NAME} login' first.`,
73
+ );
74
+ }
75
+ const client = await sdkForConsole();
76
+ const accountClient = new Account(client);
77
+
78
+ await accountClient.get();
79
+ } catch (e) {
80
+ error(
81
+ `Error Session not found. Please run '${EXECUTABLE_NAME} login' to create a session`,
82
+ );
83
+ process.exit(1);
84
+ }
85
+
86
+ let answers: any = {};
87
+
88
+ if (!organizationId && !projectId && !projectName) {
89
+ answers = await inquirer.prompt(questionsInitProject);
90
+ if (answers.override === false) {
91
+ process.exit(1);
92
+ }
93
+ } else {
94
+ answers.start = "existing";
95
+ answers.project = {};
96
+ answers.organization = {};
97
+
98
+ answers.organization =
99
+ organizationId ??
100
+ (await inquirer.prompt([questionsInitProject[2]])).organization;
101
+ answers.project.name =
102
+ projectName ?? (await inquirer.prompt([questionsInitProject[3]])).project;
103
+ answers.project =
104
+ projectId ?? (await inquirer.prompt([questionsInitProject[4]])).id;
60
105
 
61
106
  try {
62
- if (globalConfig.getEndpoint() === '' || globalConfig.getCookie() === '') {
63
- throw '';
64
- }
65
- const client = await sdkForConsole();
66
-
67
- await accountGet({
68
- parseOutput: false,
69
- sdk: client
70
- });
71
- } catch (e) {
72
- error("Error Session not found. Please run 'appwrite login' to create a session");
73
- process.exit(1);
107
+ const projectsService = await getProjectsService();
108
+ await projectsService.get(projectId);
109
+ } catch (e: any) {
110
+ if (e.code === 404) {
111
+ answers.start = "new";
112
+ answers.id = answers.project;
113
+ answers.project = answers.project.name;
114
+ } else {
115
+ throw e;
116
+ }
74
117
  }
75
-
76
- let answers: any = {};
77
-
78
- if (!organizationId && !projectId && !projectName) {
79
- answers = await inquirer.prompt(questionsInitProject)
80
- if (answers.override === false) {
81
- process.exit(1)
82
- }
83
- } else {
84
- answers.start = 'existing';
85
- answers.project = {};
86
- answers.organization = {};
87
-
88
- answers.organization = organizationId ?? (await inquirer.prompt(questionsInitProject[2])).organization;
89
- answers.project.name = projectName ?? (await inquirer.prompt(questionsInitProject[3])).project;
90
- answers.project = projectId ?? (await inquirer.prompt(questionsInitProject[4])).id;
91
-
92
- try {
93
- await projectsGet({ projectId, parseOutput: false });
94
- } catch (e: any) {
95
- if (e.code === 404) {
96
- answers.start = 'new';
97
- answers.id = answers.project;
98
- answers.project = answers.project.name;
99
- } else {
100
- throw e;
101
- }
102
- }
118
+ }
119
+
120
+ localConfig.clear(); // Clear the config to avoid any conflicts
121
+ const url = new URL(DEFAULT_ENDPOINT);
122
+
123
+ if (answers.start === "new") {
124
+ const projectsService = await getProjectsService();
125
+ response = await projectsService.create(
126
+ answers.id,
127
+ answers.project,
128
+ answers.organization,
129
+ answers.region,
130
+ );
131
+
132
+ localConfig.setProject(response["$id"]);
133
+ if (answers.region) {
134
+ localConfig.setEndpoint(
135
+ `https://${answers.region}.${url.host}${url.pathname}`,
136
+ );
103
137
  }
104
-
105
- localConfig.clear(); // Clear the config to avoid any conflicts
106
- const url = new URL("https://cloud.appwrite.io/v1");
107
-
108
- if (answers.start === 'new') {
109
- response = await projectsCreate({
110
- projectId: answers.id,
111
- name: answers.project,
112
- teamId: answers.organization,
113
- parseOutput: false
114
- })
115
-
116
- localConfig.setProject(response['$id']);
117
- if (answers.region) {
118
- localConfig.setEndpoint(`https://${answers.region}.${url.host}${url.pathname}`);
119
- }
120
- } else {
121
- localConfig.setProject(answers.project["$id"]);
122
- if(isCloud()) {
123
- localConfig.setEndpoint(`https://${answers.project["region"]}.${url.host}${url.pathname}`);
124
- }
138
+ } else {
139
+ localConfig.setProject(answers.project["$id"]);
140
+ if (isCloud()) {
141
+ localConfig.setEndpoint(
142
+ `https://${answers.project["region"]}.${url.host}${url.pathname}`,
143
+ );
125
144
  }
126
-
127
- success(`Project successfully ${answers.start === 'existing' ? 'linked' : 'created'}. Details are now stored in appwrite.config.json file.`);
128
-
129
- if(answers.start === 'existing') {
130
- answers = await inquirer.prompt(questionsInitProjectAutopull);
131
- if(answers.autopull) {
132
- cliConfig.all = true;
133
- cliConfig.force = true;
134
- await pullResources({
135
- skipDeprecated: true
136
- });
137
- } else {
138
- log("You can run 'appwrite pull all' to synchronize all of your existing resources.");
139
- }
145
+ }
146
+
147
+ success(
148
+ `Project successfully ${answers.start === "existing" ? "linked" : "created"}. Details are now stored in appwrite.config.json file.`,
149
+ );
150
+
151
+ if (answers.start === "existing") {
152
+ answers = await inquirer.prompt(questionsInitProjectAutopull);
153
+ if (answers.autopull) {
154
+ cliConfig.all = true;
155
+ cliConfig.force = true;
156
+ await pullResources({
157
+ skipDeprecated: true,
158
+ });
159
+ } else {
160
+ log(
161
+ `You can run '${EXECUTABLE_NAME} pull all' to synchronize all of your existing resources.`,
162
+ );
140
163
  }
164
+ }
141
165
 
142
- hint("Next you can use 'appwrite init' to create resources in your project, or use 'appwrite pull' and 'appwrite push' to synchronize your project.")
143
- }
166
+ hint(
167
+ `Next you can use '${EXECUTABLE_NAME} init' to create resources in your project, or use '${EXECUTABLE_NAME} pull' and '${EXECUTABLE_NAME} push' to synchronize your project.`,
168
+ );
169
+ };
144
170
 
145
171
  const initBucket = async (): Promise<void> => {
146
- const answers = await inquirer.prompt(questionsCreateBucket)
147
-
148
- localConfig.addBucket({
149
- $id: answers.id === 'unique()' ? ID.unique() : answers.id,
150
- name: answers.bucket,
151
- fileSecurity: answers.fileSecurity.toLowerCase() === 'yes',
152
- enabled: true,
153
- });
154
- success("Initialing bucket");
155
- log("Next you can use 'appwrite push bucket' to deploy the changes.");
172
+ const answers = await inquirer.prompt(questionsCreateBucket);
173
+
174
+ localConfig.addBucket({
175
+ $id: answers.id === "unique()" ? ID.unique() : answers.id,
176
+ name: answers.bucket,
177
+ fileSecurity: answers.fileSecurity.toLowerCase() === "yes",
178
+ enabled: true,
179
+ });
180
+ success("Initialing bucket");
181
+ log(
182
+ `Next you can use '${EXECUTABLE_NAME} push bucket' to deploy the changes.`,
183
+ );
156
184
  };
157
185
 
158
186
  const initTeam = async (): Promise<void> => {
159
- const answers = await inquirer.prompt(questionsCreateTeam)
187
+ const answers = await inquirer.prompt(questionsCreateTeam);
160
188
 
161
- localConfig.addTeam({
162
- $id: answers.id === 'unique()' ? ID.unique() : answers.id,
163
- name: answers.bucket,
164
- });
189
+ localConfig.addTeam({
190
+ $id: answers.id === "unique()" ? ID.unique() : answers.id,
191
+ name: answers.team,
192
+ });
165
193
 
166
- success("Initialing team");
167
- log("Next you can use 'appwrite push team' to deploy the changes.");
194
+ success("Initialing team");
195
+ log(`Next you can use '${EXECUTABLE_NAME} push team' to deploy the changes.`);
168
196
  };
169
197
 
170
198
  const initTable = async (): Promise<void> => {
171
- const answers = await inquirer.prompt(questionsCreateTable)
172
- const newDatabase = (answers.method ?? '').toLowerCase() !== 'existing';
173
-
174
- if (!newDatabase) {
175
- answers.databaseId = answers.database;
176
- answers.databaseName = localConfig.getTablesDB(answers.database).name;
177
- }
178
-
179
- const databaseId = answers.databaseId === 'unique()' ? ID.unique() : answers.databaseId;
180
-
181
- if (newDatabase || !localConfig.getTablesDB(answers.databaseId)) {
182
- localConfig.addTablesDB({
183
- $id: databaseId,
184
- name: answers.databaseName,
185
- enabled: true
186
- });
187
- }
188
-
189
- localConfig.addTable({
190
- $id: answers.id === 'unique()' ? ID.unique() : answers.id,
191
- $permissions: [],
192
- databaseId: databaseId,
193
- name: answers.table,
194
- enabled: true,
195
- rowSecurity: answers.rowSecurity.toLowerCase() === 'yes',
196
- columns: [],
197
- indexes: [],
199
+ const answers = await inquirer.prompt(questionsCreateTable);
200
+ const newDatabase = (answers.method ?? "").toLowerCase() !== "existing";
201
+
202
+ if (!newDatabase) {
203
+ answers.databaseId = answers.database;
204
+ answers.databaseName = localConfig.getTablesDB(answers.database).name;
205
+ }
206
+
207
+ const databaseId =
208
+ answers.databaseId === "unique()" ? ID.unique() : answers.databaseId;
209
+
210
+ if (newDatabase || !localConfig.getTablesDB(answers.databaseId)) {
211
+ localConfig.addTablesDB({
212
+ $id: databaseId,
213
+ name: answers.databaseName,
214
+ enabled: true,
198
215
  });
199
-
200
- success("Initialing table");
201
- log("Next you can use 'appwrite push table' to deploy the changes.");
216
+ }
217
+
218
+ localConfig.addTable({
219
+ $id: answers.id === "unique()" ? ID.unique() : answers.id,
220
+ $permissions: [],
221
+ databaseId: databaseId,
222
+ name: answers.table,
223
+ enabled: true,
224
+ rowSecurity: answers.rowSecurity.toLowerCase() === "yes",
225
+ columns: [],
226
+ indexes: [],
227
+ });
228
+
229
+ success("Initialing table");
230
+ log(
231
+ `Next you can use '${EXECUTABLE_NAME} push table' to deploy the changes.`,
232
+ );
202
233
  };
203
234
 
204
235
  const initCollection = async (): Promise<void> => {
205
- const answers = await inquirer.prompt(questionsCreateCollection)
206
- const newDatabase = (answers.method ?? '').toLowerCase() !== 'existing';
207
-
208
- if (!newDatabase) {
209
- answers.databaseId = answers.database;
210
- answers.databaseName = localConfig.getDatabase(answers.database).name;
211
- }
212
-
213
- const databaseId = answers.databaseId === 'unique()' ? ID.unique() : answers.databaseId;
214
-
215
- if (newDatabase || !localConfig.getDatabase(answers.databaseId)) {
216
- localConfig.addDatabase({
217
- $id: databaseId,
218
- name: answers.databaseName,
219
- enabled: true
220
- });
221
- }
222
-
223
- localConfig.addCollection({
224
- $id: answers.id === 'unique()' ? ID.unique() : answers.id,
225
- databaseId: databaseId,
226
- name: answers.collection,
227
- documentSecurity: answers.documentSecurity.toLowerCase() === 'yes',
228
- attributes: [],
229
- indexes: [],
230
- enabled: true,
236
+ const answers = await inquirer.prompt(questionsCreateCollection);
237
+ const newDatabase = (answers.method ?? "").toLowerCase() !== "existing";
238
+
239
+ if (!newDatabase) {
240
+ answers.databaseId = answers.database;
241
+ answers.databaseName = localConfig.getDatabase(answers.database).name;
242
+ }
243
+
244
+ const databaseId =
245
+ answers.databaseId === "unique()" ? ID.unique() : answers.databaseId;
246
+
247
+ if (newDatabase || !localConfig.getDatabase(answers.databaseId)) {
248
+ localConfig.addDatabase({
249
+ $id: databaseId,
250
+ name: answers.databaseName,
251
+ enabled: true,
231
252
  });
232
-
233
- success("Initialing collection");
234
- log("Next you can use 'appwrite push collection' to deploy the changes.");
253
+ }
254
+
255
+ localConfig.addCollection({
256
+ $id: answers.id === "unique()" ? ID.unique() : answers.id,
257
+ databaseId: databaseId,
258
+ name: answers.collection,
259
+ documentSecurity: answers.documentSecurity.toLowerCase() === "yes",
260
+ attributes: [],
261
+ indexes: [],
262
+ enabled: true,
263
+ });
264
+
265
+ success("Initialing collection");
266
+ log(
267
+ `Next you can use '${EXECUTABLE_NAME} push collection' to deploy the changes.`,
268
+ );
235
269
  };
236
270
 
237
271
  const initTopic = async (): Promise<void> => {
238
- const answers = await inquirer.prompt(questionsCreateMessagingTopic)
272
+ const answers = await inquirer.prompt(questionsCreateMessagingTopic);
239
273
 
240
- localConfig.addMessagingTopic({
241
- $id: answers.id === 'unique()' ? ID.unique() : answers.id,
242
- name: answers.topic,
274
+ localConfig.addMessagingTopic({
275
+ $id: answers.id === "unique()" ? ID.unique() : answers.id,
276
+ name: answers.topic,
277
+ });
243
278
 
244
- });
245
-
246
- success("Initialing topic");
247
- log("Next you can use 'appwrite push topic' to deploy the changes.");
279
+ success("Initialing topic");
280
+ log(
281
+ `Next you can use '${EXECUTABLE_NAME} push topic' to deploy the changes.`,
282
+ );
248
283
  };
249
284
 
250
285
  const initFunction = async (): Promise<void> => {
251
- process.chdir(localConfig.configDirectoryPath)
252
-
253
- // TODO: Add CI/CD support (ID, name, runtime)
254
- const answers = await inquirer.prompt(questionsCreateFunction)
255
- const functionFolder = path.join(process.cwd(), 'functions');
256
-
257
- if (!fs.existsSync(functionFolder)) {
258
- fs.mkdirSync(functionFolder, {
259
- recursive: true
260
- });
261
- }
262
-
263
- const functionId = answers.id === 'unique()' ? ID.unique() : answers.id;
264
- const functionName = answers.name;
265
- const functionDir = path.join(functionFolder, functionName);
266
- const templatesDir = path.join(functionFolder, `${functionId}-templates`);
267
- const runtimeDir = path.join(templatesDir, answers.runtime.name);
268
-
269
- if (fs.existsSync(functionDir)) {
270
- throw new Error(`( ${functionName} ) already exists in the current directory. Please choose another name.`);
271
- }
272
-
273
- if (!answers.runtime.entrypoint) {
274
- log(`Entrypoint for this runtime not found. You will be asked to configure entrypoint when you first push the function.`);
275
- }
276
-
277
- if (!answers.runtime.commands) {
278
- log(`Installation command for this runtime not found. You will be asked to configure the install command when you first push the function.`);
279
- }
280
-
281
- fs.mkdirSync(functionDir, { mode: 0o777 });
282
- fs.mkdirSync(templatesDir, { mode: 0o777 });
283
- const repo = "https://github.com/appwrite/templates";
284
- const api = `https://api.github.com/repos/appwrite/templates/contents/${answers.runtime.name}`
285
- let selected: { template: string } = { template: 'starter' };
286
-
287
- const sparse = (selected ? `${answers.runtime.name}/${selected.template}` : answers.runtime.name).toLowerCase();
286
+ process.chdir(localConfig.configDirectoryPath);
288
287
 
289
- let gitInitCommands = `git clone --single-branch --depth 1 --sparse ${repo} .`; // depth prevents fetching older commits reducing the amount fetched
288
+ // TODO: Add CI/CD support (ID, name, runtime)
289
+ const answers = await inquirer.prompt(questionsCreateFunction);
290
+ const functionFolder = path.join(process.cwd(), "functions");
290
291
 
291
- let gitPullCommands = `git sparse-checkout add ${sparse}`;
292
-
293
- /* Force use CMD as powershell does not support && */
294
- if (process.platform === 'win32') {
295
- gitInitCommands = 'cmd /c "' + gitInitCommands + '"';
296
- gitPullCommands = 'cmd /c "' + gitPullCommands + '"';
292
+ if (!fs.existsSync(functionFolder)) {
293
+ fs.mkdirSync(functionFolder, {
294
+ recursive: true,
295
+ });
296
+ }
297
+
298
+ const functionId = answers.id === "unique()" ? ID.unique() : answers.id;
299
+ const functionName = answers.name;
300
+ const functionDir = path.join(functionFolder, functionName);
301
+ const templatesDir = path.join(functionFolder, `${functionId}-templates`);
302
+ const runtimeDir = path.join(templatesDir, answers.runtime.name);
303
+
304
+ if (fs.existsSync(functionDir)) {
305
+ throw new Error(
306
+ `( ${functionName} ) already exists in the current directory. Please choose another name.`,
307
+ );
308
+ }
309
+
310
+ if (!answers.runtime.entrypoint) {
311
+ log(
312
+ `Entrypoint for this runtime not found. You will be asked to configure entrypoint when you first push the function.`,
313
+ );
314
+ }
315
+
316
+ if (!answers.runtime.commands) {
317
+ log(
318
+ `Installation command for this runtime not found. You will be asked to configure the install command when you first push the function.`,
319
+ );
320
+ }
321
+
322
+ fs.mkdirSync(functionDir, { mode: 0o777 });
323
+ fs.mkdirSync(templatesDir, { mode: 0o777 });
324
+ const repo = "https://github.com/appwrite/templates";
325
+ const api = `https://api.github.com/repos/appwrite/templates/contents/${answers.runtime.name}`;
326
+ let selected: { template: string } = { template: "starter" };
327
+
328
+ const sparse = (
329
+ selected
330
+ ? `${answers.runtime.name}/${selected.template}`
331
+ : answers.runtime.name
332
+ ).toLowerCase();
333
+
334
+ let gitInitCommands = `git clone --single-branch --depth 1 --sparse ${repo} .`; // depth prevents fetching older commits reducing the amount fetched
335
+
336
+ let gitPullCommands = `git sparse-checkout add ${sparse}`;
337
+
338
+ /* Force use CMD as powershell does not support && */
339
+ if (process.platform === "win32") {
340
+ gitInitCommands = 'cmd /c "' + gitInitCommands + '"';
341
+ gitPullCommands = 'cmd /c "' + gitPullCommands + '"';
342
+ }
343
+
344
+ /* Execute the child process but do not print any std output */
345
+ try {
346
+ childProcess.execSync(gitInitCommands, {
347
+ stdio: "pipe",
348
+ cwd: templatesDir,
349
+ });
350
+ childProcess.execSync(gitPullCommands, {
351
+ stdio: "pipe",
352
+ cwd: templatesDir,
353
+ });
354
+ } catch (err: any) {
355
+ /* Specialised errors with recommended actions to take */
356
+ if (err.message.includes("error: unknown option")) {
357
+ throw new Error(
358
+ `${err.message} \n\nSuggestion: Try updating your git to the latest version, then trying to run this command again.`,
359
+ );
360
+ } else if (
361
+ err.message.includes(
362
+ "is not recognized as an internal or external command,",
363
+ ) ||
364
+ err.message.includes("command not found")
365
+ ) {
366
+ throw new Error(
367
+ `${err.message} \n\nSuggestion: It appears that git is not installed, try installing git then trying to run this command again.`,
368
+ );
369
+ } else {
370
+ throw err;
297
371
  }
298
-
299
- /* Execute the child process but do not print any std output */
300
- try {
301
- childProcess.execSync(gitInitCommands, { stdio: 'pipe', cwd: templatesDir });
302
- childProcess.execSync(gitPullCommands, { stdio: 'pipe', cwd: templatesDir });
303
- } catch (err: any) {
304
- /* Specialised errors with recommended actions to take */
305
- if (err.message.includes('error: unknown option')) {
306
- throw new Error(`${err.message} \n\nSuggestion: Try updating your git to the latest version, then trying to run this command again.`)
307
- } else if (err.message.includes('is not recognized as an internal or external command,') || err.message.includes('command not found')) {
308
- throw new Error(`${err.message} \n\nSuggestion: It appears that git is not installed, try installing git then trying to run this command again.`)
309
- } else {
310
- throw err;
311
- }
372
+ }
373
+
374
+ fs.rmSync(path.join(templatesDir, ".git"), { recursive: true });
375
+ if (!selected) {
376
+ const templates: string[] = [];
377
+ templates.push(
378
+ ...fs
379
+ .readdirSync(runtimeDir, { withFileTypes: true })
380
+ .filter((item) => item.isDirectory() && item.name !== "starter")
381
+ .map((dirent) => dirent.name),
382
+ );
383
+ selected = { template: "starter" };
384
+
385
+ if (templates.length > 1) {
386
+ selected = await inquirer.prompt(
387
+ questionsCreateFunctionSelectTemplate(templates),
388
+ );
312
389
  }
313
-
314
- fs.rmSync(path.join(templatesDir, ".git"), { recursive: true });
315
- if (!selected) {
316
- const templates: string[] = [];
317
- templates.push(...fs.readdirSync(runtimeDir, { withFileTypes: true })
318
- .filter(item => item.isDirectory() && item.name !== 'starter')
319
- .map(dirent => dirent.name));
320
- selected = { template: 'starter' };
321
-
322
- if (templates.length > 1) {
323
- selected = await inquirer.prompt(questionsCreateFunctionSelectTemplate(templates))
324
- }
390
+ }
391
+
392
+ const copyRecursiveSync = (src: string, dest: string): void => {
393
+ let exists = fs.existsSync(src);
394
+ let stats = exists && fs.statSync(src);
395
+ let isDirectory = exists && stats && stats.isDirectory();
396
+ if (isDirectory) {
397
+ if (!fs.existsSync(dest)) {
398
+ fs.mkdirSync(dest);
399
+ }
400
+
401
+ fs.readdirSync(src).forEach(function (childItemName) {
402
+ copyRecursiveSync(
403
+ path.join(src, childItemName),
404
+ path.join(dest, childItemName),
405
+ );
406
+ });
407
+ } else {
408
+ fs.copyFileSync(src, dest);
325
409
  }
326
-
327
- const copyRecursiveSync = (src: string, dest: string): void => {
328
- let exists = fs.existsSync(src);
329
- let stats = exists && fs.statSync(src);
330
- let isDirectory = exists && stats && stats.isDirectory();
331
- if (isDirectory) {
332
- if (!fs.existsSync(dest)) {
333
- fs.mkdirSync(dest);
334
- }
335
-
336
- fs.readdirSync(src).forEach(function (childItemName) {
337
- copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
338
- });
339
- } else {
340
- fs.copyFileSync(src, dest);
341
- }
342
- };
343
- copyRecursiveSync(path.join(runtimeDir, selected.template), functionDir);
344
-
345
- fs.rmSync(templatesDir, { recursive: true, force: true });
346
-
347
- const readmePath = path.join(process.cwd(), 'functions', functionName, 'README.md');
348
- const readmeFile = fs.readFileSync(readmePath).toString();
349
- const newReadmeFile = readmeFile.split('\n');
350
- newReadmeFile[0] = `# ${answers.name}`;
351
- newReadmeFile.splice(1, 2);
352
- fs.writeFileSync(readmePath, newReadmeFile.join('\n'));
353
-
354
- let data = {
355
- $id: functionId,
356
- name: answers.name,
357
- runtime: answers.runtime.id,
358
- specification: answers.specification,
359
- execute: ["any"],
360
- events: [],
361
- scopes: ["users.read"],
362
- schedule: "",
363
- timeout: 15,
364
- enabled: true,
365
- logging: true,
366
- entrypoint: answers.runtime.entrypoint || '',
367
- commands: answers.runtime.commands || '',
368
- ignore: answers.runtime.ignore || null,
369
- path: `functions/${functionName}`,
370
- };
371
-
372
- localConfig.addFunction(data);
373
- success("Initialing function");
374
- log("Next you can use 'appwrite run function' to develop a function locally. To deploy the function, use 'appwrite push function'");
375
- }
410
+ };
411
+ copyRecursiveSync(path.join(runtimeDir, selected.template), functionDir);
412
+
413
+ fs.rmSync(templatesDir, { recursive: true, force: true });
414
+
415
+ const readmePath = path.join(
416
+ process.cwd(),
417
+ "functions",
418
+ functionName,
419
+ "README.md",
420
+ );
421
+ const readmeFile = fs.readFileSync(readmePath).toString();
422
+ const newReadmeFile = readmeFile.split("\n");
423
+ newReadmeFile[0] = `# ${answers.name}`;
424
+ newReadmeFile.splice(1, 2);
425
+ fs.writeFileSync(readmePath, newReadmeFile.join("\n"));
426
+
427
+ let data = {
428
+ $id: functionId,
429
+ name: answers.name,
430
+ runtime: answers.runtime.id,
431
+ specification: answers.specification,
432
+ execute: ["any"],
433
+ events: [],
434
+ scopes: ["users.read"],
435
+ schedule: "",
436
+ timeout: 15,
437
+ enabled: true,
438
+ logging: true,
439
+ entrypoint: answers.runtime.entrypoint || "",
440
+ commands: answers.runtime.commands || "",
441
+ ignore: answers.runtime.ignore || null,
442
+ path: `functions/${functionName}`,
443
+ };
444
+
445
+ localConfig.addFunction(data);
446
+ success("Initialing function");
447
+ log(
448
+ `Next you can use '${EXECUTABLE_NAME} run function' to develop a function locally. To deploy the function, use '${EXECUTABLE_NAME} push function'`,
449
+ );
450
+ };
376
451
 
377
452
  const initSite = async (): Promise<void> => {
378
- process.chdir(localConfig.configDirectoryPath)
379
-
380
- const answers = await inquirer.prompt(questionsCreateSite);
381
- const siteFolder = path.join(process.cwd(), 'sites');
382
-
383
- if (!fs.existsSync(siteFolder)) {
384
- fs.mkdirSync(siteFolder, {
385
- recursive: true
386
- });
387
- }
453
+ process.chdir(localConfig.configDirectoryPath);
388
454
 
389
- const siteId = answers.id === 'unique()' ? ID.unique() : answers.id;
390
- const siteName = answers.name;
391
- const siteDir = path.join(siteFolder, siteName);
392
- const templatesDir = path.join(siteFolder, `${siteId}-templates`);
455
+ const answers = await inquirer.prompt(questionsCreateSite);
456
+ const siteFolder = path.join(process.cwd(), "sites");
393
457
 
394
- if (fs.existsSync(siteDir)) {
395
- throw new Error(`( ${siteName} ) already exists in the current directory. Please choose another name.`);
396
- }
397
-
398
- let templateDetails: any;
399
- try {
400
- const response = await sitesListTemplates({
401
- frameworks: [answers.framework.key],
402
- useCases: ['starter'],
403
- limit: 1,
404
- parseOutput: false
405
- });
406
- if (response.total == 0) {
407
- throw new Error(`No starter template found for framework ${answers.framework.key}`);
408
- }
409
- templateDetails = response.templates[0];
410
- } catch (err: any) {
411
- throw new Error(`Failed to fetch template for framework ${answers.framework.key}: ${err.message}`);
458
+ if (!fs.existsSync(siteFolder)) {
459
+ fs.mkdirSync(siteFolder, {
460
+ recursive: true,
461
+ });
462
+ }
463
+
464
+ const siteId = answers.id === "unique()" ? ID.unique() : answers.id;
465
+ const siteName = answers.name;
466
+ const siteDir = path.join(siteFolder, siteName);
467
+ const templatesDir = path.join(siteFolder, `${siteId}-templates`);
468
+
469
+ if (fs.existsSync(siteDir)) {
470
+ throw new Error(
471
+ `( ${siteName} ) already exists in the current directory. Please choose another name.`,
472
+ );
473
+ }
474
+
475
+ let templateDetails: any;
476
+ try {
477
+ const sitesService = await getSitesService();
478
+ const response = await sitesService.listTemplates(
479
+ [answers.framework.key],
480
+ ["starter"],
481
+ 1,
482
+ );
483
+ if (response.total == 0) {
484
+ throw new Error(
485
+ `No starter template found for framework ${answers.framework.key}`,
486
+ );
412
487
  }
413
-
414
- fs.mkdirSync(siteDir, { mode: 0o777 });
415
- fs.mkdirSync(templatesDir, { mode: 0o777 });
416
- const repo = `https://github.com/${templateDetails.providerOwner}/${templateDetails.providerRepositoryId}`;
417
- let selected = { template: templateDetails.frameworks[0].providerRootDirectory };
418
-
419
- let gitCloneCommands = '';
420
-
421
- const sparse = selected.template.startsWith('./') ? selected.template.substring(2) : selected.template;
422
-
423
- log('Fetching site code ...');
424
-
425
- if(selected.template === './') {
426
- gitCloneCommands = `
488
+ templateDetails = response.templates[0];
489
+ } catch (err: any) {
490
+ throw new Error(
491
+ `Failed to fetch template for framework ${answers.framework.key}: ${err.message}`,
492
+ );
493
+ }
494
+
495
+ fs.mkdirSync(siteDir, { mode: 0o777 });
496
+ fs.mkdirSync(templatesDir, { mode: 0o777 });
497
+ const repo = `https://github.com/${templateDetails.providerOwner}/${templateDetails.providerRepositoryId}`;
498
+ let selected = {
499
+ template: templateDetails.frameworks[0].providerRootDirectory,
500
+ };
501
+
502
+ let gitCloneCommands = "";
503
+
504
+ const sparse = selected.template.startsWith("./")
505
+ ? selected.template.substring(2)
506
+ : selected.template;
507
+
508
+ log("Fetching site code ...");
509
+
510
+ if (selected.template === "./") {
511
+ gitCloneCommands = `
427
512
  mkdir -p .
428
513
  cd .
429
514
  git init
@@ -432,8 +517,8 @@ const initSite = async (): Promise<void> => {
432
517
  git fetch --depth=1 origin refs/tags/$(git ls-remote --tags origin "${templateDetails.providerVersion}" | tail -n 1 | awk -F '/' '{print $3}')
433
518
  git checkout FETCH_HEAD
434
519
  `.trim();
435
- } else {
436
- gitCloneCommands = `
520
+ } else {
521
+ gitCloneCommands = `
437
522
  mkdir -p .
438
523
  cd .
439
524
  git init
@@ -446,167 +531,194 @@ const initSite = async (): Promise<void> => {
446
531
  git fetch --depth=1 origin refs/tags/$(git ls-remote --tags origin "${templateDetails.providerVersion}" | tail -n 1 | awk -F '/' '{print $3}')
447
532
  git checkout FETCH_HEAD
448
533
  `.trim();
449
- }
450
-
451
- /* Force use CMD as powershell does not support && */
452
- if (process.platform === 'win32') {
453
- gitCloneCommands = 'cmd /c "' + gitCloneCommands + '"';
454
- }
455
-
456
- /* Execute the child process but do not print any std output */
457
- try {
458
- childProcess.execSync(gitCloneCommands, { stdio: 'pipe', cwd: templatesDir });
459
- } catch (err: any) {
460
- /* Specialised errors with recommended actions to take */
461
- if (err.message.includes('error: unknown option')) {
462
- throw new Error(`${err.message} \n\nSuggestion: Try updating your git to the latest version, then trying to run this command again.`)
463
- } else if (err.message.includes('is not recognized as an internal or external command,') || err.message.includes('command not found')) {
464
- throw new Error(`${err.message} \n\nSuggestion: It appears that git is not installed, try installing git then trying to run this command again.`)
465
- } else {
466
- throw err;
467
- }
468
- }
469
-
470
- fs.rmSync(path.join(templatesDir, ".git"), { recursive: true });
471
-
472
- const copyRecursiveSync = (src: string, dest: string): void => {
473
- let exists = fs.existsSync(src);
474
- let stats = exists && fs.statSync(src);
475
- let isDirectory = exists && stats && stats.isDirectory();
476
- if (isDirectory) {
477
- if (!fs.existsSync(dest)) {
478
- fs.mkdirSync(dest);
479
- }
480
-
481
- fs.readdirSync(src).forEach(function (childItemName) {
482
- copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
483
- });
484
- } else {
485
- fs.copyFileSync(src, dest);
486
- }
487
- };
488
- copyRecursiveSync(selected.template === './' ? templatesDir : path.join(templatesDir, selected.template), siteDir);
489
-
490
- fs.rmSync(templatesDir, { recursive: true, force: true });
491
-
492
- const readmePath = path.join(process.cwd(), 'sites', siteName, 'README.md');
493
- const readmeFile = fs.readFileSync(readmePath).toString();
494
- const newReadmeFile = readmeFile.split('\n');
495
- newReadmeFile[0] = `# ${answers.key}`;
496
- newReadmeFile.splice(1, 2);
497
- fs.writeFileSync(readmePath, newReadmeFile.join('\n'));
498
-
499
- let vars = (templateDetails.variables ?? []).map((variable: any) => {
500
- let value = variable.value;
501
- const replacements: Record<string, string> = {
502
- '{apiEndpoint}': globalConfig.getEndpoint(),
503
- '{projectId}': localConfig.getProject().projectId,
504
- '{projectName}': localConfig.getProject().projectName,
505
- };
506
-
507
- for (const placeholder in replacements) {
508
- if (value?.includes(placeholder)) {
509
- value = value.replace(placeholder, replacements[placeholder]);
510
- }
511
- }
512
-
513
- return {
514
- key: variable.name,
515
- value: value
516
- };
534
+ }
535
+
536
+ /* Force use CMD as powershell does not support && */
537
+ if (process.platform === "win32") {
538
+ gitCloneCommands = 'cmd /c "' + gitCloneCommands + '"';
539
+ }
540
+
541
+ /* Execute the child process but do not print any std output */
542
+ try {
543
+ childProcess.execSync(gitCloneCommands, {
544
+ stdio: "pipe",
545
+ cwd: templatesDir,
517
546
  });
518
-
519
- let data = {
520
- $id: siteId,
521
- name: answers.name,
522
- framework: answers.framework.key,
523
- adapter: templateDetails.frameworks[0].adapter || '',
524
- buildRuntime: templateDetails.frameworks[0].buildRuntime || '',
525
- installCommand: templateDetails.frameworks[0].installCommand || '',
526
- buildCommand: templateDetails.frameworks[0].buildCommand || '',
527
- outputDirectory: templateDetails.frameworks[0].outputDirectory || '',
528
- fallbackFile: templateDetails.frameworks[0].fallbackFile || '',
529
- specification: answers.specification,
530
- enabled: true,
531
- timeout: 30,
532
- logging: true,
533
- ignore: answers.framework.ignore || null,
534
- path: `sites/${siteName}`,
535
- vars: vars
536
- };
537
-
538
- if (!data.buildRuntime) {
539
- log(`Build runtime for this framework not found. You will be asked to configure build runtime when you first push the site.`);
540
- }
541
-
542
- if (!data.installCommand) {
543
- log(`Installation command for this framework not found. You will be asked to configure the install command when you first push the site.`);
547
+ } catch (err: any) {
548
+ /* Specialised errors with recommended actions to take */
549
+ if (err.message.includes("error: unknown option")) {
550
+ throw new Error(
551
+ `${err.message} \n\nSuggestion: Try updating your git to the latest version, then trying to run this command again.`,
552
+ );
553
+ } else if (
554
+ err.message.includes(
555
+ "is not recognized as an internal or external command,",
556
+ ) ||
557
+ err.message.includes("command not found")
558
+ ) {
559
+ throw new Error(
560
+ `${err.message} \n\nSuggestion: It appears that git is not installed, try installing git then trying to run this command again.`,
561
+ );
562
+ } else {
563
+ throw err;
544
564
  }
545
-
546
- if (!data.buildCommand) {
547
- log(`Build command for this framework not found. You will be asked to configure the build command when you first push the site.`);
565
+ }
566
+
567
+ fs.rmSync(path.join(templatesDir, ".git"), { recursive: true });
568
+
569
+ const copyRecursiveSync = (src: string, dest: string): void => {
570
+ let exists = fs.existsSync(src);
571
+ let stats = exists && fs.statSync(src);
572
+ let isDirectory = exists && stats && stats.isDirectory();
573
+ if (isDirectory) {
574
+ if (!fs.existsSync(dest)) {
575
+ fs.mkdirSync(dest);
576
+ }
577
+
578
+ fs.readdirSync(src).forEach(function (childItemName) {
579
+ copyRecursiveSync(
580
+ path.join(src, childItemName),
581
+ path.join(dest, childItemName),
582
+ );
583
+ });
584
+ } else {
585
+ fs.copyFileSync(src, dest);
548
586
  }
587
+ };
588
+ copyRecursiveSync(
589
+ selected.template === "./"
590
+ ? templatesDir
591
+ : path.join(templatesDir, selected.template),
592
+ siteDir,
593
+ );
594
+
595
+ fs.rmSync(templatesDir, { recursive: true, force: true });
596
+
597
+ const readmePath = path.join(process.cwd(), "sites", siteName, "README.md");
598
+ const readmeFile = fs.readFileSync(readmePath).toString();
599
+ const newReadmeFile = readmeFile.split("\n");
600
+ newReadmeFile[0] = `# ${answers.name}`;
601
+ newReadmeFile.splice(1, 2);
602
+ fs.writeFileSync(readmePath, newReadmeFile.join("\n"));
603
+
604
+ let vars = (templateDetails.variables ?? []).map((variable: any) => {
605
+ let value = variable.value;
606
+ const replacements: Record<string, string> = {
607
+ "{apiEndpoint}": globalConfig.getEndpoint(),
608
+ "{projectId}": localConfig.getProject().projectId,
609
+ "{projectName}": localConfig.getProject().projectName,
610
+ };
549
611
 
550
- if (!data.outputDirectory) {
551
- log(`Output directory for this framework not found. You will be asked to configure the output directory when you first push the site.`);
612
+ for (const placeholder in replacements) {
613
+ if (value?.includes(placeholder)) {
614
+ value = value.replace(placeholder, replacements[placeholder]);
615
+ }
552
616
  }
553
617
 
554
- localConfig.addSite(data);
555
- success("Initializing site");
556
- log("Next you can use 'appwrite push site' to deploy the changes.");
618
+ return {
619
+ key: variable.name,
620
+ value: value,
621
+ };
622
+ });
623
+
624
+ let data = {
625
+ $id: siteId,
626
+ name: answers.name,
627
+ framework: answers.framework.key,
628
+ adapter: templateDetails.frameworks[0].adapter || "",
629
+ buildRuntime: templateDetails.frameworks[0].buildRuntime || "",
630
+ installCommand: templateDetails.frameworks[0].installCommand || "",
631
+ buildCommand: templateDetails.frameworks[0].buildCommand || "",
632
+ outputDirectory: templateDetails.frameworks[0].outputDirectory || "",
633
+ fallbackFile: templateDetails.frameworks[0].fallbackFile || "",
634
+ specification: answers.specification,
635
+ enabled: true,
636
+ timeout: 30,
637
+ logging: true,
638
+ ignore: answers.framework.ignore || null,
639
+ path: `sites/${siteName}`,
640
+ vars: vars,
641
+ };
642
+
643
+ if (!data.buildRuntime) {
644
+ log(
645
+ `Build runtime for this framework not found. You will be asked to configure build runtime when you first push the site.`,
646
+ );
647
+ }
648
+
649
+ if (!data.installCommand) {
650
+ log(
651
+ `Installation command for this framework not found. You will be asked to configure the install command when you first push the site.`,
652
+ );
653
+ }
654
+
655
+ if (!data.buildCommand) {
656
+ log(
657
+ `Build command for this framework not found. You will be asked to configure the build command when you first push the site.`,
658
+ );
659
+ }
660
+
661
+ if (!data.outputDirectory) {
662
+ log(
663
+ `Output directory for this framework not found. You will be asked to configure the output directory when you first push the site.`,
664
+ );
665
+ }
666
+
667
+ localConfig.addSite(data);
668
+ success("Initializing site");
669
+ log(`Next you can use '${EXECUTABLE_NAME} push site' to deploy the changes.`);
557
670
  };
558
671
 
559
672
  export const init = new Command("init")
560
- .description(commandDescriptions['init'])
561
- .action(actionRunner(initResources));
673
+ .description(commandDescriptions["init"])
674
+ .action(actionRunner(initResources));
562
675
 
563
676
  init
564
- .command("project")
565
- .description("Init a new Appwrite project")
566
- .option("--organization-id <organization-id>", "Appwrite organization ID")
567
- .option("--project-id <project-id>", "Appwrite project ID")
568
- .option("--project-name <project-name>", "Appwrite project ID")
569
- .action(actionRunner(initProject));
677
+ .command("project")
678
+ .description("Init a new Appwrite project")
679
+ .option("--organization-id <organization-id>", "Appwrite organization ID")
680
+ .option("--project-id <project-id>", "Appwrite project ID")
681
+ .option("--project-name <project-name>", "Appwrite project ID")
682
+ .action(actionRunner(initProject));
570
683
 
571
684
  init
572
- .command("function")
573
- .alias("functions")
574
- .description("Init a new Appwrite function")
575
- .action(actionRunner(initFunction));
685
+ .command("function")
686
+ .alias("functions")
687
+ .description("Init a new Appwrite function")
688
+ .action(actionRunner(initFunction));
576
689
 
577
690
  init
578
- .command("site")
579
- .alias("sites")
580
- .description("Init a new Appwrite site")
581
- .action(actionRunner(initSite));
691
+ .command("site")
692
+ .alias("sites")
693
+ .description("Init a new Appwrite site")
694
+ .action(actionRunner(initSite));
582
695
 
583
696
  init
584
- .command("bucket")
585
- .alias("buckets")
586
- .description("Init a new Appwrite bucket")
587
- .action(actionRunner(initBucket));
697
+ .command("bucket")
698
+ .alias("buckets")
699
+ .description("Init a new Appwrite bucket")
700
+ .action(actionRunner(initBucket));
588
701
 
589
702
  init
590
- .command("team")
591
- .alias("teams")
592
- .description("Init a new Appwrite team")
593
- .action(actionRunner(initTeam));
703
+ .command("team")
704
+ .alias("teams")
705
+ .description("Init a new Appwrite team")
706
+ .action(actionRunner(initTeam));
594
707
 
595
708
  init
596
- .command("collection")
597
- .alias("collections")
598
- .description("Init a new Appwrite collection")
599
- .action(actionRunner(initCollection));
709
+ .command("collection")
710
+ .alias("collections")
711
+ .description("Init a new Appwrite collection")
712
+ .action(actionRunner(initCollection));
600
713
 
601
714
  init
602
- .command("table")
603
- .alias("tables")
604
- .description("Init a new Appwrite table")
605
- .action(actionRunner(initTable));
715
+ .command("table")
716
+ .alias("tables")
717
+ .description("Init a new Appwrite table")
718
+ .action(actionRunner(initTable));
606
719
 
607
720
  init
608
- .command("topic")
609
- .alias("topics")
610
- .description("Init a new Appwrite topic")
611
- .action(actionRunner(initTopic));
612
-
721
+ .command("topic")
722
+ .alias("topics")
723
+ .description("Init a new Appwrite topic")
724
+ .action(actionRunner(initTopic));