@celonis/content-cli 0.13.4 → 1.0.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/README.md +13 -6
- package/{api → commands/action-flows/action-flow}/action-flow-api.js +10 -9
- package/commands/{action-flow.command.js → action-flows/action-flow/action-flow-command.service.js} +11 -8
- package/{services/action-flow/action-flow-service.js → commands/action-flows/action-flow/action-flow.service.js} +12 -10
- package/commands/action-flows/module.js +88 -0
- package/commands/{skill.command.js → action-flows/skill/skill-command.service.js} +9 -11
- package/{content/factory/skill-manager.factory.js → commands/action-flows/skill/skill.manager-factory.js} +7 -4
- package/{content/manager → commands/action-flows/skill}/skill.manager.js +7 -4
- package/commands/analysis/analysis-bookmarks-command.service.js +39 -0
- package/{content/factory/analysis-bookmarks-manager.factory.js → commands/analysis/analysis-bookmarks.manager-factory.js} +7 -4
- package/{content/manager → commands/analysis}/analysis-bookmarks.manager.js +8 -5
- package/commands/analysis/module.js +52 -0
- package/commands/configuration-management/api/batch-import-export-api.js +84 -0
- package/{api → commands/configuration-management/api}/diff-api.js +8 -7
- package/commands/configuration-management/api/variable-assignment-candidates-api.js +41 -0
- package/{services/package-manager/batch-import-export-service.js → commands/configuration-management/batch-import-export.service.js} +43 -23
- package/commands/configuration-management/config-command.service.js +76 -0
- package/{services/package-manager/diff-service.js → commands/configuration-management/diff.service.js} +11 -8
- package/commands/configuration-management/module.js +102 -0
- package/{services/studio → commands/configuration-management}/studio.service.js +33 -24
- package/commands/{variable.command.js → configuration-management/variable-command.service.js} +10 -7
- package/{services/package-manager/variable-service.js → commands/configuration-management/variable.service.js} +36 -42
- package/commands/{ctp.command.js → cpm4/ctp-command.service.js} +11 -13
- package/{content/manager → commands/cpm4}/ctp.analysis.manager.js +3 -0
- package/{content/manager → commands/cpm4}/ctp.datamodel.manager.js +2 -2
- package/{content/factory/ctp-manager.factory.js → commands/cpm4/ctp.manager-factory.js} +9 -6
- package/{content/manager → commands/cpm4}/ctp.manager.js +6 -4
- package/commands/cpm4/module.js +46 -0
- package/commands/{connection.command.js → data-pipeline/connection/connection-command.service.js} +14 -11
- package/commands/data-pipeline/connection/connection.commands.js +65 -0
- package/{services → commands/data-pipeline}/connection/connection.service.js +18 -15
- package/{api → commands/data-pipeline/data-pool}/data-pool-api.js +14 -13
- package/commands/{data-pool.command.js → data-pipeline/data-pool/data-pool-command.service.js} +25 -23
- package/{content/factory → commands/data-pipeline/data-pool}/data-pool-manager.factory.js +9 -6
- package/{services → commands/data-pipeline}/data-pool/data-pool-service.js +13 -10
- package/commands/data-pipeline/data-pool/data-pool.commands.js +99 -0
- package/{content/manager → commands/data-pipeline/data-pool}/data-pool.manager.js +8 -9
- package/commands/data-pipeline/module.js +24 -0
- package/commands/profile/module.js +60 -0
- package/commands/profile/profile-command.service.js +94 -0
- package/{api → commands/studio/api}/asset-api.js +8 -7
- package/{api → commands/studio/api}/compute-pool-api.js +7 -6
- package/{api → commands/studio/api}/node-api.js +9 -8
- package/{api → commands/studio/api}/package-api.js +18 -17
- package/{api → commands/studio/api}/package-dependencies-api.js +12 -11
- package/{api → commands/studio/api}/space-api.js +10 -9
- package/commands/{analysis-bookmarks.command.js → studio/api/studio-variables-api.js} +18 -13
- package/commands/{asset.command.js → studio/command-service/asset-command.service.js} +21 -19
- package/commands/{package.command.js → studio/command-service/package-command.service.js} +22 -20
- package/commands/{space.command.js → studio/command-service/space-command.service.js} +9 -11
- package/commands/studio/command-service/widget.command.js +56 -0
- package/{content/factory/asset-manager.factory.js → commands/studio/manager/asset.manager-factory.js} +7 -4
- package/{content → commands/studio}/manager/asset.manager.js +8 -5
- package/{content/factory/package-manager.factory.js → commands/studio/manager/package.manager-factory.js} +7 -4
- package/{content → commands/studio}/manager/package.manager.js +9 -6
- package/{content/factory/space-manager.factory.js → commands/studio/manager/space.manager-factory.js} +6 -3
- package/{content → commands/studio}/manager/space.manager.js +7 -4
- package/{content/factory/widget-manager.factory.js → commands/studio/manager/widget.manager-factory.js} +8 -5
- package/{content → commands/studio}/manager/widget.manager.js +5 -5
- package/commands/studio/module.js +169 -0
- package/{services/package-manager → commands/studio/service}/asset-service.js +10 -9
- package/{services/package-manager/datamodel-service.js → commands/studio/service/data-model.service.js} +8 -6
- package/{services/package-manager/package-service.js → commands/studio/service/package.service.js} +59 -49
- package/{services/package-manager/space-service.js → commands/studio/service/space.service.js} +9 -9
- package/commands/studio/service/studio-variable.service.js +41 -0
- package/content-cli.js +69 -20
- package/core/command/cli-context.js +69 -0
- package/core/command/module-handler.js +200 -0
- package/core/http/base-api.js +115 -0
- package/{services/http-client-service.v2.js → core/http/http-client.js} +39 -24
- package/{services/context.service.js → core/http/http-shared/base.manager.helper.js} +6 -16
- package/{content/manager → core/http/http-shared}/base.manager.js +14 -21
- package/{services → core/profile}/profile.service.js +11 -5
- package/{validators → core/profile}/profile.validator.js +3 -3
- package/{services → core/utils}/file-service.js +2 -7
- package/core/utils/logger.js +102 -0
- package/{services → core/utils}/question.service.js +18 -7
- package/{util → core/utils}/version.js +1 -1
- package/lib/{api → commands/action-flows/action-flow}/action-flow-api.d.ts +4 -4
- package/lib/commands/{action-flow.command.d.ts → action-flows/action-flow/action-flow-command.service.d.ts} +4 -1
- package/lib/{services/action-flow/action-flow-service.d.ts → commands/action-flows/action-flow/action-flow.service.d.ts} +4 -4
- package/lib/commands/action-flows/module.d.ts +14 -0
- package/lib/commands/{skill.command.d.ts → action-flows/skill/skill-command.service.d.ts} +3 -2
- package/lib/commands/action-flows/skill/skill.manager-factory.d.ts +8 -0
- package/lib/{content/manager → commands/action-flows/skill}/skill.manager.d.ts +4 -2
- package/lib/commands/analysis/analysis-bookmarks-command.service.d.ts +7 -0
- package/lib/commands/analysis/analysis-bookmarks.manager-factory.d.ts +8 -0
- package/lib/{content/manager → commands/analysis}/analysis-bookmarks.manager.d.ts +4 -2
- package/lib/commands/analysis/module.d.ts +11 -0
- package/lib/{api → commands/configuration-management/api}/batch-import-export-api.d.ts +6 -5
- package/lib/{api → commands/configuration-management/api}/diff-api.d.ts +5 -5
- package/lib/commands/configuration-management/api/variable-assignment-candidates-api.d.ts +8 -0
- package/lib/{services/package-manager/batch-import-export-service.d.ts → commands/configuration-management/batch-import-export.service.d.ts} +8 -3
- package/lib/commands/{config.command.d.ts → configuration-management/config-command.service.d.ts} +8 -2
- package/lib/{services/package-manager/diff-service.d.ts → commands/configuration-management/diff.service.d.ts} +4 -3
- package/lib/{interfaces/package-export-transport.d.ts → commands/configuration-management/interfaces/package-export.interfaces.d.ts} +2 -2
- package/lib/{api/variable-assignment-apis.d.ts → commands/configuration-management/interfaces/variable-assignment-apis.constants.d.ts} +3 -1
- package/lib/commands/configuration-management/module.d.ts +15 -0
- package/lib/{services/studio → commands/configuration-management}/studio.service.d.ts +12 -5
- package/lib/commands/configuration-management/variable-command.service.d.ts +6 -0
- package/lib/{services/package-manager/variable-service.d.ts → commands/configuration-management/variable.service.d.ts} +8 -8
- package/lib/commands/cpm4/ctp-command.service.d.ts +7 -0
- package/lib/{content/manager → commands/cpm4}/ctp.analysis.manager.d.ts +2 -0
- package/lib/{content/manager → commands/cpm4}/ctp.datamodel.manager.d.ts +2 -1
- package/lib/{content/factory/ctp-manager.factory.d.ts → commands/cpm4/ctp.manager-factory.d.ts} +4 -1
- package/lib/{content/manager → commands/cpm4}/ctp.manager.d.ts +4 -2
- package/lib/commands/cpm4/module.d.ts +10 -0
- package/lib/commands/data-pipeline/connection/connection-command.service.d.ts +8 -0
- package/lib/commands/data-pipeline/connection/connection.commands.d.ts +11 -0
- package/lib/{services → commands/data-pipeline}/connection/connection.service.d.ts +4 -3
- package/lib/{api → commands/data-pipeline/data-pool}/data-pool-api.d.ts +5 -5
- package/lib/commands/data-pipeline/data-pool/data-pool-command.service.d.ts +14 -0
- package/lib/commands/data-pipeline/data-pool/data-pool-manager.factory.d.ts +9 -0
- package/lib/{services → commands/data-pipeline}/data-pool/data-pool-service.d.ts +4 -3
- package/lib/commands/data-pipeline/data-pool/data-pool.commands.d.ts +15 -0
- package/lib/{content/manager → commands/data-pipeline/data-pool}/data-pool.manager.d.ts +4 -2
- package/lib/commands/data-pipeline/module.d.ts +9 -0
- package/lib/commands/profile/module.d.ts +12 -0
- package/lib/commands/{profile.command.d.ts → profile/profile-command.service.d.ts} +1 -1
- package/lib/{api → commands/studio/api}/asset-api.d.ts +4 -4
- package/lib/{api → commands/studio/api}/compute-pool-api.d.ts +4 -4
- package/lib/{api → commands/studio/api}/node-api.d.ts +4 -4
- package/lib/{api → commands/studio/api}/package-api.d.ts +4 -4
- package/lib/{api → commands/studio/api}/package-dependencies-api.d.ts +4 -4
- package/lib/commands/studio/api/space-api.d.ts +9 -0
- package/lib/commands/studio/api/studio-variables-api.d.ts +8 -0
- package/lib/commands/studio/command-service/asset-command.service.d.ts +11 -0
- package/lib/commands/{package.command.d.ts → studio/command-service/package-command.service.d.ts} +8 -5
- package/lib/commands/studio/command-service/space-command.service.d.ts +6 -0
- package/lib/commands/studio/command-service/widget.command.d.ts +7 -0
- package/lib/{interfaces/batch-export-node-transport.d.ts → commands/studio/interfaces/batch-export-node.interfaces.d.ts} +1 -9
- package/lib/{content/factory/asset-manager.factory.d.ts → commands/studio/manager/asset.manager-factory.d.ts} +4 -1
- package/lib/{content → commands/studio}/manager/asset.manager.d.ts +4 -2
- package/lib/{content/factory/package-manager.factory.d.ts → commands/studio/manager/package.manager-factory.d.ts} +4 -1
- package/lib/{content → commands/studio}/manager/package.manager.d.ts +4 -2
- package/lib/commands/studio/manager/space.manager-factory.d.ts +8 -0
- package/lib/{content → commands/studio}/manager/space.manager.d.ts +4 -2
- package/lib/{content/factory/widget-manager.factory.d.ts → commands/studio/manager/widget.manager-factory.d.ts} +10 -7
- package/lib/{content → commands/studio}/manager/widget.manager.d.ts +4 -2
- package/lib/commands/studio/module.d.ts +21 -0
- package/lib/{services/package-manager → commands/studio/service}/asset-service.d.ts +4 -3
- package/lib/{services/package-manager/datamodel-service.d.ts → commands/studio/service/data-model.service.d.ts} +5 -5
- package/lib/{services/package-manager/package-service.d.ts → commands/studio/service/package.service.d.ts} +13 -6
- package/lib/commands/studio/service/space.service.d.ts +11 -0
- package/lib/commands/studio/service/studio-variable.service.d.ts +9 -0
- package/lib/core/command/cli-context.d.ts +17 -0
- package/lib/core/command/module-handler.d.ts +57 -0
- package/lib/core/http/base-api.d.ts +32 -0
- package/lib/{services/http-client-service.v2.d.ts → core/http/http-client.d.ts} +8 -3
- package/lib/{content/manager → core/http/http-shared}/base.manager.d.ts +4 -6
- package/lib/core/http/http-shared/base.manager.helper.d.ts +4 -0
- package/lib/{services → core/profile}/profile.service.d.ts +2 -1
- package/lib/{validators → core/profile}/profile.validator.d.ts +1 -1
- package/lib/{services → core/utils}/file-service.d.ts +0 -2
- package/lib/core/utils/question.service.d.ts +10 -0
- package/package.json +3 -3
- package/api/batch-import-export-api.js +0 -51
- package/api/variables-api.js +0 -56
- package/commands/config.command.js +0 -57
- package/commands/profile.command.js +0 -88
- package/commands/widget.command.js +0 -36
- package/content-cli-analyze.js +0 -56
- package/content-cli-config.js +0 -117
- package/content-cli-export.js +0 -90
- package/content-cli-get.js +0 -52
- package/content-cli-import.js +0 -93
- package/content-cli-list.js +0 -129
- package/content-cli-profile.js +0 -64
- package/content-cli-pull.js +0 -104
- package/content-cli-push.js +0 -196
- package/content-cli-set.js +0 -55
- package/content-cli-update.js +0 -44
- package/interfaces/variable-assignment-api.interface.js +0 -12
- package/lib/api/space-api.d.ts +0 -9
- package/lib/api/variables-api.d.ts +0 -14
- package/lib/commands/analysis-bookmarks.command.d.ts +0 -6
- package/lib/commands/asset.command.d.ts +0 -8
- package/lib/commands/connection.command.d.ts +0 -5
- package/lib/commands/ctp.command.d.ts +0 -6
- package/lib/commands/data-pool.command.d.ts +0 -11
- package/lib/commands/space.command.d.ts +0 -5
- package/lib/commands/variable.command.d.ts +0 -3
- package/lib/commands/widget.command.d.ts +0 -5
- package/lib/content/factory/analysis-bookmarks-manager.factory.d.ts +0 -5
- package/lib/content/factory/data-pool-manager.factory.d.ts +0 -6
- package/lib/content/factory/skill-manager.factory.d.ts +0 -5
- package/lib/content/factory/space-manager.factory.d.ts +0 -5
- package/lib/content-cli-analyze.d.ts +0 -1
- package/lib/content-cli-config.d.ts +0 -8
- package/lib/content-cli-export.d.ts +0 -6
- package/lib/content-cli-get.d.ts +0 -1
- package/lib/content-cli-import.d.ts +0 -6
- package/lib/content-cli-list.d.ts +0 -9
- package/lib/content-cli-profile.d.ts +0 -1
- package/lib/content-cli-pull.d.ts +0 -1
- package/lib/content-cli-push.d.ts +0 -1
- package/lib/content-cli-set.d.ts +0 -1
- package/lib/content-cli-update.d.ts +0 -1
- package/lib/interfaces/variable-assignment-api.interface.d.ts +0 -3
- package/lib/services/command.service.d.ts +0 -6
- package/lib/services/content.service.d.ts +0 -11
- package/lib/services/context.service.d.ts +0 -13
- package/lib/services/http-client.service.d.ts +0 -15
- package/lib/services/package-manager/space-service.d.ts +0 -11
- package/lib/services/question.service.d.ts +0 -4
- package/lib/util/context-initializer.d.ts +0 -3
- package/lib/util/program.d.ts +0 -2
- package/services/command.service.js +0 -24
- package/services/content.service.js +0 -130
- package/services/http-client.service.js +0 -157
- package/util/context-initializer.js +0 -39
- package/util/logger.js +0 -49
- package/util/program.js +0 -16
- /package/{interfaces/batch-export-import-constants.js → commands/configuration-management/interfaces/batch-export-import.constants.js} +0 -0
- /package/{interfaces/diff-package.transport.js → commands/configuration-management/interfaces/diff-package.interfaces.js} +0 -0
- /package/{interfaces/batch-export-node-transport.js → commands/configuration-management/interfaces/package-export.interfaces.js} +0 -0
- /package/{api/variable-assignment-apis.js → commands/configuration-management/interfaces/variable-assignment-apis.constants.js} +0 -0
- /package/{interfaces → commands/data-pipeline/data-pool}/data-pool-manager.interfaces.js +0 -0
- /package/{interfaces/manager-config.interface.js → commands/studio/interfaces/batch-export-node.interfaces.js} +0 -0
- /package/{interfaces/manifest-transport.js → commands/studio/interfaces/manifest.interface.js} +0 -0
- /package/{interfaces → commands/studio/interfaces}/package-manager.interfaces.js +0 -0
- /package/{interfaces → commands/studio/interfaces}/save-content-node.interface.js +0 -0
- /package/{interfaces/package-export-transport.js → commands/studio/interfaces/space.interface.js} +0 -0
- /package/{util → commands/studio/utils}/semantic-versioning.js +0 -0
- /package/{util → core/http}/axios-initializer.js +0 -0
- /package/{interfaces/save-space.interface.js → core/http/http-shared/manager-config.interface.js} +0 -0
- /package/{util → core/http}/tracing.js +0 -0
- /package/{interfaces → core/profile}/profile.interface.js +0 -0
- /package/{util → core/utils}/json.js +0 -0
- /package/{util → core/utils}/yaml.js +0 -0
- /package/lib/{interfaces/batch-export-import-constants.d.ts → commands/configuration-management/interfaces/batch-export-import.constants.d.ts} +0 -0
- /package/lib/{interfaces/diff-package.transport.d.ts → commands/configuration-management/interfaces/diff-package.interfaces.d.ts} +0 -0
- /package/lib/{interfaces → commands/data-pipeline/data-pool}/data-pool-manager.interfaces.d.ts +0 -0
- /package/lib/{interfaces/manifest-transport.d.ts → commands/studio/interfaces/manifest.interface.d.ts} +0 -0
- /package/lib/{interfaces → commands/studio/interfaces}/package-manager.interfaces.d.ts +0 -0
- /package/lib/{interfaces → commands/studio/interfaces}/save-content-node.interface.d.ts +0 -0
- /package/lib/{interfaces/save-space.interface.d.ts → commands/studio/interfaces/space.interface.d.ts} +0 -0
- /package/lib/{util → commands/studio/utils}/semantic-versioning.d.ts +0 -0
- /package/lib/{util → core/http}/axios-initializer.d.ts +0 -0
- /package/lib/{interfaces → core/http/http-shared}/manager-config.interface.d.ts +0 -0
- /package/lib/{util → core/http}/tracing.d.ts +0 -0
- /package/lib/{interfaces → core/profile}/profile.interface.d.ts +0 -0
- /package/lib/{util → core/utils}/json.d.ts +0 -0
- /package/lib/{util → core/utils}/logger.d.ts +0 -0
- /package/lib/{util → core/utils}/version.d.ts +0 -0
- /package/lib/{util → core/utils}/yaml.d.ts +0 -0
package/{services/package-manager/package-service.js → commands/studio/service/package.service.js}
RENAMED
|
@@ -13,36 +13,43 @@ 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", "
|
|
16
|
+
define(["require", "exports", "uuid", "fs", "adm-zip", "path", "os", "form-data", "../api/package-api", "../../../core/utils/logger", "../interfaces/package-manager.interfaces", "../../../core/utils/file-service", "../../../core/utils/yaml", "yaml", "../utils/semantic-versioning", "../api/node-api", "../api/package-dependencies-api", "./data-model.service", "./studio-variable.service", "./space.service"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.
|
|
22
|
-
const logger_1 = require("../../util/logger");
|
|
23
|
-
const package_api_1 = require("../../api/package-api");
|
|
21
|
+
exports.PackageService = void 0;
|
|
24
22
|
const uuid_1 = require("uuid");
|
|
25
|
-
const file_service_1 = require("../file-service");
|
|
26
|
-
const datamodel_service_1 = require("./datamodel-service");
|
|
27
|
-
const package_manager_interfaces_1 = require("../../interfaces/package-manager.interfaces");
|
|
28
|
-
const node_api_1 = require("../../api/node-api");
|
|
29
|
-
const package_dependencies_api_1 = require("../../api/package-dependencies-api");
|
|
30
|
-
const variable_service_1 = require("./variable-service");
|
|
31
|
-
const space_service_1 = require("./space-service");
|
|
32
23
|
const fs = require("fs");
|
|
33
24
|
const AdmZip = require("adm-zip");
|
|
34
25
|
const path = require("path");
|
|
35
26
|
const os_1 = require("os");
|
|
36
|
-
const semantic_versioning_1 = require("../../util/semantic-versioning");
|
|
37
|
-
const yaml_1 = require("../../util/yaml");
|
|
38
27
|
const FormData = require("form-data");
|
|
28
|
+
const package_api_1 = require("../api/package-api");
|
|
29
|
+
const logger_1 = require("../../../core/utils/logger");
|
|
30
|
+
const package_manager_interfaces_1 = require("../interfaces/package-manager.interfaces");
|
|
31
|
+
const file_service_1 = require("../../../core/utils/file-service");
|
|
32
|
+
const yaml_1 = require("../../../core/utils/yaml");
|
|
33
|
+
const yaml_2 = require("yaml");
|
|
34
|
+
const semantic_versioning_1 = require("../utils/semantic-versioning");
|
|
35
|
+
const node_api_1 = require("../api/node-api");
|
|
36
|
+
const package_dependencies_api_1 = require("../api/package-dependencies-api");
|
|
37
|
+
const data_model_service_1 = require("./data-model.service");
|
|
38
|
+
const studio_variable_service_1 = require("./studio-variable.service");
|
|
39
|
+
const space_service_1 = require("./space.service");
|
|
39
40
|
class PackageService {
|
|
40
|
-
constructor() {
|
|
41
|
+
constructor(context) {
|
|
41
42
|
this.fileDownloadedMessage = "File downloaded successfully. New filename: ";
|
|
43
|
+
this.packageApi = new package_api_1.PackageApi(context);
|
|
44
|
+
this.nodeApi = new node_api_1.NodeApi(context);
|
|
45
|
+
this.packageDependenciesApi = new package_dependencies_api_1.PackageDependenciesApi(context);
|
|
46
|
+
this.dataModelService = new data_model_service_1.DataModelService(context);
|
|
47
|
+
this.variableService = new studio_variable_service_1.StudioVariableService(context);
|
|
48
|
+
this.spaceService = new space_service_1.SpaceService(context);
|
|
42
49
|
}
|
|
43
50
|
listPackages() {
|
|
44
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const nodes = yield
|
|
52
|
+
const nodes = yield this.packageApi.findAllPackages();
|
|
46
53
|
nodes.forEach(node => {
|
|
47
54
|
logger_1.logger.info(`${node.name} - Key: "${node.key}"`);
|
|
48
55
|
});
|
|
@@ -51,7 +58,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
51
58
|
findAndExportListOfAllPackages(includeDependencies, packageKeys) {
|
|
52
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
60
|
const fieldsToInclude = ["key", "name", "changeDate", "activatedDraftId", "workingDraftId", "spaceId"];
|
|
54
|
-
let nodesListToExport = yield
|
|
61
|
+
let nodesListToExport = yield this.packageApi.findAllPackages();
|
|
55
62
|
if (packageKeys.length > 0) {
|
|
56
63
|
nodesListToExport = nodesListToExport.filter(node => packageKeys.includes(node.rootNodeKey));
|
|
57
64
|
}
|
|
@@ -61,8 +68,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
61
68
|
let publishedNodes = nodesListToExport.filter(node => node.activatedDraftId);
|
|
62
69
|
publishedNodes = yield this.getNodesWithActiveVersion(publishedNodes);
|
|
63
70
|
nodesListToExport = [...publishedNodes, ...unPublishedNodes];
|
|
64
|
-
const packageWithDataModelVariableAssignments = yield
|
|
65
|
-
const dataModelDetailsByNode = yield
|
|
71
|
+
const packageWithDataModelVariableAssignments = yield this.variableService.getVariableAssignmentsForNodes(package_manager_interfaces_1.PackageManagerVariableType.DATA_MODEL);
|
|
72
|
+
const dataModelDetailsByNode = yield this.dataModelService.getDataModelDetailsForPackages(packageWithDataModelVariableAssignments);
|
|
66
73
|
nodesListToExport.forEach(node => {
|
|
67
74
|
node.datamodels = dataModelDetailsByNode.get(node.key);
|
|
68
75
|
});
|
|
@@ -85,9 +92,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
85
92
|
const importedFilePath = path.resolve((0, os_1.tmpdir)(), "export_" + (0, uuid_1.v4)());
|
|
86
93
|
yield fs.mkdirSync(importedFilePath);
|
|
87
94
|
yield zip.extractAllTo(importedFilePath);
|
|
88
|
-
const manifestNodes = yield
|
|
95
|
+
const manifestNodes = yield this.readManifestFile(importedFilePath);
|
|
89
96
|
if (!overwrite) {
|
|
90
|
-
const allTargetPackages = yield
|
|
97
|
+
const allTargetPackages = yield this.packageApi.findAllPackages();
|
|
91
98
|
const manifestNodeKeys = manifestNodes.map(node => node.packageKey);
|
|
92
99
|
const packagesWithDraftChanges = allTargetPackages
|
|
93
100
|
.filter(node => manifestNodeKeys.includes(node.key) && node.workingDraftId !== node.activatedDraftId)
|
|
@@ -164,14 +171,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
164
171
|
return;
|
|
165
172
|
}
|
|
166
173
|
const targetSpace = yield this.getTargetSpaceForExportedPackage(packageToImport, spaceMappings);
|
|
167
|
-
let nodeInTargetTeam = yield
|
|
174
|
+
let nodeInTargetTeam = yield this.nodeApi.findOneByKeyAndRootNodeKey(packageToImport.packageKey, packageToImport.packageKey);
|
|
168
175
|
const pathToZipFile = path.resolve(importedFilePath, packageToImport.packageKey + "_" + versionOfPackageBeingImported + ".zip");
|
|
169
176
|
const packageZip = this.createBodyForImport(pathToZipFile);
|
|
170
|
-
yield
|
|
177
|
+
yield this.packageApi.importPackage(packageZip, targetSpace.id, !!nodeInTargetTeam, excludeActionFlows);
|
|
171
178
|
if (nodeInTargetTeam) {
|
|
172
|
-
yield
|
|
179
|
+
yield this.packageApi.movePackageToSpace(nodeInTargetTeam.id, targetSpace.id);
|
|
173
180
|
}
|
|
174
|
-
nodeInTargetTeam = yield
|
|
181
|
+
nodeInTargetTeam = yield this.nodeApi.findOneByKeyAndRootNodeKey(packageToImport.packageKey, packageToImport.packageKey);
|
|
175
182
|
if (this.isLatestVersion(versionOfPackageBeingImported, [...packageToImport.dependenciesByVersion.keys()])) {
|
|
176
183
|
if (dmTargetIdsBySourceIds.size > 0) {
|
|
177
184
|
const variableAssignments = packageToImport.variables
|
|
@@ -180,16 +187,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
180
187
|
variable.value = dmTargetIdsBySourceIds.get((_a = variable.value) === null || _a === void 0 ? void 0 : _a.toString());
|
|
181
188
|
return variable;
|
|
182
189
|
});
|
|
183
|
-
yield
|
|
190
|
+
yield this.variableService.assignVariableValues(nodeInTargetTeam.key, variableAssignments);
|
|
184
191
|
}
|
|
185
192
|
else {
|
|
186
|
-
yield
|
|
193
|
+
yield this.variableService.assignVariableValues(nodeInTargetTeam.key, packageToImport.variables);
|
|
187
194
|
}
|
|
188
195
|
}
|
|
189
196
|
draftIdsByPackageKeyAndVersion.set(`${nodeInTargetTeam.key}_${versionOfPackageBeingImported}`, nodeInTargetTeam.workingDraftId);
|
|
190
197
|
yield this.updateDependencyVersions(packageToImport, versionOfPackageBeingImported, sourceToTargetVersionsByNodeKey, draftIdsByPackageKeyAndVersion);
|
|
191
198
|
yield this.publishPackage(packageToImport);
|
|
192
|
-
const packageVersionInTargetTeam = yield
|
|
199
|
+
const packageVersionInTargetTeam = yield this.packageApi.findActiveVersionById(nodeInTargetTeam.id);
|
|
193
200
|
const mappedVersions = (_a = sourceToTargetVersionsByNodeKey.get(packageToImport.packageKey)) !== null && _a !== void 0 ? _a : new Map();
|
|
194
201
|
mappedVersions.set(versionOfPackageBeingImported, packageVersionInTargetTeam.version);
|
|
195
202
|
sourceToTargetVersionsByNodeKey.set(packageToImport.packageKey, mappedVersions);
|
|
@@ -218,7 +225,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
218
225
|
if (this.checkIfPackageVersionHasBeenImported(dependency.key, dependency.version, importedVersionsByNodeKey)) {
|
|
219
226
|
continue;
|
|
220
227
|
}
|
|
221
|
-
const dependentPackage = manifestNodes.find(
|
|
228
|
+
const dependentPackage = manifestNodes.find(node => node.packageKey === dependency.key);
|
|
222
229
|
yield this.importPackage(dependentPackage, manifestNodes, sourceToTargetVersionsByNodeKey, spaceMappings, dmTargetIdsBySourceIds, importedVersionsByNodeKey, draftIdsByPackageKeyAndVersion, importedFilePath, excludeActionFlows);
|
|
223
230
|
}
|
|
224
231
|
});
|
|
@@ -236,7 +243,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
236
243
|
getTargetSpaceForExportedPackage(packageToImport, spaceMappings) {
|
|
237
244
|
return __awaiter(this, void 0, void 0, function* () {
|
|
238
245
|
let targetSpace;
|
|
239
|
-
const allSpaces = yield
|
|
246
|
+
const allSpaces = yield this.spaceService.refreshAndGetAllSpaces();
|
|
240
247
|
if (spaceMappings.has(packageToImport.packageKey)) {
|
|
241
248
|
const customSpaceId = spaceMappings.get(packageToImport.packageKey);
|
|
242
249
|
const customSpace = allSpaces.find(space => space.id === customSpaceId);
|
|
@@ -248,7 +255,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
248
255
|
else {
|
|
249
256
|
targetSpace = allSpaces.find(space => space.name === packageToImport.space.spaceName);
|
|
250
257
|
if (!targetSpace) {
|
|
251
|
-
targetSpace = yield
|
|
258
|
+
targetSpace = yield this.spaceService.createSpace(packageToImport.space.spaceName, packageToImport.space.spaceIcon);
|
|
252
259
|
}
|
|
253
260
|
}
|
|
254
261
|
return targetSpace;
|
|
@@ -256,10 +263,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
256
263
|
}
|
|
257
264
|
updateDependencyVersions(node, versionOfPackage, sourceToTargetVersionsByNodeKey, draftIdsByPackageKeyAndVersion) {
|
|
258
265
|
return __awaiter(this, void 0, void 0, function* () {
|
|
259
|
-
const createdNode = yield
|
|
266
|
+
const createdNode = yield this.nodeApi.findOneByKeyAndRootNodeKey(node.packageKey, node.packageKey);
|
|
260
267
|
const newDependencies = [];
|
|
261
268
|
for (const dependency of [...node.dependenciesByVersion.get(versionOfPackage)]) {
|
|
262
|
-
const nodeInTargetTeam = yield
|
|
269
|
+
const nodeInTargetTeam = yield this.nodeApi.findOneByKeyAndRootNodeKey(dependency.key, dependency.key);
|
|
263
270
|
const draftIdOfVersionedDependency = draftIdsByPackageKeyAndVersion.get(`${dependency.key}_${dependency.version}`);
|
|
264
271
|
dependency.version = sourceToTargetVersionsByNodeKey.get(dependency.key).get(dependency.version);
|
|
265
272
|
dependency.updateAvailable = dependency.updateAvailable;
|
|
@@ -267,18 +274,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
267
274
|
dependency.rootNodeId = createdNode.rootNodeId;
|
|
268
275
|
dependency.draftId = draftIdOfVersionedDependency;
|
|
269
276
|
newDependencies.push(dependency);
|
|
270
|
-
yield
|
|
277
|
+
yield this.packageDependenciesApi.deleteDependency(createdNode.id, dependency.key);
|
|
271
278
|
}
|
|
272
279
|
if (newDependencies.length) {
|
|
273
|
-
yield
|
|
280
|
+
yield this.packageDependenciesApi.createDependencies(createdNode.id, newDependencies);
|
|
274
281
|
}
|
|
275
282
|
});
|
|
276
283
|
}
|
|
277
284
|
publishPackage(packageToImport) {
|
|
278
285
|
return __awaiter(this, void 0, void 0, function* () {
|
|
279
|
-
const nodeInTargetTeam = yield
|
|
280
|
-
const nextVersion = yield
|
|
281
|
-
yield
|
|
286
|
+
const nodeInTargetTeam = yield this.nodeApi.findOneByKeyAndRootNodeKey(packageToImport.packageKey, packageToImport.packageKey);
|
|
287
|
+
const nextVersion = yield this.packageApi.findNextVersion(nodeInTargetTeam.id);
|
|
288
|
+
yield this.packageApi.publishPackage({
|
|
282
289
|
packageKey: packageToImport.packageKey,
|
|
283
290
|
version: nextVersion.version,
|
|
284
291
|
publishMessage: "Published package after import",
|
|
@@ -288,7 +295,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
288
295
|
}
|
|
289
296
|
batchExportPackages(packageKeys, includeDependencies, excludeActionFlows) {
|
|
290
297
|
return __awaiter(this, void 0, void 0, function* () {
|
|
291
|
-
const allPackages = yield
|
|
298
|
+
const allPackages = yield this.packageApi.findAllPackages();
|
|
292
299
|
let nodesListToExport = allPackages.filter(node => packageKeys.includes(node.key));
|
|
293
300
|
const versionsByNodeKey = new Map();
|
|
294
301
|
const allPackageKeys = allPackages.map(p => p.key);
|
|
@@ -302,7 +309,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
302
309
|
const dependencyPackages = yield this.getDependencyPackages(nodesListToExport, [], allPackages, [], versionsByNodeKey);
|
|
303
310
|
nodesListToExport.push(...dependencyPackages);
|
|
304
311
|
}
|
|
305
|
-
const packagesWithVariableAssignments = yield
|
|
312
|
+
const packagesWithVariableAssignments = yield this.variableService.getVariableAssignmentsForNodes();
|
|
306
313
|
nodesListToExport.forEach(node => {
|
|
307
314
|
var _a;
|
|
308
315
|
node.variables = (_a = packagesWithVariableAssignments.find(nodeWithVariablesAssignment => nodeWithVariablesAssignment.key === node.key)) === null || _a === void 0 ? void 0 : _a.variableAssignments;
|
|
@@ -311,17 +318,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
311
318
|
packageWithVariablesAssignments.variableAssignments = packageWithVariablesAssignments.variableAssignments.filter(variable => variable.value && variable.type === package_manager_interfaces_1.PackageManagerVariableType.DATA_MODEL);
|
|
312
319
|
return packageWithVariablesAssignments;
|
|
313
320
|
});
|
|
314
|
-
const dataModelDetailsByNode = yield
|
|
321
|
+
const dataModelDetailsByNode = yield this.dataModelService.getDataModelDetailsForPackages(packagesWithDataModelVariables);
|
|
315
322
|
nodesListToExport.forEach(node => {
|
|
316
323
|
node.datamodels = dataModelDetailsByNode.get(node.key);
|
|
317
324
|
});
|
|
318
|
-
nodesListToExport = yield
|
|
325
|
+
nodesListToExport = yield this.spaceService.getParentSpaces(nodesListToExport);
|
|
319
326
|
yield this.exportToZip(nodesListToExport, versionsByNodeKey, excludeActionFlows);
|
|
320
327
|
});
|
|
321
328
|
}
|
|
322
329
|
getNodesWithActiveVersion(nodes) {
|
|
323
330
|
return __awaiter(this, void 0, void 0, function* () {
|
|
324
|
-
const activeVersionsOfPackage = yield
|
|
331
|
+
const activeVersionsOfPackage = yield this.packageApi.findActiveVersionByIds(nodes.map(node => node.id));
|
|
325
332
|
nodes.forEach(node => {
|
|
326
333
|
node.version = activeVersionsOfPackage.find(packageVersion => packageVersion.id === node.id);
|
|
327
334
|
});
|
|
@@ -330,8 +337,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
330
337
|
}
|
|
331
338
|
getPackagesWithDependencies(draftIdByNodeId) {
|
|
332
339
|
return __awaiter(this, void 0, void 0, function* () {
|
|
333
|
-
|
|
334
|
-
return allPackageDependencies;
|
|
340
|
+
return yield this.packageDependenciesApi.findPackageDependenciesByIds(draftIdByNodeId);
|
|
335
341
|
});
|
|
336
342
|
}
|
|
337
343
|
getDependencyPackages(nodesToResolve, dependencyPackages, allPackages, resolvedDependencies, versionsByNodeKey) {
|
|
@@ -383,7 +389,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
383
389
|
return __awaiter(this, void 0, void 0, function* () {
|
|
384
390
|
const zips = [];
|
|
385
391
|
for (const rootPackage of nodes) {
|
|
386
|
-
const exportedPackage = yield
|
|
392
|
+
const exportedPackage = yield this.packageApi.exportPackage(rootPackage.key, rootPackage.version.version, excludeActionFlows);
|
|
387
393
|
zips.push({
|
|
388
394
|
data: exportedPackage,
|
|
389
395
|
packageKey: rootPackage.key,
|
|
@@ -398,7 +404,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
398
404
|
const manifestNodes = this.exportManifestOfPackages(nodes, versionsByNodeKey);
|
|
399
405
|
const packageZips = yield this.exportPackagesAndAssets(nodes, excludeActionFlows);
|
|
400
406
|
const zip = new AdmZip();
|
|
401
|
-
zip.addFile("manifest.yml", Buffer.from((0,
|
|
407
|
+
zip.addFile("manifest.yml", Buffer.from((0, yaml_2.stringify)(manifestNodes), "utf8"));
|
|
402
408
|
for (const packageZip of packageZips) {
|
|
403
409
|
zip.addFile(`${packageZip.packageKey}_${packageZip.version}.zip`, packageZip.data);
|
|
404
410
|
}
|
|
@@ -409,7 +415,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
409
415
|
}
|
|
410
416
|
exportManifestOfPackages(nodes, dependencyVersionsByNodeKey) {
|
|
411
417
|
const manifestNodesByPackageKey = new Map();
|
|
412
|
-
nodes.forEach(
|
|
418
|
+
nodes.forEach(node => {
|
|
413
419
|
var _a, _b, _c, _d;
|
|
414
420
|
const manifestNode = (_a = manifestNodesByPackageKey.get(node.key)) !== null && _a !== void 0 ? _a : {};
|
|
415
421
|
manifestNode.packageKey = node.key;
|
|
@@ -418,7 +424,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
418
424
|
spaceName: node.space.name,
|
|
419
425
|
spaceIcon: node.space.iconReference
|
|
420
426
|
};
|
|
421
|
-
manifestNode.variables = (_b = node.variables) === null || _b === void 0 ? void 0 : _b.map(
|
|
427
|
+
manifestNode.variables = (_b = node.variables) === null || _b === void 0 ? void 0 : _b.map(variable => {
|
|
422
428
|
var _a;
|
|
423
429
|
if (variable.type === package_manager_interfaces_1.PackageManagerVariableType.DATA_MODEL) {
|
|
424
430
|
// @ts-ignore
|
|
@@ -438,6 +444,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
438
444
|
});
|
|
439
445
|
return [...manifestNodesByPackageKey.values()];
|
|
440
446
|
}
|
|
447
|
+
readManifestFile(importedFileName) {
|
|
448
|
+
const manifest = (0, yaml_1.parse)(fs.readFileSync(path.resolve(importedFileName + "/manifest.yml"), { encoding: "utf-8" }));
|
|
449
|
+
return Promise.all(manifest);
|
|
450
|
+
}
|
|
441
451
|
}
|
|
442
|
-
exports.
|
|
452
|
+
exports.PackageService = PackageService;
|
|
443
453
|
});
|
package/{services/package-manager/space-service.js → commands/studio/service/space.service.js}
RENAMED
|
@@ -13,24 +13,25 @@ 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", "
|
|
16
|
+
define(["require", "exports", "uuid", "../api/space-api"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.
|
|
22
|
-
const space_api_1 = require("../../api/space-api");
|
|
21
|
+
exports.SpaceService = void 0;
|
|
23
22
|
const uuid_1 = require("uuid");
|
|
23
|
+
const space_api_1 = require("../api/space-api");
|
|
24
24
|
class SpaceService {
|
|
25
|
-
constructor() {
|
|
25
|
+
constructor(context) {
|
|
26
26
|
this.allSpaces = [];
|
|
27
|
+
this.spaceApi = new space_api_1.SpaceApi(context);
|
|
27
28
|
}
|
|
28
29
|
getParentSpaces(nodes) {
|
|
29
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
31
|
const promises = [];
|
|
31
32
|
nodes.forEach(node => {
|
|
32
33
|
promises.push(new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
node.space = yield
|
|
34
|
+
node.space = yield this.spaceApi.findOne(node.spaceId);
|
|
34
35
|
resolve(node);
|
|
35
36
|
})));
|
|
36
37
|
});
|
|
@@ -39,7 +40,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
39
40
|
}
|
|
40
41
|
createSpace(spaceName, spaceIcon) {
|
|
41
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
const newSpace = yield
|
|
43
|
+
const newSpace = yield this.spaceApi.createSpace({
|
|
43
44
|
id: (0, uuid_1.v4)(),
|
|
44
45
|
name: spaceName,
|
|
45
46
|
iconReference: spaceIcon
|
|
@@ -54,11 +55,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
54
55
|
if (this.allSpaces.length) {
|
|
55
56
|
return this.allSpaces;
|
|
56
57
|
}
|
|
57
|
-
this.allSpaces = yield
|
|
58
|
+
this.allSpaces = yield this.spaceApi.findAllSpaces();
|
|
58
59
|
return this.allSpaces;
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
|
-
SpaceService
|
|
63
|
-
exports.spaceService = SpaceService.INSTANCE;
|
|
63
|
+
exports.SpaceService = SpaceService;
|
|
64
64
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
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", "../api/package-api", "../api/studio-variables-api"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.StudioVariableService = void 0;
|
|
22
|
+
const package_api_1 = require("../api/package-api");
|
|
23
|
+
const studio_variables_api_1 = require("../api/studio-variables-api");
|
|
24
|
+
class StudioVariableService {
|
|
25
|
+
constructor(context) {
|
|
26
|
+
this.packageApi = new package_api_1.PackageApi(context);
|
|
27
|
+
this.variablesApi = new studio_variables_api_1.StudioVariablesApi(context);
|
|
28
|
+
}
|
|
29
|
+
getVariableAssignmentsForNodes(type) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
return yield this.packageApi.findAllPackagesWithVariableAssignments(type);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
assignVariableValues(packageKey, variablesAssignments) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
yield this.variablesApi.assignVariableValues(packageKey, variablesAssignments);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.StudioVariableService = StudioVariableService;
|
|
41
|
+
});
|
package/content-cli.js
CHANGED
|
@@ -1,39 +1,88 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
(function (factory) {
|
|
3
12
|
if (typeof module === "object" && typeof module.exports === "object") {
|
|
4
13
|
var v = factory(require, exports);
|
|
5
14
|
if (v !== undefined) module.exports = v;
|
|
6
15
|
}
|
|
7
16
|
else if (typeof define === "function" && define.amd) {
|
|
8
|
-
define(["require", "exports", "
|
|
17
|
+
define(["require", "exports", "semver/functions/satisfies", "commander", "./core/command/module-handler", "./core/command/cli-context", "./core/utils/version", "./core/utils/logger"], factory);
|
|
9
18
|
}
|
|
10
19
|
})(function (require, exports) {
|
|
11
20
|
"use strict";
|
|
12
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
const logger_1 = require("./util/logger");
|
|
14
22
|
const semverSatisfies = require("semver/functions/satisfies");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
23
|
+
const commander_1 = require("commander");
|
|
24
|
+
const module_handler_1 = require("./core/command/module-handler");
|
|
25
|
+
const cli_context_1 = require("./core/command/cli-context");
|
|
26
|
+
const version_1 = require("./core/utils/version");
|
|
27
|
+
const logger_1 = require("./core/utils/logger");
|
|
28
|
+
/**
|
|
29
|
+
* Celonis Content CLI.
|
|
30
|
+
*
|
|
31
|
+
* This is the main entry point for the CLI.
|
|
32
|
+
*/
|
|
33
|
+
// Check if the Node.js version satisfies the minimum requirements
|
|
17
34
|
const requiredVersion = ">=10.10.0";
|
|
18
35
|
if (!semverSatisfies(process.version, requiredVersion)) {
|
|
19
36
|
logger_1.logger.error(`Node version ${process.version} not supported. Please upgrade your node version to ${requiredVersion}`);
|
|
20
37
|
process.exit(1);
|
|
21
38
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
// Global configuration options
|
|
40
|
+
const program = new commander_1.Command();
|
|
41
|
+
program.version(version_1.VersionUtils.getCurrentCliVersion());
|
|
42
|
+
program.option("-q, --quietmode", "Reduce output to a minimum", false);
|
|
43
|
+
program.option("-p, --profile [profile]");
|
|
44
|
+
program.option("--debug", "Print debug messages", false);
|
|
45
|
+
program.option("--dev", "Development Mode", false);
|
|
46
|
+
program.parseOptions(process.argv);
|
|
47
|
+
if (!program.opts().quietmode) {
|
|
48
|
+
console.log(`Content CLI - (C) Copyright 2025 - Celonis SE - Version ${version_1.VersionUtils.getCurrentCliVersion()}`);
|
|
49
|
+
console.log();
|
|
50
|
+
}
|
|
51
|
+
if (program.opts().debug) {
|
|
52
|
+
logger_1.logger.transports.forEach(t => {
|
|
53
|
+
t.level = "debug";
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* To support the legacy command structure, we have to configure some root commands
|
|
58
|
+
* that the individual modules will extend.
|
|
59
|
+
*/
|
|
60
|
+
function configureRootCommands(configurator) {
|
|
61
|
+
configurator.command("list")
|
|
62
|
+
.description("Commands to list content.")
|
|
63
|
+
.alias("ls");
|
|
38
64
|
}
|
|
65
|
+
function run() {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const context = new cli_context_1.Context(program.opts());
|
|
68
|
+
yield context.init();
|
|
69
|
+
const moduleHandler = new module_handler_1.ModuleHandler(program, context);
|
|
70
|
+
configureRootCommands(moduleHandler.configurator);
|
|
71
|
+
moduleHandler.discoverAndRegisterModules(__dirname, program.opts().dev);
|
|
72
|
+
try {
|
|
73
|
+
program.parse(process.argv);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
logger_1.logger.error(`An unexpected error occurred: ${error}`);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
run();
|
|
81
|
+
// catch uncaught exceptions
|
|
82
|
+
process.on("uncaughtException", (error, origin) => {
|
|
83
|
+
console.error("\n💥 UNCAUGHT EXCEPTION!\n");
|
|
84
|
+
console.error("Error:", error);
|
|
85
|
+
console.error("Origin:", origin);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
});
|
|
39
88
|
});
|
|
@@ -0,0 +1,69 @@
|
|
|
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", "../http/http-client", "../profile/profile.service", "../utils/logger"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.Context = void 0;
|
|
22
|
+
const http_client_1 = require("../http/http-client");
|
|
23
|
+
const profile_service_1 = require("../profile/profile.service");
|
|
24
|
+
const logger_1 = require("../utils/logger");
|
|
25
|
+
/**
|
|
26
|
+
* The execution context object is passed to the modules to access
|
|
27
|
+
* foundational services such as APIs, profiles, logging etc. It is
|
|
28
|
+
* configured upon the start of the CLI.
|
|
29
|
+
*/
|
|
30
|
+
class Context {
|
|
31
|
+
constructor(options) {
|
|
32
|
+
this.log = logger_1.logger;
|
|
33
|
+
this.profileService = new profile_service_1.ProfileService();
|
|
34
|
+
this.profileName = options.profile;
|
|
35
|
+
}
|
|
36
|
+
init() {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
yield this.loadProfile(this.profileName);
|
|
39
|
+
if (this.profile) {
|
|
40
|
+
// only if a profile is available, it makes sense to provide an initialized
|
|
41
|
+
// HttpClient API.
|
|
42
|
+
this.httpClient = new http_client_1.HttpClient(this);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
loadProfile(profileName) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
if (!profileName) {
|
|
49
|
+
this.log.debug("Profile name not specified, using default profile name");
|
|
50
|
+
profileName = this.profileService.getDefaultProfile();
|
|
51
|
+
if (!profileName) {
|
|
52
|
+
this.log.debug("A default profile is not configured.");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
this.profile = yield this.profileService.findProfile(profileName);
|
|
57
|
+
this.profileName = profileName;
|
|
58
|
+
this.log.debug(`Using profile ${profileName}`);
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
this.log.error(err);
|
|
62
|
+
this.profile = undefined;
|
|
63
|
+
this.profileName = undefined;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.Context = Context;
|
|
69
|
+
});
|