@rockcarver/frodo-cli 0.19.4 → 0.19.5-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.19.5-0] - 2023-01-12
11
+
10
12
  ## [0.19.4] - 2023-01-09
11
13
 
12
14
  ## [0.19.3] - 2023-01-07
@@ -843,7 +845,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
843
845
  - Fixed problem with adding connection profiles
844
846
  - Miscellaneous bug fixes
845
847
 
846
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.19.4...HEAD
848
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.19.5-0...HEAD
849
+
850
+ [0.19.5-0]: https://github.com/rockcarver/frodo-cli/compare/v0.19.4...v0.19.5-0
847
851
 
848
852
  [0.19.4]: https://github.com/rockcarver/frodo-cli/compare/v0.19.3...v0.19.4
849
853
 
@@ -1,38 +1,49 @@
1
1
  import { FrodoCommand } from '../FrodoCommand';
2
2
  import { Option } from 'commander';
3
- import { Authenticate, state } from '@rockcarver/frodo-lib';
4
- import { printMessage, verboseMessage } from '../../utils/Console';
3
+ import { Authenticate, Info, state } from '@rockcarver/frodo-lib';
4
+ import { createObjectTable, printMessage, verboseMessage } from '../../utils/Console';
5
5
  const {
6
6
  getTokens
7
7
  } = Authenticate;
