@rockcarver/frodo-cli 2.0.0-40 → 2.0.0-41

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
+ ## [2.0.0-40] - 2023-12-22
11
+
10
12
  ## [2.0.0-39] - 2023-12-19
11
13
 
12
14
  ## [2.0.0-38] - 2023-12-16
@@ -1445,7 +1447,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1445
1447
  - Fixed problem with adding connection profiles
1446
1448
  - Miscellaneous bug fixes
1447
1449
 
1448
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-39...HEAD
1450
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-40...HEAD
1451
+
1452
+ [2.0.0-40]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-39...v2.0.0-40
1449
1453
 
1450
1454
  [2.0.0-39]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-38...v2.0.0-39
1451
1455
 
@@ -1,17 +1,50 @@
1
- import { frodo } from '@rockcarver/frodo-lib';
1
+ import { frodo, state } from '@rockcarver/frodo-lib';
2
2
  import { Option } from 'commander';
3
+ import { importEverythingFromFile, importEverythingFromFiles } from '../../ops/ConfigOps';
4
+ import { printMessage, verboseMessage } from '../../utils/Console';
3
5
  import { FrodoCommand } from '../FrodoCommand';
4
6
  const {
5
7
  getTokens
6
8
  } = frodo.login;
7
9
  const program = new FrodoCommand('frodo config import');
