@celonis/content-cli 0.13.6 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/README.md +21 -13
  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 +75 -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/core/utils/version.js +37 -0
  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/lib/core/utils/version.d.ts +3 -0
  157. package/package.json +4 -3
  158. package/api/batch-import-export-api.js +0 -62
  159. package/api/variables-api.js +0 -56
  160. package/commands/profile.command.js +0 -88
  161. package/commands/widget.command.js +0 -36
  162. package/content-cli-analyze.js +0 -56
  163. package/content-cli-config.js +0 -119
  164. package/content-cli-export.js +0 -90
  165. package/content-cli-get.js +0 -52
  166. package/content-cli-import.js +0 -93
  167. package/content-cli-list.js +0 -129
  168. package/content-cli-profile.js +0 -64
  169. package/content-cli-pull.js +0 -104
  170. package/content-cli-push.js +0 -196
  171. package/content-cli-set.js +0 -55
  172. package/content-cli-update.js +0 -44
  173. package/interfaces/variable-assignment-api.interface.js +0 -12
  174. package/lib/api/space-api.d.ts +0 -9
  175. package/lib/api/variables-api.d.ts +0 -14
  176. package/lib/commands/analysis-bookmarks.command.d.ts +0 -6
  177. package/lib/commands/asset.command.d.ts +0 -8
  178. package/lib/commands/connection.command.d.ts +0 -5
  179. package/lib/commands/ctp.command.d.ts +0 -6
  180. package/lib/commands/data-pool.command.d.ts +0 -11
  181. package/lib/commands/space.command.d.ts +0 -5
  182. package/lib/commands/variable.command.d.ts +0 -3
  183. package/lib/commands/widget.command.d.ts +0 -5
  184. package/lib/content/factory/analysis-bookmarks-manager.factory.d.ts +0 -5
  185. package/lib/content/factory/data-pool-manager.factory.d.ts +0 -6
  186. package/lib/content/factory/skill-manager.factory.d.ts +0 -5
  187. package/lib/content/factory/space-manager.factory.d.ts +0 -5
  188. package/lib/content-cli-analyze.d.ts +0 -1
  189. package/lib/content-cli-config.d.ts +0 -8
  190. package/lib/content-cli-export.d.ts +0 -6
  191. package/lib/content-cli-get.d.ts +0 -1
  192. package/lib/content-cli-import.d.ts +0 -6
  193. package/lib/content-cli-list.d.ts +0 -9
  194. package/lib/content-cli-profile.d.ts +0 -1
  195. package/lib/content-cli-pull.d.ts +0 -1
  196. package/lib/content-cli-push.d.ts +0 -1
  197. package/lib/content-cli-set.d.ts +0 -1
  198. package/lib/content-cli-update.d.ts +0 -1
  199. package/lib/interfaces/variable-assignment-api.interface.d.ts +0 -3
  200. package/lib/services/command.service.d.ts +0 -6
  201. package/lib/services/content.service.d.ts +0 -11
  202. package/lib/services/context.service.d.ts +0 -13
  203. package/lib/services/http-client.service.d.ts +0 -15
  204. package/lib/services/package-manager/space-service.d.ts +0 -11
  205. package/lib/services/question.service.d.ts +0 -4
  206. package/lib/util/context-initializer.d.ts +0 -3
  207. package/lib/util/program.d.ts +0 -2
  208. package/lib/util/version.d.ts +0 -3
  209. package/services/command.service.js +0 -24
  210. package/services/content.service.js +0 -130
  211. package/services/http-client.service.js +0 -157
  212. package/util/context-initializer.js +0 -39
  213. package/util/logger.js +0 -49
  214. package/util/program.js +0 -16
  215. package/util/version.js +0 -21
  216. /package/{interfaces/batch-export-import-constants.js → commands/configuration-management/interfaces/batch-export-import.constants.js} +0 -0
  217. /package/{interfaces/diff-package.transport.js → commands/configuration-management/interfaces/diff-package.interfaces.js} +0 -0
  218. /package/{interfaces/batch-export-node-transport.js → commands/configuration-management/interfaces/package-export.interfaces.js} +0 -0
  219. /package/{api/variable-assignment-apis.js → commands/configuration-management/interfaces/variable-assignment-apis.constants.js} +0 -0
  220. /package/{interfaces → commands/data-pipeline/data-pool}/data-pool-manager.interfaces.js +0 -0
  221. /package/{interfaces/manager-config.interface.js → commands/studio/interfaces/batch-export-node.interfaces.js} +0 -0
  222. /package/{interfaces/manifest-transport.js → commands/studio/interfaces/manifest.interface.js} +0 -0
  223. /package/{interfaces → commands/studio/interfaces}/package-manager.interfaces.js +0 -0
  224. /package/{interfaces → commands/studio/interfaces}/save-content-node.interface.js +0 -0
  225. /package/{interfaces/package-export-transport.js → commands/studio/interfaces/space.interface.js} +0 -0
  226. /package/{util → commands/studio/utils}/semantic-versioning.js +0 -0
  227. /package/{util → core/http}/axios-initializer.js +0 -0
  228. /package/{interfaces/save-space.interface.js → core/http/http-shared/manager-config.interface.js} +0 -0
  229. /package/{util → core/http}/tracing.js +0 -0
  230. /package/{interfaces → core/profile}/profile.interface.js +0 -0
  231. /package/{util → core/utils}/json.js +0 -0
  232. /package/{util → core/utils}/yaml.js +0 -0
  233. /package/lib/{interfaces/batch-export-import-constants.d.ts → commands/configuration-management/interfaces/batch-export-import.constants.d.ts} +0 -0
  234. /package/lib/{interfaces/diff-package.transport.d.ts → commands/configuration-management/interfaces/diff-package.interfaces.d.ts} +0 -0
  235. /package/lib/{interfaces → commands/data-pipeline/data-pool}/data-pool-manager.interfaces.d.ts +0 -0
  236. /package/lib/{interfaces/manifest-transport.d.ts → commands/studio/interfaces/manifest.interface.d.ts} +0 -0
  237. /package/lib/{interfaces → commands/studio/interfaces}/package-manager.interfaces.d.ts +0 -0
  238. /package/lib/{interfaces → commands/studio/interfaces}/save-content-node.interface.d.ts +0 -0
  239. /package/lib/{interfaces/save-space.interface.d.ts → commands/studio/interfaces/space.interface.d.ts} +0 -0
  240. /package/lib/{util → commands/studio/utils}/semantic-versioning.d.ts +0 -0
  241. /package/lib/{util → core/http}/axios-initializer.d.ts +0 -0
  242. /package/lib/{interfaces → core/http/http-shared}/manager-config.interface.d.ts +0 -0
  243. /package/lib/{util → core/http}/tracing.d.ts +0 -0
  244. /package/lib/{interfaces → core/profile}/profile.interface.d.ts +0 -0
  245. /package/lib/{util → core/utils}/json.d.ts +0 -0
  246. /package/lib/{util → core/utils}/logger.d.ts +0 -0
  247. /package/lib/{util → core/utils}/yaml.d.ts +0 -0