8
+ const {
9
+ getInfo
10
+ } = Info;
8
11
  export default function setup() {
9
12
  const info = new FrodoCommand('info', ['realm']);
10
13
  info.description('Print versions and tokens.').addOption(new Option('-s, --scriptFriendly', 'Send output of operation to STDOUT in a script-friendly format (JSON) which can be piped to other commands. User messages/warnings are output to STDERR, and are not piped. For example, to only get bearer token: \n<<< frodo info my-tenant -s 2>/dev/null | jq -r .bearerToken >>>').default(false, 'Output as plain text')).action(async (host, user, password, options, command) => {
11
14
  command.handleDefaultArgsAndOpts(host, user, password, options, command);
12
- if (!options.scriptFriendly) {
13
- verboseMessage('Printing versions and tokens...');
14
- if (await getTokens()) {
15
- printMessage(`Cookie name: ${state.getCookieName()}`);
15
+ if (await getTokens()) {
16
+ const info = await getInfo();
17
+ if (!options.scriptFriendly) {
18
+ verboseMessage('Printing info, versions, and tokens...');
19
+ delete info.sessionToken;
20
+ delete info.bearerToken;
21
+ const labels = {
22
+ amVersion: 'AM Version',
23
+ authenticatedSubject: 'Subject (Type)',
24
+ config_promotion_done: 'Promotion Done',
25
+ cookieName: 'Cookie Name',
26
+ deploymentType: 'Deployment Type',
27
+ host: 'Host URL',
28
+ immutable: 'Immutable',
29
+ locked: 'Locked',
30
+ placeholder_management: 'Placeholder Management',
31
+ region: 'Region',
32
+ tier: 'Tier'
33
+ };
34
+ const table = createObjectTable(info, labels);
35
+ printMessage(`\n${table.toString()}`);
16
36
  if (state.getCookieValue()) {
17
- printMessage(`Session token: ${state.getCookieValue()}`);
37
+ printMessage(`\nSession token:`, 'info');
38
+ printMessage(`${state.getCookieValue()}`);
18
39
  }
19
40
  if (state.getBearerToken()) {
20
- printMessage(`Bearer token: ${state.getBearerToken()}`);
41
+ printMessage(`\nBearer token:`, 'info');
42
+ printMessage(`${state.getBearerToken()}`);
21
43
  }
22
44
  } else {
23
- process.exitCode = 1;
24
- }
25
- } else if (await getTokens()) {
26
- const output = {
27
- cookieName: state.getCookieName()
28
- };
29
- if (state.getCookieValue()) {
30
- output['sessionToken'] = state.getCookieValue();
31
- }
32
- if (state.getBearerToken()) {
33
- output['bearerToken'] = state.getBearerToken();
45
+ printMessage(JSON.stringify(info, null, 2), 'data');
34
46
  }
35
- printMessage(JSON.stringify(output, null, 2), 'data');
36
47
  } else {
37
48
  process.exitCode = 1;
38
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"info.js","names":["FrodoCommand","Option","Authenticate","state","printMessage","verboseMessage","getTokens","setup","info","description","addOption","default","action","host","user","password","options","command","handleDefaultArgsAndOpts","scriptFriendly","getCookieName","getCookieValue","getBearerToken","process","exitCode","output","cookieName","JSON","stringify","showHelpAfterError"],"sources":["cli/info/info.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, state } from '@rockcarver/frodo-lib';\nimport { printMessage, verboseMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\n\nexport default function setup() {\n const info = new FrodoCommand('info', ['realm']);\n info\n .description('Print versions and tokens.')\n .addOption(\n new Option(\n '-s, --scriptFriendly',\n 'Send output of operation to STDOUT in a script-friendly format (JSON) which can be piped to other commands. User messages/warnings are output to STDERR, and are not piped. For example, to only get bearer token: \\n<<< frodo info my-tenant -s 2>/dev/null | jq -r .bearerToken >>>'\n ).default(false, 'Output as plain text')\n )\n .action(async (host, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(host, user, password, options, command);\n if (!options.scriptFriendly) {\n verboseMessage('Printing versions and tokens...');\n if (await getTokens()) {\n printMessage(`Cookie name: ${state.getCookieName()}`);\n if (state.getCookieValue()) {\n printMessage(`Session token: ${state.getCookieValue()}`);\n }\n if (state.getBearerToken()) {\n printMessage(`Bearer token: ${state.getBearerToken()}`);\n }\n } else {\n process.exitCode = 1;\n }\n } else if (await getTokens()) {\n const output = {\n cookieName: state.getCookieName(),\n };\n if (state.getCookieValue()) {\n output['sessionToken'] = state.getCookieValue();\n }\n if (state.getBearerToken()) {\n output['bearerToken'] = state.getBearerToken();\n }\n printMessage(JSON.stringify(output, null, 2), 'data');\n } else {\n process.exitCode = 1;\n }\n });\n info.showHelpAfterError();\n return info;\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,EAAEC,KAAK,QAAQ,uBAAuB;AAC3D,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAElE,MAAM;EAAEC;AAAU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,CAACmB,cAAc,EAAE,EAAE;QAC1BG,MAAM,CAAC,aAAa,CAAC,GAAGtB,KAAK,CAACmB,cAAc,EAAE;MAChD;MACAlB,YAAY,CAACuB,IAAI,CAACC,SAAS,CAACH,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IACvD,CAAC,MAAM;MACLF,OAAO,CAACC,QAAQ,GAAG,CAAC;IACtB;EACF,CAAC,CAAC;EACJhB,IAAI,CAACqB,kBAAkB,EAAE;EACzB,OAAOrB,IAAI;AACb"}
1
+ {"version":3,"file":"info.js","names":["FrodoCommand","Option","Authenticate","Info","state","createObjectTable","printMessage","verboseMessage","getTokens","getInfo","setup","info","description","addOption","default","action","host","user","password","options","command","handleDefaultArgsAndOpts","scriptFriendly","sessionToken","bearerToken","labels","amVersion","authenticatedSubject","config_promotion_done","cookieName","deploymentType","immutable","locked","placeholder_management","region","tier","table","toString","getCookieValue","getBearerToken","JSON","stringify","process","exitCode","showHelpAfterError"],"sources":["cli/info/info.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, Info, state } from '@rockcarver/frodo-lib';\nimport {\n createObjectTable,\n printMessage,\n verboseMessage,\n} from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\nconst { getInfo } = Info;\n\nexport default function setup() {\n const info = new FrodoCommand('info', ['realm']);\n info\n .description('Print versions and tokens.')\n .addOption(\n new Option(\n '-s, --scriptFriendly',\n 'Send output of operation to STDOUT in a script-friendly format (JSON) which can be piped to other commands. User messages/warnings are output to STDERR, and are not piped. For example, to only get bearer token: \\n<<< frodo info my-tenant -s 2>/dev/null | jq -r .bearerToken >>>'\n ).default(false, 'Output as plain text')\n )\n .action(async (host, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(host, user, password, options, command);\n if (await getTokens()) {\n const info = await getInfo();\n if (!options.scriptFriendly) {\n verboseMessage('Printing info, versions, and tokens...');\n delete info.sessionToken;\n delete info.bearerToken;\n const labels = {\n amVersion: 'AM Version',\n authenticatedSubject: 'Subject (Type)',\n config_promotion_done: 'Promotion Done',\n cookieName: 'Cookie Name',\n deploymentType: 'Deployment Type',\n host: 'Host URL',\n immutable: 'Immutable',\n locked: 'Locked',\n placeholder_management: 'Placeholder Management',\n region: 'Region',\n tier: 'Tier',\n };\n const table = createObjectTable(info, labels);\n printMessage(`\\n${table.toString()}`);\n if (state.getCookieValue()) {\n printMessage(`\\nSession token:`, 'info');\n printMessage(`${state.getCookieValue()}`);\n }\n if (state.getBearerToken()) {\n printMessage(`\\nBearer token:`, 'info');\n printMessage(`${state.getBearerToken()}`);\n }\n } else {\n printMessage(JSON.stringify(info, null, 2), 'data');\n }\n } else {\n process.exitCode = 1;\n }\n });\n info.showHelpAfterError();\n return info;\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,EAAEC,IAAI,EAAEC,KAAK,QAAQ,uBAAuB;AACjE,SACEC,iBAAiB,EACjBC,YAAY,EACZC,cAAc,QACT,qBAAqB;AAE5B,MAAM;EAAEC;AAAU,CAAC,GAAGN,YAAY;AAClC,MAAM;EAAEO;AAAQ,CAAC,GAAGN,IAAI;AAExB,eAAe,SAASO,KAAK,GAAG;EAC9B,MAAMC,IAAI,GAAG,IAAIX,YAAY,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC;EAChDW,IAAI,CACDC,WAAW,CAAC,4BAA4B,CAAC,CACzCC,SAAS,CACR,IAAIZ,MAAM,CACR,sBAAsB,EACtB,uRAAuR,CACxR,CAACa,OAAO,CAAC,KAAK,EAAE,sBAAsB,CAAC,CACzC,CACAC,MAAM,CAAC,OAAOC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;IACxDA,OAAO,CAACC,wBAAwB,CAACL,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC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JhC,IAAI,CAACiC,kBAAkB,EAAE;EACzB,OAAOjC,IAAI;AACb"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-cli",
3
- "version": "0.19.4",
3
+ "version": "0.19.5-0",
4
4
  "type": "module",
5
5
  "description": "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
6
6
  "keywords": [
@@ -39,6 +39,9 @@
39
39
  "build:binary": "npx tsc && npx gulp build-binary",
40
40
  "watch": "npx gulp watch"
41
41
  },
42
+ "jest": {
43
+ "testTimeout": 30000
44
+ },
42
45
  "contributors": [
43
46
  {
44
47
  "name": "Sandeep Chaturvedi",
@@ -100,7 +103,7 @@
100
103
  ]
101
104
  },
102
105
  "dependencies": {
103
- "@rockcarver/frodo-lib": "0.17.6",
106
+ "@rockcarver/frodo-lib": "0.17.8-1",
104
107
  "cli-progress": "^3.11.2",
105
108
  "cli-table3": "^0.6.3",
106
109
  "colors": "^1.4.0",