@rockcarver/frodo-cli 0.19.0 → 0.19.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,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.19.1] - 2022-12-20
11
+
12
+ ### Fixed
13
+
14
+ - \#161: Frodo now properly allows adding connection profiles with log credentials
15
+
10
16
  ## [0.19.0] - 2022-12-18
11
17
 
12
18
  ### Added
@@ -823,7 +829,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
823
829
  - Fixed problem with adding connection profiles
824
830
  - Miscellaneous bug fixes
825
831
 
826
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.19.0...HEAD
832
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.19.1...HEAD
833
+
834
+ [0.19.1]: https://github.com/rockcarver/frodo-cli/compare/v0.19.0...v0.19.1
827
835
 
828
836
  [0.19.0]: https://github.com/rockcarver/frodo-cli/compare/v0.18.2-18...v0.19.0
829
837
 
@@ -111,9 +111,16 @@ export class FrodoCommand extends FrodoStubCommand {
111
111
 
112
112
  // handle arguments first
113
113
  for (const [i, v] of command.args.entries()) {
114
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
115
- const handler = stateMap[command._args[i].name()];
116
- handler(v);
114
+ const arg = command._args[i].name();
115
+ // handle only default arguments
116
+ if (Object.keys(stateMap).includes(arg)) {
117
+ debugMessage(`FrodoCommand.handleDefaultArgsAndOpts: Handling default argument '${arg}'.`);
118
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
119
+ const handler = stateMap[arg];
120
+ handler(v);
121
+ } else {
122
+ debugMessage(`FrodoCommand.handleDefaultArgsAndOpts: Ignoring non-default argument '${arg}'.`);
123
+ }
117
124
  }
118
125
 
119
126
  // handle options
@@ -1 +1 @@
1
- {"version":3,"file":"FrodoCommand.js","names":["Argument","Command","Option","globalConfig","state","fs","printMessage","createProgressIndicator","updateProgressIndicator","stopProgressIndicator","verboseMessage","debugMessage","curlirizeMessage","hostArgument","realmArgument","default","process","env","FRODO_REALM","DEFAULT_REALM_KEY","usernameArgument","passwordArgument","serviceAccountIdOption","serviceAccountJwkFileOption","deploymentOption","choices","DEPLOYMENT_TYPES","insecureOption","verboseOption","debugOption","curlirizeOption","defaultArgs","defaultOpts","stateMap","name","setHost","setRealm","setUsername","setPassword","attributeName","setServiceAccountId","file","data","readFileSync","jwk","JSON","parse","toString","setServiceAccountJwk","error","message","setDeploymentType","setAllowInsecureConnection","setVerbose","setDebug","setCurlirize","FrodoStubCommand","constructor","helpOption","showHelpAfterError","configureHelp","sortSubcommands","sortOptions","setPrintHandler","setVerboseHandler","setDebugHandler","setCurlirizeHandler","setCreateProgressHandler","setUpdateProgressHandler","setStopProgressHandler","FrodoCommand","omits","arg","includes","addArgument","opt","addOption","handleDefaultArgsAndOpts","args","command","pop","options","i","v","entries","handler","_args","k","Object","keys"],"sources":["cli/FrodoCommand.ts"],"sourcesContent":["import { Argument, Command, Option } from 'commander';\nimport * as globalConfig from '../storage/StaticStorage';\nimport { state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport {\n printMessage,\n createProgressIndicator,\n updateProgressIndicator,\n stopProgressIndicator,\n verboseMessage,\n debugMessage,\n curlirizeMessage,\n} from '../utils/Console.js';\n\nconst hostArgument = new Argument(\n '[host]',\n 'Access Management base URL, e.g.: https://cdk.iam.example.com/am. To use a connection profile, just specify a unique substring.'\n);\n\nconst realmArgument = new Argument(\n '[realm]',\n \"Realm. Specify realm as '/' for the root realm or 'realm' or '/parent/child' otherwise.\"\n).default(\n // must check for FRODO_REALM env variable here because otherwise cli will overwrite realm with default value\n process.env.FRODO_REALM || globalConfig.DEFAULT_REALM_KEY,\n '\"alpha\" for Identity Cloud tenants, \"/\" otherwise.'\n);\n\nconst usernameArgument = new Argument(\n '[username]',\n 'Username to login with. Must be an admin user with appropriate rights to manage authentication journeys/trees.'\n);\n\nconst passwordArgument = new Argument('[password]', 'Password.');\n\nconst serviceAccountIdOption = new Option(\n '--sa-id <sa-id>',\n 'Service account id.'\n);\n\nconst serviceAccountJwkFileOption = new Option(\n '--sa-jwk-file <file>',\n 'File containing the java web key (jwk) associated with the the service account.'\n);\n\nconst deploymentOption = new Option(\n '-m, --type <type>',\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'\n).choices(globalConfig.DEPLOYMENT_TYPES);\n\nconst 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\nconst verboseOption = new Option(\n '--verbose',\n 'Verbose output during command execution. If specified, may or may not produce additional output.'\n);\n\nconst 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\nconst curlirizeOption = new Option(\n '--curlirize',\n 'Output all network calls in curl format.'\n);\n\nconst defaultArgs = [\n hostArgument,\n realmArgument,\n usernameArgument,\n passwordArgument,\n];\n\nconst defaultOpts = [\n serviceAccountIdOption,\n serviceAccountJwkFileOption,\n deploymentOption,\n insecureOption,\n verboseOption,\n debugOption,\n curlirizeOption,\n];\n\nconst stateMap = {\n [hostArgument.name()]: state.setHost,\n [realmArgument.name()]: state.setRealm,\n [usernameArgument.name()]: state.setUsername,\n [passwordArgument.name()]: state.setPassword,\n [serviceAccountIdOption.attributeName()]: state.setServiceAccountId,\n [serviceAccountJwkFileOption.attributeName()]: (file) => {\n try {\n const data = fs.readFileSync(file);\n const jwk = JSON.parse(data.toString());\n state.setServiceAccountJwk(jwk);\n } catch (error) {\n printMessage(\n `Error parsing JWK from file ${file}: ${error.message}`,\n 'error'\n );\n }\n },\n [deploymentOption.attributeName()]: state.setDeploymentType,\n [insecureOption.attributeName()]: state.setAllowInsecureConnection,\n [verboseOption.attributeName()]: state.setVerbose,\n [debugOption.attributeName()]: state.setDebug,\n [curlirizeOption.attributeName()]: state.setCurlirize,\n};\n\n/**\n * Command with default options\n */\nexport class FrodoStubCommand extends Command {\n /**\n * Creates a new FrodoCommand instance\n * @param name Name of the command\n * @param omits Array of default argument names and default option names that should not be added to this command\n */\n constructor(name: string) {\n super(name);\n\n // other default settings\n this.helpOption('-h, --help', 'Help');\n this.showHelpAfterError();\n this.configureHelp({\n sortSubcommands: true,\n sortOptions: true,\n });\n\n // register default handlers\n state.setPrintHandler(printMessage);\n state.setVerboseHandler(verboseMessage);\n state.setDebugHandler(debugMessage);\n state.setCurlirizeHandler(curlirizeMessage);\n state.setCreateProgressHandler(createProgressIndicator);\n state.setUpdateProgressHandler(updateProgressIndicator);\n state.setStopProgressHandler(stopProgressIndicator);\n }\n}\n\n/**\n * Command with default options\n */\nexport class FrodoCommand extends FrodoStubCommand {\n /**\n * Creates a new FrodoCommand instance\n * @param name Name of the command\n * @param omits Array of default argument names and default option names that should not be added to this command\n */\n constructor(name: string, omits: string[] = []) {\n super(name);\n\n // register default arguments\n for (const arg of defaultArgs) {\n if (!omits.includes(arg.name())) this.addArgument(arg);\n }\n\n // register default options\n for (const opt of defaultOpts) {\n if (!omits.includes(opt.name())) this.addOption(opt);\n }\n }\n\n /**\n *\n * @param args\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n handleDefaultArgsAndOpts(...args: any) {\n const command = args.pop();\n const options = args.pop();\n\n // handle arguments first\n for (const [i, v] of command.args.entries()) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const handler: any = stateMap[command._args[i].name()];\n handler(v);\n }\n\n // handle options\n for (const [k, v] of Object.entries(options)) {\n // handle only default options\n if (Object.keys(stateMap).includes(k)) {\n debugMessage(\n `FrodoCommand.handleDefaultArgsAndOpts: Handling default option '${k}'.`\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const handler: any = stateMap[k];\n handler(v);\n } else {\n debugMessage(\n `FrodoCommand.handleDefaultArgsAndOpts: Ignoring non-default option '${k}'.`\n );\n }\n }\n }\n}\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,OAAO,EAAEC,MAAM,QAAQ,WAAW;AACrD,OAAO,KAAKC,YAAY,MAAM,0BAA0B;AACxD,SAASC,KAAK,QAAQ,uBAAuB;AAC7C,OAAOC,EAAE,MAAM,IAAI;AACnB,SACEC,YAAY,EACZC,uBAAuB,EACvBC,uBAAuB,EACvBC,qBAAqB,EACrBC,cAAc,EACdC,YAAY,EACZC,gBAAgB,QACX,qBAAqB;AAE5B,MAAMC,YAAY,GAAG,IAAIb,QAAQ,CAC/B,QAAQ,EACR,iIAAiI,CAClI;AAED,MAAMc,aAAa,GAAG,IAAId,QAAQ,CAChC,SAAS,EACT,yFAAyF,CAC1F,CAACe,OAAO;AACP;AACAC,OAAO,CAACC,GAAG,CAACC,WAAW,IAAIf,YAAY,CAACgB,iBAAiB,EACzD,oDAAoD,CACrD;AAED,MAAMC,gBAAgB,GAAG,IAAIpB,QAAQ,CACnC,YAAY,EACZ,gHAAgH,CACjH;AAED,MAAMqB,gBAAgB,GAAG,IAAIrB,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC;AAEhE,MAAMsB,sBAAsB,GAAG,IAAIpB,MAAM,CACvC,iBAAiB,EACjB,qBAAqB,CACtB;AAED,MAAMqB,2BAA2B,GAAG,IAAIrB,MAAM,CAC5C,sBAAsB,EACtB,iFAAiF,CAClF;AAED,MAAMsB,gBAAgB,GAAG,IAAItB,MAAM,CACjC,mBAAmB,EACnB;AACF;AACA;AACA;AACA;AACA;AACA,6E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AQ,CAACsD,CAAC,CAAC;QAChCF,OAAO,CAACF,CAAC,CAAC;MACZ,CAAC,MAAM;QACLxE,YAAY,CACT,uEAAsE4E,CAAE,IAAG,CAC7E;MACH;IACF;EACF;AACF"}
1
+ {"version":3,"file":"FrodoCommand.js","names":["Argument","Command","Option","globalConfig","state","fs","printMessage","createProgressIndicator","updateProgressIndicator","stopProgressIndicator","verboseMessage","debugMessage","curlirizeMessage","hostArgument","realmArgument","default","process","env","FRODO_REALM","DEFAULT_REALM_KEY","usernameArgument","passwordArgument","serviceAccountIdOption","serviceAccountJwkFileOption","deploymentOption","choices","DEPLOYMENT_TYPES","insecureOption","verboseOption","debugOption","curlirizeOption","defaultArgs","defaultOpts","stateMap","name","setHost","setRealm","setUsername","setPassword","attributeName","setServiceAccountId","file","data","readFileSync","jwk","JSON","parse","toString","setServiceAccountJwk","error","message","setDeploymentType","setAllowInsecureConnection","setVerbose","setDebug","setCurlirize","FrodoStubCommand","constructor","helpOption","showHelpAfterError","configureHelp","sortSubcommands","sortOptions","setPrintHandler","setVerboseHandler","setDebugHandler","setCurlirizeHandler","setCreateProgressHandler","setUpdateProgressHandler","setStopProgressHandler","FrodoCommand","omits","arg","includes","addArgument","opt","addOption","handleDefaultArgsAndOpts","args","command","pop","options","i","v","entries","_args","Object","keys","handler","k"],"sources":["cli/FrodoCommand.ts"],"sourcesContent":["import { Argument, Command, Option } from 'commander';\nimport * as globalConfig from '../storage/StaticStorage';\nimport { state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport {\n printMessage,\n createProgressIndicator,\n updateProgressIndicator,\n stopProgressIndicator,\n verboseMessage,\n debugMessage,\n curlirizeMessage,\n} from '../utils/Console.js';\n\nconst hostArgument = new Argument(\n '[host]',\n 'Access Management base URL, e.g.: https://cdk.iam.example.com/am. To use a connection profile, just specify a unique substring.'\n);\n\nconst realmArgument = new Argument(\n '[realm]',\n \"Realm. Specify realm as '/' for the root realm or 'realm' or '/parent/child' otherwise.\"\n).default(\n // must check for FRODO_REALM env variable here because otherwise cli will overwrite realm with default value\n process.env.FRODO_REALM || globalConfig.DEFAULT_REALM_KEY,\n '\"alpha\" for Identity Cloud tenants, \"/\" otherwise.'\n);\n\nconst usernameArgument = new Argument(\n '[username]',\n 'Username to login with. Must be an admin user with appropriate rights to manage authentication journeys/trees.'\n);\n\nconst passwordArgument = new Argument('[password]', 'Password.');\n\nconst serviceAccountIdOption = new Option(\n '--sa-id <sa-id>',\n 'Service account id.'\n);\n\nconst serviceAccountJwkFileOption = new Option(\n '--sa-jwk-file <file>',\n 'File containing the java web key (jwk) associated with the the service account.'\n);\n\nconst deploymentOption = new Option(\n '-m, --type <type>',\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'\n).choices(globalConfig.DEPLOYMENT_TYPES);\n\nconst 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\nconst verboseOption = new Option(\n '--verbose',\n 'Verbose output during command execution. If specified, may or may not produce additional output.'\n);\n\nconst 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\nconst curlirizeOption = new Option(\n '--curlirize',\n 'Output all network calls in curl format.'\n);\n\nconst defaultArgs = [\n hostArgument,\n realmArgument,\n usernameArgument,\n passwordArgument,\n];\n\nconst defaultOpts = [\n serviceAccountIdOption,\n serviceAccountJwkFileOption,\n deploymentOption,\n insecureOption,\n verboseOption,\n debugOption,\n curlirizeOption,\n];\n\nconst stateMap = {\n [hostArgument.name()]: state.setHost,\n [realmArgument.name()]: state.setRealm,\n [usernameArgument.name()]: state.setUsername,\n [passwordArgument.name()]: state.setPassword,\n [serviceAccountIdOption.attributeName()]: state.setServiceAccountId,\n [serviceAccountJwkFileOption.attributeName()]: (file) => {\n try {\n const data = fs.readFileSync(file);\n const jwk = JSON.parse(data.toString());\n state.setServiceAccountJwk(jwk);\n } catch (error) {\n printMessage(\n `Error parsing JWK from file ${file}: ${error.message}`,\n 'error'\n );\n }\n },\n [deploymentOption.attributeName()]: state.setDeploymentType,\n [insecureOption.attributeName()]: state.setAllowInsecureConnection,\n [verboseOption.attributeName()]: state.setVerbose,\n [debugOption.attributeName()]: state.setDebug,\n [curlirizeOption.attributeName()]: state.setCurlirize,\n};\n\n/**\n * Command with default options\n */\nexport class FrodoStubCommand extends Command {\n /**\n * Creates a new FrodoCommand instance\n * @param name Name of the command\n * @param omits Array of default argument names and default option names that should not be added to this command\n */\n constructor(name: string) {\n super(name);\n\n // other default settings\n this.helpOption('-h, --help', 'Help');\n this.showHelpAfterError();\n this.configureHelp({\n sortSubcommands: true,\n sortOptions: true,\n });\n\n // register default handlers\n state.setPrintHandler(printMessage);\n state.setVerboseHandler(verboseMessage);\n state.setDebugHandler(debugMessage);\n state.setCurlirizeHandler(curlirizeMessage);\n state.setCreateProgressHandler(createProgressIndicator);\n state.setUpdateProgressHandler(updateProgressIndicator);\n state.setStopProgressHandler(stopProgressIndicator);\n }\n}\n\n/**\n * Command with default options\n */\nexport class FrodoCommand extends FrodoStubCommand {\n /**\n * Creates a new FrodoCommand instance\n * @param name Name of the command\n * @param omits Array of default argument names and default option names that should not be added to this command\n */\n constructor(name: string, omits: string[] = []) {\n super(name);\n\n // register default arguments\n for (const arg of defaultArgs) {\n if (!omits.includes(arg.name())) this.addArgument(arg);\n }\n\n // register default options\n for (const opt of defaultOpts) {\n if (!omits.includes(opt.name())) this.addOption(opt);\n }\n }\n\n /**\n *\n * @param args\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n handleDefaultArgsAndOpts(...args: any) {\n const command = args.pop();\n const options = args.pop();\n\n // handle arguments first\n for (const [i, v] of command.args.entries()) {\n const arg = command._args[i].name();\n // handle only default arguments\n if (Object.keys(stateMap).includes(arg)) {\n debugMessage(\n `FrodoCommand.handleDefaultArgsAndOpts: Handling default argument '${arg}'.`\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const handler: any = stateMap[arg];\n handler(v);\n } else {\n debugMessage(\n `FrodoCommand.handleDefaultArgsAndOpts: Ignoring non-default argument '${arg}'.`\n );\n }\n }\n\n // handle options\n for (const [k, v] of Object.entries(options)) {\n // handle only default options\n if (Object.keys(stateMap).includes(k)) {\n debugMessage(\n `FrodoCommand.handleDefaultArgsAndOpts: Handling default option '${k}'.`\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const handler: any = stateMap[k];\n handler(v);\n } else {\n debugMessage(\n `FrodoCommand.handleDefaultArgsAndOpts: Ignoring non-default option '${k}'.`\n );\n }\n }\n }\n}\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,OAAO,EAAEC,MAAM,QAAQ,WAAW;AACrD,OAAO,KAAKC,YAAY,MAAM,0BAA0B;AACxD,SAASC,KAAK,QAAQ,uBAAuB;AAC7C,OAAOC,EAAE,MAAM,IAAI;AACnB,SACEC,YAAY,EACZC,uBAAuB,EACvBC,uBAAuB,EACvBC,qBAAqB,EACrBC,cAAc,EACdC,YAAY,EACZC,gBAAgB,QACX,qBAAqB;AAE5B,MAAMC,YAAY,GAAG,IAAIb,QAAQ,CAC/B,QAAQ,EACR,iIAAiI,CAClI;AAED,MAAMc,aAAa,GAAG,IAAId,QAAQ,CAChC,SAAS,EACT,yFAAyF,CAC1F,CAACe,OAAO;AACP;AACAC,OAAO,CAACC,GAAG,CAACC,WAAW,IAAIf,YAAY,CAACgB,iBAAiB,EACzD,oDAAoD,CACrD;AAED,MAAMC,gBAAgB,GAAG,IAAIpB,QAAQ,CACnC,YAAY,EACZ,g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IoD,MAAM,CAACC,IAAI,CAACtD,QAAQ,CAAC,CAACwC,QAAQ,CAACD,GAAG,CAAC,EAAE;QACvC7D,YAAY,CACT,qEAAoE6D,GAAI,IAAG,CAC7E;QACD;QACA,MAAMgB,OAAY,GAAGvD,QAAQ,CAACuC,GAAG,CAAC;QAClCgB,OAAO,CAACL,CAAC,CAAC;MACZ,CAAC,MAAM;QACLxE,YAAY,CACT,yEAAwE6D,GAAI,IAAG,CACjF;MACH;IACF;;IAEA;IACA,KAAK,MAAM,CAACiB,CAAC,EAAEN,CAAC,CAAC,IAAIG,MAAM,CAACF,OAAO,CAACH,OAAO,CAAC,EAAE;MAC5C;MACA,IAAIK,MAAM,CAACC,IAAI,CAACtD,QAAQ,CAAC,CAACwC,QAAQ,CAACgB,CAAC,CAAC,EAAE;QACrC9E,YAAY,CACT,mEAAkE8E,CAAE,IAAG,CACzE;QACD;QACA,MAAMD,OAAY,GAAGvD,QAAQ,CAACwD,CAAC,CAAC;QAChCD,OAAO,CAACL,CAAC,CAAC;MACZ,CAAC,MAAM;QACLxE,YAAY,CACT,uEAAsE8E,CAAE,IAAG,CAC7E;MACH;IACF;EACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-cli",
3
- "version": "0.19.0",
3
+ "version": "0.19.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": [