@rockcarver/frodo-cli 2.0.0-33 → 2.0.0-35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/esm/cli/admin/admin-execute-rfc7523-authz-grant-flow.js +42 -0
  3. package/esm/cli/admin/admin-execute-rfc7523-authz-grant-flow.js.map +1 -0
  4. package/esm/cli/admin/admin-generate-rfc7523-authz-grant-artifacts.js +44 -0
  5. package/esm/cli/admin/admin-generate-rfc7523-authz-grant-artifacts.js.map +1 -0
  6. package/esm/cli/admin/admin.js +2 -0
  7. package/esm/cli/admin/admin.js.map +1 -1
  8. package/esm/cli/esv/esv-secret-create.js +2 -1
  9. package/esm/cli/esv/esv-secret-create.js.map +1 -1
  10. package/esm/cli/esv/esv-secret-delete.js +4 -3
  11. package/esm/cli/esv/esv-secret-delete.js.map +1 -1
  12. package/esm/cli/esv/esv-secret-describe.js +2 -1
  13. package/esm/cli/esv/esv-secret-describe.js.map +1 -1
  14. package/esm/cli/esv/esv-secret-export.js +6 -4
  15. package/esm/cli/esv/esv-secret-export.js.map +1 -1
  16. package/esm/cli/esv/esv-secret-list.js +2 -1
  17. package/esm/cli/esv/esv-secret-list.js.map +1 -1
  18. package/esm/cli/esv/esv-secret-set.js +2 -1
  19. package/esm/cli/esv/esv-secret-set.js.map +1 -1
  20. package/esm/cli/esv/esv-secret-version-activate.js +2 -2
  21. package/esm/cli/esv/esv-secret-version-activate.js.map +1 -1
  22. package/esm/cli/esv/esv-secret-version-create.js +2 -1
  23. package/esm/cli/esv/esv-secret-version-create.js.map +1 -1
  24. package/esm/cli/esv/esv-secret-version-deactivate.js +2 -2
  25. package/esm/cli/esv/esv-secret-version-deactivate.js.map +1 -1
  26. package/esm/cli/esv/esv-secret-version-delete.js +4 -3
  27. package/esm/cli/esv/esv-secret-version-delete.js.map +1 -1
  28. package/esm/cli/esv/esv-secret-version-list.js +2 -1
  29. package/esm/cli/esv/esv-secret-version-list.js.map +1 -1
  30. package/esm/cli/esv/esv-variable-create.js +2 -1
  31. package/esm/cli/esv/esv-variable-create.js.map +1 -1
  32. package/esm/cli/esv/esv-variable-delete.js +4 -2
  33. package/esm/cli/esv/esv-variable-delete.js.map +1 -1
  34. package/esm/cli/esv/esv-variable-describe.js +2 -1
  35. package/esm/cli/esv/esv-variable-describe.js.map +1 -1
  36. package/esm/cli/esv/esv-variable-export.js +6 -3
  37. package/esm/cli/esv/esv-variable-export.js.map +1 -1
  38. package/esm/cli/esv/esv-variable-list.js +2 -1
  39. package/esm/cli/esv/esv-variable-list.js.map +1 -1
  40. package/esm/cli/esv/esv-variable-set.js +4 -2
  41. package/esm/cli/esv/esv-variable-set.js.map +1 -1
  42. package/esm/ops/AdminOps.js +142 -1
  43. package/esm/ops/AdminOps.js.map +1 -1
  44. package/esm/ops/SecretsOps.js +156 -59
  45. package/esm/ops/SecretsOps.js.map +1 -1
  46. package/esm/ops/VariablesOps.js +116 -48
  47. package/esm/ops/VariablesOps.js.map +1 -1
  48. package/esm/utils/Console.js +2 -1
  49. package/esm/utils/Console.js.map +1 -1
  50. package/package.json +10 -2
