@celonis/content-cli 0.13.5 → 1.0.0

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 (245) hide show
  1. package/README.md +13 -6
  2. package/{api → commands/action-flows/action-flow}/action-flow-api.js +10 -9
  3. package/commands/{action-flow.command.js → action-flows/action-flow/action-flow-command.service.js} +11 -8
  4. package/{services/action-flow/action-flow-service.js → commands/action-flows/action-flow/action-flow.service.js} +12 -10
  5. package/commands/action-flows/module.js +88 -0
  6. package/commands/{skill.command.js → action-flows/skill/skill-command.service.js} +9 -11
  7. package/{content/factory/skill-manager.factory.js → commands/action-flows/skill/skill.manager-factory.js} +7 -4
  8. package/{content/manager → commands/action-flows/skill}/skill.manager.js +7 -4
  9. package/commands/analysis/analysis-bookmarks-command.service.js +39 -0
  10. package/{content/factory/analysis-bookmarks-manager.factory.js → commands/analysis/analysis-bookmarks.manager-factory.js} +7 -4
  11. package/{content/manager → commands/analysis}/analysis-bookmarks.manager.js +8 -5
  12. package/commands/analysis/module.js +52 -0
  13. package/commands/configuration-management/api/batch-import-export-api.js +84 -0
  14. package/{api → commands/configuration-management/api}/diff-api.js +8 -7
  15. package/commands/configuration-management/api/variable-assignment-candidates-api.js +41 -0
  16. package/{services/package-manager/batch-import-export-service.js → commands/configuration-management/batch-import-export.service.js} +31 -26
  17. package/commands/{config.command.js → configuration-management/config-command.service.js} +21 -16
  18. package/{services/package-manager/diff-service.js → commands/configuration-management/diff.service.js} +11 -8
  19. package/commands/configuration-management/module.js +102 -0
  20. package/{services/studio → commands/configuration-management}/studio.service.js +33 -24
  21. package/commands/{variable.command.js → configuration-management/variable-command.service.js} +10 -7
  22. package/{services/package-manager/variable-service.js → commands/configuration-management/variable.service.js} +36 -42
  23. package/commands/{ctp.command.js → cpm4/ctp-command.service.js} +11 -13
  24. package/{content/manager → commands/cpm4}/ctp.analysis.manager.js +3 -0
  25. package/{content/manager → commands/cpm4}/ctp.datamodel.manager.js +2 -2
  26. package/{content/factory/ctp-manager.factory.js → commands/cpm4/ctp.manager-factory.js} +9 -6
  27. package/{content/manager → commands/cpm4}/ctp.manager.js +6 -4
  28. package/commands/cpm4/module.js +46 -0
  29. package/commands/{connection.command.js → data-pipeline/connection/connection-command.service.js} +14 -11
  30. package/commands/data-pipeline/connection/connection.commands.js +65 -0
  31. package/{services → commands/data-pipeline}/connection/connection.service.js +18 -15
  32. package/{api → commands/data-pipeline/data-pool}/data-pool-api.js +14 -13
  33. package/commands/{data-pool.command.js → data-pipeline/data-pool/data-pool-command.service.js} +25 -23
  34. package/{content/factory → commands/data-pipeline/data-pool}/data-pool-manager.factory.js +9 -6
  35. package/{services → commands/data-pipeline}/data-pool/data-pool-service.js +13 -10
  36. package/commands/data-pipeline/data-pool/data-pool.commands.js +99 -0
  37. package/{content/manager → commands/data-pipeline/data-pool}/data-pool.manager.js +8 -9
  38. package/commands/data-pipeline/module.js +24 -0
  39. package/commands/profile/module.js +60 -0
  40. package/commands/profile/profile-command.service.js +94 -0
  41. package/{api → commands/studio/api}/asset-api.js +8 -7
  42. package/{api → commands/studio/api}/compute-pool-api.js +7 -6
  43. package/{api → commands/studio/api}/node-api.js +9 -8
  44. package/{api → commands/studio/api}/package-api.js +18 -17
  45. package/{api → commands/studio/api}/package-dependencies-api.js +12 -11
  46. package/{api → commands/studio/api}/space-api.js +10 -9
  47. package/commands/{analysis-bookmarks.command.js → studio/api/studio-variables-api.js} +18 -13
  48. package/commands/{asset.command.js → studio/command-service/asset-command.service.js} +21 -19
  49. package/commands/{package.command.js → studio/command-service/package-command.service.js} +22 -20
  50. package/commands/{space.command.js → studio/command-service/space-command.service.js} +9 -11
  51. package/commands/studio/command-service/widget.command.js +56 -0
  52. package/{content/factory/asset-manager.factory.js → commands/studio/manager/asset.manager-factory.js} +7 -4
  53. package/{content → commands/studio}/manager/asset.manager.js +8 -5
  54. package/{content/factory/package-manager.factory.js → commands/studio/manager/package.manager-factory.js} +7 -4
  55. package/{content → commands/studio}/manager/package.manager.js +9 -6
  56. package/{content/factory/space-manager.factory.js → commands/studio/manager/space.manager-factory.js} +6 -3
  57. package/{content → commands/studio}/manager/space.manager.js +7 -4
  58. package/{content/factory/widget-manager.factory.js → commands/studio/manager/widget.manager-factory.js} +8 -5
  59. package/{content → commands/studio}/manager/widget.manager.js +5 -5
  60. package/commands/studio/module.js +169 -0
  61. package/{services/package-manager → commands/studio/service}/asset-service.js +10 -9
  62. package/{services/package-manager/datamodel-service.js → commands/studio/service/data-model.service.js} +8 -6
  63. package/{services/package-manager/package-service.js → commands/studio/service/package.service.js} +59 -49
  64. package/{services/package-manager/space-service.js → commands/studio/service/space.service.js} +9 -9
  65. package/commands/studio/service/studio-variable.service.js +41 -0
  66. package/content-cli.js +69 -20
  67. package/core/command/cli-context.js +69 -0
  68. package/core/command/module-handler.js +200 -0
  69. package/core/http/base-api.js +115 -0
  70. package/{services/http-client-service.v2.js → core/http/http-client.js} +39 -24
  71. package/{services/context.service.js → core/http/http-shared/base.manager.helper.js} +6 -16
  72. package/{content/manager → core/http/http-shared}/base.manager.js +14 -21
  73. package/{services → core/profile}/profile.service.js +11 -5
  74. package/{validators → core/profile}/profile.validator.js +3 -3
  75. package/{services → core/utils}/file-service.js +2 -7
  76. package/core/utils/logger.js +102 -0
  77. package/{services → core/utils}/question.service.js +18 -7
  78. package/{util → core/utils}/version.js +1 -1
  79. package/lib/{api → commands/action-flows/action-flow}/action-flow-api.d.ts +4 -4
  80. package/lib/commands/{action-flow.command.d.ts → action-flows/action-flow/action-flow-command.service.d.ts} +4 -1
  81. package/lib/{services/action-flow/action-flow-service.d.ts → commands/action-flows/action-flow/action-flow.service.d.ts} +4 -4
  82. package/lib/commands/action-flows/module.d.ts +14 -0
  83. package/lib/commands/{skill.command.d.ts → action-flows/skill/skill-command.service.d.ts} +3 -2
  84. package/lib/commands/action-flows/skill/skill.manager-factory.d.ts +8 -0
  85. package/lib/{content/manager → commands/action-flows/skill}/skill.manager.d.ts +4 -2
  86. package/lib/commands/analysis/analysis-bookmarks-command.service.d.ts +7 -0
  87. package/lib/commands/analysis/analysis-bookmarks.manager-factory.d.ts +8 -0
  88. package/lib/{content/manager → commands/analysis}/analysis-bookmarks.manager.d.ts +4 -2
  89. package/lib/commands/analysis/module.d.ts +11 -0
  90. package/lib/{api → commands/configuration-management/api}/batch-import-export-api.d.ts +5 -5
  91. package/lib/{api → commands/configuration-management/api}/diff-api.d.ts +5 -5
  92. package/lib/commands/configuration-management/api/variable-assignment-candidates-api.d.ts +8 -0
  93. package/lib/{services/package-manager/batch-import-export-service.d.ts → commands/configuration-management/batch-import-export.service.d.ts} +6 -3
  94. package/lib/commands/{config.command.d.ts → configuration-management/config-command.service.d.ts} +6 -1
  95. package/lib/{services/package-manager/diff-service.d.ts → commands/configuration-management/diff.service.d.ts} +4 -3
  96. package/lib/{interfaces/package-export-transport.d.ts → commands/configuration-management/interfaces/package-export.interfaces.d.ts} +2 -2
  97. package/lib/{api/variable-assignment-apis.d.ts → commands/configuration-management/interfaces/variable-assignment-apis.constants.d.ts} +3 -1
  98. package/lib/commands/configuration-management/module.d.ts +15 -0
  99. package/lib/{services/studio → commands/configuration-management}/studio.service.d.ts +12 -5
  100. package/lib/commands/configuration-management/variable-command.service.d.ts +6 -0
  101. package/lib/{services/package-manager/variable-service.d.ts → commands/configuration-management/variable.service.d.ts} +8 -8
  102. package/lib/commands/cpm4/ctp-command.service.d.ts +7 -0
  103. package/lib/{content/manager → commands/cpm4}/ctp.analysis.manager.d.ts +2 -0
  104. package/lib/{content/manager → commands/cpm4}/ctp.datamodel.manager.d.ts +2 -1
  105. package/lib/{content/factory/ctp-manager.factory.d.ts → commands/cpm4/ctp.manager-factory.d.ts} +4 -1
  106. package/lib/{content/manager → commands/cpm4}/ctp.manager.d.ts +4 -2
  107. package/lib/commands/cpm4/module.d.ts +10 -0
  108. package/lib/commands/data-pipeline/connection/connection-command.service.d.ts +8 -0
  109. package/lib/commands/data-pipeline/connection/connection.commands.d.ts +11 -0
  110. package/lib/{services → commands/data-pipeline}/connection/connection.service.d.ts +4 -3
  111. package/lib/{api → commands/data-pipeline/data-pool}/data-pool-api.d.ts +5 -5
  112. package/lib/commands/data-pipeline/data-pool/data-pool-command.service.d.ts +14 -0
  113. package/lib/commands/data-pipeline/data-pool/data-pool-manager.factory.d.ts +9 -0
  114. package/lib/{services → commands/data-pipeline}/data-pool/data-pool-service.d.ts +4 -3
  115. package/lib/commands/data-pipeline/data-pool/data-pool.commands.d.ts +15 -0
  116. package/lib/{content/manager → commands/data-pipeline/data-pool}/data-pool.manager.d.ts +4 -2
  117. package/lib/commands/data-pipeline/module.d.ts +9 -0
  118. package/lib/commands/profile/module.d.ts +12 -0
  119. package/lib/commands/{profile.command.d.ts → profile/profile-command.service.d.ts} +1 -1
  120. package/lib/{api → commands/studio/api}/asset-api.d.ts +4 -4
  121. package/lib/{api → commands/studio/api}/compute-pool-api.d.ts +4 -4
  122. package/lib/{api → commands/studio/api}/node-api.d.ts +4 -4
  123. package/lib/{api → commands/studio/api}/package-api.d.ts +4 -4
  124. package/lib/{api → commands/studio/api}/package-dependencies-api.d.ts +4 -4
  125. package/lib/commands/studio/api/space-api.d.ts +9 -0
  126. package/lib/commands/studio/api/studio-variables-api.d.ts +8 -0
  127. package/lib/commands/studio/command-service/asset-command.service.d.ts +11 -0
  128. package/lib/commands/{package.command.d.ts → studio/command-service/package-command.service.d.ts} +8 -5
  129. package/lib/commands/studio/command-service/space-command.service.d.ts +6 -0
  130. package/lib/commands/studio/command-service/widget.command.d.ts +7 -0
  131. package/lib/{interfaces/batch-export-node-transport.d.ts → commands/studio/interfaces/batch-export-node.interfaces.d.ts} +1 -9
  132. package/lib/{content/factory/asset-manager.factory.d.ts → commands/studio/manager/asset.manager-factory.d.ts} +4 -1
  133. package/lib/{content → commands/studio}/manager/asset.manager.d.ts +4 -2
  134. package/lib/{content/factory/package-manager.factory.d.ts → commands/studio/manager/package.manager-factory.d.ts} +4 -1
  135. package/lib/{content → commands/studio}/manager/package.manager.d.ts +4 -2
  136. package/lib/commands/studio/manager/space.manager-factory.d.ts +8 -0
  137. package/lib/{content → commands/studio}/manager/space.manager.d.ts +4 -2
  138. package/lib/{content/factory/widget-manager.factory.d.ts → commands/studio/manager/widget.manager-factory.d.ts} +10 -7
  139. package/lib/{content → commands/studio}/manager/widget.manager.d.ts +4 -2
  140. package/lib/commands/studio/module.d.ts +21 -0
  141. package/lib/{services/package-manager → commands/studio/service}/asset-service.d.ts +4 -3
  142. package/lib/{services/package-manager/datamodel-service.d.ts → commands/studio/service/data-model.service.d.ts} +5 -5
  143. package/lib/{services/package-manager/package-service.d.ts → commands/studio/service/package.service.d.ts} +13 -6
  144. package/lib/commands/studio/service/space.service.d.ts +11 -0
  145. package/lib/commands/studio/service/studio-variable.service.d.ts +9 -0
  146. package/lib/core/command/cli-context.d.ts +17 -0
  147. package/lib/core/command/module-handler.d.ts +57 -0
  148. package/lib/core/http/base-api.d.ts +32 -0
  149. package/lib/{services/http-client-service.v2.d.ts → core/http/http-client.d.ts} +8 -3
  150. package/lib/{content/manager → core/http/http-shared}/base.manager.d.ts +4 -6
  151. package/lib/core/http/http-shared/base.manager.helper.d.ts +4 -0
  152. package/lib/{services → core/profile}/profile.service.d.ts +2 -1
  153. package/lib/{validators → core/profile}/profile.validator.d.ts +1 -1
  154. package/lib/{services → core/utils}/file-service.d.ts +0 -2
  155. package/lib/core/utils/question.service.d.ts +10 -0
  156. package/package.json +3 -3
  157. package/api/batch-import-export-api.js +0 -62
  158. package/api/variables-api.js +0 -56
  159. package/commands/profile.command.js +0 -88
  160. package/commands/widget.command.js +0 -36
  161. package/content-cli-analyze.js +0 -56
  162. package/content-cli-config.js +0 -119
  163. package/content-cli-export.js +0 -90
  164. package/content-cli-get.js +0 -52
  165. package/content-cli-import.js +0 -93
  166. package/content-cli-list.js +0 -129
  167. package/content-cli-profile.js +0 -64
  168. package/content-cli-pull.js +0 -104
  169. package/content-cli-push.js +0 -196
  170. package/content-cli-set.js +0 -55
  171. package/content-cli-update.js +0 -44
  172. package/interfaces/variable-assignment-api.interface.js +0 -12
  173. package/lib/api/space-api.d.ts +0 -9
  174. package/lib/api/variables-api.d.ts +0 -14
  175. package/lib/commands/analysis-bookmarks.command.d.ts +0 -6
  176. package/lib/commands/asset.command.d.ts +0 -8
  177. package/lib/commands/connection.command.d.ts +0 -5
  178. package/lib/commands/ctp.command.d.ts +0 -6
  179. package/lib/commands/data-pool.command.d.ts +0 -11
  180. package/lib/commands/space.command.d.ts +0 -5
  181. package/lib/commands/variable.command.d.ts +0 -3
  182. package/lib/commands/widget.command.d.ts +0 -5
  183. package/lib/content/factory/analysis-bookmarks-manager.factory.d.ts +0 -5
  184. package/lib/content/factory/data-pool-manager.factory.d.ts +0 -6
  185. package/lib/content/factory/skill-manager.factory.d.ts +0 -5
  186. package/lib/content/factory/space-manager.factory.d.ts +0 -5
  187. package/lib/content-cli-analyze.d.ts +0 -1
  188. package/lib/content-cli-config.d.ts +0 -8
  189. package/lib/content-cli-export.d.ts +0 -6
  190. package/lib/content-cli-get.d.ts +0 -1
  191. package/lib/content-cli-import.d.ts +0 -6
  192. package/lib/content-cli-list.d.ts +0 -9
  193. package/lib/content-cli-profile.d.ts +0 -1
  194. package/lib/content-cli-pull.d.ts +0 -1
  195. package/lib/content-cli-push.d.ts +0 -1
  196. package/lib/content-cli-set.d.ts +0 -1
  197. package/lib/content-cli-update.d.ts +0 -1
  198. package/lib/interfaces/variable-assignment-api.interface.d.ts +0 -3
  199. package/lib/services/command.service.d.ts +0 -6
  200. package/lib/services/content.service.d.ts +0 -11
  201. package/lib/services/context.service.d.ts +0 -13
  202. package/lib/services/http-client.service.d.ts +0 -15
  203. package/lib/services/package-manager/space-service.d.ts +0 -11
  204. package/lib/services/question.service.d.ts +0 -4
  205. package/lib/util/context-initializer.d.ts +0 -3
  206. package/lib/util/program.d.ts +0 -2
  207. package/services/command.service.js +0 -24
  208. package/services/content.service.js +0 -130
  209. package/services/http-client.service.js +0 -157
  210. package/util/context-initializer.js +0 -39
  211. package/util/logger.js +0 -49
  212. package/util/program.js +0 -16
  213. /package/{interfaces/batch-export-import-constants.js → commands/configuration-management/interfaces/batch-export-import.constants.js} +0 -0
  214. /package/{interfaces/diff-package.transport.js → commands/configuration-management/interfaces/diff-package.interfaces.js} +0 -0
  215. /package/{interfaces/batch-export-node-transport.js → commands/configuration-management/interfaces/package-export.interfaces.js} +0 -0
  216. /package/{api/variable-assignment-apis.js → commands/configuration-management/interfaces/variable-assignment-apis.constants.js} +0 -0
  217. /package/{interfaces → commands/data-pipeline/data-pool}/data-pool-manager.interfaces.js +0 -0
  218. /package/{interfaces/manager-config.interface.js → commands/studio/interfaces/batch-export-node.interfaces.js} +0 -0
  219. /package/{interfaces/manifest-transport.js → commands/studio/interfaces/manifest.interface.js} +0 -0
  220. /package/{interfaces → commands/studio/interfaces}/package-manager.interfaces.js +0 -0
  221. /package/{interfaces → commands/studio/interfaces}/save-content-node.interface.js +0 -0
  222. /package/{interfaces/package-export-transport.js → commands/studio/interfaces/space.interface.js} +0 -0
  223. /package/{util → commands/studio/utils}/semantic-versioning.js +0 -0
  224. /package/{util → core/http}/axios-initializer.js +0 -0
  225. /package/{interfaces/save-space.interface.js → core/http/http-shared/manager-config.interface.js} +0 -0
  226. /package/{util → core/http}/tracing.js +0 -0
  227. /package/{interfaces → core/profile}/profile.interface.js +0 -0
  228. /package/{util → core/utils}/json.js +0 -0
  229. /package/{util → core/utils}/yaml.js +0 -0
  230. /package/lib/{interfaces/batch-export-import-constants.d.ts → commands/configuration-management/interfaces/batch-export-import.constants.d.ts} +0 -0
  231. /package/lib/{interfaces/diff-package.transport.d.ts → commands/configuration-management/interfaces/diff-package.interfaces.d.ts} +0 -0
  232. /package/lib/{interfaces → commands/data-pipeline/data-pool}/data-pool-manager.interfaces.d.ts +0 -0
  233. /package/lib/{interfaces/manifest-transport.d.ts → commands/studio/interfaces/manifest.interface.d.ts} +0 -0
  234. /package/lib/{interfaces → commands/studio/interfaces}/package-manager.interfaces.d.ts +0 -0
  235. /package/lib/{interfaces → commands/studio/interfaces}/save-content-node.interface.d.ts +0 -0
  236. /package/lib/{interfaces/save-space.interface.d.ts → commands/studio/interfaces/space.interface.d.ts} +0 -0
  237. /package/lib/{util → commands/studio/utils}/semantic-versioning.d.ts +0 -0
  238. /package/lib/{util → core/http}/axios-initializer.d.ts +0 -0
  239. /package/lib/{interfaces → core/http/http-shared}/manager-config.interface.d.ts +0 -0
  240. /package/lib/{util → core/http}/tracing.d.ts +0 -0
  241. /package/lib/{interfaces → core/profile}/profile.interface.d.ts +0 -0
  242. /package/lib/{util → core/utils}/json.d.ts +0 -0
  243. /package/lib/{util → core/utils}/logger.d.ts +0 -0
  244. /package/lib/{util → core/utils}/version.d.ts +0 -0
  245. /package/lib/{util → core/utils}/yaml.d.ts +0 -0
