@celonis/content-cli 1.2.2 → 1.2.4

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.
@@ -93,6 +93,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
93
93
  if ((options.packageKeys && options.keysByVersion) || (!options.packageKeys && !options.keysByVersion)) {
94
94
  throw new Error("Please provide either --packageKeys or --keysByVersion, but not both.");
95
95
  }
96
+ if (options.gitProfile && !options.gitBranch) {
97
+ throw new Error("Please specify a branch using --gitBranch when using a Git profile.");
98
+ }
96
99
  options.withDependencies = (_a = options.withDependencies) !== null && _a !== void 0 ? _a : false;
97
100
  yield new config_command_service_1.ConfigCommandService(context).batchExportPackages(options.packageKeys, options.keysByVersion, options.withDependencies, options.gitBranch, options.unzip);
98
101
  });
@@ -104,6 +107,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
104
107
  }
105
108
  batchImportPackages(context, command, options) {
106
109
  return __awaiter(this, void 0, void 0, function* () {
110
+ if (options.gitProfile && !options.gitBranch) {
111
+ throw new Error("Please specify a branch using --gitBranch when using a Git profile.");
112
+ }
107
113
  yield new config_command_service_1.ConfigCommandService(context).batchImportPackages(options.file, options.directory, options.overwrite, options.gitBranch);
108
114
  });
109
115
  }
@@ -87,9 +87,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
87
87
  return __awaiter(this, void 0, void 0, function* () {
88
88
  const queryParams = new URLSearchParams();
89
89
  queryParams.set("deployableType", deployableType);
90
- if (packageKey) {
91
- queryParams.set("packageKey", packageKey);
92
- }
90
+ queryParams.set("packageKey", packageKey);
93
91
  return this.httpClient()
94
92
  .get(`/pacman/api/deployments/targets?${queryParams.toString()}`)
95
93
  .catch((e) => {
@@ -67,7 +67,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
67
67
  .beta()
68
68
  .description("List all targets for a given deployable type and package key")
69
69
  .requiredOption("--deployableType <deployableType>", "The type of the deployable")
70
- .option("--packageKey <packageKey>", "Identifier of the package to list targets for")
70
+ .requiredOption("--packageKey <packageKey>", "Identifier of the package to list targets for")
71
71
  .option("--json", "Return the response as a JSON file")
72
72
  .action(this.listTargets);
73
73
  }
@@ -33,6 +33,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
33
33
  const questions = new question_service_1.QuestionService();
34
34
  try {
35
35
  profile.name = yield questions.ask("Name of the Git profile to create: ");
36
+ this.gitProfileService.validateProfileName(profile.name);
36
37
  profile.username = yield questions.ask("Your Git username: ");
37
38
  profile.repository = yield questions.ask("Your repository (format: repoOwner/repoName): ");
38
39
  const type = yield questions.ask("Authentication type: HTTPS (1), SSH token (2): ");
@@ -52,11 +53,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
52
53
  if (setAsDefault) {
53
54
  yield this.makeDefaultProfile(profile.name);
54
55
  }
56
+ logger_1.logger.info("Git Profile created successfully!");
57
+ }
58
+ catch (e) {
59
+ logger_1.logger.error(e.toString());
55
60
  }
56
61
  finally {
57
62
  yield questions.close();
58
63
  }
59
- logger_1.logger.info("Git Profile created successfully!");
60
64
  });
61
65
  }
62
66
  listProfiles() {
@@ -197,7 +197,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
197
197
  this.printBetaNoticeIfBetaCommand();
198
198
  this.printBetaNoticeIfBetaOptions();
199
199
  this.printDeprecationNoticeIfDeprecated();
200
- yield handler(this.ctx, this.cmd, this.cmd.opts());
200
+ yield handler(this.ctx, this.cmd, this.cmd.optsWithGlobals());
201
201
  }
