@celonis/content-cli 1.13.1 → 1.14.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 +17 -5
- package/commands/action-flows/module.js +2 -1
- package/commands/asset-registry/asset-registry-api.js +1 -30
- package/commands/asset-registry/asset-registry.service.js +1 -52
- package/commands/asset-registry/module.js +0 -26
- package/commands/bookmarks/bookmarks-api.js +49 -0
- package/commands/bookmarks/bookmarks-command.service.js +46 -0
- package/{core/utils/path.js → commands/bookmarks/bookmarks.interfaces.js} +0 -5
- package/commands/bookmarks/module.js +49 -0
- package/commands/configuration-management/branch/api/branch.api.js +88 -0
- package/commands/configuration-management/branch/branch-export-import.command.service.js +276 -0
- package/commands/configuration-management/branch/branch.command.service.js +178 -0
- package/commands/configuration-management/branch/interfaces/branch.interfaces.js +41 -0
- package/commands/configuration-management/module.js +164 -1
- package/commands/configuration-management/single-package-import.service.js +6 -6
- package/commands/data-pipeline/connection/connection.commands.js +4 -2
- package/commands/data-pipeline/data-pool/data-pool.commands.js +2 -1
- package/commands/deployment/module.js +4 -7
- package/content-cli.js +4 -0
- package/core/command/module-handler.js +8 -1
- package/core/feature-flag/feature-disabled-error.js +52 -0
- package/core/utils/branches.js +10 -0
- package/core/utils/file-service.js +0 -7
- package/lib/commands/asset-registry/asset-registry-api.d.ts +2 -6
- package/lib/commands/asset-registry/asset-registry.interfaces.d.ts +0 -17
- package/lib/commands/asset-registry/asset-registry.service.d.ts +2 -6
- package/lib/commands/asset-registry/module.d.ts +0 -2
- package/lib/commands/bookmarks/bookmarks-api.d.ts +8 -0
- package/lib/commands/bookmarks/bookmarks-command.service.d.ts +7 -0
- package/lib/commands/bookmarks/bookmarks.interfaces.d.ts +34 -0
- package/lib/commands/bookmarks/module.d.ts +8 -0
- package/lib/commands/configuration-management/branch/api/branch.api.d.ts +12 -0
- package/lib/commands/configuration-management/branch/branch-export-import.command.service.d.ts +36 -0
- package/lib/commands/configuration-management/branch/branch.command.service.d.ts +18 -0
- package/lib/commands/configuration-management/branch/interfaces/branch.interfaces.d.ts +139 -0
- package/lib/commands/configuration-management/module.d.ts +8 -0
- package/lib/commands/configuration-management/single-package-import.service.d.ts +5 -3
- package/lib/core/command/module-handler.d.ts +4 -4
- package/lib/core/feature-flag/feature-disabled-error.d.ts +16 -0
- package/lib/core/utils/branches.d.ts +3 -0
- package/lib/core/utils/file-service.d.ts +0 -1
- package/package.json +3 -3
- package/lib/core/utils/path.d.ts +0 -1
|
@@ -16,7 +16,7 @@ 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", "./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);
|
|
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", "./branch/branch.command.service", "./branch/branch-export-import.command.service", "../../core/utils/branches"], factory);
|
|
20
20
|
}
|
|
21
21
|
})(function (require, exports) {
|
|
22
22
|
"use strict";
|
|
@@ -33,10 +33,80 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
33
33
|
const package_validation_service_1 = require("./package-validation.service");
|
|
34
34
|
const single_package_import_service_1 = require("./single-package-import.service");
|
|
35
35
|
const single_package_export_service_1 = require("./single-package-export.service");
|
|
36
|
+
const branch_command_service_1 = require("./branch/branch.command.service");
|
|
37
|
+
const branch_export_import_command_service_1 = require("./branch/branch-export-import.command.service");
|
|
38
|
+
const branches_1 = require("../../core/utils/branches");
|
|
36
39
|
class Module extends module_handler_1.IModule {
|
|
37
40
|
register(context, configurator) {
|
|
38
41
|
const configCommand = configurator.command("config")
|
|
39
42
|
.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'.");
|
|
43
|
+
const branchCommand = configCommand.command("branch").beta()
|
|
44
|
+
.description("Author, merge, and mirror package branches");
|
|
45
|
+
const branchSettingsCommand = branchCommand.command("settings").beta()
|
|
46
|
+
.description("Commands to manage branch settings on a package");
|
|
47
|
+
branchSettingsCommand.command("set").beta()
|
|
48
|
+
.description("Configure branch settings on a main package")
|
|
49
|
+
.requiredOption("--packageKey <packageKey>", "Main package key")
|
|
50
|
+
.requiredOption("--enabled <enabled>", "true|false")
|
|
51
|
+
.option("--json", "Write response to a JSON file", false)
|
|
52
|
+
.action(this.setBranchSettings);
|
|
53
|
+
branchCommand.command("create").beta()
|
|
54
|
+
.description("Create a new branch from a source version")
|
|
55
|
+
.requiredOption("--packageKey <packageKey>", "Main package key to branch from")
|
|
56
|
+
.requiredOption("--branchKey <branchKey>", "New branch key")
|
|
57
|
+
.requiredOption("--sourceVersion <sourceVersion>", "Source version to branch from. Must be an existing version; 'LATEST' is not supported here")
|
|
58
|
+
.option("--validate", "Only validate the request without creating the branch", false)
|
|
59
|
+
.option("--json", "Write response to a JSON file", false)
|
|
60
|
+
.action(this.createBranch);
|
|
61
|
+
branchCommand.command("list").beta()
|
|
62
|
+
.description("List branches of a main package")
|
|
63
|
+
.requiredOption("--packageKey <packageKey>", "Main package key")
|
|
64
|
+
.option("--json", "Write response to a JSON file", false)
|
|
65
|
+
.action(this.listBranches);
|
|
66
|
+
branchCommand.command("delete").beta()
|
|
67
|
+
.description("Delete a branch")
|
|
68
|
+
.requiredOption("--packageKey <packageKey>", "Main package key (no '@')")
|
|
69
|
+
.requiredOption("--branchKey <branchKey>", "Branch key to delete")
|
|
70
|
+
.action(this.deleteBranch);
|
|
71
|
+
const branchMergeCommand = branchCommand.command("merge").beta()
|
|
72
|
+
.description("Commands to preview and apply branch merges");
|
|
73
|
+
branchMergeCommand.command("preview").beta()
|
|
74
|
+
.description("Preview the changes a merge would apply to a target branch")
|
|
75
|
+
.requiredOption("--packageKey <packageKey>", "Target package key (main package key or '<mainPackageKey>@<branchKey>')")
|
|
76
|
+
.requiredOption("--sourceKey <sourceKey>", "Source package key (main package key or '<mainPackageKey>@<branchKey>')")
|
|
77
|
+
.requiredOption("--sourceVersion <sourceVersion>", "Source version (or 'LATEST')")
|
|
78
|
+
.option("--json", "Write response to a JSON file", false)
|
|
79
|
+
.action(this.previewBranchMerge);
|
|
80
|
+
branchMergeCommand.command("apply").beta()
|
|
81
|
+
.description("Merge changes from a source into a target branch")
|
|
82
|
+
.requiredOption("--packageKey <packageKey>", "Target package key (main package key or '<mainPackageKey>@<branchKey>')")
|
|
83
|
+
.option("-f, --file <file>", "Path to a JSON file containing the MergeBranchTransport payload")
|
|
84
|
+
.option("--sourceKey <sourceKey>", "Source package key, main package key or '<mainPackageKey>@<branchKey>' (overrides the file's 'sourceKey')")
|
|
85
|
+
.option("--sourceVersion <sourceVersion>", "Source version (overrides the file's 'sourceVersion'; or 'LATEST')")
|
|
86
|
+
.option("--bump <bump>", "Version bump for the new published version: PATCH (the default when neither --bump nor --newVersion is given)")
|
|
87
|
+
.option("--newVersion <newVersion>", "Pin the new published version to an explicit semver")
|
|
88
|
+
.option("--summary <summary>", "Summary of changes for the new published version")
|
|
89
|
+
.option("--json", "Write response to a JSON file", false)
|
|
90
|
+
.action(this.applyBranchMerge);
|
|
91
|
+
branchCommand.command("export").beta()
|
|
92
|
+
.description("Export a branch's package, rewriting the package.json key to the main package key. Writes an unzipped '<packageKey>' directory by default (or a '<packageKey>.zip' with --zip), or pushes to the Git branch named after --branchKey when --gitProfile is set.")
|
|
93
|
+
.requiredOption("--packageKey <packageKey>", "Main package key (no '@')")
|
|
94
|
+
.option("--branchKey <branchKey>", "Branch key to export. The Git branch, when pushing, is named after this value. Mutually exclusive with --all")
|
|
95
|
+
.option("--all", "Push the main package and every one of its branches to Git. Requires --gitProfile and is mutually exclusive with --branchKey", false)
|
|
96
|
+
.option("--zip", "Export the branch as a single '<packageKey>.zip' file instead of an unzipped directory (local export only)", false)
|
|
97
|
+
.option("--gitProfile <gitProfile>", "Git profile to use. When set, the export is pushed to Git instead of written locally")
|
|
98
|
+
.option("--json", "Write response to a JSON file", false)
|
|
99
|
+
.action(this.exportBranch);
|
|
100
|
+
branchCommand.command("import").beta()
|
|
101
|
+
.description("Import a branch's package from a zip file, directory, or Git branch, restoring the package.json key to '<packageKey>@<branchKey>'. Pulls the Git branch named after --branchKey when --gitProfile is set; otherwise reads --file or --directory.")
|
|
102
|
+
.requiredOption("--packageKey <packageKey>", "Main package key (no '@')")
|
|
103
|
+
.requiredOption("--branchKey <branchKey>", "Branch key to import into. The Git branch, when pulling, is named after this value")
|
|
104
|
+
.option("-f, --file <file>", "Package zip file (relative path). Mutually exclusive with --directory and --gitProfile")
|
|
105
|
+
.option("-d, --directory <directory>", "Package directory (relative path). Mutually exclusive with --file and --gitProfile")
|
|
106
|
+
.option("--overwrite", "Flag to allow overwriting an existing package with the same key", false)
|
|
107
|
+
.option("--gitProfile <gitProfile>", "Git profile to use. When set, the package is pulled from Git instead of read locally")
|
|
108
|
+
.option("--json", "Write response to a JSON file", false)
|
|
109
|
+
.action(this.importBranch);
|
|
40
110
|
configCommand.command("list")
|
|
41
111
|
.description("[Deprecated] Use 't2tc package list' instead. List packages in the target team.")
|
|
42
112
|
.deprecationNotice("'config list' is deprecated and will be removed in a future release. Use 't2tc package list' instead.")
|
|
@@ -218,6 +288,99 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
218
288
|
.option("--params <params>", "Variable query params")
|
|
219
289
|
.action(this.listAssignments);
|
|
220
290
|
}
|
|
291
|
+
setBranchSettings(context, command, options) {
|
|
292
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
293
|
+
const enabled = String(options.enabled).toLowerCase();
|
|
294
|
+
if (enabled !== "true" && enabled !== "false") {
|
|
295
|
+
throw new Error("Please provide either 'true' or 'false' for --enabled.");
|
|
296
|
+
}
|
|
297
|
+
yield new branch_command_service_1.BranchCommandService(context).setBranchingEnabled(options.packageKey, enabled === "true", !!options.json);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
createBranch(context, command, options) {
|
|
301
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
302
|
+
yield new branch_command_service_1.BranchCommandService(context).createBranch(options.packageKey, options.branchKey, options.sourceVersion, !!options.validate, !!options.json);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
listBranches(context, command, options) {
|
|
306
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
307
|
+
yield new branch_command_service_1.BranchCommandService(context).listBranches(options.packageKey, !!options.json);
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
deleteBranch(context, command, options) {
|
|
311
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
312
|
+
yield new branch_command_service_1.BranchCommandService(context).deleteBranch(options.packageKey, options.branchKey);
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
previewBranchMerge(context, command, options) {
|
|
316
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
317
|
+
yield new branch_command_service_1.BranchCommandService(context).mergePreview(options.packageKey, options.sourceKey, options.sourceVersion, !!options.json);
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
applyBranchMerge(context, command, options) {
|
|
321
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
322
|
+
yield new branch_command_service_1.BranchCommandService(context).mergeApply(options.packageKey, {
|
|
323
|
+
sourceKey: options.sourceKey,
|
|
324
|
+
sourceVersion: options.sourceVersion,
|
|
325
|
+
file: options.file,
|
|
326
|
+
bump: options.bump,
|
|
327
|
+
version: options.newVersion,
|
|
328
|
+
summary: options.summary,
|
|
329
|
+
jsonResponse: !!options.json,
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
exportBranch(context, command, options) {
|
|
334
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
335
|
+
const gitEnabled = !!options.gitProfile;
|
|
336
|
+
const service = new branch_export_import_command_service_1.BranchExportImportCommandService(context);
|
|
337
|
+
if (options.all) {
|
|
338
|
+
if (options.branchKey) {
|
|
339
|
+
throw new Error("Please provide either --branchKey or --all, but not both.");
|
|
340
|
+
}
|
|
341
|
+
if (!gitEnabled) {
|
|
342
|
+
throw new Error("--all pushes to Git and requires a Git profile. Please provide --gitProfile.");
|
|
343
|
+
}
|
|
344
|
+
yield service.exportAll(options.packageKey, !!options.json);
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
if (!options.branchKey) {
|
|
348
|
+
throw new Error("Please provide --branchKey, or use --all to export every branch.");
|
|
349
|
+
}
|
|
350
|
+
if (options.branchKey.toLowerCase() === branches_1.BranchUtils.MAIN_BRANCH_KEY) {
|
|
351
|
+
throw new Error(`'${branches_1.BranchUtils.MAIN_BRANCH_KEY}' is a reserved branch key. The main package is exported only with --all.`);
|
|
352
|
+
}
|
|
353
|
+
yield service.exportBranch(options.packageKey, options.branchKey, {
|
|
354
|
+
zip: !!options.zip,
|
|
355
|
+
gitEnabled,
|
|
356
|
+
jsonResponse: !!options.json,
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
importBranch(context, command, options) {
|
|
361
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
362
|
+
const gitEnabled = !!options.gitProfile;
|
|
363
|
+
if (options.branchKey.toLowerCase() === branches_1.BranchUtils.MAIN_BRANCH_KEY) {
|
|
364
|
+
throw new Error(`'${branches_1.BranchUtils.MAIN_BRANCH_KEY}' is a reserved branch key. Use 'config package import' to import into the main package.`);
|
|
365
|
+
}
|
|
366
|
+
if (gitEnabled && (options.file || options.directory)) {
|
|
367
|
+
throw new Error("You cannot use --file or --directory together with --gitProfile. Only one import source can be defined.");
|
|
368
|
+
}
|
|
369
|
+
if (!gitEnabled && !options.file && !options.directory) {
|
|
370
|
+
throw new Error("You must provide a --file, a --directory, or a --gitProfile option to import a branch.");
|
|
371
|
+
}
|
|
372
|
+
if (options.file && options.directory) {
|
|
373
|
+
throw new Error("You cannot use both --file and --directory options at the same time. Only one import source can be defined.");
|
|
374
|
+
}
|
|
375
|
+
yield new branch_export_import_command_service_1.BranchExportImportCommandService(context).importBranch(options.packageKey, options.branchKey, {
|
|
376
|
+
file: options.file,
|
|
377
|
+
directory: options.directory,
|
|
378
|
+
overwrite: !!options.overwrite,
|
|
379
|
+
gitEnabled,
|
|
380
|
+
jsonResponse: !!options.json,
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
}
|
|
221
384
|
listPackages(context, command, options) {
|
|
222
385
|
return __awaiter(this, void 0, void 0, function* () {
|
|
223
386
|
if (options.staging && (options.withDependencies || options.packageKeys || options.keysByVersion || options.variableValue || options.variableType)) {
|
|
@@ -53,7 +53,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
53
53
|
}
|
|
54
54
|
try {
|
|
55
55
|
const packageZip = new AdmZip(resolvedSource.zipPath);
|
|
56
|
-
const formData =
|
|
56
|
+
const formData = SinglePackageImportService.buildBodyForImport(packageZip, resolvedSource.zipPath);
|
|
57
57
|
const result = yield this.singlePackageImportApi.importPackage(formData, overwrite);
|
|
58
58
|
this.outputResult(result, jsonResponse);
|
|
59
59
|
}
|
|
@@ -85,19 +85,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
85
85
|
}
|
|
86
86
|
return { zipPath: file_service_1.fileService.zipDirectoryAsSinglePackage(directory), isTemporary: true };
|
|
87
87
|
}
|
|
88
|
-
buildBodyForImport(packageZip, sourcePath) {
|
|
89
|
-
|
|
88
|
+
static buildBodyForImport(packageZip, sourcePath) {
|
|
89
|
+
SinglePackageImportService.assertUncompressedSizeWithinLimit(packageZip, sourcePath);
|
|
90
90
|
const formData = new FormData();
|
|
91
|
-
formData.append("packageFile",
|
|
91
|
+
formData.append("packageFile", SinglePackageImportService.getReadableStream(packageZip), { filename: "package.zip" });
|
|
92
92
|
return formData;
|
|
93
93
|
}
|
|
94
|
-
assertUncompressedSizeWithinLimit(packageZip, sourcePath) {
|
|
94
|
+
static assertUncompressedSizeWithinLimit(packageZip, sourcePath) {
|
|
95
95
|
const totalUncompressedBytes = packageZip.getEntries().reduce((sum, entry) => sum + entry.header.size, 0);
|
|
96
96
|
if (totalUncompressedBytes > SinglePackageImportService.MAX_UNCOMPRESSED_ZIP_SIZE) {
|
|
97
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
98
|
}
|
|
99
99
|
}
|
|
100
|
-
getReadableStream(packageZip) {
|
|
100
|
+
static getReadableStream(packageZip) {
|
|
101
101
|
return new node_stream_1.Readable({
|
|
102
102
|
read() {
|
|
103
103
|
this.push(packageZip.toBuffer());
|
|
@@ -30,13 +30,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
30
30
|
.description("Command to list all connections in a Data Pool")
|
|
31
31
|
.requiredOption("--dataPoolId <dataPoolId>", "ID of the data pool")
|
|
32
32
|
.action(this.listConnections);
|
|
33
|
-
const getCommand = configurator.command("get")
|
|
33
|
+
const getCommand = configurator.command("get")
|
|
34
|
+
.description("get data pool connection");
|
|
34
35
|
getCommand.command("connection")
|
|
35
36
|
.description("Programmatically read properties of your connections")
|
|
36
37
|
.requiredOption("--dataPoolId <dataPoolId>", "Id of the data pool you want to update")
|
|
37
38
|
.requiredOption("--connectionId <connectionId>", "Id of the connection you want to update")
|
|
38
39
|
.action(this.getCommandProperties);
|
|
39
|
-
const setCommand = configurator.command("set")
|
|
40
|
+
const setCommand = configurator.command("set")
|
|
41
|
+
.description("set data pool connection");
|
|
40
42
|
setCommand.command("connection")
|
|
41
43
|
.description("Programmatically update properties of your connections")
|
|
42
44
|
.requiredOption("--dataPoolId <dataPoolId>", "Id of the data pool you want to update")
|
|
@@ -52,7 +52,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
52
52
|
pushCommand.command("data-pools")
|
|
53
53
|
.description("Command to push data pools")
|
|
54
54
|
.action(this.pushDataPools);
|
|
55
|
-
const updateCommand = configurator.command("update")
|
|
55
|
+
const updateCommand = configurator.command("update")
|
|
56
|
+
.description("Update data pool");
|
|
56
57
|
updateCommand.command("data-pool")
|
|
57
58
|
.description("Command to update a data pool using a data pool configuration file")
|
|
58
59
|
.requiredOption("--id <id>", "Id of the data pool you want to update")
|
|
@@ -21,9 +21,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
21
21
|
const deployment_service_1 = require("./deployment.service");
|
|
22
22
|
class Module extends module_handler_1.IModule {
|
|
23
23
|
register(context, configurator) {
|
|
24
|
-
const deploymentCommand = configurator.command("deployment")
|
|
24
|
+
const deploymentCommand = configurator.command("deployment")
|
|
25
|
+
.description("Create deployments, list their history, check active deployments, and retrieve deployables and targets");
|
|
25
26
|
deploymentCommand.command("create")
|
|
26
|
-
.beta()
|
|
27
27
|
.description("Create a new deployment")
|
|
28
28
|
.requiredOption("--packageKey <packageKey>", "Identifier of the package to deploy")
|
|
29
29
|
.requiredOption("--packageVersion <packageVersion>", "Version of the package to deploy")
|
|
@@ -31,9 +31,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
31
|
.requiredOption("--targetId <targetId>", "Identifier of the target to deploy to")
|
|
32
32
|
.option("--json", "Return the response as a JSON file")
|
|
33
33
|
.action(this.createDeployment);
|
|
34
|
-
const listCommand = deploymentCommand.command("list")
|
|
34
|
+
const listCommand = deploymentCommand.command("list")
|
|
35
|
+
.description("List deployment history, active deployments, deployables or targets");
|
|
35
36
|
listCommand.command("history")
|
|
36
|
-
.beta()
|
|
37
37
|
.description("List deployment history")
|
|
38
38
|
.option("--packageKey <packageKey>", "Filter deployment history by package key")
|
|
39
39
|
.option("--targetId <targetId>", "Filter deployment history by target ID")
|
|
@@ -45,7 +45,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
45
45
|
.option("--json", "Return the response as a JSON file")
|
|
46
46
|
.action(this.listDeploymentHistory);
|
|
47
47
|
listCommand.command("active")
|
|
48
|
-
.beta()
|
|
49
48
|
.description("Get the active deployment(s) for a given target or package.\n" +
|
|
50
49
|
"You can use the command to list the active deployment(s) for a specific target or for a specific package.\n" +
|
|
51
50
|
"The targetIds filter is available only for getting the active deployments for a given package. \n" +
|
|
@@ -58,13 +57,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
58
57
|
.option("--json", "Return the response as a JSON file")
|
|
59
58
|
.action(this.listActiveDeployments);
|
|
60
59
|
listCommand.command("deployables")
|
|
61
|
-
.beta()
|
|
62
60
|
.description("List all deployables")
|
|
63
61
|
.option("--flavor <flavor>", "Filter deployables by flavor")
|
|
64
62
|
.option("--json", "Return the response as a JSON file")
|
|
65
63
|
.action(this.listDeployables);
|
|
66
64
|
listCommand.command("targets")
|
|
67
|
-
.beta()
|
|
68
65
|
.description("List all targets for a given deployable type and package key")
|
|
69
66
|
.requiredOption("--deployableType <deployableType>", "The type of the deployable")
|
|
70
67
|
.requiredOption("--packageKey <packageKey>", "Identifier of the package to list targets for")
|
package/content-cli.js
CHANGED
|
@@ -75,6 +75,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
75
75
|
*/
|
|
76
76
|
function configureRootCommands(configurator) {
|
|
77
77
|
configurator.command("list").description("Commands to list content.").alias("ls");
|
|
78
|
+
configurator.command("export").description("Export resource: action flow or data pool");
|
|
79
|
+
configurator.command("import").description("Import resource: action flow or data pool");
|
|
80
|
+
configurator.command("pull").description("Pull resource: skill, bookmark, view bookmark, data pool or asset");
|
|
81
|
+
configurator.command("push").description("Push resource: asset, skill, bookmark, view bookmark, CTP or data pool");
|
|
78
82
|
}
|
|
79
83
|
function run() {
|
|
80
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -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", "path", "fs", "commander", "../utils/logger", "chalk"], factory);
|
|
16
|
+
define(["require", "exports", "path", "fs", "commander", "../utils/logger", "../feature-flag/feature-disabled-error", "chalk"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -23,6 +23,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
23
23
|
const fs = require("fs");
|
|
24
24
|
const commander_1 = require("commander");
|
|
25
25
|
const logger_1 = require("../utils/logger");
|
|
26
|
+
const feature_disabled_error_1 = require("../feature-flag/feature-disabled-error");
|
|
26
27
|
const chalk = require("chalk");
|
|
27
28
|
class IModule {
|
|
28
29
|
}
|
|
@@ -204,6 +205,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
204
205
|
logger_1.logger.error(error.message);
|
|
205
206
|
return;
|
|
206
207
|
}
|
|
208
|
+
// Backend gates early-access features; translate its "feature disabled"
|
|
209
|
+
// rejection into a clear message instead of a raw error.
|
|
210
|
+
if ((0, feature_disabled_error_1.isFeatureDisabledError)(error)) {
|
|
211
|
+
logger_1.logger.error(`'${this.cmd.name()}' is not enabled for your team. Contact support to request access.`);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
207
214
|
logger_1.logger.error(`An unexpected error occured executing a command: ${error}`);
|
|
208
215
|
process.exitCode = 1;
|
|
209
216
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.isFeatureDisabledError = exports.FEATURE_DISABLED_CODE = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Recognizes the backend's "feature not enabled" response so the CLI can surface a
|
|
15
|
+
* clear message instead of a raw error. Enforcement stays entirely in the backend
|
|
16
|
+
* (pacman); the CLI only translates the response — it never decides entitlement.
|
|
17
|
+
*
|
|
18
|
+
* The backend rejects a flag-gated request with 403 and a machine-readable body:
|
|
19
|
+
* {"errorCode":"feature-disabled", ...} (pacman's standard ErrorTransport). Keying
|
|
20
|
+
* off the stable code (rather than a free-text message) keeps this robust.
|
|
21
|
+
*/
|
|
22
|
+
exports.FEATURE_DISABLED_CODE = "feature-disabled";
|
|
23
|
+
/**
|
|
24
|
+
* True when the given error represents a backend "feature disabled" rejection.
|
|
25
|
+
* HttpClient rejects with the stringified response body (often wrapped as
|
|
26
|
+
* "FatalError: {json}"), so we extract and parse the embedded JSON payload.
|
|
27
|
+
*/
|
|
28
|
+
function isFeatureDisabledError(error) {
|
|
29
|
+
return extractErrorCode(error) === exports.FEATURE_DISABLED_CODE;
|
|
30
|
+
}
|
|
31
|
+
exports.isFeatureDisabledError = isFeatureDisabledError;
|
|
32
|
+
function extractErrorCode(error) {
|
|
33
|
+
let text = "";
|
|
34
|
+
if (error instanceof Error) {
|
|
35
|
+
text = error.message;
|
|
36
|
+
}
|
|
37
|
+
else if (typeof error === "string") {
|
|
38
|
+
text = error;
|
|
39
|
+
}
|
|
40
|
+
const jsonStart = text.indexOf("{");
|
|
41
|
+
if (jsonStart === -1) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const payload = JSON.parse(text.slice(jsonStart));
|
|
46
|
+
return typeof payload.errorCode === "string" ? payload.errorCode : undefined;
|
|
47
|
+
}
|
|
48
|
+
catch (_a) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
package/core/utils/branches.js
CHANGED
|
@@ -17,7 +17,17 @@
|
|
|
17
17
|
}
|
|
18
18
|
return packageKey.includes(BranchUtils.BRANCH_SEPARATOR);
|
|
19
19
|
}
|
|
20
|
+
static constructBranchKey(projectKey, branchKey) {
|
|
21
|
+
return `${projectKey}${BranchUtils.BRANCH_SEPARATOR}${branchKey}`;
|
|
22
|
+
}
|
|
23
|
+
static extractProjectKey(packageKey) {
|
|
24
|
+
if (!BranchUtils.isBranchPackageKey(packageKey)) {
|
|
25
|
+
return packageKey;
|
|
26
|
+
}
|
|
27
|
+
return packageKey.substring(0, packageKey.indexOf(BranchUtils.BRANCH_SEPARATOR));
|
|
28
|
+
}
|
|
20
29
|
}
|
|
21
30
|
exports.BranchUtils = BranchUtils;
|
|
31
|
+
BranchUtils.MAIN_BRANCH_KEY = "main";
|
|
22
32
|
BranchUtils.BRANCH_SEPARATOR = "@";
|
|
23
33
|
});
|
|
@@ -29,13 +29,6 @@
|
|
|
29
29
|
mode: file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS,
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
writeBufferToPath(targetDir, filename, data) {
|
|
33
|
-
const resolvedDir = path.resolve(process.cwd(), targetDir);
|
|
34
|
-
const absolutePath = path.join(resolvedDir, filename);
|
|
35
|
-
this.mkdirRecursive(resolvedDir);
|
|
36
|
-
this.writeBufferToFileWithGivenName(data, absolutePath);
|
|
37
|
-
return absolutePath;
|
|
38
|
-
}
|
|
39
32
|
extractZipBufferToDirectory(data, targetDir) {
|
|
40
33
|
const targetPath = path.resolve(process.cwd(), targetDir);
|
|
41
34
|
this.mkdirRecursive(targetPath);
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Context } from "../../core/command/cli-context";
|
|
3
|
-
import {
|
|
2
|
+
import { AssetRegistryDescriptor, AssetRegistryMetadata } from "./asset-registry.interfaces";
|
|
4
3
|
export declare class AssetRegistryApi {
|
|
5
4
|
private static readonly BASE_URL;
|
|
6
|
-
private httpClient;
|
|
5
|
+
private readonly httpClient;
|
|
7
6
|
constructor(context: Context);
|
|
8
7
|
listTypes(): Promise<AssetRegistryMetadata>;
|
|
9
|
-
listSkills(): Promise<AgentSkillsResponse>;
|
|
10
8
|
getType(assetType: string): Promise<AssetRegistryDescriptor>;
|
|
11
9
|
getSchema(assetType: string): Promise<any>;
|
|
12
10
|
getExamples(assetType: string): Promise<any>;
|
|
13
11
|
validate(assetType: string, body: any): Promise<any>;
|
|
14
|
-
getSkillFile(skillPath: string, filePath?: string): Promise<Buffer>;
|
|
15
|
-
private buildSkillFileUrl;
|
|
16
12
|
private static endpointUrl;
|
|
17
13
|
}
|
|
@@ -36,20 +36,3 @@ export interface ValidateOptions {
|
|
|
36
36
|
file?: string;
|
|
37
37
|
json: boolean;
|
|
38
38
|
}
|
|
39
|
-
export interface AgentSkillMetadata {
|
|
40
|
-
version: string;
|
|
41
|
-
}
|
|
42
|
-
export interface AgentSkill {
|
|
43
|
-
name: string;
|
|
44
|
-
description: string;
|
|
45
|
-
path: string;
|
|
46
|
-
metadata: AgentSkillMetadata;
|
|
47
|
-
}
|
|
48
|
-
export interface AgentSkillsResponse {
|
|
49
|
-
skills: AgentSkill[];
|
|
50
|
-
}
|
|
51
|
-
export interface GetSkillFileOptions {
|
|
52
|
-
path: string;
|
|
53
|
-
file?: string;
|
|
54
|
-
output?: string;
|
|
55
|
-
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ValidateOptions } from "./asset-registry.interfaces";
|
|
2
2
|
import { Context } from "../../core/command/cli-context";
|
|
3
3
|
export declare class AssetRegistryService {
|
|
4
|
-
private api;
|
|
4
|
+
private readonly api;
|
|
5
5
|
constructor(context: Context);
|
|
6
6
|
listTypes(jsonResponse: boolean): Promise<void>;
|
|
7
|
-
getSkillFile(opts: GetSkillFileOptions): Promise<void>;
|
|
8
|
-
private resolveLocalFilename;
|
|
9
|
-
listSkills(jsonResponse: boolean): Promise<void>;
|
|
10
7
|
getType(assetType: string, jsonResponse: boolean): Promise<void>;
|
|
11
8
|
getSchema(assetType: string, jsonResponse: boolean): Promise<void>;
|
|
12
9
|
getExamples(assetType: string, jsonResponse: boolean): Promise<void>;
|
|
@@ -16,6 +13,5 @@ export declare class AssetRegistryService {
|
|
|
16
13
|
private parseJson;
|
|
17
14
|
private outputResponse;
|
|
18
15
|
private logDescriptorSummary;
|
|
19
|
-
private logSkillSummary;
|
|
20
16
|
private logDescriptorDetail;
|
|
21
17
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Context } from "../../core/command/cli-context";
|
|
2
|
+
import { BookmarksExport, BookmarksImportRequest, BookmarksImportResult } from "./bookmarks.interfaces";
|
|
3
|
+
export declare class BookmarksApi {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(context: Context);
|
|
6
|
+
exportBookmarks(packageKey: string): Promise<BookmarksExport>;
|
|
7
|
+
importBookmarks(packageKey: string, payload: BookmarksImportRequest): Promise<BookmarksImportResult>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Context } from "../../core/command/cli-context";
|
|
2
|
+
export declare class BookmarksCommandService {
|
|
3
|
+
private readonly bookmarksApi;
|
|
4
|
+
constructor(context: Context);
|
|
5
|
+
exportBookmarks(packageKey: string, file?: string): Promise<void>;
|
|
6
|
+
importBookmarks(packageKey: string, file: string): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface BookmarkEntry {
|
|
2
|
+
assetKey: string;
|
|
3
|
+
assetType: string;
|
|
4
|
+
bookmark: BookmarkDetails;
|
|
5
|
+
preference: BookmarkPreference;
|
|
6
|
+
}
|
|
7
|
+
export interface BookmarkDetails {
|
|
8
|
+
name: string;
|
|
9
|
+
ownerId: string;
|
|
10
|
+
sharedByLink: boolean;
|
|
11
|
+
published: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface BookmarkPreference {
|
|
14
|
+
configuration: string;
|
|
15
|
+
shareable: boolean;
|
|
16
|
+
mode: string;
|
|
17
|
+
userId: string;
|
|
18
|
+
}
|
|
19
|
+
export interface BookmarksExport {
|
|
20
|
+
packageKey: string;
|
|
21
|
+
entries: BookmarkEntry[];
|
|
22
|
+
}
|
|
23
|
+
export interface BookmarksImportRequest {
|
|
24
|
+
entries: BookmarkEntry[];
|
|
25
|
+
}
|
|
26
|
+
export interface BookmarksImportResultEntry {
|
|
27
|
+
assetKey: string;
|
|
28
|
+
status: string;
|
|
29
|
+
reason: string | null;
|
|
30
|
+
}
|
|
31
|
+
export interface BookmarksImportResult {
|
|
32
|
+
packageKey: string;
|
|
33
|
+
entries: BookmarksImportResultEntry[];
|
|
34
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Configurator, IModule } from "../../core/command/module-handler";
|
|
2
|
+
import { Context } from "../../core/command/cli-context";
|
|
3
|
+
declare class Module extends IModule {
|
|
4
|
+
register(context: Context, configurator: Configurator): void;
|
|
5
|
+
private exportBookmarks;
|
|
6
|
+
private importBookmarks;
|
|
7
|
+
}
|
|
8
|
+
export = Module;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Context } from "../../../../core/command/cli-context";
|
|
2
|
+
import { BranchingSettingsTransport, BranchTransport, CreateBranchTransport, MergeBranchTransport, MergePreviewRequestTransport, MergePreviewTransport, PackageVersionCreatedTransport } from "../interfaces/branch.interfaces";
|
|
3
|
+
export declare class BranchApi {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(context: Context);
|
|
6
|
+
configureBranchingSettings(packageKey: string, transport: BranchingSettingsTransport): Promise<BranchingSettingsTransport>;
|
|
7
|
+
createBranch(packageKey: string, transport: CreateBranchTransport, validate?: boolean): Promise<BranchTransport | void>;
|
|
8
|
+
listBranches(packageKey: string): Promise<BranchTransport[]>;
|
|
9
|
+
mergePreview(packageKey: string, transport: MergePreviewRequestTransport): Promise<MergePreviewTransport>;
|
|
10
|
+
merge(packageKey: string, transport: MergeBranchTransport): Promise<PackageVersionCreatedTransport>;
|
|
11
|
+
deleteBranch(branchPackageKey: string): Promise<void>;
|
|
12
|
+
}
|
package/lib/commands/configuration-management/branch/branch-export-import.command.service.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Context } from "../../../core/command/cli-context";
|
|
2
|
+
export interface BranchExportOptions {
|
|
3
|
+
zip?: boolean;
|
|
4
|
+
gitEnabled?: boolean;
|
|
5
|
+
jsonResponse?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface BranchImportOptions {
|
|
8
|
+
file?: string;
|
|
9
|
+
directory?: string;
|
|
10
|
+
overwrite?: boolean;
|
|
11
|
+
gitEnabled?: boolean;
|
|
12
|
+
jsonResponse?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class BranchExportImportCommandService {
|
|
15
|
+
private readonly singlePackageExportApi;
|
|
16
|
+
private readonly singlePackageImportApi;
|
|
17
|
+
private readonly branchApi;
|
|
18
|
+
private readonly gitService;
|
|
19
|
+
constructor(context: Context);
|
|
20
|
+
exportBranch(packageKey: string, branchKey: string, options?: BranchExportOptions): Promise<void>;
|
|
21
|
+
exportAll(packageKey: string, jsonResponse?: boolean): Promise<void>;
|
|
22
|
+
importBranch(packageKey: string, branchKey: string, options?: BranchImportOptions): Promise<void>;
|
|
23
|
+
private pushBranchToGit;
|
|
24
|
+
private pushMainPackage;
|
|
25
|
+
private exportRewrittenPackageDir;
|
|
26
|
+
private writeLocalArtifact;
|
|
27
|
+
private prepareLocalWorkingDir;
|
|
28
|
+
private importPackageSourceDir;
|
|
29
|
+
private normalizeToProjectKey;
|
|
30
|
+
private restoreBranchKey;
|
|
31
|
+
private replaceFieldValue;
|
|
32
|
+
private escapeRegExp;
|
|
33
|
+
private removeDir;
|
|
34
|
+
private static isExportableBranch;
|
|
35
|
+
private static writeJson;
|
|
36
|
+
}
|