package/README.md CHANGED
@@ -82,7 +82,7 @@ content-cli -h
82
82
  content-cli pull package -h
83
83
  ```
84
84
 
85
- ## Building the Project
85
+ ## Building and Using the Project locally
86
86
 
87
87
  This tool is tightly connected with the Celonis EMS and all capabilities require to have access to a Celonis EMS Team.
88
88
  After cloning the project, the next step is to install the project dependencies. We use `yarn` as our package manager,
@@ -90,11 +90,16 @@ so running `yarn install` on the project root folder should install all the nece
90
90
  the project dependencies, you can run `yarn build` to build the project artifact. To use the built artifact, you can
91
91
  run `node content-cli.js` in the generated `dist` folder.
92
92
 
93
+ If we want to use a specific local build of the tool globally, we can do this by:
94
+ - Move to the root directory of the project.
95
+ - Execute the `npm link` command.
96
+ This will create a symbolic link in the global `node_modules` directory, allowing you to run the CLI from anywhere on your machine.
97
+
93
98
  ## Release Process
94
99
 
95
- We manage releases using Github Actions with the `Build and Publish Workflow`. This action runs after merging to
96
- the master branch, which builds the project and publishes the package to the Github registry. You can install
97
- a published version of the Content CLI using the following command:
100
+ We manage releases using Github Actions with the `Build and Publish Workflow`. This action gets executed manually by the Codeowners when there are changes that need to be published.
101
+ This builds the project and publishes the package to the Github registry. You can install
102
+ the latest published version of the Content CLI using the following command:
98
103
 
99
104
  ```