202
202
  catch (error) {
203
203
  logger_1.logger.error(`An unexpected error occured executing a command: ${error}`);
@@ -218,7 +218,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
218
218
  if (this.cmd.isBeta) {
219
219
  return;
220
220
  }
221
- const providedOptions = this.cmd.opts();
221
+ const providedOptions = this.cmd.optsWithGlobals();
222
222
  for (const option of this.cmd.options) {
223
223
  const optionName = option.attributeName();
224
224
  if (option.isBeta && Object.hasOwn(providedOptions, optionName)) {
@@ -81,6 +81,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
81
81
  encoding: "utf-8",
82
82
  });
83
83
  }
84
+ validateProfileName(name) {
85
+ if (GitProfileService.INVALID_FILENAME_CHARS.test(name)) {
86
+ throw new Error(`Invalid profile name "${name}". The following characters are not allowed: / \\ : * ? " < > |`);
87
+ }
88
+ }
84
89
  buildProfileFromEnvVariables() {
85
90
  return __awaiter(this, void 0, void 0, function* () {
86
91
  const profileVariables = this.getProfileEnvVariables();
@@ -131,4 +136,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
131
136
  }
132
137
  }
133
138
  exports.GitProfileService = GitProfileService;
139
+ GitProfileService.INVALID_FILENAME_CHARS = /[\/\\:*?"<>|.]/;
134
140
  });
@@ -7,7 +7,7 @@ export declare class DeploymentApi {
7
7
  getDeployments(filter: GetDeploymentsRequest, limit?: string, offset?: string): Promise<DeploymentTransport[]>;
8
8
  getActiveDeploymentsForPackage(packageKey: string, targetIds?: string[], limit?: string, offset?: string): Promise<DeploymentTransport[]>;
9
9
  getActiveDeploymentForTarget(targetId: string): Promise<DeploymentTransport>;
10
- getTargets(deployableType: string, packageKey?: string): Promise<TargetTransport[]>;
10
+ getTargets(deployableType: string, packageKey: string): Promise<TargetTransport[]>;
11
11
  getDeployables(flavor?: string): Promise<DeployableTransport[]>;
12
12
  private addPaginationParams;
13
13
  }
@@ -6,6 +6,6 @@ export declare class DeploymentService {
6
6
  getDeployments(jsonResponse: boolean, packageKey?: string, targetId?: string, deployableType?: string, status?: string, createdBy?: string, limit?: string, offset?: string): Promise<void>;
7
7
  getActiveDeploymentForTarget(targetId: string, jsonResponse: boolean): Promise<void>;
8
8
  getActiveDeploymentsForPackage(packageKey: string, jsonResponse: boolean, targetIds?: string[], limit?: string, offset?: string): Promise<void>;
9
- getTargets(jsonResponse: boolean, deployableType: string, packageKey?: string): Promise<void>;
9
+ getTargets(jsonResponse: boolean, deployableType: string, packageKey: string): Promise<void>;
10
10
  getDeployables(jsonResponse: boolean, flavor?: string): Promise<void>;
11
11
  }
@@ -6,10 +6,12 @@ export declare class GitProfileService {
6
6
  private readonly homedir;
7
7
  private readonly gitProfileContainerPath;
8
8
  private readonly configContainer;
9
+ private static readonly INVALID_FILENAME_CHARS;
9
10
  findProfile(profileName: string): Promise<GitProfile>;
10
11
  makeDefaultProfile(profileName: string): Promise<GitProfile>;
11
12
  getDefaultProfile(): string;
12
13
  storeProfile(profile: GitProfile): void;
14
+ validateProfileName(name: string): void;
13
15
  private buildProfileFromEnvVariables;
14
16
  private storeConfig;
15
17
  private createProfileContainerIfNotExists;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celonis/content-cli",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "CLI Tool to help manage content in Celonis Platform",
5
5
  "main": "content-cli.js",
6
6
  "bin": {