@rockcarver/frodo-cli 0.18.2-3 → 0.18.2-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.18.2-5] - 2022-11-16
11
+
12
+ ## [0.18.2-4] - 2022-11-10
13
+
10
14
  ## [0.18.2-3] - 2022-11-09
11
15
 
12
16
  ## [0.18.2-2] - 2022-11-09
@@ -717,7 +721,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
717
721
  - Fixed problem with adding connection profiles
718
722
  - Miscellaneous bug fixes
719
723
 
720
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.18.2-3...HEAD
724
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.18.2-5...HEAD
725
+
726
+ [0.18.2-5]: https://github.com/rockcarver/frodo-cli/compare/v0.18.2-4...v0.18.2-5
727
+
728
+ [0.18.2-4]: https://github.com/rockcarver/frodo-cli/compare/v0.18.2-3...v0.18.2-4
721
729
 
722
730
  [0.18.2-3]: https://github.com/rockcarver/frodo-cli/compare/v0.18.2-2...v0.18.2-3
723
731
 
package/esm/app.js CHANGED
@@ -16,6 +16,7 @@ import logging from './cli/logging/logs';
16
16
  import realm from './cli/realm/realm';
17
17
  import saml from './cli/saml/saml';
18
18
  import script from './cli/script/script';
19
+ import service from './cli/service/service';
19
20
  import theme from './cli/theme/theme';
20
21
  import { printMessage } from './utils/Console';
21
22
  import { getVersions } from './utils/Version';
