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,130 +1,117 @@
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.questionsCreateSite = exports.questionsRunFunctions = exports.questionsMFAChallenge = exports.questionsListFactors = exports.questionsPushTeams = exports.questionsGetEntrypoint = exports.questionsPushMessagingTopics = exports.questionsPushBuckets = exports.questionPushChangesConfirmation = exports.questionPushChanges = exports.questionsPushTables = exports.questionsPushCollections = exports.questionsPushFunctions = exports.questionsPushSites = exports.questionsInitResources = exports.questionsPushResources = exports.questionsLogout = exports.questionGetEndpoint = exports.questionsLogin = exports.questionsPullCollection = exports.questionsCreateMessagingTopic = exports.questionsCreateTable = exports.questionsCreateCollection = exports.questionsCreateTeam = exports.questionsCreateBucket = exports.questionsCreateFunctionSelectTemplate = exports.questionsCreateFunction = exports.questionsPullSitesCode = exports.questionsPullSites = exports.questionsPullFunctionsCode = exports.questionsPullFunctions = exports.questionsPullResources = exports.questionsInitProjectAutopull = exports.questionsInitProject = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const client_1 = __importDefault(require("./client"));
9
- const config_1 = require("./config");
10
- const projects_1 = require("./commands/projects");
11
- const organizations_1 = require("./commands/organizations");
12
- const teams_1 = require("./commands/teams");
13
- const functions_1 = require("./commands/functions");
14
- const account_1 = require("./commands/account");
15
- const sdks_1 = require("./sdks");
16
- const validations_1 = require("./validations");
17
- const paginate_1 = require("./paginate");
18
- const utils_1 = require("./utils");
19
- const databases_1 = require("./commands/databases");
20
- const json_bigint_1 = __importDefault(require("json-bigint"));
21
- const sites_1 = require("./commands/sites");
22
- const JSONbigConfig = (0, json_bigint_1.default)({ storeAsString: false });
1
+ import chalk from "chalk";
2
+ import { localConfig, globalConfig } from "./config.js";
3
+ import { sdkForConsole } from "./sdks.js";
4
+ import { validateRequired } from "./validations.js";
5
+ import { paginate } from "./paginate.js";
6
+ import { checkDeployConditions, isCloud } from "./utils.js";
7
+ import { Account, Client } from "@appwrite.io/console";
8
+ import { getOrganizationsService, getTeamsService, getProjectsService, getFunctionsService, getSitesService, getDatabasesService, } from "./services.js";
9
+ import { SDK_TITLE, DEFAULT_ENDPOINT, EXECUTABLE_NAME } from "./constants.js";
23
10
  const whenOverride = (answers) => answers.override === undefined ? true : answers.override;
