@celonis/content-cli 0.2.2 → 0.2.6

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.
package/README.md CHANGED
@@ -56,7 +56,7 @@ content-cli pull package -p <profile-name> --key <package-key>
56
56
  ```
57
57
  Example, if you want to pull a package with key "interesting-package" from your profile "my-dev-profile", the command will look like this:
58
58
  ```
59
- content-cli pull package -p interesting-package --key my-dev-profile
59
+ content-cli pull package -p my-dev-profile --key interesting-package
60
60
  ```
61
61
 
62
62
  **Push:** This feature allows you to push a content file to a team in the EMS. To continue the last example,
@@ -68,7 +68,7 @@ content-cli push package -p <profile-name> --spaceKey <space-key> -f <file-to-pu
68
68
  ```
69
69
  Example, if you want to push a package from zipped file "interesting-package.zip" to you team of profile "my-dev-profile" with the space "my-cool-space", the command will look like this:
70
70
  ```
71
- content-cli push package -p interesting-package --spaceKey my-cool-space -f interesting-package.zip
71
+ content-cli push package -p my-dev-profile --spaceKey my-cool-space -f interesting-package.zip
72
72
  ```
73
73
 
74
74
  A more comprehensive list of Content CLI capabilities can be found on the following
@@ -41,16 +41,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
41
  `node ${datadogCiPath} sourcemaps upload .`,
42
42
  `--service=package-manager`,
43
43
  `--release-version=1.0.0`,
44
- `--minified-path-prefix=/package-manager/`,
44
+ "--disable-git",
45
45
  ];
46
- const datadogCommandLine = commandLines.join(" ");
46
+ const datadogCommandLine = [...commandLines, "--minified-path-prefix=/package-manager/"].join(" ");
47
47
  child_process_1.exec(datadogCommandLine, (error, stdout) => {
48
+ var _a;
48
49
  if (error) {
49
50
  logger_1.logger.error(new logger_1.GracefulError(error.message));
50
51
  }
51
52
  else {
52
53
  logger_1.logger.info(new logger_1.GracefulError(stdout));
53
54
  }
55
+ if (process.env.AWS_ACCESS_KEY_ID_CDN && process.env.AWS_SECRET_ACCESS_KEY_CDN) {
56
+ try {
57
+ const uploadSourcemapsStdout = child_process_1.execSync([
58
+ ...commandLines,
59
+ `--minified-path-prefix=https://static.celonis.cloud/static/package-manager/`,
60
+ ].join(" "));
61
+ logger_1.logger.info(uploadSourcemapsStdout);
62
+ }
63
+ catch (error) {
64
+ logger_1.logger.error(new logger_1.GracefulError(((_a = error.stderr) === null || _a === void 0 ? void 0 : _a.toString()) || error.message));
65
+ }
66
+ }
54
67
  return resolve(error || stdout);
55
68
  });
56
69
  });
