@catladder/cli 0.0.0-main-6a946974 → 0.0.0-main-7c9385f9

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 (397) hide show
  1. package/dist/bundles/catci/index.js +253 -514
  2. package/dist/bundles/catenv/index.js +2984 -6491
  3. package/dist/bundles/cli/index.js +5263 -13083
  4. package/dist/cli/src/apps/catci/catci.js +19 -91
  5. package/dist/cli/src/apps/catci/catci.js.map +1 -1
  6. package/dist/cli/src/apps/catci/commands/security/auditDocument.js +73 -79
  7. package/dist/cli/src/apps/catci/commands/security/auditDocument.js.map +1 -1
  8. package/dist/cli/src/apps/catci/commands/security/commands.js +94 -169
  9. package/dist/cli/src/apps/catci/commands/security/commands.js.map +1 -1
  10. package/dist/cli/src/apps/catci/commands/security/createSecurityAuditMergeRequest.js +42 -102
  11. package/dist/cli/src/apps/catci/commands/security/createSecurityAuditMergeRequest.js.map +1 -1
  12. package/dist/cli/src/apps/catci/commands/security/evaluateSecurityAudit.js +19 -67
  13. package/dist/cli/src/apps/catci/commands/security/evaluateSecurityAudit.js.map +1 -1
  14. package/dist/cli/src/apps/catenv/catenv.js +18 -64
  15. package/dist/cli/src/apps/catenv/catenv.js.map +1 -1
  16. package/dist/cli/src/apps/catenv/printVariables.js +36 -123
  17. package/dist/cli/src/apps/catenv/printVariables.js.map +1 -1
  18. package/dist/cli/src/apps/catenv/utils.js +26 -112
  19. package/dist/cli/src/apps/catenv/utils.js.map +1 -1
  20. package/dist/cli/src/apps/catenv/writeDotEnvFiles.js +28 -132
  21. package/dist/cli/src/apps/catenv/writeDotEnvFiles.js.map +1 -1
  22. package/dist/cli/src/apps/catenv/writeEnvDTs.js +49 -150
  23. package/dist/cli/src/apps/catenv/writeEnvDTs.js.map +1 -1
  24. package/dist/cli/src/apps/cli/cli.js +31 -76
  25. package/dist/cli/src/apps/cli/cli.js.map +1 -1
  26. package/dist/cli/src/apps/cli/commands/cloudSQL/commandRestoreDb.js +106 -180
  27. package/dist/cli/src/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +1 -1
  28. package/dist/cli/src/apps/cli/commands/cloudSQL/index.js +4 -43
  29. package/dist/cli/src/apps/cli/commands/cloudSQL/index.js.map +1 -1
  30. package/dist/cli/src/apps/cli/commands/general/index.js +67 -191
  31. package/dist/cli/src/apps/cli/commands/general/index.js.map +1 -1
  32. package/dist/cli/src/apps/cli/commands/general/namespaceAutoCompletion.js +4 -49
  33. package/dist/cli/src/apps/cli/commands/general/namespaceAutoCompletion.js.map +1 -1
  34. package/dist/cli/src/apps/cli/commands/general/portForward.js +36 -93
  35. package/dist/cli/src/apps/cli/commands/general/portForward.js.map +1 -1
  36. package/dist/cli/src/apps/cli/commands/mongodb/index.js +8 -47
  37. package/dist/cli/src/apps/cli/commands/mongodb/index.js.map +1 -1
  38. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoDestroyMember.js +86 -183
  39. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -1
  40. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoGetShell.js +30 -90
  41. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoGetShell.js.map +1 -1
  42. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoPortForward.js +50 -114
  43. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -1
  44. package/dist/cli/src/apps/cli/commands/mongodb/utils/index.js +58 -192
  45. package/dist/cli/src/apps/cli/commands/mongodb/utils/index.js.map +1 -1
  46. package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js +118 -197
  47. package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js.map +1 -1
  48. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js +81 -160
  49. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
  50. package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.js +134 -397
  51. package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.js.map +1 -1
  52. package/dist/cli/src/apps/cli/commands/project/commandDeletePods.js +40 -140
  53. package/dist/cli/src/apps/cli/commands/project/commandDeletePods.js.map +1 -1
  54. package/dist/cli/src/apps/cli/commands/project/commandDeleteProject.js +23 -92
  55. package/dist/cli/src/apps/cli/commands/project/commandDeleteProject.js.map +1 -1
  56. package/dist/cli/src/apps/cli/commands/project/commandEnvVars.js +10 -71
  57. package/dist/cli/src/apps/cli/commands/project/commandEnvVars.js.map +1 -1
  58. package/dist/cli/src/apps/cli/commands/project/commandGetMyTotalWorktime.js +7 -54
  59. package/dist/cli/src/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -1
  60. package/dist/cli/src/apps/cli/commands/project/commandGetShell.js +27 -89
  61. package/dist/cli/src/apps/cli/commands/project/commandGetShell.js.map +1 -1
  62. package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.js +65 -180
  63. package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.js.map +1 -1
  64. package/dist/cli/src/apps/cli/commands/project/commandListPods.js +13 -72
  65. package/dist/cli/src/apps/cli/commands/project/commandListPods.js.map +1 -1
  66. package/dist/cli/src/apps/cli/commands/project/commandMigrateHelm3.js +38 -104
  67. package/dist/cli/src/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -1
  68. package/dist/cli/src/apps/cli/commands/project/commandNamespace.js +8 -67
  69. package/dist/cli/src/apps/cli/commands/project/commandNamespace.js.map +1 -1
  70. package/dist/cli/src/apps/cli/commands/project/commandOpenCostDashboard.js +16 -77
  71. package/dist/cli/src/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -1
  72. package/dist/cli/src/apps/cli/commands/project/commandOpenDashboard.js +18 -81
  73. package/dist/cli/src/apps/cli/commands/project/commandOpenDashboard.js.map +1 -1
  74. package/dist/cli/src/apps/cli/commands/project/commandOpenEnv.js +14 -74
  75. package/dist/cli/src/apps/cli/commands/project/commandOpenEnv.js.map +1 -1
  76. package/dist/cli/src/apps/cli/commands/project/commandOpenGit.js +6 -53
  77. package/dist/cli/src/apps/cli/commands/project/commandOpenGit.js.map +1 -1
  78. package/dist/cli/src/apps/cli/commands/project/commandOpenGrafana.js +16 -77
  79. package/dist/cli/src/apps/cli/commands/project/commandOpenGrafana.js.map +1 -1
  80. package/dist/cli/src/apps/cli/commands/project/commandOpenGrafanaPod.js +28 -93
  81. package/dist/cli/src/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -1
  82. package/dist/cli/src/apps/cli/commands/project/commandOpenLogs.js +11 -71
  83. package/dist/cli/src/apps/cli/commands/project/commandOpenLogs.js.map +1 -1
  84. package/dist/cli/src/apps/cli/commands/project/commandPauseProject.js +23 -92
  85. package/dist/cli/src/apps/cli/commands/project/commandPauseProject.js.map +1 -1
  86. package/dist/cli/src/apps/cli/commands/project/commandPortForward.js +71 -163
  87. package/dist/cli/src/apps/cli/commands/project/commandPortForward.js.map +1 -1
  88. package/dist/cli/src/apps/cli/commands/project/commandRenewToken.js +6 -55
  89. package/dist/cli/src/apps/cli/commands/project/commandRenewToken.js.map +1 -1
  90. package/dist/cli/src/apps/cli/commands/project/commandSecretsClearBackups.js +17 -112
  91. package/dist/cli/src/apps/cli/commands/project/commandSecretsClearBackups.js.map +1 -1
  92. package/dist/cli/src/apps/cli/commands/project/commandSecurityEvaluate.js +15 -66
  93. package/dist/cli/src/apps/cli/commands/project/commandSecurityEvaluate.js.map +1 -1
  94. package/dist/cli/src/apps/cli/commands/project/commandSetup.js +6 -55
  95. package/dist/cli/src/apps/cli/commands/project/commandSetup.js.map +1 -1
  96. package/dist/cli/src/apps/cli/commands/project/commandTriggerCronjob.js +47 -135
  97. package/dist/cli/src/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -1
  98. package/dist/cli/src/apps/cli/commands/project/index.js +54 -93
  99. package/dist/cli/src/apps/cli/commands/project/index.js.map +1 -1
  100. package/dist/cli/src/apps/cli/commands/project/setup/index.js +39 -127
  101. package/dist/cli/src/apps/cli/commands/project/setup/index.js.map +1 -1
  102. package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.js +35 -100
  103. package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
  104. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js +52 -129
  105. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
  106. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js +19 -68
  107. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js.map +1 -1
  108. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js +106 -147
  109. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
  110. package/dist/cli/src/apps/cli/commands/project/setup/setupTopic.js +7 -80
  111. package/dist/cli/src/apps/cli/commands/project/setup/setupTopic.js.map +1 -1
  112. package/dist/cli/src/apps/cli/commands/project/utils/autocompletions.js +16 -105
  113. package/dist/cli/src/apps/cli/commands/project/utils/autocompletions.js.map +1 -1
  114. package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js +28 -79
  115. package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js.map +1 -1
  116. package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js +32 -89
  117. package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
  118. package/dist/cli/src/apps/cli/commands/project/utils/showProjectBanner.js +9 -53
  119. package/dist/cli/src/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -1
  120. package/dist/cli/src/apps/cli/commands/theStuffThatReallyMatters/index.js +26 -92
  121. package/dist/cli/src/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -1
  122. package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.js +13 -62
  123. package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -1
  124. package/dist/cli/src/apps/cli/verify/index.js +10 -62
  125. package/dist/cli/src/apps/cli/verify/index.js.map +1 -1
  126. package/dist/cli/src/catci.js +1 -1
  127. package/dist/cli/src/catci.js.map +1 -1
  128. package/dist/cli/src/catenv.js +8 -8
  129. package/dist/cli/src/catenv.js.map +1 -1
  130. package/dist/cli/src/cli.js +1 -1
  131. package/dist/cli/src/cli.js.map +1 -1
  132. package/dist/cli/src/config/getProjectConfig.js +118 -278
  133. package/dist/cli/src/config/getProjectConfig.js.map +1 -1
  134. package/dist/cli/src/config/parseChoice.js +3 -19
  135. package/dist/cli/src/config/parseChoice.js.map +1 -1
  136. package/dist/cli/src/gcloud/artifactsRegistry.js +10 -54
  137. package/dist/cli/src/gcloud/artifactsRegistry.js.map +1 -1
  138. package/dist/cli/src/gcloud/cloudRun/getCloudRunDomainSuffix.js +21 -60
  139. package/dist/cli/src/gcloud/cloudRun/getCloudRunDomainSuffix.js.map +1 -1
  140. package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js +12 -57
  141. package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -1
  142. package/dist/cli/src/gcloud/cloudSql/copyDb.js +30 -56
  143. package/dist/cli/src/gcloud/cloudSql/copyDb.js.map +1 -1
  144. package/dist/cli/src/gcloud/cloudSql/startProxy.js +41 -123
  145. package/dist/cli/src/gcloud/cloudSql/startProxy.js.map +1 -1
  146. package/dist/cli/src/gcloud/enableServices.js +6 -82
  147. package/dist/cli/src/gcloud/enableServices.js.map +1 -1
  148. package/dist/cli/src/gcloud/openDashboard.js +12 -95
  149. package/dist/cli/src/gcloud/openDashboard.js.map +1 -1
  150. package/dist/cli/src/gcloud/serviceAccounts.js +63 -186
  151. package/dist/cli/src/gcloud/serviceAccounts.js.map +1 -1
  152. package/dist/cli/src/k8sApi/index.js +9 -9
  153. package/dist/cli/src/k8sApi/index.js.map +1 -1
  154. package/dist/cli/src/kubernetes/index.js +20 -81
  155. package/dist/cli/src/kubernetes/index.js.map +1 -1
  156. package/dist/cli/src/kubernetes/openKubernetesDashboards.js +32 -86
  157. package/dist/cli/src/kubernetes/openKubernetesDashboards.js.map +1 -1
  158. package/dist/cli/src/kubernetes/portForward.js +5 -50
  159. package/dist/cli/src/kubernetes/portForward.js.map +1 -1
  160. package/dist/cli/src/packageInfos.js +2 -2
  161. package/dist/cli/src/packageInfos.js.map +1 -1
  162. package/dist/cli/src/utils/boxWithAscii.js +6 -6
  163. package/dist/cli/src/utils/boxWithAscii.js.map +1 -1
  164. package/dist/cli/src/utils/cluster.js +8 -61
  165. package/dist/cli/src/utils/cluster.js.map +1 -1
  166. package/dist/cli/src/utils/editAsFile.js +21 -75
  167. package/dist/cli/src/utils/editAsFile.js.map +1 -1
  168. package/dist/cli/src/utils/files.js +11 -57
  169. package/dist/cli/src/utils/files.js.map +1 -1
  170. package/dist/cli/src/utils/getEditor.js +15 -71
  171. package/dist/cli/src/utils/getEditor.js.map +1 -1
  172. package/dist/cli/src/utils/gitlab.js +176 -466
  173. package/dist/cli/src/utils/gitlab.js.map +1 -1
  174. package/dist/cli/src/utils/log.js +2 -2
  175. package/dist/cli/src/utils/log.js.map +1 -1
  176. package/dist/cli/src/utils/portForwards.js +32 -120
  177. package/dist/cli/src/utils/portForwards.js.map +1 -1
  178. package/dist/cli/src/utils/preferences/index.js +27 -108
  179. package/dist/cli/src/utils/preferences/index.js.map +1 -1
  180. package/dist/cli/src/utils/projects/index.js +28 -116
  181. package/dist/cli/src/utils/projects/index.js.map +1 -1
  182. package/dist/cli/src/utils/promise.js +4 -55
  183. package/dist/cli/src/utils/promise.js.map +1 -1
  184. package/dist/cli/src/utils/shell.js +19 -75
  185. package/dist/cli/src/utils/shell.js.map +1 -1
  186. package/dist/pipeline/src/bash/BashExpression.js +20 -52
  187. package/dist/pipeline/src/bash/BashExpression.js.map +1 -1
  188. package/dist/pipeline/src/bash/bashExpressionPerPipelineType.js +1 -1
  189. package/dist/pipeline/src/bash/bashExpressionPerPipelineType.js.map +1 -1
  190. package/dist/pipeline/src/bash/bashYaml.js +13 -10
  191. package/dist/pipeline/src/bash/bashYaml.js.map +1 -1
  192. package/dist/pipeline/src/bash/getInjectVarsScript.js +5 -27
  193. package/dist/pipeline/src/bash/getInjectVarsScript.js.map +1 -1
  194. package/dist/pipeline/src/bash/replaceAsync.js +29 -79
  195. package/dist/pipeline/src/bash/replaceAsync.js.map +1 -1
  196. package/dist/pipeline/src/build/artifacts/createBuildJobArtifact.js +29 -60
  197. package/dist/pipeline/src/build/artifacts/createBuildJobArtifact.js.map +1 -1
  198. package/dist/pipeline/src/build/base/createAppBuildJob.js +40 -72
  199. package/dist/pipeline/src/build/base/createAppBuildJob.js.map +1 -1
  200. package/dist/pipeline/src/build/base/createArtifactsConfig.js +11 -40
  201. package/dist/pipeline/src/build/base/createArtifactsConfig.js.map +1 -1
  202. package/dist/pipeline/src/build/base/index.js +36 -62
  203. package/dist/pipeline/src/build/base/index.js.map +1 -1
  204. package/dist/pipeline/src/build/base/writeBuildInfo.js +2 -2
  205. package/dist/pipeline/src/build/base/writeBuildInfo.js.map +1 -1
  206. package/dist/pipeline/src/build/base/writeDotEnv.js +13 -36
  207. package/dist/pipeline/src/build/base/writeDotEnv.js.map +1 -1
  208. package/dist/pipeline/src/build/custom/buildJob.js +8 -33
  209. package/dist/pipeline/src/build/custom/buildJob.js.map +1 -1
  210. package/dist/pipeline/src/build/custom/index.js +4 -29
  211. package/dist/pipeline/src/build/custom/index.js.map +1 -1
  212. package/dist/pipeline/src/build/custom/testJob.js +41 -50
  213. package/dist/pipeline/src/build/custom/testJob.js.map +1 -1
  214. package/dist/pipeline/src/build/docker.js +72 -104
  215. package/dist/pipeline/src/build/docker.js.map +1 -1
  216. package/dist/pipeline/src/build/index.js +17 -17
  217. package/dist/pipeline/src/build/index.js.map +1 -1
  218. package/dist/pipeline/src/build/node/buildJob.js +24 -45
  219. package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
  220. package/dist/pipeline/src/build/node/cache.js +31 -54
  221. package/dist/pipeline/src/build/node/cache.js.map +1 -1
  222. package/dist/pipeline/src/build/node/index.js +9 -34
  223. package/dist/pipeline/src/build/node/index.js.map +1 -1
  224. package/dist/pipeline/src/build/node/meteor.js +16 -40
  225. package/dist/pipeline/src/build/node/meteor.js.map +1 -1
  226. package/dist/pipeline/src/build/node/testJob.js +69 -66
  227. package/dist/pipeline/src/build/node/testJob.js.map +1 -1
  228. package/dist/pipeline/src/build/node/yarn.js +35 -51
  229. package/dist/pipeline/src/build/node/yarn.js.map +1 -1
  230. package/dist/pipeline/src/build/rails/build.js +22 -57
  231. package/dist/pipeline/src/build/rails/build.js.map +1 -1
  232. package/dist/pipeline/src/build/rails/index.js +4 -29
  233. package/dist/pipeline/src/build/rails/index.js.map +1 -1
  234. package/dist/pipeline/src/build/rails/test.js +60 -66
  235. package/dist/pipeline/src/build/rails/test.js.map +1 -1
  236. package/dist/pipeline/src/build/sbom.js +12 -12
  237. package/dist/pipeline/src/build/sbom.js.map +1 -1
  238. package/dist/pipeline/src/build/types.js +2 -6
  239. package/dist/pipeline/src/build/types.js.map +1 -1
  240. package/dist/pipeline/src/config/configruedEnvs.js +18 -47
  241. package/dist/pipeline/src/config/configruedEnvs.js.map +1 -1
  242. package/dist/pipeline/src/config/readConfig.js +26 -101
  243. package/dist/pipeline/src/config/readConfig.js.map +1 -1
  244. package/dist/pipeline/src/context/createAllComponentsContext.js +16 -63
  245. package/dist/pipeline/src/context/createAllComponentsContext.js.map +1 -1
  246. package/dist/pipeline/src/context/createComponentContext.js +93 -170
  247. package/dist/pipeline/src/context/createComponentContext.js.map +1 -1
  248. package/dist/pipeline/src/context/createWorkspaceContext.js +30 -80
  249. package/dist/pipeline/src/context/createWorkspaceContext.js.map +1 -1
  250. package/dist/pipeline/src/context/getBuildInfoVariables.js +12 -31
  251. package/dist/pipeline/src/context/getBuildInfoVariables.js.map +1 -1
  252. package/dist/pipeline/src/context/getEnvConfig.js +4 -4
  253. package/dist/pipeline/src/context/getEnvConfig.js.map +1 -1
  254. package/dist/pipeline/src/context/getEnvType.js +2 -2
  255. package/dist/pipeline/src/context/getEnvType.js.map +1 -1
  256. package/dist/pipeline/src/context/getEnvironment.js +17 -64
  257. package/dist/pipeline/src/context/getEnvironment.js.map +1 -1
  258. package/dist/pipeline/src/context/getEnvironmentContext.js +21 -22
  259. package/dist/pipeline/src/context/getEnvironmentContext.js.map +1 -1
  260. package/dist/pipeline/src/context/getEnvironmentVariables.js +109 -169
  261. package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
  262. package/dist/pipeline/src/context/getLabels.js +12 -15
  263. package/dist/pipeline/src/context/getLabels.js.map +1 -1
  264. package/dist/pipeline/src/context/getReviewSlug.js +7 -7
  265. package/dist/pipeline/src/context/getReviewSlug.js.map +1 -1
  266. package/dist/pipeline/src/context/resolveReferences.js +51 -172
  267. package/dist/pipeline/src/context/resolveReferences.js.map +1 -1
  268. package/dist/pipeline/src/context/transformJobOnlyVars.js +22 -69
  269. package/dist/pipeline/src/context/transformJobOnlyVars.js.map +1 -1
  270. package/dist/pipeline/src/context/utils/envVars.js +13 -39
  271. package/dist/pipeline/src/context/utils/envVars.js.map +1 -1
  272. package/dist/pipeline/src/deploy/base/deploy.js +60 -82
  273. package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
  274. package/dist/pipeline/src/deploy/base/index.js +11 -34
  275. package/dist/pipeline/src/deploy/base/index.js.map +1 -1
  276. package/dist/pipeline/src/deploy/base/rollback.js +11 -15
  277. package/dist/pipeline/src/deploy/base/rollback.js.map +1 -1
  278. package/dist/pipeline/src/deploy/base/stop.js +11 -15
  279. package/dist/pipeline/src/deploy/base/stop.js.map +1 -1
  280. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js +41 -64
  281. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js.map +1 -1
  282. package/dist/pipeline/src/deploy/cloudRun/cleanup.js +8 -33
  283. package/dist/pipeline/src/deploy/cloudRun/cleanup.js.map +1 -1
  284. package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.js +25 -30
  285. package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.js.map +1 -1
  286. package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunJobs.js +92 -136
  287. package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunJobs.js.map +1 -1
  288. package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js +44 -61
  289. package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js.map +1 -1
  290. package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js +25 -53
  291. package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js.map +1 -1
  292. package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +36 -47
  293. package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
  294. package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.js +22 -39
  295. package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.js.map +1 -1
  296. package/dist/pipeline/src/deploy/cloudRun/createJobs/index.js +27 -33
  297. package/dist/pipeline/src/deploy/cloudRun/createJobs/index.js.map +1 -1
  298. package/dist/pipeline/src/deploy/cloudRun/createJobs/volumes.js +7 -34
  299. package/dist/pipeline/src/deploy/cloudRun/createJobs/volumes.js.map +1 -1
  300. package/dist/pipeline/src/deploy/cloudRun/index.js +38 -75
  301. package/dist/pipeline/src/deploy/cloudRun/index.js.map +1 -1
  302. package/dist/pipeline/src/deploy/cloudRun/utils/createArgsString.js +14 -42
  303. package/dist/pipeline/src/deploy/cloudRun/utils/createArgsString.js.map +1 -1
  304. package/dist/pipeline/src/deploy/cloudRun/utils/database.js +14 -30
  305. package/dist/pipeline/src/deploy/cloudRun/utils/database.js.map +1 -1
  306. package/dist/pipeline/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +5 -5
  307. package/dist/pipeline/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js.map +1 -1
  308. package/dist/pipeline/src/deploy/cloudRun/utils/getServiceName.js +1 -3
  309. package/dist/pipeline/src/deploy/cloudRun/utils/getServiceName.js.map +1 -1
  310. package/dist/pipeline/src/deploy/cloudRun/utils/jobName.js +1 -3
  311. package/dist/pipeline/src/deploy/cloudRun/utils/jobName.js.map +1 -1
  312. package/dist/pipeline/src/deploy/cloudRun/utils/removeFirstLinesFromCommandOutput.js +1 -1
  313. package/dist/pipeline/src/deploy/cloudRun/utils/removeFirstLinesFromCommandOutput.js.map +1 -1
  314. package/dist/pipeline/src/deploy/cloudSql/utils.js +4 -4
  315. package/dist/pipeline/src/deploy/cloudSql/utils.js.map +1 -1
  316. package/dist/pipeline/src/deploy/custom/deployJob.js +18 -37
  317. package/dist/pipeline/src/deploy/custom/deployJob.js.map +1 -1
  318. package/dist/pipeline/src/deploy/custom/index.js +4 -4
  319. package/dist/pipeline/src/deploy/custom/index.js.map +1 -1
  320. package/dist/pipeline/src/deploy/dockerTag/deployJob.js +16 -48
  321. package/dist/pipeline/src/deploy/dockerTag/deployJob.js.map +1 -1
  322. package/dist/pipeline/src/deploy/dockerTag/index.js +4 -4
  323. package/dist/pipeline/src/deploy/dockerTag/index.js.map +1 -1
  324. package/dist/pipeline/src/deploy/index.js +4 -4
  325. package/dist/pipeline/src/deploy/index.js.map +1 -1
  326. package/dist/pipeline/src/deploy/kubernetes/additionalSecretKeys.js +6 -7
  327. package/dist/pipeline/src/deploy/kubernetes/additionalSecretKeys.js.map +1 -1
  328. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js +13 -13
  329. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
  330. package/dist/pipeline/src/deploy/kubernetes/deployJob.js +64 -72
  331. package/dist/pipeline/src/deploy/kubernetes/deployJob.js.map +1 -1
  332. package/dist/pipeline/src/deploy/kubernetes/index.js +21 -47
  333. package/dist/pipeline/src/deploy/kubernetes/index.js.map +1 -1
  334. package/dist/pipeline/src/deploy/kubernetes/kubeEnv.js +13 -36
  335. package/dist/pipeline/src/deploy/kubernetes/kubeEnv.js.map +1 -1
  336. package/dist/pipeline/src/deploy/kubernetes/kubeValues.js +23 -60
  337. package/dist/pipeline/src/deploy/kubernetes/kubeValues.js.map +1 -1
  338. package/dist/pipeline/src/deploy/kubernetes/mongodb.js +38 -48
  339. package/dist/pipeline/src/deploy/kubernetes/mongodb.js.map +1 -1
  340. package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.js +15 -17
  341. package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.js.map +1 -1
  342. package/dist/pipeline/src/deploy/sbom.js +9 -11
  343. package/dist/pipeline/src/deploy/sbom.js.map +1 -1
  344. package/dist/pipeline/src/deploy/types/googleCloudRun.d.ts +8 -0
  345. package/dist/pipeline/src/deploy/types/index.js +1 -5
  346. package/dist/pipeline/src/deploy/types/index.js.map +1 -1
  347. package/dist/pipeline/src/deploy/utils.js +7 -7
  348. package/dist/pipeline/src/deploy/utils.js.map +1 -1
  349. package/dist/pipeline/src/packageInfos.js +2 -2
  350. package/dist/pipeline/src/packageInfos.js.map +1 -1
  351. package/dist/pipeline/src/pipeline/createAllJobs.js +39 -132
  352. package/dist/pipeline/src/pipeline/createAllJobs.js.map +1 -1
  353. package/dist/pipeline/src/pipeline/createChildPipeline.js +24 -71
  354. package/dist/pipeline/src/pipeline/createChildPipeline.js.map +1 -1
  355. package/dist/pipeline/src/pipeline/createJobsForComponent.js +18 -62
  356. package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
  357. package/dist/pipeline/src/pipeline/createJobsForWorkspace.js +3 -3
  358. package/dist/pipeline/src/pipeline/createJobsForWorkspace.js.map +1 -1
  359. package/dist/pipeline/src/pipeline/createMainPipeline.js +57 -141
  360. package/dist/pipeline/src/pipeline/createMainPipeline.js.map +1 -1
  361. package/dist/pipeline/src/pipeline/generatePipelineFiles.js +43 -137
  362. package/dist/pipeline/src/pipeline/generatePipelineFiles.js.map +1 -1
  363. package/dist/pipeline/src/pipeline/getPipelineStages.js +8 -31
  364. package/dist/pipeline/src/pipeline/getPipelineStages.js.map +1 -1
  365. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js +150 -216
  366. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js.map +1 -1
  367. package/dist/pipeline/src/pipeline/gitlab/createGitlabPipeline.js +14 -26
  368. package/dist/pipeline/src/pipeline/gitlab/createGitlabPipeline.js.map +1 -1
  369. package/dist/pipeline/src/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.js +11 -11
  370. package/dist/pipeline/src/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.js.map +1 -1
  371. package/dist/pipeline/src/pipeline/gitlab/gitlabReleaseJobs.js +8 -9
  372. package/dist/pipeline/src/pipeline/gitlab/gitlabReleaseJobs.js.map +1 -1
  373. package/dist/pipeline/src/pipeline/gitlab/sortGitLabJobDefProps.js +11 -20
  374. package/dist/pipeline/src/pipeline/gitlab/sortGitLabJobDefProps.js.map +1 -1
  375. package/dist/pipeline/src/pipeline/packageManager.js +59 -133
  376. package/dist/pipeline/src/pipeline/packageManager.js.map +1 -1
  377. package/dist/pipeline/src/pipeline/yarn/yarnUtils.js +30 -120
  378. package/dist/pipeline/src/pipeline/yarn/yarnUtils.js.map +1 -1
  379. package/dist/pipeline/src/runner/index.js +2 -4
  380. package/dist/pipeline/src/runner/index.js.map +1 -1
  381. package/dist/pipeline/src/types/config.js +4 -28
  382. package/dist/pipeline/src/types/config.js.map +1 -1
  383. package/dist/pipeline/src/types/context.js +2 -2
  384. package/dist/pipeline/src/types/context.js.map +1 -1
  385. package/dist/pipeline/src/utils/gitlab.js +19 -42
  386. package/dist/pipeline/src/utils/gitlab.js.map +1 -1
  387. package/dist/pipeline/src/utils/index.js +6 -34
  388. package/dist/pipeline/src/utils/index.js.map +1 -1
  389. package/dist/pipeline/src/utils/jsonParse.js +2 -2
  390. package/dist/pipeline/src/utils/jsonParse.js.map +1 -1
  391. package/dist/pipeline/src/utils/removeUndefined.js +1 -22
  392. package/dist/pipeline/src/utils/removeUndefined.js.map +1 -1
  393. package/dist/pipeline/src/utils/writeFiles.js +17 -68
  394. package/dist/pipeline/src/utils/writeFiles.js.map +1 -1
  395. package/dist/tsconfig.tsbuildinfo +1 -1
  396. package/package.json +2 -2
  397. package/tsconfig.json +2 -2