24
11
  const getIgnores = (runtime) => {
25
- const languge = runtime.split("-").slice(0, -1).join("-");
26
- switch (languge) {
27
- case 'cpp':
28
- return ['build', 'CMakeFiles', 'CMakeCaches.txt'];
29
- case 'dart':
30
- return ['.packages', '.dart_tool'];
31
- case 'deno':
12
+ const language = runtime.split("-").slice(0, -1).join("-");
13
+ switch (language) {
14
+ case "cpp":
15
+ return ["build", "CMakeFiles", "CMakeCaches.txt"];
16
+ case "dart":
17
+ return [".packages", ".dart_tool"];
18
+ case "deno":
32
19
  return [];
33
- case 'dotnet':
34
- return ['bin', 'obj', '.nuget'];
35
- case 'java':
36
- case 'kotlin':
37
- return ['build'];
38
- case 'node':
39
- case 'bun':
40
- return ['node_modules', '.npm'];
41
- case 'php':
42
- return ['vendor'];
43
- case 'python':
44
- case 'python-ml':
45
- return ['__pypackages__'];
46
- case 'ruby':
47
- return ['vendor'];
48
- case 'rust':
49
- return ['target', 'debug', '*.rs.bk', '*.pdb'];
50
- case 'swift':
51
- return ['.build', '.swiftpm'];
20
+ case "dotnet":
21
+ return ["bin", "obj", ".nuget"];
22
+ case "java":
23
+ case "kotlin":
24
+ return ["build"];
25
+ case "node":
26
+ case "bun":
27
+ return ["node_modules", ".npm"];
28
+ case "php":
29
+ return ["vendor"];
30
+ case "python":
31
+ case "python-ml":
32
+ return ["__pypackages__"];
33
+ case "ruby":
34
+ return ["vendor"];
35
+ case "rust":
36
+ return ["target", "debug", "*.rs.bk", "*.pdb"];
37
+ case "swift":
38
+ return [".build", ".swiftpm"];
52
39
  }
53
40
  return [];
54
41
  };
55
42
  const getEntrypoint = (runtime) => {
56
- const languge = runtime.split("-").slice(0, -1).join("-");
57
- switch (languge) {
58
- case 'dart':
59
- return 'lib/main.dart';
60
- case 'deno':
61
- return 'src/main.ts';
62
- case 'node':
63
- return 'src/main.js';
64
- case 'bun':
65
- return 'src/main.ts';
66
- case 'php':
67
- return 'src/index.php';
68
- case 'python':
69
- case 'python-ml':
70
- return 'src/main.py';
71
- case 'ruby':
72
- return 'lib/main.rb';
73
- case 'rust':
74
- return 'main.rs';
75
- case 'swift':
76
- return 'Sources/index.swift';
77
- case 'cpp':
78
- return 'src/main.cc';
79
- case 'dotnet':
80
- return 'src/Index.cs';
81
- case 'java':
82
- return 'src/Main.java';
83
- case 'kotlin':
84
- return 'src/Main.kt';
85
- case 'go':
86
- return 'main.go';
43
+ const language = runtime.split("-").slice(0, -1).join("-");
44
+ switch (language) {
45
+ case "dart":
46
+ return "lib/main.dart";
47
+ case "deno":
48
+ return "src/main.ts";
49
+ case "node":
50
+ return "src/main.js";
51
+ case "bun":
52
+ return "src/main.ts";
53
+ case "php":
54
+ return "src/index.php";
55
+ case "python":
56
+ case "python-ml":
57
+ return "src/main.py";
58
+ case "ruby":
59
+ return "lib/main.rb";
60
+ case "rust":
61
+ return "main.rs";
62
+ case "swift":
63
+ return "Sources/index.swift";
64
+ case "cpp":
65
+ return "src/main.cc";
66
+ case "dotnet":
67
+ return "src/Index.cs";
68
+ case "java":
69
+ return "src/Main.java";
70
+ case "kotlin":
71
+ return "src/Main.kt";
72
+ case "go":
73
+ return "main.go";
87
74
  }
88
75
  return undefined;
89
76
  };
90
77
  const getInstallCommand = (runtime) => {
91
- const languge = runtime.split("-").slice(0, -1).join("-");
92
- switch (languge) {
93
- case 'dart':
94
- return 'dart pub get';
95
- case 'deno':
78
+ const language = runtime.split("-").slice(0, -1).join("-");
79
+ switch (language) {
80
+ case "dart":
81
+ return "dart pub get";
82
+ case "deno":
96
83
  return "deno cache src/main.ts";
97
- case 'node':
98
- return 'npm install';
99
- case 'bun':
100
- return 'bun install';
101
- case 'php':
102
- return 'composer install';
103
- case 'python':
104
- case 'python-ml':
105
- return 'pip install -r requirements.txt';
106
- case 'ruby':
107
- return 'bundle install';
108
- case 'rust':
109
- return 'cargo install';
110
- case 'dotnet':
111
- return 'dotnet restore';
112
- case 'swift':
113
- case 'java':
114
- case 'kotlin':
115
- case 'cpp':
116
- return '';
84
+ case "node":
85
+ return "npm install";
86
+ case "bun":
87
+ return "bun install";
88
+ case "php":
89
+ return "composer install";
90
+ case "python":
91
+ case "python-ml":
92
+ return "pip install -r requirements.txt";
93
+ case "ruby":
94
+ return "bundle install";
95
+ case "rust":
96
+ return "cargo install";
97
+ case "dotnet":
98
+ return "dotnet restore";
99
+ case "swift":
100
+ case "java":
101
+ case "kotlin":
102
+ case "cpp":
103
+ return "";
117
104
  }
118
105
  return undefined;
119
106
  };
120
- exports.questionsInitProject = [
107
+ export const questionsInitProject = [
121
108
  {
122
109
  type: "confirm",
123
110
  name: "override",
124
- message: `An Appwrite project ( ${config_1.localConfig.getProject()['projectId']} ) is already associated with the current directory. Would you like to override`,
111
+ message: `An ${SDK_TITLE} project ( ${localConfig.getProject()["projectId"]} ) is already associated with the current directory. Would you like to override it?`,
125
112
  when() {
126
- return Object.keys(config_1.localConfig.getProject()).length !== 0;
127
- }
113
+ return Object.keys(localConfig.getProject()).length !== 0;
114
+ },
128
115
  },
129
116
  {
130
117
  type: "list",
@@ -134,67 +121,71 @@ exports.questionsInitProject = [
134
121
  choices: [
135
122
  {
136
123
  name: "Create new project",
137
- value: "new"
124
+ value: "new",
138
125
  },
139
126
  {
140
127
  name: "Link directory to an existing project",
141
- value: "existing"
142
- }
143
- ]
128
+ value: "existing",
129
+ },
130
+ ],
144
131
  },
145
132
  {
146
133
  type: "search-list",
147
134
  name: "organization",
148
135
  message: "Choose your organization",
149
136
  choices: async () => {
150
- let client = await (0, sdks_1.sdkForConsole)(true);
151
- const { teams } = (0, utils_1.isCloud)()
152
- ? await (0, paginate_1.paginate)(organizations_1.organizationsList, { parseOutput: false, sdk: client }, 100, 'teams')
153
- : await (0, paginate_1.paginate)(teams_1.teamsList, { parseOutput: false, sdk: client }, 100, 'teams');
137
+ let client = await sdkForConsole(true);
138
+ const { teams } = isCloud()
139
+ ? await paginate(async (opts = {}) => (await getOrganizationsService(opts.sdk)).list(), { sdk: client }, 100, "teams")
140
+ : await paginate(async (opts = {}) => (await getTeamsService(opts.sdk)).list(), { parseOutput: false, sdk: client }, 100, "teams");
154
141
  let choices = teams.map((team, idx) => {
155
142
  return {
156
- name: `${team.name} (${team['$id']})`,
157
- value: team['$id']
143
+ name: `${team.name} (${team["$id"]})`,
144
+ value: team["$id"],
158
145
  };
159
146
  });
160
147
  if (choices.length == 0) {
161
- throw new Error(`No organizations found. Please create a new organization at ${config_1.globalConfig.getEndpoint().replace('/v1', '/console/onboarding')}`);
148
+ throw new Error(`No organizations found. Please create a new organization at ${globalConfig.getEndpoint().replace("/v1", "/console/onboarding")}`);
162
149
  }
163
150
  return choices;
164
151
  },
165
- when: whenOverride
152
+ when: whenOverride,
166
153
  },
167
154
  {
168
155
  type: "input",
169
156
  name: "project",
170
157
  message: "What would you like to name your project?",
171
158
  default: "My Awesome Project",
172
- when: (answer) => answer.start !== 'existing'
159
+ when: (answer) => answer.start !== "existing",
173
160
  },
174
161
  {
175
162
  type: "input",
176
163
  name: "id",
177
164
  message: "What ID would you like to have for your project?",
178
165
  default: "unique()",
179
- when: (answer) => answer.start !== 'existing'
166
+ when: (answer) => answer.start !== "existing",
180
167
  },
181
168
  {
182
169
  type: "search-list",
183
170
  name: "project",
184
- message: "Choose your Appwrite project.",
171
+ message: `Choose your ${SDK_TITLE} project.`,
185
172
  choices: async (answers) => {
186
173
  const queries = [
187
- JSON.stringify({ method: 'equal', attribute: 'teamId', values: [answers.organization] }),
188
- JSON.stringify({ method: 'orderDesc', attribute: '$id' })
174
+ JSON.stringify({
175
+ method: "equal",
176
+ attribute: "teamId",
177
+ values: [answers.organization],
178
+ }),
179
+ JSON.stringify({ method: "orderDesc", attribute: "$id" }),
189
180
  ];
190
- const { projects } = await (0, paginate_1.paginate)(projects_1.projectsList, { parseOutput: false }, 100, 'projects', queries);
181
+ const { projects } = await paginate(async () => (await getProjectsService()).list(queries), { parseOutput: false }, 100, "projects", queries);
191
182
  let choices = projects.map((project) => {
192
183
  return {
193
- name: `${project.name} (${project['$id']})`,
184
+ name: `${project.name} (${project["$id"]})`,
194
185
  value: {
195
- "$id": project['$id'],
196
- "region": project.region || ''
197
- }
186
+ $id: project["$id"],
187
+ region: project.region || "",
188
+ },
198
189
  };
199
190
  });
200
191
  if (choices.length === 0) {
@@ -202,139 +193,146 @@ exports.questionsInitProject = [
202
193
  }
203
194
  return choices;
204
195
  },
205
- when: (answer) => answer.start === 'existing'
196
+ when: (answer) => answer.start === "existing",
206
197
  },
207
198
  {
208
199
  type: "list",
209
200
  name: "region",
210
- message: "Select your Appwrite Cloud region",
201
+ message: `Select your ${SDK_TITLE} Cloud region`,
211
202
  choices: async () => {
212
- let client = await (0, sdks_1.sdkForConsole)(true);
213
- let response = await client.call("GET", "/console/regions");
203
+ let client = await sdkForConsole(true);
204
+ const endpoint = globalConfig.getEndpoint() || DEFAULT_ENDPOINT;
205
+ let response = (await client.call("GET", new URL(endpoint + "/console/regions")));
214
206
  let regions = response.regions || [];
215
207
  if (!regions.length) {
216
208
  throw new Error("No regions found. Please check your network or Appwrite Cloud availability.");
217
209
  }
218
- return regions.filter((region) => !region.disabled).map((region) => ({
210
+ return regions
211
+ .filter((region) => !region.disabled)
212
+ .map((region) => ({
219
213
  name: `${region.name} (${region.$id})`,
220
- value: region.$id
214
+ value: region.$id,
221
215
  }));
222
216
  },
223
217
  when: (answer) => {
224
- if (answer.start === 'existing')
218
+ if (answer.start === "existing")
225
219
  return false;
226
- return (0, utils_1.isCloud)();
227
- }
228
- }
220
+ return isCloud();
221
+ },
222
+ },
229
223
  ];
230
- exports.questionsInitProjectAutopull = [
224
+ export const questionsInitProjectAutopull = [
231
225
  {
232
226
  type: "confirm",
233
227
  name: "autopull",
234
- message: `Would you like to pull all resources from project you just linked?`
228
+ message: `Would you like to pull all resources from the project you just linked?`,
235
229
  },
236
230
  ];
237
- exports.questionsPullResources = [
231
+ export const questionsPullResources = [
238
232
  {
239
233
  type: "list",
240
234
  name: "resource",
241
235
  message: "Which resources would you like to pull?",
242
236
  choices: [
243
- { name: `Settings ${chalk_1.default.blackBright(`(Project)`)}`, value: 'settings' },
244
- { name: `Functions ${chalk_1.default.blackBright(`(Deployment)`)}`, value: 'functions' },
245
- { name: `Tables ${chalk_1.default.blackBright(`(TablesDB)`)}`, value: 'tables' },
246
- { name: `Buckets ${chalk_1.default.blackBright(`(Storage)`)}`, value: 'buckets' },
247
- { name: `Teams ${chalk_1.default.blackBright(`(Auth)`)}`, value: 'teams' },
248
- { name: `Topics ${chalk_1.default.blackBright(`(Messaging)`)}`, value: 'messages' },
249
- { name: `Collections ${chalk_1.default.blackBright(`(Legacy Databases)`)}`, value: 'collections' }
250
- ]
251
- }
237
+ { name: `Settings ${chalk.blackBright(`(Project)`)}`, value: "settings" },
238
+ {
239
+ name: `Functions ${chalk.blackBright(`(Deployment)`)}`,
240
+ value: "functions",
241
+ },
242
+ { name: `Tables ${chalk.blackBright(`(TablesDB)`)}`, value: "tables" },
243
+ { name: `Buckets ${chalk.blackBright(`(Storage)`)}`, value: "buckets" },
244
+ { name: `Teams ${chalk.blackBright(`(Auth)`)}`, value: "teams" },
245
+ { name: `Topics ${chalk.blackBright(`(Messaging)`)}`, value: "messages" },
246
+ {
247
+ name: `Collections ${chalk.blackBright(`(Legacy Databases)`)}`,
248
+ value: "collections",
249
+ },
250
+ ],
251
+ },
252
252
  ];
253
- exports.questionsPullFunctions = [
253
+ export const questionsPullFunctions = [
254
254
  {
255
255
  type: "checkbox",
256
256
  name: "functions",
257
257
  message: "Which functions would you like to pull?",
258
- validate: (value) => (0, validations_1.validateRequired)('function', value),
258
+ validate: (value) => validateRequired("function", value),
259
259
  choices: async () => {
260
- const { functions } = await (0, paginate_1.paginate)(functions_1.functionsList, { parseOutput: false }, 100, 'functions');
260
+ const { functions } = await paginate(async () => (await getFunctionsService()).list(), { parseOutput: false }, 100, "functions");
261
261
  if (functions.length === 0) {
262
- throw "We couldn't find any functions in your Appwrite project";
262
+ throw `We couldn't find any functions in your ${SDK_TITLE} project`;
263
263
  }
264
264
  return functions.map((func) => {
265
265
  return {
266
266
  name: `${func.name} (${func.$id})`,
267
- value: { ...func }
267
+ value: { ...func },
268
268
  };
269
269
  });
270
- }
271
- }
270
+ },
271
+ },
272
272
  ];
273
- exports.questionsPullFunctionsCode = [
273
+ export const questionsPullFunctionsCode = [
274
274
  {
275
275
  type: "confirm",
276
276
  name: "override",
277
- message: "Do you want to pull source code of the latest deployment?"
277
+ message: "Do you want to pull source code of the latest deployment?",
278
278
  },
279
279
  ];
280
- exports.questionsPullSites = [
280
+ export const questionsPullSites = [
281
281
  {
282
282
  type: "checkbox",
283
283
  name: "sites",
284
284
  message: "Which sites would you like to pull?",
285
- validate: (value) => (0, validations_1.validateRequired)('site', value),
285
+ validate: (value) => validateRequired("site", value),
286
286
  choices: async () => {
287
- const { sites } = await (0, paginate_1.paginate)(sites_1.sitesList, { parseOutput: false }, 100, 'sites');
287
+ const { sites } = await paginate(async () => (await getSitesService()).list(), { parseOutput: false }, 100, "sites");
288
288
  if (sites.length === 0) {
289
- throw "We couldn't find any sites in your Appwrite project";
289
+ throw `We couldn't find any sites in your ${SDK_TITLE} project`;
290
290
  }
291
291
  return sites.map((site) => {
292
292
  return {
293
293
  name: `${site.name} (${site.$id})`,
294
- value: { ...site }
294
+ value: { ...site },
295
295
  };
296
296
  });
297
- }
298
- }
297
+ },
298
+ },
299
299
  ];
300
- exports.questionsPullSitesCode = [
300
+ export const questionsPullSitesCode = [
301
301
  {
302
302
  type: "confirm",
303
303
  name: "override",
304
- message: "Do you want to pull source code of the latest deployment?"
304
+ message: "Do you want to pull source code of the latest deployment?",
305
305
  },
306
306
  ];
307
- exports.questionsCreateFunction = [
307
+ export const questionsCreateFunction = [
308
308
  {
309
309
  type: "input",
310
310
  name: "name",
311
311
  message: "What would you like to name your function?",
312
- default: "My Awesome Function"
312
+ default: "My Awesome Function",
313
313
  },
314
314
  {
315
315
  type: "input",
316
316
  name: "id",
317
317
  message: "What ID would you like to have for your function?",
318
- default: "unique()"
318
+ default: "unique()",
319
319
  },
320
320
  {
321
321
  type: "list",
322
322
  name: "runtime",
323
323
  message: "What runtime would you like to use?",
324
324
  choices: async () => {
325
- let response = await (0, functions_1.functionsListRuntimes)({
326
- parseOutput: false
327
- });
325
+ let response = await (await getFunctionsService()).listRuntimes();
328
326
  let runtimes = response["runtimes"];
329
327
  let choices = runtimes.map((runtime, idx) => {
330
328
  return {
331
- name: `${runtime.name} (${runtime['$id']})`,
329
+ name: `${runtime.name} (${runtime["$id"]})`,
332
330
  value: {
333
- id: runtime['$id'],
334
- name: runtime['$id'].split('-')[0],
335
- entrypoint: getEntrypoint(runtime['$id']),
336
- ignore: getIgnores(runtime['$id']),
337
- commands: getInstallCommand(runtime['$id'])
331
+ id: runtime["$id"],
332
+ name: runtime["$id"].split("-")[0],
333
+ entrypoint: getEntrypoint(runtime["$id"]),
334
+ ignore: getIgnores(runtime["$id"]),
335
+ commands: getInstallCommand(runtime["$id"]),
338
336
  },
339
337
  };
340
338
  });
@@ -346,89 +344,86 @@ exports.questionsCreateFunction = [
346
344
  name: "specification",
347
345
  message: "What specification would you like to use?",
348
346
  choices: async () => {
349
- let response = await (0, functions_1.functionsListSpecifications)({
350
- parseOutput: false
351
- });
347
+ let response = await (await getFunctionsService()).listSpecifications();
352
348
  let specifications = response["specifications"];
353
349
  let choices = specifications.map((spec, idx) => {
354
350
  return {
355
351
  name: `${spec.cpus} CPU, ${spec.memory}MB RAM`,
356
352
  value: spec.slug,
357
- disabled: spec.enabled === false ? 'Upgrade to use' : false
353
+ disabled: spec.enabled === false ? "Upgrade to use" : false,
358
354
  };
359
355
  });
360
356
  return choices;
361
357
  },
362
- }
358
+ },
363
359
  ];
364
- const questionsCreateFunctionSelectTemplate = (templates) => {
360
+ export const questionsCreateFunctionSelectTemplate = (templates) => {
365
361
  return [
366
362
  {
367
363
  type: "search-list",
368
364
  name: "template",
369
365
  message: "What template would you like to use?",
370
366
  choices: templates.map((template) => {
371
- const name = `${template[0].toUpperCase()}${template.split('').slice(1).join('')}`.replace(/[-_]/g, ' ');
367
+ const name = `${template[0].toUpperCase()}${template.split("").slice(1).join("")}`.replace(/[-_]/g, " ");
372
368
  return { value: template, name };
373
- })
374
- }
369
+ }),
370
+ },
375
371
  ];
376
372
  };
377
- exports.questionsCreateFunctionSelectTemplate = questionsCreateFunctionSelectTemplate;
378
- exports.questionsCreateBucket = [
373
+ export const questionsCreateBucket = [
379
374
  {
380
375
  type: "input",
381
376
  name: "bucket",
382
377
  message: "What would you like to name your bucket?",
383
- default: "My Awesome Bucket"
378
+ default: "My Awesome Bucket",
384
379
  },
385
380
  {
386
381
  type: "input",
387
382
  name: "id",
388
383
  message: "What ID would you like to have for your bucket?",
389
- default: "unique()"
384
+ default: "unique()",
390
385
  },
391
386
  {
392
387
  type: "list",
393
388
  name: "fileSecurity",
394
389
  message: "Enable File-Security configuring permissions for individual file",
395
- choices: ["No", "Yes"]
396
- }
390
+ choices: ["No", "Yes"],
391
+ },
397
392
  ];
398
- exports.questionsCreateTeam = [
393
+ export const questionsCreateTeam = [
399
394
  {
400
395
  type: "input",
401
- name: "bucket",
396
+ name: "team",
402
397
  message: "What would you like to name your team?",
403
- default: "My Awesome Team"
398
+ default: "My Awesome Team",
404
399
  },
405
400
  {
406
401
  type: "input",
407
402
  name: "id",
408
403
  message: "What ID would you like to have for your team?",
409
- default: "unique()"
410
- }
404
+ default: "unique()",
405
+ },
411
406
  ];
412
- exports.questionsCreateCollection = [
407
+ export const questionsCreateCollection = [
413
408
  {
414
409
  type: "list",
415
410
  name: "method",
416
411
  message: "What database would you like to use for your collection",
417
412
  choices: ["New", "Existing"],
418
413
  when: async () => {
419
- return config_1.localConfig.getDatabases().length !== 0;
420
- }
414
+ return localConfig.getDatabases().length !== 0;
415
+ },
421
416
  },
422
417
  {
423
418
  type: "search-list",
424
419
  name: "database",
425
420
  message: "Choose the collection database",
426
421
  choices: async () => {
427
- const databases = config_1.localConfig.getDatabases();
422
+ const databases = localConfig.getDatabases();
428
423
  let choices = databases.map((database, idx) => {
429
424
  return {
430
425
  name: `${database.name} (${database.$id})`,
431
- value: database.$id
426
+ value: database.$id,
432
427
  };
433
428
  });
434
429
  if (choices.length === 0) {
@@ -436,61 +431,61 @@ exports.questionsCreateCollection = [
436
431
  }
437
432
  return choices;
438
433
  },
439
- when: (answers) => (answers.method ?? '').toLowerCase() === 'existing'
434
+ when: (answers) => (answers.method ?? "").toLowerCase() === "existing",
440
435
  },
441
436
  {
442
437
  type: "input",
443
438
  name: "databaseName",
444
439
  message: "What would you like to name your database?",
445
440
  default: "My Awesome Database",
446
- when: (answers) => (answers.method ?? '').toLowerCase() !== 'existing'
441
+ when: (answers) => (answers.method ?? "").toLowerCase() !== "existing",
447
442
  },
448
443
  {
449
444
  type: "input",
450
445
  name: "databaseId",
451
446
  message: "What ID would you like to have for your database?",
452
447
  default: "unique()",
453
- when: (answers) => (answers.method ?? '').toLowerCase() !== 'existing'
448
+ when: (answers) => (answers.method ?? "").toLowerCase() !== "existing",
454
449
  },
455
450
  {
456
451
  type: "input",
457
452
  name: "collection",
458
453
  message: "What would you like to name your collection?",
459
- default: "My Awesome Collection"
454
+ default: "My Awesome Collection",
460
455
  },
461
456
  {
462
457
  type: "input",
463
458
  name: "id",
464
459
  message: "What ID would you like to have for your collection?",
465
- default: "unique()"
460
+ default: "unique()",
466
461
  },
467
462
  {
468
463
  type: "list",
469
464
  name: "documentSecurity",
470
465
  message: "Enable document security for configuring permissions for individual documents",
471
- choices: ["No", "Yes"]
472
- }
466
+ choices: ["No", "Yes"],
467
+ },
473
468
  ];
474
- exports.questionsCreateTable = [
469
+ export const questionsCreateTable = [
475
470
  {
476
471
  type: "list",
477
472
  name: "method",
478
473
  message: "What database would you like to use for your table?",
479
474
  choices: ["New", "Existing"],
480
475
  when: async () => {
481
- return config_1.localConfig.getTablesDBs().length !== 0;
482
- }
476
+ return localConfig.getTablesDBs().length !== 0;
477
+ },
483
478
  },
484
479
  {
485
480
  type: "search-list",
486
481
  name: "database",
487
482
  message: "Choose the table database",
488
483
  choices: async () => {
489
- const databases = config_1.localConfig.getTablesDBs();
484
+ const databases = localConfig.getTablesDBs();
490
485
  let choices = databases.map((database, idx) => {
491
486
  return {
492
487
  name: `${database.name} (${database.$id})`,
493
- value: database.$id
488
+ value: database.$id,
494
489
  };
495
490
  });
496
491
  if (choices.length === 0) {
@@ -498,65 +493,63 @@ exports.questionsCreateTable = [
498
493
  }
499
494
  return choices;
500
495
  },
501
- when: (answers) => (answers.method ?? '').toLowerCase() === 'existing'
496
+ when: (answers) => (answers.method ?? "").toLowerCase() === "existing",
502
497
  },
503
498
  {
504
499
  type: "input",
505
500
  name: "databaseName",
506
501
  message: "What would you like to name your database?",
507
502
  default: "My Awesome Database",
508
- when: (answers) => (answers.method ?? '').toLowerCase() !== 'existing'
503
+ when: (answers) => (answers.method ?? "").toLowerCase() !== "existing",
509
504
  },
510
505
  {
511
506
  type: "input",
512
507
  name: "databaseId",
513
508
  message: "What ID would you like to have for your database?",
514
509
  default: "unique()",
515
- when: (answers) => (answers.method ?? '').toLowerCase() !== 'existing'
510
+ when: (answers) => (answers.method ?? "").toLowerCase() !== "existing",
516
511
  },
517
512
  {
518
513
  type: "input",
519
514
  name: "table",
520
515
  message: "What would you like to name your table?",
521
- default: "My Awesome Table"
516
+ default: "My Awesome Table",
522
517
  },
523
518
  {
524
519
  type: "input",
525
520
  name: "id",
526
521
  message: "What ID would you like to have for your table?",
527
- default: "unique()"
522
+ default: "unique()",
528
523
  },
529
524
  {
530
525
  type: "list",
531
526
  name: "rowSecurity",
532
527
  message: "Enable row security for configuring permissions for individual rows",
533
- choices: ["No", "Yes"]
534
- }
528
+ choices: ["No", "Yes"],
529
+ },
535
530
  ];
536
- exports.questionsCreateMessagingTopic = [
531
+ export const questionsCreateMessagingTopic = [
537
532
  {
538
533
  type: "input",
539
534
  name: "topic",
540
535
  message: "What would you like to name your messaging topic?",
541
- default: "My Awesome Topic"
536
+ default: "My Awesome Topic",
542
537
  },
543
538
  {
544
539
  type: "input",
545
540
  name: "id",
546
541
  message: "What ID would you like to have for your messaging topic?",
547
- default: "unique()"
548
- }
542
+ default: "unique()",
543
+ },
549
544
  ];
550
- exports.questionsPullCollection = [
545
+ export const questionsPullCollection = [
551
546
  {
552
547
  type: "checkbox",
553
548
  name: "databases",
554
549
  message: "From which database would you like to pull collections?",
555
- validate: (value) => (0, validations_1.validateRequired)('collection', value),
550
+ validate: (value) => validateRequired("collection", value),
556
551
  choices: async () => {
557
- let response = await (0, databases_1.databasesList)({
558
- parseOutput: false
559
- });
552
+ let response = await (await getDatabasesService()).list();
560
553
  let databases = response["databases"];
561
554
  if (databases.length <= 0) {
562
555
  throw new Error("No databases found. Please create one in project console.");
@@ -564,23 +557,23 @@ exports.questionsPullCollection = [
564
557
  let choices = databases.map((database, idx) => {
565
558
  return {
566
559
  name: `${database.name} (${database.$id})`,
567
- value: database.$id
560
+ value: database.$id,
568
561
  };
569
562
  });
570
563
  return choices;
571
- }
572
- }
564
+ },
565
+ },
573
566
  ];
574
- exports.questionsLogin = [
567
+ export const questionsLogin = [
575
568
  {
576
569
  type: "list",
577
570
  name: "method",
578
- message: "What you like to do?",
571
+ message: "What would you like to do?",
579
572
  choices: [
580
- { name: 'Login to an account', value: 'login' },
581
- { name: 'Switch to an account', value: 'select' }
573
+ { name: "Login to an account", value: "login" },
574
+ { name: "Switch to an account", value: "select" },
582
575
  ],
583
- when: () => config_1.globalConfig.getSessions().length >= 2
576
+ when: () => globalConfig.getSessions().length >= 2,
584
577
  },
585
578
  {
586
579
  type: "input",
@@ -592,7 +585,7 @@ exports.questionsLogin = [
592
585
  }
593
586
  return true;
594
587
  },
595
- when: (answers) => answers.method !== 'select'
588
+ when: (answers) => answers.method !== "select",
596
589
  },
597
590
  {
598
591
  type: "password",
@@ -605,44 +598,46 @@ exports.questionsLogin = [
605
598
  }
606
599
  return true;
607
600
  },
608
- when: (answers) => answers.method !== 'select'
601
+ when: (answers) => answers.method !== "select",
609
602
  },
610
603
  {
611
604
  type: "search-list",
612
605
  name: "accountId",
613
606
  message: "Select an account to use",
614
607
  choices() {
615
- const sessions = config_1.globalConfig.getSessions();
616
- const current = config_1.globalConfig.getCurrentSession();
608
+ const sessions = globalConfig.getSessions();
609
+ const current = globalConfig.getCurrentSession();
617
610
  const data = [];
618
- const longestEmail = sessions.reduce((prev, current) => (prev && (prev.email ?? '').length > (current.email ?? '').length) ? prev : current).email.length;
611
+ const longestEmail = sessions.reduce((prev, current) => prev && (prev.email ?? "").length > (current.email ?? "").length
612
+ ? prev
613
+ : current).email.length;
619
614
  sessions.forEach((session) => {
620
615
  if (session.email) {
621
616
  data.push({
622
617
  current: current === session.id,
623
618
  value: session.id,
624
- name: `${session.email.padEnd(longestEmail)} ${current === session.id ? chalk_1.default.green.bold('current') : ' '.repeat(6)} ${session.endpoint}`,
619
+ name: `${session.email.padEnd(longestEmail)} ${current === session.id ? chalk.green.bold("current") : " ".repeat(6)} ${session.endpoint}`,
625
620
  });
626
621
  }
627
622
  });
628
623
  return data.sort((a, b) => Number(b.current) - Number(a.current));
629
624
  },
630
- when: (answers) => answers.method === 'select'
625
+ when: (answers) => answers.method === "select",
631
626
  },
632
627
  ];
633
- exports.questionGetEndpoint = [
628
+ export const questionGetEndpoint = [
634
629
  {
635
630
  type: "input",
636
631
  name: "endpoint",
637
- message: "Enter the endpoint of your Appwrite server",
632
+ message: `Enter the endpoint of your ${SDK_TITLE} server`,
638
633
  default: "http://localhost/v1",
639
634
  async validate(value) {
640
635
  if (!value) {
641
636
  return "Please enter a valid endpoint.";
642
637
  }
643
- let client = new client_1.default().setEndpoint(value);
638
+ let client = new Client().setEndpoint(value);
644
639
  try {
645
- let response = await client.call('get', '/health/version');
640
+ let response = (await client.call("get", new URL(value + "/health/version")));
646
641
  if (response.version) {
647
642
  return true;
648
643
  }
@@ -653,261 +648,266 @@ exports.questionGetEndpoint = [
653
648
  catch (error) {
654
649
  return "Invalid endpoint or your Appwrite server is not running as expected.";
655
650
  }
656
- }
657
- }
651
+ },
652
+ },
658
653
  ];
659
- exports.questionsLogout = [
654
+ export const questionsLogout = [
660
655
  {
661
656
  type: "checkbox",
662
657
  name: "accounts",
663
658
  message: "Select accounts to logout from",
664
- validate: (value) => (0, validations_1.validateRequired)('account', value),
659
+ validate: (value) => validateRequired("account", value),
665
660
  choices() {
666
- const sessions = config_1.globalConfig.getSessions();
667
- const current = config_1.globalConfig.getCurrentSession();
661
+ const sessions = globalConfig.getSessions();
662
+ const current = globalConfig.getCurrentSession();
668
663
  const data = [];
669
- const longestEmail = sessions.reduce((prev, current) => (prev && (prev.email ?? '').length > (current.email ?? '').length) ? prev : current).email.length;
664
+ const longestEmail = sessions.reduce((prev, current) => prev && (prev.email ?? "").length > (current.email ?? "").length
665
+ ? prev
666
+ : current).email.length;
670
667
  sessions.forEach((session) => {
671
668
  if (session.email) {
672
669
  data.push({
673
670
  current: current === session.id,
674
671
  value: session.id,
675
- name: `${session.email.padEnd(longestEmail)} ${current === session.id ? chalk_1.default.green.bold('current') : ' '.repeat(6)} ${session.endpoint}`,
672
+ name: `${session.email.padEnd(longestEmail)} ${current === session.id ? chalk.green.bold("current") : " ".repeat(6)} ${session.endpoint}`,
676
673
  });
677
674
  }
678
675
  });
679
676
  return data.sort((a, b) => Number(b.current) - Number(a.current));
680
- }
681
- }
677
+ },
678
+ },
682
679
  ];
683
- exports.questionsPushResources = [
680
+ export const questionsPushResources = [
684
681
  {
685
682
  type: "list",
686
683
  name: "resource",
687
684
  message: "Which resources would you like to push?",
688
685
  choices: [
689
- { name: `Settings ${chalk_1.default.blackBright(`(Project)`)}`, value: 'settings' },
690
- { name: `Functions ${chalk_1.default.blackBright(`(Deployment)`)}`, value: 'functions' },
691
- { name: `Tables ${chalk_1.default.blackBright(`(TablesDB)`)}`, value: 'tables' },
692
- { name: `Buckets ${chalk_1.default.blackBright(`(Storage)`)}`, value: 'buckets' },
693
- { name: `Teams ${chalk_1.default.blackBright(`(Auth)`)}`, value: 'teams' },
694
- { name: `Topics ${chalk_1.default.blackBright(`(Messaging)`)}`, value: 'messages' },
695
- { name: `Collections ${chalk_1.default.blackBright(`(Legacy Databases)`)}`, value: 'collections' }
696
- ]
697
- }
686
+ { name: `Settings ${chalk.blackBright(`(Project)`)}`, value: "settings" },
687
+ {
688
+ name: `Functions ${chalk.blackBright(`(Deployment)`)}`,
689
+ value: "functions",
690
+ },
691
+ { name: `Tables ${chalk.blackBright(`(TablesDB)`)}`, value: "tables" },
692
+ { name: `Buckets ${chalk.blackBright(`(Storage)`)}`, value: "buckets" },
693
+ { name: `Teams ${chalk.blackBright(`(Auth)`)}`, value: "teams" },
694
+ { name: `Topics ${chalk.blackBright(`(Messaging)`)}`, value: "messages" },
695
+ {
696
+ name: `Collections ${chalk.blackBright(`(Legacy Databases)`)}`,
697
+ value: "collections",
698
+ },
699
+ ],
700
+ },
698
701
  ];
699
- exports.questionsInitResources = [
702
+ export const questionsInitResources = [
700
703
  {
701
704
  type: "list",
702
705
  name: "resource",
703
706
  message: "Which resource would you create?",
704
707
  choices: [
705
- { name: 'Function', value: 'function' },
706
- { name: 'Site', value: 'site' },
707
- { name: 'Table', value: 'table' },
708
- { name: 'Bucket', value: 'bucket' },
709
- { name: 'Team', value: 'team' },
710
- { name: 'Topic', value: 'message' },
711
- { name: 'Collection', value: 'collection' }
712
- ]
713
- }
708
+ { name: "Function", value: "function" },
709
+ { name: "Site", value: "site" },
710
+ { name: "Table", value: "table" },
711
+ { name: "Bucket", value: "bucket" },
712
+ { name: "Team", value: "team" },
713
+ { name: "Topic", value: "message" },
714
+ { name: "Collection", value: "collection" },
715
+ ],
716
+ },
714
717
  ];
715
- exports.questionsPushSites = [
718
+ export const questionsPushSites = [
716
719
  {
717
720
  type: "checkbox",
718
721
  name: "sites",
719
722
  message: "Which sites would you like to push?",
720
- validate: (value) => (0, validations_1.validateRequired)('site', value),
721
- when: () => config_1.localConfig.getSites().length > 0,
723
+ validate: (value) => validateRequired("site", value),
724
+ when: () => localConfig.getSites().length > 0,
722
725
  choices: () => {
723
- let sites = config_1.localConfig.getSites();
724
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
726
+ let sites = localConfig.getSites();
727
+ checkDeployConditions(localConfig);
725
728
  let choices = sites.map((site, idx) => {
726
729
  return {
727
730
  name: `${site.name} (${site.$id})`,
728
- value: site.$id
731
+ value: site.$id,
729
732
  };
730
733
  });
731
734
  return choices;
732
- }
735
+ },
733
736
  },
734
737
  ];
735
- exports.questionsPushFunctions = [
738
+ export const questionsPushFunctions = [
736
739
  {
737
740
  type: "checkbox",
738
741
  name: "functions",
739
742
  message: "Which functions would you like to push?",
740
- validate: (value) => (0, validations_1.validateRequired)('function', value),
741
- when: () => config_1.localConfig.getFunctions().length > 0,
743
+ validate: (value) => validateRequired("function", value),
744
+ when: () => localConfig.getFunctions().length > 0,
742
745
  choices: () => {
743
- let functions = config_1.localConfig.getFunctions();
744
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
746
+ let functions = localConfig.getFunctions();
747
+ checkDeployConditions(localConfig);
745
748
  let choices = functions.map((func, idx) => {
746
749
  return {
747
750
  name: `${func.name} (${func.$id})`,
748
- value: func.$id
751
+ value: func.$id,
749
752
  };
750
753
  });
751
754
  return choices;
752
- }
755
+ },
753
756
  },
754
757
  ];
755
- exports.questionsPushCollections = [
758
+ export const questionsPushCollections = [
756
759
  {
757
760
  type: "checkbox",
758
761
  name: "collections",
759
762
  message: "Which collections would you like to push?",
760
- validate: (value) => (0, validations_1.validateRequired)('collection', value),
761
- when: () => config_1.localConfig.getCollections().length > 0,
763
+ validate: (value) => validateRequired("collection", value),
764
+ when: () => localConfig.getCollections().length > 0,
762
765
  choices: () => {
763
- let collections = config_1.localConfig.getCollections();
764
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
766
+ let collections = localConfig.getCollections();
767
+ checkDeployConditions(localConfig);
765
768
  return collections.map((collection) => {
766
769
  return {
767
- name: `${collection.name} (${collection['databaseId']} - ${collection['$id']})`,
768
- value: `${collection['databaseId']}|${collection['$id']}`
770
+ name: `${collection.name} (${collection["databaseId"]} - ${collection["$id"]})`,
771
+ value: `${collection["databaseId"]}|${collection["$id"]}`,
769
772
  };
770
773
  });
771
- }
772
- }
774
+ },
775
+ },
773
776
  ];
