@catladder/cli 0.0.1-bla → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/.nvmrc +1 -1
  2. package/bin/catenv +3 -0
  3. package/bin/catladder +1 -1
  4. package/dist/apps/catenv/catenv.d.ts +2 -0
  5. package/dist/apps/catenv/catenv.js +135 -0
  6. package/dist/apps/catenv/catenv.js.map +1 -0
  7. package/dist/apps/cli/cli.d.ts +2 -0
  8. package/dist/apps/cli/cli.js +81 -0
  9. package/dist/apps/cli/cli.js.map +1 -0
  10. package/dist/apps/cli/commands/general/index.d.ts +4 -0
  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/cli/commands/general/namespaceAutoCompletion.d.ts +3 -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/cli/commands/mongodb/utils/index.d.ts +13 -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 +254 -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/cli/commands/project/commandMigrateHelm3.d.ts +7 -0
  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/commandReloadConfig.d.ts +3 -0
  104. package/dist/apps/cli/commands/project/commandReloadConfig.js +62 -0
  105. package/dist/apps/cli/commands/project/commandReloadConfig.js.map +1 -0
  106. package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
  107. package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
  108. package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
  109. package/dist/apps/cli/commands/project/index.d.ts +3 -0
  110. package/dist/apps/cli/commands/project/index.js +97 -0
  111. package/dist/apps/cli/commands/project/index.js.map +1 -0
  112. package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
  113. package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
  114. package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
  115. package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +1 -0
  116. package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
  117. package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
  118. package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +1 -0
  119. package/dist/apps/cli/commands/project/utils/ensureNamespace.js +92 -0
  120. package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
  121. package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +2 -0
  122. package/dist/apps/cli/commands/project/utils/showProjectBanner.js +58 -0
  123. package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -0
  124. package/dist/apps/cli/commands/shared/index.d.ts +2 -0
  125. package/dist/apps/cli/commands/shared/index.js +72 -0
  126. package/dist/apps/cli/commands/shared/index.js.map +1 -0
  127. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
  128. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +131 -0
  129. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
  130. package/dist/apps/cli/config/writeConfig.d.ts +5 -0
  131. package/dist/apps/cli/config/writeConfig.js +104 -0
  132. package/dist/apps/cli/config/writeConfig.js.map +1 -0
  133. package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -0
  134. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
  135. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
  136. package/dist/apps/cli/verify/index.d.ts +2 -0
  137. package/dist/apps/cli/verify/index.js +90 -0
  138. package/dist/apps/cli/verify/index.js.map +1 -0
  139. package/dist/apps/cli/verify/migration/fromv2.d.ts +3 -0
  140. package/dist/apps/cli/verify/migration/fromv2.js +322 -0
  141. package/dist/apps/cli/verify/migration/fromv2.js.map +1 -0
  142. package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +4 -0
  143. package/dist/apps/cli/verify/migration/migrateSecrets.js +88 -0
  144. package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -0
  145. package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +17 -0
  146. package/dist/apps/cli/verify/migration/oldGitlabCi.js +26 -0
  147. package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
  148. package/dist/catenv.d.ts +1 -0
  149. package/dist/catenv.js +8 -0
  150. package/dist/catenv.js.map +1 -0
  151. package/dist/cli.d.ts +1 -0
  152. package/dist/cli.js +13 -0
  153. package/dist/cli.js.map +1 -0
  154. package/dist/config/clusters.d.ts +14 -0
  155. package/dist/config/clusters.js +72 -0
  156. package/dist/config/clusters.js.map +1 -0
  157. package/dist/config/constants.d.ts +4 -0
  158. package/dist/config/constants.js +8 -0
  159. package/dist/config/constants.js.map +1 -0
  160. package/dist/config/getProjectConfig.d.ts +21 -0
  161. package/dist/config/getProjectConfig.js +212 -0
  162. package/dist/config/getProjectConfig.js.map +1 -0
  163. package/dist/k8sApi/index.d.ts +5 -0
  164. package/dist/k8sApi/index.js +11 -0
  165. package/dist/k8sApi/index.js.map +1 -0
  166. package/dist/packageInfos.d.ts +2 -0
  167. package/dist/packageInfos.js +6 -0
  168. package/dist/packageInfos.js.map +1 -0
  169. package/dist/tsconfig.tsbuildinfo +1 -0
  170. package/dist/types/types.d.ts +18 -0
  171. package/dist/types/types.js +3 -0
  172. package/dist/types/types.js.map +1 -0
  173. package/dist/utils/cluster.d.ts +12 -0
  174. package/dist/utils/cluster.js +100 -0
  175. package/dist/utils/cluster.js.map +1 -0
  176. package/dist/utils/editAsFile.d.ts +1 -0
  177. package/dist/utils/editAsFile.js +85 -0
  178. package/dist/utils/editAsFile.js.map +1 -0
  179. package/dist/utils/files.d.ts +2 -0
  180. package/dist/utils/files.js +83 -0
  181. package/dist/utils/files.js.map +1 -0
  182. package/dist/utils/formatEnvVars.d.ts +2 -0
  183. package/dist/utils/formatEnvVars.js +10 -0
  184. package/dist/utils/formatEnvVars.js.map +1 -0
  185. package/dist/utils/getEditor.d.ts +4 -0
  186. package/dist/utils/getEditor.js +70 -0
  187. package/dist/utils/getEditor.js.map +1 -0
  188. package/dist/utils/gitlab.d.ts +21 -0
  189. package/dist/utils/gitlab.js +258 -0
  190. package/dist/utils/gitlab.js.map +1 -0
  191. package/dist/utils/log.d.ts +1 -0
  192. package/dist/utils/log.js +14 -0
  193. package/dist/utils/log.js.map +1 -0
  194. package/dist/utils/passwordstore/index.d.ts +8 -0
  195. package/dist/utils/passwordstore/index.js +378 -0
  196. package/dist/utils/passwordstore/index.js.map +1 -0
  197. package/dist/utils/portForward.d.ts +4 -0
  198. package/dist/utils/portForward.js +116 -0
  199. package/dist/utils/portForward.js.map +1 -0
  200. package/dist/utils/preferences/index.d.ts +3 -0
  201. package/dist/utils/preferences/index.js +119 -0
  202. package/dist/utils/preferences/index.js.map +1 -0
  203. package/dist/utils/projects/index.d.ts +8 -0
  204. package/dist/utils/projects/index.js +150 -0
  205. package/dist/utils/projects/index.js.map +1 -0
  206. package/dist/utils/promise.d.ts +2 -0
  207. package/dist/utils/promise.js +62 -0
  208. package/dist/utils/promise.js.map +1 -0
  209. package/dist/utils/shell.d.ts +1 -0
  210. package/dist/utils/shell.js +81 -0
  211. package/dist/utils/shell.js.map +1 -0
  212. package/package.json +12 -20
  213. package/src/apps/catenv/catenv.ts +48 -27
  214. package/src/apps/{shell/shell.ts → cli/cli.ts} +10 -2
  215. package/src/apps/{shell → cli}/commands/general/index.ts +1 -1
  216. package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
  217. package/src/apps/{shell → cli}/commands/general/portForward.ts +1 -1
  218. package/src/apps/{shell → cli}/commands/mongodb/index.ts +1 -1
  219. package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +18 -18
  220. package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +12 -10
  221. package/src/apps/{shell → cli}/commands/mongodb/projectMongoPortForward.ts +13 -8
  222. package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +9 -8
  223. package/src/apps/{shell → cli}/commands/project/commandCloudSqlProxy.ts +23 -17
  224. package/src/apps/cli/commands/project/commandConfigSecrets.ts +208 -0
  225. package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +22 -23
  226. package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +8 -9
  227. package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +7 -8
  228. package/src/apps/cli/commands/project/commandEnvVars.ts +15 -0
  229. package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +2 -2
  230. package/src/apps/{shell → cli}/commands/project/commandGetShell.ts +10 -10
  231. package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +1 -1
  232. package/src/apps/cli/commands/project/commandInitGitlab.ts +203 -0
  233. package/src/apps/{shell → cli}/commands/project/commandInitProject.ts +14 -6
  234. package/src/apps/cli/commands/project/commandListPods.ts +18 -0
  235. package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +16 -7
  236. package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
  237. package/src/apps/{shell → cli}/commands/project/commandOpenCostDashboard.ts +10 -7
  238. package/src/apps/cli/commands/project/commandOpenDashboard.ts +45 -0
  239. package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
  240. package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +1 -1
  241. package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +7 -7
  242. package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +9 -10
  243. package/src/apps/{shell → cli}/commands/project/commandOpenLogs.ts +7 -7
  244. package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +9 -7
  245. package/src/apps/{shell → cli}/commands/project/commandPortForward.ts +8 -8
  246. package/src/apps/cli/commands/project/commandReloadConfig.ts +12 -0
  247. package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +7 -7
  248. package/src/apps/{shell → cli}/commands/project/index.ts +4 -3
  249. package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
  250. package/src/apps/cli/commands/project/utils/ensureCluster.ts +37 -0
  251. package/src/apps/{shell → cli}/commands/project/utils/ensureNamespace.ts +2 -3
  252. package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
  253. package/src/apps/{shell → cli}/commands/shared/index.ts +0 -0
  254. package/src/apps/{shell → cli}/commands/theStuffThatReallyMatters/index.ts +11 -11
  255. package/src/apps/cli/config/writeConfig.ts +69 -0
  256. package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
  257. package/src/apps/cli/verify/index.ts +34 -0
  258. package/src/apps/cli/verify/migration/fromv2.ts +241 -0
  259. package/src/apps/cli/verify/migration/migrateSecrets.ts +37 -0
  260. package/src/apps/cli/verify/migration/oldGitlabCi.ts +43 -0
  261. package/src/catenv.ts +3 -0
  262. package/src/cli.ts +8 -0
  263. package/src/config/getProjectConfig.ts +118 -0
  264. package/src/types/types.ts +0 -2
  265. package/src/utils/cluster.ts +15 -2
  266. package/src/utils/editAsFile.ts +31 -0
  267. package/src/utils/files.ts +6 -2
  268. package/src/utils/gitlab.ts +126 -32
  269. package/src/utils/passwordstore/index.ts +19 -21
  270. package/src/utils/preferences/index.ts +6 -3
  271. package/src/utils/projects/index.ts +14 -134
  272. package/tsconfig.json +3 -7
  273. package/bin/catenv.sh +0 -1
  274. package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -245
  275. package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
  276. package/src/apps/shell/commands/project/commandInitGitlab.ts +0 -157
  277. package/src/apps/shell/commands/project/commandListPods.ts +0 -21
  278. package/src/apps/shell/commands/project/commandNamespace.ts +0 -12
  279. package/src/apps/shell/commands/project/commandOpenDashboard.ts +0 -27
  280. package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
  281. package/src/apps/shell/commands/project/commandVariables.ts +0 -13
  282. package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -7
  283. package/src/apps/shell/commands/project/utils/ensureCluster.ts +0 -31
  284. package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
  285. package/src/index.ts +0 -17
  286. package/src/types/git-repo-name.d.ts +0 -1
  287. package/src/types/yawn-yaml.d.ts +0 -1
  288. package/src/utils/dashboardToken.ts +0 -20
