@rockcarver/frodo-cli 2.0.0-22 → 2.0.0-23

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/esm/cli/FrodoCommand.js +3 -1
  3. package/esm/cli/FrodoCommand.js.map +1 -1
  4. package/esm/cli/agent/agent-web.js +2 -2
  5. package/esm/cli/agent/agent-web.js.map +1 -1
  6. package/esm/cli/app/app-import.js +1 -1
  7. package/esm/cli/app/app-import.js.map +1 -1
  8. package/esm/cli/idm/idm-export.js +14 -8
  9. package/esm/cli/idm/idm-export.js.map +1 -1
  10. package/esm/cli/idm/idm-import.js +14 -8
  11. package/esm/cli/idm/idm-import.js.map +1 -1
  12. package/esm/cli/journey/journey-export.js +2 -3
  13. package/esm/cli/journey/journey-export.js.map +1 -1
  14. package/esm/cli/oauth/oauth-client-import.js +1 -1
  15. package/esm/cli/oauth/oauth-client-import.js.map +1 -1
  16. package/esm/cli/service/service-import.js +2 -3
  17. package/esm/cli/service/service-import.js.map +1 -1
  18. package/esm/ops/AdminFederationOps.js +29 -20
  19. package/esm/ops/AdminFederationOps.js.map +1 -1
  20. package/esm/ops/AgentOps.js +41 -34
  21. package/esm/ops/AgentOps.js.map +1 -1
  22. package/esm/ops/ApplicationOps.js +23 -17
  23. package/esm/ops/ApplicationOps.js.map +1 -1
  24. package/esm/ops/CirclesOfTrustOps.js +27 -20
  25. package/esm/ops/CirclesOfTrustOps.js.map +1 -1
  26. package/esm/ops/EmailTemplateOps.js +19 -14
  27. package/esm/ops/EmailTemplateOps.js.map +1 -1
  28. package/esm/ops/IdmOps.js +14 -22
  29. package/esm/ops/IdmOps.js.map +1 -1
  30. package/esm/ops/IdpOps.js +27 -19
  31. package/esm/ops/IdpOps.js.map +1 -1
  32. package/esm/ops/JourneyOps.js +18 -51
  33. package/esm/ops/JourneyOps.js.map +1 -1
  34. package/esm/ops/OAuth2ClientOps.js +23 -17
  35. package/esm/ops/OAuth2ClientOps.js.map +1 -1
  36. package/esm/ops/PolicyOps.js +27 -20
  37. package/esm/ops/PolicyOps.js.map +1 -1
  38. package/esm/ops/PolicySetOps.js +23 -17
  39. package/esm/ops/PolicySetOps.js.map +1 -1
  40. package/esm/ops/ResourceTypeOps.js +27 -20
  41. package/esm/ops/ResourceTypeOps.js.map +1 -1
  42. package/esm/ops/Saml2Ops.js +22 -14
  43. package/esm/ops/Saml2Ops.js.map +1 -1
  44. package/esm/ops/ScriptOps.js +22 -15
  45. package/esm/ops/ScriptOps.js.map +1 -1
  46. package/esm/ops/ServiceOps.js +21 -16
  47. package/esm/ops/ServiceOps.js.map +1 -1
  48. package/esm/ops/ThemeOps.js +21 -15
  49. package/esm/ops/ThemeOps.js.map +1 -1
  50. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.0.0-22] - 2023-10-12
11
+
10
12
  ## [2.0.0-21] - 2023-10-11
11
13
 
12
14
  ## [2.0.0-20] - 2023-10-11
@@ -1357,7 +1359,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1357
1359
  - Fixed problem with adding connection profiles
1358
1360
  - Miscellaneous bug fixes
1359
1361
 
1360
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-21...HEAD
1362
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-22...HEAD
1363
+
1364
+ [2.0.0-22]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-21...v2.0.0-22
1361
1365
 
1362
1366
  [2.0.0-21]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-20...v2.0.0-21
1363
1367
 
@@ -18,12 +18,13 @@ forgeops: A ForgeOps CDK or CDM deployment. \n\
18
18
  The detected or provided deployment type controls certain behavior like obtaining an Identity \
19
19
  Management admin token or not and whether to export/import referenced email templates or how \
20
20
  to walk through the tenant admin login flow of Identity Cloud and handle MFA').choices(globalConfig.DEPLOYMENT_TYPES);
21
+ const directoryOption = new Option('-D, --directory <directory>', 'Set the working directory.').default(undefined, 'undefined');
21
22
  const insecureOption = new Option('-k, --insecure', '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.').default(false, "Don't allow insecure connections");
22
23
  const verboseOption = new Option('--verbose', 'Verbose output during command execution. If specified, may or may not produce additional output.');
23
24
  const debugOption = new Option('--debug', 'Debug output during command execution. If specified, may or may not produce additional output helpful for troubleshooting.');
24
25
  const curlirizeOption = new Option('--curlirize', 'Output all network calls in curl format.');
25
26
  const defaultArgs = [hostArgument, realmArgument, usernameArgument, passwordArgument];
26
- const defaultOpts = [serviceAccountIdOption, serviceAccountJwkFileOption, deploymentOption, insecureOption, verboseOption, debugOption, curlirizeOption];
27
+ const defaultOpts = [serviceAccountIdOption, serviceAccountJwkFileOption, deploymentOption, directoryOption, insecureOption, verboseOption, debugOption, curlirizeOption];
27
28
  const stateMap = {
28
29
  [hostArgument.name()]: host => state.setHost(host),
29
30
  [realmArgument.name()]: realm => state.setRealm(realm),
@@ -40,6 +41,7 @@ const stateMap = {
40
41
  }
41
42
  },
42
43
  [deploymentOption.attributeName()]: type => state.setDeploymentType(type),
44
+ [directoryOption.attributeName()]: directory => state.setDirectory(directory),
43
45
  [insecureOption.attributeName()]: insecure => state.setAllowInsecureConnection(insecure),
44
46
  [verboseOption.attributeName()]: verbose => state.setVerbose(verbose),
45
47
  [debugOption.attributeName()]: debug => state.setDebug(debug),