774
- exports.questionsPushTables = [
777
+ export const questionsPushTables = [
775
778
  {
776
779
  type: "checkbox",
777
780
  name: "tables",
778
781
  message: "Which tables would you like to push?",
779
- validate: (value) => (0, validations_1.validateRequired)('table', value),
780
- when: () => config_1.localConfig.getTables().length > 0,
782
+ validate: (value) => validateRequired("table", value),
783
+ when: () => localConfig.getTables().length > 0,
781
784
  choices: () => {
782
- let tables = config_1.localConfig.getTables();
783
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
785
+ let tables = localConfig.getTables();
786
+ checkDeployConditions(localConfig);
784
787
  return tables.map((table) => {
785
788
  return {
786
- name: `${table.name} (${table['databaseId']} - ${table['$id']})`,
787
- value: `${table['databaseId']}|${table['$id']}`
789
+ name: `${table.name} (${table["databaseId"]} - ${table["$id"]})`,
790
+ value: `${table["databaseId"]}|${table["$id"]}`,
788
791
  };
789
792
  });
790
- }
791
- }
793
+ },
794
+ },
792
795
  ];
793
- exports.questionPushChanges = [
796
+ export const questionPushChanges = [
794
797
  {
795
798
  type: "input",
796
799
  name: "changes",
797
- message: `Are you sure you want to apply these changes? (YES/NO)`
798
- }
800
+ message: `Are you sure you want to apply these changes? (YES/NO)`,
801
+ },
799
802
  ];
