@rockcarver/frodo-cli 0.17.0 → 0.17.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/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.17.1] - 2022-10-17
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Updated frodo-lib to 0.15.2
|
|
15
|
+
- Added options to `frodo journey describe` command:
|
|
16
|
+
- Added `--verbose` option
|
|
17
|
+
- Added `--debug` option
|
|
18
|
+
|
|
10
19
|
## [0.17.0] - 2022-10-16
|
|
11
20
|
|
|
12
21
|
### Changed
|
|
@@ -683,7 +692,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
683
692
|
- Fixed problem with adding connection profiles
|
|
684
693
|
- Miscellaneous bug fixes
|
|
685
694
|
|
|
686
|
-
[Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.17.
|
|
695
|
+
[Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.17.1...HEAD
|
|
696
|
+
|
|
697
|
+
[0.17.1]: https://github.com/rockcarver/frodo-cli/compare/v0.17.0...v0.17.1
|
|
687
698
|
|
|
688
699
|
[0.17.0]: https://github.com/rockcarver/frodo-cli/compare/v0.16.2-1...v0.17.0
|
|
689
700
|
|
|
@@ -16,7 +16,7 @@ const {
|
|
|
16
16
|
saveTextToFile
|
|
17
17
|
} = ExportImportUtils;
|
|
18
18
|
const program = new Command('frodo journey describe');
|
|
19
|
-
program.description('If -h is supplied, describe the journey/tree indicated by -i, or all journeys/trees in the realm if no -i is supplied, otherwise describe the journey/tree export file indicated by -f.').helpOption('-h, --help', 'Help').showHelpAfterError().addArgument(common.hostArgument).addArgument(common.realmArgument).addArgument(common.userArgument).addArgument(common.passwordArgument).addOption(common.deploymentOption).addOption(common.insecureOption).addOption(new Option('-i, --journey-id <journey>', 'Name of a journey/tree. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the journey export file to describe. Ignored with -A.')).addOption(new Option('-F, --output-file <file>', 'Name of the file to write the output to.')).addOption(new Option('--markdown', 'Output in markdown.')).addOption(new Option('-o, --override-version <version>', "Override version. Notation: '<major>.<minor>.<patch>' e.g. '7.2.0'. Override detected version with any version. This is helpful in order to check if journeys in one environment would be compatible running in another environment (e.g. in preparation of migrating from on-prem to ForgeRock Identity Cloud.")).action( // implement command logic inside action handler
|
|
19
|
+
program.description('If -h is supplied, describe the journey/tree indicated by -i, or all journeys/trees in the realm if no -i is supplied, otherwise describe the journey/tree export file indicated by -f.').helpOption('-h, --help', 'Help').showHelpAfterError().addArgument(common.hostArgument).addArgument(common.realmArgument).addArgument(common.userArgument).addArgument(common.passwordArgument).addOption(common.deploymentOption).addOption(common.insecureOption).addOption(common.verboseOption).addOption(common.debugOption).addOption(new Option('-i, --journey-id <journey>', 'Name of a journey/tree. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the journey export file to describe. Ignored with -A.')).addOption(new Option('-F, --output-file <file>', 'Name of the file to write the output to.')).addOption(new Option('--markdown', 'Output in markdown.')).addOption(new Option('-o, --override-version <version>', "Override version. Notation: '<major>.<minor>.<patch>' e.g. '7.2.0'. Override detected version with any version. This is helpful in order to check if journeys in one environment would be compatible running in another environment (e.g. in preparation of migrating from on-prem to ForgeRock Identity Cloud.")).action( // implement command logic inside action handler
|
|
20
20
|
async (host, realm, user, password, options) => {
|
|
21
21
|
state.default.session.setTenant(host);
|
|
22
22
|
state.default.session.setRealm(realm);
|
|
@@ -24,6 +24,8 @@ async (host, realm, user, password, options) => {
|
|
|
24
24
|
state.default.session.setPassword(password);
|
|
25
25
|
state.default.session.setDeploymentType(options.type);
|
|
26
26
|
state.default.session.setAllowInsecureConnection(options.insecure);
|
|
27
|
+
state.default.session.setVerbose(options.verbose);
|
|
28
|
+
state.default.session.setDebug(options.debug);
|
|
27
29
|
if (options.outputFile) state.default.session.setOutputFile(options.outputFile); // TODO: review checks for arguments
|
|
28
30
|
|
|
29
31
|
if (typeof host === 'undefined' || typeof options.file !== 'undefined') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey-describe.js","names":["fs","Command","Option","Authenticate","ExportImportUtils","Journey","state","describeJourney","describeJourneyMd","common","printMessage","getTokens","getJourneys","exportJourney","createFileParamTreeExportResolver","saveTextToFile","program","description","helpOption","showHelpAfterError","addArgument","hostArgument","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","outputFile","setOutputFile","file","process","exitCode","overrideVersion","setAmVersion","fileData","JSON","parse","readFileSync","journeyData","journeyId","trees","Object","values","tree","_id","Error","markdown","error","message","getRealm","journeys","journey","treeData"],"sources":["cli/journey/journey-describe.ts"],"sourcesContent":["import fs from 'fs';\nimport { Command, Option } from 'commander';\nimport {\n Authenticate,\n ExportImportUtils,\n Journey,\n state,\n} from '@rockcarver/frodo-lib';\nimport { describeJourney, describeJourneyMd } from '../../ops/JourneyOps';\nimport * as common from '../cmd_common.js';\nimport { printMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\nconst { getJourneys, exportJourney, createFileParamTreeExportResolver } =\n Journey;\nconst { saveTextToFile } = ExportImportUtils;\n\nconst program = new Command('frodo journey describe');\n\nprogram\n .description(\n 'If -h is supplied, describe the journey/tree indicated by -i, or all journeys/trees in the realm if no -i is supplied, otherwise describe the journey/tree export file indicated by -f.'\n )\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgument)\n .addArgument(common.realmArgument)\n .addArgument(common.userArgument)\n .addArgument(common.passwordArgument)\n .addOption(common.deploymentOption)\n .addOption(common.insecureOption)\n .addOption(\n new Option(\n '-i, --journey-id <journey>',\n 'Name of a journey/tree. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the journey export file to describe. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-F, --output-file <file>',\n 'Name of the file to write the output to.'\n )\n )\n .addOption(new Option('--markdown', 'Output in markdown.'))\n .addOption(\n new Option(\n '-o, --override-version <version>',\n \"Override version. Notation: '<major>.<minor>.<patch>' e.g. '7.2.0'. Override detected version with any version. This is helpful in order to check if journeys in one environment would be compatible running in another environment (e.g. in preparation of migrating from on-prem to ForgeRock Identity Cloud.\"\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options) => {\n state.default.session.setTenant(host);\n state.default.session.setRealm(realm);\n state.default.session.setUsername(user);\n state.default.session.setPassword(password);\n state.default.session.setDeploymentType(options.type);\n state.default.session.setAllowInsecureConnection(options.insecure);\n if (options.outputFile)\n state.default.session.setOutputFile(options.outputFile);\n // TODO: review checks for arguments\n if (typeof host === 'undefined' || typeof options.file !== 'undefined') {\n if (\n typeof host === 'undefined' &&\n typeof options.file === 'undefined'\n ) {\n printMessage('Need either [host] or -f.', 'error');\n process.exitCode = 1;\n return;\n }\n printMessage(`Describing local journey file ${options.file}...`);\n try {\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.default.session.setAmVersion(options.overrideVersion);\n }\n const fileData = JSON.parse(fs.readFileSync(options.file, 'utf8'));\n let journeyData;\n // single or multi tree export?\n // multi - by id\n if (\n typeof options.journeyId !== 'undefined' &&\n fileData.trees &&\n fileData.trees[options.journeyId]\n ) {\n journeyData = fileData.trees[options.journeyId];\n }\n // multi - first\n else if (typeof options.journeyId === 'undefined' && fileData.trees) {\n [journeyData] = Object.values(fileData.trees);\n }\n // single - by id\n else if (\n typeof options.journeyId !== 'undefined' &&\n options.journeyId === fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // single\n else if (\n typeof options.journeyId === 'undefined' &&\n fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // no journey/tree found\n else {\n throw new Error(\n typeof options.journeyId === 'undefined'\n ? `No journey found in ${options.file}`\n : `Journey '${options.journeyId}' not found in ${options.file}`\n );\n }\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n } else if (await getTokens()) {\n printMessage(\n `Describing journey(s) in realm \"${state.default.session.getRealm()}\"...`\n );\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.default.session.setAmVersion(options.overrideVersion);\n }\n if (typeof options.journeyId === 'undefined') {\n let journeys: any[] = [];\n journeys = await getJourneys();\n for (const journey of journeys) {\n try {\n // eslint-disable-next-line no-await-in-loop, dot-notation\n const treeData = await exportJourney(journey['_id']);\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(treeData);\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(treeData);\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n }\n } else {\n try {\n const treeData = await exportJourney(options.journeyId);\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(treeData);\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(treeData);\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,OAAOA,EAAP,MAAe,IAAf;AACA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SACEC,YADF,EAEEC,iBAFF,EAGEC,OAHF,EAIEC,KAJF,QAKO,uBALP;AAMA,SAASC,eAAT,EAA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AMqB,QAAQ,GAAG,MAAMxD,aAAa,CAACoB,OAAO,CAACuB,SAAT,CAApC,CADE,CAEF;;QACA,IAAI,CAACvB,OAAO,CAAC8B,QAAb,EAAuB;UACrB,MAAMxD,eAAe,CAAC8D,QAAD,CAArB;QACD,CAFD,CAGA;QAHA,KAIK;UACH;UACA,IAAIpC,OAAO,CAACW,UAAZ,EAAwB7B,cAAc,CAAC,EAAD,EAAKkB,OAAO,CAACW,UAAb,CAAd;UACxB,MAAMpC,iBAAiB,CAAC6D,QAAD,CAAvB;QACD;MACF,CAZD,CAYE,OAAOL,KAAP,EAAc;QACdtD,YAAY,CAACsD,KAAK,CAACC,OAAP,EAAgB,OAAhB,CAAZ;QACAlB,OAAO,CAACC,QAAR,GAAmB,CAAnB;MACD;IACF;EACF;AACF,CA1KL,CA2KI;AA3KJ;AA8KAhC,OAAO,CAACqC,KAAR"}
|
|
1
|
+
{"version":3,"file":"journey-describe.js","names":["fs","Command","Option","Authenticate","ExportImportUtils","Journey","state","describeJourney","describeJourneyMd","common","printMessage","getTokens","getJourneys","exportJourney","createFileParamTreeExportResolver","saveTextToFile","program","description","helpOption","showHelpAfterError","addArgument","hostArgument","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","verboseOption","debugOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","setVerbose","verbose","setDebug","debug","outputFile","setOutputFile","file","process","exitCode","overrideVersion","setAmVersion","fileData","JSON","parse","readFileSync","journeyData","journeyId","trees","Object","values","tree","_id","Error","markdown","error","message","getRealm","journeys","journey","treeData"],"sources":["cli/journey/journey-describe.ts"],"sourcesContent":["import fs from 'fs';\nimport { Command, Option } from 'commander';\nimport {\n Authenticate,\n ExportImportUtils,\n Journey,\n state,\n} from '@rockcarver/frodo-lib';\nimport { describeJourney, describeJourneyMd } from '../../ops/JourneyOps';\nimport * as common from '../cmd_common.js';\nimport { printMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\nconst { getJourneys, exportJourney, createFileParamTreeExportResolver } =\n Journey;\nconst { saveTextToFile } = ExportImportUtils;\n\nconst program = new Command('frodo journey describe');\n\nprogram\n .description(\n 'If -h is supplied, describe the journey/tree indicated by -i, or all journeys/trees in the realm if no -i is supplied, otherwise describe the journey/tree export file indicated by -f.'\n )\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgument)\n .addArgument(common.realmArgument)\n .addArgument(common.userArgument)\n .addArgument(common.passwordArgument)\n .addOption(common.deploymentOption)\n .addOption(common.insecureOption)\n .addOption(common.verboseOption)\n .addOption(common.debugOption)\n .addOption(\n new Option(\n '-i, --journey-id <journey>',\n 'Name of a journey/tree. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the journey export file to describe. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-F, --output-file <file>',\n 'Name of the file to write the output to.'\n )\n )\n .addOption(new Option('--markdown', 'Output in markdown.'))\n .addOption(\n new Option(\n '-o, --override-version <version>',\n \"Override version. Notation: '<major>.<minor>.<patch>' e.g. '7.2.0'. Override detected version with any version. This is helpful in order to check if journeys in one environment would be compatible running in another environment (e.g. in preparation of migrating from on-prem to ForgeRock Identity Cloud.\"\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options) => {\n state.default.session.setTenant(host);\n state.default.session.setRealm(realm);\n state.default.session.setUsername(user);\n state.default.session.setPassword(password);\n state.default.session.setDeploymentType(options.type);\n state.default.session.setAllowInsecureConnection(options.insecure);\n state.default.session.setVerbose(options.verbose);\n state.default.session.setDebug(options.debug);\n if (options.outputFile)\n state.default.session.setOutputFile(options.outputFile);\n // TODO: review checks for arguments\n if (typeof host === 'undefined' || typeof options.file !== 'undefined') {\n if (\n typeof host === 'undefined' &&\n typeof options.file === 'undefined'\n ) {\n printMessage('Need either [host] or -f.', 'error');\n process.exitCode = 1;\n return;\n }\n printMessage(`Describing local journey file ${options.file}...`);\n try {\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.default.session.setAmVersion(options.overrideVersion);\n }\n const fileData = JSON.parse(fs.readFileSync(options.file, 'utf8'));\n let journeyData;\n // single or multi tree export?\n // multi - by id\n if (\n typeof options.journeyId !== 'undefined' &&\n fileData.trees &&\n fileData.trees[options.journeyId]\n ) {\n journeyData = fileData.trees[options.journeyId];\n }\n // multi - first\n else if (typeof options.journeyId === 'undefined' && fileData.trees) {\n [journeyData] = Object.values(fileData.trees);\n }\n // single - by id\n else if (\n typeof options.journeyId !== 'undefined' &&\n options.journeyId === fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // single\n else if (\n typeof options.journeyId === 'undefined' &&\n fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // no journey/tree found\n else {\n throw new Error(\n typeof options.journeyId === 'undefined'\n ? `No journey found in ${options.file}`\n : `Journey '${options.journeyId}' not found in ${options.file}`\n );\n }\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n } else if (await getTokens()) {\n printMessage(\n `Describing journey(s) in realm \"${state.default.session.getRealm()}\"...`\n );\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.default.session.setAmVersion(options.overrideVersion);\n }\n if (typeof options.journeyId === 'undefined') {\n let journeys: any[] = [];\n journeys = await getJourneys();\n for (const journey of journeys) {\n try {\n // eslint-disable-next-line no-await-in-loop, dot-notation\n const treeData = await exportJourney(journey['_id']);\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(treeData);\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(treeData);\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n }\n } else {\n try {\n const treeData = await exportJourney(options.journeyId);\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(treeData);\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(treeData);\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,OAAOA,EAAP,MAAe,IAAf;AACA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SACEC,YADF,EAEEC,iBAFF,EAGEC,OAHF,EAIEC,KAJF,QAKO,uBALP;AAMA,SAASC,eAAT,EAA0BC,iBAA1B,QAAmD,sBAAnD;AACA,OAAO,KAAKC,MAAZ,MAAwB,kBAAxB;AACA,SAASC,YAAT,QAA6B,qBAA7B;AAEA,MAAM;EAAEC;AAAF,IAAgBR,YAAtB;AACA,MAAM;EAAES,WAAF;EAAeC,aAAf;EAA8BC;AAA9B,IACJT,OADF;AAEA,MAAM;EAAEU;AAAF,IAAqBX,iBAA3B;AAEA,MAAMY,OAAO,GAAG,IAAIf,OAAJ,CAAY,wBAAZ,CAAhB;AAEAe,OAAO,CACJC,WADH,CAEI,yLAFJ,EAIGC,UAJH,CAIc,YAJd,EAI4B,MAJ5B,EAKGC,kBALH,GAMGC,WANH,CAMeX,MAAM,CAACY,YANtB,EAOGD,WAPH,CAOeX,MAAM,CAACa,aAPtB,EAQGF,WARH,CAQeX,MAAM,CAACc,YARtB,EASGH,WATH,CASeX,MAAM,CAACe,gBATtB,EAUGC,SAVH,CAUahB,MAAM,CAACiB,gBAVpB,EAWGD,SAXH,CAWahB,MAAM,CAACkB,cAXpB,EAYGF,SAZH,CAYahB,MAAM,CAACmB,aAZpB,EAaGH,SAbH,CAaahB,MAAM,CAACoB,WAbpB,EAcGJ,SAdH,CAeI,IAAIvB,MAAJ,CACE,4BADF,E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EACF;AACF,CA9KL,CA+KI;AA/KJ;AAkLAtC,OAAO,CAAC2C,KAAR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rockcarver/frodo-cli",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
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": [
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
]
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@rockcarver/frodo-lib": "0.15.
|
|
91
|
+
"@rockcarver/frodo-lib": "0.15.2",
|
|
92
92
|
"cli-progress": "^3.11.2",
|
|
93
93
|
"cli-table3": "^0.6.2",
|
|
94
94
|
"colors": "^1.4.0",
|