@@ -1 +1 @@
1
- {"version":3,"file":"FrodoCommand.js","names":["state","Argument","Command","Option","fs","globalConfig","createProgressIndicator","curlirizeMessage","debugMessage","printMessage","stopProgressIndicator","updateProgressIndicator","verboseMessage","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","host","setHost","realm","setRealm","username","setUsername","password","setPassword","attributeName","saId","setServiceAccountId","file","data","readFileSync","jwk","JSON","parse","toString","setServiceAccountJwk","error","message","type","setDeploymentType","insecure","setAllowInsecureConnection","verbose","setVerbose","debug","setDebug","curlirize","setCurlirize","FrodoStubCommand","constructor","listenerCount","on","_error$config","_error$config2","_error$response","config","method","url","response","stack","exitCode","helpOption","showHelpAfterError","configureHelp","sortSubcommands","sortOptions","setPrintHandler","setVerboseHandler","setDebugHandler","setCurlirizeHandler","setCreateProgressHandler","setUpdateProgressHandler","setStopProgressHandler","FrodoCommand","omits","arg","includes","addArgument","opt","addOption","addHelpText","startsWith","handleDefaultArgsAndOpts","args","command","pop","options","i","v","entries","_args","length","Object","keys","handler","k"],"sources":["../../src/cli/FrodoCommand.ts"],"sourcesContent":["import { state } from '@rockcarver/frodo-lib';\nimport { Argument, Command, Option } from 'commander';\nimport fs from 'fs';\n\nimport * as globalConfig from '../storage/StaticStorage';\nimport {\n createProgressIndicator,\n curlirizeMessage,\n debugMessage,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n verboseMessage,\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 JSON 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()]: (host: string) => state.setHost(host),\n [realmArgument.name()]: (realm: string) => state.setRealm(realm),\n [usernameArgument.name()]: (username: string) => state.setUsername(username),\n [passwordArgument.name()]: (password: string) => state.setPassword(password),\n [serviceAccountIdOption.attributeName()]: (saId: string) =>\n state.setServiceAccountId(saId),\n [serviceAccountJwkFileOption.attributeName()]: (file: string) => {\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()]: (type: string) =>\n state.setDeploymentType(type),\n [insecureOption.attributeName()]: (insecure: boolean) =>\n state.setAllowInsecureConnection(insecure),\n [verboseOption.attributeName()]: (verbose: boolean) =>\n state.setVerbose(verbose),\n [debugOption.attributeName()]: (debug: boolean) => state.setDebug(debug),\n [curlirizeOption.attributeName()]: (curlirize: boolean) =>\n state.setCurlirize(curlirize),\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 if (!process.listenerCount('unhandledRejection')) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n process.on('unhandledRejection', (error: any) => {\n printMessage(\n `${error.config?.method ? error.config.method + ' ' : ''}${\n error.config?.url ? error.config.url : ''\n }`,\n 'error'\n );\n printMessage(error.response?.data, 'error');\n printMessage(error.stack, 'error');\n printMessage(\n `Please report this unhandled error here: https://github.com/rockcarver/frodo-cli/issues`,\n 'error'\n );\n process.exitCode = 1;\n });\n }\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 // additional help\n this.addHelpText(\n 'after',\n `\\nEvironment Variables:\\n` +\n ` FRODO_HOST: Access Management base URL. Overrides 'host' argument.\\n` +\n ` FRODO_REALM: Realm. Overrides 'realm' argument.\\n` +\n ` FRODO_USERNAME: Username. Overrides 'username' argument.\\n` +\n ` FRODO_PASSWORD: Password. Overrides 'password' argument.\\n` +\n ` FRODO_SA_ID: Service account uuid. Overrides '--sa-id' option.\\n` +\n ` FRODO_SA_JWK: Service account JWK. Overrides '--sa-jwk-file' option but takes the actual JWK as a value, not a file name.\\n` +\n ('frodo conn save' === this.name()\n ? ` FRODO_LOG_KEY: Log API key. Overrides '--log-api-key' option.\\n` +\n ` FRODO_LOG_SECRET: Log API secret. Overrides '--log-api-secret' option.\\n`\n : ``) +\n (this.name().startsWith('frodo log')\n ? ` FRODO_LOG_KEY: Log API key. Overrides 'username' argument.\\n` +\n ` FRODO_LOG_SECRET: Log API secret. Overrides 'password' argument.\\n`\n : ``) +\n ` FRODO_CONNECTION_PROFILES_PATH: Use this connection profiles file instead of '~/.frodo/Connections.json'.\\n` +\n ` FRODO_AUTHENTICATION_SERVICE: Name of a login journey to use.\\n` +\n ` FRODO_DEBUG: Set to any value to enable debug output. Same as '--debug'.\\n` +\n ` FRODO_MASTER_KEY_PATH: Use this master key file instead of '~/.frodo/masterkey.key' file.\\n` +\n ` FRODO_MASTER_KEY: Use this master key instead of '~/.frodo/masterkey.key' file. Takes precedence over FRODO_MASTER_KEY_PATH.\\n`\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 if (!command._args[i]) {\n printMessage(\n `${command.args.length} arguments supplied but command only supports ${command._args.length}.`,\n 'warn'\n );\n break;\n }\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,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,QAAQ,EAAEC,OAAO,EAAEC,MAAM,QAAQ,WAAW;AACrD,OAAOC,EAAE,MAAM,IAAI;AAEnB,OAAO,KAAKC,YAAY,MAAM,0BAA0B;AACxD,SACEC,uBAAuB,EACvBC,gBAAgB,EAChBC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,EACvBC,cAAc,QACT,qBAAqB;AAE5B,MAAMC,YAAY,GAAG,IAAIZ,QAAQ,CAC/B,QAAQ,EACR,iIACF,CAAC;AAED,MAAMa,aAAa,GAAG,IAAIb,QAAQ,CAChC,SAAS,EACT,yFACF,CAAC,CAACc,OAAO;AACP;AACAC,OAAO,CAACC,GAAG,CAACC,WAAW,IAAIb,YAAY,CAACc,iBAAiB,EACzD,oDACF,CAAC;AAED,MAAMC,gBAAgB,GAAG,IAAInB,QAAQ,CACnC,YAAY,EACZ,gHACF,CAAC;AAED,M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AAO,CAACN,CAAC,CAAC;MACZ,CAAC,MAAM;QACLlG,YAAY,CACT,uEAAsEyG,CAAE,IAC3E,CAAC;MACH;IACF;EACF;AACF"}
1
+ {"version":3,"file":"FrodoCommand.js","names":["state","Argument","Command","Option","fs","globalConfig","createProgressIndicator","curlirizeMessage","debugMessage","printMessage","stopProgressIndicator","updateProgressIndicator","verboseMessage","hostArgument","realmArgument","default","process","env","FRODO_REALM","DEFAULT_REALM_KEY","usernameArgument","passwordArgument","serviceAccountIdOption","serviceAccountJwkFileOption","deploymentOption","choices","DEPLOYMENT_TYPES","directoryOption","undefined","insecureOption","verboseOption","debugOption","curlirizeOption","defaultArgs","defaultOpts","stateMap","name","host","setHost","realm","setRealm","username","setUsername","password","setPassword","attributeName","saId","setServiceAccountId","file","data","readFileSync","jwk","JSON","parse","toString","setServiceAccountJwk","error","message","type","setDeploymentType","directory","setDirectory","insecure","setAllowInsecureConnection","verbose","setVerbose","debug","setDebug","curlirize","setCurlirize","FrodoStubCommand","constructor","listenerCount","on","_error$config","_error$config2","_error$response","config","method","url","response","stack","exitCode","helpOption","showHelpAfterError","configureHelp","sortSubcommands","sortOptions","setPrintHandler","setVerboseHandler","setDebugHandler","setCurlirizeHandler","setCreateProgressHandler","setUpdateProgressHandler","setStopProgressHandler","FrodoCommand","omits","arg","includes","addArgument","opt","addOption","addHelpText","startsWith","handleDefaultArgsAndOpts","args","command","pop","options","i","v","entries","_args","length","Object","keys","handler","k"],"sources":["../../src/cli/FrodoCommand.ts"],"sourcesContent":["import { state } from '@rockcarver/frodo-lib';\nimport { Argument, Command, Option } from 'commander';\nimport fs from 'fs';\n\nimport * as globalConfig from '../storage/StaticStorage';\nimport {\n createProgressIndicator,\n curlirizeMessage,\n debugMessage,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n verboseMessage,\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 JSON 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 directoryOption = new Option(\n '-D, --directory <directory>',\n 'Set the working directory.'\n).default(undefined, 'undefined');\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 directoryOption,\n insecureOption,\n verboseOption,\n debugOption,\n curlirizeOption,\n];\n\nconst stateMap = {\n [hostArgument.name()]: (host: string) => state.setHost(host),\n [realmArgument.name()]: (realm: string) => state.setRealm(realm),\n [usernameArgument.name()]: (username: string) => state.setUsername(username),\n [passwordArgument.name()]: (password: string) => state.setPassword(password),\n [serviceAccountIdOption.attributeName()]: (saId: string) =>\n state.setServiceAccountId(saId),\n [serviceAccountJwkFileOption.attributeName()]: (file: string) => {\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()]: (type: string) =>\n state.setDeploymentType(type),\n [directoryOption.attributeName()]: (directory: string) =>\n state.setDirectory(directory),\n [insecureOption.attributeName()]: (insecure: boolean) =>\n state.setAllowInsecureConnection(insecure),\n [verboseOption.attributeName()]: (verbose: boolean) =>\n state.setVerbose(verbose),\n [debugOption.attributeName()]: (debug: boolean) => state.setDebug(debug),\n [curlirizeOption.attributeName()]: (curlirize: boolean) =>\n state.setCurlirize(curlirize),\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 if (!process.listenerCount('unhandledRejection')) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n process.on('unhandledRejection', (error: any) => {\n printMessage(\n `${error.config?.method ? error.config.method + ' ' : ''}${\n error.config?.url ? error.config.url : ''\n }`,\n 'error'\n );\n printMessage(error.response?.data, 'error');\n printMessage(error.stack, 'error');\n printMessage(\n `Please report this unhandled error here: https://github.com/rockcarver/frodo-cli/issues`,\n 'error'\n );\n process.exitCode = 1;\n });\n }\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 // additional help\n this.addHelpText(\n 'after',\n `\\nEvironment Variables:\\n` +\n ` FRODO_HOST: Access Management base URL. Overrides 'host' argument.\\n` +\n ` FRODO_REALM: Realm. Overrides 'realm' argument.\\n` +\n ` FRODO_USERNAME: Username. Overrides 'username' argument.\\n` +\n ` FRODO_PASSWORD: Password. Overrides 'password' argument.\\n` +\n ` FRODO_SA_ID: Service account uuid. Overrides '--sa-id' option.\\n` +\n ` FRODO_SA_JWK: Service account JWK. Overrides '--sa-jwk-file' option but takes the actual JWK as a value, not a file name.\\n` +\n ('frodo conn save' === this.name()\n ? ` FRODO_LOG_KEY: Log API key. Overrides '--log-api-key' option.\\n` +\n ` FRODO_LOG_SECRET: Log API secret. Overrides '--log-api-secret' option.\\n`\n : ``) +\n (this.name().startsWith('frodo log')\n ? ` FRODO_LOG_KEY: Log API key. Overrides 'username' argument.\\n` +\n ` FRODO_LOG_SECRET: Log API secret. Overrides 'password' argument.\\n`\n : ``) +\n ` FRODO_CONNECTION_PROFILES_PATH: Use this connection profiles file instead of '~/.frodo/Connections.json'.\\n` +\n ` FRODO_AUTHENTICATION_SERVICE: Name of a login journey to use.\\n` +\n ` FRODO_DEBUG: Set to any value to enable debug output. Same as '--debug'.\\n` +\n ` FRODO_MASTER_KEY_PATH: Use this master key file instead of '~/.frodo/masterkey.key' file.\\n` +\n ` FRODO_MASTER_KEY: Use this master key instead of '~/.frodo/masterkey.key' file. Takes precedence over FRODO_MASTER_KEY_PATH.\\n`\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 if (!command._args[i]) {\n printMessage(\n `${command.args.length} arguments supplied but command only supports ${command._args.length}.`,\n 'warn'\n );\n break;\n }\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,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,QAAQ,EAAEC,OAAO,EAAEC,MAAM,QAAQ,WAAW;AACrD,OAAOC,EAAE,MAAM,IAAI;AAEnB,OAAO,KAAKC,YA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,CAACM,KAAK,CAACH,CAAC,CAAC,CAACzE,IAAI,CAAC,CAAC;MACnC;MACA,IAAI8E,MAAM,CAACC,IAAI,CAAChF,QAAQ,CAAC,CAAC+D,QAAQ,CAACD,GAAG,CAAC,EAAE;QACvCzF,YAAY,CACT,qEAAoEyF,GAAI,IAC3E,CAAC;QACD;QACA,MAAMmB,OAAY,GAAGjF,QAAQ,CAAC8D,GAAG,CAAC;QAClCmB,OAAO,CAACN,CAAC,CAAC;MACZ,CAAC,MAAM;QACLtG,YAAY,CACT,yEAAwEyF,GAAI,IAC/E,CAAC;MACH;IACF;;IAEA;IACA,KAAK,MAAM,CAACoB,CAAC,EAAEP,CAAC,CAAC,IAAII,MAAM,CAACH,OAAO,CAACH,OAAO,CAAC,EAAE;MAC5C;MACA,IAAIM,MAAM,CAACC,IAAI,CAAChF,QAAQ,CAAC,CAAC+D,QAAQ,CAACmB,CAAC,CAAC,EAAE;QACrC7G,YAAY,CACT,mEAAkE6G,CAAE,IACvE,CAAC;QACD;QACA,MAAMD,OAAY,GAAGjF,QAAQ,CAACkF,CAAC,CAAC;QAChCD,OAAO,CAACN,CAAC,CAAC;MACZ,CAAC,MAAM;QACLtG,YAAY,CACT,uEAAsE6G,CAAE,IAC3E,CAAC;MACH;IACF;EACF;AACF"}
@@ -1,5 +1,5 @@
1
- import { FrodoCommand } from '../FrodoCommand';
2
- const program = new FrodoCommand('frodo agent web');
1
+ import { FrodoStubCommand } from '../FrodoCommand';
2
+ const program = new FrodoStubCommand('frodo agent web');
3
3
  program.description('Manage web agents.');
4
4
  program.command('list', 'List web agents.');
5
5
  program.command('describe', 'Describe web agents.');
@@ -1 +1 @@
1
- {"version":3,"file":"agent-web.js","names":["FrodoCommand","program","description","command","parse"],"sources":["../../../src/cli/agent/agent-web.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\n\nconst program = new FrodoCommand('frodo agent web');\n\nprogram.description('Manage web agents.');\n\nprogram.command('list', 'List web agents.');\n\nprogram.command('describe', 'Describe web agents.');\n\nprogram.command('export', 'Export web agents.');\n\nprogram.command('import', 'Import web agents.');\n\nprogram.command('delete', 'Delete web agents.');\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAE9C,MAAMC,OAAO,GAAG,IAAID,YAAY,CAAC,iBAAiB,CAAC;AAEnDC,OAAO,CAACC,WAAW,CAAC,oBAAoB,CAAC;AAEzCD,OAAO,CAACE,OAAO,CAAC,MAAM,EAAE,kBAAkB,CAAC;AAE3CF,OAAO,CAACE,OAAO,CAAC,UAAU,EAAE,sBAAsB,CAAC;AAEnDF,OAAO,CAACE,OAAO,CAAC,QAAQ,EAAE,oBAAoB,CAAC;AAE/CF,OAAO,CAACE,OAAO,CAAC,QAAQ,EAAE,oBAAoB,CAAC;AAE/CF,OAAO,CAACE,OAAO,CAAC,QAAQ,EAAE,oBAAoB,CAAC;AAE/CF,OAAO,CAACG,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"agent-web.js","names":["FrodoStubCommand","program","description","command","parse"],"sources":["../../../src/cli/agent/agent-web.ts"],"sourcesContent":["import { FrodoStubCommand } from '../FrodoCommand';\n\nconst program = new FrodoStubCommand('frodo agent web');\n\nprogram.description('Manage web agents.');\n\nprogram.command('list', 'List web agents.');\n\nprogram.command('describe', 'Describe web agents.');\n\nprogram.command('export', 'Export web agents.');\n\nprogram.command('import', 'Import web agents.');\n\nprogram.command('delete', 'Delete web agents.');\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,iBAAiB;AAElD,MAAMC,OAAO,GAAG,IAAID,gBAAgB,CAAC,iBAAiB,CAAC;AAEvDC,OAAO,CAACC,WAAW,CAAC,oBAAoB,CAAC;AAEzCD,OAAO,CAACE,OAAO,CAAC,MAAM,EAAE,kBAAkB,CAAC;AAE3CF,OAAO,CAACE,OAAO,CAAC,UAAU,EAAE,sBAAsB,CAAC;AAEnDF,OAAO,CAACE,OAAO,CAAC,QAAQ,EAAE,oBAAoB,CAAC;AAE/CF,OAAO,CAACE,OAAO,CAAC,QAAQ,EAAE,oBAAoB,CAAC;AAE/CF,OAAO,CAACE,OAAO,CAAC,QAAQ,EAAE,oBAAoB,CAAC;AAE/CF,OAAO,CAACG,KAAK,CAAC,CAAC"}
@@ -13,7 +13,7 @@ program.description('Import applications.').addOption(new Option('-i, --app-id <
13
13
  async (host, realm, user, password, options, command) => {
14
14
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
15
15
  // import by id
16
- if (options.file && options.idpId && (await getTokens())) {
16
+ if (options.file && options.appId && (await getTokens())) {
17
17
  verboseMessage(`Importing application "${options.appId}"...`);
18
18
  const status = await importApplicationFromFile(options.appId, options.file, {
19
19
  deps: options.deps
@@ -1 +1 @@
1
- {"version":3,"file":"app-import.js","names":["frodo","Option","s","importApplicationFromFile","importApplicationsFromFile","importApplicationsFromFiles","importFirstApplicationFromFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","addHelpText","connId","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","file","idpId","appId","status","deps","process","exitCode","all","allSeparate","help","parse"],"sources":["../../../src/cli/app/app-import.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport * as s from '../../help/SampleData';\nimport {\n importApplicationFromFile,\n importApplicationsFromFile,\n importApplicationsFromFiles,\n importFirstApplicationFromFile,\n} from '../../ops/ApplicationOps';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo app import');\n\nprogram\n .description('Import applications.')\n .addOption(\n new Option(\n '-i, --app-id <id>',\n 'Application name. If specified, only one application is imported and the options -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Import all applications from single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all applications from separate files (*.app.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option('--no-deps', 'Do not include any dependencies (scripts).')\n )\n .addHelpText(\n 'after',\n `Important Note:\\n`['brightYellow'] +\n ` The ${\n 'frodo app'['brightCyan']\n } command to manage OAuth2 clients in v1.x has been renamed to ${\n 'frodo oauth client'['brightCyan']\n } in v2.x\\n` +\n ` The ${\n 'frodo app'['brightCyan']\n } command in v2.x manages the new applications created using the new application templates in ForgeRock Identity Cloud. To manage oauth clients, use the ${\n 'frodo oauth client'['brightCyan']\n } command.\\n\\n` +\n `Usage Examples:\\n` +\n ` Import all applications from a single export file using a connection profile:\\n` +\n ` $ frodo app import -a -f ./allAlphaApplications.application.json ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Import the first application from a single export file:\\n` +\n ` $ frodo app import -f ./allAlphaApplications.application.json ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Import all applications from separate export files:\\n` +\n ` $ frodo app import -A ${s.connId}\\n`['brightCyan'] +\n ` Import all applications without dependencies from a single export file:\\n` +\n ` $ frodo app import --no-deps -a -f ./allAlphaApplications.application.json ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Import only the application 'myApp' from a file with an export file containing multiple applications:\\n` +\n ` $ frodo app import -i myApp -f ./allAlphaApplications.application.json ${s.connId}\\n`[\n 'brightCyan'\n ]\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // import by id\n if (options.file && options.idpId && (await getTokens())) {\n verboseMessage(`Importing application \"${options.appId}\"...`);\n const status = await importApplicationFromFile(\n options.appId,\n options.file,\n {\n deps: options.deps,\n }\n );\n if (!status) process.exitCode = 1;\n }\n // --all -a\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage(\n `Importing all applications from a single file (${options.file})...`\n );\n const status = await importApplicationsFromFile(options.file, {\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // --all-separate -A\n else if (options.allSeparate && !options.file && (await getTokens())) {\n verboseMessage(\n 'Importing all applications from separate files in current directory...'\n );\n const status = await importApplicationsFromFiles({\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // import first provider from file\n else if (options.file && (await getTokens())) {\n verboseMessage(\n `Importing first application from file \"${options.file}\"...`\n );\n const status = await importFirstApplicationFromFile(options.file, {\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n printMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,OAAO,KAAKC,CAAC,MAAM,uBAAuB;AAC1C,SACEC,yBAAyB,EACzBC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,8BAA8B,QACzB,0BAA0B;AACjC,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGV,KAAK,CAACW,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,kBAAkB,CAAC;AAEpDG,OAAO,CACJC,WAAW,CAAC,sBAAsB,CAAC,CACnCC,SAAS,CACR,IAAIb,MAAM,CACR,mBAAmB,EACnB,yGACF,CACF,CAAC,CACAa,SAAS,CAAC,IAAIb,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAAC,CACzEa,SAAS,CACR,IAAIb,MAAM,CACR,WAAW,EACX,4DACF,CACF,CAAC,CACAa,SAAS,CACR,IAAIb,MAAM,CACR,oBAAoB,EACpB,2GACF,CACF,CAAC,CACAa,SAAS,CACR,IAAIb,MAAM,CAAC,WAAW,EAAE,4CAA4C,CACtE,CAAC,CACAc,WAAW,CACV,OAAO,EACN,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AS,CAAC,CAAC,CAAC,EAAE;IAC3DF,cAAc,CACX,kDAAiDc,OAAO,CAACG,IAAK,MACjE,CAAC;IACD,MAAMG,MAAM,GAAG,MAAMxB,0BAA0B,CAACkB,OAAO,CAACG,IAAI,EAAE;MAC5DI,IAAI,EAAEP,OAAO,CAACO;IAChB,CAAC,CAAC;IACF,IAAI,CAACD,MAAM,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK,IAAIT,OAAO,CAACW,WAAW,IAAI,CAACX,OAAO,CAACG,IAAI,KAAK,MAAMf,SAAS,CAAC,CAAC,CAAC,EAAE;IACpEF,cAAc,CACZ,wEACF,CAAC;IACD,MAAMoB,MAAM,GAAG,MAAMvB,2BAA2B,CAAC;MAC/CwB,IAAI,EAAEP,OAAO,CAACO;IAChB,CAAC,CAAC;IACF,IAAI,CAACD,MAAM,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK,IAAIT,OAAO,CAACG,IAAI,KAAK,MAAMf,SAAS,CAAC,CAAC,CAAC,EAAE;IAC5CF,cAAc,CACX,0CAAyCc,OAAO,CAACG,IAAK,MACzD,CAAC;IACD,MAAMG,MAAM,GAAG,MAAMtB,8BAA8B,CAACgB,OAAO,CAACG,IAAI,EAAE;MAChEI,IAAI,EAAEP,OAAO,CAACO;IAChB,CAAC,CAAC;IACF,IAAI,CAACD,MAAM,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK;IACHxB,YAAY,CAAC,sDAAsD,CAAC;IACpEK,OAAO,CAACsB,IAAI,CAAC,CAAC;IACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHnB,OAAO,CAACuB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"app-import.js","names":["frodo","Option","s","importApplicationFromFile","importApplicationsFromFile","importApplicationsFromFiles","importFirstApplicationFromFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","addHelpText","connId","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","file","appId","status","deps","process","exitCode","all","allSeparate","help","parse"],"sources":["../../../src/cli/app/app-import.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport * as s from '../../help/SampleData';\nimport {\n importApplicationFromFile,\n importApplicationsFromFile,\n importApplicationsFromFiles,\n importFirstApplicationFromFile,\n} from '../../ops/ApplicationOps';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo app import');\n\nprogram\n .description('Import applications.')\n .addOption(\n new Option(\n '-i, --app-id <id>',\n 'Application name. If specified, only one application is imported and the options -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Import all applications from single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all applications from separate files (*.app.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option('--no-deps', 'Do not include any dependencies (scripts).')\n )\n .addHelpText(\n 'after',\n `Important Note:\\n`['brightYellow'] +\n ` The ${\n 'frodo app'['brightCyan']\n } command to manage OAuth2 clients in v1.x has been renamed to ${\n 'frodo oauth client'['brightCyan']\n } in v2.x\\n` +\n ` The ${\n 'frodo app'['brightCyan']\n } command in v2.x manages the new applications created using the new application templates in ForgeRock Identity Cloud. To manage oauth clients, use the ${\n 'frodo oauth client'['brightCyan']\n } command.\\n\\n` +\n `Usage Examples:\\n` +\n ` Import all applications from a single export file using a connection profile:\\n` +\n ` $ frodo app import -a -f ./allAlphaApplications.application.json ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Import the first application from a single export file:\\n` +\n ` $ frodo app import -f ./allAlphaApplications.application.json ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Import all applications from separate export files:\\n` +\n ` $ frodo app import -A ${s.connId}\\n`['brightCyan'] +\n ` Import all applications without dependencies from a single export file:\\n` +\n ` $ frodo app import --no-deps -a -f ./allAlphaApplications.application.json ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Import only the application 'myApp' from a file with an export file containing multiple applications:\\n` +\n ` $ frodo app import -i myApp -f ./allAlphaApplications.application.json ${s.connId}\\n`[\n 'brightCyan'\n ]\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // import by id\n if (options.file && options.appId && (await getTokens())) {\n verboseMessage(`Importing application \"${options.appId}\"...`);\n const status = await importApplicationFromFile(\n options.appId,\n options.file,\n {\n deps: options.deps,\n }\n );\n if (!status) process.exitCode = 1;\n }\n // --all -a\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage(\n `Importing all applications from a single file (${options.file})...`\n );\n const status = await importApplicationsFromFile(options.file, {\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // --all-separate -A\n else if (options.allSeparate && !options.file && (await getTokens())) {\n verboseMessage(\n 'Importing all applications from separate files in current directory...'\n );\n const status = await importApplicationsFromFiles({\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // import first provider from file\n else if (options.file && (await getTokens())) {\n verboseMessage(\n `Importing first application from file \"${options.file}\"...`\n );\n const status = await importFirstApplicationFromFile(options.file, {\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n printMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,OAAO,KAAKC,CAAC,MAAM,uBAAuB;AAC1C,SACEC,yBAAyB,EACzBC,0BAA0B,EAC1BC,2BAA2B,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C;EACA;EAAA,KACK,IAAIR,OAAO,CAACG,IAAI,KAAK,MAAMf,SAAS,CAAC,CAAC,CAAC,EAAE;IAC5CF,cAAc,CACX,0CAAyCc,OAAO,CAACG,IAAK,MACzD,CAAC;IACD,MAAME,MAAM,GAAG,MAAMrB,8BAA8B,CAACgB,OAAO,CAACG,IAAI,EAAE;MAChEG,IAAI,EAAEN,OAAO,CAACM;IAChB,CAAC,CAAC;IACF,IAAI,CAACD,MAAM,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK;IACHvB,YAAY,CAAC,sDAAsD,CAAC;IACpEK,OAAO,CAACqB,IAAI,CAAC,CAAC;IACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHlB,OAAO,CAACsB,KAAK,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { frodo } from '@rockcarver/frodo-lib';
1
+ import { frodo, state } from '@rockcarver/frodo-lib';
2
2
  import { Option } from 'commander';
3
3
  import { exportAllConfigEntities, exportAllRawConfigEntities, exportConfigEntity, warnAboutOfflineConnectorServers } from '../../ops/IdmOps';
4
4
  import { printMessage, verboseMessage } from '../../utils/Console';
@@ -7,7 +7,7 @@ const {
7
7
  getTokens
8
8
  } = frodo.login;
9
9
  const program = new FrodoCommand('frodo idm export');
10
- program.description('Export IDM configuration objects.').addOption(new Option('-N, --name <name>', 'Config entity name. E.g. "managed", "sync", "provisioner-<connector-name>", etc.')).addOption(new Option('-f, --file [file]', 'Export file. Ignored with -A.')).addOption(new Option('-E, --entities-file [entities-file]', 'Name of the entity file. Ignored with -A.')).addOption(new Option('-e, --env-file [envfile]', 'Name of the env file. Ignored with -A.')).addOption(new Option('-a, --all', 'Export all IDM configuration objects into a single file in directory -D. Ignored with -N.')).addOption(new Option('-A, --all-separate', 'Export all IDM configuration objects into separate JSON files in directory -D. Ignored with -N, and -a.')).addOption(new Option('-D, --directory <directory>', 'Export directory. Required with and ignored without -a/-A.')).action(
10
+ program.description('Export IDM configuration objects.').addOption(new Option('-N, --name <name>', 'Config entity name. E.g. "managed", "sync", "provisioner-<connector-name>", etc.')).addOption(new Option('-f, --file [file]', 'Export file. Ignored with -A.')).addOption(new Option('-E, --entities-file [entities-file]', 'Name of the entity file. Ignored with -A.')).addOption(new Option('-e, --env-file [envfile]', 'Name of the env file. Ignored with -A.')).addOption(new Option('-a, --all', 'Export all IDM configuration objects into a single file in directory -D. Ignored with -N.')).addOption(new Option('-A, --all-separate', 'Export all IDM configuration objects into separate JSON files in directory -D. Ignored with -N, and -a.')).action(
11
11
  // implement command logic inside action handler
12
12
  async (host, realm, user, password, options, command) => {
13
13
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
@@ -16,16 +16,22 @@ async (host, realm, user, password, options, command) => {
16
16
  verboseMessage(`Exporting object "${options.name}"...`);
17
17
  exportConfigEntity(options.name, options.file);
18
18
  }
19
+ // require --directory -D for all-separate functions
20
+ else if (options.allSeparate && !state.getDirectory()) {
21
+ printMessage('-D or --directory required when using -A or --all-separate', 'error');
22
+ program.help();
23
+ process.exitCode = 1;
24
+ }
19
25
  // --all-separate -A
20
- else if (options.allSeparate && options.directory && options.entitiesFile && options.envFile && (await getTokens())) {
21
- verboseMessage(`Exporting IDM configuration objects specified in ${options.entitiesFile} into separate files in ${options.directory} using ${options.envFile} for variable replacement...`);
22
- exportAllConfigEntities(options.directory, options.entitiesFile, options.envFile);
26
+ else if (options.allSeparate && options.entitiesFile && options.envFile && (await getTokens())) {
27
+ verboseMessage(`Exporting IDM configuration objects specified in ${options.entitiesFile} into separate files in ${state.getDirectory()} using ${options.envFile} for variable replacement...`);
28
+ exportAllConfigEntities(options.entitiesFile, options.envFile);
23
29
  warnAboutOfflineConnectorServers();
24
30
  }
25
31
  // --all-separate -A without variable replacement
26
- else if (options.allSeparate && options.directory && (await getTokens())) {
27
- verboseMessage(`Exporting all IDM configuration objects into separate files in ${options.directory}...`);
28
- exportAllRawConfigEntities(options.directory);
32
+ else if (options.allSeparate && (await getTokens())) {
33
+ verboseMessage(`Exporting all IDM configuration objects into separate files in ${state.getDirectory()}...`);
34
+ exportAllRawConfigEntities();
29
35
  warnAboutOfflineConnectorServers();
30
36
  }
31
37
  // unrecognized combination of options or no options
@@ -1 +1 @@
1
- {"version":3,"file":"idm-export.js","names":["frodo","Option","exportAllConfigEntities","exportAllRawConfigEntities","exportConfigEntity","warnAboutOfflineConnectorServers","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","name","file","allSeparate","directory","entitiesFile","envFile","help","process","exitCode","parse"],"sources":["../../../src/cli/idm/idm-export.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportAllConfigEntities,\n exportAllRawConfigEntities,\n exportConfigEntity,\n warnAboutOfflineConnectorServers,\n} from '../../ops/IdmOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo idm export');\n\nprogram\n .description('Export IDM configuration objects.')\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, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export by id/name\n if (options.name && (await getTokens())) {\n verboseMessage(`Exporting object \"${options.name}\"...`);\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 (await getTokens())\n ) {\n verboseMessage(\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 warnAboutOfflineConnectorServers();\n }\n // --all-separate -A without variable replacement\n else if (\n options.allSeparate &&\n options.directory &&\n (await getTokens())\n ) {\n verboseMessage(\n `Exporting all IDM configuration objects into separate files in ${options.directory}...`\n );\n exportAllRawConfigEntities(options.directory);\n warnAboutOfflineConnectorServers();\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,uBAAuB,EACvBC,0BAA0B,EAC1BC,kBAAkB,EAClBC,gCAAgC,QAC3B,kBAAkB;AACzB,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGT,KAAK,CAACU,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,kBAAkB,CAAC;AAEpDG,OAAO,CACJC,WAAW,CAAC,mCAAmC,CAAC,CAChDC,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,kFACF,CACF,CAAC,CACAY,SAAS,CAAC,IAAIZ,MAAM,CAAC,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OAAO,CAACK,WAAW,IACnBL,OAAO,CAACM,SAAS,KAChB,MAAMhB,SAAS,CAAC,CAAC,CAAC,EACnB;IACAF,cAAc,CACX,kEAAiEY,OAAO,CAACM,SAAU,KACtF,CAAC;IACDtB,0BAA0B,CAACgB,OAAO,CAACM,SAAS,CAAC;IAC7CpB,gCAAgC,CAAC,CAAC;EACpC;EACA;EAAA,KACK;IACHC,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDK,OAAO,CAACiB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHnB,OAAO,CAACoB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"idm-export.js","names":["frodo","state","Option","exportAllConfigEntities","exportAllRawConfigEntities","exportConfigEntity","warnAboutOfflineConnectorServers","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","name","file","allSeparate","getDirectory","help","process","exitCode","entitiesFile","envFile","parse"],"sources":["../../../src/cli/idm/idm-export.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportAllConfigEntities,\n exportAllRawConfigEntities,\n exportConfigEntity,\n warnAboutOfflineConnectorServers,\n} from '../../ops/IdmOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo idm export');\n\nprogram\n .description('Export IDM configuration objects.')\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 .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export by id/name\n if (options.name && (await getTokens())) {\n verboseMessage(`Exporting object \"${options.name}\"...`);\n exportConfigEntity(options.name, options.file);\n }\n // require --directory -D for all-separate functions\n else if (options.allSeparate && !state.getDirectory()) {\n printMessage(\n '-D or --directory required when using -A or --all-separate',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n // --all-separate -A\n else if (\n options.allSeparate &&\n options.entitiesFile &&\n options.envFile &&\n (await getTokens())\n ) {\n verboseMessage(\n `Exporting IDM configuration objects specified in ${\n options.entitiesFile\n } into separate files in ${state.getDirectory()} using ${\n options.envFile\n } for variable replacement...`\n );\n exportAllConfigEntities(options.entitiesFile, options.envFile);\n warnAboutOfflineConnectorServers();\n }\n // --all-separate -A without variable replacement\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage(\n `Exporting all IDM configuration objects into separate files in ${state.getDirectory()}...`\n );\n exportAllRawConfigEntities();\n warnAboutOfflineConnectorServers();\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,uBAAuB,EACvBC,0BAA0B,EAC1BC,kBAAkB,EAClBC,gCAAgC,QAC3B,kBAAkB;AACzB,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ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B;EACA;EAAA,KACK,IACHT,OAAO,CAACK,WAAW,IACnBL,OAAO,CAACU,YAAY,IACpBV,OAAO,CAACW,OAAO,KACd,MAAMrB,SAAS,CAAC,CAAC,CAAC,EACnB;IACAF,cAAc,CACX,oDACCY,OAAO,CAACU,YACT,2BAA0B7B,KAAK,CAACyB,YAAY,CAAC,CAAE,UAC9CN,OAAO,CAACW,OACT,8BACH,CAAC;IACD5B,uBAAuB,CAACiB,OAAO,CAACU,YAAY,EAAEV,OAAO,CAACW,OAAO,CAAC;IAC9DzB,gCAAgC,CAAC,CAAC;EACpC;EACA;EAAA,KACK,IAAIc,OAAO,CAACK,WAAW,KAAK,MAAMf,SAAS,CAAC,CAAC,CAAC,EAAE;IACnDF,cAAc,CACX,kEAAiEP,KAAK,CAACyB,YAAY,CAAC,CAAE,KACzF,CAAC;IACDtB,0BAA0B,CAAC,CAAC;IAC5BE,gCAAgC,CAAC,CAAC;EACpC;EACA;EAAA,KACK;IACHC,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDK,OAAO,CAACe,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHjB,OAAO,CAACoB,KAAK,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { frodo } from '@rockcarver/frodo-lib';
1
+ import { frodo, state } from '@rockcarver/frodo-lib';
2
2
  import { Option } from 'commander';
3
3
  import { importAllConfigEntities, importAllRawConfigEntities, importConfigEntityByIdFromFile, importConfigEntityFromFile } from '../../ops/IdmOps';
4
4
  import { printMessage, verboseMessage } from '../../utils/Console';
@@ -7,7 +7,7 @@ const {
7
7
  getTokens
8
8
  } = frodo.login;
9
9
  const program = new FrodoCommand('frodo idm import');
10
- program.description('Import IDM configuration objects.').addOption(new Option('-N, --name <name>', 'Config entity name. E.g. "managed", "sync", "provisioner-<connector-name>", etc.')).addOption(new Option('-f, --file [file]', 'Import file. Ignored with -A.')).addOption(new Option('-E, --entities-file [entities-file]', 'Name of the entity file. Ignored with -A.')).addOption(new Option('-e, --env-file [envfile]', 'Name of the env file. Ignored with -A.')).addOption(new Option('-A, --all-separate', 'Import all IDM configuration objects from separate files in directory -D. Ignored with -N, and -a.')).addOption(new Option('-D, --directory <directory>', 'Import directory. Required with and ignored without -a/-A.')).action(
10
+ program.description('Import IDM configuration objects.').addOption(new Option('-N, --name <name>', 'Config entity name. E.g. "managed", "sync", "provisioner-<connector-name>", etc.')).addOption(new Option('-f, --file [file]', 'Import file. Ignored with -A.')).addOption(new Option('-E, --entities-file [entities-file]', 'Name of the entity file. Ignored with -A.')).addOption(new Option('-e, --env-file [envfile]', 'Name of the env file. Ignored with -A.')).addOption(new Option('-A, --all-separate', 'Import all IDM configuration objects from separate files in directory -D. Ignored with -N, and -a.')).action(
11
11
  // implement command logic inside action handler
12
12
  async (host, realm, user, password, options, command) => {
13
13
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
@@ -21,15 +21,21 @@ async (host, realm, user, password, options, command) => {
21
21
  verboseMessage(`Importing object from file...`);
22
22
  await importConfigEntityFromFile(options.file);
23
23
  }
24
+ // require --directory -D for all-separate functions
25
+ else if (options.allSeparate && !state.getDirectory()) {
26
+ printMessage('-D or --directory required when using -A or --all-separate', 'error');
27
+ program.help();
28
+ process.exitCode = 1;
29
+ }
24
30
  // --all-separate -A
25
- else if (options.allSeparate && options.directory && options.entitiesFile && options.envFile && (await getTokens())) {
26
- verboseMessage(`Importing IDM configuration objects specified in ${options.entitiesFile} into separate files in ${options.directory} using ${options.envFile} for variable replacement...`);
27
- await importAllConfigEntities(options.directory, options.entitiesFile, options.envFile);
31
+ else if (options.allSeparate && options.entitiesFile && options.envFile && (await getTokens())) {
32
+ verboseMessage(`Importing IDM configuration objects specified in ${options.entitiesFile} into separate files in ${state.getDirectory()} using ${options.envFile} for variable replacement...`);
33
+ await importAllConfigEntities(options.entitiesFile, options.envFile);
28
34
  }
29
35
  // --all-separate -A without variable replacement
30
- else if (options.allSeparate && options.directory && (await getTokens())) {
31
- verboseMessage(`Importing all IDM configuration objects from separate files in ${options.directory}...`);
32
- await importAllRawConfigEntities(options.directory);
36
+ else if (options.allSeparate && (await getTokens())) {
37
+ verboseMessage(`Importing all IDM configuration objects from separate files in ${state.getDirectory()}...`);
38
+ await importAllRawConfigEntities();
33
39
  }
34
40
  // unrecognized combination of options or no options
35
41
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"idm-import.js","names":["frodo","Option","importAllConfigEntities","importAllRawConfigEntities","importConfigEntityByIdFromFile","importConfigEntityFromFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","name","file","allSeparate","directory","entitiesFile","envFile","help","process","exitCode","parse"],"sources":["../../../src/cli/idm/idm-import.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n importAllConfigEntities,\n importAllRawConfigEntities,\n importConfigEntityByIdFromFile,\n importConfigEntityFromFile,\n} from '../../ops/IdmOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo idm import');\n\ninterface IdmImportOptions {\n type?: string;\n insecure?: boolean;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n name?: string;\n file?: string;\n entitiesFile?: string;\n envFile?: string;\n all?: string;\n allSeparate?: string;\n directory?: string;\n}\n\nprogram\n .description('Import IDM configuration objects.')\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]', 'Import 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-separate',\n 'Import all IDM configuration objects from separate files in directory -D. Ignored with -N, and -a.'\n )\n )\n .addOption(\n new Option(\n '-D, --directory <directory>',\n 'Import directory. Required with and ignored without -a/-A.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: IdmImportOptions,\n command\n ) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // import by id/name\n if (options.name && (await getTokens())) {\n verboseMessage(`Importing object \"${options.name}\"...`);\n await importConfigEntityByIdFromFile(options.name, options.file);\n }\n // import from file\n else if (options.file && (await getTokens())) {\n verboseMessage(`Importing object from file...`);\n await importConfigEntityFromFile(options.file);\n }\n // --all-separate -A\n else if (\n options.allSeparate &&\n options.directory &&\n options.entitiesFile &&\n options.envFile &&\n (await getTokens())\n ) {\n verboseMessage(\n `Importing IDM configuration objects specified in ${options.entitiesFile} into separate files in ${options.directory} using ${options.envFile} for variable replacement...`\n );\n await importAllConfigEntities(\n options.directory,\n options.entitiesFile,\n options.envFile\n );\n }\n // --all-separate -A without variable replacement\n else if (\n options.allSeparate &&\n options.directory &&\n (await getTokens())\n ) {\n verboseMessage(\n `Importing all IDM configuration objects from separate files in ${options.directory}...`\n );\n await importAllRawConfigEntities(options.directory);\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,uBAAuB,EACvBC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,0BAA0B,QACrB,kBAAkB;AACzB,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAG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AO,CAACO,YAAY,IACpBP,OAAO,CAACQ,OAAO,KACd,MAAMlB,SAAS,CAAC,CAAC,CAAC,EACnB;IACAF,cAAc,CACX,oDAAmDY,OAAO,CAACO,YAAa,2BAA0BP,OAAO,CAACM,SAAU,UAASN,OAAO,CAACQ,OAAQ,8BAChJ,CAAC;IACD,MAAMzB,uBAAuB,CAC3BiB,OAAO,CAACM,SAAS,EACjBN,OAAO,CAACO,YAAY,EACpBP,OAAO,CAACQ,OACV,CAAC;EACH;EACA;EAAA,KACK,IACHR,OAAO,CAACK,WAAW,IACnBL,OAAO,CAACM,SAAS,KAChB,MAAMhB,SAAS,CAAC,CAAC,CAAC,EACnB;IACAF,cAAc,CACX,kEAAiEY,OAAO,CAACM,SAAU,KACtF,CAAC;IACD,MAAMtB,0BAA0B,CAACgB,OAAO,CAACM,SAAS,CAAC;EACrD;EACA;EAAA,KACK;IACHnB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDK,OAAO,CAACiB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHnB,OAAO,CAACoB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"idm-import.js","names":["frodo","state","Option","importAllConfigEntities","importAllRawConfigEntities","importConfigEntityByIdFromFile","importConfigEntityFromFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","name","file","allSeparate","getDirectory","help","process","exitCode","entitiesFile","envFile","parse"],"sources":["../../../src/cli/idm/idm-import.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n importAllConfigEntities,\n importAllRawConfigEntities,\n importConfigEntityByIdFromFile,\n importConfigEntityFromFile,\n} from '../../ops/IdmOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo idm import');\n\ninterface IdmImportOptions {\n type?: string;\n insecure?: boolean;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n name?: string;\n file?: string;\n entitiesFile?: string;\n envFile?: string;\n all?: string;\n allSeparate?: string;\n directory?: string;\n}\n\nprogram\n .description('Import IDM configuration objects.')\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]', 'Import 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-separate',\n 'Import all IDM configuration objects from separate files in directory -D. Ignored with -N, and -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: IdmImportOptions,\n command\n ) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // import by id/name\n if (options.name && (await getTokens())) {\n verboseMessage(`Importing object \"${options.name}\"...`);\n await importConfigEntityByIdFromFile(options.name, options.file);\n }\n // import from file\n else if (options.file && (await getTokens())) {\n verboseMessage(`Importing object from file...`);\n await importConfigEntityFromFile(options.file);\n }\n // require --directory -D for all-separate functions\n else if (options.allSeparate && !state.getDirectory()) {\n printMessage(\n '-D or --directory required when using -A or --all-separate',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n // --all-separate -A\n else if (\n options.allSeparate &&\n options.entitiesFile &&\n options.envFile &&\n (await getTokens())\n ) {\n verboseMessage(\n `Importing IDM configuration objects specified in ${\n options.entitiesFile\n } into separate files in ${state.getDirectory()} using ${\n options.envFile\n } for variable replacement...`\n );\n await importAllConfigEntities(options.entitiesFile, options.envFile);\n }\n // --all-separate -A without variable replacement\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage(\n `Importing all IDM configuration objects from separate files in ${state.getDirectory()}...`\n );\n await importAllRawConfigEntities();\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,uBAAuB,EACvBC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,0BAA0B,QACrB,kBAAkB;AACzB,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGV,KAAK,CAACW,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,kBAAkB,CAAC;AAiBpDG,OAAO,CACJC,WAAW,CAAC,mCAAmC,CAAC,CAChDC,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,kFACF,CACF,CAAC,CACAY,SAAS,CAAC,IAAIZ,MAAM,CAAC,mBAAmB,EAAE,+BAA+B,CAAC,CAAC,CAC3EY,SAAS,CACR,IAAIZ,MAAM,CACR,qCAAqC,EACrC,2CACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,0BAA0B,EAC1B,wCACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,oBAAoB,EACpB,oGACF,CACF,CAAC,CACAa,MAAM;AACL;AACA,OACEC,IAAY,EACZC,KAAa,EACbC,IAAY,EACZC,QAAgB,EAChBC,OAAyB,EACzBC,OAAO,KACJ;EACHA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD;EACA,IAAID,OAAO,CAACG,IAA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AAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHjB,OAAO,CAACoB,KAAK,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { frodo, state } from '@rockcarver/frodo-lib';
1
+ import { frodo } from '@rockcarver/frodo-lib';
2
2
  import { Option } from 'commander';
3
3
  import { exportJourneysToFile, exportJourneysToFiles, exportJourneyToFile } from '../../ops/JourneyOps';
4
4
  import { printMessage, verboseMessage } from '../../utils/Console';
@@ -7,11 +7,10 @@ const {
7
7
  getTokens
8
8
  } = frodo.login;
9
9
  const program = new FrodoCommand('frodo journey export');
10
- program.description('Export journeys/trees.').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('-a, --all', 'Export all the journeys/trees in a realm. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Export all the journeys/trees in a realm as separate files <journey/tree name>.json. Ignored with -i or -a.')).addOption(new Option('--use-string-arrays', 'Where applicable, use string arrays to store multi-line text (e.g. scripts).').default(false, 'off')).addOption(new Option('--no-deps', 'Do not include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).')).addOption(new Option('-D, --directory <directory>', 'Destination directory.')).addOption(new Option('-O, --organize <method>', 'Organize exports into folders using the indicated method. Valid values for method:\n' + 'id: folders named by id of exported object\n' + 'type: folders named by type (e.g. script, journey, idp)\n' + 'type/id: folders named by type with sub-folders named by id')).action(
10
+ program.description('Export journeys/trees.').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('-a, --all', 'Export all the journeys/trees in a realm. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Export all the journeys/trees in a realm as separate files <journey/tree name>.json. Ignored with -i or -a.')).addOption(new Option('--use-string-arrays', 'Where applicable, use string arrays to store multi-line text (e.g. scripts).').default(false, 'off')).addOption(new Option('--no-deps', 'Do not include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).')).addOption(new Option('-O, --organize <method>', 'Organize exports into folders using the indicated method. Valid values for method:\n' + 'id: folders named by id of exported object\n' + 'type: folders named by type (e.g. script, journey, idp)\n' + 'type/id: folders named by type with sub-folders named by id')).action(
11
11
  // implement command logic inside action handler
12
12
  async (host, realm, user, password, options, command) => {
13
13
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
14
- if (options.directory) state.setDirectory(options.directory);
15
14
  // export
16
15
  if (options.journeyId && (await getTokens())) {
17
16
  verboseMessage('Exporting journey...');
@@ -1 +1 @@
1
- {"version":3,"file":"journey-export.js","names":["frodo","state","Option","exportJourneysToFile","exportJourneysToFiles","exportJourneyToFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","directory","setDirectory","journeyId","file","useStringArrays","deps","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/journey/journey-export.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportJourneysToFile,\n exportJourneysToFiles,\n exportJourneyToFile,\n} from '../../ops/JourneyOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo journey export');\n\nprogram\n .description('Export journeys/trees.')\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 '-a, --all',\n 'Export all the journeys/trees in a realm. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all the journeys/trees in a realm as separate files <journey/tree name>.json. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option(\n '--use-string-arrays',\n 'Where applicable, use string arrays to store multi-line text (e.g. scripts).'\n ).default(false, 'off')\n )\n .addOption(\n new Option(\n '--no-deps',\n 'Do not include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).'\n )\n )\n .addOption(\n new Option('-D, --directory <directory>', 'Destination directory.')\n )\n .addOption(\n new Option(\n '-O, --organize <method>',\n 'Organize exports into folders using the indicated method. Valid values for method:\\n' +\n 'id: folders named by id of exported object\\n' +\n 'type: folders named by type (e.g. script, journey, idp)\\n' +\n 'type/id: folders named by type with sub-folders named by id'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (options.directory) state.setDirectory(options.directory);\n // export\n if (options.journeyId && (await getTokens())) {\n verboseMessage('Exporting journey...');\n await exportJourneyToFile(options.journeyId, options.file, {\n useStringArrays: options.useStringArrays,\n deps: options.deps,\n });\n }\n // --all -a\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all journeys to a single file...');\n await exportJourneysToFile(options.file, {\n useStringArrays: options.useStringArrays,\n deps: options.deps,\n });\n }\n // --all-separate -A\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all journeys to separate files...');\n await exportJourneysToFiles({\n useStringArrays: options.useStringArrays,\n deps: options.deps,\n });\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,oBAAoB,EACpBC,qBAAqB,EACrBC,mBAAmB,QACd,sBAAsB;AAC7B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAq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B,CAAC;IACtC,MAAMF,mBAAmB,CAACe,OAAO,CAACK,SAAS,EAAEL,OAAO,CAACM,IAAI,EAAE;MACzDC,eAAe,EAAEP,OAAO,CAACO,eAAe;MACxCC,IAAI,EAAER,OAAO,CAACQ;IAChB,CAAC,CAAC;EACJ;EACA;EAAA,KACK,IAAIR,OAAO,CAACS,GAAG,KAAK,MAAMpB,SAAS,CAAC,CAAC,CAAC,EAAE;IAC3CF,cAAc,CAAC,4CAA4C,CAAC;IAC5D,MAAMJ,oBAAoB,CAACiB,OAAO,CAACM,IAAI,EAAE;MACvCC,eAAe,EAAEP,OAAO,CAACO,eAAe;MACxCC,IAAI,EAAER,OAAO,CAACQ;IAChB,CAAC,CAAC;EACJ;EACA;EAAA,KACK,IAAIR,OAAO,CAACU,WAAW,KAAK,MAAMrB,SAAS,CAAC,CAAC,CAAC,EAAE;IACnDF,cAAc,CAAC,6CAA6C,CAAC;IAC7D,MAAMH,qBAAqB,CAAC;MAC1BuB,eAAe,EAAEP,OAAO,CAACO,eAAe;MACxCC,IAAI,EAAER,OAAO,CAACQ;IAChB,CAAC,CAAC;EACJ;EACA;EAAA,KACK;IACHtB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDK,OAAO,CAACoB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHtB,OAAO,CAACuB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"journey-export.js","names":["frodo","Option","exportJourneysToFile","exportJourneysToFiles","exportJourneyToFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","journeyId","file","useStringArrays","deps","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/journey/journey-export.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportJourneysToFile,\n exportJourneysToFiles,\n exportJourneyToFile,\n} from '../../ops/JourneyOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo journey export');\n\nprogram\n .description('Export journeys/trees.')\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 '-a, --all',\n 'Export all the journeys/trees in a realm. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all the journeys/trees in a realm as separate files <journey/tree name>.json. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option(\n '--use-string-arrays',\n 'Where applicable, use string arrays to store multi-line text (e.g. scripts).'\n ).default(false, 'off')\n )\n .addOption(\n new Option(\n '--no-deps',\n 'Do not include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).'\n )\n )\n .addOption(\n new Option(\n '-O, --organize <method>',\n 'Organize exports into folders using the indicated method. Valid values for method:\\n' +\n 'id: folders named by id of exported object\\n' +\n 'type: folders named by type (e.g. script, journey, idp)\\n' +\n 'type/id: folders named by type with sub-folders named by id'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export\n if (options.journeyId && (await getTokens())) {\n verboseMessage('Exporting journey...');\n await exportJourneyToFile(options.journeyId, options.file, {\n useStringArrays: options.useStringArrays,\n deps: options.deps,\n });\n }\n // --all -a\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all journeys to a single file...');\n await exportJourneysToFile(options.file, {\n useStringArrays: options.useStringArrays,\n deps: options.deps,\n });\n }\n // --all-separate -A\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all journeys to separate files...');\n await exportJourneysToFiles({\n useStringArrays: options.useStringArrays,\n deps: options.deps,\n });\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,oBAAoB,EACpBC,qBAAqB,EACrBC,mBAAmB,QACd,sBAAsB;AAC7B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGR,KAAK,CAACS,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,sBAAsB,CAAC;AAExDG,OAAO,CACJC,WAAW,CAAC,wBAAwB,CAAC,CACrCC,SAAS,CACR,IAAIX,MAAM,CACR,4BAA4B,EAC5B,8DACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,mBAAmB,EACnB,wEACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,WAAW,EACX,4DACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,oBAAoB,EACpB,6GACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,qBAAqB,EACrB,8EACF,CAAC,CAACY,OAAO,CAAC,KAAK,EAAE,KAAK,CACxB,CAAC,CACAD,SAAS,CACR,IAAIX,MAAM,CACR,WAAW,EACX,4IACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,yBAAyB,EACzB,sFAAsF,GACpF,8CAA8C,GAC9C,2DAA2D,GAC3D,6DACJ,CACF,CAAC,CACAa,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD;EACA,IAAID,OAAO,CAACG,SAAS,KAAK,MAAMd,SAAS,CAAC,CAAC,CAAC,EAAE;IAC5CF,cAAc,CAAC,sBAAsB,CAAC;IACtC,MAAMF,mBAAmB,CAACe,OAAO,CAACG,SAAS,EAAEH,OAAO,CAACI,IAAI,EAAE;MACzDC,eAAe,EAAEL,OAAO,CAACK,eAAe;MACxCC,IAAI,EAAEN,OAAO,CAACM;IAChB,CAAC,CAAC;EACJ;EACA;EAAA,KACK,IAAIN,OAAO,CAACO,GAAG,KAAK,MAAMlB,SAAS,CAAC,CAAC,CAAC,EAAE;IAC3CF,cAAc,CAAC,4CAA4C,CAAC;IAC5D,MAAMJ,oBAAoB,CAACiB,OAAO,CAACI,IAAI,EAAE;MACvCC,eAAe,EAAEL,OAAO,CAACK,eAAe;MACxCC,IAAI,EAAEN,OAAO,CAACM;IAChB,CAAC,CAAC;EACJ;EACA;EAAA,KACK,IAAIN,OAAO,CAACQ,WAAW,KAAK,MAAMnB,SAAS,CAAC,CAAC,CAAC,EAAE;IACnDF,cAAc,CAAC,6CAA6C,CAAC;IAC7D,MAAMH,qBAAqB,CAAC;MAC1BqB,eAAe,EAAEL,OAAO,CAACK,eAAe;MACxCC,IAAI,EAAEN,OAAO,CAACM;IAChB,CAAC,CAAC;EACJ;EACA;EAAA,KACK;IACHpB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDK,OAAO,CAACkB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHpB,OAAO,CAACqB,KAAK,CAAC,CAAC"}
@@ -12,7 +12,7 @@ program.description('Import OAuth2 applications.').addOption(new Option('-i, --a
12
12
  async (host, realm, user, password, options, command) => {
13
13
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
14
14
  // import by id
15
- if (options.file && options.idpId && (await getTokens())) {
15
+ if (options.file && options.appId && (await getTokens())) {
16
16
  verboseMessage(`Importing OAuth2 application "${options.appId}"...`);
17
17
  const status = await importOAuth2ClientFromFile(options.appId, options.file, {
18
18
  deps: options.deps
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-client-import.js","names":["frodo","Option","importFirstOAuth2ClientFromFile","importOAuth2ClientFromFile","importOAuth2ClientsFromFile","importOAuth2ClientsFromFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","file","idpId","appId","status","deps","process","exitCode","all","allSeparate","help","parse"],"sources":["../../../src/cli/oauth/oauth-client-import.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n importFirstOAuth2ClientFromFile,\n importOAuth2ClientFromFile,\n importOAuth2ClientsFromFile,\n importOAuth2ClientsFromFiles,\n} from '../../ops/OAuth2ClientOps';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo oauth client import');\n\nprogram\n .description('Import OAuth2 applications.')\n .addOption(\n new Option(\n '-i, --app-id <id>',\n 'Application id. If specified, only one application is imported and the options -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Import all applications from single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all applications from separate files (*.app.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option('--no-deps', 'Do not include any dependencies (scripts).')\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // import by id\n if (options.file && options.idpId && (await getTokens())) {\n verboseMessage(`Importing OAuth2 application \"${options.appId}\"...`);\n const status = await importOAuth2ClientFromFile(\n options.appId,\n options.file,\n {\n deps: options.deps,\n }\n );\n if (!status) process.exitCode = 1;\n }\n // --all -a\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage(\n `Importing all OAuth2 applications from a single file (${options.file})...`\n );\n const status = await importOAuth2ClientsFromFile(options.file, {\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // --all-separate -A\n else if (options.allSeparate && !options.file && (await getTokens())) {\n verboseMessage(\n 'Importing all OAuth2 applications from separate files in current directory...'\n );\n const status = await importOAuth2ClientsFromFiles({\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // import first provider from file\n else if (options.file && (await getTokens())) {\n verboseMessage(\n `Importing first OAuth2 application from file \"${options.file}\"...`\n );\n const status = await importFirstOAuth2ClientFromFile(options.file, {\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n printMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,+BAA+B,EAC/BC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,4BAA4B,QACvB,2BAA2B;AAClC,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGT,KAAK,CAACU,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,2BAA2B,CAAC;AAE7DG,OAAO,CACJC,WAAW,CAAC,6BAA6B,CAAC,CAC1CC,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,uGACF,CACF,CAAC,CACAY,SAAS,CAAC,IAAIZ,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAAC,CACzEY,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AAS,CAAC,CAAC,CAAC,EAAE;IACpEF,cAAc,CACZ,+EACF,CAAC;IACD,MAAMkB,MAAM,GAAG,MAAMpB,4BAA4B,CAAC;MAChDqB,IAAI,EAAEP,OAAO,CAACO;IAChB,CAAC,CAAC;IACF,IAAI,CAACD,MAAM,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK,IAAIT,OAAO,CAACG,IAAI,KAAK,MAAMb,SAAS,CAAC,CAAC,CAAC,EAAE;IAC5CF,cAAc,CACX,iDAAgDY,OAAO,CAACG,IAAK,MAChE,CAAC;IACD,MAAMG,MAAM,GAAG,MAAMvB,+BAA+B,CAACiB,OAAO,CAACG,IAAI,EAAE;MACjEI,IAAI,EAAEP,OAAO,CAACO;IAChB,CAAC,CAAC;IACF,IAAI,CAACD,MAAM,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK;IACHtB,YAAY,CAAC,sDAAsD,CAAC;IACpEK,OAAO,CAACoB,IAAI,CAAC,CAAC;IACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHjB,OAAO,CAACqB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"oauth-client-import.js","names":["frodo","Option","importFirstOAuth2ClientFromFile","importOAuth2ClientFromFile","importOAuth2ClientsFromFile","importOAuth2ClientsFromFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","file","appId","status","deps","process","exitCode","all","allSeparate","help","parse"],"sources":["../../../src/cli/oauth/oauth-client-import.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n importFirstOAuth2ClientFromFile,\n importOAuth2ClientFromFile,\n importOAuth2ClientsFromFile,\n importOAuth2ClientsFromFiles,\n} from '../../ops/OAuth2ClientOps';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo oauth client import');\n\nprogram\n .description('Import OAuth2 applications.')\n .addOption(\n new Option(\n '-i, --app-id <id>',\n 'Application id. If specified, only one application is imported and the options -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Import all applications from single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all applications from separate files (*.app.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option('--no-deps', 'Do not include any dependencies (scripts).')\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // import by id\n if (options.file && options.appId && (await getTokens())) {\n verboseMessage(`Importing OAuth2 application \"${options.appId}\"...`);\n const status = await importOAuth2ClientFromFile(\n options.appId,\n options.file,\n {\n deps: options.deps,\n }\n );\n if (!status) process.exitCode = 1;\n }\n // --all -a\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage(\n `Importing all OAuth2 applications from a single file (${options.file})...`\n );\n const status = await importOAuth2ClientsFromFile(options.file, {\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // --all-separate -A\n else if (options.allSeparate && !options.file && (await getTokens())) {\n verboseMessage(\n 'Importing all OAuth2 applications from separate files in current directory...'\n );\n const status = await importOAuth2ClientsFromFiles({\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // import first provider from file\n else if (options.file && (await getTokens())) {\n verboseMessage(\n `Importing first OAuth2 application from file \"${options.file}\"...`\n );\n const status = await importFirstOAuth2ClientFromFile(options.file, {\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n printMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\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AO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHhB,OAAO,CAACoB,KAAK,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { frodo, state } from '@rockcarver/frodo-lib';
1
+ import { frodo } from '@rockcarver/frodo-lib';
2
2
  import { Option } from 'commander';
3
3
  import { importFirstServiceFromFile, importServiceFromFile, importServicesFromFile, importServicesFromFiles } from '../../ops/ServiceOps.js';
4
4
  import { printMessage, verboseMessage } from '../../utils/Console.js';
@@ -7,9 +7,8 @@ const {
7
7
  getTokens
8
8
  } = frodo.login;
9
9
  const program = new FrodoCommand('frodo service import');
10
- program.description('Import AM services.').addOption(new Option('-i, --service-id <service-id>', 'Service id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import SAML Entity(s) from. Ignored with -A.')).addOption(new Option('-a, --all', 'Import all services from a single file.')).addOption(new Option('-C, --clean', 'Remove existing service(s) before importing.')).addOption(new Option('-A, --all-separate', 'Import all services from separate files <id>.service.json.')).addOption(new Option('-D, --directory <directory>', 'Working directory.')).addOption(new Option('-g, --global', 'Import global services.')).action(async (host, realm, user, password, options, command) => {
10
+ program.description('Import AM services.').addOption(new Option('-i, --service-id <service-id>', 'Service id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import SAML Entity(s) from. Ignored with -A.')).addOption(new Option('-a, --all', 'Import all services from a single file.')).addOption(new Option('-C, --clean', 'Remove existing service(s) before importing.')).addOption(new Option('-A, --all-separate', 'Import all services from separate files <id>.service.json.')).addOption(new Option('-g, --global', 'Import global services.')).action(async (host, realm, user, password, options, command) => {
11
11
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
12
- state.setDirectory(options.directory || '.');
13
12
  const clean = options.clean ?? false;
14
13
  const globalConfig = options.global ?? false;
15
14
 
@@ -1 +1 @@
1
- {"version":3,"file":"service-import.js","names":["frodo","state","Option","importFirstServiceFromFile","importServiceFromFile","importServicesFromFile","importServicesFromFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","setDirectory","directory","clean","globalConfig","global","serviceId","file","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/service/service-import.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n importFirstServiceFromFile,\n importServiceFromFile,\n importServicesFromFile,\n importServicesFromFiles,\n} from '../../ops/ServiceOps.js';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo service import');\n\ninterface ServiceImportOptions {\n file?: string;\n all?: boolean;\n serviceId?: string;\n allSeparate?: boolean;\n type?: string;\n insecure?: boolean;\n clean?: boolean;\n directory?: string;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n global?: boolean;\n}\n\nprogram\n .description('Import AM services.')\n .addOption(\n new Option(\n '-i, --service-id <service-id>',\n 'Service id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to import SAML Entity(s) from. Ignored with -A.'\n )\n )\n .addOption(new Option('-a, --all', 'Import all services from a single file.'))\n .addOption(\n new Option('-C, --clean', 'Remove existing service(s) before importing.')\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all services from separate files <id>.service.json.'\n )\n )\n .addOption(new Option('-D, --directory <directory>', 'Working directory.'))\n .addOption(new Option('-g, --global', 'Import global services.'))\n .action(\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: ServiceImportOptions,\n command\n ) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n state.setDirectory(options.directory || '.');\n\n const clean = options.clean ?? false;\n const globalConfig = options.global ?? false;\n\n // import by id\n if (options.serviceId && options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n await importServiceFromFile(\n options.serviceId,\n options.file,\n clean,\n globalConfig\n );\n }\n // -a / --all\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage('Importing all services from a single file...');\n await importServicesFromFile(options.file, clean, globalConfig);\n }\n // -A / --all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Importing all services from separate files...');\n await importServicesFromFiles(clean, globalConfig);\n }\n // import file\n else if (options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n await importFirstServiceFromFile(options.file, clean, globalConfig);\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,0BAA0B,EAC1BC,qBAAqB,EACrBC,sBAAsB,EACtBC,uBAAuB,QAClB,yBAAyB;AAChC,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGV,KAAK,CAACW,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,sBAAsB,CAAC;AAiBxDG,OAAO,CACJC,WAAW,CAAC,qBAAqB,CAAC,CAClCC,SAAS,CACR,IAAIZ,MAAM,CACR,+BAA+B,EAC/B,kDACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,kEACF,CACF,CAAC,CACAY,SAAS,CAAC,IAAIZ,MAAM,CAAC,WAAW,EAAE,yCAAyC,CAAC,CAAC,CAC7EY,SAAS,CACR,IAAIZ,MAAM,CAAC,aAAa,EAAE,8CAA8C,CAC1E,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,oBAAoB,EACpB,4DACF,CACF,CAAC,CACAY,SAAS,CAAC,IAA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MAAMnB,SAAS,CAAC,CAAC,CAAC,EAAE;IAC5CF,cAAc,CAAC,sBAAsB,CAAC;IACtC,MAAML,0BAA0B,CAACiB,OAAO,CAACS,IAAI,EAAEJ,KAAK,EAAEC,YAAY,CAAC;EACrE;EACA;EAAA,KACK;IACHnB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDK,OAAO,CAACoB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHtB,OAAO,CAACuB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"service-import.js","names":["frodo","Option","importFirstServiceFromFile","importServiceFromFile","importServicesFromFile","importServicesFromFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","clean","globalConfig","global","serviceId","file","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/service/service-import.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n importFirstServiceFromFile,\n importServiceFromFile,\n importServicesFromFile,\n importServicesFromFiles,\n} from '../../ops/ServiceOps.js';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo service import');\n\ninterface ServiceImportOptions {\n file?: string;\n all?: boolean;\n serviceId?: string;\n allSeparate?: boolean;\n type?: string;\n insecure?: boolean;\n clean?: boolean;\n directory?: string;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n global?: boolean;\n}\n\nprogram\n .description('Import AM services.')\n .addOption(\n new Option(\n '-i, --service-id <service-id>',\n 'Service id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to import SAML Entity(s) from. Ignored with -A.'\n )\n )\n .addOption(new Option('-a, --all', 'Import all services from a single file.'))\n .addOption(\n new Option('-C, --clean', 'Remove existing service(s) before importing.')\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all services from separate files <id>.service.json.'\n )\n )\n .addOption(new Option('-g, --global', 'Import global services.'))\n .action(\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: ServiceImportOptions,\n command\n ) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n\n const clean = options.clean ?? false;\n const globalConfig = options.global ?? false;\n\n // import by id\n if (options.serviceId && options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n await importServiceFromFile(\n options.serviceId,\n options.file,\n clean,\n globalConfig\n );\n }\n // -a / --all\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage('Importing all services from a single file...');\n await importServicesFromFile(options.file, clean, globalConfig);\n }\n // -A / --all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Importing all services from separate files...');\n await importServicesFromFiles(clean, globalConfig);\n }\n // import file\n else if (options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n await importFirstServiceFromFile(options.file, clean, globalConfig);\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,0BAA0B,EAC1BC,qBAAqB,EACrBC,sBAAsB,EACtBC,uBAAuB,QAClB,yBAAyB;AAChC,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGT,KAAK,CAACU,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,sBAAsB,CAAC;AAiBxDG,OAAO,CACJC,WAAW,CAAC,qBAAqB,CAAC,CAClCC,SAAS,CACR,I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