@rockcarver/frodo-cli 0.19.3-1 → 0.19.3-2

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,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.19.3-2] - 2023-01-05
11
+
10
12
  ## [0.19.3-1] - 2022-12-31
11
13
 
12
14
  ## [0.19.3-0] - 2022-12-31
@@ -835,7 +837,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
835
837
  - Fixed problem with adding connection profiles
836
838
  - Miscellaneous bug fixes
837
839
 
838
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.19.3-1...HEAD
840
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.19.3-2...HEAD
841
+
842
+ [0.19.3-2]: https://github.com/rockcarver/frodo-cli/compare/v0.19.3-1...v0.19.3-2
839
843
 
840
844
  [0.19.3-1]: https://github.com/rockcarver/frodo-cli/compare/v0.19.3-0...v0.19.3-1
841
845
 
@@ -1,19 +1,11 @@
1
1
  import { FrodoCommand } from '../FrodoCommand';
2
2
  import { Option } from 'commander';
3
- import { Authenticate, Script } from '@rockcarver/frodo-lib';
3
+ import { Authenticate } from '@rockcarver/frodo-lib';
4
4
  import { printMessage, verboseMessage } from '../../utils/Console';
5
+ import { exportScriptByNameToFile, exportScriptsToFile, exportScriptsToFiles } from '../../ops/ScriptOps';
5
6
  const {
6
7
  getTokens
7
8
  } = Authenticate;
8
- const {
9
- exportScriptByName
10
- } = Script;
11
- const {
12
- exportScriptsToFile
13
- } = Script;
14
- const {
15
- exportScriptsToFiles
16
- } = Script;
17
9
  const program = new FrodoCommand('frodo script export');
18
10
  program.description('Export scripts.').addOption(new Option('-n, --script-name <name>', 'Name of the script. If specified, -a and -A are ignored.'))
19
11
  // .addOption(
