@rockcarver/frodo-cli 0.16.2-1 → 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,8 +7,38 @@ 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
+
19
+ ## [0.17.0] - 2022-10-16
20
+
21
+ ### Changed
22
+
23
+ - Updated frodo-lib to 0.15.1
24
+
25
+ ### Added
26
+
27
+ - \#82: Check for updates
28
+ - \#86: Support markdown output with `frodo journey describe` command
29
+ - Added new `--markdown` option to enable markdown output
30
+ - Added new `--output-file` option to enable writing output to a file
31
+
32
+ ### Fixed
33
+
34
+ - \#88: `frodo idm export` now properly regognizes `-N`/`--name` option
35
+
10
36
  ## [0.16.2-1] - 2022-10-11
11
37
 
38
+ ### Added
39
+
40
+ - \#82: Check for updates
41
+
12
42
  ## [0.16.2-0] - 2022-10-11
13
43
 
14
44
  ### Added
@@ -662,7 +692,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
662
692
  - Fixed problem with adding connection profiles
663
693
  - Miscellaneous bug fixes
664
694
 
665
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.16.2-1...HEAD
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
698
+
699
+ [0.17.0]: https://github.com/rockcarver/frodo-cli/compare/v0.16.2-1...v0.17.0
666
700
 
667
701
  [0.16.2-1]: https://github.com/rockcarver/frodo-cli/compare/v0.16.2-0...v0.16.2-1
668
702
 
@@ -1,13 +1,13 @@
1
1
  import { Argument, Option } from 'commander';
2
2
  import { state } from '@rockcarver/frodo-lib';
3
3
  import * as global from '../storage/StaticStorage.js';
4
- import { printMessage, createProgressIndicator, updateProgressIndicator, stopProgressIndicator, verbose, debug } from '../utils/Console.js';
4
+ import { printMessage, createProgressIndicator, updateProgressIndicator, stopProgressIndicator, verboseMessage, debugMessage } from '../utils/Console.js';
5
5
  state.default.session.setPrintHandler(printMessage);
6
+ state.default.session.setVerboseHandler(verboseMessage);
7
+ state.default.session.setDebugHandler(debugMessage);
6
8
  state.default.session.setCreateProgressHandler(createProgressIndicator);
7
9
  state.default.session.setUpdateProgressHandler(updateProgressIndicator);
8
- state.default.session.setStopProgressHandler(stopProgressIndicator);
9
- state.default.session.setVerboseHandler(verbose);
10
- state.default.session.setDebugHandler(debug); // pseudo functions for commands that do not otherwise need to import
10
+ state.default.session.setStopProgressHandler(stopProgressIndicator); // pseudo functions for commands that do not otherwise need to import
11
11
  // this file but need to trigger print and progress handler registration
12
12
 
13
13
  export function init() {}
