@catladder/cli 0.0.0-main-d74691dd → 0.0.0-main-b29ca0c2

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 (343) hide show
  1. package/.nvmrc +1 -1
  2. package/bin/catenv +1 -0
  3. package/bin/catladder +1 -1
  4. package/bin/debugCatenv +1 -0
  5. package/dist/apps/catenv/catenv.js +130 -35
  6. package/dist/apps/catenv/catenv.js.map +1 -1
  7. package/dist/apps/cli/cli.d.ts +2 -0
  8. package/dist/apps/cli/cli.js +82 -0
  9. package/dist/apps/cli/cli.js.map +1 -0
  10. package/dist/apps/{shell → cli}/commands/general/index.d.ts +1 -1
  11. package/dist/apps/cli/commands/general/index.js +274 -0
  12. package/dist/apps/cli/commands/general/index.js.map +1 -0
  13. package/dist/apps/{shell → cli}/commands/general/namespaceAutoCompletion.d.ts +0 -0
  14. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js +56 -0
  15. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js.map +1 -0
  16. package/dist/apps/cli/commands/general/portForward.d.ts +3 -0
  17. package/dist/apps/cli/commands/general/portForward.js +98 -0
  18. package/dist/apps/cli/commands/general/portForward.js.map +1 -0
  19. package/dist/apps/cli/commands/mongodb/index.d.ts +3 -0
  20. package/dist/apps/cli/commands/mongodb/index.js +53 -0
  21. package/dist/apps/cli/commands/mongodb/index.js.map +1 -0
  22. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +3 -0
  23. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +190 -0
  24. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -0
  25. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +3 -0
  26. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js +96 -0
  27. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js.map +1 -0
  28. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +3 -0
  29. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +105 -0
  30. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -0
  31. package/dist/apps/{shell → cli}/commands/mongodb/utils/index.d.ts +0 -0
  32. package/dist/apps/cli/commands/mongodb/utils/index.js +167 -0
  33. package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -0
  34. package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +3 -0
  35. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +128 -0
  36. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
  37. package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +3 -0
  38. package/dist/apps/cli/commands/project/commandConfigSecrets.js +217 -0
  39. package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -0
  40. package/dist/apps/cli/commands/project/commandCopyDB.d.ts +3 -0
  41. package/dist/apps/cli/commands/project/commandCopyDB.js +102 -0
  42. package/dist/apps/cli/commands/project/commandCopyDB.js.map +1 -0
  43. package/dist/apps/cli/commands/project/commandDeletePods.d.ts +3 -0
  44. package/dist/apps/cli/commands/project/commandDeletePods.js +119 -0
  45. package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -0
  46. package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +3 -0
  47. package/dist/apps/cli/commands/project/commandDeleteProject.js +97 -0
  48. package/dist/apps/cli/commands/project/commandDeleteProject.js.map +1 -0
  49. package/dist/apps/cli/commands/project/commandEnvVars.d.ts +3 -0
  50. package/dist/apps/cli/commands/project/commandEnvVars.js +74 -0
  51. package/dist/apps/cli/commands/project/commandEnvVars.js.map +1 -0
  52. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +3 -0
  53. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +58 -0
  54. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -0
  55. package/dist/apps/cli/commands/project/commandGetShell.d.ts +3 -0
  56. package/dist/apps/cli/commands/project/commandGetShell.js +92 -0
  57. package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -0
  58. package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +3 -0
  59. package/dist/apps/cli/commands/project/commandGitlabCi.js +185 -0
  60. package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -0
  61. package/dist/apps/cli/commands/project/commandInitGitlab.d.ts +3 -0
  62. package/dist/apps/cli/commands/project/commandInitGitlab.js +245 -0
  63. package/dist/apps/cli/commands/project/commandInitGitlab.js.map +1 -0
  64. package/dist/apps/cli/commands/project/commandInitProject.d.ts +3 -0
  65. package/dist/apps/cli/commands/project/commandInitProject.js +345 -0
  66. package/dist/apps/cli/commands/project/commandInitProject.js.map +1 -0
  67. package/dist/apps/cli/commands/project/commandListPods.d.ts +3 -0
  68. package/dist/apps/cli/commands/project/commandListPods.js +78 -0
  69. package/dist/apps/cli/commands/project/commandListPods.js.map +1 -0
  70. package/dist/apps/{shell → cli}/commands/project/commandMigrateHelm3.d.ts +1 -1
  71. package/dist/apps/cli/commands/project/commandMigrateHelm3.js +113 -0
  72. package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -0
  73. package/dist/apps/cli/commands/project/commandNamespace.d.ts +3 -0
  74. package/dist/apps/cli/commands/project/commandNamespace.js +70 -0
  75. package/dist/apps/cli/commands/project/commandNamespace.js.map +1 -0
  76. package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +3 -0
  77. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +83 -0
  78. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -0
  79. package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +3 -0
  80. package/dist/apps/cli/commands/project/commandOpenDashboard.js +92 -0
  81. package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -0
  82. package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +3 -0
  83. package/dist/apps/cli/commands/project/commandOpenEnv.js +80 -0
  84. package/dist/apps/cli/commands/project/commandOpenEnv.js.map +1 -0
  85. package/dist/apps/cli/commands/project/commandOpenGit.d.ts +3 -0
  86. package/dist/apps/cli/commands/project/commandOpenGit.js +56 -0
  87. package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -0
  88. package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +3 -0
  89. package/dist/apps/cli/commands/project/commandOpenGrafana.js +83 -0
  90. package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -0
  91. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +3 -0
  92. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +99 -0
  93. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -0
  94. package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +3 -0
  95. package/dist/apps/cli/commands/project/commandOpenLogs.js +87 -0
  96. package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -0
  97. package/dist/apps/cli/commands/project/commandPauseProject.d.ts +3 -0
  98. package/dist/apps/cli/commands/project/commandPauseProject.js +97 -0
  99. package/dist/apps/cli/commands/project/commandPauseProject.js.map +1 -0
  100. package/dist/apps/cli/commands/project/commandPortForward.d.ts +3 -0
  101. package/dist/apps/cli/commands/project/commandPortForward.js +106 -0
  102. package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
  103. package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
  104. package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
  105. package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
  106. package/dist/apps/cli/commands/project/index.d.ts +3 -0
  107. package/dist/apps/cli/commands/project/index.js +95 -0
  108. package/dist/apps/cli/commands/project/index.js.map +1 -0
  109. package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
  110. package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
  111. package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
  112. package/dist/apps/{shell → cli}/commands/project/utils/ensureCluster.d.ts +0 -0
  113. package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
  114. package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
  115. package/dist/apps/{shell → cli}/commands/project/utils/ensureNamespace.d.ts +0 -0
  116. package/dist/apps/cli/commands/project/utils/ensureNamespace.js +92 -0
  117. package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
  118. package/dist/apps/{shell → cli}/commands/shared/index.d.ts +0 -0
  119. package/dist/apps/cli/commands/shared/index.js +72 -0
  120. package/dist/apps/cli/commands/shared/index.js.map +1 -0
  121. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
  122. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +131 -0
  123. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
  124. package/dist/apps/{shell → cli}/utils/getGoogleAuthUserNumber.d.ts +0 -0
  125. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
  126. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
  127. package/dist/{index.d.ts → catenv.d.ts} +0 -0
  128. package/dist/catenv.js +8 -0
  129. package/dist/catenv.js.map +1 -0
  130. package/dist/cli.d.ts +1 -0
  131. package/dist/cli.js +13 -0
  132. package/dist/cli.js.map +1 -0
  133. package/dist/config/clusters.js +57 -9
  134. package/dist/config/clusters.js.map +1 -1
  135. package/dist/config/constants.js +1 -1
  136. package/dist/config/getProjectConfig.d.ts +11 -7
  137. package/dist/config/getProjectConfig.js +166 -61
  138. package/dist/config/getProjectConfig.js.map +1 -1
  139. package/dist/k8sApi/index.js +5 -5
  140. package/dist/k8sApi/index.js.map +1 -1
  141. package/dist/packageInfos.js +3 -3
  142. package/dist/packageInfos.js.map +1 -1
  143. package/dist/tsconfig.tsbuildinfo +1 -1
  144. package/dist/types/types.js +1 -1
  145. package/dist/utils/cluster.js +79 -19
  146. package/dist/utils/cluster.js.map +1 -1
  147. package/dist/utils/dashboardToken.js +80 -15
  148. package/dist/utils/dashboardToken.js.map +1 -1
  149. package/dist/utils/editAsFile.d.ts +1 -1
  150. package/dist/utils/editAsFile.js +78 -15
  151. package/dist/utils/editAsFile.js.map +1 -1
  152. package/dist/utils/files.js +70 -16
  153. package/dist/utils/files.js.map +1 -1
  154. package/dist/utils/formatEnvVars.js +8 -5
  155. package/dist/utils/formatEnvVars.js.map +1 -1
  156. package/dist/utils/getEditor.js +64 -14
  157. package/dist/utils/getEditor.js.map +1 -1
  158. package/dist/utils/gitlab.d.ts +2 -1
  159. package/dist/utils/gitlab.js +194 -79
  160. package/dist/utils/gitlab.js.map +1 -1
  161. package/dist/utils/log.js +3 -3
  162. package/dist/utils/log.js.map +1 -1
  163. package/dist/utils/passwordstore/index.js +362 -154
  164. package/dist/utils/passwordstore/index.js.map +1 -1
  165. package/dist/utils/portForward.js +103 -34
  166. package/dist/utils/portForward.js.map +1 -1
  167. package/dist/utils/preferences/index.js +110 -28
  168. package/dist/utils/preferences/index.js.map +1 -1
  169. package/dist/utils/projects/index.js +136 -40
  170. package/dist/utils/projects/index.js.map +1 -1
  171. package/dist/utils/promise.js +56 -5
  172. package/dist/utils/promise.js.map +1 -1
  173. package/dist/utils/shell.js +75 -19
  174. package/dist/utils/shell.js.map +1 -1
  175. package/package.json +9 -10
  176. package/src/apps/catenv/catenv.ts +16 -5
  177. package/src/apps/{shell/shell.ts → cli/cli.ts} +2 -2
  178. package/src/apps/{shell → cli}/commands/general/index.ts +1 -1
  179. package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
  180. package/src/apps/{shell → cli}/commands/general/portForward.ts +1 -1
  181. package/src/apps/{shell → cli}/commands/mongodb/index.ts +1 -1
  182. package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +3 -3
  183. package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +3 -3
  184. package/src/apps/{shell → cli}/commands/mongodb/projectMongoPortForward.ts +3 -3
  185. package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +0 -0
  186. package/src/apps/{shell → cli}/commands/project/commandCloudSqlProxy.ts +7 -7
  187. package/src/apps/cli/commands/project/commandConfigSecrets.ts +161 -0
  188. package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +9 -5
  189. package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +3 -3
  190. package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +3 -3
  191. package/src/apps/cli/commands/project/commandEnvVars.ts +15 -0
  192. package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +2 -2
  193. package/src/apps/{shell → cli}/commands/project/commandGetShell.ts +3 -3
  194. package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +1 -1
  195. package/src/apps/{shell → cli}/commands/project/commandInitGitlab.ts +3 -3
  196. package/src/apps/{shell → cli}/commands/project/commandInitProject.ts +2 -2
  197. package/src/apps/{shell → cli}/commands/project/commandListPods.ts +3 -3
  198. package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +11 -5
  199. package/src/apps/{shell → cli}/commands/project/commandNamespace.ts +3 -3
  200. package/src/apps/{shell → cli}/commands/project/commandOpenCostDashboard.ts +3 -3
  201. package/src/apps/{shell → cli}/commands/project/commandOpenDashboard.ts +12 -6
  202. package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
  203. package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +1 -1
  204. package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +3 -3
  205. package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +4 -5
  206. package/src/apps/{shell → cli}/commands/project/commandOpenLogs.ts +3 -3
  207. package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +3 -3
  208. package/src/apps/{shell → cli}/commands/project/commandPortForward.ts +3 -3
  209. package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +3 -3
  210. package/src/apps/{shell → cli}/commands/project/index.ts +1 -1
  211. package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
  212. package/src/apps/{shell → cli}/commands/project/utils/ensureCluster.ts +6 -2
  213. package/src/apps/{shell → cli}/commands/project/utils/ensureNamespace.ts +0 -0
  214. package/src/apps/{shell → cli}/commands/shared/index.ts +0 -0
  215. package/src/apps/{shell → cli}/commands/theStuffThatReallyMatters/index.ts +11 -11
  216. package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
  217. package/src/catenv.ts +3 -0
  218. package/src/cli.ts +8 -0
  219. package/src/config/getProjectConfig.ts +48 -40
  220. package/src/utils/editAsFile.ts +12 -2
  221. package/src/utils/gitlab.ts +14 -10
  222. package/src/utils/projects/index.ts +2 -1
  223. package/tsconfig.json +2 -2
  224. package/bin/catenv.sh +0 -1
  225. package/dist/apps/shell/commands/general/index.js +0 -104
  226. package/dist/apps/shell/commands/general/index.js.map +0 -1
  227. package/dist/apps/shell/commands/general/namespaceAutoCompletion.js +0 -11
  228. package/dist/apps/shell/commands/general/namespaceAutoCompletion.js.map +0 -1
  229. package/dist/apps/shell/commands/general/portForward.d.ts +0 -3
  230. package/dist/apps/shell/commands/general/portForward.js +0 -42
  231. package/dist/apps/shell/commands/general/portForward.js.map +0 -1
  232. package/dist/apps/shell/commands/mongodb/index.d.ts +0 -3
  233. package/dist/apps/shell/commands/mongodb/index.js +0 -14
  234. package/dist/apps/shell/commands/mongodb/index.js.map +0 -1
  235. package/dist/apps/shell/commands/mongodb/projectMongoDestroyMember.d.ts +0 -3
  236. package/dist/apps/shell/commands/mongodb/projectMongoDestroyMember.js +0 -93
  237. package/dist/apps/shell/commands/mongodb/projectMongoDestroyMember.js.map +0 -1
  238. package/dist/apps/shell/commands/mongodb/projectMongoGetShell.d.ts +0 -3
  239. package/dist/apps/shell/commands/mongodb/projectMongoGetShell.js +0 -36
  240. package/dist/apps/shell/commands/mongodb/projectMongoGetShell.js.map +0 -1
  241. package/dist/apps/shell/commands/mongodb/projectMongoPortForward.d.ts +0 -3
  242. package/dist/apps/shell/commands/mongodb/projectMongoPortForward.js +0 -43
  243. package/dist/apps/shell/commands/mongodb/projectMongoPortForward.js.map +0 -1
  244. package/dist/apps/shell/commands/mongodb/utils/index.js +0 -61
  245. package/dist/apps/shell/commands/mongodb/utils/index.js.map +0 -1
  246. package/dist/apps/shell/commands/project/commandCloudSqlProxy.d.ts +0 -3
  247. package/dist/apps/shell/commands/project/commandCloudSqlProxy.js +0 -47
  248. package/dist/apps/shell/commands/project/commandCloudSqlProxy.js.map +0 -1
  249. package/dist/apps/shell/commands/project/commandConfigSecrets.d.ts +0 -3
  250. package/dist/apps/shell/commands/project/commandConfigSecrets.js +0 -96
  251. package/dist/apps/shell/commands/project/commandConfigSecrets.js.map +0 -1
  252. package/dist/apps/shell/commands/project/commandCopyDB.d.ts +0 -3
  253. package/dist/apps/shell/commands/project/commandCopyDB.js +0 -67
  254. package/dist/apps/shell/commands/project/commandCopyDB.js.map +0 -1
  255. package/dist/apps/shell/commands/project/commandDeletePods.d.ts +0 -3
  256. package/dist/apps/shell/commands/project/commandDeletePods.js +0 -45
  257. package/dist/apps/shell/commands/project/commandDeletePods.js.map +0 -1
  258. package/dist/apps/shell/commands/project/commandDeleteProject.d.ts +0 -3
  259. package/dist/apps/shell/commands/project/commandDeleteProject.js +0 -28
  260. package/dist/apps/shell/commands/project/commandDeleteProject.js.map +0 -1
  261. package/dist/apps/shell/commands/project/commandEnvVars.d.ts +0 -3
  262. package/dist/apps/shell/commands/project/commandEnvVars.js +0 -12
  263. package/dist/apps/shell/commands/project/commandEnvVars.js.map +0 -1
  264. package/dist/apps/shell/commands/project/commandGetMyTotalWorktime.d.ts +0 -3
  265. package/dist/apps/shell/commands/project/commandGetMyTotalWorktime.js +0 -11
  266. package/dist/apps/shell/commands/project/commandGetMyTotalWorktime.js.map +0 -1
  267. package/dist/apps/shell/commands/project/commandGetShell.d.ts +0 -3
  268. package/dist/apps/shell/commands/project/commandGetShell.js +0 -30
  269. package/dist/apps/shell/commands/project/commandGetShell.js.map +0 -1
  270. package/dist/apps/shell/commands/project/commandGitlabCi.d.ts +0 -3
  271. package/dist/apps/shell/commands/project/commandGitlabCi.js +0 -86
  272. package/dist/apps/shell/commands/project/commandGitlabCi.js.map +0 -1
  273. package/dist/apps/shell/commands/project/commandInitGitlab.d.ts +0 -3
  274. package/dist/apps/shell/commands/project/commandInitGitlab.js +0 -142
  275. package/dist/apps/shell/commands/project/commandInitGitlab.js.map +0 -1
  276. package/dist/apps/shell/commands/project/commandInitProject.d.ts +0 -3
  277. package/dist/apps/shell/commands/project/commandInitProject.js +0 -253
  278. package/dist/apps/shell/commands/project/commandInitProject.js.map +0 -1
  279. package/dist/apps/shell/commands/project/commandListPods.d.ts +0 -3
  280. package/dist/apps/shell/commands/project/commandListPods.js +0 -19
  281. package/dist/apps/shell/commands/project/commandListPods.js.map +0 -1
  282. package/dist/apps/shell/commands/project/commandMigrateHelm3.js +0 -45
  283. package/dist/apps/shell/commands/project/commandMigrateHelm3.js.map +0 -1
  284. package/dist/apps/shell/commands/project/commandNamespace.d.ts +0 -3
  285. package/dist/apps/shell/commands/project/commandNamespace.js +0 -11
  286. package/dist/apps/shell/commands/project/commandNamespace.js.map +0 -1
  287. package/dist/apps/shell/commands/project/commandOpenCostDashboard.d.ts +0 -3
  288. package/dist/apps/shell/commands/project/commandOpenCostDashboard.js +0 -22
  289. package/dist/apps/shell/commands/project/commandOpenCostDashboard.js.map +0 -1
  290. package/dist/apps/shell/commands/project/commandOpenDashboard.d.ts +0 -3
  291. package/dist/apps/shell/commands/project/commandOpenDashboard.js +0 -28
  292. package/dist/apps/shell/commands/project/commandOpenDashboard.js.map +0 -1
  293. package/dist/apps/shell/commands/project/commandOpenEnv.d.ts +0 -3
  294. package/dist/apps/shell/commands/project/commandOpenEnv.js +0 -19
  295. package/dist/apps/shell/commands/project/commandOpenEnv.js.map +0 -1
  296. package/dist/apps/shell/commands/project/commandOpenGit.d.ts +0 -3
  297. package/dist/apps/shell/commands/project/commandOpenGit.js +0 -9
  298. package/dist/apps/shell/commands/project/commandOpenGit.js.map +0 -1
  299. package/dist/apps/shell/commands/project/commandOpenGrafana.d.ts +0 -3
  300. package/dist/apps/shell/commands/project/commandOpenGrafana.js +0 -22
  301. package/dist/apps/shell/commands/project/commandOpenGrafana.js.map +0 -1
  302. package/dist/apps/shell/commands/project/commandOpenGrafanaPod.d.ts +0 -3
  303. package/dist/apps/shell/commands/project/commandOpenGrafanaPod.js +0 -34
  304. package/dist/apps/shell/commands/project/commandOpenGrafanaPod.js.map +0 -1
  305. package/dist/apps/shell/commands/project/commandOpenLogs.d.ts +0 -3
  306. package/dist/apps/shell/commands/project/commandOpenLogs.js +0 -22
  307. package/dist/apps/shell/commands/project/commandOpenLogs.js.map +0 -1
  308. package/dist/apps/shell/commands/project/commandPauseProject.d.ts +0 -3
  309. package/dist/apps/shell/commands/project/commandPauseProject.js +0 -28
  310. package/dist/apps/shell/commands/project/commandPauseProject.js.map +0 -1
  311. package/dist/apps/shell/commands/project/commandPortForward.d.ts +0 -3
  312. package/dist/apps/shell/commands/project/commandPortForward.js +0 -40
  313. package/dist/apps/shell/commands/project/commandPortForward.js.map +0 -1
  314. package/dist/apps/shell/commands/project/commandTriggerCronjob.d.ts +0 -3
  315. package/dist/apps/shell/commands/project/commandTriggerCronjob.js +0 -56
  316. package/dist/apps/shell/commands/project/commandTriggerCronjob.js.map +0 -1
  317. package/dist/apps/shell/commands/project/index.d.ts +0 -3
  318. package/dist/apps/shell/commands/project/index.js +0 -56
  319. package/dist/apps/shell/commands/project/index.js.map +0 -1
  320. package/dist/apps/shell/commands/project/utils/autocompletions.d.ts +0 -1
  321. package/dist/apps/shell/commands/project/utils/autocompletions.js +0 -6
  322. package/dist/apps/shell/commands/project/utils/autocompletions.js.map +0 -1
  323. package/dist/apps/shell/commands/project/utils/ensureCluster.js +0 -32
  324. package/dist/apps/shell/commands/project/utils/ensureCluster.js.map +0 -1
  325. package/dist/apps/shell/commands/project/utils/ensureNamespace.js +0 -39
  326. package/dist/apps/shell/commands/project/utils/ensureNamespace.js.map +0 -1
  327. package/dist/apps/shell/commands/shared/index.js +0 -22
  328. package/dist/apps/shell/commands/shared/index.js.map +0 -1
  329. package/dist/apps/shell/commands/theStuffThatReallyMatters/index.d.ts +0 -3
  330. package/dist/apps/shell/commands/theStuffThatReallyMatters/index.js +0 -51
  331. package/dist/apps/shell/commands/theStuffThatReallyMatters/index.js.map +0 -1
  332. package/dist/apps/shell/shell.d.ts +0 -2
  333. package/dist/apps/shell/shell.js +0 -38
  334. package/dist/apps/shell/shell.js.map +0 -1
  335. package/dist/apps/shell/utils/getGoogleAuthUserNumber.js +0 -20
  336. package/dist/apps/shell/utils/getGoogleAuthUserNumber.js.map +0 -1
  337. package/dist/index.js +0 -21
  338. package/dist/index.js.map +0 -1
  339. package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -114
  340. package/src/apps/shell/commands/project/commandEnvVars.ts +0 -14
  341. package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
  342. package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -3
  343. package/src/index.ts +0 -17
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ exports.__esModule = true;
42
+ var log_1 = require("../../../../utils/log");
43
+ var portForward_1 = require("../../../../utils/portForward");
44
+ var projects_1 = require("../../../../utils/projects");
45
+ var autocompletions_1 = require("../project/utils/autocompletions");
46
+ var ensureCluster_1 = __importDefault(require("../project/utils/ensureCluster"));
47
+ var utils_1 = require("./utils");
48
+ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
49
+ var _a, _b;
50
+ return __generator(this, function (_c) {
51
+ switch (_c.label) {
52
+ case 0:
53
+ _b = (_a = vorpal
54
+ .command("project-mongo-port-forward <envComponent>", "port foward to a mongodb"))
55
+ .autocomplete;
56
+ return [4 /*yield*/, (0, autocompletions_1.envAndComponents)()];
57
+ case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])
58
+ .action(function (_a) {
59
+ var envComponent = _a.envComponent;
60
+ return __awaiter(this, void 0, void 0, function () {
61
+ var namespace, podNames, podName, localPort;
62
+ return __generator(this, function (_b) {
63
+ switch (_b.label) {
64
+ case 0: return [4 /*yield*/, ensureCluster_1["default"].call(this, envComponent)];
65
+ case 1:
66
+ _b.sent();
67
+ return [4 /*yield*/, (0, projects_1.getProjectNamespace)(envComponent)];
68
+ case 2:
69
+ namespace = _b.sent();
70
+ return [4 /*yield*/, (0, utils_1.getProjectMongodbAllPodsSortedWithLabel)(envComponent)];
71
+ case 3:
72
+ podNames = _b.sent();
73
+ if (podNames.length === 0) {
74
+ (0, log_1.logError)(this, "sorry, no pods found");
75
+ return [2 /*return*/];
76
+ }
77
+ if (!(podNames.length === 1)) return [3 /*break*/, 4];
78
+ podName = podNames[0].value;
79
+ return [3 /*break*/, 6];
80
+ case 4: return [4 /*yield*/, this.prompt({
81
+ type: "list",
82
+ name: "podName",
83
+ choices: podNames,
84
+ message: "Which pod? 🤔"
85
+ })];
86
+ case 5:
87
+ podName = (_b.sent()).podName;
88
+ _b.label = 6;
89
+ case 6: return [4 /*yield*/, this.prompt({
90
+ type: "number",
91
+ name: "localPort",
92
+ "default": "30000",
93
+ message: "Local port: "
94
+ })];
95
+ case 7:
96
+ localPort = (_b.sent()).localPort;
97
+ return [2 /*return*/, (0, portForward_1.startPortForward)(podName, localPort, 27017, namespace)];
98
+ }
99
+ });
100
+ });
101
+ })];
102
+ }
103
+ });
104
+ }); });
105
+ //# sourceMappingURL=projectMongoPortForward.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectMongoPortForward.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/mongodb/projectMongoPortForward.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6CAAiD;AACjD,6DAAiE;AACjE,uDAAiE;AACjE,oEAAoE;AACpE,iFAA2D;AAC3D,iCAAkE;AAElE,sBAAe,UAAO,MAAc;;;;;gBAClC,KAAA,CAAA,KAAA,MAAM;qBACH,OAAO,CACN,2CAA2C,EAC3C,0BAA0B,CAC3B,CAAA;qBACA,YAAY,CAAA;gBAAC,qBAAM,IAAA,kCAAgB,GAAE,EAAA;oBALxC,sBAAA,cAKgB,SAAwB,EAAC;qBACtC,MAAM,CAAC,UAAgB,EAAgB;wBAAd,YAAY,kBAAA;;;;;wCACpC,qBAAM,0BAAa,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,EAAA;;oCAA5C,SAA4C,CAAC;oCAC3B,qBAAM,IAAA,8BAAmB,EAAC,YAAY,CAAC,EAAA;;oCAAnD,SAAS,GAAG,SAAuC;oCACxC,qBAAM,IAAA,+CAAuC,EAC5D,YAAY,CACb,EAAA;;oCAFK,QAAQ,GAAG,SAEhB;oCACD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;wCACzB,IAAA,cAAQ,EAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;wCACvC,sBAAO;qCACR;yCAEG,CAAA,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAA,EAArB,wBAAqB;oCACvB,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;;wCAG1B,qBAAM,IAAI,CAAC,MAAM,CAAC;wCAChB,IAAI,EAAE,MAAM;wCACZ,IAAI,EAAE,SAAS;wCACf,OAAO,EAAE,QAAQ;wCACjB,OAAO,EAAE,eAAe;qCACzB,CAAC,EAAA;;oCANJ,OAAO,GAAG,CACR,SAKE,CACH,CAAC,OAAO,CAAC;;wCAGU,qBAAM,IAAI,CAAC,MAAM,CAAC;wCACtC,IAAI,EAAE,QAAQ;wCACd,IAAI,EAAE,WAAW;wCACjB,SAAO,EAAE,OAAO;wCAChB,OAAO,EAAE,cAAc;qCACxB,CAAC,EAAA;;oCALM,SAAS,GAAK,CAAA,SAKpB,CAAA,UALe;oCAMjB,sBAAO,IAAA,8BAAgB,EAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,EAAC;;;;iBAC/D,CAAC,EAAA;;;KAAA,EAAC"}
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ exports.__esModule = true;
50
+ exports.getProjectMongodbAllPodsSortedWithLabel = exports.getMongoDbPodsWithReplInfo = exports.podIsMaster = exports.executeMongodbCommand = exports.getMongodbShell = exports.getProjectMongodbAllPods = void 0;
51
+ var child_process_promise_1 = require("child-process-promise");
52
+ var projects_1 = require("../../../../../utils/projects");
53
+ var filterMongoDbs = function (podNames) {
54
+ return podNames.filter(function (name) { return name.includes("mongodb-replicaset"); });
55
+ };
56
+ var getProjectMongodbAllPods = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
57
+ switch (_b.label) {
58
+ case 0:
59
+ _a = filterMongoDbs;
60
+ return [4 /*yield*/, (0, projects_1.getProjectPodNames)(envComponent)];
61
+ case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
62
+ }
63
+ }); }); };
64
+ exports.getProjectMongodbAllPods = getProjectMongodbAllPods;
65
+ var getMongodbShell = function (namespace, podName) { return __awaiter(void 0, void 0, void 0, function () {
66
+ var command, e_1;
67
+ return __generator(this, function (_a) {
68
+ switch (_a.label) {
69
+ case 0:
70
+ command = "kubectl exec -it ".concat(podName, " --namespace ").concat(namespace, " mongo");
71
+ _a.label = 1;
72
+ case 1:
73
+ _a.trys.push([1, 3, , 4]);
74
+ return [4 /*yield*/, (0, child_process_promise_1.spawn)(command, {
75
+ shell: true,
76
+ stdio: "inherit",
77
+ env: __assign(__assign({}, process.env), { DEBUG: "" })
78
+ })];
79
+ case 2:
80
+ _a.sent();
81
+ return [3 /*break*/, 4];
82
+ case 3:
83
+ e_1 = _a.sent();
84
+ return [3 /*break*/, 4];
85
+ case 4: return [2 /*return*/];
86
+ }
87
+ });
88
+ }); };
89
+ exports.getMongodbShell = getMongodbShell;
90
+ var executeMongodbCommand = function (namespace, podName, mongoCommand) { return __awaiter(void 0, void 0, void 0, function () {
91
+ var fullCommand, stdout;
92
+ return __generator(this, function (_a) {
93
+ switch (_a.label) {
94
+ case 0:
95
+ fullCommand = "kubectl exec -it ".concat(podName, " --namespace ").concat(namespace, " -- mongo --quiet --eval \"JSON.stringify(").concat(mongoCommand, ")\"");
96
+ return [4 /*yield*/, (0, child_process_promise_1.exec)(fullCommand, {
97
+ env: __assign(__assign({}, process.env), { DEBUG: "" })
98
+ })];
99
+ case 1:
100
+ stdout = (_a.sent()).stdout;
101
+ return [2 /*return*/, JSON.parse(stdout)];
102
+ }
103
+ });
104
+ }); };
105
+ exports.executeMongodbCommand = executeMongodbCommand;
106
+ var podIsMaster = function (namespace, podName) { return __awaiter(void 0, void 0, void 0, function () {
107
+ var result;
108
+ return __generator(this, function (_a) {
109
+ switch (_a.label) {
110
+ case 0: return [4 /*yield*/, (0, exports.executeMongodbCommand)(namespace, podName, "db.isMaster()")];
111
+ case 1:
112
+ result = _a.sent();
113
+ return [2 /*return*/, result.ismaster];
114
+ }
115
+ });
116
+ }); };
117
+ exports.podIsMaster = podIsMaster;
118
+ var spaces = function (n) { return " ".repeat(n); };
119
+ var getMongoDbPodsWithReplInfo = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
120
+ var namespace, _a, _b;
121
+ return __generator(this, function (_c) {
122
+ switch (_c.label) {
123
+ case 0: return [4 /*yield*/, (0, projects_1.getProjectNamespace)(envComponent)];
124
+ case 1:
125
+ namespace = _c.sent();
126
+ _b = (_a = Promise).all;
127
+ return [4 /*yield*/, (0, exports.getProjectMongodbAllPods)(envComponent)];
128
+ case 2: return [4 /*yield*/, _b.apply(_a, [(_c.sent()).map(function (podName) { return __awaiter(void 0, void 0, void 0, function () {
129
+ var _a;
130
+ return __generator(this, function (_b) {
131
+ switch (_b.label) {
132
+ case 0:
133
+ _a = {
134
+ podName: podName,
135
+ componentName: podName.replace(/-mongodb-replicaset-[0-9]+/, "")
136
+ };
137
+ return [4 /*yield*/, (0, exports.podIsMaster)(namespace, podName)];
138
+ case 1: return [2 /*return*/, (_a.isMaster = _b.sent(),
139
+ _a)];
140
+ }
141
+ });
142
+ }); })])];
143
+ case 3: return [2 /*return*/, (_c.sent()).sort(function (podA, podB) { return (podA.isMaster ? (podB.isMaster ? 0 : -1) : 1); })];
144
+ }
145
+ });
146
+ }); };
147
+ exports.getMongoDbPodsWithReplInfo = getMongoDbPodsWithReplInfo;
148
+ var getProjectMongodbAllPodsSortedWithLabel = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
149
+ var pods, maxComponentNameLength;
150
+ return __generator(this, function (_a) {
151
+ switch (_a.label) {
152
+ case 0: return [4 /*yield*/, (0, exports.getMongoDbPodsWithReplInfo)(envComponent)];
153
+ case 1:
154
+ pods = _a.sent();
155
+ maxComponentNameLength = Math.max.apply(Math, pods.map(function (c) { return c.componentName.length; }));
156
+ return [2 /*return*/, pods.map(function (_a) {
157
+ var podName = _a.podName, isMaster = _a.isMaster, componentName = _a.componentName;
158
+ return ({
159
+ value: podName,
160
+ name: "[ ".concat(componentName).concat(spaces(maxComponentNameLength - componentName.length), " ").concat(isMaster ? " PRIMARY " : " secondary ", "] ").concat(podName)
161
+ });
162
+ })];
163
+ }
164
+ });
165
+ }); };
166
+ exports.getProjectMongodbAllPodsSortedWithLabel = getProjectMongodbAllPodsSortedWithLabel;
167
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/apps/cli/commands/mongodb/utils/index.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ import Vorpal from "vorpal";
2
+ declare const _default: (vorpal: Vorpal) => Promise<Vorpal.Command>;
3
+ export default _default;
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ exports.__esModule = true;
39
+ var pipeline_1 = require("@catladder/pipeline");
40
+ var child_process_promise_1 = require("child-process-promise");
41
+ var fs_extra_1 = require("fs-extra");
42
+ var tmp_promise_1 = require("tmp-promise");
43
+ var constants_1 = require("../../../../config/constants");
44
+ var getProjectConfig_1 = require("../../../../config/getProjectConfig");
45
+ var passwordstore_1 = require("../../../../utils/passwordstore");
46
+ var autocompletions_1 = require("./utils/autocompletions");
47
+ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
48
+ var _a, _b;
49
+ return __generator(this, function (_c) {
50
+ switch (_c.label) {
51
+ case 0:
52
+ _b = (_a = vorpal
53
+ .command("project-cloud-sql-proxy <envComponent>", "proxy to cloud sql db"))
54
+ .autocomplete;
55
+ return [4 /*yield*/, (0, autocompletions_1.envAndComponents)()];
56
+ case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])
57
+ .action(function (_a) {
58
+ var _b, _c, _d, _e;
59
+ var envComponent = _a.envComponent;
60
+ return __awaiter(this, void 0, void 0, function () {
61
+ var _f, env, componentName, config, localPort, POSTGRESQL_PASSWORD, context, values, projectId, defaultInstanceId, instanceId, defaultRegion, region, instanceName, cloudsqlCredentials;
62
+ var _this = this;
63
+ return __generator(this, function (_g) {
64
+ switch (_g.label) {
65
+ case 0:
66
+ _f = (0, getProjectConfig_1.parseChoice)(envComponent), env = _f.env, componentName = _f.componentName;
67
+ return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
68
+ case 1:
69
+ config = _g.sent();
70
+ return [4 /*yield*/, this.prompt({
71
+ type: "number",
72
+ name: "localPort",
73
+ "default": "54320",
74
+ message: "Local port: "
75
+ })];
76
+ case 2:
77
+ localPort = (_g.sent()).localPort;
78
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(this, env, componentName)];
79
+ case 3:
80
+ POSTGRESQL_PASSWORD = (_b = (_g.sent())) === null || _b === void 0 ? void 0 : _b.POSTGRESQL_PASSWORD;
81
+ return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
82
+ case 4:
83
+ context = _g.sent();
84
+ if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
85
+ throw new Error("currently only supported for kubernetes deployment");
86
+ }
87
+ this.log("postgres-PW: ".concat(POSTGRESQL_PASSWORD));
88
+ this.log("");
89
+ values = context.componentConfig.deploy.values;
90
+ projectId = ((_c = values === null || values === void 0 ? void 0 : values.cloudsql) === null || _c === void 0 ? void 0 : _c.projectId) || constants_1.GOOGLE_PROJECT;
91
+ defaultInstanceId = "".concat(config.customerName, "-").concat(config.appName, "-").concat(env);
92
+ instanceId = ((_d = values === null || values === void 0 ? void 0 : values.cloudsql) === null || _d === void 0 ? void 0 : _d.instanceId) || defaultInstanceId;
93
+ defaultRegion = "europe-west6";
94
+ region = ((_e = values === null || values === void 0 ? void 0 : values.cloudsql) === null || _e === void 0 ? void 0 : _e.region) || defaultRegion;
95
+ instanceName = "".concat(projectId, ":").concat(region, ":").concat(instanceId, "=tcp:").concat(localPort);
96
+ return [4 /*yield*/, (0, passwordstore_1.readPass)(constants_1.GOOGLE_CLOUD_SQL_PASS_PATH)];
97
+ case 5:
98
+ cloudsqlCredentials = _g.sent();
99
+ return [4 /*yield*/, (0, tmp_promise_1.withFile)(function (_a) {
100
+ var tmpFilePath = _a.path;
101
+ return __awaiter(_this, void 0, void 0, function () {
102
+ return __generator(this, function (_b) {
103
+ switch (_b.label) {
104
+ case 0: return [4 /*yield*/, (0, fs_extra_1.writeFile)(tmpFilePath, cloudsqlCredentials)];
105
+ case 1:
106
+ _b.sent();
107
+ return [4 /*yield*/, (0, child_process_promise_1.spawn)("cloud_sql_proxy", ["-instances", instanceName, "-credential_file", tmpFilePath], {
108
+ stdio: "inherit",
109
+ shell: true
110
+ })];
111
+ case 2:
112
+ _b.sent();
113
+ return [2 /*return*/];
114
+ }
115
+ });
116
+ });
117
+ })];
118
+ case 6:
119
+ _g.sent();
120
+ return [2 /*return*/];
121
+ }
122
+ });
123
+ });
124
+ })];
125
+ }
126
+ });
127
+ }); });
128
+ //# sourceMappingURL=commandCloudSqlProxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandCloudSqlProxy.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/project/commandCloudSqlProxy.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ import Vorpal from "vorpal";
2
+ declare const _default: (vorpal: Vorpal) => Promise<void>;
3
+ export default _default;
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
12
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
13
+ });
14
+ };
15
+ var __generator = (this && this.__generator) || function (thisArg, body) {
16
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
17
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
18
+ function verb(n) { return function (v) { return step([n, v]); }; }
19
+ function step(op) {
20
+ if (f) throw new TypeError("Generator is already executing.");
21
+ while (_) try {
22
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
23
+ if (y = 0, t) op = [op[0] & 2, t.value];
24
+ switch (op[0]) {
25
+ case 0: case 1: t = op; break;
26
+ case 4: _.label++; return { value: op[1], done: false };
27
+ case 5: _.label++; y = op[1]; op = [0]; continue;
28
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
29
+ default:
30
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
31
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
32
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
33
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
34
+ if (t[2]) _.ops.pop();
35
+ _.trys.pop(); continue;
36
+ }
37
+ op = body.call(thisArg, _);
38
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
39
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
40
+ }
41
+ };
42
+ exports.__esModule = true;
43
+ /* eslint-disable no-constant-condition */
44
+ var common_tags_1 = require("common-tags");
45
+ var lodash_1 = require("lodash");
46
+ var getProjectConfig_1 = require("../../../../config/getProjectConfig");
47
+ var editAsFile_1 = require("../../../../utils/editAsFile");
48
+ var gitlab_1 = require("../../../../utils/gitlab");
49
+ var promise_1 = require("../../../../utils/promise");
50
+ var autocompletions_1 = require("./utils/autocompletions");
51
+ var getEnvVarsToEdit = function (env, componentName) { return __awaiter(void 0, void 0, void 0, function () {
52
+ var secretEnvVarKeys, allEnvVars;
53
+ return __generator(this, function (_a) {
54
+ switch (_a.label) {
55
+ case 0: return [4 /*yield*/, (0, getProjectConfig_1.getEnvironment)(env, componentName)];
56
+ case 1:
57
+ secretEnvVarKeys = (_a.sent()).secretEnvVarKeys;
58
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(this, env, componentName)];
59
+ case 2:
60
+ allEnvVars = _a.sent();
61
+ return [2 /*return*/, Object.fromEntries(secretEnvVarKeys.map(function (key) { return [key, allEnvVars[key]]; }))];
62
+ }
63
+ });
64
+ }); };
65
+ var doItFor = function (instance, env, components) { return __awaiter(void 0, void 0, void 0, function () {
66
+ var valuesToEdit, _a, _b, hasErrors, _i, components_1, componentName, usedKeys, secretEnvVarKeys, extranous, missing, shouldContinue, _c, components_2, componentName;
67
+ return __generator(this, function (_d) {
68
+ switch (_d.label) {
69
+ case 0:
70
+ _b = (_a = Object).fromEntries;
71
+ return [4 /*yield*/, Promise.all(components.map(function (componentName) { return __awaiter(void 0, void 0, void 0, function () {
72
+ var _a;
73
+ return __generator(this, function (_b) {
74
+ switch (_b.label) {
75
+ case 0:
76
+ _a = [componentName];
77
+ return [4 /*yield*/, getEnvVarsToEdit(env, componentName)];
78
+ case 1: return [2 /*return*/, _a.concat([
79
+ _b.sent()
80
+ ])];
81
+ }
82
+ });
83
+ }); }))];
84
+ case 1:
85
+ valuesToEdit = _b.apply(_a, [_d.sent()]);
86
+ hasErrors = true;
87
+ _d.label = 2;
88
+ case 2:
89
+ if (!hasErrors) return [3 /*break*/, 10];
90
+ return [4 /*yield*/, (0, editAsFile_1.editAsFile)(valuesToEdit, (0, common_tags_1.stripIndents)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n Please fill in all secrets for: ", "\n\n "], ["\n Please fill in all secrets for: ", "\n\n "])), components.join(", ")))];
91
+ case 3:
92
+ valuesToEdit = _d.sent();
93
+ // check for errors
94
+ hasErrors = false;
95
+ _i = 0, components_1 = components;
96
+ _d.label = 4;
97
+ case 4:
98
+ if (!(_i < components_1.length)) return [3 /*break*/, 9];
99
+ componentName = components_1[_i];
100
+ usedKeys = valuesToEdit[componentName]
101
+ ? Object.keys(valuesToEdit[componentName])
102
+ : [];
103
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvironment)(env, componentName)];
104
+ case 5:
105
+ secretEnvVarKeys = (_d.sent()).secretEnvVarKeys;
106
+ extranous = (0, lodash_1.difference)(usedKeys, secretEnvVarKeys);
107
+ missing = (0, lodash_1.difference)(secretEnvVarKeys, usedKeys);
108
+ if (!(extranous.length > 0 || missing.length > 0)) return [3 /*break*/, 8];
109
+ instance.log("");
110
+ instance.log("\uD83D\uDE3F Oh no! There is something wrong with \"".concat(componentName, "\""));
111
+ instance.log("");
112
+ if (extranous.length > 0) {
113
+ instance.log("these secrets are not declared in the config");
114
+ extranous.forEach(function (key) { return instance.log(key); });
115
+ instance.log("");
116
+ }
117
+ if (missing.length > 0) {
118
+ instance.log("these secrets have not been provided:");
119
+ missing.forEach(function (key) { return instance.log(key); });
120
+ instance.log("");
121
+ }
122
+ return [4 /*yield*/, (0, promise_1.delay)(1000)];
123
+ case 6:
124
+ _d.sent();
125
+ return [4 /*yield*/, instance.prompt({
126
+ "default": true,
127
+ message: "Try again? 🤔",
128
+ name: "shouldContinue",
129
+ type: "confirm"
130
+ })];
131
+ case 7:
132
+ shouldContinue = (_d.sent()).shouldContinue;
133
+ if (!shouldContinue) {
134
+ throw new Error("abort");
135
+ }
136
+ hasErrors = true;
137
+ _d.label = 8;
138
+ case 8:
139
+ _i++;
140
+ return [3 /*break*/, 4];
141
+ case 9: return [3 /*break*/, 2];
142
+ case 10:
143
+ _c = 0, components_2 = components;
144
+ _d.label = 11;
145
+ case 11:
146
+ if (!(_c < components_2.length)) return [3 /*break*/, 14];
147
+ componentName = components_2[_c];
148
+ return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(this, valuesToEdit[componentName], env, componentName)];
149
+ case 12:
150
+ _d.sent();
151
+ _d.label = 13;
152
+ case 13:
153
+ _c++;
154
+ return [3 /*break*/, 11];
155
+ case 14: return [2 /*return*/];
156
+ }
157
+ });
158
+ }); };
159
+ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
160
+ var _a, _b;
161
+ return __generator(this, function (_c) {
162
+ switch (_c.label) {
163
+ case 0:
164
+ _b = (_a = vorpal
165
+ .command("project-config-secrets <envComponent>", "setup/update secrets stored in pass"))
166
+ .autocomplete;
167
+ return [4 /*yield*/, (0, autocompletions_1.allEnvsAndAllComponents)()];
168
+ case 1:
169
+ _b.apply(_a, [_c.sent()])
170
+ .action(function (_a) {
171
+ var envComponent = _a.envComponent;
172
+ return __awaiter(this, void 0, void 0, function () {
173
+ var _b, env, componentName, components;
174
+ return __generator(this, function (_c) {
175
+ switch (_c.label) {
176
+ case 0:
177
+ _b = (0, getProjectConfig_1.parseChoice)(envComponent), env = _b.env, componentName = _b.componentName;
178
+ if (!!componentName) return [3 /*break*/, 3];
179
+ return [4 /*yield*/, (0, getProjectConfig_1.getProjectComponents)()];
180
+ case 1:
181
+ components = _c.sent();
182
+ return [4 /*yield*/, doItFor(this, env, components)];
183
+ case 2:
184
+ _c.sent();
185
+ _c.label = 3;
186
+ case 3:
187
+ if (!componentName) return [3 /*break*/, 5];
188
+ return [4 /*yield*/, doItFor(this, env, [componentName])];
189
+ case 4:
190
+ _c.sent();
191
+ _c.label = 5;
192
+ case 5: return [2 /*return*/];
193
+ }
194
+ });
195
+ });
196
+ });
197
+ return [2 /*return*/];
198
+ }
199
+ });
200
+ }); }); /*
201
+ async function createNewEnvInPass(env: any, secretEnvVarsMapping: ISecrets) {
202
+ // const passPath = await getPassPath(env);
203
+ this.log(
204
+ "Your selected env is not yet in pass. Do you want to copy it from another env? "
205
+ );
206
+ const noAnswer = "No, I will create a new one from scratch.";
207
+ const { sourceEnv } = await this.prompt({
208
+ type: "list",
209
+ name: "sourceEnv",
210
+ choices: [...(await envAndComponents()).filter((e) => e !== env), noAnswer],
211
+ message: "Do you want to copy an env?",
212
+ });
213
+ // TODO: reimplenent
214
+ }
215
+ */
216
+ var templateObject_1;
217
+ //# sourceMappingURL=commandConfigSecrets.js.map