@@ -31,17 +23,17 @@ async (host, realm, user, password, options, command) => {
31
23
  // export by name
32
24
  if ((options.scriptName || options.script) && (await getTokens())) {
33
25
  verboseMessage('Exporting script...');
34
- exportScriptByName(options.scriptName || options.script, options.file);
26
+ await exportScriptByNameToFile(options.scriptName || options.script, options.file);
35
27
  }
36
28
  // -a / --all
37
29
  else if (options.all && (await getTokens())) {
38
30
  verboseMessage('Exporting all scripts to a single file...');
39
- exportScriptsToFile(options.file);
31
+ await exportScriptsToFile(options.file);
40
32
  }
41
33
  // -A / --all-separate
42
34
  else if (options.allSeparate && (await getTokens())) {
43
35
  verboseMessage('Exporting all scripts to separate files...');
44
- exportScriptsToFiles();
36
+ await exportScriptsToFiles();
45
37
  }
46
38
  // unrecognized combination of options or no options
47
39
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"script-export.js","names":["FrodoCommand","Option","Authenticate","Script","printMessage","verboseMessage","getTokens","exportScriptByName","exportScriptsToFile","exportScriptsToFiles","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","scriptName","script","file","all","allSeparate","help","process","exitCode","parse"],"sources":["cli/script/script-export.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, Script } from '@rockcarver/frodo-lib';\nimport { printMessage, verboseMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\nconst { exportScriptByName } = Script;\nconst { exportScriptsToFile } = Script;\nconst { exportScriptsToFiles } = Script;\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 -i.'\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 -i or -a.'\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 .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 exportScriptByName(options.scriptName || options.script, options.file);\n }\n // -a / --all\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all scripts to a single file...');\n exportScriptsToFile(options.file);\n }\n // -A / --all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all scripts to separate files...');\n exportScriptsToFiles();\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,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,EAAEC,MAAM,QAAQ,uBAAuB;AAC5D,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAElE,MAAM;EAAEC;AAAU,CAAC,GAAGJ,YAAY;AAClC,MAAM;EAAEK;AAAmB,CAAC,GAAGJ,MAAM;AACrC,MAAM;EAAEK;AAAoB,CAAC,GAAGL,MAAM;AACtC,MAAM;EAAEM;AAAqB,CAAC,GAAGN,MAAM;AAEvC,MAAMO,OAAO,GAAG,IAAIV,YAAY,CAAC,qBAAqB,CAAC;AAEvDU,OAAO,CACJC,WAAW,CAAC,iBAAiB,CAAC,CAC9BC,SAAS,CACR,IAAIX,MAAM,CACR,0BAA0B,EAC1B,0DAA0D,CAC3D;AAEH;AACA;AACA;AACA;AACA;AACA;AAAA,CACCW,SAAS,CAAC,IAAIX,MAAM,CAAC,m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Command","Option","Authenticate","printMessage","verboseMessage","exportScriptByNameToFile","exportScriptsToFile","exportScriptsToFiles","getTokens","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","scriptName","script","file","all","allSeparate","help","process","exitCode","parse"],"sources":["cli/script/script-export.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate } from '@rockcarver/frodo-lib';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport {\n exportScriptByNameToFile,\n exportScriptsToFile,\n exportScriptsToFiles,\n} from '../../ops/ScriptOps';\n\nconst { getTokens } = Authenticate;\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 -i.'\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 -i or -a.'\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 .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 await exportScriptByNameToFile(\n options.scriptName || options.script,\n options.file\n );\n }\n // -a / --all\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all scripts to a single file...');\n await exportScriptsToFile(options.file);\n }\n // -A / --all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all scripts to separate files...');\n await exportScriptsToFiles();\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,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SACEC,wBAAwB,EACxBC,mBAAmB,EACnBC,oBAAoB,QACf,qBAAqB;AAE5B,MAAM;EAAEC;AAAU,CAAC,GAAGN,YAAY;AAElC,MAAMO,OAAO,GAAG,IAAIT,YAAY,CAAC,qBAAqB,CAAC;AAEvDS,OAAO,CACJC,WAAW,CAAC,iBAAiB,CAAC,CAC9BC,SAAS,CACR,IAAIV,MAAM,CACR,0BAA0B,EAC1B,0DAA0D,CAC3D;AAEH;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,uDAAuD,CACxD,CACF,CACAU,SAAS,CACR,IAAIV,MAAM,CACR,oBAAoB,EACpB,uGAAuG,CACxG;AAEH;AAAA,CACCU,SAAS,CACR,IAAIV,MAAM,CACR,uBAAuB,EACvB,+DAA+D,CAChE,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,IAAI,CAACD,OAAO,CAACG,UAAU,IAAIH,OAAO,CAACI,MAAM,MAAM,MAAMb,SAAS,EAAE,CAAC,EAAE;IACjEJ,cAAc,CAAC,qBAAqB,CAAC;IACrC,MAAMC,wBAAwB,CAC5BY,OAAO,CAACG,UAAU,IAAIH,OAAO,CAACI,MAAM,EACpCJ,OAAO,CAACK,IAAI,CACb;EACH;EACA;EAAA,KACK,IAAIL,OAAO,CAACM,GAAG,KAAK,MAAMf,SAAS,EAAE,CAAC,EAAE;IAC3CJ,cAAc,CAAC,2CAA2C,CAAC;IAC3D,MAAME,mBAAmB,CAACW,OAAO,CAACK,IAAI,CAAC;EACzC;EACA;EAAA,KACK,IAAIL,OAAO,CAACO,WAAW,KAAK,MAAMhB,SAAS,EAAE,CAAC,EAAE;IACnDJ,cAAc,CAAC,4CAA4C,CAAC;IAC5D,MAAMG,oBAAoB,EAAE;EAC9B;EACA;EAAA,KACK;IACHJ,YAAY,CACV,sDAAsD,EACtD,OAAO,CACR;IACDM,OAAO,CAACgB,IAAI,EAAE;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHlB,OAAO,CAACmB,KAAK,EAAE"}
@@ -1,13 +1,11 @@
1
1
  import { FrodoCommand } from '../FrodoCommand';
2
2
  import { Option } from 'commander';
3
- import { Authenticate, Script, state } from '@rockcarver/frodo-lib';
3
+ import { Authenticate, state } from '@rockcarver/frodo-lib';
4
4
  import { verboseMessage } from '../../utils/Console';
5
+ import { importScriptsFromFile } from '../../ops/ScriptOps';
5
6
  const {
6
7
  getTokens
7
8
  } = Authenticate;
8
- const {
9
- importScriptsFromFile
10
- } = Script;
11
9
  const program = new FrodoCommand('frodo script import');
12
10
  program.description('Import scripts.').addOption(new Option('-f, --file <file>', 'Name of the file to import.')).addOption(new Option('-n, --script-name <name>', 'Name of the script. If specified, -a and -A are ignored.')).addOption(new Option('--re-uuid', 'Re-UUID. Create a new UUID for the script upon import. Use this to duplicate a script or create a new version of the same script. Note that you must also choose a new name using -n/--script-name to avoid import errors.').default(false, 'false'))
13
11
  // deprecated option
@@ -1 +1 @@
1
- {"version":3,"file":"script-import.js","names":["FrodoCommand","Option","Authenticate","Script","state","verboseMessage","getTokens","importScriptsFromFile","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getRealm","scriptName","script","file","reUuid","process","exitCode","parse"],"sources":["cli/script/script-import.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, Script, state } from '@rockcarver/frodo-lib';\nimport { verboseMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\n\nconst { importScriptsFromFile } = Script;\n\nconst program = new FrodoCommand('frodo script import');\n\nprogram\n .description('Import scripts.')\n .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))\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 '--re-uuid',\n 'Re-UUID. Create a new UUID for the script upon import. Use this to duplicate a script or create a new version of the same script. Note that you must also choose a new name using -n/--script-name to avoid import errors.'\n ).default(false, 'false')\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 .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(\n `Importing script(s) into realm \"${state.getRealm()}\"...`\n );\n importScriptsFromFile(\n options.scriptName || options.script,\n options.file,\n options.reUuid\n );\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,MAAM,EAAEC,KAAK,QAAQ,uBAAuB;AACnE,SAASC,cAAc,QAAQ,qBAAqB;AAEpD,MAAM;EAAEC;AAAU,CAAC,GAAGJ,YAAY;AAElC,MAAM;EAAEK;AAAsB,CAAC,GAAGJ,MAAM;AAExC,MAAMK,OAAO,GAAG,IAAIR,YAAY,CAAC,qBAAqB,CAAC;AAEvDQ,OAAO,CACJC,WAAW,CAAC,iBAAiB,CAAC,CAC9BC,SAAS,CAAC,IAAIT,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAAC,CACzES,SAAS,CACR,IAAIT,MAAM,CACR,0BAA0B,EAC1B,0DAA0D,CAC3D,CACF,CACAS,SAAS,CACR,IAAIT,MAAM,CACR,WAAW,EACX,4NAA4N,CAC7N,CAACU,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;AAE3B;AAAA,CACCD,SAAS,CACR,IAAIT,MAAM,CACR,uBAAuB,EACvB,+DAA+D,CAChE,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,IAAI,MAAMZ,SAAS,EAAE,EAAE;IACrBD,cAAc,CACX,mCAAkCD,KAAK,CAACgB,QAAQ,EAAG,MAAK,CAC1D;IACDb,qBAAqB,CACnBU,OAAO,CAACI,UAAU,IAAIJ,OAAO,CAACK,MAAM,EACpCL,OAAO,CAACM,IAAI,EACZN,OAAO,CAACO,MAAM,CACf;EACH,CAAC,MAAM;IACLC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHlB,OAAO,CAACmB,KAAK,EAAE"}
1
+ {"version":3,"file":"script-import.js","names":["FrodoCommand","Option","Authenticate","state","verboseMessage","importScriptsFromFile","getTokens","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getRealm","scriptName","script","file","reUuid","process","exitCode","parse"],"sources":["cli/script/script-import.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, state } from '@rockcarver/frodo-lib';\nimport { verboseMessage } from '../../utils/Console';\nimport { importScriptsFromFile } from '../../ops/ScriptOps';\n\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo script import');\n\nprogram\n .description('Import scripts.')\n .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))\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 '--re-uuid',\n 'Re-UUID. Create a new UUID for the script upon import. Use this to duplicate a script or create a new version of the same script. Note that you must also choose a new name using -n/--script-name to avoid import errors.'\n ).default(false, 'false')\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 .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(\n `Importing script(s) into realm \"${state.getRealm()}\"...`\n );\n importScriptsFromFile(\n options.scriptName || options.script,\n options.file,\n options.reUuid\n );\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,KAAK,QAAQ,uBAAuB;AAC3D,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,qBAAqB,QAAQ,qBAAqB;AAE3D,MAAM;EAAEC;AAAU,CAAC,GAAGJ,YAAY;AAElC,MAAMK,OAAO,GAAG,IAAIP,YAAY,CAAC,qBAAqB,CAAC;AAEvDO,OAAO,CACJC,WAAW,CAAC,iBAAiB,CAAC,CAC9BC,SAAS,CAAC,IAAIR,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAAC,CACzEQ,SAAS,CACR,IAAIR,MAAM,CACR,0BAA0B,EAC1B,0DAA0D,CAC3D,CACF,CACAQ,SAAS,CACR,IAAIR,MAAM,CACR,WAAW,EACX,4NAA4N,CAC7N,CAACS,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;AAE3B;AAAA,CACCD,SAAS,CACR,IAAIR,MAAM,CACR,uBAAuB,EACvB,+DAA+D,CAChE,CACF,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,IAAI,MAAMX,SAAS,EAAE,EAAE;IACrBF,cAAc,CACX,mCAAkCD,KAAK,CAACgB,QAAQ,EAAG,MAAK,CAC1D;IACDd,qBAAqB,CACnBW,OAAO,CAACI,UAAU,IAAIJ,OAAO,CAACK,MAAM,EACpCL,OAAO,CAACM,IAAI,EACZN,OAAO,CAACO,MAAM,CACf;EACH,CAAC,MAAM;IACLC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHlB,OAAO,CAACmB,KAAK,EAAE"}
@@ -1,13 +1,11 @@
1
1
  import { FrodoCommand } from '../FrodoCommand';
2
2
  import { Option } from 'commander';
3
- import { Authenticate, Script, state } from '@rockcarver/frodo-lib';
3
+ import { Authenticate, state } from '@rockcarver/frodo-lib';
4
4
  import { verboseMessage } from '../../utils/Console';
5
+ import { listScripts } from '../../ops/ScriptOps';
5
6
  const {
6
7
  getTokens
7
8
  } = Authenticate;
8
- const {
9
- listScripts
10
- } = Script;
11
9
  const program = new FrodoCommand('frodo script list');
12
10
  program.description('List scripts.').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":"script-list.js","names":["FrodoCommand","Option","Authenticate","Script","state","verboseMessage","getTokens","listScripts","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getRealm","long","process","exitCode","parse"],"sources":["cli/script/script-list.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, Script, state } from '@rockcarver/frodo-lib';\nimport { verboseMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\nconst { listScripts } = Script;\n\nconst program = new FrodoCommand('frodo script list');\n\nprogram\n .description('List scripts.')\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 scripts in realm \"${state.getRealm()}\"...`);\n await listScripts(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,MAAM,EAAEC,KAAK,QAAQ,uBAAuB;AACnE,SAASC,cAAc,QAAQ,qBAAqB;AAEpD,MAAM;EAAEC;AAAU,CAAC,GAAGJ,YAAY;AAClC,MAAM;EAAEK;AAAY,CAAC,GAAGJ,MAAM;AAE9B,MAAMK,OAAO,GAAG,IAAIR,YAAY,CAAC,mBAAmB,CAAC;AAErDQ,OAAO,CACJC,WAAW,CAAC,eAAe,CAAC,CAC5BC,SAAS,CACR,IAAIT,MAAM,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAACU,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,6BAA4BD,KAAK,CAACgB,QAAQ,EAAG,MAAK,CAAC;IACnE,MAAMb,WAAW,CAACU,OAAO,CAACI,IAAI,CAAC;EACjC,CAAC,MAAM;IACLC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHf,OAAO,CAACgB,KAAK,EAAE"}
1
+ {"version":3,"file":"script-list.js","names":["FrodoCommand","Option","Authenticate","state","verboseMessage","listScripts","getTokens","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getRealm","long","process","exitCode","parse"],"sources":["cli/script/script-list.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, state } from '@rockcarver/frodo-lib';\nimport { verboseMessage } from '../../utils/Console';\nimport { listScripts } from '../../ops/ScriptOps';\n\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo script list');\n\nprogram\n .description('List scripts.')\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 scripts in realm \"${state.getRealm()}\"...`);\n await listScripts(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,KAAK,QAAQ,uBAAuB;AAC3D,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,WAAW,QAAQ,qBAAqB;AAEjD,MAAM;EAAEC;AAAU,CAAC,GAAGJ,YAAY;AAElC,MAAMK,OAAO,GAAG,IAAIP,YAAY,CAAC,mBAAmB,CAAC;AAErDO,OAAO,CACJC,WAAW,CAAC,eAAe,CAAC,CAC5BC,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,MAAMX,SAAS,EAAE,EAAE;IACrBF,cAAc,CAAE,6BAA4BD,KAAK,CAACgB,QAAQ,EAAG,MAAK,CAAC;IACnE,MAAMd,WAAW,CAACW,OAAO,CAACI,IAAI,CAAC;EACjC,CAAC,MAAM;IACLC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHf,OAAO,CAACgB,KAAK,EAAE"}
@@ -11,11 +11,11 @@ const {
11
11
  getProviderMetadata,
12
12
  getProviderMetadataUrl,
13
13
  getSaml2ProviderStub,
14
- getRawProviders,
15
- getRawProvider,
14
+ getRawSaml2Providers,
15
+ getRawSaml2Provider,
16
16
  importSaml2Provider,
17
17
  importSaml2Providers,
18
- putRawProvider
18
+ putRawSaml2Provider
19
19
  } = Saml2;
20
20
  const {
21
21
  getTypedFilename,
@@ -297,7 +297,7 @@ export async function importSaml2ProvidersFromFiles() {
297
297
  * List entity providers
298
298
  */
299
299
  export async function listRawSaml2Providers() {
300
- const providerList = (await getRawProviders()).result;
300
+ const providerList = (await getRawSaml2Providers()).result;
301
301
  providerList.sort((a, b) => a._id.localeCompare(b._id));
302
302
  for (const provider of providerList) {
303
303
  printMessage(`${provider._id}`, 'data');
@@ -317,7 +317,7 @@ export async function exportRawSaml2ProviderToFile(entityId, file = null) {
317
317
  }
318
318
  createProgressBar(1, `Exporting raw entity provider: ${entityId}`);
319
319
  try {
320
- const rawData = await getRawProvider(entityId);
320
+ const rawData = await getRawSaml2Provider(entityId);
321
321
  updateProgressBar(`Writing file ${fileName}`);
322
322
  saveTextToFile(JSON.stringify(rawData, null, 2), fileName);
323
323
  stopProgressBar(`Exported raw entity provider ${entityId} to ${fileName}.`);
@@ -338,7 +338,7 @@ export async function exportRawSaml2ProvidersToFile(file = null) {
338
338
  fileName = getTypedFilename(`all${getRealmString()}ProvidersRaw`, 'raw.saml');
339
339
  }
340
340
  try {
341
- const samlApplicationList = (await getRawProviders()).result;
341
+ const samlApplicationList = (await getRawSaml2Providers()).result;
342
342
  saveToFile('application', samlApplicationList, '_id', fileName);
343
343
  printMessage(`All RAW saml entity providers exported to: ${fileName}`, 'info');
344
344
  } catch (error) {
@@ -352,14 +352,14 @@ export async function exportRawSaml2ProvidersToFile(file = null) {
352
352
  * Export all entity providers to individual files
353
353
  */
354
354
  export async function exportRawSaml2ProvidersToFiles() {
355
- const samlApplicationList = (await getRawProviders()).result;
355
+ const samlApplicationList = (await getRawSaml2Providers()).result;
356
356
  let hasError = false;
357
357
  createProgressBar(samlApplicationList.length, 'Exporting RAW providers');
358
358
  let exportedAmount = 0;
359
359
  for (const item of samlApplicationList) {
360
360
  updateProgressBar(`Exporting provider ${item.entityId}`);
361
361
  try {
362
- const samlApplicationData = await getRawProvider(item._id);
362
+ const samlApplicationData = await getRawSaml2Provider(item._id);
363
363
  const fileName = getTypedFilename(`${item._id}${getRealmString()}ProviderRaw`, 'raw.saml');
364
364
  saveToFile('application', [samlApplicationData], '_id', fileName);
365
365
  exportedAmount++;
@@ -391,7 +391,7 @@ file) {
391
391
  // remove the "_rev" data before PUT
392
392
  delete samlEntityData.application[id]._rev;
393
393
  try {
394
- await putRawProvider(id, samlEntityData.application[id]);
394
+ await putRawSaml2Provider(id, samlEntityData.application[id]);
395
395
  } catch (error) {
396
396
  printMessage(`Unable to import: ${id}`, 'error');
397
397
  }
@@ -416,7 +416,7 @@ export async function importFirstRawSaml2ProviderFromFile(file) {
416
416
  // remove the "_rev" data before PUT
417
417
  delete samlEntityData.application[id]._rev;
418
418
  try {
419
- await putRawProvider(id, samlEntityData.application[id]);
419
+ await putRawSaml2Provider(id, samlEntityData.application[id]);
420
420
  } catch (error) {
421
421
  printMessage(`Unable to import: ${id}`, 'error');
422
422
  }
@@ -448,7 +448,7 @@ export async function importRawSaml2ProvidersFromFile(file) {
448
448
  for (const id in samlEntityData.application) {
449
449
  // remove the "_rev" data before PUT
450
450
  delete samlEntityData.application[id]._rev;
451
- await putRawProvider(id, samlEntityData.application[id]).then(result => {
451
+ await putRawSaml2Provider(id, samlEntityData.application[id]).then(result => {
452
452
  if (result === null) {
453
453
  printMessage(`Import validation failed for ${id}`, 'error');
454
454
  }
@@ -480,7 +480,7 @@ export async function importRawSaml2ProvidersFromFiles(directory) {
480
480
  for (const id in samlEntityData.application) {
481
481
  // remove the "_rev" data before PUT
482
482
  delete samlEntityData.application[id]._rev;
483
- await putRawProvider(id, samlEntityData.application[id]).then(result => {
483
+ await putRawSaml2Provider(id, samlEntityData.application[id]).then(result => {
484
484
  if (result === null) {
485
485
  printMessage(`Import validation failed for ${id}`, 'error');
486
486
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Saml2Ops.js","names":["fs","path","Saml2","ExportImportUtils","createObjectTable","createProgressBar","createTable","debugMessage","printMessage","showSpinner","stopProgressBar","stopSpinner","updateProgressBar","roleMap","exportSaml2Provider","exportSaml2Providers","getSaml2ProviderStubs","getProviderByLocationAndId","getProviderMetadata","getProviderMetadataUrl","getSaml2ProviderStub","getRawProviders","getRawProvider","importSaml2Provider","importSaml2Providers","putRawProvider","getTypedFilename","saveJsonToFile","saveTextToFile","getRealmString","saveToFile","validateImport","getOneLineDescription","saml2ProviderObj","roles","key","value","Object","entries","push","description","entityId","entityLocation","length","join","getTableHeaderMd","markdown","getTableRowMd","row","listSaml2Providers","long","providerList","sort","a","b","_id","localeCompare","provider","table","location","map","role","toString","describeSaml2Provider","stub","id","rawProviderData","_rev","metadataUrl","error","message","exportSaml2MetadataToFile","file","fileName","metaData","brightCyan","exportSaml2ProviderToFile","fileData","err","exportSaml2ProvidersToFile","exportData","response","status","exportSaml2ProvidersToFiles","stubs","importSaml2ProviderFromFile","readFile","data","JSON","parse","meta","importFirstSaml2ProviderFromFile","keys","saml","remote","hosted","importSaml2ProvidersFromFile","importSaml2ProvidersFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","totalStatus","total","successes","warnings","failures","readFileSync","myStatus","listRawSaml2Providers","result","exportRawSaml2ProviderToFile","rawData","stringify","exportRawSaml2ProvidersToFile","samlApplicationList","exportRawSaml2ProvidersToFiles","hasError","exportedAmount","item","samlApplicationData","importRawSaml2ProviderFromFile","indexOf","samlEntityData","application","importFirstRawSaml2ProviderFromFile","importRawSaml2ProvidersFromFile","amountOfEntities","then","importRawSaml2ProvidersFromFiles","directory","files","filesToImport","forEach","filePathAbsolute"],"sources":["ops/Saml2Ops.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { Saml2ProviderSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport { Saml2, ExportImportUtils } from '@rockcarver/frodo-lib';\nimport {\n MultiOpStatusInterface,\n Saml2ExportInterface,\n} from '@rockcarver/frodo-lib/types/ops/OpsTypes';\nimport {\n createObjectTable,\n createProgressBar,\n createTable,\n debugMessage,\n printMessage,\n showSpinner,\n stopProgressBar,\n stopSpinner,\n updateProgressBar,\n} from '../utils/Console';\n\nconst {\n roleMap,\n exportSaml2Provider,\n exportSaml2Providers,\n getSaml2ProviderStubs,\n getProviderByLocationAndId,\n getProviderMetadata,\n getProviderMetadataUrl,\n getSaml2ProviderStub,\n getRawProviders,\n getRawProvider,\n importSaml2Provider,\n importSaml2Providers,\n putRawProvider,\n} = Saml2;\nconst {\n getTypedFilename,\n saveJsonToFile,\n saveTextToFile,\n getRealmString,\n saveToFile,\n validateImport,\n} = ExportImportUtils;\n\n/**\n * Get a one-line description of the saml2 provider object\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(\n saml2ProviderObj: Saml2ProviderSkeleton\n): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const description = `[${saml2ProviderObj.entityId['brightCyan']}]${\n ' (' + saml2ProviderObj.entityLocation\n }${roles.length ? ' ' + roles.join(', ') + ')' : ')'}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Entity Id | Location | Role(s) |\\n';\n markdown += '| --------- | -------- | ------- |';\n return markdown;\n}\n\n/**\n * Get a table-row of the saml2 provider in markdown\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a table-row of the saml2 provider in markdown\n */\nexport function getTableRowMd(saml2ProviderObj: Saml2ProviderSkeleton): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const row = `| ${saml2ProviderObj.entityId} | ${\n saml2ProviderObj.entityLocation\n } | ${roles.length ? roles.join(', ') : ''} |`;\n return row;\n}\n\n/**\n * List entity providers\n * @param {boolean} long Long list format with details\n */\nexport async function listSaml2Providers(long = false) {\n const providerList = await getSaml2ProviderStubs();\n providerList.sort((a, b) => a._id.localeCompare(b._id));\n if (!long) {\n for (const provider of providerList) {\n printMessage(`${provider.entityId}`, 'data');\n }\n } else {\n const table = createTable([\n 'Entity Id'['brightCyan'],\n 'Location'['brightCyan'],\n 'Role(s)'['brightCyan'],\n ]);\n for (const provider of providerList) {\n table.push([\n provider.entityId,\n provider.location,\n provider.roles.map((role) => roleMap[role]).join(', '),\n ]);\n }\n printMessage(table.toString());\n }\n}\n\n/**\n * Describe an entity provider's configuration\n * @param {String} entityId Provider entity id\n */\nexport async function describeSaml2Provider(entityId) {\n try {\n const stub = await getSaml2ProviderStub(entityId);\n printMessage(stub);\n const { location } = stub;\n const id = stub._id;\n const roles = stub.roles.map((role: string) => roleMap[role]).join(', ');\n const rawProviderData = await getProviderByLocationAndId(location, id);\n delete rawProviderData._id;\n delete rawProviderData._rev;\n rawProviderData.location = location;\n rawProviderData.roles = roles;\n rawProviderData.metadataUrl = getProviderMetadataUrl(entityId);\n const table = createObjectTable(rawProviderData);\n printMessage(table.toString());\n } catch (error) {\n printMessage(error.message, 'error');\n }\n}\n\n/**\n * Export provider metadata to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n */\nexport async function exportSaml2MetadataToFile(entityId, file = null) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(entityId, 'metadata', 'xml');\n }\n createProgressBar(1, `Exporting metadata for: ${entityId}`);\n try {\n updateProgressBar(`Writing file ${fileName}`);\n const metaData = await getProviderMetadata(entityId);\n saveTextToFile(metaData, fileName);\n stopProgressBar(\n `Exported ${entityId.brightCyan} metadata to ${fileName.brightCyan}.`\n );\n } catch (error) {\n stopProgressBar(`${error}`);\n printMessage(error, 'error');\n }\n}\n\n/**\n * Export a single entity provider to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n */\nexport async function exportSaml2ProviderToFile(entityId, file = null) {\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: start [entityId=${entityId}, file=${file}]`\n );\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(entityId, 'saml');\n }\n try {\n createProgressBar(1, `Exporting provider ${entityId}`);\n const fileData = await exportSaml2Provider(entityId);\n saveJsonToFile(fileData, fileName);\n stopProgressBar(\n `Exported ${entityId.brightCyan} to ${fileName.brightCyan}.`\n );\n } catch (err) {\n stopProgressBar(`${err}`);\n printMessage(err, 'error');\n }\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: end [entityId=${entityId}, file=${fileName}]`\n );\n}\n\n/**\n * Export all entity providers to one file\n * @param {String} file Optional filename\n */\nexport async function exportSaml2ProvidersToFile(file = null) {\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [file=${file}]`);\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`all${getRealmString()}Providers`, 'saml');\n }\n try {\n const exportData = await exportSaml2Providers();\n saveJsonToFile(exportData, fileName);\n } catch (error) {\n printMessage(error.message, 'error');\n printMessage(\n `exportSaml2ProvidersToFile: ${error.response?.status}`,\n 'error'\n );\n }\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: end [file=${file}]`);\n}\n\n/**\n * Export all entity providers to individual files\n */\nexport async function exportSaml2ProvidersToFiles() {\n const stubs = await getSaml2ProviderStubs();\n if (stubs.length > 0) {\n createProgressBar(stubs.length, 'Exporting providers');\n for (const stub of stubs) {\n updateProgressBar(`Exporting provider ${stub.entityId}`);\n const fileName = getTypedFilename(stub.entityId, 'saml');\n const fileData = await exportSaml2Provider(stub.entityId);\n saveJsonToFile(fileData, fileName);\n }\n stopProgressBar(`${stubs.length} providers exported.`);\n } else {\n printMessage('No entity providers found.', 'info');\n }\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} entityId Provider entity id\n * @param {String} file Import file name\n */\nexport async function importSaml2ProviderFromFile(\n entityId: string,\n file: string\n) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n showSpinner(`Importing ${entityId}...`);\n try {\n await importSaml2Provider(entityId, fileData);\n stopSpinner(`Imported ${entityId}.`);\n } catch (error) {\n stopSpinner(`Error importing ${entityId}: ${error.message}`);\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} file Import file name\n */\nexport async function importFirstSaml2ProviderFromFile(file: string) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data) as Saml2ExportInterface;\n // pick the first provider and run with it\n const entityId =\n Object.keys(fileData.saml.remote)[0] ||\n Object.keys(fileData.saml.hosted)[0];\n if (validateImport(fileData.meta)) {\n showSpinner(`Importing ${entityId}...`);\n try {\n await importSaml2Provider(entityId, fileData);\n stopSpinner(`Imported ${entityId}.`);\n } catch (error) {\n stopSpinner(`Error importing ${entityId}: ${error.message}`);\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all SAML entity providers from file\n * @param {String} file Import file name\n */\nexport async function importSaml2ProvidersFromFile(file: string) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n await importSaml2Providers(fileData);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all SAML entity providers from all *.saml.json files in the current directory\n */\nexport async function importSaml2ProvidersFromFiles() {\n const names = fs.readdirSync('.');\n const jsonFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.saml.json')\n );\n createProgressBar(jsonFiles.length, 'Importing providers...');\n const totalStatus: MultiOpStatusInterface = {\n total: 0,\n successes: 0,\n warnings: 0,\n failures: 0,\n };\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n const myStatus = await importSaml2Providers(fileData);\n totalStatus.total += myStatus.total;\n totalStatus.successes += myStatus.successes;\n totalStatus.warnings += myStatus.warnings;\n totalStatus.failures += myStatus.failures;\n updateProgressBar(\n `Imported ${myStatus.successes}/${myStatus.total} provider(s) from ${file}.`\n );\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n }\n stopProgressBar(\n `Imported ${totalStatus.successes} of ${totalStatus.total} provider(s) from ${jsonFiles.length} file(s).`\n );\n}\n\n/**\n * List entity providers\n */\nexport async function listRawSaml2Providers() {\n const providerList = (await getRawProviders()).result;\n providerList.sort((a, b) => a._id.localeCompare(b._id));\n for (const provider of providerList) {\n printMessage(`${provider._id}`, 'data');\n }\n}\n\n/**\n * Exports a RAW SAML entity, which means the raw xml is included.\n * @param {string} entityId Reference to the entity for export\n * @param {string} file Optional filename for the exported file\n */\nexport async function exportRawSaml2ProviderToFile(entityId, file = null) {\n printMessage(`Exporting raw SAML entity provider ${entityId}`, 'info');\n let fileName = file;\n if (!file) {\n fileName = getTypedFilename(`${entityId}`, 'raw.saml');\n }\n createProgressBar(1, `Exporting raw entity provider: ${entityId}`);\n try {\n const rawData = await getRawProvider(entityId);\n updateProgressBar(`Writing file ${fileName}`);\n saveTextToFile(JSON.stringify(rawData, null, 2), fileName);\n stopProgressBar(`Exported raw entity provider ${entityId} to ${fileName}.`);\n } catch (error) {\n stopProgressBar(`Error exporting raw entity ${entityId}: ${error.message}`);\n printMessage(error.response?.data, 'error');\n }\n}\n\n/**\n * Export all entity providers raw to one file\n * @param {String} file Optional filename\n */\nexport async function exportRawSaml2ProvidersToFile(file = null) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(\n `all${getRealmString()}ProvidersRaw`,\n 'raw.saml'\n );\n }\n try {\n const samlApplicationList = (await getRawProviders()).result;\n\n saveToFile('application', samlApplicationList, '_id', fileName);\n printMessage(\n `All RAW saml entity providers exported to: ${fileName}`,\n 'info'\n );\n } catch (error) {\n printMessage(error.message, 'error');\n printMessage(\n `exportRawSaml2ProvidersToFile: ${error.response?.status}`,\n 'error'\n );\n }\n}\n\n/**\n * Export all entity providers to individual files\n */\nexport async function exportRawSaml2ProvidersToFiles() {\n const samlApplicationList = (await getRawProviders()).result;\n let hasError = false;\n createProgressBar(samlApplicationList.length, 'Exporting RAW providers');\n let exportedAmount = 0;\n for (const item of samlApplicationList) {\n updateProgressBar(`Exporting provider ${item.entityId}`);\n try {\n const samlApplicationData = await getRawProvider(item._id);\n const fileName = getTypedFilename(\n `${item._id}${getRealmString()}ProviderRaw`,\n 'raw.saml'\n );\n saveToFile('application', [samlApplicationData], '_id', fileName);\n exportedAmount++;\n } catch (error) {\n hasError = true;\n printMessage(`Unable to export: ${item._id}`, 'error');\n }\n }\n stopProgressBar(`${exportedAmount} providers exported.`);\n if (!hasError) {\n printMessage('All entities exported.', 'info');\n } else {\n printMessage('All other entities exported.', 'info');\n }\n}\n\n/**\n * Imports a raw SAML export file (containing one entity).\n * @param {string} file The import file\n */\nexport async function importRawSaml2ProviderFromFile(\n // entityId: string,\n file: string\n) {\n printMessage(`Importing SAML Entity ${file}...`, 'info');\n if (file.indexOf('.raw.saml.json') > -1) {\n const samlEntityData = JSON.parse(fs.readFileSync(file, 'utf8'));\n if (validateImport(samlEntityData.meta)) {\n for (const id in samlEntityData.application) {\n // remove the \"_rev\" data before PUT\n delete samlEntityData.application[id]._rev;\n try {\n await putRawProvider(id, samlEntityData.application[id]);\n } catch (error) {\n printMessage(`Unable to import: ${id}`, 'error');\n }\n printMessage(`Imported ${id}`, 'info');\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n }\n}\n\n/**\n * Import first raw SAML entity provider from file\n * @param {String} file Import file name\n */\nexport async function importFirstRawSaml2ProviderFromFile(file) {\n printMessage(`Importing SAML Entity ${file}...`, 'info');\n if (file.indexOf('.raw.saml.json') > -1) {\n const samlEntityData = JSON.parse(fs.readFileSync(file, 'utf8'));\n if (validateImport(samlEntityData.meta)) {\n for (const id in samlEntityData.application) {\n // remove the \"_rev\" data before PUT\n delete samlEntityData.application[id]._rev;\n try {\n await putRawProvider(id, samlEntityData.application[id]);\n } catch (error) {\n printMessage(`Unable to import: ${id}`, 'error');\n }\n printMessage(`Imported ${id}`, 'info');\n return;\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n }\n}\n\n/**\n * Imports the RAW provider info from a single file.\n * @param file Import file name\n */\nexport async function importRawSaml2ProvidersFromFile(file: string) {\n fs.readFile(file, 'utf8', async function (err, data) {\n if (err) throw err;\n const samlEntityData = JSON.parse(data);\n let amountOfEntities = 0;\n for (const id in samlEntityData.application) {\n if (id.length) {\n amountOfEntities++;\n }\n }\n if (validateImport(samlEntityData.meta)) {\n createProgressBar(amountOfEntities, 'Importing providers...');\n for (const id in samlEntityData.application) {\n // remove the \"_rev\" data before PUT\n delete samlEntityData.application[id]._rev;\n await putRawProvider(id, samlEntityData.application[id]).then(\n (result) => {\n if (result === null) {\n printMessage(`Import validation failed for ${id}`, 'error');\n }\n }\n );\n updateProgressBar(`Imported ${id}...`);\n }\n stopProgressBar(`Import done`);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Whenever the SAML RAW file were exported using the exportRAW functionality this function\n * is used to read them back in. Only files with the .samlRaw.json extension will be imported.\n * @param {string} directory The directory from which to import the files\n */\nexport async function importRawSaml2ProvidersFromFiles(directory) {\n const files = fs.readdirSync(directory);\n const filesToImport = files.filter(\n (file) => file.indexOf('.samlRaw.json') > -1\n );\n\n if (filesToImport.length > 0) {\n createProgressBar(filesToImport.length, 'Importing providers...');\n filesToImport.forEach(async (file) => {\n const filePathAbsolute = path.join(directory, file);\n filesToImport.push(file);\n const samlEntityData = JSON.parse(\n fs.readFileSync(filePathAbsolute, 'utf8')\n );\n if (validateImport(samlEntityData.meta)) {\n for (const id in samlEntityData.application) {\n // remove the \"_rev\" data before PUT\n delete samlEntityData.application[id]._rev;\n await putRawProvider(id, samlEntityData.application[id]).then(\n (result) => {\n if (result === null) {\n printMessage(`Import validation failed for ${id}`, 'error');\n }\n }\n );\n updateProgressBar(`Imported ${id}...`);\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n stopProgressBar(`Import done`);\n } else {\n printMessage(\n 'Import failed, no files to import. (check extension to be .samlRaw.json)',\n 'warn'\n );\n }\n}\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AAEvB,SAASC,KAAK,EAAEC,iBAAiB,QAAQ,uBAAuB;AAKhE,SACEC,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C,IAAI,CAAC;MACxB,MAAMsD,cAAc,GAAGtC,IAAI,CAACC,KAAK,CAC/BzF,EAAE,CAAC8G,YAAY,CAAC2B,gBAAgB,EAAE,MAAM,CAAC,CAC1C;MACD,IAAI1G,cAAc,CAAC+F,cAAc,CAACpC,IAAI,CAAC,EAAE;QACvC,KAAK,MAAMzB,EAAE,IAAI6D,cAAc,CAACC,WAAW,EAAE;UAC3C;UACA,OAAOD,cAAc,CAACC,WAAW,CAAC9D,EAAE,CAAC,CAACE,IAAI;UAC1C,MAAM1C,cAAc,CAACwC,EAAE,EAAE6D,cAAc,CAACC,WAAW,CAAC9D,EAAE,CAAC,CAAC,CAACkE,IAAI,CAC1DlB,MAAM,IAAK;YACV,IAAIA,MAAM,KAAK,IAAI,EAAE;cACnBzG,YAAY,CAAE,gCAA+ByD,EAAG,EAAC,EAAE,OAAO,CAAC;YAC7D;UACF,CAAC,CACF;UACDrD,iBAAiB,CAAE,YAAWqD,EAAG,KAAI,CAAC;QACxC;MACF,CAAC,MAAM;QACLzD,YAAY,CAAC,6BAA6B,EAAE,OAAO,CAAC;MACtD;IACF,CAAC,CAAC;IACFE,eAAe,CAAE,aAAY,CAAC;EAChC,CAAC,MAAM;IACLF,YAAY,CACV,0EAA0E,EAC1E,MAAM,CACP;EACH;AACF"}
1
+ {"version":3,"file":"Saml2Ops.js","names":["fs","path","Saml2","ExportImportUtils","createObjectTable","createProgressBar","createTable","debugMessage","printMessage","showSpinner","stopProgressBar","stopSpinner","updateProgressBar","roleMap","exportSaml2Provider","exportSaml2Providers","getSaml2ProviderStubs","getProviderByLocationAndId","getProviderMetadata","getProviderMetadataUrl","getSaml2ProviderStub","getRawSaml2Providers","getRawSaml2Provider","importSaml2Provider","importSaml2Providers","putRawSaml2Provider","getTypedFilename","saveJsonToFile","saveTextToFile","getRealmString","saveToFile","validateImport","getOneLineDescription","saml2ProviderObj","roles","key","value","Object","entries","push","description","entityId","entityLocation","length","join","getTableHeaderMd","markdown","getTableRowMd","row","listSaml2Providers","long","providerList","sort","a","b","_id","localeCompare","provider","table","location","map","role","toString","describeSaml2Provider","stub","id","rawProviderData","_rev","metadataUrl","error","message","exportSaml2MetadataToFile","file","fileName","metaData","brightCyan","exportSaml2ProviderToFile","fileData","err","exportSaml2ProvidersToFile","exportData","response","status","exportSaml2ProvidersToFiles","stubs","importSaml2ProviderFromFile","readFile","data","JSON","parse","meta","importFirstSaml2ProviderFromFile","keys","saml","remote","hosted","importSaml2ProvidersFromFile","importSaml2ProvidersFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","totalStatus","total","successes","warnings","failures","readFileSync","myStatus","listRawSaml2Providers","result","exportRawSaml2ProviderToFile","rawData","stringify","exportRawSaml2ProvidersToFile","samlApplicationList","exportRawSaml2ProvidersToFiles","hasError","exportedAmount","item","samlApplicationData","importRawSaml2ProviderFromFile","indexOf","samlEntityData","application","importFirstRawSaml2ProviderFromFile","importRawSaml2ProvidersFromFile","amountOfEntities","then","importRawSaml2ProvidersFromFiles","directory","files","filesToImport","forEach","filePathAbsolute"],"sources":["ops/Saml2Ops.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { Saml2ProviderSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport { Saml2, ExportImportUtils } from '@rockcarver/frodo-lib';\nimport {\n MultiOpStatusInterface,\n Saml2ExportInterface,\n} from '@rockcarver/frodo-lib/types/ops/OpsTypes';\nimport {\n createObjectTable,\n createProgressBar,\n createTable,\n debugMessage,\n printMessage,\n showSpinner,\n stopProgressBar,\n stopSpinner,\n updateProgressBar,\n} from '../utils/Console';\n\nconst {\n roleMap,\n exportSaml2Provider,\n exportSaml2Providers,\n getSaml2ProviderStubs,\n getProviderByLocationAndId,\n getProviderMetadata,\n getProviderMetadataUrl,\n getSaml2ProviderStub,\n getRawSaml2Providers,\n getRawSaml2Provider,\n importSaml2Provider,\n importSaml2Providers,\n putRawSaml2Provider,\n} = Saml2;\nconst {\n getTypedFilename,\n saveJsonToFile,\n saveTextToFile,\n getRealmString,\n saveToFile,\n validateImport,\n} = ExportImportUtils;\n\n/**\n * Get a one-line description of the saml2 provider object\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(\n saml2ProviderObj: Saml2ProviderSkeleton\n): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const description = `[${saml2ProviderObj.entityId['brightCyan']}]${\n ' (' + saml2ProviderObj.entityLocation\n }${roles.length ? ' ' + roles.join(', ') + ')' : ')'}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Entity Id | Location | Role(s) |\\n';\n markdown += '| --------- | -------- | ------- |';\n return markdown;\n}\n\n/**\n * Get a table-row of the saml2 provider in markdown\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a table-row of the saml2 provider in markdown\n */\nexport function getTableRowMd(saml2ProviderObj: Saml2ProviderSkeleton): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const row = `| ${saml2ProviderObj.entityId} | ${\n saml2ProviderObj.entityLocation\n } | ${roles.length ? roles.join(', ') : ''} |`;\n return row;\n}\n\n/**\n * List entity providers\n * @param {boolean} long Long list format with details\n */\nexport async function listSaml2Providers(long = false) {\n const providerList = await getSaml2ProviderStubs();\n providerList.sort((a, b) => a._id.localeCompare(b._id));\n if (!long) {\n for (const provider of providerList) {\n printMessage(`${provider.entityId}`, 'data');\n }\n } else {\n const table = createTable([\n 'Entity Id'['brightCyan'],\n 'Location'['brightCyan'],\n 'Role(s)'['brightCyan'],\n ]);\n for (const provider of providerList) {\n table.push([\n provider.entityId,\n provider.location,\n provider.roles.map((role) => roleMap[role]).join(', '),\n ]);\n }\n printMessage(table.toString());\n }\n}\n\n/**\n * Describe an entity provider's configuration\n * @param {String} entityId Provider entity id\n */\nexport async function describeSaml2Provider(entityId) {\n try {\n const stub = await getSaml2ProviderStub(entityId);\n printMessage(stub);\n const { location } = stub;\n const id = stub._id;\n const roles = stub.roles.map((role: string) => roleMap[role]).join(', ');\n const rawProviderData = await getProviderByLocationAndId(location, id);\n delete rawProviderData._id;\n delete rawProviderData._rev;\n rawProviderData.location = location;\n rawProviderData.roles = roles;\n rawProviderData.metadataUrl = getProviderMetadataUrl(entityId);\n const table = createObjectTable(rawProviderData);\n printMessage(table.toString());\n } catch (error) {\n printMessage(error.message, 'error');\n }\n}\n\n/**\n * Export provider metadata to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n */\nexport async function exportSaml2MetadataToFile(entityId, file = null) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(entityId, 'metadata', 'xml');\n }\n createProgressBar(1, `Exporting metadata for: ${entityId}`);\n try {\n updateProgressBar(`Writing file ${fileName}`);\n const metaData = await getProviderMetadata(entityId);\n saveTextToFile(metaData, fileName);\n stopProgressBar(\n `Exported ${entityId.brightCyan} metadata to ${fileName.brightCyan}.`\n );\n } catch (error) {\n stopProgressBar(`${error}`);\n printMessage(error, 'error');\n }\n}\n\n/**\n * Export a single entity provider to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n */\nexport async function exportSaml2ProviderToFile(entityId, file = null) {\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: start [entityId=${entityId}, file=${file}]`\n );\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(entityId, 'saml');\n }\n try {\n createProgressBar(1, `Exporting provider ${entityId}`);\n const fileData = await exportSaml2Provider(entityId);\n saveJsonToFile(fileData, fileName);\n stopProgressBar(\n `Exported ${entityId.brightCyan} to ${fileName.brightCyan}.`\n );\n } catch (err) {\n stopProgressBar(`${err}`);\n printMessage(err, 'error');\n }\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: end [entityId=${entityId}, file=${fileName}]`\n );\n}\n\n/**\n * Export all entity providers to one file\n * @param {String} file Optional filename\n */\nexport async function exportSaml2ProvidersToFile(file = null) {\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [file=${file}]`);\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`all${getRealmString()}Providers`, 'saml');\n }\n try {\n const exportData = await exportSaml2Providers();\n saveJsonToFile(exportData, fileName);\n } catch (error) {\n printMessage(error.message, 'error');\n printMessage(\n `exportSaml2ProvidersToFile: ${error.response?.status}`,\n 'error'\n );\n }\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: end [file=${file}]`);\n}\n\n/**\n * Export all entity providers to individual files\n */\nexport async function exportSaml2ProvidersToFiles() {\n const stubs = await getSaml2ProviderStubs();\n if (stubs.length > 0) {\n createProgressBar(stubs.length, 'Exporting providers');\n for (const stub of stubs) {\n updateProgressBar(`Exporting provider ${stub.entityId}`);\n const fileName = getTypedFilename(stub.entityId, 'saml');\n const fileData = await exportSaml2Provider(stub.entityId);\n saveJsonToFile(fileData, fileName);\n }\n stopProgressBar(`${stubs.length} providers exported.`);\n } else {\n printMessage('No entity providers found.', 'info');\n }\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} entityId Provider entity id\n * @param {String} file Import file name\n */\nexport async function importSaml2ProviderFromFile(\n entityId: string,\n file: string\n) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n showSpinner(`Importing ${entityId}...`);\n try {\n await importSaml2Provider(entityId, fileData);\n stopSpinner(`Imported ${entityId}.`);\n } catch (error) {\n stopSpinner(`Error importing ${entityId}: ${error.message}`);\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} file Import file name\n */\nexport async function importFirstSaml2ProviderFromFile(file: string) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data) as Saml2ExportInterface;\n // pick the first provider and run with it\n const entityId =\n Object.keys(fileData.saml.remote)[0] ||\n Object.keys(fileData.saml.hosted)[0];\n if (validateImport(fileData.meta)) {\n showSpinner(`Importing ${entityId}...`);\n try {\n await importSaml2Provider(entityId, fileData);\n stopSpinner(`Imported ${entityId}.`);\n } catch (error) {\n stopSpinner(`Error importing ${entityId}: ${error.message}`);\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all SAML entity providers from file\n * @param {String} file Import file name\n */\nexport async function importSaml2ProvidersFromFile(file: string) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n await importSaml2Providers(fileData);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all SAML entity providers from all *.saml.json files in the current directory\n */\nexport async function importSaml2ProvidersFromFiles() {\n const names = fs.readdirSync('.');\n const jsonFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.saml.json')\n );\n createProgressBar(jsonFiles.length, 'Importing providers...');\n const totalStatus: MultiOpStatusInterface = {\n total: 0,\n successes: 0,\n warnings: 0,\n failures: 0,\n };\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n const myStatus = await importSaml2Providers(fileData);\n totalStatus.total += myStatus.total;\n totalStatus.successes += myStatus.successes;\n totalStatus.warnings += myStatus.warnings;\n totalStatus.failures += myStatus.failures;\n updateProgressBar(\n `Imported ${myStatus.successes}/${myStatus.total} provider(s) from ${file}.`\n );\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n }\n stopProgressBar(\n `Imported ${totalStatus.successes} of ${totalStatus.total} provider(s) from ${jsonFiles.length} file(s).`\n );\n}\n\n/**\n * List entity providers\n */\nexport async function listRawSaml2Providers() {\n const providerList = (await getRawSaml2Providers()).result;\n providerList.sort((a, b) => a._id.localeCompare(b._id));\n for (const provider of providerList) {\n printMessage(`${provider._id}`, 'data');\n }\n}\n\n/**\n * Exports a RAW SAML entity, which means the raw xml is included.\n * @param {string} entityId Reference to the entity for export\n * @param {string} file Optional filename for the exported file\n */\nexport async function exportRawSaml2ProviderToFile(entityId, file = null) {\n printMessage(`Exporting raw SAML entity provider ${entityId}`, 'info');\n let fileName = file;\n if (!file) {\n fileName = getTypedFilename(`${entityId}`, 'raw.saml');\n }\n createProgressBar(1, `Exporting raw entity provider: ${entityId}`);\n try {\n const rawData = await getRawSaml2Provider(entityId);\n updateProgressBar(`Writing file ${fileName}`);\n saveTextToFile(JSON.stringify(rawData, null, 2), fileName);\n stopProgressBar(`Exported raw entity provider ${entityId} to ${fileName}.`);\n } catch (error) {\n stopProgressBar(`Error exporting raw entity ${entityId}: ${error.message}`);\n printMessage(error.response?.data, 'error');\n }\n}\n\n/**\n * Export all entity providers raw to one file\n * @param {String} file Optional filename\n */\nexport async function exportRawSaml2ProvidersToFile(file = null) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(\n `all${getRealmString()}ProvidersRaw`,\n 'raw.saml'\n );\n }\n try {\n const samlApplicationList = (await getRawSaml2Providers()).result;\n\n saveToFile('application', samlApplicationList, '_id', fileName);\n printMessage(\n `All RAW saml entity providers exported to: ${fileName}`,\n 'info'\n );\n } catch (error) {\n printMessage(error.message, 'error');\n printMessage(\n `exportRawSaml2ProvidersToFile: ${error.response?.status}`,\n 'error'\n );\n }\n}\n\n/**\n * Export all entity providers to individual files\n */\nexport async function exportRawSaml2ProvidersToFiles() {\n const samlApplicationList = (await getRawSaml2Providers()).result;\n let hasError = false;\n createProgressBar(samlApplicationList.length, 'Exporting RAW providers');\n let exportedAmount = 0;\n for (const item of samlApplicationList) {\n updateProgressBar(`Exporting provider ${item.entityId}`);\n try {\n const samlApplicationData = await getRawSaml2Provider(item._id);\n const fileName = getTypedFilename(\n `${item._id}${getRealmString()}ProviderRaw`,\n 'raw.saml'\n );\n saveToFile('application', [samlApplicationData], '_id', fileName);\n exportedAmount++;\n } catch (error) {\n hasError = true;\n printMessage(`Unable to export: ${item._id}`, 'error');\n }\n }\n stopProgressBar(`${exportedAmount} providers exported.`);\n if (!hasError) {\n printMessage('All entities exported.', 'info');\n } else {\n printMessage('All other entities exported.', 'info');\n }\n}\n\n/**\n * Imports a raw SAML export file (containing one entity).\n * @param {string} file The import file\n */\nexport async function importRawSaml2ProviderFromFile(\n // entityId: string,\n file: string\n) {\n printMessage(`Importing SAML Entity ${file}...`, 'info');\n if (file.indexOf('.raw.saml.json') > -1) {\n const samlEntityData = JSON.parse(fs.readFileSync(file, 'utf8'));\n if (validateImport(samlEntityData.meta)) {\n for (const id in samlEntityData.application) {\n // remove the \"_rev\" data before PUT\n delete samlEntityData.application[id]._rev;\n try {\n await putRawSaml2Provider(id, samlEntityData.application[id]);\n } catch (error) {\n printMessage(`Unable to import: ${id}`, 'error');\n }\n printMessage(`Imported ${id}`, 'info');\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n }\n}\n\n/**\n * Import first raw SAML entity provider from file\n * @param {String} file Import file name\n */\nexport async function importFirstRawSaml2ProviderFromFile(file) {\n printMessage(`Importing SAML Entity ${file}...`, 'info');\n if (file.indexOf('.raw.saml.json') > -1) {\n const samlEntityData = JSON.parse(fs.readFileSync(file, 'utf8'));\n if (validateImport(samlEntityData.meta)) {\n for (const id in samlEntityData.application) {\n // remove the \"_rev\" data before PUT\n delete samlEntityData.application[id]._rev;\n try {\n await putRawSaml2Provider(id, samlEntityData.application[id]);\n } catch (error) {\n printMessage(`Unable to import: ${id}`, 'error');\n }\n printMessage(`Imported ${id}`, 'info');\n return;\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n }\n}\n\n/**\n * Imports the RAW provider info from a single file.\n * @param file Import file name\n */\nexport async function importRawSaml2ProvidersFromFile(file: string) {\n fs.readFile(file, 'utf8', async function (err, data) {\n if (err) throw err;\n const samlEntityData = JSON.parse(data);\n let amountOfEntities = 0;\n for (const id in samlEntityData.application) {\n if (id.length) {\n amountOfEntities++;\n }\n }\n if (validateImport(samlEntityData.meta)) {\n createProgressBar(amountOfEntities, 'Importing providers...');\n for (const id in samlEntityData.application) {\n // remove the \"_rev\" data before PUT\n delete samlEntityData.application[id]._rev;\n await putRawSaml2Provider(id, samlEntityData.application[id]).then(\n (result) => {\n if (result === null) {\n printMessage(`Import validation failed for ${id}`, 'error');\n }\n }\n );\n updateProgressBar(`Imported ${id}...`);\n }\n stopProgressBar(`Import done`);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Whenever the SAML RAW file were exported using the exportRAW functionality this function\n * is used to read them back in. Only files with the .samlRaw.json extension will be imported.\n * @param {string} directory The directory from which to import the files\n */\nexport async function importRawSaml2ProvidersFromFiles(directory) {\n const files = fs.readdirSync(directory);\n const filesToImport = files.filter(\n (file) => file.indexOf('.samlRaw.json') > -1\n );\n\n if (filesToImport.length > 0) {\n createProgressBar(filesToImport.length, 'Importing providers...');\n filesToImport.forEach(async (file) => {\n const filePathAbsolute = path.join(directory, file);\n filesToImport.push(file);\n const samlEntityData = JSON.parse(\n fs.readFileSync(filePathAbsolute, 'utf8')\n );\n if (validateImport(samlEntityData.meta)) {\n for (const id in samlEntityData.application) {\n // remove the \"_rev\" data before PUT\n delete samlEntityData.application[id]._rev;\n await putRawSaml2Provider(id, samlEntityData.application[id]).then(\n (result) => {\n if (result === null) {\n printMessage(`Import validation failed for ${id}`, 'error');\n }\n }\n );\n updateProgressBar(`Imported ${id}...`);\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n stopProgressBar(`Import done`);\n } else {\n printMessage(\n 'Import failed, no files to import. (check extension to be .samlRaw.json)',\n 'warn'\n );\n }\n}\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AAEvB,SAASC,KAA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IAAI,CAACyF,SAAS,EAAE7D,IAAI,CAAC;MACnD+D,aAAa,CAAChG,IAAI,CAACiC,IAAI,CAAC;MACxB,MAAMsD,cAAc,GAAGtC,IAAI,CAACC,KAAK,CAC/BzF,EAAE,CAAC8G,YAAY,CAAC2B,gBAAgB,EAAE,MAAM,CAAC,CAC1C;MACD,IAAI1G,cAAc,CAAC+F,cAAc,CAACpC,IAAI,CAAC,EAAE;QACvC,KAAK,MAAMzB,EAAE,IAAI6D,cAAc,CAACC,WAAW,EAAE;UAC3C;UACA,OAAOD,cAAc,CAACC,WAAW,CAAC9D,EAAE,CAAC,CAACE,IAAI;UAC1C,MAAM1C,mBAAmB,CAACwC,EAAE,EAAE6D,cAAc,CAACC,WAAW,CAAC9D,EAAE,CAAC,CAAC,CAACkE,IAAI,CAC/DlB,MAAM,IAAK;YACV,IAAIA,MAAM,KAAK,IAAI,EAAE;cACnBzG,YAAY,CAAE,gCAA+ByD,EAAG,EAAC,EAAE,OAAO,CAAC;YAC7D;UACF,CAAC,CACF;UACDrD,iBAAiB,CAAE,YAAWqD,EAAG,KAAI,CAAC;QACxC;MACF,CAAC,MAAM;QACLzD,YAAY,CAAC,6BAA6B,EAAE,OAAO,CAAC;MACtD;IACF,CAAC,CAAC;IACFE,eAAe,CAAE,aAAY,CAAC;EAChC,CAAC,MAAM;IACLF,YAAY,CACV,0EAA0E,EAC1E,MAAM,CACP;EACH;AACF"}
@@ -1,4 +1,15 @@
1
- import { ExportImportUtils } from '@rockcarver/frodo-lib';
1
+ import fs from 'fs';
2
+ import { Script, ExportImportUtils, state } from '@rockcarver/frodo-lib';
3
+ import { createProgressBar, createTable, debugMessage, failSpinner, printMessage, showSpinner, spinSpinner, stopProgressBar, succeedSpinner, updateProgressBar } from '../utils/Console';
4
+ import wordwrap from './utils/Wordwrap';
5
+ import { getTypedFilename, saveJsonToFile, titleCase } from '../utils/ExportImportUtils';
6
+ const {
7
+ getScripts,
8
+ exportScripts,
9
+ exportScript,
10
+ exportScriptByName,
11
+ importScripts
12
+ } = Script;
2
13
 
3
14
  /**
4
15
  * Get a one-line description of the script object
@@ -34,4 +45,169 @@ export function getTableRowMd(scriptObj) {
34
45
  const description = `| ${scriptObj.name} | ${langMap[scriptObj.language]} | ${ExportImportUtils.titleCase(scriptObj.context.split('_').join(' '))} | \`${scriptObj._id}\` |`;
35
46
  return description;
36
47
  }
48
+
49
+ /**
50
+ * List scripts
51
+ * @param {boolean} long detail list
52
+ * @returns {Promise<boolean>} true if no errors occurred during export, false otherwise
53
+ */
54
+ export async function listScripts(long = false) {
55
+ let outcome = true;
56
+ debugMessage(`Cli.ScriptOps.listScripts: start`);
57
+ try {
58
+ const scripts = await getScripts();
59
+ scripts.sort((a, b) => a.name.localeCompare(b.name));
60
+ if (long) {
61
+ const table = createTable(['Name', 'UUID', 'Language', 'Context', 'Description']);
62
+ const langMap = {
63
+ JAVASCRIPT: 'JS',
64
+ GROOVY: 'Groovy'
65
+ };
66
+ scripts.forEach(script => {
67
+ table.push([wordwrap(script.name, 25, ' '), script._id, langMap[script.language], wordwrap(titleCase(script.context.split('_').join(' ')), 25), wordwrap(script.description, 30)]);
68
+ });
69
+ printMessage(table.toString(), 'data');
70
+ } else {
71
+ scripts.forEach(script => {
72
+ printMessage(`${script.name}`, 'data');
73
+ });
74
+ }
75
+ } catch (error) {
76
+ outcome = false;
77
+ printMessage(`Error listing scripts: ${error.message}`, 'error');
78
+ debugMessage(error);
79
+ }
80
+ debugMessage(`Cli.ScriptOps.listScripts: end [${outcome}]`);
81
+ return outcome;
82
+ }
83
+
84
+ /**
85
+ * Export script by id to file
86
+ * @param {string} scriptId script uuid
87
+ * @param {string} file file name
88
+ * @returns {Promise<boolean>} true if no errors occurred during export, false otherwise
89
+ */
90
+ export async function exportScriptToFile(scriptId, file) {
91
+ debugMessage(`Cli.ScriptOps.exportScriptToFile: start`);
92
+ try {
93
+ showSpinner(`Exporting script '${scriptId}'...`);
94
+ let fileName = getTypedFilename(scriptId, 'script');
95
+ if (file) {
96
+ fileName = file;
97
+ }
98
+ spinSpinner(`Exporting script '${scriptId}' to '${fileName}'...`);
99
+ const exportData = await exportScript(scriptId);
100
+ saveJsonToFile(exportData, fileName);
101
+ succeedSpinner(`Exported script '${scriptId}' to '${fileName}'.`);
102
+ debugMessage(`Cli.ScriptOps.exportScriptToFile: end [true]`);
103
+ return true;
104
+ } catch (error) {
105
+ failSpinner(`Error exporting script '${scriptId}': ${error.message}`);
106
+ debugMessage(error);
107
+ }
108
+ debugMessage(`Cli.ScriptOps.exportScriptToFile: end [false]`);
109
+ return false;
110
+ }
111
+
112
+ /**
113
+ * Export script by name to file
114
+ * @param {string} name script name
115
+ * @param {string} file file name
116
+ * @returns {Promise<boolean>} true if no errors occurred during export, false otherwise
117
+ */
118
+ export async function exportScriptByNameToFile(name, file) {
119
+ debugMessage(`Cli.ScriptOps.exportScriptByNameToFile: start`);
120
+ try {
121
+ showSpinner(`Exporting script '${name}'...`);
122
+ let fileName = getTypedFilename(name, 'script');
123
+ if (file) {
124
+ fileName = file;
125
+ }
126
+ spinSpinner(`Exporting script '${name}' to '${fileName}'...`);
127
+ const exportData = await exportScriptByName(name);
128
+ saveJsonToFile(exportData, fileName);
129
+ succeedSpinner(`Exported script '${name}' to '${fileName}'.`);
130
+ debugMessage(`Cli.ScriptOps.exportScriptByNameToFile: end [true]`);
131
+ return true;
132
+ } catch (error) {
133
+ failSpinner(`Error exporting script '${name}': ${error.message}`);
134
+ debugMessage(error);
135
+ }
136
+ debugMessage(`Cli.ScriptOps.exportScriptByNameToFile: end [false]`);
137
+ return false;
138
+ }
139
+
140
+ /**
141
+ * Export all scripts to single file
142
+ * @param {string} file file name
143
+ * @returns {Promise<boolean>} true if no errors occurred during export, false otherwise
144
+ */
145
+ export async function exportScriptsToFile(file) {
146
+ debugMessage(`Cli.ScriptOps.exportScriptsToFile: start`);
147
+ try {
148
+ let fileName = getTypedFilename(`all${titleCase(state.getRealm())}Scripts`, 'script');
149
+ if (file) {
150
+ fileName = file;
151
+ }
152
+ const exportData = await exportScripts();
153
+ saveJsonToFile(exportData, fileName);
154
+ debugMessage(`Cli.ScriptOps.exportScriptsToFile: end [true]`);
155
+ return true;
156
+ } catch (error) {
157
+ printMessage(`Error exporting scripts: ${error.message}`, 'error');
158
+ debugMessage(error);
159
+ }
160
+ debugMessage(`Cli.ScriptOps.exportScriptsToFile: end [false]`);
161
+ return false;
162
+ }
163
+
164
+ /**
165
+ * Export all scripts to individual files
166
+ * @returns {Promise<boolean>} true if no errors occurred during export, false otherwise
167
+ */
168
+ export async function exportScriptsToFiles() {
169
+ let outcome = true;
170
+ debugMessage(`Cli.ScriptOps.exportScriptsToFiles: start`);
171
+ const scriptList = await getScripts();
172
+ createProgressBar(scriptList.length, 'Exporting scripts to individual files...');
173
+ for (const script of scriptList) {
174
+ try {
175
+ updateProgressBar(`Reading script ${script.name}`);
176
+ const fileName = getTypedFilename(script.name, 'script');
177
+ const exportData = await exportScriptByName(script.name);
178
+ saveJsonToFile(exportData, fileName);
179
+ } catch (error) {
180
+ outcome = false;
181
+ printMessage(`Error exporting script '${script.name}': ${error.message}`, 'error');
182
+ debugMessage(error);
183
+ }
184
+ }
185
+ stopProgressBar(`Exported ${scriptList.length} scripts to individual files.`);
186
+ debugMessage(`Cli.ScriptOps.exportScriptsToFiles: end [${outcome}]`);
187
+ return outcome;
188
+ }
189
+
190
+ /**
191
+ * Import script(s) from file
192
+ * @param {string} name Optional name of script. If supplied, only the script of that name is imported
193
+ * @param {string} file file name
194
+ * @param {boolean} reUuid true to generate a new uuid for each script on import, false otherwise
195
+ * @returns {Promise<boolean>} true if no errors occurred during import, false otherwise
196
+ */
197
+ export async function importScriptsFromFile(name, file, reUuid = false) {
198
+ let outcome = false;
199
+ debugMessage(`Cli.ScriptOps.importScriptsFromFile: start`);
200
+ fs.readFile(file, 'utf8', async (err, data) => {
201
+ try {
202
+ if (err) throw err;
203
+ const importData = JSON.parse(data);
204
+ outcome = await importScripts(name, importData, reUuid);
205
+ } catch (error) {
206
+ printMessage(`Error exporting script '${name}': ${error.message}`, 'error');
207
+ debugMessage(error);
208
+ }
209
+ });
210
+ debugMessage(`Cli.ScriptOps.importScriptsFromFile: end [${outcome}]`);
211
+ return outcome;
212
+ }
37
213
  //# sourceMappingURL=ScriptOps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScriptOps.js","names":["ExportImportUtils","getOneLineDescription","scriptObj","description","_id","context","name","getTableHeaderMd","markdown","getTableRowMd","langMap","JAVASCRIPT","GROOVY","language","titleCase","split","join"],"sources":["ops/ScriptOps.ts"],"sourcesContent":["import { ScriptSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport { ExportImportUtils } from '@rockcarver/frodo-lib';\n\n/**\n * Get a one-line description of the script object\n * @param {ScriptSkeleton} scriptObj script object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(scriptObj: ScriptSkeleton): string {\n const description = `[${scriptObj._id['brightCyan']}] ${scriptObj.context} - ${scriptObj.name}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Name | Language | Type | Id |\\n';\n markdown += '| ---- | -------- | ---- | ---|';\n return markdown;\n}\n\n/**\n * Get a one-line description of the script object in markdown\n * @param {ScriptSkeleton} scriptObj script object to describe\n * @returns {string} markdown table row\n */\nexport function getTableRowMd(scriptObj: ScriptSkeleton): string {\n const langMap = { JAVASCRIPT: 'JavaSscript', GROOVY: 'Groovy' };\n const description = `| ${scriptObj.name} | ${\n langMap[scriptObj.language]\n } | ${ExportImportUtils.titleCase(\n scriptObj.context.split('_').join(' ')\n )} | \\`${scriptObj._id}\\` |`;\n return description;\n}\n"],"mappings":"AACA,SAASA,iBAAiB,QAAQ,uBAAuB;;AAEzD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqB,CAACC,SAAyB,EAAU;EACvE,MAAMC,WAAW,GAAI,IAAGD,SAAS,CAACE,GAAG,CAAC,YAAY,CAAE,KAAIF,SAAS,CAACG,OAAQ,MAAKH,SAAS,CAACI,IAAK,EAAC;EAC/F,OAAOH,WAAW;AACpB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASI,gBAAgB,GAAW;EACzC,IAAIC,QAAQ,GAAG,EAAE;EACjBA,QAAQ,IAAI,mCAAmC;EAC/CA,QAAQ,IAAI,iCAAiC;EAC7C,OAAOA,QAAQ;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAa,CAACP,SAAyB,EAAU;EAC/D,MAAMQ,OAAO,GAAG;IAAEC,UAAU,EAAE,aAAa;IAAEC,MAAM,EAAE;EAAS,CAAC;EAC/D,MAAMT,WAAW,GAAI,KAAID,SAAS,CAACI,IAAK,MACtCI,OAAO,CAACR,SAAS,CAACW,QAAQ,CAC3B,MAAKb,iBAAiB,CAACc,SAAS,CAC/BZ,SAAS,CAACG,OAAO,CAACU,KAAK,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CACtC,QAAOd,SAAS,CAACE,GAAI,MAAK;EAC5B,OAAOD,WAAW;AACpB"}
1
+ {"version":3,"file":"ScriptOps.js","names":["fs","Script","ExportImportUtils","state","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","spinSpinner","stopProgressBar","succeedSpinner","updateProgressBar","wordwrap","getTypedFilename","saveJsonToFile","titleCase","getScripts","exportScripts","exportScript","exportScriptByName","importScripts","getOneLineDescription","scriptObj","description","_id","context","name","getTableHeaderMd","markdown","getTableRowMd","langMap","JAVASCRIPT","GROOVY","language","split","join","listScripts","long","outcome","scripts","sort","a","b","localeCompare","table","forEach","script","push","toString","error","message","exportScriptToFile","scriptId","file","fileName","exportData","exportScriptByNameToFile","exportScriptsToFile","getRealm","exportScriptsToFiles","scriptList","length","importScriptsFromFile","reUuid","readFile","err","data","importData","JSON","parse"],"sources":["ops/ScriptOps.ts"],"sourcesContent":["import fs from 'fs';\nimport { ScriptSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport { Script, ExportImportUtils, state } from '@rockcarver/frodo-lib';\nimport {\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n spinSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport wordwrap from './utils/Wordwrap';\nimport {\n getTypedFilename,\n saveJsonToFile,\n titleCase,\n} from '../utils/ExportImportUtils';\n\nconst {\n getScripts,\n exportScripts,\n exportScript,\n exportScriptByName,\n importScripts,\n} = Script;\n\n/**\n * Get a one-line description of the script object\n * @param {ScriptSkeleton} scriptObj script object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(scriptObj: ScriptSkeleton): string {\n const description = `[${scriptObj._id['brightCyan']}] ${scriptObj.context} - ${scriptObj.name}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Name | Language | Type | Id |\\n';\n markdown += '| ---- | -------- | ---- | ---|';\n return markdown;\n}\n\n/**\n * Get a one-line description of the script object in markdown\n * @param {ScriptSkeleton} scriptObj script object to describe\n * @returns {string} markdown table row\n */\nexport function getTableRowMd(scriptObj: ScriptSkeleton): string {\n const langMap = { JAVASCRIPT: 'JavaSscript', GROOVY: 'Groovy' };\n const description = `| ${scriptObj.name} | ${\n langMap[scriptObj.language]\n } | ${ExportImportUtils.titleCase(\n scriptObj.context.split('_').join(' ')\n )} | \\`${scriptObj._id}\\` |`;\n return description;\n}\n\n/**\n * List scripts\n * @param {boolean} long detail list\n * @returns {Promise<boolean>} true if no errors occurred during export, false otherwise\n */\nexport async function listScripts(long = false): Promise<boolean> {\n let outcome = true;\n debugMessage(`Cli.ScriptOps.listScripts: start`);\n try {\n const scripts = await getScripts();\n scripts.sort((a, b) => a.name.localeCompare(b.name));\n if (long) {\n const table = createTable([\n 'Name',\n 'UUID',\n 'Language',\n 'Context',\n 'Description',\n ]);\n const langMap = { JAVASCRIPT: 'JS', GROOVY: 'Groovy' };\n scripts.forEach((script) => {\n table.push([\n wordwrap(script.name, 25, ' '),\n script._id,\n langMap[script.language],\n wordwrap(titleCase(script.context.split('_').join(' ')), 25),\n wordwrap(script.description, 30),\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n scripts.forEach((script) => {\n printMessage(`${script.name}`, 'data');\n });\n }\n } catch (error) {\n outcome = false;\n printMessage(`Error listing scripts: ${error.message}`, 'error');\n debugMessage(error);\n }\n debugMessage(`Cli.ScriptOps.listScripts: end [${outcome}]`);\n return outcome;\n}\n\n/**\n * Export script by id to file\n * @param {string} scriptId script uuid\n * @param {string} file file name\n * @returns {Promise<boolean>} true if no errors occurred during export, false otherwise\n */\nexport async function exportScriptToFile(\n scriptId: string,\n file: string\n): Promise<boolean> {\n debugMessage(`Cli.ScriptOps.exportScriptToFile: start`);\n try {\n showSpinner(`Exporting script '${scriptId}'...`);\n let fileName = getTypedFilename(scriptId, 'script');\n if (file) {\n fileName = file;\n }\n spinSpinner(`Exporting script '${scriptId}' to '${fileName}'...`);\n const exportData = await exportScript(scriptId);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported script '${scriptId}' to '${fileName}'.`);\n debugMessage(`Cli.ScriptOps.exportScriptToFile: end [true]`);\n return true;\n } catch (error) {\n failSpinner(`Error exporting script '${scriptId}': ${error.message}`);\n debugMessage(error);\n }\n debugMessage(`Cli.ScriptOps.exportScriptToFile: end [false]`);\n return false;\n}\n\n/**\n * Export script by name to file\n * @param {string} name script name\n * @param {string} file file name\n * @returns {Promise<boolean>} true if no errors occurred during export, false otherwise\n */\nexport async function exportScriptByNameToFile(\n name: string,\n file: string\n): Promise<boolean> {\n debugMessage(`Cli.ScriptOps.exportScriptByNameToFile: start`);\n try {\n showSpinner(`Exporting script '${name}'...`);\n let fileName = getTypedFilename(name, 'script');\n if (file) {\n fileName = file;\n }\n spinSpinner(`Exporting script '${name}' to '${fileName}'...`);\n const exportData = await exportScriptByName(name);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported script '${name}' to '${fileName}'.`);\n debugMessage(`Cli.ScriptOps.exportScriptByNameToFile: end [true]`);\n return true;\n } catch (error) {\n failSpinner(`Error exporting script '${name}': ${error.message}`);\n debugMessage(error);\n }\n debugMessage(`Cli.ScriptOps.exportScriptByNameToFile: end [false]`);\n return false;\n}\n\n/**\n * Export all scripts to single file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if no errors occurred during export, false otherwise\n */\nexport async function exportScriptsToFile(file: string): Promise<boolean> {\n debugMessage(`Cli.ScriptOps.exportScriptsToFile: start`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(state.getRealm())}Scripts`,\n 'script'\n );\n if (file) {\n fileName = file;\n }\n const exportData = await exportScripts();\n saveJsonToFile(exportData, fileName);\n debugMessage(`Cli.ScriptOps.exportScriptsToFile: end [true]`);\n return true;\n } catch (error) {\n printMessage(`Error exporting scripts: ${error.message}`, 'error');\n debugMessage(error);\n }\n debugMessage(`Cli.ScriptOps.exportScriptsToFile: end [false]`);\n return false;\n}\n\n/**\n * Export all scripts to individual files\n * @returns {Promise<boolean>} true if no errors occurred during export, false otherwise\n */\nexport async function exportScriptsToFiles(): Promise<boolean> {\n let outcome = true;\n debugMessage(`Cli.ScriptOps.exportScriptsToFiles: start`);\n const scriptList = await getScripts();\n createProgressBar(\n scriptList.length,\n 'Exporting scripts to individual files...'\n );\n for (const script of scriptList) {\n try {\n updateProgressBar(`Reading script ${script.name}`);\n const fileName = getTypedFilename(script.name, 'script');\n const exportData = await exportScriptByName(script.name);\n saveJsonToFile(exportData, fileName);\n } catch (error) {\n outcome = false;\n printMessage(\n `Error exporting script '${script.name}': ${error.message}`,\n 'error'\n );\n debugMessage(error);\n }\n }\n stopProgressBar(`Exported ${scriptList.length} scripts to individual files.`);\n debugMessage(`Cli.ScriptOps.exportScriptsToFiles: end [${outcome}]`);\n return outcome;\n}\n\n/**\n * Import script(s) from file\n * @param {string} name Optional name of script. If supplied, only the script of that name is imported\n * @param {string} file file name\n * @param {boolean} reUuid true to generate a new uuid for each script on import, false otherwise\n * @returns {Promise<boolean>} true if no errors occurred during import, false otherwise\n */\nexport async function importScriptsFromFile(\n name: string,\n file: string,\n reUuid = false\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`Cli.ScriptOps.importScriptsFromFile: start`);\n fs.readFile(file, 'utf8', async (err, data) => {\n try {\n if (err) throw err;\n const importData = JSON.parse(data);\n outcome = await importScripts(name, importData, reUuid);\n } catch (error) {\n printMessage(\n `Error exporting script '${name}': ${error.message}`,\n 'error'\n );\n debugMessage(error);\n }\n });\n debugMessage(`Cli.ScriptOps.importScriptsFromFile: end [${outcome}]`);\n return outcome;\n}\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AAEnB,SAASC,MAAM,EAAEC,iBAAiB,EAAEC,KAAK,QAAQ,uBAAuB;AACxE,SACEC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,OAAOC,QAAQ,MAAM,kBAAkB;AACvC,SACEC,gBAAgB,EAChBC,cAAc,EACdC,SAAS,QACJ,4BAA4B;AAEnC,MAAM;EACJC,UAAU;EACVC,aAAa;EACbC,YAAY;EACZC,kBAAkB;EAClBC;AACF,CAAC,GAAGrB,MAAM;;AAEV;AACA;AACA;AACA;AACA;AACA,OAAO,SAASsB,qBAAqB,CAACC,SAAyB,EAAU;EACvE,MAAMC,WAAW,GAAI,IAAGD,SAAS,CAACE,GAAG,CAAC,YAAY,CAAE,KAAIF,SAAS,CAACG,OAAQ,MAAKH,SAAS,CAACI,IAAK,EAAC;EAC/F,OAAOH,WAAW;AACpB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASI,gBAAgB,GAAW;EACzC,IAAIC,QAAQ,GAAG,EAAE;EACjBA,QAAQ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AK,MAAKuB,KAAK,CAACC,OAAQ,EAAC,EAC3D,OAAO,CACR;MACD9C,YAAY,CAAC6C,KAAK,CAAC;IACrB;EACF;EACAxC,eAAe,CAAE,YAAWmD,UAAU,CAACC,MAAO,+BAA8B,CAAC;EAC7EzD,YAAY,CAAE,4CAA2CkC,OAAQ,GAAE,CAAC;EACpE,OAAOA,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAewB,qBAAqB,CACzCpC,IAAY,EACZ2B,IAAY,EACZU,MAAM,GAAG,KAAK,EACI;EAClB,IAAIzB,OAAO,GAAG,KAAK;EACnBlC,YAAY,CAAE,4CAA2C,CAAC;EAC1DN,EAAE,CAACkE,QAAQ,CAACX,IAAI,EAAE,MAAM,EAAE,OAAOY,GAAG,EAAEC,IAAI,KAAK;IAC7C,IAAI;MACF,IAAID,GAAG,EAAE,MAAMA,GAAG;MAClB,MAAME,UAAU,GAAGC,IAAI,CAACC,KAAK,CAACH,IAAI,CAAC;MACnC5B,OAAO,GAAG,MAAMlB,aAAa,CAACM,IAAI,EAAEyC,UAAU,EAAEJ,MAAM,CAAC;IACzD,CAAC,CAAC,OAAOd,KAAK,EAAE;MACd3C,YAAY,CACT,2BAA0BoB,IAAK,MAAKuB,KAAK,CAACC,OAAQ,EAAC,EACpD,OAAO,CACR;MACD9C,YAAY,CAAC6C,KAAK,CAAC;IACrB;EACF,CAAC,CAAC;EACF7C,YAAY,CAAE,6CAA4CkC,OAAQ,GAAE,CAAC;EACrE,OAAOA,OAAO;AAChB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-cli",
3
- "version": "0.19.3-1",
3
+ "version": "0.19.3-2",
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": [
@@ -48,10 +48,18 @@
48
48
  "name": "Adam Crockett",
49
49
  "email": "adam.crockett@forgerock.com"
50
50
  },
51
+ {
52
+ "name": "Mees van Dongen",
53
+ "email": "meesvandongen@gmail.com"
54
+ },
51
55
  {
52
56
  "name": "Ali Falahi",
53
57
  "email": "ali@falahi.com"
54
58
  },
59
+ {
60
+ "name": "Marcel Maas",
61
+ "email": "maas.marcel@gmail.com"
62
+ },
55
63
  {
56
64
  "name": "Joshua Sayers",
57
65
  "email": "joshua.sayers@forgerock.com"
@@ -88,7 +96,7 @@
88
96
  ]
89
97
  },
90
98
  "dependencies": {
91
- "@rockcarver/frodo-lib": "0.17.3",
99
+ "@rockcarver/frodo-lib": "0.17.4",
92
100
  "cli-progress": "^3.11.2",
93
101
  "cli-table3": "^0.6.3",
94
102
  "colors": "^1.4.0",