@celonis/content-cli 0.5.4 → 0.6.0
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/api/asset-api.js +1 -0
- package/api/compute-pool-api.js +1 -0
- package/api/data-pool-api.js +29 -0
- package/api/node-api.js +1 -0
- package/api/package-api.js +1 -0
- package/api/package-dependencies-api.js +1 -0
- package/api/space-api.js +1 -0
- package/api/variable-assignment-apis.js +1 -0
- package/api/variables-api.js +1 -0
- package/commands/analysis-bookmarks.command.js +1 -0
- package/commands/analysis.command.js +1 -0
- package/commands/asset.command.js +1 -0
- package/commands/connection.command.js +41 -0
- package/commands/ctp.command.js +1 -0
- package/commands/data-pool.command.js +1 -0
- package/commands/objective.command.js +1 -0
- package/commands/package.command.js +1 -0
- package/commands/profile.command.js +1 -0
- package/commands/skill.command.js +1 -0
- package/commands/space.command.js +1 -0
- package/commands/variable.command.js +1 -0
- package/commands/widget-sourcemaps.command.js +1 -0
- package/commands/widget.command.js +1 -0
- package/content/factory/analysis-bookmarks-manager.factory.js +1 -0
- package/content/factory/analysis-manager.factory.js +1 -0
- package/content/factory/asset-manager.factory.js +1 -0
- package/content/factory/ctp-manager.factory.js +1 -0
- package/content/factory/data-pool-manager.factory.js +1 -0
- package/content/factory/objective-manager.factory.js +1 -0
- package/content/factory/package-manager.factory.js +1 -0
- package/content/factory/skill-manager.factory.js +1 -0
- package/content/factory/space-manager.factory.js +1 -0
- package/content/factory/widget-manager.factory.js +3 -2
- package/content/factory/widget-sourcemaps-manager.factory.js +1 -0
- package/content/manager/analysis-bookmarks.manager.js +6 -6
- package/content/manager/analysis.manager.js +7 -7
- package/content/manager/asset.manager.js +4 -5
- package/content/manager/base.manager.js +1 -0
- package/content/manager/ctp.analysis.manager.js +8 -8
- package/content/manager/ctp.datamodel.manager.js +1 -0
- package/content/manager/ctp.manager.js +1 -0
- package/content/manager/data-pool.manager.js +3 -6
- package/content/manager/objective.manager.js +3 -4
- package/content/manager/package.manager.js +6 -6
- package/content/manager/skill.manager.js +6 -6
- package/content/manager/space.manager.js +2 -1
- package/content/manager/widget-sourcemaps.manager.js +3 -2
- package/content/manager/widget.manager.js +6 -6
- package/content-cli-export.js +1 -0
- package/content-cli-get.js +52 -0
- package/content-cli-import.js +1 -0
- package/content-cli-list.js +16 -1
- package/content-cli-push.js +1 -1
- package/content-cli-set.js +54 -0
- package/content-cli.js +2 -0
- package/interfaces/package-manager.interfaces.js +2 -1
- package/interfaces/profile.interface.js +1 -0
- package/lib/api/data-pool-api.d.ts +4 -0
- package/lib/commands/connection.command.d.ts +5 -0
- package/lib/content-cli-get.d.ts +1 -0
- package/lib/content-cli-list.d.ts +2 -1
- package/lib/content-cli-set.d.ts +1 -0
- package/lib/interfaces/data-pool-manager.interfaces.d.ts +1 -1
- package/lib/interfaces/profile.interface.d.ts +1 -1
- package/lib/services/connection/connection.service.d.ts +7 -0
- package/lib/services/http-client-service.v2.d.ts +1 -3
- package/lib/services/http-client.service.d.ts +2 -3
- package/lib/validators/profile.validator.d.ts +1 -1
- package/package.json +6 -7
- package/services/connection/connection.service.js +83 -0
- package/services/content.service.js +1 -0
- package/services/context.service.js +1 -0
- package/services/data-pool/data-pool-service.js +4 -3
- package/services/file-service.js +2 -1
- package/services/http-client-service.v2.js +60 -54
- package/services/http-client.service.js +55 -45
- package/services/package-manager/asset-service.js +2 -1
- package/services/package-manager/datamodel-service.js +1 -0
- package/services/package-manager/package-service.js +5 -4
- package/services/package-manager/space-service.js +2 -1
- package/services/package-manager/variable-service.js +2 -1
- package/services/profile.service.js +1 -0
- package/services/question.service.js +1 -0
- package/util/context-initializer.js +1 -0
- package/util/logger.js +1 -0
- package/util/semantic-versioning.js +1 -0
- package/util/tracing.js +1 -0
- package/util/version.js +1 -0
- package/util/yaml.js +1 -0
- package/validators/profile.validator.js +31 -33
|
@@ -18,6 +18,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.dataPoolService = void 0;
|
|
21
22
|
const data_pool_api_1 = require("../../api/data-pool-api");
|
|
22
23
|
const logger_1 = require("../../util/logger");
|
|
23
24
|
const uuid_1 = require("uuid");
|
|
@@ -29,7 +30,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
29
30
|
const importReport = yield data_pool_api_1.dataPoolApi.executeDataPoolsBatchImport(requestFileContent);
|
|
30
31
|
const importReportString = JSON.stringify(importReport, null, 4);
|
|
31
32
|
if (outputToJsonFile) {
|
|
32
|
-
const reportFileName = "batch_import_report_" + uuid_1.v4() + ".json";
|
|
33
|
+
const reportFileName = "batch_import_report_" + (0, uuid_1.v4)() + ".json";
|
|
33
34
|
file_service_1.fileService.writeToFileWithGivenName(importReportString, reportFileName);
|
|
34
35
|
logger_1.logger.info("Batch import report file: " + reportFileName);
|
|
35
36
|
}
|
|
@@ -43,7 +44,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
44
|
const exportedDataPool = yield data_pool_api_1.dataPoolApi.exportDataPool(poolId);
|
|
44
45
|
const exportedDataPoolString = JSON.stringify(exportedDataPool, null, 4);
|
|
45
46
|
if (outputToJsonFile) {
|
|
46
|
-
const reportFileName = uuid_1.v4() + "_data_pool_" + poolId + ".json";
|
|
47
|
+
const reportFileName = (0, uuid_1.v4)() + "_data_pool_" + poolId + ".json";
|
|
47
48
|
file_service_1.fileService.writeToFileWithGivenName(exportedDataPoolString, reportFileName);
|
|
48
49
|
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + reportFileName);
|
|
49
50
|
}
|
|
@@ -79,7 +80,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
82
|
exportListOfPools(nodes) {
|
|
82
|
-
const filename = uuid_1.v4() + ".json";
|
|
83
|
+
const filename = (0, uuid_1.v4)() + ".json";
|
|
83
84
|
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(nodes), filename);
|
|
84
85
|
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
|
|
85
86
|
}
|
package/services/file-service.js
CHANGED
|
@@ -18,6 +18,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.fileService = exports.FileService = void 0;
|
|
21
22
|
const fs = require("fs");
|
|
22
23
|
const path = require("path");
|
|
23
24
|
const logger_1 = require("../util/logger");
|
|
@@ -32,7 +33,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
33
|
fs.mkdirSync(path.resolve(process.cwd(), dirName));
|
|
33
34
|
}
|
|
34
35
|
readManifestFile(importedFileName) {
|
|
35
|
-
const manifest = yaml_1.parse(fs.readFileSync(path.resolve(importedFileName + "/manifest.yml"), { encoding: "utf-8" }));
|
|
36
|
+
const manifest = (0, yaml_1.parse)(fs.readFileSync(path.resolve(importedFileName + "/manifest.yml"), { encoding: "utf-8" }));
|
|
36
37
|
return Promise.all(manifest);
|
|
37
38
|
}
|
|
38
39
|
readFileToJson(fileName) {
|
|
@@ -13,24 +13,29 @@ 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", "../interfaces/profile.interface", "
|
|
16
|
+
define(["require", "exports", "../interfaces/profile.interface", "./context.service", "../util/logger", "../util/tracing", "../util/version", "axios", "form-data"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.httpClientV2 = void 0;
|
|
21
22
|
const profile_interface_1 = require("../interfaces/profile.interface");
|
|
22
|
-
const request = require("request");
|
|
23
23
|
const context_service_1 = require("./context.service");
|
|
24
24
|
const logger_1 = require("../util/logger");
|
|
25
|
-
const querystring = require("querystring");
|
|
26
25
|
const tracing_1 = require("../util/tracing");
|
|
27
26
|
const version_1 = require("../util/version");
|
|
27
|
+
const axios_1 = require("axios");
|
|
28
|
+
const FormData = require("form-data");
|
|
28
29
|
class HttpClientServiceV2 {
|
|
29
30
|
get(url) {
|
|
30
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
32
|
return new Promise((resolve, reject) => {
|
|
32
|
-
|
|
33
|
-
this.
|
|
33
|
+
axios_1.default.get(this.resolveUrl(url), {
|
|
34
|
+
headers: this.buildHeaders(context_service_1.contextService.getContext().profile)
|
|
35
|
+
}).then(response => {
|
|
36
|
+
this.handleResponse(response, resolve, reject);
|
|
37
|
+
}).catch(err => {
|
|
38
|
+
this.handleError(err, resolve, reject);
|
|
34
39
|
});
|
|
35
40
|
}).catch(e => {
|
|
36
41
|
throw new logger_1.FatalError(e);
|
|
@@ -40,8 +45,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
40
45
|
postFile(url, body, parameters) {
|
|
41
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
47
|
return new Promise((resolve, reject) => {
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
const formData = new FormData();
|
|
49
|
+
formData.append("package", body.formData.package);
|
|
50
|
+
axios_1.default.post(this.resolveUrl(url), formData, {
|
|
51
|
+
headers: Object.assign(Object.assign({}, this.buildHeaders(context_service_1.contextService.getContext().profile, "multipart/form-data")), formData.getHeaders()),
|
|
52
|
+
params: parameters
|
|
53
|
+
}).then(response => {
|
|
54
|
+
this.handleResponse(response, resolve, reject);
|
|
55
|
+
}).catch(err => {
|
|
56
|
+
this.handleError(err, resolve, reject);
|
|
45
57
|
});
|
|
46
58
|
}).catch(e => {
|
|
47
59
|
throw new logger_1.FatalError(e);
|
|
@@ -51,8 +63,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
51
63
|
post(url, body) {
|
|
52
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
65
|
return new Promise((resolve, reject) => {
|
|
54
|
-
|
|
55
|
-
this.
|
|
66
|
+
axios_1.default.post(this.resolveUrl(url), typeof body === "string" || body instanceof String ? body : JSON.stringify(body), {
|
|
67
|
+
headers: this.buildHeaders(context_service_1.contextService.getContext().profile, "application/json;charset=utf-8")
|
|
68
|
+
}).then(response => {
|
|
69
|
+
this.handleResponse(response, resolve, reject);
|
|
70
|
+
}).catch(err => {
|
|
71
|
+
this.handleError(err, resolve, reject);
|
|
56
72
|
});
|
|
57
73
|
}).catch(e => {
|
|
58
74
|
throw new logger_1.FatalError(e);
|
|
@@ -62,8 +78,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
62
78
|
put(url, body) {
|
|
63
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
80
|
return new Promise((resolve, reject) => {
|
|
65
|
-
|
|
66
|
-
this.
|
|
81
|
+
axios_1.default.put(this.resolveUrl(url), JSON.stringify(body), {
|
|
82
|
+
headers: this.buildHeaders(context_service_1.contextService.getContext().profile, "application/json;charset=utf-8")
|
|
83
|
+
}).then(response => {
|
|
84
|
+
this.handleResponse(response, resolve, reject);
|
|
85
|
+
}).catch(err => {
|
|
86
|
+
this.handleError(err, resolve, reject);
|
|
67
87
|
});
|
|
68
88
|
}).catch(e => {
|
|
69
89
|
throw new logger_1.FatalError(e);
|
|
@@ -73,8 +93,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
73
93
|
delete(url) {
|
|
74
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
95
|
return new Promise((resolve, reject) => {
|
|
76
|
-
|
|
77
|
-
this.
|
|
96
|
+
axios_1.default.delete(this.resolveUrl(url), {
|
|
97
|
+
headers: this.buildHeaders(context_service_1.contextService.getContext().profile, "application/json;charset=utf-8")
|
|
98
|
+
}).then(response => {
|
|
99
|
+
this.handleResponse(response, resolve, reject);
|
|
100
|
+
}).catch(err => {
|
|
101
|
+
this.handleError(err, resolve, reject);
|
|
78
102
|
});
|
|
79
103
|
}).catch(e => {
|
|
80
104
|
throw new logger_1.FatalError(e);
|
|
@@ -84,23 +108,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
84
108
|
downloadFile(url) {
|
|
85
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
110
|
return new Promise((resolve, reject) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
111
|
+
axios_1.default.post(this.resolveUrl(url), null, {
|
|
112
|
+
headers: this.buildHeaders(context_service_1.contextService.getContext().profile),
|
|
113
|
+
responseType: "stream"
|
|
114
|
+
}).then(response => {
|
|
90
115
|
const data = [];
|
|
91
|
-
response.on("data", (chunk) => {
|
|
116
|
+
response.data.on("data", (chunk) => {
|
|
92
117
|
data.push(chunk);
|
|
93
118
|
});
|
|
94
|
-
response.on("end", () => {
|
|
95
|
-
if (this.checkBadRequest(response.
|
|
96
|
-
this.handleBadRequest(response.
|
|
119
|
+
response.data.on("end", () => {
|
|
120
|
+
if (this.checkBadRequest(response.status)) {
|
|
121
|
+
this.handleBadRequest(response.status, data.toString(), reject);
|
|
97
122
|
}
|
|
98
123
|
else {
|
|
99
124
|
this.handleResponseStreamData(Buffer.concat(data), resolve, reject);
|
|
100
125
|
}
|
|
101
126
|
});
|
|
102
|
-
})
|
|
103
|
-
.
|
|
127
|
+
}).catch(err => {
|
|
128
|
+
this.handleError(err, resolve, reject);
|
|
129
|
+
});
|
|
104
130
|
});
|
|
105
131
|
});
|
|
106
132
|
}
|
|
@@ -115,28 +141,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
115
141
|
resolveUrl(url) {
|
|
116
142
|
return context_service_1.contextService.getContext().profile.team.replace(/\/?$/, url);
|
|
117
143
|
}
|
|
118
|
-
makeFileDownloadOptions(profile) {
|
|
119
|
-
return {
|
|
120
|
-
headers: this.buildHeaders(profile),
|
|
121
|
-
responseType: "binary",
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
144
|
handleResponse(res, resolve, reject) {
|
|
125
|
-
if (this.checkBadRequest(res.
|
|
126
|
-
this.handleBadRequest(res.
|
|
145
|
+
if (this.checkBadRequest(res.status)) {
|
|
146
|
+
this.handleBadRequest(res.status, res.data, reject);
|
|
127
147
|
return;
|
|
128
148
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
149
|
+
resolve(res.data);
|
|
150
|
+
}
|
|
151
|
+
handleError(err, resolve, reject) {
|
|
152
|
+
if (err.response) {
|
|
153
|
+
this.handleResponse(err.response, resolve, reject);
|
|
134
154
|
}
|
|
135
|
-
|
|
136
|
-
reject(
|
|
137
|
-
return;
|
|
155
|
+
else {
|
|
156
|
+
reject(err.message);
|
|
138
157
|
}
|
|
139
|
-
resolve(body);
|
|
140
158
|
}
|
|
141
159
|
checkBadRequest(statusCode) {
|
|
142
160
|
return statusCode >= 400;
|
|
@@ -144,32 +162,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
144
162
|
// tslint:disable-next-line:typedef
|
|
145
163
|
handleBadRequest(statusCode, data, reject) {
|
|
146
164
|
if (data) {
|
|
147
|
-
reject(data);
|
|
165
|
+
reject(JSON.stringify(data));
|
|
148
166
|
}
|
|
149
167
|
else {
|
|
150
168
|
reject("Backend responded with status code " + statusCode);
|
|
151
169
|
}
|
|
152
170
|
}
|
|
153
|
-
makeOptions(profile, body = {}) {
|
|
154
|
-
const options = {
|
|
155
|
-
headers: this.buildHeaders(profile),
|
|
156
|
-
};
|
|
157
|
-
return Object.assign(options, body);
|
|
158
|
-
}
|
|
159
|
-
makeOptionsJson(profile, body, contentType) {
|
|
160
|
-
return {
|
|
161
|
-
headers: this.buildHeaders(profile, contentType),
|
|
162
|
-
body: body,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
171
|
buildHeaders(profile, contentType) {
|
|
166
172
|
return Object.assign(Object.assign(Object.assign({}, this.buildAuthorizationHeaders(profile, contentType)), tracing_1.TracingUtils.getTracingHeaders()), { "User-Agent": "content-cli v" + version_1.VersionUtils.getCurrentCliVersion() });
|
|
167
173
|
}
|
|
168
174
|
buildAuthorizationHeaders(profile, contentType) {
|
|
169
175
|
const authenticationType = profile.authenticationType || profile_interface_1.AuthenticationType.BEARER;
|
|
170
176
|
return {
|
|
171
|
-
|
|
172
|
-
"
|
|
177
|
+
Authorization: `${authenticationType} ${profile.apiToken}`,
|
|
178
|
+
"Content-Type": contentType !== null && contentType !== void 0 ? contentType : "application/json",
|
|
173
179
|
};
|
|
174
180
|
}
|
|
175
181
|
}
|
|
@@ -13,20 +13,30 @@ 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", "../interfaces/profile.interface", "../util/logger", "
|
|
16
|
+
define(["require", "exports", "../interfaces/profile.interface", "../util/logger", "axios", "form-data"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.HttpClientService = void 0;
|
|
21
22
|
const profile_interface_1 = require("../interfaces/profile.interface");
|
|
22
23
|
const logger_1 = require("../util/logger");
|
|
23
|
-
const
|
|
24
|
+
const axios_1 = require("axios");
|
|
25
|
+
const FormData = require("form-data");
|
|
24
26
|
class HttpClientService {
|
|
25
27
|
pushData(url, profile, body) {
|
|
26
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
29
|
return new Promise((resolve, reject) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
const headers = this.buildAuthorizationHeaders(profile);
|
|
31
|
+
if (body instanceof FormData) {
|
|
32
|
+
headers["Content-Type"] = "multipart/form-data";
|
|
33
|
+
}
|
|
34
|
+
axios_1.default.post(url, body, {
|
|
35
|
+
headers
|
|
36
|
+
}).then(response => {
|
|
37
|
+
this.handleResponse(response, resolve, reject);
|
|
38
|
+
}).catch(err => {
|
|
39
|
+
this.handleError(err, resolve, reject);
|
|
30
40
|
});
|
|
31
41
|
});
|
|
32
42
|
});
|
|
@@ -34,8 +44,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
44
|
pullData(url, profile) {
|
|
35
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
46
|
return new Promise((resolve, reject) => {
|
|
37
|
-
|
|
38
|
-
this.
|
|
47
|
+
axios_1.default.get(url, {
|
|
48
|
+
headers: this.buildAuthorizationHeaders(profile)
|
|
49
|
+
}).then(response => {
|
|
50
|
+
this.handleResponse(response, resolve, reject);
|
|
51
|
+
}).catch(err => {
|
|
52
|
+
this.handleError(err, resolve, reject);
|
|
39
53
|
});
|
|
40
54
|
});
|
|
41
55
|
});
|
|
@@ -43,31 +57,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
57
|
pullFileData(url, profile) {
|
|
44
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
59
|
return new Promise((resolve, reject) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
60
|
+
axios_1.default.post(url, null, {
|
|
61
|
+
headers: this.buildAuthorizationHeaders(profile),
|
|
62
|
+
responseType: "stream"
|
|
63
|
+
}).then(response => {
|
|
49
64
|
const data = [];
|
|
50
|
-
response.on("data", (chunk) => {
|
|
65
|
+
response.data.on("data", (chunk) => {
|
|
51
66
|
data.push(chunk);
|
|
52
67
|
});
|
|
53
|
-
response.on("end", () => {
|
|
54
|
-
if (this.checkBadRequest(response.
|
|
55
|
-
this.handleBadRequest(response.
|
|
68
|
+
response.data.on("end", () => {
|
|
69
|
+
if (this.checkBadRequest(response.status)) {
|
|
70
|
+
this.handleBadRequest(response.status, data.toString(), reject);
|
|
56
71
|
}
|
|
57
72
|
else {
|
|
58
73
|
this.handleResponseStreamData(Buffer.concat(data), resolve, reject);
|
|
59
74
|
}
|
|
60
75
|
});
|
|
61
|
-
})
|
|
62
|
-
.
|
|
76
|
+
}).catch(err => {
|
|
77
|
+
this.handleError(err, resolve, reject);
|
|
78
|
+
});
|
|
63
79
|
});
|
|
64
80
|
});
|
|
65
81
|
}
|
|
66
82
|
updateData(url, profile, body) {
|
|
67
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
84
|
return new Promise((resolve, reject) => {
|
|
69
|
-
|
|
70
|
-
this.
|
|
85
|
+
axios_1.default.put(url, body, {
|
|
86
|
+
headers: this.buildAuthorizationHeaders(profile)
|
|
87
|
+
}).then(response => {
|
|
88
|
+
this.handleResponse(response, resolve, reject);
|
|
89
|
+
}).catch(err => {
|
|
90
|
+
this.handleError(err, resolve, reject);
|
|
71
91
|
});
|
|
72
92
|
});
|
|
73
93
|
});
|
|
@@ -75,29 +95,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
75
95
|
findAll(url, profile) {
|
|
76
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
97
|
return new Promise((resolve, reject) => {
|
|
78
|
-
|
|
79
|
-
this.
|
|
98
|
+
axios_1.default.get(url, {
|
|
99
|
+
headers: this.buildAuthorizationHeaders(profile)
|
|
100
|
+
}).then(response => {
|
|
101
|
+
this.handleResponse(response, resolve, reject);
|
|
102
|
+
}).catch(err => {
|
|
103
|
+
this.handleError(err, resolve, reject);
|
|
80
104
|
});
|
|
81
105
|
});
|
|
82
106
|
});
|
|
83
107
|
}
|
|
84
|
-
makeOptions(profile, body = {}) {
|
|
85
|
-
const options = {
|
|
86
|
-
headers: this.buildAuthorizationHeaders(profile),
|
|
87
|
-
};
|
|
88
|
-
return Object.assign(options, body);
|
|
89
|
-
}
|
|
90
|
-
makeFileDownloadOptions(profile) {
|
|
91
|
-
return {
|
|
92
|
-
headers: this.buildAuthorizationHeaders(profile),
|
|
93
|
-
responseType: "binary",
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
108
|
buildAuthorizationHeaders(profile) {
|
|
97
109
|
const authenticationType = profile.authenticationType || profile_interface_1.AuthenticationType.BEARER;
|
|
98
110
|
return {
|
|
99
|
-
|
|
100
|
-
"
|
|
111
|
+
Authorization: `${authenticationType} ${profile.apiToken}`,
|
|
112
|
+
"Content-Type": "application/json",
|
|
101
113
|
};
|
|
102
114
|
}
|
|
103
115
|
// tslint:disable-next-line:typedef
|
|
@@ -111,21 +123,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
111
123
|
}
|
|
112
124
|
// tslint:disable-next-line:typedef
|
|
113
125
|
handleResponse(res, resolve, reject) {
|
|
114
|
-
if (this.checkBadRequest(res.
|
|
115
|
-
this.handleBadRequest(res.
|
|
126
|
+
if (this.checkBadRequest(res.status)) {
|
|
127
|
+
this.handleBadRequest(res.status, res.data, reject);
|
|
116
128
|
return;
|
|
117
129
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
130
|
+
resolve(res.data);
|
|
131
|
+
}
|
|
132
|
+
handleError(err, resolve, reject) {
|
|
133
|
+
if (err.response) {
|
|
134
|
+
this.handleResponse(err.response, resolve, reject);
|
|
123
135
|
}
|
|
124
|
-
|
|
125
|
-
reject(
|
|
126
|
-
return;
|
|
136
|
+
else {
|
|
137
|
+
reject(err.message);
|
|
127
138
|
}
|
|
128
|
-
resolve(body);
|
|
129
139
|
}
|
|
130
140
|
checkBadRequest(statusCode) {
|
|
131
141
|
return statusCode >= 400;
|
|
@@ -133,7 +143,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
133
143
|
// tslint:disable-next-line:typedef
|
|
134
144
|
handleBadRequest(statusCode, data, reject) {
|
|
135
145
|
if (data) {
|
|
136
|
-
reject(data);
|
|
146
|
+
reject(JSON.stringify(data));
|
|
137
147
|
}
|
|
138
148
|
else {
|
|
139
149
|
reject("Backend responded with status code " + statusCode);
|
|
@@ -18,6 +18,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.assetService = void 0;
|
|
21
22
|
const logger_1 = require("../../util/logger");
|
|
22
23
|
const asset_api_1 = require("../../api/asset-api");
|
|
23
24
|
const uuid_1 = require("uuid");
|
|
@@ -38,7 +39,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
38
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
40
|
const fieldsToInclude = ["key", "name", "assetType", "rootNodeKey", "activatedDraftId"];
|
|
40
41
|
const nodes = yield asset_api_1.assetApi.findAllAssets(assetType);
|
|
41
|
-
const filename = uuid_1.v4() + ".json";
|
|
42
|
+
const filename = (0, uuid_1.v4)() + ".json";
|
|
42
43
|
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(nodes, fieldsToInclude), filename);
|
|
43
44
|
logger_1.logger.info(this.fileDownloadedMessage + filename);
|
|
44
45
|
});
|
|
@@ -18,6 +18,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.dataModelService = void 0;
|
|
21
22
|
const compute_pool_api_1 = require("../../api/compute-pool-api");
|
|
22
23
|
class DataModelService {
|
|
23
24
|
getDataModelDetailsForPackages(packagesWithDataModelVariables) {
|
|
@@ -18,6 +18,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.packageService = void 0;
|
|
21
22
|
const logger_1 = require("../../util/logger");
|
|
22
23
|
const package_api_1 = require("../../api/package-api");
|
|
23
24
|
const uuid_1 = require("uuid");
|
|
@@ -82,7 +83,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
82
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
84
|
exportedPackagesFile = exportedPackagesFile + (exportedPackagesFile.includes(".zip") ? "" : ".zip");
|
|
84
85
|
const zip = new AdmZip(exportedPackagesFile);
|
|
85
|
-
const importedFilePath = path.resolve(os_1.tmpdir(), "export_" + uuid_1.v4());
|
|
86
|
+
const importedFilePath = path.resolve((0, os_1.tmpdir)(), "export_" + (0, uuid_1.v4)());
|
|
86
87
|
yield fs.mkdirSync(importedFilePath);
|
|
87
88
|
yield zip.extractAllTo(importedFilePath);
|
|
88
89
|
const manifestNodes = yield file_service_1.fileService.readManifestFile(importedFilePath);
|
|
@@ -384,7 +385,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
384
385
|
return nodePath.includes(nodeKey + ":" + version);
|
|
385
386
|
}
|
|
386
387
|
exportListOfPackages(nodes, fieldsToInclude) {
|
|
387
|
-
const filename = uuid_1.v4() + ".json";
|
|
388
|
+
const filename = (0, uuid_1.v4)() + ".json";
|
|
388
389
|
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(nodes, fieldsToInclude), filename);
|
|
389
390
|
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
|
|
390
391
|
}
|
|
@@ -407,11 +408,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
407
408
|
const manifestNodes = this.exportManifestOfPackages(nodes, versionsByNodeKey);
|
|
408
409
|
const packageZips = yield this.exportPackagesAndAssets(nodes);
|
|
409
410
|
const zip = new AdmZip();
|
|
410
|
-
zip.addFile("manifest.yml", Buffer.from(yaml_1.stringify(manifestNodes), "utf8"));
|
|
411
|
+
zip.addFile("manifest.yml", Buffer.from((0, yaml_1.stringify)(manifestNodes), "utf8"));
|
|
411
412
|
for (const packageZip of packageZips) {
|
|
412
413
|
zip.addFile(`${packageZip.packageKey}_${packageZip.version}.zip`, packageZip.data);
|
|
413
414
|
}
|
|
414
|
-
const fileName = "export_" + uuid_1.v4() + ".zip";
|
|
415
|
+
const fileName = "export_" + (0, uuid_1.v4)() + ".zip";
|
|
415
416
|
zip.writeZip(fileName);
|
|
416
417
|
logger_1.logger.info(this.fileDownloadedMessage + fileName);
|
|
417
418
|
});
|
|
@@ -18,6 +18,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.spaceService = void 0;
|
|
21
22
|
const space_api_1 = require("../../api/space-api");
|
|
22
23
|
const uuid_1 = require("uuid");
|
|
23
24
|
class SpaceService {
|
|
@@ -39,7 +40,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
39
40
|
createSpace(spaceName, spaceIcon) {
|
|
40
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
42
|
const newSpace = yield space_api_1.spaceApi.createSpace({
|
|
42
|
-
id: uuid_1.v4(),
|
|
43
|
+
id: (0, uuid_1.v4)(),
|
|
43
44
|
name: spaceName,
|
|
44
45
|
iconReference: spaceIcon
|
|
45
46
|
});
|
|
@@ -18,6 +18,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.variableService = void 0;
|
|
21
22
|
const package_api_1 = require("../../api/package-api");
|
|
22
23
|
const variables_api_1 = require("../../api/variables-api");
|
|
23
24
|
const uuid_1 = require("uuid");
|
|
@@ -48,7 +49,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
48
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
50
|
const parsedParams = this.parseParams(params);
|
|
50
51
|
const assignments = yield variables_api_1.variablesApi.getCandidateAssignments(type, parsedParams);
|
|
51
|
-
const filename = uuid_1.v4() + ".json";
|
|
52
|
+
const filename = (0, uuid_1.v4)() + ".json";
|
|
52
53
|
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(assignments), filename);
|
|
53
54
|
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
|
|
54
55
|
});
|
|
@@ -18,6 +18,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.profileService = exports.ProfileService = void 0;
|
|
21
22
|
const profile_interface_1 = require("../interfaces/profile.interface");
|
|
22
23
|
const profile_validator_1 = require("../validators/profile.validator");
|
|
23
24
|
const path = require("path");
|
|
@@ -18,6 +18,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.QuestionService = void 0;
|
|
21
22
|
const readline = require("readline");
|
|
22
23
|
class QuestionService {
|
|
23
24
|
static ask(question) {
|
|
@@ -18,6 +18,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.ContextInitializer = void 0;
|
|
21
22
|
const logger_1 = require("./logger");
|
|
22
23
|
const context_service_1 = require("../services/context.service");
|
|
23
24
|
const commander = require("commander");
|
package/util/logger.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GracefulError = exports.FatalError = exports.logger = void 0;
|
|
12
13
|
const winston = require("winston");
|
|
13
14
|
const Transport = require("winston-transport");
|
|
14
15
|
class CustomTransport extends Transport {
|
package/util/tracing.js
CHANGED
package/util/version.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.VersionUtils = void 0;
|
|
12
13
|
// tslint:disable-next-line:no-var-requires
|
|
13
14
|
const { version } = require("./../package.json");
|
|
14
15
|
class VersionUtils {
|
package/util/yaml.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.parse = exports.stringify = void 0;
|
|
12
13
|
const YAML = require("yaml");
|
|
13
14
|
function stringify(data) {
|
|
14
15
|
return YAML.stringify(data, { doubleQuotedAsJSON: true, indent: 2, lineWidth: 200 });
|