@@ -1 +1 @@
1
- {"version":3,"file":"cmd_common.js","names":["Argument","Option","state","global","printMessage","createProgressIndicator","updateProgressIndicator","stopProgressIndicator","verbose","debug","default","session","setPrintHandler","setCreateProgressHandler","setUpdateProgressHandler","setStopProgressHandler","setVerboseHandler","setDebugHandler","init","hostArgumentDescription","hostArgument","hostArgumentM","realmArgumentDescription","realmArgument","DEFAULT_REALM_KEY","realmArgumentM","userArgumentDescription","userArgument","userArgumentM","passwordArgumentDescription","passwordArgument","passwordArgumentM","apiKeyArgumentDescription","apiKeyArgument","apiSecretArgumentDescription","apiSecretArgument","treeOptionDescription","treeOption","treeOptionM","fileOptionDescription","fileOption","fileOptionM","deploymentOptionDescription","deploymentOption","choices","DEPLOYMENT_TYPES","deploymentOptionM","insecureOption","verboseOption","debugOption","managedNameOption","managedNameOptionM","dirOptionDescription","dirOption","dirOptionM","entitiesFileOptionDescription","entitiesFileOption","entitiesFileOptionM","envFileOptionDescription","envFileOption","envFileOptionM","sourcesOptionDescription","sourcesOptionDefaultValueDescription","sourcesOptionM","scriptFriendlyOption","makeOptionMandatory"],"sources":["cli/cmd_common.ts"],"sourcesContent":["import { Argument, Option } from 'commander';\nimport { state } from '@rockcarver/frodo-lib';\nimport * as global from '../storage/StaticStorage.js';\nimport {\n printMessage,\n createProgressIndicator,\n updateProgressIndicator,\n stopProgressIndicator,\n verbose,\n debug\n} from '../utils/Console.js';\n\nstate.default.session.setPrintHandler(printMessage);\nstate.default.session.setCreateProgressHandler(createProgressIndicator);\nstate.default.session.setUpdateProgressHandler(updateProgressIndicator);\nstate.default.session.setStopProgressHandler(stopProgressIndicator);\nstate.default.session.setVerboseHandler(verbose);\nstate.default.session.setDebugHandler(debug);\n\n// pseudo functions for commands that do not otherwise need to import\n// this file but need to trigger print and progress handler registration\nexport function init() {}\n\nconst hostArgumentDescription =\n 'Access Management base URL, e.g.: https://cdk.iam.example.com/am. To use a connection profile, just specify a unique substring.';\nexport const hostArgument = new Argument('[host]', hostArgumentDescription);\nexport const hostArgumentM = new Argument('<host>', hostArgumentDescription);\n\nconst realmArgumentDescription =\n \"Realm. Specify realm as '/' for the root realm or 'realm' or '/parent/child' otherwise.\";\nexport const realmArgument = new Argument(\n '[realm]',\n realmArgumentDescription\n).default(\n global.DEFAULT_REALM_KEY,\n '\"alpha\" for Identity Cloud tenants, \"/\" otherwise.'\n);\nexport const realmArgumentM = new Argument('<realm>', realmArgumentDescription);\n\nconst userArgumentDescription =\n 'Username to login with. Must be an admin user with appropriate rights to manage authentication journeys/trees.';\nexport const userArgument = new Argument('[user]', userArgumentDescription);\nexport const userArgumentM = new Argument('<user>', userArgumentDescription);\n\nconst passwordArgumentDescription = 'Password.';\nexport const passwordArgument = new Argument(\n '[password]',\n passwordArgumentDescription\n);\nexport const passwordArgumentM = new Argument(\n '<password>',\n passwordArgumentDescription\n);\n\nconst apiKeyArgumentDescription = 'API key for logging API.';\nexport const apiKeyArgument = new Argument('[key]', apiKeyArgumentDescription);\n\nconst apiSecretArgumentDescription = 'API secret for logging API.';\nexport const apiSecretArgument = new Argument(\n '[secret]',\n apiSecretArgumentDescription\n);\n\nconst treeOptionDescription =\n 'Specify the name of an authentication journey/tree.';\nexport const treeOption = new Option(\n '-t, --tree <tree>',\n treeOptionDescription\n);\nexport const treeOptionM = new Option(\n '-t, --tree <tree>',\n treeOptionDescription\n);\n\nconst fileOptionDescription = 'File name.';\nexport const fileOption = new Option(\n '-f, --file <file>',\n fileOptionDescription\n);\nexport const fileOptionM = new Option(\n '-f, --file <file>',\n fileOptionDescription\n);\n\nconst deploymentOptionDescription =\n 'Override auto-detected deployment type. Valid values for type: \\n\\\nclassic: A classic Access Management-only deployment with custom layout and configuration. \\n\\\ncloud: A ForgeRock Identity Cloud environment. \\n\\\nforgeops: A ForgeOps CDK or CDM deployment. \\n\\\nThe detected or provided deployment type controls certain behavior like obtaining an Identity \\\nManagement admin token or not and whether to export/import referenced email templates or how \\\nto walk through the tenant admin login flow of Identity Cloud and handle MFA';\nexport const deploymentOption = new Option(\n '-m, --type <type>',\n deploymentOptionDescription\n).choices(global.DEPLOYMENT_TYPES);\nexport const deploymentOptionM = new Option(\n '-m, --type <type>',\n deploymentOptionDescription\n).choices(global.DEPLOYMENT_TYPES);\n\nexport const insecureOption = new Option(\n '-k, --insecure',\n 'Allow insecure connections when using SSL/TLS. Has no effect when using a network proxy for https (HTTPS_PROXY=http://<host>:<port>), in that case the proxy must provide this capability.'\n).default(false, \"Don't allow insecure connections\");\n\nexport const verboseOption = new Option(\n '--verbose',\n 'Verbose output during command execution. If specified, may or may not produce additional output.'\n);\n\nexport const debugOption = new Option(\n '--debug',\n 'Debug output during command execution. If specified, may or may not produce additional output helpful for troubleshooting.'\n);\n\nexport const managedNameOption = new Option(\n '-N, --name <name>',\n 'Managed object name to be operated on. Examples are \\\nuser, role, alpha_user, alpha_role etc.'\n);\nexport const managedNameOptionM = new Option(\n '-N, --name <name>',\n 'Managed object name to be operated on. Examples are \\\nuser, role, alpha_user, alpha_role etc.'\n);\n\nconst dirOptionDescription =\n 'Directory for exporting all configuration entities to.';\nexport const dirOption = new Option(\n '-D, --directory <directory>',\n dirOptionDescription\n);\nexport const dirOptionM = new Option(\n '-D, --directory <directory>',\n dirOptionDescription\n);\n\nconst entitiesFileOptionDescription =\n 'JSON file that specifies the config entities to export/import.';\nexport const entitiesFileOption = new Option(\n '-E, --entitiesFile <file>',\n entitiesFileOptionDescription\n);\nexport const entitiesFileOptionM = new Option(\n '-E, --entitiesFile <file>',\n entitiesFileOptionDescription\n);\n\nconst envFileOptionDescription =\n 'File that defines environment specific variables for replacement during configuration export/import.';\nexport const envFileOption = new Option(\n '-e, --envFile <file>',\n envFileOptionDescription\n);\nexport const envFileOptionM = new Option(\n '-e, --envFile <file>',\n envFileOptionDescription\n);\n\nconst sourcesOptionDescription = 'Comma separated list of log sources';\nconst sourcesOptionDefaultValueDescription = 'Log everything';\nexport const sourcesOptionM = new Option(\n '-c, --sources <sources>',\n sourcesOptionDescription\n).default('am-everything,idm-everything', sourcesOptionDefaultValueDescription);\n\nexport const scriptFriendlyOption = new Option(\n '-s, --scriptFriendly',\n 'Send output of operation to STDOUT in a script-friendly format (JSON) which can be piped to other \\\ncommands. User messages/warnings are output to STDERR, and are not piped. For example, to only get \\\nbearer token: \\n\\\n<<< frodo info my-tenant -s 2>/dev/null | jq -r .bearerToken >>>'\n).default(false, 'Output as plain text');\n\ntreeOptionM.makeOptionMandatory();\nfileOptionM.makeOptionMandatory();\ndeploymentOptionM.makeOptionMandatory();\ndirOptionM.makeOptionMandatory();\nentitiesFileOptionM.makeOptionMandatory();\nenvFileOptionM.makeOptionMandatory();\nmanagedNameOptionM.makeOptionMandatory();\nsourcesOptionM.makeOptionMandatory();\n"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,MAAnB,QAAiC,WAAjC;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,OAAO,KAAKC,MAAZ,MAAwB,6BAAxB;AACA,SACEC,YADF,EAEEC,uBAF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D,oCAHZ,CAAvB;AAKP,OAAO,MAAME,oBAAoB,GAAG,IAAI/D,MAAJ,CAClC,sBADkC,EAElC;AACF;AACA;AACA,iEALoC,EAMlCS,OANkC,CAM1B,KAN0B,EAMnB,sBANmB,CAA7B;AAQP4B,WAAW,CAAC2B,mBAAZ;AACAxB,WAAW,CAACwB,mBAAZ;AACAnB,iBAAiB,CAACmB,mBAAlB;AACAX,UAAU,CAACW,mBAAX;AACAR,mBAAmB,CAACQ,mBAApB;AACAL,cAAc,CAACK,mBAAf;AACAd,kBAAkB,CAACc,mBAAnB;AACAF,cAAc,CAACE,mBAAf"}
1
+ {"version":3,"file":"cmd_common.js","names":["Argument","Option","state","global","printMessage","createProgressIndicator","updateProgressIndicator","stopProgressIndicator","verboseMessage","debugMessage","default","session","setPrintHandler","setVerboseHandler","setDebugHandler","setCreateProgressHandler","setUpdateProgressHandler","setStopProgressHandler","init","hostArgumentDescription","hostArgument","hostArgumentM","realmArgumentDescription","realmArgument","DEFAULT_REALM_KEY","realmArgumentM","userArgumentDescription","userArgument","userArgumentM","passwordArgumentDescription","passwordArgument","passwordArgumentM","apiKeyArgumentDescription","apiKeyArgument","apiSecretArgumentDescription","apiSecretArgument","treeOptionDescription","treeOption","treeOptionM","fileOptionDescription","fileOption","fileOptionM","deploymentOptionDescription","deploymentOption","choices","DEPLOYMENT_TYPES","deploymentOptionM","insecureOption","verboseOption","debugOption","managedNameOption","managedNameOptionM","dirOptionDescription","dirOption","dirOptionM","entitiesFileOptionDescription","entitiesFileOption","entitiesFileOptionM","envFileOptionDescription","envFileOption","envFileOptionM","sourcesOptionDescription","sourcesOptionDefaultValueDescription","sourcesOptionM","scriptFriendlyOption","makeOptionMandatory"],"sources":["cli/cmd_common.ts"],"sourcesContent":["import { Argument, Option } from 'commander';\nimport { state } from '@rockcarver/frodo-lib';\nimport * as global from '../storage/StaticStorage.js';\nimport {\n printMessage,\n createProgressIndicator,\n updateProgressIndicator,\n stopProgressIndicator,\n verboseMessage,\n debugMessage,\n} from '../utils/Console.js';\n\nstate.default.session.setPrintHandler(printMessage);\nstate.default.session.setVerboseHandler(verboseMessage);\nstate.default.session.setDebugHandler(debugMessage);\nstate.default.session.setCreateProgressHandler(createProgressIndicator);\nstate.default.session.setUpdateProgressHandler(updateProgressIndicator);\nstate.default.session.setStopProgressHandler(stopProgressIndicator);\n\n// pseudo functions for commands that do not otherwise need to import\n// this file but need to trigger print and progress handler registration\nexport function init() {}\n\nconst hostArgumentDescription =\n 'Access Management base URL, e.g.: https://cdk.iam.example.com/am. To use a connection profile, just specify a unique substring.';\nexport const hostArgument = new Argument('[host]', hostArgumentDescription);\nexport const hostArgumentM = new Argument('<host>', hostArgumentDescription);\n\nconst realmArgumentDescription =\n \"Realm. Specify realm as '/' for the root realm or 'realm' or '/parent/child' otherwise.\";\nexport const realmArgument = new Argument(\n '[realm]',\n realmArgumentDescription\n).default(\n global.DEFAULT_REALM_KEY,\n '\"alpha\" for Identity Cloud tenants, \"/\" otherwise.'\n);\nexport const realmArgumentM = new Argument('<realm>', realmArgumentDescription);\n\nconst userArgumentDescription =\n 'Username to login with. Must be an admin user with appropriate rights to manage authentication journeys/trees.';\nexport const userArgument = new Argument('[user]', userArgumentDescription);\nexport const userArgumentM = new Argument('<user>', userArgumentDescription);\n\nconst passwordArgumentDescription = 'Password.';\nexport const passwordArgument = new Argument(\n '[password]',\n passwordArgumentDescription\n);\nexport const passwordArgumentM = new Argument(\n '<password>',\n passwordArgumentDescription\n);\n\nconst apiKeyArgumentDescription = 'API key for logging API.';\nexport const apiKeyArgument = new Argument('[key]', apiKeyArgumentDescription);\n\nconst apiSecretArgumentDescription = 'API secret for logging API.';\nexport const apiSecretArgument = new Argument(\n '[secret]',\n apiSecretArgumentDescription\n);\n\nconst treeOptionDescription =\n 'Specify the name of an authentication journey/tree.';\nexport const treeOption = new Option(\n '-t, --tree <tree>',\n treeOptionDescription\n);\nexport const treeOptionM = new Option(\n '-t, --tree <tree>',\n treeOptionDescription\n);\n\nconst fileOptionDescription = 'File name.';\nexport const fileOption = new Option(\n '-f, --file <file>',\n fileOptionDescription\n);\nexport const fileOptionM = new Option(\n '-f, --file <file>',\n fileOptionDescription\n);\n\nconst deploymentOptionDescription =\n 'Override auto-detected deployment type. Valid values for type: \\n\\\nclassic: A classic Access Management-only deployment with custom layout and configuration. \\n\\\ncloud: A ForgeRock Identity Cloud environment. \\n\\\nforgeops: A ForgeOps CDK or CDM deployment. \\n\\\nThe detected or provided deployment type controls certain behavior like obtaining an Identity \\\nManagement admin token or not and whether to export/import referenced email templates or how \\\nto walk through the tenant admin login flow of Identity Cloud and handle MFA';\nexport const deploymentOption = new Option(\n '-m, --type <type>',\n deploymentOptionDescription\n).choices(global.DEPLOYMENT_TYPES);\nexport const deploymentOptionM = new Option(\n '-m, --type <type>',\n deploymentOptionDescription\n).choices(global.DEPLOYMENT_TYPES);\n\nexport const insecureOption = new Option(\n '-k, --insecure',\n 'Allow insecure connections when using SSL/TLS. Has no effect when using a network proxy for https (HTTPS_PROXY=http://<host>:<port>), in that case the proxy must provide this capability.'\n).default(false, \"Don't allow insecure connections\");\n\nexport const verboseOption = new Option(\n '--verbose',\n 'Verbose output during command execution. If specified, may or may not produce additional output.'\n);\n\nexport const debugOption = new Option(\n '--debug',\n 'Debug output during command execution. If specified, may or may not produce additional output helpful for troubleshooting.'\n);\n\nexport const managedNameOption = new Option(\n '-N, --name <name>',\n 'Managed object name to be operated on. Examples are \\\nuser, role, alpha_user, alpha_role etc.'\n);\nexport const managedNameOptionM = new Option(\n '-N, --name <name>',\n 'Managed object name to be operated on. Examples are \\\nuser, role, alpha_user, alpha_role etc.'\n);\n\nconst dirOptionDescription =\n 'Directory for exporting all configuration entities to.';\nexport const dirOption = new Option(\n '-D, --directory <directory>',\n dirOptionDescription\n);\nexport const dirOptionM = new Option(\n '-D, --directory <directory>',\n dirOptionDescription\n);\n\nconst entitiesFileOptionDescription =\n 'JSON file that specifies the config entities to export/import.';\nexport const entitiesFileOption = new Option(\n '-E, --entitiesFile <file>',\n entitiesFileOptionDescription\n);\nexport const entitiesFileOptionM = new Option(\n '-E, --entitiesFile <file>',\n entitiesFileOptionDescription\n);\n\nconst envFileOptionDescription =\n 'File that defines environment specific variables for replacement during configuration export/import.';\nexport const envFileOption = new Option(\n '-e, --envFile <file>',\n envFileOptionDescription\n);\nexport const envFileOptionM = new Option(\n '-e, --envFile <file>',\n envFileOptionDescription\n);\n\nconst sourcesOptionDescription = 'Comma separated list of log sources';\nconst sourcesOptionDefaultValueDescription = 'Log everything';\nexport const sourcesOptionM = new Option(\n '-c, --sources <sources>',\n sourcesOptionDescription\n).default('am-everything,idm-everything', sourcesOptionDefaultValueDescription);\n\nexport const scriptFriendlyOption = new Option(\n '-s, --scriptFriendly',\n 'Send output of operation to STDOUT in a script-friendly format (JSON) which can be piped to other \\\ncommands. User messages/warnings are output to STDERR, and are not piped. For example, to only get \\\nbearer token: \\n\\\n<<< frodo info my-tenant -s 2>/dev/null | jq -r .bearerToken >>>'\n).default(false, 'Output as plain text');\n\ntreeOptionM.makeOptionMandatory();\nfileOptionM.makeOptionMandatory();\ndeploymentOptionM.makeOptionMandatory();\ndirOptionM.makeOptionMandatory();\nentitiesFileOptionM.makeOptionMandatory();\nenvFileOptionM.makeOptionMandatory();\nmanagedNameOptionM.makeOptionMandatory();\nsourcesOptionM.makeOptionMandatory();\n"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,MAAnB,QAAiC,WAAjC;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,OAAO,KAAKC,MAAZ,MAAwB,6BAAxB;AACA,SACEC,YADF,EAEEC,uBAFF,EAGEC,uBAHF,EAIEC,qBAJF,EAKEC,cALF,EAMEC,YANF,QAOO,qBAPP;AASAP,KAAK,CAACQ,OAAN,CAAcC,OAAd,CAAsBC,eAAtB,CAAsCR,YAAtC;AACAF,KAAK,CAACQ,OAAN,CAAcC,OAAd,CAAsBE,iBAAtB,CAAwCL,cAAxC;AACAN,KAAK,CAACQ,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AiB,CAACmB,mBAAlB;AACAX,UAAU,CAACW,mBAAX;AACAR,mBAAmB,CAACQ,mBAApB;AACAL,cAAc,CAACK,mBAAf;AACAd,kBAAkB,CAACc,mBAAnB;AACAF,cAAc,CAACE,mBAAf"}
@@ -21,9 +21,9 @@ async (host, realm, user, password, options) => {
21
21
 
22
22
  if (await getTokens()) {
23
23
  // export by id/name
24
- if (options.idmName) {
25
- console.log(`Exporting object "${options.idmName}" from realm "${state.default.session.getRealm()}"...`);
26
- exportConfigEntity(options.idmName, options.file);
24
+ if (options.name) {
25
+ console.log(`Exporting object "${options.name}" from realm "${state.default.session.getRealm()}"...`);
26
+ exportConfigEntity(options.name, options.file);
27
27
  } // --all-separate -A
28
28
  else if (options.allSeparate && options.directory && options.entitiesFile && options.envFile) {
29
29
  console.log(`Exporting IDM configuration objects specified in ${options.entitiesFile} into separate files in ${options.directory} using ${options.envFile} for variable replacement...`);
@@ -1 +1 @@
1
- {"version":3,"file":"idm-export.js","names":["Command","Option","Authenticate","Idm","state","common","getTokens","exportAllConfigEntities","exportAllRawConfigEntities","exportConfigEntity","program","description","helpOption","showHelpAfterError","addArgument","hostArgumentM","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","idmName","console","log","getRealm","file","allSeparate","directory","entitiesFile","envFile","help","parse"],"sources":["cli/idm/idm-export.ts"],"sourcesContent":["import { Command, Option } from 'commander';\nimport { Authenticate, Idm, state } from '@rockcarver/frodo-lib';\nimport * as common from '../cmd_common.js';\n\nconst { getTokens } = Authenticate;\nconst {\n exportAllConfigEntities,\n exportAllRawConfigEntities,\n exportConfigEntity,\n} = Idm;\n\nconst program = new Command('frodo idm export');\n\nprogram\n .description('Export IDM configuration objects.')\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgumentM)\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 '-N, --name <name>',\n 'Config entity name. E.g. \"managed\", \"sync\", \"provisioner-<connector-name>\", etc.'\n )\n )\n .addOption(new Option('-f, --file [file]', 'Export file. Ignored with -A.'))\n .addOption(\n new Option(\n '-E, --entities-file [entities-file]',\n 'Name of the entity file. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-e, --env-file [envfile]',\n 'Name of the env file. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Export all IDM configuration objects into a single file in directory -D. Ignored with -N.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all IDM configuration objects into separate JSON files in directory -D. Ignored with -N, and -a.'\n )\n )\n .addOption(\n new Option(\n '-D, --directory <directory>',\n 'Export directory. Required with and ignored without -a/-A.'\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 (await getTokens()) {\n // export by id/name\n if (options.idmName) {\n console.log(\n `Exporting object \"${\n options.idmName\n }\" from realm \"${state.default.session.getRealm()}\"...`\n );\n exportConfigEntity(options.idmName, options.file);\n }\n // --all-separate -A\n else if (\n options.allSeparate &&\n options.directory &&\n options.entitiesFile &&\n options.envFile\n ) {\n console.log(\n `Exporting IDM configuration objects specified in ${options.entitiesFile} into separate files in ${options.directory} using ${options.envFile} for variable replacement...`\n );\n exportAllConfigEntities(\n options.directory,\n options.entitiesFile,\n options.envFile\n );\n }\n // --all-separate -A without variable replacement\n else if (options.allSeparate && options.directory) {\n console.log(\n `Exporting all IDM configuration objects into separate files in ${options.directory}...`\n );\n exportAllRawConfigEntities(options.directory);\n }\n // unrecognized combination of options or no options\n else {\n console.log(\n 'Unrecognized combination of options or no options...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IAAInB,OAAO,CAACgB,WAAR,IAAuBhB,OAAO,CAACiB,SAAnC,EAA8C;MACjDL,OAAO,CAACC,GAAR,CACG,kEAAiEb,OAAO,CAACiB,SAAU,KADtF;MAGApC,0BAA0B,CAACmB,OAAO,CAACiB,SAAT,CAA1B;IACD,CALI,CAML;IANK,KAOA;MACHL,OAAO,CAACC,GAAR,CACE,sDADF,EAEE,OAFF;MAIA9B,OAAO,CAACqC,IAAR;IACD;EACF;AACF,CAlGL,CAmGI;AAnGJ;AAsGArC,OAAO,CAACsC,KAAR"}
1
+ {"version":3,"file":"idm-export.js","names":["Command","Option","Authenticate","Idm","state","common","getTokens","exportAllConfigEntities","exportAllRawConfigEntities","exportConfigEntity","program","description","helpOption","showHelpAfterError","addArgument","hostArgumentM","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","name","console","log","getRealm","file","allSeparate","directory","entitiesFile","envFile","help","parse"],"sources":["cli/idm/idm-export.ts"],"sourcesContent":["import { Command, Option } from 'commander';\nimport { Authenticate, Idm, state } from '@rockcarver/frodo-lib';\nimport * as common from '../cmd_common.js';\n\nconst { getTokens } = Authenticate;\nconst {\n exportAllConfigEntities,\n exportAllRawConfigEntities,\n exportConfigEntity,\n} = Idm;\n\nconst program = new Command('frodo idm export');\n\nprogram\n .description('Export IDM configuration objects.')\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgumentM)\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 '-N, --name <name>',\n 'Config entity name. E.g. \"managed\", \"sync\", \"provisioner-<connector-name>\", etc.'\n )\n )\n .addOption(new Option('-f, --file [file]', 'Export file. Ignored with -A.'))\n .addOption(\n new Option(\n '-E, --entities-file [entities-file]',\n 'Name of the entity file. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-e, --env-file [envfile]',\n 'Name of the env file. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Export all IDM configuration objects into a single file in directory -D. Ignored with -N.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all IDM configuration objects into separate JSON files in directory -D. Ignored with -N, and -a.'\n )\n )\n .addOption(\n new Option(\n '-D, --directory <directory>',\n 'Export directory. Required with and ignored without -a/-A.'\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 (await getTokens()) {\n // export by id/name\n if (options.name) {\n console.log(\n `Exporting object \"${\n options.name\n }\" from realm \"${state.default.session.getRealm()}\"...`\n );\n exportConfigEntity(options.name, options.file);\n }\n // --all-separate -A\n else if (\n options.allSeparate &&\n options.directory &&\n options.entitiesFile &&\n options.envFile\n ) {\n console.log(\n `Exporting IDM configuration objects specified in ${options.entitiesFile} into separate files in ${options.directory} using ${options.envFile} for variable replacement...`\n );\n exportAllConfigEntities(\n options.directory,\n options.entitiesFile,\n options.envFile\n );\n }\n // --all-separate -A without variable replacement\n else if (options.allSeparate && options.directory) {\n console.log(\n `Exporting all IDM configuration objects into separate files in ${options.directory}...`\n );\n exportAllRawConfigEntities(options.directory);\n }\n // unrecognized combination of options or no options\n else {\n console.log(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SAASC,YAAT,EAAuBC,GAAvB,EAA4BC,KAA5B,QAAyC,uBAAzC;AACA,OAAO,KAAKC,MAAZ,MAAwB,kBAAxB;AAEA,MAAM;EAAEC;A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F;MAIA9B,OAAO,CAACqC,IAAR;IACD;EACF;AACF,CAlGL,CAmGI;AAnGJ;AAsGArC,OAAO,CAACsC,KAAR"}
@@ -1,8 +1,9 @@
1
1
  import fs from 'fs';
2
2
  import { Command, Option } from 'commander';
3
- import { Authenticate, Journey, state } from '@rockcarver/frodo-lib';
4
- import { describeJourney } from '../../ops/JourneyOps';
3
+ import { Authenticate, ExportImportUtils, Journey, state } from '@rockcarver/frodo-lib';
4
+ import { describeJourney, describeJourneyMd } from '../../ops/JourneyOps';
5
5
  import * as common from '../cmd_common.js';
6
+ import { printMessage } from '../../utils/Console';
6
7
  const {
7
8
  getTokens
8
9
  } = Authenticate;
@@ -11,24 +12,30 @@ const {
11
12
  exportJourney,
12
13
  createFileParamTreeExportResolver
13
14
  } = Journey;
15
+ const {
16
+ saveTextToFile
17
+ } = ExportImportUtils;
14
18
  const program = new Command('frodo journey describe');
15
- 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 file to write the exported journey(s) to. Ignored with -A.')).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
16
20
  async (host, realm, user, password, options) => {
17
21
  state.default.session.setTenant(host);
18
22
  state.default.session.setRealm(realm);
19
23
  state.default.session.setUsername(user);
20
24
  state.default.session.setPassword(password);
21
25
  state.default.session.setDeploymentType(options.type);
22
- state.default.session.setAllowInsecureConnection(options.insecure); // TODO: review checks for arguments
26
+ state.default.session.setAllowInsecureConnection(options.insecure);
27
+ state.default.session.setVerbose(options.verbose);
28
+ state.default.session.setDebug(options.debug);
29
+ if (options.outputFile) state.default.session.setOutputFile(options.outputFile); // TODO: review checks for arguments
23
30
 
24
31
  if (typeof host === 'undefined' || typeof options.file !== 'undefined') {
25
32
  if (typeof host === 'undefined' && typeof options.file === 'undefined') {
26
- console.log('Need either [host] or -f.');
33
+ printMessage('Need either [host] or -f.', 'error');
27
34
  process.exitCode = 1;
28
35
  return;
29
36
  }
30
37
 
31
- console.log(`Describing local journey file ${options.file}...`);
38
+ printMessage(`Describing local journey file ${options.file}...`);
32
39
 
33
40
  try {
34
41
  var _fileData$tree, _fileData$tree2;
@@ -56,15 +63,23 @@ async (host, realm, user, password, options) => {
56
63
  } // no journey/tree found
57
64
  else {
58
65
  throw new Error(typeof options.journeyId === 'undefined' ? `No journey found in ${options.file}` : `Journey '${options.journeyId}' not found in ${options.file}`);
59
- }
66
+ } // ANSI text output
67
+
60
68
 
61
- await describeJourney(journeyData, createFileParamTreeExportResolver(options.file));
69
+ if (!options.markdown) {
70
+ await describeJourney(journeyData, createFileParamTreeExportResolver(options.file));
71
+ } // Markdown output
72
+ else {
73
+ // reset output file
74
+ if (options.outputFile) saveTextToFile('', options.outputFile);
75
+ await describeJourneyMd(journeyData, createFileParamTreeExportResolver(options.file));
76
+ }
62
77
  } catch (error) {
63
- console.log(error.message);
78
+ printMessage(error.message, 'error');
64
79
  process.exitCode = 1;
65
80
  }
66
81
  } else if (await getTokens()) {
67
- console.log(`Describing journey(s) in realm "${state.default.session.getRealm()}"...`); // override version
82
+ printMessage(`Describing journey(s) in realm "${state.default.session.getRealm()}"...`); // override version
68
83
 
69
84
  if (typeof options.overrideVersion !== 'undefined') {
70
85
  state.default.session.setAmVersion(options.overrideVersion);
@@ -77,19 +92,35 @@ async (host, realm, user, password, options) => {
77
92
  for (const journey of journeys) {
78
93
  try {
79
94
  // eslint-disable-next-line no-await-in-loop, dot-notation
80
- const treeData = await exportJourney(journey['_id']);
81
- await describeJourney(treeData);
95
+ const treeData = await exportJourney(journey['_id']); // ANSI text output
96
+
97
+ if (!options.markdown) {
98
+ await describeJourney(treeData);
99
+ } // Markdown output
100
+ else {
101
+ // reset output file
102
+ if (options.outputFile) saveTextToFile('', options.outputFile);
103
+ await describeJourneyMd(treeData);
104
+ }
82
105
  } catch (error) {
83
- console.log(error.message);
106
+ printMessage(error.message, 'error');
84
107
  process.exitCode = 1;
85
108
  }
86
109
  }
87
110
  } else {
88
111
  try {
89
- const treeData = await exportJourney(options.journeyId);
90
- await describeJourney(treeData);
112
+ const treeData = await exportJourney(options.journeyId); // ANSI text output
113
+
114
+ if (!options.markdown) {
115
+ await describeJourney(treeData);
116
+ } // Markdown output
117
+ else {
118
+ // reset output file
119
+ if (options.outputFile) saveTextToFile('', options.outputFile);
120
+ await describeJourneyMd(treeData);
121
+ }
91
122
  } catch (error) {
92
- console.log(error.message);
123
+ printMessage(error.message, 'error');
93
124
  process.exitCode = 1;
94
125
  }
95
126
  }
@@ -1 +1 @@
1
- {"version":3,"file":"journey-describe.js","names":["fs","Command","Option","Authenticate","Journey","state","describeJourney","common","getTokens","getJourneys","exportJourney","createFileParamTreeExportResolver","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","file","console","log","process","exitCode","overrideVersion","setAmVersion","fileData","JSON","parse","readFileSync","journeyData","journeyId","trees","Object","values","tree","_id","Error","error","message","getRealm","journeys","journey","treeData"],"sources":["cli/journey/journey-describe.ts"],"sourcesContent":["import fs from 'fs';\nimport { Command, Option } from 'commander';\nimport { Authenticate, Journey, state } from '@rockcarver/frodo-lib';\nimport { describeJourney } from '../../ops/JourneyOps';\nimport * as common from '../cmd_common.js';\n\nconst { getTokens } = Authenticate;\nconst { getJourneys, exportJourney, createFileParamTreeExportResolver } =\n Journey;\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 file to write the exported journey(s) to. Ignored with -A.'\n )\n )\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 // 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 console.log('Need either [host] or -f.');\n process.exitCode = 1;\n return;\n }\n console.log(`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 await describeJourney(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n } catch (error) {\n console.log(error.message);\n process.exitCode = 1;\n }\n } else if (await getTokens()) {\n console.log(\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 await describeJourney(treeData);\n } catch (error) {\n console.log(error.message);\n process.exitCode = 1;\n }\n }\n } else {\n try {\n const treeData = await exportJourney(options.journeyId);\n await describeJourney(treeData);\n } catch (error) {\n console.log(error.message);\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,SAASC,YAAT,EAAuBC,OAAvB,EAAgCC,KAAhC,QAA6C,uBAA7C;AACA,SAASC,eAAT,QAAgC,sBAAhC;AACA,OAAO,KAAKC,MAAZ,MAAwB,kBAAxB;AAEA,MAAM;EAAEC;AAAF,IAAgBL,YAAtB;AACA,MAAM;EAAEM,WAAF;EAAeC,aAAf;EAA8BC;AAA9B,IACJP,OADF;AAGA,MAAMQ,OAAO,GAAG,IAAIX,OAAJ,CAAY,wBAAZ,CAAhB;AAEAW,OAAO,CACJC,WADH,CAEI,yLAFJ,EAIGC,UAJH,CAIc,YAJd,EAI4B,MAJ5B,EAKGC,kBALH,GAMGC,WANH,CAMeT,MAAM,CAACU,YANtB,EAOGD,WAPH,CAOeT,MAAM,CAACW,aAPtB,EAQGF,WARH,CAQeT,MAAM,CAACY,YARtB,EASGH,WATH,CASeT,MAAM,CAACa,gBATtB,EAUGC,SAVH,CAUad,MAAM,CAACe,gBAVpB,EAWGD,SAXH,CAWad,MAAM,CAACgB,cAXpB,EAYGF,SAZH,CAaI,IAAInB,MAAJ,CACE,4BADF,EAEE,8DAFF,CAbJ,EAkBGmB,SAlBH,CAmBI,IAAInB,MAAJ,CACE,mBADF,EAEE,wEAFF,CAnBJ,EAwBGmB,SAxBH,CAyBI,IAAInB,MAAJ,CACE,kCADF,EAEE,iTAFF,CAzBJ,EA8BGsB,MA9BH,EA+BI;AACA,OAAOC,IAAP,EAAaC,KAAb,EAAoBC,IAApB,EAA0B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CrC,KAAK,CAACyB,OAAN,CAAcC,OAAd,CAAsB8B,QAAtB,EAAiC,MADtE,EAD4B,CAI5B;;IACA,IAAI,OAAOhC,OAAO,CAACgB,eAAf,KAAmC,WAAvC,EAAoD;MAClDxC,KAAK,CAACyB,OAAN,CAAcC,OAAd,CAAsBe,YAAtB,CAAmCjB,OAAO,CAACgB,eAA3C;IACD;;IACD,IAAI,OAAOhB,OAAO,CAACuB,SAAf,KAA6B,WAAjC,EAA8C;MAC5C,IAAIU,QAAe,GAAG,EAAtB;MACAA,QAAQ,GAAG,MAAMrD,WAAW,EAA5B;;MACA,KAAK,MAAMsD,OAAX,IAAsBD,QAAtB,EAAgC;QAC9B,IAAI;UACF;UACA,MAAME,QAAQ,GAAG,MAAMtD,aAAa,CAACqD,OAAO,CAAC,KAAD,CAAR,CAApC;UACA,MAAMzD,eAAe,CAAC0D,QAAD,CAArB;QACD,CAJD,CAIE,OAAOL,KAAP,EAAc;UACdlB,OAAO,CAACC,GAAR,CAAYiB,KAAK,CAACC,OAAlB;UACAjB,OAAO,CAACC,QAAR,GAAmB,CAAnB;QACD;MACF;IACF,CAbD,MAaO;MACL,IAAI;QACF,MAAMoB,QAAQ,GAAG,MAAMtD,aAAa,CAACmB,OAAO,CAACuB,SAAT,CAApC;QACA,MAAM9C,eAAe,CAAC0D,QAAD,CAArB;MACD,CAHD,CAGE,OAAOL,KAAP,EAAc;QACdlB,OAAO,CAACC,GAAR,CAAYiB,KAAK,CAACC,OAAlB;QACAjB,OAAO,CAACC,QAAR,GAAmB,CAAnB;MACD;IACF;EACF;AACF,CAnIL,CAoII;AApIJ;AAuIAhC,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,CA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,GAAG,MAAM9D,aAAa,CAACsB,OAAO,CAAC2B,SAAT,CAApC,CADE,CAEF;;QACA,IAAI,CAAC3B,OAAO,CAACkC,QAAb,EAAuB;UACrB,MAAM9D,eAAe,CAACoE,QAAD,CAArB;QACD,CAFD,CAGA;QAHA,KAIK;UACH;UACA,IAAIxC,OAAO,CAACe,UAAZ,EAAwBnC,cAAc,CAAC,EAAD,EAAKoB,OAAO,CAACe,UAAb,CAAd;UACxB,MAAM1C,iBAAiB,CAACmE,QAAD,CAAvB;QACD;MACF,CAZD,CAYE,OAAOL,KAAP,EAAc;QACd5D,YAAY,CAAC4D,KAAK,CAACC,OAAP,EAAgB,OAAhB,CAAZ;QACAlB,OAAO,CAACC,QAAR,GAAmB,CAAnB;MACD;IACF;EACF;AACF,CA9KL,CA+KI;AA/KJ;AAkLAtC,OAAO,CAAC2C,KAAR"}
@@ -9,4 +9,25 @@ export function getOneLineDescription(cotObj) {
9
9
  const description = `[${cotObj._id['brightCyan']}]`;
10
10
  return description;
11
11
  }
12
+ /**
13
+ * Get markdown table header
14
+ * @returns {string} markdown table header
15
+ */
16
+
17
+ export function getTableHeaderMd() {
18
+ let markdown = '';
19
+ markdown += '| Name/Id | Status | Trusted Providers |\n';
20
+ markdown += '| ------- | ------ | ----------------- |';
21
+ return markdown;
22
+ }
23
+ /**
24
+ * Get a table-row of the circle of trust in markdown
25
+ * @param {SocialIdpSkeleton} cotObj circle of trust object to describe
26
+ * @returns {string} a table-row of the circle of trust in markdown
27
+ */
28
+
29
+ export function getTableRowMd(cotObj) {
30
+ const row = `| ${cotObj._id} | ${cotObj.status === 'active' ? ':white_check_mark: `active`' : ':o: `inactive`'} | ${cotObj.trustedProviders.map(provider => provider.split('|')[0]).join('<br>')} |`;
31
+ return row;
32
+ }
12
33
  //# sourceMappingURL=CirclesOfTrustOps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CirclesOfTrustOps.js","names":["getOneLineDescription","cotObj","description","_id"],"sources":["ops/CirclesOfTrustOps.ts"],"sourcesContent":["// import { CircleOfTrustSkeleton } from \"@rockcarver/frodo-lib/types/api/ApiTypes\";\nimport { TypesRaw } from '@rockcarver/frodo-lib';\n\n/**\n * Get a one-line description of the circle of trust object\n * @param {CircleOfTrustSkeleton} cotObj circle of trust object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(cotObj: TypesRaw.CircleOfTrustSkeleton): string {\n const description = `[${cotObj._id['brightCyan']}]`;\n return description;\n}\n"],"mappings":"AAAA;;AAGA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAT,CAA+BC,MAA/B,EAA+E;EACpF,MAAMC,WAAW,GAAI,IAAGD,MAAM,CAACE,GAAP,CAAW,YAAX,CAAyB,GAAjD;EACA,OAAOD,WAAP;AACD"}
1
+ {"version":3,"file":"CirclesOfTrustOps.js","names":["getOneLineDescription","cotObj","description","_id","getTableHeaderMd","markdown","getTableRowMd","row","status","trustedProviders","map","provider","split","join"],"sources":["ops/CirclesOfTrustOps.ts"],"sourcesContent":["// import { CircleOfTrustSkeleton } from \"@rockcarver/frodo-lib/types/api/ApiTypes\";\nimport { TypesRaw } from '@rockcarver/frodo-lib';\n\n/**\n * Get a one-line description of the circle of trust object\n * @param {CircleOfTrustSkeleton} cotObj circle of trust object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(\n cotObj: TypesRaw.CircleOfTrustSkeleton\n): string {\n const description = `[${cotObj._id['brightCyan']}]`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Name/Id | Status | Trusted Providers |\\n';\n markdown += '| ------- | ------ | ----------------- |';\n return markdown;\n}\n\n/**\n * Get a table-row of the circle of trust in markdown\n * @param {SocialIdpSkeleton} cotObj circle of trust object to describe\n * @returns {string} a table-row of the circle of trust in markdown\n */\nexport function getTableRowMd(cotObj: TypesRaw.CircleOfTrustSkeleton): string {\n const row = `| ${cotObj._id} | ${\n cotObj.status === 'active'\n ? ':white_check_mark: `active`'\n : ':o: `inactive`'\n } | ${cotObj.trustedProviders\n .map((provider) => provider.split('|')[0])\n .join('<br>')} |`;\n return row;\n}\n"],"mappings":"AAAA;;AAGA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAT,CACLC,MADK,EAEG;EACR,MAAMC,WAAW,GAAI,IAAGD,MAAM,CAACE,GAAP,CAAW,YAAX,CAAyB,GAAjD;EACA,OAAOD,WAAP;AACD;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASE,gBAAT,GAAoC;EACzC,IAAIC,QAAQ,GAAG,EAAf;EACAA,QAAQ,IAAI,4CAAZ;EACAA,QAAQ,IAAI,0CAAZ;EACA,OAAOA,QAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAuBL,MAAvB,EAAuE;EAC5E,MAAMM,GAAG,GAAI,KAAIN,MAAM,CAACE,GAAI,MAC1BF,MAAM,CAACO,MAAP,KAAkB,QAAlB,GACI,6BADJ,GAEI,gBACL,MAAKP,MAAM,CAACQ,gBAAP,CACHC,GADG,CACEC,QAAD,IAAcA,QAAQ,CAACC,KAAT,CAAe,GAAf,EAAoB,CAApB,CADf,EAEHC,IAFG,CAEE,MAFF,CAEU,IANhB;EAOA,OAAON,GAAP;AACD"}
@@ -1,10 +1,36 @@
1
+ import { EmailTemplateRaw } from '@rockcarver/frodo-lib';
1
2
  /**
2
3
  * Get a one-line description of the email template
3
4
  * @param {EmailTemplateSkeleton} templateObj email template object to describe
4
5
  * @returns {string} a one-line description
5
6
  */
7
+
6
8
  export function getOneLineDescription(templateObj) {
7
9
  const description = `[${templateObj._id.split('/')[1]['brightCyan']}] ${templateObj.displayName ? templateObj.displayName : ''} - ${templateObj.defaultLocale ? templateObj.subject[templateObj.defaultLocale] : Object.values(templateObj.subject)[0]}`;
8
10
  return description;
9
11
  }
12
+ /**
13
+ * Get markdown table header
14
+ * @returns {string} markdown table header
15
+ */
16
+
17
+ export function getTableHeaderMd() {
18
+ let markdown = '';
19
+ markdown += '| Display Name | Locale(s) | Subject | Id |\n';
20
+ markdown += '| ------------ | --------- | ------- | ---|';
21
+ return markdown;
22
+ }
23
+ /**
24
+ * Get a table-row of the email template in markdown
25
+ * @param {EmailTemplateSkeleton} templateObj email template object to describe
26
+ * @returns {string} a table-row of the email template in markdown
27
+ */
28
+
29
+ export function getTableRowMd(templateObj) {
30
+ const templateId = templateObj._id.replace(`${EmailTemplateRaw.EMAIL_TEMPLATE_TYPE}/`, '');
31
+
32
+ const locales = `${templateObj.defaultLocale}${Object.keys(templateObj.subject).length > 1 ? ` (${Object.keys(templateObj.subject).filter(locale => locale !== templateObj.defaultLocale).join(',')})` : ''}`;
33
+ const row = `| ${templateObj.name ? templateObj.name : templateId} | ${locales} | ${templateObj.subject[templateObj.defaultLocale]} | \`${templateId}\` |`;
34
+ return row;
35
+ }
10
36
  //# sourceMappingURL=EmailTemplateOps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmailTemplateOps.js","names":["getOneLineDescription","templateObj","description","_id","split","displayName","defaultLocale","subject","Object","values"],"sources":["ops/EmailTemplateOps.ts"],"sourcesContent":["import { EmailTemplateSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\n\n/**\n * Get a one-line description of the email template\n * @param {EmailTemplateSkeleton} templateObj email template object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(\n templateObj: EmailTemplateSkeleton\n): string {\n const description = `[${templateObj._id.split('/')[1]['brightCyan']}] ${\n templateObj.displayName ? templateObj.displayName : ''\n } - ${\n templateObj.defaultLocale\n ? templateObj.subject[templateObj.defaultLocale]\n : Object.values(templateObj.subject)[0]\n }`;\n return description;\n}\n"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAT,CACLC,WADK,EAEG;EACR,MAAMC,WAAW,GAAI,IAAGD,WAAW,CAACE,GAAZ,CAAgBC,KAAhB,CAAsB,GAAtB,EAA2B,CAA3B,EAA8B,YAA9B,CAA4C,KAClEH,WAAW,CAACI,WAAZ,GAA0BJ,WAAW,CAACI,WAAtC,GAAoD,EACrD,MACCJ,WAAW,CAACK,aAAZ,GACIL,WAAW,CAACM,OAAZ,CAAoBN,WAAW,CAACK,aAAhC,CADJ,GAEIE,MAAM,CAACC,MAAP,CAAcR,WAAW,CAACM,OAA1B,EAAmC,CAAnC,CACL,EAND;EAOA,OAAOL,WAAP;AACD"}
1
+ {"version":3,"file":"EmailTemplateOps.js","names":["EmailTemplateRaw","getOneLineDescription","templateObj","description","_id","split","displayName","defaultLocale","subject","Object","values","getTableHeaderMd","markdown","getTableRowMd","templateId","replace","EMAIL_TEMPLATE_TYPE","locales","keys","length","filter","locale","join","row","name"],"sources":["ops/EmailTemplateOps.ts"],"sourcesContent":["import { EmailTemplateSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport { EmailTemplateRaw } from '@rockcarver/frodo-lib';\n\n/**\n * Get a one-line description of the email template\n * @param {EmailTemplateSkeleton} templateObj email template object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(\n templateObj: EmailTemplateSkeleton\n): string {\n const description = `[${templateObj._id.split('/')[1]['brightCyan']}] ${\n templateObj.displayName ? templateObj.displayName : ''\n } - ${\n templateObj.defaultLocale\n ? templateObj.subject[templateObj.defaultLocale]\n : Object.values(templateObj.subject)[0]\n }`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Display Name | Locale(s) | Subject | Id |\\n';\n markdown += '| ------------ | --------- | ------- | ---|';\n return markdown;\n}\n\n/**\n * Get a table-row of the email template in markdown\n * @param {EmailTemplateSkeleton} templateObj email template object to describe\n * @returns {string} a table-row of the email template in markdown\n */\nexport function getTableRowMd(templateObj: EmailTemplateSkeleton): string {\n const templateId = templateObj._id.replace(\n `${EmailTemplateRaw.EMAIL_TEMPLATE_TYPE}/`,\n ''\n );\n const locales = `${templateObj.defaultLocale}${\n Object.keys(templateObj.subject).length > 1\n ? ` (${Object.keys(templateObj.subject)\n .filter((locale) => locale !== templateObj.defaultLocale)\n .join(',')})`\n : ''\n }`;\n const row = `| ${\n templateObj.name ? templateObj.name : templateId\n } | ${locales} | ${\n templateObj.subject[templateObj.defaultLocale]\n } | \\`${templateId}\\` |`;\n return row;\n}\n"],"mappings":"AACA,SAASA,gBAAT,QAAiC,uBAAjC;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,qBAAT,CACLC,WADK,EAEG;EACR,MAAMC,WAAW,GAAI,IAAGD,WAAW,CAACE,GAAZ,CAAgBC,KAAhB,CAAsB,GAAtB,EAA2B,CAA3B,EAA8B,YAA9B,CAA4C,KAClEH,WAAW,CAACI,WAAZ,GAA0BJ,WAAW,CAACI,WAAtC,GAAoD,EACrD,MACCJ,WAAW,CAACK,aAAZ,GACIL,WAAW,CAACM,OAAZ,CAAoBN,WAAW,CAACK,aAAhC,CADJ,GAEIE,MAAM,CAACC,MAAP,CAAcR,WAAW,CAACM,OAA1B,EAAmC,CAAnC,CACL,EAND;EAOA,OAAOL,WAAP;AACD;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASQ,gBAAT,GAAoC;EACzC,IAAIC,QAAQ,GAAG,EAAf;EACAA,QAAQ,IAAI,+CAAZ;EACAA,QAAQ,IAAI,6CAAZ;EACA,OAAOA,QAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAuBX,WAAvB,EAAmE;EACxE,MAAMY,UAAU,GAAGZ,WAAW,CAACE,GAAZ,CAAgBW,OAAhB,CAChB,GAAEf,gBAAgB,CAACgB,mBAAoB,GADvB,EAEjB,EAFiB,CAAnB;;EAIA,MAAMC,OAAO,GAAI,GAAEf,WAAW,CAACK,aAAc,GAC3CE,MAAM,CAACS,IAAP,CAAYhB,WAAW,CAACM,OAAxB,EAAiCW,MAAjC,GAA0C,CAA1C,GACK,KAAIV,MAAM,CAACS,IAAP,CAAYhB,WAAW,CAACM,OAAxB,EACFY,MADE,CACMC,MAAD,IAAYA,MAAM,KAAKnB,WAAW,CAACK,aADxC,EAEFe,IAFE,CAEG,GAFH,CAEQ,GAHjB,GAII,EACL,EAND;EAOA,MAAMC,GAAG,GAAI,KACXrB,WAAW,CAACsB,IAAZ,GAAmBtB,WAAW,CAACsB,IAA/B,GAAsCV,UACvC,MAAKG,OAAQ,MACZf,WAAW,CAACM,OAAZ,CAAoBN,WAAW,CAACK,aAAhC,CACD,QAAOO,UAAW,MAJnB;EAKA,OAAOS,GAAP;AACD"}
package/esm/ops/IdpOps.js CHANGED
@@ -7,4 +7,25 @@ export function getOneLineDescription(socialIdpObj) {
7
7
  const description = `[${socialIdpObj._id['brightCyan']}] ${socialIdpObj._type._id}`;
8
8
  return description;
9
9
  }
10
+ /**
11
+ * Get markdown table header
12
+ * @returns {string} markdown table header
13
+ */
14
+
15
+ export function getTableHeaderMd() {
16
+ let markdown = '';
17
+ markdown += '| Name/Id | Status | Type |\n';
18
+ markdown += '| ------- | ------ | ---- |';
19
+ return markdown;
20
+ }
21
+ /**
22
+ * Get a table-row of the social idp in markdown
23
+ * @param {SocialIdpSkeleton} socialIdpObj social idp object to describe
24
+ * @returns {string} a table-row of the social idp in markdown
25
+ */
26
+
27
+ export function getTableRowMd(socialIdpObj) {
28
+ const row = `| ${socialIdpObj._id} | ${socialIdpObj.enabled === false ? ':o: `disabled`' : ':white_check_mark: `enabled`'} | ${socialIdpObj._type.name} |`;
29
+ return row;
30
+ }
10
31
  //# sourceMappingURL=IdpOps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IdpOps.js","names":["getOneLineDescription","socialIdpObj","description","_id","_type"],"sources":["ops/IdpOps.ts"],"sourcesContent":["import { SocialIdpSkeleton } from \"@rockcarver/frodo-lib/types/api/ApiTypes\";\n\n/**\n * Get a one-line description of the social idp object\n * @param {SocialIdpSkeleton} socialIdpObj social idp object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(socialIdpObj: SocialIdpSkeleton): string {\n const description = `[${socialIdpObj._id['brightCyan']}] ${socialIdpObj._type._id}`;\n return description;\n}\n"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAT,CAA+BC,YAA/B,EAAwE;EAC7E,MAAMC,WAAW,GAAI,IAAGD,YAAY,CAACE,GAAb,CAAiB,YAAjB,CAA+B,KAAIF,YAAY,CAACG,KAAb,CAAmBD,GAAI,EAAlF;EACA,OAAOD,WAAP;AACD"}
1
+ {"version":3,"file":"IdpOps.js","names":["getOneLineDescription","socialIdpObj","description","_id","_type","getTableHeaderMd","markdown","getTableRowMd","row","enabled","name"],"sources":["ops/IdpOps.ts"],"sourcesContent":["import { SocialIdpSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\n\n/**\n * Get a one-line description of the social idp object\n * @param {SocialIdpSkeleton} socialIdpObj social idp object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(socialIdpObj: SocialIdpSkeleton): string {\n const description = `[${socialIdpObj._id['brightCyan']}] ${socialIdpObj._type._id}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Name/Id | Status | Type |\\n';\n markdown += '| ------- | ------ | ---- |';\n return markdown;\n}\n\n/**\n * Get a table-row of the social idp in markdown\n * @param {SocialIdpSkeleton} socialIdpObj social idp object to describe\n * @returns {string} a table-row of the social idp in markdown\n */\nexport function getTableRowMd(socialIdpObj: SocialIdpSkeleton): string {\n const row = `| ${socialIdpObj._id} | ${\n socialIdpObj.enabled === false\n ? ':o: `disabled`'\n : ':white_check_mark: `enabled`'\n } | ${socialIdpObj._type.name} |`;\n return row;\n}\n"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAT,CAA+BC,YAA/B,EAAwE;EAC7E,MAAMC,WAAW,GAAI,IAAGD,YAAY,CAACE,GAAb,CAAiB,YAAjB,CAA+B,KAAIF,YAAY,CAACG,KAAb,CAAmBD,GAAI,EAAlF;EACA,OAAOD,WAAP;AACD;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASG,gBAAT,GAAoC;EACzC,IAAIC,QAAQ,GAAG,EAAf;EACAA,QAAQ,IAAI,+BAAZ;EACAA,QAAQ,IAAI,6BAAZ;EACA,OAAOA,QAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAuBN,YAAvB,EAAgE;EACrE,MAAMO,GAAG,GAAI,KAAIP,YAAY,CAACE,GAAI,MAChCF,YAAY,CAACQ,OAAb,KAAyB,KAAzB,GACI,gBADJ,GAEI,8BACL,MAAKR,YAAY,CAACG,KAAb,CAAmBM,IAAK,IAJ9B;EAKA,OAAOF,GAAP;AACD"}