@@ -6,104 +6,32 @@
6
6
 
7
7
  "use strict";
8
8
 
9
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
10
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11
- return new (P || (P = Promise))(function (resolve, reject) {
12
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
13
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
14
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
15
- step((generator = generator.apply(thisArg, _arguments || [])).next());
16
- });
17
- };
18
- var __generator = (this && this.__generator) || function (thisArg, body) {
19
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
20
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
21
- function verb(n) { return function (v) { return step([n, v]); }; }
22
- function step(op) {
23
- if (f) throw new TypeError("Generator is already executing.");
24
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
25
- 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;
26
- if (y = 0, t) op = [op[0] & 2, t.value];
27
- switch (op[0]) {
28
- case 0: case 1: t = op; break;
29
- case 4: _.label++; return { value: op[1], done: false };
30
- case 5: _.label++; y = op[1]; op = [0]; continue;
31
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
32
- default:
33
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
34
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
35
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
36
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
37
- if (t[2]) _.ops.pop();
38
- _.trys.pop(); continue;
39
- }
40
- op = body.call(thisArg, _);
41
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
42
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
43
- }
44
- };
45
- var __read = (this && this.__read) || function (o, n) {
46
- var m = typeof Symbol === "function" && o[Symbol.iterator];
47
- if (!m) return o;
48
- var i = m.call(o), r, ar = [], e;
49
- try {
50
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
51
- }
52
- catch (error) { e = { error: error }; }
53
- finally {
54
- try {
55
- if (r && !r.done && (m = i["return"])) m.call(i);
56
- }
57
- finally { if (e) throw e.error; }
58
- }
59
- return ar;
60
- };
61
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
62
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
63
- if (ar || !(i in from)) {
64
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
65
- ar[i] = from[i];
66
- }
67
- }
68
- return to.concat(ar || Array.prototype.slice.call(from));
69
- };
70
9
  var __importDefault = (this && this.__importDefault) || function (mod) {
71
10
  return (mod && mod.__esModule) ? mod : { "default": mod };
72
11
  };
