@rockcarver/frodo-cli 0.23.1-2 → 0.23.1-4

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,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.23.1-4] - 2023-04-20
11
+
12
+ ### Changed
13
+
14
+ - Update to frodo-lib 0.18.9-4
15
+
16
+ ## [0.23.1-3] - 2023-04-18
17
+
18
+ ### Changed
19
+
20
+ - Update to frodo-lib 0.18.9-3
21
+ - Changes based on rockcarver/frodo-lib#234 (code refactoring) and updated frodo-lib:
22
+ - Added support for `-A` and `-a` options to `frodo app import` command
23
+ - Added support for `--no-deps` option to `frodo app export` and `frodo app import` commands
24
+
25
+ ### Fixed
26
+
27
+ - \#214: Fixed a regression introduced in #186, which 'swallowed' `frodo` command exit codes and resulted in always exiting with 0 even if a `frodo` command returned with a different exit code.
28
+
10
29
  ## [0.23.1-2] - 2023-03-28
11
30
 
12
31
  ### Changed
@@ -17,7 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
17
36
 
18
37
  ### Added
19
38
 
20
- - \#213: More debug logging for connection profile lookup by a unique substring. Use --debug to see the additional output. This is not yet a solution for rockcarver/frodo-cli#213 but should help identify the root cause.
39
+ - \#213: More debug logging for connection profile lookup by a unique substring. Use --debug to see the additional output. This is not yet a solution for #213 but should help identify the root cause.
21
40
  - \#216: More debug logging for the 2fa process and proper detection of unsupported webauthn factor.
22
41
 
23
42
  ### Changed
@@ -1081,7 +1100,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1081
1100
  - Fixed problem with adding connection profiles
1082
1101
  - Miscellaneous bug fixes
1083
1102
 
1084
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.23.1-2...HEAD
1103
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.23.1-4...HEAD
1104
+
1105
+ [0.23.1-4]: https://github.com/rockcarver/frodo-cli/compare/v0.23.1-3...v0.23.1-4
1106
+
1107
+ [0.23.1-3]: https://github.com/rockcarver/frodo-cli/compare/v0.23.1-2...v0.23.1-3
1085
1108
 
1086
1109
  [0.23.1-2]: https://github.com/rockcarver/frodo-cli/compare/v0.23.1-1...v0.23.1-2
1087
1110
 
@@ -1,34 +1,42 @@
1
1
  import { FrodoCommand } from '../FrodoCommand';
2
2
  import { Option } from 'commander';
3
- import { Authenticate, OAuth2Client } from '@rockcarver/frodo-lib';
3
+ import { Authenticate } from '@rockcarver/frodo-lib';
4
4
  import { verboseMessage } from '../../utils/Console.js';
5
+ import { exportOAuth2ClientsToFile, exportOAuth2ClientsToFiles, exportOAuth2ClientToFile } from '../../ops/OAuth2ClientOps';
5
6
  const {
6
7
  getTokens
7
8
  } = Authenticate;
8
- const {
9
- exportOAuth2ClientsToFile,
10
- exportOAuth2ClientsToFiles,
11
- exportOAuth2ClientToFile
12
- } = OAuth2Client;
13
9
  const program = new FrodoCommand('frodo app export');