@@ -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
+ });
@@ -13,25 +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", "../services/http-client-service.v2"], factory);
16
+ define(["require", "exports"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.diffApi = void 0;
22
- const http_client_service_v2_1 = require("../services/http-client-service.v2");
21
+ exports.DiffApi = void 0;
23
22
  class DiffApi {
23
+ constructor(context) {
24
+ this.httpClient = context.httpClient;
25
+ }
24
26
  diffPackages(data) {
25
27
  return __awaiter(this, void 0, void 0, function* () {
26
- return http_client_service_v2_1.httpClientV2.postFile("/package-manager/api/core/packages/diff/configuration", data);
28
+ return this.httpClient.postFile("/package-manager/api/core/packages/diff/configuration", data);
27
29
  });
28
30
  }
29
31
  hasChanges(data) {
30
32
  return __awaiter(this, void 0, void 0, function* () {
31
- return http_client_service_v2_1.httpClientV2.postFile("/package-manager/api/core/packages/diff/configuration/has-changes", data);
33
+ return this.httpClient.postFile("/package-manager/api/core/packages/diff/configuration/has-changes", data);
32
34
  });
33
35
  }
34
36
  }
35
- DiffApi.INSTANCE = new DiffApi();
36
- exports.diffApi = DiffApi.INSTANCE;
37
+ exports.DiffApi = DiffApi;
37
38
  });
