@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
@@ -13,18 +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", "../../api/data-pool-api", "../../util/logger"], factory);
16
+ define(["require", "exports", "../../../core/utils/logger", "../data-pool/data-pool-api"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.connectionService = void 0;
22
- const data_pool_api_1 = require("../../api/data-pool-api");
23
- const logger_1 = require("../../util/logger");
21
+ exports.ConnectionService = void 0;
22
+ const logger_1 = require("../../../core/utils/logger");
23
+ const data_pool_api_1 = require("../data-pool/data-pool-api");
24
24
  class ConnectionService {
25
+ constructor(context) {
26
+ this.dataPoolApi = new data_pool_api_1.DataPoolApi(context);
27
+ }
25
28
  findAllConnections(dataPoolId) {
26
29
  return __awaiter(this, void 0, void 0, function* () {
27
- const connections = yield data_pool_api_1.dataPoolApi.listConnections(dataPoolId);
30
+ const connections = yield this.dataPoolApi.listConnections(dataPoolId);
28
31
  connections.forEach(connection => {
29
32
  logger_1.logger.info(`Connection ID: ${connection.id} - Name: ${connection.name} - Type: ${connection.type}`);
30
33
  });
@@ -33,14 +36,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
33
36
  }
34
37
  listProperties(dataPoolId, connectionId) {
35
38
  return __awaiter(this, void 0, void 0, function* () {
36
- const connection = yield data_pool_api_1.dataPoolApi.getConnection(dataPoolId, connectionId);
39
+ const connection = yield this.dataPoolApi.getConnection(dataPoolId, connectionId);
37
40
  const type = connection.type;
38
- const typedConnection = yield data_pool_api_1.dataPoolApi.getTypedConnection(dataPoolId, connectionId, type);
41
+ const typedConnection = yield this.dataPoolApi.getTypedConnection(dataPoolId, connectionId, type);
39
42
  logger_1.logger.info(`Connection ID: ${connection.id} - Name: ${connection.name} - Type: ${connection.type}`);
40
- logger_1.logger.info(`Properties:`);
41
- for (let k in typedConnection) {
42
- if (typeof typedConnection[k] === 'object') {
43
- for (let o in typedConnection[k]) {
43
+ logger_1.logger.info("Properties:");
44
+ for (const k in typedConnection) {
45
+ if (typeof typedConnection[k] === "object") {
46
+ for (const o in typedConnection[k]) {
44
47
  logger_1.logger.info(` ${k}.${o} : ${typeof typedConnection[k][o]} := ${typedConnection[k][o]}`);
45
48
  }
46
49
  }
@@ -53,9 +56,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
53
56
  }
54
57
  updateProperty(dataPoolId, connectionId, property, value) {
55
58
  return __awaiter(this, void 0, void 0, function* () {
56
- const connection = yield data_pool_api_1.dataPoolApi.getConnection(dataPoolId, connectionId);
59
+ const connection = yield this.dataPoolApi.getConnection(dataPoolId, connectionId);
57
60
  const type = connection.type;
58
- const typedConnection = yield data_pool_api_1.dataPoolApi.getTypedConnection(dataPoolId, connectionId, type);
61
+ const typedConnection = yield this.dataPoolApi.getTypedConnection(dataPoolId, connectionId, type);
59
62
  const parts = property.split(".");
60
63
  // update the typed connection object
61
64
  let currentObject = typedConnection;
@@ -74,10 +77,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
74
77
  return;
75
78
  }
76
79
  }
77
- yield data_pool_api_1.dataPoolApi.updateTypedConnection(dataPoolId, connectionId, type, typedConnection);
80
+ yield this.dataPoolApi.updateTypedConnection(dataPoolId, connectionId, type, typedConnection);
78
81
  logger_1.logger.info(`Property ${property} updated.`);
79
82
  });
80
83
  }
81
84
  }
82
- exports.connectionService = new ConnectionService();
85
+ exports.ConnectionService = ConnectionService;
83
86
  });
@@ -13,65 +13,66 @@ 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.dataPoolApi = void 0;
22
- const http_client_service_v2_1 = require("../services/http-client-service.v2");
23
- const logger_1 = require("../util/logger");
21
+ exports.DataPoolApi = void 0;
22
+ const logger_1 = require("../../../core/utils/logger");
24
23
  class DataPoolApi {
24
+ constructor(context) {
25
+ this.httpClient = context.httpClient;
26
+ }
25
27
  findAllPagedPools(limit, page) {
26
28
  return __awaiter(this, void 0, void 0, function* () {
27
- return http_client_service_v2_1.httpClientV2.get(`/integration/api/pools/paged?limit=${limit}&page=${page}`).catch(e => {
29
+ return this.httpClient.get(`/integration/api/pools/paged?limit=${limit}&page=${page}`).catch(e => {
28
30
  throw new logger_1.FatalError(`Problem getting data pools: : ${e}`);
29
31
  });
30
32
  });
31
33
  }
32
34
  executeDataPoolsBatchImport(importRequest) {
33
35
  return __awaiter(this, void 0, void 0, function* () {
34
- return http_client_service_v2_1.httpClientV2.post("/integration/api/pool/batch-import", importRequest).catch(e => {
36
+ return this.httpClient.post("/integration/api/pool/batch-import", importRequest).catch(e => {
35
37
  throw new logger_1.FatalError(`Data Pool batch import failed: : ${e}`);
36
38
  });
37
39
  });
38
40
  }
39
41
  exportDataPool(poolId) {
40
42
  return __awaiter(this, void 0, void 0, function* () {
41
- return http_client_service_v2_1.httpClientV2.get(`/integration/api/pools/${poolId}/v2/export`).catch(e => {
43
+ return this.httpClient.get(`/integration/api/pools/${poolId}/v2/export`).catch(e => {
42
44
  throw new logger_1.FatalError(`Data Pool export failed: : ${e}`);
43
45
  });
44
46
  });
45
47
  }
46
48
  listConnections(poolId) {
47
49
  return __awaiter(this, void 0, void 0, function* () {
48
- return http_client_service_v2_1.httpClientV2.get(`/integration/api/pools/${poolId}/overviews/data-sources`).catch(e => {
50
+ return this.httpClient.get(`/integration/api/pools/${poolId}/overviews/data-sources`).catch(e => {
49
51
  throw new logger_1.FatalError(`Can not list connections: : ${e}`);
50
52
  });
51
53
  });
52
54
  }
53
55
  getConnection(poolId, connectionId) {
54
56
  return __awaiter(this, void 0, void 0, function* () {
55
- return http_client_service_v2_1.httpClientV2.get(`/integration/api/pools/${poolId}/data-sources/${connectionId}`).catch(e => {
57
+ return this.httpClient.get(`/integration/api/pools/${poolId}/data-sources/${connectionId}`).catch(e => {
56
58
  throw new logger_1.FatalError(`Can not get connection: : ${e}`);
57
59
  });
58
60
  });
59
61
  }
60
62
  getTypedConnection(poolId, connectionId, type) {
61
63
  return __awaiter(this, void 0, void 0, function* () {
62
- return http_client_service_v2_1.httpClientV2.get(`/integration/api/datasource/${type}/${connectionId}`).catch(e => {
64
+ return this.httpClient.get(`/integration/api/datasource/${type}/${connectionId}`).catch(e => {
63
65
  throw new logger_1.FatalError(`Can get typed connection: : ${e}`);
64
66
  });
65
67
  });
66
68
  }
67
69
  updateTypedConnection(poolId, connectionId, type, data) {
68
70
  return __awaiter(this, void 0, void 0, function* () {
69
- return http_client_service_v2_1.httpClientV2.put(`/integration/api/datasource/${type}/${connectionId}`, data).catch(e => {
71
+ return this.httpClient.put(`/integration/api/datasource/${type}/${connectionId}`, data).catch(e => {
70
72
  throw new logger_1.FatalError(`Can not update typed connection: ${e}`);
71
73
  });
72
74
  });
73
75
  }
74
76
  }
75
- DataPoolApi.INSTANCE = new DataPoolApi();
76
- exports.dataPoolApi = DataPoolApi.INSTANCE;
77
+ exports.DataPoolApi = DataPoolApi;
77
78
  });
@@ -13,60 +13,62 @@ 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/data-pool-manager.factory", "../services/data-pool/data-pool-service"], factory);
16
+ define(["require", "exports", "./data-pool-manager.factory", "./data-pool-service", "../../../core/http/http-shared/base.manager.helper"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.DataPoolCommand = void 0;
22
- const content_service_1 = require("../services/content.service");
23
- const data_pool_manager_factory_1 = require("../content/factory/data-pool-manager.factory");
24
- const data_pool_service_1 = require("../services/data-pool/data-pool-service");
25
- class DataPoolCommand {
26
- constructor() {
27
- this.contentService = new content_service_1.ContentService();
28
- this.dataPoolManagerFactory = new data_pool_manager_factory_1.DataPoolManagerFactory();
21
+ exports.DataPoolCommandService = void 0;
22
+ const data_pool_manager_factory_1 = require("./data-pool-manager.factory");
23
+ const data_pool_service_1 = require("./data-pool-service");
24
+ const base_manager_helper_1 = require("../../../core/http/http-shared/base.manager.helper");
25
+ class DataPoolCommandService {
26
+ constructor(context) {
27
+ this.baseManagerHelper = new base_manager_helper_1.BaseManagerHelper();
28
+ this.dataPoolManagerFactory = new data_pool_manager_factory_1.DataPoolManagerFactory(context);
29
+ this.dataPoolService = new data_pool_service_1.DataPoolService(context);
29
30
  }
30
- pullDataPool(profile, id) {
31
+ pullDataPool(id) {
31
32
  return __awaiter(this, void 0, void 0, function* () {
32
- yield this.contentService.pull(profile, this.dataPoolManagerFactory.createManager(id, null));
33
+ yield this.dataPoolManagerFactory.createManager(id, null).pull();
33
34
  });
34
35
  }
35
- pushDataPool(profile, filename) {
36
+ pushDataPool(filename) {
36
37
  return __awaiter(this, void 0, void 0, function* () {
37
- yield this.contentService.push(profile, this.dataPoolManagerFactory.createManager(null, filename));
38
+ yield this.dataPoolManagerFactory.createManager(null, filename).push();
38
39
  });
39
40
  }
40
41
  exportDataPool(poolId, outputToJsonFile) {
41
42
  return __awaiter(this, void 0, void 0, function* () {
42
- yield data_pool_service_1.dataPoolService.exportDataPool(poolId, outputToJsonFile);
43
+ yield this.dataPoolService.exportDataPool(poolId, outputToJsonFile);
43
44
  });
44
45
  }
45
- pushDataPools(profile) {
46
+ pushDataPools() {
46
47
  return __awaiter(this, void 0, void 0, function* () {
47
- yield this.contentService.batchPush(profile, this.dataPoolManagerFactory.createManagers());
48
+ const dataPoolManagers = this.dataPoolManagerFactory.createManagers();
49
+ yield this.baseManagerHelper.batchPush(dataPoolManagers);
48
50
  });
49
51
  }
50
52
  batchImportDataPools(requestFile, outputToJsonFile) {
51
53
  return __awaiter(this, void 0, void 0, function* () {
52
- yield data_pool_service_1.dataPoolService.batchImportDataPools(requestFile, outputToJsonFile);
54
+ yield this.dataPoolService.batchImportDataPools(requestFile, outputToJsonFile);
53
55
  });
54
56
  }
55
- updateDataPool(profile, id, filename) {
57
+ updateDataPool(id, filename) {
56
58
  return __awaiter(this, void 0, void 0, function* () {
57
- yield this.contentService.update(profile, this.dataPoolManagerFactory.createManager(id, filename));
59
+ yield this.dataPoolManagerFactory.createManager(id, filename).update();
58
60
  });
59
61
  }
60
- listDataPools(profile, jsonResponse) {
62
+ listDataPools(jsonResponse) {
61
63
  return __awaiter(this, void 0, void 0, function* () {
62
64
  if (jsonResponse) {
63
- yield data_pool_service_1.dataPoolService.findAndExportAllPools();
65
+ yield this.dataPoolService.findAndExportAllPools();
64
66
  }
65
67
  else {
66
- yield data_pool_service_1.dataPoolService.listDataPools();
68
+ yield this.dataPoolService.listDataPools();
67
69
  }
68
70
  });
69
71
  }
70
72
  }
71
- exports.DataPoolCommand = DataPoolCommand;
73
+ exports.DataPoolCommandService = DataPoolCommandService;
72
74
  });
@@ -4,19 +4,22 @@
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/data-pool.manager"], factory);
7
+ define(["require", "exports", "path", "./data-pool.manager", "../../../core/utils/logger", "fs"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.DataPoolManagerFactory = void 0;
13
- const fs = require("fs");
14
13
  const path = require("path");
15
- const logger_1 = require("../../util/logger");
16
- const data_pool_manager_1 = require("../manager/data-pool.manager");
14
+ const data_pool_manager_1 = require("./data-pool.manager");
15
+ const logger_1 = require("../../../core/utils/logger");
16
+ const fs = require("fs");
17
17
  class DataPoolManagerFactory {
18
+ constructor(context) {
19
+ this.context = context;
20
+ }
18
21
  createManager(id, filename) {
19
- const dataPoolManager = new data_pool_manager_1.DataPoolManager();
22
+ const dataPoolManager = new data_pool_manager_1.DataPoolManager(this.context);
20
23
  dataPoolManager.id = id;
21
24
  if (filename !== null) {
22
25
  dataPoolManager.content = this.readFile(filename);
@@ -34,7 +37,7 @@
34
37
  return false;
35
38
  })
36
39
  .map(dataPool => {
37
- const dataPoolManager = new data_pool_manager_1.DataPoolManager();
40
+ const dataPoolManager = new data_pool_manager_1.DataPoolManager(this.context);
38
41
  dataPoolManager.content = this.readFile(dataPool);
39
42
  return dataPoolManager;
40
43
  });
@@ -13,21 +13,24 @@ 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/data-pool-api", "../../util/logger", "uuid", "../file-service"], factory);
16
+ define(["require", "exports", "uuid", "../../../core/utils/file-service", "../../../core/utils/logger", "./data-pool-api"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.dataPoolService = void 0;
22
- const data_pool_api_1 = require("../../api/data-pool-api");
23
- const logger_1 = require("../../util/logger");
21
+ exports.DataPoolService = void 0;
24
22
  const uuid_1 = require("uuid");
25
- const file_service_1 = require("../file-service");
23
+ const file_service_1 = require("../../../core/utils/file-service");
24
+ const logger_1 = require("../../../core/utils/logger");
25
+ const data_pool_api_1 = require("./data-pool-api");
26
26
  class DataPoolService {
27
+ constructor(context) {
28
+ this.dataPoolApi = new data_pool_api_1.DataPoolApi(context);
29
+ }
27
30
  batchImportDataPools(requestFilePath, outputToJsonFile) {
28
31
  return __awaiter(this, void 0, void 0, function* () {
29
32
  const requestFileContent = file_service_1.fileService.readFile(requestFilePath);
30
- const importReport = yield data_pool_api_1.dataPoolApi.executeDataPoolsBatchImport(requestFileContent);
33
+ const importReport = yield this.dataPoolApi.executeDataPoolsBatchImport(requestFileContent);
31
34
  const importReportString = JSON.stringify(importReport, null, 4);
32
35
  if (outputToJsonFile) {
33
36
  const reportFileName = "batch_import_report_" + (0, uuid_1.v4)() + ".json";
@@ -41,7 +44,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
44
  }
42
45
  exportDataPool(poolId, outputToJsonFile) {
43
46
  return __awaiter(this, void 0, void 0, function* () {
44
- const exportedDataPool = yield data_pool_api_1.dataPoolApi.exportDataPool(poolId);
47
+ const exportedDataPool = yield this.dataPoolApi.exportDataPool(poolId);
45
48
  const exportedDataPoolString = JSON.stringify(exportedDataPool, null, 4);
46
49
  if (outputToJsonFile) {
47
50
  const reportFileName = (0, uuid_1.v4)() + "_data_pool_" + poolId + ".json";
@@ -71,10 +74,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
71
74
  return __awaiter(this, void 0, void 0, function* () {
72
75
  let page = 0;
73
76
  const dataPools = [];
74
- let tmpPage = yield data_pool_api_1.dataPoolApi.findAllPagedPools("100", page.toString());
77
+ let tmpPage = yield this.dataPoolApi.findAllPagedPools("100", page.toString());
75
78
  while (tmpPage.pageNumber < tmpPage.totalCount) {
76
79
  dataPools.push(...tmpPage.content);
77
- tmpPage = yield data_pool_api_1.dataPoolApi.findAllPagedPools("100", (++page).toString());
80
+ tmpPage = yield this.dataPoolApi.findAllPagedPools("100", (++page).toString());
78
81
  }
79
82
  return dataPools;
80
83
  });
@@ -85,5 +88,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
85
88
  logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
86
89
  }
87
90
  }
88
- exports.dataPoolService = new DataPoolService();
91
+ exports.DataPoolService = DataPoolService;
89
92
  });
@@ -0,0 +1,99 @@
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", "./data-pool-command.service"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.DataPoolCommands = void 0;
22
+ const data_pool_command_service_1 = require("./data-pool-command.service");
23
+ class DataPoolCommands {
24
+ register(context, configurator) {
25
+ const exportCommand = configurator.command("export");
26
+ exportCommand.command("data-pool")
27
+ .description("Command to export a data pool")
28
+ .requiredOption("--id <id>", "ID of the data pool you want to export")
29
+ .option("--outputToJsonFile", "Output the exported data pool to a JSON file")
30
+ .action(this.exportDataPool);
31
+ const importCommand = configurator.command("import");
32
+ importCommand.command("data-pools")
33
+ .description("Command to batch import multiple data pools with their objects and dependencies")
34
+ .requiredOption("-f, --jsonFile <file>", "The file with the JSON data pool batch import request")
35
+ .option("--outputToJsonFile", "Output the batch import result in a JSON file")
36
+ .action(this.batchImportDataPools);
37
+ const listCommand = configurator.command("list");
38
+ listCommand.command("data-pools")
39
+ .description("Command to list all Data Pools")
40
+ .option("--json", "Return response as json type", "")
41
+ .action(this.listDataPools);
42
+ const pullCommand = configurator.command("pull");
43
+ pullCommand.command("data-pool")
44
+ .description("Command to pull a data pool")
45
+ .requiredOption("--id <id>", "Id of the data pool you want to pull")
46
+ .action(this.pullDataPool);
47
+ const pushCommand = configurator.command("push");
48
+ pushCommand.command("data-pool")
49
+ .description("Command to push a data pool")
50
+ .requiredOption("-f, --file <file>", "The file you want to push")
51
+ .action(this.pushDataPool);
52
+ pushCommand.command("data-pools")
53
+ .description("Command to push data pools")
54
+ .action(this.pushDataPools);
55
+ const updateCommand = configurator.command("update");
56
+ updateCommand.command("data-pool")
57
+ .description("Command to update a data pool using a data pool configuration file")
58
+ .requiredOption("--id <id>", "Id of the data pool you want to update")
59
+ .requiredOption("-f, --file <file>", "The file you want to push")
60
+ .action(this.updateDataPool);
61
+ }
62
+ exportDataPool(context, command, options) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ yield new data_pool_command_service_1.DataPoolCommandService(context).exportDataPool(options.id, options.outputToJsonFile);
65
+ });
66
+ }
67
+ batchImportDataPools(context, command, options) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ yield new data_pool_command_service_1.DataPoolCommandService(context).batchImportDataPools(options.jsonFile, options.outputToJsonFile);
70
+ });
71
+ }
72
+ listDataPools(context, command, options) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ yield new data_pool_command_service_1.DataPoolCommandService(context).listDataPools(options.json);
75
+ });
76
+ }
77
+ pullDataPool(context, command, options) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ yield new data_pool_command_service_1.DataPoolCommandService(context).pullDataPool(options.id);
80
+ });
81
+ }
82
+ pushDataPool(context, command, options) {
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ yield new data_pool_command_service_1.DataPoolCommandService(context).pushDataPool(options.file);
85
+ });
86
+ }
87
+ pushDataPools(context, command, options) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ yield new data_pool_command_service_1.DataPoolCommandService(context).pushDataPools();
90
+ });
91
+ }
92
+ updateDataPool(context, command, options) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ yield new data_pool_command_service_1.DataPoolCommandService(context).updateDataPool(options.id, options.file);
95
+ });
96
+ }
97
+ }
98
+ exports.DataPoolCommands = DataPoolCommands;
99
+ });
@@ -4,14 +4,17 @@
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"], factory);
7
+ define(["require", "exports", "../../../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.DataPoolManager = void 0;
13
- const base_manager_1 = require("./base.manager");
13
+ const base_manager_1 = require("../../../core/http/http-shared/base.manager");
14
14
  class DataPoolManager extends base_manager_1.BaseManager {
15
+ constructor(context) {
16
+ super(context);
17
+ }
15
18
  get content() {
16
19
  return this._content;
17
20
  }
@@ -26,13 +29,9 @@
26
29
  }
27
30
  getConfig() {
28
31
  return {
29
- pushUrl: this.profile.team.replace(/\/?$/, `${DataPoolManager.DATA_POOL_PUSH_URL}`),
30
- pullUrl: this.profile.team
31
- .replace(/\/?$/, `${DataPoolManager.DATA_POOL_PULL_URL}`)
32
- .replace("{id}", this.id),
33
- updateUrl: this.profile.team
34
- .replace(/\/?$/, DataPoolManager.DATA_POOL_ACTIONS_URL)
35
- .replace("{id}", this.id),
32
+ pushUrl: DataPoolManager.DATA_POOL_PUSH_URL,
33
+ pullUrl: DataPoolManager.DATA_POOL_PULL_URL.replace("{id}", this.id),
34
+ updateUrl: DataPoolManager.DATA_POOL_ACTIONS_URL.replace("{id}", this.id),
36
35
  exportFileName: DataPoolManager.DATA_POOL_FILE_NAME_PREFIX + this.id + ".json",
37
36
  onPushSuccessMessage: (data) => {
38
37
  return "Data Pool was pushed successfully. New ID: " + data.id;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Commands related to the Data Pipeline area.
3
+ */
4
+ (function (factory) {
5
+ if (typeof module === "object" && typeof module.exports === "object") {
6
+ var v = factory(require, exports);
7
+ if (v !== undefined) module.exports = v;
8
+ }
9
+ else if (typeof define === "function" && define.amd) {
10
+ define(["require", "exports", "../../core/command/module-handler", "./connection/connection.commands", "./data-pool/data-pool.commands"], factory);
11
+ }
12
+ })(function (require, exports) {
13
+ "use strict";
14
+ const module_handler_1 = require("../../core/command/module-handler");
15
+ const connection_commands_1 = require("./connection/connection.commands");
16
+ const data_pool_commands_1 = require("./data-pool/data-pool.commands");
17
+ class Module extends module_handler_1.IModule {
18
+ register(context, configurator) {
19
+ new data_pool_commands_1.DataPoolCommands().register(context, configurator);
20
+ new connection_commands_1.ConnectionCommands().register(context, configurator);
21
+ }
22
+ }
23
+ return Module;
24
+ });
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Commands to create and list access profiles.
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", "../../core/utils/logger", "./profile-command.service"], factory);
20
+ }
21
+ })(function (require, exports) {
22
+ "use strict";
23
+ const module_handler_1 = require("../../core/command/module-handler");
24
+ const logger_1 = require("../../core/utils/logger");
25
+ const profile_command_service_1 = require("./profile-command.service");
26
+ class Module extends module_handler_1.IModule {
27
+ register(context, configurator) {
28
+ const command = configurator.command("profile")
29
+ .description("Manage profiles required to access a system.");
30
+ command.command("list")
31
+ .description("Command to list all stored profiles")
32
+ .action(this.listProfiles);
33
+ command.command("create")
34
+ .description("Command to create a new profile")
35
+ .option("--setAsDefault", "Set this profile as default")
36
+ .action(this.createProfile);
37
+ command.command("default <profile>")
38
+ .description("Command to set a profile as default")
39
+ .action(this.defaultProfile);
40
+ }
41
+ defaultProfile(context, command) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const profile = command.args[0];
44
+ yield new profile_command_service_1.ProfileCommandService().makeDefaultProfile(profile);
45
+ });
46
+ }
47
+ createProfile(context, command, options) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ yield new profile_command_service_1.ProfileCommandService().createProfile(options.setAsDefault);
50
+ });
51
+ }
52
+ listProfiles(context, command) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ logger_1.logger.debug("List profiles");
55
+ yield new profile_command_service_1.ProfileCommandService().listProfiles();
56
+ });
57
+ }
58
+ }
59
+ return Module;
60
+ });