@rockcarver/frodo-cli 0.13.2 → 0.13.3

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/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.13.3] - 2022-09-30
11
+
12
+ ### Added
13
+
14
+ - rockcarver/frodo-lib#104: Enhanced `frodo journey describe` command to include more details
15
+ - \#60: Support the improved frodo journey describe command with frodo-cli
16
+
17
+ ### Changed
18
+
19
+ - Updated frodo-lib to 0.12.6
20
+
10
21
  ## [0.13.2] - 2022-09-29
11
22
 
12
23
  ### Changed
@@ -559,7 +570,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
559
570
  - Fixed problem with adding connection profiles
560
571
  - Miscellaneous bug fixes
561
572
 
562
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.13.2...HEAD
573
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.13.3...HEAD
574
+
575
+ [0.13.3]: https://github.com/rockcarver/frodo-cli/compare/v0.13.2...v0.13.3
563
576
 
564
577
  [0.13.2]: https://github.com/rockcarver/frodo-cli/compare/v0.13.1...v0.13.2
565
578
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-cli",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "type": "module",
5
5
  "description": "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
6
6
  "keywords": [
@@ -85,7 +85,7 @@
85
85
  },
86
86
  "dependencies": {
87
87
  "@colors/colors": "^1.5.0",
88
- "@rockcarver/frodo-lib": "0.12.5",
88
+ "@rockcarver/frodo-lib": "0.12.6",
89
89
  "cli-progress": "^3.11.2",
90
90
  "cli-table3": "^0.6.2",
91
91
  "commander": "^9.4.0",
@@ -4,7 +4,12 @@ import { Authenticate, Journey, state } from '@rockcarver/frodo-lib';
4
4
  import * as common from '../cmd_common.js';
5
5
 
6
6
  const { getTokens } = Authenticate;
7
- const { getJourneys, exportJourney, describeJourney } = Journey;
7
+ const {
8
+ getJourneys,
9
+ exportJourney,
10
+ createFileParamTreeExportResolver,
11
+ describeJourney,
12
+ } = Journey;
8
13
 
9
14
  const program = new Command('frodo journey describe');
10
15
 
@@ -59,9 +64,47 @@ program
59
64
  }
60
65
  console.log(`Describing local journey file ${options.file}...`);
61
66
  try {
62
- const data = fs.readFileSync(options.file, 'utf8');
63
- const journeyData = JSON.parse(data);
64
- describeJourney(journeyData);
67
+ const fileData = JSON.parse(fs.readFileSync(options.file, 'utf8'));
68
+ let journeyData = null;
69
+ // single or multi tree export?
70
+ // multi - by id
71
+ if (
72
+ typeof options.journeyId !== 'undefined' &&
73
+ fileData.trees &&
74
+ fileData.trees[options.journeyId]
75
+ ) {
76
+ journeyData = fileData.trees[options.journeyId];
77
+ }
78
+ // multi - first
79
+ else if (typeof options.journeyId === 'undefined' && fileData.trees) {
80
+ [journeyData] = Object.values(fileData.trees);
81
+ }
82
+ // single - by id
83
+ else if (
84
+ typeof options.journeyId !== 'undefined' &&
85
+ options.journeyId === fileData.tree?._id
86
+ ) {
87
+ journeyData = fileData;
88
+ }
89
+ // single
90
+ else if (
91
+ typeof options.journeyId === 'undefined' &&
92
+ fileData.tree?._id
93
+ ) {
94
+ journeyData = fileData;
95
+ }
96
+ // no journey/tree found
97
+ else {
98
+ throw new Error(
99
+ typeof options.journeyId === 'undefined'
100
+ ? `No journey found in ${options.file}`
101
+ : `Journey '${options.journeyId}' not found in ${options.file}`
102
+ );
103
+ }
104
+ describeJourney(
105
+ journeyData,
106
+ createFileParamTreeExportResolver(options.file)
107
+ );
65
108
  } catch (error) {
66
109
  console.log(error.message);
67
110
  process.exitCode = 1;
@@ -75,7 +118,7 @@ program
75
118
  journeys = await getJourneys();
76
119
  for (const journey of journeys) {
77
120
  try {
78
- // eslint-disable-next-line no-await-in-loop
121
+ // eslint-disable-next-line no-await-in-loop, dot-notation
79
122
  const treeData = await exportJourney(journey['_id']);
80
123
  describeJourney(treeData);
81
124
  } catch (error) {