@@ -0,0 +1,41 @@
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", "../interfaces/variable-assignment-apis.constants", "../../../core/utils/logger"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.VariableAssignmentCandidatesApi = void 0;
22
+ const variable_assignment_apis_constants_1 = require("../interfaces/variable-assignment-apis.constants");
23
+ const logger_1 = require("../../../core/utils/logger");
24
+ class VariableAssignmentCandidatesApi {
25
+ constructor(context) {
26
+ this.httpClient = context.httpClient;
27
+ }
28
+ getCandidateAssignments(type, params) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ if (!variable_assignment_apis_constants_1.variableAssignmentApis[type]) {
31
+ throw new logger_1.FatalError(`Variable type ${type} not supported.`);
32
+ }
33
+ const apiUrl = variable_assignment_apis_constants_1.variableAssignmentApis[type].url + (params.toString().length ? `?${params.toString()}` : "");
34
+ return this.httpClient.get(apiUrl).catch(e => {
35
+ throw new logger_1.FatalError(`Problem getting variables assignment values for type ${type}: ${e}`);
36
+ });
37
+ });
38
+ }
39
+ }
40
+ exports.VariableAssignmentCandidatesApi = VariableAssignmentCandidatesApi;
41
+ });
@@ -13,27 +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", "../../api/batch-import-export-api", "../../util/logger", "uuid", "../file-service", "../studio/studio.service", "../../util/json", "form-data", "../../interfaces/batch-export-import-constants", "../../api/package-api", "stream", "adm-zip"], factory);
16
+ define(["require", "exports", "uuid", "form-data", "stream", "adm-zip", "./interfaces/batch-export-import.constants", "../../core/utils/file-service", "../../core/utils/logger", "../../core/utils/json", "../studio/api/package-api", "./api/batch-import-export-api", "./studio.service"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.batchImportExportService = void 0;
22
- const batch_import_export_api_1 = require("../../api/batch-import-export-api");
23
- const logger_1 = require("../../util/logger");
21
+ exports.BatchImportExportService = void 0;
24
22
  const uuid_1 = require("uuid");
25
- const file_service_1 = require("../file-service");
26
- const studio_service_1 = require("../studio/studio.service");
27
- const json_1 = require("../../util/json");
28
23
  const FormData = require("form-data");
29
- const batch_export_import_constants_1 = require("../../interfaces/batch-export-import-constants");
30
- const package_api_1 = require("../../api/package-api");
31
24
  const stream_1 = require("stream");
32
25
  const AdmZip = require("adm-zip");
26
+ const batch_export_import_constants_1 = require("./interfaces/batch-export-import.constants");
27
+ const file_service_1 = require("../../core/utils/file-service");
28
+ const logger_1 = require("../../core/utils/logger");
29
+ const json_1 = require("../../core/utils/json");
30
+ const package_api_1 = require("../studio/api/package-api");
31
+ const batch_import_export_api_1 = require("./api/batch-import-export-api");
32
+ const studio_service_1 = require("./studio.service");
33
33
  class BatchImportExportService {
34
+ constructor(context) {
35
+ this.batchImportExportApi = new batch_import_export_api_1.BatchImportExportApi(context);
36
+ this.studioPackageApi = new package_api_1.PackageApi(context);
37
+ this.studioService = new studio_service_1.StudioService(context);
38
+ }
34
39
  listActivePackages(flavors) {
35
40
  return __awaiter(this, void 0, void 0, function* () {
36
- const activePackages = yield batch_import_export_api_1.batchImportExportApi.findAllActivePackages(flavors);
41
+ const activePackages = yield this.batchImportExportApi.findAllActivePackages(flavors);
37
42
  activePackages.forEach(pkg => {
38
43
  logger_1.logger.info(`${pkg.name} - Key: "${pkg.key}"`);
39
44
  });
@@ -43,34 +48,34 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
48
  return __awaiter(this, void 0, void 0, function* () {
44
49
  let packagesToExport;
45
50
  if (packageKeys.length) {
46
- packagesToExport = yield batch_import_export_api_1.batchImportExportApi.findActivePackagesByKeys(packageKeys, withDependencies);
51
+ packagesToExport = yield this.batchImportExportApi.findActivePackagesByKeys(packageKeys, withDependencies);
47
52
  }
48
53
  else {
49
- packagesToExport = yield batch_import_export_api_1.batchImportExportApi.findAllActivePackages(flavors, withDependencies);
54
+ packagesToExport = yield this.batchImportExportApi.findAllActivePackages(flavors, withDependencies);
50
55
  }
51
- packagesToExport = yield studio_service_1.studioService.getExportPackagesWithStudioData(packagesToExport, withDependencies);
56
+ packagesToExport = yield this.studioService.getExportPackagesWithStudioData(packagesToExport, withDependencies);
52
57
  this.exportListOfPackages(packagesToExport);
53
58
  });
54
59
  }
55
60
  batchExportPackages(packageKeys, withDependencies = false) {
56
61
  return __awaiter(this, void 0, void 0, function* () {
57
- const exportedPackagesData = yield batch_import_export_api_1.batchImportExportApi.exportPackages(packageKeys, withDependencies);
62
+ const exportedPackagesData = yield this.batchImportExportApi.exportPackages(packageKeys, withDependencies);
58
63
  const exportedPackagesZip = new AdmZip(exportedPackagesData);
59
64
  const manifest = (0, json_1.parse)(exportedPackagesZip.getEntry(batch_export_import_constants_1.BatchExportImportConstants.MANIFEST_FILE_NAME).getData().toString());
60
65
  const versionsByPackageKey = this.getVersionsByPackageKey(manifest);
61
66
  let exportedVariables = yield this.getVersionedVariablesForPackagesWithKeys(versionsByPackageKey);
62
- exportedVariables = studio_service_1.studioService.fixConnectionVariables(exportedVariables);
67
+ exportedVariables = this.studioService.fixConnectionVariables(exportedVariables);
63
68
  exportedPackagesZip.addFile(batch_export_import_constants_1.BatchExportImportConstants.VARIABLES_FILE_NAME, Buffer.from((0, json_1.stringify)(exportedVariables), "utf8"));
64
69
  const studioPackageKeys = manifest.filter(packageManifest => packageManifest.flavor === batch_export_import_constants_1.BatchExportImportConstants.STUDIO)
65
70
  .map(packageManifest => packageManifest.packageKey);
66
- const studioData = yield studio_service_1.studioService.getStudioPackageManifests(studioPackageKeys);
71
+ const studioData = yield this.studioService.getStudioPackageManifests(studioPackageKeys);
67
72
  exportedPackagesZip.addFile(batch_export_import_constants_1.BatchExportImportConstants.STUDIO_FILE_NAME, Buffer.from((0, json_1.stringify)(studioData), "utf8"));
68
73
  exportedPackagesZip.getEntries().forEach(entry => {
69
74
  if (entry.name.endsWith(batch_export_import_constants_1.BatchExportImportConstants.ZIP_EXTENSION)) {
70
75
  const lastUnderscoreIndex = entry.name.lastIndexOf("_");
71
76
  const packageKey = entry.name.substring(0, lastUnderscoreIndex);
72
77
  if (studioPackageKeys.includes(packageKey)) {
73
- const updatedPackage = studio_service_1.studioService.processPackageForExport(entry, exportedVariables);
78
+ const updatedPackage = this.studioService.processPackageForExport(entry, exportedVariables);
74
79
  exportedPackagesZip.updateFile(entry, updatedPackage.toBuffer());
75
80
  }
76
81
  }
@@ -86,11 +91,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
86
91
  let configs = new AdmZip(file);
87
92
  const studioManifests = this.parseEntryData(configs, batch_export_import_constants_1.BatchExportImportConstants.STUDIO_FILE_NAME);
88
93
  const variablesManifests = this.parseEntryData(configs, batch_export_import_constants_1.BatchExportImportConstants.VARIABLES_FILE_NAME);
89
- configs = yield studio_service_1.studioService.mapSpaces(configs, studioManifests);
90
- const existingStudioPackages = yield package_api_1.packageApi.findAllPackages();
94
+ configs = yield this.studioService.mapSpaces(configs, studioManifests);
95
+ const existingStudioPackages = yield this.studioPackageApi.findAllPackages();
91
96
  const formData = this.buildBodyForImport(configs, variablesManifests);
92
- const postPackageImportData = yield batch_import_export_api_1.batchImportExportApi.importPackages(formData, overwrite);
93
- yield studio_service_1.studioService.processImportedPackages(configs, existingStudioPackages, studioManifests);
97
+ const postPackageImportData = yield this.batchImportExportApi.importPackages(formData, overwrite);
98
+ yield this.studioService.processImportedPackages(configs, existingStudioPackages, studioManifests);
94
99
  const reportFileName = "config_import_report_" + (0, uuid_1.v4)() + ".json";
95
100
  file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(postPackageImportData), reportFileName);
96
101
  logger_1.logger.info("Config import report file: " + reportFileName);
@@ -98,14 +103,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
98
103
  }
99
104
  findAndExportListOfActivePackagesByVariableValue(flavors, variableValue, variableType) {
100
105
  return __awaiter(this, void 0, void 0, function* () {
101
- let packagesToExport = yield batch_import_export_api_1.batchImportExportApi.findActivePackagesByVariableValue(flavors, variableValue, variableType);
102
- packagesToExport = yield studio_service_1.studioService.getExportPackagesWithStudioData(packagesToExport, false);
106
+ let packagesToExport = yield this.batchImportExportApi.findActivePackagesByVariableValue(flavors, variableValue, variableType);
107
+ packagesToExport = yield this.studioService.getExportPackagesWithStudioData(packagesToExport, false);
103
108
  this.exportListOfPackages(packagesToExport);
104
109
  });
105
110
  }
106
111
  listActivePackagesByVariableValue(flavors, variableValue, variableType) {
107
112
  return __awaiter(this, void 0, void 0, function* () {
108
- const packagesByVariableValue = yield batch_import_export_api_1.batchImportExportApi.findActivePackagesByVariableValue(flavors, variableValue, variableType);
113
+ const packagesByVariableValue = yield this.batchImportExportApi.findActivePackagesByVariableValue(flavors, variableValue, variableType);
109
114
  packagesByVariableValue.forEach(pkg => {
110
115
  logger_1.logger.info(`${pkg.name} - Key: "${pkg.key}"`);
111
116
  });
@@ -133,7 +138,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
133
138
  });
134
139
  });
135
140
  });
136
- return batch_import_export_api_1.batchImportExportApi.findVariablesWithValuesByPackageKeysAndVersion(variableExportRequest);
141
+ return this.batchImportExportApi.findVariablesWithValuesByPackageKeysAndVersion(variableExportRequest);
137
142
  }
138
143
  buildBodyForImport(configs, variablesManifests) {
139
144
  const formData = new FormData();
@@ -162,5 +167,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
162
167
  return null;
163
168
  }
164
169
  }
165
- exports.batchImportExportService = new BatchImportExportService();
170
+ exports.BatchImportExportService = BatchImportExportService;
166
171
  });
@@ -13,16 +13,21 @@ 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/package-manager/batch-import-export-service", "../services/package-manager/variable-service", "../services/package-manager/diff-service"], factory);
16
+ define(["require", "exports", "./batch-import-export.service", "./variable.service", "./diff.service"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.ConfigCommand = void 0;
22
- const batch_import_export_service_1 = require("../services/package-manager/batch-import-export-service");
23
- const variable_service_1 = require("../services/package-manager/variable-service");
24
- const diff_service_1 = require("../services/package-manager/diff-service");
25
- class ConfigCommand {
21
+ exports.ConfigCommandService = void 0;
22
+ const batch_import_export_service_1 = require("./batch-import-export.service");
23
+ const variable_service_1 = require("./variable.service");
24
+ const diff_service_1 = require("./diff.service");
25
+ class ConfigCommandService {
26
+ constructor(context) {
27
+ this.batchImportExportService = new batch_import_export_service_1.BatchImportExportService(context);
28
+ this.variableService = new variable_service_1.VariableService(context);
29
+ this.diffService = new diff_service_1.DiffService(context);
30
+ }
26
31
  listActivePackages(jsonResponse, flavors, withDependencies, packageKeys, variableValue, variableType) {
27
32
  return __awaiter(this, void 0, void 0, function* () {
28
33
  if (variableValue) {
@@ -30,42 +35,42 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
30
35
  return;
31
36
  }
32
37
  if (jsonResponse) {
33
- yield batch_import_export_service_1.batchImportExportService.findAndExportListOfActivePackages(flavors !== null && flavors !== void 0 ? flavors : [], packageKeys !== null && packageKeys !== void 0 ? packageKeys : [], withDependencies);
38
+ yield this.batchImportExportService.findAndExportListOfActivePackages(flavors !== null && flavors !== void 0 ? flavors : [], packageKeys !== null && packageKeys !== void 0 ? packageKeys : [], withDependencies);
34
39
  }
35
40
  else {
36
- yield batch_import_export_service_1.batchImportExportService.listActivePackages(flavors !== null && flavors !== void 0 ? flavors : []);
41
+ yield this.batchImportExportService.listActivePackages(flavors !== null && flavors !== void 0 ? flavors : []);
37
42
  }
38
43
  });
39
44
  }
40
45
  listVariables(jsonResponse, keysByVersion, keysByVersionFile) {
41
46
  return __awaiter(this, void 0, void 0, function* () {
42
47
  if (jsonResponse) {
43
- yield variable_service_1.variableService.exportVariables(keysByVersion, keysByVersionFile);
48
+ yield this.variableService.exportVariables(keysByVersion, keysByVersionFile);
44
49
  }
45
50
  else {
46
- yield variable_service_1.variableService.listVariables(keysByVersion, keysByVersionFile);
51
+ yield this.variableService.listVariables(keysByVersion, keysByVersionFile);
47
52
  }
48
53
  });
49
54
  }
50
55
  batchExportPackages(packageKeys, withDependencies = false) {
51
- return batch_import_export_service_1.batchImportExportService.batchExportPackages(packageKeys, withDependencies);
56
+ return this.batchImportExportService.batchExportPackages(packageKeys, withDependencies);
52
57
  }
53
58
  batchImportPackages(file, overwrite) {
54
- return batch_import_export_service_1.batchImportExportService.batchImportPackages(file, overwrite);
59
+ return this.batchImportExportService.batchImportPackages(file, overwrite);
55
60
  }
56
61
  diffPackages(file, hasChanges, jsonResponse) {
57
- return diff_service_1.diffService.diffPackages(file, hasChanges, jsonResponse);
62
+ return this.diffService.diffPackages(file, hasChanges, jsonResponse);
58
63
  }
59
64
  listPackagesByVariableValue(jsonResponse, flavors, variableValue, variableType) {
60
65
  return __awaiter(this, void 0, void 0, function* () {
61
66
  if (jsonResponse) {
62
- yield batch_import_export_service_1.batchImportExportService.findAndExportListOfActivePackagesByVariableValue(flavors !== null && flavors !== void 0 ? flavors : [], variableValue, variableType);
67
+ yield this.batchImportExportService.findAndExportListOfActivePackagesByVariableValue(flavors !== null && flavors !== void 0 ? flavors : [], variableValue, variableType);
63
68
  }
64
69
  else {
65
- yield batch_import_export_service_1.batchImportExportService.listActivePackagesByVariableValue(flavors !== null && flavors !== void 0 ? flavors : [], variableValue, variableType);
70
+ yield this.batchImportExportService.listActivePackagesByVariableValue(flavors !== null && flavors !== void 0 ? flavors : [], variableValue, variableType);
66
71
  }
67
72
  });
68
73
  }
69
74
  }
70
- exports.ConfigCommand = ConfigCommand;
75
+ exports.ConfigCommandService = ConfigCommandService;
71
76
  });
@@ -13,20 +13,23 @@ 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", "adm-zip", "stream", "form-data", "../../api/diff-api", "../file-service", "../../util/logger", "uuid"], factory);
16
+ define(["require", "exports", "adm-zip", "stream", "form-data", "uuid", "../../core/utils/logger", "../../core/utils/file-service", "./api/diff-api"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.diffService = void 0;
21
+ exports.DiffService = void 0;
22
22
  const AdmZip = require("adm-zip");
23
23
  const stream_1 = require("stream");
24
24
  const FormData = require("form-data");
25
- const diff_api_1 = require("../../api/diff-api");
26
- const file_service_1 = require("../file-service");
27
- const logger_1 = require("../../util/logger");
28
25
  const uuid_1 = require("uuid");
26
+ const logger_1 = require("../../core/utils/logger");
27
+ const file_service_1 = require("../../core/utils/file-service");
28
+ const diff_api_1 = require("./api/diff-api");
29
29
  class DiffService {
30
+ constructor(context) {
31
+ this.diffApi = new diff_api_1.DiffApi(context);
32
+ }
30
33
  diffPackages(file, hasChanges, jsonResponse) {
31
34
  return __awaiter(this, void 0, void 0, function* () {
32
35
  if (hasChanges) {
@@ -41,7 +44,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
44
  return __awaiter(this, void 0, void 0, function* () {
42
45
  const packages = new AdmZip(file);
43
46
  const formData = this.buildBodyForDiff(packages);
44
- const returnedHasChangesData = yield diff_api_1.diffApi.hasChanges(formData);
47
+ const returnedHasChangesData = yield this.diffApi.hasChanges(formData);
45
48
  if (jsonResponse) {
46
49
  this.exportListOfPackageDiffMetadata(returnedHasChangesData);
47
50
  }
@@ -54,7 +57,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54
57
  return __awaiter(this, void 0, void 0, function* () {
55
58
  const packages = new AdmZip(file);
56
59
  const formData = this.buildBodyForDiff(packages);
57
- const returnedHasChangesData = yield diff_api_1.diffApi.diffPackages(formData);
60
+ const returnedHasChangesData = yield this.diffApi.diffPackages(formData);
58
61
  if (jsonResponse) {
59
62
  this.exportListOfPackageDiffs(returnedHasChangesData);
60
63
  }
@@ -94,5 +97,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
94
97
  return "\n" + JSON.stringify(packageDiffMetadata, null, 2);
95
98
  }
96
99
  }
97
- exports.diffService = new DiffService();
100
+ exports.DiffService = DiffService;
98
101
  });
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Commands related to Celonis configuration management.
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", "./config-command.service", "./variable-command.service"], factory);
20
+ }
21
+ })(function (require, exports) {
22
+ "use strict";
23
+ const module_handler_1 = require("../../core/command/module-handler");
24
+ const config_command_service_1 = require("./config-command.service");
25
+ const variable_command_service_1 = require("./variable-command.service");
26
+ class Module extends module_handler_1.IModule {
27
+ register(context, configurator) {
28
+ const configCommand = configurator.command("config");
29
+ configCommand.command("list")
30
+ .description("Command to list active packages that can be exported")
31
+ .option("--json", "Return response as json type", "")
32
+ .option("--flavors <flavors...>", "Lists only active packages of the given flavors")
33
+ .option("--withDependencies", "Include dependencies", "")
34
+ .option("--packageKeys <packageKeys...>", "Lists only given package keys")
35
+ .option("--variableValue <variableValue>", "Variable value for filtering packages by.")
36
+ .option("--variableType <variableType>", "Variable type for filtering packages by.")
37
+ .action(this.listActivePackages);
38
+ configCommand.command("export")
39
+ .description("Command to export package configs")
40
+ .requiredOption("--packageKeys <packageKeys...>", "Keys of packages to export")
41
+ .option("--withDependencies", "Include variables and dependencies", "")
42
+ .action(this.batchExportPackages);
43
+ configCommand.command("import")
44
+ .description("Command to import package configs")
45
+ .option("--overwrite", "Flag to allow overwriting of packages")
46
+ .requiredOption("-f, --file <file>", "Exported packages file (relative path)")
47
+ .action(this.batchImportPackages);
48
+ configCommand.command("diff")
49
+ .description("Command to diff configs of packages")
50
+ .option("--hasChanges", "Flag to return only the information if the package has changes without the actual changes")
51
+ .option("--json", "Return the response as a JSON file")
52
+ .requiredOption("-f, --file <file>", "Exported packages file (relative or absolute path)")
53
+ .action(this.diffPackages);
54
+ const variablesCommand = configCommand.command("variables")
55
+ .description("Commands related to variable configs");
56
+ variablesCommand.command("list")
57
+ .description("Command to list versioned variables of packages")
58
+ .option("--json", "Return response as json type", "")
59
+ .option("--keysByVersion <keysByVersion...>", "Mapping of package keys and versions", "")
60
+ .option("--keysByVersionFile <keysByVersionFile>", "Package keys by version mappings file path.", "")
61
+ .action(this.listVariables);
62
+ const listCommand = configurator.command("list");
63
+ listCommand.command("assignments")
64
+ .description("Command to list possible variable assignments for a type")
65
+ .option("--json", "Return response as json type", "")
66
+ .requiredOption("--type <type>", "Type of variable")
67
+ .option("--params <params>", "Variable query params")
68
+ .action(this.listAssignments);
69
+ }
70
+ listActivePackages(context, command, options) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ yield new config_command_service_1.ConfigCommandService(context).listActivePackages(options.json, options.flavors, options.withDependencies, options.packageKeys, options.variableValue, options.variableType);
73
+ });
74
+ }
75
+ batchExportPackages(context, command, options) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ yield new config_command_service_1.ConfigCommandService(context).batchExportPackages(options.packageKeys, options.withDependencies);
78
+ });
79
+ }
80
+ batchImportPackages(context, command, options) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ yield new config_command_service_1.ConfigCommandService(context).batchImportPackages(options.file, options.overwrite);
83
+ });
84
+ }
85
+ diffPackages(context, command, options) {
86
+ return __awaiter(this, void 0, void 0, function* () {
87
+ yield new config_command_service_1.ConfigCommandService(context).diffPackages(options.file, options.hasChanges, options.json);
88
+ });
89
+ }
90
+ listVariables(context, command, options) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ yield new config_command_service_1.ConfigCommandService(context).listVariables(options.json, options.keysByVersion, options.keysByVersionFile);
93
+ });
94
+ }
95
+ listAssignments(context, command, options) {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ yield new variable_command_service_1.VariableCommandService(context).listAssignments(options.type, options.json, options.params);
98
+ });
99
+ }
100
+ }
101
+ return Module;
102
+ });