73
12
  Object.defineProperty(exports, "__esModule", ({ value: true }));
74
13
  exports.runCatCi = void 0;
75
- var vorpal_1 = __importDefault(__nccwpck_require__(1491));
76
- var packageInfos_1 = __importDefault(__nccwpck_require__(2260));
77
- var commands_1 = __importDefault(__nccwpck_require__(4288));
14
+ const vorpal_1 = __importDefault(__nccwpck_require__(1491));
15
+ const packageInfos_1 = __importDefault(__nccwpck_require__(2260));
16
+ const commands_1 = __importDefault(__nccwpck_require__(4288));
78
17
  function reconstructArgs(args) {
79
- return __spreadArray([args[0]], __read(args.slice(1).map(function (arg) { return "\"".concat(arg, "\""); })), false).join(" ");
18
+ return [args[0], ...args.slice(1).map((arg) => `"${arg}"`)].join(" ");
80
19
  }
81
- function runCatCi() {
82
- return __awaiter(this, void 0, void 0, function () {
83
- var vorpal, isInteractive, args;
84
- return __generator(this, function (_a) {
85
- switch (_a.label) {
86
- case 0:
87
- vorpal = new vorpal_1.default();
88
- process.exitCode = 0;
89
- vorpal.delimiter("catci $").history("catci").version(packageInfos_1.default.version);
90
- (0, commands_1.default)(vorpal);
91
- isInteractive = process.argv.length <= 2;
92
- if (!isInteractive) return [3 /*break*/, 1];
93
- vorpal.log("Catladder CI Tools \uD83D\uDE3B\uD83D\uDD28 version ".concat(packageInfos_1.default.version)).show();
94
- return [3 /*break*/, 3];
95
- case 1:
96
- process.exitCode = 1;
97
- args = reconstructArgs(process.argv.slice(2));
98
- return [4 /*yield*/, vorpal.exec(args)];
99
- case 2:
100
- _a.sent();
101
- process.exit();
102
- _a.label = 3;
103
- case 3: return [2 /*return*/];
104
- }
105
- });
106
- });
20
+ async function runCatCi() {
21
+ const vorpal = new vorpal_1.default();
22
+ process.exitCode = 0;
23
+ vorpal.delimiter("catci $").history("catci").version(packageInfos_1.default.version);
24
+ (0, commands_1.default)(vorpal);
25
+ const isInteractive = process.argv.length <= 2;
26
+ if (isInteractive) {
27
+ vorpal.log(`Catladder CI Tools 😻🔨 version ${packageInfos_1.default.version}`).show();
28
+ }
29
+ else {
30
+ process.exitCode = 1;
31
+ const args = reconstructArgs(process.argv.slice(2));
32
+ await vorpal.exec(args);
33
+ process.exit();
34
+ }
107
35
  }
108
36
  exports.runCatCi = runCatCi;
109
37
  //# sourceMappingURL=catci.js.map
@@ -115,115 +43,109 @@ exports.runCatCi = runCatCi;
115
43
 
116
44
  "use strict";
117
45
 
118
- var __read = (this && this.__read) || function (o, n) {
119
- var m = typeof Symbol === "function" && o[Symbol.iterator];
120
- if (!m) return o;
121
- var i = m.call(o), r, ar = [], e;
122
- try {
123
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
124
- }
125
- catch (error) { e = { error: error }; }
126
- finally {
127
- try {
128
- if (r && !r.done && (m = i["return"])) m.call(i);
129
- }
130
- finally { if (e) throw e.error; }
131
- }
132
- return ar;
133
- };
134
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
135
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
136
- if (ar || !(i in from)) {
137
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
138
- ar[i] = from[i];
139
- }
140
- }
141
- return to.concat(ar || Array.prototype.slice.call(from));
142
- };
143
46
  var __importDefault = (this && this.__importDefault) || function (mod) {
144
47
  return (mod && mod.__esModule) ? mod : { "default": mod };
145
48
  };
