@codiac.io/codiac-cli 1.3.68 → 1.3.70

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 (276) hide show
  1. package/README.md +1 -1
  2. package/dist/apis/api-plus-local/api-client-plus-local.d.ts +12 -4
  3. package/dist/apis/api-plus-local/api-client-plus-local.js +121 -92
  4. package/dist/apis/api-plus-local/api-client-plus-local.js.map +1 -1
  5. package/dist/apis/api-plus-local/asset-where-entity-merger.d.ts +4 -2
  6. package/dist/apis/api-plus-local/asset-where-entity-merger.js +17 -8
  7. package/dist/apis/api-plus-local/asset-where-entity-merger.js.map +1 -1
  8. package/dist/apis/api-plus-local/enterprise-state-entity-merger.d.ts +3 -2
  9. package/dist/apis/api-plus-local/enterprise-state-entity-merger.js +13 -2
  10. package/dist/apis/api-plus-local/enterprise-state-entity-merger.js.map +1 -1
  11. package/dist/apis/api-plus-local/root-map-entity-merger.d.ts +7 -3
  12. package/dist/apis/api-plus-local/root-map-entity-merger.js +19 -8
  13. package/dist/apis/api-plus-local/root-map-entity-merger.js.map +1 -1
  14. package/dist/apis/codiac-api/gen/contracts.d.ts +38 -4
  15. package/dist/apis/codiac-api/gen/contracts.js +2 -0
  16. package/dist/apis/codiac-api/gen/contracts.js.map +1 -1
  17. package/dist/apis/codiac-relay/common/api-user-creds.d.ts +2 -2
  18. package/dist/apis/codiac-relay/common/api-user-creds.js +2 -1
  19. package/dist/apis/codiac-relay/common/api-user-creds.js.map +1 -1
  20. package/dist/apis/codiac-relay/gen/client.d.ts +5 -1
  21. package/dist/apis/codiac-relay/gen/client.js +16 -0
  22. package/dist/apis/codiac-relay/gen/client.js.map +1 -1
  23. package/dist/apis/codiac-relay/gen/contracts.d.ts +131 -2
  24. package/dist/apis/codiac-relay/gen/contracts.js +12 -1
  25. package/dist/apis/codiac-relay/gen/contracts.js.map +1 -1
  26. package/dist/apis/nats/nats-client.d.ts +1 -0
  27. package/dist/apis/nats/nats-client.js +8 -4
  28. package/dist/apis/nats/nats-client.js.map +1 -1
  29. package/dist/cli-common/argument-manager.d.ts +1 -1
  30. package/dist/cli-common/command-base.d.ts +6 -4
  31. package/dist/cli-common/command-base.js +31 -22
  32. package/dist/cli-common/command-base.js.map +1 -1
  33. package/dist/codiac-constants.d.ts +2 -0
  34. package/dist/codiac-constants.js +2 -0
  35. package/dist/codiac-constants.js.map +1 -1
  36. package/dist/codiac-entities/cluster-capture-def.d.ts +4 -2
  37. package/dist/command-base-enterprise.d.ts +2 -1
  38. package/dist/command-base-enterprise.js +10 -7
  39. package/dist/command-base-enterprise.js.map +1 -1
  40. package/dist/command-base-tenantless.d.ts +2 -1
  41. package/dist/command-base-tenantless.js +12 -10
  42. package/dist/command-base-tenantless.js.map +1 -1
  43. package/dist/commands/asset/create.d.ts +2 -8
  44. package/dist/commands/asset/create.js +24 -4
  45. package/dist/commands/asset/create.js.map +1 -1
  46. package/dist/commands/asset/deploy.d.ts +8 -4
  47. package/dist/commands/asset/deploy.js +58 -29
  48. package/dist/commands/asset/deploy.js.map +1 -1
  49. package/dist/commands/asset/entrypoint/delete.js +3 -3
  50. package/dist/commands/asset/entrypoint/delete.js.map +1 -1
  51. package/dist/commands/asset/entrypoint/set.js +3 -3
  52. package/dist/commands/asset/entrypoint/set.js.map +1 -1
  53. package/dist/commands/asset/list.d.ts +2 -0
  54. package/dist/commands/asset/list.js +4 -0
  55. package/dist/commands/asset/list.js.map +1 -1
  56. package/dist/commands/asset/view.d.ts +4 -4
  57. package/dist/commands/asset/view.js +3 -2
  58. package/dist/commands/asset/view.js.map +1 -1
  59. package/dist/commands/cabinet/create.d.ts +2 -1
  60. package/dist/commands/cabinet/create.js +15 -2
  61. package/dist/commands/cabinet/create.js.map +1 -1
  62. package/dist/commands/cabinet/obliterate.d.ts +3 -1
  63. package/dist/commands/cabinet/obliterate.js +6 -2
  64. package/dist/commands/cabinet/obliterate.js.map +1 -1
  65. package/dist/commands/cluster/start.d.ts +37 -0
  66. package/dist/commands/cluster/start.js +191 -0
  67. package/dist/commands/cluster/start.js.map +1 -0
  68. package/dist/commands/cluster/stop.d.ts +36 -0
  69. package/dist/commands/cluster/stop.js +190 -0
  70. package/dist/commands/cluster/stop.js.map +1 -0
  71. package/dist/commands/config/add.d.ts +3 -2
  72. package/dist/commands/config/add.js +8 -25
  73. package/dist/commands/config/add.js.map +1 -1
  74. package/dist/commands/config/delete.js +7 -4
  75. package/dist/commands/config/delete.js.map +1 -1
  76. package/dist/commands/config/settings/get.js +7 -4
  77. package/dist/commands/config/settings/get.js.map +1 -1
  78. package/dist/commands/config/view.d.ts +0 -1
  79. package/dist/commands/config/view.js +5 -39
  80. package/dist/commands/config/view.js.map +1 -1
  81. package/dist/commands/environment/cluster/attach.js +15 -4
  82. package/dist/commands/environment/cluster/attach.js.map +1 -1
  83. package/dist/commands/environment/cluster/detach.js +6 -1
  84. package/dist/commands/environment/cluster/detach.js.map +1 -1
  85. package/dist/commands/environment/create.d.ts +1 -0
  86. package/dist/commands/environment/create.js +22 -3
  87. package/dist/commands/environment/create.js.map +1 -1
  88. package/dist/commands/environment/list.d.ts +3 -0
  89. package/dist/commands/environment/list.js +20 -7
  90. package/dist/commands/environment/list.js.map +1 -1
  91. package/dist/commands/filestore/capture.js.map +1 -1
  92. package/dist/commands/imageRegistry/capture.js +4 -0
  93. package/dist/commands/imageRegistry/capture.js.map +1 -1
  94. package/dist/commands/imageRegistry/list.d.ts +29 -0
  95. package/dist/commands/imageRegistry/list.js +108 -0
  96. package/dist/commands/imageRegistry/list.js.map +1 -0
  97. package/dist/commands/init.js +4 -4
  98. package/dist/commands/init.js.map +1 -1
  99. package/dist/commands/noc/cluster/capture.d.ts +0 -2
  100. package/dist/commands/noc/cluster/capture.js +19 -15
  101. package/dist/commands/noc/cluster/capture.js.map +1 -1
  102. package/dist/commands/noc/cluster/create.d.ts +20 -0
  103. package/dist/commands/noc/cluster/create.js +244 -17
  104. package/dist/commands/noc/cluster/create.js.map +1 -1
  105. package/dist/commands/noc/cluster/destroy.d.ts +4 -0
  106. package/dist/commands/noc/cluster/destroy.js +38 -9
  107. package/dist/commands/noc/cluster/destroy.js.map +1 -1
  108. package/dist/commands/noc/cluster/forget.d.ts +2 -1
  109. package/dist/commands/noc/cluster/forget.js +20 -3
  110. package/dist/commands/noc/cluster/forget.js.map +1 -1
  111. package/dist/commands/noc/cluster/init.d.ts +1 -0
  112. package/dist/commands/noc/cluster/init.js +10 -3
  113. package/dist/commands/noc/cluster/init.js.map +1 -1
  114. package/dist/commands/noc/cluster/list.js +6 -2
  115. package/dist/commands/noc/cluster/list.js.map +1 -1
  116. package/dist/message-contracts/terminal-command-request.d.ts +66 -0
  117. package/dist/message-contracts/terminal-command-request.js +13 -0
  118. package/dist/message-contracts/terminal-command-request.js.map +1 -0
  119. package/dist/ops/LocalOps.d.ts +1 -1
  120. package/dist/ops/LocalOps.js +4 -4
  121. package/dist/ops/LocalOps.js.map +1 -1
  122. package/dist/ops/entities/cli-config.d.ts +2 -1
  123. package/dist/ops/entities/cli-config.js +3 -2
  124. package/dist/ops/entities/cli-config.js.map +1 -1
  125. package/dist/ops/index.d.ts +0 -3
  126. package/dist/ops/index.js +3 -3
  127. package/dist/ops/index.js.map +1 -1
  128. package/dist/ops/k8s/k8s-utils.js.map +1 -1
  129. package/dist/ops/scaffolding/base-scaffolding.d.ts +1 -1
  130. package/dist/ops/scaffolding/base-scaffolding.js +2 -1
  131. package/dist/ops/scaffolding/base-scaffolding.js.map +1 -1
  132. package/dist/ops/scaffolding/codiac-api-scaffolding.js.map +1 -1
  133. package/dist/ops/scaffolding/typescript-scaffolding.d.ts +2 -1
  134. package/dist/ops/scaffolding/typescript-scaffolding.js +2 -1
  135. package/dist/ops/scaffolding/typescript-scaffolding.js.map +1 -1
  136. package/dist/ops/terminal-command-runner/local-command-runner.d.ts +41 -0
  137. package/dist/ops/terminal-command-runner/local-command-runner.js +146 -0
  138. package/dist/ops/terminal-command-runner/local-command-runner.js.map +1 -0
  139. package/dist/ops/terminal-utils.d.ts +56 -0
  140. package/dist/ops/terminal-utils.js +721 -0
  141. package/dist/ops/terminal-utils.js.map +1 -0
  142. package/dist/relay/relay-container.js +4 -1
  143. package/dist/relay/relay-container.js.map +1 -1
  144. package/dist/relay/wsclient/relay-websocket-client.d.ts +3 -0
  145. package/dist/relay/wsclient/relay-websocket-client.js +9 -0
  146. package/dist/relay/wsclient/relay-websocket-client.js.map +1 -1
  147. package/dist/sdk/codiac-sdk-for-cli.d.ts +29 -0
  148. package/dist/sdk/codiac-sdk-for-cli.js +83 -0
  149. package/dist/sdk/codiac-sdk-for-cli.js.map +1 -0
  150. package/dist/{uilogic → sdk}/i-cluster-configurator.d.ts +2 -1
  151. package/dist/sdk/i-cluster-configurator.js.map +1 -0
  152. package/dist/sdk/i-file-store-configurator.js.map +1 -0
  153. package/dist/{uilogic → sdk}/i-login-configurator.d.ts +10 -3
  154. package/dist/sdk/i-login-configurator.js.map +1 -0
  155. package/dist/sdk/i-registry-configurator.js.map +1 -0
  156. package/dist/sdk/i-secret-store-configurator.js.map +1 -0
  157. package/dist/sdk/index.d.ts +7 -0
  158. package/dist/sdk/index.js +11 -0
  159. package/dist/sdk/index.js.map +1 -0
  160. package/dist/sdk-adapters/artifact-hub/artifact-hub-cli-adapter.d.ts +6 -0
  161. package/dist/sdk-adapters/artifact-hub/artifact-hub-cli-adapter.js +16 -0
  162. package/dist/sdk-adapters/artifact-hub/artifact-hub-cli-adapter.js.map +1 -0
  163. package/dist/{uilogic/cloud-resource-configurators → sdk-adapters/artifact-hub}/helm-resource-configurator.d.ts +4 -4
  164. package/dist/{uilogic/cloud-resource-configurators → sdk-adapters/artifact-hub}/helm-resource-configurator.js +5 -1
  165. package/dist/sdk-adapters/artifact-hub/helm-resource-configurator.js.map +1 -0
  166. package/dist/sdk-adapters/artifact-hub/index.d.ts +2 -0
  167. package/dist/sdk-adapters/artifact-hub/index.js +6 -0
  168. package/dist/sdk-adapters/artifact-hub/index.js.map +1 -0
  169. package/dist/sdk-adapters/aws/aws-cli-adapter.d.ts +6 -0
  170. package/dist/sdk-adapters/aws/aws-cli-adapter.js +20 -0
  171. package/dist/sdk-adapters/aws/aws-cli-adapter.js.map +1 -0
  172. package/dist/{uilogic/cloud-resource-configurators → sdk-adapters/aws}/aws-resource-configurator.d.ts +6 -9
  173. package/dist/{uilogic/cloud-resource-configurators → sdk-adapters/aws}/aws-resource-configurator.js +20 -10
  174. package/dist/sdk-adapters/aws/aws-resource-configurator.js.map +1 -0
  175. package/dist/sdk-adapters/aws/index.d.ts +2 -0
  176. package/dist/sdk-adapters/aws/index.js +6 -0
  177. package/dist/sdk-adapters/aws/index.js.map +1 -0
  178. package/dist/{uilogic/cloud-resource-configurators → sdk-adapters/azure}/az-interactive-login-configurator.d.ts +6 -7
  179. package/dist/{uilogic/cloud-resource-configurators → sdk-adapters/azure}/az-interactive-login-configurator.js +7 -8
  180. package/dist/sdk-adapters/azure/az-interactive-login-configurator.js.map +1 -0
  181. package/dist/sdk-adapters/azure/azure-cli-adapter.d.ts +6 -0
  182. package/dist/sdk-adapters/azure/azure-cli-adapter.js +20 -0
  183. package/dist/sdk-adapters/azure/azure-cli-adapter.js.map +1 -0
  184. package/dist/{uilogic/cloud-resource-configurators → sdk-adapters/azure}/azure-resource-configurator.d.ts +4 -13
  185. package/dist/{uilogic/cloud-resource-configurators → sdk-adapters/azure}/azure-resource-configurator.js +33 -38
  186. package/dist/sdk-adapters/azure/azure-resource-configurator.js.map +1 -0
  187. package/dist/sdk-adapters/azure/index.d.ts +3 -0
  188. package/dist/sdk-adapters/azure/index.js +7 -0
  189. package/dist/sdk-adapters/azure/index.js.map +1 -0
  190. package/dist/sdk-adapters/docker-hub/docker-hub-cli-adapter.d.ts +6 -0
  191. package/dist/sdk-adapters/docker-hub/docker-hub-cli-adapter.js +16 -0
  192. package/dist/sdk-adapters/docker-hub/docker-hub-cli-adapter.js.map +1 -0
  193. package/dist/{uilogic/cloud-resource-configurators → sdk-adapters/docker-hub}/docker-hub-resource-configurator.d.ts +4 -4
  194. package/dist/{uilogic/cloud-resource-configurators → sdk-adapters/docker-hub}/docker-hub-resource-configurator.js +7 -1
  195. package/dist/sdk-adapters/docker-hub/docker-hub-resource-configurator.js.map +1 -0
  196. package/dist/sdk-adapters/docker-hub/index.d.ts +2 -0
  197. package/dist/sdk-adapters/docker-hub/index.js +6 -0
  198. package/dist/sdk-adapters/docker-hub/index.js.map +1 -0
  199. package/dist/sdk-adapters/local-machine/index.js +4 -0
  200. package/dist/sdk-adapters/local-machine/index.js.map +1 -0
  201. package/dist/sdk-adapters/local-machine/local-machine-cli-adapter.js +14 -0
  202. package/dist/sdk-adapters/local-machine/local-machine-cli-adapter.js.map +1 -0
  203. package/dist/sdk-adapters/local-machine/local-machine-login-configurator.d.ts +17 -0
  204. package/dist/sdk-adapters/local-machine/local-machine-login-configurator.js +66 -0
  205. package/dist/sdk-adapters/local-machine/local-machine-login-configurator.js.map +1 -0
  206. package/dist/sdk-adapters/local-machine/local-machine-resource-configurator.d.ts +21 -0
  207. package/dist/sdk-adapters/local-machine/local-machine-resource-configurator.js +126 -0
  208. package/dist/sdk-adapters/local-machine/local-machine-resource-configurator.js.map +1 -0
  209. package/dist/sdk-adapters/shared/resource-configurator-base.d.ts +31 -0
  210. package/dist/sdk-adapters/shared/resource-configurator-base.js +124 -0
  211. package/dist/sdk-adapters/shared/resource-configurator-base.js.map +1 -0
  212. package/dist/uilogic/build-configurator.d.ts +2 -1
  213. package/dist/uilogic/build-configurator.js.map +1 -1
  214. package/dist/uilogic/cloud-provider-contextualizer.d.ts +4 -4
  215. package/dist/uilogic/cloud-provider-contextualizer.js +24 -9
  216. package/dist/uilogic/cloud-provider-contextualizer.js.map +1 -1
  217. package/dist/uilogic/cloud-resource-configurator-factory.d.ts +6 -10
  218. package/dist/uilogic/cloud-resource-configurator-factory.js +31 -19
  219. package/dist/uilogic/cloud-resource-configurator-factory.js.map +1 -1
  220. package/dist/uilogic/cloud-resource-configurators/asset-configurator.d.ts +8 -1
  221. package/dist/uilogic/cloud-resource-configurators/asset-configurator.js.map +1 -1
  222. package/dist/uilogic/cloud-resource-configurators/unsupported-resource-configurator.d.ts +1 -1
  223. package/dist/uilogic/config-ui-utils.d.ts +19 -14
  224. package/dist/uilogic/config-ui-utils.js +66 -21
  225. package/dist/uilogic/config-ui-utils.js.map +1 -1
  226. package/dist/uilogic/enterprise-contextualizer.d.ts +2 -1
  227. package/dist/uilogic/enterprise-contextualizer.js.map +1 -1
  228. package/dist/uilogic/i-messaging-client.d.ts +1 -0
  229. package/dist/uilogic/image-registry-contextualizer.d.ts +3 -3
  230. package/dist/uilogic/image-registry-contextualizer.js +4 -2
  231. package/dist/uilogic/image-registry-contextualizer.js.map +1 -1
  232. package/dist/uilogic/index.d.ts +0 -4
  233. package/dist/uilogic/index.js +0 -4
  234. package/dist/uilogic/index.js.map +1 -1
  235. package/dist/uilogic/lrp-watcher-predef.js +10 -4
  236. package/dist/uilogic/lrp-watcher-predef.js.map +1 -1
  237. package/dist/uilogic/rootmap-ui-utils.d.ts +2 -0
  238. package/dist/uilogic/rootmap-ui-utils.js +35 -11
  239. package/dist/uilogic/rootmap-ui-utils.js.map +1 -1
  240. package/dist/uilogic/tenant-contextualizer.d.ts +1 -1
  241. package/dist/uilogic/tenant-contextualizer.js.map +1 -1
  242. package/dist/uilogic/type-safety-utils.d.ts +11 -0
  243. package/dist/uilogic/type-safety-utils.js +13 -0
  244. package/dist/uilogic/type-safety-utils.js.map +1 -1
  245. package/dist/uilogic/validators/non-empty-validator.d.ts +7 -0
  246. package/dist/uilogic/validators/non-empty-validator.js +20 -0
  247. package/dist/uilogic/validators/non-empty-validator.js.map +1 -0
  248. package/dist/uilogic/validators/semver-range-validator.d.ts +1 -1
  249. package/dist/uilogic/validators/semver-range-validator.js +2 -2
  250. package/dist/uilogic/validators/semver-range-validator.js.map +1 -1
  251. package/oclif.manifest.json +250 -23
  252. package/package.json +4 -4
  253. package/dist/ops/azure-container-registry-client/azure-container-registry-client.js +0 -148
  254. package/dist/ops/azure-container-registry-client/azure-container-registry-client.js.map +0 -1
  255. package/dist/uilogic/cloud-resource-configurators/aws-resource-configurator.js.map +0 -1
  256. package/dist/uilogic/cloud-resource-configurators/az-interactive-login-configurator.js.map +0 -1
  257. package/dist/uilogic/cloud-resource-configurators/azure-resource-configurator.js.map +0 -1
  258. package/dist/uilogic/cloud-resource-configurators/azure-types.js +0 -10
  259. package/dist/uilogic/cloud-resource-configurators/azure-types.js.map +0 -1
  260. package/dist/uilogic/cloud-resource-configurators/docker-hub-resource-configurator.js.map +0 -1
  261. package/dist/uilogic/cloud-resource-configurators/helm-resource-configurator.js.map +0 -1
  262. package/dist/uilogic/i-cluster-configurator.js.map +0 -1
  263. package/dist/uilogic/i-file-store-configurator.js.map +0 -1
  264. package/dist/uilogic/i-login-configurator.js.map +0 -1
  265. package/dist/uilogic/i-registry-configurator.js.map +0 -1
  266. package/dist/uilogic/i-secret-store-configurator.js.map +0 -1
  267. /package/dist/{uilogic → sdk}/i-cluster-configurator.js +0 -0
  268. /package/dist/{uilogic → sdk}/i-file-store-configurator.d.ts +0 -0
  269. /package/dist/{uilogic → sdk}/i-file-store-configurator.js +0 -0
  270. /package/dist/{uilogic → sdk}/i-login-configurator.js +0 -0
  271. /package/dist/{uilogic → sdk}/i-registry-configurator.d.ts +0 -0
  272. /package/dist/{uilogic → sdk}/i-registry-configurator.js +0 -0
  273. /package/dist/{uilogic → sdk}/i-secret-store-configurator.d.ts +0 -0
  274. /package/dist/{uilogic → sdk}/i-secret-store-configurator.js +0 -0
  275. /package/dist/{ops/azure-container-registry-client/azure-container-registry-client.d.ts → sdk-adapters/local-machine/index.d.ts} +0 -0
  276. /package/dist/{uilogic/cloud-resource-configurators/azure-types.d.ts → sdk-adapters/local-machine/local-machine-cli-adapter.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"typescript-scaffolding.js","sourceRoot":"","sources":["../../../src/ops/scaffolding/typescript-scaffolding.ts"],"names":[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CAAC,CAAC;iBACb;YACH,CAAC,CAAA,CAAC,CAAC;QACL,CAAC;KAAA;CAEF,CAAA;AA1JY,qBAAqB;IADjC,IAAA,sBAAU,GAAE;IAEE,mBAAA,IAAA,kBAAM,EAAC,0BAAU,CAAC,aAAa,CAAC,CAAA;;GADlC,qBAAqB,CA0JjC;AA1JY,sDAAqB"}
1
+ {"version":3,"file":"typescript-scaffolding.js","sourceRoot":"","sources":["../../../src/ops/scaffolding/typescript-scaffolding.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,6BAA6B;AAC7B,0BAAkD;AAClD,0EAAiF;AACjF,4DAAsD;AACtD,yCAA+C;AAC/C,oEAAuD;AAEvD,0CAA0C;AAE1C;GACG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,sBAAW;IACpD,YAAwD,MAAqB;QAC3E,KAAK,CAAC,YAAY,CAAC,CAAC;QADkC,WAAM,GAAN,MAAM,CAAe;QAG3E,IAAI,CAAC,eAAe,GAAG,CAAC,kBAAkB,CAAC,CAAA;QAC3C,IAAI,CAAC,kBAAkB,GAAG;YACxB,OAAO;YACP,MAAM;YACN,KAAK;YACL,cAAc;YACd,aAAa;YACb,aAAa;YACb,SAAS;YACT,kBAAkB;YAClB,kBAAkB;SACnB,CAAC;QACF,IAAI,CAAC,eAAe,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QACzC,IAAI,CAAC,aAAa,GAAG;YACnB,aAAa,sBAAkB,CAAC,kBAAkB,EAAE;YACpD,eAAe,sBAAkB,CAAC,kBAAkB,EAAE;YACtD,uBAAuB;YACvB,oBAAoB;YACpB,qBAAqB;SACtB,CAAC;QACF,IAAI,CAAC,aAAa,GAAG,aAAa,sBAAkB,CAAC,kBAAkB,EAAE,CAAC;QAC1E,4CAA4C;QAC5C,6BAA6B;QAC7B,wFAAwF;QACxF,uGAAuG;QACvG,KAAK;QAEL,IAAI,CAAC,gBAAgB,GAAG,CAAO,WAAW,EAAE,UA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,EAAE,SAAS,EAAE,wBAAQ,CAAC,MAAM,CAAC,CAAC;oBAC1F,+CAA+C;oBAC/C,8CAA8C;oBAC9C,gDAAgD;oBAChD,iIAAiI;oBACjI,+GAA+G;oBAC/G,sEAAsE;oBACtE,IAAI;oBAEJ,OAAO,EAAE,CAAC;iBACX;gBAAC,OAAO,GAAG,EAAE;oBACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oCAAoC,GAAG,EAAE,CAAC,CAAC;oBAC7D,MAAM,CAAC,GAAG,CAAC,CAAC;iBACb;YACH,CAAC,CAAA,CAAC,CAAC;QACL,CAAC;KAAA;CAEF,CAAA;AA1JY,qBAAqB;IADjC,IAAA,sBAAU,GAAE;IAEE,mBAAA,IAAA,kBAAM,EAAC,0BAAU,CAAC,aAAa,CAAC,CAAA;;GADlC,qBAAqB,CA0JjC;AA1JY,sDAAqB"}
@@ -0,0 +1,41 @@
1
+ import { IBetterLogger } from "@codiac.io/codiac-common";
2
+ import { TerminalCommandRequest } from "../../message-contracts/terminal-command-request";
3
+ import { IMessageReceivedMeta, IMessagingClient } from "../../uilogic/i-messaging-client";
4
+ import { TerminalUtils } from "../terminal-utils";
5
+ import { CliEnviro } from "../entities";
6
+ export declare class LocalCommandRunner {
7
+ private msgClient;
8
+ private cliEnviro;
9
+ private termUtils;
10
+ private logger;
11
+ constructor(msgClient: IMessagingClient, cliEnviro: CliEnviro, termUtils: TerminalUtils, logger: IBetterLogger);
12
+ private readonly subject;
13
+ private localTerminalCommandRunnerHandlerId;
14
+ /** IMPORTANT! This method requires the client to be connected first. */
15
+ listen(): void;
16
+ protected cliCommandHandler(err: Error | null, msg: TerminalCommandRequest, meta: IMessageReceivedMeta, raw?: any): Promise<void>;
17
+ /** Performs token replacement on the given string using loDash's html view engine.
18
+ * This method DOES NOT mutate the given string; it only returns the new value.
19
+ *
20
+ * **Token delimiters**:
21
+ * * interpolate: `<%= user %>` or `${user}`
22
+ * * html-escape: `<%- value %>`
23
+ * * backslashes to treat delimiters as plain text: `<%= "\\<%- value %\\>" %>`
24
+ *
25
+ * For more examples, see: [LoDash template command](https://lodash.com/docs/4.17.15#template)
26
+ * &nbsp;
27
+ *
28
+ * **EXAMPLE**: Use the "interpolate" delimiter to create a compiled template.
29
+ * ```typescript
30
+ * let output = performTokenReplacements('identifier for this string', 'hello <%= user %>!', { 'user': 'fred' });
31
+ * ```
32
+ * ...yields...
33
+ * ```typescript
34
+ * 'hello fred!'
35
+ * ```
36
+
37
+ * Errors are logged and ignored.
38
+ *
39
+ */
40
+ private performTokenReplacements;
41
+ }
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LocalCommandRunner = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const _ = require("lodash");
6
+ const path = require("path");
7
+ const inversify_1 = require("inversify");
8
+ const codiac_common_1 = require("@codiac.io/codiac-common");
9
+ const contracts_1 = require("@codiac.io/codiac-common/contracts");
10
+ const terminal_utils_1 = require("../terminal-utils");
11
+ const entities_1 = require("../entities");
12
+ const INTERFACES_CLI_1 = require("../INTERFACES_CLI");
13
+ let LocalCommandRunner = class LocalCommandRunner {
14
+ constructor(msgClient, cliEnviro, termUtils, logger) {
15
+ this.msgClient = msgClient;
16
+ this.cliEnviro = cliEnviro;
17
+ this.termUtils = termUtils;
18
+ this.logger = logger;
19
+ this.subject = "mylocalmachine.executeinterminal";
20
+ }
21
+ /** IMPORTANT! This method requires the client to be connected first. */
22
+ listen() {
23
+ var _a;
24
+ try {
25
+ // let subject = ;
26
+ this.localTerminalCommandRunnerHandlerId = this.msgClient.subscribe(this.subject, (err, msg, meta, raw) => tslib_1.__awaiter(this, void 0, void 0, function* () {
27
+ try {
28
+ yield this.cliCommandHandler(err, msg, meta, raw);
29
+ return;
30
+ }
31
+ catch (err) {
32
+ throw err;
33
+ }
34
+ }));
35
+ return;
36
+ }
37
+ catch (err) {
38
+ err.message = "Error setting up command handler: ".concat((_a = err.message) !== null && _a !== void 0 ? _a : "(check logs for details)");
39
+ throw err;
40
+ }
41
+ }
42
+ cliCommandHandler(err, msg, meta, raw) {
43
+ var _a, _b;
44
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
45
+ // 1) Execute the command in a terminal
46
+ this.logger.debug("Terminal command received", msg);
47
+ let response = new contracts_1.SingleResult(false, undefined, undefined, { code: 1, stdout: "Nothing to see here; move along." });
48
+ try {
49
+ const replacements = Object.assign({}, _.clone(this.cliEnviro));
50
+ replacements.cliConfigDir = path.normalize(replacements.cliConfigDir);
51
+ let ultReq = _.cloneDeep(msg);
52
+ ultReq.env = Object.assign(Object.assign({}, process.env), msg.env);
53
+ ultReq.command = this.performTokenReplacements("cli command", ultReq.command, replacements);
54
+ response.output = yield this.termUtils.execute(ultReq);
55
+ }
56
+ catch (err) {
57
+ response.output.code = 1; // generic error code (if we're here, then we're not able to parse it from the terminal output)
58
+ response.output.error = err;
59
+ response.message = (_a = err.message) !== null && _a !== void 0 ? _a : response.message;
60
+ }
61
+ finally {
62
+ response.success = Boolean(response.output.code == 0);
63
+ if (response.output) {
64
+ if (response.output.error && !_.isEmpty(response.output.error)) {
65
+ response.error = response.output.error;
66
+ if (response.error.message && !_.isEmpty(response.error.message))
67
+ response.message = response.output.error.message;
68
+ }
69
+ }
70
+ }
71
+ // 2) Reply with results
72
+ try {
73
+ let responseMeta = {
74
+ action: meta.action,
75
+ correlationId: meta.correlationId,
76
+ subject: (_b = meta.replyOn) !== null && _b !== void 0 ? _b : this.subject
77
+ };
78
+ yield this.msgClient.publish(response, responseMeta);
79
+ return;
80
+ }
81
+ catch (err) {
82
+ throw err;
83
+ }
84
+ });
85
+ }
86
+ /** Performs token replacement on the given string using loDash's html view engine.
87
+ * This method DOES NOT mutate the given string; it only returns the new value.
88
+ *
89
+ * **Token delimiters**:
90
+ * * interpolate: `<%= user %>` or `${user}`
91
+ * * html-escape: `<%- value %>`
92
+ * * backslashes to treat delimiters as plain text: `<%= "\\<%- value %\\>" %>`
93
+ *
94
+ * For more examples, see: [LoDash template command](https://lodash.com/docs/4.17.15#template)
95
+ * &nbsp;
96
+ *
97
+ * **EXAMPLE**: Use the "interpolate" delimiter to create a compiled template.
98
+ * ```typescript
99
+ * let output = performTokenReplacements('identifier for this string', 'hello <%= user %>!', { 'user': 'fred' });
100
+ * ```
101
+ * ...yields...
102
+ * ```typescript
103
+ * 'hello fred!'
104
+ * ```
105
+
106
+ * Errors are logged and ignored.
107
+ *
108
+ */
109
+ performTokenReplacements(templateName, template, variables) {
110
+ var _a;
111
+ try {
112
+ // Catches the variable placeholders inside a string, eg: "https://${asset-code}.${cabinet}.${tenant}.oncodiac.io"
113
+ // let ptn = /\$\{([\w\d\._]+)\}/g;
114
+ // let re = new RegExp(ptn);
115
+ // let matches = re.exec(setting.value); // would be faster to make this a distinct list of variable names, since we're doing a global replace on the callouts.
116
+ // let newValue = setting.value;
117
+ // for (let match in matches) {
118
+ // let variableName = match[0]; // the capture without the callout delimiters
119
+ // if (variables.contains(variablesName)) {
120
+ // let callout = "${" + variableName + "}"; // NOTE: validate that these delims are indeed the ones we are supporting
121
+ // let actual = variables[variableName];
122
+ // newValue = newValue.replace(callout, actual);
123
+ // this.logger.trace(`Replaced config variable callout: [${variableName}] in setting: [${setting.setting}], targetFile: [${setting.targetFile}]`);
124
+ // }
125
+ // }
126
+ let viewEngine = _.template(template);
127
+ let newValue = viewEngine(variables);
128
+ return newValue;
129
+ }
130
+ catch (err) {
131
+ this.logger.detail(`Error performing token replacements on ${templateName}: ${(_a = err.message) !== null && _a !== void 0 ? _a : err.stack}`);
132
+ return template;
133
+ }
134
+ }
135
+ };
136
+ LocalCommandRunner = tslib_1.__decorate([
137
+ (0, inversify_1.injectable)(),
138
+ tslib_1.__param(0, (0, inversify_1.inject)(INTERFACES_CLI_1.INTERFACES_CLI.IMessagingClient)),
139
+ tslib_1.__param(1, (0, inversify_1.inject)(entities_1.CliEnviro)),
140
+ tslib_1.__param(2, (0, inversify_1.inject)(terminal_utils_1.TerminalUtils)),
141
+ tslib_1.__param(3, (0, inversify_1.inject)(codiac_common_1.INTERFACES.IBetterLogger)),
142
+ tslib_1.__metadata("design:paramtypes", [Object, entities_1.CliEnviro,
143
+ terminal_utils_1.TerminalUtils, Object])
144
+ ], LocalCommandRunner);
145
+ exports.LocalCommandRunner = LocalCommandRunner;
146
+ //# sourceMappingURL=local-command-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-command-runner.js","sourceRoot":"","sources":["../../../src/ops/terminal-command-runner/local-command-runner.ts"],"names":[],"mappings":";;;;AAAA,4BAA6B;AAC7B,6BAA6B;AAC7B,yCAA+C;AAC/C,4DAAqE;AACrE,kEAAkE;AAGlE,sDAAkD;AAClD,0CAAwC;AACxC,sDAAmD;AAI5C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAE7B,YACmD,SAA2B,EACjD,SAAoB,EAChB,SAAwB,EACb,MAAqB;QAHd,cAAS,GAAT,SAAS,CAAkB;QACjD,cAAS,GAAT,SAAS,CAAW;QAChB,cAAS,GAAT,SAAS,CAAe;QACb,WAAM,GAAN,MAAM,CAAe;QAKhD,YAAO,GAAW,kCAAkC,CAAC;IAFtE,CAAC;IAKD,wEAAwE;IACjE,MAAM;;QACX,IAAI;YACF,kBAAkB;YAElB,IAAI,CAAC,mCAAmC,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,CAAO,GAAiB,EAAE,GAA2B,EAAE,IAA0B,EAAE,GAAS,EAAE,EAAE;gBAChL,IAAI;oBACF,MAAM,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;oBAClD,OAAO;iBACR;gBAAC,OAAO,GAAG,EAAE;oBACZ,MAAM,GAAG,CAAC;iBACX;YACH,CAAC,CAAA,CAAC,CAAC;YAEH,OAAO;SACR;QAAC,OAAO,GAAG,EAAE;YACZ,GAAG,CAAC,OAAO,GAAG,oC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,IAAI,UAAU,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACtC,IAAI,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;YAErC,OAAO,QAAQ,CAAC;SACjB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,0CAA0C,YAAY,KAAK,MAAA,GAAG,CAAC,OAAO,mCAAI,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;YACzG,OAAO,QAAQ,CAAC;SACjB;IAEH,CAAC;CAEF,CAAA;AA/IY,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;IAIR,mBAAA,IAAA,kBAAM,EAAC,+BAAc,CAAC,gBAAgB,CAAC,CAAA;IACvC,mBAAA,IAAA,kBAAM,EAAC,oBAAS,CAAC,CAAA;IACjB,mBAAA,IAAA,kBAAM,EAAC,8BAAa,CAAC,CAAA;IACrB,mBAAA,IAAA,kBAAM,EAAC,0BAAU,CAAC,aAAa,CAAC,CAAA;qDAFK,oBAAS;QACL,8BAAa;GAL9C,kBAAkB,CA+I9B;AA/IY,gDAAkB"}
@@ -0,0 +1,56 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { ChildProcess } from 'child_process';
4
+ import { IBetterLogger, LogLevel } from '@codiac.io/codiac-common/IBetterLogger';
5
+ import * as types from '@codiac.io/codiac-ops-common';
6
+ import { CommandResponse, TerminalCommandRequest } from '../message-contracts/terminal-command-request';
7
+ export declare class TerminalUtils {
8
+ private logger;
9
+ constructor(logger: IBetterLogger);
10
+ private cliExec;
11
+ execute(request: TerminalCommandRequest): Promise<CommandResponse>;
12
+ /** Fires the given shell command into a child process
13
+ * that inherits the parent's stdio (input, output, and error streams),
14
+ * and resolves the promise on exit of that child process.
15
+ * Returns the exit code from the child process.
16
+ *
17
+ * @param terminalExe The executable to open the terminal. Examples: `powershell`, `wsl`, `bash`, `sh`
18
+ * @param terminalArgs Arguments for the terminal executable itself. Examples: (for powershell: `["-c"]`, for wsl: `["-d", "ubuntu-20.04", "bash", "-l", "-c"]` OR `["-d", "ubuntu-20.04", "bash", "-l", "--"]`, for bash: `["-c"]`). IMPORTANT! Be sure to include the `-c` or `--` arg at the end because these arguments string will be suffixed by the `commandString` parameter of this function.
19
+ * @param commandString the commands to execute from within the terminal process (typically delimited by "&&" or "&"). NOTE: This string will be automatically enclosed in double quotes for final execution, with any existing double-quotes escaped as `\"`, unless you set the `doNotEnquoteCommand` parameter to true on this fucntion
20
+ * @param env If this gets passed in, it replaces the current env. That is, no env vars from the parent get carried into the child process.
21
+ * So if you use this param and you still want the current env vars, you'll have to add process.env to your dictionary (use a spread operator).
22
+ * @param collectStdOut (optional, defaults to false) Prevents piping runtime data directly to stdout and instead renders it after completion. Some processes provide runtime status messages (eg: docker's percent completes, etc), which get obstructed by piping to stdout. If so, set this argument to true.
23
+ * @param enquoteCommand (optional, defaults to auto) Setting to true forces enclosing the command string in double quotes for final execution. By default the given commandString param will get appended as is to the terminal command when the last terminal argument is the double-dash: `--`, otherwise it will be enclosed in double quotes (with escaping).
24
+ * */
25
+ spawnTerminalCommands(terminalExe: string, terminalArgs: string[], commandString: string, cwd: string, env?: types.dic, collectStdOut?: boolean, enquoteCommand?: boolean | undefined): Promise<CommandResponse>;
26
+ /** Fires the given shell command into a child process
27
+ * that inherits the parent's stdio (input, output, and error streams),
28
+ * and resolves the promise on exit of that child process.
29
+ * Returns the exit code from the child process.
30
+ * @param env If this gets passed in, it replaces the current env. That is, no env vars from the parent get carried into the child process.
31
+ * So if you use this param and you still want the current env vars, you'll have to add process.env to your dictionary (use a spread operator).
32
+ * @param collectStdOut (optional, defaults to false) Prevents piping runtime data directly to stdout and instead renders it after completion. Some processes provide runtime status messages (eg: docker's percent completes, etc), which get obstructed by piping to stdout. If so, set this argument to true.
33
+ * */
34
+ spawnAndLog(cmd: string, cwd: string, env?: types.dic, logLevel?: LogLevel, collectStdOut?: boolean, stdoutEncoding?: BufferEncoding): Promise<[number, string | undefined]>;
35
+ /** Fires the given shell command into a child process
36
+ * that inherits the parent's stdio (input, output, and error streams),
37
+ * and resolves the promise on exit of that child process.
38
+ * Returns the exit code from the child process.
39
+ *
40
+ * @param terminalExe The executable to open the terminal. Examples: `powershell`, `wsl`, `bash`, `sh`
41
+ * @param terminalArgs Arguments for the terminal executable itself. Examples: (for powershell: `["-c"]`, for wsl: `["-d", "ubuntu-20.04", "bash", "-l", "-c"]` OR `["-d", "ubuntu-20.04", "bash", "-l", "--"]`, for bash: `["-c"]`). IMPORTANT! Be sure to include the `-c` or `--` arg at the end because these arguments string will be suffixed by the `commandString` parameter of this function.
42
+ * @param commandString the commands to execute from within the terminal process (typically delimited by "&&" or "&"). NOTE: This string will be automatically enclosed in double quotes for final execution, with any existing double-quotes escaped as `\"`, unless you set the `doNotEnquoteCommand` parameter to true on this fucntion
43
+ * @param env If this gets passed in, it replaces the current env. That is, no env vars from the parent get carried into the child process.
44
+ * So if you use this param and you still want the current env vars, you'll have to add process.env to your dictionary (use a spread operator).
45
+ * @param collectStdOut (optional, defaults to false) Prevents piping runtime data directly to stdout and instead renders it after completion. Some processes provide runtime status messages (eg: docker's percent completes, etc), which get obstructed by piping to stdout. If so, set this argument to true.
46
+ * @param enquoteCommand (optional, defaults to auto) Setting to true forces enclosing the command string in double quotes for final execution. By default the given commandString param will get appended as is to the terminal command when the last terminal argument is the double-dash: `--`, otherwise it will be enclosed in double quotes (with escaping).
47
+ * */
48
+ openTerminal(terminalExe: string, terminalArgs: string[], cwd: string, env?: types.dic, collectStdOut?: boolean, enquoteCommand?: boolean | undefined): ChildProcess;
49
+ executeInExistingTerminal(terminal: ChildProcess, command: string): Promise<CommandResponse>;
50
+ /** Returns the exit code (NOTE: this exit code reflects the exit code of the most recently executed command). */
51
+ closeTerminal(term: ChildProcess): Promise<number>;
52
+ /** Equivalent of: `openTerminal() + executeInTerminal() + closeTerminal()`.
53
+ *
54
+ */
55
+ executeSingleCommandInTerminal(terminalExe: string, terminalArgs: string[], command: string, cwd: string, env?: types.dic): Promise<CommandResponse>;
56
+ }