100
105
  npm i -g @celonis/content-cli
@@ -102,9 +107,11 @@ npm i -g @celonis/content-cli
102
107
 
103
108
  ## Contributing
104
109
 
105
- We encourage public contributions! Please review
110
+ We encourage public contributions! Please check
106
111
  [CONTRIBUTING.md](https://github.com/celonis/content-cli/blob/master/CONTRIBUTING.md) for details on our
107
- code of conduct and development process.
112
+ code of conduct.
113
+
114
+ For details on command development, refer to the [How to Add a Command](https://github.com/celonis/content-cli/blob/master/docs/how-to-add-command.md) guide.
108
115
 
109
116
  ## License
110
117
 
@@ -13,25 +13,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  if (v !== undefined) module.exports = v;
14
14
  }
15
15
  else if (typeof define === "function" && define.amd) {
16
- define(["require", "exports", "../services/http-client-service.v2", "../util/logger"], factory);
16
+ define(["require", "exports", "../../../core/utils/logger"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.actionFlowApi = void 0;
22
- const http_client_service_v2_1 = require("../services/http-client-service.v2");
23
- const logger_1 = require("../util/logger");
21
+ exports.ActionFlowApi = void 0;
22
+ const logger_1 = require("../../../core/utils/logger");
24
23
  class ActionFlowApi {
24
+ constructor(context) {
25
+ this.httpClient = context.httpClient;
26
+ }
25
27
  exportRawAssets(packageId) {
26
28
  return __awaiter(this, void 0, void 0, function* () {
27
- return http_client_service_v2_1.httpClientV2.getFile(`/ems-automation/api/root/${packageId}/export/assets`).catch(e => {
29
+ return this.httpClient.getFile(`/ems-automation/api/root/${packageId}/export/assets`).catch(e => {
28
30
  throw new logger_1.FatalError(`Problem getting Action Flow assets: ${e}`);
29
31
  });
30
32
  });
31
33
  }
32
34
  analyzeAssets(packageId) {
33
35
  return __awaiter(this, void 0, void 0, function* () {
34
- return http_client_service_v2_1.httpClientV2.get(`/ems-automation/api/root/${packageId}/export/assets/analyze`).catch(e => {
36
+ return this.httpClient.get(`/ems-automation/api/root/${packageId}/export/assets/analyze`).catch(e => {
35
37
  throw new logger_1.FatalError(`Problem analyzing Action Flow assets: ${e}`);
36
38
  });
37
39
  });
@@ -41,12 +43,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
43
  const params = {
42
44
  dryRun: dryRun,
43
45
  };
44
- return http_client_service_v2_1.httpClientV2.postFile(`/ems-automation/api/root/${packageId}/import/assets`, data, params).catch(e => {
46
+ return this.httpClient.postFile(`/ems-automation/api/root/${packageId}/import/assets`, data, params).catch(e => {
45
47
  throw new logger_1.FatalError(`Problem importing Action Flow assets: ${e}`);
46
48
  });
47
49
  });
48
50
  }
49
51
  }
50
- ActionFlowApi.INSTANCE = new ActionFlowApi();
51
- exports.actionFlowApi = ActionFlowApi.INSTANCE;
52
+ exports.ActionFlowApi = ActionFlowApi;
52
53
  });
@@ -13,29 +13,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  if (v !== undefined) module.exports = v;
14
14
  }
15
15
  else if (typeof define === "function" && define.amd) {
16
- define(["require", "exports", "../services/action-flow/action-flow-service"], factory);
16
+ define(["require", "exports", "./action-flow.service"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.ActionFlowCommand = void 0;
22
- const action_flow_service_1 = require("../services/action-flow/action-flow-service");
23
- class ActionFlowCommand {
21
+ exports.ActionFlowCommandService = void 0;
22
+ const action_flow_service_1 = require("./action-flow.service");
23
+ class ActionFlowCommandService {
24
+ constructor(context) {
25
+ this.actionFlowService = new action_flow_service_1.ActionFlowService(context);
26
+ }
24
27
  exportActionFlows(packageId, metadataFile) {
25
28
  return __awaiter(this, void 0, void 0, function* () {
26
- yield action_flow_service_1.actionFlowService.exportActionFlows(packageId, metadataFile);
29
+ yield this.actionFlowService.exportActionFlows(packageId, metadataFile);
27
30
  });
28
31
  }
29
32
  analyzeActionFlows(packageId, outputToJsonFile) {
30
33
  return __awaiter(this, void 0, void 0, function* () {
31
- yield action_flow_service_1.actionFlowService.analyzeActionFlows(packageId, outputToJsonFile);
34
+ yield this.actionFlowService.analyzeActionFlows(packageId, outputToJsonFile);
32
35
  });
33
36
  }
34
37
  importActionFlows(packageId, filePath, dryRun, outputToJsonFile) {
35
38
  return __awaiter(this, void 0, void 0, function* () {
36
- yield action_flow_service_1.actionFlowService.importActionFlows(packageId, filePath, dryRun, outputToJsonFile);
39
+ yield this.actionFlowService.importActionFlows(packageId, filePath, dryRun, outputToJsonFile);
37
40
  });
38
41
  }
39
42
  }
40
- exports.ActionFlowCommand = ActionFlowCommand;
43
+ exports.ActionFlowCommandService = ActionFlowCommandService;
41
44
  });
@@ -13,23 +13,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  if (v !== undefined) module.exports = v;
14
14
  }
15
15
  else if (typeof define === "function" && define.amd) {
16
- define(["require", "exports", "../../util/logger", "uuid", "../file-service", "../../api/action-flow-api", "adm-zip", "form-data", "fs"], factory);
16
+ define(["require", "exports", "uuid", "adm-zip", "form-data", "fs", "./action-flow-api", "../../../core/utils/file-service", "../../../core/utils/logger"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.metadataFileName = exports.actionFlowService = void 0;
22
- const logger_1 = require("../../util/logger");
21
+ exports.ActionFlowService = void 0;
23
22
  const uuid_1 = require("uuid");
24
- const file_service_1 = require("../file-service");
25
- const action_flow_api_1 = require("../../api/action-flow-api");
26
23
  const AdmZip = require("adm-zip");
27
24
  const FormData = require("form-data");
28
25
  const fs = require("fs");
26
+ const action_flow_api_1 = require("./action-flow-api");
27
+ const file_service_1 = require("../../../core/utils/file-service");
28
+ const logger_1 = require("../../../core/utils/logger");
29
29
  class ActionFlowService {
30
+ constructor(context) {
31
+ this.actionFlowApi = new action_flow_api_1.ActionFlowApi(context);
32
+ }
30
33
  exportActionFlows(packageId, metadataFilePath) {
31
34
  return __awaiter(this, void 0, void 0, function* () {
32
- const exportedActionFlowsData = yield action_flow_api_1.actionFlowApi.exportRawAssets(packageId);
35
+ const exportedActionFlowsData = yield this.actionFlowApi.exportRawAssets(packageId);
33
36
  const tmpZip = new AdmZip(exportedActionFlowsData);
34
37
  const zip = new AdmZip();
35
38
  tmpZip.getEntries().forEach(entry => {
@@ -45,7 +48,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
45
48
  }
46
49
  analyzeActionFlows(packageId, outputToJsonFile) {
47
50
  return __awaiter(this, void 0, void 0, function* () {
48
- const actionFlowsMetadata = yield action_flow_api_1.actionFlowApi.analyzeAssets(packageId);
51
+ const actionFlowsMetadata = yield this.actionFlowApi.analyzeAssets(packageId);
49
52
  const actionFlowsMetadataString = JSON.stringify(actionFlowsMetadata, null, 4);
50
53
  if (outputToJsonFile) {
51
54
  const metadataFileName = "action-flows_metadata_" + (0, uuid_1.v4)() + ".json";
@@ -60,7 +63,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
60
63
  importActionFlows(packageId, filePath, dryRun, outputToJsonFile) {
61
64
  return __awaiter(this, void 0, void 0, function* () {
62
65
  const actionFlowsZip = this.createBodyForImport(filePath);
63
- const eventLog = yield action_flow_api_1.actionFlowApi.importAssets(packageId, actionFlowsZip, dryRun);
66
+ const eventLog = yield this.actionFlowApi.importAssets(packageId, actionFlowsZip, dryRun);
64
67
  const eventLogString = JSON.stringify(eventLog, null, 4);
65
68
  if (outputToJsonFile) {
66
69
  const eventLogFileName = "action-flows_import_event_log_" + (0, uuid_1.v4)() + ".json";
@@ -84,7 +87,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
84
87
  zip.addFile(ActionFlowService.METADATA_FILE_NAME, Buffer.from(metadata));
85
88
  }
86
89
  }
90
+ exports.ActionFlowService = ActionFlowService;
87
91
  ActionFlowService.METADATA_FILE_NAME = "metadata.json";
88
- exports.actionFlowService = new ActionFlowService();
89
- exports.metadataFileName = ActionFlowService.METADATA_FILE_NAME;
90
92
  });
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Commands related to the Action Flows area.
3
+ */
4
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
+ return new (P || (P = Promise))(function (resolve, reject) {
7
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11
+ });
12
+ };
13
+ (function (factory) {
14
+ if (typeof module === "object" && typeof module.exports === "object") {
15
+ var v = factory(require, exports);
16
+ if (v !== undefined) module.exports = v;
17
+ }
18
+ else if (typeof define === "function" && define.amd) {
19
+ define(["require", "exports", "../../core/command/module-handler", "./action-flow/action-flow-command.service", "./skill/skill-command.service"], factory);
20
+ }
21
+ })(function (require, exports) {
22
+ "use strict";
23
+ const module_handler_1 = require("../../core/command/module-handler");
24
+ const action_flow_command_service_1 = require("./action-flow/action-flow-command.service");
25
+ const skill_command_service_1 = require("./skill/skill-command.service");
26
+ class Module extends module_handler_1.IModule {
27
+ register(context, configurator) {
28
+ const analyzeCommand = configurator.command("analyze");
29
+ analyzeCommand.command("action-flows")
30
+ .description("Analyze Action Flows dependencies for a certain package")
31
+ .requiredOption("--packageId <packageId>", "ID of the package from which you want to export Action Flows")
32
+ .option("-o, --outputToJsonFile", "Output the analyze result in a JSON file")
33
+ .action(this.analyzeActionFlows);
34
+ const exportCommand = configurator.command("export");
35
+ exportCommand.command("action-flows")
36
+ .description("Command to export all Action Flows in a package with their objects and dependencies")
37
+ .requiredOption("--packageId <packageId>", "ID of the package from which you want to export Action Flows")
38
+ .option("-f, --file <file>", "Action flows metadata file (relative path)")
39
+ .action(this.exportActionFlows);
40
+ const importCommand = configurator.command("import");
41
+ importCommand.command("action-flows")
42
+ .description("Command to import all Action Flows in a package with their objects and dependencies")
43
+ .requiredOption("--packageId <packageId>", "ID of the package to which you want to export Action Flows")
44
+ .requiredOption("-f, --file <file>", "Exported Action Flows file (relative path)")
45
+ .requiredOption("-d, --dryRun <dryRun>", "Execute the import on dry run mode")
46
+ .option("-o, --outputToJsonFile", "Output the import result in a JSON file")
47
+ .action(this.importActionFlows);
48
+ const pullCommand = configurator.command("pull");
49
+ pullCommand.command("skill")
50
+ .description("Command to pull a skill")
51
+ .requiredOption("--projectId <projectId>", "Id of the project you want to pull")
52
+ .requiredOption("--skillId <skillId>", "Id of the skill you want to pull")
53
+ .action(this.pullSkill);
54
+ const pushCommand = configurator.command("push");
55
+ pushCommand.command("skill")
56
+ .description("Command to push a skill to a project")
57
+ .requiredOption("--projectId <projectId>", "Id of the project you want to push")
58
+ .requiredOption("-f, --file <file>", "The file you want to push")
59
+ .action(this.pushSkill);
60
+ }
61
+ analyzeActionFlows(context, command, options) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ yield new action_flow_command_service_1.ActionFlowCommandService(context).analyzeActionFlows(options.packageId, options.outputToJsonFile);
64
+ });
65
+ }
66
+ exportActionFlows(context, command, options) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ yield new action_flow_command_service_1.ActionFlowCommandService(context).exportActionFlows(options.packageId, options.file);
69
+ });
70
+ }
71
+ importActionFlows(context, command, options) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ yield new action_flow_command_service_1.ActionFlowCommandService(context).importActionFlows(options.packageId, options.file, options.dryRun, options.outputToJsonFile);
74
+ });
75
+ }
76
+ pullSkill(context, command, options) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ yield new skill_command_service_1.SkillCommandService(context).pullSkill(options.profile, options.projectId, options.skillId);
79
+ });
80
+ }
81
+ pushSkill(context, command, options) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ yield new skill_command_service_1.SkillCommandService(context).pushSkill(options.profile, options.projectId, options.file);
84
+ });
85
+ }
86
+ }
87
+ return Module;
88
+ });
@@ -13,29 +13,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  if (v !== undefined) module.exports = v;
14
14
  }
15
15
  else if (typeof define === "function" && define.amd) {
16
- define(["require", "exports", "../services/content.service", "../content/factory/skill-manager.factory"], factory);
16
+ define(["require", "exports", "./skill.manager-factory"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.SkillCommand = void 0;
22
- const content_service_1 = require("../services/content.service");
23
- const skill_manager_factory_1 = require("../content/factory/skill-manager.factory");
24
- class SkillCommand {
25
- constructor() {
26
- this.contentService = new content_service_1.ContentService();
27
- this.skillManagerFactory = new skill_manager_factory_1.SkillManagerFactory();
21
+ exports.SkillCommandService = void 0;
22
+ const skill_manager_factory_1 = require("./skill.manager-factory");
23
+ class SkillCommandService {
24
+ constructor(context) {
25
+ this.skillManagerFactory = new skill_manager_factory_1.SkillManagerFactory(context);
28
26
  }
29
27
  pullSkill(profile, projectId, skillId) {
30
28
  return __awaiter(this, void 0, void 0, function* () {
31
- yield this.contentService.pull(profile, this.skillManagerFactory.createManager(projectId, skillId, null));
29
+ yield this.skillManagerFactory.createManager(projectId, skillId, null).pull();
32
30
  });
33
31
  }
34
32
  pushSkill(profile, projectId, filename) {
35
33
  return __awaiter(this, void 0, void 0, function* () {
36
- yield this.contentService.push(profile, this.skillManagerFactory.createManager(projectId, null, filename));
34
+ yield this.skillManagerFactory.createManager(projectId, null, filename).push();
37
35
  });
38
36
  }
39
37
  }
40
- exports.SkillCommand = SkillCommand;
38
+ exports.SkillCommandService = SkillCommandService;
41
39
  });
@@ -4,7 +4,7 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "fs", "path", "../../util/logger", "../manager/skill.manager"], factory);
7
+ define(["require", "exports", "fs", "path", "../../../core/utils/logger", "./skill.manager"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
@@ -12,11 +12,14 @@
12
12
  exports.SkillManagerFactory = void 0;
13
13
  const fs = require("fs");
14
14
  const path = require("path");
15
- const logger_1 = require("../../util/logger");
16
- const skill_manager_1 = require("../manager/skill.manager");
15
+ const logger_1 = require("../../../core/utils/logger");
16
+ const skill_manager_1 = require("./skill.manager");
17
17
  class SkillManagerFactory {
18
+ constructor(context) {
19
+ this.context = context;
20
+ }
18
21
  createManager(projectId, skillId, filename) {
19
- const skillManager = new skill_manager_1.SkillManager();
22
+ const skillManager = new skill_manager_1.SkillManager(this.context);
20
23
  skillManager.skillId = skillId;
21
24
  skillManager.projectId = projectId;
22
25
  if (filename !== null) {
@@ -4,15 +4,18 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./base.manager", "form-data"], factory);
7
+ define(["require", "exports", "form-data", "../../../core/http/http-shared/base.manager"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SkillManager = void 0;
13
- const base_manager_1 = require("./base.manager");
14
13
  const FormData = require("form-data");
14
+ const base_manager_1 = require("../../../core/http/http-shared/base.manager");
15
15
  class SkillManager extends base_manager_1.BaseManager {
16
+ constructor(context) {
17
+ super(context);
18
+ }
16
19
  get content() {
17
20
  return this._content;
18
21
  }
@@ -33,8 +36,8 @@
33
36
  }
34
37
  getConfig() {
35
38
  return {
36
- pushUrl: this.profile.team.replace(/\/?$/, `${SkillManager.BASE_URL}/${this.projectId}/skills/import-file`),
37
- pullUrl: this.profile.team.replace(/\/?$/, `${SkillManager.BASE_URL}/${this.projectId}/skills/${this.skillId}/export`),
39
+ pushUrl: `${SkillManager.BASE_URL}/${this.projectId}/skills/import-file`,
40
+ pullUrl: `${SkillManager.BASE_URL}/${this.projectId}/skills/${this.skillId}/export`,
38
41
  exportFileName: "skill_" + this.skillId + ".json",
39
42
  onPushSuccessMessage: (skill) => {
40
43
  return "Skill was pushed successfully. New ID: " + skill.id;
@@ -0,0 +1,39 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ (function (factory) {
11
+ if (typeof module === "object" && typeof module.exports === "object") {
12
+ var v = factory(require, exports);
13
+ if (v !== undefined) module.exports = v;
14
+ }
15
+ else if (typeof define === "function" && define.amd) {
16
+ define(["require", "exports", "./analysis-bookmarks.manager-factory"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.AnalysisBookmarksCommandService = void 0;
22
+ const analysis_bookmarks_manager_factory_1 = require("./analysis-bookmarks.manager-factory");
23
+ class AnalysisBookmarksCommandService {
24
+ constructor(context) {
25
+ this.analysisBookmarksManagerFactory = new analysis_bookmarks_manager_factory_1.AnalysisBookmarksManagerFactory(context);
26
+ }
27
+ pullAnalysisBookmarks(analysisId, type) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ yield this.analysisBookmarksManagerFactory.createAnalysisBookmarksManager(null, analysisId, type).pull();
30
+ });
31
+ }
32
+ pushAnalysisBookmarks(analysisId, filename) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ yield this.analysisBookmarksManagerFactory.createAnalysisBookmarksManager(filename, analysisId).push();
35
+ });
36
+ }
37
+ }
38
+ exports.AnalysisBookmarksCommandService = AnalysisBookmarksCommandService;
39
+ });
@@ -4,7 +4,7 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "fs", "path", "../../util/logger", "../manager/analysis-bookmarks.manager"], factory);
7
+ define(["require", "exports", "fs", "path", "./analysis-bookmarks.manager", "../../core/utils/logger"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
@@ -12,11 +12,14 @@
12
12
  exports.AnalysisBookmarksManagerFactory = void 0;
13
13
  const fs = require("fs");
14
14
  const path = require("path");
15
- const logger_1 = require("../../util/logger");
16
- const analysis_bookmarks_manager_1 = require("../manager/analysis-bookmarks.manager");
15
+ const analysis_bookmarks_manager_1 = require("./analysis-bookmarks.manager");
16
+ const logger_1 = require("../../core/utils/logger");
17
17
  class AnalysisBookmarksManagerFactory {
18
+ constructor(context) {
19
+ this.context = context;
20
+ }
18
21
  createAnalysisBookmarksManager(filename, analysisId, type) {
19
- const analysisBookmarksManager = new analysis_bookmarks_manager_1.AnalysisBookmarksManager();
22
+ const analysisBookmarksManager = new analysis_bookmarks_manager_1.AnalysisBookmarksManager(this.context);
20
23
  analysisBookmarksManager.analysisId = analysisId;
21
24
  if (type === undefined || type === null) {
22
25
  type = "user";
@@ -4,16 +4,19 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./base.manager", "fs", "form-data"], factory);
7
+ define(["require", "exports", "fs", "form-data", "../../core/http/http-shared/base.manager"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.AnalysisBookmarksManager = void 0;
13
- const base_manager_1 = require("./base.manager");
14
13
  const fs = require("fs");
15
14
  const FormData = require("form-data");
15
+ const base_manager_1 = require("../../core/http/http-shared/base.manager");
16
16
  class AnalysisBookmarksManager extends base_manager_1.BaseManager {
17
+ constructor(context) {
18
+ super(context);
19
+ }
17
20
  get fileName() {
18
21
  return this._fileName;
19
22
  }
@@ -35,9 +38,9 @@
35
38
  getConfig() {
36
39
  const pullUrl = `${AnalysisBookmarksManager.BASE_URL}/export?analysisId=${this.analysisId}&type=${this.type}`;
37
40
  return {
38
- pushUrl: this.profile.team.replace(/\/?$/, `${AnalysisBookmarksManager.BASE_URL}/import?analysisId=${this.analysisId}`),
39
- pullUrl: this.profile.team.replace(/\/?$/, pullUrl),
40
- exportFileName: `${AnalysisBookmarksManager.ANALYSIS_BOOKMARKS_FILE_PREFIX}${this.analysisId}${".json"}`,
41
+ pushUrl: `${AnalysisBookmarksManager.BASE_URL}/import?analysisId=${this.analysisId}`,
42
+ pullUrl: pullUrl,
43
+ exportFileName: `${AnalysisBookmarksManager.ANALYSIS_BOOKMARKS_FILE_PREFIX}${this.analysisId}.json`,
41
44
  onPushSuccessMessage: () => {
42
45
  return "Analysis Bookmarks was pushed successfully.";
43
46
  },
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Commands related to the Analysis feature.
3
+ */
4
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
+ return new (P || (P = Promise))(function (resolve, reject) {
7
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11
+ });
12
+ };
13
+ (function (factory) {
14
+ if (typeof module === "object" && typeof module.exports === "object") {
15
+ var v = factory(require, exports);
16
+ if (v !== undefined) module.exports = v;
17
+ }
18
+ else if (typeof define === "function" && define.amd) {
19
+ define(["require", "exports", "../../core/command/module-handler", "./analysis-bookmarks-command.service"], factory);
20
+ }
21
+ })(function (require, exports) {
22
+ "use strict";
23
+ const module_handler_1 = require("../../core/command/module-handler");
24
+ const analysis_bookmarks_command_service_1 = require("./analysis-bookmarks-command.service");
25
+ class Module extends module_handler_1.IModule {
26
+ register(context, configurator) {
27
+ const pullCommand = configurator.command("pull");
28
+ pullCommand.command("bookmarks")
29
+ .description("Command to pull an analysis bookmarks")
30
+ .option("--type <type>", "Pull shared/all Analysis Bookmarks, else by default get user bookmarks")
31
+ .requiredOption("--id <id>", "Id of the analysis you want to pull")
32
+ .action(this.pullAnalysisBookmarks);
33
+ const pushCommand = configurator.command("push");
34
+ pushCommand.command("bookmarks")
35
+ .description("Command to push an analysis to a workspace")
36
+ .requiredOption("--id <id>", "Id of the Analysis to which you want to push the analysis bookmarks")
37
+ .requiredOption("-f, --file <file>", "The file you want to push")
38
+ .action(this.pushAnalysisBookmarks);
39
+ }
40
+ pullAnalysisBookmarks(context, command, options) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ yield new analysis_bookmarks_command_service_1.AnalysisBookmarksCommandService(context).pullAnalysisBookmarks(options.id, options.type);
43
+ });
44
+ }
45
+ pushAnalysisBookmarks(context, command, options) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ yield new analysis_bookmarks_command_service_1.AnalysisBookmarksCommandService(context).pushAnalysisBookmarks(options.id, options.file);
48
+ });
49
+ }
50
+ }
51
+ return Module;
52
+ });
@@ -0,0 +1,84 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ (function (factory) {
11
+ if (typeof module === "object" && typeof module.exports === "object") {
12
+ var v = factory(require, exports);
13
+ if (v !== undefined) module.exports = v;
14
+ }
15
+ else if (typeof define === "function" && define.amd) {
16
+ define(["require", "exports", "../../../core/utils/logger"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.BatchImportExportApi = void 0;
22
+ const logger_1 = require("../../../core/utils/logger");
23
+ class BatchImportExportApi {
24
+ constructor(context) {
25
+ this.httpClient = context.httpClient;
26
+ }
27
+ findAllActivePackages(flavors, withDependencies = false) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ const queryParams = new URLSearchParams();
30
+ queryParams.set("withDependencies", withDependencies.toString());
31
+ flavors.forEach(flavor => queryParams.append("flavors", flavor));
32
+ return this.httpClient.get(`/package-manager/api/core/packages/export/list?${queryParams.toString()}`).catch(e => {
33
+ throw new logger_1.FatalError(`Problem getting active packages: ${e}`);
34
+ });
35
+ });
36
+ }
37
+ findActivePackagesByVariableValue(flavors, variableValue, variableType) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const queryParams = new URLSearchParams();
40
+ queryParams.set("variableValue", variableValue);
41
+ if (variableType) {
42
+ queryParams.set("variableType", variableType);
43
+ }
44
+ flavors.forEach(flavor => queryParams.append("flavors", flavor));
45
+ return this.httpClient.get(`/package-manager/api/core/packages/export/list-by-variable-value?${queryParams.toString()}`).catch(e => {
46
+ throw new logger_1.FatalError(`Problem getting active packages by variable value: ${e}`);
47
+ });
48
+ });
49
+ }
50
+ findActivePackagesByKeys(packageKeys, withDependencies = false) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const queryParams = new URLSearchParams();
53
+ packageKeys.forEach(key => queryParams.append("packageKeys", key));
54
+ queryParams.set("withDependencies", withDependencies.toString());
55
+ return this.httpClient.get(`/package-manager/api/core/packages/export/list-by-keys?${queryParams.toString()}`).catch(e => {
56
+ throw new logger_1.FatalError(`Problem getting active packages by keys: ${e}`);
57
+ });
58
+ });
59
+ }
60
+ exportPackages(packageKeys, withDependencies = false) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ const queryParams = new URLSearchParams();
63
+ packageKeys.forEach(packageKey => queryParams.append("packageKeys", packageKey));
64
+ queryParams.set("withDependencies", withDependencies.toString());
65
+ return this.httpClient.getFile(`/package-manager/api/core/packages/export/batch?${queryParams.toString()}`).catch(e => {
66
+ throw new logger_1.FatalError(`Problem exporting packages: ${e}`);
67
+ });
68
+ });
69
+ }
70
+ importPackages(data, overwrite) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ return this.httpClient.postFile("/package-manager/api/core/packages/import/batch", data, { overwrite });
73
+ });
74
+ }
75
+ findVariablesWithValuesByPackageKeysAndVersion(packagesByKeyAndVersion) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ return this.httpClient.post("/package-manager/api/core/packages/export/batch/variables-with-assignments", packagesByKeyAndVersion).catch(e => {
78
+ throw new logger_1.FatalError(`Problem exporting package variables: ${e}`);
79
+ });
80
+ });
81
+ }
82
+ }
83
+ exports.BatchImportExportApi = BatchImportExportApi;
84
+ });