@@ -0,0 +1,98 @@
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 k8sApi_1 = __importDefault(require("../../../../k8sApi"));
45
+ var namespaceAutoCompletion_1 = require("./namespaceAutoCompletion");
46
+ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
47
+ return __generator(this, function (_a) {
48
+ return [2 /*return*/, vorpal
49
+ .command("port-forward <namespace>", "start port-forwarding")
50
+ .autocomplete(namespaceAutoCompletion_1.namespaceAutoCompletion)
51
+ .action(function (_a) {
52
+ var namespace = _a.namespace;
53
+ return __awaiter(this, void 0, void 0, function () {
54
+ var res, podNames, podName, localPort, remotePort;
55
+ return __generator(this, function (_b) {
56
+ switch (_b.label) {
57
+ case 0: return [4 /*yield*/, k8sApi_1["default"].listNamespacedPod(namespace)];
58
+ case 1:
59
+ res = _b.sent();
60
+ if (res.body.items.length === 0) {
61
+ (0, log_1.logError)(this, "sorry, no pods found");
62
+ return [2 /*return*/];
63
+ }
64
+ podNames = res.body.items.map(function (i) { return i.metadata.name; });
65
+ if (podNames.length === 0) {
66
+ (0, log_1.logError)(this, "sorry, no pods found");
67
+ return [2 /*return*/];
68
+ }
69
+ return [4 /*yield*/, this.prompt({
70
+ type: "list",
71
+ name: "podName",
72
+ choices: podNames,
73
+ message: "Which pod? 🤔"
74
+ })];
75
+ case 2:
76
+ podName = (_b.sent()).podName;
77
+ return [4 /*yield*/, this.prompt({
78
+ type: "number",
79
+ name: "localPort",
80
+ message: "Local port: "
81
+ })];
82
+ case 3:
83
+ localPort = (_b.sent()).localPort;
84
+ return [4 /*yield*/, this.prompt({
85
+ type: "number",
86
+ name: "remotePort",
87
+ message: "Remote port: "
88
+ })];
89
+ case 4:
90
+ remotePort = (_b.sent()).remotePort;
91
+ return [2 /*return*/, (0, portForward_1.startPortForward)(podName, localPort, remotePort, namespace)];
92
+ }
93
+ });
94
+ });
95
+ })];
96
+ });
97
+ }); });
98
+ //# sourceMappingURL=portForward.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portForward.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/general/portForward.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6CAAiD;AAEjD,6DAAiE;AAEjE,8DAAwC;AACxC,qEAAoE;AAEpE,sBAAe,UAAO,MAAc;;QAClC,sBAAA,MAAM;iBACH,OAAO,CAAC,0BAA0B,EAAE,uBAAuB,CAAC;iBAC5D,YAAY,CAAC,iDAAuB,CAAC;iBACrC,MAAM,CAAC,UAAgB,EAAa;oBAAX,SAAS,eAAA;;;;;oCACrB,qBAAM,mBAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAA;;gCAA/C,GAAG,GAAG,SAAyC;gCACrD,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;oCAC/B,IAAA,cAAQ,EAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;oCACvC,sBAAO;iCACR;gCACK,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAf,CAAe,CAAC,CAAC;gCAE5D,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;oCACzB,IAAA,cAAQ,EAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;oCACvC,sBAAO;iCACR;gCACmB,qBAAM,IAAI,CAAC,MAAM,CAAC;wCACpC,IAAI,EAAE,MAAM;wCACZ,IAAI,EAAE,SAAS;wCACf,OAAO,EAAE,QAAQ;wCACjB,OAAO,EAAE,eAAe;qCACzB,CAAC,EAAA;;gCALM,OAAO,GAAK,CAAA,SAKlB,CAAA,QALa;gCAOO,qBAAM,IAAI,CAAC,MAAM,CAAC;wCACtC,IAAI,EAAE,QAAQ;wCACd,IAAI,EAAE,WAAW;wCAEjB,OAAO,EAAE,cAAc;qCACxB,CAAC,EAAA;;gCALM,SAAS,GAAK,CAAA,SAKpB,CAAA,UALe;gCAOM,qBAAM,IAAI,CAAC,MAAM,CAAC;wCACvC,IAAI,EAAE,QAAQ;wCACd,IAAI,EAAE,YAAY;wCAElB,OAAO,EAAE,eAAe;qCACzB,CAAC,EAAA;;gCALM,UAAU,GAAK,CAAA,SAKrB,CAAA,WALgB;gCAOlB,sBAAO,IAAA,8BAAgB,EAAC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,EAAC;;;;aACpE,CAAC,EAAA;;KAAA,EAAC"}
@@ -0,0 +1,3 @@
1
+ import Vorpal from "vorpal";
2
+ declare const _default: (vorpal: Vorpal) => Promise<void>;
3
+ export default _default;
@@ -0,0 +1,53 @@
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 projectMongoDestroyMember_1 = __importDefault(require("./projectMongoDestroyMember"));
43
+ var projectMongoGetShell_1 = __importDefault(require("./projectMongoGetShell"));
44
+ var projectMongoPortForward_1 = __importDefault(require("./projectMongoPortForward"));
45
+ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
46
+ return __generator(this, function (_a) {
47
+ (0, projectMongoGetShell_1["default"])(vorpal);
48
+ (0, projectMongoPortForward_1["default"])(vorpal);
49
+ (0, projectMongoDestroyMember_1["default"])(vorpal);
50
+ return [2 /*return*/];
51
+ });
52
+ }); });
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/mongodb/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0FAAoE;AACpE,gFAA0D;AAC1D,sFAAgE;AAEhE,sBAAe,UAAO,MAAc;;QAClC,IAAA,iCAAoB,EAAC,MAAM,CAAC,CAAC;QAC7B,IAAA,oCAAuB,EAAC,MAAM,CAAC,CAAC;QAChC,IAAA,sCAAyB,EAAC,MAAM,CAAC,CAAC;;;KACnC,EAAC"}
@@ -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,190 @@
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 child_process_promise_1 = require("child-process-promise");
43
+ var log_1 = require("../../../../utils/log");
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
+ var removeFinalizer = function (namespace, type, name) { return __awaiter(void 0, void 0, void 0, function () {
49
+ return __generator(this, function (_a) {
50
+ return [2 /*return*/, (0, child_process_promise_1.exec)("kubectl patch --namespace ".concat(namespace, " ").concat(type, " ").concat(name, " -p '{\"metadata\":{\"finalizers\":null}}'"))];
51
+ });
52
+ }); };
53
+ var deleteResource = function (namespace, type, name) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
54
+ return [2 /*return*/, (0, child_process_promise_1.exec)("kubectl delete --namespace ".concat(namespace, " ").concat(type, " ").concat(name))];
55
+ }); }); };
56
+ var removeFinalizerAndDelete = function (namespace, type, name) { return __awaiter(void 0, void 0, void 0, function () {
57
+ var _a, _b, _c;
58
+ return __generator(this, function (_d) {
59
+ switch (_d.label) {
60
+ case 0:
61
+ _b = (_a = Promise).all;
62
+ _c = [removeFinalizer(namespace, type, name)];
63
+ return [4 /*yield*/, deleteResource(namespace, type, name)];
64
+ case 1: return [2 /*return*/, _b.apply(_a, [_c.concat([
65
+ _d.sent()
66
+ ])])];
67
+ }
68
+ });
69
+ }); };
70
+ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
71
+ var _a, _b;
72
+ return __generator(this, function (_c) {
73
+ switch (_c.label) {
74
+ case 0:
75
+ _b = (_a = vorpal
76
+ .command("project-mongo-destroy-member <envComponent>", "DESTROY a member of a replicaset in order to reinitialize it"))
77
+ .autocomplete;
78
+ return [4 /*yield*/, (0, autocompletions_1.envAndComponents)()];
79
+ case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])
80
+ .action(function (_a) {
81
+ var envComponent = _a.envComponent;
82
+ return __awaiter(this, void 0, void 0, function () {
83
+ var understood, namespace, mongodbPods, pvcs, secondaries, podName, thePvc, shouldContinue, e_1, e_2;
84
+ return __generator(this, function (_b) {
85
+ switch (_b.label) {
86
+ case 0: return [4 /*yield*/, ensureCluster_1["default"].call(this, envComponent)];
87
+ case 1:
88
+ _b.sent();
89
+ this.log("this command tries to delete a (secondary) member of the replicaset, it's persistent volume claim (pvc) and the volume");
90
+ this.log("");
91
+ this.log("this is useful, if you update the stateful set with new volume configuration (different size or storage class)");
92
+ this.log("");
93
+ this.log("Kubernetes will usually recreate the missing member with the updated config and mongodb will start synchronizing the new member.");
94
+ this.log("");
95
+ this.log("This works without downtime, but should be done when load on the db is low. Also it has not been tested with large dbs (> 10gi)");
96
+ this.log("");
97
+ this.log("Deleting the volume and claim often stuck, just wait or cancel and restart.");
98
+ this.log("");
99
+ return [4 /*yield*/, this.prompt({
100
+ "default": true,
101
+ message: "DO YOU UNDERSTAND?",
102
+ name: "understood",
103
+ type: "confirm"
104
+ })];
105
+ case 2:
106
+ understood = (_b.sent()).understood;
107
+ if (!understood) {
108
+ throw new Error("abort");
109
+ }
110
+ return [4 /*yield*/, (0, projects_1.getProjectNamespace)(envComponent)];
111
+ case 3:
112
+ namespace = _b.sent();
113
+ return [4 /*yield*/, (0, utils_1.getMongoDbPodsWithReplInfo)(envComponent)];
114
+ case 4:
115
+ mongodbPods = _b.sent();
116
+ return [4 /*yield*/, (0, projects_1.getProjectPvcs)(envComponent)];
117
+ case 5:
118
+ pvcs = _b.sent();
119
+ secondaries = mongodbPods.filter(function (pod) { return !pod.isMaster; });
120
+ if (secondaries.length === 0) {
121
+ (0, log_1.logError)(this, "sorry, no pods found");
122
+ return [2 /*return*/];
123
+ }
124
+ return [4 /*yield*/, this.prompt({
125
+ type: "list",
126
+ name: "podName",
127
+ choices: secondaries.map(function (p) { return ({
128
+ name: "[ secondary ] ".concat(p.podName),
129
+ value: p.podName
130
+ }); }),
131
+ message: "Which pod? 🤔"
132
+ })];
133
+ case 6:
134
+ podName = (_b.sent()).podName;
135
+ thePvc = pvcs.find(function (pvc) { return pvc.metadata.name === "datadir-".concat(podName); });
136
+ if (!thePvc) {
137
+ (0, log_1.logError)(this, "sorry, no pvc found for ".concat(podName));
138
+ return [2 /*return*/];
139
+ }
140
+ return [4 /*yield*/, this.prompt({
141
+ "default": true,
142
+ message: "THIS WILL DESTROY THE POD, ITS VOLUME AND ALL ITS DATA 🙀🙀🙀!!! continue? 🤔",
143
+ name: "shouldContinue",
144
+ type: "confirm"
145
+ })];
146
+ case 7:
147
+ shouldContinue = (_b.sent()).shouldContinue;
148
+ if (!shouldContinue) {
149
+ throw new Error("abort");
150
+ }
151
+ // force delete, see https://github.com/kubernetes/kubernetes/issues/77258#issuecomment-502209800
152
+ this.log("destroying volume...");
153
+ _b.label = 8;
154
+ case 8:
155
+ _b.trys.push([8, 10, , 11]);
156
+ return [4 /*yield*/, removeFinalizerAndDelete(namespace, "pv", thePvc.spec.volumeName)];
157
+ case 9:
158
+ _b.sent();
159
+ return [3 /*break*/, 11];
160
+ case 10:
161
+ e_1 = _b.sent();
162
+ this.log(e_1.message);
163
+ return [3 /*break*/, 11];
164
+ case 11:
165
+ this.log("destroying volume claim...");
166
+ _b.label = 12;
167
+ case 12:
168
+ _b.trys.push([12, 14, , 15]);
169
+ return [4 /*yield*/, removeFinalizerAndDelete(namespace, "pvc", thePvc.metadata.name)];
170
+ case 13:
171
+ _b.sent();
172
+ return [3 /*break*/, 15];
173
+ case 14:
174
+ e_2 = _b.sent();
175
+ this.log(e_2.message);
176
+ return [3 /*break*/, 15];
177
+ case 15:
178
+ this.log("destroying pod...");
179
+ return [4 /*yield*/, removeFinalizerAndDelete(namespace, "pod", podName)];
180
+ case 16:
181
+ _b.sent();
182
+ return [2 /*return*/];
183
+ }
184
+ });
185
+ });
186
+ })];
187
+ }
188
+ });
189
+ }); });
190
+ //# sourceMappingURL=projectMongoDestroyMember.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectMongoDestroyMember.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/mongodb/projectMongoDestroyMember.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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M,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAA;;oCAAtE,SAAsE,CAAC;;;;oCAEvE,IAAI,CAAC,GAAG,CAAC,GAAC,CAAC,OAAO,CAAC,CAAC;;;oCAEtB,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;oCAC9B,qBAAM,wBAAwB,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,EAAA;;oCAAzD,SAAyD,CAAC;;;;;iBAC3D,CAAC,EAAA;;;KAAA,EAAC"}
@@ -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,96 @@
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 projects_1 = require("../../../../utils/projects");
44
+ var autocompletions_1 = require("../project/utils/autocompletions");
45
+ var ensureCluster_1 = __importDefault(require("../project/utils/ensureCluster"));
46
+ var utils_1 = require("./utils");
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-mongo-get-shell <envComponent>", "get a shell to a mongodb in the environment"))
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 envComponent = _a.envComponent;
59
+ return __awaiter(this, void 0, void 0, function () {
60
+ var namespace, podNames, podName;
61
+ return __generator(this, function (_b) {
62
+ switch (_b.label) {
63
+ case 0: return [4 /*yield*/, ensureCluster_1["default"].call(this, envComponent)];
64
+ case 1:
65
+ _b.sent();
66
+ return [4 /*yield*/, (0, projects_1.getProjectNamespace)(envComponent)];
67
+ case 2:
68
+ namespace = _b.sent();
69
+ return [4 /*yield*/, (0, utils_1.getProjectMongodbAllPodsSortedWithLabel)(envComponent)];
70
+ case 3:
71
+ podNames = _b.sent();
72
+ if (podNames.length === 0) {
73
+ (0, log_1.logError)(this, "sorry, no pods found");
74
+ return [2 /*return*/];
75
+ }
76
+ if (!(podNames.length === 1)) return [3 /*break*/, 4];
77
+ podName = podNames[0];
78
+ return [3 /*break*/, 6];
79
+ case 4: return [4 /*yield*/, this.prompt({
80
+ type: "list",
81
+ name: "podName",
82
+ choices: podNames,
83
+ message: "Which pod? 🤔"
84
+ })];
85
+ case 5:
86
+ podName = (_b.sent()).podName;
87
+ _b.label = 6;
88
+ case 6: return [2 /*return*/, (0, utils_1.getMongodbShell)(namespace, podName)];
89
+ }
90
+ });
91
+ });
92
+ })];
93
+ }
94
+ });
95
+ }); });
96
+ //# sourceMappingURL=projectMongoGetShell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectMongoGetShell.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/mongodb/projectMongoGetShell.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6CAAiD;AACjD,uDAAiE;AACjE,oEAAoE;AACpE,iFAA2D;AAC3D,iCAGiB;AAEjB,sBAAe,UAAO,MAAc;;;;;gBAClC,KAAA,CAAA,KAAA,MAAM;qBACH,OAAO,CACN,wCAAwC,EACxC,6CAA6C,CAC9C,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;;wCAGpB,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;;wCAGZ,sBAAO,IAAA,uBAAe,EAAC,SAAS,EAAE,OAAO,CAAC,EAAC;;;;iBAC5C,CAAC,EAAA;;;KAAA,EAAC"}
@@ -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,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,13 @@
1
+ export declare const getProjectMongodbAllPods: (envComponent: string) => Promise<string[]>;
2
+ export declare const getMongodbShell: (namespace: string, podName: string) => Promise<void>;
3
+ export declare const executeMongodbCommand: (namespace: string, podName: string, mongoCommand: string) => Promise<any>;
4
+ export declare const podIsMaster: (namespace: string, podName: string) => Promise<any>;
5
+ export declare const getMongoDbPodsWithReplInfo: (envComponent: string) => Promise<{
6
+ podName: string;
7
+ componentName: string;
8
+ isMaster: any;
9
+ }[]>;
10
+ export declare const getProjectMongodbAllPodsSortedWithLabel: (envComponent: string) => Promise<{
11
+ value: string;
12
+ name: string;
13
+ }[]>;