@@ -1 +1 @@
1
- {"version":3,"file":"esv-variable-create.js","names":["frodo","s","createVariable","verboseMessage","FrodoCommand","getTokens","login","program","description","requiredOption","option","addHelpText","connId","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","variableId","value","variableType","process","exitCode","parse"],"sources":["../../../src/cli/esv/esv-variable-create.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\n\nimport * as s from '../../help/SampleData';\nimport { createVariable } from '../../ops/VariablesOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo esv variable create');\n\nprogram\n .description('Create variables.')\n .requiredOption('-i, --variable-id <variable-id>', 'Variable id.')\n .requiredOption('--value <value>', 'Variable value.')\n .option('--description [description]', 'Variable description.')\n .option(\n '--variable-type [variable-type]',\n 'Variable type. Must be one of \"string\", \"list\", \"array\", \"object\", \"bool\", \"int\", or \"number\".',\n 'string'\n )\n .addHelpText(\n 'after',\n `Usage Examples:\\n` +\n ` Create an ESV variable using implied default type \"string\":\\n` +\n ` $ frodo esv variable create --variable-id \"esv-trinity-phone\" --value \"(312)-555-0690\" --description \"Trinity's phone number.\" ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Create an ESV variable of type \"array\":\\n` +\n ` $ frodo esv variable create --variable-id \"esv-nebuchadnezzar-crew\" --variable-type array --value '[\"Morpheus\",\"Trinity\",\"Link\",\"Tank\",\"Dozer\",\"Apoc\",\"Cypher\",\"Mouse\",\"Neo\",\"Switch\"]' --description \"The crew of the Nebuchadnezzar hovercraft.\" ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Create an ESV variable of type \"object\":\\n` +\n ` $ frodo esv variable create --variable-id \"esv-nebuchadnezzar-crew-structure\" --variable-type object --value '{\"Captain\":\"Morpheus\",\"FirstMate\":\"Trinity\",\"Operator\":[\"Link\",\"Tank\"],\"Medic\":\"Dozer\",\"Crewmen\":[\"Apoc\",\"Cypher\",\"Mouse\",\"Neo\",\"Switch\"]}' --description \"The structure of the crew of the Nebuchadnezzar hovercraft.\" ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Create an ESV variable of type \"int\":\\n` +\n ` $ frodo esv variable create --variable-id \"esv-neo-age\" --variable-type int --value '28' --description \"Neo's age in the matrix.\" ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Create an ESV variable of type \"bool\":\\n` +\n ` $ frodo esv variable create --variable-id \"esv-blue-piller\" --variable-type bool --value 'false' --description \"Zion membership criteria.\" ${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 if (await getTokens()) {\n verboseMessage('Creating variable...');\n createVariable(\n options.variableId,\n options.value,\n options.description,\n options.variableType\n );\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,OAAO,KAAKC,CAAC,MAAM,uBAAuB;AAC1C,SAASC,cAAc,QAAQ,wBAAwB;AACvD,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,2BAA2B,CAAC;AAE7DG,OAAO,CACJC,WAAW,CAAC,mBAAmB,CAAC,CAChCC,cAAc,CAAC,iCAAiC,EAAE,cAAc,CAAC,CACjEA,cAAc,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CACpDC,MAAM,CAAC,6BAA6B,EAAE,uBAAuB,CAAC,CAC9DA,MAAM,CACL,iCAAiC,EACjC,gGAAgG,EAChG,QACF,CAAC,CACAC,WAAW,CACV,OAAO,EACN,mBAAkB,GAChB,iEAAgE,GAChE,oIAAmIV,CAAC,CAACW,MAAO,IAAG,CAC9I,YAAY,CACb,GACA,6CAA4C,GAC5C,wPAAuPX,CAAC,CAACW,MAAO,IAAG,CAClQ,YAAY,CACb,GACA,8CAA6C,GAC7C,2UAA0UX,CAAC,CAACW,MAAO,IAAG,CACrV,YAAY,CACb,GACA,2CAA0C,GAC1C,uIAAsIX,CAAC,CAACW,MAAO,IAAG,CACjJ,YAAY,CACb,GACA,4CAA2C,GAC3C,gJAA+IX,CAAC,CAACW,MAAO,IAAG,CAC1J,YAAY,CAElB,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,MAAMd,SAAS,CAAC,CAAC,EAAE;IACrBF,cAAc,CAAC,sBAAsB,CAAC;IACtCD,cAAc,CACZgB,OAAO,CAACG,UAAU,EAClBH,OAAO,CAACI,KAAK,EACbJ,OAAO,CAACV,WAAW,EACnBU,OAAO,CAACK,YACV,CAAC;EACH,CAAC,MAAM;IACLC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHlB,OAAO,CAACmB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"esv-variable-create.js","names":["frodo","s","createVariable","verboseMessage","FrodoCommand","getTokens","login","program","description","requiredOption","option","addHelpText","connId","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","outcome","variableId","value","variableType","process","exitCode","parse"],"sources":["../../../src/cli/esv/esv-variable-create.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\n\nimport * as s from '../../help/SampleData';\nimport { createVariable } from '../../ops/VariablesOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo esv variable create');\n\nprogram\n .description('Create variables.')\n .requiredOption('-i, --variable-id <variable-id>', 'Variable id.')\n .requiredOption('--value <value>', 'Variable value.')\n .option('--description [description]', 'Variable description.')\n .option(\n '--variable-type [variable-type]',\n 'Variable type. Must be one of \"string\", \"list\", \"array\", \"object\", \"bool\", \"int\", or \"number\".',\n 'string'\n )\n .addHelpText(\n 'after',\n `Usage Examples:\\n` +\n ` Create an ESV variable using implied default type \"string\":\\n` +\n ` $ frodo esv variable create --variable-id \"esv-trinity-phone\" --value \"(312)-555-0690\" --description \"Trinity's phone number.\" ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Create an ESV variable of type \"array\":\\n` +\n ` $ frodo esv variable create --variable-id \"esv-nebuchadnezzar-crew\" --variable-type array --value '[\"Morpheus\",\"Trinity\",\"Link\",\"Tank\",\"Dozer\",\"Apoc\",\"Cypher\",\"Mouse\",\"Neo\",\"Switch\"]' --description \"The crew of the Nebuchadnezzar hovercraft.\" ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Create an ESV variable of type \"object\":\\n` +\n ` $ frodo esv variable create --variable-id \"esv-nebuchadnezzar-crew-structure\" --variable-type object --value '{\"Captain\":\"Morpheus\",\"FirstMate\":\"Trinity\",\"Operator\":[\"Link\",\"Tank\"],\"Medic\":\"Dozer\",\"Crewmen\":[\"Apoc\",\"Cypher\",\"Mouse\",\"Neo\",\"Switch\"]}' --description \"The structure of the crew of the Nebuchadnezzar hovercraft.\" ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Create an ESV variable of type \"int\":\\n` +\n ` $ frodo esv variable create --variable-id \"esv-neo-age\" --variable-type int --value '28' --description \"Neo's age in the matrix.\" ${s.connId}\\n`[\n 'brightCyan'\n ] +\n ` Create an ESV variable of type \"bool\":\\n` +\n ` $ frodo esv variable create --variable-id \"esv-blue-piller\" --variable-type bool --value 'false' --description \"Zion membership criteria.\" ${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 if (await getTokens()) {\n verboseMessage('Creating variable...');\n const outcome = await createVariable(\n options.variableId,\n options.value,\n options.description,\n options.variableType\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,OAAO,KAAKC,CAAC,MAAM,uBAAuB;AAC1C,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGL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EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHnB,OAAO,CAACoB,KAAK,CAAC,CAAC"}
@@ -14,12 +14,14 @@ async (host, realm, user, password, options, command) => {
14
14
  // delete by id
15
15
  if (options.variableId && (await getTokens())) {
16
16
  verboseMessage('Deleting variable...');
17
- deleteVariableById(options.variableId);
17
+ const outcome = await deleteVariableById(options.variableId);
18
+ if (!outcome) process.exitCode = 1;
18
19
  }
19
20
  // --all -a
20
21
  else if (options.all && (await getTokens())) {
21
22
  verboseMessage('Deleting all variables...');
22
- deleteVariables();
23
+ const outcome = await deleteVariables();
24
+ if (!outcome) process.exitCode = 1;
23
25
  }
24
26
  // unrecognized combination of options or no options
25
27
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"esv-variable-delete.js","names":["frodo","Option","deleteVariableById","deleteVariables","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","variableId","all","help","process","exitCode","parse"],"sources":["../../../src/cli/esv/esv-variable-delete.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { deleteVariableById, deleteVariables } from '../../ops/VariablesOps';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo cmd sub2 delete');\n\nprogram\n .description('Delete variables.')\n .addOption(\n new Option(\n '-i, --variable-id <variable-id>',\n 'Variable id. If specified, -a is ignored.'\n )\n )\n .addOption(\n new Option('-a, --all', 'Delete all variable in a realm. 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 .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 by id\n if (options.variableId && (await getTokens())) {\n verboseMessage('Deleting variable...');\n deleteVariableById(options.variableId);\n }\n // --all -a\n else if (options.all && (await getTokens())) {\n verboseMessage('Deleting all variables...');\n deleteVariables();\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,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,wBAAwB;AAC5E,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGP,KAAK,CAACQ,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,uBAAuB,CAAC;AAEzDG,OAAO,CACJC,WAAW,CAAC,mBAAmB,CAAC,CAChCC,SAAS,CACR,IAAIV,MAAM,CACR,iCAAiC,EACjC,2CACF,CACF,CAAC,CACAU,SAAS,CACR,IAAIV,MAAM,CAAC,WAAW,EAAE,kDAAkD,CAC5E,CAAC,CACAU,SAAS,CACR,IAAIV,MAAM,CACR,WAAW,EACX,sEACF,CACF,CAAC,CACAW,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD;EACA,IAAID,OAAO,CAACG,UAAU,KAAK,MAAMb,SAAS,CAAC,CAAC,CAAC,EAAE;IAC7CF,cAAc,CAAC,sBAAsB,CAAC;IACtCH,kBAAkB,CAACe,OAAO,CAACG,UAAU,CAAC;EACxC;EACA;EAAA,KACK,IAAIH,OAAO,CAACI,GAAG,KAAK,MAAMd,SAAS,CAAC,CAAC,CAAC,EAAE;IAC3CF,cAAc,CAAC,2BAA2B,CAAC;IAC3CF,eAAe,CAAC,CAAC;EACnB;EACA;EAAA,KACK;IACHC,YAAY,CAAC,sDAAsD,CAAC;IACpEK,OAAO,CAACa,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHf,OAAO,CAACgB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"esv-variable-delete.js","names":["frodo","Option","deleteVariableById","deleteVariables","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","variableId","outcome","process","exitCode","all","help","parse"],"sources":["../../../src/cli/esv/esv-variable-delete.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { deleteVariableById, deleteVariables } from '../../ops/VariablesOps';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo cmd sub2 delete');\n\nprogram\n .description('Delete variables.')\n .addOption(\n new Option(\n '-i, --variable-id <variable-id>',\n 'Variable id. If specified, -a is ignored.'\n )\n )\n .addOption(\n new Option('-a, --all', 'Delete all variable in a realm. 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 .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 by id\n if (options.variableId && (await getTokens())) {\n verboseMessage('Deleting variable...');\n const outcome = await deleteVariableById(options.variableId);\n if (!outcome) process.exitCode = 1;\n }\n // --all -a\n else if (options.all && (await getTokens())) {\n verboseMessage('Deleting all variables...');\n const outcome = await deleteVariables();\n if (!outcome) 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,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,wBAAwB;AAC5E,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGP,KAAK,CAACQ,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,uBAAuB,CAAC;AAEzDG,OAAO,CACJC,WAAW,CAAC,mBAAmB,CAAC,CAChCC,SAAS,CACR,IAAIV,MAAM,CACR,iCAAiC,EACjC,2CACF,CACF,CAAC,CACAU,SAAS,CACR,IAAIV,MAAM,CAAC,WAAW,EAAE,kDAAkD,CAC5E,CAAC,CACAU,SAAS,CACR,IAAIV,MAAM,CACR,WAAW,EACX,sEACF,CACF,CAAC,CACAW,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD;EACA,IAAID,OAAO,CAACG,UAAU,KAAK,MAAMb,SAAS,CAAC,CAAC,CAAC,EAAE;IAC7CF,cAAc,CAAC,sBAAsB,CAAC;IACtC,MAAMgB,OAAO,GAAG,MAAMnB,kBAAkB,CAACe,OAAO,CAACG,UAAU,CAAC;IAC5D,IAAI,CAACC,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK,IAAIN,OAAO,CAACO,GAAG,KAAK,MAAMjB,SAAS,CAAC,CAAC,CAAC,EAAE;IAC3CF,cAAc,CAAC,2BAA2B,CAAC;IAC3C,MAAMgB,OAAO,GAAG,MAAMlB,eAAe,CAAC,CAAC;IACvC,IAAI,CAACkB,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK;IACHnB,YAAY,CAAC,sDAAsD,CAAC;IACpEK,OAAO,CAACgB,IAAI,CAAC,CAAC;IACdH,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHd,OAAO,CAACiB,KAAK,CAAC,CAAC"}
@@ -13,7 +13,8 @@ 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(`Describing variable ${options.variableId}...`);
16
- describeVariable(options.variableId, options.json);
16
+ const outcome = await describeVariable(options.variableId, options.json);
17
+ if (!outcome) process.exitCode = 1;
17
18
  } else {
18
19
  process.exitCode = 1;
19
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"esv-variable-describe.js","names":["frodo","Option","describeVariable","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","makeOptionMandatory","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","variableId","json","process","exitCode","parse"],"sources":["../../../src/cli/esv/esv-variable-describe.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { describeVariable } from '../../ops/VariablesOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo esv variable describe');\n\nprogram\n .description('Describe variables.')\n .addOption(\n new Option(\n '-i, --variable-id <variable-id>',\n 'Variable id.'\n ).makeOptionMandatory()\n )\n .addOption(new Option('--json', 'Output in JSON format.'))\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(`Describing variable ${options.variableId}...`);\n describeVariable(options.variableId, options.json);\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,gBAAgB,QAAQ,wBAAwB;AACzD,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,6BAA6B,CAAC;AAE/DG,OAAO,CACJC,WAAW,CAAC,qBAAqB,CAAC,CAClCC,SAAS,CACR,IAAIR,MAAM,CACR,iCAAiC,EACjC,cACF,CAAC,CAACS,mBAAmB,CAAC,CACxB,CAAC,CACAD,SAAS,CAAC,IAAIR,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC,CACzDU,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,MAAMZ,SAAS,CAAC,CAAC,EAAE;IACrBF,cAAc,CAAE,uBAAsBa,OAAO,CAACG,UAAW,KAAI,CAAC;IAC9DjB,gBAAgB,CAACc,OAAO,CAACG,UAAU,EAAEH,OAAO,CAACI,IAAI,CAAC;EACpD,CAAC,MAAM;IACLC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHf,OAAO,CAACgB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"esv-variable-describe.js","names":["frodo","Option","describeVariable","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","makeOptionMandatory","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","variableId","outcome","json","process","exitCode","parse"],"sources":["../../../src/cli/esv/esv-variable-describe.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { describeVariable } from '../../ops/VariablesOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo esv variable describe');\n\nprogram\n .description('Describe variables.')\n .addOption(\n new Option(\n '-i, --variable-id <variable-id>',\n 'Variable id.'\n ).makeOptionMandatory()\n )\n .addOption(new Option('--json', 'Output in JSON format.'))\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(`Describing variable ${options.variableId}...`);\n const outcome = await describeVariable(\n options.variableId,\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;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,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,6BAA6B,CAAC;AAE/DG,OAAO,CACJC,WAAW,CAAC,qBAAqB,CAAC,CAClCC,SAAS,CACR,IAAIR,MAAM,CACR,iCAAiC,EACjC,cACF,CAAC,CAACS,mBAAmB,CAAC,CACxB,CAAC,CACAD,SAAS,CAAC,IAAIR,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC,CACzDU,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,MAAMZ,SAAS,CAAC,CAAC,EAAE;IACrBF,cAAc,CAAE,uBAAsBa,OAAO,CAACG,UAAW,KAAI,CAAC;IAC9D,MAAMC,OAAO,GAAG,MAAMlB,gBAAgB,CACpCc,OAAO,CAACG,UAAU,EAClBH,OAAO,CAACK,IACV,CAAC;IACD,IAAI,CAACD,OAAO,EAAEE,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"}
@@ -13,13 +13,16 @@ async (host, realm, user, password, options, command) => {
13
13
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
14
14
  if (options.variableId && (await getTokens())) {
15
15
  verboseMessage(`Exporting variable "${options.variableId}" from realm "${state.getRealm()}"...`);
16
- await exportVariableToFile(options.variableId, options.file, options.decode);
16
+ const outcome = await exportVariableToFile(options.variableId, options.file, options.decode);
17
+ if (!outcome) process.exitCode = 1;
17
18
  } else if (options.all && (await getTokens())) {
18
19
  verboseMessage('Exporting all variables to a single file...');
19
- await exportVariablesToFile(options.file, options.decode);
20
+ const outcome = await exportVariablesToFile(options.file, options.decode);
21
+ if (!outcome) process.exitCode = 1;
20
22
  } else if (options.allSeparate && (await getTokens())) {
21
23
  verboseMessage('Exporting all variables to separate files...');
22
- await exportVariablesToFiles(options.decode);
24
+ const outcome = await exportVariablesToFiles(options.decode);
25
+ if (!outcome) process.exitCode = 1;
23
26
  } else {
24
27
  printMessage('Unrecognized combination of options or no options...', 'error');
25
28
  program.help();
@@ -1 +1 @@
1
- {"version":3,"file":"esv-variable-export.js","names":["frodo","state","Option","exportVariablesToFile","exportVariablesToFiles","exportVariableToFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","variableId","getRealm","file","decode","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/esv/esv-variable-export.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportVariablesToFile,\n exportVariablesToFiles,\n exportVariableToFile,\n} from '../../ops/VariablesOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo esv variable export');\n\nprogram\n .description('Export variables.')\n .addOption(\n new Option(\n '-i, --variable-id <variable-id>',\n 'Variable id. 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 variables to a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all variables to separate files (*.variable.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option(\n '--no-decode',\n 'Do not include decoded variable value in export'\n ).default(false, 'false')\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (options.variableId && (await getTokens())) {\n verboseMessage(\n `Exporting variable \"${\n options.variableId\n }\" from realm \"${state.getRealm()}\"...`\n );\n await exportVariableToFile(\n options.variableId,\n options.file,\n options.decode\n );\n } else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all variables to a single file...');\n await exportVariablesToFile(options.file, options.decode);\n } else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all variables to separate files...');\n await exportVariablesToFiles(options.decode);\n } else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,qBAAqB,EACrBC,sBAAsB,EACtBC,oBAAoB,QACf,wBAAwB;AAC/B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGT,KAAK,CAACU,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,2BAA2B,CAAC;AAE7DG,OAAO,CACJC,WAAW,CAAC,mBAAmB,CAAC,CAChCC,SAAS,CACR,IAAIX,MAAM,CACR,iCAAiC,EACjC,mDACF,CACF,CAAC,CACAW,SAAS,CAAC,IAAIX,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAAC,CACtEW,SAAS,CACR,IAAIX,MAAM,CACR,WAAW,EACX,yDACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,oBAAoB,EACpB,2GACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,aAAa,EACb,iDACF,CAAC,CAACY,OAAO,CAAC,KAAK,EAAE,OAAO,CAC1B,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,IAAID,OAAO,CAACG,UAAU,KAAK,MAAMd,SAAS,CAAC,CAAC,CAAC,EAAE;IAC7CF,cAAc,CACX,uBACCa,OAAO,CAACG,UACT,iBAAgBtB,KAAK,CAACuB,QAAQ,CAAC,CAAE,MACpC,CAAC;IACD,MAAMnB,oBAAoB,CACxBe,OAAO,CAACG,UAAU,EAClBH,OAAO,CAACK,IAAI,EACZL,OAAO,CAACM,MACV,CAAC;EACH,CAAC,MAAM,IAAIN,OAAO,CAACO,GAAG,KAAK,MAAMlB,SAAS,CAAC,CAAC,CAAC,EAAE;IAC7CF,cAAc,CAAC,6CAA6C,CAAC;IAC7D,MAAMJ,qBAAqB,CAACiB,OAAO,CAACK,IAAI,EAAEL,OAAO,CAACM,MAAM,CAAC;EAC3D,CAAC,MAAM,IAAIN,OAAO,CAACQ,WAAW,KAAK,MAAMnB,SAAS,CAAC,CAAC,CAAC,EAAE;IACrDF,cAAc,CAAC,8CAA8C,CAAC;IAC9D,MAAMH,sBAAsB,CAACgB,OAAO,CAACM,MAAM,CAAC;EAC9C,CAAC,MAAM;IACLpB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDK,OAAO,CAACkB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHpB,OAAO,CAACqB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"esv-variable-export.js","names":["frodo","state","Option","exportVariablesToFile","exportVariablesToFiles","exportVariableToFile","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","variableId","getRealm","outcome","file","decode","process","exitCode","all","allSeparate","help","parse"],"sources":["../../../src/cli/esv/esv-variable-export.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportVariablesToFile,\n exportVariablesToFiles,\n exportVariableToFile,\n} from '../../ops/VariablesOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo esv variable export');\n\nprogram\n .description('Export variables.')\n .addOption(\n new Option(\n '-i, --variable-id <variable-id>',\n 'Variable id. 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 variables to a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all variables to separate files (*.variable.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option(\n '--no-decode',\n 'Do not include decoded variable value in export'\n ).default(false, 'false')\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (options.variableId && (await getTokens())) {\n verboseMessage(\n `Exporting variable \"${\n options.variableId\n }\" from realm \"${state.getRealm()}\"...`\n );\n const outcome = await exportVariableToFile(\n options.variableId,\n options.file,\n options.decode\n );\n if (!outcome) process.exitCode = 1;\n } else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all variables to a single file...');\n const outcome = await exportVariablesToFile(\n options.file,\n options.decode\n );\n if (!outcome) process.exitCode = 1;\n } else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all variables to separate files...');\n const outcome = await exportVariablesToFiles(options.decode);\n if (!outcome) process.exitCode = 1;\n } else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,qBAAqB,EACrBC,sBAAsB,EACtBC,oBAAoB,QACf,wBAAwB;AAC/B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGT,KAAK,CAACU,KAAK;AAEjC,MAAMC,OAAO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,OAAO,CAACO,MACV,CAAC;IACD,IAAI,CAACF,OAAO,EAAEG,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM,IAAIT,OAAO,CAACW,WAAW,KAAK,MAAMtB,SAAS,CAAC,CAAC,CAAC,EAAE;IACrDF,cAAc,CAAC,8CAA8C,CAAC;IAC9D,MAAMkB,OAAO,GAAG,MAAMrB,sBAAsB,CAACgB,OAAO,CAACO,MAAM,CAAC;IAC5D,IAAI,CAACF,OAAO,EAAEG,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLvB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDK,OAAO,CAACqB,IAAI,CAAC,CAAC;IACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHlB,OAAO,CAACsB,KAAK,CAAC,CAAC"}
@@ -13,7 +13,8 @@ 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('Listing variables...');
16
- listVariables(options.long);
16
+ const outcome = await listVariables(options.long);
17
+ if (!outcome) process.exitCode = 1;
17
18
  } else {
18
19
  process.exitCode = 1;
19
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"esv-variable-list.js","names":["frodo","Option","listVariables","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","long","process","exitCode","parse"],"sources":["../../../src/cli/esv/esv-variable-list.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { listVariables } from '../../ops/VariablesOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo esv variable list');\n\nprogram\n .description('List variables.')\n .addOption(\n new Option('-l, --long', 'Long with all fields.').default(false, 'false')\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 variables...');\n listVariables(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,SAASC,aAAa,QAAQ,wBAAwB;AACtD,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,yBAAyB,CAAC;AAE3DG,OAAO,CACJC,WAAW,CAAC,iBAAiB,CAAC,CAC9BC,SAAS,CACR,IAAIR,MAAM,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAACS,OAAO,CAAC,KAAK,EAAE,OAAO,CAC1E,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,MAAMZ,SAAS,CAAC,CAAC,EAAE;IACrBF,cAAc,CAAC,sBAAsB,CAAC;IACtCD,aAAa,CAACc,OAAO,CAACG,IAAI,CAAC;EAC7B,CAAC,MAAM;IACLC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHd,OAAO,CAACe,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"esv-variable-list.js","names":["frodo","Option","listVariables","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","outcome","long","process","exitCode","parse"],"sources":["../../../src/cli/esv/esv-variable-list.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { listVariables } from '../../ops/VariablesOps';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo esv variable list');\n\nprogram\n .description('List variables.')\n .addOption(\n new Option('-l, --long', 'Long with all fields.').default(false, 'false')\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 variables...');\n const outcome = await listVariables(options.long);\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,aAAa,QAAQ,wBAAwB;AACtD,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,yBAAyB,CAAC;AAE3DG,OAAO,CACJC,WAAW,CAAC,iBAAiB,CAAC,CAC9BC,SAAS,CACR,IAAIR,MAAM,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAACS,OAAO,CAAC,KAAK,EAAE,OAAO,CAC1E,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,MAAMZ,SAAS,CAAC,CAAC,EAAE;IACrBF,cAAc,CAAC,sBAAsB,CAAC;IACtC,MAAMgB,OAAO,GAAG,MAAMjB,aAAa,CAACc,OAAO,CAACI,IAAI,CAAC;IACjD,IAAI,CAACD,OAAO,EAAEE,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"}
@@ -12,10 +12,12 @@ async (host, realm, user, password, options, command) => {
12
12
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
13
13
  if (options.variableId && options.value && options.description && (await getTokens())) {
14
14
  verboseMessage('Updating variable...');
15
- updateVariable(options.variableId, options.value, options.description);
15
+ const outcome = await updateVariable(options.variableId, options.value, options.description);
16
+ if (!outcome) process.exitCode = 1;
16
17
  } else if (options.variableId && options.description && (await getTokens())) {
17
18
  verboseMessage('Updating variable...');
18
- setVariableDescription(options.variableId, options.description);
19
+ const outcome = await setVariableDescription(options.variableId, options.description);
20
+ if (!outcome) process.exitCode = 1;
19
21
  }
20
22
  // unrecognized combination of options or no options
21
23
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"esv-variable-set.js","names":["frodo","setVariableDescription","updateVariable","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","requiredOption","option","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","variableId","value","help","process","exitCode","parse"],"sources":["../../../src/cli/esv/esv-variable-set.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\n\nimport { setVariableDescription, updateVariable } from '../../ops/VariablesOps';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo esv variable set');\n\nprogram\n .description('Set variable description.')\n .requiredOption('-i, --variable-id <variable-id>', 'Variable id.')\n .option('--value [value]', 'Variable value.')\n .option('--description [description]', 'Variable description.')\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 (\n options.variableId &&\n options.value &&\n options.description &&\n (await getTokens())\n ) {\n verboseMessage('Updating variable...');\n updateVariable(options.variableId, options.value, options.description);\n } else if (\n options.variableId &&\n options.description &&\n (await getTokens())\n ) {\n verboseMessage('Updating variable...');\n setVariableDescription(options.variableId, options.description);\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Provide --variable-id and either one or both of --value and --description.'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAE7C,SAASC,sBAAsB,EAAEC,cAAc,QAAQ,wBAAwB;AAC/E,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGN,KAAK,CAACO,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,wBAAwB,CAAC;AAE1DG,OAAO,CACJC,WAAW,CAAC,2BAA2B,CAAC,CACxCC,cAAc,CAAC,iCAAiC,EAAE,cAAc,CAAC,CACjEC,MAAM,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAC5CA,MAAM,CAAC,6BAA6B,EAAE,uBAAuB,CAAC,CAC9DC,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,IACED,OAAO,CAACG,UAAU,IAClBH,OAAO,CAACI,KAAK,IACbJ,OAAO,CAACR,WAAW,KAClB,MAAMH,SAAS,CAAC,CAAC,CAAC,EACnB;IACAF,cAAc,CAAC,sBAAsB,CAAC;IACtCF,cAAc,CAACe,OAAO,CAACG,UAAU,EAAEH,OAAO,CAACI,KAAK,EAAEJ,OAAO,CAACR,WAAW,CAAC;EACxE,CAAC,MAAM,IACLQ,OAAO,CAACG,UAAU,IAClBH,OAAO,CAACR,WAAW,KAClB,MAAMH,SAAS,CAAC,CAAC,CAAC,EACnB;IACAF,cAAc,CAAC,sBAAsB,CAAC;IACtCH,sBAAsB,CAACgB,OAAO,CAACG,UAAU,EAAEH,OAAO,CAACR,WAAW,CAAC;EACjE;EACA;EAAA,KACK;IACHN,YAAY,CACV,4EACF,CAAC;IACDK,OAAO,CAACc,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHhB,OAAO,CAACiB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"esv-variable-set.js","names":["frodo","setVariableDescription","updateVariable","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","requiredOption","option","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","variableId","value","outcome","process","exitCode","help","parse"],"sources":["../../../src/cli/esv/esv-variable-set.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\n\nimport { setVariableDescription, updateVariable } from '../../ops/VariablesOps';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo esv variable set');\n\nprogram\n .description('Set variable description.')\n .requiredOption('-i, --variable-id <variable-id>', 'Variable id.')\n .option('--value [value]', 'Variable value.')\n .option('--description [description]', 'Variable description.')\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 (\n options.variableId &&\n options.value &&\n options.description &&\n (await getTokens())\n ) {\n verboseMessage('Updating variable...');\n const outcome = await updateVariable(\n options.variableId,\n options.value,\n options.description\n );\n if (!outcome) process.exitCode = 1;\n } else if (\n options.variableId &&\n options.description &&\n (await getTokens())\n ) {\n verboseMessage('Updating variable...');\n const outcome = await setVariableDescription(\n options.variableId,\n options.description\n );\n if (!outcome) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Provide --variable-id and either one or both of --value and --description.'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAE7C,SAASC,sBAAsB,EAAEC,cAAc,QAAQ,wBAAwB;AAC/E,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGN,KAAK,CAACO,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,wBAAwB,CAAC;AAE1DG,OAAO,CACJC,WAAW,CAAC,2BAA2B,CAAC,CACxCC,cAAc,CAAC,iCAAiC,EAAE,cAAc,CAAC,CACjEC,MAAM,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAC5CA,MAAM,CAAC,6BAA6B,EAAE,uBAAuB,CAAC,CAC9DC,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,IACED,OAAO,CAACG,UAAU,IAClBH,OAAO,CAACI,KAAK,IACbJ,OAAO,CAACR,WAAW,KAClB,MAAMH,SAAS,CAAC,CAAC,CAAC,EACnB;IACAF,cAAc,CAAC,sBAAsB,CAAC;IACtC,MAAMkB,OAAO,GAAG,MAAMpB,cAAc,CAClCe,OAAO,CAACG,UAAU,EAClBH,OAAO,CAACI,KAAK,EACbJ,OAAO,CAACR,WACV,CAAC;IACD,IAAI,CAACa,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM,IACLP,OAAO,CAACG,UAAU,IAClBH,OAAO,CAACR,WAAW,KAClB,MAAMH,SAAS,CAAC,CAAC,CAAC,EACnB;IACAF,cAAc,CAAC,sBAAsB,CAAC;IACtC,MAAMkB,OAAO,GAAG,MAAMrB,sBAAsB,CAC1CgB,OAAO,CAACG,UAAU,EAClBH,OAAO,CAACR,WACV,CAAC;IACD,IAAI,CAACa,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK;IACHrB,YAAY,CACV,4EACF,CAAC;IACDK,OAAO,CAACiB,IAAI,CAAC,CAAC;IACdF,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHhB,OAAO,CAACkB,KAAK,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { frodo, state } from '@rockcarver/frodo-lib';
2
2
  import fs from 'fs';
3
+ import { cleanupProgressIndicators, createKeyValueTable, createProgressIndicator, printMessage, stopProgressIndicator, updateProgressIndicator } from '../utils/Console';
3
4
  import { extractScriptToFile } from './ScriptOps';
4
5
  const {
5
6
  getRealmName,
@@ -10,8 +11,148 @@ const {
10
11
  getWorkingDirectory
11
12
  } = frodo.utils;
12
13
  const {
13
- exportFullConfiguration
14
+ exportFullConfiguration,
15
+ generateRfc7523AuthZGrantArtifacts: _generateRfc7523AuthZGrantArtifacts,
16
+ executeRfc7523AuthZGrantFlow: _executeRfc7523AuthZGrantFlow
14
17
  } = frodo.admin;
18
+ const {
19
+ stringify
20
+ } = frodo.utils.json;
21
+ const {
22
+ readOAuth2TrustedJwtIssuer
23
+ } = frodo.oauth2oidc.issuer;
24
+ function getJwkFilePath(clientId) {
25
+ return getFilePath(getTypedFilename(clientId + '_private', 'jwk'), true);
26
+ }
27
+ function getJwksFilePath(clientId) {
28
+ return getFilePath(getTypedFilename(clientId + '_public', 'jwks'), true);
29
+ }
30
+ export async function generateRfc7523AuthZGrantArtifacts(clientId, iss, jwk, sub, scope, options, json) {
31
+ let artifacts;
32
+ try {
33
+ const barId = createProgressIndicator('determinate', options.save ? 3 : 1, 'Generating artifacts...');
34
+ artifacts = await _generateRfc7523AuthZGrantArtifacts(clientId, iss, jwk, sub, scope, options);
35
+ updateProgressIndicator(barId, 'Successfully generated artifacts.');
36
+ let jwkFile;
37
+ let jwksFile;
38
+ if (options.save) {
39
+ const jwkBarId = createProgressIndicator('determinate', 1, 'Saving JWK (private key)...');
40
+ jwkFile = getJwkFilePath(clientId);
41
+ saveJsonToFile(artifacts.jwk, jwkFile, false);
42
+ updateProgressIndicator(jwkBarId, `Saved JWK to ${jwkFile}.`);
43
+ updateProgressIndicator(barId, 'Successfully saved JWK (private key).');
44
+ stopProgressIndicator(jwkBarId);
45
+ const jwksBarId = createProgressIndicator('determinate', 1, 'Saving JWKS (public key)...');
46
+ jwksFile = getJwksFilePath(clientId);
47
+ saveJsonToFile(artifacts.jwks, jwksFile, false);
48
+ updateProgressIndicator(jwksBarId, `Saved JWKS to ${jwksFile}.`);
49
+ stopProgressIndicator(jwksBarId);
50
+ updateProgressIndicator(barId, 'Successfully saved JWKS (public key).');
51
+ }
52
+ stopProgressIndicator(barId, `Successfully generated ${options.save ? 'and saved artifacts' : 'artifacts'}.`);
53
+ cleanupProgressIndicators();
54
+ if (json) {
55
+ printMessage(artifacts, 'data');
56
+ } else {
57
+ var _artifacts$issuer$all, _artifacts$issuer$all2;
58
+ printMessage(options.save ? `\nCreated oauth2 client in the ${state.getRealm()} realm:` : `\nIn AM, create an OAuth2 client in the ${state.getRealm()} realm with the following information:`);
59
+ const client = createKeyValueTable();
60
+ client.push(['Client ID'['brightCyan'], clientId]);
61
+ client.push(['Client Name'['brightCyan'], clientId]);
62
+ client.push(['Scopes'['brightCyan'], artifacts.client.coreOAuth2ClientConfig.scopes.value.join(', ')]);
63
+ client.push(['Client Type'['brightCyan'], artifacts.client.coreOAuth2ClientConfig.clientType.value]);
64
+ client.push(['Grant Types'['brightCyan'], artifacts.client.advancedOAuth2ClientConfig.grantTypes.value.join(', ')]);
65
+ client.push(['Implied Consent'['brightCyan'], artifacts.client.advancedOAuth2ClientConfig.isConsentImplied.value]);
66
+ client.push(['Token Endpoint Authentication '['brightCyan'], artifacts.client.advancedOAuth2ClientConfig.tokenEndpointAuthMethod.value]);
67
+ client.push(['Public Key Selector'['brightCyan'], artifacts.client.signEncOAuth2ClientConfig.publicKeyLocation.value]);
68
+ client.push(['JWKS (Public Key)'['brightCyan'], options.save ? `${jwksFile}` : 'See below']);
69
+ printMessage(`\n${client.toString()}`);
70
+ printMessage(options.save ? `\nCreated oauth2 trusted issuer in the ${state.getRealm()} realm:` : `\nIn AM, create a trusted issuer in the ${state.getRealm()} realm with the following information:`);
71
+ const issuer = createKeyValueTable();
72
+ issuer.push(['Name'['brightCyan'], artifacts.issuer._id]);
73
+ issuer.push(['JWT Issuer'['brightCyan'], artifacts.issuer.issuer.value]);
74
+ issuer.push(['Allowed Subjects '['brightCyan'], (_artifacts$issuer$all = artifacts.issuer.allowedSubjects) !== null && _artifacts$issuer$all !== void 0 && _artifacts$issuer$all.value.length ? (_artifacts$issuer$all2 = artifacts.issuer.allowedSubjects) === null || _artifacts$issuer$all2 === void 0 ? void 0 : _artifacts$issuer$all2.value.join(', ') : `Any ${state.getRealm()} realm user`]);
75
+ issuer.push(['JWKS (Public Key)'['brightCyan'], options.save ? `${jwksFile}` : 'See below']);
76
+ printMessage(`\n${issuer.toString()}`);
77
+ if (!options.save) {
78
+ printMessage('\nJWK (Private Key)'['brightCyan']);
79
+ printMessage(stringify(artifacts.jwk));
80
+ printMessage('\nJWKS (Public Key)'['brightCyan']);
81
+ printMessage(stringify(artifacts.jwks));
82
+ }
83
+ }
84
+ return true;
85
+ } catch (error) {
86
+ printMessage(error, 'error');
87
+ return false;
88
+ }
89
+ }
90
+ export async function executeRfc7523AuthZGrantFlow(clientId, iss, jwk, sub, scope, json) {
91
+ let tokenResponse;
92
+ let spinnerId;
93
+ try {
94
+ let issuer;
95
+ // make sure we have an issuer
96
+ if (!iss) {
97
+ let issSpinnerId;
98
+ try {
99
+ issSpinnerId = createProgressIndicator('indeterminate', 0, 'No issuer provided, attempting to find suitable issuer...');
100
+ if (!issuer) issuer = await readOAuth2TrustedJwtIssuer(clientId + '-issuer');
101
+ iss = issuer.issuer.value;
102
+ stopProgressIndicator(issSpinnerId, `Found suitable issuer: ${clientId + '-issuer'} - ${iss}`, 'success');
103
+ } catch (error) {
104
+ stopProgressIndicator(issSpinnerId, `No issuer provided and no suitable issuer could be found: ${error.message}`, 'fail');
105
+ }
106
+ }
107
+ // make sure we have a JWK
108
+ if (!jwk) {
109
+ let jwkSpinnerId;
110
+ try {
111
+ jwkSpinnerId = createProgressIndicator('indeterminate', 0, 'No JWK provided, attempting to locate a suitable JWK...');
112
+ jwk = JSON.parse(fs.readFileSync(getJwkFilePath(clientId), 'utf8'));
113
+ stopProgressIndicator(jwkSpinnerId, `Loaded private key JWK from: ${getJwkFilePath(clientId)}`, 'success');
114
+ } catch (error) {
115
+ stopProgressIndicator(jwkSpinnerId, `No JWK provided and no suitable JWK could be loaded from file: ${error.message}`, 'fail');
116
+ }
117
+ }
118
+ // make sure we have a subject
119
+ if (!sub) {
120
+ let subSpinnerId;
121
+ try {
122
+ subSpinnerId = createProgressIndicator('indeterminate', 0, 'Executing rfc7523 authz grant flow...');
123
+ if (!issuer) issuer = await frodo.oauth2oidc.issuer.readOAuth2TrustedJwtIssuer(clientId + '-issuer');
124
+ if (issuer.allowedSubjects.value && issuer.allowedSubjects.value.length) sub = issuer.allowedSubjects.value[0];
125
+ } catch (error) {
126
+ stopProgressIndicator(subSpinnerId, `No subject provided and no suitable subject could be extracted from the trusted issuer configuration: ${error.message}`, 'fail');
127
+ }
128
+ if (sub) {
129
+ stopProgressIndicator(subSpinnerId, `Using first subject from issuer's allowed subjects: ${sub}`, 'success');
130
+ } else {
131
+ stopProgressIndicator(subSpinnerId, `No subject provided and no suitable subject could be extracted from the trusted issuer's list of allowed subjects.`, 'success');
132
+ }
133
+ }
134
+ // we got everything we need, let's get that token
135
+ spinnerId = createProgressIndicator('indeterminate', 0, 'Executing rfc7523 authz grant flow...');
136
+ tokenResponse = await _executeRfc7523AuthZGrantFlow(clientId, iss, jwk, sub, scope);
137
+ stopProgressIndicator(spinnerId, 'Successfully executed rfc7523 authz grant flow.', 'success');
138
+ } catch (error) {
139
+ var _error$response;
140
+ stopProgressIndicator(spinnerId, `Error executing rfc7523 authz grant flow: ${stringify(((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data) || error.message)}`, 'fail');
141
+ return false;
142
+ }
143
+ cleanupProgressIndicators();
144
+ if (json) {
145
+ printMessage(tokenResponse, 'data');
146
+ } else {
147
+ printMessage('\nAccess Token'['brightCyan']);
148
+ printMessage(tokenResponse.access_token);
149
+ if (tokenResponse.id_token) {
150
+ printMessage('\nIdentity Token'['brightCyan']);
151
+ printMessage(tokenResponse.id_token);
152
+ }
153
+ }
154
+ return true;
155
+ }
15
156
 
16
157
  /**
17
158
  * Export everything to separate files
@@ -1 +1 @@
1
- {"version":3,"file":"AdminOps.js","names":["frodo","state","fs","extractScriptToFile","getRealmName","getTypedFilename","titleCase","saveJsonToFile","getFilePath","getWorkingDirectory","utils","exportFullConfiguration","admin","exportEverythingToFile","file","options","useStringArrays","noDecode","exportData","fileName","getRealm","exportEverythingToFiles","extract","meta","baseDirectory","Object","entries","forEach","type","obj","existsSync","mkdirSync","samlData","saml","cot","hosted","metadata","remote","id","value","concat","filename","entityId","samlType","authentication","name","includes","slice","lastIndexOf","recursive"],"sources":["../../src/ops/AdminOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport {\n FullExportInterface,\n FullExportOptions,\n} from '@rockcarver/frodo-lib/types/ops/AdminOps';\nimport { ScriptExportInterface } from '@rockcarver/frodo-lib/types/ops/ScriptOps';\nimport fs from 'fs';\n\nimport { extractScriptToFile } from './ScriptOps';\n\nconst {\n getRealmName,\n getTypedFilename,\n titleCase,\n saveJsonToFile,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst { exportFullConfiguration } = frodo.admin;\n\n/**\n * Export everything to separate files\n * @param file file name\n * @param {FullExportOptions} options export options\n */\nexport async function exportEverythingToFile(\n file,\n options: FullExportOptions = {\n useStringArrays: true,\n noDecode: false,\n }\n): Promise<void> {\n const exportData = await exportFullConfiguration(options);\n let fileName = getTypedFilename(\n `${titleCase(getRealmName(state.getRealm()))}`,\n `everything`\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true));\n}\n\n/**\n * Export everything to separate files\n * @param extract Extracts the scripts from the exports into separate files if true\n * @param {FullExportOptions} options export options\n */\nexport async function exportEverythingToFiles(\n extract = false,\n options: FullExportOptions = {\n useStringArrays: true,\n noDecode: false,\n }\n): Promise<void> {\n const exportData: FullExportInterface =\n await exportFullConfiguration(options);\n delete exportData.meta;\n const baseDirectory = getWorkingDirectory(true);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(exportData).forEach(([type, obj]: [string, any]) => {\n if (obj) {\n if (!fs.existsSync(`${baseDirectory}/${type}`)) {\n fs.mkdirSync(`${baseDirectory}/${type}`);\n }\n if (type == 'saml') {\n const samlData = {\n saml: {\n cot: {},\n hosted: {},\n metadata: {},\n remote: {},\n },\n };\n if (obj.cot) {\n if (!fs.existsSync(`${baseDirectory}/cot`)) {\n fs.mkdirSync(`${baseDirectory}/cot`);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(obj.cot).forEach(([id, value]: [string, any]) => {\n samlData.saml.cot = {\n [id]: value,\n };\n saveJsonToFile(\n samlData,\n `${baseDirectory}/cot/${getTypedFilename(id, 'cot.saml')}`\n );\n });\n samlData.saml.cot = {};\n }\n Object.entries(obj.hosted)\n .concat(Object.entries(obj.remote))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .forEach(([id, value]: [string, any]) => {\n const filename = getTypedFilename(\n value.entityId ? value.entityId : id,\n type\n );\n const samlType = obj.hosted[id] ? 'hosted' : 'remote';\n samlData.saml[samlType][id] = value;\n samlData.saml.metadata = {\n [id]: obj.metadata[id],\n };\n saveJsonToFile(samlData, `${baseDirectory}/${type}/${filename}`);\n samlData.saml[samlType] = {};\n });\n } else if (type == 'authentication') {\n const fileName = getTypedFilename(\n `${frodo.utils.getRealmName(state.getRealm())}Realm`,\n 'authentication.settings'\n );\n saveJsonToFile(\n {\n authentication: obj,\n },\n `${baseDirectory}/${type}/${fileName}`\n );\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(obj).forEach(([id, value]: [string, any]) => {\n const filename =\n type == 'config'\n ? `${id}.json`\n : getTypedFilename(value.name ? value.name : id, type);\n if (type == 'config' && filename.includes('/')) {\n fs.mkdirSync(\n `${baseDirectory}/${type}/${filename.slice(\n 0,\n filename.lastIndexOf('/')\n )}`,\n {\n recursive: true,\n }\n );\n }\n if (extract && type == 'script') {\n extractScriptToFile(exportData as ScriptExportInterface, id, type);\n }\n saveJsonToFile(\n {\n [type]: {\n [id]: value,\n },\n },\n `${baseDirectory}/${type}/${filename}`\n );\n });\n }\n }\n });\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAMpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SAASC,mBAAmB,QAAQ,aAAa;AAEjD,MAAM;EACJC,YAAY;EACZC,gBAAgB;EAChBC,SAAS;EACTC,cAAc;EACdC,WAAW;EACXC;AACF,CAAC,GAAGT,KAAK,CAACU,KAAK;AACf,MAAM;EAAEC;AAAwB,CAAC,GAAGX,KAAK,CAACY,KAAK;;AAE/C;AACA;AACA;AACA;AACA;AACA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;YACR;UACF,CAAC,EACA,GAAEf,aAAc,IAAGI,IAAK,IAAGa,QAAS,EACvC,CAAC;QACH,CAAC,CAAC;MACJ;IACF;EACF,CAAC,CAAC;AACJ"}
1
+ {"version":3,"file":"AdminOps.js","names":["frodo","state","fs","cleanupProgressIndicators","createKeyValueTable","createProgressIndicator","printMessage","stopProgressIndicator","updateProgressIndicator","extractScriptToFile","getRealmName","getTypedFilename","titleCase","saveJsonToFile","getFilePath","getWorkingDirectory","utils","exportFullConfiguration","generateRfc7523AuthZGrantArtifacts","_generateRfc7523AuthZGrantArtifacts","executeRfc7523AuthZGrantFlow","_executeRfc7523AuthZGrantFlow","admin","stringify","json","readOAuth2TrustedJwtIssuer","oauth2oidc","issuer","getJwkFilePath","clientId","getJwksFilePath","iss","jwk","sub","scope","options","artifacts","barId","save","jwkFile","jwksFile","jwkBarId","jwksBarId","jwks","_artifacts$issuer$all","_artifacts$issuer$all2","getRealm","client","push","coreOAuth2ClientConfig","scopes","value","join","clientType","advancedOAuth2ClientConfig","grantTypes","isConsentImplied","tokenEndpointAuthMethod","signEncOAuth2ClientConfig","publicKeyLocation","toString","_id","allowedSubjects","length","error","tokenResponse","spinnerId","issSpinnerId","message","jwkSpinnerId","JSON","parse","readFileSync","subSpinnerId","_error$response","response","data","access_token","id_token","exportEverythingToFile","file","useStringArrays","noDecode","exportData","fileName","exportEverythingToFiles","extract","meta","baseDirectory","Object","entries","forEach","type","obj","existsSync","mkdirSync","samlData","saml","cot","hosted","metadata","remote","id","concat","filename","entityId","samlType","authentication","name","includes","slice","lastIndexOf","recursive"],"sources":["../../src/ops/AdminOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Writable } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport { OAuth2ClientSkeleton } from '@rockcarver/frodo-lib/types/api/OAuth2ClientApi';\nimport { AccessTokenResponseType } from '@rockcarver/frodo-lib/types/api/OAuth2OIDCApi';\nimport { OAuth2TrustedJwtIssuerSkeleton } from '@rockcarver/frodo-lib/types/api/OAuth2TrustedJwtIssuerApi';\nimport {\n FullExportInterface,\n FullExportOptions,\n} from '@rockcarver/frodo-lib/types/ops/AdminOps';\nimport { JwkRsa, JwksInterface } from '@rockcarver/frodo-lib/types/ops/JoseOps';\nimport { ScriptExportInterface } from '@rockcarver/frodo-lib/types/ops/ScriptOps';\nimport fs from 'fs';\n\nimport {\n cleanupProgressIndicators,\n createKeyValueTable,\n createProgressIndicator,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\nimport { extractScriptToFile } from './ScriptOps';\n\nconst {\n getRealmName,\n getTypedFilename,\n titleCase,\n saveJsonToFile,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n exportFullConfiguration,\n generateRfc7523AuthZGrantArtifacts: _generateRfc7523AuthZGrantArtifacts,\n executeRfc7523AuthZGrantFlow: _executeRfc7523AuthZGrantFlow,\n} = frodo.admin;\nconst { stringify } = frodo.utils.json;\nconst { readOAuth2TrustedJwtIssuer } = frodo.oauth2oidc.issuer;\n\nfunction getJwkFilePath(clientId: string): string {\n return getFilePath(getTypedFilename(clientId + '_private', 'jwk'), true);\n}\n\nfunction getJwksFilePath(clientId: string): string {\n return getFilePath(getTypedFilename(clientId + '_public', 'jwks'), true);\n}\n\nexport async function generateRfc7523AuthZGrantArtifacts(\n clientId: string,\n iss: string,\n jwk?: JwkRsa,\n sub?: string,\n scope?: string[],\n options?: { save: boolean },\n json?: boolean\n): Promise<boolean> {\n let artifacts: {\n jwk: JwkRsa;\n jwks: JwksInterface;\n client: OAuth2ClientSkeleton;\n issuer: OAuth2TrustedJwtIssuerSkeleton;\n };\n try {\n const barId = createProgressIndicator(\n 'determinate',\n options.save ? 3 : 1,\n 'Generating artifacts...'\n );\n artifacts = await _generateRfc7523AuthZGrantArtifacts(\n clientId,\n iss,\n jwk,\n sub,\n scope,\n options\n );\n updateProgressIndicator(barId, 'Successfully generated artifacts.');\n let jwkFile: string;\n let jwksFile: string;\n if (options.save) {\n const jwkBarId = createProgressIndicator(\n 'determinate',\n 1,\n 'Saving JWK (private key)...'\n );\n jwkFile = getJwkFilePath(clientId);\n saveJsonToFile(artifacts.jwk, jwkFile, false);\n updateProgressIndicator(jwkBarId, `Saved JWK to ${jwkFile}.`);\n updateProgressIndicator(barId, 'Successfully saved JWK (private key).');\n stopProgressIndicator(jwkBarId);\n const jwksBarId = createProgressIndicator(\n 'determinate',\n 1,\n 'Saving JWKS (public key)...'\n );\n jwksFile = getJwksFilePath(clientId);\n saveJsonToFile(artifacts.jwks, jwksFile, false);\n updateProgressIndicator(jwksBarId, `Saved JWKS to ${jwksFile}.`);\n stopProgressIndicator(jwksBarId);\n updateProgressIndicator(barId, 'Successfully saved JWKS (public key).');\n }\n stopProgressIndicator(\n barId,\n `Successfully generated ${\n options.save ? 'and saved artifacts' : 'artifacts'\n }.`\n );\n cleanupProgressIndicators();\n\n if (json) {\n printMessage(artifacts, 'data');\n } else {\n printMessage(\n options.save\n ? `\\nCreated oauth2 client in the ${state.getRealm()} realm:`\n : `\\nIn AM, create an OAuth2 client in the ${state.getRealm()} realm with the following information:`\n );\n const client = createKeyValueTable();\n client.push(['Client ID'['brightCyan'], clientId]);\n client.push(['Client Name'['brightCyan'], clientId]);\n client.push([\n 'Scopes'['brightCyan'],\n (\n artifacts.client.coreOAuth2ClientConfig.scopes as Writable<string[]>\n ).value.join(', '),\n ]);\n client.push([\n 'Client Type'['brightCyan'],\n (artifacts.client.coreOAuth2ClientConfig.clientType as Writable<string>)\n .value,\n ]);\n client.push([\n 'Grant Types'['brightCyan'],\n (\n artifacts.client.advancedOAuth2ClientConfig.grantTypes as Writable<\n string[]\n >\n ).value.join(', '),\n ]);\n client.push([\n 'Implied Consent'['brightCyan'],\n (\n artifacts.client.advancedOAuth2ClientConfig\n .isConsentImplied as Writable<boolean>\n ).value,\n ]);\n client.push([\n 'Token Endpoint Authentication '['brightCyan'],\n (\n artifacts.client.advancedOAuth2ClientConfig\n .tokenEndpointAuthMethod as Writable<string>\n ).value,\n ]);\n client.push([\n 'Public Key Selector'['brightCyan'],\n (\n artifacts.client.signEncOAuth2ClientConfig\n .publicKeyLocation as Writable<string>\n ).value,\n ]);\n client.push([\n 'JWKS (Public Key)'['brightCyan'],\n options.save ? `${jwksFile}` : 'See below',\n ]);\n printMessage(`\\n${client.toString()}`);\n\n printMessage(\n options.save\n ? `\\nCreated oauth2 trusted issuer in the ${state.getRealm()} realm:`\n : `\\nIn AM, create a trusted issuer in the ${state.getRealm()} realm with the following information:`\n );\n const issuer = createKeyValueTable();\n issuer.push(['Name'['brightCyan'], artifacts.issuer._id]);\n issuer.push([\n 'JWT Issuer'['brightCyan'],\n (artifacts.issuer.issuer as Writable<string>).value,\n ]);\n issuer.push([\n 'Allowed Subjects '['brightCyan'],\n (artifacts.issuer.allowedSubjects as Writable<string[]>)?.value.length\n ? (\n artifacts.issuer.allowedSubjects as Writable<string[]>\n )?.value.join(', ')\n : `Any ${state.getRealm()} realm user`,\n ]);\n issuer.push([\n 'JWKS (Public Key)'['brightCyan'],\n options.save ? `${jwksFile}` : 'See below',\n ]);\n printMessage(`\\n${issuer.toString()}`);\n if (!options.save) {\n printMessage('\\nJWK (Private Key)'['brightCyan']);\n printMessage(stringify(artifacts.jwk));\n printMessage('\\nJWKS (Public Key)'['brightCyan']);\n printMessage(stringify(artifacts.jwks));\n }\n }\n return true;\n } catch (error) {\n printMessage(error, 'error');\n return false;\n }\n}\n\nexport async function executeRfc7523AuthZGrantFlow(\n clientId: string,\n iss?: string,\n jwk?: JwkRsa,\n sub?: string,\n scope?: string[],\n json?: boolean\n): Promise<boolean> {\n let tokenResponse: AccessTokenResponseType;\n let spinnerId: string;\n try {\n let issuer: OAuth2TrustedJwtIssuerSkeleton;\n // make sure we have an issuer\n if (!iss) {\n let issSpinnerId: string;\n try {\n issSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'No issuer provided, attempting to find suitable issuer...'\n );\n if (!issuer)\n issuer = await readOAuth2TrustedJwtIssuer(clientId + '-issuer');\n iss = (issuer.issuer as Writable<string>).value;\n stopProgressIndicator(\n issSpinnerId,\n `Found suitable issuer: ${clientId + '-issuer'} - ${iss}`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n issSpinnerId,\n `No issuer provided and no suitable issuer could be found: ${error.message}`,\n 'fail'\n );\n }\n }\n // make sure we have a JWK\n if (!jwk) {\n let jwkSpinnerId: string;\n try {\n jwkSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'No JWK provided, attempting to locate a suitable JWK...'\n );\n jwk = JSON.parse(fs.readFileSync(getJwkFilePath(clientId), 'utf8'));\n stopProgressIndicator(\n jwkSpinnerId,\n `Loaded private key JWK from: ${getJwkFilePath(clientId)}`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n jwkSpinnerId,\n `No JWK provided and no suitable JWK could be loaded from file: ${error.message}`,\n 'fail'\n );\n }\n }\n // make sure we have a subject\n if (!sub) {\n let subSpinnerId: string;\n try {\n subSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'Executing rfc7523 authz grant flow...'\n );\n if (!issuer)\n issuer = await frodo.oauth2oidc.issuer.readOAuth2TrustedJwtIssuer(\n clientId + '-issuer'\n );\n if (\n (issuer.allowedSubjects as Writable<string[]>).value &&\n (issuer.allowedSubjects as Writable<string[]>).value.length\n )\n sub = (issuer.allowedSubjects as Writable<string[]>).value[0];\n } catch (error) {\n stopProgressIndicator(\n subSpinnerId,\n `No subject provided and no suitable subject could be extracted from the trusted issuer configuration: ${error.message}`,\n 'fail'\n );\n }\n if (sub) {\n stopProgressIndicator(\n subSpinnerId,\n `Using first subject from issuer's allowed subjects: ${sub}`,\n 'success'\n );\n } else {\n stopProgressIndicator(\n subSpinnerId,\n `No subject provided and no suitable subject could be extracted from the trusted issuer's list of allowed subjects.`,\n 'success'\n );\n }\n }\n // we got everything we need, let's get that token\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'Executing rfc7523 authz grant flow...'\n );\n tokenResponse = await _executeRfc7523AuthZGrantFlow(\n clientId,\n iss,\n jwk,\n sub,\n scope\n );\n stopProgressIndicator(\n spinnerId,\n 'Successfully executed rfc7523 authz grant flow.',\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error executing rfc7523 authz grant flow: ${stringify(\n error.response?.data || error.message\n )}`,\n 'fail'\n );\n return false;\n }\n cleanupProgressIndicators();\n\n if (json) {\n printMessage(tokenResponse, 'data');\n } else {\n printMessage('\\nAccess Token'['brightCyan']);\n printMessage(tokenResponse.access_token);\n if (tokenResponse.id_token) {\n printMessage('\\nIdentity Token'['brightCyan']);\n printMessage(tokenResponse.id_token);\n }\n }\n return true;\n}\n\n/**\n * Export everything to separate files\n * @param file file name\n * @param {FullExportOptions} options export options\n */\nexport async function exportEverythingToFile(\n file,\n options: FullExportOptions = {\n useStringArrays: true,\n noDecode: false,\n }\n): Promise<void> {\n const exportData = await exportFullConfiguration(options);\n let fileName = getTypedFilename(\n `${titleCase(getRealmName(state.getRealm()))}`,\n `everything`\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true));\n}\n\n/**\n * Export everything to separate files\n * @param extract Extracts the scripts from the exports into separate files if true\n * @param {FullExportOptions} options export options\n */\nexport async function exportEverythingToFiles(\n extract = false,\n options: FullExportOptions = {\n useStringArrays: true,\n noDecode: false,\n }\n): Promise<void> {\n const exportData: FullExportInterface =\n await exportFullConfiguration(options);\n delete exportData.meta;\n const baseDirectory = getWorkingDirectory(true);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(exportData).forEach(([type, obj]: [string, any]) => {\n if (obj) {\n if (!fs.existsSync(`${baseDirectory}/${type}`)) {\n fs.mkdirSync(`${baseDirectory}/${type}`);\n }\n if (type == 'saml') {\n const samlData = {\n saml: {\n cot: {},\n hosted: {},\n metadata: {},\n remote: {},\n },\n };\n if (obj.cot) {\n if (!fs.existsSync(`${baseDirectory}/cot`)) {\n fs.mkdirSync(`${baseDirectory}/cot`);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(obj.cot).forEach(([id, value]: [string, any]) => {\n samlData.saml.cot = {\n [id]: value,\n };\n saveJsonToFile(\n samlData,\n `${baseDirectory}/cot/${getTypedFilename(id, 'cot.saml')}`\n );\n });\n samlData.saml.cot = {};\n }\n Object.entries(obj.hosted)\n .concat(Object.entries(obj.remote))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .forEach(([id, value]: [string, any]) => {\n const filename = getTypedFilename(\n value.entityId ? value.entityId : id,\n type\n );\n const samlType = obj.hosted[id] ? 'hosted' : 'remote';\n samlData.saml[samlType][id] = value;\n samlData.saml.metadata = {\n [id]: obj.metadata[id],\n };\n saveJsonToFile(samlData, `${baseDirectory}/${type}/${filename}`);\n samlData.saml[samlType] = {};\n });\n } else if (type == 'authentication') {\n const fileName = getTypedFilename(\n `${frodo.utils.getRealmName(state.getRealm())}Realm`,\n 'authentication.settings'\n );\n saveJsonToFile(\n {\n authentication: obj,\n },\n `${baseDirectory}/${type}/${fileName}`\n );\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(obj).forEach(([id, value]: [string, any]) => {\n const filename =\n type == 'config'\n ? `${id}.json`\n : getTypedFilename(value.name ? value.name : id, type);\n if (type == 'config' && filename.includes('/')) {\n fs.mkdirSync(\n `${baseDirectory}/${type}/${filename.slice(\n 0,\n filename.lastIndexOf('/')\n )}`,\n {\n recursive: true,\n }\n );\n }\n if (extract && type == 'script') {\n extractScriptToFile(exportData as ScriptExportInterface, id, type);\n }\n saveJsonToFile(\n {\n [type]: {\n [id]: value,\n },\n },\n `${baseDirectory}/${type}/${filename}`\n );\n });\n }\n }\n });\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAWpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,yBAAyB,EACzBC,mB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