146
49
  Object.defineProperty(exports, "__esModule", ({ value: true }));
147
50
  exports.evaluateDocument = exports.makeTemplate = void 0;
148
- var topics_json_1 = __importDefault(__nccwpck_require__(1888));
149
- var allTopics = topics_json_1.default;
150
- var checkYes = "✅";
151
- var checkNo = "❌";
152
- var checkPlaceholder = "".concat(checkYes, "/").concat(checkNo);
153
- var responsiblePlaceholder = "@...";
154
- var rows = [
51
+ const topics_json_1 = __importDefault(__nccwpck_require__(1888));
52
+ const allTopics = topics_json_1.default;
53
+ const checkYes = "✅";
54
+ const checkNo = "❌";
55
+ const checkPlaceholder = `${checkYes}/${checkNo}`;
56
+ const responsiblePlaceholder = "@...";
57
+ const rows = [
155
58
  ["Responsible", checkPlaceholder, "Description", "Note", "More Information"],
156
- ].concat(allTopics.map(function (t) { return [
59
+ ].concat(allTopics.map((t) => [
157
60
  Array(t.responsibles).fill(responsiblePlaceholder).join(", "),
158
61
  checkPlaceholder,
159
62
  t.description,
160
63
  "",
161
64
  t.more,
162
- ]; }));
65
+ ]));
163
66
  function makeTable(rows) {
164
- var colWidths = calculateColumnWidths(rows);
165
- return "\n".concat(makeRow(rows[0], colWidths, " "), "\n").concat(makeRow(rows[0].map(function () { return ""; }), colWidths, "-"), "\n").concat(rows
67
+ const colWidths = calculateColumnWidths(rows);
68
+ return `
69
+ ${makeRow(rows[0], colWidths, " ")}
70
+ ${makeRow(rows[0].map(() => ""), colWidths, "-")}
71
+ ${rows
166
72
  .slice(1)
167
- .map(function (row) { return makeRow(row, colWidths, " "); })
168
- .join("\n"), "\n");
73
+ .map((row) => makeRow(row, colWidths, " "))
74
+ .join("\n")}
75
+ `;
169
76
  }
170
77
  function calculateColumnWidths(rows) {
171
- var columnCount = rows[0].length;
172
- return Array.from({ length: columnCount }, function (_, i) { return i; }).map(function (columnIndex) {
173
- return Math.max.apply(Math, __spreadArray([], __read(rows.map(function (row) { return row[columnIndex].length; })), false));
174
- });
78
+ const columnCount = rows[0].length;
79
+ return Array.from({ length: columnCount }, (_, i) => i).map((columnIndex) => Math.max(...rows.map((row) => row[columnIndex].length)));
175
80
  }
176
81
  function makeRow(row, colWidths, fillString) {
177
- return "| ".concat(row
178
- .map(function (cell, i) { return cell.padEnd(colWidths[i], fillString); })
179
- .join(" | "), " |");
82
+ return `| ${row
83
+ .map((cell, i) => cell.padEnd(colWidths[i], fillString))
84
+ .join(" | ")} |`;
180
85
  }
181
86
  function makeTemplate() {
182
- return "\n# Security Audit Report\n\nA security audit report document is a comprehensive assessment of an application's security posture, containing security topics that auditors can mark to indicate the state of various security aspects.\n\nIt serves as a structured guide for security team to evaluate different security factors such as authentication, authorization, data encryption, input validation, and more.\n\n## General Information\n\n- Project Owner is @...\n- Dev team:\n - @...\n - @...\n - @...\n\n## Project Security\n\n".concat(makeTable(rows), "\n\n");
87
+ return `
88
+ # Security Audit Report
89
+
90
+ A security audit report document is a comprehensive assessment of an application's security posture, containing security topics that auditors can mark to indicate the state of various security aspects.
91
+
92
+ It serves as a structured guide for security team to evaluate different security factors such as authentication, authorization, data encryption, input validation, and more.
93
+
94
+ ## General Information
95
+
96
+ - Project Owner is @...
97
+ - Dev team:
98
+ - @...
99
+ - @...
100
+ - @...
101
+
102
+ ## Project Security
103
+
104
+ ${makeTable(rows)}
105
+
106
+ `;
183
107
  }
184
108
  exports.makeTemplate = makeTemplate;
185
109
  function evaluateDocument(document) {
186
110
  var _a, _b;
187
- var rawRows = (_b = (_a = document.match(/^\s*\|.*?\|\s*$/gm)) === null || _a === void 0 ? void 0 : _a.map(function (row) { return row.trim(); })) !== null && _b !== void 0 ? _b : [];
188
- var matchedRows = rawRows
189
- .map(function (row) { return row.split("|").map(function (col) { return col.trim(); }); })
111
+ const rawRows = (_b = (_a = document.match(/^\s*\|.*?\|\s*$/gm)) === null || _a === void 0 ? void 0 : _a.map((row) => row.trim())) !== null && _b !== void 0 ? _b : [];
112
+ const matchedRows = rawRows
113
+ .map((row) => row.split("|").map((col) => col.trim()))
190
114
  .slice(2);
191
- var knownTopics = new Set(allTopics.map(function (t) { return t.description; }));
192
- var topics = matchedRows.map(function (col) {
193
- var responsibles = col[1].split(", ");
194
- var answer = col[2];
195
- var description = col[3];
196
- var note = col[4];
197
- var isUnknown = !knownTopics.has(description);
198
- var isAnswered = !isUnknown &&
115
+ const knownTopics = new Set(allTopics.map((t) => t.description));
116
+ const topics = matchedRows.map((col) => {
117
+ const responsibles = col[1].split(", ");
118
+ const answer = col[2];
119
+ const description = col[3];
120
+ const note = col[4];
121
+ const isUnknown = !knownTopics.has(description);
122
+ const isAnswered = !isUnknown &&
199
123
  !answer.includes(checkPlaceholder) &&
200
- !responsibles.some(function (responsible) {
201
- return responsible.includes(responsiblePlaceholder);
202
- });
203
- var isSecured = !isUnknown && isAnswered && answer.includes(checkYes);
124
+ !responsibles.some((responsible) => responsible.includes(responsiblePlaceholder));
125
+ const isSecured = !isUnknown && isAnswered && answer.includes(checkYes);
204
126
  return {
205
- responsibles: responsibles,
206
- answer: answer,
207
- description: description,
208
- note: note,
209
- isUnknown: isUnknown,
210
- isAnswered: isAnswered,
211
- isSecured: isSecured,
127
+ responsibles,
128
+ answer,
129
+ description,
130
+ note,
131
+ isUnknown,
132
+ isAnswered,
133
+ isSecured,
212
134
  };
213
135
  });
214
- var totalTopics = allTopics.length;
215
- var answeredTopics = topics.filter(function (t) { return t.isAnswered; }).length;
216
- var securedTopics = topics.filter(function (t) { return t.isSecured; }).length;
217
- var unknownTopics = topics.filter(function (t) { return t.isUnknown; }).length;
218
- var rating = Math.round((securedTopics / totalTopics) * 100);
136
+ const totalTopics = allTopics.length;
137
+ const answeredTopics = topics.filter((t) => t.isAnswered).length;
138
+ const securedTopics = topics.filter((t) => t.isSecured).length;
139
+ const unknownTopics = topics.filter((t) => t.isUnknown).length;
140
+ const rating = Math.round((securedTopics / totalTopics) * 100);
219
141
  return {
220
- topics: topics,
142
+ topics,
221
143
  score: {
222
- rating: rating,
223
- totalTopics: totalTopics,
224
- answeredTopics: answeredTopics,
225
- securedTopics: securedTopics,
226
- unknownTopics: unknownTopics,
144
+ rating,
145
+ totalTopics,
146
+ answeredTopics,
147
+ securedTopics,
148
+ unknownTopics,
227
149
  },
228
150
  };
229
151
  }
@@ -233,52 +155,16 @@ exports.evaluateDocument = evaluateDocument;
233
155
  /***/ }),
234
156
 
235
157
  /***/ 4288:
236
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
158
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
237
159
 
238
160
  "use strict";
239
161
 
240
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
241
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
242
- return new (P || (P = Promise))(function (resolve, reject) {
243
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
244
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
245
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
246
- step((generator = generator.apply(thisArg, _arguments || [])).next());
247
- });
248
- };
249
- var __generator = (this && this.__generator) || function (thisArg, body) {
250
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
251
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
252
- function verb(n) { return function (v) { return step([n, v]); }; }
253
- function step(op) {
254
- if (f) throw new TypeError("Generator is already executing.");
255
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
256
- 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;
257
- if (y = 0, t) op = [op[0] & 2, t.value];
258
- switch (op[0]) {
259
- case 0: case 1: t = op; break;
260
- case 4: _.label++; return { value: op[1], done: false };
261
- case 5: _.label++; y = op[1]; op = [0]; continue;
262
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
263
- default:
264
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
265
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
266
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
267
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
268
- if (t[2]) _.ops.pop();
269
- _.trys.pop(); continue;
270
- }
271
- op = body.call(thisArg, _);
272
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
273
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
274
- }
275
- };
276
162
  Object.defineProperty(exports, "__esModule", ({ value: true }));
