@forge/cli 0.0.0-experimental-deeb8f6 → 0.0.0-experimental-c8e9749

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 (319) hide show
  1. package/CHANGELOG.md +1110 -2
  2. package/npm-shrinkwrap.json +13212 -223
  3. package/out/analytics-client/analytics-client.d.ts +36 -0
  4. package/out/analytics-client/analytics-client.d.ts.map +1 -0
  5. package/out/analytics-client/analytics-client.js +140 -0
  6. package/out/analytics-client/analytics-message-handler.d.ts +21 -0
  7. package/out/analytics-client/analytics-message-handler.d.ts.map +1 -0
  8. package/out/analytics-client/analytics-message-handler.js +43 -0
  9. package/out/autocomplete/autocomplete-config.json +243 -0
  10. package/out/autocomplete/index.d.ts +5 -0
  11. package/out/autocomplete/index.d.ts.map +1 -0
  12. package/out/autocomplete/index.js +41 -0
  13. package/out/autocomplete/isSupportedShell.d.ts +2 -0
  14. package/out/autocomplete/isSupportedShell.d.ts.map +1 -0
  15. package/out/autocomplete/isSupportedShell.js +11 -0
  16. package/out/autocomplete/types.d.ts +14 -0
  17. package/out/autocomplete/types.d.ts.map +1 -0
  18. package/out/autocomplete/types.js +2 -0
  19. package/out/autocomplete/util.d.ts +6 -0
  20. package/out/autocomplete/util.d.ts.map +1 -0
  21. package/out/autocomplete/util.js +15 -0
  22. package/out/bin/cli.d.ts +1 -0
  23. package/out/bin/cli.d.ts.map +1 -1
  24. package/out/bin/cli.js +4 -1
  25. package/out/bin/postinstall.d.ts +2 -0
  26. package/out/bin/postinstall.d.ts.map +1 -0
  27. package/out/bin/postinstall.js +23 -0
  28. package/out/command-line/anon-user-id.d.ts +3 -0
  29. package/out/command-line/anon-user-id.d.ts.map +1 -0
  30. package/out/command-line/anon-user-id.js +17 -0
  31. package/out/command-line/command.d.ts +80 -0
  32. package/out/command-line/command.d.ts.map +1 -0
  33. package/out/command-line/command.js +408 -0
  34. package/out/command-line/controller/assertUnreachable.d.ts +2 -0
  35. package/out/command-line/controller/assertUnreachable.d.ts.map +1 -0
  36. package/out/command-line/controller/assertUnreachable.js +7 -0
  37. package/out/command-line/controller/autocomplete-controller.d.ts +12 -0
  38. package/out/command-line/controller/autocomplete-controller.d.ts.map +1 -0
  39. package/out/command-line/controller/autocomplete-controller.js +54 -0
  40. package/out/command-line/controller/deploy-controller.d.ts +42 -0
  41. package/out/command-line/controller/deploy-controller.d.ts.map +1 -0
  42. package/out/command-line/controller/deploy-controller.js +139 -0
  43. package/out/command-line/controller/feedback-controller.d.ts +9 -0
  44. package/out/command-line/controller/feedback-controller.d.ts.map +1 -0
  45. package/out/command-line/controller/feedback-controller.js +19 -0
  46. package/out/command-line/controller/getNodeVersion.d.ts +2 -0
  47. package/out/command-line/controller/getNodeVersion.d.ts.map +1 -0
  48. package/out/command-line/controller/getNodeVersion.js +7 -0
  49. package/out/command-line/controller/install-controller.d.ts +35 -0
  50. package/out/command-line/controller/install-controller.d.ts.map +1 -0
  51. package/out/command-line/controller/install-controller.js +157 -0
  52. package/out/command-line/controller/lint-controller.d.ts +9 -0
  53. package/out/command-line/controller/lint-controller.d.ts.map +1 -0
  54. package/out/command-line/controller/lint-controller.js +20 -0
  55. package/out/command-line/controller/pre-command-controller.d.ts +25 -0
  56. package/out/command-line/controller/pre-command-controller.d.ts.map +1 -0
  57. package/out/command-line/controller/pre-command-controller.js +57 -0
  58. package/out/command-line/controller/prerequisites-controller.d.ts +15 -0
  59. package/out/command-line/controller/prerequisites-controller.d.ts.map +1 -0
  60. package/out/command-line/controller/prerequisites-controller.js +41 -0
  61. package/out/command-line/controller/settings-controller.d.ts +19 -0
  62. package/out/command-line/controller/settings-controller.d.ts.map +1 -0
  63. package/out/command-line/controller/settings-controller.js +48 -0
  64. package/out/command-line/controller/stubController.d.ts +9 -0
  65. package/out/command-line/controller/stubController.d.ts.map +1 -0
  66. package/out/command-line/controller/stubController.js +15 -0
  67. package/out/command-line/controller/tunnel-controller.d.ts +14 -0
  68. package/out/command-line/controller/tunnel-controller.d.ts.map +1 -0
  69. package/out/command-line/controller/tunnel-controller.js +43 -0
  70. package/out/command-line/dependency-injection.d.ts +76 -0
  71. package/out/command-line/dependency-injection.d.ts.map +1 -0
  72. package/out/command-line/dependency-injection.js +211 -0
  73. package/out/command-line/environment.d.ts +2 -0
  74. package/out/command-line/environment.d.ts.map +1 -0
  75. package/out/command-line/environment.js +16 -0
  76. package/out/command-line/errors.d.ts +6 -0
  77. package/out/command-line/errors.d.ts.map +1 -0
  78. package/out/command-line/errors.js +12 -0
  79. package/out/command-line/index.d.ts +5 -0
  80. package/out/command-line/index.d.ts.map +1 -0
  81. package/out/command-line/index.js +73 -0
  82. package/out/command-line/register-app-commands.d.ts +10 -0
  83. package/out/command-line/register-app-commands.d.ts.map +1 -0
  84. package/out/command-line/register-app-commands.js +128 -0
  85. package/out/command-line/register-authentication-command.d.ts +16 -0
  86. package/out/command-line/register-authentication-command.d.ts.map +1 -0
  87. package/out/command-line/register-authentication-command.js +94 -0
  88. package/out/command-line/register-autocomplete-commands.d.ts +3 -0
  89. package/out/command-line/register-autocomplete-commands.d.ts.map +1 -0
  90. package/out/command-line/register-autocomplete-commands.js +14 -0
  91. package/out/command-line/register-contributors-commands.d.ts +3 -0
  92. package/out/command-line/register-contributors-commands.d.ts.map +1 -0
  93. package/out/command-line/register-contributors-commands.js +134 -0
  94. package/out/command-line/register-deployment-commands.d.ts +22 -0
  95. package/out/command-line/register-deployment-commands.d.ts.map +1 -0
  96. package/out/command-line/register-deployment-commands.js +16 -0
  97. package/out/command-line/register-environment-variables-commands.d.ts +3 -0
  98. package/out/command-line/register-environment-variables-commands.d.ts.map +1 -0
  99. package/out/command-line/register-environment-variables-commands.js +103 -0
  100. package/out/command-line/register-feedback-commands.d.ts +3 -0
  101. package/out/command-line/register-feedback-commands.d.ts.map +1 -0
  102. package/out/command-line/register-feedback-commands.js +32 -0
  103. package/out/command-line/register-installation-commands.d.ts +6 -0
  104. package/out/command-line/register-installation-commands.d.ts.map +1 -0
  105. package/out/command-line/register-installation-commands.js +143 -0
  106. package/out/command-line/register-lint-command.d.ts +8 -0
  107. package/out/command-line/register-lint-command.d.ts.map +1 -0
  108. package/out/command-line/register-lint-command.js +16 -0
  109. package/out/command-line/register-log-commands.d.ts +4 -0
  110. package/out/command-line/register-log-commands.d.ts.map +1 -0
  111. package/out/command-line/register-log-commands.js +139 -0
  112. package/out/command-line/register-providers-commands.d.ts +3 -0
  113. package/out/command-line/register-providers-commands.d.ts.map +1 -0
  114. package/out/command-line/register-providers-commands.js +44 -0
  115. package/out/command-line/register-settings-commands.d.ts +3 -0
  116. package/out/command-line/register-settings-commands.d.ts.map +1 -0
  117. package/out/command-line/register-settings-commands.js +39 -0
  118. package/out/command-line/register-tunnel-commands.d.ts +3 -0
  119. package/out/command-line/register-tunnel-commands.d.ts.map +1 -0
  120. package/out/command-line/register-tunnel-commands.js +15 -0
  121. package/out/command-line/register-webtrigger-commands.d.ts +3 -0
  122. package/out/command-line/register-webtrigger-commands.d.ts.map +1 -0
  123. package/out/command-line/register-webtrigger-commands.js +56 -0
  124. package/out/command-line/sentry.d.ts +4 -0
  125. package/out/command-line/sentry.d.ts.map +1 -0
  126. package/out/command-line/sentry.js +16 -0
  127. package/out/command-line/unique-machine-id.d.ts +3 -0
  128. package/out/command-line/unique-machine-id.d.ts.map +1 -0
  129. package/out/command-line/unique-machine-id.js +19 -0
  130. package/out/command-line/version-info.d.ts +9 -0
  131. package/out/command-line/version-info.d.ts.map +1 -0
  132. package/out/command-line/version-info.js +42 -0
  133. package/out/command-line/view/analytics-settings-view.d.ts +7 -0
  134. package/out/command-line/view/analytics-settings-view.d.ts.map +1 -0
  135. package/out/command-line/view/analytics-settings-view.js +18 -0
  136. package/out/command-line/view/deploy-view.d.ts +21 -0
  137. package/out/command-line/view/deploy-view.d.ts.map +1 -0
  138. package/out/command-line/view/deploy-view.js +58 -0
  139. package/out/command-line/view/install-view.d.ts +18 -0
  140. package/out/command-line/view/install-view.d.ts.map +1 -0
  141. package/out/command-line/view/install-view.js +56 -0
  142. package/out/command-line/view/lint-view.d.ts +12 -0
  143. package/out/command-line/view/lint-view.d.ts.map +1 -0
  144. package/out/command-line/view/lint-view.js +31 -0
  145. package/out/command-line/view/lite-lint-view.d.ts +10 -0
  146. package/out/command-line/view/lite-lint-view.d.ts.map +1 -0
  147. package/out/command-line/view/lite-lint-view.js +18 -0
  148. package/out/command-line/view/settings-view.d.ts +10 -0
  149. package/out/command-line/view/settings-view.d.ts.map +1 -0
  150. package/out/command-line/view/settings-view.js +26 -0
  151. package/out/command-line/view/tunnel-view.d.ts +20 -0
  152. package/out/command-line/view/tunnel-view.d.ts.map +1 -0
  153. package/out/command-line/view/tunnel-view.js +92 -0
  154. package/out/contributors/add-contributor.d.ts +17 -0
  155. package/out/contributors/add-contributor.d.ts.map +1 -0
  156. package/out/contributors/add-contributor.js +14 -0
  157. package/out/contributors/graphql-client.d.ts +14 -0
  158. package/out/contributors/graphql-client.d.ts.map +1 -0
  159. package/out/contributors/graphql-client.js +113 -0
  160. package/out/contributors/list-contributors.d.ts +18 -0
  161. package/out/contributors/list-contributors.d.ts.map +1 -0
  162. package/out/contributors/list-contributors.js +14 -0
  163. package/out/contributors/remove-contributors.d.ts +18 -0
  164. package/out/contributors/remove-contributors.d.ts.map +1 -0
  165. package/out/contributors/remove-contributors.js +14 -0
  166. package/out/deploy/deployer/deploy-monitor-graphql-client.d.ts +24 -0
  167. package/out/deploy/deployer/deploy-monitor-graphql-client.d.ts.map +1 -0
  168. package/out/deploy/deployer/deploy-monitor-graphql-client.js +57 -0
  169. package/out/deploy/deployer/deployer.d.ts +40 -0
  170. package/out/deploy/deployer/deployer.d.ts.map +1 -0
  171. package/out/deploy/deployer/deployer.js +187 -0
  172. package/out/deploy/deployer/index.d.ts +4 -0
  173. package/out/deploy/deployer/index.d.ts.map +1 -0
  174. package/out/deploy/deployer/index.js +6 -0
  175. package/out/deploy/deployer/trigger-deploy-graphql-client.d.ts +19 -0
  176. package/out/deploy/deployer/trigger-deploy-graphql-client.d.ts.map +1 -0
  177. package/out/deploy/deployer/trigger-deploy-graphql-client.js +49 -0
  178. package/out/deploy/index.d.ts +5 -0
  179. package/out/deploy/index.d.ts.map +1 -0
  180. package/out/deploy/index.js +7 -0
  181. package/out/deploy/package-upload-deploy.d.ts +20 -0
  182. package/out/deploy/package-upload-deploy.d.ts.map +1 -0
  183. package/out/deploy/package-upload-deploy.js +37 -0
  184. package/out/deploy/packager/archiver.d.ts +27 -0
  185. package/out/deploy/packager/archiver.d.ts.map +1 -0
  186. package/out/deploy/packager/archiver.js +76 -0
  187. package/out/deploy/packager/index.d.ts +3 -0
  188. package/out/deploy/packager/index.d.ts.map +1 -0
  189. package/out/deploy/packager/index.js +5 -0
  190. package/out/deploy/packager/nativeui-bundler.d.ts +12 -0
  191. package/out/deploy/packager/nativeui-bundler.d.ts.map +1 -0
  192. package/out/deploy/packager/nativeui-bundler.js +34 -0
  193. package/out/deploy/packager/packager.d.ts +32 -0
  194. package/out/deploy/packager/packager.d.ts.map +1 -0
  195. package/out/deploy/packager/packager.js +21 -0
  196. package/out/deploy/packager/runtime-bundler.d.ts +15 -0
  197. package/out/deploy/packager/runtime-bundler.d.ts.map +1 -0
  198. package/out/deploy/packager/runtime-bundler.js +53 -0
  199. package/out/deploy/uploader/artifact-graphql-client.d.ts +26 -0
  200. package/out/deploy/uploader/artifact-graphql-client.d.ts.map +1 -0
  201. package/out/deploy/uploader/artifact-graphql-client.js +100 -0
  202. package/out/deploy/uploader/index.d.ts +3 -0
  203. package/out/deploy/uploader/index.d.ts.map +1 -0
  204. package/out/deploy/uploader/index.js +5 -0
  205. package/out/deploy/uploader/uploader.d.ts +19 -0
  206. package/out/deploy/uploader/uploader.d.ts.map +1 -0
  207. package/out/deploy/uploader/uploader.js +43 -0
  208. package/out/environment-variables/delete-environment-variable.d.ts +18 -0
  209. package/out/environment-variables/delete-environment-variable.d.ts.map +1 -0
  210. package/out/environment-variables/delete-environment-variable.js +14 -0
  211. package/out/environment-variables/graphql-client.d.ts +16 -0
  212. package/out/environment-variables/graphql-client.d.ts.map +1 -0
  213. package/out/environment-variables/graphql-client.js +113 -0
  214. package/out/environment-variables/list-environment-variables.d.ts +22 -0
  215. package/out/environment-variables/list-environment-variables.d.ts.map +1 -0
  216. package/out/environment-variables/list-environment-variables.js +14 -0
  217. package/out/environment-variables/set-environment-variable.d.ts +20 -0
  218. package/out/environment-variables/set-environment-variable.d.ts.map +1 -0
  219. package/out/environment-variables/set-environment-variable.js +14 -0
  220. package/out/installations/graphql-client.d.ts +75 -0
  221. package/out/installations/graphql-client.d.ts.map +1 -0
  222. package/out/installations/graphql-client.js +423 -0
  223. package/out/installations/install-app-site.d.ts +21 -0
  224. package/out/installations/install-app-site.d.ts.map +1 -0
  225. package/out/installations/install-app-site.js +19 -0
  226. package/out/installations/shared.d.ts +5 -0
  227. package/out/installations/shared.d.ts.map +1 -0
  228. package/out/installations/shared.js +20 -0
  229. package/out/installations/site-translation/bitbucket.d.ts +24 -0
  230. package/out/installations/site-translation/bitbucket.d.ts.map +1 -0
  231. package/out/installations/site-translation/bitbucket.js +113 -0
  232. package/out/installations/site-translation/cloudid-products.d.ts +17 -0
  233. package/out/installations/site-translation/cloudid-products.d.ts.map +1 -0
  234. package/out/installations/site-translation/cloudid-products.js +89 -0
  235. package/out/installations/site-translation/index.d.ts +4 -0
  236. package/out/installations/site-translation/index.d.ts.map +1 -0
  237. package/out/installations/site-translation/index.js +6 -0
  238. package/out/installations/site-translation/site-translation.d.ts +12 -0
  239. package/out/installations/site-translation/site-translation.d.ts.map +1 -0
  240. package/out/installations/site-translation/site-translation.js +2 -0
  241. package/out/installations/uninstall-app.d.ts +25 -0
  242. package/out/installations/uninstall-app.d.ts.map +1 -0
  243. package/out/installations/uninstall-app.js +43 -0
  244. package/out/migration-keys/graphql-client.d.ts +8 -0
  245. package/out/migration-keys/graphql-client.d.ts.map +1 -0
  246. package/out/migration-keys/graphql-client.js +55 -0
  247. package/out/providers/configure-provider.d.ts +19 -0
  248. package/out/providers/configure-provider.d.ts.map +1 -0
  249. package/out/providers/configure-provider.js +14 -0
  250. package/out/providers/graphql-client.d.ts +8 -0
  251. package/out/providers/graphql-client.d.ts.map +1 -0
  252. package/out/providers/graphql-client.js +45 -0
  253. package/out/service/cached-config-service.d.ts +8 -0
  254. package/out/service/cached-config-service.d.ts.map +1 -0
  255. package/out/service/cached-config-service.js +16 -0
  256. package/out/service/command-suggestion-service.d.ts +4 -0
  257. package/out/service/command-suggestion-service.d.ts.map +1 -0
  258. package/out/service/command-suggestion-service.js +17 -0
  259. package/out/service/docker-service.d.ts +24 -0
  260. package/out/service/docker-service.d.ts.map +1 -0
  261. package/out/service/docker-service.js +71 -0
  262. package/out/service/installation-service.d.ts +51 -0
  263. package/out/service/installation-service.d.ts.map +1 -0
  264. package/out/service/installation-service.js +91 -0
  265. package/out/service/lint-service.d.ts +23 -0
  266. package/out/service/lint-service.d.ts.map +1 -0
  267. package/out/service/lint-service.js +39 -0
  268. package/out/service/lite-lint-service.d.ts +10 -0
  269. package/out/service/lite-lint-service.d.ts.map +1 -0
  270. package/out/service/lite-lint-service.js +27 -0
  271. package/out/service/migration-keys-service.d.ts +19 -0
  272. package/out/service/migration-keys-service.d.ts.map +1 -0
  273. package/out/service/migration-keys-service.js +14 -0
  274. package/out/service/port-finding-service.d.ts +12 -0
  275. package/out/service/port-finding-service.d.ts.map +1 -0
  276. package/out/service/port-finding-service.js +34 -0
  277. package/out/service/resource-packaging-service.d.ts +46 -0
  278. package/out/service/resource-packaging-service.d.ts.map +1 -0
  279. package/out/service/resource-packaging-service.js +132 -0
  280. package/out/service/resources-uploader-service.d.ts +16 -0
  281. package/out/service/resources-uploader-service.d.ts.map +1 -0
  282. package/out/service/resources-uploader-service.js +39 -0
  283. package/out/service/tunnel-analytics-service.d.ts +11 -0
  284. package/out/service/tunnel-analytics-service.d.ts.map +1 -0
  285. package/out/service/tunnel-analytics-service.js +24 -0
  286. package/out/service/tunnel-service.d.ts +41 -0
  287. package/out/service/tunnel-service.d.ts.map +1 -0
  288. package/out/service/tunnel-service.js +196 -0
  289. package/out/storage/local-file-storage.d.ts +17 -0
  290. package/out/storage/local-file-storage.d.ts.map +1 -0
  291. package/out/storage/local-file-storage.js +53 -0
  292. package/out/webtrigger/get-webtrigger-url.d.ts +27 -0
  293. package/out/webtrigger/get-webtrigger-url.d.ts.map +1 -0
  294. package/out/webtrigger/get-webtrigger-url.js +26 -0
  295. package/out/webtrigger/graphql-client.d.ts +14 -0
  296. package/out/webtrigger/graphql-client.d.ts.map +1 -0
  297. package/out/webtrigger/graphql-client.js +52 -0
  298. package/out/workers/analytics-message-worker.d.ts +12 -0
  299. package/out/workers/analytics-message-worker.d.ts.map +1 -0
  300. package/out/workers/analytics-message-worker.js +29 -0
  301. package/out/workers/forge-cli-workers.d.ts +2 -0
  302. package/out/workers/forge-cli-workers.d.ts.map +1 -0
  303. package/out/workers/forge-cli-workers.js +21 -0
  304. package/out/workers/tunnel-clean-up-worker.d.ts +8 -0
  305. package/out/workers/tunnel-clean-up-worker.d.ts.map +1 -0
  306. package/out/workers/tunnel-clean-up-worker.js +31 -0
  307. package/out/workers/version-check-worker.d.ts +8 -0
  308. package/out/workers/version-check-worker.d.ts.map +1 -0
  309. package/out/workers/version-check-worker.js +20 -0
  310. package/out/workers/worker-info.d.ts +8 -0
  311. package/out/workers/worker-info.d.ts.map +1 -0
  312. package/out/workers/worker-info.js +15 -0
  313. package/out/workers/worker.d.ts +6 -0
  314. package/out/workers/worker.d.ts.map +1 -0
  315. package/out/workers/worker.js +9 -0
  316. package/out/workers/workers-starter.d.ts +5 -0
  317. package/out/workers/workers-starter.d.ts.map +1 -0
  318. package/out/workers/workers-starter.js +22 -0
  319. package/package.json +60 -5
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerCommands = exports.createCommandHandler = exports.directoryNameFromAppName = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fs_1 = tslib_1.__importDefault(require("fs"));
6
+ const sanitize_filename_1 = tslib_1.__importDefault(require("sanitize-filename"));
7
+ const cli_shared_1 = require("@forge/cli-shared");
8
+ const cli_shared_2 = require("@forge/cli-shared");
9
+ var TemplateCategory;
10
+ (function (TemplateCategory) {
11
+ TemplateCategory["SHOW_ALL"] = "Show All";
12
+ TemplateCategory["CUSTOM_UI"] = "Custom UI";
13
+ TemplateCategory["BACKEND"] = "Triggers and Validators";
14
+ TemplateCategory["UI_KIT"] = "UI kit";
15
+ })(TemplateCategory || (TemplateCategory = {}));
16
+ function ensureDirectoryDoesntExist(directory) {
17
+ if (fs_1.default.existsSync(directory)) {
18
+ throw new cli_shared_1.ValidationError(cli_shared_1.Text.create.error.directory.exists(directory));
19
+ }
20
+ }
21
+ function ensureValidNameLength(name) {
22
+ if (name.length <= 0 || name.length > 50) {
23
+ throw new cli_shared_1.ValidationError(cli_shared_1.Text.create.error.name.tooLong());
24
+ }
25
+ }
26
+ function directoryNameFromAppName(appName) {
27
+ if (appName === undefined) {
28
+ return undefined;
29
+ }
30
+ const normalized = (0, sanitize_filename_1.default)(appName.trim()).trim().replace(/ /g, '-');
31
+ const chars = Array.from(normalized);
32
+ const allDashes = chars.every((char) => char === '-');
33
+ return allDashes ? undefined : normalized;
34
+ }
35
+ exports.directoryNameFromAppName = directoryNameFromAppName;
36
+ async function createCommandHandler(ui, createAppCommand, name, { template, directory }) {
37
+ if (directory) {
38
+ ensureDirectoryDoesntExist(directory);
39
+ ui.info(cli_shared_1.Text.create.intro(directory));
40
+ }
41
+ else {
42
+ directory = directoryNameFromAppName(name) || template;
43
+ if (directory) {
44
+ ensureDirectoryDoesntExist(directory);
45
+ }
46
+ const currentDirectory = process.cwd();
47
+ ui.info(cli_shared_1.Text.create.introWithCurrentDirectory(currentDirectory));
48
+ }
49
+ ui.info(cli_shared_1.Text.ctrlC);
50
+ if (!name) {
51
+ ui.info(cli_shared_1.Text.create.overviewAppName);
52
+ name = await ui.promptForText(cli_shared_1.Text.create.promptName);
53
+ if (!directory) {
54
+ directory = directoryNameFromAppName(name) || template;
55
+ if (directory) {
56
+ ensureDirectoryDoesntExist(directory);
57
+ }
58
+ }
59
+ }
60
+ ensureValidNameLength(name);
61
+ if (!template) {
62
+ ui.info(cli_shared_1.Text.create.overviewTemplates);
63
+ const templates = await ui.displayTemporaryMessage(() => createAppCommand.getAvailableTemplates(), cli_shared_1.Text.create.waitTemplates);
64
+ const type = await ui.promptForList(cli_shared_1.Text.create.promptCategory, Object.values(TemplateCategory));
65
+ const filteredTemplates = type === TemplateCategory.SHOW_ALL
66
+ ? templates
67
+ : templates
68
+ .filter((name) => {
69
+ switch (type) {
70
+ case TemplateCategory.BACKEND:
71
+ return !name.includes('ui-kit') && !name.includes('custom-ui') && name !== 'blank';
72
+ case TemplateCategory.CUSTOM_UI:
73
+ return name.includes('custom-ui');
74
+ case TemplateCategory.UI_KIT:
75
+ return name.includes('ui-kit');
76
+ }
77
+ })
78
+ .map((name) => name.replace('-ui-kit', '').replace('-custom-ui', ''));
79
+ template = await ui.promptForList(cli_shared_1.Text.create.promptTemplate, filteredTemplates);
80
+ if (type === TemplateCategory.UI_KIT) {
81
+ template = `${template}-ui-kit`;
82
+ }
83
+ if (type === TemplateCategory.CUSTOM_UI) {
84
+ template = `${template}-custom-ui`;
85
+ }
86
+ if (!directory) {
87
+ directory = template;
88
+ ensureDirectoryDoesntExist(directory);
89
+ }
90
+ }
91
+ ui.emptyLine();
92
+ const result = await ui.displayProgress(() => createAppCommand.execute({ name, template, directory }), cli_shared_1.Text.create.cmd.start, cli_shared_1.Text.create.cmd.success(name));
93
+ ui.info(cli_shared_1.Text.create.cmd.successDetails(directory, cli_shared_2.VALID_ENVIRONMENT_OPTIONS));
94
+ return result;
95
+ }
96
+ exports.createCommandHandler = createCommandHandler;
97
+ function registerCreateCommands({ cmd, ui, commands: { createAppCommand } }) {
98
+ cmd
99
+ .command('create [name]')
100
+ .description(cli_shared_1.Text.create.cmd.desc)
101
+ .option('-t, --template <template name>', cli_shared_1.Text.create.optionTemplate)
102
+ .option('-d, --directory <directory name>', cli_shared_1.Text.create.optionDirectory)
103
+ .action((name, options) => createCommandHandler(ui, createAppCommand, name, options));
104
+ }
105
+ function registerRegisterCommand({ cmd, ui, commands: { registerAppCommand } }) {
106
+ cmd
107
+ .command('register [name]')
108
+ .description(cli_shared_1.Text.register.cmd.desc)
109
+ .requireManifestFile()
110
+ .action(async (name) => {
111
+ ui.info(cli_shared_1.Text.register.intro);
112
+ ui.info(cli_shared_1.Text.ctrlC);
113
+ ui.emptyLine();
114
+ if (!name) {
115
+ ui.info(cli_shared_1.Text.create.overviewAppName);
116
+ name = await ui.promptForText(cli_shared_1.Text.create.promptName);
117
+ ui.emptyLine();
118
+ }
119
+ const result = await ui.displayProgress(() => registerAppCommand.execute({ name }), cli_shared_1.Text.register.cmd.start, cli_shared_1.Text.register.cmd.success(name));
120
+ ui.info(cli_shared_1.Text.register.cmd.successDetails(cli_shared_2.VALID_ENVIRONMENT_OPTIONS));
121
+ return result;
122
+ });
123
+ }
124
+ function registerCommands(deps) {
125
+ registerCreateCommands(deps);
126
+ registerRegisterCommand(deps);
127
+ }
128
+ exports.registerCommands = registerCommands;
@@ -0,0 +1,16 @@
1
+ import { PersonalApiCredentialsValidated } from '@forge/cli-shared';
2
+ import { CommandLineUI, LoginCommand } from '@forge/cli-shared';
3
+ import { Dependencies } from './dependency-injection';
4
+ export interface LoginCommandOptions {
5
+ email: string;
6
+ token: string;
7
+ }
8
+ export declare function loginCommandHandler(ui: CommandLineUI, instructionsUrl: string, loginCommand: LoginCommand, { email, token }: LoginCommandOptions): Promise<{
9
+ creds: PersonalApiCredentialsValidated;
10
+ analytics: {
11
+ userId: string;
12
+ anonymousId: string | undefined;
13
+ };
14
+ }>;
15
+ export declare function registerCommands(deps: Dependencies): void;
16
+ //# sourceMappingURL=register-authentication-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-authentication-command.d.ts","sourceRoot":"","sources":["../../src/command-line/register-authentication-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,+BAA+B,EAIhC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAQ,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAYtD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,mBAAmB,CACvC,EAAE,EAAE,aAAa,EACjB,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,YAAY,EAC1B,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,mBAAmB,GACpC,OAAO,CAAC;IAAE,KAAK,EAAE,+BAA+B,CAAC;IAAC,SAAS,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAA;CAAE,CAAC,CAoCrH;AAiDD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,QAIlD"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerCommands = exports.loginCommandHandler = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const child_process_1 = tslib_1.__importDefault(require("child_process"));
6
+ const cli_shared_1 = require("@forge/cli-shared");
7
+ const cli_shared_2 = require("@forge/cli-shared");
8
+ const anon_user_id_1 = require("./anon-user-id");
9
+ function guessEmail() {
10
+ const child = child_process_1.default.spawnSync('git', ['config', '--global', 'user.email'], { encoding: 'utf8', shell: true });
11
+ if (child.status || child.error) {
12
+ return undefined;
13
+ }
14
+ return child.stdout.trim();
15
+ }
16
+ async function loginCommandHandler(ui, instructionsUrl, loginCommand, { email, token }) {
17
+ try {
18
+ ui.info(cli_shared_2.Text.login.introText);
19
+ ui.info(cli_shared_2.Text.ctrlC);
20
+ ui.emptyLine();
21
+ if (!email) {
22
+ const maybeEmail = guessEmail();
23
+ email = await ui.promptForText(cli_shared_2.Text.login.promptEmail, maybeEmail);
24
+ ui.emptyLine();
25
+ }
26
+ if (!token) {
27
+ ui.info(cli_shared_2.Text.login.url(instructionsUrl));
28
+ ui.emptyLine();
29
+ token = await ui.promptForSecret(cli_shared_2.Text.login.promptToken);
30
+ ui.emptyLine();
31
+ }
32
+ const { creds, analytics } = await ui.displayProgress(() => loginCommand.execute({ email, token }), cli_shared_2.Text.login.checking, (data) => cli_shared_2.Text.login.success(data.user.name));
33
+ ui.emptyLine();
34
+ ui.info(cli_shared_2.Text.login.nextStep);
35
+ return {
36
+ creds,
37
+ analytics: Object.assign(Object.assign({}, analytics), { anonymousId: (0, anon_user_id_1.getAnonId)(true) })
38
+ };
39
+ }
40
+ catch (error) {
41
+ throw error instanceof cli_shared_1.UserNotFoundError ? new cli_shared_1.UserNotFoundError(cli_shared_2.Text.login.error) : error;
42
+ }
43
+ }
44
+ exports.loginCommandHandler = loginCommandHandler;
45
+ function registerLoginCommand({ cmd, ui, graphqlGateway, commands: { loginCommand } }) {
46
+ const instructionsUrl = (0, cli_shared_1.getInstructionsUrl)(graphqlGateway);
47
+ cmd
48
+ .command('login')
49
+ .description(cli_shared_2.Text.login.cmd)
50
+ .option('-u, --email <user email>', cli_shared_2.Text.login.optionEmail)
51
+ .option('-t, --token <api token>', cli_shared_2.Text.login.optionToken)
52
+ .requireNoAuthentication()
53
+ .nonInteractiveOption('--email', '--token')
54
+ .action((options) => loginCommandHandler(ui, instructionsUrl, loginCommand, options));
55
+ }
56
+ function registerLogoutCommand({ cmd, ui, commands: { logoutCommand } }) {
57
+ cmd
58
+ .command('logout')
59
+ .description(cli_shared_2.Text.logout.cmd)
60
+ .requireNoAuthentication()
61
+ .action(async () => {
62
+ await logoutCommand.execute();
63
+ ui.info(cli_shared_2.Text.logout.loggedOut);
64
+ });
65
+ }
66
+ function registerWhoAmICommand({ cmd, ui, services: { credentialStore }, commands: { loginCommand } }) {
67
+ cmd
68
+ .command('whoami')
69
+ .description(cli_shared_2.Text.whoami.cmd)
70
+ .action(async () => {
71
+ try {
72
+ const credentials = await credentialStore.getCredentials();
73
+ const { name, accountId } = await loginCommand.getUser(credentials);
74
+ ui.info(cli_shared_2.Text.whoami.success.personalCredentials(credentials.email, name, accountId));
75
+ }
76
+ catch (error) {
77
+ if (error instanceof cli_shared_1.UserNotFoundError) {
78
+ if (process.env[cli_shared_1.EMAIL_KEY] && process.env[cli_shared_1.API_TOKEN_KEY]) {
79
+ throw new cli_shared_1.UserNotFoundError(cli_shared_2.Text.whoami.error.personalCredentialsEnv(cli_shared_1.EMAIL_KEY, cli_shared_1.API_TOKEN_KEY));
80
+ }
81
+ else {
82
+ throw new cli_shared_1.UserNotFoundError(cli_shared_2.Text.whoami.error.personalCredentialsKeytar);
83
+ }
84
+ }
85
+ throw error;
86
+ }
87
+ });
88
+ }
89
+ function registerCommands(deps) {
90
+ registerLoginCommand(deps);
91
+ registerLogoutCommand(deps);
92
+ registerWhoAmICommand(deps);
93
+ }
94
+ exports.registerCommands = registerCommands;
@@ -0,0 +1,3 @@
1
+ import { Dependencies } from './dependency-injection';
2
+ export declare const registerCommands: ({ cmd, controllers: { autocompleteController } }: Dependencies) => void;
3
+ //# sourceMappingURL=register-autocomplete-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-autocomplete-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-autocomplete-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAItD,eAAO,MAAM,gBAAgB,qDAAsD,YAAY,KAAG,IAQjG,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerCommands = void 0;
4
+ const cli_shared_1 = require("@forge/cli-shared");
5
+ const registerCommands = ({ cmd, controllers: { autocompleteController } }) => {
6
+ cmd
7
+ .command('autocomplete [install|uninstall]')
8
+ .requireNoAuthentication()
9
+ .description(cli_shared_1.Text.autocomplete.cmd.desc)
10
+ .action(async (arg) => {
11
+ await autocompleteController.run(arg);
12
+ });
13
+ };
14
+ exports.registerCommands = registerCommands;
@@ -0,0 +1,3 @@
1
+ import { Dependencies } from './dependency-injection';
2
+ export declare const registerCommands: (deps: Dependencies) => void;
3
+ //# sourceMappingURL=register-contributors-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-contributors-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-contributors-commands.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AA6KtD,eAAO,MAAM,gBAAgB,SAAU,YAAY,KAAG,IAOrD,CAAC"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerCommands = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const cli_shared_1 = require("@forge/cli-shared");
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const COMMAND_NAME = 'contributors';
8
+ const registerAddContributorCommand = (parent, { ui, commands: { addContributorCommand } }) => {
9
+ parent
10
+ .command('add')
11
+ .requireAppId()
12
+ .description(cli_shared_1.Text.addContributor.cmd.desc)
13
+ .option('-u, --email [email]', cli_shared_1.Text.addContributor.optionContributorEmail)
14
+ .option('--confirm-add-contributor', cli_shared_1.Text.addContributor.optionSkipConfirmation)
15
+ .nonInteractiveOption('--email')
16
+ .action(async ({ email, confirmAddContributor, nonInteractive }) => {
17
+ ui.info(cli_shared_1.Text.addContributor.overview);
18
+ ui.info(cli_shared_1.Text.ctrlC);
19
+ ui.emptyLine();
20
+ if (!email) {
21
+ ui.info(cli_shared_1.Text.addContributor.contributorEmailInfo);
22
+ ui.emptyLine();
23
+ email = await ui.promptForText(cli_shared_1.Text.addContributor.promptContributorEmail);
24
+ ui.emptyLine();
25
+ }
26
+ if (nonInteractive) {
27
+ confirmAddContributor = true;
28
+ }
29
+ if (!confirmAddContributor) {
30
+ ui.info(cli_shared_1.Text.addContributor.confirmationInfo);
31
+ ui.emptyLine();
32
+ confirmAddContributor = await ui.confirm(cli_shared_1.Text.addContributor.promptConfirmation);
33
+ if (confirmAddContributor)
34
+ ui.emptyLine();
35
+ }
36
+ if (confirmAddContributor) {
37
+ await ui.displayProgress(() => addContributorCommand.execute({ email }), cli_shared_1.Text.addContributor.cmd.start, cli_shared_1.Text.addContributor.cmd.success);
38
+ }
39
+ });
40
+ };
41
+ const registerListContributorsCommand = (parent, { ui, commands: { listContributorCommand } }) => {
42
+ parent
43
+ .command('list')
44
+ .requireAppId()
45
+ .description(cli_shared_1.Text.listContributors.cmd.desc)
46
+ .action(async () => {
47
+ const contributors = await listContributorCommand.execute();
48
+ ui.table([
49
+ ['name', 'Name'],
50
+ ['email', 'Email']
51
+ ], contributors.map((contributor) => {
52
+ var _a;
53
+ const name = [contributor.publicName];
54
+ if (contributor.isOwner) {
55
+ name.push(cli_shared_1.Text.listContributors.appOwner);
56
+ }
57
+ if (contributor.accountStatus !== 'active') {
58
+ name.push(cli_shared_1.Text.listContributors.userInactive);
59
+ }
60
+ return {
61
+ name: name.join(' '),
62
+ email: (_a = contributor.email) !== null && _a !== void 0 ? _a : 'Email Not Visible'
63
+ };
64
+ }), {
65
+ emptyMessage: cli_shared_1.Text.listContributors.noContributors,
66
+ preMessage: cli_shared_1.Text.listContributors.banner
67
+ });
68
+ });
69
+ };
70
+ const registerRemoveContributorsCommand = (parent, { ui, commands: { listContributorCommand, removeContributorsCommand } }) => {
71
+ parent
72
+ .command('remove')
73
+ .requireAppId()
74
+ .description(cli_shared_1.Text.removeContributors.cmd.desc)
75
+ .option('-u, --email [emails...]', cli_shared_1.Text.removeContributors.optionContributorEmail)
76
+ .option('--confirm-remove-contributors', cli_shared_1.Text.removeContributors.optionSkipConfirmation)
77
+ .nonInteractiveOption('--email')
78
+ .action(async ({ email, confirmRemoveContributors, nonInteractive }) => {
79
+ let accountIds;
80
+ let accountReferences = email;
81
+ if (!email) {
82
+ const contributors = await listContributorCommand.execute();
83
+ const nonOwners = contributors.filter((contributor) => !contributor.isOwner);
84
+ if (nonOwners.length === 0) {
85
+ ui.info(cli_shared_1.Text.removeContributors.addContributorMessage);
86
+ ui.emptyLine();
87
+ return;
88
+ }
89
+ const selectedContributorsIndexes = await ui.promptForTable(cli_shared_1.Text.removeContributors.promptContributorEmail, cli_shared_1.Text.removeContributors.overview, ['Name', 'Email'], nonOwners.map((contributor) => {
90
+ var _a;
91
+ const name = [contributor.publicName];
92
+ if (contributor.accountStatus !== 'active') {
93
+ name.push(cli_shared_1.Text.listContributors.userInactive);
94
+ }
95
+ return {
96
+ names: [name.join(' '), (_a = contributor.email) !== null && _a !== void 0 ? _a : 'Email Not Visible'],
97
+ value: contributor.accountId
98
+ };
99
+ }));
100
+ accountIds = selectedContributorsIndexes.map((index) => nonOwners[index].accountId);
101
+ accountReferences = selectedContributorsIndexes.map((index) => nonOwners[index].publicName);
102
+ }
103
+ if (!accountReferences) {
104
+ return;
105
+ }
106
+ if (nonInteractive) {
107
+ confirmRemoveContributors = true;
108
+ }
109
+ if (!confirmRemoveContributors) {
110
+ ui.info(cli_shared_1.Text.removeContributors.confirmationInfo);
111
+ ui.emptyLine();
112
+ accountReferences.forEach((name) => {
113
+ ui.info(chalk_1.default.grey(name));
114
+ });
115
+ ui.emptyLine();
116
+ confirmRemoveContributors = await ui.confirm(cli_shared_1.Text.removeContributors.promptConfirmation);
117
+ if (confirmRemoveContributors)
118
+ ui.emptyLine();
119
+ }
120
+ if (confirmRemoveContributors) {
121
+ await ui.displayProgress(() => removeContributorsCommand.execute({ emails: email, accountIds }), cli_shared_1.Text.removeContributors.cmd.start, cli_shared_1.Text.removeContributors.cmd.success);
122
+ ui.emptyLine();
123
+ ui.info(cli_shared_1.Text.removeContributors.commandSuccessMessage(accountReferences));
124
+ }
125
+ });
126
+ };
127
+ const registerCommands = (deps) => {
128
+ const { cmd } = deps;
129
+ const contributors = cmd.command(COMMAND_NAME).description(cli_shared_1.Text.contributors.desc);
130
+ registerAddContributorCommand(contributors, deps);
131
+ registerListContributorsCommand(contributors, deps);
132
+ registerRemoveContributorsCommand(contributors, deps);
133
+ };
134
+ exports.registerCommands = registerCommands;
@@ -0,0 +1,22 @@
1
+ import { Dependencies } from './dependency-injection';
2
+ export interface DeploymentResult {
3
+ analytics: {
4
+ moduleList?: string[];
5
+ hostedResourceList: {
6
+ rawSize: string;
7
+ zipSize: string;
8
+ extensionList: string[];
9
+ fileCount: number;
10
+ }[];
11
+ egressPermissionList?: {
12
+ type: string;
13
+ domains: string[] | undefined;
14
+ }[];
15
+ connectKey?: {
16
+ action?: string;
17
+ value?: string;
18
+ };
19
+ };
20
+ }
21
+ export declare const registerCommands: ({ cmd, controllers: { deployController } }: Dependencies) => void;
22
+ //# sourceMappingURL=register-deployment-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-deployment-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-deployment-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE;QACT,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,kBAAkB,EAAE;YAClB,OAAO,EAAE,MAAM,CAAC;YAChB,OAAO,EAAE,MAAM,CAAC;YAChB,aAAa,EAAE,MAAM,EAAE,CAAC;YACxB,SAAS,EAAE,MAAM,CAAC;SACnB,EAAE,CAAC;QACJ,oBAAoB,CAAC,EAAE;YACrB,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;SAC/B,EAAE,CAAC;QACJ,UAAU,CAAC,EAAE;YACX,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;KACH,CAAC;CACH;AAID,eAAO,MAAM,gBAAgB,+CAAgD,YAAY,SASxF,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerCommands = void 0;
4
+ const cli_shared_1 = require("@forge/cli-shared");
5
+ const DEPLOY_COMMAND_NAME = 'deploy';
6
+ const registerCommands = ({ cmd, controllers: { deployController } }) => {
7
+ cmd
8
+ .command(DEPLOY_COMMAND_NAME)
9
+ .requireAppId()
10
+ .description(cli_shared_1.Text.deploy.cmd.desc)
11
+ .option('-f, --no-verify', 'Disable pre-deployment checks')
12
+ .environmentOption()
13
+ .nonInteractiveOption()
14
+ .action(async (opts) => deployController.run(opts));
15
+ };
16
+ exports.registerCommands = registerCommands;
@@ -0,0 +1,3 @@
1
+ import { Dependencies } from './dependency-injection';
2
+ export declare const registerCommands: ({ cmd, ...deps }: Dependencies) => void;
3
+ //# sourceMappingURL=register-environment-variables-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-environment-variables-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-environment-variables-commands.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AA2HtD,eAAO,MAAM,gBAAgB,qBAAsB,YAAY,KAAG,IAOjE,CAAC"}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerCommands = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const cli_shared_1 = require("@forge/cli-shared");
6
+ const cli_shared_2 = require("@forge/cli-shared");
7
+ const COMMAND_NAME = 'variables';
8
+ const SET_COMMAND_NAME = 'set';
9
+ const registerSetEnvironmentVariableCommand = ({ cmd, ui, commands: { setEnvironmentVariableCommand } }) => {
10
+ cmd
11
+ .command(`${SET_COMMAND_NAME} [key] [value]`)
12
+ .requireAppId()
13
+ .description(cli_shared_1.Text.varsSet.cmd.desc)
14
+ .option('--encrypt', cli_shared_1.Text.varsSet.optionSecret, false)
15
+ .environmentOption()
16
+ .action(async (key, value, { environment, encrypt }) => {
17
+ ui.info(cli_shared_1.Text.varsSet.overview(environment, cli_shared_2.environmentToOption));
18
+ ui.info(cli_shared_1.Text.ctrlC);
19
+ ui.emptyLine();
20
+ if (!value && !encrypt) {
21
+ ui.info(cli_shared_1.Text.varsSet.encryptInfo);
22
+ ui.emptyLine();
23
+ encrypt =
24
+ (await ui.promptForList(cli_shared_1.Text.varsSet.promptEncrypt, [cli_shared_1.Text.varsSet.yes, cli_shared_1.Text.varsSet.no])) ===
25
+ cli_shared_1.Text.varsSet.yes;
26
+ ui.emptyLine();
27
+ }
28
+ if (!key) {
29
+ ui.info(cli_shared_1.Text.varsSet.keyInfo);
30
+ ui.emptyLine();
31
+ key = await ui.promptForText(cli_shared_1.Text.varsSet.promptKey);
32
+ }
33
+ if (!value) {
34
+ value = encrypt
35
+ ? await ui.promptForSecret(cli_shared_1.Text.varsSet.promptValue)
36
+ : await ui.promptForText(cli_shared_1.Text.varsSet.promptValue);
37
+ ui.emptyLine();
38
+ }
39
+ await ui.displayProgress(() => setEnvironmentVariableCommand.execute({ environment, encrypt, key, value }), cli_shared_1.Text.varsSet.cmd.start, cli_shared_1.Text.varsSet.cmd.success);
40
+ ui.info(cli_shared_1.Text.varsList.hint);
41
+ });
42
+ };
43
+ const UNSET_COMMAND_NAME = 'unset';
44
+ const registerDeleteEnvironmentVariableCommand = ({ cmd, ui, commands: { deleteEnvironmentVariableCommand } }) => {
45
+ cmd
46
+ .command(`${UNSET_COMMAND_NAME} <key>`)
47
+ .requireAppId()
48
+ .description(cli_shared_1.Text.varsUnset.cmd.desc)
49
+ .environmentOption()
50
+ .action(async (key, { environment }) => {
51
+ ui.info(cli_shared_1.Text.varsUnset.cmd.start(environment, cli_shared_2.environmentToOption));
52
+ ui.info(cli_shared_1.Text.ctrlC);
53
+ await deleteEnvironmentVariableCommand.execute({ environment, key });
54
+ ui.info(cli_shared_1.Text.varsUnset.cmd.success(key));
55
+ ui.info(cli_shared_1.Text.varsList.hint);
56
+ });
57
+ };
58
+ const LIST_COMMAND_NAME = 'list';
59
+ const registerListEnvironmentVariableCommand = ({ cmd, ui, commands: { listEnvironmentVariablesCommand } }) => {
60
+ cmd
61
+ .command(LIST_COMMAND_NAME)
62
+ .requireAppId()
63
+ .description(cli_shared_1.Text.varsList.cmd)
64
+ .environmentOption()
65
+ .jsonOption()
66
+ .action(async ({ environment, json }) => {
67
+ const variables = await listEnvironmentVariablesCommand.execute({ environment });
68
+ ui.table([
69
+ ['encrypted', 'Encrypted?'],
70
+ ['key', 'Key'],
71
+ ['value', 'Value']
72
+ ], variables === null || variables === void 0 ? void 0 : variables.map(({ encrypt: encrypted, key, value }) => ({
73
+ encrypted,
74
+ key,
75
+ value: encrypted ? cli_shared_1.Text.varsList.encryptedValue : value
76
+ })), {
77
+ json,
78
+ emptyMessage: cli_shared_1.Text.varsList.empty(environment, cli_shared_2.environmentToOption),
79
+ preMessage: cli_shared_1.Text.varsList.overview(environment, cli_shared_2.environmentToOption),
80
+ postMessage: cli_shared_1.Text.varsList.postfix,
81
+ format: {
82
+ encrypted: (value) => (value ? '✔' : '')
83
+ }
84
+ });
85
+ });
86
+ };
87
+ const DEPRECATED_SET_COMMAND = 'variables:set';
88
+ const DEPRECATED_UNSET_COMMAND = 'variables:unset';
89
+ const DEPRECATED_LIST_COMMAND = 'variables:list';
90
+ const registerVariablesSubcommandStubs = ({ cmd, controllers: { stubController } }) => {
91
+ cmd.deprecatedCommand(DEPRECATED_SET_COMMAND, `${COMMAND_NAME} ${SET_COMMAND_NAME}`, stubController);
92
+ cmd.deprecatedCommand(DEPRECATED_UNSET_COMMAND, `${COMMAND_NAME} ${UNSET_COMMAND_NAME}`, stubController);
93
+ cmd.deprecatedCommand(DEPRECATED_LIST_COMMAND, `${COMMAND_NAME} ${LIST_COMMAND_NAME}`, stubController);
94
+ };
95
+ const registerCommands = (_a) => {
96
+ var { cmd } = _a, deps = tslib_1.__rest(_a, ["cmd"]);
97
+ const variables = cmd.command(COMMAND_NAME).description(cli_shared_1.Text.variables.description);
98
+ registerVariablesSubcommandStubs(Object.assign({ cmd }, deps));
99
+ registerSetEnvironmentVariableCommand(Object.assign({ cmd: variables }, deps));
100
+ registerDeleteEnvironmentVariableCommand(Object.assign({ cmd: variables }, deps));
101
+ registerListEnvironmentVariableCommand(Object.assign({ cmd: variables }, deps));
102
+ };
103
+ exports.registerCommands = registerCommands;
@@ -0,0 +1,3 @@
1
+ import { Dependencies } from './dependency-injection';
2
+ export declare const registerCommands: (deps: Dependencies) => void;
3
+ //# sourceMappingURL=register-feedback-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-feedback-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-feedback-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AA+BtD,eAAO,MAAM,gBAAgB,SAAU,YAAY,SAElD,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerCommands = void 0;
4
+ const cli_shared_1 = require("@forge/cli-shared");
5
+ const registerFeedbackCommands = ({ cmd, ui, controllers: { feedbackController } }) => {
6
+ cmd
7
+ .command(cli_shared_1.Text.feedback.cmd)
8
+ .description(cli_shared_1.Text.feedback.description)
9
+ .action(async () => {
10
+ ui.info(cli_shared_1.Text.feedback.action.start);
11
+ const feedback = await ui.promptForText(cli_shared_1.Text.feedback.action.enterFeedbackPrompt);
12
+ if (!feedback || 0 === feedback.trim().length)
13
+ return;
14
+ ui.emptyLine();
15
+ try {
16
+ await ui.displayProgress(() => feedbackController.sendFeedback(feedback), cli_shared_1.Text.feedback.action.sendingFeedbackProgress, (result) => {
17
+ const successful = result.status == 200;
18
+ return {
19
+ successful,
20
+ message: successful ? cli_shared_1.Text.feedback.action.success : cli_shared_1.Text.feedback.action.error
21
+ };
22
+ });
23
+ }
24
+ catch (e) {
25
+ throw new Error(cli_shared_1.Text.feedback.action.error);
26
+ }
27
+ });
28
+ };
29
+ const registerCommands = (deps) => {
30
+ registerFeedbackCommands(deps);
31
+ };
32
+ exports.registerCommands = registerCommands;
@@ -0,0 +1,6 @@
1
+ import { Dependencies } from './dependency-injection';
2
+ import { Installation } from '../service/installation-service';
3
+ export declare const performSingleUninstall: (installId: string, { ui, commands: { uninstallAppCommand } }: Dependencies) => Promise<void>;
4
+ export declare const performMultipleUninstalls: (appsToUninstall: Installation[], { ui, commands: { uninstallAppCommand } }: Dependencies) => Promise<void>;
5
+ export declare const registerCommands: ({ cmd, ...deps }: Dependencies) => void;
6
+ //# sourceMappingURL=register-installation-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-installation-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-installation-commands.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAqD/D,eAAO,MAAM,sBAAsB,cACtB,MAAM,6CAC0B,YAAY,kBAwBxD,CAAC;AAEF,eAAO,MAAM,yBAAyB,oBACnB,YAAY,EAAE,6CACY,YAAY,kBA+CxD,CAAC;AAgEF,eAAO,MAAM,gBAAgB,qBAAsB,YAAY,KAAG,IAejE,CAAC"}