800
- exports.questionPushChangesConfirmation = [
803
+ export const questionPushChangesConfirmation = [
801
804
  {
802
805
  type: "input",
803
806
  name: "changes",
804
- message: `Please type 'YES' or 'NO':`
805
- }
807
+ message: `Please type 'YES' or 'NO':`,
808
+ },
806
809
  ];
807
- exports.questionsPushBuckets = [
810
+ export const questionsPushBuckets = [
808
811
  {
809
812
  type: "checkbox",
810
813
  name: "buckets",
811
814
  message: "Which buckets would you like to push?",
812
- validate: (value) => (0, validations_1.validateRequired)('bucket', value),
813
- when: () => config_1.localConfig.getBuckets().length > 0,
815
+ validate: (value) => validateRequired("bucket", value),
816
+ when: () => localConfig.getBuckets().length > 0,
814
817
  choices: () => {
815
- let buckets = config_1.localConfig.getBuckets();
816
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
818
+ let buckets = localConfig.getBuckets();
819
+ checkDeployConditions(localConfig);
817
820
  return buckets.map((bucket) => {
818
821
  return {
819
- name: `${bucket.name} (${bucket['$id']})`,
820
- value: bucket.$id
822
+ name: `${bucket.name} (${bucket["$id"]})`,
823
+ value: bucket.$id,
821
824
  };
822
825
  });
823
- }
824
- }
826
+ },
827
+ },
825
828
  ];
