@celonis/content-cli 1.4.0 → 1.4.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.
@@ -24,7 +24,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  constructor(context) {
25
25
  this.httpClient = () => context.httpClient;
26
26
  }
27
- findAll(packageKey, nodeKey, version) {
27
+ findAllStaging(packageKey, nodeKey) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ return this.httpClient()
30
+ .get(`/pacman/api/core/staging/packages/${packageKey}/nodes/${nodeKey}/dependencies`)
31
+ .catch((e) => {
32
+ throw new logger_1.FatalError(`Problem finding dependencies for node ${nodeKey} in package ${packageKey}: ${e}`);
33
+ });
34
+ });
35
+ }
36
+ findAllByVersion(packageKey, nodeKey, version) {
28
37
  return __awaiter(this, void 0, void 0, function* () {
29
38
  const queryParams = new URLSearchParams();
30
39
  queryParams.set("version", version);
@@ -75,7 +75,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
75
75
  configVersionCommand.command("get")
76
76
  .description("Get version metadata for a specific package version")
77
77
  .requiredOption("--packageKey <packageKey>", "Identifier of the package")
78
- .requiredOption("--packageVersion <packageVersion>", "Version of the package")
78
+ .requiredOption("--packageVersion <packageVersion>", "Version of the package. Can be a specific version or \"LATEST\" keyword, which will return the most recently created version.")
79
79
  .option("--json", "Return the response as a JSON file")
80
80
  .action(this.getPackageVersion);
81
81
  const variablesCommand = configCommand.command("variables")
@@ -119,7 +119,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
119
119
  .description("List dependencies of a specific node in a package")
120
120
  .requiredOption("--packageKey <packageKey>", "Identifier of the package")
121
121
  .requiredOption("--nodeKey <nodeKey>", "Identifier of the node")
122
- .requiredOption("--packageVersion <packageVersion>", "Version of the package")
122
+ .option("--packageVersion <packageVersion>", "Version of the package. If not sent, the staging state of the package will be used.")
123
123
  .option("--json", "Return the response as a JSON file")
124
124
  .action(this.listNodeDependencies);
125
125
  const listCommand = configurator.command("list");
@@ -199,6 +199,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
199
199
  }
200
200
  listNodeDependencies(context, command, options) {
201
201
  return __awaiter(this, void 0, void 0, function* () {
202
+ if (options.packageVersion === "") {
203
+ throw new Error("Please specify a valid package version");
204
+ }
202
205
  yield new node_dependency_service_1.NodeDependencyService(context).listNodeDependencies(options.packageKey, options.nodeKey, options.packageVersion, options.json);
203
206
  });
204
207
  }
@@ -29,7 +29,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
29
29
  }
30
30
  listNodeDependencies(packageKey, nodeKey, version, jsonResponse) {
31
31
  return __awaiter(this, void 0, void 0, function* () {
32
- const dependencies = yield this.nodeDependencyApi.findAll(packageKey, nodeKey, version);
32
+ let dependencies;
33
+ if (version) {
34
+ dependencies = yield this.nodeDependencyApi.findAllByVersion(packageKey, nodeKey, version);
35
+ }
36
+ else {
37
+ dependencies = yield this.nodeDependencyApi.findAllStaging(packageKey, nodeKey);
38
+ }
33
39
  if (jsonResponse) {
34
40
  const filename = (0, uuid_1.v4)() + ".json";
35
41
  file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(dependencies, null, 2), filename);
@@ -63,20 +63,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
63
63
  }
64
64
  return targetDir;
65
65
  }
66
- copyDirectoryToCurrentLocation(sourceDir, targetName) {
67
- fs.mkdirSync(targetName, { recursive: true });
68
- fs.cpSync(sourceDir, targetName, { recursive: true });
69
- }
70
66
  isDirectory(sourcePath) {
71
67
  var _a;
72
68
  return (_a = fs.statSync(sourcePath)) === null || _a === void 0 ? void 0 : _a.isDirectory();
73
69
  }
74
70
  zipDirectoryInBatchExportFormat(sourceDir) {
71
+ if (fs.lstatSync(sourceDir).isSymbolicLink()) {
72
+ throw new logger_1.FatalError("Source directory cannot be a symbolic link.");
73
+ }
75
74
  const files = fs.readdirSync(sourceDir);
76
75
  const finalZip = new AdmZip();
77
76
  files.forEach(file => {
78
77
  const fullPath = path.join(sourceDir, file);
79
- const stat = fs.statSync(fullPath);
78
+ const stat = fs.lstatSync(fullPath);
80
79
  if (stat.isDirectory()) {
81
80
  const zip = new AdmZip();
82
81
  zip.addLocalFolder(fullPath);
@@ -3,5 +3,6 @@ import { NodeDependencyTransport } from "../interfaces/node-dependency.interface
3
3
  export declare class NodeDependencyApi {
4
4
  private httpClient;
5
5
  constructor(context: Context);
6
- findAll(packageKey: string, nodeKey: string, version: string): Promise<NodeDependencyTransport[]>;
6
+ findAllStaging(packageKey: string, nodeKey: string): Promise<NodeDependencyTransport[]>;
7
+ findAllByVersion(packageKey: string, nodeKey: string, version: string): Promise<NodeDependencyTransport[]>;
7
8
  }
@@ -6,7 +6,6 @@ export declare class FileService {
6
6
  readFile(filename: string): string;
7
7
  extractExportedZipWithNestedZips(zipFile: AdmZip): string;
8
8
  extractExportedZipWithNestedZipsToDir(zipFile: AdmZip, targetDir: string): string;
9
- copyDirectoryToCurrentLocation(sourceDir: string, targetName: string): void;
10
9
  isDirectory(sourcePath: string): boolean;
11
10
  zipDirectoryInBatchExportFormat(sourceDir: string): string;
12
11
  private getSerializedFileContent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celonis/content-cli",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "CLI Tool to help manage content in Celonis Platform",
5
5
  "main": "content-cli.js",
6
6
  "bin": {
@@ -53,5 +53,8 @@
53
53
  "prettier --write",
54
54
  "git add"
55
55
  ]
56
+ },
57
+ "repository": {
58
+ "url": "https://github.com/celonis/content-cli"
56
59
  }
57
60
  }