8
- program.description('Import full cloud configuration.').addOption(new Option('-i, --config-id <config-id>', 'Configuration id. If specified, only one configuration is imported and the options -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import.')).addOption(new Option('-a, --all', 'Import all configuration from a single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Import all configuration from separate (.json) files in the working directory. Ignored with -i or -a.')).action(
10
+ program.description('Import full cloud configuration.').addOption(new Option('-f, --file <file>', 'Name of the file to import.')).addOption(new Option('-a, --all', 'Import all configuration from the single file -f. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Import all configuration from separate (.json) files in the (working) directory -D. Ignored with -i or -a.')).addOption(new Option('-C, --clean', 'Remove existing service(s) before importing.')).addOption(new Option('-g, --global', 'Import service(s) as global service(s).')).addOption(new Option('-r, --current-realm', 'Import service(s) into the current realm.')).addOption(new Option('--re-uuid-journeys', 'Generate new UUIDs for all journey nodes during import.').default(false, 'off')).addOption(new Option('--re-uuid-scripts', 'Create new UUIDs for the scripts upon import. Use this to duplicate scripts or create a new versions of the same scripts.').default(false, 'off')).action(
9
11
  // implement command logic inside action handler
10
12
  async (host, realm, user, password, options, command) => {
11
13
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
12
- if (await getTokens()) {
13
- // code goes here
14
+ // Require --file -f for all function
15
+ if (options.all && !options.file) {
16
+ printMessage('-f or --file required when using -a or --all', 'error');
17
+ program.help();
18
+ process.exitCode = 1;
19
+ // --all -a
20
+ } else if (options.all && (await getTokens())) {
21
+ verboseMessage('Exporting everything from a single file...');
22
+ await importEverythingFromFile(options.file, {
23
+ reUuidJourneys: options.reUuidJourneys,
24
+ reUuidScripts: options.reUuidScripts,
25
+ cleanServices: options.clean,
26
+ global: options.global,
27
+ realm: options.realm
28
+ });
29
+ // require --directory -D for all-separate function
30
+ } else if (options.allSeparate && !state.getDirectory()) {
31
+ printMessage('-D or --directory required when using -A or --all-separate', 'error');
32
+ program.help();
33
+ process.exitCode = 1;
34
+ // --all-separate -A
35
+ } else if (options.allSeparate && (await getTokens())) {
36
+ verboseMessage('Importing everything from separate files...');
37
+ await importEverythingFromFiles({
38
+ reUuidJourneys: options.reUuidJourneys,
39
+ reUuidScripts: options.reUuidScripts,
40
+ cleanServices: options.clean,
41
+ global: options.global,
42
+ realm: options.realm
43
+ });
44
+ // unrecognized combination of options or no options
14
45
  } else {
46
+ verboseMessage('Unrecognized combination of options or no options...');
47
+ program.help();
15
48
  process.exitCode = 1;
16
49
  }
17
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config-import.js","names":["frodo","Option","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","process","exitCode","parse"],"sources":["../../../src/cli/config/config-import.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo config import');\n\nprogram\n .description('Import full cloud configuration.')\n .addOption(\n new Option(\n '-i, --config-id <config-id>',\n 'Configuration id. If specified, only one configuration is imported and the options -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Import all configuration from a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all configuration from separate (.json) files in the working directory. Ignored with -i or -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n // code goes here\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGH,KAAK,CAACI,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,qBAAqB,CAAC;AAEvDG,OAAO,CACJC,WAAW,CAAC,kCAAkC,CAAC,CAC/CC,SAAS,CACR,IAAIN,MAAM,CACR,6BAA6B,EAC7B,2GACF,CACF,CAAC,CACAM,SAAS,CAAC,IAAIN,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAAC,CACzEM,SAAS,CACR,IAAIN,MAAM,CACR,WAAW,EACX,+DACF,CACF,CAAC,CACAM,SAAS,CACR,IAAIN,MAAM,CACR,oBAAoB,EACpB,uGACF,CACF,CAAC,CACAO,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD,IAAI,MAAMX,SAAS,CAAC,CAAC,EAAE;IACrB;EAAA,CACD,MAAM;IACLa,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHZ,OAAO,CAACa,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"config-import.js","names":["frodo","state","Option","importEverythingFromFile","importEverythingFromFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","all","file","help","process","exitCode","reUuidJourneys","reUuidScripts","cleanServices","clean","global","allSeparate","getDirectory","parse"],"sources":["../../../src/cli/config/config-import.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n importEverythingFromFile,\n importEverythingFromFiles,\n} from '../../ops/ConfigOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo config import');\n\nprogram\n .description('Import full cloud configuration.')\n .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Import all configuration from the single file -f. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all configuration from separate (.json) files in the (working) directory -D. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option('-C, --clean', 'Remove existing service(s) before importing.')\n )\n .addOption(\n new Option('-g, --global', 'Import service(s) as global service(s).')\n )\n .addOption(\n new Option(\n '-r, --current-realm',\n 'Import service(s) into the current realm.'\n )\n )\n .addOption(\n new Option(\n '--re-uuid-journeys',\n 'Generate new UUIDs for all journey nodes during import.'\n ).default(false, 'off')\n )\n .addOption(\n new Option(\n '--re-uuid-scripts',\n 'Create new UUIDs for the scripts upon import. Use this to duplicate scripts or create a new versions of the same scripts.'\n ).default(false, 'off')\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 // Require --file -f for all function\n if (options.all && !options.file) {\n printMessage('-f or --file required when using -a or --all', 'error');\n program.help();\n process.exitCode = 1;\n // --all -a\n } else if (options.all && (await getTokens())) {\n verboseMessage('Exporting everything from a single file...');\n await importEverythingFromFile(options.file, {\n reUuidJourneys: options.reUuidJourneys,\n reUuidScripts: options.reUuidScripts,\n cleanServices: options.clean,\n global: options.global,\n realm: options.realm,\n });\n // require --directory -D for all-separate function\n } else if (options.allSeparate && !state.getDirectory()) {\n printMessage(\n '-D or --directory required when using -A or --all-separate',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n // --all-separate -A\n } else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Importing everything from separate files...');\n await importEverythingFromFiles({\n reUuidJourneys: options.reUuidJourneys,\n reUuidScripts: options.reUuidScripts,\n cleanServices: options.clean,\n global: options.global,\n realm: options.realm,\n });\n // unrecognized combination of options or no options\n } else {\n verboseMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,wBAAwB,EACxBC,yBA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}
@@ -10,8 +10,7 @@ export default function setup() {
10
10
  //program.command('describe', 'Describe full cloud configuration.');
11
11
 
12
12
  program.command('export', 'Export full cloud configuration for all ops that currently support export..');
13
-
14
- //program.command('import', 'Import full cloud configuration.');
13
+ program.command('import', 'Import full cloud configuration for all ops that currently support import.');
15
14
 
16
15
  //program.command('delete', 'Delete full cloud configuration.');
17
16
 
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","names":["path","fileURLToPath","FrodoStubCommand","__dirname","dirname","import","meta","url","setup","program","description","executableDir","command"],"sources":["../../../src/cli/config/config.ts"],"sourcesContent":["import path from 'path';\nimport { fileURLToPath } from 'url';\n\nimport { FrodoStubCommand } from '../FrodoCommand';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport default function setup() {\n const program = new FrodoStubCommand('config')\n .description('Manage full cloud configuration.')\n .executableDir(__dirname);\n\n //program.command('list', 'List full cloud configuration.');\n\n //program.command('describe', 'Describe full cloud configuration.');\n\n program.command(\n 'export',\n 'Export full cloud configuration for all ops that currently support export..'\n );\n\n //program.command('import', 'Import full cloud configuration.');\n\n //program.command('delete', 'Delete full cloud configuration.');\n\n return program;\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,SAASC,gBAAgB,QAAQ,iBAAiB;AAElD,MAAMC,SAAS,GAAGH,IAAI,CAACI,OAAO,CAACH,aAAa,CAACI,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAE9D,eAAe,SAASC,KAAKA,CAAA,EAAG;EAC9B,MAAMC,OAAO,GAAG,IAAIP,gBAAgB,CAAC,QAAQ,CAAC,CAC3CQ,WAAW,CAAC,kCAAkC,CAAC,CAC/CC,aAAa,CAACR,SAAS,CAAC;;EAE3B;;EAEA;;EAEAM,OAAO,CAACG,OAAO,CACb,QAAQ,EACR,6EACF,CAAC;;EAED;;EAEA;;EAEA,OAAOH,OAAO;AAChB"}
1
+ {"version":3,"file":"config.js","names":["path","fileURLToPath","FrodoStubCommand","__dirname","dirname","import","meta","url","setup","program","description","executableDir","command"],"sources":["../../../src/cli/config/config.ts"],"sourcesContent":["import path from 'path';\nimport { fileURLToPath } from 'url';\n\nimport { FrodoStubCommand } from '../FrodoCommand';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport default function setup() {\n const program = new FrodoStubCommand('config')\n .description('Manage full cloud configuration.')\n .executableDir(__dirname);\n\n //program.command('list', 'List full cloud configuration.');\n\n //program.command('describe', 'Describe full cloud configuration.');\n\n program.command(\n 'export',\n 'Export full cloud configuration for all ops that currently support export..'\n );\n\n program.command(\n 'import',\n 'Import full cloud configuration for all ops that currently support import.'\n );\n\n //program.command('delete', 'Delete full cloud configuration.');\n\n return program;\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,SAASC,gBAAgB,QAAQ,iBAAiB;AAElD,MAAMC,SAAS,GAAGH,IAAI,CAACI,OAAO,CAACH,aAAa,CAACI,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAE9D,eAAe,SAASC,KAAKA,CAAA,EAAG;EAC9B,MAAMC,OAAO,GAAG,IAAIP,gBAAgB,CAAC,QAAQ,CAAC,CAC3CQ,WAAW,CAAC,kCAAkC,CAAC,CAC/CC,aAAa,CAACR,SAAS,CAAC;;EAE3B;;EAEA;;EAEAM,OAAO,CAACG,OAAO,CACb,QAAQ,EACR,6EACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,QAAQ,EACR,4EACF,CAAC;;EAED;;EAEA,OAAOH,OAAO;AAChB"}
@@ -7,29 +7,37 @@ const {
7
7
  getTokens
8
8
  } = frodo.login;
9
9
  const program = new FrodoCommand('frodo idp import');
10
- program.description('Import (social) identity providers.').addOption(new Option('-i, --idp-id <id>', 'Provider id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import the provider(s) from.')).addOption(new Option('-a, --all', 'Import all the providers from single file. Ignored with -t or -i.')).addOption(new Option('-A, --all-separate', 'Import all the providers from separate files (*.json) in the current directory. Ignored with -t or -i or -a.')).action(
10
+ program.description('Import (social) identity providers.').addOption(new Option('-i, --idp-id <id>', 'Provider id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import the provider(s) from.')).addOption(new Option('-a, --all', 'Import all the providers from single file. Ignored with -t or -i.')).addOption(new Option('-A, --all-separate', 'Import all the providers from separate files (*.json) in the current directory. Ignored with -t or -i or -a.')).addOption(new Option('--no-deps', 'Do not include any dependencies (scripts).')).action(
11
11
  // implement command logic inside action handler
12
12
  async (host, realm, user, password, options, command) => {
13
13
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
14
14
  // import by id
15
15
  if (options.file && options.idpId && (await getTokens())) {
16
16
  verboseMessage(`Importing provider "${options.idpId}" into realm "${state.getRealm()}"...`);
17
- await importSocialIdentityProviderFromFile(options.idpId, options.file);
17
+ await importSocialIdentityProviderFromFile(options.idpId, options.file, {
18
+ deps: options.deps
19
+ });
18
20
  }
19
21
  // --all -a
20
22
  else if (options.all && options.file && (await getTokens())) {
21
23
  verboseMessage(`Importing all providers from a single file (${options.file})...`);
22
- await importSocialIdentityProvidersFromFile(options.file);
24
+ await importSocialIdentityProvidersFromFile(options.file, {
25
+ deps: options.deps
26
+ });
23
27
  }
24
28
  // --all-separate -A
25
29
  else if (options.allSeparate && !options.file && (await getTokens())) {
26
30
  verboseMessage('Importing all providers from separate files in current directory...');
27
- await importSocialIdentityProvidersFromFiles();
31
+ await importSocialIdentityProvidersFromFiles({
32
+ deps: options.deps
33
+ });
28
34
  }
29
35
  // import first provider from file
30
36
  else if (options.file && (await getTokens())) {
31
37
  verboseMessage(`Importing first provider from file "${options.file}" into realm "${state.getRealm()}"...`);
32
- await importFirstSocialIdentityProviderFromFile(options.file);
38
+ await importFirstSocialIdentityProviderFromFile(options.file, {
39
+ deps: options.deps
40
+ });
33
41
  }
34
42
  // unrecognized combination of options or no options
35
43
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"idp-import.js","names":["frodo","state","Option","importFirstSocialIdentityProviderFromFile","importSocialIdentityProviderFromFile","importSocialIdentityProvidersFromFile","importSocialIdentityProvidersFromFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","file","idpId","getRealm","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/idp/idp-import.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n importFirstSocialIdentityProviderFromFile,\n importSocialIdentityProviderFromFile,\n importSocialIdentityProvidersFromFile,\n importSocialIdentityProvidersFromFiles,\n} from '../../ops/IdpOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo idp import');\n\nprogram\n .description('Import (social) identity providers.')\n .addOption(\n new Option(\n '-i, --idp-id <id>',\n 'Provider 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 the provider(s) from.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Import all the providers from single file. Ignored with -t or -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all the providers from separate files (*.json) in the current directory. Ignored with -t or -i or -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // import by id\n if (options.file && options.idpId && (await getTokens())) {\n verboseMessage(\n `Importing provider \"${\n options.idpId\n }\" into realm \"${state.getRealm()}\"...`\n );\n await importSocialIdentityProviderFromFile(options.idpId, options.file);\n }\n // --all -a\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage(\n `Importing all providers from a single file (${options.file})...`\n );\n await importSocialIdentityProvidersFromFile(options.file);\n }\n // --all-separate -A\n else if (options.allSeparate && !options.file && (await getTokens())) {\n verboseMessage(\n 'Importing all providers from separate files in current directory...'\n );\n await importSocialIdentityProvidersFromFiles();\n }\n // import first provider from file\n else if (options.file && (await getTokens())) {\n verboseMessage(\n `Importing first provider from file \"${\n options.file\n }\" into realm \"${state.getRealm()}\"...`\n );\n await importFirstSocialIdentityProviderFromFile(options.file);\n }\n // unrecognized combination of options or no options\n else {\n printMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,yCAAyC,EACzCC,oCAAoC,EACpCC,qCAAqC,EACrCC,sCAAsC,QACjC,kBAAkB;AACzB,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGV,KAAK,CAACW,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,kBAAkB,CAAC;AAEpDG,OAAO,CACJC,WAAW,CAAC,qCAAqC,CAAC,CAClDC,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,mDACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,kDACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,WAAW,EACX,mEACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,oBAAoB,EACpB,8GACF,CACF,CAAC,CACAa,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJ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","Option","importFirstSocialIdentityProviderFromFile","importSocialIdentityProviderFromFile","importSocialIdentityProvidersFromFile","importSocialIdentityProvidersFromFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","file","idpId","getRealm","deps","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/idp/idp-import.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n importFirstSocialIdentityProviderFromFile,\n importSocialIdentityProviderFromFile,\n importSocialIdentityProvidersFromFile,\n importSocialIdentityProvidersFromFiles,\n} from '../../ops/IdpOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo idp import');\n\nprogram\n .description('Import (social) identity providers.')\n .addOption(\n new Option(\n '-i, --idp-id <id>',\n 'Provider 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 the provider(s) from.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Import all the providers from single file. Ignored with -t or -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all the providers from separate files (*.json) in the current directory. Ignored with -t or -i or -a.'\n )\n )\n .addOption(\n new Option('--no-deps', 'Do not include any dependencies (scripts).')\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // import by id\n if (options.file && options.idpId && (await getTokens())) {\n verboseMessage(\n `Importing provider \"${\n options.idpId\n }\" into realm \"${state.getRealm()}\"...`\n );\n await importSocialIdentityProviderFromFile(\n options.idpId,\n options.file,\n {\n deps: options.deps,\n }\n );\n }\n // --all -a\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage(\n `Importing all providers from a single file (${options.file})...`\n );\n await importSocialIdentityProvidersFromFile(options.file, {\n deps: options.deps,\n });\n }\n // --all-separate -A\n else if (options.allSeparate && !options.file && (await getTokens())) {\n verboseMessage(\n 'Importing all providers from separate files in current directory...'\n );\n await importSocialIdentityProvidersFromFiles({\n deps: options.deps,\n });\n }\n // import first provider from file\n else if (options.file && (await getTokens())) {\n verboseMessage(\n `Importing first provider from file \"${\n options.file\n }\" into realm \"${state.getRealm()}\"...`\n );\n await importFirstSocialIdentityProviderFromFile(options.file, {\n deps: options.deps,\n });\n }\n // unrecognized combination of options or no options\n else {\n printMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,yCAAyC,EACzCC,oCAAoC,EACpCC,qCAAqC,EACrCC,sCAAsC,QACjC,kBAAkB;AACzB,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGV,KAAK,CAACW,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,kBAAkB,CAAC;AAEpDG,OAAO,CACJC,WAAW,CAAC,qCAAqC,CAAC,CAClDC,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,mDACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,kDACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,WAAW,EACX,mEACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,oBAAoB,EACpB,8GACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CAAC,WAAW,EAAE,4CAA4C,CACtE,CAAC,CACAa,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,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G,IAAI,EAAE;MAC5DG,IAAI,EAAEN,OAAO,CAACM;IAChB,CAAC,CAAC;EACJ;EACA;EAAA,KACK;IACHnB,YAAY,CAAC,sDAAsD,CAAC;IACpEK,OAAO,CAACiB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHnB,OAAO,CAACoB,KAAK,CAAC,CAAC"}
@@ -7,29 +7,37 @@ const {
7
7
  getTokens
8
8
  } = frodo.login;
9
9
  const program = new FrodoCommand('frodo saml import');
10
- program.description('Import SAML entity providers.').addOption(new Option('-i, --entity-id <entity-id>', 'Entity id. If specified, only one provider is imported and the options -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import the entity provider(s) from.')).addOption(new Option('-a, --all', 'Import all entity providers from single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Import all entity providers from separate files (*.saml.json) in the current directory. Ignored with -i or -a.')).action(
10
+ program.description('Import SAML entity providers.').addOption(new Option('-i, --entity-id <entity-id>', 'Entity id. If specified, only one provider is imported and the options -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import the entity provider(s) from.')).addOption(new Option('-a, --all', 'Import all entity providers from single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Import all entity providers from separate files (*.saml.json) in the current directory. Ignored with -i or -a.')).addOption(new Option('--no-deps', 'Do not include any dependencies (scripts).')).action(
11
11
  // implement program logic inside action handler
12
12
  async (host, realm, user, password, options, command) => {
13
13
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
14
14
  // import by id
15
15
  if (options.file && options.entityId && (await getTokens())) {
16
16
  verboseMessage(`Importing provider "${options.entityId}" into realm "${state.getRealm()}"...`);
17
- await importSaml2ProviderFromFile(options.entityId, options.file);
17
+ await importSaml2ProviderFromFile(options.entityId, options.file, {
18
+ deps: options.deps
19
+ });
18
20
  }
19
21
  // --all -a
20
22
  else if (options.all && options.file && (await getTokens())) {
21
23
  verboseMessage(`Importing all providers from a single file (${options.file})...`);
22
- await importSaml2ProvidersFromFile(options.file);
24
+ await importSaml2ProvidersFromFile(options.file, {
25
+ deps: options.deps
26
+ });
23
27
  }
24
28
  // --all-separate -A
25
29
  else if (options.allSeparate && !options.file && (await getTokens())) {
26
30
  verboseMessage('Importing all providers from separate files (*.saml.json) in current directory...');
27
- await importSaml2ProvidersFromFiles();
31
+ await importSaml2ProvidersFromFiles({
32
+ deps: options.deps
33
+ });
28
34
  }
29
35
  // import first provider from file
30
36
  else if (options.file && (await getTokens())) {
31
37
  verboseMessage(`Importing first provider from file "${options.file}" into realm "${state.getRealm()}"...`);
32
- await importFirstSaml2ProviderFromFile(options.file);
38
+ await importFirstSaml2ProviderFromFile(options.file, {
39
+ deps: options.deps
40
+ });
33
41
  }
34
42
  // unrecognized combination of options or no options
35
43
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"saml-import.js","names":["frodo","state","Option","importFirstSaml2ProviderFromFile","importSaml2ProviderFromFile","importSaml2ProvidersFromFile","importSaml2ProvidersFromFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","file","entityId","getRealm","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/saml/saml-import.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n importFirstSaml2ProviderFromFile,\n importSaml2ProviderFromFile,\n importSaml2ProvidersFromFile,\n importSaml2ProvidersFromFiles,\n} from '../../ops/Saml2Ops';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo saml import');\n\nprogram\n .description('Import SAML entity providers.')\n .addOption(\n new Option(\n '-i, --entity-id <entity-id>',\n 'Entity id. If specified, only one provider is imported and the options -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to import the entity provider(s) from.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Import all entity providers from single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all entity providers from separate files (*.saml.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .action(\n // implement program logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // import by id\n if (options.file && options.entityId && (await getTokens())) {\n verboseMessage(\n `Importing provider \"${\n options.entityId\n }\" into realm \"${state.getRealm()}\"...`\n );\n await importSaml2ProviderFromFile(options.entityId, options.file);\n }\n // --all -a\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage(\n `Importing all providers from a single file (${options.file})...`\n );\n await importSaml2ProvidersFromFile(options.file);\n }\n // --all-separate -A\n else if (options.allSeparate && !options.file && (await getTokens())) {\n verboseMessage(\n 'Importing all providers from separate files (*.saml.json) in current directory...'\n );\n await importSaml2ProvidersFromFiles();\n }\n // import first provider from file\n else if (options.file && (await getTokens())) {\n verboseMessage(\n `Importing first provider from file \"${\n options.file\n }\" into realm \"${state.getRealm()}\"...`\n );\n await importFirstSaml2ProviderFromFile(options.file);\n }\n // unrecognized combination of options or no options\n else {\n printMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end program logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,gCAAgC,EAChCC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,6BAA6B,QACxB,oBAAoB;AAC3B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGV,KAAK,CAACW,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAA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A6B,CAAC,CAAC;EACvC;EACA;EAAA,KACK,IAAIc,OAAO,CAACG,IAAI,KAAK,MAAMb,SAAS,CAAC,CAAC,CAAC,EAAE;IAC5CF,cAAc,CACX,uCACCY,OAAO,CAACG,IACT,iBAAgBtB,KAAK,CAACwB,QAAQ,CAAC,CAAE,MACpC,CAAC;IACD,MAAMtB,gCAAgC,CAACiB,OAAO,CAACG,IAAI,CAAC;EACtD;EACA;EAAA,KACK;IACHhB,YAAY,CAAC,sDAAsD,CAAC;IACpEK,OAAO,CAACgB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHlB,OAAO,CAACmB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"saml-import.js","names":["frodo","state","Option","importFirstSaml2ProviderFromFile","importSaml2ProviderFromFile","importSaml2ProvidersFromFile","importSaml2ProvidersFromFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","file","entityId","getRealm","deps","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/saml/saml-import.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n importFirstSaml2ProviderFromFile,\n importSaml2ProviderFromFile,\n importSaml2ProvidersFromFile,\n importSaml2ProvidersFromFiles,\n} from '../../ops/Saml2Ops';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo saml import');\n\nprogram\n .description('Import SAML entity providers.')\n .addOption(\n new Option(\n '-i, --entity-id <entity-id>',\n 'Entity id. If specified, only one provider is imported and the options -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to import the entity provider(s) from.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Import all entity providers from single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all entity providers from separate files (*.saml.json) in the current directory. Ignored with -i or -a.'\n )\n )\n .addOption(\n new Option('--no-deps', 'Do not include any dependencies (scripts).')\n )\n .action(\n // implement program logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // import by id\n if (options.file && options.entityId && (await getTokens())) {\n verboseMessage(\n `Importing provider \"${\n options.entityId\n }\" into realm \"${state.getRealm()}\"...`\n );\n await importSaml2ProviderFromFile(options.entityId, options.file, {\n deps: options.deps,\n });\n }\n // --all -a\n else if (options.all && options.file && (await getTokens())) {\n verboseMessage(\n `Importing all providers from a single file (${options.file})...`\n );\n await importSaml2ProvidersFromFile(options.file, {\n deps: options.deps,\n });\n }\n // --all-separate -A\n else if (options.allSeparate && !options.file && (await getTokens())) {\n verboseMessage(\n 'Importing all providers from separate files (*.saml.json) in current directory...'\n );\n await importSaml2ProvidersFromFiles({\n deps: options.deps,\n });\n }\n // import first provider from file\n else if (options.file && (await getTokens())) {\n verboseMessage(\n `Importing first provider from file \"${\n options.file\n }\" into realm \"${state.getRealm()}\"...`\n );\n await importFirstSaml2ProviderFromFile(options.file, {\n deps: options.deps,\n });\n }\n // unrecognized combination of options or no options\n else {\n printMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end program logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,gCAAgC,EAChCC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,6BAA6B,QACxB,oBAAoB;AAC3B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGV,KAAK,CAACW,KAAK;AAEjC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AAEN,OAAO,CAACM;IAChB,CAAC,CAAC;EACJ;EACA;EAAA,KACK,IAAIN,OAAO,CAACQ,WAAW,IAAI,CAACR,OAAO,CAACG,IAAI,KAAK,MAAMb,SAAS,CAAC,CAAC,CAAC,EAAE;IACpEF,cAAc,CACZ,mFACF,CAAC;IACD,MAAMF,6BAA6B,CAAC;MAClCoB,IAAI,EAAEN,OAAO,CAACM;IAChB,CAAC,CAAC;EACJ;EACA;EAAA,KACK,IAAIN,OAAO,CAACG,IAAI,KAAK,MAAMb,SAAS,CAAC,CAAC,CAAC,EAAE;IAC5CF,cAAc,CACX,uCACCY,OAAO,CAACG,IACT,iBAAgBtB,KAAK,CAACwB,QAAQ,CAAC,CAAE,MACpC,CAAC;IACD,MAAMtB,gCAAgC,CAACiB,OAAO,CAACG,IAAI,EAAE;MACnDG,IAAI,EAAEN,OAAO,CAACM;IAChB,CAAC,CAAC;EACJ;EACA;EAAA,KACK;IACHnB,YAAY,CAAC,sDAAsD,CAAC;IACpEK,OAAO,CAACiB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHnB,OAAO,CAACoB,KAAK,CAAC,CAAC"}
@@ -7,30 +7,47 @@ const {
7
7
  getTokens
8
8
  } = frodo.login;
9
9
  const program = new FrodoCommand('frodo service import');
10
- program.description('Import AM services.').addOption(new Option('-i, --service-id <service-id>', 'Service id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import SAML Entity(s) from. Ignored with -A.')).addOption(new Option('-a, --all', 'Import all services from a single file.')).addOption(new Option('-C, --clean', 'Remove existing service(s) before importing.')).addOption(new Option('-A, --all-separate', 'Import all services from separate files <id>.service.json.')).addOption(new Option('-g, --global', 'Import global services.')).action(async (host, realm, user, password, options, command) => {
10
+ program.description('Import AM services.').addOption(new Option('-i, --service-id <service-id>', 'Service id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import SAML Entity(s) from. Ignored with -A.')).addOption(new Option('-a, --all', 'Import all services from a single file.')).addOption(new Option('-C, --clean', 'Remove existing service(s) before importing.')).addOption(new Option('-A, --all-separate', 'Import all services from separate files <id>.service.json.')).addOption(new Option('-g, --global', 'Import service(s) as global service(s).')).addOption(new Option('-r, --current-realm', 'Import service(s) into the current realm.')).action(async (host, realm, user, password, options, command) => {
11
11
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
12
12
  const clean = options.clean ?? false;
13
13
  const globalConfig = options.global ?? false;
14
+ const realmConfig = options.realm ?? false;
14
15
 
15
16
  // import by id
16
17
  if (options.serviceId && options.file && (await getTokens())) {
17
18
  verboseMessage('Importing service...');
18
- await importServiceFromFile(options.serviceId, options.file, clean, globalConfig);
19
+ await importServiceFromFile(options.serviceId, options.file, {
20
+ clean,
21
+ global: globalConfig,
22
+ realm: realmConfig
23
+ });
19
24
  }
20
25
  // -a / --all
21
26
  else if (options.all && options.file && (await getTokens())) {
22
27
  verboseMessage('Importing all services from a single file...');
23
- await importServicesFromFile(options.file, clean, globalConfig);
28
+ await importServicesFromFile(options.file, {
29
+ clean,
30
+ global: globalConfig,
31
+ realm: realmConfig
32
+ });
24
33
  }
25
34
  // -A / --all-separate
26
35
  else if (options.allSeparate && (await getTokens())) {
27
36
  verboseMessage('Importing all services from separate files...');
28
- await importServicesFromFiles(clean, globalConfig);
37
+ await importServicesFromFiles({
38
+ clean,
39
+ global: globalConfig,
40
+ realm: realmConfig
41
+ });
29
42
  }
30
43
  // import file
31
44
  else if (options.file && (await getTokens())) {
32
45
  verboseMessage('Importing service...');
33
- await importFirstServiceFromFile(options.file, clean, globalConfig);
46
+ await importFirstServiceFromFile(options.file, {
47
+ clean,
48
+ global: globalConfig,
49
+ realm: realmConfig
50
+ });
34
51
  }
35
52
  // unrecognized combination of options or no options
36
53
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"service-import.js","names":["frodo","Option","importFirstServiceFromFile","importServiceFromFile","importServicesFromFile","importServicesFromFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","clean","globalConfig","global","serviceId","file","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/service/service-import.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n importFirstServiceFromFile,\n importServiceFromFile,\n importServicesFromFile,\n importServicesFromFiles,\n} from '../../ops/ServiceOps.js';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo service import');\n\ninterface ServiceImportOptions {\n file?: string;\n all?: boolean;\n serviceId?: string;\n allSeparate?: boolean;\n type?: string;\n insecure?: boolean;\n clean?: boolean;\n directory?: string;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n global?: boolean;\n}\n\nprogram\n .description('Import AM services.')\n .addOption(\n new Option(\n '-i, --service-id <service-id>',\n 'Service id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to import SAML Entity(s) from. Ignored with -A.'\n )\n )\n .addOption(new Option('-a, --all', 'Import all services from a single file.'))\n .addOption(\n new Option('-C, --clean', 'Remove existing service(s) before importing.')\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all services from separate files <id>.service.json.'\n )\n )\n .addOption(new Option('-g, --global', 'Import global services.'))\n .action(\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: ServiceImportOptions,\n command\n ) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n\n const clean = options.clean ?? false;\n const globalConfig = options.global ?? false;\n\n // import by id\n if (options.serviceId && options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n await importServiceFromFile(\n options.serviceId,\n options.file,\n clean,\n globalConfig\n );\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, globalConfig);\n }\n // -A / --all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Importing all services from separate files...');\n await importServicesFromFiles(clean, globalConfig);\n }\n // import file\n else if (options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n await importFirstServiceFromFile(options.file, clean, globalConfig);\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,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,0BAA0B,EAC1BC,qBAAqB,EACrBC,sBAAsB,EACtBC,uBAAuB,QAClB,yBAAyB;AAChC,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGT,KAAK,CAACU,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,sBAAsB,CAAC;AAiBxDG,OAAO,CACJC,WAAW,CAAC,qBAAqB,CAAC,CAClCC,SAAS,CACR,IAAIZ,MAAM,CACR,+BAA+B,EAC/B,kDACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,kEACF,CACF,CAAC,CACAY,SAAS,CAAC,IAAIZ,MAAM,CAAC,WAAW,EAAE,yCAAyC,CAAC,CAAC,CAC7EY,SAAS,CACR,IAAIZ,MAAM,CAAC,aAAa,EAAE,8CAA8C,CAC1E,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,oBAAoB,EACpB,4DACF,CACF,CAAC,CACAY,SAAS,CAAC,IAAIZ,MAAM,CAAC,cAAc,EAAE,yBAAyB,CAAC,CAAC,CAChEa,MAAM,CACL,OACEC,IAAY,EAC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AO,CAACkB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHpB,OAAO,CAACqB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"service-import.js","names":["frodo","Option","importFirstServiceFromFile","importServiceFromFile","importServicesFromFile","importServicesFromFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","clean","globalConfig","global","realmConfig","serviceId","file","all","allSeparate","help","process","exitCode","parse"],"sources":["../../../src/cli/service/service-import.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n importFirstServiceFromFile,\n importServiceFromFile,\n importServicesFromFile,\n importServicesFromFiles,\n} from '../../ops/ServiceOps.js';\nimport { printMessage, verboseMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo service import');\n\ninterface ServiceImportOptions {\n file?: string;\n all?: boolean;\n serviceId?: string;\n allSeparate?: boolean;\n type?: string;\n insecure?: boolean;\n clean?: boolean;\n directory?: string;\n verbose?: boolean;\n debug?: boolean;\n curlirize?: boolean;\n global?: boolean;\n realm?: boolean;\n}\n\nprogram\n .description('Import AM services.')\n .addOption(\n new Option(\n '-i, --service-id <service-id>',\n 'Service id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to import SAML Entity(s) from. Ignored with -A.'\n )\n )\n .addOption(new Option('-a, --all', 'Import all services from a single file.'))\n .addOption(\n new Option('-C, --clean', 'Remove existing service(s) before importing.')\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all services from separate files <id>.service.json.'\n )\n )\n .addOption(\n new Option('-g, --global', 'Import service(s) as global service(s).')\n )\n .addOption(\n new Option(\n '-r, --current-realm',\n 'Import service(s) into the current realm.'\n )\n )\n .action(\n async (\n host: string,\n realm: string,\n user: string,\n password: string,\n options: ServiceImportOptions,\n command\n ) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n\n const clean = options.clean ?? false;\n const globalConfig = options.global ?? false;\n const realmConfig = options.realm ?? false;\n\n // import by id\n if (options.serviceId && options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n await importServiceFromFile(options.serviceId, options.file, {\n clean,\n global: globalConfig,\n realm: realmConfig,\n });\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, {\n clean,\n global: globalConfig,\n realm: realmConfig,\n });\n }\n // -A / --all-separate\n else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Importing all services from separate files...');\n await importServicesFromFiles({\n clean,\n global: globalConfig,\n realm: realmConfig,\n });\n }\n // import file\n else if (options.file && (await getTokens())) {\n verboseMessage('Importing service...');\n await importFirstServiceFromFile(options.file, {\n clean,\n global: globalConfig,\n realm: realmConfig,\n });\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,0BAA0B,EAC1BC,qBAAqB,EACrBC,sBAAsB,EACtBC,uBAAuB,QAClB,yBAAyB;AAChC,SAASC,YAAY,EAAEC,cAAc,QAAQ,wBAAwB;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGT,KAAK,CAACU,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,sBAAsB,CAAC;AAkBxDG,OAAO,CACJC,WAAW,CAAC,qBAAqB,CAAC,CAClCC,SAAS,CACR,IAAIZ,MAAM,CACR,+BAA+B,E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E;IAC3DF,cAAc,CAAC,8CAA8C,CAAC;IAC9D,MAAMH,sBAAsB,CAACe,OAAO,CAACQ,IAAI,EAAE;MACzCL,KAAK;MACLE,MAAM,EAAED,YAAY;MACpBP,KAAK,EAAES;IACT,CAAC,CAAC;EACJ;EACA;EAAA,KACK,IAAIN,OAAO,CAACU,WAAW,KAAK,MAAMpB,SAAS,CAAC,CAAC,CAAC,EAAE;IACnDF,cAAc,CAAC,+CAA+C,CAAC;IAC/D,MAAMF,uBAAuB,CAAC;MAC5BiB,KAAK;MACLE,MAAM,EAAED,YAAY;MACpBP,KAAK,EAAES;IACT,CAAC,CAAC;EACJ;EACA;EAAA,KACK,IAAIN,OAAO,CAACQ,IAAI,KAAK,MAAMlB,SAAS,CAAC,CAAC,CAAC,EAAE;IAC5CF,cAAc,CAAC,sBAAsB,CAAC;IACtC,MAAML,0BAA0B,CAACiB,OAAO,CAACQ,IAAI,EAAE;MAC7CL,KAAK;MACLE,MAAM,EAAED,YAAY;MACpBP,KAAK,EAAES;IACT,CAAC,CAAC;EACJ;EACA;EAAA,KACK;IACHnB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;IACDK,OAAO,CAACmB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;AAEHrB,OAAO,CAACsB,KAAK,CAAC,CAAC"}
@@ -302,7 +302,7 @@ export async function importApplicationsFromFiles(options = {
302
302
  try {
303
303
  const data = fs.readFileSync(file, 'utf8');
304
304
  const fileData = JSON.parse(data);
305
- const count = Object.keys(fileData.application).length;
305
+ const count = Object.keys(fileData.managedApplication).length;
306
306
  total += count;
307
307
  await _importApplications(fileData, options);
308
308
  updateProgressIndicator(barId, `Imported ${count} application(s) from ${file}`);
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationOps.js","names":["frodo","state","fs","createProgressIndicator","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressIndicator","succeedSpinner","updateProgressIndicator","wordwrap","getTypedFilename","titleCase","getFilePath","getWorkingDirectory","saveJsonToFile","utils","readApplications","_readApplications","deleteApplicationByName","_deleteApplicationByName","deleteApplications","_deleteApplications","exportApplication","_exportApplication","exportApplicationByName","_exportApplicationByName","exportApplications","_exportApplications","importApplicationByName","_importApplicationByName","importFirstApplication","_importFirstApplication","importApplications","_importApplications","app","listApplications","long","applications","sort","a","b","name","localeCompare","table","hAlign","content","forEach","push","_id","templateName","templateVersion","authoritative","description","toString","error","deleteApplication","applicationName","deep","outcome","message","deleted","length","exportApplicationToFile","file","includeMeta","options","useStringArrays","deps","fileName","filePath","exportData","exportApplicationsToFile","getRealmName","getRealm","exportApplicationsToFiles","errors","barId","application","fileBarId","importApplicationFromFile","data","readFileSync","fileData","JSON","parse","importFirstApplicationFromFile","importApplicationsFromFile","applicationData","importApplicationsFromFiles","names","readdirSync","files","filter","toLowerCase","endsWith","map","total","count","Object","keys"],"sources":["../../src/ops/ApplicationOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport type {\n ApplicationExportInterface,\n ApplicationExportOptions,\n ApplicationImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/ApplicationOps';\nimport fs from 'fs';\n\nimport {\n createProgressIndicator,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressIndicator,\n succeedSpinner,\n updateProgressIndicator,\n} from '../utils/Console';\nimport wordwrap from './utils/Wordwrap';\n\nconst {\n getTypedFilename,\n titleCase,\n getFilePath,\n getWorkingDirectory,\n saveJsonToFile,\n} = frodo.utils;\nconst {\n readApplications: _readApplications,\n deleteApplicationByName: _deleteApplicationByName,\n deleteApplications: _deleteApplications,\n exportApplication: _exportApplication,\n exportApplicationByName: _exportApplicationByName,\n exportApplications: _exportApplications,\n importApplicationByName: _importApplicationByName,\n importFirstApplication: _importFirstApplication,\n importApplications: _importApplications,\n} = frodo.app;\n\n/**\n * List applications\n */\nexport async function listApplications(long = false) {\n try {\n const applications = await _readApplications();\n applications.sort((a, b) => a.name.localeCompare(b.name));\n if (long) {\n const table = createTable([\n 'Name',\n 'Id',\n 'Template',\n {\n hAlign: 'right',\n content: 'Version',\n },\n {\n hAlign: 'right',\n content: 'Authoritative',\n },\n 'Description',\n ]);\n applications.forEach((app) => {\n table.push([\n app.name,\n app._id,\n app.templateName,\n {\n hAlign: 'right',\n content: app.templateVersion,\n },\n {\n hAlign: 'right',\n content: app.authoritative,\n },\n wordwrap(app.description, 30),\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n applications.forEach((app) => {\n printMessage(`${app.name}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing applications - ${error}`, 'error');\n }\n}\n\n/**\n * Delete application\n * @param {string} applicationName application name\n * @param {boolean} deep deep delete (include dependencies)\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteApplication(\n applicationName: string,\n deep: boolean\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.deleteApplication: begin`);\n showSpinner(`Deleting ${applicationName}...`);\n try {\n await _deleteApplicationByName(applicationName, deep);\n outcome = true;\n succeedSpinner(`Deleted ${applicationName}`);\n } catch (error) {\n failSpinner(`Error deleting ${applicationName}: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.deleteApplication: end`);\n return outcome;\n}\n\n/**\n * Delete all applications\n * @param {boolean} deep deep delete (include dependencies)\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteApplications(deep: boolean): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.deleteApplications: begin`);\n showSpinner(`Deleting all applications...`);\n try {\n const deleted = await _deleteApplications(deep);\n outcome = true;\n succeedSpinner(`Deleted ${deleted.length} applications`);\n } catch (error) {\n failSpinner(`Error deleting applications: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.deleteApplications: end`);\n return outcome;\n}\n\n/**\n * Export application to file\n * @param {string} applicationName application name\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationToFile(\n applicationName: string,\n file: string,\n includeMeta: boolean,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n) {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.exportApplicationToFile: begin`);\n showSpinner(`Exporting ${applicationName}...`);\n try {\n let fileName = getTypedFilename(applicationName, 'application');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await _exportApplicationByName(applicationName, options);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported ${applicationName} to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${applicationName}: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.exportApplicationToFile: end`);\n return outcome;\n}\n\n/**\n * Export all applications to file\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationsToFile(\n file: string,\n includeMeta: boolean,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.exportApplicationsToFile: begin`);\n showSpinner(`Exporting all applications...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(frodo.utils.getRealmName(state.getRealm()))}Applications`,\n 'application'\n );\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await _exportApplications(options);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported all applications to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting all applications`);\n printMessage(`${error.message}`, 'error');\n }\n debugMessage(`cli.ApplicationOps.exportApplicationsToFile: end [${outcome}]`);\n return outcome;\n}\n\n/**\n * Export all applications to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationsToFiles(\n includeMeta: boolean,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n) {\n debugMessage(`cli.ApplicationOps.exportApplicationsToFiles: begin`);\n const errors = [];\n let barId: string;\n try {\n const applications = await _readApplications();\n barId = createProgressIndicator(\n 'determinate',\n applications.length,\n 'Exporting applications...'\n );\n for (const application of applications) {\n const fileBarId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting application ${application.name}...`\n );\n const file = getFilePath(\n getTypedFilename(application.name, 'application'),\n true\n );\n try {\n updateProgressIndicator(barId, `Exporting ${application.name}.`);\n const exportData = await _exportApplication(application._id, options);\n saveJsonToFile(exportData, file, includeMeta);\n updateProgressIndicator(\n fileBarId,\n `Saving ${application.name} to ${file}.`\n );\n stopProgressIndicator(\n fileBarId,\n `${application.name} saved to ${file}.`\n );\n } catch (error) {\n errors.push(error);\n updateProgressIndicator(barId, `Error exporting ${application.name}.`);\n stopProgressIndicator(\n fileBarId,\n `Error saving ${application.name} to ${file}.`\n );\n }\n }\n stopProgressIndicator(barId, `Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressIndicator(barId, `Error exporting applications(s) to file(s)`);\n }\n debugMessage(`cli.ApplicationOps.exportApplicationsToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import application from file\n * @param {string} applicationName client id\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationFromFile(\n applicationName: string,\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importApplicationFromFile: begin`);\n showSpinner(`Importing ${applicationName}...`);\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await _importApplicationByName(applicationName, fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${applicationName}.`);\n } catch (error) {\n failSpinner(`Error importing ${applicationName}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first application from file\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstApplicationFromFile(\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: begin`);\n const filePath = getFilePath(file);\n showSpinner(`Importing ${filePath}...`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n await _importFirstApplication(fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${filePath}.`);\n } catch (error) {\n failSpinner(`Error importing ${filePath}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: end`);\n return outcome;\n}\n\n/**\n * Import applications from file\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationsFromFile(\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importApplicationsFromFile: begin`);\n const filePath = getFilePath(file);\n showSpinner(`Importing ${filePath}...`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const applicationData = JSON.parse(data);\n await _importApplications(applicationData, options);\n outcome = true;\n succeedSpinner(`Imported ${filePath}.`);\n } catch (error) {\n failSpinner(`Error importing ${filePath}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationsFromFile: end`);\n return outcome;\n}\n\n/**\n * Import applications from files\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationsFromFiles(\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n const errors = [];\n let barId: string;\n try {\n debugMessage(`cli.ApplicationOps.importApplicationsFromFiles: begin`);\n const names = fs.readdirSync(getWorkingDirectory());\n const files = names\n .filter((name) => name.toLowerCase().endsWith('.application.json'))\n .map((name) => getFilePath(name));\n barId = createProgressIndicator(\n 'determinate',\n files.length,\n 'Importing applications...'\n );\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: ApplicationExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.application).length;\n total += count;\n await _importApplications(fileData, options);\n updateProgressIndicator(\n barId,\n `Imported ${count} application(s) from ${file}`\n );\n } catch (error) {\n errors.push(error);\n updateProgressIndicator(\n barId,\n `Error importing application(s) from ${file}`\n );\n printMessage(error, 'error');\n }\n }\n stopProgressIndicator(\n barId,\n `Finished importing ${total} application(s) from ${files.length} file(s).`\n );\n } catch (error) {\n errors.push(error);\n stopProgressIndicator(\n barId,\n `Error importing application(s) from file(s).`\n );\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationsFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAMpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,qBAAqB,EACrBC,cAAc,EACdC,uBAAuB,QAClB,kBAAkB;AACzB,OAAOC,QAAQ,MAAM,kBAAkB;AAEvC,MAAM;EACJC,gBAAgB;EAChBC,SAAS;EACTC,WAAW;EACXC,mBAAmB;EACnBC;AACF,CAAC,GAAGjB,KAAK,CAACkB,KAAK;AACf,MAAM;EACJC,gBAAgB,EAAEC,iBAAiB;EACnCC,uBAAuB,EAAEC,wBAAwB;EACjDC,kBAAkB,EAAEC,mBAAmB;EACvCC,iBAAiB,EAAEC,kBAAkB;EACrCC,uBAAuB,EAAEC,wBAAwB;EACjDC,kBAAkB,EAAEC,mBA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AY,CAAE,qDAAoD,CAAC;EACnE,OAAO,CAAC,KAAKyE,MAAM,CAACd,MAAM;AAC5B"}
1
+ {"version":3,"file":"ApplicationOps.js","names":["frodo","state","fs","createProgressIndicator","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressIndicator","succeedSpinner","updateProgressIndicator","wordwrap","getTypedFilename","titleCase","getFilePath","getWorkingDirectory","saveJsonToFile","utils","readApplications","_readApplications","deleteApplicationByName","_deleteApplicationByName","deleteApplications","_deleteApplications","exportApplication","_exportApplication","exportApplicationByName","_exportApplicationByName","exportApplications","_exportApplications","importApplicationByName","_importApplicationByName","importFirstApplication","_importFirstApplication","importApplications","_importApplications","app","listApplications","long","applications","sort","a","b","name","localeCompare","table","hAlign","content","forEach","push","_id","templateName","templateVersion","authoritative","description","toString","error","deleteApplication","applicationName","deep","outcome","message","deleted","length","exportApplicationToFile","file","includeMeta","options","useStringArrays","deps","fileName","filePath","exportData","exportApplicationsToFile","getRealmName","getRealm","exportApplicationsToFiles","errors","barId","application","fileBarId","importApplicationFromFile","data","readFileSync","fileData","JSON","parse","importFirstApplicationFromFile","importApplicationsFromFile","applicationData","importApplicationsFromFiles","names","readdirSync","files","filter","toLowerCase","endsWith","map","total","count","Object","keys","managedApplication"],"sources":["../../src/ops/ApplicationOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport type {\n ApplicationExportInterface,\n ApplicationExportOptions,\n ApplicationImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/ApplicationOps';\nimport fs from 'fs';\n\nimport {\n createProgressIndicator,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressIndicator,\n succeedSpinner,\n updateProgressIndicator,\n} from '../utils/Console';\nimport wordwrap from './utils/Wordwrap';\n\nconst {\n getTypedFilename,\n titleCase,\n getFilePath,\n getWorkingDirectory,\n saveJsonToFile,\n} = frodo.utils;\nconst {\n readApplications: _readApplications,\n deleteApplicationByName: _deleteApplicationByName,\n deleteApplications: _deleteApplications,\n exportApplication: _exportApplication,\n exportApplicationByName: _exportApplicationByName,\n exportApplications: _exportApplications,\n importApplicationByName: _importApplicationByName,\n importFirstApplication: _importFirstApplication,\n importApplications: _importApplications,\n} = frodo.app;\n\n/**\n * List applications\n */\nexport async function listApplications(long = false) {\n try {\n const applications = await _readApplications();\n applications.sort((a, b) => a.name.localeCompare(b.name));\n if (long) {\n const table = createTable([\n 'Name',\n 'Id',\n 'Template',\n {\n hAlign: 'right',\n content: 'Version',\n },\n {\n hAlign: 'right',\n content: 'Authoritative',\n },\n 'Description',\n ]);\n applications.forEach((app) => {\n table.push([\n app.name,\n app._id,\n app.templateName,\n {\n hAlign: 'right',\n content: app.templateVersion,\n },\n {\n hAlign: 'right',\n content: app.authoritative,\n },\n wordwrap(app.description, 30),\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n applications.forEach((app) => {\n printMessage(`${app.name}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing applications - ${error}`, 'error');\n }\n}\n\n/**\n * Delete application\n * @param {string} applicationName application name\n * @param {boolean} deep deep delete (include dependencies)\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteApplication(\n applicationName: string,\n deep: boolean\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.deleteApplication: begin`);\n showSpinner(`Deleting ${applicationName}...`);\n try {\n await _deleteApplicationByName(applicationName, deep);\n outcome = true;\n succeedSpinner(`Deleted ${applicationName}`);\n } catch (error) {\n failSpinner(`Error deleting ${applicationName}: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.deleteApplication: end`);\n return outcome;\n}\n\n/**\n * Delete all applications\n * @param {boolean} deep deep delete (include dependencies)\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteApplications(deep: boolean): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.deleteApplications: begin`);\n showSpinner(`Deleting all applications...`);\n try {\n const deleted = await _deleteApplications(deep);\n outcome = true;\n succeedSpinner(`Deleted ${deleted.length} applications`);\n } catch (error) {\n failSpinner(`Error deleting applications: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.deleteApplications: end`);\n return outcome;\n}\n\n/**\n * Export application to file\n * @param {string} applicationName application name\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationToFile(\n applicationName: string,\n file: string,\n includeMeta: boolean,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n) {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.exportApplicationToFile: begin`);\n showSpinner(`Exporting ${applicationName}...`);\n try {\n let fileName = getTypedFilename(applicationName, 'application');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await _exportApplicationByName(applicationName, options);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported ${applicationName} to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${applicationName}: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.exportApplicationToFile: end`);\n return outcome;\n}\n\n/**\n * Export all applications to file\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationsToFile(\n file: string,\n includeMeta: boolean,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.exportApplicationsToFile: begin`);\n showSpinner(`Exporting all applications...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(frodo.utils.getRealmName(state.getRealm()))}Applications`,\n 'application'\n );\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await _exportApplications(options);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported all applications to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting all applications`);\n printMessage(`${error.message}`, 'error');\n }\n debugMessage(`cli.ApplicationOps.exportApplicationsToFile: end [${outcome}]`);\n return outcome;\n}\n\n/**\n * Export all applications to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationsToFiles(\n includeMeta: boolean,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n) {\n debugMessage(`cli.ApplicationOps.exportApplicationsToFiles: begin`);\n const errors = [];\n let barId: string;\n try {\n const applications = await _readApplications();\n barId = createProgressIndicator(\n 'determinate',\n applications.length,\n 'Exporting applications...'\n );\n for (const application of applications) {\n const fileBarId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting application ${application.name}...`\n );\n const file = getFilePath(\n getTypedFilename(application.name, 'application'),\n true\n );\n try {\n updateProgressIndicator(barId, `Exporting ${application.name}.`);\n const exportData = await _exportApplication(application._id, options);\n saveJsonToFile(exportData, file, includeMeta);\n updateProgressIndicator(\n fileBarId,\n `Saving ${application.name} to ${file}.`\n );\n stopProgressIndicator(\n fileBarId,\n `${application.name} saved to ${file}.`\n );\n } catch (error) {\n errors.push(error);\n updateProgressIndicator(barId, `Error exporting ${application.name}.`);\n stopProgressIndicator(\n fileBarId,\n `Error saving ${application.name} to ${file}.`\n );\n }\n }\n stopProgressIndicator(barId, `Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressIndicator(barId, `Error exporting applications(s) to file(s)`);\n }\n debugMessage(`cli.ApplicationOps.exportApplicationsToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import application from file\n * @param {string} applicationName client id\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationFromFile(\n applicationName: string,\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importApplicationFromFile: begin`);\n showSpinner(`Importing ${applicationName}...`);\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await _importApplicationByName(applicationName, fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${applicationName}.`);\n } catch (error) {\n failSpinner(`Error importing ${applicationName}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first application from file\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstApplicationFromFile(\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: begin`);\n const filePath = getFilePath(file);\n showSpinner(`Importing ${filePath}...`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n await _importFirstApplication(fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${filePath}.`);\n } catch (error) {\n failSpinner(`Error importing ${filePath}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: end`);\n return outcome;\n}\n\n/**\n * Import applications from file\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationsFromFile(\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importApplicationsFromFile: begin`);\n const filePath = getFilePath(file);\n showSpinner(`Importing ${filePath}...`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const applicationData = JSON.parse(data);\n await _importApplications(applicationData, options);\n outcome = true;\n succeedSpinner(`Imported ${filePath}.`);\n } catch (error) {\n failSpinner(`Error importing ${filePath}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationsFromFile: end`);\n return outcome;\n}\n\n/**\n * Import applications from files\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationsFromFiles(\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n const errors = [];\n let barId: string;\n try {\n debugMessage(`cli.ApplicationOps.importApplicationsFromFiles: begin`);\n const names = fs.readdirSync(getWorkingDirectory());\n const files = names\n .filter((name) => name.toLowerCase().endsWith('.application.json'))\n .map((name) => getFilePath(name));\n barId = createProgressIndicator(\n 'determinate',\n files.length,\n 'Importing applications...'\n );\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: ApplicationExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.managedApplication).length;\n total += count;\n await _importApplications(fileData, options);\n updateProgressIndicator(\n barId,\n `Imported ${count} application(s) from ${file}`\n );\n } catch (error) {\n errors.push(error);\n updateProgressIndicator(\n barId,\n `Error importing application(s) from ${file}`\n );\n printMessage(error, 'error');\n }\n }\n stopProgressIndicator(\n barId,\n `Finished importing ${total} application(s) from ${files.length} file(s).`\n );\n } catch (error) {\n errors.push(error);\n stopProgressIndicator(\n barId,\n `Error importing application(s) from file(s).`\n );\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationsFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAMpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,qBAAqB,EACrBC,cAAc,EACdC,uBAAuB,QAClB,kBAAkB;AACzB,OAAOC,QAAQ,MAAM,kBAAkB;AAEvC,MAAM;EACJC,gBAAgB;EAChBC,SAAS;EACTC,WAAW;EACXC,mBAAmB;EACnBC;AACF,CAAC,GAAGjB,KAAK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B,MAAO,WAClE,CAAC;EACH,CAAC,CAAC,OAAOP,KAAK,EAAE;IACdqB,MAAM,CAAC5B,IAAI,CAACO,KAAK,CAAC;IAClBhD,qBAAqB,CACnBsE,KAAK,EACJ,8CACH,CAAC;IACDxE,YAAY,CAACkD,KAAK,EAAE,OAAO,CAAC;EAC9B;EACApD,YAAY,CAAE,qDAAoD,CAAC;EACnE,OAAO,CAAC,KAAKyE,MAAM,CAACd,MAAM;AAC5B"}
@@ -1,6 +1,7 @@
1
1
  import { frodo, state } from '@rockcarver/frodo-lib';
2
2
  import fs from 'fs';
3
3
  import fse from 'fs-extra';
4
+ import { getFullExportConfig, getFullExportConfigFromDirectory } from '../utils/Config';
4
5
  import { printMessage } from '../utils/Console';
5
6
  import { extractScriptToFile } from './ScriptOps';
6
7
  const {
@@ -12,7 +13,8 @@ const {
12
13
  getWorkingDirectory
13
14
  } = frodo.utils;
14
15
  const {
15
- exportFullConfiguration
16
+ exportFullConfiguration,
17
+ importFullConfiguration
16
18
  } = frodo.config;
17
19
  const {
18
20
  stringify
@@ -20,7 +22,7 @@ const {
20
22
 
21
23
  /**
22
24
  * Export everything to separate files
23
- * @param file file name
25
+ * @param {String} file file name
24
26
  * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
25
27
  * @param {FullExportOptions} options export options
26
28
  */
@@ -38,7 +40,7 @@ export async function exportEverythingToFile(file, includeMeta = true, options =
38
40
 
39
41
  /**
40
42
  * Export everything to separate files
41
- * @param extract Extracts the scripts from the exports into separate files if true
43
+ * @param {boolean} extract Extracts the scripts from the exports into separate files if true
42
44
  * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
43
45
  * @param {FullExportOptions} options export options
44
46
  */
@@ -127,4 +129,34 @@ export async function exportEverythingToFiles(extract = false, includeMeta = tru
127
129
  }
128
130
  });
129
131
  }
132
+
133
+ /**
134
+ * Import everything from a single file
135
+ * @param {String} file The file path
136
+ * @param {FullImportOptions} options import options
137
+ */
138
+ export async function importEverythingFromFile(file, options = {
139
+ reUuidJourneys: false,
140
+ reUuidScripts: false,
141
+ cleanServices: false,
142
+ global: false,
143
+ realm: false
144
+ }) {
145
+ const data = await getFullExportConfig(file);
146
+ await importFullConfiguration(data, options);
147
+ }
148
+
149
+ /**
150
+ * Import everything from separate files
151
+ */
152
+ export async function importEverythingFromFiles(options = {
153
+ reUuidJourneys: false,
154
+ reUuidScripts: false,
155
+ cleanServices: false,
156
+ global: false,
157
+ realm: false
158
+ }) {
159
+ const data = await getFullExportConfigFromDirectory(state.getDirectory());
160
+ await importFullConfiguration(data, options);
161
+ }
130
162
  //# sourceMappingURL=ConfigOps.js.map