826
- exports.questionsPushMessagingTopics = [
829
+ export const questionsPushMessagingTopics = [
827
830
  {
828
831
  type: "checkbox",
829
832
  name: "topics",
830
833
  message: "Which messaging topic would you like to push?",
831
- validate: (value) => (0, validations_1.validateRequired)('topics', value),
832
- when: () => config_1.localConfig.getMessagingTopics().length > 0,
834
+ validate: (value) => validateRequired("topics", value),
835
+ when: () => localConfig.getMessagingTopics().length > 0,
833
836
  choices: () => {
834
- let topics = config_1.localConfig.getMessagingTopics();
837
+ let topics = localConfig.getMessagingTopics();
835
838
  return topics.map((topic) => {
836
839
  return {
837
- name: `${topic.name} (${topic['$id']})`,
838
- value: topic.$id
840
+ name: `${topic.name} (${topic["$id"]})`,
841
+ value: topic.$id,
839
842
  };
840
843
  });
841
- }
842
- }
844
+ },
845
+ },
843
846
  ];
844
- exports.questionsGetEntrypoint = [
847
+ export const questionsGetEntrypoint = [
845
848
  {
846
849
  type: "input",
847
850
  name: "entrypoint",
848
851
  message: "Enter the entrypoint",
849
- default: null,
850
852
  validate(value) {
851
853
  if (!value) {
852
854
  return "Please enter your entrypoint";
853
855
  }
854
856
  return true;
855
- }
857
+ },
856
858
  },
857
859
  ];