@@ -13,7 +13,7 @@ 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", "commander", "fs", "path", "./commands/analysis.command", "./commands/skill.command", "./commands/widget.command", "./commands/data-pool.command", "./commands/asset.command", "./commands/package.command", "./commands/ctp.command", "./commands/widget-sourcemaps.command"], factory);
16
+ define(["require", "exports", "commander", "fs", "path", "./commands/analysis.command", "./commands/skill.command", "./commands/widget.command", "./commands/data-pool.command", "./commands/asset.command", "./commands/package.command", "./commands/ctp.command", "./commands/widget-sourcemaps.command", "child_process", "./util/logger"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -29,6 +29,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
29
29
  const package_command_1 = require("./commands/package.command");
30
30
  const ctp_command_1 = require("./commands/ctp.command");
31
31
  const widget_sourcemaps_command_1 = require("./commands/widget-sourcemaps.command");
32
+ const child_process_1 = require("child_process");
33
+ const logger_1 = require("./util/logger");
32
34
  class Push {
33
35
  static analysis(program) {
34
36
  program
@@ -83,7 +85,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
83
85
  .option("--userSpecific", "Upload widget only for the user in the provided api token")
84
86
  .option("--packageManager", "Upload widget to package manager (deprecated)") // Deprecated
85
87
  .action((cmd) => __awaiter(this, void 0, void 0, function* () {
88
+ var _a;
86
89
  yield new widget_command_1.WidgetCommand().pushWidget(cmd.profile, !!cmd.tenantIndependent, !!cmd.userSpecific);
90
+ if (process.env.AWS_ACCESS_KEY_ID_CDN && process.env.AWS_SECRET_ACCESS_KEY_CDN) {
91
+ try {
92
+ const dir = path.resolve(process.cwd());
93
+ const pushToS3stdout = child_process_1.execSync(`aws s3 cp ${dir} s3://celonis-static-origin/static/package-manager/ --recursive --exclude="*.map" --exclude="*.yaml" --profile default`).toString("utf-8");
94
+ logger_1.logger.info(pushToS3stdout);
95
+ }
96
+ catch (error) {
97
+ logger_1.logger.error(new logger_1.GracefulError(((_a = error.stderr) === null || _a === void 0 ? void 0 : _a.toString()) || error.message));
98
+ }
99
+ }
87
100
  const zipFileName = path.resolve(process.cwd(), "output.zip");
88
101
  fs.unlinkSync(zipFileName);
89
102
  process.exit();
@@ -9,4 +9,7 @@
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ class AssetMetadataTransport {
13
+ }
14
+ exports.AssetMetadataTransport = AssetMetadataTransport;
12
15
  });
@@ -5,4 +5,8 @@ export interface SaveContentNode {
5
5
  nodeType: string;
6
6
  assetType: string;
7
7
  serializedContent: string;
8
+ assetMetadataTransport: AssetMetadataTransport;
9
+ }
10
+ export declare class AssetMetadataTransport {
11
+ hidden: boolean;
8
12
  }
@@ -1,4 +1,5 @@
1
1
  import { Profile } from "../interfaces/profile.interface";
2
2
  export declare class ProfileValidator {
3
3
  static validateProfile(profile: Profile): Promise<any>;
4
+ private static parseBody;
4
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celonis/content-cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.6",
4
4
  "description": "CLI Tool to help manage content in Celonis EMS",
5
5
  "main": "content-cli.js",
6
6
  "bin": {
@@ -38,25 +38,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
38
38
  if (!validUrl.isUri(profile.team)) {
39
39
  logger_1.logger.error(new logger_1.FatalError("The provided url is not a valid url."));
40
40
  }
41
- let options = {
41
+ const options = {
42
42
  headers: {
43
43
  authorization: `${profile_interface_1.AuthenticationType.BEARER} ${profile.apiToken}`,
44
44
  },
45
45
  };
46
- const url = profile.team.replace(/\/?$/, "/api/cloud");
46
+ const url = profile.team.replace(/\/?$/, "/api/cloud/team");
47
47
  request.get(url, options, (err, res) => {
48
- let body;
49
- try {
50
- body = JSON.parse(res.body);
51
- }
52
- catch (e) {
53
- logger_1.logger.error(new logger_1.FatalError("The provided team or api key is wrong."));
54
- reject();
55
- }
56
- if (res.statusCode >= 400 || body.teamDomain == null) {
48
+ let body = this.parseBody(res.body);
49
+ if (res.statusCode >= 400 || !(body === null || body === void 0 ? void 0 : body.domain)) {
57
50
  options.headers.authorization = `${profile_interface_1.AuthenticationType.APPKEY} ${profile.apiToken}`;
58
51
  request.get(url, options, (err, res) => {
59
- if (res.statusCode === 200) {
52
+ body = this.parseBody(res.body);
53
+ if (res.statusCode === 200 && (body === null || body === void 0 ? void 0 : body.domain)) {
60
54
  resolve(profile_interface_1.AuthenticationType.APPKEY);
61
55
  }
62
56
  else {
@@ -72,6 +66,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
72
66
  });
73
67
  });
74
68
  }
69
+ static parseBody(responseBody) {
70
+ try {
71
+ return JSON.parse(responseBody);
72
+ // tslint:disable-next-line:no-empty
73
+ }
74
+ catch (ignored) { }
75
+ }
75
76
  }
76
77
  exports.ProfileValidator = ProfileValidator;
77
78
  });