@celonis/content-cli 1.14.0 → 1.15.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/commands/action-flows/action-flow/action-flow.service.js +9 -9
- package/commands/asset-registry/asset-registry-api.js +0 -7
- package/commands/asset-registry/asset-registry.service.js +18 -63
- package/commands/asset-registry/module.js +0 -21
- package/commands/bookmarks/bookmarks-command.service.js +5 -3
- package/commands/configuration-management/api/node-api.js +17 -0
- package/commands/configuration-management/branch/branch-export-import.command.service.js +31 -24
- package/commands/configuration-management/branch/branch.command.service.js +14 -10
- package/commands/configuration-management/metadata.service.js +9 -5
- package/commands/configuration-management/module.js +6 -5
- package/commands/configuration-management/node-dependency.service.js +5 -3
- package/commands/configuration-management/node-diff.service.js +10 -6
- package/commands/configuration-management/node.service.js +14 -10
- package/commands/configuration-management/package-validation.service.js +11 -5
- package/commands/configuration-management/package-version.service.js +7 -5
- package/commands/configuration-management/single-package-export.service.js +6 -6
- package/commands/configuration-management/single-package-import.service.js +22 -18
- package/commands/configuration-management/staging-package.service.js +9 -5
- package/commands/configuration-management/variable.service.js +11 -7
- package/commands/data-pipeline/data-pool/data-pool-service.js +13 -9
- package/commands/deployment/deployment.service.js +15 -13
- package/commands/git-profile/module.js +2 -1
- package/commands/profile/module.js +2 -1
- package/commands/studio/manager/space.manager.js +21 -10
- package/commands/studio/service/asset-service.js +5 -4
- package/commands/studio/service/package.service.js +9 -5
- package/commands/t2tc/diff.service.js +15 -9
- package/commands/t2tc/t2tc-package.service.js +25 -23
- package/content-cli.js +10 -2
- package/core/command/module-handler.js +14 -1
- package/core/http/http-client.js +24 -3
- package/core/http/http-shared/base.manager.js +35 -59
- package/core/profile/profile.service.js +35 -21
- package/core/profile/profile.validator.js +19 -9
- package/core/utils/cui-api.js +52 -0
- package/core/utils/cui-file-service.js +106 -0
- package/core/utils/file-service.js +7 -6
- package/lib/commands/action-flows/action-flow/action-flow.service.d.ts +1 -0
- package/lib/commands/asset-registry/asset-registry-api.d.ts +0 -1
- package/lib/commands/asset-registry/asset-registry.interfaces.d.ts +0 -8
- package/lib/commands/asset-registry/asset-registry.service.d.ts +1 -5
- package/lib/commands/asset-registry/module.d.ts +0 -1
- package/lib/commands/bookmarks/bookmarks-command.service.d.ts +1 -0
- package/lib/commands/configuration-management/api/node-api.d.ts +1 -0
- package/lib/commands/configuration-management/branch/branch-export-import.command.service.d.ts +2 -1
- package/lib/commands/configuration-management/branch/branch.command.service.d.ts +2 -1
- package/lib/commands/configuration-management/interfaces/package-validation.interfaces.d.ts +1 -1
- package/lib/commands/configuration-management/metadata.service.d.ts +1 -0
- package/lib/commands/configuration-management/node-dependency.service.d.ts +1 -0
- package/lib/commands/configuration-management/node-diff.service.d.ts +1 -0
- package/lib/commands/configuration-management/node.service.d.ts +2 -1
- package/lib/commands/configuration-management/package-validation.service.d.ts +1 -0
- package/lib/commands/configuration-management/package-version.service.d.ts +1 -0
- package/lib/commands/configuration-management/single-package-export.service.d.ts +1 -0
- package/lib/commands/configuration-management/single-package-import.service.d.ts +1 -0
- package/lib/commands/configuration-management/staging-package.service.d.ts +1 -0
- package/lib/commands/configuration-management/variable.service.d.ts +1 -0
- package/lib/commands/data-pipeline/data-pool/data-pool-service.d.ts +1 -0
- package/lib/commands/deployment/deployment.service.d.ts +1 -0
- package/lib/commands/studio/service/asset-service.d.ts +1 -0
- package/lib/commands/studio/service/package.service.d.ts +1 -0
- package/lib/commands/t2tc/diff.service.d.ts +1 -0
- package/lib/commands/t2tc/t2tc-package.service.d.ts +1 -0
- package/lib/content-cli.d.ts +1 -0
- package/lib/core/command/module-handler.d.ts +2 -0
- package/lib/core/http/http-client.d.ts +4 -0
- package/lib/core/http/http-shared/base.manager.d.ts +7 -5
- package/lib/core/http/http-shared/manager-config.interface.d.ts +1 -1
- package/lib/core/profile/profile.service.d.ts +2 -0
- package/lib/core/profile/profile.validator.d.ts +3 -0
- package/lib/core/utils/cui-api.d.ts +26 -0
- package/lib/core/utils/cui-file-service.d.ts +19 -0
- package/package.json +1 -1
|
@@ -72,15 +72,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
72
72
|
.catch(() => reject(`The profile ${profileName} couldn't be resolved.`));
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
else if (process.env.TEAM_URL && process.env.API_TOKEN) {
|
|
76
|
-
resolve(this.buildProfileFromEnvVariables());
|
|
77
|
-
}
|
|
78
|
-
else if (process.env.CELONIS_URL && process.env.CELONIS_API_TOKEN) {
|
|
79
|
-
this.mapCelonisEnvProfile();
|
|
80
|
-
resolve(this.buildProfileFromEnvVariables());
|
|
81
|
-
}
|
|
82
75
|
else {
|
|
83
|
-
|
|
76
|
+
const envProfileSource = this.selectEnvProfileSource();
|
|
77
|
+
if (envProfileSource) {
|
|
78
|
+
if (envProfileSource.requiresCelonisMapping) {
|
|
79
|
+
this.mapCelonisEnvProfile();
|
|
80
|
+
}
|
|
81
|
+
resolve(this.buildProfileFromEnvVariables());
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
reject(`The profile ${profileName} couldn't be resolved due to missing environment variables.`);
|
|
85
|
+
}
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
catch (e) {
|
|
@@ -136,6 +138,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
136
138
|
});
|
|
137
139
|
});
|
|
138
140
|
}
|
|
141
|
+
selectEnvProfileSource() {
|
|
142
|
+
var _a, _b;
|
|
143
|
+
const sources = [
|
|
144
|
+
{ teamUrl: process.env.TEAM_URL, apiToken: process.env.API_TOKEN, requiresCelonisMapping: false },
|
|
145
|
+
{ teamUrl: process.env.CELONIS_URL, apiToken: process.env.CELONIS_API_TOKEN, requiresCelonisMapping: true },
|
|
146
|
+
].filter(source => !!source.teamUrl);
|
|
147
|
+
return (_b = (_a = sources.find(source => !!source.apiToken)) !== null && _a !== void 0 ? _a : sources[0]) !== null && _b !== void 0 ? _b : null;
|
|
148
|
+
}
|
|
139
149
|
buildProfileFromEnvVariables() {
|
|
140
150
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
151
|
const profileVariables = this.getProfileEnvVariables();
|
|
@@ -146,7 +156,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
146
156
|
authenticationType: profile_interface_1.AuthenticationType.BEARER,
|
|
147
157
|
type: profile_interface_1.ProfileType.KEY
|
|
148
158
|
};
|
|
149
|
-
|
|
159
|
+
profile_validator_1.ProfileValidator.validateEnvironmentProfile(profile);
|
|
160
|
+
if (!profile.apiToken) {
|
|
161
|
+
logger_1.logger.warn(`No API token provided. Requests to ${profile.team} will be sent without an authorization header.`);
|
|
162
|
+
}
|
|
150
163
|
return profile;
|
|
151
164
|
});
|
|
152
165
|
}
|
|
@@ -266,9 +279,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
266
279
|
if (!this.isProfileExpired(profile, expiryBuffer)) {
|
|
267
280
|
return;
|
|
268
281
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
282
|
+
try {
|
|
283
|
+
const issuer = yield openid_client_1.Issuer.discover(profile.team);
|
|
284
|
+
if (profile.type === profile_interface_1.ProfileType.DEVICE_CODE) {
|
|
272
285
|
const oauthClient = new issuer.Client({
|
|
273
286
|
client_id: "content-cli",
|
|
274
287
|
token_endpoint_auth_method: "none",
|
|
@@ -278,12 +291,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
278
291
|
profile.expiresAt = tokenSet.expires_at;
|
|
279
292
|
profile.refreshToken = tokenSet.refresh_token;
|
|
280
293
|
}
|
|
281
|
-
|
|
282
|
-
logger_1.logger.error(new logger_1.FatalError("The profile cannot be refreshed. Please retry or recreate profile."));
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
try {
|
|
294
|
+
else {
|
|
287
295
|
const oauthClient = new issuer.Client({
|
|
288
296
|
client_id: profile.clientId,
|
|
289
297
|
client_secret: profile.clientSecret,
|
|
@@ -296,13 +304,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
296
304
|
profile.apiToken = tokenSet.access_token;
|
|
297
305
|
profile.expiresAt = tokenSet.expires_at;
|
|
298
306
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
307
|
+
}
|
|
308
|
+
catch (err) {
|
|
309
|
+
throw this.unrefreshableProfile(profile.name, err);
|
|
302
310
|
}
|
|
303
311
|
yield this.storeProfile(profile);
|
|
304
312
|
});
|
|
305
313
|
}
|
|
314
|
+
unrefreshableProfile(profileName, err) {
|
|
315
|
+
const cause = err instanceof Error ? err.message : "an unrecognised error";
|
|
316
|
+
logger_1.logger.debug(`Refreshing the profile ${profileName} failed: ${cause}`);
|
|
317
|
+
logger_1.logger.warn(`The profile ${profileName} cannot be refreshed. Retry, or recreate it.`);
|
|
318
|
+
return new Error(`The profile ${profileName} cannot be refreshed.`);
|
|
319
|
+
}
|
|
306
320
|
getProfileEnvVariables() {
|
|
307
321
|
return {
|
|
308
322
|
teamUrl: this.getBaseTeamUrl(process.env.TEAM_URL),
|
|
@@ -25,23 +25,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
25
25
|
class ProfileValidator {
|
|
26
26
|
static validateProfile(profile) {
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
|
|
29
|
-
logger_1.logger.error(new logger_1.FatalError("The name can not be empty"));
|
|
30
|
-
}
|
|
31
|
-
if (profile.team == null) {
|
|
32
|
-
logger_1.logger.error(new logger_1.FatalError("The team can not be empty"));
|
|
33
|
-
}
|
|
28
|
+
this.validateIdentity(profile);
|
|
34
29
|
if (profile.type === profile_interface_1.ProfileType.KEY && profile.apiToken == null) {
|
|
35
30
|
logger_1.logger.error(new logger_1.FatalError("The api token can not be empty for this profile type"));
|
|
36
31
|
}
|
|
37
32
|
if (profile.type === profile_interface_1.ProfileType.CLIENT_CREDENTIALS && (profile.clientId == null || profile.clientSecret == null)) {
|
|
38
33
|
logger_1.logger.error(new logger_1.FatalError("The client id and secret can not be empty for this profile type"));
|
|
39
34
|
}
|
|
40
|
-
|
|
41
|
-
logger_1.logger.error(new logger_1.FatalError("The provided url is not a valid url."));
|
|
42
|
-
}
|
|
35
|
+
this.validateTeamUrl(profile);
|
|
43
36
|
});
|
|
44
37
|
}
|
|
38
|
+
static validateEnvironmentProfile(profile) {
|
|
39
|
+
this.validateIdentity(profile);
|
|
40
|
+
this.validateTeamUrl(profile);
|
|
41
|
+
}
|
|
42
|
+
static validateIdentity(profile) {
|
|
43
|
+
if (profile.name == null) {
|
|
44
|
+
logger_1.logger.error(new logger_1.FatalError("The name can not be empty"));
|
|
45
|
+
}
|
|
46
|
+
if (profile.team == null) {
|
|
47
|
+
logger_1.logger.error(new logger_1.FatalError("The team can not be empty"));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
static validateTeamUrl(profile) {
|
|
51
|
+
if (!validUrl.isUri(profile.team)) {
|
|
52
|
+
logger_1.logger.error(new logger_1.FatalError("The provided url is not a valid url."));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
45
55
|
}
|
|
46
56
|
exports.ProfileValidator = ProfileValidator;
|
|
47
57
|
});
|
|
@@ -0,0 +1,52 @@
|
|
|
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", "./logger"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.CuiApi = exports.CuiMarking = exports.CUI_MARKING_FAILED_MESSAGE = void 0;
|
|
22
|
+
const logger_1 = require("./logger");
|
|
23
|
+
exports.CUI_MARKING_FAILED_MESSAGE = "Could not resolve CUI marking. No file was written";
|
|
24
|
+
var CuiMarking;
|
|
25
|
+
(function (CuiMarking) {
|
|
26
|
+
CuiMarking["DISABLED"] = "DISABLED";
|
|
27
|
+
CuiMarking["CLASSIFIED"] = "CLASSIFIED";
|
|
28
|
+
})(CuiMarking || (exports.CuiMarking = CuiMarking = {}));
|
|
29
|
+
class CuiApi {
|
|
30
|
+
constructor(context) {
|
|
31
|
+
this.httpClient = () => context.httpClient;
|
|
32
|
+
}
|
|
33
|
+
getCuiMarking() {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const { status, data } = yield this.httpClient().getStatusAndData(CuiApi.CUI_PDF_COVER_SHEET_URL);
|
|
36
|
+
if (status === CuiApi.STATUS_FORBIDDEN) {
|
|
37
|
+
logger_1.logger.debug("CUI marking does not apply, the feature flag is disabled");
|
|
38
|
+
return { marking: CuiMarking.DISABLED };
|
|
39
|
+
}
|
|
40
|
+
if (status === CuiApi.STATUS_OK && data) {
|
|
41
|
+
return { marking: CuiMarking.CLASSIFIED, cover: data };
|
|
42
|
+
}
|
|
43
|
+
logger_1.logger.debug(`The CUI cover call answered with status ${status}`);
|
|
44
|
+
throw new logger_1.FatalError(exports.CUI_MARKING_FAILED_MESSAGE);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.CuiApi = CuiApi;
|
|
49
|
+
CuiApi.CUI_PDF_COVER_SHEET_URL = "/api/team/cui-settings/cui-pdf-cover";
|
|
50
|
+
CuiApi.STATUS_OK = 200;
|
|
51
|
+
CuiApi.STATUS_FORBIDDEN = 403;
|
|
52
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
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", "node:path", "adm-zip", "./cui-api", "./file-service", "./file.constants", "./logger"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.CuiFileService = void 0;
|
|
22
|
+
const path = require("node:path");
|
|
23
|
+
const AdmZip = require("adm-zip");
|
|
24
|
+
const cui_api_1 = require("./cui-api");
|
|
25
|
+
const file_service_1 = require("./file-service");
|
|
26
|
+
const file_constants_1 = require("./file.constants");
|
|
27
|
+
const logger_1 = require("./logger");
|
|
28
|
+
class CuiFileService {
|
|
29
|
+
constructor(context) {
|
|
30
|
+
this.cuiApi = new cui_api_1.CuiApi(context);
|
|
31
|
+
}
|
|
32
|
+
writeToFileWithGivenName(data, filename) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return this.writeWithCoverHandling(name => file_service_1.fileService.writeToFileWithGivenName(data, name), filename, cover => this.writeClassifiedArchive(filename, data, cover));
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
writeZipToFileWithGivenName(zipData, filename) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return this.writeWithCoverHandling(name => file_service_1.fileService.writeBufferToFileWithGivenName(zipData, name), filename, cover => {
|
|
40
|
+
const zip = new AdmZip(zipData);
|
|
41
|
+
this.addCoverPage(zip, cover);
|
|
42
|
+
return this.writeArchive(zip, filename);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
writeDirectoryWithGivenName(write, directoryName) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
return this.writeWithCoverHandling(write, directoryName, cover => {
|
|
49
|
+
const coverSheet = this.decodeCoverPage(cover);
|
|
50
|
+
const classifiedName = this.prefixFileName(directoryName, CuiFileService.CLASSIFIED_PREFIX);
|
|
51
|
+
write(classifiedName);
|
|
52
|
+
file_service_1.fileService.writeBufferToFileWithGivenName(coverSheet, path.join(classifiedName, CuiFileService.COVER_SHEET_FILE_NAME));
|
|
53
|
+
return classifiedName;
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
writeWithCoverHandling(write, filename, onClassified) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const decision = yield this.cuiApi.getCuiMarking();
|
|
60
|
+
if (decision.marking === cui_api_1.CuiMarking.DISABLED) {
|
|
61
|
+
write(filename);
|
|
62
|
+
return filename;
|
|
63
|
+
}
|
|
64
|
+
return onClassified(decision.cover);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
writeClassifiedArchive(filename, data, cover) {
|
|
68
|
+
const zip = new AdmZip();
|
|
69
|
+
zip.addFile(path.basename(filename), Buffer.from(data, "utf-8"), "", file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS);
|
|
70
|
+
this.addCoverPage(zip, cover);
|
|
71
|
+
return this.writeArchive(zip, filename);
|
|
72
|
+
}
|
|
73
|
+
addCoverPage(zip, cover) {
|
|
74
|
+
zip.addFile(CuiFileService.COVER_SHEET_FILE_NAME, this.decodeCoverPage(cover), "", file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS);
|
|
75
|
+
}
|
|
76
|
+
writeArchive(zip, filename) {
|
|
77
|
+
const archiveName = this.buildClassifiedArchiveName(filename);
|
|
78
|
+
file_service_1.fileService.writeBufferToFileWithGivenName(zip.toBuffer(), archiveName);
|
|
79
|
+
return archiveName;
|
|
80
|
+
}
|
|
81
|
+
decodeCoverPage(cover) {
|
|
82
|
+
const coverPage = cover.coverPage;
|
|
83
|
+
if (!(coverPage === null || coverPage === void 0 ? void 0 : coverPage.pdfContent)) {
|
|
84
|
+
logger_1.logger.debug("CUI marking applies but the response contained no cover page");
|
|
85
|
+
throw new logger_1.FatalError(cui_api_1.CUI_MARKING_FAILED_MESSAGE);
|
|
86
|
+
}
|
|
87
|
+
if (coverPage.encoding !== CuiFileService.BASE64_ENCODING) {
|
|
88
|
+
logger_1.logger.debug(`Unsupported CUI cover page encoding: ${coverPage.encoding}`);
|
|
89
|
+
throw new logger_1.FatalError(cui_api_1.CUI_MARKING_FAILED_MESSAGE);
|
|
90
|
+
}
|
|
91
|
+
return Buffer.from(coverPage.pdfContent, CuiFileService.BASE64_ENCODING);
|
|
92
|
+
}
|
|
93
|
+
buildClassifiedArchiveName(filename) {
|
|
94
|
+
const baseName = path.basename(filename);
|
|
95
|
+
const nameWithoutExtension = baseName.slice(0, baseName.length - path.extname(baseName).length);
|
|
96
|
+
return path.join(path.dirname(filename), `${CuiFileService.CLASSIFIED_PREFIX}${nameWithoutExtension}.zip`);
|
|
97
|
+
}
|
|
98
|
+
prefixFileName(filename, prefix) {
|
|
99
|
+
return path.join(path.dirname(filename), `${prefix}${path.basename(filename)}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.CuiFileService = CuiFileService;
|
|
103
|
+
CuiFileService.COVER_SHEET_FILE_NAME = "CUI_Cover_Sheet.pdf";
|
|
104
|
+
CuiFileService.CLASSIFIED_PREFIX = "CUI - ";
|
|
105
|
+
CuiFileService.BASE64_ENCODING = "base64";
|
|
106
|
+
});
|
|
@@ -57,11 +57,12 @@
|
|
|
57
57
|
return this.extractExportedZipWithNestedZipsToDir(zipFile, tempDir);
|
|
58
58
|
}
|
|
59
59
|
extractExportedZipWithNestedZipsToDir(zipFile, targetDir) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const targetPath = path.resolve(process.cwd(), targetDir);
|
|
61
|
+
this.mkdirRecursive(targetPath);
|
|
62
|
+
zipFile.extractAllTo(targetPath, true, true);
|
|
63
|
+
const files = fs.readdirSync(targetPath);
|
|
63
64
|
for (const file of files) {
|
|
64
|
-
const innerZipPath = path.join(
|
|
65
|
+
const innerZipPath = path.join(targetPath, file);
|
|
65
66
|
if (file.endsWith(".zip")) {
|
|
66
67
|
const nestedZip = new AdmZip(innerZipPath);
|
|
67
68
|
const nestedDir = innerZipPath.replace(/\.zip$/, "");
|
|
@@ -70,8 +71,8 @@
|
|
|
70
71
|
fs.rmSync(innerZipPath); // Optionally remove the inner zip
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
|
-
this.restrictFilePermissions(
|
|
74
|
-
return
|
|
74
|
+
this.restrictFilePermissions(targetPath);
|
|
75
|
+
return targetPath;
|
|
75
76
|
}
|
|
76
77
|
isDirectory(sourcePath) {
|
|
77
78
|
var _a;
|
|
@@ -2,6 +2,7 @@ import { Context } from "../../../core/command/cli-context";
|
|
|
2
2
|
export declare class ActionFlowService {
|
|
3
3
|
static readonly METADATA_FILE_NAME = "metadata.json";
|
|
4
4
|
private actionFlowApi;
|
|
5
|
+
private readonly cuiFileService;
|
|
5
6
|
constructor(context: Context);
|
|
6
7
|
exportActionFlows(packageId: string, metadataFilePath: string): Promise<void>;
|
|
7
8
|
analyzeActionFlows(packageId: string, outputToJsonFile: boolean): Promise<void>;
|
|
@@ -8,6 +8,5 @@ export declare class AssetRegistryApi {
|
|
|
8
8
|
getType(assetType: string): Promise<AssetRegistryDescriptor>;
|
|
9
9
|
getSchema(assetType: string): Promise<any>;
|
|
10
10
|
getExamples(assetType: string): Promise<any>;
|
|
11
|
-
validate(assetType: string, body: any): Promise<any>;
|
|
12
11
|
private static endpointUrl;
|
|
13
12
|
}
|
|
@@ -28,11 +28,3 @@ export interface AssetContributions {
|
|
|
28
28
|
dataPipelineEntityTypes: string[];
|
|
29
29
|
actionTypes: string[];
|
|
30
30
|
}
|
|
31
|
-
export interface ValidateOptions {
|
|
32
|
-
assetType: string;
|
|
33
|
-
packageKey?: string;
|
|
34
|
-
nodeKey?: string;
|
|
35
|
-
configuration?: string;
|
|
36
|
-
file?: string;
|
|
37
|
-
json: boolean;
|
|
38
|
-
}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { ValidateOptions } from "./asset-registry.interfaces";
|
|
2
1
|
import { Context } from "../../core/command/cli-context";
|
|
3
2
|
export declare class AssetRegistryService {
|
|
4
3
|
private readonly api;
|
|
4
|
+
private readonly cuiFileService;
|
|
5
5
|
constructor(context: Context);
|
|
6
6
|
listTypes(jsonResponse: boolean): Promise<void>;
|
|
7
7
|
getType(assetType: string, jsonResponse: boolean): Promise<void>;
|
|
8
8
|
getSchema(assetType: string, jsonResponse: boolean): Promise<void>;
|
|
9
9
|
getExamples(assetType: string, jsonResponse: boolean): Promise<void>;
|
|
10
|
-
validate(opts: ValidateOptions): Promise<void>;
|
|
11
|
-
private static readonly INLINE_VALIDATION_NODE_KEY;
|
|
12
|
-
private buildValidatePayload;
|
|
13
|
-
private parseJson;
|
|
14
10
|
private outputResponse;
|
|
15
11
|
private logDescriptorSummary;
|
|
16
12
|
private logDescriptorDetail;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from "../../core/command/cli-context";
|
|
2
2
|
export declare class BookmarksCommandService {
|
|
3
3
|
private readonly bookmarksApi;
|
|
4
|
+
private readonly cuiFileService;
|
|
4
5
|
constructor(context: Context);
|
|
5
6
|
exportBookmarks(packageKey: string, file?: string): Promise<void>;
|
|
6
7
|
importBookmarks(packageKey: string, file: string): Promise<void>;
|
|
@@ -8,5 +8,6 @@ export declare class NodeApi {
|
|
|
8
8
|
createStagingNode(packageKey: string, transport: SaveNodeTransport, validateOnly: boolean): Promise<NodeTransport | void>;
|
|
9
9
|
updateStagingNode(packageKey: string, nodeKey: string, transport: UpdateNodeTransport, validateOnly: boolean): Promise<NodeTransport | void>;
|
|
10
10
|
archiveStagingNode(packageKey: string, nodeKey: string, force: boolean): Promise<void>;
|
|
11
|
+
findStagingNodesByPackage(packageKey: string, withConfiguration: boolean, limit: number, offset: number): Promise<NodeTransport[]>;
|
|
11
12
|
findVersionedNodesByPackage(packageKey: string, version: string, withConfiguration: boolean, limit: number, offset: number): Promise<NodeTransport[]>;
|
|
12
13
|
}
|
package/lib/commands/configuration-management/branch/branch-export-import.command.service.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare class BranchExportImportCommandService {
|
|
|
16
16
|
private readonly singlePackageImportApi;
|
|
17
17
|
private readonly branchApi;
|
|
18
18
|
private readonly gitService;
|
|
19
|
+
private readonly cuiFileService;
|
|
19
20
|
constructor(context: Context);
|
|
20
21
|
exportBranch(packageKey: string, branchKey: string, options?: BranchExportOptions): Promise<void>;
|
|
21
22
|
exportAll(packageKey: string, jsonResponse?: boolean): Promise<void>;
|
|
@@ -32,5 +33,5 @@ export declare class BranchExportImportCommandService {
|
|
|
32
33
|
private escapeRegExp;
|
|
33
34
|
private removeDir;
|
|
34
35
|
private static isExportableBranch;
|
|
35
|
-
private
|
|
36
|
+
private writeJson;
|
|
36
37
|
}
|
|
@@ -2,6 +2,7 @@ import { Context } from "../../../core/command/cli-context";
|
|
|
2
2
|
import { BranchTransport, BranchingSettingsTransport, MergeApplyOptions, MergePreviewTransport, PackageVersionCreatedTransport } from "./interfaces/branch.interfaces";
|
|
3
3
|
export declare class BranchCommandService {
|
|
4
4
|
private readonly branchApi;
|
|
5
|
+
private readonly cuiFileService;
|
|
5
6
|
constructor(context: Context);
|
|
6
7
|
setBranchingEnabled(packageKey: string, enabled: boolean, jsonResponse: boolean): Promise<BranchingSettingsTransport>;
|
|
7
8
|
createBranch(packageKey: string, branchKey: string, sourceVersion: string, validate: boolean, jsonResponse: boolean): Promise<BranchTransport | void>;
|
|
@@ -10,7 +11,7 @@ export declare class BranchCommandService {
|
|
|
10
11
|
mergePreview(targetPackageKey: string, sourceKey: string, sourceVersion: string, jsonResponse: boolean): Promise<MergePreviewTransport>;
|
|
11
12
|
mergeApply(targetPackageKey: string, options: MergeApplyOptions): Promise<PackageVersionCreatedTransport>;
|
|
12
13
|
private static buildVersionCreate;
|
|
13
|
-
private
|
|
14
|
+
private writeJson;
|
|
14
15
|
private static printBranch;
|
|
15
16
|
private static printPreviewSummary;
|
|
16
17
|
private static countConflictPaths;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from "../../core/command/cli-context";
|
|
2
2
|
export declare class MetadataService {
|
|
3
3
|
private metadataApi;
|
|
4
|
+
private readonly cuiFileService;
|
|
4
5
|
constructor(context: Context);
|
|
5
6
|
exportPackagesMetadata(packageKeys: string[], jsonResponse: boolean): Promise<void>;
|
|
6
7
|
private exportListOfPackagesMetadata;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from "../../core/command/cli-context";
|
|
2
2
|
export declare class NodeDependencyService {
|
|
3
3
|
private readonly nodeDependencyApi;
|
|
4
|
+
private readonly cuiFileService;
|
|
4
5
|
constructor(context: Context);
|
|
5
6
|
listNodeDependencies(packageKey: string, nodeKey: string, version: string, jsonResponse: boolean): Promise<void>;
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from "../../core/command/cli-context";
|
|
2
2
|
export declare class NodeDiffService {
|
|
3
3
|
private nodeDiffApi;
|
|
4
|
+
private readonly cuiFileService;
|
|
4
5
|
constructor(context: Context);
|
|
5
6
|
diff(packageKey: string, nodeKey: string, baseVersion: string, compareVersion: string, jsonResponse: boolean): Promise<void>;
|
|
6
7
|
diffWithFile(packageKey: string, nodeKey: string, baseVersion: string, file: string, jsonResponse: boolean): Promise<void>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Context } from "../../core/command/cli-context";
|
|
2
2
|
export declare class NodeService {
|
|
3
3
|
private nodeApi;
|
|
4
|
+
private readonly cuiFileService;
|
|
4
5
|
constructor(context: Context);
|
|
5
6
|
findNode(packageKey: string, nodeKey: string, withConfiguration: boolean, packageVersion: string | null, jsonResponse: boolean): Promise<void>;
|
|
6
|
-
listNodes(packageKey: string, packageVersion: string, limit: number, offset: number, withConfiguration: boolean, jsonResponse: boolean): Promise<void>;
|
|
7
|
+
listNodes(packageKey: string, packageVersion: string | null, limit: number, offset: number, withConfiguration: boolean, jsonResponse: boolean): Promise<void>;
|
|
7
8
|
createNode(packageKey: string, body: string | undefined, file: string | undefined, validateOnly: boolean, jsonResponse: boolean): Promise<void>;
|
|
8
9
|
updateNode(packageKey: string, nodeKey: string, body: string | undefined, file: string | undefined, validateOnly: boolean, jsonResponse: boolean): Promise<void>;
|
|
9
10
|
archiveNode(packageKey: string, nodeKey: string, force: boolean): Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from "../../core/command/cli-context";
|
|
2
2
|
export declare class PackageValidationService {
|
|
3
3
|
private packageValidationApi;
|
|
4
|
+
private readonly cuiFileService;
|
|
4
5
|
constructor(context: Context);
|
|
5
6
|
validatePackage(packageKey: string, layers: string[], nodeKeys: string[], jsonOutput: boolean): Promise<void>;
|
|
6
7
|
private printValidationResult;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from "../../core/command/cli-context";
|
|
2
2
|
export declare class PackageVersionService {
|
|
3
3
|
private packageVersionApi;
|
|
4
|
+
private readonly cuiFileService;
|
|
4
5
|
constructor(context: Context);
|
|
5
6
|
findPackageVersion(packageKey: string, version: string, jsonResponse: boolean): Promise<void>;
|
|
6
7
|
createPackageVersion(packageKey: string, version: string | undefined, versionBumpOption: string, summaryOfChanges: string | undefined, nodeFilterKeys: string[] | undefined, jsonResponse: boolean): Promise<void>;
|
|
@@ -2,6 +2,7 @@ import { Context } from "../../core/command/cli-context";
|
|
|
2
2
|
export declare class SinglePackageExportService {
|
|
3
3
|
private readonly singlePackageExportApi;
|
|
4
4
|
private readonly gitService;
|
|
5
|
+
private readonly cuiFileService;
|
|
5
6
|
constructor(context: Context);
|
|
6
7
|
exportPackage(packageKey: string, zip: boolean, gitBranch: string): Promise<void>;
|
|
7
8
|
private exportToGitBranch;
|
|
@@ -5,6 +5,7 @@ export declare class SinglePackageImportService {
|
|
|
5
5
|
private static readonly MAX_UNCOMPRESSED_ZIP_SIZE;
|
|
6
6
|
private readonly singlePackageImportApi;
|
|
7
7
|
private readonly gitService;
|
|
8
|
+
private readonly cuiFileService;
|
|
8
9
|
constructor(context: Context);
|
|
9
10
|
importPackage(file: string, directory: string, overwrite: boolean, jsonResponse: boolean, gitBranch: string): Promise<void>;
|
|
10
11
|
private resolveSource;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from "../../core/command/cli-context";
|
|
2
2
|
export declare class StagingPackageService {
|
|
3
3
|
private stagingPackageApi;
|
|
4
|
+
private readonly cuiFileService;
|
|
4
5
|
constructor(context: Context);
|
|
5
6
|
listStagingPackages(flavors: string[], includeBranches: boolean, jsonResponse: boolean): Promise<void>;
|
|
6
7
|
private exportListOfPackages;
|
|
@@ -3,6 +3,7 @@ export declare class VariableService {
|
|
|
3
3
|
private variableApi;
|
|
4
4
|
private variableAssignmentCandidatesApi;
|
|
5
5
|
private readonly stagingPackageVariablesApi;
|
|
6
|
+
private readonly cuiFileService;
|
|
6
7
|
constructor(context: Context);
|
|
7
8
|
listVariables(keysByVersion: string[], keysByVersionFile: string): Promise<void>;
|
|
8
9
|
listCandidateAssignments(type: string, params: string): Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from "../../../core/command/cli-context";
|
|
2
2
|
export declare class DataPoolService {
|
|
3
3
|
private dataPoolApi;
|
|
4
|
+
private readonly cuiFileService;
|
|
4
5
|
constructor(context: Context);
|
|
5
6
|
batchImportDataPools(requestFilePath: string, outputToJsonFile: boolean): Promise<void>;
|
|
6
7
|
exportDataPool(poolId: string, outputToJsonFile: boolean): Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from "../../core/command/cli-context";
|
|
2
2
|
export declare class DeploymentService {
|
|
3
3
|
private deploymentApi;
|
|
4
|
+
private readonly cuiFileService;
|
|
4
5
|
constructor(context: Context);
|
|
5
6
|
createDeployment(packageKey: string, packageVersion: string, deployableType: string, targetId: string, jsonResponse: boolean): Promise<void>;
|
|
6
7
|
getDeployments(jsonResponse: boolean, packageKey?: string, targetId?: string, deployableType?: string, status?: string, createdBy?: string, limit?: string, offset?: string): Promise<void>;
|
|
@@ -2,6 +2,7 @@ import { Context } from "../../../core/command/cli-context";
|
|
|
2
2
|
export declare class AssetService {
|
|
3
3
|
protected readonly fileDownloadedMessage = "File downloaded successfully. New filename: ";
|
|
4
4
|
private assetApi;
|
|
5
|
+
private readonly cuiFileService;
|
|
5
6
|
constructor(context: Context);
|
|
6
7
|
listAssets(assetType: string): Promise<void>;
|
|
7
8
|
findAndExportAllAssets(assetType: string): Promise<void>;
|
|
@@ -7,6 +7,7 @@ export declare class PackageService {
|
|
|
7
7
|
private packageDependenciesApi;
|
|
8
8
|
private dataModelService;
|
|
9
9
|
private variableService;
|
|
10
|
+
private readonly cuiFileService;
|
|
10
11
|
constructor(context: Context);
|
|
11
12
|
listPackages(): Promise<void>;
|
|
12
13
|
findAndExportListOfAllPackages(includeDependencies: boolean, packageKeys: string[]): Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from "../../core/command/cli-context";
|
|
2
2
|
export declare class DiffService {
|
|
3
3
|
private diffApi;
|
|
4
|
+
private readonly cuiFileService;
|
|
4
5
|
constructor(context: Context);
|
|
5
6
|
diffPackages(file: string, hasChanges: boolean, baseVersion: string, jsonResponse: boolean): Promise<void>;
|
|
6
7
|
private hasChanges;
|
|
@@ -5,6 +5,7 @@ export declare class T2tcPackageService {
|
|
|
5
5
|
private studioPackageApi;
|
|
6
6
|
private studioService;
|
|
7
7
|
private gitService;
|
|
8
|
+
private readonly cuiFileService;
|
|
8
9
|
constructor(context: Context);
|
|
9
10
|
listActivePackages(flavors: string[], includeBranches: boolean): Promise<void>;
|
|
10
11
|
findAndExportListOfPackages(flavors: string[], packageKeys: string[], keysByVersion: string[], withDependencies: boolean, includeBranches: boolean): Promise<void>;
|
package/lib/content-cli.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export interface CreateProgramOptions {
|
|
|
14
14
|
* Build a fully-configured Commander program without parsing argv
|
|
15
15
|
*/
|
|
16
16
|
export declare function createProgram(context: Context, opts?: CreateProgramOptions): Command;
|
|
17
|
+
export declare function loadProfileOnDemand(program: Command, context: Context): void;
|
|
@@ -20,6 +20,7 @@ export declare class ModuleHandler {
|
|
|
20
20
|
discoverAndRegisterModules(rootPath: string, devMode?: boolean): void;
|
|
21
21
|
}
|
|
22
22
|
type CommandHandler = (context: Context, command: Command, options: OptionValues) => Promise<void>;
|
|
23
|
+
export declare function shouldLoadProfile(command: Command): boolean;
|
|
23
24
|
/**
|
|
24
25
|
* Allows the creation of root level commands.
|
|
25
26
|
*/
|
|
@@ -53,6 +54,7 @@ export declare class CommandConfig {
|
|
|
53
54
|
requiredOption(flags: string, description?: string, defaultValue?: string | boolean | string[]): CommandConfig;
|
|
54
55
|
deprecationNotice(deprecationMessage: string): CommandConfig;
|
|
55
56
|
beta(): CommandConfig;
|
|
57
|
+
skipProfileLoading(): this;
|
|
56
58
|
action(handler: CommandHandler): void;
|
|
57
59
|
private printDeprecationNoticeIfDeprecated;
|
|
58
60
|
private printBetaNoticeIfBetaCommand;
|
|
@@ -9,6 +9,10 @@ export declare class HttpClient {
|
|
|
9
9
|
private axios;
|
|
10
10
|
constructor(context: Context);
|
|
11
11
|
get(url: string): Promise<any>;
|
|
12
|
+
getStatusAndData(url: string): Promise<{
|
|
13
|
+
status: number;
|
|
14
|
+
data: any;
|
|
15
|
+
}>;
|
|
12
16
|
getFile(url: string): Promise<any>;
|
|
13
17
|
postFile(url: string, formData: FormData, parameters?: {}): Promise<any>;
|
|
14
18
|
post(url: string, body: any): Promise<any>;
|