858
- exports.questionsPushTeams = [
860
+ export const questionsPushTeams = [
859
861
  {
860
862
  type: "checkbox",
861
863
  name: "teams",
862
864
  message: "Which teams would you like to push?",
863
- validate: (value) => (0, validations_1.validateRequired)('team', value),
864
- when: () => config_1.localConfig.getTeams().length > 0,
865
+ validate: (value) => validateRequired("team", value),
866
+ when: () => localConfig.getTeams().length > 0,
865
867
  choices: () => {
866
- let teams = config_1.localConfig.getTeams();
867
- (0, utils_1.checkDeployConditions)(config_1.localConfig);
868
+ let teams = localConfig.getTeams();
869
+ checkDeployConditions(localConfig);
868
870
  return teams.map((team) => {
869
871
  return {
870
- name: `${team.name} (${team['$id']})`,
871
- value: team.$id
872
+ name: `${team.name} (${team["$id"]})`,
873
+ value: team.$id,
872
874
  };
873
875
  });
874
- }
876
+ },
875
877
  },
876
878
  ];
877
- exports.questionsListFactors = [
879
+ export const questionsListFactors = [
878
880
  {
879
881
  type: "list",
880
882
  name: "factor",
881
883
  message: "Your account is protected by multi-factor authentication. Please choose one for verification.",
882
884
  choices: async () => {
883
- let client = await (0, sdks_1.sdkForConsole)(false);
884
- const factors = await (0, account_1.accountListMFAFactors)({
885
- sdk: client,
886
- parseOutput: false
887
- });
885
+ let client = await sdkForConsole(false);
886
+ const accountClient = new Account(client);
887
+ const factors = await accountClient.listMfaFactors();
888
888
  const choices = [
889
889
  {
890
890
  name: `Authenticator app (Get a code from a third-party authenticator app)`,
891
- value: 'totp'
891
+ value: "totp",
892
892
  },
893
893
  {
894
- name: `Email (Get a security code at your Appwrite email address)`,
895
- value: 'email'
894
+ name: `Email (Get a security code at your ${SDK_TITLE} email address)`,
895
+ value: "email",
896
896
  },
897
897
  {
898
- name: `SMS (Get a security code on your Appwrite phone number)`,
899
- value: 'phone'
898
+ name: `SMS (Get a security code on your ${SDK_TITLE} phone number)`,
899
+ value: "phone",
900
900
  },
901
901
  {
902
902
  name: `Recovery code (Use one of your recovery codes for verification)`,
903
- value: 'recoveryCode'
904
- }
903
+ value: "recoveryCode",
904
+ },
905
905
  ].filter((ch) => factors[ch.value] === true);
906
906
  return choices;
907
- }
908
- }
907
+ },
908
+ },
909
909
  ];