14
- program.description('Export OAuth2 applications.').addOption(new Option('-i, --app-id <app-id>', 'App id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the export file.')).addOption(new Option('-a, --all', 'Export all OAuth2 apps to a single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Export all OAuth2 apps to separate files (*.oauth2.app.json) in the current directory. Ignored with -i or -a.')).action(
10
+ program.description('Export OAuth2 applications.').addOption(new Option('-i, --app-id <app-id>', 'App id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the export file.')).addOption(new Option('-a, --all', 'Export all OAuth2 apps to a single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Export all OAuth2 apps to separate files (*.oauth2.app.json) in the current directory. Ignored with -i or -a.')).addOption(new Option('--no-deps', 'Do not include any dependencies (scripts).')).action(
15
11
  // implement command logic inside action handler
16
12
  async (host, realm, user, password, options, command) => {
17
13
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
18
14
  // export
19
15
  if (options.appId && (await getTokens())) {
20
16
  verboseMessage('Exporting OAuth2 application...');
21
- exportOAuth2ClientToFile(options.appId, options.file);
17
+ const status = await exportOAuth2ClientToFile(options.appId, options.file, {
18
+ useStringArrays: true,
19
+ deps: options.deps
20
+ });
21
+ if (!status) process.exitCode = 1;
22
22
  }
23
23
  // -a/--all
24
24
  else if (options.all && (await getTokens())) {
25
25
  verboseMessage('Exporting all OAuth2 applications to file...');
26
- exportOAuth2ClientsToFile(options.file);
26
+ const status = await exportOAuth2ClientsToFile(options.file, {
27
+ useStringArrays: true,
28
+ deps: options.deps
29
+ });
30
+ if (!status) process.exitCode = 1;
27
31
  }
28
32
  // -A/--all-separate
29
33
  else if (options.allSeparate && (await getTokens())) {
30
34
  verboseMessage('Exporting all applications to separate files...');
31
- exportOAuth2ClientsToFiles();
35
+ const status = await exportOAuth2ClientsToFiles({
36
+ useStringArrays: true,
37
+ deps: options.deps
38
+ });
39
+ if (!status) process.exitCode = 1;
32
40
  }
33
41
  // unrecognized combination of options or no options
34
42
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"app-export.js","names":["FrodoCommand","Option","Authenticate","OAuth2Client","verboseMessage","getTokens","exportOAuth2ClientsToFile","exportOAuth2ClientsToFiles","exportOAuth2ClientToFile","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","appId","file","all","allSeparate","help","process","exitCode","parse"],"sources":["cli/app/app-export.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, OAuth2Client } from '@rockcarver/frodo-lib';\nimport { verboseMessage } from '../../utils/Console.js';\n\nconst { getTokens } = Authenticate;\nconst {\n exportOAuth2ClientsToFile,\n exportOAuth2ClientsToFiles,\n exportOAuth2ClientToFile,\n} = OAuth2Client;\n\nconst program = new FrodoCommand('frodo app export');\n\nprogram\n .description('Export OAuth2 applications.')\n .addOption(\n new Option(\n '-i, --app-id <app-id>',\n 'App 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 OAuth2 apps to a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all OAuth2 apps to separate files (*.oauth2.app.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export\n if (options.appId && (await getTokens())) {\n verboseMessage('Exporting OAuth2 application...');\n exportOAuth2ClientToFile(options.appId, options.file);\n }\n // -a/--all\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all OAuth2 applications to file...');\n exportOAuth2ClientsToFile(options.file);\n }\n // -A/--all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all applications to separate files...');\n exportOAuth2ClientsToFiles();\n }\n // unrecognized combination of options or no options\n else {\n verboseMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,EAAEC,YAAY,QAAQ,uBAAuB;AAClE,SAASC,cAAc,QAAQ,wBAAwB;AAEvD,MAAM;EAAEC;AAAU,CAAC,GAAGH,YAAY;AAClC,MAAM;EACJI,yBAAyB;EACzBC,0BAA0B;EAC1BC;AACF,CAAC,GAAGL,YAAY;AAEhB,MAAMM,OAAO,GAAG,IAAIT,YAAY,CAAC,kBAAkB,CAAC;AAEpDS,OAAO,CACJC,WAAW,CAAC,6BAA6B,CAAC,CAC1CC,SAAS,CACR,IAAIV,MAAM,CACR,uBAAuB,EACvB,8CAA8C,CAC/C,CACF,CACAU,SAAS,CAAC,IAAIV,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAAC,CACtEU,SAAS,CACR,IAAIV,MAAM,CACR,WAAW,EACX,2DAA2D,CAC5D,CACF,CACAU,SAAS,CACR,IAAIV,MAAM,CACR,oBAAoB,EACpB,+GAA+G,CAChH,CACF,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,OAAO,CACR;EACD;EACA,IAAID,OAAO,CAACG,KAAK,KAAK,MAAMf,SAAS,EAAE,CAAC,EAAE;IACxCD,cAAc,CAAC,iCAAiC,CAAC;IACjDI,wBAAwB,CAACS,OAAO,CAACG,KAAK,EAAEH,OAAO,CAACI,IAAI,CAAC;EACvD;EACA;EAAA,KACK,IAAIJ,OAAO,CAACK,GAAG,KAAK,MAAMjB,SAAS,EAAE,CAAC,EAAE;IAC3CD,cAAc,CAAC,8CAA8C,CAAC;IAC9DE,yBAAyB,CAACW,OAAO,CAACI,IAAI,CAAC;EACzC;EACA;EAAA,KACK,IAAIJ,OAAO,CAACM,WAAW,KAAK,MAAMlB,SAAS,EAAE,CAAC,EAAE;IACnDD,cAAc,CAAC,iDAAiD,CAAC;IACjEG,0BAA0B,EAAE;EAC9B;EACA;EAAA,KACK;IACHH,cAAc,CAAC,sDAAsD,CAAC;IACtEK,OAAO,CAACe,IAAI,EAAE;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHjB,OAAO,CAACkB,KAAK,EAAE"}
1
+ {"version":3,"file":"app-export.js","names":["FrodoCommand","Option","Authenticate","verboseMessage","exportOAuth2ClientsToFile","exportOAuth2ClientsToFiles","exportOAuth2ClientToFile","getTokens","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","appId","status","file","useStringArrays","deps","process","exitCode","all","allSeparate","help","parse"],"sources":["cli/app/app-export.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate } from '@rockcarver/frodo-lib';\nimport { verboseMessage } from '../../utils/Console.js';\nimport {\n exportOAuth2ClientsToFile,\n exportOAuth2ClientsToFiles,\n exportOAuth2ClientToFile,\n} from '../../ops/OAuth2ClientOps';\n\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo app export');\n\nprogram\n .description('Export OAuth2 applications.')\n .addOption(\n new Option(\n '-i, --app-id <app-id>',\n 'App 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 OAuth2 apps to a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all OAuth2 apps to separate files (*.oauth2.app.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option('--no-deps', 'Do not include any dependencies (scripts).')\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // export\n if (options.appId && (await getTokens())) {\n verboseMessage('Exporting OAuth2 application...');\n const status = await exportOAuth2ClientToFile(\n options.appId,\n options.file,\n {\n useStringArrays: true,\n deps: options.deps,\n }\n );\n if (!status) process.exitCode = 1;\n }\n // -a/--all\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all OAuth2 applications to file...');\n const status = await exportOAuth2ClientsToFile(options.file, {\n useStringArrays: true,\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // -A/--all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all applications to separate files...');\n const status = await exportOAuth2ClientsToFiles({\n useStringArrays: true,\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n verboseMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SACEC,yBAAyB,EACzBC,0BAA0B,EAC1BC,wBAAwB,QACnB,2BAA2B;AAElC,MAAM;EAAEC;AAAU,CAAC,GAAGL,YAAY;AAElC,MAAMM,OAAO,GAAG,IAAIR,YAAY,CAAC,kBAAkB,CAAC;AAEpDQ,OAAO,CACJC,WAAW,CAAC,6BAA6B,CAAC,CAC1CC,SAAS,CACR,IAAIT,MAAM,CACR,uBAAuB,EACvB,8CAA8C,CAC/C,CACF,CACAS,SAAS,CAAC,IAAIT,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAAC,CACtES,SAAS,CACR,IAAIT,MAAM,CACR,WAAW,EACX,2DAA2D,CAC5D,CACF,CACAS,SAAS,CACR,IAAIT,MAAM,CACR,oBAAoB,EACpB,+GAA+G,CAChH,CACF,CACAS,SAAS,CACR,IAAIT,MAAM,CAAC,WAAW,EAAE,4CAA4C,CAAC,CACtE,CACAU,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OAAO,CACR;EACD;EACA,IAAID,OAAO,CAACG,KAAK,KAAK,MAAMZ,SAAS,EAAE,CAAC,EAAE;IACxCJ,cAAc,CAAC,iCAAiC,CAAC;IACjD,MAAMiB,MAAM,GAAG,MAAMd,wBAAwB,CAC3CU,OAAO,CAACG,KAAK,EACbH,OAAO,CAACK,IAAI,EACZ;MACEC,eAAe,EAAE,IAAI;MACrBC,IAAI,EAAEP,OAAO,CAACO;IAChB,CAAC,CACF;IACD,IAAI,CAACH,MAAM,EAAEI,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK,IAAIT,OAAO,CAACU,GAAG,KAAK,MAAMnB,SAAS,EAAE,CAAC,EAAE;IAC3CJ,cAAc,CAAC,8CAA8C,CAAC;IAC9D,MAAMiB,MAAM,GAAG,MAAMhB,yBAAyB,CAACY,OAAO,CAACK,IAAI,EAAE;MAC3DC,eAAe,EAAE,IAAI;MACrBC,IAAI,EAAEP,OAAO,CAACO;IAChB,CAAC,CAAC;IACF,IAAI,CAACH,MAAM,EAAEI,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK,IAAIT,OAAO,CAACW,WAAW,KAAK,MAAMpB,SAAS,EAAE,CAAC,EAAE;IACnDJ,cAAc,CAAC,iDAAiD,CAAC;IACjE,MAAMiB,MAAM,GAAG,MAAMf,0BAA0B,CAAC;MAC9CiB,eAAe,EAAE,IAAI;MACrBC,IAAI,EAAEP,OAAO,CAACO;IAChB,CAAC,CAAC;IACF,IAAI,CAACH,MAAM,EAAEI,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK;IACHtB,cAAc,CAAC,sDAAsD,CAAC;IACtEK,OAAO,CAACoB,IAAI,EAAE;IACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHjB,OAAO,CAACqB,KAAK,EAAE"}
@@ -1,42 +1,52 @@
1
1
  import { FrodoCommand } from '../FrodoCommand';
2
2
  import { Option } from 'commander';
3
- import { Authenticate, OAuth2Client } from '@rockcarver/frodo-lib';
4
- import { verboseMessage } from '../../utils/Console.js';
3
+ import { Authenticate } from '@rockcarver/frodo-lib';
4
+ import { printMessage, verboseMessage } from '../../utils/Console.js';
5
+ import { importFirstOAuth2ClientFromFile, importOAuth2ClientFromFile, importOAuth2ClientsFromFile, importOAuth2ClientsFromFiles } from '../../ops/OAuth2ClientOps';
5
6
  const {
6
7
  getTokens
7
8
  } = Authenticate;
8
- const {
9
- importOAuth2ClientsFromFile
10
- } = OAuth2Client;
11
9
  const program = new FrodoCommand('frodo app import');
12
- program.description('Import OAuth2 applications.')
13
- // .addOption(
14
- // new Option(
15
- // '-i, --cmd-id <cmd-id>',
16
- // 'Cmd id. If specified, only one cmd is imported and the options -a and -A are ignored.'
17
- // )
18
- // )
19
- .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))
20
- // .addOption(
21
- // new Option(
22
- // '-a, --all',
23
- // 'Import all cmds from single file. Ignored with -i.'
24
- // )
25
- // )
26
- // .addOption(
27
- // new Option(
28
- // '-A, --all-separate',
29
- // 'Import all cmds from separate files (*.cmd.json) in the current directory. Ignored with -i or -a.'
30
- // )
31
- // )
32
- .action(
10
+ program.description('Import OAuth2 applications.').addOption(new Option('-i, --app-id <id>', 'Application id. If specified, only one application is imported and the options -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import.')).addOption(new Option('-a, --all', 'Import all applications from single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Import all applications from separate files (*.app.json) in the current directory. Ignored with -i or -a.')).addOption(new Option('--no-deps', 'Do not include any dependencies (scripts).')).action(
33
11
  // implement command logic inside action handler
34
12
  async (host, realm, user, password, options, command) => {
35
13
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
36
- if (await getTokens()) {
37
- verboseMessage(`Importing OAuth2 application(s) ...`);
38
- importOAuth2ClientsFromFile(options.file);
39
- } else {
14
+ // import by id
15
+ if (options.file && options.idpId && (await getTokens())) {
16
+ verboseMessage(`Importing OAuth2 application "${options.appId}"...`);
17
+ const status = await importOAuth2ClientFromFile(options.appId, options.file, {
18
+ deps: options.deps
19
+ });
20
+ if (!status) process.exitCode = 1;
21
+ }
22
+ // --all -a
23
+ else if (options.all && options.file && (await getTokens())) {
24
+ verboseMessage(`Importing all OAuth2 applications from a single file (${options.file})...`);
25
+ const status = await importOAuth2ClientsFromFile(options.file, {
26
+ deps: options.deps
27
+ });
28
+ if (!status) process.exitCode = 1;
29
+ }
30
+ // --all-separate -A
31
+ else if (options.allSeparate && !options.file && (await getTokens())) {
32
+ verboseMessage('Importing all OAuth2 applications from separate files in current directory...');
33
+ const status = await importOAuth2ClientsFromFiles({
34
+ deps: options.deps
35
+ });
36
+ if (!status) process.exitCode = 1;
37
+ }
38
+ // import first provider from file
39
+ else if (options.file && (await getTokens())) {
40
+ verboseMessage(`Importing first OAuth2 application from file "${options.file}"...`);
41
+ const status = await importFirstOAuth2ClientFromFile(options.file, {
42
+ deps: options.deps
43
+ });
44
+ if (!status) process.exitCode = 1;
45
+ }
46
+ // unrecognized combination of options or no options
47
+ else {
48
+ printMessage('Unrecognized combination of options or no options...');
49
+ program.help();
40
50
  process.exitCode = 1;
41
51
  }
42
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"app-import.js","names":["FrodoCommand","Option","Authenticate","OAuth2Client","verboseMessage","getTokens","importOAuth2ClientsFromFile","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","file","process","exitCode","parse"],"sources":["cli/app/app-import.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, OAuth2Client } from '@rockcarver/frodo-lib';\nimport { verboseMessage } from '../../utils/Console.js';\n\nconst { getTokens } = Authenticate;\nconst { importOAuth2ClientsFromFile } = OAuth2Client;\n\nconst program = new FrodoCommand('frodo app import');\n\nprogram\n .description('Import OAuth2 applications.')\n // .addOption(\n // new Option(\n // '-i, --cmd-id <cmd-id>',\n // 'Cmd id. If specified, only one cmd is imported and the options -a and -A are ignored.'\n // )\n // )\n .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))\n // .addOption(\n // new Option(\n // '-a, --all',\n // 'Import all cmds from single file. Ignored with -i.'\n // )\n // )\n // .addOption(\n // new Option(\n // '-A, --all-separate',\n // 'Import all cmds from separate files (*.cmd.json) in the current directory. Ignored with -i or -a.'\n // )\n // )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n verboseMessage(`Importing OAuth2 application(s) ...`);\n importOAuth2ClientsFromFile(options.file);\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,EAAEC,YAAY,QAAQ,uBAAuB;AAClE,SAASC,cAAc,QAAQ,wBAAwB;AAEvD,MAAM;EAAEC;AAAU,CAAC,GAAGH,YAAY;AAClC,MAAM;EAAEI;AAA4B,CAAC,GAAGH,YAAY;AAEpD,MAAMI,OAAO,GAAG,IAAIP,YAAY,CAAC,kBAAkB,CAAC;AAEpDO,OAAO,CACJC,WAAW,CAAC,6BAA6B;AAC1C;AACA;AACA;AACA;AACA;AACA;AAAA,CACCC,SAAS,CAAC,IAAIR,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,CAAC;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,CACCS,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,OAAO,CACR;EACD,IAAI,MAAMX,SAAS,EAAE,EAAE;IACrBD,cAAc,CAAE,qCAAoC,CAAC;IACrDE,2BAA2B,CAACS,OAAO,CAACG,IAAI,CAAC;EAC3C,CAAC,MAAM;IACLC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHb,OAAO,CAACc,KAAK,EAAE"}
1
+ {"version":3,"file":"app-import.js","names":["FrodoCommand","Option","Authenticate","printMessage","verboseMessage","importFirstOAuth2ClientFromFile","importOAuth2ClientFromFile","importOAuth2ClientsFromFile","importOAuth2ClientsFromFiles","getTokens","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","file","idpId","appId","status","deps","process","exitCode","all","allSeparate","help","parse"],"sources":["cli/app/app-import.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate } from '@rockcarver/frodo-lib';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport {\n importFirstOAuth2ClientFromFile,\n importOAuth2ClientFromFile,\n importOAuth2ClientsFromFile,\n importOAuth2ClientsFromFiles,\n} from '../../ops/OAuth2ClientOps';\n\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo app import');\n\nprogram\n .description('Import OAuth2 applications.')\n .addOption(\n new Option(\n '-i, --app-id <id>',\n 'Application id. If specified, only one application is imported and the options -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Import all applications from single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all applications from separate files (*.app.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option('--no-deps', 'Do not include any dependencies (scripts).')\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // import by id\n if (options.file && options.idpId && (await getTokens())) {\n verboseMessage(`Importing OAuth2 application \"${options.appId}\"...`);\n const status = await importOAuth2ClientFromFile(\n options.appId,\n options.file,\n {\n deps: options.deps,\n }\n );\n if (!status) process.exitCode = 1;\n }\n // --all -a\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage(\n `Importing all OAuth2 applications from a single file (${options.file})...`\n );\n const status = await importOAuth2ClientsFromFile(options.file, {\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // --all-separate -A\n else if (options.allSeparate && !options.file && (await getTokens())) {\n verboseMessage(\n 'Importing all OAuth2 applications from separate files in current directory...'\n );\n const status = await importOAuth2ClientsFromFiles({\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // import first provider from file\n else if (options.file && (await getTokens())) {\n verboseMessage(\n `Importing first OAuth2 application from file \"${options.file}\"...`\n );\n const status = await importFirstOAuth2ClientFromFile(options.file, {\n deps: options.deps,\n });\n if (!status) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n printMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SACEC,+BAA+B,EAC/BC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,4BAA4B,QACvB,2BAA2B;AAElC,MAAM;EAAEC;AAAU,CAAC,GAAGP,YAAY;AAElC,MAAMQ,OAAO,GAAG,IAAIV,YAAY,CAAC,kBAAkB,CAAC;AAEpDU,OAAO,CACJC,WAAW,CAAC,6BAA6B,CAAC,CAC1CC,SAAS,CACR,IAAIX,MAAM,CACR,mBAAmB,EACnB,uGAAuG,CACxG,CACF,CACAW,SAAS,CAAC,IAAIX,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAAC,CACzEW,SAAS,CACR,IAAIX,MAAM,CACR,WAAW,EACX,4DAA4D,CAC7D,CACF,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,oBAAoB,EACpB,2GAA2G,CAC5G,CACF,CACAW,SAAS,CACR,IAAIX,MAAM,CAA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ACD,MAAM,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK,IAAIT,OAAO,CAACG,IAAI,KAAK,MAAMZ,SAAS,EAAE,CAAC,EAAE;IAC5CL,cAAc,CACX,iDAAgDc,OAAO,CAACG,IAAK,MAAK,CACpE;IACD,MAAMG,MAAM,GAAG,MAAMnB,+BAA+B,CAACa,OAAO,CAACG,IAAI,EAAE;MACjEI,IAAI,EAAEP,OAAO,CAACO;IAChB,CAAC,CAAC;IACF,IAAI,CAACD,MAAM,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;EACnC;EACA;EAAA,KACK;IACHxB,YAAY,CAAC,sDAAsD,CAAC;IACpEO,OAAO,CAACoB,IAAI,EAAE;IACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHjB,OAAO,CAACqB,KAAK,EAAE"}
@@ -1,13 +1,11 @@
1
1
  import { FrodoCommand } from '../FrodoCommand';
2
2
  import { Option } from 'commander';
3
- import { Authenticate, OAuth2Client } from '@rockcarver/frodo-lib';
3
+ import { Authenticate } from '@rockcarver/frodo-lib';
4
4
  import { verboseMessage } from '../../utils/Console.js';
5
+ import { listOAuth2Clients } from '../../ops/OAuth2ClientOps';
5
6
  const {
6
7
  getTokens
7
8
  } = Authenticate;
8
- const {
9
- listOAuth2Clients
10
- } = OAuth2Client;
11
9
  const program = new FrodoCommand('frodo app list');
12
10
  program.description('List OAuth2 applications.').addOption(new Option('-l, --long', 'Long with all fields.').default(false, 'false')).action(
13
11
  // implement command logic inside action handler
@@ -1 +1 @@
1
- {"version":3,"file":"app-list.js","names":["FrodoCommand","Option","Authenticate","OAuth2Client","verboseMessage","getTokens","listOAuth2Clients","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","long","process","exitCode","parse"],"sources":["cli/app/app-list.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, OAuth2Client } from '@rockcarver/frodo-lib';\nimport { verboseMessage } from '../../utils/Console.js';\n\nconst { getTokens } = Authenticate;\nconst { listOAuth2Clients } = OAuth2Client;\n\nconst program = new FrodoCommand('frodo app list');\n\nprogram\n .description('List OAuth2 applications.')\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 OAuth2 applications...`);\n listOAuth2Clients(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,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,EAAEC,YAAY,QAAQ,uBAAuB;AAClE,SAASC,cAAc,QAAQ,wBAAwB;AAEvD,MAAM;EAAEC;AAAU,CAAC,GAAGH,YAAY;AAClC,MAAM;EAAEI;AAAkB,CAAC,GAAGH,YAAY;AAE1C,MAAMI,OAAO,GAAG,IAAIP,YAAY,CAAC,gBAAgB,CAAC;AAElDO,OAAO,CACJC,WAAW,CAAC,2BAA2B,CAAC,CACxCC,SAAS,CACR,IAAIR,MAAM,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAACS,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAC1E,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,OAAO,CACR;EACD,IAAI,MAAMZ,SAAS,EAAE,EAAE;IACrBD,cAAc,CAAE,gCAA+B,CAAC;IAChDE,iBAAiB,CAACU,OAAO,CAACG,IAAI,CAAC;EACjC,CAAC,MAAM;IACLC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHd,OAAO,CAACe,KAAK,EAAE"}
1
+ {"version":3,"file":"app-list.js","names":["FrodoCommand","Option","Authenticate","verboseMessage","listOAuth2Clients","getTokens","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","long","process","exitCode","parse"],"sources":["cli/app/app-list.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate } from '@rockcarver/frodo-lib';\nimport { verboseMessage } from '../../utils/Console.js';\nimport { listOAuth2Clients } from '../../ops/OAuth2ClientOps';\n\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo app list');\n\nprogram\n .description('List OAuth2 applications.')\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 OAuth2 applications...`);\n listOAuth2Clients(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,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,iBAAiB,QAAQ,2BAA2B;AAE7D,MAAM;EAAEC;AAAU,CAAC,GAAGH,YAAY;AAElC,MAAMI,OAAO,GAAG,IAAIN,YAAY,CAAC,gBAAgB,CAAC;AAElDM,OAAO,CACJC,WAAW,CAAC,2BAA2B,CAAC,CACxCC,SAAS,CACR,IAAIP,MAAM,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAACQ,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAC1E,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,OAAO,CACR;EACD,IAAI,MAAMX,SAAS,EAAE,EAAE;IACrBF,cAAc,CAAE,gCAA+B,CAAC;IAChDC,iBAAiB,CAACW,OAAO,CAACG,IAAI,CAAC;EACjC,CAAC,MAAM;IACLC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHd,OAAO,CAACe,KAAK,EAAE"}
package/esm/launch.js CHANGED
@@ -4,8 +4,11 @@ import { createRequire } from 'module';
4
4
  const require = createRequire(import.meta.url);
5
5
  const launchArgs = ['--no-warnings', '--enable-source-maps', '--experimental-loader', require.resolve('./loader.js'), require.resolve('./app.js')];
6
6
  const frodoArgs = process.argv.slice(2);
7
- spawn(process.execPath, [...launchArgs, ...frodoArgs], {
7
+ const frodo = spawn(process.execPath, [...launchArgs, ...frodoArgs], {
8
8
  stdio: 'inherit',
9
9
  shell: false
10
10
  });
11
+ frodo.on('exit', code => {
12
+ process.exitCode = code;
13
+ });
11
14
  //# sourceMappingURL=launch.js.map
package/esm/launch.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"launch.js","names":["spawn","createRequire","require","import","meta","url","launchArgs","resolve","frodoArgs","process","argv","slice","execPath","stdio","shell"],"sources":["launch.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { spawn } from 'node:child_process';\nimport { createRequire } from 'module';\n\nconst require = createRequire(import.meta.url);\n\nconst launchArgs = [\n '--no-warnings',\n '--enable-source-maps',\n '--experimental-loader',\n require.resolve('./loader.js'),\n require.resolve('./app.js'),\n];\nconst frodoArgs = process.argv.slice(2);\n\nspawn(process.execPath, [...launchArgs, ...frodoArgs], {\n stdio: 'inherit',\n shell: false,\n});\n"],"mappings":"AAAA;AACA,SAASA,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,aAAa,QAAQ,QAAQ;AAEtC,MAAMC,OAAO,GAAGD,aAAa,CAACE,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAE9C,MAAMC,UAAU,GAAG,CACjB,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvBJ,OAAO,CAACK,OAAO,CAAC,aAAa,CAAC,EAC9BL,OAAO,CAACK,OAAO,CAAC,UAAU,CAAC,CAC5B;AACD,MAAMC,SAAS,GAAGC,OAAO,CAACC,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC;AAEvCX,KAAK,CAACS,OAAO,CAACG,QAAQ,EAAE,CAAC,GAAGN,UAAU,EAAE,GAAGE,SAAS,CAAC,EAAE;EACrDK,KAAK,EAAE,SAAS;EAChBC,KAAK,EAAE;AACT,CAAC,CAAC"}
1
+ {"version":3,"file":"launch.js","names":["spawn","createRequire","require","import","meta","url","launchArgs","resolve","frodoArgs","process","argv","slice","frodo","execPath","stdio","shell","on","code","exitCode"],"sources":["launch.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { spawn } from 'node:child_process';\nimport { createRequire } from 'module';\n\nconst require = createRequire(import.meta.url);\n\nconst launchArgs = [\n '--no-warnings',\n '--enable-source-maps',\n '--experimental-loader',\n require.resolve('./loader.js'),\n require.resolve('./app.js'),\n];\nconst frodoArgs = process.argv.slice(2);\n\nconst frodo = spawn(process.execPath, [...launchArgs, ...frodoArgs], {\n stdio: 'inherit',\n shell: false,\n});\n\nfrodo.on('exit', (code) => {\n process.exitCode = code;\n});\n"],"mappings":"AAAA;AACA,SAASA,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,aAAa,QAAQ,QAAQ;AAEtC,MAAMC,OAAO,GAAGD,aAAa,CAACE,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAE9C,MAAMC,UAAU,GAAG,CACjB,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvBJ,OAAO,CAACK,OAAO,CAAC,aAAa,CAAC,EAC9BL,OAAO,CAACK,OAAO,CAAC,UAAU,CAAC,CAC5B;AACD,MAAMC,SAAS,GAAGC,OAAO,CAACC,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC;AAEvC,MAAMC,KAAK,GAAGZ,KAAK,CAACS,OAAO,CAACI,QAAQ,EAAE,CAAC,GAAGP,UAAU,EAAE,GAAGE,SAAS,CAAC,EAAE;EACnEM,KAAK,EAAE,SAAS;EAChBC,KAAK,EAAE;AACT,CAAC,CAAC;AAEFH,KAAK,CAACI,EAAE,CAAC,MAAM,EAAGC,IAAI,IAAK;EACzBR,OAAO,CAACS,QAAQ,GAAGD,IAAI;AACzB,CAAC,CAAC"}
@@ -0,0 +1,274 @@
1
+ import fs from 'fs';
2
+ import { OAuth2Client, ExportImportUtils, Utils, state } from '@rockcarver/frodo-lib';
3
+ import { createProgressBar, createTable, debugMessage, failSpinner, printMessage, showSpinner, stopProgressBar, succeedSpinner, updateProgressBar } from '../utils/Console';
4
+ import { saveJsonToFile } from '../utils/ExportImportUtils';
5
+ const {
6
+ getTypedFilename,
7
+ titleCase
8
+ } = ExportImportUtils;
9
+ const {
10
+ getOAuth2Clients,
11
+ exportOAuth2Client,
12
+ exportOAuth2Clients,
13
+ importOAuth2Client,
14
+ importFirstOAuth2Client,
15
+ importOAuth2Clients
16
+ } = OAuth2Client;
17
+ const {
18
+ getRealmName
19
+ } = Utils;
20
+
21
+ /**
22
+ * List OAuth2 clients
23
+ */
24
+ export async function listOAuth2Clients(long = false) {
25
+ try {
26
+ const clients = await getOAuth2Clients();
27
+ clients.sort((a, b) => a._id.localeCompare(b._id));
28
+ if (long) {
29
+ const table = createTable(['Client Id', 'Status', 'Client Type', 'Grant Types', 'Scopes', 'Redirect URIs'
30
+ // 'Description',
31
+ ]);
32
+
33
+ const grantTypesMap = {
34
+ authorization_code: 'Authz Code',
35
+ client_credentials: 'Client Creds',
36
+ refresh_token: 'Refresh Token',
37
+ password: 'ROPC',
38
+ 'urn:ietf:params:oauth:grant-type:uma-ticket': 'UMA',
39
+ implicit: 'Implicit',
40
+ 'urn:ietf:params:oauth:grant-type:device_code': 'Device Code',
41
+ 'urn:ietf:params:oauth:grant-type:saml2-bearer': 'SAML2 Bearer',
42
+ 'urn:openid:params:grant-type:ciba': 'CIBA',
43
+ 'urn:ietf:params:oauth:grant-type:token-exchange': 'Token Exchange',
44
+ 'urn:ietf:params:oauth:grant-type:jwt-bearer': 'JWT Bearer'
45
+ };
46
+ clients.forEach(client => {
47
+ table.push([client._id, client.coreOAuth2ClientConfig.status === 'Active' ? 'Active'['brightGreen'] : client.coreOAuth2ClientConfig.status.brightRed, client.coreOAuth2ClientConfig.clientType, client.advancedOAuth2ClientConfig.grantTypes.map(type => grantTypesMap[type]).join('\n'), client.coreOAuth2ClientConfig.scopes.join('\n'), client.coreOAuth2ClientConfig.redirectionUris.join('\n')
48
+ // wordwrap(client.description, 30),
49
+ ]);
50
+ });
51
+
52
+ printMessage(table.toString(), 'data');
53
+ } else {
54
+ clients.forEach(client => {
55
+ printMessage(`${client._id}`, 'data');
56
+ });
57
+ }
58
+ } catch (error) {
59
+ printMessage(`Error listing applications - ${error}`, 'error');
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Export OAuth2 client to file
65
+ * @param {string} clientId client id
66
+ * @param {string} file file name
67
+ * @param {OAuth2ClientExportOptions} options export options
68
+ * @returns {Promise<boolean>} true if successful, false otherwise
69
+ */
70
+ export async function exportOAuth2ClientToFile(clientId, file, options = {
71
+ useStringArrays: true,
72
+ deps: true
73
+ }) {
74
+ let outcome = false;
75
+ debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientToFile: begin`);
76
+ showSpinner(`Exporting ${clientId}...`);
77
+ try {
78
+ let fileName = getTypedFilename(clientId, 'oauth2.app');
79
+ if (file) {
80
+ fileName = file;
81
+ }
82
+ const exportData = await exportOAuth2Client(clientId, options);
83
+ saveJsonToFile(exportData, fileName);
84
+ succeedSpinner(`Exported ${clientId} to ${fileName}.`);
85
+ outcome = true;
86
+ } catch (error) {
87
+ failSpinner(`Error exporting ${clientId}: ${error.message}`);
88
+ }
89
+ debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientToFile: end`);
90
+ return outcome;
91
+ }
92
+
93
+ /**
94
+ * Export all OAuth2 clients to file
95
+ * @param {string} file file name
96
+ * @param {OAuth2ClientExportOptions} options export options
97
+ * @returns {Promise<boolean>} true if successful, false otherwise
98
+ */
99
+ export async function exportOAuth2ClientsToFile(file, options = {
100
+ useStringArrays: true,
101
+ deps: true
102
+ }) {
103
+ let outcome = false;
104
+ debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFile: begin`);
105
+ showSpinner(`Exporting all clients...`);
106
+ try {
107
+ let fileName = getTypedFilename(`all${titleCase(getRealmName(state.getRealm()))}Applications`, 'oauth2.app');
108
+ if (file) {
109
+ fileName = file;
110
+ }
111
+ const exportData = await exportOAuth2Clients(options);
112
+ saveJsonToFile(exportData, fileName);
113
+ succeedSpinner(`Exported all clients to ${fileName}.`);
114
+ outcome = true;
115
+ } catch (error) {
116
+ failSpinner(`Error exporting all clients`);
117
+ printMessage(`${error.message}`, 'error');
118
+ }
119
+ debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFile: end [${outcome}]`);
120
+ return outcome;
121
+ }
122
+
123
+ /**
124
+ * Export all OAuth2 clients to separate files
125
+ * @param {OAuth2ClientExportOptions} options export options
126
+ * @returns {Promise<boolean>} true if successful, false otherwise
127
+ */
128
+ export async function exportOAuth2ClientsToFiles(options = {
129
+ useStringArrays: true,
130
+ deps: true
131
+ }) {
132
+ debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFiles: begin`);
133
+ const errors = [];
134
+ try {
135
+ const clients = await getOAuth2Clients();
136
+ createProgressBar(clients.length, 'Exporting clients...');
137
+ for (const client of clients) {
138
+ const file = getTypedFilename(client._id, 'oauth2.app');
139
+ try {
140
+ const exportData = await exportOAuth2Client(client._id, options);
141
+ saveJsonToFile(exportData, file);
142
+ updateProgressBar(`Exported ${client._id}.`);
143
+ } catch (error) {
144
+ errors.push(error);
145
+ updateProgressBar(`Error exporting ${client._id}.`);
146
+ }
147
+ }
148
+ stopProgressBar(`Export complete.`);
149
+ } catch (error) {
150
+ errors.push(error);
151
+ stopProgressBar(`Error exporting client(s) to file(s)`);
152
+ }
153
+ debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFiles: end`);
154
+ return 0 === errors.length;
155
+ }
156
+
157
+ /**
158
+ * Import first OAuth2 client from file
159
+ * @param {string} clientId client id
160
+ * @param {string} file file name
161
+ * @param {OAuth2ClientImportOptions} options import options
162
+ * @returns {Promise<boolean>} true if successful, false otherwise
163
+ */
164
+ export async function importOAuth2ClientFromFile(clientId, file, options = {
165
+ deps: true
166
+ }) {
167
+ let outcome = false;
168
+ debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientFromFile: begin`);
169
+ showSpinner(`Importing ${clientId}...`);
170
+ try {
171
+ const data = fs.readFileSync(file, 'utf8');
172
+ const fileData = JSON.parse(data);
173
+ await importOAuth2Client(clientId, fileData, options);
174
+ outcome = true;
175
+ succeedSpinner(`Imported ${clientId}.`);
176
+ } catch (error) {
177
+ failSpinner(`Error importing ${clientId}.`);
178
+ printMessage(error, 'error');
179
+ }
180
+ debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientFromFile: end`);
181
+ return outcome;
182
+ }
183
+
184
+ /**
185
+ * Import first OAuth2 client from file
186
+ * @param {string} file file name
187
+ * @param {OAuth2ClientImportOptions} options import options
188
+ * @returns {Promise<boolean>} true if successful, false otherwise
189
+ */
190
+ export async function importFirstOAuth2ClientFromFile(file, options = {
191
+ deps: true
192
+ }) {
193
+ let outcome = false;
194
+ debugMessage(`cli.OAuth2ClientOps.importFirstOAuth2ClientFromFile: begin`);
195
+ showSpinner(`Importing ${file}...`);
196
+ try {
197
+ const data = fs.readFileSync(file, 'utf8');
198
+ const fileData = JSON.parse(data);
199
+ await importFirstOAuth2Client(fileData, options);
200
+ outcome = true;
201
+ succeedSpinner(`Imported ${file}.`);
202
+ } catch (error) {
203
+ failSpinner(`Error importing ${file}.`);
204
+ printMessage(error, 'error');
205
+ }
206
+ debugMessage(`cli.OAuth2ClientOps.importFirstOAuth2ClientFromFile: end`);
207
+ return outcome;
208
+ }
209
+
210
+ /**
211
+ * Import OAuth2 clients from file
212
+ * @param {string} file file name
213
+ * @param {OAuth2ClientImportOptions} options import options
214
+ * @returns {Promise<boolean>} true if successful, false otherwise
215
+ */
216
+ export async function importOAuth2ClientsFromFile(file, options = {
217
+ deps: true
218
+ }) {
219
+ let outcome = false;
220
+ debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFile: begin`);
221
+ showSpinner(`Importing ${file}...`);
222
+ try {
223
+ const data = fs.readFileSync(file, 'utf8');
224
+ const applicationData = JSON.parse(data);
225
+ await importOAuth2Clients(applicationData, options);
226
+ outcome = true;
227
+ succeedSpinner(`Imported ${file}.`);
228
+ } catch (error) {
229
+ failSpinner(`Error importing ${file}.`);
230
+ printMessage(error, 'error');
231
+ }
232
+ debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFile: end`);
233
+ return outcome;
234
+ }
235
+
236
+ /**
237
+ * Import OAuth2 clients from files
238
+ * @param {OAuth2ClientImportOptions} options import options
239
+ * @returns {Promise<boolean>} true if successful, false otherwise
240
+ */
241
+ export async function importOAuth2ClientsFromFiles(options = {
242
+ deps: true
243
+ }) {
244
+ const errors = [];
245
+ try {
246
+ debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFiles: begin`);
247
+ const names = fs.readdirSync('.');
248
+ const files = names.filter(name => name.toLowerCase().endsWith('.oauth2.app.json'));
249
+ createProgressBar(files.length, 'Importing clients...');
250
+ let total = 0;
251
+ for (const file of files) {
252
+ try {
253
+ const data = fs.readFileSync(file, 'utf8');
254
+ const fileData = JSON.parse(data);
255
+ const count = Object.keys(fileData.application).length;
256
+ total += count;
257
+ await importOAuth2Clients(fileData, options);
258
+ updateProgressBar(`Imported ${count} client(s) from ${file}`);
259
+ } catch (error) {
260
+ errors.push(error);
261
+ updateProgressBar(`Error importing client(s) from ${file}`);
262
+ printMessage(error, 'error');
263
+ }
264
+ }
265
+ stopProgressBar(`Finished importing ${total} client(s) from ${files.length} file(s).`);
266
+ } catch (error) {
267
+ errors.push(error);
268
+ stopProgressBar(`Error importing client(s) from file(s).`);
269
+ printMessage(error, 'error');
270
+ }
271
+ debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFiles: end`);
272
+ return 0 === errors.length;
273
+ }
274
+ //# sourceMappingURL=OAuth2ClientOps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OAuth2ClientOps.js","names":["fs","OAuth2Client","ExportImportUtils","Utils","state","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","saveJsonToFile","getTypedFilename","titleCase","getOAuth2Clients","exportOAuth2Client","exportOAuth2Clients","importOAuth2Client","importFirstOAuth2Client","importOAuth2Clients","getRealmName","listOAuth2Clients","long","clients","sort","a","b","_id","localeCompare","table","grantTypesMap","authorization_code","client_credentials","refresh_token","password","implicit","forEach","client","push","coreOAuth2ClientConfig","status","brightRed","clientType","advancedOAuth2ClientConfig","grantTypes","map","type","join","scopes","redirectionUris","toString","error","exportOAuth2ClientToFile","clientId","file","options","useStringArrays","deps","outcome","fileName","exportData","message","exportOAuth2ClientsToFile","getRealm","exportOAuth2ClientsToFiles","errors","length","importOAuth2ClientFromFile","data","readFileSync","fileData","JSON","parse","importFirstOAuth2ClientFromFile","importOAuth2ClientsFromFile","applicationData","importOAuth2ClientsFromFiles","names","readdirSync","files","filter","name","toLowerCase","endsWith","total","count","Object","keys","application"],"sources":["ops/OAuth2ClientOps.ts"],"sourcesContent":["import fs from 'fs';\nimport {\n OAuth2Client,\n ExportImportUtils,\n Utils,\n state,\n} from '@rockcarver/frodo-lib';\nimport {\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport { saveJsonToFile } from '../utils/ExportImportUtils';\nimport {\n OAuth2ClientExportInterface,\n OAuth2ClientExportOptions,\n OAuth2ClientImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/OAuth2ClientOps';\n\nconst { getTypedFilename, titleCase } = ExportImportUtils;\nconst {\n getOAuth2Clients,\n exportOAuth2Client,\n exportOAuth2Clients,\n importOAuth2Client,\n importFirstOAuth2Client,\n importOAuth2Clients,\n} = OAuth2Client;\nconst { getRealmName } = Utils;\n\n/**\n * List OAuth2 clients\n */\nexport async function listOAuth2Clients(long = false) {\n try {\n const clients = await getOAuth2Clients();\n clients.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable([\n 'Client Id',\n 'Status',\n 'Client Type',\n 'Grant Types',\n 'Scopes',\n 'Redirect URIs',\n // 'Description',\n ]);\n const grantTypesMap = {\n authorization_code: 'Authz Code',\n client_credentials: 'Client Creds',\n refresh_token: 'Refresh Token',\n password: 'ROPC',\n 'urn:ietf:params:oauth:grant-type:uma-ticket': 'UMA',\n implicit: 'Implicit',\n 'urn:ietf:params:oauth:grant-type:device_code': 'Device Code',\n 'urn:ietf:params:oauth:grant-type:saml2-bearer': 'SAML2 Bearer',\n 'urn:openid:params:grant-type:ciba': 'CIBA',\n 'urn:ietf:params:oauth:grant-type:token-exchange': 'Token Exchange',\n 'urn:ietf:params:oauth:grant-type:jwt-bearer': 'JWT Bearer',\n };\n clients.forEach((client) => {\n table.push([\n client._id,\n client.coreOAuth2ClientConfig.status === 'Active'\n ? 'Active'['brightGreen']\n : client.coreOAuth2ClientConfig.status.brightRed,\n client.coreOAuth2ClientConfig.clientType,\n client.advancedOAuth2ClientConfig.grantTypes\n .map((type) => grantTypesMap[type])\n .join('\\n'),\n client.coreOAuth2ClientConfig.scopes.join('\\n'),\n client.coreOAuth2ClientConfig.redirectionUris.join('\\n'),\n // wordwrap(client.description, 30),\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n clients.forEach((client) => {\n printMessage(`${client._id}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing applications - ${error}`, 'error');\n }\n}\n\n/**\n * Export OAuth2 client to file\n * @param {string} clientId client id\n * @param {string} file file name\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientToFile(\n clientId: string,\n file: string,\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n) {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientToFile: begin`);\n showSpinner(`Exporting ${clientId}...`);\n try {\n let fileName = getTypedFilename(clientId, 'oauth2.app');\n if (file) {\n fileName = file;\n }\n const exportData = await exportOAuth2Client(clientId, options);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${clientId} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${clientId}: ${error.message}`);\n }\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientToFile: end`);\n return outcome;\n}\n\n/**\n * Export all OAuth2 clients to file\n * @param {string} file file name\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientsToFile(\n file: string,\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFile: begin`);\n showSpinner(`Exporting all clients...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Applications`,\n 'oauth2.app'\n );\n if (file) {\n fileName = file;\n }\n const exportData = await exportOAuth2Clients(options);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported all clients to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting all clients`);\n printMessage(`${error.message}`, 'error');\n }\n debugMessage(\n `cli.OAuth2ClientOps.exportOAuth2ClientsToFile: end [${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Export all OAuth2 clients to separate files\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientsToFiles(\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n) {\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFiles: begin`);\n const errors = [];\n try {\n const clients = await getOAuth2Clients();\n createProgressBar(clients.length, 'Exporting clients...');\n for (const client of clients) {\n const file = getTypedFilename(client._id, 'oauth2.app');\n try {\n const exportData: OAuth2ClientExportInterface =\n await exportOAuth2Client(client._id, options);\n saveJsonToFile(exportData, file);\n updateProgressBar(`Exported ${client._id}.`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error exporting ${client._id}.`);\n }\n }\n stopProgressBar(`Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error exporting client(s) to file(s)`);\n }\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import first OAuth2 client from file\n * @param {string} clientId client id\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientFromFile(\n clientId: string,\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientFromFile: begin`);\n showSpinner(`Importing ${clientId}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importOAuth2Client(clientId, fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${clientId}.`);\n } catch (error) {\n failSpinner(`Error importing ${clientId}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first OAuth2 client from file\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstOAuth2ClientFromFile(\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importFirstOAuth2ClientFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importFirstOAuth2Client(fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importFirstOAuth2ClientFromFile: end`);\n return outcome;\n}\n\n/**\n * Import OAuth2 clients from file\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientsFromFile(\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const applicationData = JSON.parse(data);\n await importOAuth2Clients(applicationData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFile: end`);\n return outcome;\n}\n\n/**\n * Import OAuth2 clients from files\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientsFromFiles(\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n const errors = [];\n try {\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFiles: begin`);\n const names = fs.readdirSync('.');\n const files = names.filter((name) =>\n name.toLowerCase().endsWith('.oauth2.app.json')\n );\n createProgressBar(files.length, 'Importing clients...');\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: OAuth2ClientExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.application).length;\n total += count;\n await importOAuth2Clients(fileData, options);\n updateProgressBar(`Imported ${count} client(s) from ${file}`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error importing client(s) from ${file}`);\n printMessage(error, 'error');\n }\n }\n stopProgressBar(\n `Finished importing ${total} client(s) from ${files.length} file(s).`\n );\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error importing client(s) from file(s).`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,SACEC,YAAY,EACZC,iBAAiB,EACjBC,KAAK,EACLC,KAAK,QACA,uBAAuB;AAC9B,SACEC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,SAASC,cAAc,QAAQ,4BAA4B;AAO3D,MAAM;EAAEC,gBAAgB;EAAEC;AAAU,CAAC,GAAGd,iBAAiB;AACzD,MAAM;EACJe,gBAAgB;EAChBC,kBAAkB;EAClBC,mBAAmB;EACnBC,kBAAkB;EAClBC,uBAAuB;EACvBC;AACF,CAAC,GAAGrB,YAAY;AAChB,MAAM;EAAEsB;AAAa,CAAC,GAAGpB,KAAK;;AAE9B;AACA;AACA;AACA,OAAO,eAAeqB,iBAAiB,CAACC,IAAI,GAAG,KAAK,EAAE;EACpD,IAAI;IACF,MAAMC,OAAO,GAAG,MAAMT,gBAAgB,EAAE;IACxCS,OAAO,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAA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QACdc,MAAM,CAAC3B,IAAI,CAACa,KAAK,CAAC;QAClBzC,iBAAiB,CAAE,kCAAiC4C,IAAK,EAAC,CAAC;QAC3DhD,YAAY,CAAC6C,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACA3C,eAAe,CACZ,sBAAqB4E,KAAM,mBAAkBL,KAAK,CAACb,MAAO,WAAU,CACtE;EACH,CAAC,CAAC,OAAOf,KAAK,EAAE;IACdc,MAAM,CAAC3B,IAAI,CAACa,KAAK,CAAC;IAClB3C,eAAe,CAAE,yCAAwC,CAAC;IAC1DF,YAAY,CAAC6C,KAAK,EAAE,OAAO,CAAC;EAC9B;EACA/C,YAAY,CAAE,uDAAsD,CAAC;EACrE,OAAO,CAAC,KAAK6D,MAAM,CAACC,MAAM;AAC5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-cli",
3
- "version": "0.23.1-2",
3
+ "version": "0.23.1-4",
4
4
  "type": "module",
5
5
  "description": "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
6
6
  "keywords": [
@@ -99,13 +99,14 @@
99
99
  ]
100
100
  },
101
101
  "dependencies": {
102
- "@rockcarver/frodo-lib": "0.18.9-1",
102
+ "@rockcarver/frodo-lib": "0.18.9-4",
103
103
  "chokidar": "^3.5.3",
104
104
  "cli-progress": "^3.11.2",
105
105
  "cli-table3": "^0.6.3",
106
106
  "colors": "^1.4.0",
107
107
  "commander": "^9.4.1",
108
108
  "compare-versions": "^5.0.1",
109
+ "fs-extra": "^11.1.1",
109
110
  "nanospinner": "^1.1.0",
110
111
  "properties-reader": "^2.2.0",
111
112
  "replaceall": "^0.1.6",