@celonis/content-cli 0.1.0 → 0.2.1
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 +68 -18
- package/commands/analysis.command.js +2 -1
- package/commands/asset.command.js +2 -1
- package/commands/ctp.command.js +4 -3
- package/commands/data-pool.command.js +2 -1
- package/commands/objective.command.js +2 -1
- package/commands/package.command.js +6 -5
- package/commands/profile.command.js +3 -2
- package/commands/skill.command.js +2 -1
- package/commands/widget-sourcemaps.command.js +33 -0
- package/commands/widget.command.js +2 -1
- package/content/factory/ctp-manager.factory.js +4 -3
- package/content/factory/package-manager.factory.js +20 -13
- package/content/factory/widget-manager.factory.js +2 -16
- package/content/factory/widget-sourcemaps-manager.factory.js +34 -0
- package/content/manager/analysis.manager.js +1 -1
- package/content/manager/asset.manager.js +1 -1
- package/content/manager/base.manager.js +2 -1
- package/content/manager/ctp.analysis.manager.js +2 -1
- package/content/manager/ctp.datamodel.manager.js +1 -1
- package/content/manager/ctp.manager.js +6 -0
- package/content/manager/data-pool.manager.js +1 -1
- package/content/manager/objective.manager.js +1 -1
- package/content/manager/package.manager.js +8 -10
- package/content/manager/skill.manager.js +1 -1
- package/content/manager/widget-sourcemaps.manager.js +69 -0
- package/content/manager/widget.manager.js +1 -1
- package/content-cli-list.js +2 -1
- package/content-cli-profile.js +2 -1
- package/content-cli-pull.js +4 -2
- package/content-cli-push.js +22 -4
- package/content-cli-update.js +2 -1
- package/content-cli.js +0 -0
- package/interfaces/profile.interface.js +5 -0
- package/lib/commands/ctp.command.d.ts +1 -1
- package/lib/commands/package.command.d.ts +1 -1
- package/lib/commands/widget-sourcemaps.command.d.ts +4 -0
- package/lib/content/factory/ctp-manager.factory.d.ts +1 -1
- package/lib/content/factory/package-manager.factory.d.ts +4 -2
- package/lib/content/factory/widget-manager.factory.d.ts +15 -2
- package/lib/content/factory/widget-sourcemaps-manager.factory.d.ts +5 -0
- package/lib/content/manager/analysis.manager.d.ts +8 -4
- package/lib/content/manager/asset.manager.d.ts +7 -4
- package/lib/content/manager/base.manager.d.ts +2 -1
- package/lib/content/manager/ctp.manager.d.ts +7 -2
- package/lib/content/manager/data-pool.manager.d.ts +4 -2
- package/lib/content/manager/objective.manager.d.ts +4 -2
- package/lib/content/manager/package.manager.d.ts +15 -6
- package/lib/content/manager/skill.manager.d.ts +6 -3
- package/lib/content/manager/widget-sourcemaps.manager.d.ts +12 -0
- package/lib/content/manager/widget.manager.d.ts +6 -3
- package/lib/interfaces/profile.interface.d.ts +5 -0
- package/lib/services/http-client.service.d.ts +1 -1
- package/lib/validators/profile.validator.d.ts +1 -1
- package/package.json +6 -4
- package/services/content.service.js +2 -1
- package/services/http-client.service.js +10 -7
- package/services/profile.service.js +12 -6
- package/services/question.service.js +3 -2
- package/validators/profile.validator.js +17 -7
|
@@ -1,8 +1,9 @@
|
|
|
1
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); }); }
|
|
2
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3
4
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
4
5
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
5
|
-
function step(result) { result.done ? resolve(result.value) :
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7
8
|
});
|
|
8
9
|
};
|
|
@@ -12,11 +13,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
13
|
if (v !== undefined) module.exports = v;
|
|
13
14
|
}
|
|
14
15
|
else if (typeof define === "function" && define.amd) {
|
|
15
|
-
define(["require", "exports", "path", "fs", "../util/logger", "os"], factory);
|
|
16
|
+
define(["require", "exports", "../interfaces/profile.interface", "../validators/profile.validator", "path", "fs", "../util/logger", "os"], factory);
|
|
16
17
|
}
|
|
17
18
|
})(function (require, exports) {
|
|
18
19
|
"use strict";
|
|
19
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const profile_interface_1 = require("../interfaces/profile.interface");
|
|
22
|
+
const profile_validator_1 = require("../validators/profile.validator");
|
|
20
23
|
const path = require("path");
|
|
21
24
|
const fs = require("fs");
|
|
22
25
|
const logger_1 = require("../util/logger");
|
|
@@ -79,13 +82,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
79
82
|
});
|
|
80
83
|
}
|
|
81
84
|
buildProfileFromEnvVariables() {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
const profileVariables = this.getProfileEnvVariables();
|
|
87
|
+
const profile = {
|
|
85
88
|
name: profileVariables.teamUrl,
|
|
86
89
|
team: profileVariables.teamUrl,
|
|
87
90
|
apiToken: profileVariables.apiToken,
|
|
88
|
-
|
|
91
|
+
authenticationType: profile_interface_1.AuthenticationType.BEARER,
|
|
92
|
+
};
|
|
93
|
+
profile.authenticationType = yield profile_validator_1.ProfileValidator.validateProfile(profile);
|
|
94
|
+
return profile;
|
|
89
95
|
});
|
|
90
96
|
}
|
|
91
97
|
storeConfig(config) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
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); }); }
|
|
2
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3
4
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
4
5
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
5
|
-
function step(result) { result.done ? resolve(result.value) :
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7
8
|
});
|
|
8
9
|
};
|
|
@@ -27,10 +28,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
30
|
}
|
|
31
|
+
exports.QuestionService = QuestionService;
|
|
30
32
|
QuestionService.readLine = readline.createInterface({
|
|
31
33
|
input: process.stdin,
|
|
32
34
|
output: process.stdout,
|
|
33
35
|
terminal: true,
|
|
34
36
|
});
|
|
35
|
-
exports.QuestionService = QuestionService;
|
|
36
37
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
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); }); }
|
|
2
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3
4
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
4
5
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
5
|
-
function step(result) { result.done ? resolve(result.value) :
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7
8
|
});
|
|
8
9
|
};
|
|
@@ -12,11 +13,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
13
|
if (v !== undefined) module.exports = v;
|
|
13
14
|
}
|
|
14
15
|
else if (typeof define === "function" && define.amd) {
|
|
15
|
-
define(["require", "exports", "../util/logger", "valid-url", "request"], factory);
|
|
16
|
+
define(["require", "exports", "../interfaces/profile.interface", "../util/logger", "valid-url", "request"], factory);
|
|
16
17
|
}
|
|
17
18
|
})(function (require, exports) {
|
|
18
19
|
"use strict";
|
|
19
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const profile_interface_1 = require("../interfaces/profile.interface");
|
|
20
22
|
const logger_1 = require("../util/logger");
|
|
21
23
|
const validUrl = require("valid-url");
|
|
22
24
|
const request = require("request");
|
|
@@ -36,9 +38,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
36
38
|
if (!validUrl.isUri(profile.team)) {
|
|
37
39
|
logger_1.logger.error(new logger_1.FatalError("The provided url is not a valid url."));
|
|
38
40
|
}
|
|
39
|
-
|
|
41
|
+
let options = {
|
|
40
42
|
headers: {
|
|
41
|
-
authorization:
|
|
43
|
+
authorization: `${profile_interface_1.AuthenticationType.BEARER} ${profile.apiToken}`,
|
|
42
44
|
},
|
|
43
45
|
};
|
|
44
46
|
const url = profile.team.replace(/\/?$/, "/api/cloud");
|
|
@@ -52,11 +54,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
52
54
|
reject();
|
|
53
55
|
}
|
|
54
56
|
if (res.statusCode >= 400 || body.teamDomain == null) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
options.headers.authorization = `${profile_interface_1.AuthenticationType.APPKEY} ${profile.apiToken}`;
|
|
58
|
+
request.get(url, options, (err, res) => {
|
|
59
|
+
if (res.statusCode === 200) {
|
|
60
|
+
resolve(profile_interface_1.AuthenticationType.APPKEY);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
logger_1.logger.error(new logger_1.FatalError("The provided team or api key is wrong."));
|
|
64
|
+
reject();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
57
67
|
}
|
|
58
68
|
else {
|
|
59
|
-
resolve();
|
|
69
|
+
resolve(profile_interface_1.AuthenticationType.BEARER);
|
|
60
70
|
}
|
|
61
71
|
});
|
|
62
72
|
});
|