910
- exports.questionsMFAChallenge = [
910
+ export const questionsMFAChallenge = [
911
911
  {
912
912
  type: "input",
913
913
  name: "otp",
@@ -918,50 +918,48 @@ exports.questionsMFAChallenge = [
918
918
  }
919
919
  return true;
920
920
  },
921
- }
921
+ },
922
922
  ];
923
- exports.questionsRunFunctions = [
923
+ export const questionsRunFunctions = [
924
924
  {
925
925
  type: "list",
926
926
  name: "function",
927
927
  message: "Which function would you like to develop locally?",
928
- validate: (value) => (0, validations_1.validateRequired)('function', value),
928
+ validate: (value) => validateRequired("function", value),
929
929
  choices: () => {
930
- let functions = config_1.localConfig.getFunctions();
930
+ let functions = localConfig.getFunctions();
931
931
  if (functions.length === 0) {
932
- throw new Error("No functions found. Use 'appwrite pull functions' to synchronize existing one, or use 'appwrite init function' to create a new one.");
932
+ throw new Error(`No functions found. Use '${EXECUTABLE_NAME} pull functions' to synchronize existing one, or use '${EXECUTABLE_NAME} init function' to create a new one.`);
933
933
  }
934
934
  let choices = functions.map((func, idx) => {
935
935
  return {
936
936
  name: `${func.name} (${func.$id})`,
937
- value: func.$id
937
+ value: func.$id,
938
938
  };
939
939
  });
940
940
  return choices;
941
- }
942
- }
941
+ },
942
+ },
943
943
  ];
