@rockcarver/frodo-cli 2.0.0-55 → 2.0.0-57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.0.0-56] - 2024-05-01
11
+
12
+ ## [2.0.0-55] - 2024-04-09
13
+
10
14
  ### Changed
11
15
 
12
16
  - Update to frodo-lib 2.0.0-77
@@ -1541,7 +1545,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1541
1545
  - Fixed problem with adding connection profiles
1542
1546
  - Miscellaneous bug fixes
1543
1547
 
1544
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-54...HEAD
1548
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-56...HEAD
1549
+
1550
+ [2.0.0-56]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-55...v2.0.0-56
1551
+
1552
+ [2.0.0-55]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-54...v2.0.0-55
1545
1553
 
1546
1554
  [2.0.0-54]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-53...v2.0.0-54
1547
1555
 
@@ -13,14 +13,14 @@ program.description('Export scripts.').addOption(new Option('-n, --script-name <
13
13
  // )
14
14
  .addOption(new Option('-f, --file <file>', 'Name of the export file.')).addOption(new Option('-a, --all', 'Export all scripts to a single file. Ignored with -n.')).addOption(new Option('-A, --all-separate', 'Export all scripts to separate files (*.script.json) in the current directory. Ignored with -n or -a.')).addOption(new Option('-N, --no-metadata', 'Does not include metadata in the export file.'))
15
15
  // deprecated option
16
- .addOption(new Option('-s, --script <script>', 'DEPRECATED! Use -n/--script-name instead. Name of the script.')).addOption(new Option('-x, --extract', 'Extract the script from the exported file, and save it to a separate file. Ignored with -n or -a.')).addOption(new Option('-d, --default', 'Export all scripts including the default scripts. Ignored with -n.')).action(
16
+ .addOption(new Option('-s, --script <script>', 'DEPRECATED! Use -n/--script-name instead. Name of the script.')).addOption(new Option('-x, --extract', 'Extract the script from the exported file, and save it to a separate file. Ignored with -a.')).addOption(new Option('-d, --default', 'Export all scripts including the default scripts. Ignored with -n.')).action(
17
17
  // implement command logic inside action handler
18
18
  async (host, realm, user, password, options, command) => {
19
19
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
20
20
  // export by name
21
21
  if ((options.scriptName || options.script) && (await getTokens())) {
22
22
  verboseMessage('Exporting script...');
23
- const outcome = await exportScriptByNameToFile(options.scriptName || options.script, options.file, options.metadata);
23
+ const outcome = await exportScriptByNameToFile(options.scriptName || options.script, options.file, options.metadata, options.extract);
24
24
  if (!outcome) process.exitCode = 1;
25
25
  }
26
26
  // -a / --all
@@ -1 +1 @@
1
- {"version":3,"file":"script-export.js","names":["Option","getTokens","exportScriptByNameToFile","exportScriptsToFile","exportScriptsToFiles","printMessage","verboseMessage","FrodoCommand","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","scriptName","script","outcome","file","metadata","process","exitCode","all","default","allSeparate","extract","help","parse"],"sources":["../../../src/cli/script/script-export.ts"],"sourcesContent":["import { Option } from 'commander';\n\nimport { getTokens } from '../../ops/AuthenticateOps';\nimport {\n exportScriptByNameToFile,\n exportScriptsToFile,\n exportScriptsToFiles,\n} from '../../ops/ScriptOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst program = new FrodoCommand('frodo script export');\n\nprogram\n .description('Export scripts.')\n .addOption(\n new Option(\n '-n, --script-name <name>',\n 'Name of the script. If specified, -a and -A are ignored.'\n )\n )\n // .addOption(\n // new Option(\n // '-i, --script-id <uuid>',\n // 'Uuid of the script. 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 scripts to a single file. Ignored with -n.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all scripts to separate files (*.script.json) in the current directory. Ignored with -n 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 // deprecated option\n .addOption(\n new Option(\n '-s, --script <script>',\n 'DEPRECATED! Use -n/--script-name instead. Name of the script.'\n )\n )\n .addOption(\n new Option(\n '-x, --extract',\n 'Extract the script from the exported file, and save it to a separate file. Ignored with -n or -a.'\n )\n )\n .addOption(\n new Option(\n '-d, --default',\n 'Export all scripts including the default scripts. Ignored with -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 // export by name\n if ((options.scriptName || options.script) && (await getTokens())) {\n verboseMessage('Exporting script...');\n const outcome = await exportScriptByNameToFile(\n options.scriptName || options.script,\n options.file,\n options.metadata\n );\n if (!outcome) process.exitCode = 1;\n }\n // -a / --all\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all scripts to a single file...');\n const outcome = await exportScriptsToFile(\n options.file,\n options.metadata,\n options.default\n );\n if (!outcome) process.exitCode = 1;\n }\n // -A / --all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all scripts to separate files...');\n // -x / --extract\n const outcome = await exportScriptsToFiles(\n options.extract,\n options.metadata,\n options.default\n );\n if (!outcome) process.exitCode = 1;\n }\n\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,WAAW;AAElC,SAASC,SAAS,QAAQ,2BAA2B;AACrD,SACEC,wBAAwB,EACxBC,mBAAmB,EACnBC,oBAAoB,QACf,qBAAqB;AAC5B,SAASC,YAAY,EAAEC,c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;IACD,IAAI,CAACF,OAAO,EAAEG,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK,IAAIT,OAAO,CAACU,GAAG,KAAK,MAAMzB,SAAS,CAAC,CAAC,CAAC,EAAE;IAC3CK,cAAc,CAAC,2CAA2C,CAAC;IAC3D,MAAMe,OAAO,GAAG,MAAMlB,mBAAmB,CACvCa,OAAO,CAACM,IAAI,EACZN,OAAO,CAACO,QAAQ,EAChBP,OAAO,CAACW,OACV,CAAC;IACD,IAAI,CAACN,OAAO,EAAEG,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK,IAAIT,OAAO,CAACY,WAAW,KAAK,MAAM3B,SAAS,CAAC,CAAC,CAAC,EAAE;IACnDK,cAAc,CAAC,4CAA4C,CAAC;IAC5D;IACA,MAAMe,OAAO,GAAG,MAAMjB,oBAAoB,CACxCY,OAAO,CAACa,OAAO,EACfb,OAAO,CAACO,QAAQ,EAChBP,OAAO,CAACW,OACV,CAAC;IACD,IAAI,CAACN,OAAO,EAAEG,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;;EAEA;EAAA,KACK;IACHpB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDG,OAAO,CAACsB,IAAI,CAAC,CAAC;IACdN,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHjB,OAAO,CAACuB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"script-export.js","names":["Option","getTokens","exportScriptByNameToFile","exportScriptsToFile","exportScriptsToFiles","printMessage","verboseMessage","FrodoCommand","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","scriptName","script","outcome","file","metadata","extract","process","exitCode","all","default","allSeparate","help","parse"],"sources":["../../../src/cli/script/script-export.ts"],"sourcesContent":["import { Option } from 'commander';\n\nimport { getTokens } from '../../ops/AuthenticateOps';\nimport {\n exportScriptByNameToFile,\n exportScriptsToFile,\n exportScriptsToFiles,\n} from '../../ops/ScriptOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst program = new FrodoCommand('frodo script export');\n\nprogram\n .description('Export scripts.')\n .addOption(\n new Option(\n '-n, --script-name <name>',\n 'Name of the script. If specified, -a and -A are ignored.'\n )\n )\n // .addOption(\n // new Option(\n // '-i, --script-id <uuid>',\n // 'Uuid of the script. 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 scripts to a single file. Ignored with -n.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all scripts to separate files (*.script.json) in the current directory. Ignored with -n 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 // deprecated option\n .addOption(\n new Option(\n '-s, --script <script>',\n 'DEPRECATED! Use -n/--script-name instead. Name of the script.'\n )\n )\n .addOption(\n new Option(\n '-x, --extract',\n 'Extract the script from the exported file, and save it to a separate file. Ignored with -a.'\n )\n )\n .addOption(\n new Option(\n '-d, --default',\n 'Export all scripts including the default scripts. Ignored with -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 // export by name\n if ((options.scriptName || options.script) && (await getTokens())) {\n verboseMessage('Exporting script...');\n const outcome = await exportScriptByNameToFile(\n options.scriptName || options.script,\n options.file,\n options.metadata,\n options.extract\n );\n if (!outcome) process.exitCode = 1;\n }\n // -a / --all\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all scripts to a single file...');\n const outcome = await exportScriptsToFile(\n options.file,\n options.metadata,\n options.default\n );\n if (!outcome) process.exitCode = 1;\n }\n // -A / --all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all scripts to separate files...');\n // -x / --extract\n const outcome = await exportScriptsToFiles(\n options.extract,\n options.metadata,\n options.default\n );\n if (!outcome) process.exitCode = 1;\n }\n\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,WAAW;AAElC,SAASC,SAAS,QAAQ,2BAA2B;AACrD,SACEC,wBAAwB,EACxBC,mBAAmB,EACnBC,oBAAoB,QACf,qBAAqB;AAC5B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAMC,OAAO,GAAG,IAAID,YAAY,CAAC,qBAAqB,CAAC;AAEvDC,OAAO,CACJC,WAAW,CAAC,iBAAiB,CAAC,CAC9BC,SAAS,CACR,IAAIV,MAAM,CACR,0BAA0B,EAC1B,0DACF,CACF;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,CACCU,SAAS,CAAC,IAAIV,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAAC,CACtEU,SAAS,CACR,IAAIV,MAAM,CACR,WAAW,EACX,uDACF,CACF,CAAC,CACAU,SAAS,CACR,IAAIV,MAAM,CACR,oBAAoB,EACpB,uGACF,CACF,CAAC,CACAU,SAAS,CACR,IAAIV,MAAM,CACR,mBAAmB,EACnB,+CACF,CACF;AACA;AAAA,CACCU,SAAS,CACR,IAAIV,MAAM,CACR,uBAAuB,EACvB,+DACF,CACF,CAAC,CACAU,SAAS,CACR,IAAIV,MAAM,CACR,eAAe,EACf,6FACF,CACF,CAAC,CACAU,SAAS,CACR,IAAIV,MAAM,CACR,eAAe,EACf,oEACF,CACF,CAAC,CACAW,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAA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AACA;AACF,CAAC;AAEHlB,OAAO,CAACuB,KAAK,CAAC,CAAC"}
@@ -4,11 +4,11 @@ import { importFirstServiceFromFile, importServiceFromFile, importServicesFromFi
4
4
  import { printMessage, verboseMessage } from '../../utils/Console.js';
5
5
  import { FrodoCommand } from '../FrodoCommand';
6
6
  const program = new FrodoCommand('frodo service import');
7
- program.description('Import AM services.').addOption(new Option('-i, --service-id <service-id>', 'Service id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import SAML Entity(s) from. Ignored with -A.')).addOption(new Option('-a, --all', 'Import all services from a single file.')).addOption(new Option('-C, --clean', 'Remove existing service(s) before importing.')).addOption(new Option('-A, --all-separate', 'Import all services from separate files <id>.service.json.')).addOption(new Option('-g, --global', 'Import service(s) as global service(s).')).addOption(new Option('-r, --current-realm', 'Import service(s) into the current realm.')).action(async (host, realm, user, password, options, command) => {
7
+ program.description('Import AM services.').addOption(new Option('-i, --service-id <service-id>', 'Service id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import SAML Entity(s) from. Ignored with -A.')).addOption(new Option('-a, --all', 'Import all services from a single file.')).addOption(new Option('-C, --clean', 'Remove existing service(s) before importing.')).addOption(new Option('-A, --all-separate', 'Import all services from separate files <id>.service.json.')).addOption(new Option('-g, --global', 'Import service(s) as global service(s).').default(false)).addOption(new Option('-r, --current-realm', 'Import service(s) into the current realm. Use this flag if you exported a service from one realm and are importing into another realm.').default(false)).action(async (host, realm, user, password, options, command) => {
8
8
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
9
9
  const clean = options.clean ?? false;
10
10
  const globalConfig = options.global ?? false;
11
- const realmConfig = options.realm ?? false;
11
+ const realmConfig = globalConfig ? false : options.currentRealm ?? false;
12
12
 
13
13
  // import by id
14
14
  if (options.serviceId && options.file && (await getTokens())) {
@@ -1 +1 @@
1
- {"version":3,"file":"service-import.js","names":["Option","getTokens","importFirstServiceFromFile","importServiceFromFile","importServicesFromFile","importServicesFromFiles","printMessage","verboseMessage","FrodoCommand","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","clean","globalConfig","global","realmConfig","serviceId","file","outcome","process","exitCode","all","allSeparate","help","parse"],"sources":["../../../src/cli/service/service-import.ts"],"sourcesContent":["import { Option } from 'commander';\n\nimport { getTokens } from '../../ops/AuthenticateOps';\nimport {\n importFirstServiceFromFile,\n importServiceFromFile,\n importServicesFromFile,\n importServicesFromFiles,\n} from '../../ops/ServiceOps.js';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst program = new FrodoCommand('frodo service import');\n\ninterface ServiceImportOptions {\n file?: string;\n all?: boolean;\n serviceId?: string;\n allSeparate?: boolean;\n type?: string;\n insecure?: boolean;\n clean?: boolean;\n directory?: string;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n global?: boolean;\n realm?: boolean;\n}\n\nprogram\n .description('Import AM services.')\n .addOption(\n new Option(\n '-i, --service-id <service-id>',\n 'Service id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to import SAML Entity(s) from. Ignored with -A.'\n )\n )\n .addOption(new Option('-a, --all', 'Import all services from a single file.'))\n .addOption(\n new Option('-C, --clean', 'Remove existing service(s) before importing.')\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all services from separate files <id>.service.json.'\n )\n )\n .addOption(\n new Option('-g, --global', 'Import service(s) as global service(s).')\n )\n .addOption(\n new Option(\n '-r, --current-realm',\n 'Import service(s) into the current realm.'\n )\n )\n .action(\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: ServiceImportOptions,\n command\n ) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n\n const clean = options.clean ?? false;\n const globalConfig = options.global ?? false;\n const realmConfig = options.realm ?? false;\n\n // import by id\n if (options.serviceId && options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n const outcome = await importServiceFromFile(\n options.serviceId,\n options.file,\n {\n clean,\n global: globalConfig,\n realm: realmConfig,\n }\n );\n if (!outcome) process.exitCode = 1;\n }\n // -a / --all\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage('Importing all services from a single file...');\n const outcome = await importServicesFromFile(options.file, {\n clean,\n global: globalConfig,\n realm: realmConfig,\n });\n if (!outcome) process.exitCode = 1;\n }\n // -A / --all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Importing all services from separate files...');\n const outcome = await importServicesFromFiles({\n clean,\n global: globalConfig,\n realm: realmConfig,\n });\n if (!outcome) process.exitCode = 1;\n }\n // import file\n else if (options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n const outcome = await importFirstServiceFromFile(options.file, {\n clean,\n global: globalConfig,\n realm: realmConfig,\n });\n if (!outcome) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,WAAW;AAElC,SAASC,SAAS,QAAQ,2BAA2B;AACrD,SACEC,0BAA0B,EAC1BC,qBAAqB,EACrBC,sBAAsB,EACtBC,uBAAuB,QAClB,yBAAyB;AAChC,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAMC,OAAO,GAAG,IAAID,YAAY,CAAC,sBAAsB,CAAC;AAkBxDC,OAAO,CACJC,WAAW,CAAC,qBAAqB,CAAC,CAClCC,SAAS,CACR,IAAIX,MAAM,CACR,+BAA+B,EAC/B,kDACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,mBAAmB,EACnB,kEACF,CACF,CAAC,CACAW,SAAS,CAAC,IAAIX,MAAM,CAAC,WAAW,EAAE,yCAAyC,CAAC,CAAC,CAC7EW,S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ACQ,IAAI,EAAE;MACzDL,KAAK;MACLE,MAAM,EAAED,YAAY;MACpBP,KAAK,EAAES;IACT,CAAC,CAAC;IACF,IAAI,CAACG,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK,IAAIX,OAAO,CAACa,WAAW,KAAK,MAAM7B,SAAS,CAAC,CAAC,CAAC,EAAE;IACnDM,cAAc,CAAC,+CAA+C,CAAC;IAC/D,MAAMmB,OAAO,GAAG,MAAMrB,uBAAuB,CAAC;MAC5Ce,KAAK;MACLE,MAAM,EAAED,YAAY;MACpBP,KAAK,EAAES;IACT,CAAC,CAAC;IACF,IAAI,CAACG,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK,IAAIX,OAAO,CAACQ,IAAI,KAAK,MAAMxB,SAAS,CAAC,CAAC,CAAC,EAAE;IAC5CM,cAAc,CAAC,sBAAsB,CAAC;IACtC,MAAMmB,OAAO,GAAG,MAAMxB,0BAA0B,CAACe,OAAO,CAACQ,IAAI,EAAE;MAC7DL,KAAK;MACLE,MAAM,EAAED,YAAY;MACpBP,KAAK,EAAES;IACT,CAAC,CAAC;IACF,IAAI,CAACG,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK;IACHtB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDG,OAAO,CAACsB,IAAI,CAAC,CAAC;IACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHnB,OAAO,CAACuB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"service-import.js","names":["Option","getTokens","importFirstServiceFromFile","importServiceFromFile","importServicesFromFile","importServicesFromFiles","printMessage","verboseMessage","FrodoCommand","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","clean","globalConfig","global","realmConfig","currentRealm","serviceId","file","outcome","process","exitCode","all","allSeparate","help","parse"],"sources":["../../../src/cli/service/service-import.ts"],"sourcesContent":["import { Option } from 'commander';\n\nimport { getTokens } from '../../ops/AuthenticateOps';\nimport {\n importFirstServiceFromFile,\n importServiceFromFile,\n importServicesFromFile,\n importServicesFromFiles,\n} from '../../ops/ServiceOps.js';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst program = new FrodoCommand('frodo service import');\n\ninterface ServiceImportOptions {\n file?: string;\n all?: boolean;\n serviceId?: string;\n allSeparate?: boolean;\n type?: string;\n insecure?: boolean;\n clean?: boolean;\n directory?: string;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n global?: boolean;\n currentRealm?: boolean;\n}\n\nprogram\n .description('Import AM services.')\n .addOption(\n new Option(\n '-i, --service-id <service-id>',\n 'Service id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to import SAML Entity(s) from. Ignored with -A.'\n )\n )\n .addOption(new Option('-a, --all', 'Import all services from a single file.'))\n .addOption(\n new Option('-C, --clean', 'Remove existing service(s) before importing.')\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all services from separate files <id>.service.json.'\n )\n )\n .addOption(\n new Option(\n '-g, --global',\n 'Import service(s) as global service(s).'\n ).default(false)\n )\n .addOption(\n new Option(\n '-r, --current-realm',\n 'Import service(s) into the current realm. Use this flag if you exported a service from one realm and are importing into another realm.'\n ).default(false)\n )\n .action(\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: ServiceImportOptions,\n command\n ) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n\n const clean = options.clean ?? false;\n const globalConfig = options.global ?? false;\n const realmConfig = globalConfig ? false : options.currentRealm ?? false;\n\n // import by id\n if (options.serviceId && options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n const outcome = await importServiceFromFile(\n options.serviceId,\n options.file,\n {\n clean,\n global: globalConfig,\n realm: realmConfig,\n }\n );\n if (!outcome) process.exitCode = 1;\n }\n // -a / --all\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage('Importing all services from a single file...');\n const outcome = await importServicesFromFile(options.file, {\n clean,\n global: globalConfig,\n realm: realmConfig,\n });\n if (!outcome) process.exitCode = 1;\n }\n // -A / --all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Importing all services from separate files...');\n const outcome = await importServicesFromFiles({\n clean,\n global: globalConfig,\n realm: realmConfig,\n });\n if (!outcome) process.exitCode = 1;\n }\n // import file\n else if (options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n const outcome = await importFirstServiceFromFile(options.file, {\n clean,\n global: globalConfig,\n realm: realmConfig,\n });\n if (!outcome) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,WAAW;AAElC,SAASC,SAAS,QAAQ,2BAA2B;AACrD,SACEC,0BAA0B,EAC1BC,qBAAqB,EACrBC,sBAAsB,EACtBC,uBAAuB,QAClB,yBAAyB;AAChC,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAMC,OAAO,GAAG,IAAID,YAAY,CAAC,sBAAsB,CAAC;AAkBxDC,OAAO,CACJC,WAAW,CAAC,qBAAqB,CAAC,CAClCC,SAAS,CACR,IAAIX,MAAM,CACR,+BAA+B,EAC/B,kDACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,mBAAmB,EACnB,kEACF,CACF,CAAC,CACAW,SAAS,CAAC,IAAIX,MAAM,CAAC,WAAW,EAAE,yCAAyC,CAAC,CAAC,CAC7EW,SAAS,CACR,IAAIX,MAAM,CAAC,aAAa,EAAE,8CAA8C,CAC1E,CAAC,CACAW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AACc,OAAO,CAACS,IAAI,EAAE;MACzDN,KAAK;MACLE,MAAM,EAAED,YAAY;MACpBP,KAAK,EAAES;IACT,CAAC,CAAC;IACF,IAAI,CAACI,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK,IAAIZ,OAAO,CAACc,WAAW,KAAK,MAAM/B,SAAS,CAAC,CAAC,CAAC,EAAE;IACnDM,cAAc,CAAC,+CAA+C,CAAC;IAC/D,MAAMqB,OAAO,GAAG,MAAMvB,uBAAuB,CAAC;MAC5CgB,KAAK;MACLE,MAAM,EAAED,YAAY;MACpBP,KAAK,EAAES;IACT,CAAC,CAAC;IACF,IAAI,CAACI,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK,IAAIZ,OAAO,CAACS,IAAI,KAAK,MAAM1B,SAAS,CAAC,CAAC,CAAC,EAAE;IAC5CM,cAAc,CAAC,sBAAsB,CAAC;IACtC,MAAMqB,OAAO,GAAG,MAAM1B,0BAA0B,CAACgB,OAAO,CAACS,IAAI,EAAE;MAC7DN,KAAK;MACLE,MAAM,EAAED,YAAY;MACpBP,KAAK,EAAES;IACT,CAAC,CAAC;IACF,IAAI,CAACI,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK;IACHxB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDG,OAAO,CAACwB,IAAI,CAAC,CAAC;IACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHrB,OAAO,CAACyB,KAAK,CAAC,CAAC"}
@@ -47,7 +47,7 @@ const {
47
47
  } = frodo.cloud.secret;
48
48
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
49
49
  const OAUTH2_CLIENT = JSON.parse(fs.readFileSync(path.resolve(__dirname, './templates/OAuth2ClientTemplate.json'), 'utf8'));
50
- const GENERIC_EXTENSION_ATTRIBUTES = JSON.parse(fs.readFileSync(path.resolve(__dirname, './templates/cloud/GenericExtensionAttributesTemplate.json'), 'utf8'));
50
+ const GENERIC_EXTENSION_ATTRIBUTES = JSON.parse(fs.readFileSync(path.resolve(__dirname, './templates/GenericExtensionAttributesTemplate.json'), 'utf8'));
51
51
  const protectedClients = ['ui', 'idm-provisioning'];
52
52
  const protectedSubjects = ['amadmin', 'autoid-resource-server'];
53
53
  const privilegedScopes = ['am-introspect-all-tokens', 'fr:idm:*', 'fr:idc:esv:*'];
@@ -628,25 +628,24 @@ export async function hideGenericExtensionAttributes(includeCustomized, dryRun)
628
628
  try {
629
629
  const response = await readConfigEntity('managed');
630
630
  const managed = cloneDeep(response);
631
- const propertyNames = Object.keys(GENERIC_EXTENSION_ATTRIBUTES);
632
631
  const updatedObjects = managed.objects.map(object => {
633
632
  // ignore all other objects
634
633
  if (object.name !== getCurrentRealmManagedUser()) {
635
634
  return object;
636
635
  }
637
- propertyNames.forEach(name => {
638
- if (isEqualJson(GENERIC_EXTENSION_ATTRIBUTES[name], object.schema.properties[name], ['viewable', 'usageDescription']) || includeCustomized) {
639
- if (object.schema.properties[name].viewable) {
640
- printMessage(`${name}: hide`);
636
+ for (const property of Object.keys(cloneDeep(GENERIC_EXTENSION_ATTRIBUTES))) {
637
+ if (isEqualJson(GENERIC_EXTENSION_ATTRIBUTES[property], object.schema.properties[property], ['viewable', 'usageDescription', 'searchable']) || includeCustomized) {
638
+ if (object.schema.properties[property].viewable) {
639
+ printMessage(`${property}: hide`);
641
640
  // eslint-disable-next-line no-param-reassign
642
- object.schema.properties[name].viewable = false;
641
+ object.schema.properties[property].viewable = false;
643
642
  } else {
644
- printMessage(`${name}: ignore (already hidden)`);
643
+ printMessage(`${property}: ignore (already hidden)`);
645
644
  }
646
645
  } else {
647
- printMessage(`${name}: skip (customized)`);
646
+ printMessage(`${property}: skip (customized)`);
648
647
  }
649
- });
648
+ }
650
649
  return object;
651
650
  });
652
651
  managed.objects = updatedObjects;
@@ -666,25 +665,24 @@ export async function showGenericExtensionAttributes(includeCustomized, dryRun)
666
665
  try {
667
666
  const response = await readConfigEntity('managed');
668
667
  const managed = cloneDeep(response);
669
- const propertyNames = Object.keys(GENERIC_EXTENSION_ATTRIBUTES);
670
668
  const updatedObjects = managed.objects.map(object => {
671
669
  // ignore all other objects
672
670
  if (object.name !== getCurrentRealmManagedUser()) {
673
671
  return object;
674
672
  }
675
- propertyNames.forEach(name => {
676
- if (isEqualJson(GENERIC_EXTENSION_ATTRIBUTES[name], object.schema.properties[name], ['viewable', 'usageDescription']) || includeCustomized) {
677
- if (!object.schema.properties[name].viewable) {
678
- printMessage(`${name}: show`);
673
+ for (const property of Object.keys(cloneDeep(GENERIC_EXTENSION_ATTRIBUTES))) {
674
+ if (isEqualJson(GENERIC_EXTENSION_ATTRIBUTES[property], object.schema.properties[property], ['viewable', 'usageDescription']) || includeCustomized) {
675
+ if (!object.schema.properties[property].viewable) {
676
+ printMessage(`${property}: show`);
679
677
  // eslint-disable-next-line no-param-reassign
680
- object.schema.properties[name].viewable = true;
678
+ object.schema.properties[property].viewable = true;
681
679
  } else {
682
- printMessage(`${name}: ignore (already showing)`);
680
+ printMessage(`${property}: ignore (already showing)`);
683
681
  }
684
682
  } else {
685
- printMessage(`${name}: skip (customized)`);
683
+ printMessage(`${property}: skip (customized)`);
686
684
  }
687
- });
685
+ }
688
686
  return object;
689
687
  });
690
688
  managed.objects = updatedObjects;