277
- var evaluateSecurityAudit_1 = __nccwpck_require__(6725);
278
- var rest_1 = __nccwpck_require__(1084);
279
- var createSecurityAuditMergeRequest_1 = __nccwpck_require__(8933);
280
- var ts_results_es_1 = __nccwpck_require__(2807);
281
- var GITLAB_HOST = "https://git.panter.ch";
163
+ const evaluateSecurityAudit_1 = __nccwpck_require__(6725);
164
+ const rest_1 = __nccwpck_require__(1084);
165
+ const createSecurityAuditMergeRequest_1 = __nccwpck_require__(8933);
166
+ const ts_results_es_1 = __nccwpck_require__(2807);
167
+ const GITLAB_HOST = "https://git.panter.ch";
282
168
  function default_1(vorpal) {
283
169
  commandCiJob(vorpal);
284
170
  commandEvaluate(vorpal);
@@ -286,257 +172,158 @@ function default_1(vorpal) {
286
172
  }
287
173
  exports["default"] = default_1;
288
174
  function resultAsExitCode(func) {
289
- var _this = this;
290
- return function (args) { return __awaiter(_this, void 0, void 0, function () {
291
- var result;
292
- return __generator(this, function (_a) {
293
- switch (_a.label) {
294
- case 0: return [4 /*yield*/, func(args)];
295
- case 1:
296
- result = _a.sent();
297
- process.exitCode = result.isErr() ? 1 : 0;
298
- return [2 /*return*/];
175
+ return async (args) => {
176
+ const result = await func(args);
177
+ process.exitCode = result.isErr() ? 1 : 0;
178
+ };
179
+ }
180
+ async function commandCiJob(vorpal) {
181
+ vorpal
182
+ .command("security-audit-ci-job <path> <token> <mainBranch> <projectId> <userId>", `Evaluates security audit document. If the document can't be evaluated or does not exist, creates a new MR with security audit document template.
183
+
184
+ <path> root path of a project with security audit document (${createSecurityAuditMergeRequest_1.SECURITY_AUDIT_FILE_NAME})
185
+ <token> gitlab token with 'api' scopes and permissions to create a new branch
186
+ <main-branch> main branch name
187
+ <project-id> project id to create security audit for
188
+ <user-id> gitlab user id that will be assignee of the audit
189
+ `)
190
+ .action(resultAsExitCode(async (args) => {
191
+ const evaluation = await (0, evaluateSecurityAudit_1.evaluateSecurityAudit)({ path: args.path });
192
+ if (evaluation.isErr()) {
193
+ console.log("could not evaluate security audit document");
194
+ console.log("creating new merge request with security audit template...");
195
+ const { token, mainBranch, projectId, userId } = args;
196
+ const api = new rest_1.Gitlab({
197
+ host: GITLAB_HOST,
198
+ token,
199
+ });
200
+ const mr = await (0, createSecurityAuditMergeRequest_1.createSecurityAuditMergeRequest)({
201
+ api,
202
+ mainBranch,
203
+ projectId,
204
+ userId: parseInt(userId),
205
+ });
206
+ if (mr.isErr()) {
207
+ console.error(`could not create merge request with security audit template: ${mr.error}`);
208
+ return mr;
299
209
  }
300
- });
301
- }); };
210
+ console.log("security audit merge request created successfully");
211
+ console.log(`please finish the MR by updating SECURITY.md document: ${mr.value.web_url}`);
212
+ return (0, ts_results_es_1.Err)("merge request created");
213
+ }
214
+ if (evaluation.value.score.answeredTopics === 0) {
215
+ console.error("audit document has no answered topics");
216
+ console.error(`please answer security topics in ${createSecurityAuditMergeRequest_1.SECURITY_AUDIT_FILE_NAME} by adding responsible people and check/cross in the table`);
217
+ return (0, ts_results_es_1.Err)("audit document has no answered topics");
218
+ }
219
+ console.log((0, evaluateSecurityAudit_1.makeSecurityAuditOverview)(evaluation.value));
220
+ return (0, ts_results_es_1.Ok)({});
221
+ }));
302
222
  }
303
- function commandCiJob(vorpal) {
304
- return __awaiter(this, void 0, void 0, function () {
305
- var _this = this;
306
- return __generator(this, function (_a) {
307
- vorpal
308
- .command("security-audit-ci-job <path> <token> <mainBranch> <projectId> <userId>", "Evaluates security audit document. If the document can't be evaluated or does not exist, creates a new MR with security audit document template.\n\n<path> root path of a project with security audit document (".concat(createSecurityAuditMergeRequest_1.SECURITY_AUDIT_FILE_NAME, ")\n<token> gitlab token with 'api' scopes and permissions to create a new branch\n<main-branch> main branch name\n<project-id> project id to create security audit for\n<user-id> gitlab user id that will be assignee of the audit\n"))
309
- .action(resultAsExitCode(function (args) { return __awaiter(_this, void 0, void 0, function () {
310
- var evaluation, token, mainBranch, projectId, userId, api, mr;
311
- return __generator(this, function (_a) {
312
- switch (_a.label) {
313
- case 0: return [4 /*yield*/, (0, evaluateSecurityAudit_1.evaluateSecurityAudit)({ path: args.path })];
314
- case 1:
315
- evaluation = _a.sent();
316
- if (!evaluation.isErr()) return [3 /*break*/, 3];
317
- console.log("could not evaluate security audit document");
318
- console.log("creating new merge request with security audit template...");
319
- token = args.token, mainBranch = args.mainBranch, projectId = args.projectId, userId = args.userId;
320
- api = new rest_1.Gitlab({
321
- host: GITLAB_HOST,
322
- token: token,
323
- });
324
- return [4 /*yield*/, (0, createSecurityAuditMergeRequest_1.createSecurityAuditMergeRequest)({
325
- api: api,
326
- mainBranch: mainBranch,
327
- projectId: projectId,
328
- userId: parseInt(userId),
329
- })];
330
- case 2:
331
- mr = _a.sent();
332
- if (mr.isErr()) {
333
- console.error("could not create merge request with security audit template: ".concat(mr.error));
334
- return [2 /*return*/, mr];
335
- }
336
- console.log("security audit merge request created successfully");
337
- console.log("please finish the MR by updating SECURITY.md document: ".concat(mr.value.web_url));
338
- return [2 /*return*/, (0, ts_results_es_1.Err)("merge request created")];
339
- case 3:
340
- if (evaluation.value.score.answeredTopics === 0) {
341
- console.error("audit document has no answered topics");
342
- console.error("please answer security topics in ".concat(createSecurityAuditMergeRequest_1.SECURITY_AUDIT_FILE_NAME, " by adding responsible people and check/cross in the table"));
343
- return [2 /*return*/, (0, ts_results_es_1.Err)("audit document has no answered topics")];
344
- }
345
- console.log((0, evaluateSecurityAudit_1.makeSecurityAuditOverview)(evaluation.value));
346
- return [2 /*return*/, (0, ts_results_es_1.Ok)({})];
347
- }
348
- });
349
- }); }));
350
- return [2 /*return*/];
351
- });
352
- });
223
+ async function commandEvaluate(vorpal) {
224
+ vorpal
225
+ .command("security-audit-evaluate <path>", "Evaluates security audit document in given <path>")
226
+ .action(resultAsExitCode(async (args) => {
227
+ console.log("evaluating security audit document...");
228
+ const result = await (0, evaluateSecurityAudit_1.evaluateSecurityAudit)({ path: args.path });
229
+ if (result.isErr()) {
230
+ console.error(result.error);
231
+ console.error(`please make sure the security audit document ${createSecurityAuditMergeRequest_1.SECURITY_AUDIT_FILE_NAME} is in the repository`);
232
+ }
233
+ else {
234
+ console.log((0, evaluateSecurityAudit_1.makeSecurityAuditOverview)(result.value));
235
+ }
236
+ return result;
237
+ }));
353
238
  }
354
- function commandEvaluate(vorpal) {
355
- return __awaiter(this, void 0, void 0, function () {
356
- var _this = this;
357
- return __generator(this, function (_a) {
358
- vorpal
359
- .command("security-audit-evaluate <path>", "Evaluates security audit document in given <path>")
360
- .action(resultAsExitCode(function (args) { return __awaiter(_this, void 0, void 0, function () {
361
- var result;
362
- return __generator(this, function (_a) {
363
- switch (_a.label) {
364
- case 0:
365
- console.log("evaluating security audit document...");
366
- return [4 /*yield*/, (0, evaluateSecurityAudit_1.evaluateSecurityAudit)({ path: args.path })];
367
- case 1:
368
- result = _a.sent();
369
- if (result.isErr()) {
370
- console.error(result.error);
371
- console.error("please make sure the security audit document ".concat(createSecurityAuditMergeRequest_1.SECURITY_AUDIT_FILE_NAME, " is in the repository"));
372
- }
373
- else {
374
- console.log((0, evaluateSecurityAudit_1.makeSecurityAuditOverview)(result.value));
375
- }
376
- return [2 /*return*/, result];
377
- }
378
- });
379
- }); }));
380
- return [2 /*return*/];
239
+ async function commandCreate(vorpal) {
240
+ vorpal
241
+ .command("security-audit-create <token> <mainBranch> <projectId> <userId>", `Creates a MR in given project with the latest security audit template document
242
+
243
+ <token> gitlab token with 'api' scopes and permissions to create a new branch
244
+ <main-branch> main branch name
245
+ <project-id> project id to create security audit for
246
+ <user-id> gitlab user id that will be assignee of the audit
247
+ `)
248
+ .action(resultAsExitCode(async (args) => {
249
+ const { token, mainBranch, projectId, userId } = args;
250
+ const api = new rest_1.Gitlab({
251
+ host: GITLAB_HOST,
252
+ token,
381
253
  });
382
- });
383
- }
384
- function commandCreate(vorpal) {
385
- return __awaiter(this, void 0, void 0, function () {
386
- var _this = this;
387
- return __generator(this, function (_a) {
388
- vorpal
389
- .command("security-audit-create <token> <mainBranch> <projectId> <userId>", "Creates a MR in given project with the latest security audit template document\n\n<token> gitlab token with 'api' scopes and permissions to create a new branch\n<main-branch> main branch name\n<project-id> project id to create security audit for\n<user-id> gitlab user id that will be assignee of the audit\n")
390
- .action(resultAsExitCode(function (args) { return __awaiter(_this, void 0, void 0, function () {
391
- var token, mainBranch, projectId, userId, api, result;
392
- return __generator(this, function (_a) {
393
- switch (_a.label) {
394
- case 0:
395
- token = args.token, mainBranch = args.mainBranch, projectId = args.projectId, userId = args.userId;
396
- api = new rest_1.Gitlab({
397
- host: GITLAB_HOST,
398
- token: token,
399
- });
400
- return [4 /*yield*/, (0, createSecurityAuditMergeRequest_1.createSecurityAuditMergeRequest)({
401
- api: api,
402
- mainBranch: mainBranch,
403
- projectId: projectId,
404
- userId: parseInt(userId),
405
- })];
406
- case 1:
407
- result = _a.sent();
408
- if (result.isErr()) {
409
- console.error("could not create security audit merge request: ".concat(result.error));
410
- }
411
- else {
412
- console.log("security audit merge request created successfully");
413
- console.log("please finish the MR by updating SECURITY.md document: ".concat(result.value.web_url));
414
- }
415
- return [2 /*return*/, result];
416
- }
417
- });
418
- }); }));
419
- return [2 /*return*/];
254
+ const result = await (0, createSecurityAuditMergeRequest_1.createSecurityAuditMergeRequest)({
255
+ api,
256
+ mainBranch,
257
+ projectId,
258
+ userId: parseInt(userId),
420
259
  });
421
- });
260
+ if (result.isErr()) {
261
+ console.error(`could not create security audit merge request: ${result.error}`);
262
+ }
263
+ else {
264
+ console.log("security audit merge request created successfully");
265
+ console.log(`please finish the MR by updating SECURITY.md document: ${result.value.web_url}`);
266
+ }
267
+ return result;
268
+ }));
422
269
  }
423
270
  //# sourceMappingURL=commands.js.map
424
271
 
425
272
  /***/ }),
426
273
 
427
274
  /***/ 8933:
428
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
275
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
429
276
 
430
277
  "use strict";
431
278
 
432
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
433
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
434
- return new (P || (P = Promise))(function (resolve, reject) {
435
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
436
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
437
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
438
- step((generator = generator.apply(thisArg, _arguments || [])).next());
439
- });
440
- };
441
- var __generator = (this && this.__generator) || function (thisArg, body) {
442
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
443
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
444
- function verb(n) { return function (v) { return step([n, v]); }; }
445
- function step(op) {
446
- if (f) throw new TypeError("Generator is already executing.");
447
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
448
- 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;
449
- if (y = 0, t) op = [op[0] & 2, t.value];
450
- switch (op[0]) {
451
- case 0: case 1: t = op; break;
452
- case 4: _.label++; return { value: op[1], done: false };
453
- case 5: _.label++; y = op[1]; op = [0]; continue;
454
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
455
- default:
456
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
457
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
458
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
459
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
460
- if (t[2]) _.ops.pop();
461
- _.trys.pop(); continue;
462
- }
463
- op = body.call(thisArg, _);
464
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
465
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
466
- }
467
- };
468
279
  Object.defineProperty(exports, "__esModule", ({ value: true }));
469
280
  exports.createSecurityAuditMergeRequest = exports.SECURITY_AUDIT_FILE_NAME = void 0;
470
- var ts_results_es_1 = __nccwpck_require__(2807);
471
- var auditDocument_1 = __nccwpck_require__(2488);
281
+ const ts_results_es_1 = __nccwpck_require__(2807);
282
+ const auditDocument_1 = __nccwpck_require__(2488);
472
283
  function makeDatedBranchName(branchName) {
473
- var date = new Date().toISOString().slice(0, -5).replaceAll(/[:.T]/g, "-");
474
- return "".concat(branchName, "-").concat(date);
284
+ const date = new Date().toISOString().slice(0, -5).replaceAll(/[:.T]/g, "-");
285
+ return `${branchName}-${date}`;
475
286
  }
476
- var MR_TITLE = "Draft: chore(security): add security audit document";
287
+ const MR_TITLE = "Draft: chore(security): add security audit document";
477
288
  exports.SECURITY_AUDIT_FILE_NAME = "SECURITY.md";
478
- function createSecurityAuditMergeRequest(_a) {
479
- return __awaiter(this, arguments, void 0, function (_b) {
480
- var mrs, existingMr, auditTemplate, branch, commit, mr;
481
- var projectId = _b.projectId, mainBranch = _b.mainBranch, userId = _b.userId, api = _b.api;
482
- return __generator(this, function (_c) {
483
- switch (_c.label) {
484
- case 0: return [4 /*yield*/, ts_results_es_1.Result.wrapAsync(function () {
485
- return api.MergeRequests.all({
486
- state: "opened",
487
- wip: "yes",
488
- labels: "security-audit",
489
- });
490
- })];
491
- case 1:
492
- mrs = (_c.sent()).mapErr(function () { return "could not search for existing merge requests"; });
493
- if (mrs.isErr())
494
- return [2 /*return*/, mrs];
495
- existingMr = mrs.value[0];
496
- if (existingMr)
497
- return [2 /*return*/, (0, ts_results_es_1.Err)("open merge request with security audit already exists: ".concat(existingMr.web_url))];
498
- auditTemplate = ts_results_es_1.Result.wrap(function () { return (0, auditDocument_1.makeTemplate)(); }).mapErr(function () { return "could not make security audit template document"; });
499
- if (auditTemplate.isErr())
500
- return [2 /*return*/, auditTemplate];
501
- return [4 /*yield*/, ts_results_es_1.Result.wrapAsync(function () {
502
- return api.Branches.create(projectId, makeDatedBranchName("chore/security-audit"), mainBranch);
503
- })];
504
- case 2:
505
- branch = (_c.sent()).mapErr(function (e) {
506
- console.log(e);
507
- return "could not create branch";
508
- });
509
- if (branch.isErr())
510
- return [2 /*return*/, branch];
511
- return [4 /*yield*/, ts_results_es_1.Result.wrapAsync(function () {
512
- return api.Commits.create(projectId, branch.value.name, "chore(security): add empty security audit document template", [
513
- {
514
- action: "create",
515
- filePath: exports.SECURITY_AUDIT_FILE_NAME,
516
- content: auditTemplate.value,
517
- encoding: "text",
518
- },
519
- ]);
520
- })];
521
- case 3:
522
- commit = (_c.sent()).mapErr(function () { return "could not create commit"; });
523
- if (commit.isErr())
524
- return [2 /*return*/, commit];
525
- return [4 /*yield*/, ts_results_es_1.Result.wrapAsync(function () {
526
- return api.MergeRequests.create(projectId, branch.value.name, mainBranch, MR_TITLE, {
527
- description: "Please follow and update security audit document in `".concat(exports.SECURITY_AUDIT_FILE_NAME, "`."),
528
- assigneeId: userId,
529
- squash: true,
530
- labels: "security-audit",
531
- removeSourceBranch: true,
532
- });
533
- })];
534
- case 4:
535
- mr = (_c.sent()).mapErr(function () { return "could not create merge request"; });
536
- return [2 /*return*/, mr];
537
- }
538
- });
289
+ async function createSecurityAuditMergeRequest({ projectId, mainBranch, userId, api, }) {
290
+ const mrs = (await ts_results_es_1.Result.wrapAsync(() => api.MergeRequests.all({
291
+ state: "opened",
292
+ wip: "yes",
293
+ labels: "security-audit",
294
+ }))).mapErr(() => `could not search for existing merge requests`);
295
+ if (mrs.isErr())
296
+ return mrs;
297
+ const existingMr = mrs.value[0];
298
+ if (existingMr)
299
+ return (0, ts_results_es_1.Err)(`open merge request with security audit already exists: ${existingMr.web_url}`);
300
+ const auditTemplate = ts_results_es_1.Result.wrap(() => (0, auditDocument_1.makeTemplate)()).mapErr(() => "could not make security audit template document");
301
+ if (auditTemplate.isErr())
302
+ return auditTemplate;
303
+ const branch = (await ts_results_es_1.Result.wrapAsync(() => api.Branches.create(projectId, makeDatedBranchName("chore/security-audit"), mainBranch))).mapErr((e) => {
304
+ console.log(e);
305
+ return "could not create branch";
539
306
  });
307
+ if (branch.isErr())
308
+ return branch;
309
+ const commit = (await ts_results_es_1.Result.wrapAsync(() => api.Commits.create(projectId, branch.value.name, "chore(security): add empty security audit document template", [
310
+ {
311
+ action: "create",
312
+ filePath: exports.SECURITY_AUDIT_FILE_NAME,
313
+ content: auditTemplate.value,
314
+ encoding: "text",
315
+ },
316
+ ]))).mapErr(() => "could not create commit");
317
+ if (commit.isErr())
318
+ return commit;
319
+ const mr = (await ts_results_es_1.Result.wrapAsync(() => api.MergeRequests.create(projectId, branch.value.name, mainBranch, MR_TITLE, {
320
+ description: `Please follow and update security audit document in \`${exports.SECURITY_AUDIT_FILE_NAME}\`.`,
321
+ assigneeId: userId,
322
+ squash: true,
323
+ labels: "security-audit",
324
+ removeSourceBranch: true,
325
+ }))).mapErr(() => "could not create merge request");
326
+ return mr;
540
327
  }
541
328
  exports.createSecurityAuditMergeRequest = createSecurityAuditMergeRequest;
542
329
  //# sourceMappingURL=createSecurityAuditMergeRequest.js.map
@@ -544,82 +331,34 @@ exports.createSecurityAuditMergeRequest = createSecurityAuditMergeRequest;
544
331
  /***/ }),
545
332
 
546
333
  /***/ 6725:
547
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
334
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
548
335
 
549
336
  "use strict";
550
337
 
551
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
552
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
553
- return new (P || (P = Promise))(function (resolve, reject) {
554
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
555
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
556
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
557
- step((generator = generator.apply(thisArg, _arguments || [])).next());
558
- });
559
- };
560
- var __generator = (this && this.__generator) || function (thisArg, body) {
561
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
562
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
563
- function verb(n) { return function (v) { return step([n, v]); }; }
564
- function step(op) {
565
- if (f) throw new TypeError("Generator is already executing.");
566
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
567
- 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;
568
- if (y = 0, t) op = [op[0] & 2, t.value];
569
- switch (op[0]) {
570
- case 0: case 1: t = op; break;
571
- case 4: _.label++; return { value: op[1], done: false };
572
- case 5: _.label++; y = op[1]; op = [0]; continue;
573
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
574
- default:
575
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
576
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
577
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
578
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
579
- if (t[2]) _.ops.pop();
580
- _.trys.pop(); continue;
581
- }
582
- op = body.call(thisArg, _);
583
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
584
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
585
- }
586
- };
587
338
  Object.defineProperty(exports, "__esModule", ({ value: true }));
588
339
  exports.makeSecurityAuditOverview = exports.evaluateSecurityAudit = void 0;
589
- var ts_results_es_1 = __nccwpck_require__(2807);
590
- var path_1 = __nccwpck_require__(1017);
591
- var promises_1 = __nccwpck_require__(3292);
592
- var createSecurityAuditMergeRequest_1 = __nccwpck_require__(8933);
593
- var auditDocument_1 = __nccwpck_require__(2488);
594
- function evaluateSecurityAudit(_a) {
595
- return __awaiter(this, arguments, void 0, function (_b) {
596
- var _this = this;
597
- var path = _b.path;
598
- return __generator(this, function (_c) {
599
- switch (_c.label) {
600
- case 0: return [4 /*yield*/, ts_results_es_1.Result.wrapAsync(function () { return __awaiter(_this, void 0, void 0, function () {
601
- var filePath, docData, doc;
602
- return __generator(this, function (_a) {
603
- switch (_a.label) {
604
- case 0:
605
- filePath = (0, path_1.join)(path, createSecurityAuditMergeRequest_1.SECURITY_AUDIT_FILE_NAME);
606
- return [4 /*yield*/, (0, promises_1.readFile)(filePath)];
607
- case 1:
608
- docData = _a.sent();
609
- doc = docData.toString("utf-8");
610
- return [2 /*return*/, (0, auditDocument_1.evaluateDocument)(doc)];
611
- }
612
- });
613
- }); })];
614
- case 1: return [2 /*return*/, (_c.sent()).mapErr(function (e) { return "could not evaluate ".concat(createSecurityAuditMergeRequest_1.SECURITY_AUDIT_FILE_NAME, ": ").concat(e); })];
615
- }
616
- });
617
- });
340
+ const ts_results_es_1 = __nccwpck_require__(2807);
341
+ const path_1 = __nccwpck_require__(1017);
342
+ const promises_1 = __nccwpck_require__(3292);
343
+ const createSecurityAuditMergeRequest_1 = __nccwpck_require__(8933);
344
+ const auditDocument_1 = __nccwpck_require__(2488);
345
+ async function evaluateSecurityAudit({ path }) {
346
+ return (await ts_results_es_1.Result.wrapAsync(async () => {
347
+ const filePath = (0, path_1.join)(path, createSecurityAuditMergeRequest_1.SECURITY_AUDIT_FILE_NAME);
348
+ const docData = await (0, promises_1.readFile)(filePath);
349
+ const doc = docData.toString("utf-8");
350
+ return (0, auditDocument_1.evaluateDocument)(doc);
351
+ })).mapErr((e) => `could not evaluate ${createSecurityAuditMergeRequest_1.SECURITY_AUDIT_FILE_NAME}: ${e}`);
618
352
  }
619
353
  exports.evaluateSecurityAudit = evaluateSecurityAudit;
620
354
  function makeSecurityAuditOverview(evaluation) {
621
- var ratingToEmo = function (r) { return (r < 33 ? "🟥" : r < 66 ? "🟨" : "🟩"); };
622
- return "Project security posture overview:\n \uD83E\uDDD0 Total topics: ".concat(evaluation.score.totalTopics, "\n \uD83D\uDD12 Secured topics: ").concat(evaluation.score.securedTopics, "\n \uD83D\uDCE2 Answered topics: ").concat(evaluation.score.answeredTopics, "\n \u2754 Unknown topics: ").concat(evaluation.score.unknownTopics, "\n \uD83D\uDCCA Rating: ").concat(ratingToEmo(evaluation.score.rating), " ").concat(evaluation.score.rating, "/100");
355
+ const ratingToEmo = (r) => (r < 33 ? "🟥" : r < 66 ? "🟨" : "🟩");
356
+ return `Project security posture overview:
357
+ 🧐 Total topics: ${evaluation.score.totalTopics}
358
+ 🔒 Secured topics: ${evaluation.score.securedTopics}
359
+ 📢 Answered topics: ${evaluation.score.answeredTopics}
360
+ ❔ Unknown topics: ${evaluation.score.unknownTopics}
361
+ 📊 Rating: ${ratingToEmo(evaluation.score.rating)} ${evaluation.score.rating}/100`;
623
362
  }
624
363
  exports.makeSecurityAuditOverview = makeSecurityAuditOverview;
625
364
  //# sourceMappingURL=evaluateSecurityAudit.js.map
@@ -637,9 +376,9 @@ exports.makeSecurityAuditOverview = makeSecurityAuditOverview;
637
376
  // this will point to the root package.json
638
377
  var _a;
639
378
  Object.defineProperty(exports, "__esModule", ({ value: true }));
640
- var path = ((_a = require.main) === null || _a === void 0 ? void 0 : _a.path) + "/../package.json";
379
+ const path = ((_a = require.main) === null || _a === void 0 ? void 0 : _a.path) + "/../package.json";
641
380
  // eslint-disable-next-line @typescript-eslint/no-var-requires
642
- var ownPkg = require(path);
381
+ const ownPkg = require(path);
643
382
  exports["default"] = ownPkg;
644
383
  //# sourceMappingURL=packageInfos.js.map
645
384
 
@@ -72012,7 +71751,7 @@ var __webpack_exports__ = {};
72012
71751
  var exports = __webpack_exports__;
72013
71752
 
72014
71753
  Object.defineProperty(exports, "__esModule", ({ value: true }));
72015
- var catci_1 = __nccwpck_require__(1123);
71754
+ const catci_1 = __nccwpck_require__(1123);
72016
71755
  (0, catci_1.runCatCi)();
72017
71756
  //# sourceMappingURL=catci.js.map
72018
71757
  })();