944
- exports.questionsCreateSite = [
944
+ export const questionsCreateSite = [
945
945
  {
946
946
  type: "input",
947
947
  name: "name",
948
948
  message: "What would you like to name your site?",
949
- default: "My Awesome Site"
949
+ default: "My Awesome Site",
950
950
  },
951
951
  {
952
952
  type: "input",
953
953
  name: "id",
954
954
  message: "What ID would you like to have for your site?",
955
- default: "unique()"
955
+ default: "unique()",
956
956
  },
957
957
  {
958
958
  type: "list",
959
959
  name: "framework",
960
960
  message: "What framework would you like to use?",
961
961
  choices: async () => {
962
- let response = await (0, sites_1.sitesListFrameworks)({
963
- parseOutput: false
964
- });
962
+ let response = await (await getSitesService()).listFrameworks();
965
963
  let frameworks = response["frameworks"];
966
964
  let choices = frameworks.map((framework) => {
967
965
  return {
@@ -977,19 +975,17 @@ exports.questionsCreateSite = [
977
975
  name: "specification",
978
976
  message: "What specification would you like to use?",
979
977
  choices: async () => {
980
- let response = await (0, sites_1.sitesListSpecifications)({
981
- parseOutput: false
982
- });
978
+ let response = await (await getSitesService()).listSpecifications();
983
979
  let specifications = response["specifications"];
984
980
  let choices = specifications.map((spec) => {
985
981
  return {
986
982
  name: `${spec.cpus} CPU, ${spec.memory}MB RAM`,
987
983
  value: spec.slug,
988
- disabled: spec.enabled === false ? 'Upgrade to use' : false
984
+ disabled: spec.enabled === false ? "Upgrade to use" : false,
989
985
  };
990
986
  });
991
987
  return choices;
992
988
  },
993
- }
989
+ },
994
990
  ];
995
991
  //# sourceMappingURL=questions.js.map