@rockcarver/frodo-cli 0.15.1 → 0.16.1
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 +40 -1
- package/esm/cli/cmd_common.js +6 -7
- package/esm/cli/cmd_common.js.map +1 -1
- package/esm/cli/journey/journey-describe.js +3 -3
- package/esm/cli/journey/journey-describe.js.map +1 -1
- package/esm/cli/theme/theme-import.js +3 -1
- package/esm/cli/theme/theme-import.js.map +1 -1
- package/esm/utils/Console.js +41 -3
- package/esm/utils/Console.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.16.1] - 2022-10-11
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Updated frodo-lib to 0.14.1
|
|
15
|
+
- Release name is now prefixed with `Frodo CLI` for clarity in notifications.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- rockcarver/frodo-cli#70: Added ability to create custom logging noise filters
|
|
20
|
+
- \#76, #77, #78, #79: `frodo theme import` command now supports `--debug` and `--verbose` flags. Other commands may register the new cli options as well. Most output is expected to come from the library layer but cli commands may also issue `verbose` and `debug` message.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- rockcarver/frodo-lib#116: Frodo now properly imports themes.
|
|
25
|
+
|
|
26
|
+
## [0.16.0] - 2022-10-11
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- Updated frodo-lib to 0.14.0
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- rockcarver/frodo-cli#70: Added ability to create custom logging noise filters
|
|
35
|
+
- \#76, #77, #78, #79: `frodo theme import` command now supports `--debug` and `--verbose` flags. Other commands may register the new cli options as well. Most output is expected to come from the library layer but cli commands may also issue `verbose` and `debug` message.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- rockcarver/frodo-lib#116: Frodo now properly imports themes.
|
|
40
|
+
|
|
10
41
|
## [0.15.1] - 2022-10-05
|
|
11
42
|
|
|
12
43
|
### Fixed
|
|
@@ -15,6 +46,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
15
46
|
|
|
16
47
|
## [0.15.1-0] - 2022-10-04
|
|
17
48
|
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- Updated frodo-lib to 0.13.1-0
|
|
52
|
+
|
|
18
53
|
### Added
|
|
19
54
|
|
|
20
55
|
- \#70: Added ability to create custom logging noise filters
|
|
@@ -614,7 +649,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
614
649
|
- Fixed problem with adding connection profiles
|
|
615
650
|
- Miscellaneous bug fixes
|
|
616
651
|
|
|
617
|
-
[Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.
|
|
652
|
+
[Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.16.1...HEAD
|
|
653
|
+
|
|
654
|
+
[0.16.1]: https://github.com/rockcarver/frodo-cli/compare/v0.16.0...v0.16.1
|
|
655
|
+
|
|
656
|
+
[0.16.0]: https://github.com/rockcarver/frodo-cli/compare/v0.15.1...v0.16.0
|
|
618
657
|
|
|
619
658
|
[0.15.1]: https://github.com/rockcarver/frodo-cli/compare/v0.15.1-0...v0.15.1
|
|
620
659
|
|
package/esm/cli/cmd_common.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Argument, Option } from 'commander';
|
|
2
2
|
import { state } from '@rockcarver/frodo-lib';
|
|
3
3
|
import * as global from '../storage/StaticStorage.js';
|
|
4
|
-
import { printMessage, createProgressIndicator, updateProgressIndicator, stopProgressIndicator } from '../utils/Console.js';
|
|
4
|
+
import { printMessage, createProgressIndicator, updateProgressIndicator, stopProgressIndicator, verbose, debug } from '../utils/Console.js';
|
|
5
5
|
state.default.session.setPrintHandler(printMessage);
|
|
6
6
|
state.default.session.setCreateProgressHandler(createProgressIndicator);
|
|
7
7
|
state.default.session.setUpdateProgressHandler(updateProgressIndicator);
|
|
8
|
-
state.default.session.setStopProgressHandler(stopProgressIndicator);
|
|
8
|
+
state.default.session.setStopProgressHandler(stopProgressIndicator);
|
|
9
|
+
state.default.session.setVerboseHandler(verbose);
|
|
10
|
+
state.default.session.setDebugHandler(debug); // pseudo functions for commands that do not otherwise need to import
|
|
9
11
|
// this file but need to trigger print and progress handler registration
|
|
10
12
|
|
|
11
13
|
export function init() {}
|
|
@@ -41,10 +43,8 @@ to walk through the tenant admin login flow of Identity Cloud and handle MFA';
|
|
|
41
43
|
export const deploymentOption = new Option('-m, --type <type>', deploymentOptionDescription).choices(global.DEPLOYMENT_TYPES);
|
|
42
44
|
export const deploymentOptionM = new Option('-m, --type <type>', deploymentOptionDescription).choices(global.DEPLOYMENT_TYPES);
|
|
43
45
|
export const insecureOption = new Option('-k, --insecure', 'Allow insecure connections when using SSL/TLS. Has no effect when using a network proxy for https (HTTPS_PROXY=http://<host>:<port>), in that case the proxy must provide this capability.').default(false, "Don't allow insecure connections");
|
|
44
|
-
export const
|
|
45
|
-
|
|
46
|
-
export const nameOptionM = new Option('-N, --name <name>', 'Config entity name to be exported or imported/updated. Examples are \
|
|
47
|
-
managed, sync, provisioner-xxxx, etc.');
|
|
46
|
+
export const verboseOption = new Option('--verbose', 'Verbose output during command execution. If specified, may or may not produce additional output.');
|
|
47
|
+
export const debugOption = new Option('--debug', 'Debug output during command execution. If specified, may or may not produce additional output helpful for troubleshooting.');
|
|
48
48
|
export const managedNameOption = new Option('-N, --name <name>', 'Managed object name to be operated on. Examples are \
|
|
49
49
|
user, role, alpha_user, alpha_role etc.');
|
|
50
50
|
export const managedNameOptionM = new Option('-N, --name <name>', 'Managed object name to be operated on. Examples are \
|
|
@@ -68,7 +68,6 @@ bearer token: \n\
|
|
|
68
68
|
treeOptionM.makeOptionMandatory();
|
|
69
69
|
fileOptionM.makeOptionMandatory();
|
|
70
70
|
deploymentOptionM.makeOptionMandatory();
|
|
71
|
-
nameOptionM.makeOptionMandatory();
|
|
72
71
|
dirOptionM.makeOptionMandatory();
|
|
73
72
|
entitiesFileOptionM.makeOptionMandatory();
|
|
74
73
|
envFileOptionM.makeOptionMandatory();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmd_common.js","names":["Argument","Option","state","global","printMessage","createProgressIndicator","updateProgressIndicator","stopProgressIndicator","default","session","setPrintHandler","setCreateProgressHandler","setUpdateProgressHandler","setStopProgressHandler","init","hostArgumentDescription","hostArgument","hostArgumentM","realmArgumentDescription","realmArgument","DEFAULT_REALM_KEY","realmArgumentM","userArgumentDescription","userArgument","userArgumentM","passwordArgumentDescription","passwordArgument","passwordArgumentM","apiKeyArgumentDescription","apiKeyArgument","apiSecretArgumentDescription","apiSecretArgument","treeOptionDescription","treeOption","treeOptionM","fileOptionDescription","fileOption","fileOptionM","deploymentOptionDescription","deploymentOption","choices","DEPLOYMENT_TYPES","deploymentOptionM","insecureOption","nameOption","nameOptionM","managedNameOption","managedNameOptionM","dirOptionDescription","dirOption","dirOptionM","entitiesFileOptionDescription","entitiesFileOption","entitiesFileOptionM","envFileOptionDescription","envFileOption","envFileOptionM","sourcesOptionDescription","sourcesOptionDefaultValueDescription","sourcesOptionM","scriptFriendlyOption","makeOptionMandatory"],"sources":["cli/cmd_common.ts"],"sourcesContent":["import { Argument, Option } from 'commander';\nimport { state } from '@rockcarver/frodo-lib';\nimport * as global from '../storage/StaticStorage.js';\nimport {\n printMessage,\n createProgressIndicator,\n updateProgressIndicator,\n stopProgressIndicator,\n} from '../utils/Console.js';\n\nstate.default.session.setPrintHandler(printMessage);\nstate.default.session.setCreateProgressHandler(createProgressIndicator);\nstate.default.session.setUpdateProgressHandler(updateProgressIndicator);\nstate.default.session.setStopProgressHandler(stopProgressIndicator);\n\n// pseudo functions for commands that do not otherwise need to import\n// this file but need to trigger print and progress handler registration\nexport function init() {}\n\nconst hostArgumentDescription =\n 'Access Management base URL, e.g.: https://cdk.iam.example.com/am. To use a connection profile, just specify a unique substring.';\nexport const hostArgument = new Argument('[host]', hostArgumentDescription);\nexport const hostArgumentM = new Argument('<host>', hostArgumentDescription);\n\nconst realmArgumentDescription =\n \"Realm. Specify realm as '/' for the root realm or 'realm' or '/parent/child' otherwise.\";\nexport const realmArgument = new Argument(\n '[realm]',\n realmArgumentDescription\n).default(\n global.DEFAULT_REALM_KEY,\n '\"alpha\" for Identity Cloud tenants, \"/\" otherwise.'\n);\nexport const realmArgumentM = new Argument('<realm>', realmArgumentDescription);\n\nconst userArgumentDescription =\n 'Username to login with. Must be an admin user with appropriate rights to manage authentication journeys/trees.';\nexport const userArgument = new Argument('[user]', userArgumentDescription);\nexport const userArgumentM = new Argument('<user>', userArgumentDescription);\n\nconst passwordArgumentDescription = 'Password.';\nexport const passwordArgument = new Argument(\n '[password]',\n passwordArgumentDescription\n);\nexport const passwordArgumentM = new Argument(\n '<password>',\n passwordArgumentDescription\n);\n\nconst apiKeyArgumentDescription = 'API key for logging API.';\nexport const apiKeyArgument = new Argument('[key]', apiKeyArgumentDescription);\n\nconst apiSecretArgumentDescription = 'API secret for logging API.';\nexport const apiSecretArgument = new Argument(\n '[secret]',\n apiSecretArgumentDescription\n);\n\nconst treeOptionDescription =\n 'Specify the name of an authentication journey/tree.';\nexport const treeOption = new Option(\n '-t, --tree <tree>',\n treeOptionDescription\n);\nexport const treeOptionM = new Option(\n '-t, --tree <tree>',\n treeOptionDescription\n);\n\nconst fileOptionDescription = 'File name.';\nexport const fileOption = new Option(\n '-f, --file <file>',\n fileOptionDescription\n);\nexport const fileOptionM = new Option(\n '-f, --file <file>',\n fileOptionDescription\n);\n\nconst deploymentOptionDescription =\n 'Override auto-detected deployment type. Valid values for type: \\n\\\nclassic: A classic Access Management-only deployment with custom layout and configuration. \\n\\\ncloud: A ForgeRock Identity Cloud environment. \\n\\\nforgeops: A ForgeOps CDK or CDM deployment. \\n\\\nThe detected or provided deployment type controls certain behavior like obtaining an Identity \\\nManagement admin token or not and whether to export/import referenced email templates or how \\\nto walk through the tenant admin login flow of Identity Cloud and handle MFA';\nexport const deploymentOption = new Option(\n '-m, --type <type>',\n deploymentOptionDescription\n).choices(global.DEPLOYMENT_TYPES);\nexport const deploymentOptionM = new Option(\n '-m, --type <type>',\n deploymentOptionDescription\n).choices(global.DEPLOYMENT_TYPES);\n\nexport const insecureOption = new Option(\n '-k, --insecure',\n 'Allow insecure connections when using SSL/TLS. Has no effect when using a network proxy for https (HTTPS_PROXY=http://<host>:<port>), in that case the proxy must provide this capability.'\n).default(false, \"Don't allow insecure connections\");\n\nexport const nameOption = new Option(\n '-N, --name <name>',\n 'Config entity name to be exported or imported/updated. Examples are \\\nmanaged, sync, provisioner-xxxx, etc.'\n);\nexport const nameOptionM = new Option(\n '-N, --name <name>',\n 'Config entity name to be exported or imported/updated. Examples are \\\nmanaged, sync, provisioner-xxxx, etc.'\n);\n\nexport const managedNameOption = new Option(\n '-N, --name <name>',\n 'Managed object name to be operated on. Examples are \\\nuser, role, alpha_user, alpha_role etc.'\n);\nexport const managedNameOptionM = new Option(\n '-N, --name <name>',\n 'Managed object name to be operated on. Examples are \\\nuser, role, alpha_user, alpha_role etc.'\n);\n\nconst dirOptionDescription =\n 'Directory for exporting all configuration entities to.';\nexport const dirOption = new Option(\n '-D, --directory <directory>',\n dirOptionDescription\n);\nexport const dirOptionM = new Option(\n '-D, --directory <directory>',\n dirOptionDescription\n);\n\nconst entitiesFileOptionDescription =\n 'JSON file that specifies the config entities to export/import.';\nexport const entitiesFileOption = new Option(\n '-E, --entitiesFile <file>',\n entitiesFileOptionDescription\n);\nexport const entitiesFileOptionM = new Option(\n '-E, --entitiesFile <file>',\n entitiesFileOptionDescription\n);\n\nconst envFileOptionDescription =\n 'File that defines environment specific variables for replacement during configuration export/import.';\nexport const envFileOption = new Option(\n '-e, --envFile <file>',\n envFileOptionDescription\n);\nexport const envFileOptionM = new Option(\n '-e, --envFile <file>',\n envFileOptionDescription\n);\n\nconst sourcesOptionDescription = 'Comma separated list of log sources';\nconst sourcesOptionDefaultValueDescription = 'Log everything';\nexport const sourcesOptionM = new Option(\n '-c, --sources <sources>',\n sourcesOptionDescription\n).default('am-everything,idm-everything', sourcesOptionDefaultValueDescription);\n\nexport const scriptFriendlyOption = new Option(\n '-s, --scriptFriendly',\n 'Send output of operation to STDOUT in a script-friendly format (JSON) which can be piped to other \\\ncommands. User messages/warnings are output to STDERR, and are not piped. For example, to only get \\\nbearer token: \\n\\\n<<< frodo info my-tenant -s 2>/dev/null | jq -r .bearerToken >>>'\n).default(false, 'Output as plain text');\n\ntreeOptionM.makeOptionMandatory();\nfileOptionM.makeOptionMandatory();\ndeploymentOptionM.makeOptionMandatory();\nnameOptionM.makeOptionMandatory();\ndirOptionM.makeOptionMandatory();\nentitiesFileOptionM.makeOptionMandatory();\nenvFileOptionM.makeOptionMandatory();\nmanagedNameOptionM.makeOptionMandatory();\nsourcesOptionM.makeOptionMandatory();\n"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,MAAnB,QAAiC,WAAjC;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,OAAO,KAAKC,MAAZ,MAAwB,6BAAxB;AACA,SACEC,YADF,EAEEC,uBAFF,EAGEC,uBAHF,EAIEC,qBAJF,QAKO,qBALP;AAOAL,KAAK,CAACM,OAAN,CAAcC,OAAd,CAAsBC,eAAtB,CAAsCN,YAAtC;AACAF,KAAK,CAACM,OAAN,CAAcC,OAAd,CAAsBE,wBAAtB,CAA+CN,uBAA/C;AACAH,KAAK,CAACM,OAAN,CAAcC,OAAd,CAAsBG,wBAAtB,CAA+CN,uBAA/C;AACAJ,KAAK,CAACM,OAAN,CAAcC,OAAd,CAAsBI,sBAAtB,CAA6CN,qBAA7C,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MAAJ,CACvB,6BADuB,EAEvB+C,oBAFuB,CAAlB;AAIP,OAAO,MAAME,UAAU,GAAG,IAAIjD,MAAJ,CACxB,6BADwB,EAExB+C,oBAFwB,CAAnB;AAKP,MAAMG,6BAA6B,GACjC,gEADF;AAEA,OAAO,MAAMC,kBAAkB,GAAG,IAAInD,MAAJ,CAChC,2BADgC,EAEhCkD,6BAFgC,CAA3B;AAIP,OAAO,MAAME,mBAAmB,GAAG,IAAIpD,MAAJ,CACjC,2BADiC,EAEjCkD,6BAFiC,CAA5B;AAKP,MAAMG,wBAAwB,GAC5B,sGADF;AAEA,OAAO,MAAMC,aAAa,GAAG,IAAItD,MAAJ,CAC3B,sBAD2B,EAE3BqD,wBAF2B,CAAtB;AAIP,OAAO,MAAME,cAAc,GAAG,IAAIvD,MAAJ,CAC5B,sBAD4B,EAE5BqD,wBAF4B,CAAvB;AAKP,MAAMG,wBAAwB,GAAG,qCAAjC;AACA,MAAMC,oCAAoC,GAAG,gBAA7C;AACA,OAAO,MAAMC,cAAc,GAAG,IAAI1D,MAAJ,CAC5B,yBAD4B,EAE5BwD,wBAF4B,EAG5BjD,OAH4B,CAGpB,8BAHoB,EAGYkD,oCAHZ,CAAvB;AAKP,OAAO,MAAME,oBAAoB,GAAG,IAAI3D,MAAJ,CAClC,sBADkC,EAElC;AACF;AACA;AACA,iEALoC,EAMlCO,OANkC,CAM1B,KAN0B,EAMnB,sBANmB,CAA7B;AAQP0B,WAAW,CAAC2B,mBAAZ;AACAxB,WAAW,CAACwB,mBAAZ;AACAnB,iBAAiB,CAACmB,mBAAlB;AACAhB,WAAW,CAACgB,mBAAZ;AACAX,UAAU,CAACW,mBAAX;AACAR,mBAAmB,CAACQ,mBAApB;AACAL,cAAc,CAACK,mBAAf;AACAd,kBAAkB,CAACc,mBAAnB;AACAF,cAAc,CAACE,mBAAf"}
|
|
1
|
+
{"version":3,"file":"cmd_common.js","names":["Argument","Option","state","global","printMessage","createProgressIndicator","updateProgressIndicator","stopProgressIndicator","verbose","debug","default","session","setPrintHandler","setCreateProgressHandler","setUpdateProgressHandler","setStopProgressHandler","setVerboseHandler","setDebugHandler","init","hostArgumentDescription","hostArgument","hostArgumentM","realmArgumentDescription","realmArgument","DEFAULT_REALM_KEY","realmArgumentM","userArgumentDescription","userArgument","userArgumentM","passwordArgumentDescription","passwordArgument","passwordArgumentM","apiKeyArgumentDescription","apiKeyArgument","apiSecretArgumentDescription","apiSecretArgument","treeOptionDescription","treeOption","treeOptionM","fileOptionDescription","fileOption","fileOptionM","deploymentOptionDescription","deploymentOption","choices","DEPLOYMENT_TYPES","deploymentOptionM","insecureOption","verboseOption","debugOption","managedNameOption","managedNameOptionM","dirOptionDescription","dirOption","dirOptionM","entitiesFileOptionDescription","entitiesFileOption","entitiesFileOptionM","envFileOptionDescription","envFileOption","envFileOptionM","sourcesOptionDescription","sourcesOptionDefaultValueDescription","sourcesOptionM","scriptFriendlyOption","makeOptionMandatory"],"sources":["cli/cmd_common.ts"],"sourcesContent":["import { Argument, Option } from 'commander';\nimport { state } from '@rockcarver/frodo-lib';\nimport * as global from '../storage/StaticStorage.js';\nimport {\n printMessage,\n createProgressIndicator,\n updateProgressIndicator,\n stopProgressIndicator,\n verbose,\n debug\n} from '../utils/Console.js';\n\nstate.default.session.setPrintHandler(printMessage);\nstate.default.session.setCreateProgressHandler(createProgressIndicator);\nstate.default.session.setUpdateProgressHandler(updateProgressIndicator);\nstate.default.session.setStopProgressHandler(stopProgressIndicator);\nstate.default.session.setVerboseHandler(verbose);\nstate.default.session.setDebugHandler(debug);\n\n// pseudo functions for commands that do not otherwise need to import\n// this file but need to trigger print and progress handler registration\nexport function init() {}\n\nconst hostArgumentDescription =\n 'Access Management base URL, e.g.: https://cdk.iam.example.com/am. To use a connection profile, just specify a unique substring.';\nexport const hostArgument = new Argument('[host]', hostArgumentDescription);\nexport const hostArgumentM = new Argument('<host>', hostArgumentDescription);\n\nconst realmArgumentDescription =\n \"Realm. Specify realm as '/' for the root realm or 'realm' or '/parent/child' otherwise.\";\nexport const realmArgument = new Argument(\n '[realm]',\n realmArgumentDescription\n).default(\n global.DEFAULT_REALM_KEY,\n '\"alpha\" for Identity Cloud tenants, \"/\" otherwise.'\n);\nexport const realmArgumentM = new Argument('<realm>', realmArgumentDescription);\n\nconst userArgumentDescription =\n 'Username to login with. Must be an admin user with appropriate rights to manage authentication journeys/trees.';\nexport const userArgument = new Argument('[user]', userArgumentDescription);\nexport const userArgumentM = new Argument('<user>', userArgumentDescription);\n\nconst passwordArgumentDescription = 'Password.';\nexport const passwordArgument = new Argument(\n '[password]',\n passwordArgumentDescription\n);\nexport const passwordArgumentM = new Argument(\n '<password>',\n passwordArgumentDescription\n);\n\nconst apiKeyArgumentDescription = 'API key for logging API.';\nexport const apiKeyArgument = new Argument('[key]', apiKeyArgumentDescription);\n\nconst apiSecretArgumentDescription = 'API secret for logging API.';\nexport const apiSecretArgument = new Argument(\n '[secret]',\n apiSecretArgumentDescription\n);\n\nconst treeOptionDescription =\n 'Specify the name of an authentication journey/tree.';\nexport const treeOption = new Option(\n '-t, --tree <tree>',\n treeOptionDescription\n);\nexport const treeOptionM = new Option(\n '-t, --tree <tree>',\n treeOptionDescription\n);\n\nconst fileOptionDescription = 'File name.';\nexport const fileOption = new Option(\n '-f, --file <file>',\n fileOptionDescription\n);\nexport const fileOptionM = new Option(\n '-f, --file <file>',\n fileOptionDescription\n);\n\nconst deploymentOptionDescription =\n 'Override auto-detected deployment type. Valid values for type: \\n\\\nclassic: A classic Access Management-only deployment with custom layout and configuration. \\n\\\ncloud: A ForgeRock Identity Cloud environment. \\n\\\nforgeops: A ForgeOps CDK or CDM deployment. \\n\\\nThe detected or provided deployment type controls certain behavior like obtaining an Identity \\\nManagement admin token or not and whether to export/import referenced email templates or how \\\nto walk through the tenant admin login flow of Identity Cloud and handle MFA';\nexport const deploymentOption = new Option(\n '-m, --type <type>',\n deploymentOptionDescription\n).choices(global.DEPLOYMENT_TYPES);\nexport const deploymentOptionM = new Option(\n '-m, --type <type>',\n deploymentOptionDescription\n).choices(global.DEPLOYMENT_TYPES);\n\nexport const insecureOption = new Option(\n '-k, --insecure',\n 'Allow insecure connections when using SSL/TLS. Has no effect when using a network proxy for https (HTTPS_PROXY=http://<host>:<port>), in that case the proxy must provide this capability.'\n).default(false, \"Don't allow insecure connections\");\n\nexport const verboseOption = new Option(\n '--verbose',\n 'Verbose output during command execution. If specified, may or may not produce additional output.'\n);\n\nexport const debugOption = new Option(\n '--debug',\n 'Debug output during command execution. If specified, may or may not produce additional output helpful for troubleshooting.'\n);\n\nexport const managedNameOption = new Option(\n '-N, --name <name>',\n 'Managed object name to be operated on. Examples are \\\nuser, role, alpha_user, alpha_role etc.'\n);\nexport const managedNameOptionM = new Option(\n '-N, --name <name>',\n 'Managed object name to be operated on. Examples are \\\nuser, role, alpha_user, alpha_role etc.'\n);\n\nconst dirOptionDescription =\n 'Directory for exporting all configuration entities to.';\nexport const dirOption = new Option(\n '-D, --directory <directory>',\n dirOptionDescription\n);\nexport const dirOptionM = new Option(\n '-D, --directory <directory>',\n dirOptionDescription\n);\n\nconst entitiesFileOptionDescription =\n 'JSON file that specifies the config entities to export/import.';\nexport const entitiesFileOption = new Option(\n '-E, --entitiesFile <file>',\n entitiesFileOptionDescription\n);\nexport const entitiesFileOptionM = new Option(\n '-E, --entitiesFile <file>',\n entitiesFileOptionDescription\n);\n\nconst envFileOptionDescription =\n 'File that defines environment specific variables for replacement during configuration export/import.';\nexport const envFileOption = new Option(\n '-e, --envFile <file>',\n envFileOptionDescription\n);\nexport const envFileOptionM = new Option(\n '-e, --envFile <file>',\n envFileOptionDescription\n);\n\nconst sourcesOptionDescription = 'Comma separated list of log sources';\nconst sourcesOptionDefaultValueDescription = 'Log everything';\nexport const sourcesOptionM = new Option(\n '-c, --sources <sources>',\n sourcesOptionDescription\n).default('am-everything,idm-everything', sourcesOptionDefaultValueDescription);\n\nexport const scriptFriendlyOption = new Option(\n '-s, --scriptFriendly',\n 'Send output of operation to STDOUT in a script-friendly format (JSON) which can be piped to other \\\ncommands. User messages/warnings are output to STDERR, and are not piped. For example, to only get \\\nbearer token: \\n\\\n<<< frodo info my-tenant -s 2>/dev/null | jq -r .bearerToken >>>'\n).default(false, 'Output as plain text');\n\ntreeOptionM.makeOptionMandatory();\nfileOptionM.makeOptionMandatory();\ndeploymentOptionM.makeOptionMandatory();\ndirOptionM.makeOptionMandatory();\nentitiesFileOptionM.makeOptionMandatory();\nenvFileOptionM.makeOptionMandatory();\nmanagedNameOptionM.makeOptionMandatory();\nsourcesOptionM.makeOptionMandatory();\n"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,MAAnB,QAAiC,WAAjC;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,OAAO,KAAKC,MAAZ,MAAwB,6BAAxB;AACA,SACEC,YADF,EAEEC,uBAFF,EAGEC,uBAHF,EAIEC,qBAJF,EAKEC,OALF,EAMEC,KANF,QAOO,qBAPP;AASAP,KAAK,CAACQ,OAAN,CAAcC,OAAd,CAAsBC,eAAtB,CAAsCR,YAAtC;AACAF,KAAK,CAACQ,OAAN,CAAcC,OAAd,CAAsBE,wBAAtB,CAA+CR,uBAA/C;AACAH,KAAK,CAACQ,OAAN,CAAcC,OAAd,CAAsBG,wBAAtB,CAA+CR,uBAA/C;AACAJ,KAAK,CAACQ,OAAN,CAAcC,OAAd,CAAsBI,sBAAtB,CAA6CR,qBAA7C;AACAL,KAAK,CAACQ,OAAN,CAAcC,OAAd,CAAsBK,iBAAtB,CAAwCR,OAAxC;AACAN,KAAK,CAACQ,OAAN,CAAcC,OAAd,CAAsBM,eAAtB,CAAsCR,KAAtC,E,CAEA;AACA;;AACA,OAAO,SAASS,IAAT,GAAgB,CAAE;AAEzB,MAAMC,uBAAuB,GAC3B,iIADF;AAEA,OAAO,MAAMC,YAAY,GAAG,IAAIpB,QAAJ,CAAa,QAAb,EAAuBmB,uBAAvB,CAArB;AACP,OAAO,MAAME,aAAa,GAAG,IAAIrB,QAAJ,CAA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2BADgC,EAEhCsD,6BAFgC,CAA3B;AAIP,OAAO,MAAME,mBAAmB,GAAG,IAAIxD,MAAJ,CACjC,2BADiC,EAEjCsD,6BAFiC,CAA5B;AAKP,MAAMG,wBAAwB,GAC5B,sGADF;AAEA,OAAO,MAAMC,aAAa,GAAG,IAAI1D,MAAJ,CAC3B,sBAD2B,EAE3ByD,wBAF2B,CAAtB;AAIP,OAAO,MAAME,cAAc,GAAG,IAAI3D,MAAJ,CAC5B,sBAD4B,EAE5ByD,wBAF4B,CAAvB;AAKP,MAAMG,wBAAwB,GAAG,qCAAjC;AACA,MAAMC,oCAAoC,GAAG,gBAA7C;AACA,OAAO,MAAMC,cAAc,GAAG,IAAI9D,MAAJ,CAC5B,yBAD4B,EAE5B4D,wBAF4B,EAG5BnD,OAH4B,CAGpB,8BAHoB,EAGYoD,oCAHZ,CAAvB;AAKP,OAAO,MAAME,oBAAoB,GAAG,IAAI/D,MAAJ,CAClC,sBADkC,EAElC;AACF;AACA;AACA,iEALoC,EAMlCS,OANkC,CAM1B,KAN0B,EAMnB,sBANmB,CAA7B;AAQP4B,WAAW,CAAC2B,mBAAZ;AACAxB,WAAW,CAACwB,mBAAZ;AACAnB,iBAAiB,CAACmB,mBAAlB;AACAX,UAAU,CAACW,mBAAX;AACAR,mBAAmB,CAACQ,mBAApB;AACAL,cAAc,CAACK,mBAAf;AACAd,kBAAkB,CAACc,mBAAnB;AACAF,cAAc,CAACE,mBAAf"}
|
|
@@ -58,7 +58,7 @@ async (host, realm, user, password, options) => {
|
|
|
58
58
|
throw new Error(typeof options.journeyId === 'undefined' ? `No journey found in ${options.file}` : `Journey '${options.journeyId}' not found in ${options.file}`);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
describeJourney(journeyData, createFileParamTreeExportResolver(options.file));
|
|
61
|
+
await describeJourney(journeyData, createFileParamTreeExportResolver(options.file));
|
|
62
62
|
} catch (error) {
|
|
63
63
|
console.log(error.message);
|
|
64
64
|
process.exitCode = 1;
|
|
@@ -78,7 +78,7 @@ async (host, realm, user, password, options) => {
|
|
|
78
78
|
try {
|
|
79
79
|
// eslint-disable-next-line no-await-in-loop, dot-notation
|
|
80
80
|
const treeData = await exportJourney(journey['_id']);
|
|
81
|
-
describeJourney(treeData);
|
|
81
|
+
await describeJourney(treeData);
|
|
82
82
|
} catch (error) {
|
|
83
83
|
console.log(error.message);
|
|
84
84
|
process.exitCode = 1;
|
|
@@ -87,7 +87,7 @@ async (host, realm, user, password, options) => {
|
|
|
87
87
|
} else {
|
|
88
88
|
try {
|
|
89
89
|
const treeData = await exportJourney(options.journeyId);
|
|
90
|
-
describeJourney(treeData);
|
|
90
|
+
await describeJourney(treeData);
|
|
91
91
|
} catch (error) {
|
|
92
92
|
console.log(error.message);
|
|
93
93
|
process.exitCode = 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey-describe.js","names":["fs","Command","Option","Authenticate","Journey","state","describeJourney","common","getTokens","getJourneys","exportJourney","createFileParamTreeExportResolver","program","description","helpOption","showHelpAfterError","addArgument","hostArgument","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","file","console","log","process","exitCode","overrideVersion","setAmVersion","fileData","JSON","parse","readFileSync","journeyData","journeyId","trees","Object","values","tree","_id","Error","error","message","getRealm","journeys","journey","treeData"],"sources":["cli/journey/journey-describe.ts"],"sourcesContent":["import fs from 'fs';\nimport { Command, Option } from 'commander';\nimport { Authenticate, Journey, state } from '@rockcarver/frodo-lib';\nimport { describeJourney } from '../../ops/JourneyOps';\nimport * as common from '../cmd_common.js';\n\nconst { getTokens } = Authenticate;\nconst { getJourneys, exportJourney, createFileParamTreeExportResolver } =\n Journey;\n\nconst program = new Command('frodo journey describe');\n\nprogram\n .description(\n 'If -h is supplied, describe the journey/tree indicated by -i, or all journeys/trees in the realm if no -i is supplied, otherwise describe the journey/tree export file indicated by -f.'\n )\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgument)\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 '-i, --journey-id <journey>',\n 'Name of a journey/tree. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to write the exported journey(s) to. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-o, --override-version <version>',\n \"Override version. Notation: '<major>.<minor>.<patch>' e.g. '7.2.0'. Override detected version with any version. This is helpful in order to check if journeys in one environment would be compatible running in another environment (e.g. in preparation of migrating from on-prem to ForgeRock Identity Cloud.\"\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 // TODO: review checks for arguments\n if (typeof host === 'undefined' || typeof options.file !== 'undefined') {\n if (\n typeof host === 'undefined' &&\n typeof options.file === 'undefined'\n ) {\n console.log('Need either [host] or -f.');\n process.exitCode = 1;\n return;\n }\n console.log(`Describing local journey file ${options.file}...`);\n try {\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.default.session.setAmVersion(options.overrideVersion);\n }\n const fileData = JSON.parse(fs.readFileSync(options.file, 'utf8'));\n let journeyData;\n // single or multi tree export?\n // multi - by id\n if (\n typeof options.journeyId !== 'undefined' &&\n fileData.trees &&\n fileData.trees[options.journeyId]\n ) {\n journeyData = fileData.trees[options.journeyId];\n }\n // multi - first\n else if (typeof options.journeyId === 'undefined' && fileData.trees) {\n [journeyData] = Object.values(fileData.trees);\n }\n // single - by id\n else if (\n typeof options.journeyId !== 'undefined' &&\n options.journeyId === fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // single\n else if (\n typeof options.journeyId === 'undefined' &&\n fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // no journey/tree found\n else {\n throw new Error(\n typeof options.journeyId === 'undefined'\n ? `No journey found in ${options.file}`\n : `Journey '${options.journeyId}' not found in ${options.file}`\n );\n }\n describeJourney(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n } catch (error) {\n console.log(error.message);\n process.exitCode = 1;\n }\n } else if (await getTokens()) {\n console.log(\n `Describing journey(s) in realm \"${state.default.session.getRealm()}\"...`\n );\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.default.session.setAmVersion(options.overrideVersion);\n }\n if (typeof options.journeyId === 'undefined') {\n let journeys: any[] = [];\n journeys = await getJourneys();\n for (const journey of journeys) {\n try {\n // eslint-disable-next-line no-await-in-loop, dot-notation\n const treeData = await exportJourney(journey['_id']);\n describeJourney(treeData);\n } catch (error) {\n console.log(error.message);\n process.exitCode = 1;\n }\n }\n } else {\n try {\n const treeData = await exportJourney(options.journeyId);\n describeJourney(treeData);\n } catch (error) {\n console.log(error.message);\n process.exitCode = 1;\n }\n }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,OAAOA,EAAP,MAAe,IAAf;AACA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SAASC,YAAT,EAAuBC,OAAvB,EAAgCC,KAAhC,QAA6C,uBAA7C;AACA,SAASC,eAAT,QAAgC,sBAAhC;AACA,OAAO,KAAKC,MAAZ,MAAwB,kBAAxB;AAEA,MAAM;EAAEC;AAAF,IAAgBL,YAAtB;AACA,MAAM;EAAEM,WAAF;EAAeC,aAAf;EAA8BC;AAA9B,IACJP,OADF;AAGA,MAAMQ,OAAO,GAAG,IAAIX,OAAJ,CAAY,wBAAZ,CAAhB;AAEAW,OAAO,CACJC,WADH,CAEI,yLAFJ,EAIGC,UAJH,CAIc,YAJd,EAI4B,MAJ5B,EAKGC,kBALH,GAMGC,WANH,CAMeT,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,aAAa,CAACmB,OAAO,CAACuB,SAAT,CAApC;QACA9C,eAAe,CAAC0D,QAAD,CAAf;MACD,CAHD,CAGE,OAAOL,KAAP,EAAc;QACdlB,OAAO,CAACC,GAAR,CAAYiB,KAAK,CAACC,OAAlB;QACAjB,OAAO,CAACC,QAAR,GAAmB,CAAnB;MACD;IACF;EACF;AACF,CAnIL,CAoII;AApIJ;AAuIAhC,OAAO,CAACqC,KAAR"}
|
|
1
|
+
{"version":3,"file":"journey-describe.js","names":["fs","Command","Option","Authenticate","Journey","state","describeJourney","common","getTokens","getJourneys","exportJourney","createFileParamTreeExportResolver","program","description","helpOption","showHelpAfterError","addArgument","hostArgument","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","file","console","log","process","exitCode","overrideVersion","setAmVersion","fileData","JSON","parse","readFileSync","journeyData","journeyId","trees","Object","values","tree","_id","Error","error","message","getRealm","journeys","journey","treeData"],"sources":["cli/journey/journey-describe.ts"],"sourcesContent":["import fs from 'fs';\nimport { Command, Option } from 'commander';\nimport { Authenticate, Journey, state } from '@rockcarver/frodo-lib';\nimport { describeJourney } from '../../ops/JourneyOps';\nimport * as common from '../cmd_common.js';\n\nconst { getTokens } = Authenticate;\nconst { getJourneys, exportJourney, createFileParamTreeExportResolver } =\n Journey;\n\nconst program = new Command('frodo journey describe');\n\nprogram\n .description(\n 'If -h is supplied, describe the journey/tree indicated by -i, or all journeys/trees in the realm if no -i is supplied, otherwise describe the journey/tree export file indicated by -f.'\n )\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgument)\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 '-i, --journey-id <journey>',\n 'Name of a journey/tree. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to write the exported journey(s) to. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-o, --override-version <version>',\n \"Override version. Notation: '<major>.<minor>.<patch>' e.g. '7.2.0'. Override detected version with any version. This is helpful in order to check if journeys in one environment would be compatible running in another environment (e.g. in preparation of migrating from on-prem to ForgeRock Identity Cloud.\"\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 // TODO: review checks for arguments\n if (typeof host === 'undefined' || typeof options.file !== 'undefined') {\n if (\n typeof host === 'undefined' &&\n typeof options.file === 'undefined'\n ) {\n console.log('Need either [host] or -f.');\n process.exitCode = 1;\n return;\n }\n console.log(`Describing local journey file ${options.file}...`);\n try {\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.default.session.setAmVersion(options.overrideVersion);\n }\n const fileData = JSON.parse(fs.readFileSync(options.file, 'utf8'));\n let journeyData;\n // single or multi tree export?\n // multi - by id\n if (\n typeof options.journeyId !== 'undefined' &&\n fileData.trees &&\n fileData.trees[options.journeyId]\n ) {\n journeyData = fileData.trees[options.journeyId];\n }\n // multi - first\n else if (typeof options.journeyId === 'undefined' && fileData.trees) {\n [journeyData] = Object.values(fileData.trees);\n }\n // single - by id\n else if (\n typeof options.journeyId !== 'undefined' &&\n options.journeyId === fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // single\n else if (\n typeof options.journeyId === 'undefined' &&\n fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // no journey/tree found\n else {\n throw new Error(\n typeof options.journeyId === 'undefined'\n ? `No journey found in ${options.file}`\n : `Journey '${options.journeyId}' not found in ${options.file}`\n );\n }\n await describeJourney(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n } catch (error) {\n console.log(error.message);\n process.exitCode = 1;\n }\n } else if (await getTokens()) {\n console.log(\n `Describing journey(s) in realm \"${state.default.session.getRealm()}\"...`\n );\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.default.session.setAmVersion(options.overrideVersion);\n }\n if (typeof options.journeyId === 'undefined') {\n let journeys: any[] = [];\n journeys = await getJourneys();\n for (const journey of journeys) {\n try {\n // eslint-disable-next-line no-await-in-loop, dot-notation\n const treeData = await exportJourney(journey['_id']);\n await describeJourney(treeData);\n } catch (error) {\n console.log(error.message);\n process.exitCode = 1;\n }\n }\n } else {\n try {\n const treeData = await exportJourney(options.journeyId);\n await describeJourney(treeData);\n } catch (error) {\n console.log(error.message);\n process.exitCode = 1;\n }\n }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,OAAOA,EAAP,MAAe,IAAf;AACA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SAASC,YAAT,EAAuBC,OAAvB,EAAgCC,KAAhC,QAA6C,uBAA7C;AACA,SAASC,eAAT,QAAgC,sBAAhC;AACA,OAAO,KAAKC,MAAZ,MAAwB,kBAAxB;AAEA,MAAM;EAAEC;AAAF,IAAgBL,YAAtB;AACA,MAAM;EAAEM,WAAF;EAAeC,aAAf;EAA8BC;AAA9B,IACJP,OADF;AAGA,MAAMQ,OAAO,GAAG,IAAIX,OAAJ,CAAY,wBAAZ,CAAhB;AAEAW,OAAO,CACJC,WADH,CAEI,yLAFJ,EAIGC,UAJH,CAIc,YAJd,EAI4B,MAJ5B,EAKGC,kBALH,GAMGC,WANH,CAMeT,MAAM,CAACU,YANtB,EAOGD,WAPH,CAOeT,MAAM,CAACW,aAPtB,EAQGF,WARH,CAQeT,MAAM,CAACY,YARtB,EASGH,WATH,CASeT,MAAM,CAACa,gBATtB,EAUGC,SAVH,CAUad,MAAM,CAACe,gBAVpB,EAWGD,SAXH,CAWad,MAAM,CAACgB,cAXpB,EAYGF,SAZH,CAaI,IAAInB,MAAJ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CAnIL,CAoII;AApIJ;AAuIAhC,OAAO,CAACqC,KAAR"}
|
|
@@ -12,7 +12,7 @@ const {
|
|
|
12
12
|
importThemesFromFiles
|
|
13
13
|
} = Theme;
|
|
14
14
|
const program = new Command('frodo theme import');
|
|
15
|
-
program.description('Import themes.').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, --theme-name <name>', 'Name of the theme. If specified, -a and -A are ignored.')).addOption(new Option('-i, --theme-id <uuid>', 'Uuid of the theme. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import the theme(s) from.')).addOption(new Option('-a, --all', 'Import all the themes from single file. Ignored with -n or -i.')).addOption(new Option('-A, --all-separate', 'Import all the themes from separate files (*.json) in the current directory. Ignored with -n or -i or -a.')).action( // implement command logic inside action handler
|
|
15
|
+
program.description('Import themes.').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(new Option('-n, --theme-name <name>', 'Name of the theme. If specified, -a and -A are ignored.')).addOption(new Option('-i, --theme-id <uuid>', 'Uuid of the theme. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import the theme(s) from.')).addOption(new Option('-a, --all', 'Import all the themes from single file. Ignored with -n or -i.')).addOption(new Option('-A, --all-separate', 'Import all the themes from separate files (*.json) in the current directory. Ignored with -n or -i or -a.')).action( // implement command logic inside action handler
|
|
16
16
|
async (host, realm, user, password, options) => {
|
|
17
17
|
state.default.session.setTenant(host);
|
|
18
18
|
state.default.session.setRealm(realm);
|
|
@@ -20,6 +20,8 @@ async (host, realm, user, password, options) => {
|
|
|
20
20
|
state.default.session.setPassword(password);
|
|
21
21
|
state.default.session.setDeploymentType(options.type);
|
|
22
22
|
state.default.session.setAllowInsecureConnection(options.insecure);
|
|
23
|
+
state.default.session.setVerbose(options.verbose);
|
|
24
|
+
state.default.session.setDebug(options.debug);
|
|
23
25
|
|
|
24
26
|
if (await getTokens()) {
|
|
25
27
|
// import by name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-import.js","names":["Command","Option","Authenticate","Theme","state","common","getTokens","importFirstThemeFromFile","importThemeById","importThemeByName","importThemesFromFile","importThemesFromFiles","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","file","themeName","console","log","getRealm","themeId","all","allSeparate","help","parse"],"sources":["cli/theme/theme-import.ts"],"sourcesContent":["import { Command, Option } from 'commander';\nimport { Authenticate, Theme, state } from '@rockcarver/frodo-lib';\nimport * as common from '../cmd_common.js';\n\nconst { getTokens } = Authenticate;\n\nconst {\n importFirstThemeFromFile,\n importThemeById,\n importThemeByName,\n importThemesFromFile,\n importThemesFromFiles,\n} = Theme;\n\nconst program = new Command('frodo theme import');\n\nprogram\n .description('Import themes.')\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, --theme-name <name>',\n 'Name of the theme. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-i, --theme-id <uuid>',\n 'Uuid of the theme. 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 theme(s) from.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Import all the themes from single file. Ignored with -n or -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all the themes from separate files (*.json) in the current directory. Ignored with -n or -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 if (await getTokens()) {\n // import by name\n if (options.file && options.themeName) {\n console.log(\n `Importing theme with name \"${\n options.themeName\n }\" into realm \"${state.default.session.getRealm()}\"...`\n );\n importThemeByName(options.themeName, options.file);\n }\n // import by id\n else if (options.file && options.themeId) {\n console.log(\n `Importing theme with id \"${\n options.themeId\n }\" into realm \"${state.default.session.getRealm()}\"...`\n );\n importThemeById(options.themeId, options.file);\n }\n // --all -a\n else if (options.all && options.file) {\n console.log(\n `Importing all themes from a single file (${options.file})...`\n );\n importThemesFromFile(options.file);\n }\n // --all-separate -A\n else if (options.allSeparate && !options.file) {\n console.log(\n 'Importing all themes from separate files in current directory...'\n );\n importThemesFromFiles();\n }\n // import single theme from file\n else if (options.file) {\n console.log(\n `Importing first theme from file \"${\n options.file\n }\" into realm \"${state.default.session.getRealm()}\"...`\n );\n importFirstThemeFromFile(options.file);\n }\n // unrecognized combination of options or no options\n else {\n console.log('Unrecognized combination of options or no options...');\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,EAA8BC,KAA9B,QAA2C,uBAA3C;AACA,OAAO,KAAKC,MAAZ,MAAwB,kBAAxB;AAEA,MAAM;EAAEC;AAAF,IAAgBJ,YAAtB;AAEA,MAAM;EACJK,wBADI;EAEJC,eAFI;EAGJC,iBAHI;EAIJC,oBAJI;EAKJC;AALI,IAMFR,KANJ;AAQA,MAAMS,OAAO,GAAG,IAAIZ,OAAJ,CAAY,oBAAZ,CAAhB;AAEAY,OAAO,CACJC,WADH,CACe,gBADf,EAEGC,UAFH,CAEc,YAFd,EAE4B,MAF5B,EAGGC,kBAHH,GAIGC,WAJH,CAIeX,MAAM,CAACY,aAJtB,EAKGD,WALH,CAKeX,MAAM,CAACa,aALtB,EAMGF,WANH,CAMeX,MAAM,CAACc,YANtB,EAOGH,WAPH,CAOeX,MAAM,CAACe,gBAPtB,EAQGC,SARH,CAQahB,MAAM,CAACiB,gBARpB,EASGD,SATH,CASahB,MAAM,CAACkB,cATpB,EAUGF,SAVH,
|
|
1
|
+
{"version":3,"file":"theme-import.js","names":["Command","Option","Authenticate","Theme","state","common","getTokens","importFirstThemeFromFile","importThemeById","importThemeByName","importThemesFromFile","importThemesFromFiles","program","description","helpOption","showHelpAfterError","addArgument","hostArgumentM","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","verboseOption","debugOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","setVerbose","verbose","setDebug","debug","file","themeName","console","log","getRealm","themeId","all","allSeparate","help","parse"],"sources":["cli/theme/theme-import.ts"],"sourcesContent":["import { Command, Option } from 'commander';\nimport { Authenticate, Theme, state } from '@rockcarver/frodo-lib';\nimport * as common from '../cmd_common.js';\n\nconst { getTokens } = Authenticate;\n\nconst {\n importFirstThemeFromFile,\n importThemeById,\n importThemeByName,\n importThemesFromFile,\n importThemesFromFiles,\n} = Theme;\n\nconst program = new Command('frodo theme import');\n\nprogram\n .description('Import themes.')\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(\n new Option(\n '-n, --theme-name <name>',\n 'Name of the theme. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-i, --theme-id <uuid>',\n 'Uuid of the theme. 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 theme(s) from.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Import all the themes from single file. Ignored with -n or -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all the themes from separate files (*.json) in the current directory. Ignored with -n or -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 if (await getTokens()) {\n // import by name\n if (options.file && options.themeName) {\n console.log(\n `Importing theme with name \"${\n options.themeName\n }\" into realm \"${state.default.session.getRealm()}\"...`\n );\n importThemeByName(options.themeName, options.file);\n }\n // import by id\n else if (options.file && options.themeId) {\n console.log(\n `Importing theme with id \"${\n options.themeId\n }\" into realm \"${state.default.session.getRealm()}\"...`\n );\n importThemeById(options.themeId, options.file);\n }\n // --all -a\n else if (options.all && options.file) {\n console.log(\n `Importing all themes from a single file (${options.file})...`\n );\n importThemesFromFile(options.file);\n }\n // --all-separate -A\n else if (options.allSeparate && !options.file) {\n console.log(\n 'Importing all themes from separate files in current directory...'\n );\n importThemesFromFiles();\n }\n // import single theme from file\n else if (options.file) {\n console.log(\n `Importing first theme from file \"${\n options.file\n }\" into realm \"${state.default.session.getRealm()}\"...`\n );\n importFirstThemeFromFile(options.file);\n }\n // unrecognized combination of options or no options\n else {\n console.log('Unrecognized combination of options or no options...');\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,EAA8BC,KAA9B,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,CAACC,GAAR,CACG,4CAA2ClB,OAAO,CAACe,IAAK,MAD3D;MAGApC,oBAAoB,CAACqB,OAAO,CAACe,IAAT,CAApB;IACD,CALI,CAML;IANK,KAOA,IAAIf,OAAO,CAACsB,WAAR,IAAuB,CAACtB,OAAO,CAACe,IAApC,EAA0C;MAC7CE,OAAO,CAACC,GAAR,CACE,kEADF;MAGAtC,qBAAqB;IACtB,CALI,CAML;IANK,KAOA,IAAIoB,OAAO,CAACe,IAAZ,EAAkB;MACrBE,OAAO,CAACC,GAAR,CACG,oCACClB,OAAO,CAACe,IACT,iBAAgB1C,KAAK,CAAC4B,OAAN,CAAcC,OAAd,CAAsBiB,QAAtB,EAAiC,MAHpD;MAKA3C,wBAAwB,CAACwB,OAAO,CAACe,IAAT,CAAxB;IACD,CAPI,CAQL;IARK,KASA;MACHE,OAAO,CAACC,GAAR,CAAY,sDAAZ;MACArC,OAAO,CAAC0C,IAAR;IACD;EACF;AACF,CArGL,CAsGI;AAtGJ;AAyGA1C,OAAO,CAAC2C,KAAR"}
|
package/esm/utils/Console.js
CHANGED
|
@@ -85,7 +85,7 @@ function error(message) {
|
|
|
85
85
|
switch (typeof message) {
|
|
86
86
|
case 'object':
|
|
87
87
|
console.dir(message, {
|
|
88
|
-
depth:
|
|
88
|
+
depth: 3
|
|
89
89
|
});
|
|
90
90
|
break;
|
|
91
91
|
|
|
@@ -93,17 +93,55 @@ function error(message) {
|
|
|
93
93
|
console.error(message.brightRed);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Output a debug message
|
|
98
|
+
* @param {Object} message the message
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
export function verbose(message) {
|
|
103
|
+
if (state.default.session.getVerbose()) {
|
|
104
|
+
switch (typeof message) {
|
|
105
|
+
case 'object':
|
|
106
|
+
console.dir(message, {
|
|
107
|
+
depth: 3
|
|
108
|
+
});
|
|
109
|
+
break;
|
|
110
|
+
|
|
111
|
+
default:
|
|
112
|
+
console.error(message);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Output a debug message
|
|
118
|
+
* @param {Object} message the message
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
export function debug(message) {
|
|
122
|
+
if (state.default.session.getDebug()) {
|
|
123
|
+
switch (typeof message) {
|
|
124
|
+
case 'object':
|
|
125
|
+
console.dir(message, {
|
|
126
|
+
depth: 10
|
|
127
|
+
});
|
|
128
|
+
break;
|
|
129
|
+
|
|
130
|
+
default:
|
|
131
|
+
console.error(message.brightMagenta);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
96
135
|
/**
|
|
97
136
|
* Prints a string message to console
|
|
98
137
|
*
|
|
99
138
|
* @param {string} message The string message to print
|
|
100
139
|
* @param {string} [type=text] "text", "info", "warn", "error" or "data". All but
|
|
101
140
|
* type="data" will be written to stderr.
|
|
102
|
-
* @param {boolean} [newline=true] Whether to add a
|
|
141
|
+
* @param {boolean} [newline=true] Whether to add a newline at the end of message
|
|
103
142
|
*
|
|
104
143
|
*/
|
|
105
144
|
|
|
106
|
-
|
|
107
145
|
export function printMessage(message, type = 'text', newline = true) {
|
|
108
146
|
// if (state.default.session.getItem('scriptFriendly')) {
|
|
109
147
|
switch (type) {
|
package/esm/utils/Console.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Console.js","names":["SingleBar","Presets","createSpinner","Table","state","Color","enable","data","message","console","dir","depth","log","text","error","info","brightCyan","warn","yellow","brightRed","printMessage","type","newline","process","stdout","write","stderr","createProgressBar","total","options","format","noTTYOutput","opt","pBar","default","session","getItem","legacy","start","setItem","updateProgressBar","increment","stopProgressBar","update","stop","showSpinner","spinner","stopSpinner","succeedSpinner","success","warnSpinner","failSpinner","spinSpinner","spin","createProgressIndicator","updateProgressIndicator","progressBar","stopProgressIndicator","status","createTable","head","table","chars","top","bottom","left","mid","right","style","createKeyValueTable","wordWrap","getObjectDepth","object","Object","Math","max","values","map","hasValues","has","keys","key","addRows","level","keyMap","space","push","hAlign","content","gray","indention","Array","fill","join","concat","createObjectTable"],"sources":["utils/Console.ts"],"sourcesContent":["import { SingleBar, Presets } from 'cli-progress';\nimport { createSpinner } from 'nanospinner';\nimport Table from 'cli-table3';\nimport { state } from '@rockcarver/frodo-lib';\nimport Color from 'colors';\n\nColor.enable();\n\n/**\n * Output a data message\n * @param {Object} message the message\n */\nfunction data(message) {\n switch (typeof message) {\n case 'object':\n console.dir(message, { depth: 3 });\n break;\n default:\n console.log(message);\n }\n}\n\n/**\n * Output a text message\n * @param {Object} message the message\n */\nfunction text(message) {\n switch (typeof message) {\n case 'object':\n console.dir(message, { depth: 3 });\n break;\n default:\n console.error(message);\n }\n}\n\n/**\n * Output an info message\n * @param {Object} message the message\n */\nfunction info(message) {\n switch (typeof message) {\n case 'object':\n console.dir(message, { depth: 3 });\n break;\n default:\n console.error(message.brightCyan);\n }\n}\n\n/**\n * Output a warn message\n * @param {Object} message the message\n */\nfunction warn(message) {\n switch (typeof message) {\n case 'object':\n console.dir(message, { depth: 3 });\n break;\n default:\n console.error(message.yellow);\n }\n}\n\n/**\n * Output an error message\n * @param {Object} message the message\n */\nfunction error(message) {\n switch (typeof message) {\n case 'object':\n console.dir(message, { depth: 4 });\n break;\n default:\n console.error(message.brightRed);\n }\n}\n\n/**\n * Prints a string message to console\n *\n * @param {string} message The string message to print\n * @param {string} [type=text] \"text\", \"info\", \"warn\", \"error\" or \"data\". All but\n * type=\"data\" will be written to stderr.\n * @param {boolean} [newline=true] Whether to add a new at the end of message\n *\n */\nexport function printMessage(message, type = 'text', newline = true) {\n // if (state.default.session.getItem('scriptFriendly')) {\n switch (type) {\n case 'data':\n if (newline) {\n data(message);\n } else {\n process.stdout.write(message);\n }\n break;\n case 'text':\n if (newline) {\n text(message);\n } else {\n process.stderr.write(message);\n }\n break;\n case 'info':\n if (newline) {\n info(message);\n } else {\n process.stderr.write(message['brightCyan']);\n }\n break;\n case 'warn':\n if (newline) {\n warn(message);\n } else {\n process.stderr.write(message.yellow);\n }\n break;\n case 'error':\n if (newline) {\n error(message);\n } else {\n process.stderr.write(message['brightRed']);\n }\n break;\n default:\n if (newline) {\n error(message);\n } else {\n process.stderr.write(message['bgBrightRed']);\n }\n }\n}\n\n/**\n * Creates a progress bar on stderr\n *\n * Example:\n * [========================================] 100% | 49/49 | Analyzing journey - transactional_auth\n *\n * @param {Number} total The total number of entries to track progress for\n * @param {String} message optional progress bar message\n * @param {Object} options progress bar configuration options\n *\n */\nexport function createProgressBar(\n total,\n message = null,\n options = {\n format: '[{bar}] {percentage}% | {value}/{total} | {data}',\n noTTYOutput: true,\n }\n) {\n let opt = options;\n if (message == null) {\n opt = {\n format: '[{bar}] {percentage}% | {value}/{total}',\n noTTYOutput: true,\n };\n }\n let pBar = state.default.session.getItem('progressBar');\n if (!pBar) pBar = new SingleBar(opt, Presets.legacy); // create only when needed\n pBar.start(total, 0, {\n data: message,\n });\n state.default.session.setItem('progressBar', pBar);\n}\n\n/**\n * Updates the progress bar by 1\n * @param {string} message optional message to update the progress bar\n *\n */\nexport function updateProgressBar(message = null) {\n const pBar = state.default.session.getItem('progressBar');\n if (message)\n pBar.increment({\n data: message,\n });\n else pBar.increment();\n}\n\n/**\n * Stop and hide the progress bar\n * @param {*} message optional message to update the progress bar\n */\nexport function stopProgressBar(message = null) {\n const pBar = state.default.session.getItem('progressBar');\n if (message)\n pBar.update({\n data: message,\n });\n pBar.stop();\n}\n\n/**\n * Create the spinner\n * @param {String} message optional spinner message\n */\nexport function showSpinner(message) {\n const spinner = createSpinner(message).start();\n state.default.session.setItem('Spinner', spinner);\n}\n\n/**\n * Stop the spinner\n * @param {String} message optional message to update the spinner\n */\nexport function stopSpinner(message = null) {\n const spinner = state.default.session.getItem('Spinner');\n if (spinner) {\n let options = {};\n if (message) options = { text: message };\n spinner.stop(options);\n }\n}\n\n/**\n * Succeed the spinner. Stop and render success checkmark with optional message.\n * @param {String} message optional message to update the spinner\n */\nexport function succeedSpinner(message = null) {\n const spinner = state.default.session.getItem('Spinner');\n if (spinner) {\n let options = {};\n if (message) options = { text: message };\n spinner.success(options);\n }\n}\n\n/**\n * Warn the spinner\n * @param {String} message optional message to update the spinner\n */\nexport function warnSpinner(message = null) {\n const spinner = state.default.session.getItem('Spinner');\n if (spinner) {\n let options = {};\n if (message) options = { text: message };\n spinner.warn(options);\n }\n}\n\n/**\n * Fail the spinner\n * @param {String} message optional message to update the spinner\n */\nexport function failSpinner(message = null) {\n const spinner = state.default.session.getItem('Spinner');\n if (spinner) {\n let options = {};\n if (message) options = { text: message };\n spinner.error(options);\n }\n}\n\n/**\n * Spin the spinner\n * @param {String} message optional message to update the spinner\n */\nexport function spinSpinner(message = null) {\n const spinner = state.default.session.getItem('Spinner');\n if (spinner) {\n let options = {};\n if (message) options = { text: message };\n spinner.update(options);\n spinner.spin();\n }\n}\n\nexport function createProgressIndicator(\n type = 'determinate',\n total = 0,\n message = null\n) {\n if (type === 'determinate') {\n createProgressBar(total, message);\n } else {\n showSpinner(message);\n }\n}\n\nexport function updateProgressIndicator(message) {\n const progressBar = state.default.session.getItem('progressBar');\n if (!progressBar) {\n spinSpinner(message);\n } else {\n updateProgressBar(message);\n }\n}\n\nexport function stopProgressIndicator(message, status = 'none') {\n const progressBar = state.default.session.getItem('progressBar');\n if (!progressBar) {\n switch (status) {\n case 'none':\n stopSpinner(message);\n break;\n case 'success':\n succeedSpinner(message);\n break;\n case 'warn':\n warnSpinner(message);\n break;\n case 'fail':\n failSpinner(message);\n break;\n default:\n stopSpinner(message);\n break;\n }\n } else {\n stopProgressBar(message);\n }\n}\n\n/**\n * Create an empty table\n * @param {string[]} head header row as an array of strings\n * @returns {any} an empty table\n */\nexport function createTable(head) {\n const table = new Table({\n head,\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n },\n style: { 'padding-left': 0, 'padding-right': 0, head: ['brightCyan'] },\n });\n return table;\n}\n\n/**\n * Create a new key/value table\n * @returns {any} an empty key/value table\n */\nexport function createKeyValueTable() {\n const table = new Table({\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n },\n style: { 'padding-left': 0, 'padding-right': 0 },\n wordWrap: true,\n });\n return table;\n}\n\n/**\n * Helper function to determine the total depth of an object\n * @param {Object} object input object\n * @returns {Number} total depth of the input object\n */\nfunction getObjectDepth(object) {\n return Object(object) === object\n ? 1 + Math.max(-1, ...Object.values(object).map(getObjectDepth))\n : 0;\n}\n\n/**\n * Helper function to determine if an object has values\n * @param {Object} object input object\n * @returns {boolean} true of the object or any of its sub-objects contain values, false otherwise\n */\nfunction hasValues(object) {\n let has = false;\n const keys = Object.keys(object);\n for (const key of keys) {\n if (Object(object[key]) !== object[key]) {\n return true;\n }\n has = has || hasValues(object[key]);\n }\n return has;\n}\n\n/**\n * Helper function (recursive) to add rows to an object table\n * @param {object} object object to render\n * @param {number} depth total depth of initial object\n * @param {number} level current level\n * @param {any} table the object table to add the rows to\n * @returns the updated object table\n */\nfunction addRows(object, depth, level, table, keyMap) {\n const space = ' ';\n const keys = Object.keys(object);\n for (const key of keys) {\n if (Object(object[key]) !== object[key]) {\n if (level === 1) {\n table.push([\n keyMap[key] ? keyMap[key].brightCyan : key['brightCyan'],\n object[key],\n ]);\n } else {\n table.push([\n {\n hAlign: 'right',\n content: keyMap[key] ? keyMap[key].gray : key.gray,\n },\n object[key],\n ]);\n }\n }\n }\n for (const key of keys) {\n if (Object(object[key]) === object[key]) {\n // only print header if there are any values below\n if (hasValues(object[key])) {\n let indention = new Array(level).fill(space).join('');\n if (level < 3) indention = `\\n${indention}`;\n table.push([\n indention.concat(\n keyMap[key] ? keyMap[key].brightCyan : key['brightCyan']\n ),\n '',\n ]);\n }\n // eslint-disable-next-line no-param-reassign\n table = addRows(object[key], depth, level + 1, table, keyMap);\n }\n }\n return table;\n}\n\n/**\n * Create and populate an object table from any JSON object. Use for describe commands.\n * @param {Object} object JSON object to create\n * @returns {any} a table that can be printed to the console\n */\nexport function createObjectTable(object, keyMap = {}) {\n // eslint-disable-next-line no-param-reassign\n const depth = getObjectDepth(object);\n // eslint-disable-next-line no-param-reassign\n const level = 0;\n // eslint-disable-next-line no-param-reassign\n const table = new Table({\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n },\n style: { 'padding-left': 0, 'padding-right': 0, head: ['brightCyan'] },\n });\n addRows(object, depth, level + 1, table, keyMap);\n return table;\n}\n"],"mappings":"AAAA,SAASA,SAAT,EAAoBC,OAApB,QAAmC,cAAnC;AACA,SAASC,aAAT,QAA8B,aAA9B;AACA,OAAOC,KAAP,MAAkB,YAAlB;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,OAAOC,KAAP,MAAkB,QAAlB;AAEAA,KAAK,CAACC,MAAN;AAEA;AACA;AACA;AACA;;AACA,SAASC,IAAT,CAAcC,OAAd,EAAuB;EACrB,QAAQ,OAAOA,OAAf;IACE,KAAK,QAAL;MACEC,OAAO,CAACC,GAAR,CAAYF,OAAZ,EAAqB;QAAEG,KAAK,EAAE;MAAT,CAArB;MACA;;IACF;MACEF,OAAO,CAACG,GAAR,CAAYJ,OAAZ;EALJ;AAOD;AAED;AACA;AACA;AACA;;;AACA,SAASK,IAAT,CAAcL,OAAd,EAAuB;EACrB,QAAQ,OAAOA,OAAf;IACE,KAA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AAC,YAAD,CAD5C,CADS,EAIT,EAJS,CAAX;MAMD,CAXsC,CAYvC;;;MACApB,KAAK,GAAGqB,OAAO,CAACV,MAAM,CAACS,GAAD,CAAP,EAActE,KAAd,EAAqBwE,KAAK,GAAG,CAA7B,EAAgCtB,KAAhC,EAAuCuB,MAAvC,CAAf;IACD;EACF;;EACD,OAAOvB,KAAP;AACD;AAED;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASkC,iBAAT,CAA2BvB,MAA3B,EAAmCY,MAAM,GAAG,EAA5C,EAAgD;EACrD;EACA,MAAMzE,KAAK,GAAG4D,cAAc,CAACC,MAAD,CAA5B,CAFqD,CAGrD;;EACA,MAAMW,KAAK,GAAG,CAAd,CAJqD,CAKrD;;EACA,MAAMtB,KAAK,GAAG,IAAI1D,KAAJ,CAAU;IACtB2D,KAAK,EAAE;MACLC,GAAG,EAAE,EADA;MAEL,WAAW,EAFN;MAGL,YAAY,EAHP;MAIL,aAAa,EAJR;MAKLC,MAAM,EAAE,EALH;MAML,cAAc,EANT;MAOL,eAAe,EAPV;MAQL,gBAAgB,EARX;MASLC,IAAI,EAAE,EATD;MAUL,YAAY,EAVP;MAWLC,GAAG,EAAE,EAXA;MAYL,WAAW,EAZN;MAaLC,KAAK,EAAE,EAbF;MAcL,aAAa;IAdR,CADe;IAiBtBC,KAAK,EAAE;MAAE,gBAAgB,CAAlB;MAAqB,iBAAiB,CAAtC;MAAyCR,IAAI,EAAE,CAAC,YAAD;IAA/C;EAjBe,CAAV,CAAd;EAmBAsB,OAAO,CAACV,MAAD,EAAS7D,KAAT,EAAgBwE,KAAK,GAAG,CAAxB,EAA2BtB,KAA3B,EAAkCuB,MAAlC,CAAP;EACA,OAAOvB,KAAP;AACD"}
|
|
1
|
+
{"version":3,"file":"Console.js","names":["SingleBar","Presets","createSpinner","Table","state","Color","enable","data","message","console","dir","depth","log","text","error","info","brightCyan","warn","yellow","brightRed","verbose","default","session","getVerbose","debug","getDebug","brightMagenta","printMessage","type","newline","process","stdout","write","stderr","createProgressBar","total","options","format","noTTYOutput","opt","pBar","getItem","legacy","start","setItem","updateProgressBar","increment","stopProgressBar","update","stop","showSpinner","spinner","stopSpinner","succeedSpinner","success","warnSpinner","failSpinner","spinSpinner","spin","createProgressIndicator","updateProgressIndicator","progressBar","stopProgressIndicator","status","createTable","head","table","chars","top","bottom","left","mid","right","style","createKeyValueTable","wordWrap","getObjectDepth","object","Object","Math","max","values","map","hasValues","has","keys","key","addRows","level","keyMap","space","push","hAlign","content","gray","indention","Array","fill","join","concat","createObjectTable"],"sources":["utils/Console.ts"],"sourcesContent":["import { SingleBar, Presets } from 'cli-progress';\nimport { createSpinner } from 'nanospinner';\nimport Table from 'cli-table3';\nimport { state } from '@rockcarver/frodo-lib';\nimport Color from 'colors';\n\nColor.enable();\n\n/**\n * Output a data message\n * @param {Object} message the message\n */\nfunction data(message) {\n switch (typeof message) {\n case 'object':\n console.dir(message, { depth: 3 });\n break;\n default:\n console.log(message);\n }\n}\n\n/**\n * Output a text message\n * @param {Object} message the message\n */\nfunction text(message) {\n switch (typeof message) {\n case 'object':\n console.dir(message, { depth: 3 });\n break;\n default:\n console.error(message);\n }\n}\n\n/**\n * Output an info message\n * @param {Object} message the message\n */\nfunction info(message) {\n switch (typeof message) {\n case 'object':\n console.dir(message, { depth: 3 });\n break;\n default:\n console.error(message.brightCyan);\n }\n}\n\n/**\n * Output a warn message\n * @param {Object} message the message\n */\nfunction warn(message) {\n switch (typeof message) {\n case 'object':\n console.dir(message, { depth: 3 });\n break;\n default:\n console.error(message.yellow);\n }\n}\n\n/**\n * Output an error message\n * @param {Object} message the message\n */\nfunction error(message) {\n switch (typeof message) {\n case 'object':\n console.dir(message, { depth: 3 });\n break;\n default:\n console.error(message.brightRed);\n }\n}\n\n/**\n * Output a debug message\n * @param {Object} message the message\n */\nexport function verbose(message) {\n if (state.default.session.getVerbose()) {\n switch (typeof message) {\n case 'object':\n console.dir(message, { depth: 3 });\n break;\n default:\n console.error(message);\n }\n }\n}\n\n/**\n * Output a debug message\n * @param {Object} message the message\n */\nexport function debug(message) {\n if (state.default.session.getDebug()) {\n switch (typeof message) {\n case 'object':\n console.dir(message, { depth: 10 });\n break;\n default:\n console.error(message.brightMagenta);\n }\n }\n}\n\n/**\n * Prints a string message to console\n *\n * @param {string} message The string message to print\n * @param {string} [type=text] \"text\", \"info\", \"warn\", \"error\" or \"data\". All but\n * type=\"data\" will be written to stderr.\n * @param {boolean} [newline=true] Whether to add a newline at the end of message\n *\n */\nexport function printMessage(message, type = 'text', newline = true) {\n // if (state.default.session.getItem('scriptFriendly')) {\n switch (type) {\n case 'data':\n if (newline) {\n data(message);\n } else {\n process.stdout.write(message);\n }\n break;\n case 'text':\n if (newline) {\n text(message);\n } else {\n process.stderr.write(message);\n }\n break;\n case 'info':\n if (newline) {\n info(message);\n } else {\n process.stderr.write(message['brightCyan']);\n }\n break;\n case 'warn':\n if (newline) {\n warn(message);\n } else {\n process.stderr.write(message.yellow);\n }\n break;\n case 'error':\n if (newline) {\n error(message);\n } else {\n process.stderr.write(message['brightRed']);\n }\n break;\n default:\n if (newline) {\n error(message);\n } else {\n process.stderr.write(message['bgBrightRed']);\n }\n }\n}\n\n/**\n * Creates a progress bar on stderr\n *\n * Example:\n * [========================================] 100% | 49/49 | Analyzing journey - transactional_auth\n *\n * @param {Number} total The total number of entries to track progress for\n * @param {String} message optional progress bar message\n * @param {Object} options progress bar configuration options\n *\n */\nexport function createProgressBar(\n total,\n message = null,\n options = {\n format: '[{bar}] {percentage}% | {value}/{total} | {data}',\n noTTYOutput: true,\n }\n) {\n let opt = options;\n if (message == null) {\n opt = {\n format: '[{bar}] {percentage}% | {value}/{total}',\n noTTYOutput: true,\n };\n }\n let pBar = state.default.session.getItem('progressBar');\n if (!pBar) pBar = new SingleBar(opt, Presets.legacy); // create only when needed\n pBar.start(total, 0, {\n data: message,\n });\n state.default.session.setItem('progressBar', pBar);\n}\n\n/**\n * Updates the progress bar by 1\n * @param {string} message optional message to update the progress bar\n *\n */\nexport function updateProgressBar(message = null) {\n const pBar = state.default.session.getItem('progressBar');\n if (message)\n pBar.increment({\n data: message,\n });\n else pBar.increment();\n}\n\n/**\n * Stop and hide the progress bar\n * @param {*} message optional message to update the progress bar\n */\nexport function stopProgressBar(message = null) {\n const pBar = state.default.session.getItem('progressBar');\n if (message)\n pBar.update({\n data: message,\n });\n pBar.stop();\n}\n\n/**\n * Create the spinner\n * @param {String} message optional spinner message\n */\nexport function showSpinner(message) {\n const spinner = createSpinner(message).start();\n state.default.session.setItem('Spinner', spinner);\n}\n\n/**\n * Stop the spinner\n * @param {String} message optional message to update the spinner\n */\nexport function stopSpinner(message = null) {\n const spinner = state.default.session.getItem('Spinner');\n if (spinner) {\n let options = {};\n if (message) options = { text: message };\n spinner.stop(options);\n }\n}\n\n/**\n * Succeed the spinner. Stop and render success checkmark with optional message.\n * @param {String} message optional message to update the spinner\n */\nexport function succeedSpinner(message = null) {\n const spinner = state.default.session.getItem('Spinner');\n if (spinner) {\n let options = {};\n if (message) options = { text: message };\n spinner.success(options);\n }\n}\n\n/**\n * Warn the spinner\n * @param {String} message optional message to update the spinner\n */\nexport function warnSpinner(message = null) {\n const spinner = state.default.session.getItem('Spinner');\n if (spinner) {\n let options = {};\n if (message) options = { text: message };\n spinner.warn(options);\n }\n}\n\n/**\n * Fail the spinner\n * @param {String} message optional message to update the spinner\n */\nexport function failSpinner(message = null) {\n const spinner = state.default.session.getItem('Spinner');\n if (spinner) {\n let options = {};\n if (message) options = { text: message };\n spinner.error(options);\n }\n}\n\n/**\n * Spin the spinner\n * @param {String} message optional message to update the spinner\n */\nexport function spinSpinner(message = null) {\n const spinner = state.default.session.getItem('Spinner');\n if (spinner) {\n let options = {};\n if (message) options = { text: message };\n spinner.update(options);\n spinner.spin();\n }\n}\n\nexport function createProgressIndicator(\n type = 'determinate',\n total = 0,\n message = null\n) {\n if (type === 'determinate') {\n createProgressBar(total, message);\n } else {\n showSpinner(message);\n }\n}\n\nexport function updateProgressIndicator(message) {\n const progressBar = state.default.session.getItem('progressBar');\n if (!progressBar) {\n spinSpinner(message);\n } else {\n updateProgressBar(message);\n }\n}\n\nexport function stopProgressIndicator(message, status = 'none') {\n const progressBar = state.default.session.getItem('progressBar');\n if (!progressBar) {\n switch (status) {\n case 'none':\n stopSpinner(message);\n break;\n case 'success':\n succeedSpinner(message);\n break;\n case 'warn':\n warnSpinner(message);\n break;\n case 'fail':\n failSpinner(message);\n break;\n default:\n stopSpinner(message);\n break;\n }\n } else {\n stopProgressBar(message);\n }\n}\n\n/**\n * Create an empty table\n * @param {string[]} head header row as an array of strings\n * @returns {any} an empty table\n */\nexport function createTable(head) {\n const table = new Table({\n head,\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n },\n style: { 'padding-left': 0, 'padding-right': 0, head: ['brightCyan'] },\n });\n return table;\n}\n\n/**\n * Create a new key/value table\n * @returns {any} an empty key/value table\n */\nexport function createKeyValueTable() {\n const table = new Table({\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n },\n style: { 'padding-left': 0, 'padding-right': 0 },\n wordWrap: true,\n });\n return table;\n}\n\n/**\n * Helper function to determine the total depth of an object\n * @param {Object} object input object\n * @returns {Number} total depth of the input object\n */\nfunction getObjectDepth(object) {\n return Object(object) === object\n ? 1 + Math.max(-1, ...Object.values(object).map(getObjectDepth))\n : 0;\n}\n\n/**\n * Helper function to determine if an object has values\n * @param {Object} object input object\n * @returns {boolean} true of the object or any of its sub-objects contain values, false otherwise\n */\nfunction hasValues(object) {\n let has = false;\n const keys = Object.keys(object);\n for (const key of keys) {\n if (Object(object[key]) !== object[key]) {\n return true;\n }\n has = has || hasValues(object[key]);\n }\n return has;\n}\n\n/**\n * Helper function (recursive) to add rows to an object table\n * @param {object} object object to render\n * @param {number} depth total depth of initial object\n * @param {number} level current level\n * @param {any} table the object table to add the rows to\n * @returns the updated object table\n */\nfunction addRows(object, depth, level, table, keyMap) {\n const space = ' ';\n const keys = Object.keys(object);\n for (const key of keys) {\n if (Object(object[key]) !== object[key]) {\n if (level === 1) {\n table.push([\n keyMap[key] ? keyMap[key].brightCyan : key['brightCyan'],\n object[key],\n ]);\n } else {\n table.push([\n {\n hAlign: 'right',\n content: keyMap[key] ? keyMap[key].gray : key.gray,\n },\n object[key],\n ]);\n }\n }\n }\n for (const key of keys) {\n if (Object(object[key]) === object[key]) {\n // only print header if there are any values below\n if (hasValues(object[key])) {\n let indention = new Array(level).fill(space).join('');\n if (level < 3) indention = `\\n${indention}`;\n table.push([\n indention.concat(\n keyMap[key] ? keyMap[key].brightCyan : key['brightCyan']\n ),\n '',\n ]);\n }\n // eslint-disable-next-line no-param-reassign\n table = addRows(object[key], depth, level + 1, table, keyMap);\n }\n }\n return table;\n}\n\n/**\n * Create and populate an object table from any JSON object. Use for describe commands.\n * @param {Object} object JSON object to create\n * @returns {any} a table that can be printed to the console\n */\nexport function createObjectTable(object, keyMap = {}) {\n // eslint-disable-next-line no-param-reassign\n const depth = getObjectDepth(object);\n // eslint-disable-next-line no-param-reassign\n const level = 0;\n // eslint-disable-next-line no-param-reassign\n const table = new Table({\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n },\n style: { 'padding-left': 0, 'padding-right': 0, head: ['brightCyan'] },\n });\n addRows(object, depth, level + 1, table, keyMap);\n return table;\n}\n"],"mappings":"AAAA,SAASA,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"description": "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
|
|
6
6
|
"keywords": [
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"test:e2e": "node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand e2e",
|
|
36
36
|
"test:e2e:list": "node --experimental-vm-modules node_modules/jest/bin/jest.js --listTests e2e",
|
|
37
37
|
"lint": "npx eslint --ext .js --ignore-path .gitignore .",
|
|
38
|
-
"build": "npx gulp",
|
|
39
|
-
"build:local": "npx gulp build-local",
|
|
40
|
-
"build:binary": "npx gulp build-binary",
|
|
38
|
+
"build": "npx tsc && npx gulp",
|
|
39
|
+
"build:local": "npx tsc && npx gulp build-local",
|
|
40
|
+
"build:binary": "npx tsc && npx gulp build-binary",
|
|
41
41
|
"watch": "npx gulp watch"
|
|
42
42
|
},
|
|
43
43
|
"contributors": [
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
]
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@rockcarver/frodo-lib": "0.
|
|
91
|
+
"@rockcarver/frodo-lib": "0.14.1",
|
|
92
92
|
"cli-progress": "^3.11.2",
|
|
93
93
|
"cli-table3": "^0.6.2",
|
|
94
94
|
"colors": "^1.4.0",
|