@@ -42,6 +43,7 @@ const {
42
43
  program.addCommand(realm());
43
44
  program.addCommand(saml());
44
45
  program.addCommand(script());
46
+ program.addCommand(service());
45
47
  program.addCommand(theme());
46
48
  program.showHelpAfterError();
47
49
  program.enablePositionalOptions();
package/esm/app.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","names":["ConnectionProfile","Command","admin","agent","app","conn","email","esv","idm","idp","info","journey","logging","realm","saml","script","theme","printMessage","getVersions","initConnectionProfiles","program","version","addCommand","showHelpAfterError","enablePositionalOptions","parse","e"],"sources":["app.ts"],"sourcesContent":["#!/usr/bin/env -S node --no-warnings --enable-source-maps --experimental-specifier-resolution=node\n\nimport { ConnectionProfile } from '@rockcarver/frodo-lib';\nimport { Command } from 'commander';\n\n// commands\nimport admin from './cli/admin/admin';\nimport agent from './cli/agent/agent';\nimport app from './cli/app/app';\nimport conn from './cli/conn/conn';\nimport email from './cli/email/email';\nimport esv from './cli/esv/esv';\nimport idm from './cli/idm/idm';\nimport idp from './cli/idp/idp';\nimport info from './cli/info/info';\nimport journey from './cli/journey/journey';\nimport logging from './cli/logging/logs';\nimport realm from './cli/realm/realm';\nimport saml from './cli/saml/saml';\nimport script from './cli/script/script';\nimport theme from './cli/theme/theme';\nimport { printMessage } from './utils/Console';\nimport { getVersions } from './utils/Version';\n\nconst { initConnectionProfiles } = ConnectionProfile;\n\n(async () => {\n try {\n const program = new Command('frodo').version(\n await getVersions(false),\n '-v, --version'\n );\n\n printMessage(await getVersions(true), 'text', false);\n\n initConnectionProfiles();\n\n program.addCommand(admin());\n program.addCommand(agent());\n program.addCommand(app());\n program.addCommand(conn());\n program.addCommand(email());\n program.addCommand(esv());\n program.addCommand(idm());\n program.addCommand(idp());\n program.addCommand(info());\n program.addCommand(journey());\n program.addCommand(logging());\n program.addCommand(realm());\n program.addCommand(saml());\n program.addCommand(script());\n program.addCommand(theme());\n\n program.showHelpAfterError();\n program.enablePositionalOptions();\n program.parse();\n } catch (e) {\n printMessage(`ERROR: exception running frodo - ${e}`, 'error');\n }\n})();\n"],"mappings":"AAAA;AAEA,SAASA,iBAAT,QAAkC,uBAAlC;AACA,SAASC,OAAT,QAAwB,WAAxB,C,CAEA;;AACA,OAAOC,KAAP,MAAkB,mBAAlB;AACA,OAAOC,KAAP,MAAkB,mBAAlB;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CAACE,UAAR,CAAmBX,OAAO,EAA1B;IACAS,OAAO,CAACE,UAAR,CAAmBV,OAAO,EAA1B;IACAQ,OAAO,CAACE,UAAR,CAAmBT,KAAK,EAAxB;IACAO,OAAO,CAACE,UAAR,CAAmBR,IAAI,EAAvB;IACAM,OAAO,CAACE,UAAR,CAAmBP,MAAM,EAAzB;IACAK,OAAO,CAACE,UAAR,CAAmBN,KAAK,EAAxB;IAEAI,OAAO,CAACG,kBAAR;IACAH,OAAO,CAACI,uBAAR;IACAJ,OAAO,CAACK,KAAR;EACD,CA7BD,CA6BE,OAAOC,CAAP,EAAU;IACVT,YAAY,CAAE,oCAAmCS,CAAE,EAAvC,EAA0C,OAA1C,CAAZ;EACD;AACF,CAjCD"}
1
+ {"version":3,"file":"app.js","names":["ConnectionProfile","Command","admin","agent","app","conn","email","esv","idm","idp","info","journey","logging","realm","saml","script","service","theme","printMessage","getVersions","initConnectionProfiles","program","version","addCommand","showHelpAfterError","enablePositionalOptions","parse","e"],"sources":["app.ts"],"sourcesContent":["#!/usr/bin/env -S node --no-warnings --enable-source-maps --experimental-specifier-resolution=node\n\nimport { ConnectionProfile } from '@rockcarver/frodo-lib';\nimport { Command } from 'commander';\n\n// commands\nimport admin from './cli/admin/admin';\nimport agent from './cli/agent/agent';\nimport app from './cli/app/app';\nimport conn from './cli/conn/conn';\nimport email from './cli/email/email';\nimport esv from './cli/esv/esv';\nimport idm from './cli/idm/idm';\nimport idp from './cli/idp/idp';\nimport info from './cli/info/info';\nimport journey from './cli/journey/journey';\nimport logging from './cli/logging/logs';\nimport realm from './cli/realm/realm';\nimport saml from './cli/saml/saml';\nimport script from './cli/script/script';\nimport service from './cli/service/service';\nimport theme from './cli/theme/theme';\nimport { printMessage } from './utils/Console';\nimport { getVersions } from './utils/Version';\n\nconst { initConnectionProfiles } = ConnectionProfile;\n\n(async () => {\n try {\n const program = new Command('frodo').version(\n await getVersions(false),\n '-v, --version'\n );\n\n printMessage(await getVersions(true), 'text', false);\n\n initConnectionProfiles();\n\n program.addCommand(admin());\n program.addCommand(agent());\n program.addCommand(app());\n program.addCommand(conn());\n program.addCommand(email());\n program.addCommand(esv());\n program.addCommand(idm());\n program.addCommand(idp());\n program.addCommand(info());\n program.addCommand(journey());\n program.addCommand(logging());\n program.addCommand(realm());\n program.addCommand(saml());\n program.addCommand(script());\n program.addCommand(service());\n program.addCommand(theme());\n\n program.showHelpAfterError();\n program.enablePositionalOptions();\n program.parse();\n } catch (e) {\n printMessage(`ERROR: exception running frodo - ${e}`, 'error');\n }\n})();\n"],"mappings":"AAAA;AAEA,SAASA,iBAAT,QAAkC,uBAAlC;AACA,SAASC,OAAT,QAAwB,WAAxB,C,CAEA;;AACA,OAAOC,KAAP,MAAkB,mBAAlB;AACA,OAAOC,KAAP,MAAkB,mBAAlB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,KAAP,MAAkB,mBAAlB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,OAAP,MAAoB,uBAApB;AACA,OAAOC,OAAP,MAAoB,oBAApB;AACA,OAAOC,KAAP,MAAkB,mBAAlB;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,OAAOC,OAAP,MAAoB,uBAApB;AACA,OAAOC,KAAP,MAAkB,mBAAlB;AACA,SAASC,YAAT,QAA6B,iBAA7B;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA,MAAM;EAAEC;AAAF,IAA6BpB,iBAAnC;;AAEA,CAAC,YAAY;EACX,IAAI;IACF,MAAMqB,OAAO,GAAG,IAAIpB,OAAJ,CAAY,OAAZ,EAAqBqB,OAArB,CACd,MAAMH,WAAW,CAAC,KAAD,CADH,EAEd,eAFc,CAAhB;IAKAD,YAAY,CAAC,MAAMC,WAAW,CAAC,IAAD,CAAlB,EAA0B,MAA1B,EAAkC,KAAlC,CAAZ;IAEAC,sBAAsB;IAEtBC,OAAO,CAACE,UAAR,CAAmBrB,KAAK,EAAxB;IACAmB,OAAO,CAACE,UAAR,CAAmBpB,KAAK,EAAxB;IACAkB,OAAO,CAACE,UAAR,CAAmBnB,GAAG,EAAtB;IACAiB,OAAO,CAACE,UAAR,CAAmBlB,IAAI,EAAvB;IACAgB,OAAO,CAACE,UAAR,CAAmBjB,KAAK,EAAxB;IACAe,OAAO,CAACE,UAAR,CAAmBhB,GAAG,EAAtB;IACAc,OAAO,CAACE,UAAR,CAAmBf,GAAG,EAAtB;IACAa,OAAO,CAACE,UAAR,CAAmBd,GAAG,EAAtB;IACAY,OAAO,CAACE,UAAR,CAAmBb,IAAI,EAAvB;IACAW,OAAO,CAACE,UAAR,CAAmBZ,OAAO,EAA1B;IACAU,OAAO,CAACE,UAAR,CAAmBX,OAAO,EAA1B;IACAS,OAAO,CAACE,UAAR,CAAmBV,KAAK,EAAxB;IACAQ,OAAO,CAACE,UAAR,CAAmBT,IAAI,EAAvB;IACAO,OAAO,CAACE,UAAR,CAAmBR,MAAM,EAAzB;IACAM,OAAO,CAACE,UAAR,CAAmBP,OAAO,EAA1B;IACAK,OAAO,CAACE,UAAR,CAAmBN,KAAK,EAAxB;IAEAI,OAAO,CAACG,kBAAR;IACAH,OAAO,CAACI,uBAAR;IACAJ,OAAO,CAACK,KAAR;EACD,CA9BD,CA8BE,OAAOC,CAAP,EAAU;IACVT,YAAY,CAAE,oCAAmCS,CAAE,EAAvC,EAA0C,OAA1C,CAAZ;EACD;AACF,CAlCD"}
@@ -7,7 +7,7 @@ const {
7
7
  getTokens
8
8
  } = Authenticate;
9
9
  const program = new Command('frodo cmd export');
10
- program.description('Cmd export.').helpOption('-h, --help', 'Help').showHelpAfterError().addArgument(common.hostArgumentM).addArgument(common.realmArgument).addArgument(common.userArgument).addArgument(common.passwordArgument).addOption(common.deploymentOption).addOption(common.insecureOption).addOption(common.verboseOption).addOption(common.debugOption).addOption(common.curlirizeOption).addOption(new Option('-i, --agent-id <agent-id>', 'Cmd 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 cmds to a single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Export all cmds to separate files (*.cmd.json) in the current directory. Ignored with -i or -a.')).action( // implement command logic inside action handler
10
+ program.description('Agent export.').helpOption('-h, --help', 'Help').showHelpAfterError().addArgument(common.hostArgumentM).addArgument(common.realmArgument).addArgument(common.userArgument).addArgument(common.passwordArgument).addOption(common.deploymentOption).addOption(common.insecureOption).addOption(common.verboseOption).addOption(common.debugOption).addOption(common.curlirizeOption).addOption(new Option('-i, --agent-id <agent-id>', 'Agent 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 agents to a single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Export all agents to separate files (*.<type>.agent.json) in the current directory. Ignored with -i or -a.')).action( // implement command logic inside action handler
11
11
  async (host, realm, user, password, options) => {
12
12
  state.default.session.setTenant(host);
13
13
  state.default.session.setRealm(realm);
@@ -1 +1 @@
1
- {"version":3,"file":"agent-export.js","names":["Command","Option","Authenticate","state","common","verboseMessage","exportAgentsToFile","exportAgentsToFiles","exportAgentToFile","getTokens","program","description","helpOption","showHelpAfterError","addArgument","hostArgumentM","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","verboseOption","debugOption","curlirizeOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","setVerbose","verbose","setDebug","debug","setCurlirize","curlirize","agentId","file","all","allSeparate","help","parse"],"sources":["cli/agent/agent-export.ts"],"sourcesContent":["import { Command, Option } from 'commander';\nimport { Authenticate, state } from '@rockcarver/frodo-lib';\nimport * as common from '../cmd_common.js';\nimport { verboseMessage } from '../../utils/Console.js';\nimport {\n exportAgentsToFile,\n exportAgentsToFiles,\n exportAgentToFile,\n} from '../../ops/AgentOps.js';\n\nconst { getTokens } = Authenticate;\n\nconst program = new Command('frodo cmd export');\n\nprogram\n .description('Cmd export.')\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgumentM)\n .addArgument(common.realmArgument)\n .addArgument(common.userArgument)\n .addArgument(common.passwordArgument)\n .addOption(common.deploymentOption)\n .addOption(common.insecureOption)\n .addOption(common.verboseOption)\n .addOption(common.debugOption)\n .addOption(common.curlirizeOption)\n .addOption(\n new Option(\n '-i, --agent-id <agent-id>',\n 'Cmd 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 cmds to a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all cmds to 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) => {\n state.default.session.setTenant(host);\n state.default.session.setRealm(realm);\n state.default.session.setUsername(user);\n state.default.session.setPassword(password);\n state.default.session.setDeploymentType(options.type);\n state.default.session.setAllowInsecureConnection(options.insecure);\n state.default.session.setVerbose(options.verbose);\n state.default.session.setDebug(options.debug);\n state.default.session.setCurlirize(options.curlirize);\n if (await getTokens()) {\n // export\n if (options.agentId) {\n verboseMessage('Exporting agent...');\n await exportAgentToFile(options.agentId, options.file);\n }\n // --all -a\n else if (options.all) {\n verboseMessage('Exporting all agents to a single file...');\n await exportAgentsToFile(options.file);\n }\n // --all-separate -A\n else if (options.allSeparate) {\n verboseMessage('Exporting all agents to separate files...');\n await exportAgentsToFiles();\n }\n // unrecognized combination of options or no options\n else {\n verboseMessage(\n 'Unrecognized combination of options or no options...'\n );\n program.help();\n }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":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F,CApEL,CAqEI;AArEJ;AAwEAzC,OAAO,CAAC0C,KAAR"}
1
+ {"version":3,"file":"agent-export.js","names":["Command","Option","Authenticate","state","common","verboseMessage","exportAgentsToFile","exportAgentsToFiles","exportAgentToFile","getTokens","program","description","helpOption","showHelpAfterError","addArgument","hostArgumentM","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","verboseOption","debugOption","curlirizeOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","setVerbose","verbose","setDebug","debug","setCurlirize","curlirize","agentId","file","all","allSeparate","help","parse"],"sources":["cli/agent/agent-export.ts"],"sourcesContent":["import { Command, Option } from 'commander';\nimport { Authenticate, state } from '@rockcarver/frodo-lib';\nimport * as common from '../cmd_common.js';\nimport { verboseMessage } from '../../utils/Console.js';\nimport {\n exportAgentsToFile,\n exportAgentsToFiles,\n exportAgentToFile,\n} from '../../ops/AgentOps.js';\n\nconst { getTokens } = Authenticate;\n\nconst program = new Command('frodo cmd export');\n\nprogram\n .description('Agent export.')\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgumentM)\n .addArgument(common.realmArgument)\n .addArgument(common.userArgument)\n .addArgument(common.passwordArgument)\n .addOption(common.deploymentOption)\n .addOption(common.insecureOption)\n .addOption(common.verboseOption)\n .addOption(common.debugOption)\n .addOption(common.curlirizeOption)\n .addOption(\n new Option(\n '-i, --agent-id <agent-id>',\n 'Agent 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 agents to a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all agents to separate files (*.<type>.agent.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) => {\n state.default.session.setTenant(host);\n state.default.session.setRealm(realm);\n state.default.session.setUsername(user);\n state.default.session.setPassword(password);\n state.default.session.setDeploymentType(options.type);\n state.default.session.setAllowInsecureConnection(options.insecure);\n state.default.session.setVerbose(options.verbose);\n state.default.session.setDebug(options.debug);\n state.default.session.setCurlirize(options.curlirize);\n if (await getTokens()) {\n // export\n if (options.agentId) {\n verboseMessage('Exporting agent...');\n await exportAgentToFile(options.agentId, options.file);\n }\n // --all -a\n else if (options.all) {\n verboseMessage('Exporting all agents to a single file...');\n await exportAgentsToFile(options.file);\n }\n // --all-separate -A\n else if (options.allSeparate) {\n verboseMessage('Exporting all agents to separate files...');\n await exportAgentsToFiles();\n }\n // unrecognized combination of options or no options\n else {\n verboseMessage(\n 'Unrecognized combination of options or no options...'\n );\n program.help();\n }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SAASC,YAAT,EAAuBC,KAAvB,QAAoC,uBAApC;AACA,OAAO,KAAKC,MAAZ,MAAwB,kBAAxB;AACA,SAASC,cAAT,QAA+B,wBAA/B;AACA,SACEC,kBADF,EAEEC,mBAFF,EAGEC,iBAHF,QAIO,uBAJP;AAMA,MAAM;EAAEC;AAAF,IAAgBP,YAAtB;AAEA,MAAMQ,OAAO,GAAG,IAAIV,OAAJ,CAAY,kBAAZ,CAAhB;AAEAU,OAAO,CACJC,WADH,CACe,eADf,EAEGC,UAFH,CAEc,YAFd,EAE4B,MAF5B,EAGGC,kBAHH,GAIGC,WAJH,CAIeV,MAAM,CAACW,aAJtB,EAKGD,WALH,CAKeV,MAAM,CAACY,aALtB,EAMGF,WANH,CAMeV,MAAM,CAACa,YANtB,EAOGH,WAPH,CAOeV,MAAM,CAACc,gBAPtB,EAQGC,SARH,CAQaf,MAAM,CAACgB,gBARpB,EASGD,SATH,CASaf,MAAM,CAACiB,cATpB,EAUGF,SAVH,CAUaf,MAAM,CAACkB,aAVpB,EAWGH,SAXH,CAWaf,MAAM,CAACmB,WAXpB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AAqB;MACnB1C,cAAc,CAAC,oBAAD,CAAd;MACA,MAAMG,iBAAiB,CAACsB,OAAO,CAACiB,OAAT,EAAkBjB,OAAO,CAACkB,IAA1B,CAAvB;IACD,CAHD,CAIA;IAJA,KAKK,IAAIlB,OAAO,CAACmB,GAAZ,EAAiB;MACpB5C,cAAc,CAAC,0CAAD,CAAd;MACA,MAAMC,kBAAkB,CAACwB,OAAO,CAACkB,IAAT,CAAxB;IACD,CAHI,CAIL;IAJK,KAKA,IAAIlB,OAAO,CAACoB,WAAZ,EAAyB;MAC5B7C,cAAc,CAAC,2CAAD,CAAd;MACA,MAAME,mBAAmB,EAAzB;IACD,CAHI,CAIL;IAJK,KAKA;MACHF,cAAc,CACZ,sDADY,CAAd;MAGAK,OAAO,CAACyC,IAAR;IACD;EACF;AACF,CApEL,CAqEI;AArEJ;AAwEAzC,OAAO,CAAC0C,KAAR"}
@@ -1,7 +1,7 @@
1
1
  import { Command, Option } from 'commander';
2
2
  import { Authenticate, Idm, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
- import { printMessage } from '../../utils/Console.js';
3
+ import * as common from '../cmd_common';
4
+ import { printMessage } from '../../utils/Console';
5
5
  const {
6
6
  getTokens
7
7
  } = Authenticate;
@@ -1 +1 @@
1
- {"version":3,"file":"idm-export.js","names":["Command","Option","Authenticate","Idm","state","common","printMessage","getTokens","exportAllConfigEntities","exportAllRawConfigEntities","exportConfigEntity","program","description","helpOption","showHelpAfterError","addArgument","hostArgumentM","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","name","getRealm","file","allSeparate","directory","entitiesFile","envFile","help","parse"],"sources":["cli/idm/idm-export.ts"],"sourcesContent":["import { Command, Option } from 'commander';\nimport { Authenticate, Idm, state } from '@rockcarver/frodo-lib';\nimport * as common from '../cmd_common.js';\nimport { printMessage } from '../../utils/Console.js';\n\nconst { getTokens } = Authenticate;\nconst {\n exportAllConfigEntities,\n exportAllRawConfigEntities,\n exportConfigEntity,\n} = Idm;\n\nconst program = new Command('frodo idm export');\n\nprogram\n .description('Export IDM configuration objects.')\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgumentM)\n .addArgument(common.realmArgument)\n .addArgument(common.userArgument)\n .addArgument(common.passwordArgument)\n .addOption(common.deploymentOption)\n .addOption(common.insecureOption)\n .addOption(\n new Option(\n '-N, --name <name>',\n 'Config entity name. E.g. \"managed\", \"sync\", \"provisioner-<connector-name>\", etc.'\n )\n )\n .addOption(new Option('-f, --file [file]', 'Export file. Ignored with -A.'))\n .addOption(\n new Option(\n '-E, --entities-file [entities-file]',\n 'Name of the entity file. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-e, --env-file [envfile]',\n 'Name of the env file. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Export all IDM configuration objects into a single file in directory -D. Ignored with -N.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all IDM configuration objects into separate JSON files in directory -D. Ignored with -N, and -a.'\n )\n )\n .addOption(\n new Option(\n '-D, --directory <directory>',\n 'Export directory. Required with and ignored without -a/-A.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options) => {\n state.default.session.setTenant(host);\n state.default.session.setRealm(realm);\n state.default.session.setUsername(user);\n state.default.session.setPassword(password);\n state.default.session.setDeploymentType(options.type);\n state.default.session.setAllowInsecureConnection(options.insecure);\n if (await getTokens()) {\n // export by id/name\n if (options.name) {\n printMessage(\n `Exporting object \"${\n options.name\n }\" from realm \"${state.default.session.getRealm()}\"...`\n );\n exportConfigEntity(options.name, options.file);\n }\n // --all-separate -A\n else if (\n options.allSeparate &&\n options.directory &&\n options.entitiesFile &&\n options.envFile\n ) {\n printMessage(\n `Exporting IDM configuration objects specified in ${options.entitiesFile} into separate files in ${options.directory} using ${options.envFile} for variable replacement...`\n );\n exportAllConfigEntities(\n options.directory,\n options.entitiesFile,\n options.envFile\n );\n }\n // --all-separate -A without variable replacement\n else if (options.allSeparate && options.directory) {\n printMessage(\n `Exporting all IDM configuration objects into separate files in ${options.directory}...`\n );\n exportAllRawConfigEntities(options.directory);\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 }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SAASC,YAAT,EAAuBC,GAAvB,EAA4BC,KAA5B,QAAyC,uBAAzC;AACA,OAAO,KAAKC,MAAZ,MAAwB,kBAAxB;AACA,SAASC,YAAT,QAA6B,wBAA7B;AAEA,MAAM;EAAEC;AAAF,IAAgBL,YAAtB;AACA,MAAM;EACJM,uBADI;EAEJC,0BAFI;EAGJC;AAHI,IAIFP,GAJJ;AAMA,MAAMQ,OAAO,GAAG,IAAIX,OAAJ,CAAY,kBAAZ,CAAhB;AAEAW,OAAO,CACJC,WADH,CACe,mCADf,EAEGC,UAFH,CAEc,YAFd,EAE4B,MAF5B,EAGGC,kBAHH,GAIGC,WAJH,CAIeV,MAAM,CAACW,aAJtB,EAKGD,WALH,CAKeV,MAAM,CAACY,aALtB,EAMGF,WANH,CAMeV,MAAM,CAACa,YANtB,EAOGH,WAPH,CAOeV,MAAM,CAACc,gBAPtB,EAQGC,SARH,CAQaf,MAAM,CAACgB,gBARpB,EASGD,SATH,CASaf,MAAM,CAACiB,cATpB,EAUGF,SAVH,CAWI,IAAInB,MAAJ,CACE,mBADF,EAEE,kFAFF,CAXJ,EAgBGmB,SAhBH,CAgBa,IAAInB,MAAJ,CAAW,mBAAX,EAAgC,+BAAhC,CAhBb,EAiBGmB,SAjBH,CAkBI,IAAInB,MAAJ,CACE,qCADF,EAEE,2CAFF,CAlBJ,EAuBGmB,SAvBH,CAwBI,IAAInB,MAAJ,CAC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AY,CACT,oDAAmDsB,OAAO,CAACgB,YAAa,2BAA0BhB,OAAO,CAACe,SAAU,UAASf,OAAO,CAACiB,OAAQ,8BADpI,CAAZ;MAGArC,uBAAuB,CACrBoB,OAAO,CAACe,SADa,EAErBf,OAAO,CAACgB,YAFa,EAGrBhB,OAAO,CAACiB,OAHa,CAAvB;IAKD,CAdI,CAeL;IAfK,KAgBA,IAAIjB,OAAO,CAACc,WAAR,IAAuBd,OAAO,CAACe,SAAnC,EAA8C;MACjDrC,YAAY,CACT,kEAAiEsB,OAAO,CAACe,SAAU,KAD1E,CAAZ;MAGAlC,0BAA0B,CAACmB,OAAO,CAACe,SAAT,CAA1B;IACD,CALI,CAML;IANK,KAOA;MACHrC,YAAY,CACV,sDADU,EAEV,OAFU,CAAZ;MAIAK,OAAO,CAACmC,IAAR;IACD;EACF;AACF,CAlGL,CAmGI;AAnGJ;AAsGAnC,OAAO,CAACoC,KAAR"}
1
+ {"version":3,"file":"idm-export.js","names":["Command","Option","Authenticate","Idm","state","common","printMessage","getTokens","exportAllConfigEntities","exportAllRawConfigEntities","exportConfigEntity","program","description","helpOption","showHelpAfterError","addArgument","hostArgumentM","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","name","getRealm","file","allSeparate","directory","entitiesFile","envFile","help","parse"],"sources":["cli/idm/idm-export.ts"],"sourcesContent":["import { Command, Option } from 'commander';\nimport { Authenticate, Idm, state } from '@rockcarver/frodo-lib';\nimport * as common from '../cmd_common';\nimport { printMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\nconst {\n exportAllConfigEntities,\n exportAllRawConfigEntities,\n exportConfigEntity,\n} = Idm;\n\nconst program = new Command('frodo idm export');\n\nprogram\n .description('Export IDM configuration objects.')\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgumentM)\n .addArgument(common.realmArgument)\n .addArgument(common.userArgument)\n .addArgument(common.passwordArgument)\n .addOption(common.deploymentOption)\n .addOption(common.insecureOption)\n .addOption(\n new Option(\n '-N, --name <name>',\n 'Config entity name. E.g. \"managed\", \"sync\", \"provisioner-<connector-name>\", etc.'\n )\n )\n .addOption(new Option('-f, --file [file]', 'Export file. Ignored with -A.'))\n .addOption(\n new Option(\n '-E, --entities-file [entities-file]',\n 'Name of the entity file. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-e, --env-file [envfile]',\n 'Name of the env file. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Export all IDM configuration objects into a single file in directory -D. Ignored with -N.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all IDM configuration objects into separate JSON files in directory -D. Ignored with -N, and -a.'\n )\n )\n .addOption(\n new Option(\n '-D, --directory <directory>',\n 'Export directory. Required with and ignored without -a/-A.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options) => {\n state.default.session.setTenant(host);\n state.default.session.setRealm(realm);\n state.default.session.setUsername(user);\n state.default.session.setPassword(password);\n state.default.session.setDeploymentType(options.type);\n state.default.session.setAllowInsecureConnection(options.insecure);\n if (await getTokens()) {\n // export by id/name\n if (options.name) {\n printMessage(\n `Exporting object \"${\n options.name\n }\" from realm \"${state.default.session.getRealm()}\"...`\n );\n exportConfigEntity(options.name, options.file);\n }\n // --all-separate -A\n else if (\n options.allSeparate &&\n options.directory &&\n options.entitiesFile &&\n options.envFile\n ) {\n printMessage(\n `Exporting IDM configuration objects specified in ${options.entitiesFile} into separate files in ${options.directory} using ${options.envFile} for variable replacement...`\n );\n exportAllConfigEntities(\n options.directory,\n options.entitiesFile,\n options.envFile\n );\n }\n // --all-separate -A without variable replacement\n else if (options.allSeparate && options.directory) {\n printMessage(\n `Exporting all IDM configuration objects into separate files in ${options.directory}...`\n );\n exportAllRawConfigEntities(options.directory);\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 }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SAASC,YAAT,EAAuBC,GAAvB,EAA4BC,KAA5B,QAAyC,uBAAzC;AACA,OAAO,KAAKC,MAAZ,MAAwB,eAAxB;AACA,SAASC,YAAT,QAA6B,qBAA7B;AAEA,MAAM;EAAEC;AAAF,IAAgBL,YAAtB;AACA,MAAM;EACJM,uBADI;EAEJC,0BAFI;EAGJC;AAHI,IAIFP,GAJJ;AAMA,MAAMQ,OAAO,GAAG,IAAIX,OAAJ,CAAY,kBAAZ,CAAhB;AAEAW,OAAO,CACJC,WADH,CACe,mCADf,EAEGC,UAFH,CAEc,YAFd,EAE4B,MAF5B,EAGGC,kBAHH,GAIGC,WAJH,CAIeV,MAAM,CAACW,aAJtB,EAKGD,WALH,CAKeV,MAAM,CAACY,aALtB,EAMGF,WANH,CAMeV,MAAM,CAACa,YANtB,EAOGH,WAPH,CAOeV,MAAM,CAACc,gBAPtB,EAQGC,SARH,CAQaf,MAAM,CAACgB,gBARpB,EASGD,SATH,CASaf,MAAM,CAACiB,cATpB,EAUGF,SAVH,CAWI,IAAInB,MAAJ,CACE,mBADF,EAEE,kFAFF,CAXJ,EAgBGmB,SAhBH,CAgBa,IAAInB,MAAJ,CAAW,mBAAX,EAAgC,+BAAhC,CAhBb,EAiBGmB,SAjBH,CAkBI,IAAInB,MAAJ,CACE,qCADF,EAEE,2CAFF,CAlBJ,EAuBGmB,SAvBH,CAwBI,IAAInB,MAAJ,CACE,0BADF,EAEE,wCAFF,CAxBJ,EA6BGmB,SA7BH,CA8BI,IAAInB,MAAJ,CACE,WADF,EAEE,2FAFF,CA9BJ,EAmCGmB,SAnCH,CAoCI,IAAInB,MAAJ,CACE,oBADF,EAEE,yGAFF,CApCJ,EAyCGmB,SAzCH,CA0CI,IAAInB,MAAJ,CACE,6BADF,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AdI,CAeL;IAfK,KAgBA,IAAIjB,OAAO,CAACc,WAAR,IAAuBd,OAAO,CAACe,SAAnC,EAA8C;MACjDrC,YAAY,CACT,kEAAiEsB,OAAO,CAACe,SAAU,KAD1E,CAAZ;MAGAlC,0BAA0B,CAACmB,OAAO,CAACe,SAAT,CAA1B;IACD,CALI,CAML;IANK,KAOA;MACHrC,YAAY,CACV,sDADU,EAEV,OAFU,CAAZ;MAIAK,OAAO,CAACmC,IAAR;IACD;EACF;AACF,CAlGL,CAmGI;AAnGJ;AAsGAnC,OAAO,CAACoC,KAAR"}
@@ -0,0 +1,45 @@
1
+ import { Command, Option } from 'commander';
2
+ import { Authenticate, Idm, state } from '@rockcarver/frodo-lib';
3
+ import * as common from '../cmd_common';
4
+ import { printMessage } from '../../utils/Console';
5
+ const {
6
+ getTokens
7
+ } = Authenticate;
8
+ const {
9
+ importAllConfigEntities,
10
+ importAllRawConfigEntities,
11
+ importConfigEntity
12
+ } = Idm;
13
+ const program = new Command('frodo idm import');
14
+ program.description('Import IDM configuration objects.').helpOption('-h, --help', 'Help').showHelpAfterError().addArgument(common.hostArgumentM).addArgument(common.realmArgument).addArgument(common.userArgument).addArgument(common.passwordArgument).addOption(common.deploymentOption).addOption(common.insecureOption).addOption(new Option('-N, --name <name>', 'Config entity name. E.g. "managed", "sync", "provisioner-<connector-name>", etc.')).addOption(new Option('-f, --file [file]', 'Import file. Ignored with -A.')).addOption(new Option('-E, --entities-file [entities-file]', 'Name of the entity file. Ignored with -A.')).addOption(new Option('-e, --env-file [envfile]', 'Name of the env file. Ignored with -A.')).addOption(new Option('-A, --all-separate', 'Import all IDM configuration objects into separate JSON files in directory -D. Ignored with -N, and -a.')).addOption(new Option('-D, --directory <directory>', 'Import directory. Required with and ignored without -a/-A.')).action( // implement command logic inside action handler
15
+ async (host, realm, user, password, options) => {
16
+ state.default.session.setTenant(host);
17
+ state.default.session.setRealm(realm);
18
+ state.default.session.setUsername(user);
19
+ state.default.session.setPassword(password);
20
+ state.default.session.setDeploymentType(options.type);
21
+ state.default.session.setAllowInsecureConnection(options.insecure);
22
+
23
+ if (await getTokens()) {
24
+ // import by id/name
25
+ if (options.name) {
26
+ printMessage(`Importing object "${options.name}" to realm "${state.default.session.getRealm()}"...`);
27
+ await importConfigEntity(options.name, options.file);
28
+ } // --all-separate -A
29
+ else if (options.allSeparate && options.directory && options.entitiesFile && options.envFile) {
30
+ printMessage(`Importing IDM configuration objects specified in ${options.entitiesFile} into separate files in ${options.directory} using ${options.envFile} for variable replacement...`);
31
+ await importAllConfigEntities(options.directory, options.entitiesFile, options.envFile);
32
+ } // --all-separate -A without variable replacement
33
+ else if (options.allSeparate && options.directory) {
34
+ printMessage(`Importing all IDM configuration objects into separate files in ${options.directory}...`);
35
+ await importAllRawConfigEntities(options.directory);
36
+ } // unrecognized combination of options or no options
37
+ else {
38
+ printMessage('Unrecognized combination of options or no options...', 'error');
39
+ program.help();
40
+ }
41
+ }
42
+ } // end command logic inside action handler
43
+ );
44
+ program.parse();
45
+ //# sourceMappingURL=idm-import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idm-import.js","names":["Command","Option","Authenticate","Idm","state","common","printMessage","getTokens","importAllConfigEntities","importAllRawConfigEntities","importConfigEntity","program","description","helpOption","showHelpAfterError","addArgument","hostArgumentM","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","name","getRealm","file","allSeparate","directory","entitiesFile","envFile","help","parse"],"sources":["cli/idm/idm-import.ts"],"sourcesContent":["import { Command, Option } from 'commander';\nimport { Authenticate, Idm, state } from '@rockcarver/frodo-lib';\nimport * as common from '../cmd_common';\nimport { printMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\nconst {\n importAllConfigEntities,\n importAllRawConfigEntities,\n importConfigEntity,\n} = Idm;\n\nconst program = new Command('frodo idm import');\n\ninterface IdmImportOptions {\n type?: string;\n insecure?: string;\n name?: string;\n file?: string;\n entitiesFile?: string;\n envFile?: string;\n all?: string;\n allSeparate?: string;\n directory?: string;\n}\n\nprogram\n .description('Import IDM configuration objects.')\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgumentM)\n .addArgument(common.realmArgument)\n .addArgument(common.userArgument)\n .addArgument(common.passwordArgument)\n .addOption(common.deploymentOption)\n .addOption(common.insecureOption)\n .addOption(\n new Option(\n '-N, --name <name>',\n 'Config entity name. E.g. \"managed\", \"sync\", \"provisioner-<connector-name>\", etc.'\n )\n )\n .addOption(new Option('-f, --file [file]', 'Import file. Ignored with -A.'))\n .addOption(\n new Option(\n '-E, --entities-file [entities-file]',\n 'Name of the entity file. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-e, --env-file [envfile]',\n 'Name of the env file. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all IDM configuration objects into separate JSON files in directory -D. Ignored with -N, and -a.'\n )\n )\n .addOption(\n new Option(\n '-D, --directory <directory>',\n 'Import directory. Required with and ignored without -a/-A.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: IdmImportOptions\n ) => {\n state.default.session.setTenant(host);\n state.default.session.setRealm(realm);\n state.default.session.setUsername(user);\n state.default.session.setPassword(password);\n state.default.session.setDeploymentType(options.type);\n state.default.session.setAllowInsecureConnection(options.insecure);\n if (await getTokens()) {\n // import by id/name\n if (options.name) {\n printMessage(\n `Importing object \"${\n options.name\n }\" to realm \"${state.default.session.getRealm()}\"...`\n );\n await importConfigEntity(options.name, options.file);\n }\n // --all-separate -A\n else if (\n options.allSeparate &&\n options.directory &&\n options.entitiesFile &&\n options.envFile\n ) {\n printMessage(\n `Importing IDM configuration objects specified in ${options.entitiesFile} into separate files in ${options.directory} using ${options.envFile} for variable replacement...`\n );\n await importAllConfigEntities(\n options.directory,\n options.entitiesFile,\n options.envFile\n );\n }\n // --all-separate -A without variable replacement\n else if (options.allSeparate && options.directory) {\n printMessage(\n `Importing all IDM configuration objects into separate files in ${options.directory}...`\n );\n await importAllRawConfigEntities(options.directory);\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 }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SAASC,YAAT,EAAuBC,GAAvB,EAA4BC,KAA5B,QAAyC,uBAAzC;AACA,OAAO,KAAKC,MAAZ,MAAwB,eAAxB;AACA,SAASC,YAAT,QAA6B,qBAA7B;AAEA,MAAM;EAAEC;AAAF,IAAgBL,YAAtB;AACA,MAAM;EACJM,uBADI;EAEJC,0BAFI;EAGJC;AAHI,IAIFP,GAJJ;AAMA,MAAMQ,OAAO,GAAG,IAAIX,OAAJ,CAAY,kBAAZ,CAAhB;AAcAW,OAAO,CACJC,WADH,CACe,mCADf,EAEGC,UAFH,CAEc,YAFd,EAE4B,MAF5B,EAGGC,kBAHH,GAIGC,WAJH,CAIeV,MAAM,CAACW,aAJtB,EAKGD,WALH,CAKeV,MAAM,CAACY,aALtB,EAMGF,WANH,CAMeV,MAAM,CAACa,YANtB,EAOGH,WAPH,CAOeV,MAAM,CAACc,gBAPtB,EAQGC,SARH,CAQaf,MAAM,CAACgB,gBARpB,EASGD,SATH,CASaf,MAAM,CAACiB,cATpB,EAUGF,SAVH,CAWI,IAAInB,MAAJ,CACE,mBADF,EAEE,kFAFF,CAXJ,EAgBGmB,SAhBH,CAgBa,IAAInB,MAAJ,CAAW,mBAAX,EAAgC,+BAAhC,CAhBb,EAiBGmB,SAjBH,CAkBI,IAAInB,MAAJ,CACE,qCADF,EAEE,2CAFF,CAlBJ,EAuBGmB,SAvBH,CAwBI,IAAInB,MAAJ,CACE,0BADF,EAEE,wCAFF,CAxBJ,EA6BGmB,SA7BH,CA8BI,IAAInB,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,OAAO,CAACe,SADmB,EAE3Bf,OAAO,CAACgB,YAFmB,EAG3BhB,OAAO,CAACiB,OAHmB,CAA7B;IAKD,CAdI,CAeL;IAfK,KAgBA,IAAIjB,OAAO,CAACc,WAAR,IAAuBd,OAAO,CAACe,SAAnC,EAA8C;MACjDrC,YAAY,CACT,kEAAiEsB,OAAO,CAACe,SAAU,KAD1E,CAAZ;MAGA,MAAMlC,0BAA0B,CAACmB,OAAO,CAACe,SAAT,CAAhC;IACD,CALI,CAML;IANK,KAOA;MACHrC,YAAY,CACV,sDADU,EAEV,OAFU,CAAZ;MAIAK,OAAO,CAACmC,IAAR;IACD;EACF;AACF,CAlGL,CAmGI;AAnGJ;AAsGAnC,OAAO,CAACoC,KAAR"}
@@ -9,6 +9,7 @@ export default function setup() {
9
9
  program.command('list', 'List all IDM configuration objects.').showHelpAfterError(); // Do all 3 commands (raw / all / one ) or seperate?
10
10
 
11
11
  program.command('export', 'Export IDM configuration objects.').showHelpAfterError();
12
+ program.command('import', 'Import IDM configuration objects.').showHelpAfterError();
12
13
  program.command('count', 'Count number of managed objects of a given type.').showHelpAfterError();
13
14
  program.showHelpAfterError();
14
15
  return program;
@@ -1 +1 @@
1
- {"version":3,"file":"idm.js","names":["Command","path","fileURLToPath","__dirname","dirname","import","meta","url","setup","program","helpOption","description","executableDir","command","showHelpAfterError"],"sources":["cli/idm/idm.ts"],"sourcesContent":["import { Command } from 'commander';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport default function setup() {\n const program = new Command('idm')\n .helpOption('-h, --help', 'Help')\n .description('Manage IDM configuration.')\n .executableDir(__dirname);\n\n program\n .command('list', 'List all IDM configuration objects.')\n .showHelpAfterError();\n\n // Do all 3 commands (raw / all / one ) or seperate?\n program\n .command('export', 'Export IDM configuration objects.')\n .showHelpAfterError();\n\n program\n .command('count', 'Count number of managed objects of a given type.')\n .showHelpAfterError();\n\n program.showHelpAfterError();\n return program;\n}\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,WAAxB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,aAAT,QAA8B,KAA9B;;AAEA,MAAMC,SAAS,GAAGF,IAAI,CAACG,OAAL,CAAaF,aAAa,CAACG,MAAM,CAACC,IAAP,CAAYC,GAAb,CAA1B,CAAlB;;AAEA,eAAe,SAASC,KAAT,GAAiB;EAC9B,MAAMC,OAAO,GAAG,IAAIT,OAAJ,CAAY,KAAZ,EACbU,UADa,CACF,YADE,EACY,MADZ,EAEbC,WAFa,CAED,2BAFC,EAGbC,aAHa,CAGCT,SAHD,CAAhB;EAKAM,OAAO,CACJI,OADH,CACW,MADX,EACmB,qCADnB,EAEGC,kBAFH,GAN8B,CAU9B;;EACAL,OAAO,CACJI,OADH,CACW,QADX,EACqB,mCADrB,EAEGC,kBAFH;EAIAL,OAAO,CACJI,OADH,CACW,OADX,EACoB,kDADpB,EAEGC,kBAFH;EAIAL,OAAO,CAACK,kBAAR;EACA,OAAOL,OAAP;AACD"}
1
+ {"version":3,"file":"idm.js","names":["Command","path","fileURLToPath","__dirname","dirname","import","meta","url","setup","program","helpOption","description","executableDir","command","showHelpAfterError"],"sources":["cli/idm/idm.ts"],"sourcesContent":["import { Command } from 'commander';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport default function setup() {\n const program = new Command('idm')\n .helpOption('-h, --help', 'Help')\n .description('Manage IDM configuration.')\n .executableDir(__dirname);\n\n program\n .command('list', 'List all IDM configuration objects.')\n .showHelpAfterError();\n\n // Do all 3 commands (raw / all / one ) or seperate?\n program\n .command('export', 'Export IDM configuration objects.')\n .showHelpAfterError();\n\n program\n .command('import', 'Import IDM configuration objects.')\n .showHelpAfterError();\n\n program\n .command('count', 'Count number of managed objects of a given type.')\n .showHelpAfterError();\n\n program.showHelpAfterError();\n return program;\n}\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,WAAxB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,aAAT,QAA8B,KAA9B;;AAEA,MAAMC,SAAS,GAAGF,IAAI,CAACG,OAAL,CAAaF,aAAa,CAACG,MAAM,CAACC,IAAP,CAAYC,GAAb,CAA1B,CAAlB;;AAEA,eAAe,SAASC,KAAT,GAAiB;EAC9B,MAAMC,OAAO,GAAG,IAAIT,OAAJ,CAAY,KAAZ,EACbU,UADa,CACF,YADE,EACY,MADZ,EAEbC,WAFa,CAED,2BAFC,EAGbC,aAHa,CAGCT,SAHD,CAAhB;EAKAM,OAAO,CACJI,OADH,CACW,MADX,EACmB,qCADnB,EAEGC,kBAFH,GAN8B,CAU9B;;EACAL,OAAO,CACJI,OADH,CACW,QADX,EACqB,mCADrB,EAEGC,kBAFH;EAIAL,OAAO,CACJI,OADH,CACW,QADX,EACqB,mCADrB,EAEGC,kBAFH;EAIAL,OAAO,CACJI,OADH,CACW,OADX,EACoB,kDADpB,EAEGC,kBAFH;EAIAL,OAAO,CAACK,kBAAR;EACA,OAAOL,OAAP;AACD"}
@@ -0,0 +1,29 @@
1
+ import { Authenticate, state } from '@rockcarver/frodo-lib';
2
+ import { Command, Option } from 'commander';
3
+ import { deleteService, deleteServices } from '../../ops/ServiceOps.js';
4
+ import * as common from '../cmd_common.js';
5
+ const {
6
+ getTokens
7
+ } = Authenticate;
8
+ const program = new Command('frodo service delete');
9
+ program.description('Delete AM services.').helpOption('-h, --help', 'Help').showHelpAfterError().addArgument(common.hostArgumentM).addArgument(common.realmArgument).addArgument(common.userArgument).addArgument(common.passwordArgument).addOption(common.deploymentOption).addOption(common.insecureOption).addOption(common.verboseOption).addOption(common.debugOption).addOption(common.curlirizeOption).addOption(new Option('-i, --id <id>', 'Id of Service to be deleted.')).addOption(new Option('-a, --all', 'Delete all services. Ignored with -i.')).action(async (host, realm, user, password, options) => {
10
+ state.default.session.setTenant(host);
11
+ state.default.session.setRealm(realm);
12
+ state.default.session.setUsername(user);
13
+ state.default.session.setPassword(password);
14
+ state.default.session.setDeploymentType(options.type);
15
+ state.default.session.setAllowInsecureConnection(options.insecure);
16
+ state.default.session.setVerbose(options.verbose);
17
+ state.default.session.setDebug(options.debug);
18
+ state.default.session.setCurlirize(options.curlirize);
19
+
20
+ if (options.id && (await getTokens())) {
21
+ await deleteService(options.id);
22
+ } else if (options.all && (await getTokens())) {
23
+ await deleteServices();
24
+ } else {
25
+ program.help();
26
+ }
27
+ });
28
+ program.parse();
29
+ //# sourceMappingURL=service-delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-delete.js","names":["Authenticate","state","Command","Option","deleteService","deleteServices","common","getTokens","program","description","helpOption","showHelpAfterError","addArgument","hostArgumentM","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","verboseOption","debugOption","curlirizeOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","setVerbose","verbose","setDebug","debug","setCurlirize","curlirize","id","all","help","parse"],"sources":["cli/service/service-delete.ts"],"sourcesContent":["import { Authenticate, state } from '@rockcarver/frodo-lib';\nimport { Command, Option } from 'commander';\nimport { deleteService, deleteServices } from '../../ops/ServiceOps.js';\nimport * as common from '../cmd_common.js';\n\nconst { getTokens } = Authenticate;\n\nconst program = new Command('frodo service delete');\n\ninterface ServiceDeleteOptions {\n id?: string;\n type?: string;\n insecure?: boolean;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n all?: boolean;\n}\n\nprogram\n .description('Delete AM services.')\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgumentM)\n .addArgument(common.realmArgument)\n .addArgument(common.userArgument)\n .addArgument(common.passwordArgument)\n .addOption(common.deploymentOption)\n .addOption(common.insecureOption)\n .addOption(common.verboseOption)\n .addOption(common.debugOption)\n .addOption(common.curlirizeOption)\n .addOption(new Option('-i, --id <id>', 'Id of Service to be deleted.'))\n .addOption(new Option('-a, --all', 'Delete all services. Ignored with -i.'))\n .action(\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: ServiceDeleteOptions\n ) => {\n state.default.session.setTenant(host);\n state.default.session.setRealm(realm);\n state.default.session.setUsername(user);\n state.default.session.setPassword(password);\n state.default.session.setDeploymentType(options.type);\n state.default.session.setAllowInsecureConnection(options.insecure);\n state.default.session.setVerbose(options.verbose);\n state.default.session.setDebug(options.debug);\n state.default.session.setCurlirize(options.curlirize);\n if (options.id && (await getTokens())) {\n await deleteService(options.id);\n } else if (options.all && (await getTokens())) {\n await deleteServices();\n } else {\n program.help();\n }\n }\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAT,EAAuBC,KAAvB,QAAoC,uBAApC;AACA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,yBAA9C;AACA,OAAO,KAAKC,MAAZ,MAAwB,kBAAxB;AAEA,MAAM;EAAEC;AAAF,IAAgBP,YAAtB;AAEA,MAAMQ,OAAO,GAAG,IAAIN,OAAJ,CAAY,sBAAZ,CAAhB;AAYAM,OAAO,CACJC,WADH,CACe,qBADf,EAEGC,UAFH,CAEc,YAFd,EAE4B,MAF5B,EAGGC,kBAHH,GAIGC,WAJH,CAIeN,MAAM,CAACO,aAJtB,EAKGD,WALH,CAKeN,MAAM,CAACQ,aALtB,EAMGF,WANH,CAMeN,MAAM,CAACS,YANtB,EAOGH,WAPH,CAOeN,MAAM,CAACU,gBAPtB,EAQGC,SARH,CAQaX,MAAM,CAACY,gBARpB,EASGD,SATH,CASaX,MAAM,CAACa,cATpB,EAUGF,SAVH,CAUaX,MAAM,CAACc,aAVpB,EAWGH,SAXH,CAWaX,MAAM,CAACe,WAXpB,EAYGJ,SAZH,CAYaX,MAAM,CAACgB,eAZpB,EAaGL,SAbH,CAaa,IAAId,MAAJ,CAAW,eAAX,EAA4B,8BAA5B,CAbb,EAcGc,SAdH,CAca,IAAId,MAAJ,C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import { Command, Option } from 'commander';
3
+ import { exportServicesToFile, exportServicesToFiles, exportServiceToFile } from '../../ops/ServiceOps.js';
4
+ import { printMessage, verboseMessage } from '../../utils/Console.js';
5
+ import * as common from '../cmd_common.js';
6
+ const {
7
+ getTokens
8
+ } = Authenticate;
9
+ const program = new Command('frodo service export');
10
+ program.description('Export AM services.').helpOption('-h, --help', 'Help').showHelpAfterError().addArgument(common.hostArgumentM).addArgument(common.realmArgument).addArgument(common.userArgument).addArgument(common.passwordArgument).addOption(common.deploymentOption).addOption(common.insecureOption).addOption(common.verboseOption).addOption(common.debugOption).addOption(common.curlirizeOption).addOption(new Option('-i, --service-id <service-id>', 'Service id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the export file.')).addOption(new Option('-a, --all', 'Export all services to a single file.')).addOption(new Option('-A, --all-separate', 'Export all services to separate files (*.service.json) in the current directory. Ignored with -a.')).action(async (host, realm, user, password, options) => {
11
+ state.default.session.setTenant(host);
12
+ state.default.session.setRealm(realm);
13
+ state.default.session.setUsername(user);
14
+ state.default.session.setPassword(password);
15
+ state.default.session.setDeploymentType(options.type);
16
+ state.default.session.setAllowInsecureConnection(options.insecure);
17
+ state.default.session.setVerbose(options.verbose);
18
+ state.default.session.setDebug(options.debug);
19
+ state.default.session.setCurlirize(options.curlirize); // export by name
20
+
21
+ if (options.serviceId && (await getTokens())) {
22
+ verboseMessage('Exporting service...');
23
+ await exportServiceToFile(options.serviceId, options.file);
24
+ } // -a / --all
25
+ else if (options.all && (await getTokens())) {
26
+ verboseMessage('Exporting all services to a single file...');
27
+ await exportServicesToFile(options.file);
28
+ } // -A / --all-separate
29
+ else if (options.allSeparate && (await getTokens())) {
30
+ verboseMessage('Exporting all services to separate files...');
31
+ await exportServicesToFiles();
32
+ } // unrecognized combination of options or no options
33
+ else {
34
+ printMessage('Unrecognized combination of options or no options...', 'error');
35
+ program.help();
36
+ }
37
+ } // end command logic inside action handler
38
+ );
39
+ program.parse();
40
+ //# sourceMappingURL=service-export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-export.js","names":["Authenticate","state","Command","Option","exportServicesToFile","exportServicesToFiles","exportServiceToFile","printMessage","verboseMessage","common","getTokens","program","description","helpOption","showHelpAfterError","addArgument","hostArgumentM","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","verboseOption","debugOption","curlirizeOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","setVerbose","verbose","setDebug","debug","setCurlirize","curlirize","serviceId","file","all","allSeparate","help","parse"],"sources":["cli/service/service-export.ts"],"sourcesContent":["import { Authenticate, state } from '@rockcarver/frodo-lib';\nimport { Command, Option } from 'commander';\nimport {\n exportServicesToFile,\n exportServicesToFiles,\n exportServiceToFile,\n} from '../../ops/ServiceOps.js';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport * as common from '../cmd_common.js';\n\nconst { getTokens } = Authenticate;\n\nconst program = new Command('frodo service export');\n\ninterface ServiceExportOptions {\n file?: string;\n all?: boolean;\n serviceId?: string;\n allSeparate?: boolean;\n type?: string;\n insecure?: boolean;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n}\n\nprogram\n .description('Export AM services.')\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgumentM)\n .addArgument(common.realmArgument)\n .addArgument(common.userArgument)\n .addArgument(common.passwordArgument)\n .addOption(common.deploymentOption)\n .addOption(common.insecureOption)\n .addOption(common.verboseOption)\n .addOption(common.debugOption)\n .addOption(common.curlirizeOption)\n .addOption(\n new Option(\n '-i, --service-id <service-id>',\n 'Service id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the export file.'))\n .addOption(new Option('-a, --all', 'Export all services to a single file.'))\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all services to separate files (*.service.json) in the current directory. Ignored with -a.'\n )\n )\n .action(\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: ServiceExportOptions\n ) => {\n state.default.session.setTenant(host);\n state.default.session.setRealm(realm);\n state.default.session.setUsername(user);\n state.default.session.setPassword(password);\n state.default.session.setDeploymentType(options.type);\n state.default.session.setAllowInsecureConnection(options.insecure);\n state.default.session.setVerbose(options.verbose);\n state.default.session.setDebug(options.debug);\n state.default.session.setCurlirize(options.curlirize);\n // export by name\n if (options.serviceId && (await getTokens())) {\n verboseMessage('Exporting service...');\n await exportServiceToFile(options.serviceId, options.file);\n }\n // -a / --all\n else if (options.all && (await getTokens())) {\n verboseMessage('Exporting all services to a single file...');\n await exportServicesToFile(options.file);\n }\n // -A / --all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting all services to separate files...');\n await exportServicesToFiles();\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 }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAT,EAAuBC,KAAvB,QAAoC,uBAApC;AACA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SACEC,oBADF,EAEEC,qBAFF,EAGEC,mBAHF,QAIO,yBAJP;AAKA,SAASC,YAAT,EAAuBC,cAAvB,QAA6C,wBAA7C;AACA,OAAO,KAAKC,MAAZ,MAAwB,kBAAxB;AAEA,MAAM;EAAEC;AAAF,IAAgBV,YAAtB;AAEA,MAAMW,OAAO,GAAG,IAAIT,OAAJ,CAAY,sBAAZ,CAAhB;AAcAS,OAAO,CACJC,WADH,CACe,qBADf,EAEGC,UAFH,CAEc,YAFd,EAE4B,MAF5B,EAGGC,kBAHH,GAIGC,WAJH,CAIeN,MAAM,CAACO,aAJtB,EAKGD,WALH,CAKeN,MAAM,CAACQ,aALtB,EAMGF,WANH,CAMeN,MAAM,CAACS,YANtB,EAOGH,WAPH,CAOeN,MAAM,CAACU,gBAPtB,EAQGC,SARH,CAQaX,MAAM,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B,CAAmCf,OAAO,CAACgB,SAA3C,EATG,CAUH;;EACA,IAAIhB,OAAO,CAACiB,SAAR,KAAsB,MAAMtC,SAAS,EAArC,CAAJ,EAA8C;IAC5CF,cAAc,CAAC,sBAAD,CAAd;IACA,MAAMF,mBAAmB,CAACyB,OAAO,CAACiB,SAAT,EAAoBjB,OAAO,CAACkB,IAA5B,CAAzB;EACD,CAHD,CAIA;EAJA,KAKK,IAAIlB,OAAO,CAACmB,GAAR,KAAgB,MAAMxC,SAAS,EAA/B,CAAJ,EAAwC;IAC3CF,cAAc,CAAC,4CAAD,CAAd;IACA,MAAMJ,oBAAoB,CAAC2B,OAAO,CAACkB,IAAT,CAA1B;EACD,CAHI,CAIL;EAJK,KAKA,IAAIlB,OAAO,CAACoB,WAAR,KAAwB,MAAMzC,SAAS,EAAvC,CAAJ,EAAgD;IACnDF,cAAc,CAAC,6CAAD,CAAd;IACA,MAAMH,qBAAqB,EAA3B;EACD,CAHI,CAIL;EAJK,KAKA;IACHE,YAAY,CACV,sDADU,EAEV,OAFU,CAAZ;IAIAI,OAAO,CAACyC,IAAR;EACD;AACF,CAnEL,CAoEI;AApEJ;AAuEAzC,OAAO,CAAC0C,KAAR"}
@@ -0,0 +1,46 @@
1
+ import { Authenticate, state } from '@rockcarver/frodo-lib';
2
+ import { Command, Option } from 'commander';
3
+ import { importFirstServiceFromFile, importServiceFromFile, importServicesFromFile, importServicesFromFiles } from '../../ops/ServiceOps.js';
4
+ import { printMessage, verboseMessage } from '../../utils/Console.js';
5
+ import * as common from '../cmd_common.js';
6
+ const {
7
+ getTokens
8
+ } = Authenticate;
9
+ const program = new Command('frodo service import');
10
+ program.description('Import AM services.').helpOption('-h, --help', 'Help').showHelpAfterError().addArgument(common.hostArgumentM).addArgument(common.realmArgument).addArgument(common.userArgument).addArgument(common.passwordArgument).addOption(common.deploymentOption).addOption(common.insecureOption).addOption(common.verboseOption).addOption(common.debugOption).addOption(common.curlirizeOption).addOption(new Option('-i, --service-id <service-id>', 'Service id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import SAML Entity(s) from. Ignored with -A.')).addOption(new Option('-a, --all', 'Import all services from a single file.')).addOption(new Option('-C, --clean', 'Remove existing service(s) before importing.')).addOption(new Option('-A, --all-separate', 'Import all services from separate files <id>.service.json.')).addOption(new Option('-D, --directory <directory>', 'Working directory.')).action(async (host, realm, user, password, options) => {
11
+ state.default.session.setTenant(host);
12
+ state.default.session.setRealm(realm);
13
+ state.default.session.setUsername(user);
14
+ state.default.session.setPassword(password);
15
+ state.default.session.setDeploymentType(options.type);
16
+ state.default.session.setAllowInsecureConnection(options.insecure);
17
+ state.default.session.setVerbose(options.verbose);
18
+ state.default.session.setDebug(options.debug);
19
+ state.default.session.setCurlirize(options.curlirize);
20
+ state.default.session.setDirectory(options.directory || '.');
21
+ const clean = options.clean ?? false; // import by id
22
+
23
+ if (options.serviceId && options.file && (await getTokens())) {
24
+ verboseMessage('Importing service...');
25
+ await importServiceFromFile(options.serviceId, options.file, clean);
26
+ } // -a / --all
27
+ else if (options.all && options.file && (await getTokens())) {
28
+ verboseMessage('Importing all services from a single file...');
29
+ await importServicesFromFile(options.file, clean);
30
+ } // -A / --all-separate
31
+ else if (options.allSeparate && (await getTokens())) {
32
+ verboseMessage('Importing all services from separate files...');
33
+ await importServicesFromFiles(clean);
34
+ } // import file
35
+ else if (options.file && (await getTokens())) {
36
+ verboseMessage('Importing service...');
37
+ await importFirstServiceFromFile(options.file, clean);
38
+ } // unrecognized combination of options or no options
39
+ else {
40
+ printMessage('Unrecognized combination of options or no options...', 'error');
41
+ program.help();
42
+ }
43
+ } // end command logic inside action handler
44
+ );
45
+ program.parse();
46
+ //# sourceMappingURL=service-import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-import.js","names":["Authenticate","state","Command","Option","importFirstServiceFromFile","importServiceFromFile","importServicesFromFile","importServicesFromFiles","printMessage","verboseMessage","common","getTokens","program","description","helpOption","showHelpAfterError","addArgument","hostArgumentM","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","verboseOption","debugOption","curlirizeOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","setVerbose","verbose","setDebug","debug","setCurlirize","curlirize","setDirectory","directory","clean","serviceId","file","all","allSeparate","help","parse"],"sources":["cli/service/service-import.ts"],"sourcesContent":["import { Authenticate, state } from '@rockcarver/frodo-lib';\nimport { Command, Option } from 'commander';\nimport {\n importFirstServiceFromFile,\n importServiceFromFile,\n importServicesFromFile,\n importServicesFromFiles,\n} from '../../ops/ServiceOps.js';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport * as common from '../cmd_common.js';\n\nconst { getTokens } = Authenticate;\n\nconst program = new Command('frodo service import');\n\ninterface ServiceImportOptions {\n file?: string;\n all?: boolean;\n serviceId?: string;\n allSeparate?: boolean;\n type?: string;\n insecure?: boolean;\n clean?: boolean;\n directory?: string;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n}\n\nprogram\n .description('Import AM services.')\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgumentM)\n .addArgument(common.realmArgument)\n .addArgument(common.userArgument)\n .addArgument(common.passwordArgument)\n .addOption(common.deploymentOption)\n .addOption(common.insecureOption)\n .addOption(common.verboseOption)\n .addOption(common.debugOption)\n .addOption(common.curlirizeOption)\n .addOption(\n new Option(\n '-i, --service-id <service-id>',\n 'Service id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to import SAML Entity(s) from. Ignored with -A.'\n )\n )\n .addOption(new Option('-a, --all', 'Import all services from a single file.'))\n .addOption(\n new Option('-C, --clean', 'Remove existing service(s) before importing.')\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all services from separate files <id>.service.json.'\n )\n )\n .addOption(new Option('-D, --directory <directory>', 'Working directory.'))\n .action(\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: ServiceImportOptions\n ) => {\n state.default.session.setTenant(host);\n state.default.session.setRealm(realm);\n state.default.session.setUsername(user);\n state.default.session.setPassword(password);\n state.default.session.setDeploymentType(options.type);\n state.default.session.setAllowInsecureConnection(options.insecure);\n state.default.session.setVerbose(options.verbose);\n state.default.session.setDebug(options.debug);\n state.default.session.setCurlirize(options.curlirize);\n state.default.session.setDirectory(options.directory || '.');\n\n const clean = options.clean ?? false;\n\n // import by id\n if (options.serviceId && options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n await importServiceFromFile(options.serviceId, options.file, clean);\n }\n // -a / --all\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage('Importing all services from a single file...');\n await importServicesFromFile(options.file, clean);\n }\n // -A / --all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Importing all services from separate files...');\n await importServicesFromFiles(clean);\n }\n // import file\n else if (options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n await importFirstServiceFromFile(options.file, clean);\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 }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAT,EAAuBC,KAAvB,QAAoC,uBAApC;AACA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SACEC,0BADF,EAEEC,qBAFF,EAGEC,sBAHF,EAIEC,uBAJF,QAKO,yBALP;AAMA,SAASC,YAAT,EAAuBC,cAAvB,QAA6C,wBAA7C;AACA,OAAO,KAAKC,MAAZ,MAAwB,kBAAxB;AAEA,MAAM;EAAEC;AAAF,IAAgBX,YAAtB;AAEA,MAAMY,OAAO,GAAG,IAAIV,OAAJ,CAAY,sBAAZ,CAAhB;AAgBAU,OAAO,CACJC,WADH,CACe,qBADf,EAEGC,UAFH,CAEc,YAFd,EAE4B,MAF5B,EAGGC,kBAHH,GAIGC,WAJH,CAIeN,MAAM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EAAyC;IAC5CF,cAAc,CAAC,sBAAD,CAAd;IACA,MAAML,0BAA0B,CAAC4B,OAAO,CAACqB,IAAT,EAAeF,KAAf,CAAhC;EACD,CAHI,CAIL;EAJK,KAKA;IACH3C,YAAY,CACV,sDADU,EAEV,OAFU,CAAZ;IAIAI,OAAO,CAAC4C,IAAR;EACD;AACF,CArFL,CAsFI;AAtFJ;AAyFA5C,OAAO,CAAC6C,KAAR"}
@@ -0,0 +1,27 @@
1
+ import { Authenticate, state } from '@rockcarver/frodo-lib';
2
+ import { Command, Option } from 'commander';
3
+ import { listServices } from '../../ops/ServiceOps.js';
4
+ import { verboseMessage } from '../../utils/Console.js';
5
+ import * as common from '../cmd_common.js';
6
+ const {
7
+ getTokens
8
+ } = Authenticate;
9
+ const program = new Command('frodo service list');
10
+ program.description('List AM services.').helpOption('-h, --help', 'Help').showHelpAfterError().addArgument(common.hostArgumentM).addArgument(common.realmArgument).addArgument(common.userArgument).addArgument(common.passwordArgument).addOption(common.deploymentOption).addOption(common.insecureOption).addOption(common.verboseOption).addOption(common.debugOption).addOption(common.curlirizeOption).addOption(new Option('-l, --long', 'Long with all fields.').default(false, 'false')).action(async (host, realm, user, password, options) => {
11
+ state.default.session.setTenant(host);
12
+ state.default.session.setRealm(realm);
13
+ state.default.session.setUsername(user);
14
+ state.default.session.setPassword(password);
15
+ state.default.session.setDeploymentType(options.type);
16
+ state.default.session.setAllowInsecureConnection(options.insecure);
17
+ state.default.session.setVerbose(options.verbose);
18
+ state.default.session.setDebug(options.debug);
19
+ state.default.session.setCurlirize(options.curlirize);
20
+
21
+ if (await getTokens()) {
22
+ verboseMessage(`Listing all AM services for realm: ${realm}`);
23
+ await listServices(options.long);
24
+ }
25
+ });
26
+ program.parse();
27
+ //# sourceMappingURL=service-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-list.js","names":["Authenticate","state","Command","Option","listServices","verboseMessage","common","getTokens","program","description","helpOption","showHelpAfterError","addArgument","hostArgumentM","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","verboseOption","debugOption","curlirizeOption","default","action","host","realm","user","password","options","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","setVerbose","verbose","setDebug","debug","setCurlirize","curlirize","long","parse"],"sources":["cli/service/service-list.ts"],"sourcesContent":["import { Authenticate, state } from '@rockcarver/frodo-lib';\nimport { Command, Option } from 'commander';\nimport { listServices } from '../../ops/ServiceOps.js';\nimport { verboseMessage } from '../../utils/Console.js';\nimport * as common from '../cmd_common.js';\n\nconst { getTokens } = Authenticate;\n\nconst program = new Command('frodo service list');\n\nprogram\n .description('List AM services.')\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgumentM)\n .addArgument(common.realmArgument)\n .addArgument(common.userArgument)\n .addArgument(common.passwordArgument)\n .addOption(common.deploymentOption)\n .addOption(common.insecureOption)\n .addOption(common.verboseOption)\n .addOption(common.debugOption)\n .addOption(common.curlirizeOption)\n .addOption(\n new Option('-l, --long', 'Long with all fields.').default(false, 'false')\n )\n .action(async (host, realm, user, password, options) => {\n state.default.session.setTenant(host);\n state.default.session.setRealm(realm);\n state.default.session.setUsername(user);\n state.default.session.setPassword(password);\n state.default.session.setDeploymentType(options.type);\n state.default.session.setAllowInsecureConnection(options.insecure);\n state.default.session.setVerbose(options.verbose);\n state.default.session.setDebug(options.debug);\n state.default.session.setCurlirize(options.curlirize);\n if (await getTokens()) {\n verboseMessage(`Listing all AM services for realm: ${realm}`);\n await listServices(options.long);\n }\n });\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAT,EAAuBC,KAAvB,QAAoC,uBAApC;AACA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SAASC,YAAT,QAA6B,yBAA7B;AACA,SAASC,cAAT,QAA+B,wBAA/B;AACA,OAAO,KAAKC,MAAZ,MAAwB,kBAAxB;AAEA,MAAM;EAAEC;AAAF,IAAgBP,YAAtB;AA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AAO,CAACW,OAAzC;EACAvC,KAAK,CAACsB,OAAN,CAAcO,OAAd,CAAsBW,QAAtB,CAA+BZ,OAAO,CAACa,KAAvC;EACAzC,KAAK,CAACsB,OAAN,CAAcO,OAAd,CAAsBa,YAAtB,CAAmCd,OAAO,CAACe,SAA3C;;EACA,IAAI,MAAMrC,SAAS,EAAnB,EAAuB;IACrBF,cAAc,CAAE,sCAAqCqB,KAAM,EAA7C,CAAd;IACA,MAAMtB,YAAY,CAACyB,OAAO,CAACgB,IAAT,CAAlB;EACD;AACF,CA9BH;AAgCArC,OAAO,CAACsC,KAAR"}
@@ -0,0 +1,16 @@
1
+ import { Command } from 'commander';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
+
7
+ export default function setup() {
8
+ const program = new Command('service').helpOption('-h, --help', 'Help').description('Manage AM services.').executableDir(__dirname);
9
+ program.command('list', 'List AM services.').showHelpAfterError();
10
+ program.command('export', 'Export AM services.').showHelpAfterError();
11
+ program.command('import', 'Import AM services.').showHelpAfterError();
12
+ program.command('delete', 'Delete AM services.').showHelpAfterError();
13
+ program.showHelpAfterError();
14
+ return program;
15
+ }
16
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","names":["Command","path","fileURLToPath","__dirname","dirname","import","meta","url","setup","program","helpOption","description","executableDir","command","showHelpAfterError"],"sources":["cli/service/service.ts"],"sourcesContent":["import { Command } from 'commander';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport default function setup() {\n const program = new Command('service')\n .helpOption('-h, --help', 'Help')\n .description('Manage AM services.')\n .executableDir(__dirname);\n\n program.command('list', 'List AM services.').showHelpAfterError();\n\n program.command('export', 'Export AM services.').showHelpAfterError();\n\n program.command('import', 'Import AM services.').showHelpAfterError();\n\n program.command('delete', 'Delete AM services.').showHelpAfterError();\n\n program.showHelpAfterError();\n return program;\n}\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,WAAxB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,aAAT,QAA8B,KAA9B;;AAEA,MAAMC,SAAS,GAAGF,IAAI,CAACG,OAAL,CAAaF,aAAa,CAACG,MAAM,CAACC,IAAP,CAAYC,GAAb,CAA1B,CAAlB;;AAEA,eAAe,SAASC,KAAT,GAAiB;EAC9B,MAAMC,OAAO,GAAG,IAAIT,OAAJ,CAAY,SAAZ,EACbU,UADa,CACF,YADE,EACY,MADZ,EAEbC,WAFa,CAED,qBAFC,EAGbC,aAHa,CAGCT,SAHD,CAAhB;EAKAM,OAAO,CAACI,OAAR,CAAgB,MAAhB,EAAwB,mBAAxB,EAA6CC,kBAA7C;EAEAL,OAAO,CAACI,OAAR,CAAgB,QAAhB,EAA0B,qBAA1B,EAAiDC,kBAAjD;EAEAL,OAAO,CAACI,OAAR,CAAgB,QAAhB,EAA0B,qBAA1B,EAAiDC,kBAAjD;EAEAL,OAAO,CAACI,OAAR,CAAgB,QAAhB,EAA0B,qBAA1B,EAAiDC,kBAAjD;EAEAL,OAAO,CAACK,kBAAR;EACA,OAAOL,OAAP;AACD"}
@@ -0,0 +1,234 @@
1
+ import fs from 'fs';
2
+ import { printMessage, createTable, debugMessage, showSpinner, succeedSpinner, failSpinner } from '../utils/Console';
3
+ import { ExportImportUtils, Service, Utils, state } from '@rockcarver/frodo-lib';
4
+ const {
5
+ createServiceExportTemplate,
6
+ deleteFullServices,
7
+ deleteFullService,
8
+ getListOfServices,
9
+ getFullServices,
10
+ exportServices,
11
+ exportService,
12
+ importServices,
13
+ importService
14
+ } = Service;
15
+ const {
16
+ getTypedFilename,
17
+ getWorkingDirectory,
18
+ saveJsonToFile,
19
+ titleCase
20
+ } = ExportImportUtils;
21
+ const {
22
+ getRealmName
23
+ } = Utils;
24
+ /**
25
+ * List services
26
+ */
27
+
28
+ export async function listServices(long = false) {
29
+ try {
30
+ const services = await getListOfServices();
31
+ services.sort((a, b) => a._id.localeCompare(b._id));
32
+
33
+ if (long) {
34
+ const table = createTable(['Service Id', 'Service Name']);
35
+
36
+ for (const service of services) {
37
+ table.push([service._id, service.name]);
38
+ }
39
+
40
+ printMessage(table.toString(), 'data');
41
+ } else {
42
+ for (const service of services) {
43
+ printMessage(`${service._id}`, 'data');
44
+ }
45
+ }
46
+ } catch (error) {
47
+ printMessage(`Error listing agents - ${error}`, 'error');
48
+ printMessage(error.stack, 'error');
49
+ }
50
+ }
51
+ /**
52
+ * Export all services to file
53
+ * @param {string} file file name
54
+ */
55
+
56
+ export async function exportServicesToFile(file) {
57
+ const exportData = await exportServices();
58
+ let fileName = getTypedFilename(`all${titleCase(getRealmName(state.default.session.getRealm()))}Services`, `service`);
59
+
60
+ if (file) {
61
+ fileName = file;
62
+ }
63
+
64
+ saveJsonToFile(exportData, fileName);
65
+ }
66
+ /**
67
+ * Export service to file
68
+ * @param {string} serviceId service id
69
+ * @param {string} file file name
70
+ */
71
+
72
+ export async function exportServiceToFile(serviceId, file) {
73
+ const exportData = await exportService(serviceId);
74
+ let fileName = getTypedFilename(serviceId, `service`);
75
+
76
+ if (file) {
77
+ fileName = file;
78
+ }
79
+
80
+ saveJsonToFile(exportData, fileName);
81
+ }
82
+ /**
83
+ * Export all services to separate files
84
+ */
85
+
86
+ export async function exportServicesToFiles() {
87
+ debugMessage(`cli.ServiceOps.exportServicesToFiles: start`);
88
+ const services = await getFullServices();
89
+
90
+ for (const service of services) {
91
+ const fileName = getTypedFilename(service._type._id, `service`);
92
+ const exportData = createServiceExportTemplate();
93
+ exportData.service[service._type._id] = service;
94
+ debugMessage(`cli.ServiceOps.exportServicesToFiles: exporting ${service._type._id} to ${fileName}`);
95
+ saveJsonToFile(exportData, fileName);
96
+ }
97
+
98
+ debugMessage(`cli.ServiceOps.exportServicesToFiles: end.`);
99
+ }
100
+ /**
101
+ * Import a service from file
102
+ * @param {string} serviceId service id/name
103
+ * @param {string} file import file name
104
+ * @param {boolean} clean remove existing service
105
+ */
106
+
107
+ export async function importServiceFromFile(serviceId, file, clean) {
108
+ debugMessage(`cli.ServiceOps.importServiceFromFile: start [serviceId=${serviceId}, file=${file}]`);
109
+ const verbose = state.default.session.getVerbose();
110
+ fs.readFile(file, 'utf8', async (err, data) => {
111
+ if (err) throw err;
112
+ const importData = JSON.parse(data);
113
+
114
+ if (importData && importData.service[serviceId]) {
115
+ if (!verbose) showSpinner(`Importing ${serviceId}...`);
116
+
117
+ try {
118
+ if (verbose) showSpinner(`Importing ${serviceId}...`);
119
+ await importService(serviceId, importData, clean);
120
+ succeedSpinner(`Imported ${serviceId}.`);
121
+ } catch (importError) {
122
+ var _importError$response, _importError$response2, _importError$response3, _importError$response4;
123
+
124
+ const message = (_importError$response = importError.response) === null || _importError$response === void 0 ? void 0 : (_importError$response2 = _importError$response.data) === null || _importError$response2 === void 0 ? void 0 : _importError$response2.message;
125
+ const detail = (_importError$response3 = importError.response) === null || _importError$response3 === void 0 ? void 0 : (_importError$response4 = _importError$response3.data) === null || _importError$response4 === void 0 ? void 0 : _importError$response4.detail;
126
+ if (verbose) showSpinner(`Importing ${serviceId}...`);
127
+ failSpinner(`${detail ? message + ' - ' + detail : message}`);
128
+ }
129
+ } else {
130
+ showSpinner(`Importing ${serviceId}...`);
131
+ failSpinner(`${serviceId} not found!`);
132
+ }
133
+ });
134
+ debugMessage(`cli.ServiceOps.importServiceFromFile: end [serviceId=${serviceId}, file=${file}]`);
135
+ }
136
+ /**
137
+ * Import first service from file
138
+ * @param {string} file import file name
139
+ * @param {boolean} clean remove existing service
140
+ */
141
+
142
+ export async function importFirstServiceFromFile(file, clean) {
143
+ debugMessage(`cli.ServiceOps.importFirstServiceFromFile: start [file=${file}]`);
144
+ const verbose = state.default.session.getVerbose();
145
+ fs.readFile(file, 'utf8', async (err, data) => {
146
+ if (err) throw err;
147
+ const importData = JSON.parse(data);
148
+
149
+ if (importData && Object.keys(importData.service).length) {
150
+ const serviceId = Object.keys(importData.service)[0];
151
+ if (!verbose) showSpinner(`Importing ${serviceId}...`);
152
+
153
+ try {
154
+ if (verbose) showSpinner(`Importing ${serviceId}...`);
155
+ await importService(serviceId, importData, clean);
156
+ succeedSpinner(`Imported ${serviceId}.`);
157
+ } catch (importError) {
158
+ var _importError$response5, _importError$response6, _importError$response7, _importError$response8;
159
+
160
+ const message = (_importError$response5 = importError.response) === null || _importError$response5 === void 0 ? void 0 : (_importError$response6 = _importError$response5.data) === null || _importError$response6 === void 0 ? void 0 : _importError$response6.message;
161
+ const detail = (_importError$response7 = importError.response) === null || _importError$response7 === void 0 ? void 0 : (_importError$response8 = _importError$response7.data) === null || _importError$response8 === void 0 ? void 0 : _importError$response8.detail;
162
+ if (verbose) showSpinner(`Importing ${serviceId}...`);
163
+ failSpinner(`${detail ? message + ' - ' + detail : message}`);
164
+ }
165
+ } else {
166
+ showSpinner(`Importing service...`);
167
+ failSpinner(`No service found in ${file}!`);
168
+ }
169
+
170
+ debugMessage(`cli.ServiceOps.importFirstServiceFromFile: end [file=${file}]`);
171
+ });
172
+ }
173
+ /**
174
+ * Import services from file
175
+ * @param {String} file file name
176
+ * @param {boolean} clean remove existing service
177
+ */
178
+
179
+ export async function importServicesFromFile(file, clean) {
180
+ debugMessage(`cli.ServiceOps.importServiceFromFile: start [file=${file}]`);
181
+ fs.readFile(file, 'utf8', async (err, data) => {
182
+ if (err) throw err;
183
+ debugMessage(`cli.ServiceOps.importServiceFromFile: importing ${file}`);
184
+ const importData = JSON.parse(data);
185
+
186
+ try {
187
+ await importServices(importData, clean);
188
+ } catch (error) {
189
+ printMessage(`${error.message}`, 'error');
190
+ printMessage(error.response.status, 'error');
191
+ }
192
+
193
+ debugMessage(`cli.ServiceOps.importServiceFromFile: end [file=${file}]`);
194
+ });
195
+ }
196
+ /**
197
+ * Import all services from separate files
198
+ * @param {boolean} clean remove existing service
199
+ */
200
+
201
+ export async function importServicesFromFiles(clean) {
202
+ debugMessage(`cli.ServiceOps.importServicesFromFiles: start`);
203
+ const names = fs.readdirSync(getWorkingDirectory());
204
+ const agentFiles = names.filter(name => name.toLowerCase().endsWith('.service.json'));
205
+
206
+ for (const file of agentFiles) {
207
+ await importServicesFromFile(file, clean);
208
+ }
209
+
210
+ debugMessage(`cli.ServiceOps.importServicesFromFiles: end`);
211
+ }
212
+ /**
213
+ * Delete a service by id/name
214
+ * @param {string} serviceId Reference to the service to delete
215
+ */
216
+
217
+ export async function deleteService(serviceId) {
218
+ try {
219
+ await deleteFullService(serviceId);
220
+ } catch (error) {
221
+ var _error$response, _error$response$data;
222
+
223
+ const message = (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.message;
224
+ printMessage(`Delete service '${serviceId}': ${message}`, 'error');
225
+ }
226
+ }
227
+ /**
228
+ * Delete all services
229
+ */
230
+
231
+ export async function deleteServices() {
232
+ await deleteFullServices();
233
+ }
234
+ //# sourceMappingURL=ServiceOps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceOps.js","names":["fs","printMessage","createTable","debugMessage","showSpinner","succeedSpinner","failSpinner","ExportImportUtils","Service","Utils","state","createServiceExportTemplate","deleteFullServices","deleteFullService","getListOfServices","getFullServices","exportServices","exportService","importServices","importService","getTypedFilename","getWorkingDirectory","saveJsonToFile","titleCase","getRealmName","listServices","long","services","sort","a","b","_id","localeCompare","table","service","push","name","toString","error","stack","exportServicesToFile","file","exportData","fileName","default","session","getRealm","exportServiceToFile","serviceId","exportServicesToFiles","_type","importServiceFromFile","clean","verbose","getVerbose","readFile","err","data","importData","JSON","parse","importError","message","response","detail","importFirstServiceFromFile","Object","keys","length","importServicesFromFile","status","importServicesFromFiles","names","readdirSync","agentFiles","filter","toLowerCase","endsWith","deleteService","deleteServices"],"sources":["ops/ServiceOps.ts"],"sourcesContent":["import fs from 'fs';\nimport {\n printMessage,\n createTable,\n debugMessage,\n showSpinner,\n succeedSpinner,\n failSpinner,\n} from '../utils/Console';\nimport {\n ExportImportUtils,\n Service,\n Utils,\n state,\n} from '@rockcarver/frodo-lib';\nimport { ServiceExportInterface } from '@rockcarver/frodo-lib/types/ops/OpsTypes';\n\nconst {\n createServiceExportTemplate,\n deleteFullServices,\n deleteFullService,\n getListOfServices,\n getFullServices,\n exportServices,\n exportService,\n importServices,\n importService,\n} = Service;\nconst { getTypedFilename, getWorkingDirectory, saveJsonToFile, titleCase } =\n ExportImportUtils;\nconst { getRealmName } = Utils;\n\n/**\n * List services\n */\nexport async function listServices(long = false) {\n try {\n const services = await getListOfServices();\n services.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable(['Service Id', 'Service Name']);\n for (const service of services) {\n table.push([service._id, service.name]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const service of services) {\n printMessage(`${service._id}`, 'data');\n }\n }\n } catch (error) {\n printMessage(`Error listing agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * Export all services to file\n * @param {string} file file name\n */\nexport async function exportServicesToFile(file) {\n const exportData = await exportServices();\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.default.session.getRealm()))}Services`,\n `service`\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export service to file\n * @param {string} serviceId service id\n * @param {string} file file name\n */\nexport async function exportServiceToFile(serviceId: string, file: string) {\n const exportData = await exportService(serviceId);\n let fileName = getTypedFilename(serviceId, `service`);\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export all services to separate files\n */\nexport async function exportServicesToFiles() {\n debugMessage(`cli.ServiceOps.exportServicesToFiles: start`);\n const services = await getFullServices();\n for (const service of services) {\n const fileName = getTypedFilename(service._type._id, `service`);\n const exportData = createServiceExportTemplate();\n exportData.service[service._type._id] = service;\n debugMessage(\n `cli.ServiceOps.exportServicesToFiles: exporting ${service._type._id} to ${fileName}`\n );\n saveJsonToFile(exportData, fileName);\n }\n debugMessage(`cli.ServiceOps.exportServicesToFiles: end.`);\n}\n\n/**\n * Import a service from file\n * @param {string} serviceId service id/name\n * @param {string} file import file name\n * @param {boolean} clean remove existing service\n */\nexport async function importServiceFromFile(\n serviceId: string,\n file: string,\n clean: boolean\n) {\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: start [serviceId=${serviceId}, file=${file}]`\n );\n const verbose = state.default.session.getVerbose();\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (importData && importData.service[serviceId]) {\n if (!verbose) showSpinner(`Importing ${serviceId}...`);\n try {\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n await importService(serviceId, importData, clean);\n succeedSpinner(`Imported ${serviceId}.`);\n } catch (importError) {\n const message = importError.response?.data?.message;\n const detail = importError.response?.data?.detail;\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${detail ? message + ' - ' + detail : message}`);\n }\n } else {\n showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${serviceId} not found!`);\n }\n });\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: end [serviceId=${serviceId}, file=${file}]`\n );\n}\n\n/**\n * Import first service from file\n * @param {string} file import file name\n * @param {boolean} clean remove existing service\n */\nexport async function importFirstServiceFromFile(file: string, clean: boolean) {\n debugMessage(\n `cli.ServiceOps.importFirstServiceFromFile: start [file=${file}]`\n );\n const verbose = state.default.session.getVerbose();\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (importData && Object.keys(importData.service).length) {\n const serviceId = Object.keys(importData.service)[0];\n if (!verbose) showSpinner(`Importing ${serviceId}...`);\n try {\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n await importService(serviceId, importData, clean);\n succeedSpinner(`Imported ${serviceId}.`);\n } catch (importError) {\n const message = importError.response?.data?.message;\n const detail = importError.response?.data?.detail;\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${detail ? message + ' - ' + detail : message}`);\n }\n } else {\n showSpinner(`Importing service...`);\n failSpinner(`No service found in ${file}!`);\n }\n debugMessage(\n `cli.ServiceOps.importFirstServiceFromFile: end [file=${file}]`\n );\n });\n}\n\n/**\n * Import services from file\n * @param {String} file file name\n * @param {boolean} clean remove existing service\n */\nexport async function importServicesFromFile(file: string, clean: boolean) {\n debugMessage(`cli.ServiceOps.importServiceFromFile: start [file=${file}]`);\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(`cli.ServiceOps.importServiceFromFile: importing ${file}`);\n const importData = JSON.parse(data) as ServiceExportInterface;\n try {\n await importServices(importData, clean);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(`cli.ServiceOps.importServiceFromFile: end [file=${file}]`);\n });\n}\n\n/**\n * Import all services from separate files\n * @param {boolean} clean remove existing service\n */\nexport async function importServicesFromFiles(clean: boolean) {\n debugMessage(`cli.ServiceOps.importServicesFromFiles: start`);\n const names = fs.readdirSync(getWorkingDirectory());\n const agentFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.service.json')\n );\n for (const file of agentFiles) {\n await importServicesFromFile(file, clean);\n }\n debugMessage(`cli.ServiceOps.importServicesFromFiles: end`);\n}\n\n/**\n * Delete a service by id/name\n * @param {string} serviceId Reference to the service to delete\n */\nexport async function deleteService(serviceId: string) {\n try {\n await deleteFullService(serviceId);\n } catch (error) {\n const message = error.response?.data?.message;\n printMessage(`Delete service '${serviceId}': ${message}`, 'error');\n }\n}\n\n/**\n * Delete all services\n */\nexport async function deleteServices() {\n await deleteFullServices();\n}\n"],"mappings":"AAAA,OAAOA,EAAP,MAAe,IAAf;AACA,SACEC,YADF,EAEEC,WAFF,EAGEC,YAHF,EAIEC,WAJF,EAKEC,cALF,EAMEC,WANF,QAOO,kBAPP;AAQA,SACEC,iBADF,EAEEC,OAFF,EAGEC,KAHF,EAIEC,KAJF,QAKO,uBALP;AAQA,MAAM;E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AAGxE,EAAE,CAACyE,WAAH,CAAepD,mBAAmB,EAAlC,CAAd;EACA,MAAMqD,UAAU,GAAGF,KAAK,CAACG,MAAN,CAAcvC,IAAD,IAC9BA,IAAI,CAACwC,WAAL,GAAmBC,QAAnB,CAA4B,eAA5B,CADiB,CAAnB;;EAGA,KAAK,MAAMpC,IAAX,IAAmBiC,UAAnB,EAA+B;IAC7B,MAAML,sBAAsB,CAAC5B,IAAD,EAAOW,KAAP,CAA5B;EACD;;EACDjD,YAAY,CAAE,6CAAF,CAAZ;AACD;AAED;AACA;AACA;AACA;;AACA,OAAO,eAAe2E,aAAf,CAA6B9B,SAA7B,EAAgD;EACrD,IAAI;IACF,MAAMnC,iBAAiB,CAACmC,SAAD,CAAvB;EACD,CAFD,CAEE,OAAOV,KAAP,EAAc;IAAA;;IACd,MAAMwB,OAAO,sBAAGxB,KAAK,CAACyB,QAAT,4EAAG,gBAAgBN,IAAnB,yDAAG,qBAAsBK,OAAtC;IACA7D,YAAY,CAAE,mBAAkB+C,SAAU,MAAKc,OAAQ,EAA3C,EAA8C,OAA9C,CAAZ;EACD;AACF;AAED;AACA;AACA;;AACA,OAAO,eAAeiB,cAAf,GAAgC;EACrC,MAAMnE,kBAAkB,EAAxB;AACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-cli",
3
- "version": "0.18.2-3",
3
+ "version": "0.18.2-5",
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": [
@@ -90,7 +90,7 @@
90
90
  ]
91
91
  },
92
92
  "dependencies": {
93
- "@rockcarver/frodo-lib": "0.16.2-4",
93
+ "@rockcarver/frodo-lib": "0.16.2-8",
94
94
  "cli-progress": "^3.11.2",
95
95
  "cli-table3": "^0.6.2",
96
96
  "colors": "^1.4.0",