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
@@ -0,0 +1,1052 @@
1
+ import { Command } from "commander";
2
+ import { sdkForProject } from "../../sdks.js";
3
+ import {
4
+ actionRunner,
5
+ commandDescriptions,
6
+ success,
7
+ parse,
8
+ parseBool,
9
+ parseInteger,
10
+ } from "../../parser.js";
11
+ import {
12
+ Messaging,
13
+ MessagePriority,
14
+ SmtpEncryption,
15
+ } from "@appwrite.io/console";
16
+
17
+ let messagingClient: Messaging | null = null;
18
+
19
+ const getMessagingClient = async (): Promise<Messaging> => {
20
+ if (!messagingClient) {
21
+ const sdkClient = await sdkForProject();
22
+ messagingClient = new Messaging(sdkClient);
23
+ }
24
+ return messagingClient;
25
+ };
26
+
27
+ export const messaging = new Command("messaging")
28
+ .description(commandDescriptions["messaging"] ?? "")
29
+ .configureHelp({
30
+ helpWidth: process.stdout.columns || 80,
31
+ });
32
+
33
+ messaging
34
+ .command(`list-messages`)
35
+ .description(`Get a list of all messages from the current Appwrite project.`)
36
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType`)
37
+ .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
38
+ .option(
39
+ `--total [value]`,
40
+ `When set to false, the total count returned will be 0 and will not be calculated.`,
41
+ (value: string | undefined) =>
42
+ value === undefined ? true : parseBool(value),
43
+ )
44
+ .action(
45
+ actionRunner(
46
+ async ({ queries, search, total }) =>
47
+ parse(await (await getMessagingClient()).listMessages(queries, search, total)),
48
+ ),
49
+ );
50
+
51
+ messaging
52
+ .command(`create-email`)
53
+ .description(`Create a new email message.`)
54
+ .requiredOption(`--message-id <message-id>`, `Message ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
55
+ .requiredOption(`--subject <subject>`, `Email Subject.`)
56
+ .requiredOption(`--content <content>`, `Email Content.`)
57
+ .option(`--topics [topics...]`, `List of Topic IDs.`)
58
+ .option(`--users [users...]`, `List of User IDs.`)
59
+ .option(`--targets [targets...]`, `List of Targets IDs.`)
60
+ .option(`--cc [cc...]`, `Array of target IDs to be added as CC.`)
61
+ .option(`--bcc [bcc...]`, `Array of target IDs to be added as BCC.`)
62
+ .option(`--attachments [attachments...]`, `Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>.`)
63
+ .option(
64
+ `--draft [value]`,
65
+ `Is message a draft`,
66
+ (value: string | undefined) =>
67
+ value === undefined ? true : parseBool(value),
68
+ )
69
+ .option(
70
+ `--html [value]`,
71
+ `Is content of type HTML`,
72
+ (value: string | undefined) =>
73
+ value === undefined ? true : parseBool(value),
74
+ )
75
+ .option(`--scheduled-at <scheduled-at>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`)
76
+ .action(
77
+ actionRunner(
78
+ async ({ messageId, subject, content, topics, users, targets, cc, bcc, attachments, draft, html, scheduledAt }) =>
79
+ parse(await (await getMessagingClient()).createEmail(messageId, subject, content, topics, users, targets, cc, bcc, attachments, draft, html, scheduledAt)),
80
+ ),
81
+ );
82
+
83
+ messaging
84
+ .command(`update-email`)
85
+ .description(`Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated.
86
+ `)
87
+ .requiredOption(`--message-id <message-id>`, `Message ID.`)
88
+ .option(`--topics [topics...]`, `List of Topic IDs.`)
89
+ .option(`--users [users...]`, `List of User IDs.`)
90
+ .option(`--targets [targets...]`, `List of Targets IDs.`)
91
+ .option(`--subject <subject>`, `Email Subject.`)
92
+ .option(`--content <content>`, `Email Content.`)
93
+ .option(
94
+ `--draft [value]`,
95
+ `Is message a draft`,
96
+ (value: string | undefined) =>
97
+ value === undefined ? true : parseBool(value),
98
+ )
99
+ .option(
100
+ `--html [value]`,
101
+ `Is content of type HTML`,
102
+ (value: string | undefined) =>
103
+ value === undefined ? true : parseBool(value),
104
+ )
105
+ .option(`--cc [cc...]`, `Array of target IDs to be added as CC.`)
106
+ .option(`--bcc [bcc...]`, `Array of target IDs to be added as BCC.`)
107
+ .option(`--scheduled-at <scheduled-at>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`)
108
+ .option(`--attachments [attachments...]`, `Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>.`)
109
+ .action(
110
+ actionRunner(
111
+ async ({ messageId, topics, users, targets, subject, content, draft, html, cc, bcc, scheduledAt, attachments }) =>
112
+ parse(await (await getMessagingClient()).updateEmail(messageId, topics, users, targets, subject, content, draft, html, cc, bcc, scheduledAt, attachments)),
113
+ ),
114
+ );
115
+
116
+ messaging
117
+ .command(`create-push`)
118
+ .description(`Create a new push notification.`)
119
+ .requiredOption(`--message-id <message-id>`, `Message ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
120
+ .option(`--title <title>`, `Title for push notification.`)
121
+ .option(`--body <body>`, `Body for push notification.`)
122
+ .option(`--topics [topics...]`, `List of Topic IDs.`)
123
+ .option(`--users [users...]`, `List of User IDs.`)
124
+ .option(`--targets [targets...]`, `List of Targets IDs.`)
125
+ .option(`--data <data>`, `Additional key-value pair data for push notification.`)
126
+ .option(`--action <action>`, `Action for push notification.`)
127
+ .option(`--image <image>`, `Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>.`)
128
+ .option(`--icon <icon>`, `Icon for push notification. Available only for Android and Web Platform.`)
129
+ .option(`--sound <sound>`, `Sound for push notification. Available only for Android and iOS Platform.`)
130
+ .option(`--color <color>`, `Color for push notification. Available only for Android Platform.`)
131
+ .option(`--tag <tag>`, `Tag for push notification. Available only for Android Platform.`)
132
+ .option(`--badge <badge>`, `Badge for push notification. Available only for iOS Platform.`, parseInteger)
133
+ .option(
134
+ `--draft [value]`,
135
+ `Is message a draft`,
136
+ (value: string | undefined) =>
137
+ value === undefined ? true : parseBool(value),
138
+ )
139
+ .option(`--scheduled-at <scheduled-at>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`)
140
+ .option(
141
+ `--content-available [value]`,
142
+ `If set to true, the notification will be delivered in the background. Available only for iOS Platform.`,
143
+ (value: string | undefined) =>
144
+ value === undefined ? true : parseBool(value),
145
+ )
146
+ .option(
147
+ `--critical [value]`,
148
+ `If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform.`,
149
+ (value: string | undefined) =>
150
+ value === undefined ? true : parseBool(value),
151
+ )
152
+ .option(`--priority <priority>`, `Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification.`)
153
+ .action(
154
+ actionRunner(
155
+ async ({ messageId, title, body, topics, users, targets, data, action, image, icon, sound, color, tag, badge, draft, scheduledAt, contentAvailable, critical, priority }) =>
156
+ parse(await (await getMessagingClient()).createPush(messageId, title, body, topics, users, targets, JSON.parse(data), action, image, icon, sound, color, tag, badge, draft, scheduledAt, contentAvailable, critical, priority as MessagePriority)),
157
+ ),
158
+ );
159
+
160
+ messaging
161
+ .command(`update-push`)
162
+ .description(`Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated.
163
+ `)
164
+ .requiredOption(`--message-id <message-id>`, `Message ID.`)
165
+ .option(`--topics [topics...]`, `List of Topic IDs.`)
166
+ .option(`--users [users...]`, `List of User IDs.`)
167
+ .option(`--targets [targets...]`, `List of Targets IDs.`)
168
+ .option(`--title <title>`, `Title for push notification.`)
169
+ .option(`--body <body>`, `Body for push notification.`)
170
+ .option(`--data <data>`, `Additional Data for push notification.`)
171
+ .option(`--action <action>`, `Action for push notification.`)
172
+ .option(`--image <image>`, `Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>.`)
173
+ .option(`--icon <icon>`, `Icon for push notification. Available only for Android and Web platforms.`)
174
+ .option(`--sound <sound>`, `Sound for push notification. Available only for Android and iOS platforms.`)
175
+ .option(`--color <color>`, `Color for push notification. Available only for Android platforms.`)
176
+ .option(`--tag <tag>`, `Tag for push notification. Available only for Android platforms.`)
177
+ .option(`--badge <badge>`, `Badge for push notification. Available only for iOS platforms.`, parseInteger)
178
+ .option(
179
+ `--draft [value]`,
180
+ `Is message a draft`,
181
+ (value: string | undefined) =>
182
+ value === undefined ? true : parseBool(value),
183
+ )
184
+ .option(`--scheduled-at <scheduled-at>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`)
185
+ .option(
186
+ `--content-available [value]`,
187
+ `If set to true, the notification will be delivered in the background. Available only for iOS Platform.`,
188
+ (value: string | undefined) =>
189
+ value === undefined ? true : parseBool(value),
190
+ )
191
+ .option(
192
+ `--critical [value]`,
193
+ `If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform.`,
194
+ (value: string | undefined) =>
195
+ value === undefined ? true : parseBool(value),
196
+ )
197
+ .option(`--priority <priority>`, `Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification.`)
198
+ .action(
199
+ actionRunner(
200
+ async ({ messageId, topics, users, targets, title, body, data, action, image, icon, sound, color, tag, badge, draft, scheduledAt, contentAvailable, critical, priority }) =>
201
+ parse(await (await getMessagingClient()).updatePush(messageId, topics, users, targets, title, body, JSON.parse(data), action, image, icon, sound, color, tag, badge, draft, scheduledAt, contentAvailable, critical, priority as MessagePriority)),
202
+ ),
203
+ );
204
+
205
+ messaging
206
+ .command(`create-sms`)
207
+ .description(`Create a new SMS message.`)
208
+ .requiredOption(`--message-id <message-id>`, `Message ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
209
+ .requiredOption(`--content <content>`, `SMS Content.`)
210
+ .option(`--topics [topics...]`, `List of Topic IDs.`)
211
+ .option(`--users [users...]`, `List of User IDs.`)
212
+ .option(`--targets [targets...]`, `List of Targets IDs.`)
213
+ .option(
214
+ `--draft [value]`,
215
+ `Is message a draft`,
216
+ (value: string | undefined) =>
217
+ value === undefined ? true : parseBool(value),
218
+ )
219
+ .option(`--scheduled-at <scheduled-at>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`)
220
+ .action(
221
+ actionRunner(
222
+ async ({ messageId, content, topics, users, targets, draft, scheduledAt }) =>
223
+ parse(await (await getMessagingClient()).createSms(messageId, content, topics, users, targets, draft, scheduledAt)),
224
+ ),
225
+ );
226
+
227
+ messaging
228
+ .command(`update-sms`)
229
+ .description(`Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated.
230
+ `)
231
+ .requiredOption(`--message-id <message-id>`, `Message ID.`)
232
+ .option(`--topics [topics...]`, `List of Topic IDs.`)
233
+ .option(`--users [users...]`, `List of User IDs.`)
234
+ .option(`--targets [targets...]`, `List of Targets IDs.`)
235
+ .option(`--content <content>`, `Email Content.`)
236
+ .option(
237
+ `--draft [value]`,
238
+ `Is message a draft`,
239
+ (value: string | undefined) =>
240
+ value === undefined ? true : parseBool(value),
241
+ )
242
+ .option(`--scheduled-at <scheduled-at>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`)
243
+ .action(
244
+ actionRunner(
245
+ async ({ messageId, topics, users, targets, content, draft, scheduledAt }) =>
246
+ parse(await (await getMessagingClient()).updateSms(messageId, topics, users, targets, content, draft, scheduledAt)),
247
+ ),
248
+ );
249
+
250
+ messaging
251
+ .command(`get-message`)
252
+ .description(`Get a message by its unique ID.
253
+ `)
254
+ .requiredOption(`--message-id <message-id>`, `Message ID.`)
255
+ .action(
256
+ actionRunner(
257
+ async ({ messageId }) =>
258
+ parse(await (await getMessagingClient()).getMessage(messageId)),
259
+ ),
260
+ );
261
+
262
+ messaging
263
+ .command(`delete`)
264
+ .description(`Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message.`)
265
+ .requiredOption(`--message-id <message-id>`, `Message ID.`)
266
+ .action(
267
+ actionRunner(
268
+ async ({ messageId }) =>
269
+ parse(await (await getMessagingClient()).delete(messageId)),
270
+ ),
271
+ );
272
+
273
+ messaging
274
+ .command(`list-message-logs`)
275
+ .description(`Get the message activity logs listed by its unique ID.`)
276
+ .requiredOption(`--message-id <message-id>`, `Message ID.`)
277
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset`)
278
+ .option(
279
+ `--total [value]`,
280
+ `When set to false, the total count returned will be 0 and will not be calculated.`,
281
+ (value: string | undefined) =>
282
+ value === undefined ? true : parseBool(value),
283
+ )
284
+ .action(
285
+ actionRunner(
286
+ async ({ messageId, queries, total }) =>
287
+ parse(await (await getMessagingClient()).listMessageLogs(messageId, queries, total)),
288
+ ),
289
+ );
290
+
291
+ messaging
292
+ .command(`list-targets`)
293
+ .description(`Get a list of the targets associated with a message.`)
294
+ .requiredOption(`--message-id <message-id>`, `Message ID.`)
295
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType`)
296
+ .option(
297
+ `--total [value]`,
298
+ `When set to false, the total count returned will be 0 and will not be calculated.`,
299
+ (value: string | undefined) =>
300
+ value === undefined ? true : parseBool(value),
301
+ )
302
+ .action(
303
+ actionRunner(
304
+ async ({ messageId, queries, total }) =>
305
+ parse(await (await getMessagingClient()).listTargets(messageId, queries, total)),
306
+ ),
307
+ );
308
+
309
+ messaging
310
+ .command(`list-providers`)
311
+ .description(`Get a list of all providers from the current Appwrite project.`)
312
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled`)
313
+ .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
314
+ .option(
315
+ `--total [value]`,
316
+ `When set to false, the total count returned will be 0 and will not be calculated.`,
317
+ (value: string | undefined) =>
318
+ value === undefined ? true : parseBool(value),
319
+ )
320
+ .action(
321
+ actionRunner(
322
+ async ({ queries, search, total }) =>
323
+ parse(await (await getMessagingClient()).listProviders(queries, search, total)),
324
+ ),
325
+ );
326
+
327
+ messaging
328
+ .command(`create-apns-provider`)
329
+ .description(`Create a new Apple Push Notification service provider.`)
330
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
331
+ .requiredOption(`--name <name>`, `Provider name.`)
332
+ .option(`--auth-key <auth-key>`, `APNS authentication key.`)
333
+ .option(`--auth-key-id <auth-key-id>`, `APNS authentication key ID.`)
334
+ .option(`--team-id <team-id>`, `APNS team ID.`)
335
+ .option(`--bundle-id <bundle-id>`, `APNS bundle ID.`)
336
+ .option(
337
+ `--sandbox [value]`,
338
+ `Use APNS sandbox environment.`,
339
+ (value: string | undefined) =>
340
+ value === undefined ? true : parseBool(value),
341
+ )
342
+ .option(
343
+ `--enabled [value]`,
344
+ `Set as enabled.`,
345
+ (value: string | undefined) =>
346
+ value === undefined ? true : parseBool(value),
347
+ )
348
+ .action(
349
+ actionRunner(
350
+ async ({ providerId, name, authKey, authKeyId, teamId, bundleId, sandbox, enabled }) =>
351
+ parse(await (await getMessagingClient()).createApnsProvider(providerId, name, authKey, authKeyId, teamId, bundleId, sandbox, enabled)),
352
+ ),
353
+ );
354
+
355
+ messaging
356
+ .command(`update-apns-provider`)
357
+ .description(`Update a Apple Push Notification service provider by its unique ID.`)
358
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
359
+ .option(`--name <name>`, `Provider name.`)
360
+ .option(
361
+ `--enabled [value]`,
362
+ `Set as enabled.`,
363
+ (value: string | undefined) =>
364
+ value === undefined ? true : parseBool(value),
365
+ )
366
+ .option(`--auth-key <auth-key>`, `APNS authentication key.`)
367
+ .option(`--auth-key-id <auth-key-id>`, `APNS authentication key ID.`)
368
+ .option(`--team-id <team-id>`, `APNS team ID.`)
369
+ .option(`--bundle-id <bundle-id>`, `APNS bundle ID.`)
370
+ .option(
371
+ `--sandbox [value]`,
372
+ `Use APNS sandbox environment.`,
373
+ (value: string | undefined) =>
374
+ value === undefined ? true : parseBool(value),
375
+ )
376
+ .action(
377
+ actionRunner(
378
+ async ({ providerId, name, enabled, authKey, authKeyId, teamId, bundleId, sandbox }) =>
379
+ parse(await (await getMessagingClient()).updateApnsProvider(providerId, name, enabled, authKey, authKeyId, teamId, bundleId, sandbox)),
380
+ ),
381
+ );
382
+
383
+ messaging
384
+ .command(`create-fcm-provider`)
385
+ .description(`Create a new Firebase Cloud Messaging provider.`)
386
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
387
+ .requiredOption(`--name <name>`, `Provider name.`)
388
+ .option(`--service-account-json <service-account-json>`, `FCM service account JSON.`)
389
+ .option(
390
+ `--enabled [value]`,
391
+ `Set as enabled.`,
392
+ (value: string | undefined) =>
393
+ value === undefined ? true : parseBool(value),
394
+ )
395
+ .action(
396
+ actionRunner(
397
+ async ({ providerId, name, serviceAccountJson, enabled }) =>
398
+ parse(await (await getMessagingClient()).createFcmProvider(providerId, name, JSON.parse(serviceAccountJson), enabled)),
399
+ ),
400
+ );
401
+
402
+ messaging
403
+ .command(`update-fcm-provider`)
404
+ .description(`Update a Firebase Cloud Messaging provider by its unique ID.`)
405
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
406
+ .option(`--name <name>`, `Provider name.`)
407
+ .option(
408
+ `--enabled [value]`,
409
+ `Set as enabled.`,
410
+ (value: string | undefined) =>
411
+ value === undefined ? true : parseBool(value),
412
+ )
413
+ .option(`--service-account-json <service-account-json>`, `FCM service account JSON.`)
414
+ .action(
415
+ actionRunner(
416
+ async ({ providerId, name, enabled, serviceAccountJson }) =>
417
+ parse(await (await getMessagingClient()).updateFcmProvider(providerId, name, enabled, JSON.parse(serviceAccountJson))),
418
+ ),
419
+ );
420
+
421
+ messaging
422
+ .command(`create-mailgun-provider`)
423
+ .description(`Create a new Mailgun provider.`)
424
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
425
+ .requiredOption(`--name <name>`, `Provider name.`)
426
+ .option(`--api-key <api-key>`, `Mailgun API Key.`)
427
+ .option(`--domain <domain>`, `Mailgun Domain.`)
428
+ .option(
429
+ `--is-eu-region [value]`,
430
+ `Set as EU region.`,
431
+ (value: string | undefined) =>
432
+ value === undefined ? true : parseBool(value),
433
+ )
434
+ .option(`--from-name <from-name>`, `Sender Name.`)
435
+ .option(`--from-email <from-email>`, `Sender email address.`)
436
+ .option(`--reply-to-name <reply-to-name>`, `Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well.`)
437
+ .option(`--reply-to-email <reply-to-email>`, `Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well.`)
438
+ .option(
439
+ `--enabled [value]`,
440
+ `Set as enabled.`,
441
+ (value: string | undefined) =>
442
+ value === undefined ? true : parseBool(value),
443
+ )
444
+ .action(
445
+ actionRunner(
446
+ async ({ providerId, name, apiKey, domain, isEuRegion, fromName, fromEmail, replyToName, replyToEmail, enabled }) =>
447
+ parse(await (await getMessagingClient()).createMailgunProvider(providerId, name, apiKey, domain, isEuRegion, fromName, fromEmail, replyToName, replyToEmail, enabled)),
448
+ ),
449
+ );
450
+
451
+ messaging
452
+ .command(`update-mailgun-provider`)
453
+ .description(`Update a Mailgun provider by its unique ID.`)
454
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
455
+ .option(`--name <name>`, `Provider name.`)
456
+ .option(`--api-key <api-key>`, `Mailgun API Key.`)
457
+ .option(`--domain <domain>`, `Mailgun Domain.`)
458
+ .option(
459
+ `--is-eu-region [value]`,
460
+ `Set as EU region.`,
461
+ (value: string | undefined) =>
462
+ value === undefined ? true : parseBool(value),
463
+ )
464
+ .option(
465
+ `--enabled [value]`,
466
+ `Set as enabled.`,
467
+ (value: string | undefined) =>
468
+ value === undefined ? true : parseBool(value),
469
+ )
470
+ .option(`--from-name <from-name>`, `Sender Name.`)
471
+ .option(`--from-email <from-email>`, `Sender email address.`)
472
+ .option(`--reply-to-name <reply-to-name>`, `Name set in the reply to field for the mail. Default value is sender name.`)
473
+ .option(`--reply-to-email <reply-to-email>`, `Email set in the reply to field for the mail. Default value is sender email.`)
474
+ .action(
475
+ actionRunner(
476
+ async ({ providerId, name, apiKey, domain, isEuRegion, enabled, fromName, fromEmail, replyToName, replyToEmail }) =>
477
+ parse(await (await getMessagingClient()).updateMailgunProvider(providerId, name, apiKey, domain, isEuRegion, enabled, fromName, fromEmail, replyToName, replyToEmail)),
478
+ ),
479
+ );
480
+
481
+ messaging
482
+ .command(`create-msg-91-provider`)
483
+ .description(`Create a new MSG91 provider.`)
484
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
485
+ .requiredOption(`--name <name>`, `Provider name.`)
486
+ .option(`--template-id <template-id>`, `Msg91 template ID`)
487
+ .option(`--sender-id <sender-id>`, `Msg91 sender ID.`)
488
+ .option(`--auth-key <auth-key>`, `Msg91 auth key.`)
489
+ .option(
490
+ `--enabled [value]`,
491
+ `Set as enabled.`,
492
+ (value: string | undefined) =>
493
+ value === undefined ? true : parseBool(value),
494
+ )
495
+ .action(
496
+ actionRunner(
497
+ async ({ providerId, name, templateId, senderId, authKey, enabled }) =>
498
+ parse(await (await getMessagingClient()).createMsg91Provider(providerId, name, templateId, senderId, authKey, enabled)),
499
+ ),
500
+ );
501
+
502
+ messaging
503
+ .command(`update-msg-91-provider`)
504
+ .description(`Update a MSG91 provider by its unique ID.`)
505
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
506
+ .option(`--name <name>`, `Provider name.`)
507
+ .option(
508
+ `--enabled [value]`,
509
+ `Set as enabled.`,
510
+ (value: string | undefined) =>
511
+ value === undefined ? true : parseBool(value),
512
+ )
513
+ .option(`--template-id <template-id>`, `Msg91 template ID.`)
514
+ .option(`--sender-id <sender-id>`, `Msg91 sender ID.`)
515
+ .option(`--auth-key <auth-key>`, `Msg91 auth key.`)
516
+ .action(
517
+ actionRunner(
518
+ async ({ providerId, name, enabled, templateId, senderId, authKey }) =>
519
+ parse(await (await getMessagingClient()).updateMsg91Provider(providerId, name, enabled, templateId, senderId, authKey)),
520
+ ),
521
+ );
522
+
523
+ messaging
524
+ .command(`create-resend-provider`)
525
+ .description(`Create a new Resend provider.`)
526
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
527
+ .requiredOption(`--name <name>`, `Provider name.`)
528
+ .option(`--api-key <api-key>`, `Resend API key.`)
529
+ .option(`--from-name <from-name>`, `Sender Name.`)
530
+ .option(`--from-email <from-email>`, `Sender email address.`)
531
+ .option(`--reply-to-name <reply-to-name>`, `Name set in the reply to field for the mail. Default value is sender name.`)
532
+ .option(`--reply-to-email <reply-to-email>`, `Email set in the reply to field for the mail. Default value is sender email.`)
533
+ .option(
534
+ `--enabled [value]`,
535
+ `Set as enabled.`,
536
+ (value: string | undefined) =>
537
+ value === undefined ? true : parseBool(value),
538
+ )
539
+ .action(
540
+ actionRunner(
541
+ async ({ providerId, name, apiKey, fromName, fromEmail, replyToName, replyToEmail, enabled }) =>
542
+ parse(await (await getMessagingClient()).createResendProvider(providerId, name, apiKey, fromName, fromEmail, replyToName, replyToEmail, enabled)),
543
+ ),
544
+ );
545
+
546
+ messaging
547
+ .command(`update-resend-provider`)
548
+ .description(`Update a Resend provider by its unique ID.`)
549
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
550
+ .option(`--name <name>`, `Provider name.`)
551
+ .option(
552
+ `--enabled [value]`,
553
+ `Set as enabled.`,
554
+ (value: string | undefined) =>
555
+ value === undefined ? true : parseBool(value),
556
+ )
557
+ .option(`--api-key <api-key>`, `Resend API key.`)
558
+ .option(`--from-name <from-name>`, `Sender Name.`)
559
+ .option(`--from-email <from-email>`, `Sender email address.`)
560
+ .option(`--reply-to-name <reply-to-name>`, `Name set in the Reply To field for the mail. Default value is Sender Name.`)
561
+ .option(`--reply-to-email <reply-to-email>`, `Email set in the Reply To field for the mail. Default value is Sender Email.`)
562
+ .action(
563
+ actionRunner(
564
+ async ({ providerId, name, enabled, apiKey, fromName, fromEmail, replyToName, replyToEmail }) =>
565
+ parse(await (await getMessagingClient()).updateResendProvider(providerId, name, enabled, apiKey, fromName, fromEmail, replyToName, replyToEmail)),
566
+ ),
567
+ );
568
+
569
+ messaging
570
+ .command(`create-sendgrid-provider`)
571
+ .description(`Create a new Sendgrid provider.`)
572
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
573
+ .requiredOption(`--name <name>`, `Provider name.`)
574
+ .option(`--api-key <api-key>`, `Sendgrid API key.`)
575
+ .option(`--from-name <from-name>`, `Sender Name.`)
576
+ .option(`--from-email <from-email>`, `Sender email address.`)
577
+ .option(`--reply-to-name <reply-to-name>`, `Name set in the reply to field for the mail. Default value is sender name.`)
578
+ .option(`--reply-to-email <reply-to-email>`, `Email set in the reply to field for the mail. Default value is sender email.`)
579
+ .option(
580
+ `--enabled [value]`,
581
+ `Set as enabled.`,
582
+ (value: string | undefined) =>
583
+ value === undefined ? true : parseBool(value),
584
+ )
585
+ .action(
586
+ actionRunner(
587
+ async ({ providerId, name, apiKey, fromName, fromEmail, replyToName, replyToEmail, enabled }) =>
588
+ parse(await (await getMessagingClient()).createSendgridProvider(providerId, name, apiKey, fromName, fromEmail, replyToName, replyToEmail, enabled)),
589
+ ),
590
+ );
591
+
592
+ messaging
593
+ .command(`update-sendgrid-provider`)
594
+ .description(`Update a Sendgrid provider by its unique ID.`)
595
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
596
+ .option(`--name <name>`, `Provider name.`)
597
+ .option(
598
+ `--enabled [value]`,
599
+ `Set as enabled.`,
600
+ (value: string | undefined) =>
601
+ value === undefined ? true : parseBool(value),
602
+ )
603
+ .option(`--api-key <api-key>`, `Sendgrid API key.`)
604
+ .option(`--from-name <from-name>`, `Sender Name.`)
605
+ .option(`--from-email <from-email>`, `Sender email address.`)
606
+ .option(`--reply-to-name <reply-to-name>`, `Name set in the Reply To field for the mail. Default value is Sender Name.`)
607
+ .option(`--reply-to-email <reply-to-email>`, `Email set in the Reply To field for the mail. Default value is Sender Email.`)
608
+ .action(
609
+ actionRunner(
610
+ async ({ providerId, name, enabled, apiKey, fromName, fromEmail, replyToName, replyToEmail }) =>
611
+ parse(await (await getMessagingClient()).updateSendgridProvider(providerId, name, enabled, apiKey, fromName, fromEmail, replyToName, replyToEmail)),
612
+ ),
613
+ );
614
+
615
+ messaging
616
+ .command(`create-smtp-provider`)
617
+ .description(`Create a new SMTP provider.`)
618
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
619
+ .requiredOption(`--name <name>`, `Provider name.`)
620
+ .requiredOption(`--host <host>`, `SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as \`smtp1.example.com:25;smtp2.example.com\`. You can also specify encryption type, for example: \`tls://smtp1.example.com:587;ssl://smtp2.example.com:465"\`. Hosts will be tried in order.`)
621
+ .option(`--port <port>`, `The default SMTP server port.`, parseInteger)
622
+ .option(`--username <username>`, `Authentication username.`)
623
+ .option(`--password <password>`, `Authentication password.`)
624
+ .option(`--encryption <encryption>`, `Encryption type. Can be omitted, 'ssl', or 'tls'`)
625
+ .option(
626
+ `--auto-tls [value]`,
627
+ `Enable SMTP AutoTLS feature.`,
628
+ (value: string | undefined) =>
629
+ value === undefined ? true : parseBool(value),
630
+ )
631
+ .option(`--mailer <mailer>`, `The value to use for the X-Mailer header.`)
632
+ .option(`--from-name <from-name>`, `Sender Name.`)
633
+ .option(`--from-email <from-email>`, `Sender email address.`)
634
+ .option(`--reply-to-name <reply-to-name>`, `Name set in the reply to field for the mail. Default value is sender name.`)
635
+ .option(`--reply-to-email <reply-to-email>`, `Email set in the reply to field for the mail. Default value is sender email.`)
636
+ .option(
637
+ `--enabled [value]`,
638
+ `Set as enabled.`,
639
+ (value: string | undefined) =>
640
+ value === undefined ? true : parseBool(value),
641
+ )
642
+ .action(
643
+ actionRunner(
644
+ async ({ providerId, name, host, port, username, password, encryption, autoTls, mailer, fromName, fromEmail, replyToName, replyToEmail, enabled }) =>
645
+ parse(await (await getMessagingClient()).createSmtpProvider(providerId, name, host, port, username, password, encryption as SmtpEncryption, autoTls, mailer, fromName, fromEmail, replyToName, replyToEmail, enabled)),
646
+ ),
647
+ );
648
+
649
+ messaging
650
+ .command(`update-smtp-provider`)
651
+ .description(`Update a SMTP provider by its unique ID.`)
652
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
653
+ .option(`--name <name>`, `Provider name.`)
654
+ .option(`--host <host>`, `SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as \`smtp1.example.com:25;smtp2.example.com\`. You can also specify encryption type, for example: \`tls://smtp1.example.com:587;ssl://smtp2.example.com:465"\`. Hosts will be tried in order.`)
655
+ .option(`--port <port>`, `SMTP port.`, parseInteger)
656
+ .option(`--username <username>`, `Authentication username.`)
657
+ .option(`--password <password>`, `Authentication password.`)
658
+ .option(`--encryption <encryption>`, `Encryption type. Can be 'ssl' or 'tls'`)
659
+ .option(
660
+ `--auto-tls [value]`,
661
+ `Enable SMTP AutoTLS feature.`,
662
+ (value: string | undefined) =>
663
+ value === undefined ? true : parseBool(value),
664
+ )
665
+ .option(`--mailer <mailer>`, `The value to use for the X-Mailer header.`)
666
+ .option(`--from-name <from-name>`, `Sender Name.`)
667
+ .option(`--from-email <from-email>`, `Sender email address.`)
668
+ .option(`--reply-to-name <reply-to-name>`, `Name set in the Reply To field for the mail. Default value is Sender Name.`)
669
+ .option(`--reply-to-email <reply-to-email>`, `Email set in the Reply To field for the mail. Default value is Sender Email.`)
670
+ .option(
671
+ `--enabled [value]`,
672
+ `Set as enabled.`,
673
+ (value: string | undefined) =>
674
+ value === undefined ? true : parseBool(value),
675
+ )
676
+ .action(
677
+ actionRunner(
678
+ async ({ providerId, name, host, port, username, password, encryption, autoTls, mailer, fromName, fromEmail, replyToName, replyToEmail, enabled }) =>
679
+ parse(await (await getMessagingClient()).updateSmtpProvider(providerId, name, host, port, username, password, encryption as SmtpEncryption, autoTls, mailer, fromName, fromEmail, replyToName, replyToEmail, enabled)),
680
+ ),
681
+ );
682
+
683
+ messaging
684
+ .command(`create-telesign-provider`)
685
+ .description(`Create a new Telesign provider.`)
686
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
687
+ .requiredOption(`--name <name>`, `Provider name.`)
688
+ .option(`--from <from>`, `Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`)
689
+ .option(`--customer-id <customer-id>`, `Telesign customer ID.`)
690
+ .option(`--api-key <api-key>`, `Telesign API key.`)
691
+ .option(
692
+ `--enabled [value]`,
693
+ `Set as enabled.`,
694
+ (value: string | undefined) =>
695
+ value === undefined ? true : parseBool(value),
696
+ )
697
+ .action(
698
+ actionRunner(
699
+ async ({ providerId, name, from, customerId, apiKey, enabled }) =>
700
+ parse(await (await getMessagingClient()).createTelesignProvider(providerId, name, from, customerId, apiKey, enabled)),
701
+ ),
702
+ );
703
+
704
+ messaging
705
+ .command(`update-telesign-provider`)
706
+ .description(`Update a Telesign provider by its unique ID.`)
707
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
708
+ .option(`--name <name>`, `Provider name.`)
709
+ .option(
710
+ `--enabled [value]`,
711
+ `Set as enabled.`,
712
+ (value: string | undefined) =>
713
+ value === undefined ? true : parseBool(value),
714
+ )
715
+ .option(`--customer-id <customer-id>`, `Telesign customer ID.`)
716
+ .option(`--api-key <api-key>`, `Telesign API key.`)
717
+ .option(`--from <from>`, `Sender number.`)
718
+ .action(
719
+ actionRunner(
720
+ async ({ providerId, name, enabled, customerId, apiKey, from }) =>
721
+ parse(await (await getMessagingClient()).updateTelesignProvider(providerId, name, enabled, customerId, apiKey, from)),
722
+ ),
723
+ );
724
+
725
+ messaging
726
+ .command(`create-textmagic-provider`)
727
+ .description(`Create a new Textmagic provider.`)
728
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
729
+ .requiredOption(`--name <name>`, `Provider name.`)
730
+ .option(`--from <from>`, `Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`)
731
+ .option(`--username <username>`, `Textmagic username.`)
732
+ .option(`--api-key <api-key>`, `Textmagic apiKey.`)
733
+ .option(
734
+ `--enabled [value]`,
735
+ `Set as enabled.`,
736
+ (value: string | undefined) =>
737
+ value === undefined ? true : parseBool(value),
738
+ )
739
+ .action(
740
+ actionRunner(
741
+ async ({ providerId, name, from, username, apiKey, enabled }) =>
742
+ parse(await (await getMessagingClient()).createTextmagicProvider(providerId, name, from, username, apiKey, enabled)),
743
+ ),
744
+ );
745
+
746
+ messaging
747
+ .command(`update-textmagic-provider`)
748
+ .description(`Update a Textmagic provider by its unique ID.`)
749
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
750
+ .option(`--name <name>`, `Provider name.`)
751
+ .option(
752
+ `--enabled [value]`,
753
+ `Set as enabled.`,
754
+ (value: string | undefined) =>
755
+ value === undefined ? true : parseBool(value),
756
+ )
757
+ .option(`--username <username>`, `Textmagic username.`)
758
+ .option(`--api-key <api-key>`, `Textmagic apiKey.`)
759
+ .option(`--from <from>`, `Sender number.`)
760
+ .action(
761
+ actionRunner(
762
+ async ({ providerId, name, enabled, username, apiKey, from }) =>
763
+ parse(await (await getMessagingClient()).updateTextmagicProvider(providerId, name, enabled, username, apiKey, from)),
764
+ ),
765
+ );
766
+
767
+ messaging
768
+ .command(`create-twilio-provider`)
769
+ .description(`Create a new Twilio provider.`)
770
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
771
+ .requiredOption(`--name <name>`, `Provider name.`)
772
+ .option(`--from <from>`, `Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`)
773
+ .option(`--account-sid <account-sid>`, `Twilio account secret ID.`)
774
+ .option(`--auth-token <auth-token>`, `Twilio authentication token.`)
775
+ .option(
776
+ `--enabled [value]`,
777
+ `Set as enabled.`,
778
+ (value: string | undefined) =>
779
+ value === undefined ? true : parseBool(value),
780
+ )
781
+ .action(
782
+ actionRunner(
783
+ async ({ providerId, name, from, accountSid, authToken, enabled }) =>
784
+ parse(await (await getMessagingClient()).createTwilioProvider(providerId, name, from, accountSid, authToken, enabled)),
785
+ ),
786
+ );
787
+
788
+ messaging
789
+ .command(`update-twilio-provider`)
790
+ .description(`Update a Twilio provider by its unique ID.`)
791
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
792
+ .option(`--name <name>`, `Provider name.`)
793
+ .option(
794
+ `--enabled [value]`,
795
+ `Set as enabled.`,
796
+ (value: string | undefined) =>
797
+ value === undefined ? true : parseBool(value),
798
+ )
799
+ .option(`--account-sid <account-sid>`, `Twilio account secret ID.`)
800
+ .option(`--auth-token <auth-token>`, `Twilio authentication token.`)
801
+ .option(`--from <from>`, `Sender number.`)
802
+ .action(
803
+ actionRunner(
804
+ async ({ providerId, name, enabled, accountSid, authToken, from }) =>
805
+ parse(await (await getMessagingClient()).updateTwilioProvider(providerId, name, enabled, accountSid, authToken, from)),
806
+ ),
807
+ );
808
+
809
+ messaging
810
+ .command(`create-vonage-provider`)
811
+ .description(`Create a new Vonage provider.`)
812
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
813
+ .requiredOption(`--name <name>`, `Provider name.`)
814
+ .option(`--from <from>`, `Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`)
815
+ .option(`--api-key <api-key>`, `Vonage API key.`)
816
+ .option(`--api-secret <api-secret>`, `Vonage API secret.`)
817
+ .option(
818
+ `--enabled [value]`,
819
+ `Set as enabled.`,
820
+ (value: string | undefined) =>
821
+ value === undefined ? true : parseBool(value),
822
+ )
823
+ .action(
824
+ actionRunner(
825
+ async ({ providerId, name, from, apiKey, apiSecret, enabled }) =>
826
+ parse(await (await getMessagingClient()).createVonageProvider(providerId, name, from, apiKey, apiSecret, enabled)),
827
+ ),
828
+ );
829
+
830
+ messaging
831
+ .command(`update-vonage-provider`)
832
+ .description(`Update a Vonage provider by its unique ID.`)
833
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
834
+ .option(`--name <name>`, `Provider name.`)
835
+ .option(
836
+ `--enabled [value]`,
837
+ `Set as enabled.`,
838
+ (value: string | undefined) =>
839
+ value === undefined ? true : parseBool(value),
840
+ )
841
+ .option(`--api-key <api-key>`, `Vonage API key.`)
842
+ .option(`--api-secret <api-secret>`, `Vonage API secret.`)
843
+ .option(`--from <from>`, `Sender number.`)
844
+ .action(
845
+ actionRunner(
846
+ async ({ providerId, name, enabled, apiKey, apiSecret, from }) =>
847
+ parse(await (await getMessagingClient()).updateVonageProvider(providerId, name, enabled, apiKey, apiSecret, from)),
848
+ ),
849
+ );
850
+
851
+ messaging
852
+ .command(`get-provider`)
853
+ .description(`Get a provider by its unique ID.
854
+ `)
855
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
856
+ .action(
857
+ actionRunner(
858
+ async ({ providerId }) =>
859
+ parse(await (await getMessagingClient()).getProvider(providerId)),
860
+ ),
861
+ );
862
+
863
+ messaging
864
+ .command(`delete-provider`)
865
+ .description(`Delete a provider by its unique ID.`)
866
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
867
+ .action(
868
+ actionRunner(
869
+ async ({ providerId }) =>
870
+ parse(await (await getMessagingClient()).deleteProvider(providerId)),
871
+ ),
872
+ );
873
+
874
+ messaging
875
+ .command(`list-provider-logs`)
876
+ .description(`Get the provider activity logs listed by its unique ID.`)
877
+ .requiredOption(`--provider-id <provider-id>`, `Provider ID.`)
878
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset`)
879
+ .option(
880
+ `--total [value]`,
881
+ `When set to false, the total count returned will be 0 and will not be calculated.`,
882
+ (value: string | undefined) =>
883
+ value === undefined ? true : parseBool(value),
884
+ )
885
+ .action(
886
+ actionRunner(
887
+ async ({ providerId, queries, total }) =>
888
+ parse(await (await getMessagingClient()).listProviderLogs(providerId, queries, total)),
889
+ ),
890
+ );
891
+
892
+ messaging
893
+ .command(`list-subscriber-logs`)
894
+ .description(`Get the subscriber activity logs listed by its unique ID.`)
895
+ .requiredOption(`--subscriber-id <subscriber-id>`, `Subscriber ID.`)
896
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset`)
897
+ .option(
898
+ `--total [value]`,
899
+ `When set to false, the total count returned will be 0 and will not be calculated.`,
900
+ (value: string | undefined) =>
901
+ value === undefined ? true : parseBool(value),
902
+ )
903
+ .action(
904
+ actionRunner(
905
+ async ({ subscriberId, queries, total }) =>
906
+ parse(await (await getMessagingClient()).listSubscriberLogs(subscriberId, queries, total)),
907
+ ),
908
+ );
909
+
910
+ messaging
911
+ .command(`list-topics`)
912
+ .description(`Get a list of all topics from the current Appwrite project.`)
913
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal`)
914
+ .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
915
+ .option(
916
+ `--total [value]`,
917
+ `When set to false, the total count returned will be 0 and will not be calculated.`,
918
+ (value: string | undefined) =>
919
+ value === undefined ? true : parseBool(value),
920
+ )
921
+ .action(
922
+ actionRunner(
923
+ async ({ queries, search, total }) =>
924
+ parse(await (await getMessagingClient()).listTopics(queries, search, total)),
925
+ ),
926
+ );
927
+
928
+ messaging
929
+ .command(`create-topic`)
930
+ .description(`Create a new topic.`)
931
+ .requiredOption(`--topic-id <topic-id>`, `Topic ID. Choose a custom Topic ID or a new Topic ID.`)
932
+ .requiredOption(`--name <name>`, `Topic Name.`)
933
+ .option(`--subscribe [subscribe...]`, `An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.`)
934
+ .action(
935
+ actionRunner(
936
+ async ({ topicId, name, subscribe }) =>
937
+ parse(await (await getMessagingClient()).createTopic(topicId, name, subscribe)),
938
+ ),
939
+ );
940
+
941
+ messaging
942
+ .command(`get-topic`)
943
+ .description(`Get a topic by its unique ID.
944
+ `)
945
+ .requiredOption(`--topic-id <topic-id>`, `Topic ID.`)
946
+ .action(
947
+ actionRunner(
948
+ async ({ topicId }) =>
949
+ parse(await (await getMessagingClient()).getTopic(topicId)),
950
+ ),
951
+ );
952
+
953
+ messaging
954
+ .command(`update-topic`)
955
+ .description(`Update a topic by its unique ID.
956
+ `)
957
+ .requiredOption(`--topic-id <topic-id>`, `Topic ID.`)
958
+ .option(`--name <name>`, `Topic Name.`)
959
+ .option(`--subscribe [subscribe...]`, `An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.`)
960
+ .action(
961
+ actionRunner(
962
+ async ({ topicId, name, subscribe }) =>
963
+ parse(await (await getMessagingClient()).updateTopic(topicId, name, subscribe)),
964
+ ),
965
+ );
966
+
967
+ messaging
968
+ .command(`delete-topic`)
969
+ .description(`Delete a topic by its unique ID.`)
970
+ .requiredOption(`--topic-id <topic-id>`, `Topic ID.`)
971
+ .action(
972
+ actionRunner(
973
+ async ({ topicId }) =>
974
+ parse(await (await getMessagingClient()).deleteTopic(topicId)),
975
+ ),
976
+ );
977
+
978
+ messaging
979
+ .command(`list-topic-logs`)
980
+ .description(`Get the topic activity logs listed by its unique ID.`)
981
+ .requiredOption(`--topic-id <topic-id>`, `Topic ID.`)
982
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset`)
983
+ .option(
984
+ `--total [value]`,
985
+ `When set to false, the total count returned will be 0 and will not be calculated.`,
986
+ (value: string | undefined) =>
987
+ value === undefined ? true : parseBool(value),
988
+ )
989
+ .action(
990
+ actionRunner(
991
+ async ({ topicId, queries, total }) =>
992
+ parse(await (await getMessagingClient()).listTopicLogs(topicId, queries, total)),
993
+ ),
994
+ );
995
+
996
+ messaging
997
+ .command(`list-subscribers`)
998
+ .description(`Get a list of all subscribers from the current Appwrite project.`)
999
+ .requiredOption(`--topic-id <topic-id>`, `Topic ID. The topic ID subscribed to.`)
1000
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled`)
1001
+ .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1002
+ .option(
1003
+ `--total [value]`,
1004
+ `When set to false, the total count returned will be 0 and will not be calculated.`,
1005
+ (value: string | undefined) =>
1006
+ value === undefined ? true : parseBool(value),
1007
+ )
1008
+ .action(
1009
+ actionRunner(
1010
+ async ({ topicId, queries, search, total }) =>
1011
+ parse(await (await getMessagingClient()).listSubscribers(topicId, queries, search, total)),
1012
+ ),
1013
+ );
1014
+
1015
+ messaging
1016
+ .command(`create-subscriber`)
1017
+ .description(`Create a new subscriber.`)
1018
+ .requiredOption(`--topic-id <topic-id>`, `Topic ID. The topic ID to subscribe to.`)
1019
+ .requiredOption(`--subscriber-id <subscriber-id>`, `Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.`)
1020
+ .requiredOption(`--target-id <target-id>`, `Target ID. The target ID to link to the specified Topic ID.`)
1021
+ .action(
1022
+ actionRunner(
1023
+ async ({ topicId, subscriberId, targetId }) =>
1024
+ parse(await (await getMessagingClient()).createSubscriber(topicId, subscriberId, targetId)),
1025
+ ),
1026
+ );
1027
+
1028
+ messaging
1029
+ .command(`get-subscriber`)
1030
+ .description(`Get a subscriber by its unique ID.
1031
+ `)
1032
+ .requiredOption(`--topic-id <topic-id>`, `Topic ID. The topic ID subscribed to.`)
1033
+ .requiredOption(`--subscriber-id <subscriber-id>`, `Subscriber ID.`)
1034
+ .action(
1035
+ actionRunner(
1036
+ async ({ topicId, subscriberId }) =>
1037
+ parse(await (await getMessagingClient()).getSubscriber(topicId, subscriberId)),
1038
+ ),
1039
+ );
1040
+
1041
+ messaging
1042
+ .command(`delete-subscriber`)
1043
+ .description(`Delete a subscriber by its unique ID.`)
1044
+ .requiredOption(`--topic-id <topic-id>`, `Topic ID. The topic ID subscribed to.`)
1045
+ .requiredOption(`--subscriber-id <subscriber-id>`, `Subscriber ID.`)
1046
+ .action(
1047
+ actionRunner(
1048
+ async ({ topicId, subscriberId }) =>
1049
+ parse(await (await getMessagingClient()).deleteSubscriber(topicId, subscriberId)),
1050
+ ),
1051
+ );
1052
+