@rockcarver/frodo-cli 2.0.0-45 → 2.0.0-47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -9,7 +9,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Added
11
11
 
12
- - pem and base64hmac encoded ESV secret creation
12
+ - \#360: Frodo now saves the deployment type in connection profiles.
13
+
14
+ ### Changed
15
+
16
+ - Update to frodo-lib 2.0.0-67
17
+
18
+ ## [2.0.0-46] - 2024-01-20
19
+
20
+ ## [2.0.0-45] - 2024-01-16
21
+
22
+ ### Added
23
+
24
+ - pem and base64hmac encoded ESV secret creation
13
25
 
14
26
  ## [2.0.0-44] - 2024-01-11
15
27
 
@@ -1459,7 +1471,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1459
1471
  - Fixed problem with adding connection profiles
1460
1472
  - Miscellaneous bug fixes
1461
1473
 
1462
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-44...HEAD
1474
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-46...HEAD
1475
+
1476
+ [2.0.0-46]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-45...v2.0.0-46
1477
+
1478
+ [2.0.0-45]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-44...v2.0.0-45
1463
1479
 
1464
1480
  [2.0.0-44]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-43...v2.0.0-44
1465
1481
 
@@ -97,7 +97,7 @@ export class FrodoStubCommand extends Command {
97
97
  // shutdown handlers
98
98
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
99
99
  this.hook('postAction', (thisCommand, actionCommand) => {
100
- debugMessage(`postAction: this command: ${thisCommand.name()}, action command: ${actionCommand.name()}`);
100
+ debugMessage(`FrodoCommand: running postAction hook: this command: ${thisCommand.name()}, action command: ${actionCommand.name()}`);
101
101
  cleanupProgressIndicators();
102
102
  });
103
103
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FrodoCommand.js","names":["frodo","state","Argument","Command","Option","fs","globalConfig","cleanupProgressIndicators","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","noCacheOption","flushCacheOption","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","cache","setUseTokenCache","flush","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","hook","thisCommand","actionCommand","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 { frodo, state } from '@rockcarver/frodo-lib';\nimport { Argument, Command, Option } from 'commander';\nimport fs from 'fs';\n\nimport * as globalConfig from '../storage/StaticStorage';\nimport {\n cleanupProgressIndicators,\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 noCacheOption = new Option(\n '--no-cache',\n 'Disable token cache for this operation.'\n);\n\nconst flushCacheOption = new Option('--flush-cache', 'Flush token cache.');\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 noCacheOption,\n flushCacheOption,\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 [noCacheOption.attributeName()]: (cache: boolean) =>\n state.setUseTokenCache(cache),\n [flushCacheOption.attributeName()]: (flush: boolean) => {\n if (flush) frodo.cache.flush();\n },\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 // shutdown handlers\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this.hook('postAction', (thisCommand, actionCommand) => {\n debugMessage(\n `postAction: this command: ${thisCommand.name()}, action command: ${actionCommand.name()}`\n );\n cleanupProgressIndicators();\n });\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_NO_CACHE: Disable token cache. Same as '--no-cache' option.\\n` +\n ` FRODO_TOKEN_CACHE_PATH: Use this token cache file instead of '~/.frodo/TokenCache.json'.\\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 what's in '~/.frodo/masterkey.key'. 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,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,QAAQ,EAAEC,OAAO,EAAEC,MAAM,QAAQ,WAAW;AACrD,OAAOC,EAAE,MAAM,IAAI;AAEnB,OAAO,KAAKC,YAAY,MAAM,0BAA0B;AACxD,SACEC,yBAAyB,EACzBC,uBAAuB,EACvBC,gBAAgB,EAChBC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,EACvBC,cAAc,QACT,qBAAqB;AAE5B,MAAMC,YAAY,GAAG,IAAIb,QAAQ,CAC/B,QAAQ,EACR,iIACF,CAAC;AAED,MAAMc,aAAa,GAAG,IAAId,QAAQ,CAChC,SAAS,EACT,yFACF,CAAC,CAACe,OAAO;AACP;AACAC,OAAO,CAACC,GAAG,CAACC,WAAW,IAAId,YAAY,CAACe,iBAAiB,EACzD,oDACF,CAAC;AAED,MAAMC,gBAAgB,GAAG,IAAIpB,QAAQ,CACnC,YAAY,EACZ,gHACF,CAAC;AAED,MAAMqB,gBAAgB,GAAG,IAAIrB,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC;AAEhE,MAAMsB,sBAAsB,GAAG,IAAIpB,MAAM,CACvC,iBAAiB,EACjB,qBACF,CAAC;AAED,MAAMqB,2BAA2B,GAAG,IAAIrB,MAAM,CAC5C,sBAAsB,EACtB,iF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AAC;QACD;MACF;MACA,MAAMhB,GAAG,GAAGS,OAAO,CAACM,KAAK,CAACH,CAAC,CAAC,CAAC/E,IAAI,CAAC,CAAC;MACnC;MACA,IAAIoF,MAAM,CAACC,IAAI,CAACtF,QAAQ,CAAC,CAACqE,QAAQ,CAACD,GAAG,CAAC,EAAE;QACvCjG,YAAY,CACT,qEAAoEiG,GAAI,IAC3E,CAAC;QACD;QACA,MAAMmB,OAAY,GAAGvF,QAAQ,CAACoE,GAAG,CAAC;QAClCmB,OAAO,CAACN,CAAC,CAAC;MACZ,CAAC,MAAM;QACL9G,YAAY,CACT,yEAAwEiG,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,CAACtF,QAAQ,CAAC,CAACqE,QAAQ,CAACmB,CAAC,CAAC,EAAE;QACrCrH,YAAY,CACT,mEAAkEqH,CAAE,IACvE,CAAC;QACD;QACA,MAAMD,OAAY,GAAGvF,QAAQ,CAACwF,CAAC,CAAC;QAChCD,OAAO,CAACN,CAAC,CAAC;MACZ,CAAC,MAAM;QACL9G,YAAY,CACT,uEAAsEqH,CAAE,IAC3E,CAAC;MACH;IACF;EACF;AACF"}
1
+ {"version":3,"file":"FrodoCommand.js","names":["frodo","state","Argument","Command","Option","fs","globalConfig","cleanupProgressIndicators","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","noCacheOption","flushCacheOption","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","cache","setUseTokenCache","flush","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","hook","thisCommand","actionCommand","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 { frodo, state } from '@rockcarver/frodo-lib';\nimport { Argument, Command, Option } from 'commander';\nimport fs from 'fs';\n\nimport * as globalConfig from '../storage/StaticStorage';\nimport {\n cleanupProgressIndicators,\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 noCacheOption = new Option(\n '--no-cache',\n 'Disable token cache for this operation.'\n);\n\nconst flushCacheOption = new Option('--flush-cache', 'Flush token cache.');\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 noCacheOption,\n flushCacheOption,\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 [noCacheOption.attributeName()]: (cache: boolean) =>\n state.setUseTokenCache(cache),\n [flushCacheOption.attributeName()]: (flush: boolean) => {\n if (flush) frodo.cache.flush();\n },\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 // shutdown handlers\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this.hook('postAction', (thisCommand, actionCommand) => {\n debugMessage(\n `FrodoCommand: running postAction hook: this command: ${thisCommand.name()}, action command: ${actionCommand.name()}`\n );\n cleanupProgressIndicators();\n });\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_NO_CACHE: Disable token cache. Same as '--no-cache' option.\\n` +\n ` FRODO_TOKEN_CACHE_PATH: Use this token cache file instead of '~/.frodo/TokenCache.json'.\\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 what's in '~/.frodo/masterkey.key'. 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,EAAEC,KAAK,Q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AAK,MAAM,CAACoB,CAAC,EAAEP,CAAC,CAAC,IAAII,MAAM,CAACH,OAAO,CAACH,OAAO,CAAC,EAAE;MAC5C;MACA,IAAIM,MAAM,CAACC,IAAI,CAACtF,QAAQ,CAAC,CAACqE,QAAQ,CAACmB,CAAC,CAAC,EAAE;QACrCrH,YAAY,CACT,mEAAkEqH,CAAE,IACvE,CAAC;QACD;QACA,MAAMD,OAAY,GAAGvF,QAAQ,CAACwF,CAAC,CAAC;QAChCD,OAAO,CAACN,CAAC,CAAC;MACZ,CAAC,MAAM;QACL9G,YAAY,CACT,uEAAsEqH,CAAE,IAC3E,CAAC;MACH;IACF;EACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"admin-execute-rfc7523-authz-grant-flow.js","names":["frodo","Option","fs","v4","uuidv4","s","executeRfc7523AuthZGrantFlow","printMessage","FrodoCommand","getTokens","login","program","description","addOption","default","addHelpText","amBaseUrl","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","clientId","jwk","undefined","jwkFile","data","readFileSync","JSON","parse","toString","error","message","outcome","iss","sub","scope","split","json","process","exitCode"],"sources":["../../../src/cli/admin/admin-execute-rfc7523-authz-grant-flow.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { JwkRsa } from '@rockcarver/frodo-lib/types/ops/JoseOps.js';\nimport { Option } from 'commander';\nimport fs from 'fs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as s from '../../help/SampleData';\nimport { executeRfc7523AuthZGrantFlow } from '../../ops/AdminOps.js';\nimport { printMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand.js';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand(\n 'frodo admin execute-rfc7523-authz-grant-flow'\n);\n\nprogram\n .description('Execute RFC7523 authorization grant flow.')\n .addOption(new Option('--client-id [id]', 'Client id.'))\n .addOption(\n new Option(\n '--jwk-file [file]',\n 'Path to JSON Web Key (JWK) file containing private key.'\n )\n )\n .addOption(\n new Option(\n '--sub [subject]',\n 'Subject identifier, typically a UUID. Must resolve to a valid user in the realm.'\n )\n )\n .addOption(new Option('--iss [issuer]', 'Trusted issuer, typically a URL.'))\n .addOption(\n new Option('--scope [scope]', 'Space-delimited list of scopes.').default(\n 'openid fr:am:* fr:idm:*'\n )\n )\n .addOption(new Option('--json', 'Output in JSON format.'))\n .addHelpText(\n 'after',\n `Usage Examples:\\n` +\n ` If you used frodo to create the RFC7523 configuration (see 'Related Commands' below), then you can test your configuration with minimal input and frodo will locate the missing parameters. The command below returns access token and identity token:\\n` +\n ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Same as above but output raw json:\\n` +\n ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 --json ${s.amBaseUrl}'\\n`[\n 'brightCyan'\n ] +\n ` Same as first command above but explicitly provide all parameters:\\n` +\n ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --jwk-file rfc7523-client1_private.jwk.json ${s.amBaseUrl}'\\n`[\n 'brightCyan'\n ] +\n `\\nRelated Commands:\\n` +\n ` Run ${\n 'frodo admin generate-rfc7523-authz-grant-artefacts --help'[\n 'brightCyan'\n ]\n } to see how to create the required configuration artefacts for ${\n 'frodo admin execute-rfc7523-authz-grant-flow'['brightCyan']\n }:\\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 (await getTokens()) {\n printMessage(`Executing RFC7523 authorization grant flow...`);\n let clientId = uuidv4();\n if (options.clientId) {\n clientId = options.clientId;\n }\n let jwk: JwkRsa = undefined;\n if (options.jwkFile) {\n try {\n const data = fs.readFileSync(options.jwkFile);\n jwk = JSON.parse(data.toString());\n } catch (error) {\n printMessage(\n `Error parsing JWK from file ${options.jwkFile}: ${error.message}`,\n 'error'\n );\n }\n }\n const outcome = await executeRfc7523AuthZGrantFlow(\n clientId,\n options.iss,\n jwk,\n options.sub,\n options.scope.split(' '),\n options.json\n );\n if (!outcome) process.exitCode = 1;\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAE7C,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,EAAE,MAAM,IAAI;AACnB,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AAEnC,OAAO,KAAKC,CAAC,MAAM,uBAAuB;AAC1C,SAASC,4BAA4B,QAAQ,uBAAuB;AACpE,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,MAAM;EAAEC;AAAU,CAAC,GAAGT,KAAK,CAACU,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAC9B,8CACF,CAAC;AAEDG,OAAO,CACJC,WAAW,CAAC,2CAA2C,CAAC,CACxDC,SAAS,CAAC,IAAIZ,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC,CACvDY,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,yDACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,iBAAiB,EACjB,kFACF,CACF,CAAC,CACAY,SAAS,CAAC,IAAIZ,MAAM,CAAC,gBAAgB,EAAE,kCAAkC,CAAC,CAAC,CAC3EY,SAAS,CACR,IAAIZ,MAAM,CAAC,iBAAiB,EAAE,iCAAiC,CAAC,CAACa,OAAO,CACtE,yBACF,CACF,CAAC,CACAD,SAAS,CAAC,IAAIZ,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC,CACzDc,WAAW,CACV,OAAO,EACN,mBAAkB,GAChB,4PAA2P,GAC3P,gFAA+EV,CAAC,CAACW,SAAU,IAA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,GAAG,CAAC,EACxBlB,OAAO,CAACmB,IACV,CAAC;IACD,IAAI,CAACL,OAAO,EAAEM,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHhC,OAAO,CAACqB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"admin-execute-rfc7523-authz-grant-flow.js","names":["frodo","Option","fs","v4","uuidv4","s","executeRfc7523AuthZGrantFlow","printMessage","FrodoCommand","getTokens","login","program","description","addOption","default","addHelpText","amBaseUrl","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","clientId","jwk","undefined","jwkFile","data","readFileSync","JSON","parse","toString","error","message","outcome","iss","sub","scope","split","json","process","exitCode"],"sources":["../../../src/cli/admin/admin-execute-rfc7523-authz-grant-flow.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { JwkRsa } from '@rockcarver/frodo-lib/types/ops/JoseOps.js';\nimport { Option } from 'commander';\nimport fs from 'fs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as s from '../../help/SampleData';\nimport { executeRfc7523AuthZGrantFlow } from '../../ops/AdminOps.js';\nimport { printMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand.js';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand(\n 'frodo admin execute-rfc7523-authz-grant-flow'\n);\n\nprogram\n .description('Execute RFC7523 authorization grant flow.')\n .addOption(new Option('--client-id [id]', 'Client id.'))\n .addOption(\n new Option(\n '--jwk-file [file]',\n 'Path to JSON Web Key (JWK) file containing private key.'\n )\n )\n .addOption(\n new Option(\n '--sub [subject]',\n 'Subject identifier, typically a UUID. Must resolve to a valid user in the realm.'\n )\n )\n .addOption(new Option('--iss [issuer]', 'Trusted issuer, typically a URL.'))\n .addOption(\n new Option('--scope [scope]', 'Space-delimited list of scopes.').default(\n 'openid fr:am:* fr:idm:*'\n )\n )\n .addOption(new Option('--json', 'Output in JSON format.'))\n .addHelpText(\n 'after',\n `Usage Examples:\\n` +\n ` If you used frodo to create the RFC7523 configuration (see 'Related Commands' below), then you can test your configuration with minimal input and frodo will locate the missing parameters. The command below returns access token and identity token:\\n` +\n ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Same as above but output raw json:\\n` +\n ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 --json ${s.amBaseUrl}'\\n`[\n 'brightCyan'\n ] +\n ` Same as first command above but explicitly provide all parameters:\\n` +\n ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --jwk-file rfc7523-client1_private.jwk.json ${s.amBaseUrl}'\\n`[\n 'brightCyan'\n ] +\n `\\nRelated Commands:\\n` +\n ` Run ${'frodo admin generate-rfc7523-authz-grant-artefacts --help'['brightCyan']} to see how to create the required configuration artefacts for ${'frodo admin execute-rfc7523-authz-grant-flow'['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 if (await getTokens()) {\n printMessage(`Executing RFC7523 authorization grant flow...`);\n let clientId = uuidv4();\n if (options.clientId) {\n clientId = options.clientId;\n }\n let jwk: JwkRsa = undefined;\n if (options.jwkFile) {\n try {\n const data = fs.readFileSync(options.jwkFile);\n jwk = JSON.parse(data.toString());\n } catch (error) {\n printMessage(\n `Error parsing JWK from file ${options.jwkFile}: ${error.message}`,\n 'error'\n );\n }\n }\n const outcome = await executeRfc7523AuthZGrantFlow(\n clientId,\n options.iss,\n jwk,\n options.sub,\n options.scope.split(' '),\n options.json\n );\n if (!outcome) process.exitCode = 1;\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram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AK,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"admin-generate-rfc7523-authz-grant-artefacts.js","names":["frodo","state","Option","fs","v4","uuidv4","s","generateRfc7523AuthZGrantArtefacts","printMessage","FrodoCommand","getTokens","login","program","description","addOption","default","addHelpText","amBaseUrl","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getRealm","clientId","jwk","undefined","jwkFile","data","readFileSync","JSON","parse","toString","error","message","outcome","iss","sub","scope","split","save","json","process","exitCode"],"sources":["../../../src/cli/admin/admin-generate-rfc7523-authz-grant-artefacts.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { JwkRsa } from '@rockcarver/frodo-lib/types/ops/JoseOps.js';\nimport { Option } from 'commander';\nimport fs from 'fs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as s from '../../help/SampleData';\nimport { generateRfc7523AuthZGrantArtefacts } from '../../ops/AdminOps.js';\nimport { printMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand.js';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand(\n 'frodo admin generate-rfc7523-authz-grant-artefacts'\n);\n\nprogram\n .description('Generate RFC7523 authorization grant artefacts.')\n .addOption(new Option('--client-id [id]', 'Client id.'))\n .addOption(\n new Option(\n '--jwk-file [file]',\n 'Path to JSON Web Key (JWK) file containing private key.'\n )\n )\n .addOption(\n new Option(\n '--sub [subject]',\n 'Subject identifier, typically a UUID. Must resolve to a valid user in the realm. Restricts the trusted issuer to only this subject by adding the identifier to the list of allowed subjects. Omitting this option allows the trusted issuer to request tokens for any realm user without restrictions.'\n )\n )\n .addOption(new Option('--iss [issuer]', 'Trusted issuer, typically a URL.'))\n .addOption(\n new Option('--scope [scope]', 'Space-delimited list of scopes.').default(\n 'openid fr:am:* fr:idm:*'\n )\n )\n .addOption(\n new Option(\n '--no-save',\n 'Do not save artefacts in AM and to file By default this command creates a fully configured oauth2 client and trusted issuer in AM and saves the generated JWK (private key) and JWKS (public key set) to files.'\n )\n )\n .addOption(new Option('--json', 'Output in JSON format.'))\n .addHelpText(\n 'after',\n `Usage Examples:\\n` +\n ` Generate, output to console, and save all the artefacts for an RFC7523 authorization grant flow configuration limited to one particular subject:\\n` +\n ` - Fully configured OAuth2 client - named '<clientId>'\\n` +\n ` - Fully configured OAuth2 trusted issuer - named '<clientId>-issuer'\\n` +\n ` - Private Key as Json Web Key (JWK) - named '<clientId>_private.jwk.json'\\n` +\n ` - Public Key as Json Web Key Set (JWKS) - named '<clientId>_public.jwks.json'\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Same as above but use an existing JWK file instead of creating one.\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --jwk-file rfc7523-client1_private.jwk.json ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Generate and output to console all the artefacts for an RFC7523 authorization grant flow configuration but do not create any configuration or files.\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --no-save ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Generate and output in json format all the artefacts for an RFC7523 authorization grant flow configuration.\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --json ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n `\\nRelated Commands:\\n` +\n ` Run ${\n 'frodo admin execute-rfc7523-authz-grant-flow --help'['brightCyan']\n } to see how to test your configuration created with ${\n 'frodo admin generate-rfc7523-authz-grant-artefacts'['brightCyan']\n }:\\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 (await getTokens()) {\n printMessage(\n `Generating RFC7523 authorization grant artefacts in realm \"${state.getRealm()}\"...`\n );\n let clientId = uuidv4();\n if (options.clientId) {\n clientId = options.clientId;\n }\n let jwk: JwkRsa = undefined;\n if (options.jwkFile) {\n try {\n const data = fs.readFileSync(options.jwkFile);\n jwk = JSON.parse(data.toString());\n } catch (error) {\n printMessage(\n `Error parsing JWK from file ${options.jwkFile}: ${error.message}`,\n 'error'\n );\n }\n }\n const outcome = await generateRfc7523AuthZGrantArtefacts(\n clientId,\n options.iss,\n jwk,\n options.sub,\n options.scope.split(' '),\n { save: options.save },\n options.json\n );\n if (!outcome) process.exitCode = 1;\n } else {\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;AAEpD,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,EAAE,MAAM,IAAI;AACnB,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AAEnC,OAAO,KAAKC,CAAC,MAAM,uBAAuB;AAC1C,SAASC,kCAAkC,QAAQ,uBAAuB;AAC1E,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,MAAM;EAAEC;AAAU,CAAC,GAAGV,KAAK,CAACW,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAC9B,oDACF,CAAC;AAEDG,OAAO,CACJC,WAAW,CAAC,iDAAiD,CAAC,CAC9DC,SAAS,CAAC,IAAIZ,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC,CACvDY,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,yDACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,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AACI,QAAQ,EAAE;MACpBA,QAAQ,GAAGJ,OAAO,CAACI,QAAQ;IAC7B;IACA,IAAIC,GAAW,GAAGC,SAAS;IAC3B,IAAIN,OAAO,CAACO,OAAO,EAAE;MACnB,IAAI;QACF,MAAMC,IAAI,GAAG5B,EAAE,CAAC6B,YAAY,CAACT,OAAO,CAACO,OAAO,CAAC;QAC7CF,GAAG,GAAGK,IAAI,CAACC,KAAK,CAACH,IAAI,CAACI,QAAQ,CAAC,CAAC,CAAC;MACnC,CAAC,CAAC,OAAOC,KAAK,EAAE;QACd5B,YAAY,CACT,+BAA8Be,OAAO,CAACO,OAAQ,KAAIM,KAAK,CAACC,OAAQ,EAAC,EAClE,OACF,CAAC;MACH;IACF;IACA,MAAMC,OAAO,GAAG,MAAM/B,kCAAkC,CACtDoB,QAAQ,EACRJ,OAAO,CAACgB,GAAG,EACXX,GAAG,EACHL,OAAO,CAACiB,GAAG,EACXjB,OAAO,CAACkB,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,EACxB;MAAEC,IAAI,EAAEpB,OAAO,CAACoB;IAAK,CAAC,EACtBpB,OAAO,CAACqB,IACV,CAAC;IACD,IAAI,CAACN,OAAO,EAAEO,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHlC,OAAO,CAACsB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"admin-generate-rfc7523-authz-grant-artefacts.js","names":["frodo","state","Option","fs","v4","uuidv4","s","generateRfc7523AuthZGrantArtefacts","printMessage","FrodoCommand","getTokens","login","program","description","addOption","default","addHelpText","amBaseUrl","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getRealm","clientId","jwk","undefined","jwkFile","data","readFileSync","JSON","parse","toString","error","message","outcome","iss","sub","scope","split","save","json","process","exitCode"],"sources":["../../../src/cli/admin/admin-generate-rfc7523-authz-grant-artefacts.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { JwkRsa } from '@rockcarver/frodo-lib/types/ops/JoseOps.js';\nimport { Option } from 'commander';\nimport fs from 'fs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as s from '../../help/SampleData';\nimport { generateRfc7523AuthZGrantArtefacts } from '../../ops/AdminOps.js';\nimport { printMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand.js';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand(\n 'frodo admin generate-rfc7523-authz-grant-artefacts'\n);\n\nprogram\n .description('Generate RFC7523 authorization grant artefacts.')\n .addOption(new Option('--client-id [id]', 'Client id.'))\n .addOption(\n new Option(\n '--jwk-file [file]',\n 'Path to JSON Web Key (JWK) file containing private key.'\n )\n )\n .addOption(\n new Option(\n '--sub [subject]',\n 'Subject identifier, typically a UUID. Must resolve to a valid user in the realm. Restricts the trusted issuer to only this subject by adding the identifier to the list of allowed subjects. Omitting this option allows the trusted issuer to request tokens for any realm user without restrictions.'\n )\n )\n .addOption(new Option('--iss [issuer]', 'Trusted issuer, typically a URL.'))\n .addOption(\n new Option('--scope [scope]', 'Space-delimited list of scopes.').default(\n 'openid fr:am:* fr:idm:*'\n )\n )\n .addOption(\n new Option(\n '--no-save',\n 'Do not save artefacts in AM and to file By default this command creates a fully configured oauth2 client and trusted issuer in AM and saves the generated JWK (private key) and JWKS (public key set) to files.'\n )\n )\n .addOption(new Option('--json', 'Output in JSON format.'))\n .addHelpText(\n 'after',\n `Usage Examples:\\n` +\n ` Generate, output to console, and save all the artefacts for an RFC7523 authorization grant flow configuration limited to one particular subject:\\n` +\n ` - Fully configured OAuth2 client - named '<clientId>'\\n` +\n ` - Fully configured OAuth2 trusted issuer - named '<clientId>-issuer'\\n` +\n ` - Private Key as Json Web Key (JWK) - named '<clientId>_private.jwk.json'\\n` +\n ` - Public Key as Json Web Key Set (JWKS) - named '<clientId>_public.jwks.json'\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Same as above but use an existing JWK file instead of creating one.\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --jwk-file rfc7523-client1_private.jwk.json ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Generate and output to console all the artefacts for an RFC7523 authorization grant flow configuration but do not create any configuration or files.\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --no-save ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Generate and output in json format all the artefacts for an RFC7523 authorization grant flow configuration.\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --json ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n `\\nRelated Commands:\\n` +\n ` Run ${'frodo admin execute-rfc7523-authz-grant-flow --help'['brightCyan']} to see how to test your configuration created with ${'frodo admin generate-rfc7523-authz-grant-artefacts'['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 if (await getTokens()) {\n printMessage(\n `Generating RFC7523 authorization grant artefacts in realm \"${state.getRealm()}\"...`\n );\n let clientId = uuidv4();\n if (options.clientId) {\n clientId = options.clientId;\n }\n let jwk: JwkRsa = undefined;\n if (options.jwkFile) {\n try {\n const data = fs.readFileSync(options.jwkFile);\n jwk = JSON.parse(data.toString());\n } catch (error) {\n printMessage(\n `Error parsing JWK from file ${options.jwkFile}: ${error.message}`,\n 'error'\n );\n }\n }\n const outcome = await generateRfc7523AuthZGrantArtefacts(\n clientId,\n options.iss,\n jwk,\n options.sub,\n options.scope.split(' '),\n { save: options.save },\n options.json\n );\n if (!outcome) process.exitCode = 1;\n } else {\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;AAEpD,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,EAAE,MAAM,IAAI;AACnB,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AAEnC,OAAO,KAAKC,CAAC,MAAM,uBAAuB;AAC1C,SAASC,kCAAkC,QAAQ,uBAAuB;AAC1E,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,MAAM;EAAEC;AAAU,CAAC,GAAGV,KAAK,CAACW,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAC9B,oDACF,CAAC;AAEDG,OAAO,CACJC,WAAW,CAAC,iDAAiD,CAAC,CAC9DC,SAAS,CAAC,IAAIZ,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC,CACvDY,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,yDACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,iBAAiB,EACjB,wSACF,CACF,CAAC,CACAY,SAAS,CAAC,IAAIZ,MAAM,CAAC,gBAAgB,EAAE,kCAAkC,CAAC,CAAC,CAC3EY,SAAS,CACR,IAAIZ,MAAM,CAAC,iBAAiB,EAAE,iCAAiC,CAAC,CAACa,OAAO,CACtE,yBACF,CACF,CAAC,CACAD,SAAS,CACR,IAAIZ,MAAM,CACR,WAAW,EACX,iNACF,CACF,CAAC,CACAY,SAAS,CAAC,IAAIZ,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC,CACzDc,WAAW,CACV,OA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A8Be,OAAO,CAACO,OAAQ,KAAIM,KAAK,CAACC,OAAQ,EAAC,EAClE,OACF,CAAC;MACH;IACF;IACA,MAAMC,OAAO,GAAG,MAAM/B,kCAAkC,CACtDoB,QAAQ,EACRJ,OAAO,CAACgB,GAAG,EACXX,GAAG,EACHL,OAAO,CAACiB,GAAG,EACXjB,OAAO,CAACkB,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,EACxB;MAAEC,IAAI,EAAEpB,OAAO,CAACoB;IAAK,CAAC,EACtBpB,OAAO,CAACqB,IACV,CAAC;IACD,IAAI,CAACN,OAAO,EAAEO,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHlC,OAAO,CAACsB,KAAK,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"app-delete.js","names":["frodo","Option","s","deleteApplication","deleteApplications","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","addHelpText","amBaseUrl","connId","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","appId","status","deep","process","exitCode","all","help","parse"],"sources":["../../../src/cli/app/app-delete.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport * as s from '../../help/SampleData';\nimport {\n deleteApplication,\n deleteApplications,\n} from '../../ops/ApplicationOps';\nimport { verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo app delete');\n\nprogram\n .description('Delete applications.')\n .addOption(\n new Option(\n '-i, --app-id <id>',\n 'Application name. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option('-a, --all', 'Delete all applications. Ignored with -i.')\n )\n .addOption(\n new Option(\n '--no-deep',\n 'No deep delete. This leaves orphaned configuration artifacts behind.'\n )\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 ` Delete application 'myApp':\\n` +\n ` $ frodo app delete -i 'myApp' ${s.amBaseUrl}\\n`['brightCyan'] +\n ` Delete all applications:\\n` +\n ` $ frodo app delete -a ${s.connId}\\n`['brightCyan']\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 // delete app by name\n if (options.appId && (await getTokens())) {\n verboseMessage('Deleting application...');\n const status = await deleteApplication(options.appId, options.deep);\n if (!status) process.exitCode = 1;\n }\n // -a/--all\n else if (options.all && (await getTokens())) {\n verboseMessage('Deleting all applications...');\n const status = await deleteApplications(options.deep);\n if (!status) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n verboseMessage('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,iBAAiB,EACjBC,kBAAkB,QACb,0BAA0B;AACjC,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGP,KAAK,CAACQ,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,kBAAkB,CAAC;AAEpDG,OAAO,CACJC,WAAW,CAAC,sBAAsB,CAAC,CACnCC,SAAS,CACR,IAAIV,MAAM,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,IAAI,CAACD,MAAM,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK;IACHtB,cAAc,CAAC,sDAAsD,CAAC;IACtEI,OAAO,CAACoB,IAAI,CAAC,CAAC;IACdH,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHlB,OAAO,CAACqB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"app-delete.js","names":["frodo","Option","s","deleteApplication","deleteApplications","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","addHelpText","amBaseUrl","connId","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","appId","status","deep","process","exitCode","all","help","parse"],"sources":["../../../src/cli/app/app-delete.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport * as s from '../../help/SampleData';\nimport {\n deleteApplication,\n deleteApplications,\n} from '../../ops/ApplicationOps';\nimport { verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo app delete');\n\nprogram\n .description('Delete applications.')\n .addOption(\n new Option(\n '-i, --app-id <id>',\n 'Application name. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option('-a, --all', 'Delete all applications. Ignored with -i.')\n )\n .addOption(\n new Option(\n '--no-deep',\n 'No deep delete. This leaves orphaned configuration artifacts behind.'\n )\n )\n .addHelpText(\n 'after',\n `Important Note:\\n`['brightYellow'] +\n ` The ${'frodo app'['brightCyan']} command to manage OAuth2 clients in v1.x has been renamed to ${'frodo oauth client'['brightCyan']} in v2.x\\n` +\n ` The ${'frodo app'['brightCyan']} command in v2.x manages the new applications created using the new application templates in ForgeRock Identity Cloud. To manage oauth clients, use the ${'frodo oauth client'['brightCyan']} command.\\n\\n` +\n `Usage Examples:\\n` +\n ` Delete application 'myApp':\\n` +\n ` $ frodo app delete -i 'myApp' ${s.amBaseUrl}\\n`['brightCyan'] +\n ` Delete all applications:\\n` +\n ` $ frodo app delete -a ${s.connId}\\n`['brightCyan']\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 // delete app by name\n if (options.appId && (await getTokens())) {\n verboseMessage('Deleting application...');\n const status = await deleteApplication(options.appId, options.deep);\n if (!status) process.exitCode = 1;\n }\n // -a/--all\n else if (options.all && (await getTokens())) {\n verboseMessage('Deleting all applications...');\n const status = await deleteApplications(options.deep);\n if (!status) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n verboseMessage('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,iBAAiB,EACjBC,kBAAkB,QACb,0BAA0B;AACjC,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGP,KAAK,CAACQ,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,kBAAkB,CAAC;AAEpDG,OAAO,CACJC,WAAW,CAAC,sBAAsB,CAAC,CACnCC,SAAS,CACR,IAAIV,MAAM,CACR,mBAAmB,EACnB,wDACF,CACF,CAAC,CACAU,SAAS,CACR,IAAIV,MAAM,CAAC,WAAW,EAAE,2CAA2C,CACrE,CAAC,CACAU,SAAS,CACR,IAAIV,MAAM,CACR,WAAW,EACX,sEACF,CACF,CAAC,CACAW,WAAW,CACV,OAAO,EACN,mBAAkB,CAAC,cAAc,CAAC,GAChC,SAAQ,WAAW,CAAC,YAAY,CAAE,iEAAgE,oBAAoB,CAAC,YAAY,CAAE,YAAW,GAChJ,SAAQ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":["frodo","Option","s","FrodoCommand","getTokens","login","program","description","addOption","addHelpText","connId","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","process","exitCode","parse"],"sources":["../../../src/cli/app/app-describe.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport * as s from '../../help/SampleData';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo app describe');\n\nprogram\n .description('Describe application.')\n .addOption(new Option('-i, --app-id <id>', 'Application name.'))\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 ` Describe application 'myApp':\\n` +\n ` $ frodo app describe -i myApp ${s.connId}\\n`['brightCyan'] +\n ` Describe application 'myApp' in raw JSON:\\n` +\n ` $ frodo app describe -i myApp --json ${s.connId}\\n`['brightCyan']\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 (await getTokens()) {\n // code goes here\n } else {\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,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGJ,KAAK,CAACK,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,oBAAoB,CAAC;AAEtDG,OAAO,CACJC,WAAW,CAAC,uBAAuB,CAAC,CACpCC,SAAS,CAAC,IAAIP,MAAM,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC,CAC/DQ,WAAW,CACV,OAAO,EACN,mBAAkB,CAAC,cAAc,CAAC,GAChC,SACC,WAAW,CAAC,YAAY,CACzB,iEACC,oBAAoB,CAAC,YAAY,CAClC,YAAW,GACX,SACC,WAAW,CAAC,YAAY,CACzB,2JACC,oBAAoB,CAAC,YAAY,CAClC,eAAc,GACd,mBAAkB,GAClB,mCAAkC,GAClC,mCAAkCP,CAAC,CAACQ,MAAO,IAAG,CAAC,YAAY,CAAC,GAC5D,+CAA8C,GAC9C,0CAAyCR,CAAC,CAACQ,MAAO,IAAG,CAAC,YAAY,CACvE,CAAC,CACAC,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,IAAI,MAAMb,SAAS,CAAC,CAAC,EAAE;IACrB;EAAA,CACD,MAAM;IACLe,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHd,OAAO,CAACe,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"app-describe.js","names":["frodo","Option","s","FrodoCommand","getTokens","login","program","description","addOption","addHelpText","connId","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","process","exitCode","parse"],"sources":["../../../src/cli/app/app-describe.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport * as s from '../../help/SampleData';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo app describe');\n\nprogram\n .description('Describe application.')\n .addOption(new Option('-i, --app-id <id>', 'Application name.'))\n .addHelpText(\n 'after',\n `Important Note:\\n`['brightYellow'] +\n ` The ${'frodo app'['brightCyan']} command to manage OAuth2 clients in v1.x has been renamed to ${'frodo oauth client'['brightCyan']} in v2.x\\n` +\n ` The ${'frodo app'['brightCyan']} command in v2.x manages the new applications created using the new application templates in ForgeRock Identity Cloud. To manage oauth clients, use the ${'frodo oauth client'['brightCyan']} command.\\n\\n` +\n `Usage Examples:\\n` +\n ` Describe application 'myApp':\\n` +\n ` $ frodo app describe -i myApp ${s.connId}\\n`['brightCyan'] +\n ` Describe application 'myApp' in raw JSON:\\n` +\n ` $ frodo app describe -i myApp --json ${s.connId}\\n`['brightCyan']\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 (await getTokens()) {\n // code goes here\n } else {\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,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGJ,KAAK,CAACK,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,oBAAoB,CAAC;AAEtDG,OAAO,CACJC,WAAW,CAAC,uBAAuB,CAAC,CACpCC,SAAS,CAAC,IAAIP,MAAM,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC,CAC/DQ,WAAW,CACV,OAAO,EACN,mBAAkB,CAAC,cAAc,CAAC,GAChC,SAAQ,WAAW,CAAC,YAAY,CAAE,iEAAgE,oBAAoB,CAAC,YAAY,CAAE,YAAW,GAChJ,SAAQ,WAAW,CAAC,YAAY,CAAE,2JAA0J,oBAAoB,CAAC,YAAY,CAAE,eAAc,GAC7O,mBAAkB,GAClB,mCAAkC,GAClC,mCAAkCP,CAAC,CAACQ,MAAO,IAAG,CAAC,YAAY,CAAC,GAC5D,+CAA8C,GAC9C,0CAAyCR,CAAC,CAACQ,MAAO,IAAG,CAAC,YAAY,CACvE,CAAC,CACAC,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,IAAI,MAAMb,SAAS,CAAC,CAAC,EAAE;IACrB;EAAA,CACD,MAAM;IACLe,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHd,OAAO,CAACe,KAAK,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"app-export.js","names":["frodo","Option","s","exportApplicationsToFile","exportApplicationsToFiles","exportApplicationToFile","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","addHelpText","connId","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","appId","status","file","metadata","useStringArrays","deps","process","exitCode","all","allSeparate","help","parse"],"sources":["../../../src/cli/app/app-export.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport * as s from '../../help/SampleData';\nimport {\n exportApplicationsToFile,\n exportApplicationsToFiles,\n exportApplicationToFile,\n} from '../../ops/ApplicationOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo app export');\n\nprogram\n .description('Export applications.')\n .addOption(\n new Option(\n '-i, --app-id <app-id>',\n 'Application name. If specified, -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the export file.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Export all applications to a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all applications to separate files (*.application.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option(\n '-N, --no-metadata',\n 'Does not include metadata in the export file.'\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 ` Export all applications to a single export file with an auto-generated filename using a connection profile:\\n` +\n ` $ frodo app export -a ${s.connId}\\n`['brightCyan'] +\n ` Export the first application to a single export file with a custom filename:\\n` +\n ` $ frodo app export -f ./allMyApplications.application.json ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Export all applications to separate export files with an auto-generated filenames:\\n` +\n ` $ frodo app export -A ${s.connId}\\n`['brightCyan'] +\n ` Export all applications without dependencies to a single export file:\\n` +\n ` $ frodo app export --no-deps -a ${s.connId}\\n`['brightCyan'] +\n ` Export the application 'myApp' to a file with an auto-generated filename of 'myApp.application.json':\\n` +\n ` $ frodo app export -i myApp ${s.connId}\\n`['brightCyan']\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.appId && (await getTokens())) {\n verboseMessage('Exporting application...');\n const status = await exportApplicationToFile(\n options.appId,\n options.file,\n options.metadata,\n {\n useStringArrays: true,\n deps: options.deps,\n }\n );\n if (!status) process.exitCode = 1;\n }\n // -a/--all\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all applications to file...');\n const status = await exportApplicationsToFile(\n options.file,\n options.metadata,\n {\n useStringArrays: true,\n deps: options.deps,\n }\n );\n if (!status) process.exitCode = 1;\n }\n // -A/--all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all applications to separate files...');\n const status = await exportApplicationsToFiles(options.metadata, {\n useStringArrays: true,\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n verboseMessage('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,wBAAwB,EACxBC,yBAAyB,EACzBC,uBAAuB,QAClB,0BAA0B;AACjC,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGR,KAAK,CAACS,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,kBAAkB,CAAC;AAEpDG,OAAO,CACJC,WAAW,CAAC,sBAAsB,CAAC,CACnCC,SAAS,CACR,IAAIX,MAAM,CACR,uBAAuB,EACvB,wDACF,CACF,CAAC,CACAW,SAAS,CAAC,IAAIX,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAAC,CACtEW,SAAS,CACR,IAAIX,MAAM,CACR,WAAW,EACX,4DACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,oBAAoB,EACpB,iHACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,mBAAmB,EACnB,+CACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CAAC,WAAW,EAAE,4CAA4C,CACtE,CAAC,CACAY,WAAW,CACV,OAAO,EACN,mBAAkB,CAAC,cAAc,CAAC,GAChC,SACC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uC,CAAC;IACvD,MAAMkB,MAAM,GAAG,MAAMrB,wBAAwB,CAC3CiB,OAAO,CAACK,IAAI,EACZL,OAAO,CAACM,QAAQ,EAChB;MACEC,eAAe,EAAE,IAAI;MACrBC,IAAI,EAAER,OAAO,CAACQ;IAChB,CACF,CAAC;IACD,IAAI,CAACJ,MAAM,EAAEK,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK,IAAIV,OAAO,CAACY,WAAW,KAAK,MAAMxB,SAAS,CAAC,CAAC,CAAC,EAAE;IACnDF,cAAc,CAAC,iDAAiD,CAAC;IACjE,MAAMkB,MAAM,GAAG,MAAMpB,yBAAyB,CAACgB,OAAO,CAACM,QAAQ,EAAE;MAC/DC,eAAe,EAAE,IAAI;MACrBC,IAAI,EAAER,OAAO,CAACQ;IAChB,CAAC,CAAC;IACF,IAAI,CAACJ,MAAM,EAAEK,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK;IACHxB,cAAc,CAAC,sDAAsD,CAAC;IACtEI,OAAO,CAACuB,IAAI,CAAC,CAAC;IACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHpB,OAAO,CAACwB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"app-export.js","names":["frodo","Option","s","exportApplicationsToFile","exportApplicationsToFiles","exportApplicationToFile","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","addHelpText","connId","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","appId","status","file","metadata","useStringArrays","deps","process","exitCode","all","allSeparate","help","parse"],"sources":["../../../src/cli/app/app-export.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport * as s from '../../help/SampleData';\nimport {\n exportApplicationsToFile,\n exportApplicationsToFiles,\n exportApplicationToFile,\n} from '../../ops/ApplicationOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo app export');\n\nprogram\n .description('Export applications.')\n .addOption(\n new Option(\n '-i, --app-id <app-id>',\n 'Application name. If specified, -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the export file.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Export all applications to a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all applications to separate files (*.application.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option(\n '-N, --no-metadata',\n 'Does not include metadata in the export file.'\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 ${'frodo app'['brightCyan']} command to manage OAuth2 clients in v1.x has been renamed to ${'frodo oauth client'['brightCyan']} in v2.x\\n` +\n ` The ${'frodo app'['brightCyan']} command in v2.x manages the new applications created using the new application templates in ForgeRock Identity Cloud. To manage oauth clients, use the ${'frodo oauth client'['brightCyan']} command.\\n\\n` +\n `Usage Examples:\\n` +\n ` Export all applications to a single export file with an auto-generated filename using a connection profile:\\n` +\n ` $ frodo app export -a ${s.connId}\\n`['brightCyan'] +\n ` Export the first application to a single export file with a custom filename:\\n` +\n ` $ frodo app export -f ./allMyApplications.application.json ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Export all applications to separate export files with an auto-generated filenames:\\n` +\n ` $ frodo app export -A ${s.connId}\\n`['brightCyan'] +\n ` Export all applications without dependencies to a single export file:\\n` +\n ` $ frodo app export --no-deps -a ${s.connId}\\n`['brightCyan'] +\n ` Export the application 'myApp' to a file with an auto-generated filename of 'myApp.application.json':\\n` +\n ` $ frodo app export -i myApp ${s.connId}\\n`['brightCyan']\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.appId && (await getTokens())) {\n verboseMessage('Exporting application...');\n const status = await exportApplicationToFile(\n options.appId,\n options.file,\n options.metadata,\n {\n useStringArrays: true,\n deps: options.deps,\n }\n );\n if (!status) process.exitCode = 1;\n }\n // -a/--all\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all applications to file...');\n const status = await exportApplicationsToFile(\n options.file,\n options.metadata,\n {\n useStringArrays: true,\n deps: options.deps,\n }\n );\n if (!status) process.exitCode = 1;\n }\n // -A/--all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all applications to separate files...');\n const status = await exportApplicationsToFiles(options.metadata, {\n useStringArrays: true,\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n verboseMessage('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,wBAAwB,EACxBC,yBAAyB,EACzBC,uBAAuB,QAClB,0BAA0B;AACjC,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGR,KAAK,CAACS,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,kBAAkB,CAAC;AAEpDG,OAAO,CACJC,WAAW,CAAC,sBAAsB,CAAC,CACnCC,SAAS,CACR,IAAIX,MAAM,CACR,uBAAuB,EACvB,wDACF,CACF,CAAC,CACAW,SAAS,CAAC,IAAIX,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAAC,CACtEW,SAAS,CACR,IAAIX,MAAM,CACR,WAAW,EACX,4DACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,oBAAoB,EACpB,iHACF,C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,IAAI,EAAER,OAAO,CAACQ;IAChB,CACF,CAAC;IACD,IAAI,CAACJ,MAAM,EAAEK,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK,IAAIV,OAAO,CAACW,GAAG,KAAK,MAAMvB,SAAS,CAAC,CAAC,CAAC,EAAE;IAC3CF,cAAc,CAAC,uCAAuC,CAAC;IACvD,MAAMkB,MAAM,GAAG,MAAMrB,wBAAwB,CAC3CiB,OAAO,CAACK,IAAI,EACZL,OAAO,CAACM,QAAQ,EAChB;MACEC,eAAe,EAAE,IAAI;MACrBC,IAAI,EAAER,OAAO,CAACQ;IAChB,CACF,CAAC;IACD,IAAI,CAACJ,MAAM,EAAEK,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK,IAAIV,OAAO,CAACY,WAAW,KAAK,MAAMxB,SAAS,CAAC,CAAC,CAAC,EAAE;IACnDF,cAAc,CAAC,iDAAiD,CAAC;IACjE,MAAMkB,MAAM,GAAG,MAAMpB,yBAAyB,CAACgB,OAAO,CAACM,QAAQ,EAAE;MAC/DC,eAAe,EAAE,IAAI;MACrBC,IAAI,EAAER,OAAO,CAACQ;IAChB,CAAC,CAAC;IACF,IAAI,CAACJ,MAAM,EAAEK,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK;IACHxB,cAAc,CAAC,sDAAsD,CAAC;IACtEI,OAAO,CAACuB,IAAI,CAAC,CAAC;IACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHpB,OAAO,CAACwB,KAAK,CAAC,CAAC"}
@@ -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","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,EAC3BC,8BAA8B,QACzB,0BAA0B;AACjC,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,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AAc,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
+ {"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 ${'frodo app'['brightCyan']} command to manage OAuth2 clients in v1.x has been renamed to ${'frodo oauth client'['brightCyan']} in v2.x\\n` +\n ` The ${'frodo app'['brightCyan']} command in v2.x manages the new applications created using the new application templates in ForgeRock Identity Cloud. To manage oauth clients, use the ${'frodo oauth client'['brightCyan']} 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,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,mBAAkB,CAAC,cAAc,CAAC,GAChC,SAAQ,WAAW,CAAC,YAAY,CAAE,iEAAg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c,OAAO,CAACG,IAAK,MACjE,CAAC;IACD,MAAME,MAAM,GAAG,MAAMvB,0BAA0B,CAACkB,OAAO,CAACG,IAAI,EAAE;MAC5DG,IAAI,EAAEN,OAAO,CAACM;IAChB,CAAC,CAAC;IACF,IAAI,CAACD,MAAM,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK,IAAIR,OAAO,CAACU,WAAW,IAAI,CAACV,OAAO,CAACG,IAAI,KAAK,MAAMf,SAAS,CAAC,CAAC,CAAC,EAAE;IACpEF,cAAc,CACZ,wEACF,CAAC;IACD,MAAMmB,MAAM,GAAG,MAAMtB,2BAA2B,CAAC;MAC/CuB,IAAI,EAAEN,OAAO,CAACM;IAChB,CAAC,CAAC;IACF,IAAI,CAACD,MAAM,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;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 +1 @@
1
- {"version":3,"file":"app-list.js","names":["frodo","Option","s","listApplications","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","addHelpText","amBaseUrl","username","password","connId","action","host","realm","user","options","command","handleDefaultArgsAndOpts","long","process","exitCode","parse"],"sources":["../../../src/cli/app/app-list.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport * as s from '../../help/SampleData';\nimport { listApplications } from '../../ops/ApplicationOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo app list');\n\nprogram\n .description('List applications.')\n .addOption(\n new Option('-l, --long', 'Long with all fields.').default(false, 'false')\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 ` List applications using AM base URL, username, and password (note the quotes around password to allow special characters):\\n` +\n ` $ frodo app list ${s.amBaseUrl} ${s.username} '${s.password}'\\n`[\n 'brightCyan'\n ] +\n ` List applications using a connection profile (identified by the full AM base URL):\\n` +\n ` $ frodo app list ${s.amBaseUrl}\\n`['brightCyan'] +\n ` List applications using a connection profile (identified by a unique substring of the AM base URL):\\n` +\n ` $ frodo app list ${s.connId}\\n`['brightCyan']\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 (await getTokens()) {\n verboseMessage(`Listing applications...`);\n await listApplications(options.long);\n } else {\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,SAASC,gBAAgB,QAAQ,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AG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHlB,OAAO,CAACmB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"app-list.js","names":["frodo","Option","s","listApplications","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","addHelpText","amBaseUrl","username","password","connId","action","host","realm","user","options","command","handleDefaultArgsAndOpts","long","process","exitCode","parse"],"sources":["../../../src/cli/app/app-list.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport * as s from '../../help/SampleData';\nimport { listApplications } from '../../ops/ApplicationOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo app list');\n\nprogram\n .description('List applications.')\n .addOption(\n new Option('-l, --long', 'Long with all fields.').default(false, 'false')\n )\n .addHelpText(\n 'after',\n `Important Note:\\n`['brightYellow'] +\n ` The ${'frodo app'['brightCyan']} command to manage OAuth2 clients in v1.x has been renamed to ${'frodo oauth client'['brightCyan']} in v2.x\\n` +\n ` The ${'frodo app'['brightCyan']} command in v2.x manages the new applications created using the new application templates in ForgeRock Identity Cloud. To manage oauth clients, use the ${'frodo oauth client'['brightCyan']} command.\\n\\n` +\n `Usage Examples:\\n` +\n ` List applications using AM base URL, username, and password (note the quotes around password to allow special characters):\\n` +\n ` $ frodo app list ${s.amBaseUrl} ${s.username} '${s.password}'\\n`[\n 'brightCyan'\n ] +\n ` List applications using a connection profile (identified by the full AM base URL):\\n` +\n ` $ frodo app list ${s.amBaseUrl}\\n`['brightCyan'] +\n ` List applications using a connection profile (identified by a unique substring of the AM base URL):\\n` +\n ` $ frodo app list ${s.connId}\\n`['brightCyan']\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 (await getTokens()) {\n verboseMessage(`Listing applications...`);\n await listApplications(options.long);\n } else {\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,SAASC,gBAAgB,QAAQ,0BAA0B;AAC3D,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGN,KAAK,CAACO,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,gBAAgB,CAAC;AAElDG,OAAO,CACJC,WAAW,CAAC,oBAAoB,CAAC,CACjCC,SAAS,CACR,IAAIT,MAAM,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAACU,OAAO,CAAC,KAAK,EAAE,OAAO,CAC1E,CAAC,CACAC,WAAW,CACV,OAAO,EACN,mBAAkB,CAAC,cAAc,CAAC,GAChC,SAAQ,WAAW,CAAC,YAAY,CAAE,iEAAgE,oBAAoB,CAAC,YAAY,CAAE,YAAW,GAChJ,SAAQ,WAAW,CAAC,YAAY,CAAE,2JAA0J,oBAAoB,CAAC,YAAY,CAAE,eAAc,GAC7O,mBAAkB,GAClB,gIAA+H,GAC/H,sBAAqBV,CAAC,CAACW,SAAU,IAAGX,CAAC,CAACY,QAAS,KAAIZ,CAAC,CAACa,QAAS,KAAI,CACjE,YAAY,CACb,GACA,wFAAuF,GACvF,sBAAqBb,CAAC,CAACW,SAAU,IAAG,CAAC,YAAY,CAAC,GAClD,yGAAwG,GACxG,sBAAqBX,CAAC,CAACc,MAAO,IAAG,CAAC,YAAY,CACnD,CAAC,CACAC,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEL,QAAQ,EAAEM,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BL,IAAI,EACJC,KAAK,EACLC,IAAI,EACJL,QAAQ,EACRM,OAAO,EACPC,OACF,CAAC;EACD,IAAI,MAAMhB,SAAS,CAAC,CAAC,EAAE;IACrBF,cAAc,CAAE,yBAAwB,CAAC;IACzC,MAAMD,gBAAgB,CAACkB,OAAO,CAACG,IAAI,CAAC;EACtC,CAAC,MAAM;IACLC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHlB,OAAO,CAACmB,KAAK,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","names":["path","fileURLToPath","FrodoStubCommand","__dirname","dirname","import","meta","url","setup","program","description","executableDir","addHelpText","command"],"sources":["../../../src/cli/app/app.ts"],"sourcesContent":["import path from 'path';\nimport { fileURLToPath } from 'url';\n\nimport { FrodoStubCommand } from '../FrodoCommand';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport default function setup() {\n const program = new FrodoStubCommand('app')\n .description('Manage applications.')\n .executableDir(__dirname)\n .addHelpText(\n 'after',\n `\\nImportant 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 );\n\n program.command('list', 'List applications.');\n\n // program\n // .command('describe', 'Describe applications.');\n\n program.command('export', 'Export applications.');\n\n program.command('import', 'Import applications.');\n\n program.command('delete', 'Delete applications.');\n\n return program;\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,SAASC,gBAAgB,QAAQ,iBAAiB;AAElD,MAAMC,SAAS,GAAGH,IAAI,CAACI,OAAO,CAACH,aAAa,CAACI,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAE9D,eAAe,SAASC,KAAKA,CAAA,EAAG;EAC9B,MAAMC,OAAO,GAAG,IAAIP,gBAAgB,CAAC,KAAK,CAAC,CACxCQ,WAAW,CAAC,sBAAsB,CAAC,CACnCC,aAAa,CAACR,SAAS,CAAC,CACxBS,WAAW,CACV,OAAO,EACN,qBAAoB,CAAC,cAAc,CAAC,GAClC,SACC,WAAW,CAAC,YAAY,CACzB,iEACC,oBAAoB,CAAC,YAAY,CAClC,YAAW,GACX,SACC,WAAW,CAAC,YAAY,CACzB,2JACC,oBAAoB,CAAC,YAAY,CAClC,eACL,CAAC;EAEHH,OAAO,CAACI,OAAO,CAAC,MAAM,EAAE,oBAAoB,CAAC;;EAE7C;EACA;;EAEAJ,OAAO,CAACI,OAAO,CAAC,QAAQ,EAAE,sBAAsB,CAAC;EAEjDJ,OAAO,CAACI,OAAO,CAAC,QAAQ,EAAE,sBAAsB,CAAC;EAEjDJ,OAAO,CAACI,OAAO,CAAC,QAAQ,EAAE,sBAAsB,CAAC;EAEjD,OAAOJ,OAAO;AAChB"}
1
+ {"version":3,"file":"app.js","names":["path","fileURLToPath","FrodoStubCommand","__dirname","dirname","import","meta","url","setup","program","description","executableDir","addHelpText","command"],"sources":["../../../src/cli/app/app.ts"],"sourcesContent":["import path from 'path';\nimport { fileURLToPath } from 'url';\n\nimport { FrodoStubCommand } from '../FrodoCommand';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport default function setup() {\n const program = new FrodoStubCommand('app')\n .description('Manage applications.')\n .executableDir(__dirname)\n .addHelpText(\n 'after',\n `\\nImportant Note:\\n`['brightYellow'] +\n ` The ${'frodo app'['brightCyan']} command to manage OAuth2 clients in v1.x has been renamed to ${'frodo oauth client'['brightCyan']} in v2.x\\n` +\n ` The ${'frodo app'['brightCyan']} command in v2.x manages the new applications created using the new application templates in ForgeRock Identity Cloud. To manage oauth clients, use the ${'frodo oauth client'['brightCyan']} command.\\n\\n`\n );\n\n program.command('list', 'List applications.');\n\n // program\n // .command('describe', 'Describe applications.');\n\n program.command('export', 'Export applications.');\n\n program.command('import', 'Import applications.');\n\n program.command('delete', 'Delete applications.');\n\n return program;\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,SAASC,gBAAgB,QAAQ,iBAAiB;AAElD,MAAMC,SAAS,GAAGH,IAAI,CAACI,OAAO,CAACH,aAAa,CAACI,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAE9D,eAAe,SAASC,KAAKA,CAAA,EAAG;EAC9B,MAAMC,OAAO,GAAG,IAAIP,gBAAgB,CAAC,KAAK,CAAC,CACxCQ,WAAW,CAAC,sBAAsB,CAAC,CACnCC,aAAa,CAACR,SAAS,CAAC,CACxBS,WAAW,CACV,OAAO,EACN,qBAAoB,CAAC,cAAc,CAAC,GAClC,SAAQ,WAAW,CAAC,YAAY,CAAE,iEAAgE,oBAAoB,CAAC,YAAY,CAAE,YAAW,GAChJ,SAAQ,WAAW,CAAC,YAAY,CAAE,2JAA0J,oBAAoB,CAAC,YAAY,CAAE,eACpO,CAAC;EAEHH,OAAO,CAACI,OAAO,CAAC,MAAM,EAAE,oBAAoB,CAAC;;EAE7C;EACA;;EAEAJ,OAAO,CAACI,OAAO,CAAC,QAAQ,EAAE,sBAAsB,CAAC;EAEjDJ,OAAO,CAACI,OAAO,CAAC,QAAQ,EAAE,sBAAsB,CAAC;EAEjDJ,OAAO,CAACI,OAAO,CAAC,QAAQ,EAAE,sBAAsB,CAAC;EAEjD,OAAOJ,OAAO;AAChB"}
@@ -1,19 +1,24 @@
1
1
  import { frodo } from '@rockcarver/frodo-lib';
2
2
  import { Option } from 'commander';
3
- import { createVersionOfSecret } from '../../ops/SecretsOps';
3
+ import { createVersionOfSecret, createVersionOfSecretFromFile } from '../../ops/SecretsOps';
4
4
  import { verboseMessage } from '../../utils/Console.js';
5
5
  import { FrodoCommand } from '../FrodoCommand';
6
6
  const {
7
7
  getTokens
8
8
  } = frodo.login;
9
9
  const program = new FrodoCommand('frodo esv secret version create');
10
- program.description('Create new version of secret.').addOption(new Option('-i, --secret-id <secret-id>', 'Secret id.')).addOption(new Option('--value <value>', 'Secret value.')).action(
10
+ program.description('Create new version of secret.').addOption(new Option('-i, --secret-id <secret-id>', 'Secret id.')).addOption(new Option('--value <value>', 'Secret value.')).addOption(new Option('-f, --file [file]', 'Name of the file to read pem or base64hmac encoded secret from. Ignored if --value is specified')).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
14
  if (await getTokens()) {
15
15
  verboseMessage('Creating new version of secret...');
16
- const outcome = await createVersionOfSecret(options.secretId, options.value);
16
+ let outcome = null;
17
+ if (options.value) {
18
+ outcome = await createVersionOfSecret(options.secretId, options.value);
19
+ } else {
20
+ outcome = await createVersionOfSecretFromFile(options.secretId, options.file);
21
+ }
17
22
  if (!outcome) process.exitCode = 1;
18
23
  } else {
19
24
  process.exitCode = 1;
@@ -1 +1 @@
1
- {"version":3,"file":"esv-secret-version-create.js","names":["frodo","Option","createVersionOfSecret","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","outcome","secretId","value","process","exitCode","parse"],"sources":["../../../src/cli/esv/esv-secret-version-create.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { createVersionOfSecret } from '../../ops/SecretsOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo esv secret version create');\n\nprogram\n .description('Create new version of secret.')\n .addOption(new Option('-i, --secret-id <secret-id>', 'Secret id.'))\n .addOption(new Option('--value <value>', 'Secret value.'))\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 (await getTokens()) {\n verboseMessage('Creating new version of secret...');\n const outcome = await createVersionOfSecret(\n options.secretId,\n options.value\n );\n if (!outcome) process.exitCode = 1;\n } else {\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,SAASC,qBAAqB,QAAQ,sBAAsB;AAC5D,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGL,KAAK,CAACM,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,iCAAiC,CAAC;AAEnEG,OAAO,CACJC,WAAW,CAAC,+BAA+B,CAAC,CAC5CC,SAAS,CAAC,IAAIR,MAAM,CAAC,6BAA6B,EAAE,YAAY,CAAC,CAAC,CAClEQ,SAAS,CAAC,IAAIR,MAAM,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC,CACzDS,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,IAAI,MAAMX,SAAS,CAAC,CAAC,EAAE;IACrBF,cAAc,CAAC,mCAAmC,CAAC;IACnD,MAAMe,OAAO,GAAG,MAAMhB,qBAAqB,CACzCa,OAAO,CAACI,QAAQ,EAChBJ,OAAO,CAACK,KACV,CAAC;IACD,IAAI,CAACF,OAAO,EAAEG,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHf,OAAO,CAACgB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"esv-secret-version-create.js","names":["frodo","Option","createVersionOfSecret","createVersionOfSecretFromFile","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","outcome","value","secretId","file","process","exitCode","parse"],"sources":["../../../src/cli/esv/esv-secret-version-create.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n createVersionOfSecret,\n createVersionOfSecretFromFile,\n} from '../../ops/SecretsOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo esv secret version create');\n\nprogram\n .description('Create new version of secret.')\n .addOption(new Option('-i, --secret-id <secret-id>', 'Secret id.'))\n .addOption(new Option('--value <value>', 'Secret value.'))\n .addOption(\n new Option(\n '-f, --file [file]',\n 'Name of the file to read pem or base64hmac encoded secret from. Ignored if --value is specified'\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 (await getTokens()) {\n verboseMessage('Creating new version of secret...');\n let outcome = null;\n if (options.value) {\n outcome = await createVersionOfSecret(\n options.secretId,\n options.value\n );\n } else {\n outcome = await createVersionOfSecretFromFile(\n options.secretId,\n options.file\n );\n }\n if (!outcome) process.exitCode = 1;\n } else {\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,qBAAqB,EACrBC,6BAA6B,QACxB,sBAAsB;AAC7B,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGN,KAAK,CAACO,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,iCAAiC,CAAC;AAEnEG,OAAO,CACJC,WAAW,CAAC,+BAA+B,CAAC,CAC5CC,SAAS,CAAC,IAAIT,MAAM,CAAC,6BAA6B,EAAE,YAAY,CAAC,CAAC,CAClES,SAAS,CAAC,IAAIT,MAAM,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC,CACzDS,SAAS,CACR,IAAIT,MAAM,CACR,mBAAmB,EACnB,iGACF,CACF,CAAC,CACAU,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,IAAI,MAAMX,SAAS,CAAC,CAAC,EAAE;IACrBF,cAAc,CAAC,mCAAmC,CAAC;IACnD,IAAIe,OAAO,GAAG,IAAI;IAClB,IAAIH,OAAO,CAACI,KAAK,EAAE;MACjBD,OAAO,GAAG,MAAMjB,qBAAqB,CACnCc,OAAO,CAACK,QAAQ,EAChBL,OAAO,CAACI,KACV,CAAC;IACH,CAAC,MAAM;MACLD,OAAO,GAAG,MAAMhB,6BAA6B,CAC3Ca,OAAO,CAACK,QAAQ,EAChBL,OAAO,CAACM,IACV,CAAC;IACH;IACA,IAAI,CAACH,OAAO,EAAEI,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHhB,OAAO,CAACiB,KAAK,CAAC,CAAC"}
@@ -79,6 +79,7 @@ export async function describeConnectionProfile(host, showSecrets) {
79
79
  }
80
80
  const keyMap = {
81
81
  tenant: 'Host',
82
+ deploymentType: 'Deployment Type',
82
83
  username: 'Username',
83
84
  password: 'Password',
84
85
  logApiKey: 'Log API Key',
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectionProfileOps.js","names":["frodo","state","fs","createObjectTable","createTable","debugMessage","failSpinner","printMessage","showSpinner","succeedSpinner","getAccessTokenForServiceAccount","login","getConnectionProfilesPath","getConnectionProfileByHost","conn","listConnectionProfiles","long","filename","data","readFileSync","connectionsData","JSON","parse","Object","keys","length","table","forEach","c","push","svcacctName","svcacctId","username","logApiKey","toString","e","message","describeConnectionProfile","host","showSecrets","profile","present","jwk","svcacctJwk","password","logApiSecret","authenticationService","keyMap","tenant","authenticationHeaderOverrides","stringify","addExistingServiceAccount","serviceAccountId","privateKeyFile","validate","token","setServiceAccountId","setServiceAccountJwk","err"],"sources":["../../src/ops/ConnectionProfileOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\n\nimport {\n createObjectTable,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n succeedSpinner,\n} from '../utils/Console';\n\nconst { getAccessTokenForServiceAccount } = frodo.login;\nconst { getConnectionProfilesPath, getConnectionProfileByHost } = frodo.conn;\n\n/**\n * List connection profiles\n * @param {boolean} long Long list format with details\n * @param {State} state library state\n */\nexport function listConnectionProfiles(long = false) {\n const filename = getConnectionProfilesPath();\n try {\n const data = fs.readFileSync(filename, 'utf8');\n const connectionsData = JSON.parse(data);\n if (Object.keys(connectionsData).length < 1) {\n printMessage(`No connections defined yet in ${filename}`, 'info');\n } else {\n if (long) {\n const table = createTable([\n 'Host',\n 'Service Account',\n 'Username',\n 'Log API Key',\n ]);\n Object.keys(connectionsData).forEach((c) => {\n table.push([\n c,\n connectionsData[c].svcacctName || connectionsData[c].svcacctId,\n connectionsData[c].username,\n connectionsData[c].logApiKey,\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n Object.keys(connectionsData).forEach((c) => {\n printMessage(`${c}`, 'data');\n });\n // getUniqueNames(5, Object.keys(connectionsData));\n }\n printMessage(\n 'Any unique substring of a saved host can be used as the value for host parameter in all commands',\n 'info'\n );\n }\n } catch (e) {\n printMessage(`No connections found in ${filename} (${e.message})`, 'error');\n }\n}\n\n/**\n * Describe connection profile\n * @param {string} host Host URL or unique substring\n * @param {boolean} showSecrets Whether secrets should be shown in clear text or not\n */\nexport async function describeConnectionProfile(\n host: string,\n showSecrets: boolean\n) {\n debugMessage(`ConnectionProfileOps.describeConnectionProfile: start`);\n const profile = await getConnectionProfileByHost(host);\n if (profile) {\n debugMessage(profile);\n const present = '[present]';\n const jwk = profile.svcacctJwk;\n if (!showSecrets) {\n if (profile.password) profile.password = present;\n if (profile.logApiSecret) profile.logApiSecret = present;\n if (profile.svcacctJwk) (profile as unknown)['svcacctJwk'] = present;\n }\n if (!profile.username) {\n delete profile.username;\n delete profile.password;\n }\n if (!profile.logApiKey) {\n delete profile.logApiKey;\n delete profile.logApiSecret;\n }\n if (!profile.svcacctId) {\n delete profile.svcacctId;\n delete profile.svcacctJwk;\n delete profile.svcacctName;\n }\n if (showSecrets && jwk) {\n (profile as unknown)['svcacctJwk'] = 'see below';\n }\n if (!profile.authenticationService) {\n delete profile.authenticationService;\n }\n const keyMap = {\n tenant: 'Host',\n username: 'Username',\n password: 'Password',\n logApiKey: 'Log API Key',\n logApiSecret: 'Log API Secret',\n authenticationService: 'Authentication Service',\n authenticationHeaderOverrides: 'Authentication Header Overrides',\n svcacctName: 'Service Account Name',\n svcacctId: 'Service Account Id',\n svcacctJwk: 'Service Account JWK',\n };\n const table = createObjectTable(profile, keyMap);\n printMessage(table.toString(), 'data');\n if (showSecrets && jwk) {\n printMessage(JSON.stringify(jwk), 'data');\n }\n } else {\n printMessage(`No connection profile ${host} found`);\n }\n debugMessage(`ConnectionProfileOps.describeConnectionProfile: end`);\n}\n\nexport async function addExistingServiceAccount(\n serviceAccountId: string,\n privateKeyFile: string,\n validate: boolean\n): Promise<boolean> {\n try {\n const data = fs.readFileSync(privateKeyFile);\n const jwk = JSON.parse(data.toString());\n if (validate) {\n showSpinner(`Validating service account ${serviceAccountId}...`);\n const token = await getAccessTokenForServiceAccount(\n serviceAccountId,\n jwk\n );\n if (token === null) {\n failSpinner(`Failed to validate service account ${serviceAccountId}.`);\n return false;\n } else {\n succeedSpinner(\n `Successfully validated service account ${serviceAccountId}.`\n );\n }\n }\n state.setServiceAccountId(serviceAccountId);\n state.setServiceAccountJwk(jwk);\n return true;\n } catch (err) {\n failSpinner(\n `Failed to validate service account ${serviceAccountId}: ${err}.`\n );\n }\n return false;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,cAAc,QACT,kBAAkB;AAEzB,MAAM;EAAEC;AAAgC,CAAC,GAAGV,KAAK,CAACW,KAAK;AACvD,MAAM;EAAEC,yBAAyB;EAAEC;AAA2B,CAAC,GAAGb,KAAK,CAACc,IAAI;;AAE5E;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAACC,IAAI,GAAG,KAAK,EAAE;EACnD,MAAMC,QAAQ,GAAGL,yBAAyB,CAAC,CAAC;EAC5C,IAAI;IACF,MAAMM,IAAI,GAAGhB,EAAE,CAACiB,YAAY,CAACF,QAAQ,EAAE,MAAM,CAAC;IAC9C,MAAMG,eAAe,GAAGC,IAAI,CAACC,KAAK,CAACJ,IAAI,CAAC;IACxC,IAAIK,MAAM,CAACC,IAAI,CAACJ,eAAe,CAAC,CAACK,MAAM,GAAG,CAAC,EAAE;MAC3ClB,YAAY,CAAE,iCAAgCU,QAAS,EAAC,EAAE,MAAM,CAAC;IACnE,CAAC,MAAM;MACL,IAAID,IAAI,EAAE;QACR,MAAMU,KAAK,GAAGtB,WAAW,CAAC,CACxB,MAAM,EACN,iBAAiB,EACjB,UAAU,EACV,aAAa,CACd,CAAC;QACFmB,MAAM,CAACC,IAAI,CAACJ,e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AAK,QAAO,CAAC;EACrD;EACAjC,YAAY,CAAE,qDAAoD,CAAC;AACrE;AAEA,OAAO,eAAe8C,yBAAyBA,CAC7CC,gBAAwB,EACxBC,cAAsB,EACtBC,QAAiB,EACC;EAClB,IAAI;IACF,MAAMpC,IAAI,GAAGhB,EAAE,CAACiB,YAAY,CAACkC,cAAc,CAAC;IAC5C,MAAMX,GAAG,GAAGrB,IAAI,CAACC,KAAK,CAACJ,IAAI,CAACgB,QAAQ,CAAC,CAAC,CAAC;IACvC,IAAIoB,QAAQ,EAAE;MACZ9C,WAAW,CAAE,8BAA6B4C,gBAAiB,KAAI,CAAC;MAChE,MAAMG,KAAK,GAAG,MAAM7C,+BAA+B,CACjD0C,gBAAgB,EAChBV,GACF,CAAC;MACD,IAAIa,KAAK,KAAK,IAAI,EAAE;QAClBjD,WAAW,CAAE,sCAAqC8C,gBAAiB,GAAE,CAAC;QACtE,OAAO,KAAK;MACd,CAAC,MAAM;QACL3C,cAAc,CACX,0CAAyC2C,gBAAiB,GAC7D,CAAC;MACH;IACF;IACAnD,KAAK,CAACuD,mBAAmB,CAACJ,gBAAgB,CAAC;IAC3CnD,KAAK,CAACwD,oBAAoB,CAACf,GAAG,CAAC;IAC/B,OAAO,IAAI;EACb,CAAC,CAAC,OAAOgB,GAAG,EAAE;IACZpD,WAAW,CACR,sCAAqC8C,gBAAiB,KAAIM,GAAI,GACjE,CAAC;EACH;EACA,OAAO,KAAK;AACd"}
1
+ {"version":3,"file":"ConnectionProfileOps.js","names":["frodo","state","fs","createObjectTable","createTable","debugMessage","failSpinner","printMessage","showSpinner","succeedSpinner","getAccessTokenForServiceAccount","login","getConnectionProfilesPath","getConnectionProfileByHost","conn","listConnectionProfiles","long","filename","data","readFileSync","connectionsData","JSON","parse","Object","keys","length","table","forEach","c","push","svcacctName","svcacctId","username","logApiKey","toString","e","message","describeConnectionProfile","host","showSecrets","profile","present","jwk","svcacctJwk","password","logApiSecret","authenticationService","keyMap","tenant","deploymentType","authenticationHeaderOverrides","stringify","addExistingServiceAccount","serviceAccountId","privateKeyFile","validate","token","setServiceAccountId","setServiceAccountJwk","err"],"sources":["../../src/ops/ConnectionProfileOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\n\nimport {\n createObjectTable,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n succeedSpinner,\n} from '../utils/Console';\n\nconst { getAccessTokenForServiceAccount } = frodo.login;\nconst { getConnectionProfilesPath, getConnectionProfileByHost } = frodo.conn;\n\n/**\n * List connection profiles\n * @param {boolean} long Long list format with details\n * @param {State} state library state\n */\nexport function listConnectionProfiles(long = false) {\n const filename = getConnectionProfilesPath();\n try {\n const data = fs.readFileSync(filename, 'utf8');\n const connectionsData = JSON.parse(data);\n if (Object.keys(connectionsData).length < 1) {\n printMessage(`No connections defined yet in ${filename}`, 'info');\n } else {\n if (long) {\n const table = createTable([\n 'Host',\n 'Service Account',\n 'Username',\n 'Log API Key',\n ]);\n Object.keys(connectionsData).forEach((c) => {\n table.push([\n c,\n connectionsData[c].svcacctName || connectionsData[c].svcacctId,\n connectionsData[c].username,\n connectionsData[c].logApiKey,\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n Object.keys(connectionsData).forEach((c) => {\n printMessage(`${c}`, 'data');\n });\n // getUniqueNames(5, Object.keys(connectionsData));\n }\n printMessage(\n 'Any unique substring of a saved host can be used as the value for host parameter in all commands',\n 'info'\n );\n }\n } catch (e) {\n printMessage(`No connections found in ${filename} (${e.message})`, 'error');\n }\n}\n\n/**\n * Describe connection profile\n * @param {string} host Host URL or unique substring\n * @param {boolean} showSecrets Whether secrets should be shown in clear text or not\n */\nexport async function describeConnectionProfile(\n host: string,\n showSecrets: boolean\n) {\n debugMessage(`ConnectionProfileOps.describeConnectionProfile: start`);\n const profile = await getConnectionProfileByHost(host);\n if (profile) {\n debugMessage(profile);\n const present = '[present]';\n const jwk = profile.svcacctJwk;\n if (!showSecrets) {\n if (profile.password) profile.password = present;\n if (profile.logApiSecret) profile.logApiSecret = present;\n if (profile.svcacctJwk) (profile as unknown)['svcacctJwk'] = present;\n }\n if (!profile.username) {\n delete profile.username;\n delete profile.password;\n }\n if (!profile.logApiKey) {\n delete profile.logApiKey;\n delete profile.logApiSecret;\n }\n if (!profile.svcacctId) {\n delete profile.svcacctId;\n delete profile.svcacctJwk;\n delete profile.svcacctName;\n }\n if (showSecrets && jwk) {\n (profile as unknown)['svcacctJwk'] = 'see below';\n }\n if (!profile.authenticationService) {\n delete profile.authenticationService;\n }\n const keyMap = {\n tenant: 'Host',\n deploymentType: 'Deployment Type',\n username: 'Username',\n password: 'Password',\n logApiKey: 'Log API Key',\n logApiSecret: 'Log API Secret',\n authenticationService: 'Authentication Service',\n authenticationHeaderOverrides: 'Authentication Header Overrides',\n svcacctName: 'Service Account Name',\n svcacctId: 'Service Account Id',\n svcacctJwk: 'Service Account JWK',\n };\n const table = createObjectTable(profile, keyMap);\n printMessage(table.toString(), 'data');\n if (showSecrets && jwk) {\n printMessage(JSON.stringify(jwk), 'data');\n }\n } else {\n printMessage(`No connection profile ${host} found`);\n }\n debugMessage(`ConnectionProfileOps.describeConnectionProfile: end`);\n}\n\nexport async function addExistingServiceAccount(\n serviceAccountId: string,\n privateKeyFile: string,\n validate: boolean\n): Promise<boolean> {\n try {\n const data = fs.readFileSync(privateKeyFile);\n const jwk = JSON.parse(data.toString());\n if (validate) {\n showSpinner(`Validating service account ${serviceAccountId}...`);\n const token = await getAccessTokenForServiceAccount(\n serviceAccountId,\n jwk\n );\n if (token === null) {\n failSpinner(`Failed to validate service account ${serviceAccountId}.`);\n return false;\n } else {\n succeedSpinner(\n `Successfully validated service account ${serviceAccountId}.`\n );\n }\n }\n state.setServiceAccountId(serviceAccountId);\n state.setServiceAccountJwk(jwk);\n return true;\n } catch (err) {\n failSpinner(\n `Failed to validate service account ${serviceAccountId}: ${err}.`\n );\n }\n return false;\n}\n"],"mappings":"AAAA,SAASA,KAAK,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,CAAC,CAAC;IACvC,IAAIqB,QAAQ,EAAE;MACZ/C,WAAW,CAAE,8BAA6B6C,gBAAiB,KAAI,CAAC;MAChE,MAAMG,KAAK,GAAG,MAAM9C,+BAA+B,CACjD2C,gBAAgB,EAChBX,GACF,CAAC;MACD,IAAIc,KAAK,KAAK,IAAI,EAAE;QAClBlD,WAAW,CAAE,sCAAqC+C,gBAAiB,GAAE,CAAC;QACtE,OAAO,KAAK;MACd,CAAC,MAAM;QACL5C,cAAc,CACX,0CAAyC4C,gBAAiB,GAC7D,CAAC;MACH;IACF;IACApD,KAAK,CAACwD,mBAAmB,CAACJ,gBAAgB,CAAC;IAC3CpD,KAAK,CAACyD,oBAAoB,CAAChB,GAAG,CAAC;IAC/B,OAAO,IAAI;EACb,CAAC,CAAC,OAAOiB,GAAG,EAAE;IACZrD,WAAW,CACR,sCAAqC+C,gBAAiB,KAAIM,GAAI,GACjE,CAAC;EACH;EACA,OAAO,KAAK;AACd"}
@@ -1 +1 @@
1
- {"version":3,"file":"Saml2Ops.js","names":["frodo","fs","createObjectTable","createProgressIndicator","createTable","debugMessage","printMessage","stopProgressIndicator","updateProgressIndicator","decodeBase64","saveTextToFile","getFilePath","getWorkingDirectory","utils","getTypedFilename","saveJsonToFile","getRealmString","validateImport","readSaml2ProviderStubs","readSaml2Provider","readSaml2ProviderStub","getSaml2ProviderMetadataUrl","getSaml2ProviderMetadata","exportSaml2Provider","exportSaml2Providers","importSaml2Provider","importSaml2Providers","saml2","entityProvider","roleMap","identityProvider","serviceProvider","attributeQueryProvider","xacmlPolicyEnforcementPoint","getOneLineDescription","saml2ProviderObj","roles","key","value","Object","entries","push","description","entityId","entityLocation","length","join","getTableHeaderMd","markdown","getTableRowMd","row","listSaml2Providers","long","providerList","sort","a","b","_id","localeCompare","provider","table","location","map","role","toString","describeSaml2Provider","stub","rawProviderData","_rev","metadataUrl","error","message","exportSaml2MetadataToFile","file","filePath","indicatorId","metaData","brightCyan","exportSaml2ProviderToFile","includeMeta","options","deps","fileData","err","exportSaml2ProvidersToFile","exportData","_error$response","response","status","exportSaml2ProvidersToFiles","stubs","importSaml2ProviderFromFile","data","readFileSync","JSON","parse","importFirstSaml2ProviderFromFile","entityId64","keys","saml","remote","hosted","importSaml2ProvidersFromFile","meta","importSaml2ProvidersFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","total","result"],"sources":["../../src/ops/Saml2Ops.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { type Saml2ProviderSkeleton } from '@rockcarver/frodo-lib/types/api/Saml2Api';\nimport type {\n Saml2EntitiesExportOptions,\n Saml2EntitiesImportOptions,\n Saml2ExportInterface,\n} from '@rockcarver/frodo-lib/types/ops/Saml2Ops';\nimport fs from 'fs';\n\nimport {\n createObjectTable,\n createProgressIndicator,\n createTable,\n debugMessage,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\n\nconst { decodeBase64, saveTextToFile, getFilePath, getWorkingDirectory } =\n frodo.utils;\nconst { getTypedFilename, saveJsonToFile, getRealmString, validateImport } =\n frodo.utils;\nconst {\n readSaml2ProviderStubs,\n readSaml2Provider,\n readSaml2ProviderStub,\n getSaml2ProviderMetadataUrl,\n getSaml2ProviderMetadata,\n exportSaml2Provider,\n exportSaml2Providers,\n importSaml2Provider,\n importSaml2Providers,\n} = frodo.saml2.entityProvider;\n\nconst roleMap = {\n identityProvider: 'IDP',\n serviceProvider: 'SP',\n attributeQueryProvider: 'AttrQuery',\n xacmlPolicyEnforcementPoint: 'XACML PEP',\n};\n\n/**\n * Get a one-line description of the saml2 provider object\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(\n saml2ProviderObj: Saml2ProviderSkeleton\n): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const description = `[${saml2ProviderObj.entityId['brightCyan']}]${\n ' (' + saml2ProviderObj.entityLocation\n }${roles.length ? ' ' + roles.join(', ') + ')' : ')'}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Entity Id | Location | Role(s) |\\n';\n markdown += '| --------- | -------- | ------- |';\n return markdown;\n}\n\n/**\n * Get a table-row of the saml2 provider in markdown\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a table-row of the saml2 provider in markdown\n */\nexport function getTableRowMd(saml2ProviderObj: Saml2ProviderSkeleton): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const row = `| ${saml2ProviderObj.entityId} | ${\n saml2ProviderObj.entityLocation\n } | ${roles.length ? roles.join(', ') : ''} |`;\n return row;\n}\n\n/**\n * List entity providers\n * @param {boolean} long Long list format with details\n */\nexport async function listSaml2Providers(long = false) {\n const providerList = await readSaml2ProviderStubs();\n providerList.sort((a, b) => a._id.localeCompare(b._id));\n if (!long) {\n for (const provider of providerList) {\n printMessage(`${provider.entityId}`, 'data');\n }\n } else {\n const table = createTable([\n 'Entity Id'['brightCyan'],\n 'Location'['brightCyan'],\n 'Role(s)'['brightCyan'],\n ]);\n for (const provider of providerList) {\n table.push([\n provider.entityId,\n provider.location,\n provider.roles.map((role) => roleMap[role]).join(', '),\n ]);\n }\n printMessage(table.toString(), 'data');\n }\n}\n\n/**\n * Describe an entity provider's configuration\n * @param {String} entityId Provider entity id\n */\nexport async function describeSaml2Provider(entityId) {\n try {\n const stub = await readSaml2ProviderStub(entityId);\n const { location } = stub;\n const roles = stub.roles.map((role: string) => roleMap[role]).join(', ');\n const rawProviderData = await readSaml2Provider(entityId);\n delete rawProviderData._id;\n delete rawProviderData._rev;\n rawProviderData.location = location;\n rawProviderData.roles = roles;\n rawProviderData.metadataUrl = getSaml2ProviderMetadataUrl(entityId);\n const table = createObjectTable(rawProviderData);\n printMessage(table.toString(), 'data');\n } catch (error) {\n printMessage(error.message, 'error');\n }\n}\n\n/**\n * Export provider metadata to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n */\nexport async function exportSaml2MetadataToFile(entityId, file = null) {\n if (!file) {\n file = getTypedFilename(entityId, 'metadata', 'xml');\n }\n const filePath = getFilePath(file, true);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting metadata for: ${entityId}`\n );\n try {\n updateProgressIndicator(indicatorId, `Writing file ${filePath}`);\n const metaData = await getSaml2ProviderMetadata(entityId);\n saveTextToFile(metaData, filePath);\n updateProgressIndicator(indicatorId, `Exported provider ${entityId}`);\n stopProgressIndicator(\n indicatorId,\n // @ts-expect-error - brightCyan colors the string, even though it is not a property of string\n `Exported ${entityId.brightCyan} metadata to ${filePath.brightCyan}.`\n );\n } catch (error) {\n stopProgressIndicator(indicatorId, `${error}`);\n printMessage(error, 'error');\n }\n}\n\n/**\n * Export a single entity provider to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSaml2ProviderToFile(\n entityId: string,\n file: string = null,\n includeMeta = true,\n options: Saml2EntitiesExportOptions = { deps: true }\n) {\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: start [entityId=${entityId}, file=${file}]`\n );\n if (!file) {\n file = getTypedFilename(entityId, 'saml');\n }\n const filePath = getFilePath(file, true);\n let indicatorId: string;\n try {\n indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting provider ${entityId}`\n );\n const fileData = await exportSaml2Provider(entityId, options);\n saveJsonToFile(fileData, filePath, includeMeta);\n updateProgressIndicator(indicatorId, `Exported provider ${entityId}`);\n stopProgressIndicator(\n indicatorId,\n // @ts-expect-error - brightCyan colors the string, even though it is not a property of string\n `Exported ${entityId.brightCyan} to ${filePath.brightCyan}.`\n );\n } catch (err) {\n stopProgressIndicator(indicatorId, `${err}`);\n printMessage(err, 'error');\n }\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: end [entityId=${entityId}, file=${filePath}]`\n );\n}\n\n/**\n * Export all entity providers to one file\n * @param {String} file Optional filename\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSaml2ProvidersToFile(\n file: string = null,\n includeMeta = true,\n options: Saml2EntitiesExportOptions = { deps: true }\n) {\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [file=${file}]`);\n if (!file) {\n file = getTypedFilename(`all${getRealmString()}Providers`, 'saml');\n }\n try {\n const exportData = await exportSaml2Providers(options);\n saveJsonToFile(exportData, getFilePath(file, true), includeMeta);\n } catch (error) {\n printMessage(error.message, 'error');\n printMessage(\n `exportSaml2ProvidersToFile: ${error.response?.status}`,\n 'error'\n );\n }\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: end [file=${file}]`);\n}\n\n/**\n * Export all entity providers to individual files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSaml2ProvidersToFiles(\n includeMeta = true,\n options: Saml2EntitiesExportOptions = { deps: true }\n) {\n const stubs = await readSaml2ProviderStubs();\n if (stubs.length > 0) {\n const indicatorId = createProgressIndicator(\n 'determinate',\n stubs.length,\n 'Exporting providers'\n );\n for (const stub of stubs) {\n const file = getFilePath(getTypedFilename(stub.entityId, 'saml'), true);\n const fileData = await exportSaml2Provider(stub.entityId, options);\n saveJsonToFile(fileData, file, includeMeta);\n updateProgressIndicator(\n indicatorId,\n `Exported provider ${stub.entityId}`\n );\n }\n stopProgressIndicator(indicatorId, `${stubs.length} providers exported.`);\n } else {\n printMessage('No entity providers found.', 'info');\n }\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} entityId Provider entity id\n * @param {String} file Import file name\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importSaml2ProviderFromFile(\n entityId: string,\n file: string,\n options: Saml2EntitiesImportOptions = { deps: true }\n) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${entityId}...`\n );\n try {\n await importSaml2Provider(entityId, fileData, options);\n stopProgressIndicator(indicatorId, `Imported ${entityId}.`, 'success');\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing ${entityId}: ${error.message}`,\n 'fail'\n );\n }\n } catch (error) {\n printMessage(\n `Error importing saml2 provider ${entityId}: ${error}`,\n 'error'\n );\n }\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} file Import file name\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importFirstSaml2ProviderFromFile(\n file: string, \n options: Saml2EntitiesImportOptions = { deps: true }) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data) as Saml2ExportInterface;\n // pick the first provider and run with it\n const entityId64 =\n Object.keys(fileData.saml.remote)[0] ||\n Object.keys(fileData.saml.hosted)[0];\n const entityId = decodeBase64(entityId64);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${entityId}...`\n );\n try {\n await importSaml2Provider(entityId, fileData, options);\n stopProgressIndicator(indicatorId, `Imported ${entityId}.`, 'success');\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing ${entityId}: ${error.message}`,\n 'fail'\n );\n }\n } catch (error) {\n printMessage(`Error importing first saml2 provider: ${error}`, 'error');\n }\n}\n\n/**\n * Import all SAML entity providers from file\n * @param {String} file Import file name\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importSaml2ProvidersFromFile(\n file: string,\n options: Saml2EntitiesImportOptions = { deps: true }\n) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n await importSaml2Providers(fileData, options);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n } catch (error) {\n printMessage(`Error importing saml2 providers: ${error}`, 'error');\n }\n}\n\n/**\n * Import all SAML entity providers from all *.saml.json files in the current directory\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importSaml2ProvidersFromFiles(\n options: Saml2EntitiesImportOptions = { deps: true }\n) {\n const names = fs.readdirSync(getWorkingDirectory());\n const jsonFiles = names\n .filter((name) => name.toLowerCase().endsWith('.saml.json'))\n .map((name) => getFilePath(name));\n const indicatorId = createProgressIndicator(\n 'determinate',\n jsonFiles.length,\n 'Importing providers...'\n );\n let total = 0;\n for (const file of jsonFiles) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n const result = await importSaml2Providers(fileData, options);\n total += result.length;\n updateProgressIndicator(\n indicatorId,\n `Imported ${result.length} provider(s) from ${file}.`\n );\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n } catch (error) {\n printMessage(\n `Error importing providers from ${file}: ${error.message}`,\n 'error'\n );\n }\n }\n stopProgressIndicator(\n indicatorId,\n `Imported ${total} provider(s) from ${jsonFiles.length} file(s).`\n );\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAO7C,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AAEzB,MAAM;EAAEC,YAAY;EAAEC,cAAc;EAAEC,WAAW;EAAEC;AAAoB,CAAC,GACtEZ,KAAK,CAACa,KAAK;AACb,MAAM;EAAEC,gBAAgB;EAAEC,cAAc;EAAEC,cAAc;EAAEC;AAAe,CAAC,GACxEjB,KAAK,CAACa,KAAK;AACb,MAAM;EACJK,sBAAsB;EACtBC,iBAAiB;EACjBC,qBAAqB;EACrBC,2BAA2B;EAC3BC,wBAAwB;EACxBC,mBAAmB;EACnBC,oBAAoB;EACpBC,mBAAmB;EACnBC;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AAG,CAAC;EACb,KAAK,MAAMvC,IAAI,IAAIkC,SAAS,EAAE;IAC5B,IAAI;MACF,MAAMf,IAAI,GAAG3F,EAAE,CAAC4F,YAAY,CAACpB,IAAI,EAAE,MAAM,CAAC;MAC1C,MAAMS,QAAQ,GAAGY,IAAI,CAACC,KAAK,CAACH,IAAI,CAAC;MACjC,IAAI3E,cAAc,CAACiE,QAAQ,CAACqB,IAAI,CAAC,EAAE;QACjC,MAAMU,MAAM,GAAG,MAAMvF,oBAAoB,CAACwD,QAAQ,EAAEF,OAAO,CAAC;QAC5DgC,KAAK,IAAIC,MAAM,CAACpE,MAAM;QACtBrC,uBAAuB,CACrBmE,WAAW,EACV,YAAWsC,MAAM,CAACpE,MAAO,qBAAoB4B,IAAK,GACrD,CAAC;MACH,CAAC,MAAM;QACLnE,YAAY,CAAE,iBAAgBmE,IAAK,UAAS,EAAE,OAAO,CAAC;MACxD;IACF,CAAC,CAAC,OAAOH,KAAK,EAAE;MACdhE,YAAY,CACT,kCAAiCmE,IAAK,KAAIH,KAAK,CAACC,OAAQ,EAAC,EAC1D,OACF,CAAC;IACH;EACF;EACAhE,qBAAqB,CACnBoE,WAAW,EACV,YAAWqC,KAAM,qBAAoBL,SAAS,CAAC9D,MAAO,WACzD,CAAC;AACH"}
1
+ {"version":3,"file":"Saml2Ops.js","names":["frodo","fs","createObjectTable","createProgressIndicator","createTable","debugMessage","printMessage","stopProgressIndicator","updateProgressIndicator","decodeBase64","saveTextToFile","getFilePath","getWorkingDirectory","utils","getTypedFilename","saveJsonToFile","getRealmString","validateImport","readSaml2ProviderStubs","readSaml2Provider","readSaml2ProviderStub","getSaml2ProviderMetadataUrl","getSaml2ProviderMetadata","exportSaml2Provider","exportSaml2Providers","importSaml2Provider","importSaml2Providers","saml2","entityProvider","roleMap","identityProvider","serviceProvider","attributeQueryProvider","xacmlPolicyEnforcementPoint","getOneLineDescription","saml2ProviderObj","roles","key","value","Object","entries","push","description","entityId","entityLocation","length","join","getTableHeaderMd","markdown","getTableRowMd","row","listSaml2Providers","long","providerList","sort","a","b","_id","localeCompare","provider","table","location","map","role","toString","describeSaml2Provider","stub","rawProviderData","_rev","metadataUrl","error","message","exportSaml2MetadataToFile","file","filePath","indicatorId","metaData","brightCyan","exportSaml2ProviderToFile","includeMeta","options","deps","fileData","err","exportSaml2ProvidersToFile","exportData","_error$response","response","status","exportSaml2ProvidersToFiles","stubs","importSaml2ProviderFromFile","data","readFileSync","JSON","parse","importFirstSaml2ProviderFromFile","entityId64","keys","saml","remote","hosted","importSaml2ProvidersFromFile","meta","importSaml2ProvidersFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","total","result"],"sources":["../../src/ops/Saml2Ops.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { type Saml2ProviderSkeleton } from '@rockcarver/frodo-lib/types/api/Saml2Api';\nimport type {\n Saml2EntitiesExportOptions,\n Saml2EntitiesImportOptions,\n Saml2ExportInterface,\n} from '@rockcarver/frodo-lib/types/ops/Saml2Ops';\nimport fs from 'fs';\n\nimport {\n createObjectTable,\n createProgressIndicator,\n createTable,\n debugMessage,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\n\nconst { decodeBase64, saveTextToFile, getFilePath, getWorkingDirectory } =\n frodo.utils;\nconst { getTypedFilename, saveJsonToFile, getRealmString, validateImport } =\n frodo.utils;\nconst {\n readSaml2ProviderStubs,\n readSaml2Provider,\n readSaml2ProviderStub,\n getSaml2ProviderMetadataUrl,\n getSaml2ProviderMetadata,\n exportSaml2Provider,\n exportSaml2Providers,\n importSaml2Provider,\n importSaml2Providers,\n} = frodo.saml2.entityProvider;\n\nconst roleMap = {\n identityProvider: 'IDP',\n serviceProvider: 'SP',\n attributeQueryProvider: 'AttrQuery',\n xacmlPolicyEnforcementPoint: 'XACML PEP',\n};\n\n/**\n * Get a one-line description of the saml2 provider object\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(\n saml2ProviderObj: Saml2ProviderSkeleton\n): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const description = `[${saml2ProviderObj.entityId['brightCyan']}]${\n ' (' + saml2ProviderObj.entityLocation\n }${roles.length ? ' ' + roles.join(', ') + ')' : ')'}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Entity Id | Location | Role(s) |\\n';\n markdown += '| --------- | -------- | ------- |';\n return markdown;\n}\n\n/**\n * Get a table-row of the saml2 provider in markdown\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a table-row of the saml2 provider in markdown\n */\nexport function getTableRowMd(saml2ProviderObj: Saml2ProviderSkeleton): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const row = `| ${saml2ProviderObj.entityId} | ${\n saml2ProviderObj.entityLocation\n } | ${roles.length ? roles.join(', ') : ''} |`;\n return row;\n}\n\n/**\n * List entity providers\n * @param {boolean} long Long list format with details\n */\nexport async function listSaml2Providers(long = false) {\n const providerList = await readSaml2ProviderStubs();\n providerList.sort((a, b) => a._id.localeCompare(b._id));\n if (!long) {\n for (const provider of providerList) {\n printMessage(`${provider.entityId}`, 'data');\n }\n } else {\n const table = createTable([\n 'Entity Id'['brightCyan'],\n 'Location'['brightCyan'],\n 'Role(s)'['brightCyan'],\n ]);\n for (const provider of providerList) {\n table.push([\n provider.entityId,\n provider.location,\n provider.roles.map((role) => roleMap[role]).join(', '),\n ]);\n }\n printMessage(table.toString(), 'data');\n }\n}\n\n/**\n * Describe an entity provider's configuration\n * @param {String} entityId Provider entity id\n */\nexport async function describeSaml2Provider(entityId) {\n try {\n const stub = await readSaml2ProviderStub(entityId);\n const { location } = stub;\n const roles = stub.roles.map((role: string) => roleMap[role]).join(', ');\n const rawProviderData = await readSaml2Provider(entityId);\n delete rawProviderData._id;\n delete rawProviderData._rev;\n rawProviderData.location = location;\n rawProviderData.roles = roles;\n rawProviderData.metadataUrl = getSaml2ProviderMetadataUrl(entityId);\n const table = createObjectTable(rawProviderData);\n printMessage(table.toString(), 'data');\n } catch (error) {\n printMessage(error.message, 'error');\n }\n}\n\n/**\n * Export provider metadata to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n */\nexport async function exportSaml2MetadataToFile(entityId, file = null) {\n if (!file) {\n file = getTypedFilename(entityId, 'metadata', 'xml');\n }\n const filePath = getFilePath(file, true);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting metadata for: ${entityId}`\n );\n try {\n updateProgressIndicator(indicatorId, `Writing file ${filePath}`);\n const metaData = await getSaml2ProviderMetadata(entityId);\n saveTextToFile(metaData, filePath);\n updateProgressIndicator(indicatorId, `Exported provider ${entityId}`);\n stopProgressIndicator(\n indicatorId,\n // @ts-expect-error - brightCyan colors the string, even though it is not a property of string\n `Exported ${entityId.brightCyan} metadata to ${filePath.brightCyan}.`\n );\n } catch (error) {\n stopProgressIndicator(indicatorId, `${error}`);\n printMessage(error, 'error');\n }\n}\n\n/**\n * Export a single entity provider to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSaml2ProviderToFile(\n entityId: string,\n file: string = null,\n includeMeta = true,\n options: Saml2EntitiesExportOptions = { deps: true }\n) {\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: start [entityId=${entityId}, file=${file}]`\n );\n if (!file) {\n file = getTypedFilename(entityId, 'saml');\n }\n const filePath = getFilePath(file, true);\n let indicatorId: string;\n try {\n indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting provider ${entityId}`\n );\n const fileData = await exportSaml2Provider(entityId, options);\n saveJsonToFile(fileData, filePath, includeMeta);\n updateProgressIndicator(indicatorId, `Exported provider ${entityId}`);\n stopProgressIndicator(\n indicatorId,\n // @ts-expect-error - brightCyan colors the string, even though it is not a property of string\n `Exported ${entityId.brightCyan} to ${filePath.brightCyan}.`\n );\n } catch (err) {\n stopProgressIndicator(indicatorId, `${err}`);\n printMessage(err, 'error');\n }\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: end [entityId=${entityId}, file=${filePath}]`\n );\n}\n\n/**\n * Export all entity providers to one file\n * @param {String} file Optional filename\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSaml2ProvidersToFile(\n file: string = null,\n includeMeta = true,\n options: Saml2EntitiesExportOptions = { deps: true }\n) {\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [file=${file}]`);\n if (!file) {\n file = getTypedFilename(`all${getRealmString()}Providers`, 'saml');\n }\n try {\n const exportData = await exportSaml2Providers(options);\n saveJsonToFile(exportData, getFilePath(file, true), includeMeta);\n } catch (error) {\n printMessage(error.message, 'error');\n printMessage(\n `exportSaml2ProvidersToFile: ${error.response?.status}`,\n 'error'\n );\n }\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: end [file=${file}]`);\n}\n\n/**\n * Export all entity providers to individual files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSaml2ProvidersToFiles(\n includeMeta = true,\n options: Saml2EntitiesExportOptions = { deps: true }\n) {\n const stubs = await readSaml2ProviderStubs();\n if (stubs.length > 0) {\n const indicatorId = createProgressIndicator(\n 'determinate',\n stubs.length,\n 'Exporting providers'\n );\n for (const stub of stubs) {\n const file = getFilePath(getTypedFilename(stub.entityId, 'saml'), true);\n const fileData = await exportSaml2Provider(stub.entityId, options);\n saveJsonToFile(fileData, file, includeMeta);\n updateProgressIndicator(\n indicatorId,\n `Exported provider ${stub.entityId}`\n );\n }\n stopProgressIndicator(indicatorId, `${stubs.length} providers exported.`);\n } else {\n printMessage('No entity providers found.', 'info');\n }\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} entityId Provider entity id\n * @param {String} file Import file name\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importSaml2ProviderFromFile(\n entityId: string,\n file: string,\n options: Saml2EntitiesImportOptions = { deps: true }\n) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${entityId}...`\n );\n try {\n await importSaml2Provider(entityId, fileData, options);\n stopProgressIndicator(indicatorId, `Imported ${entityId}.`, 'success');\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing ${entityId}: ${error.message}`,\n 'fail'\n );\n }\n } catch (error) {\n printMessage(\n `Error importing saml2 provider ${entityId}: ${error}`,\n 'error'\n );\n }\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} file Import file name\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importFirstSaml2ProviderFromFile(\n file: string,\n options: Saml2EntitiesImportOptions = { deps: true }\n) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data) as Saml2ExportInterface;\n // pick the first provider and run with it\n const entityId64 =\n Object.keys(fileData.saml.remote)[0] ||\n Object.keys(fileData.saml.hosted)[0];\n const entityId = decodeBase64(entityId64);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${entityId}...`\n );\n try {\n await importSaml2Provider(entityId, fileData, options);\n stopProgressIndicator(indicatorId, `Imported ${entityId}.`, 'success');\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing ${entityId}: ${error.message}`,\n 'fail'\n );\n }\n } catch (error) {\n printMessage(`Error importing first saml2 provider: ${error}`, 'error');\n }\n}\n\n/**\n * Import all SAML entity providers from file\n * @param {String} file Import file name\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importSaml2ProvidersFromFile(\n file: string,\n options: Saml2EntitiesImportOptions = { deps: true }\n) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n await importSaml2Providers(fileData, options);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n } catch (error) {\n printMessage(`Error importing saml2 providers: ${error}`, 'error');\n }\n}\n\n/**\n * Import all SAML entity providers from all *.saml.json files in the current directory\n * @param {Saml2ProviderImportOptions} options import options\n */\nexport async function importSaml2ProvidersFromFiles(\n options: Saml2EntitiesImportOptions = { deps: true }\n) {\n const names = fs.readdirSync(getWorkingDirectory());\n const jsonFiles = names\n .filter((name) => name.toLowerCase().endsWith('.saml.json'))\n .map((name) => getFilePath(name));\n const indicatorId = createProgressIndicator(\n 'determinate',\n jsonFiles.length,\n 'Importing providers...'\n );\n let total = 0;\n for (const file of jsonFiles) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n const result = await importSaml2Providers(fileData, options);\n total += result.length;\n updateProgressIndicator(\n indicatorId,\n `Imported ${result.length} provider(s) from ${file}.`\n );\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n } catch (error) {\n printMessage(\n `Error importing providers from ${file}: ${error.message}`,\n 'error'\n );\n }\n }\n stopProgressIndicator(\n indicatorId,\n `Imported ${total} provider(s) from ${jsonFiles.length} file(s).`\n );\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAO7C,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AAEzB,MAAM;EAAEC,YAAY;EAAEC,cAAc;EAAEC,WAAW;EAAEC;AAAoB,CAAC,GACtEZ,KAAK,CAACa,KAAK;AACb,MAAM;EAAEC,gBAAgB;EAAEC,cAAc;EAAEC,cAAc;EAA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CAC3DjD,GAAG,CAAE+C,IAAI,IAAKlG,WAAW,CAACkG,IAAI,CAAC,CAAC;EACnC,MAAMlC,WAAW,GAAGxE,uBAAuB,CACzC,aAAa,EACbwG,SAAS,CAAC9D,MAAM,EAChB,wBACF,CAAC;EACD,IAAImE,KAAK,GAAG,CAAC;EACb,KAAK,MAAMvC,IAAI,IAAIkC,SAAS,EAAE;IAC5B,IAAI;MACF,MAAMf,IAAI,GAAG3F,EAAE,CAAC4F,YAAY,CAACpB,IAAI,EAAE,MAAM,CAAC;MAC1C,MAAMS,QAAQ,GAAGY,IAAI,CAACC,KAAK,CAACH,IAAI,CAAC;MACjC,IAAI3E,cAAc,CAACiE,QAAQ,CAACqB,IAAI,CAAC,EAAE;QACjC,MAAMU,MAAM,GAAG,MAAMvF,oBAAoB,CAACwD,QAAQ,EAAEF,OAAO,CAAC;QAC5DgC,KAAK,IAAIC,MAAM,CAACpE,MAAM;QACtBrC,uBAAuB,CACrBmE,WAAW,EACV,YAAWsC,MAAM,CAACpE,MAAO,qBAAoB4B,IAAK,GACrD,CAAC;MACH,CAAC,MAAM;QACLnE,YAAY,CAAE,iBAAgBmE,IAAK,UAAS,EAAE,OAAO,CAAC;MACxD;IACF,CAAC,CAAC,OAAOH,KAAK,EAAE;MACdhE,YAAY,CACT,kCAAiCmE,IAAK,KAAIH,KAAK,CAACC,OAAQ,EAAC,EAC1D,OACF,CAAC;IACH;EACF;EACAhE,qBAAqB,CACnBoE,WAAW,EACV,YAAWqC,KAAM,qBAAoBL,SAAS,CAAC9D,MAAO,WACzD,CAAC;AACH"}
@@ -124,7 +124,7 @@ export async function createSecret(id, value, description, encoding, useInPlaceh
124
124
  }
125
125
 
126
126
  /**
127
- * Create PEM certificate from file
127
+ * Create secret from file (pem / base64hmac)
128
128
  * @param {string} id secret id
129
129
  * @param {string} file certificate file name
130
130
  * @param {string} description secret description
@@ -398,6 +398,26 @@ export async function createVersionOfSecret(secretId, value) {
398
398
  return outcome;
399
399
  }
400
400
 
401
+ /**
402
+ * Create new version of secret from file
403
+ * @param {string} secretId secret id
404
+ * @param {string} file filename
405
+ * @returns {Promise<boolean>} true if successful, false otherwise
406
+ */
407
+ export async function createVersionOfSecretFromFile(secretId, file) {
408
+ let outcome = false;
409
+ const value = fs.readFileSync(getFilePath(file), 'utf8');
410
+ const spinnerId = createProgressIndicator('indeterminate', 0, `Creating new version of secret ${secretId}...`);
411
+ try {
412
+ const version = await _createVersionOfSecret(secretId, value);
413
+ stopProgressIndicator(spinnerId, `Created version ${version.version} of secret ${secretId}`, 'success');
414
+ outcome = true;
415
+ } catch (error) {
416
+ stopProgressIndicator(spinnerId, `Error: ${error.response.data.code} - ${error.response.data.message}`, 'fail');
417
+ }
418
+ return outcome;
419
+ }
420
+
401
421
  /**
402
422
  * Activate a version of a secret
403
423
  * @param {String} secretId secret id
@@ -1 +1 @@
1
- {"version":3,"file":"SecretsOps.js","names":["frodo","state","fs","getFullExportConfig","isIdUsed","createKeyValueTable","createProgressIndicator","createTable","debugMessage","printMessage","stopProgressIndicator","updateProgressIndicator","wordwrap","resolveUserName","idm","managed","readSecrets","createSecret","_createSecret","readVersionsOfSecret","readSecret","exportSecret","exportSecrets","enableVersionOfSecret","disableVersionOfSecret","createVersionOfSecret","_createVersionOfSecret","updateSecretDescription","deleteSecret","_deleteSecret","deleteVersionOfSecret","_deleteVersionOfSecret","cloud","secret","getFilePath","getTypedFilename","saveJsonToFile","saveToFile","titleCase","utils","listSecrets","long","usage","file","spinnerId","secrets","sort","a","b","_id","localeCompare","length","error","_error$response","response","data","message","forEach","variable","fullExport","headers","hAlign","content","_error$response2","push","table","lastChangedBy","getUseBearerTokenForAmApis","values","activeVersion","loadedVersion","loaded","description","Date","lastChangeDate","toUTCString","isEsvUsed","used","location","toString","id","value","encoding","useInPlaceholders","outcome","code","createSecretFromFile","readFileSync","setSecretDescription","secretId","deleteSecrets","_error$response3","indicatorId","listSecretVersions","versions","_error$response4","statusMap","ENABLED","DISABLED","DESTROYED","version","status","createDate","toLocaleString","describeSecret","_error$response5","exportSecretToFile","includeMeta","fileName","filePath","fileData","_error$response6","exportSecretsToFile","getRealm","secretsExport","_error$response7","exportSecretsToFiles","_error$response8","activateVersionOfSecret","deactivateVersionOfSecret"],"sources":["../../src/ops/SecretsOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport {\n SecretEncodingType,\n SecretSkeleton,\n VersionOfSecretSkeleton,\n} from '@rockcarver/frodo-lib/types/api/cloud/SecretsApi';\nimport fs from 'fs';\n\nimport { getFullExportConfig, isIdUsed } from '../utils/Config';\nimport {\n createKeyValueTable,\n createProgressIndicator,\n createTable,\n debugMessage,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\nimport wordwrap from './utils/Wordwrap';\n\nconst { resolveUserName } = frodo.idm.managed;\nconst {\n readSecrets,\n createSecret: _createSecret,\n readVersionsOfSecret,\n readSecret,\n exportSecret,\n exportSecrets,\n enableVersionOfSecret,\n disableVersionOfSecret,\n createVersionOfSecret: _createVersionOfSecret,\n updateSecretDescription,\n deleteSecret: _deleteSecret,\n deleteVersionOfSecret: _deleteVersionOfSecret,\n} = frodo.cloud.secret;\n\nconst { getFilePath, getTypedFilename, saveJsonToFile, saveToFile, titleCase } =\n frodo.utils;\n\n/**\n * List secrets\n * @param {boolean} long Long version, all the fields besides usage\n * @param {boolean} usage Display usage field\n * @param {String | null} file Optional filename to determine usage\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listSecrets(\n long: boolean = false,\n usage: boolean = false,\n file: string | null = null\n): Promise<boolean> {\n let spinnerId: string;\n let secrets: SecretSkeleton[] = [];\n try {\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Reading secrets...`\n );\n secrets = await readSecrets();\n secrets.sort((a, b) => a._id.localeCompare(b._id));\n stopProgressIndicator(\n spinnerId,\n `Successfully read ${secrets.length} secrets.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error reading secrets: ${error.response?.data || error.message}`,\n 'fail'\n );\n return false;\n }\n if (!long && !usage) {\n secrets.forEach((variable) => {\n printMessage(variable._id, 'data');\n });\n return true;\n }\n let fullExport = null;\n const headers = long\n ? [\n 'Id'['brightCyan'],\n { hAlign: 'right', content: 'Active\\nVersion'['brightCyan'] },\n { hAlign: 'right', content: 'Loaded\\nVersion'['brightCyan'] },\n 'Status'['brightCyan'],\n 'Description'['brightCyan'],\n 'Modifier'['brightCyan'],\n 'Modified (UTC)'['brightCyan'],\n ]\n : ['Id'['brightCyan']];\n if (usage) {\n try {\n fullExport = await getFullExportConfig(file);\n } catch (error) {\n printMessage(\n `Error getting full export: ${error.response?.data || error.message}`,\n 'error'\n );\n return false;\n }\n //Delete secrets from full export so they aren't mistakenly used for determining usage\n delete fullExport.secrets;\n headers.push('Used'['brightCyan']);\n }\n const table = createTable(headers);\n for (const secret of secrets) {\n let lastChangedBy = secret.lastChangedBy;\n if (long) {\n try {\n lastChangedBy = state.getUseBearerTokenForAmApis()\n ? secret.lastChangedBy\n : await resolveUserName('teammember', secret.lastChangedBy);\n } catch (error) {\n // ignore\n }\n }\n const values = long\n ? [\n secret._id,\n { hAlign: 'right', content: secret.activeVersion },\n { hAlign: 'right', content: secret.loadedVersion },\n secret.loaded ? 'loaded'['brightGreen'] : 'unloaded'['brightRed'],\n wordwrap(secret.description, 40),\n lastChangedBy,\n new Date(secret.lastChangeDate).toUTCString(),\n ]\n : [secret._id];\n if (usage) {\n const isEsvUsed = isIdUsed(fullExport, secret._id, true);\n values.push(\n isEsvUsed.used\n ? `${'yes'['brightGreen']} (at ${isEsvUsed.location})`\n : 'no'['brightRed']\n );\n }\n table.push(values);\n }\n printMessage(table.toString(), 'data');\n return true;\n}\n\n/**\n * Create secret\n * @param {string} id secret id\n * @param {string} value secret value\n * @param {string} description secret description\n * @param {SecretEncodingType} encoding secret encoding\n * @param {boolean} useInPlaceholders use secret in placeholders\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function createSecret(\n id: string,\n value: string,\n description: string,\n encoding: SecretEncodingType,\n useInPlaceholders: boolean\n): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Creating secret ${id}...`\n );\n try {\n await _createSecret(id, value, description, encoding, useInPlaceholders);\n stopProgressIndicator(spinnerId, `Created secret ${id}`, 'success');\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n error.response\n ? `Error: ${error.response.data.code} - ${error.response.data.message}`\n : error,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Create PEM certificate from file\n * @param {string} id secret id\n * @param {string} file certificate file name\n * @param {string} description secret description\n * @param {SecretEncodingType} encoding secret encoding\n * @param {boolean} useInPlaceholders use secret in placeholders\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function createSecretFromFile(\n id: string,\n file: string,\n description: string,\n encoding: SecretEncodingType,\n useInPlaceholders: boolean\n): Promise<boolean> {\n let outcome = false;\n const value = fs.readFileSync(getFilePath(file), 'utf8');\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Creating secret ${id}...`\n );\n try {\n await _createSecret(id, value, description, encoding, useInPlaceholders);\n stopProgressIndicator(spinnerId, `Created secret ${id}`, 'success');\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n error.response\n ? `Error: ${error.response.data.code} - ${error.response.data.message}`\n : error,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Set description of secret\n * @param {string} secretId secret id\n * @param {string} description secret description\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function setSecretDescription(\n secretId: string,\n description: string\n): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Setting description of secret ${secretId}...`\n );\n try {\n await updateSecretDescription(secretId, description);\n stopProgressIndicator(\n spinnerId,\n `Set description of secret ${secretId}`,\n 'success'\n );\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Delete a secret\n * @param {string} secretId secret id\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteSecret(secretId: string): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Deleting secret ${secretId}...`\n );\n try {\n await _deleteSecret(secretId);\n stopProgressIndicator(spinnerId, `Deleted secret ${secretId}`, 'success');\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Delete all secrets\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteSecrets(): Promise<boolean> {\n let outcome = false;\n let secrets: SecretSkeleton[] = [];\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Reading secrets...`\n );\n try {\n secrets = await readSecrets();\n secrets.sort((a, b) => a._id.localeCompare(b._id));\n stopProgressIndicator(\n spinnerId,\n `Successfully read ${secrets.length} secrets.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error reading secrets: ${error.response?.data || error.message}`,\n 'fail'\n );\n }\n const indicatorId = createProgressIndicator(\n 'determinate',\n secrets.length,\n `Deleting secrets...`\n );\n try {\n for (const secret of secrets) {\n try {\n await _deleteSecret(secret._id);\n updateProgressIndicator(indicatorId, `Deleted secret ${secret._id}`);\n } catch (error) {\n printMessage(\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'error'\n );\n }\n }\n stopProgressIndicator(indicatorId, `Secrets deleted.`);\n outcome = true;\n } catch (error) {\n printMessage(\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'error'\n );\n }\n return outcome;\n}\n\n/**\n * List all the versions of the secret\n * @param {String} secretId secret id\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listSecretVersions(secretId): Promise<boolean> {\n let outcome = false;\n let spinnerId: string;\n let versions: VersionOfSecretSkeleton[] = [];\n try {\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Reading secret versions...`\n );\n versions = await readVersionsOfSecret(secretId);\n stopProgressIndicator(\n spinnerId,\n `Successfully read ${versions.length} secret versions.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error reading secret versions: ${error.response?.data || error.message}`,\n 'fail'\n );\n }\n const table = createTable([\n { hAlign: 'right', content: 'Version'['brightCyan'] },\n 'Status'['brightCyan'],\n 'Loaded'['brightCyan'],\n 'Created'['brightCyan'],\n ]);\n const statusMap = {\n ENABLED: 'active'['brightGreen'],\n DISABLED: 'inactive'['brightRed'],\n DESTROYED: 'deleted'['brightRed'],\n };\n for (const version of versions) {\n table.push([\n { hAlign: 'right', content: version.version },\n statusMap[version.status],\n version.loaded ? 'loaded'['brightGreen'] : 'unloaded'['brightRed'],\n new Date(version.createDate).toLocaleString(),\n ]);\n }\n printMessage(table.toString(), 'data');\n outcome = true;\n return outcome;\n}\n\n/**\n * Describe a secret\n * @param {string} secretId Secret id\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeSecret(secretId: string): Promise<boolean> {\n let outcome = false;\n let spinnerId: string;\n let secret: SecretSkeleton = null;\n try {\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Reading secret ${secretId}...`\n );\n secret = await readSecret(secretId);\n stopProgressIndicator(\n spinnerId,\n `Successfully read secret ${secretId}.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error reading secret ${secretId}: ${\n error.response?.data || error.message\n }`,\n 'fail'\n );\n }\n const table = createKeyValueTable();\n table.push(['Name'['brightCyan'], secret._id]);\n table.push(['Active Version'['brightCyan'], secret.activeVersion]);\n table.push(['Loaded Version'['brightCyan'], secret.loadedVersion]);\n table.push([\n 'Status'['brightCyan'],\n secret.loaded ? 'loaded'['brightGreen'] : 'unloaded'['brightRed'],\n ]);\n table.push(['Description'['brightCyan'], wordwrap(secret.description, 60)]);\n table.push([\n 'Modified'['brightCyan'],\n new Date(secret.lastChangeDate).toLocaleString(),\n ]);\n let lastChangedBy = secret.lastChangedBy;\n try {\n lastChangedBy = state.getUseBearerTokenForAmApis()\n ? secret.lastChangedBy\n : await resolveUserName('teammember', secret.lastChangedBy);\n } catch (error) {\n // ignore\n }\n table.push(['Modifier'['brightCyan'], lastChangedBy]);\n table.push(['Modifier UUID'['brightCyan'], secret.lastChangedBy]);\n table.push(['Encoding'['brightCyan'], secret.encoding]);\n table.push(['Use In Placeholders'['brightCyan'], secret.useInPlaceholders]);\n printMessage(table.toString(), 'data');\n printMessage('\\nSecret Versions:', 'data');\n await listSecretVersions(secretId);\n outcome = true;\n return outcome;\n}\n\n/**\n * Export a single secret to file\n * @param {String} secretId Secret id\n * @param {String} file Optional filename\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportSecretToFile(\n secretId: string,\n file: string | null,\n includeMeta: boolean\n): Promise<boolean> {\n debugMessage(\n `Cli.SecretsOps.exportSecretToFile: start [secretId=${secretId}, file=${file}]`\n );\n let outcome = false;\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(secretId, 'secret');\n }\n const filePath = getFilePath(fileName, true);\n let spinnerId: string;\n try {\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Exporting secret ${secretId}`\n );\n const fileData = await exportSecret(secretId);\n saveJsonToFile(fileData, filePath, includeMeta);\n stopProgressIndicator(\n spinnerId,\n `Exported ${secretId['brightCyan']} to ${filePath['brightCyan']}.`,\n 'success'\n );\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error exporting secret: ${error.response?.data || error.message}`,\n 'fail'\n );\n }\n debugMessage(\n `Cli.SecretsOps.exportSecretToFile: end [outcome=${outcome}, secretId=${secretId}, file=${file}]`\n );\n return outcome;\n}\n\n/**\n * Export all secrets to single file\n * @param {string} file Optional filename\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportSecretsToFile(\n file: string,\n includeMeta: boolean\n): Promise<boolean> {\n debugMessage(`Cli.SecretsOps.exportSecretsToFile: start [file=${file}]`);\n let outcome = false;\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(\n `all${titleCase(state.getRealm())}Secrets`,\n 'secret'\n );\n }\n try {\n const secretsExport = await exportSecrets();\n saveJsonToFile(secretsExport, getFilePath(fileName, true), includeMeta);\n outcome = true;\n } catch (error) {\n printMessage(error.message, 'error');\n printMessage(`exportSecretsToFile: ${error.response?.status}`, 'error');\n }\n debugMessage(`Cli.SecretsOps.exportSecretsToFile: end [file=${file}]`);\n return outcome;\n}\n\n/**\n * Export all secrets to individual files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportSecretsToFiles(\n includeMeta: boolean\n): Promise<boolean> {\n let outcome = false;\n let secrets: SecretSkeleton[] = [];\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Reading secrets...`\n );\n try {\n secrets = await readSecrets();\n secrets.sort((a, b) => a._id.localeCompare(b._id));\n stopProgressIndicator(\n spinnerId,\n `Successfully read ${secrets.length} secrets.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error reading secrets: ${error.response?.data || error.message}`,\n 'fail'\n );\n }\n const indicatorId = createProgressIndicator(\n 'determinate',\n secrets.length,\n 'Exporting secrets'\n );\n for (const secret of secrets) {\n updateProgressIndicator(indicatorId, `Writing secret ${secret._id}`);\n const fileName = getTypedFilename(secret._id, 'secret');\n saveToFile(\n 'secret',\n secret,\n '_id',\n getFilePath(fileName, true),\n includeMeta\n );\n }\n stopProgressIndicator(indicatorId, `${secrets.length} secrets exported.`);\n outcome = true;\n return outcome;\n}\n\n/**\n * Create new version of secret\n * @param {string} secretId secret id\n * @param {string} value secret value\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function createVersionOfSecret(\n secretId: string,\n value: string\n): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Creating new version of secret ${secretId}...`\n );\n try {\n const version = await _createVersionOfSecret(secretId, value);\n stopProgressIndicator(\n spinnerId,\n `Created version ${version.version} of secret ${secretId}`,\n 'success'\n );\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Activate a version of a secret\n * @param {String} secretId secret id\n * @param {Number} version version of secret\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function activateVersionOfSecret(\n secretId,\n version\n): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Activating version ${version} of secret ${secretId}...`\n );\n try {\n await enableVersionOfSecret(secretId, version);\n stopProgressIndicator(\n spinnerId,\n `Activated version ${version} of secret ${secretId}`,\n 'success'\n );\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Deactivate a version of a secret\n * @param {String} secretId secret id\n * @param {Number} version version of secret\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deactivateVersionOfSecret(\n secretId,\n version\n): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Deactivating version ${version} of secret ${secretId}...`\n );\n try {\n await disableVersionOfSecret(secretId, version);\n stopProgressIndicator(\n spinnerId,\n `Deactivated version ${version} of secret ${secretId}`,\n 'success'\n );\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Delete version of secret\n * @param {String} secretId secret id\n * @param {Number} version version of secret\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteVersionOfSecret(\n secretId,\n version\n): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Deleting version ${version} of secret ${secretId}...`\n );\n try {\n await _deleteVersionOfSecret(secretId, version);\n stopProgressIndicator(\n spinnerId,\n `Deleted version ${version} of secret ${secretId}`,\n 'success'\n );\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'fail'\n );\n }\n return outcome;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAMpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SAASC,mBAAmB,EAAEC,QAAQ,QAAQ,iBAAiB;AAC/D,SACEC,mBAAmB,EACnBC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AACzB,OAAOC,QAAQ,MAAM,kBAAkB;AAEvC,MAAM;EAAEC;AAAgB,CAAC,GAAGb,KAAK,CAACc,GAAG,CAACC,OAAO;AAC7C,MAAM;EACJC,WAAW;EACXC,YAAY,EAAEC,aAAa;EAC3BC,oBAAoB;EACpBC,UAAU;EACVC,YAAY;EACZC,aAAa;EACbC,qBAAqB;EACrBC,sBAAsB;EACtBC,qBAAqB,EAAEC,sBAAsB;EAC7CC,uBAAuB;EACvBC,YAAY,EAAEC,aAAa;EAC3BC,qBAAqB,EAAEC;AACzB,CAAC,GAAG/B,KAAK,CAACgC,KAAK,CAACC,MAAM;AAEtB,MAAM;EAAEC,WAAW;EAAEC,gBAAgB;EAAEC,cAAc;EAAEC,UAAU;EAAEC;AAAU,CAAC,GAC5EtC,KAAK,CAACuC,KAAK;;AAEb;AACA;AACA;AACA;AACA;A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,OAAO;AAChB"}
1
+ {"version":3,"file":"SecretsOps.js","names":["frodo","state","fs","getFullExportConfig","isIdUsed","createKeyValueTable","createProgressIndicator","createTable","debugMessage","printMessage","stopProgressIndicator","updateProgressIndicator","wordwrap","resolveUserName","idm","managed","readSecrets","createSecret","_createSecret","readVersionsOfSecret","readSecret","exportSecret","exportSecrets","enableVersionOfSecret","disableVersionOfSecret","createVersionOfSecret","_createVersionOfSecret","updateSecretDescription","deleteSecret","_deleteSecret","deleteVersionOfSecret","_deleteVersionOfSecret","cloud","secret","getFilePath","getTypedFilename","saveJsonToFile","saveToFile","titleCase","utils","listSecrets","long","usage","file","spinnerId","secrets","sort","a","b","_id","localeCompare","length","error","_error$response","response","data","message","forEach","variable","fullExport","headers","hAlign","content","_error$response2","push","table","lastChangedBy","getUseBearerTokenForAmApis","values","activeVersion","loadedVersion","loaded","description","Date","lastChangeDate","toUTCString","isEsvUsed","used","location","toString","id","value","encoding","useInPlaceholders","outcome","code","createSecretFromFile","readFileSync","setSecretDescription","secretId","deleteSecrets","_error$response3","indicatorId","listSecretVersions","versions","_error$response4","statusMap","ENABLED","DISABLED","DESTROYED","version","status","createDate","toLocaleString","describeSecret","_error$response5","exportSecretToFile","includeMeta","fileName","filePath","fileData","_error$response6","exportSecretsToFile","getRealm","secretsExport","_error$response7","exportSecretsToFiles","_error$response8","createVersionOfSecretFromFile","activateVersionOfSecret","deactivateVersionOfSecret"],"sources":["../../src/ops/SecretsOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport {\n SecretEncodingType,\n SecretSkeleton,\n VersionOfSecretSkeleton,\n} from '@rockcarver/frodo-lib/types/api/cloud/SecretsApi';\nimport fs from 'fs';\n\nimport { getFullExportConfig, isIdUsed } from '../utils/Config';\nimport {\n createKeyValueTable,\n createProgressIndicator,\n createTable,\n debugMessage,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\nimport wordwrap from './utils/Wordwrap';\n\nconst { resolveUserName } = frodo.idm.managed;\nconst {\n readSecrets,\n createSecret: _createSecret,\n readVersionsOfSecret,\n readSecret,\n exportSecret,\n exportSecrets,\n enableVersionOfSecret,\n disableVersionOfSecret,\n createVersionOfSecret: _createVersionOfSecret,\n updateSecretDescription,\n deleteSecret: _deleteSecret,\n deleteVersionOfSecret: _deleteVersionOfSecret,\n} = frodo.cloud.secret;\n\nconst { getFilePath, getTypedFilename, saveJsonToFile, saveToFile, titleCase } =\n frodo.utils;\n\n/**\n * List secrets\n * @param {boolean} long Long version, all the fields besides usage\n * @param {boolean} usage Display usage field\n * @param {String | null} file Optional filename to determine usage\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listSecrets(\n long: boolean = false,\n usage: boolean = false,\n file: string | null = null\n): Promise<boolean> {\n let spinnerId: string;\n let secrets: SecretSkeleton[] = [];\n try {\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Reading secrets...`\n );\n secrets = await readSecrets();\n secrets.sort((a, b) => a._id.localeCompare(b._id));\n stopProgressIndicator(\n spinnerId,\n `Successfully read ${secrets.length} secrets.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error reading secrets: ${error.response?.data || error.message}`,\n 'fail'\n );\n return false;\n }\n if (!long && !usage) {\n secrets.forEach((variable) => {\n printMessage(variable._id, 'data');\n });\n return true;\n }\n let fullExport = null;\n const headers = long\n ? [\n 'Id'['brightCyan'],\n { hAlign: 'right', content: 'Active\\nVersion'['brightCyan'] },\n { hAlign: 'right', content: 'Loaded\\nVersion'['brightCyan'] },\n 'Status'['brightCyan'],\n 'Description'['brightCyan'],\n 'Modifier'['brightCyan'],\n 'Modified (UTC)'['brightCyan'],\n ]\n : ['Id'['brightCyan']];\n if (usage) {\n try {\n fullExport = await getFullExportConfig(file);\n } catch (error) {\n printMessage(\n `Error getting full export: ${error.response?.data || error.message}`,\n 'error'\n );\n return false;\n }\n //Delete secrets from full export so they aren't mistakenly used for determining usage\n delete fullExport.secrets;\n headers.push('Used'['brightCyan']);\n }\n const table = createTable(headers);\n for (const secret of secrets) {\n let lastChangedBy = secret.lastChangedBy;\n if (long) {\n try {\n lastChangedBy = state.getUseBearerTokenForAmApis()\n ? secret.lastChangedBy\n : await resolveUserName('teammember', secret.lastChangedBy);\n } catch (error) {\n // ignore\n }\n }\n const values = long\n ? [\n secret._id,\n { hAlign: 'right', content: secret.activeVersion },\n { hAlign: 'right', content: secret.loadedVersion },\n secret.loaded ? 'loaded'['brightGreen'] : 'unloaded'['brightRed'],\n wordwrap(secret.description, 40),\n lastChangedBy,\n new Date(secret.lastChangeDate).toUTCString(),\n ]\n : [secret._id];\n if (usage) {\n const isEsvUsed = isIdUsed(fullExport, secret._id, true);\n values.push(\n isEsvUsed.used\n ? `${'yes'['brightGreen']} (at ${isEsvUsed.location})`\n : 'no'['brightRed']\n );\n }\n table.push(values);\n }\n printMessage(table.toString(), 'data');\n return true;\n}\n\n/**\n * Create secret\n * @param {string} id secret id\n * @param {string} value secret value\n * @param {string} description secret description\n * @param {SecretEncodingType} encoding secret encoding\n * @param {boolean} useInPlaceholders use secret in placeholders\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function createSecret(\n id: string,\n value: string,\n description: string,\n encoding: SecretEncodingType,\n useInPlaceholders: boolean\n): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Creating secret ${id}...`\n );\n try {\n await _createSecret(id, value, description, encoding, useInPlaceholders);\n stopProgressIndicator(spinnerId, `Created secret ${id}`, 'success');\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n error.response\n ? `Error: ${error.response.data.code} - ${error.response.data.message}`\n : error,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Create secret from file (pem / base64hmac)\n * @param {string} id secret id\n * @param {string} file certificate file name\n * @param {string} description secret description\n * @param {SecretEncodingType} encoding secret encoding\n * @param {boolean} useInPlaceholders use secret in placeholders\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function createSecretFromFile(\n id: string,\n file: string,\n description: string,\n encoding: SecretEncodingType,\n useInPlaceholders: boolean\n): Promise<boolean> {\n let outcome = false;\n const value = fs.readFileSync(getFilePath(file), 'utf8');\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Creating secret ${id}...`\n );\n try {\n await _createSecret(id, value, description, encoding, useInPlaceholders);\n stopProgressIndicator(spinnerId, `Created secret ${id}`, 'success');\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n error.response\n ? `Error: ${error.response.data.code} - ${error.response.data.message}`\n : error,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Set description of secret\n * @param {string} secretId secret id\n * @param {string} description secret description\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function setSecretDescription(\n secretId: string,\n description: string\n): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Setting description of secret ${secretId}...`\n );\n try {\n await updateSecretDescription(secretId, description);\n stopProgressIndicator(\n spinnerId,\n `Set description of secret ${secretId}`,\n 'success'\n );\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Delete a secret\n * @param {string} secretId secret id\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteSecret(secretId: string): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Deleting secret ${secretId}...`\n );\n try {\n await _deleteSecret(secretId);\n stopProgressIndicator(spinnerId, `Deleted secret ${secretId}`, 'success');\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Delete all secrets\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteSecrets(): Promise<boolean> {\n let outcome = false;\n let secrets: SecretSkeleton[] = [];\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Reading secrets...`\n );\n try {\n secrets = await readSecrets();\n secrets.sort((a, b) => a._id.localeCompare(b._id));\n stopProgressIndicator(\n spinnerId,\n `Successfully read ${secrets.length} secrets.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error reading secrets: ${error.response?.data || error.message}`,\n 'fail'\n );\n }\n const indicatorId = createProgressIndicator(\n 'determinate',\n secrets.length,\n `Deleting secrets...`\n );\n try {\n for (const secret of secrets) {\n try {\n await _deleteSecret(secret._id);\n updateProgressIndicator(indicatorId, `Deleted secret ${secret._id}`);\n } catch (error) {\n printMessage(\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'error'\n );\n }\n }\n stopProgressIndicator(indicatorId, `Secrets deleted.`);\n outcome = true;\n } catch (error) {\n printMessage(\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'error'\n );\n }\n return outcome;\n}\n\n/**\n * List all the versions of the secret\n * @param {String} secretId secret id\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listSecretVersions(secretId): Promise<boolean> {\n let outcome = false;\n let spinnerId: string;\n let versions: VersionOfSecretSkeleton[] = [];\n try {\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Reading secret versions...`\n );\n versions = await readVersionsOfSecret(secretId);\n stopProgressIndicator(\n spinnerId,\n `Successfully read ${versions.length} secret versions.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error reading secret versions: ${error.response?.data || error.message}`,\n 'fail'\n );\n }\n const table = createTable([\n { hAlign: 'right', content: 'Version'['brightCyan'] },\n 'Status'['brightCyan'],\n 'Loaded'['brightCyan'],\n 'Created'['brightCyan'],\n ]);\n const statusMap = {\n ENABLED: 'active'['brightGreen'],\n DISABLED: 'inactive'['brightRed'],\n DESTROYED: 'deleted'['brightRed'],\n };\n for (const version of versions) {\n table.push([\n { hAlign: 'right', content: version.version },\n statusMap[version.status],\n version.loaded ? 'loaded'['brightGreen'] : 'unloaded'['brightRed'],\n new Date(version.createDate).toLocaleString(),\n ]);\n }\n printMessage(table.toString(), 'data');\n outcome = true;\n return outcome;\n}\n\n/**\n * Describe a secret\n * @param {string} secretId Secret id\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeSecret(secretId: string): Promise<boolean> {\n let outcome = false;\n let spinnerId: string;\n let secret: SecretSkeleton = null;\n try {\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Reading secret ${secretId}...`\n );\n secret = await readSecret(secretId);\n stopProgressIndicator(\n spinnerId,\n `Successfully read secret ${secretId}.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error reading secret ${secretId}: ${\n error.response?.data || error.message\n }`,\n 'fail'\n );\n }\n const table = createKeyValueTable();\n table.push(['Name'['brightCyan'], secret._id]);\n table.push(['Active Version'['brightCyan'], secret.activeVersion]);\n table.push(['Loaded Version'['brightCyan'], secret.loadedVersion]);\n table.push([\n 'Status'['brightCyan'],\n secret.loaded ? 'loaded'['brightGreen'] : 'unloaded'['brightRed'],\n ]);\n table.push(['Description'['brightCyan'], wordwrap(secret.description, 60)]);\n table.push([\n 'Modified'['brightCyan'],\n new Date(secret.lastChangeDate).toLocaleString(),\n ]);\n let lastChangedBy = secret.lastChangedBy;\n try {\n lastChangedBy = state.getUseBearerTokenForAmApis()\n ? secret.lastChangedBy\n : await resolveUserName('teammember', secret.lastChangedBy);\n } catch (error) {\n // ignore\n }\n table.push(['Modifier'['brightCyan'], lastChangedBy]);\n table.push(['Modifier UUID'['brightCyan'], secret.lastChangedBy]);\n table.push(['Encoding'['brightCyan'], secret.encoding]);\n table.push(['Use In Placeholders'['brightCyan'], secret.useInPlaceholders]);\n printMessage(table.toString(), 'data');\n printMessage('\\nSecret Versions:', 'data');\n await listSecretVersions(secretId);\n outcome = true;\n return outcome;\n}\n\n/**\n * Export a single secret to file\n * @param {String} secretId Secret id\n * @param {String} file Optional filename\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportSecretToFile(\n secretId: string,\n file: string | null,\n includeMeta: boolean\n): Promise<boolean> {\n debugMessage(\n `Cli.SecretsOps.exportSecretToFile: start [secretId=${secretId}, file=${file}]`\n );\n let outcome = false;\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(secretId, 'secret');\n }\n const filePath = getFilePath(fileName, true);\n let spinnerId: string;\n try {\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Exporting secret ${secretId}`\n );\n const fileData = await exportSecret(secretId);\n saveJsonToFile(fileData, filePath, includeMeta);\n stopProgressIndicator(\n spinnerId,\n `Exported ${secretId['brightCyan']} to ${filePath['brightCyan']}.`,\n 'success'\n );\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error exporting secret: ${error.response?.data || error.message}`,\n 'fail'\n );\n }\n debugMessage(\n `Cli.SecretsOps.exportSecretToFile: end [outcome=${outcome}, secretId=${secretId}, file=${file}]`\n );\n return outcome;\n}\n\n/**\n * Export all secrets to single file\n * @param {string} file Optional filename\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportSecretsToFile(\n file: string,\n includeMeta: boolean\n): Promise<boolean> {\n debugMessage(`Cli.SecretsOps.exportSecretsToFile: start [file=${file}]`);\n let outcome = false;\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(\n `all${titleCase(state.getRealm())}Secrets`,\n 'secret'\n );\n }\n try {\n const secretsExport = await exportSecrets();\n saveJsonToFile(secretsExport, getFilePath(fileName, true), includeMeta);\n outcome = true;\n } catch (error) {\n printMessage(error.message, 'error');\n printMessage(`exportSecretsToFile: ${error.response?.status}`, 'error');\n }\n debugMessage(`Cli.SecretsOps.exportSecretsToFile: end [file=${file}]`);\n return outcome;\n}\n\n/**\n * Export all secrets to individual files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportSecretsToFiles(\n includeMeta: boolean\n): Promise<boolean> {\n let outcome = false;\n let secrets: SecretSkeleton[] = [];\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Reading secrets...`\n );\n try {\n secrets = await readSecrets();\n secrets.sort((a, b) => a._id.localeCompare(b._id));\n stopProgressIndicator(\n spinnerId,\n `Successfully read ${secrets.length} secrets.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error reading secrets: ${error.response?.data || error.message}`,\n 'fail'\n );\n }\n const indicatorId = createProgressIndicator(\n 'determinate',\n secrets.length,\n 'Exporting secrets'\n );\n for (const secret of secrets) {\n updateProgressIndicator(indicatorId, `Writing secret ${secret._id}`);\n const fileName = getTypedFilename(secret._id, 'secret');\n saveToFile(\n 'secret',\n secret,\n '_id',\n getFilePath(fileName, true),\n includeMeta\n );\n }\n stopProgressIndicator(indicatorId, `${secrets.length} secrets exported.`);\n outcome = true;\n return outcome;\n}\n\n/**\n * Create new version of secret\n * @param {string} secretId secret id\n * @param {string} value secret value\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function createVersionOfSecret(\n secretId: string,\n value: string\n): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Creating new version of secret ${secretId}...`\n );\n try {\n const version = await _createVersionOfSecret(secretId, value);\n stopProgressIndicator(\n spinnerId,\n `Created version ${version.version} of secret ${secretId}`,\n 'success'\n );\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Create new version of secret from file\n * @param {string} secretId secret id\n * @param {string} file filename\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function createVersionOfSecretFromFile(\n secretId: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n const value = fs.readFileSync(getFilePath(file), 'utf8');\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Creating new version of secret ${secretId}...`\n );\n try {\n const version = await _createVersionOfSecret(secretId, value);\n stopProgressIndicator(\n spinnerId,\n `Created version ${version.version} of secret ${secretId}`,\n 'success'\n );\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Activate a version of a secret\n * @param {String} secretId secret id\n * @param {Number} version version of secret\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function activateVersionOfSecret(\n secretId,\n version\n): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Activating version ${version} of secret ${secretId}...`\n );\n try {\n await enableVersionOfSecret(secretId, version);\n stopProgressIndicator(\n spinnerId,\n `Activated version ${version} of secret ${secretId}`,\n 'success'\n );\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Deactivate a version of a secret\n * @param {String} secretId secret id\n * @param {Number} version version of secret\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deactivateVersionOfSecret(\n secretId,\n version\n): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Deactivating version ${version} of secret ${secretId}...`\n );\n try {\n await disableVersionOfSecret(secretId, version);\n stopProgressIndicator(\n spinnerId,\n `Deactivated version ${version} of secret ${secretId}`,\n 'success'\n );\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'fail'\n );\n }\n return outcome;\n}\n\n/**\n * Delete version of secret\n * @param {String} secretId secret id\n * @param {Number} version version of secret\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteVersionOfSecret(\n secretId,\n version\n): Promise<boolean> {\n let outcome = false;\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Deleting version ${version} of secret ${secretId}...`\n );\n try {\n await _deleteVersionOfSecret(secretId, version);\n stopProgressIndicator(\n spinnerId,\n `Deleted version ${version} of secret ${secretId}`,\n 'success'\n );\n outcome = true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error: ${error.response.data.code} - ${error.response.data.message}`,\n 'fail'\n );\n }\n return outcome;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAMpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SAASC,mBAAmB,EAAEC,QAAQ,QAAQ,iBAAiB;AAC/D,SACEC,mBAAmB,EACnBC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AACzB,OAAOC,QAAQ,MAAM,kBAAkB;AAEvC,MAAM;EAAEC;AAAgB,CAAC,GAAGb,KAAK,CAACc,GAAG,CAACC,OAAO;AAC7C,MAAM;EACJC,WAAW;EACXC,YAAY,EAAEC,aAAa;EAC3BC,oBAAoB;EACpBC,UAAU;EACVC,YAAY;EACZC,aAAa;EACbC,qBAAqB;EACrBC,sBAAsB;EACtBC,qBAAqB,EAAEC,sBAAsB;EAC7CC,uBAAuB;EACvBC,YAAY,EAAEC,aAAa;EAC3BC,qBAAqB,EAAEC;AACzB,CAAC,GAAG/B,KAAK,CAACgC,KAAK,CAACC,MAAM;AAEtB,MAAM;EAAEC,WAAW;EAAEC,gBAAgB;EAAEC,cAAc;EAAEC,UAAU;EAAEC;AAAU,CAAC,GAC5EtC,KAAK,CAACuC,KAAK;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,WAAWA,CAC/BC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ACE,QAAQ,CAACC,IAAI,CAACC,OAAQ,EAAC,EACrE,MACF,CAAC;EACH;EACA,OAAO4B,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAetD,qBAAqBA,CACzC2D,QAAQ,EACRW,OAAO,EACW;EAClB,IAAIhB,OAAO,GAAG,KAAK;EACnB,MAAMxC,SAAS,GAAGtC,uBAAuB,CACvC,eAAe,EACf,CAAC,EACA,oBAAmB8F,OAAQ,cAAaX,QAAS,KACpD,CAAC;EACD,IAAI;IACF,MAAM1D,sBAAsB,CAAC0D,QAAQ,EAAEW,OAAO,CAAC;IAC/C1F,qBAAqB,CACnBkC,SAAS,EACR,mBAAkBwD,OAAQ,cAAaX,QAAS,EAAC,EAClD,SACF,CAAC;IACDL,OAAO,GAAG,IAAI;EAChB,CAAC,CAAC,OAAOhC,KAAK,EAAE;IACd1C,qBAAqB,CACnBkC,SAAS,EACR,UAASQ,KAAK,CAACE,QAAQ,CAACC,IAAI,CAAC8B,IAAK,MAAKjC,KAAK,CAACE,QAAQ,CAACC,IAAI,CAACC,OAAQ,EAAC,EACrE,MACF,CAAC;EACH;EACA,OAAO4B,OAAO;AAChB"}
@@ -1,4 +1,5 @@
1
1
  export default async () => {
2
2
  process.env.TZ = 'UTC';
3
+ process.env.LANG = 'en-US';
3
4
  process.env.FRODO_NO_CACHE = 'true';
4
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-cli",
3
- "version": "2.0.0-45",
3
+ "version": "2.0.0-47",
4
4
  "type": "module",
5
5
  "description": "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
6
6
  "keywords": [
@@ -116,7 +116,7 @@
116
116
  ]
117
117
  },
118
118
  "dependencies": {
119
- "@rockcarver/frodo-lib": "2.0.0-64",
119
+ "@rockcarver/frodo-lib": "2.0.0-67",
120
120
  "chokidar": "^3.5.3",
121
121
  "cli-progress": "^3.11.2",
122
122
  "cli-table3": "^0.6.3",