@celonis/content-cli 1.11.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/action-flows/action-flow/action-flow.service.js +4 -2
- package/commands/asset-registry/asset-registry-api.js +33 -7
- package/commands/asset-registry/asset-registry.service.js +25 -3
- package/commands/asset-registry/module.js +15 -0
- package/commands/configuration-management/api/metadata-api.js +38 -0
- package/commands/configuration-management/api/single-package-export-api.js +38 -0
- package/commands/configuration-management/api/{diff-api.js → single-package-import-api.js} +5 -10
- package/commands/configuration-management/api/staging-package-api.js +39 -0
- package/commands/configuration-management/api/variable-api.js +36 -0
- package/commands/configuration-management/config-command.service.js +1 -63
- package/commands/configuration-management/connection-variable.helper.js +30 -0
- package/commands/configuration-management/interfaces/single-package-import.interfaces.js +12 -0
- package/commands/configuration-management/metadata.service.js +50 -0
- package/commands/configuration-management/module.js +80 -16
- package/commands/configuration-management/single-package-export.service.js +64 -0
- package/commands/configuration-management/single-package-import.service.js +131 -0
- package/commands/configuration-management/staging-package.service.js +50 -0
- package/commands/configuration-management/variable.service.js +18 -21
- package/commands/studio/manager/package.manager.js +1 -1
- package/commands/studio/module.js +8 -4
- package/commands/t2tc/api/diff-api.js +40 -0
- package/commands/{configuration-management/api/batch-import-export-api.js → t2tc/api/t2tc-package-api.js} +3 -29
- package/commands/{configuration-management → t2tc}/diff.service.js +7 -7
- package/commands/t2tc/module.js +105 -0
- package/commands/{configuration-management → t2tc}/studio.service.js +2 -17
- package/commands/t2tc/t2tc-command.service.js +88 -0
- package/commands/{configuration-management/batch-import-export.service.js → t2tc/t2tc-package.service.js} +26 -52
- package/commands/view/module.js +54 -0
- package/commands/view/view-bookmarks-command.service.js +45 -0
- package/commands/view/view-bookmarks.manager-factory.js +39 -0
- package/commands/view/view-bookmarks.manager.js +60 -0
- package/content-cli.js +61 -35
- package/core/command/module-handler.js +5 -0
- package/core/utils/file-service.js +45 -16
- package/core/utils/path.js +17 -0
- package/lib/commands/asset-registry/asset-registry-api.d.ts +5 -0
- package/lib/commands/asset-registry/asset-registry.interfaces.d.ts +5 -0
- package/lib/commands/asset-registry/asset-registry.service.d.ts +3 -1
- package/lib/commands/asset-registry/module.d.ts +1 -0
- package/lib/commands/configuration-management/api/metadata-api.d.ts +7 -0
- package/lib/commands/configuration-management/api/single-package-export-api.d.ts +7 -0
- package/lib/commands/configuration-management/api/single-package-import-api.d.ts +8 -0
- package/lib/commands/configuration-management/api/staging-package-api.d.ts +7 -0
- package/lib/commands/configuration-management/api/variable-api.d.ts +7 -0
- package/lib/commands/configuration-management/config-command.service.d.ts +0 -8
- package/lib/commands/configuration-management/connection-variable.helper.d.ts +2 -0
- package/lib/commands/configuration-management/interfaces/single-package-import.interfaces.d.ts +19 -0
- package/lib/commands/configuration-management/metadata.service.d.ts +7 -0
- package/lib/commands/configuration-management/module.d.ts +4 -1
- package/lib/commands/configuration-management/single-package-export.service.d.ts +8 -0
- package/lib/commands/configuration-management/single-package-import.service.d.ts +13 -0
- package/lib/commands/configuration-management/staging-package.service.d.ts +7 -0
- package/lib/commands/configuration-management/variable.service.d.ts +1 -2
- package/lib/commands/t2tc/api/diff-api.d.ts +9 -0
- package/lib/commands/{configuration-management/api/batch-import-export-api.d.ts → t2tc/api/t2tc-package-api.d.ts} +3 -6
- package/lib/commands/{configuration-management → t2tc}/diff.service.d.ts +1 -1
- package/lib/commands/t2tc/module.d.ts +10 -0
- package/lib/commands/{configuration-management → t2tc}/studio.service.d.ts +1 -3
- package/lib/commands/t2tc/t2tc-command.service.d.ts +12 -0
- package/lib/commands/{configuration-management/batch-import-export.service.d.ts → t2tc/t2tc-package.service.d.ts} +3 -5
- package/lib/commands/view/module.d.ts +11 -0
- package/lib/commands/view/view-bookmarks-command.service.d.ts +7 -0
- package/lib/commands/view/view-bookmarks.manager-factory.d.ts +8 -0
- package/lib/commands/view/view-bookmarks.manager.d.ts +20 -0
- package/lib/content-cli.d.ts +15 -1
- package/lib/core/utils/file-service.d.ts +8 -1
- package/lib/core/utils/path.d.ts +1 -0
- package/package.json +4 -4
- package/lib/commands/configuration-management/api/diff-api.d.ts +0 -9
- /package/commands/{configuration-management/interfaces → t2tc}/batch-export-import.constants.js +0 -0
- /package/lib/commands/{configuration-management/interfaces → t2tc}/batch-export-import.constants.d.ts +0 -0
|
@@ -16,23 +16,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
16
16
|
if (v !== undefined) module.exports = v;
|
|
17
17
|
}
|
|
18
18
|
else if (typeof define === "function" && define.amd) {
|
|
19
|
-
define(["require", "exports", "../../core/command/module-handler", "./config-command.service", "./variable-command.service", "./node.service", "./node-diff.service", "./node-dependency.service", "./package-version-command.service", "./package-validation.service"], factory);
|
|
19
|
+
define(["require", "exports", "../../core/command/module-handler", "./config-command.service", "./staging-package.service", "./metadata.service", "../t2tc/t2tc-command.service", "./variable-command.service", "./node.service", "./node-diff.service", "./node-dependency.service", "./package-version-command.service", "./package-validation.service", "./single-package-import.service", "./single-package-export.service"], factory);
|
|
20
20
|
}
|
|
21
21
|
})(function (require, exports) {
|
|
22
22
|
"use strict";
|
|
23
23
|
const module_handler_1 = require("../../core/command/module-handler");
|
|
24
24
|
const config_command_service_1 = require("./config-command.service");
|
|
25
|
+
const staging_package_service_1 = require("./staging-package.service");
|
|
26
|
+
const metadata_service_1 = require("./metadata.service");
|
|
27
|
+
const t2tc_command_service_1 = require("../t2tc/t2tc-command.service");
|
|
25
28
|
const variable_command_service_1 = require("./variable-command.service");
|
|
26
29
|
const node_service_1 = require("./node.service");
|
|
27
30
|
const node_diff_service_1 = require("./node-diff.service");
|
|
28
31
|
const node_dependency_service_1 = require("./node-dependency.service");
|
|
29
32
|
const package_version_command_service_1 = require("./package-version-command.service");
|
|
30
33
|
const package_validation_service_1 = require("./package-validation.service");
|
|
34
|
+
const single_package_import_service_1 = require("./single-package-import.service");
|
|
35
|
+
const single_package_export_service_1 = require("./single-package-export.service");
|
|
31
36
|
class Module extends module_handler_1.IModule {
|
|
32
37
|
register(context, configurator) {
|
|
33
|
-
const configCommand = configurator.command("config")
|
|
38
|
+
const configCommand = configurator.command("config")
|
|
39
|
+
.description("Manage package configurations and their resources (package, nodes, versions, variables, metadata). Note: 'config list/export/import/diff' are deprecated — bulk Team-to-Team Copy operations have moved to the 't2tc package' group, and single-package operations live under 'config package'.");
|
|
34
40
|
configCommand.command("list")
|
|
35
|
-
.description("
|
|
41
|
+
.description("[Deprecated] Use 't2tc package list' instead. List packages in the target team.")
|
|
42
|
+
.deprecationNotice("'config list' is deprecated and will be removed in a future release. Use 't2tc package list' instead.")
|
|
36
43
|
.option("--json", "Return response as json type", "")
|
|
37
44
|
.option("--flavors <flavors...>", "Lists only packages of the given flavors")
|
|
38
45
|
.option("--withDependencies", "Include dependencies", "")
|
|
@@ -44,7 +51,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
44
51
|
.option("--staging", "List staging packages instead", false)
|
|
45
52
|
.action(this.listPackages);
|
|
46
53
|
configCommand.command("export")
|
|
47
|
-
.description("
|
|
54
|
+
.description("[Deprecated] Use 't2tc package export' instead. Export one or more packages into a Team-to-Team Copy archive.")
|
|
55
|
+
.deprecationNotice("'config export' is deprecated and will be removed in a future release. Use 't2tc package export' instead.")
|
|
48
56
|
.option("--packageKeys <packageKeys...>", "Keys of packages to export. Exports the latest deployed version only")
|
|
49
57
|
.option("--keysByVersion <keysByVersion...>", "Keys of packages to export by version")
|
|
50
58
|
.option("--withDependencies", "Include variables and dependencies", "")
|
|
@@ -56,12 +64,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
56
64
|
.description("Commands related to package metadata");
|
|
57
65
|
metadataCommand
|
|
58
66
|
.command("export")
|
|
59
|
-
.description("
|
|
67
|
+
.description("Show whether multiple packages have unpublished changes (bulk metadata export).")
|
|
60
68
|
.requiredOption("--packageKeys <packageKeys...>", "Keys of packages to find the metadata of")
|
|
61
69
|
.option("--json", "Return response as json type", "")
|
|
62
|
-
.action(this.
|
|
70
|
+
.action(this.exportPackagesMetadata);
|
|
63
71
|
configCommand.command("import")
|
|
64
|
-
.description("
|
|
72
|
+
.description("[Deprecated] Use 't2tc package import' (batch) or 'config package import' (single package) instead. Import packages from a Team-to-Team Copy archive.")
|
|
73
|
+
.deprecationNotice("'config import' is deprecated and will be removed in a future release. Use 't2tc package import' (batch archive) or 'config package import' (single package) instead.")
|
|
65
74
|
.option("--overwrite", "Flag to allow overwriting of packages")
|
|
66
75
|
.option("--validate", "Validate node configurations before import", false)
|
|
67
76
|
.option("--gitProfile <gitProfile>", "Git profile which you want to use for the Git operations")
|
|
@@ -69,16 +78,49 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
69
78
|
.option("-f, --file <file>", "Exported packages file (relative path)")
|
|
70
79
|
.option("-d, --directory <directory>", "Exported packages directory (relative path)")
|
|
71
80
|
.action(this.batchImportPackages);
|
|
72
|
-
configCommand.command("
|
|
81
|
+
const packageCommand = configCommand.command("package")
|
|
82
|
+
.description("Commands for working with a single package.");
|
|
83
|
+
packageCommand.command("import")
|
|
84
|
+
.description("Import a package from a zip file, directory, or Git branch. Uses the package format, which is not interchangeable with the 't2tc package export' / 't2tc package import' batch archive.")
|
|
85
|
+
.option("-f, --file <file>", "Package zip file (relative path)")
|
|
86
|
+
.option("-d, --directory <directory>", "Package directory (relative path)")
|
|
87
|
+
.option("--overwrite", "Flag to allow overwriting an existing package with the same key")
|
|
88
|
+
.option("--json", "Return the response as a JSON file")
|
|
89
|
+
.option("--gitProfile <gitProfile>", "Git profile which you want to use for the Git operations")
|
|
90
|
+
.option("--gitBranch <gitBranch>", "Git branch from which you want to pull the package and import")
|
|
91
|
+
.action(this.importSinglePackage);
|
|
92
|
+
packageCommand.command("export")
|
|
93
|
+
.description("Export a single package's staging (draft) version to an unzipped directory (or a single zip with --zip, or to a Git branch with --gitBranch). Uses the package format, which is not interchangeable with the 't2tc package export' / 't2tc package import' batch archive.")
|
|
94
|
+
.requiredOption("--packageKey <packageKey>", "Key of the package to export")
|
|
95
|
+
.option("--zip", "Export the package as a single <packageKey>.zip file instead of an unzipped <packageKey> directory", false)
|
|
96
|
+
.option("--gitProfile <gitProfile>", "Git profile which you want to use for the Git operations")
|
|
97
|
+
.option("--gitBranch <gitBranch>", "Git branch in which you want to push the exported package")
|
|
98
|
+
.action(this.exportSinglePackage);
|
|
99
|
+
packageCommand.command("validate")
|
|
73
100
|
.description("Validate package node configurations")
|
|
74
101
|
.requiredOption("--packageKey <packageKey>", "Key of the package to validate")
|
|
75
|
-
.option("--layers <layers...>", "Validation layers to run. Allowed values: SCHEMA, BUSINESS, PACKAGE_SETTINGS (can be combined, e.g. --layers SCHEMA BUSINESS PACKAGE_SETTINGS). Defaults to SCHEMA.", ["SCHEMA"])
|
|
102
|
+
.option("--layers <layers...>", "Validation layers to run. Allowed values: SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES (can be combined, e.g. --layers SCHEMA BUSINESS PACKAGE_SETTINGS PIG_SEMANTICS DATA_PIPELINES). Defaults to SCHEMA.", ["SCHEMA"])
|
|
103
|
+
.option("--nodeKeys <nodeKeys...>", "Specific node keys to validate (default: all nodes)")
|
|
104
|
+
.option("--json", "Return the response as a JSON file")
|
|
105
|
+
.action(this.validatePackage);
|
|
106
|
+
packageCommand.command("list")
|
|
107
|
+
.description("List packages in the target team. Lists staging packages by default.")
|
|
108
|
+
.option("--json", "Return response as json type", "")
|
|
109
|
+
.option("--flavors <flavors...>", "Lists only packages of the given flavors")
|
|
110
|
+
.action(this.listStagingPackages);
|
|
111
|
+
configCommand.command("validate")
|
|
112
|
+
.description("[Deprecated] Use 'config package validate' instead. Validate package node configurations.")
|
|
113
|
+
.deprecationNotice("'config validate' is deprecated and will be removed in a future release. Use 'config package validate' instead.")
|
|
114
|
+
.requiredOption("--packageKey <packageKey>", "Key of the package to validate")
|
|
115
|
+
.option("--layers <layers...>", "Validation layers to run. Allowed values: SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES (can be combined, e.g. --layers SCHEMA BUSINESS PACKAGE_SETTINGS PIG_SEMANTICS DATA_PIPELINES). Defaults to SCHEMA.", ["SCHEMA"])
|
|
76
116
|
.option("--nodeKeys <nodeKeys...>", "Specific node keys to validate (default: all nodes)")
|
|
77
117
|
.option("--json", "Return the response as a JSON file")
|
|
78
118
|
.action(this.validatePackage);
|
|
79
119
|
configCommand.command("diff")
|
|
80
|
-
.description("
|
|
120
|
+
.description("[Deprecated] Use 't2tc package diff' instead. Diff a local Team-to-Team Copy archive against deployed or staging packages.")
|
|
121
|
+
.deprecationNotice("'config diff' is deprecated and will be removed in a future release. Use 't2tc package diff' instead.")
|
|
81
122
|
.option("--hasChanges", "Flag to return only the information if the package has changes without the actual changes")
|
|
123
|
+
.option("--baseVersion <version>", "Compare against a given version or STAGING")
|
|
82
124
|
.option("--json", "Return the response as a JSON file")
|
|
83
125
|
.requiredOption("-f, --file <file>", "Exported packages file (relative or absolute path)")
|
|
84
126
|
.action(this.diffPackages);
|
|
@@ -184,7 +226,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
184
226
|
if (options.packageKeys && options.keysByVersion) {
|
|
185
227
|
throw new Error("Please provide either --packageKeys or --keysByVersion, but not both.");
|
|
186
228
|
}
|
|
187
|
-
yield new
|
|
229
|
+
yield new t2tc_command_service_1.T2tcCommandService(context).listPackages(options.json, options.flavors, options.withDependencies, options.packageKeys, options.keysByVersion, options.variableValue, options.variableType, options.branches, options.staging);
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
listStagingPackages(context, command, options) {
|
|
233
|
+
var _a;
|
|
234
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
235
|
+
yield new staging_package_service_1.StagingPackageService(context).listStagingPackages((_a = options.flavors) !== null && _a !== void 0 ? _a : [], false, options.json);
|
|
188
236
|
});
|
|
189
237
|
}
|
|
190
238
|
batchExportPackages(context, command, options) {
|
|
@@ -197,12 +245,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
197
245
|
throw new Error("Please specify a branch using --gitBranch when using a Git profile.");
|
|
198
246
|
}
|
|
199
247
|
options.withDependencies = (_a = options.withDependencies) !== null && _a !== void 0 ? _a : false;
|
|
200
|
-
yield new
|
|
248
|
+
yield new t2tc_command_service_1.T2tcCommandService(context).batchExportPackages(options.packageKeys, options.keysByVersion, options.withDependencies, options.gitBranch, options.unzip);
|
|
201
249
|
});
|
|
202
250
|
}
|
|
203
|
-
|
|
251
|
+
exportPackagesMetadata(context, command, options) {
|
|
204
252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
-
yield new
|
|
253
|
+
yield new metadata_service_1.MetadataService(context).exportPackagesMetadata(options.packageKeys, options.json);
|
|
206
254
|
});
|
|
207
255
|
}
|
|
208
256
|
getPackageVersion(context, command, options) {
|
|
@@ -228,12 +276,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
228
276
|
if (options.gitProfile && !options.gitBranch) {
|
|
229
277
|
throw new Error("Please specify a branch using --gitBranch when using a Git profile.");
|
|
230
278
|
}
|
|
231
|
-
yield new
|
|
279
|
+
yield new t2tc_command_service_1.T2tcCommandService(context).batchImportPackages(options.file, options.directory, options.overwrite, options.gitBranch, options.validate);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
importSinglePackage(context, command, options) {
|
|
283
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
284
|
+
if (options.gitProfile && !options.gitBranch) {
|
|
285
|
+
throw new Error("Please specify a branch using --gitBranch when using a Git profile.");
|
|
286
|
+
}
|
|
287
|
+
yield new single_package_import_service_1.SinglePackageImportService(context).importPackage(options.file, options.directory, options.overwrite, options.json, options.gitBranch);
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
exportSinglePackage(context, command, options) {
|
|
291
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
292
|
+
if (options.gitProfile && !options.gitBranch) {
|
|
293
|
+
throw new Error("Please specify a branch using --gitBranch when using a Git profile.");
|
|
294
|
+
}
|
|
295
|
+
yield new single_package_export_service_1.SinglePackageExportService(context).exportPackage(options.packageKey, options.zip, options.gitBranch);
|
|
232
296
|
});
|
|
233
297
|
}
|
|
234
298
|
diffPackages(context, command, options) {
|
|
235
299
|
return __awaiter(this, void 0, void 0, function* () {
|
|
236
|
-
yield new
|
|
300
|
+
yield new t2tc_command_service_1.T2tcCommandService(context).diffPackages(options.file, options.hasChanges, options.baseVersion, options.json);
|
|
237
301
|
});
|
|
238
302
|
}
|
|
239
303
|
validatePackage(context, command, options) {
|
|
@@ -0,0 +1,64 @@
|
|
|
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:fs", "../../core/utils/file-service", "../../core/utils/logger", "../../core/git-profile/git/git.service", "./api/single-package-export-api", "node:path"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.SinglePackageExportService = void 0;
|
|
22
|
+
const fs = require("node:fs");
|
|
23
|
+
const file_service_1 = require("../../core/utils/file-service");
|
|
24
|
+
const logger_1 = require("../../core/utils/logger");
|
|
25
|
+
const git_service_1 = require("../../core/git-profile/git/git.service");
|
|
26
|
+
const single_package_export_api_1 = require("./api/single-package-export-api");
|
|
27
|
+
const node_path_1 = require("node:path");
|
|
28
|
+
class SinglePackageExportService {
|
|
29
|
+
constructor(context) {
|
|
30
|
+
this.singlePackageExportApi = new single_package_export_api_1.SinglePackageExportApi(context);
|
|
31
|
+
this.gitService = new git_service_1.GitService(context);
|
|
32
|
+
}
|
|
33
|
+
exportPackage(packageKey, zip, gitBranch) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const packageData = yield this.singlePackageExportApi.exportPackage(packageKey);
|
|
36
|
+
if (gitBranch) {
|
|
37
|
+
yield this.exportToGitBranch(packageData, gitBranch);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (zip) {
|
|
41
|
+
const fileName = `${packageKey}.zip`;
|
|
42
|
+
file_service_1.fileService.writeBufferToFileWithGivenName(packageData, (0, node_path_1.resolve)(process.cwd(), fileName));
|
|
43
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + fileName);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
file_service_1.fileService.extractZipBufferToDirectory(packageData, packageKey);
|
|
47
|
+
logger_1.logger.info(`Successful export. Exported directory: ${packageKey}`);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
exportToGitBranch(packageData, gitBranch) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const extractedDirectory = file_service_1.fileService.extractZipBufferToTempDirectory(packageData);
|
|
53
|
+
try {
|
|
54
|
+
yield this.gitService.pushToBranch(extractedDirectory, gitBranch);
|
|
55
|
+
logger_1.logger.info("Successfully exported package to branch: " + gitBranch);
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
fs.rmSync(extractedDirectory, { recursive: true, force: true });
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.SinglePackageExportService = SinglePackageExportService;
|
|
64
|
+
});
|
|
@@ -0,0 +1,131 @@
|
|
|
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", "uuid", "form-data", "node:stream", "adm-zip", "node:fs", "../../core/utils/file-service", "../../core/utils/logger", "../../core/git-profile/git/git.service", "./api/single-package-import-api"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.SinglePackageImportService = void 0;
|
|
22
|
+
const uuid_1 = require("uuid");
|
|
23
|
+
const FormData = require("form-data");
|
|
24
|
+
const node_stream_1 = require("node:stream");
|
|
25
|
+
const AdmZip = require("adm-zip");
|
|
26
|
+
const fs = require("node:fs");
|
|
27
|
+
const file_service_1 = require("../../core/utils/file-service");
|
|
28
|
+
const logger_1 = require("../../core/utils/logger");
|
|
29
|
+
const git_service_1 = require("../../core/git-profile/git/git.service");
|
|
30
|
+
const single_package_import_api_1 = require("./api/single-package-import-api");
|
|
31
|
+
class SinglePackageImportService {
|
|
32
|
+
constructor(context) {
|
|
33
|
+
this.singlePackageImportApi = new single_package_import_api_1.SinglePackageImportApi(context);
|
|
34
|
+
this.gitService = new git_service_1.GitService(context);
|
|
35
|
+
}
|
|
36
|
+
importPackage(file, directory, overwrite, jsonResponse, gitBranch) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
if ((file || directory) && gitBranch) {
|
|
39
|
+
throw new Error("You cannot use --file or --directory together with --gitBranch. Only one import source can be defined.");
|
|
40
|
+
}
|
|
41
|
+
if (!file && !directory && !gitBranch) {
|
|
42
|
+
throw new Error("You must provide a --file, a --directory, or a --gitBranch option to import a package.");
|
|
43
|
+
}
|
|
44
|
+
let gitTempDir;
|
|
45
|
+
try {
|
|
46
|
+
let resolvedSource;
|
|
47
|
+
if (gitBranch) {
|
|
48
|
+
gitTempDir = yield this.gitService.pullFromBranch(gitBranch);
|
|
49
|
+
resolvedSource = { zipPath: file_service_1.fileService.zipDirectoryAsSinglePackage(gitTempDir), isTemporary: true };
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
resolvedSource = this.resolveSource(file, directory);
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const packageZip = new AdmZip(resolvedSource.zipPath);
|
|
56
|
+
const formData = this.buildBodyForImport(packageZip, resolvedSource.zipPath);
|
|
57
|
+
const result = yield this.singlePackageImportApi.importPackage(formData, overwrite);
|
|
58
|
+
this.outputResult(result, jsonResponse);
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
if (resolvedSource.isTemporary) {
|
|
62
|
+
fs.rmSync(resolvedSource.zipPath);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
finally {
|
|
67
|
+
if (gitTempDir) {
|
|
68
|
+
fs.rmSync(gitTempDir, { recursive: true, force: true });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
resolveSource(file, directory) {
|
|
74
|
+
if (file && directory) {
|
|
75
|
+
throw new Error("You cannot use both --file and --directory options at the same time. Only one import source can be defined.");
|
|
76
|
+
}
|
|
77
|
+
if (file) {
|
|
78
|
+
if (file_service_1.fileService.isDirectory(file)) {
|
|
79
|
+
throw new Error("The --file option accepts only zip files.");
|
|
80
|
+
}
|
|
81
|
+
return { zipPath: file, isTemporary: false };
|
|
82
|
+
}
|
|
83
|
+
if (!file_service_1.fileService.isDirectory(directory)) {
|
|
84
|
+
throw new Error("The --directory option accepts only directories.");
|
|
85
|
+
}
|
|
86
|
+
return { zipPath: file_service_1.fileService.zipDirectoryAsSinglePackage(directory), isTemporary: true };
|
|
87
|
+
}
|
|
88
|
+
buildBodyForImport(packageZip, sourcePath) {
|
|
89
|
+
this.assertUncompressedSizeWithinLimit(packageZip, sourcePath);
|
|
90
|
+
const formData = new FormData();
|
|
91
|
+
formData.append("packageFile", this.getReadableStream(packageZip), { filename: "package.zip" });
|
|
92
|
+
return formData;
|
|
93
|
+
}
|
|
94
|
+
assertUncompressedSizeWithinLimit(packageZip, sourcePath) {
|
|
95
|
+
const totalUncompressedBytes = packageZip.getEntries().reduce((sum, entry) => sum + entry.header.size, 0);
|
|
96
|
+
if (totalUncompressedBytes > SinglePackageImportService.MAX_UNCOMPRESSED_ZIP_SIZE) {
|
|
97
|
+
throw new Error(`Failed to handle zip file "${sourcePath}": uncompressed size ${(totalUncompressedBytes / (Math.pow(1024, 3))).toFixed(2)} GB exceeds the 4 GB limit.`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
getReadableStream(packageZip) {
|
|
101
|
+
return new node_stream_1.Readable({
|
|
102
|
+
read() {
|
|
103
|
+
this.push(packageZip.toBuffer());
|
|
104
|
+
this.push(null);
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
outputResult(result, jsonResponse) {
|
|
109
|
+
var _a;
|
|
110
|
+
if (jsonResponse) {
|
|
111
|
+
const filename = (0, uuid_1.v4)() + ".json";
|
|
112
|
+
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(result, null, 2), filename);
|
|
113
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const importedPackage = result.importedPackage;
|
|
117
|
+
const importedNodes = (_a = result.importedNodes) !== null && _a !== void 0 ? _a : [];
|
|
118
|
+
logger_1.logger.info(`Successfully imported package: ${importedPackage.key}`);
|
|
119
|
+
logger_1.logger.info(`Name: ${importedPackage.name}`);
|
|
120
|
+
if (importedPackage.flavor) {
|
|
121
|
+
logger_1.logger.info(`Flavor: ${importedPackage.flavor}`);
|
|
122
|
+
}
|
|
123
|
+
logger_1.logger.info(`Imported ${importedNodes.length} node(s).`);
|
|
124
|
+
importedNodes.forEach(node => {
|
|
125
|
+
logger_1.logger.info(` - ${node.key} (${node.type})`);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.SinglePackageImportService = SinglePackageImportService;
|
|
130
|
+
SinglePackageImportService.MAX_UNCOMPRESSED_ZIP_SIZE = 4 * 1024 * 1024 * 1024;
|
|
131
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
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", "uuid", "../../core/utils/file-service", "../../core/utils/logger", "./api/staging-package-api"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.StagingPackageService = void 0;
|
|
22
|
+
const uuid_1 = require("uuid");
|
|
23
|
+
const file_service_1 = require("../../core/utils/file-service");
|
|
24
|
+
const logger_1 = require("../../core/utils/logger");
|
|
25
|
+
const staging_package_api_1 = require("./api/staging-package-api");
|
|
26
|
+
class StagingPackageService {
|
|
27
|
+
constructor(context) {
|
|
28
|
+
this.stagingPackageApi = new staging_package_api_1.StagingPackageApi(context);
|
|
29
|
+
}
|
|
30
|
+
listStagingPackages(flavors, includeBranches, jsonResponse) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const stagingPackages = yield this.stagingPackageApi.findAllStagingPackages(flavors, includeBranches);
|
|
33
|
+
if (jsonResponse) {
|
|
34
|
+
this.exportListOfPackages(stagingPackages);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
stagingPackages.forEach(pkg => {
|
|
38
|
+
logger_1.logger.info(`${pkg.name} - Key: "${pkg.key}"`);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exportListOfPackages(packages) {
|
|
44
|
+
const filename = (0, uuid_1.v4)() + ".json";
|
|
45
|
+
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(packages), filename);
|
|
46
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.StagingPackageService = StagingPackageService;
|
|
50
|
+
});
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
if (v !== undefined) module.exports = v;
|
|
14
14
|
}
|
|
15
15
|
else if (typeof define === "function" && define.amd) {
|
|
16
|
-
define(["require", "exports", "uuid", "../../core/utils/logger", "./
|
|
16
|
+
define(["require", "exports", "uuid", "../../core/utils/logger", "./connection-variable.helper", "../../core/utils/file-service", "./api/variable-api", "url", "./api/variable-assignment-candidates-api", "./api/staging-package-variables-api"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -21,18 +21,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
21
21
|
exports.VariableService = void 0;
|
|
22
22
|
const uuid_1 = require("uuid");
|
|
23
23
|
const logger_1 = require("../../core/utils/logger");
|
|
24
|
-
const
|
|
24
|
+
const connection_variable_helper_1 = require("./connection-variable.helper");
|
|
25
25
|
const file_service_1 = require("../../core/utils/file-service");
|
|
26
|
-
const
|
|
26
|
+
const variable_api_1 = require("./api/variable-api");
|
|
27
27
|
const url_1 = require("url");
|
|
28
28
|
const variable_assignment_candidates_api_1 = require("./api/variable-assignment-candidates-api");
|
|
29
29
|
const staging_package_variables_api_1 = require("./api/staging-package-variables-api");
|
|
30
30
|
class VariableService {
|
|
31
31
|
constructor(context) {
|
|
32
|
-
this.
|
|
32
|
+
this.variableApi = new variable_api_1.VariableApi(context);
|
|
33
33
|
this.variableAssignmentCandidatesApi = new variable_assignment_candidates_api_1.VariableAssignmentCandidatesApi(context);
|
|
34
34
|
this.stagingPackageVariablesApi = new staging_package_variables_api_1.StagingPackageVariablesApi(context);
|
|
35
|
-
this.studioService = new studio_service_1.StudioService(context);
|
|
36
35
|
}
|
|
37
36
|
listVariables(keysByVersion, keysByVersionFile) {
|
|
38
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -85,25 +84,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
85
84
|
}
|
|
86
85
|
getVersionedVariablesByKeyVersionPairs(keysByVersion, keysByVersionFile) {
|
|
87
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
const variablesExportRequest =
|
|
89
|
-
const variableManifests = yield this.
|
|
90
|
-
return
|
|
87
|
+
const variablesExportRequest = this.buildKeyVersionPairs(keysByVersion, keysByVersionFile);
|
|
88
|
+
const variableManifests = yield this.variableApi.findVariablesWithValuesByPackageKeysAndVersion(variablesExportRequest);
|
|
89
|
+
return (0, connection_variable_helper_1.fixConnectionVariables)(variableManifests);
|
|
91
90
|
});
|
|
92
91
|
}
|
|
93
92
|
buildKeyVersionPairs(keysByVersion, keysByVersionFile) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return variablesExportRequest;
|
|
106
|
-
});
|
|
93
|
+
let variablesExportRequest = [];
|
|
94
|
+
if (keysByVersion.length !== 0) {
|
|
95
|
+
variablesExportRequest = this.buildKeyAndVersionPairsFromArrayInput(keysByVersion);
|
|
96
|
+
}
|
|
97
|
+
else if (keysByVersion.length === 0 && keysByVersionFile !== "") {
|
|
98
|
+
variablesExportRequest = file_service_1.fileService.readFileToJson(keysByVersionFile);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
throw new logger_1.FatalError("Please provide keysByVersion mappings or file path!");
|
|
102
|
+
}
|
|
103
|
+
return variablesExportRequest;
|
|
107
104
|
}
|
|
108
105
|
buildKeyAndVersionPairsFromArrayInput(keysByVersion) {
|
|
109
106
|
return keysByVersion.map(keyAndVersion => {
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
validateOptions() {
|
|
94
94
|
if (this.newKey && this.overwrite) {
|
|
95
95
|
logger_1.logger.error("You cannot overwrite a package and set a new key at the same time. Please use only one of the options.");
|
|
96
|
-
process.exit();
|
|
96
|
+
process.exit(1);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
getPushUrlWithParams(pushUrl) {
|
|
@@ -29,7 +29,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
29
29
|
register(context, configurator) {
|
|
30
30
|
const listCommand = configurator.command("list");
|
|
31
31
|
listCommand.command("packages")
|
|
32
|
-
.description("Command to list all packages")
|
|
32
|
+
.description("[Deprecated] Use 'config package list' instead. Command to list all packages")
|
|
33
|
+
.deprecationNotice("'list packages' is deprecated and will be removed in a future release. Use 'config package list' instead.")
|
|
33
34
|
.option("--json", "Return response as json type", "")
|
|
34
35
|
.option("--includeDependencies", "Include variables and dependencies", "")
|
|
35
36
|
.option("--packageKeys <packageKeys...>", "Lists only given package keys")
|
|
@@ -49,7 +50,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
49
50
|
.requiredOption("--key <key>", "Key of asset you want to pull")
|
|
50
51
|
.action(this.pullAsset);
|
|
51
52
|
pullCommand.command("package")
|
|
52
|
-
.description("Command to pull a package")
|
|
53
|
+
.description("[Deprecated] Use 'config package export' instead. Command to pull a package")
|
|
54
|
+
.deprecationNotice("'pull package' is deprecated and will be removed in a future release. Use 'config package export' instead.")
|
|
53
55
|
.requiredOption("--key <key>", "Key of the package you want to pull")
|
|
54
56
|
.option("--store", "Pull package with store deployment metadata")
|
|
55
57
|
.option("--newKey <newKey>", "Define a new key for your package")
|
|
@@ -66,14 +68,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
66
68
|
.requiredOption("--package <packageKey>", "Key of the package you want to push assets to")
|
|
67
69
|
.action(this.pushAssets);
|
|
68
70
|
pushCommand.command("package")
|
|
69
|
-
.description("Command to push a package to Studio")
|
|
71
|
+
.description("[Deprecated] Use 'config package import' instead. Command to push a package to Studio")
|
|
72
|
+
.deprecationNotice("'push package' is deprecated and will be removed in a future release. Use 'config package import' instead.")
|
|
70
73
|
.option("--newKey <newKey>", "Define a new key for your package")
|
|
71
74
|
.option("--overwrite", "Overwrite package and its assets")
|
|
72
75
|
.requiredOption("-f, --file <file>", "The file you want to push")
|
|
73
76
|
.requiredOption("--spaceKey <spaceKey>", "The key of the destination space")
|
|
74
77
|
.action(this.pushPackage);
|
|
75
78
|
pushCommand.command("packages")
|
|
76
|
-
.description("Command to push packages to Studio")
|
|
79
|
+
.description("[Deprecated] Use 'config package import' (single package) instead. Command to push packages to Studio")
|
|
80
|
+
.deprecationNotice("'push packages' is deprecated and will be removed in a future release. Use 'config package import' (single package) instead.")
|
|
77
81
|
.requiredOption("--spaceKey <spaceKey>", "The key of the destination space")
|
|
78
82
|
.action(this.pushPackages);
|
|
79
83
|
pushCommand.command("widget")
|
|
@@ -0,0 +1,40 @@
|
|
|
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"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.DiffApi = void 0;
|
|
22
|
+
class DiffApi {
|
|
23
|
+
constructor(context) {
|
|
24
|
+
this.httpClient = () => context.httpClient;
|
|
25
|
+
}
|
|
26
|
+
diffPackages(baseVersion, data) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const paramString = baseVersion ? "?" + new URLSearchParams({ "baseVersion": baseVersion }).toString() : "";
|
|
29
|
+
return this.httpClient().postFile(`/package-manager/api/core/packages/diff/configuration${paramString}`, data);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
hasChanges(baseVersion, data) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const paramString = baseVersion ? "?" + new URLSearchParams({ "baseVersion": baseVersion }).toString() : "";
|
|
35
|
+
return this.httpClient().postFile(`/package-manager/api/core/packages/diff/configuration/has-changes${paramString}`, data);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.DiffApi = DiffApi;
|
|
40
|
+
});
|