@celonis/content-cli 0.4.6 → 0.4.7

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.
@@ -13,19 +13,18 @@ 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", "./commands/package.command", "./commands/space.command", "./commands/data-pool.command", "./commands/asset.command", "commander", "./services/context.service", "./util/logger"], factory);
16
+ define(["require", "exports", "./commands/package.command", "./commands/space.command", "./commands/data-pool.command", "./commands/asset.command", "./util/logger", "commander", "./util/context-initializer"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
- var _a;
21
20
  Object.defineProperty(exports, "__esModule", { value: true });
22
21
  const package_command_1 = require("./commands/package.command");
23
22
  const space_command_1 = require("./commands/space.command");
24
23
  const data_pool_command_1 = require("./commands/data-pool.command");
25
24
  const asset_command_1 = require("./commands/asset.command");
26
- const commander = require("commander");
27
- const context_service_1 = require("./services/context.service");
28
25
  const logger_1 = require("./util/logger");
26
+ const commander = require("commander");
27
+ const context_initializer_1 = require("./util/context-initializer");
29
28
  class List {
30
29
  static packages(program) {
31
30
  program
@@ -80,19 +79,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
80
79
  }
81
80
  }
82
81
  exports.List = List;
83
- const options = commander.parseOptions(process.argv);
84
- const indexOfProfileOption = (_a = options.unknown.indexOf('-p')) !== null && _a !== void 0 ? _a : options.unknown.indexOf('--profile');
85
82
  process.on("unhandledRejection", (e, promise) => {
86
83
  logger_1.logger.error(e.toString());
87
84
  });
88
- context_service_1.contextService.resolveProfile(options.unknown[indexOfProfileOption + 1]).then(() => {
85
+ const loadAllCommands = () => {
89
86
  List.packages(commander);
90
87
  List.spaces(commander);
91
88
  List.dataPools(commander);
92
89
  List.assets(commander);
93
90
  commander.parse(process.argv);
94
- }).catch(e => {
95
- console.log(e);
91
+ };
92
+ context_initializer_1.ContextInitializer.initContext()
93
+ .then(loadAllCommands)
94
+ .catch(e => {
95
+ logger_1.logger.error(e);
96
96
  });
97
97
  if (!process.argv.slice(2).length) {
98
98
  commander.outputHelp();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celonis/content-cli",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "CLI Tool to help manage content in Celonis EMS",
5
5
  "main": "content-cli.js",
6
6
  "bin": {
@@ -43,7 +43,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  const exportedDataPool = yield data_pool_api_1.dataPoolApi.exportDataPool(poolId);
44
44
  const exportedDataPoolString = JSON.stringify(exportedDataPool, null, 4);
45
45
  if (outputToJsonFile) {
46
- const reportFileName = uuid_1.v4() + "data_pool_" + poolId + ".json";
46
+ const reportFileName = uuid_1.v4() + "_data_pool_" + poolId + ".json";
47
47
  file_service_1.fileService.writeToFileWithGivenName(exportedDataPoolString, reportFileName);
48
48
  logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + reportFileName);
49
49
  }