@rockcarver/frodo-cli 0.20.0 → 0.20.1-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 CHANGED
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.20.1-1] - 2023-01-16
11
+
12
+ ## [0.20.1-0] - 2023-01-15
13
+
14
+ ### Fixed
15
+
16
+ - \#176: frodo logs fetch end timestamp ignored
17
+
10
18
  ## [0.20.0] - 2023-01-13
11
19
 
12
20
  ### Added
@@ -954,7 +962,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
954
962
  - Fixed problem with adding connection profiles
955
963
  - Miscellaneous bug fixes
956
964
 
957
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.20.0...HEAD
965
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.20.1-1...HEAD
966
+
967
+ [0.20.1-1]: https://github.com/rockcarver/frodo-cli/compare/v0.20.1-0...v0.20.1-1
968
+
969
+ [0.20.1-0]: https://github.com/rockcarver/frodo-cli/compare/v0.20.0...v0.20.1-0
958
970
 
959
971
  [0.20.0]: https://github.com/rockcarver/frodo-cli/compare/v0.19.5-2...v0.20.0
960
972
 
@@ -19,7 +19,7 @@ const {
19
19
  const SECONDS_IN_30_DAYS = 2592000;
20
20
  const SECONDS_IN_1_HOUR = 3600;
21
21
  const LOG_TIME_WINDOW_MAX = SECONDS_IN_30_DAYS;
22
- const LOG_TIME_WINDOW_INCREMENT = SECONDS_IN_1_HOUR;
22
+ const LOG_TIME_WINDOW_INCREMENT = 1;
23
23
  const program = new FrodoCommand('frodo logs fetch', ['realm', 'type']);
24
24
  program.description('Fetch Identity Cloud logs between a specified begin and end time period.\
25
25
  WARNING: depending on filters and time period specified, this could take substantial time to complete.').addOption(sourcesOptionM).addOption(new Option('-l, --level <level>', 'Set log level filter. You can specify the level as a number or a string. \
@@ -32,63 +32,66 @@ Cannot be more than 30 days in the past. If not specified, logs from one hour ag
32
32
  command.handleDefaultArgsAndOpts(host, user, password, options, command);
33
33
  let credsFromParameters = true;
34
34
  const conn = await getConnectionProfile();
35
- state.setHost(conn.tenant);
36
- if (conn.logApiKey != null && conn.logApiSecret != null) {
37
- credsFromParameters = false;
38
- state.setLogApiKey(conn.logApiKey);
39
- state.setLogApiSecret(conn.logApiSecret);
40
- } else {
41
- if (conn.username == null && conn.password == null) {
42
- if (!state.getUsername() && !state.getPassword()) {
43
- credsFromParameters = false;
44
- printMessage('User credentials not specified as parameters and no saved API key and secret found!', 'warn');
45
- return;
46
- }
35
+ if (conn) {
36
+ state.setHost(conn.tenant);
37
+ if (conn.logApiKey != null && conn.logApiSecret != null) {
38
+ credsFromParameters = false;
39
+ state.setLogApiKey(conn.logApiKey);
40
+ state.setLogApiSecret(conn.logApiSecret);
47
41
  } else {
48
- state.setUsername(conn.username);
49
- state.setPassword(conn.password);
42
+ if (conn.username == null && conn.password == null) {
43
+ if (!state.getUsername() && !state.getPassword()) {
44
+ credsFromParameters = false;
45
+ printMessage('User credentials not specified as parameters and no saved API key and secret found!', 'warn');
46
+ return;
47
+ }
48
+ } else {
49
+ state.setUsername(conn.username);
50
+ state.setPassword(conn.password);
51
+ }
52
+ if (await getTokens()) {
53
+ const creds = await provisionCreds();
54
+ state.setLogApiKey(creds.api_key_id);
55
+ state.setLogApiSecret(creds.api_key_secret);
56
+ }
50
57
  }
51
- if (await getTokens()) {
52
- const creds = await provisionCreds();
53
- state.setLogApiKey(creds.api_key_id);
54
- state.setLogApiSecret(creds.api_key_secret);
58
+ const now = Date.now() / 1000;
59
+ const nowString = new Date(now * 1000).toISOString();
60
+ if (typeof options.beginTimestamp === 'undefined' || !options.beginTimestamp) {
61
+ // no beginTimestamp value specified, default is 1 hour ago
62
+ const tempStartDate = new Date();
63
+ tempStartDate.setTime((now - SECONDS_IN_1_HOUR) * 1000);
64
+ options.beginTimestamp = tempStartDate.toISOString();
65
+ // also override endTimestamp to now
66
+ const tempEndDate = new Date();
67
+ tempEndDate.setTime(now * 1000);
68
+ options.endTimestamp = tempEndDate;
69
+ printMessage('No timestamps specified, defaulting to logs from 1 hour ago', 'info');
55
70
  }
56
- }
57
- const now = Date.now() / 1000;
58
- if (typeof options.beginTimestamp === 'undefined' || !options.beginTimestamp) {
59
- // no beginTimestamp value specified, default is 1 hour ago
60
- const tempStartDate = new Date();
61
- tempStartDate.setTime((now - SECONDS_IN_1_HOUR) * 1000);
62
- options.beginTimestamp = tempStartDate.toISOString();
63
- // also override endTimestamp to now
64
- const tempEndDate = new Date();
65
- tempEndDate.setTime(now * 1000);
66
- options.endTimestamp = tempEndDate;
67
- printMessage('No timestamps specified, defaulting to logs from 1 hour ago', 'info');
68
- }
69
- if (typeof options.endTimestamp === 'undefined' || !options.endTimestamp) {
70
- // no endTimestamp value specified, default is now
71
- options.endTimestamp = now * 1000;
72
- printMessage('No end timestamp specified, defaulting end timestamp to "now"', 'info');
73
- }
74
- let beginTs = Date.parse(options.beginTimestamp) / 1000;
75
- if (Date.parse(options.endTimestamp) / 1000 < beginTs) {
76
- printMessage('End timestamp can not be before begin timestamp', 'error');
77
- return;
78
- }
79
- if (now - beginTs > LOG_TIME_WINDOW_MAX) {
80
- printMessage('Begin timestamp can not be more than 30 days in the past', 'error');
81
- return;
82
- }
83
- let intermediateEndTs = 0;
84
- printMessage(`Fetching ID Cloud logs from the following sources: ${command.opts().sources} and levels [${resolveLevel(command.opts().level)}]...`);
85
- if (credsFromParameters) await saveConnectionProfile(host); // save new values if they were specified on CLI
71
+ if (typeof options.endTimestamp === 'undefined' || !options.endTimestamp) {
72
+ // no endTimestamp value specified, default is now
73
+ options.endTimestamp = nowString;
74
+ printMessage('No end timestamp specified, defaulting end timestamp to "now"', 'info');
75
+ }
76
+ let beginTs = Date.parse(options.beginTimestamp) / 1000;
77
+ if (Date.parse(options.endTimestamp) / 1000 < beginTs) {
78
+ printMessage('End timestamp can not be before begin timestamp', 'error');
79
+ return;
80
+ }
81
+ if (now - beginTs > LOG_TIME_WINDOW_MAX) {
82
+ printMessage('Begin timestamp can not be more than 30 days in the past', 'error');
83
+ return;
84
+ }
85
+ let intermediateEndTs = 0;
86
+ printMessage(`Fetching ID Cloud logs from the following sources: ${command.opts().sources} and levels [${resolveLevel(command.opts().level)}] of ${conn.tenant}...`);
87
+ if (credsFromParameters) await saveConnectionProfile(host); // save new values if they were specified on CLI
86
88
 
87
- do {
88
- intermediateEndTs = beginTs + LOG_TIME_WINDOW_INCREMENT;
89
- await fetchLogs(command.opts().sources, new Date(beginTs * 1000).toISOString(), new Date(intermediateEndTs * 1000).toISOString(), resolveLevel(command.opts().level), command.opts().transactionId, command.opts().searchString, null, config.getNoiseFilters(options.defaults));
90
- beginTs = intermediateEndTs;
91
- } while (intermediateEndTs < Date.parse(options.endTimestamp) / 1000);
89
+ do {
90
+ intermediateEndTs = beginTs + LOG_TIME_WINDOW_INCREMENT;
91
+ await fetchLogs(command.opts().sources, new Date(beginTs * 1000).toISOString(), new Date(intermediateEndTs * 1000).toISOString(), resolveLevel(command.opts().level), command.opts().transactionId, command.opts().searchString, null, config.getNoiseFilters(options.defaults));
92
+ beginTs = intermediateEndTs;
93
+ } while (intermediateEndTs < Date.parse(options.endTimestamp) / 1000);
94
+ }
92
95
  });
93
96
  program.parse();
94
97
  //# sourceMappingURL=logs-fetch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logs-fetch.js","names":["FrodoCommand","sourcesOptionM","Option","Authenticate","ConnectionProfile","Log","state","config","printMessage","provisionCreds","fetchLogs","resolveLevel","getConnectionProfile","saveConnectionProfile","getTokens","SECONDS_IN_30_DAYS","SECONDS_IN_1_HOUR","LOG_TIME_WINDOW_MAX","LOG_TIME_WINDOW_INCREMENT","program","description","addOption","default","FRODO_LOG_NOISEFILTER_FILENAME","action","host","user","password","options","command","handleDefaultArgsAndOpts","credsFromParameters","conn","setHost","tenant","logApiKey","logApiSecret","setLogApiKey","setLogApiSecret","username","getUsername","getPassword","setUsername","setPassword","creds","api_key_id","api_key_secret","now","Date","beginTimestamp","tempStartDate","setTime","toISOString","tempEndDate","endTimestamp","beginTs","parse","intermediateEndTs","opts","sources","level","transactionId","searchString","getNoiseFilters","defaults"],"sources":["cli/logging/logs-fetch.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { sourcesOptionM } from './logs';\nimport { Option } from 'commander';\nimport {\n Authenticate,\n ConnectionProfile,\n Log,\n state,\n} from '@rockcarver/frodo-lib';\nimport * as config from '../../utils/Config';\nimport { printMessage } from '../../utils/Console';\n\nconst { provisionCreds, fetchLogs, resolveLevel } = Log;\nconst { getConnectionProfile, saveConnectionProfile } = ConnectionProfile;\nconst { getTokens } = Authenticate;\n\nconst SECONDS_IN_30_DAYS = 2592000;\nconst SECONDS_IN_1_HOUR = 3600;\nconst LOG_TIME_WINDOW_MAX = SECONDS_IN_30_DAYS;\nconst LOG_TIME_WINDOW_INCREMENT = SECONDS_IN_1_HOUR;\n\nconst program = new FrodoCommand('frodo logs fetch', ['realm', 'type']);\nprogram\n .description(\n 'Fetch Identity Cloud logs between a specified begin and end time period.\\\n WARNING: depending on filters and time period specified, this could take substantial time to complete.'\n )\n .addOption(sourcesOptionM)\n .addOption(\n new Option(\n '-l, --level <level>',\n 'Set log level filter. You can specify the level as a number or a string. \\\nFollowing values are possible (values on the same line are equivalent): \\\n\\n0, SEVERE, FATAL, or ERROR\\n1, WARNING, WARN or CONFIG\\\n\\n2, INFO or INFORMATION\\n3, DEBUG, FINE, FINER or FINEST\\\n\\n4 or ALL'\n ).default('ERROR', `${resolveLevel('ERROR')}`)\n )\n .addOption(\n new Option('-t, --transaction-id <txid>', 'Filter by transactionId')\n )\n .addOption(\n new Option(\n '-b, --begin-timestamp <beginTs>',\n 'Begin timestamp for period (in ISO8601, example: \"2022-10-13T19:06:28Z\", or \"2022-09.30\". \\\nCannot be more than 30 days in the past. If not specified, logs from one hour ago are fetched \\\n(-e is ignored)'\n )\n )\n .addOption(\n new Option(\n '-e, --end-timestamp <endTs>',\n 'End timestamp for period. Default: \"now\"'\n )\n )\n .addOption(\n new Option(\n '-s, --search-string <ss>',\n 'Filter by a specific string (ANDed with transactionID filter)'\n )\n )\n .addOption(\n new Option('-d, --defaults', 'Use default logging noise filters').default(\n false,\n `Use custom logging noise filters defined in $HOME/${config.FRODO_LOG_NOISEFILTER_FILENAME}`\n )\n )\n .action(async (host, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(host, user, password, options, command);\n let credsFromParameters = true;\n const conn = await getConnectionProfile();\n state.setHost(conn.tenant);\n if (conn.logApiKey != null && conn.logApiSecret != null) {\n credsFromParameters = false;\n state.setLogApiKey(conn.logApiKey);\n state.setLogApiSecret(conn.logApiSecret);\n } else {\n if (conn.username == null && conn.password == null) {\n if (!state.getUsername() && !state.getPassword()) {\n credsFromParameters = false;\n printMessage(\n 'User credentials not specified as parameters and no saved API key and secret found!',\n 'warn'\n );\n return;\n }\n } else {\n state.setUsername(conn.username);\n state.setPassword(conn.password);\n }\n if (await getTokens()) {\n const creds = await provisionCreds();\n state.setLogApiKey(creds.api_key_id);\n state.setLogApiSecret(creds.api_key_secret);\n }\n }\n const now = Date.now() / 1000;\n if (\n typeof options.beginTimestamp === 'undefined' ||\n !options.beginTimestamp\n ) {\n // no beginTimestamp value specified, default is 1 hour ago\n const tempStartDate = new Date();\n tempStartDate.setTime((now - SECONDS_IN_1_HOUR) * 1000);\n options.beginTimestamp = tempStartDate.toISOString();\n // also override endTimestamp to now\n const tempEndDate = new Date();\n tempEndDate.setTime(now * 1000);\n options.endTimestamp = tempEndDate;\n printMessage(\n 'No timestamps specified, defaulting to logs from 1 hour ago',\n 'info'\n );\n }\n if (typeof options.endTimestamp === 'undefined' || !options.endTimestamp) {\n // no endTimestamp value specified, default is now\n options.endTimestamp = now * 1000;\n printMessage(\n 'No end timestamp specified, defaulting end timestamp to \"now\"',\n 'info'\n );\n }\n let beginTs = Date.parse(options.beginTimestamp) / 1000;\n if (Date.parse(options.endTimestamp) / 1000 < beginTs) {\n printMessage('End timestamp can not be before begin timestamp', 'error');\n return;\n }\n if (now - beginTs > LOG_TIME_WINDOW_MAX) {\n printMessage(\n 'Begin timestamp can not be more than 30 days in the past',\n 'error'\n );\n return;\n }\n let intermediateEndTs = 0;\n printMessage(\n `Fetching ID Cloud logs from the following sources: ${\n command.opts().sources\n } and levels [${resolveLevel(command.opts().level)}]...`\n );\n if (credsFromParameters) await saveConnectionProfile(host); // save new values if they were specified on CLI\n\n do {\n intermediateEndTs = beginTs + LOG_TIME_WINDOW_INCREMENT;\n await fetchLogs(\n command.opts().sources,\n new Date(beginTs * 1000).toISOString(),\n new Date(intermediateEndTs * 1000).toISOString(),\n resolveLevel(command.opts().level),\n command.opts().transactionId,\n command.opts().searchString,\n null,\n config.getNoiseFilters(options.defaults)\n );\n beginTs = intermediateEndTs;\n } while (intermediateEndTs < Date.parse(options.endTimestamp) / 1000);\n });\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,cAAc,QAAQ,QAAQ;AACvC,SAASC,MAAM,QAAQ,WAAW;AAClC,SACEC,YAAY,EACZC,iBAAiB,EACjBC,GAAG,EACHC,KAAK,QACA,uBAAuB;AAC9B,OAAO,KAAKC,MAAM,MAAM,oBAAoB;AAC5C,SAASC,YAAY,QAAQ,qBAAqB;AAElD,MAAM;EAAEC,cAAc;EAAEC,SAAS;EAAEC;AAAa,CAAC,GAAGN,GAAG;AACvD,MAAM;EAAEO,oBAAoB;EAAEC;AAAsB,CAAC,GAAGT,iBAAiB;AACzE,MAAM;EAAEU;AAAU,CAAC,GAAGX,YAAY;AAElC,MAAMY,kBAAkB,GAAG,OAAO;AAClC,MAAMC,iBAAiB,GAAG,IAAI;AAC9B,MAAMC,mBAAmB,GAAGF,kBAAkB;AAC9C,MAAMG,yBAAyB,GAAGF,iBAAiB;AAEnD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a,EAC5BhC,OAAO,CAAC6B,IAAI,EAAE,CAACI,YAAY,EAC3B,IAAI,EACJvD,MAAM,CAACwD,eAAe,CAACnC,OAAO,CAACoC,QAAQ,CAAC,CACzC;IACDT,OAAO,GAAGE,iBAAiB;EAC7B,CAAC,QAAQA,iBAAiB,GAAGT,IAAI,CAACQ,KAAK,CAAC5B,OAAO,CAAC0B,YAAY,CAAC,GAAG,IAAI;AACtE,CAAC,CAAC;AAEJnC,OAAO,CAACqC,KAAK,EAAE"}
1
+ {"version":3,"file":"logs-fetch.js","names":["FrodoCommand","sourcesOptionM","Option","Authenticate","ConnectionProfile","Log","state","config","printMessage","provisionCreds","fetchLogs","resolveLevel","getConnectionProfile","saveConnectionProfile","getTokens","SECONDS_IN_30_DAYS","SECONDS_IN_1_HOUR","LOG_TIME_WINDOW_MAX","LOG_TIME_WINDOW_INCREMENT","program","description","addOption","default","FRODO_LOG_NOISEFILTER_FILENAME","action","host","user","password","options","command","handleDefaultArgsAndOpts","credsFromParameters","conn","setHost","tenant","logApiKey","logApiSecret","setLogApiKey","setLogApiSecret","username","getUsername","getPassword","setUsername","setPassword","creds","api_key_id","api_key_secret","now","Date","nowString","toISOString","beginTimestamp","tempStartDate","setTime","tempEndDate","endTimestamp","beginTs","parse","intermediateEndTs","opts","sources","level","transactionId","searchString","getNoiseFilters","defaults"],"sources":["cli/logging/logs-fetch.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { sourcesOptionM } from './logs';\nimport { Option } from 'commander';\nimport {\n Authenticate,\n ConnectionProfile,\n Log,\n state,\n} from '@rockcarver/frodo-lib';\nimport * as config from '../../utils/Config';\nimport { printMessage } from '../../utils/Console';\n\nconst { provisionCreds, fetchLogs, resolveLevel } = Log;\nconst { getConnectionProfile, saveConnectionProfile } = ConnectionProfile;\nconst { getTokens } = Authenticate;\n\nconst SECONDS_IN_30_DAYS = 2592000;\nconst SECONDS_IN_1_HOUR = 3600;\nconst LOG_TIME_WINDOW_MAX = SECONDS_IN_30_DAYS;\nconst LOG_TIME_WINDOW_INCREMENT = 1;\n\nconst program = new FrodoCommand('frodo logs fetch', ['realm', 'type']);\nprogram\n .description(\n 'Fetch Identity Cloud logs between a specified begin and end time period.\\\n WARNING: depending on filters and time period specified, this could take substantial time to complete.'\n )\n .addOption(sourcesOptionM)\n .addOption(\n new Option(\n '-l, --level <level>',\n 'Set log level filter. You can specify the level as a number or a string. \\\nFollowing values are possible (values on the same line are equivalent): \\\n\\n0, SEVERE, FATAL, or ERROR\\n1, WARNING, WARN or CONFIG\\\n\\n2, INFO or INFORMATION\\n3, DEBUG, FINE, FINER or FINEST\\\n\\n4 or ALL'\n ).default('ERROR', `${resolveLevel('ERROR')}`)\n )\n .addOption(\n new Option('-t, --transaction-id <txid>', 'Filter by transactionId')\n )\n .addOption(\n new Option(\n '-b, --begin-timestamp <beginTs>',\n 'Begin timestamp for period (in ISO8601, example: \"2022-10-13T19:06:28Z\", or \"2022-09.30\". \\\nCannot be more than 30 days in the past. If not specified, logs from one hour ago are fetched \\\n(-e is ignored)'\n )\n )\n .addOption(\n new Option(\n '-e, --end-timestamp <endTs>',\n 'End timestamp for period. Default: \"now\"'\n )\n )\n .addOption(\n new Option(\n '-s, --search-string <ss>',\n 'Filter by a specific string (ANDed with transactionID filter)'\n )\n )\n .addOption(\n new Option('-d, --defaults', 'Use default logging noise filters').default(\n false,\n `Use custom logging noise filters defined in $HOME/${config.FRODO_LOG_NOISEFILTER_FILENAME}`\n )\n )\n .action(async (host, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(host, user, password, options, command);\n let credsFromParameters = true;\n const conn = await getConnectionProfile();\n if (conn) {\n state.setHost(conn.tenant);\n if (conn.logApiKey != null && conn.logApiSecret != null) {\n credsFromParameters = false;\n state.setLogApiKey(conn.logApiKey);\n state.setLogApiSecret(conn.logApiSecret);\n } else {\n if (conn.username == null && conn.password == null) {\n if (!state.getUsername() && !state.getPassword()) {\n credsFromParameters = false;\n printMessage(\n 'User credentials not specified as parameters and no saved API key and secret found!',\n 'warn'\n );\n return;\n }\n } else {\n state.setUsername(conn.username);\n state.setPassword(conn.password);\n }\n if (await getTokens()) {\n const creds = await provisionCreds();\n state.setLogApiKey(creds.api_key_id);\n state.setLogApiSecret(creds.api_key_secret);\n }\n }\n const now = Date.now() / 1000;\n const nowString = new Date(now * 1000).toISOString();\n if (\n typeof options.beginTimestamp === 'undefined' ||\n !options.beginTimestamp\n ) {\n // no beginTimestamp value specified, default is 1 hour ago\n const tempStartDate = new Date();\n tempStartDate.setTime((now - SECONDS_IN_1_HOUR) * 1000);\n options.beginTimestamp = tempStartDate.toISOString();\n // also override endTimestamp to now\n const tempEndDate = new Date();\n tempEndDate.setTime(now * 1000);\n options.endTimestamp = tempEndDate;\n printMessage(\n 'No timestamps specified, defaulting to logs from 1 hour ago',\n 'info'\n );\n }\n if (\n typeof options.endTimestamp === 'undefined' ||\n !options.endTimestamp\n ) {\n // no endTimestamp value specified, default is now\n options.endTimestamp = nowString;\n printMessage(\n 'No end timestamp specified, defaulting end timestamp to \"now\"',\n 'info'\n );\n }\n let beginTs = Date.parse(options.beginTimestamp) / 1000;\n if (Date.parse(options.endTimestamp) / 1000 < beginTs) {\n printMessage(\n 'End timestamp can not be before begin timestamp',\n 'error'\n );\n return;\n }\n if (now - beginTs > LOG_TIME_WINDOW_MAX) {\n printMessage(\n 'Begin timestamp can not be more than 30 days in the past',\n 'error'\n );\n return;\n }\n let intermediateEndTs = 0;\n printMessage(\n `Fetching ID Cloud logs from the following sources: ${\n command.opts().sources\n } and levels [${resolveLevel(command.opts().level)}] of ${\n conn.tenant\n }...`\n );\n if (credsFromParameters) await saveConnectionProfile(host); // save new values if they were specified on CLI\n\n do {\n intermediateEndTs = beginTs + LOG_TIME_WINDOW_INCREMENT;\n await fetchLogs(\n command.opts().sources,\n new Date(beginTs * 1000).toISOString(),\n new Date(intermediateEndTs * 1000).toISOString(),\n resolveLevel(command.opts().level),\n command.opts().transactionId,\n command.opts().searchString,\n null,\n config.getNoiseFilters(options.defaults)\n );\n beginTs = intermediateEndTs;\n } while (intermediateEndTs < Date.parse(options.endTimestamp) / 1000);\n }\n });\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,cAAc,QAAQ,QAAQ;AACvC,SAASC,MAAM,QAAQ,WAAW;AAClC,SACEC,YAAY,EACZC,iBAAiB,EACjBC,GAAG,EACHC,KAAK,QACA,uBAAuB;AAC9B,OAAO,KAAKC,MAAM,MAAM,oBAAoB;AAC5C,SAASC,YAAY,QAAQ,qBAAqB;AAElD,MAAM;EAAEC,cAAc;EAAEC,SAAS;EAAEC;AAAa,CAAC,GAAGN,GAAG;AACvD,MAAM;EAAEO,oBAAoB;EAAEC;AAAsB,CAAC,GAAGT,iBAAiB;AACzE,MAAM;EAAEU;AAAU,CAAC,GAAGX,YAAY;AAElC,MAAMY,kBAAkB,GAAG,OAAO;AAClC,MAAMC,iBAAiB,GAAG,IAAI;AAC9B,MAAMC,mBAAmB,GAAGF,kBAAkB;AAC9C,MAAMG,yBAAyB,GAAG,CAAC;AAEnC,MAAMC,OAAO,GAAG,IAAInB,YAAY,CAAC,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACvEmB,OAAO,CACJC,WAAW,CACV;AACJ,wGAAwG,CACrG,CACAC,SAAS,CAACpB,cAAc,CAAC,CACzBoB,SAAS,CACR,IAAInB,MAAM,CACR,qBAAqB,EACrB;AACN;AACA;AACA;AACA,WAAW,CACN,CAACoB,OAAO,CAAC,OAAO,EAAG,GAAEX,YAAY,CAAC,OAAO,CAAE,EAAC,CAAC,CAC/C,CACAU,SAAS,CACR,IAAInB,MAAM,CAAC,6BAA6B,EAAE,yBAAyB,CAAC,CACrE,CACAmB,SAAS,CACR,IAAInB,MAAM,CACR,iCAAiC,EACjC;AACN;AACA,gBAAgB,CACX,CACF,CACAmB,SAAS,CACR,IAAInB,MAAM,CACR,6BAA6B,EAC7B,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D,YAAY,CACV,iDAAiD,EACjD,OAAO,CACR;MACD;IACF;IACA,IAAIuC,GAAG,GAAGS,OAAO,GAAGvC,mBAAmB,EAAE;MACvCT,YAAY,CACV,0DAA0D,EAC1D,OAAO,CACR;MACD;IACF;IACA,IAAIkD,iBAAiB,GAAG,CAAC;IACzBlD,YAAY,CACT,sDACCqB,OAAO,CAAC8B,IAAI,EAAE,CAACC,OAChB,gBAAejD,YAAY,CAACkB,OAAO,CAAC8B,IAAI,EAAE,CAACE,KAAK,CAAE,QACjD7B,IAAI,CAACE,MACN,KAAI,CACN;IACD,IAAIH,mBAAmB,EAAE,MAAMlB,qBAAqB,CAACY,IAAI,CAAC,CAAC,CAAC;;IAE5D,GAAG;MACDiC,iBAAiB,GAAGF,OAAO,GAAGtC,yBAAyB;MACvD,MAAMR,SAAS,CACbmB,OAAO,CAAC8B,IAAI,EAAE,CAACC,OAAO,EACtB,IAAIZ,IAAI,CAACQ,OAAO,GAAG,IAAI,CAAC,CAACN,WAAW,EAAE,EACtC,IAAIF,IAAI,CAACU,iBAAiB,GAAG,IAAI,CAAC,CAACR,WAAW,EAAE,EAChDvC,YAAY,CAACkB,OAAO,CAAC8B,IAAI,EAAE,CAACE,KAAK,CAAC,EAClChC,OAAO,CAAC8B,IAAI,EAAE,CAACG,aAAa,EAC5BjC,OAAO,CAAC8B,IAAI,EAAE,CAACI,YAAY,EAC3B,IAAI,EACJxD,MAAM,CAACyD,eAAe,CAACpC,OAAO,CAACqC,QAAQ,CAAC,CACzC;MACDT,OAAO,GAAGE,iBAAiB;IAC7B,CAAC,QAAQA,iBAAiB,GAAGV,IAAI,CAACS,KAAK,CAAC7B,OAAO,CAAC2B,YAAY,CAAC,GAAG,IAAI;EACtE;AACF,CAAC,CAAC;AAEJpC,OAAO,CAACsC,KAAK,EAAE"}
@@ -18,39 +18,42 @@ program.description('List available ID Cloud log sources.').action(async (host,
18
18
  let credsFromParameters = true;
19
19
  verboseMessage('Listing available ID Cloud log sources...');
20
20
  const conn = await getConnectionProfile();
21
- state.setHost(conn.tenant);
22
- if (conn.logApiKey != null && conn.logApiSecret != null) {
23
- credsFromParameters = false;
24
- state.setLogApiKey(conn.logApiKey);
25
- state.setLogApiSecret(conn.logApiSecret);
26
- } else {
27
- if (conn.username == null && conn.password == null) {
28
- if (!state.getUsername() && !state.getPassword()) {
29
- credsFromParameters = false;
30
- printMessage('User credentials not specified as parameters and no saved API key and secret found!', 'warn');
31
- return;
32
- }
21
+ if (conn) {
22
+ state.setHost(conn.tenant);
23
+ if (conn.logApiKey != null && conn.logApiSecret != null) {
24
+ credsFromParameters = false;
25
+ state.setLogApiKey(conn.logApiKey);
26
+ state.setLogApiSecret(conn.logApiSecret);
33
27
  } else {
34
- state.setUsername(conn.username);
35
- state.setPassword(conn.password);
28
+ if (conn.username == null && conn.password == null) {
29
+ if (!state.getUsername() && !state.getPassword()) {
30
+ credsFromParameters = false;
31
+ printMessage('User credentials not specified as parameters and no saved API key and secret found!', 'warn');
32
+ return;
33
+ }
34
+ } else {
35
+ state.setUsername(conn.username);
36
+ state.setPassword(conn.password);
37
+ }
38
+ if (await getTokens()) {
39
+ const creds = await provisionCreds();
40
+ state.setLogApiKey(creds.api_key_id);
41
+ state.setLogApiSecret(creds.api_key_secret);
42
+ }
36
43
  }
37
- if (await getTokens()) {
38
- const creds = await provisionCreds();
39
- state.setLogApiKey(creds.api_key_id);
40
- state.setLogApiSecret(creds.api_key_secret);
44
+ const sources = await getLogSources();
45
+ if (sources.length === 0) {
46
+ printMessage("Can't get sources, possible cause - wrong API key or secret", 'error');
47
+ } else {
48
+ if (credsFromParameters) await saveConnectionProfile(host); // save new values if they were specified on CLI
49
+ printMessage(`Log sources from ${conn.tenant}`);
50
+ sources.forEach(source => {
51
+ printMessage(`${source}`, 'data');
52
+ });
53
+ printMessage('Use any combination of comma separated sources, example:', 'info');
54
+ printMessage(`$ frodo logs tail -c am-core,idm-core ${host}`, 'text');
41
55
  }
42
56
  }
43
- const sources = await getLogSources();
44
- if (sources.length === 0) {
45
- printMessage("Can't get sources, possible cause - wrong API key or secret", 'error');
46
- } else {
47
- if (credsFromParameters) await saveConnectionProfile(host); // save new values if they were specified on CLI
48
- sources.forEach(source => {
49
- printMessage(`${source}`, 'data');
50
- });
51
- printMessage('Use any combination of comma separated sources:', 'info');
52
- printMessage(`$ frodo logs tail -c am-core,idm-core ${host}`, 'text');
53
- }
54
57
  });
55
58
  program.parse();
56
59
  //# sourceMappingURL=logs-list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logs-list.js","names":["FrodoCommand","Authenticate","ConnectionProfile","Log","state","printMessage","verboseMessage","provisionCreds","getLogSources","getConnectionProfile","saveConnectionProfile","getTokens","program","description","action","host","user","password","options","command","handleDefaultArgsAndOpts","credsFromParameters","conn","setHost","tenant","logApiKey","logApiSecret","setLogApiKey","setLogApiSecret","username","getUsername","getPassword","setUsername","setPassword","creds","api_key_id","api_key_secret","sources","length","forEach","source","parse"],"sources":["cli/logging/logs-list.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport {\n Authenticate,\n ConnectionProfile,\n Log,\n state,\n} from '@rockcarver/frodo-lib';\nimport { printMessage, verboseMessage } from '../../utils/Console';\n\nconst { provisionCreds, getLogSources } = Log;\nconst { getConnectionProfile, saveConnectionProfile } = ConnectionProfile;\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo logs list', ['realm', 'type']);\nprogram\n .description('List available ID Cloud log sources.')\n .action(async (host, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(host, user, password, options, command);\n let credsFromParameters = true;\n verboseMessage('Listing available ID Cloud log sources...');\n const conn = await getConnectionProfile();\n state.setHost(conn.tenant);\n if (conn.logApiKey != null && conn.logApiSecret != null) {\n credsFromParameters = false;\n state.setLogApiKey(conn.logApiKey);\n state.setLogApiSecret(conn.logApiSecret);\n } else {\n if (conn.username == null && conn.password == null) {\n if (!state.getUsername() && !state.getPassword()) {\n credsFromParameters = false;\n printMessage(\n 'User credentials not specified as parameters and no saved API key and secret found!',\n 'warn'\n );\n return;\n }\n } else {\n state.setUsername(conn.username);\n state.setPassword(conn.password);\n }\n if (await getTokens()) {\n const creds = await provisionCreds();\n state.setLogApiKey(creds.api_key_id);\n state.setLogApiSecret(creds.api_key_secret);\n }\n }\n\n const sources = await getLogSources();\n if (sources.length === 0) {\n printMessage(\n \"Can't get sources, possible cause - wrong API key or secret\",\n 'error'\n );\n } else {\n if (credsFromParameters) await saveConnectionProfile(host); // save new values if they were specified on CLI\n sources.forEach((source) => {\n printMessage(`${source}`, 'data');\n });\n printMessage('Use any combination of comma separated sources:', 'info');\n printMessage(`$ frodo logs tail -c am-core,idm-core ${host}`, 'text');\n }\n });\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SACEC,YAAY,EACZC,iBAAiB,EACjBC,GAAG,EACHC,KAAK,QACA,uBAAuB;AAC9B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAElE,MAAM;EAAEC,cAAc;EAAEC;AAAc,CAAC,GAAGL,GAAG;AAC7C,MAAM;EAAEM,oBAAoB;EAAEC;AAAsB,CAAC,GAAGR,iBAAiB;AACzE,MAAM;EAAES;AAAU,CAAC,GAAGV,YAAY;AAElC,MAAMW,OAAO,GAAG,IAAIZ,YAAY,CAAC,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACtEY,OAAO,CACJC,WAAW,CAAC,sCAAsC,CAAC,CACnDC,MAAM,CAAC,OAAOC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACxDA,OAAO,CAACC,wBAAwB,CAACL,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,CAAC;EACxE,IAAIE,mBAAmB,GAAG,IAAI;EAC9Bf,cAAc,CAAC,2CAA2C,CAAC;EAC3D,MAAMgB,IAAI,GAAG,MAAMb,oBAAoB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AEmC,MAAO,EAAC,EAAE,MAAM,CAAC;IACnC,CAAC,CAAC;IACFnC,YAAY,CAAC,iDAAiD,EAAE,MAAM,CAAC;IACvEA,YAAY,CAAE,yCAAwCU,IAAK,EAAC,EAAE,MAAM,CAAC;EACvE;AACF,CAAC,CAAC;AAEJH,OAAO,CAAC6B,KAAK,EAAE"}
1
+ {"version":3,"file":"logs-list.js","names":["FrodoCommand","Authenticate","ConnectionProfile","Log","state","printMessage","verboseMessage","provisionCreds","getLogSources","getConnectionProfile","saveConnectionProfile","getTokens","program","description","action","host","user","password","options","command","handleDefaultArgsAndOpts","credsFromParameters","conn","setHost","tenant","logApiKey","logApiSecret","setLogApiKey","setLogApiSecret","username","getUsername","getPassword","setUsername","setPassword","creds","api_key_id","api_key_secret","sources","length","forEach","source","parse"],"sources":["cli/logging/logs-list.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport {\n Authenticate,\n ConnectionProfile,\n Log,\n state,\n} from '@rockcarver/frodo-lib';\nimport { printMessage, verboseMessage } from '../../utils/Console';\n\nconst { provisionCreds, getLogSources } = Log;\nconst { getConnectionProfile, saveConnectionProfile } = ConnectionProfile;\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo logs list', ['realm', 'type']);\nprogram\n .description('List available ID Cloud log sources.')\n .action(async (host, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(host, user, password, options, command);\n let credsFromParameters = true;\n verboseMessage('Listing available ID Cloud log sources...');\n const conn = await getConnectionProfile();\n if (conn) {\n state.setHost(conn.tenant);\n if (conn.logApiKey != null && conn.logApiSecret != null) {\n credsFromParameters = false;\n state.setLogApiKey(conn.logApiKey);\n state.setLogApiSecret(conn.logApiSecret);\n } else {\n if (conn.username == null && conn.password == null) {\n if (!state.getUsername() && !state.getPassword()) {\n credsFromParameters = false;\n printMessage(\n 'User credentials not specified as parameters and no saved API key and secret found!',\n 'warn'\n );\n return;\n }\n } else {\n state.setUsername(conn.username);\n state.setPassword(conn.password);\n }\n if (await getTokens()) {\n const creds = await provisionCreds();\n state.setLogApiKey(creds.api_key_id);\n state.setLogApiSecret(creds.api_key_secret);\n }\n }\n\n const sources = await getLogSources();\n if (sources.length === 0) {\n printMessage(\n \"Can't get sources, possible cause - wrong API key or secret\",\n 'error'\n );\n } else {\n if (credsFromParameters) await saveConnectionProfile(host); // save new values if they were specified on CLI\n printMessage(`Log sources from ${conn.tenant}`);\n sources.forEach((source) => {\n printMessage(`${source}`, 'data');\n });\n printMessage(\n 'Use any combination of comma separated sources, example:',\n 'info'\n );\n printMessage(`$ frodo logs tail -c am-core,idm-core ${host}`, 'text');\n }\n }\n });\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SACEC,YAAY,EACZC,iBAAiB,EACjBC,GAAG,EACHC,KAAK,QACA,uBAAuB;AAC9B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAElE,MAAM;EAAEC,cAAc;EAAEC;AAAc,CAAC,GAAGL,GAAG;AAC7C,MAAM;EAAEM,oBAAoB;EAAEC;AAAsB,CAAC,GAAGR,iBAAiB;AACzE,MAAM;EAAES;AAAU,CAAC,GAAGV,YAAY;AAElC,MAAMW,OAAO,GAAG,IAAIZ,YAAY,CAAC,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACtEY,OAAO,CACJC,WAAW,CAAC,sCAAsC,CAAC,CACnDC,MAAM,CAAC,OAAOC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACxDA,OAAO,CAACC,wBAAwB,CAACL,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,CAAC;EACxE,IAAIE,mBAAmB,GAAG,IAAI;EAC9Bf,cAAc,CAAC,2CAA2C,CAAC;EAC3D,MAAMgB,IAAI,GAAG,MAAMb,oBAAoB,EAAE;EACzC,IAAIa,IAAI,EAAE;IACRlB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AAO,CAAEC,MAAM,IAAK;QAC1BnC,YAAY,CAAE,GAAEmC,MAAO,EAAC,EAAE,MAAM,CAAC;MACnC,CAAC,CAAC;MACFnC,YAAY,CACV,0DAA0D,EAC1D,MAAM,CACP;MACDA,YAAY,CAAE,yCAAwCU,IAAK,EAAC,EAAE,MAAM,CAAC;IACvE;EACF;AACF,CAAC,CAAC;AAEJH,OAAO,CAAC6B,KAAK,EAAE"}
@@ -25,31 +25,33 @@ Following values are possible (values on the same line are equivalent): \
25
25
  command.handleDefaultArgsAndOpts(host, user, password, options, command);
26
26
  let credsFromParameters = true;
27
27
  const conn = await getConnectionProfile();
28
- state.setHost(conn.tenant);
29
- if (conn.logApiKey != null && conn.logApiSecret != null) {
30
- credsFromParameters = false;
31
- state.setLogApiKey(conn.logApiKey);
32
- state.setLogApiSecret(conn.logApiSecret);
33
- } else {
34
- if (conn.username == null && conn.password == null) {
35
- if (!state.getUsername() && !state.getPassword()) {
36
- credsFromParameters = false;
37
- printMessage('User credentials not specified as parameters and no saved API key and secret found!', 'warn');
38
- return;
39
- }
28
+ if (conn) {
29
+ state.setHost(conn.tenant);
30
+ if (conn.logApiKey != null && conn.logApiSecret != null) {
31
+ credsFromParameters = false;
32
+ state.setLogApiKey(conn.logApiKey);
33
+ state.setLogApiSecret(conn.logApiSecret);
40
34
  } else {
41
- state.setUsername(conn.username);
42
- state.setPassword(conn.password);
43
- }
44
- if (await getTokens()) {
45
- const creds = await provisionCreds();
46
- state.setLogApiKey(creds.api_key_id);
47
- state.setLogApiSecret(creds.api_key_secret);
35
+ if (conn.username == null && conn.password == null) {
36
+ if (!state.getUsername() && !state.getPassword()) {
37
+ credsFromParameters = false;
38
+ printMessage('User credentials not specified as parameters and no saved API key and secret found!', 'warn');
39
+ return;
40
+ }
41
+ } else {
42
+ state.setUsername(conn.username);
43
+ state.setPassword(conn.password);
44
+ }
45
+ if (await getTokens()) {
46
+ const creds = await provisionCreds();
47
+ state.setLogApiKey(creds.api_key_id);
48
+ state.setLogApiSecret(creds.api_key_secret);
49
+ }
48
50
  }
51
+ printMessage(`Tailing ID Cloud logs from the following sources: ${command.opts().sources} and levels [${resolveLevel(command.opts().level)}] of ${conn.tenant}...`);
52
+ if (credsFromParameters) await saveConnectionProfile(host); // save new values if they were specified on CLI
53
+ await tailLogs(command.opts().sources, resolveLevel(command.opts().level), command.opts().transactionId, null, config.getNoiseFilters(options.defaults));
49
54
  }
50
- printMessage(`Tailing ID Cloud logs from the following sources: ${command.opts().sources} and levels [${resolveLevel(command.opts().level)}]...`);
51
- if (credsFromParameters) await saveConnectionProfile(host); // save new values if they were specified on CLI
52
- await tailLogs(command.opts().sources, resolveLevel(command.opts().level), command.opts().transactionId, null, config.getNoiseFilters(options.defaults));
53
55
  });
54
56
  program.parse();
55
57
  //# sourceMappingURL=logs-tail.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logs-tail.js","names":["FrodoCommand","sourcesOptionM","Option","Authenticate","ConnectionProfile","Log","state","config","printMessage","provisionCreds","tailLogs","resolveLevel","getConnectionProfile","saveConnectionProfile","getTokens","program","description","addOption","default","FRODO_LOG_NOISEFILTER_FILENAME","action","host","user","password","options","command","handleDefaultArgsAndOpts","credsFromParameters","conn","setHost","tenant","logApiKey","logApiSecret","setLogApiKey","setLogApiSecret","username","getUsername","getPassword","setUsername","setPassword","creds","api_key_id","api_key_secret","opts","sources","level","transactionId","getNoiseFilters","defaults","parse"],"sources":["cli/logging/logs-tail.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { sourcesOptionM } from './logs';\nimport { Option } from 'commander';\nimport {\n Authenticate,\n ConnectionProfile,\n Log,\n state,\n} from '@rockcarver/frodo-lib';\nimport * as config from '../../utils/Config';\nimport { printMessage } from '../../utils/Console';\n\nconst { provisionCreds, tailLogs, resolveLevel } = Log;\nconst { getConnectionProfile, saveConnectionProfile } = ConnectionProfile;\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo logs tail', ['realm', 'type']);\nprogram\n .description('Tail Identity Cloud logs.')\n .addOption(sourcesOptionM)\n .addOption(\n new Option(\n '-l, --level <level>',\n 'Set log level filter. You can specify the level as a number or a string. \\\nFollowing values are possible (values on the same line are equivalent): \\\n\\n0, SEVERE, FATAL, or ERROR\\n1, WARNING, WARN or CONFIG\\\n\\n2, INFO or INFORMATION\\n3, DEBUG, FINE, FINER or FINEST\\\n\\n4 or ALL'\n ).default('ERROR', `${resolveLevel('ERROR')}`)\n )\n .addOption(\n new Option('-t, --transaction-id <txid>', 'Filter by transactionId')\n )\n .addOption(\n new Option('-d, --defaults', 'Use default logging noise filters').default(\n false,\n `Use custom logging noise filters defined in $HOME/${config.FRODO_LOG_NOISEFILTER_FILENAME}`\n )\n )\n .action(async (host, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(host, user, password, options, command);\n let credsFromParameters = true;\n const conn = await getConnectionProfile();\n state.setHost(conn.tenant);\n if (conn.logApiKey != null && conn.logApiSecret != null) {\n credsFromParameters = false;\n state.setLogApiKey(conn.logApiKey);\n state.setLogApiSecret(conn.logApiSecret);\n } else {\n if (conn.username == null && conn.password == null) {\n if (!state.getUsername() && !state.getPassword()) {\n credsFromParameters = false;\n printMessage(\n 'User credentials not specified as parameters and no saved API key and secret found!',\n 'warn'\n );\n return;\n }\n } else {\n state.setUsername(conn.username);\n state.setPassword(conn.password);\n }\n if (await getTokens()) {\n const creds = await provisionCreds();\n state.setLogApiKey(creds.api_key_id);\n state.setLogApiSecret(creds.api_key_secret);\n }\n }\n printMessage(\n `Tailing ID Cloud logs from the following sources: ${\n command.opts().sources\n } and levels [${resolveLevel(command.opts().level)}]...`\n );\n if (credsFromParameters) await saveConnectionProfile(host); // save new values if they were specified on CLI\n await tailLogs(\n command.opts().sources,\n resolveLevel(command.opts().level),\n command.opts().transactionId,\n null,\n config.getNoiseFilters(options.defaults)\n );\n });\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,cAAc,QA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,EAClCpB,OAAO,CAACkB,IAAI,EAAE,CAACG,aAAa,EAC5B,IAAI,EACJvC,MAAM,CAACwC,eAAe,CAACvB,OAAO,CAACwB,QAAQ,CAAC,CACzC;AACH,CAAC,CAAC;AAEJjC,OAAO,CAACkC,KAAK,EAAE"}
1
+ {"version":3,"file":"logs-tail.js","names":["FrodoCommand","sourcesOptionM","Option","Authenticate","ConnectionProfile","Log","state","config","printMessage","provisionCreds","tailLogs","resolveLevel","getConnectionProfile","saveConnectionProfile","getTokens","program","description","addOption","default","FRODO_LOG_NOISEFILTER_FILENAME","action","host","user","password","options","command","handleDefaultArgsAndOpts","credsFromParameters","conn","setHost","tenant","logApiKey","logApiSecret","setLogApiKey","setLogApiSecret","username","getUsername","getPassword","setUsername","setPassword","creds","api_key_id","api_key_secret","opts","sources","level","transactionId","getNoiseFilters","defaults","parse"],"sources":["cli/logging/logs-tail.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { sourcesOptionM } from './logs';\nimport { Option } from 'commander';\nimport {\n Authenticate,\n ConnectionProfile,\n Log,\n state,\n} from '@rockcarver/frodo-lib';\nimport * as config from '../../utils/Config';\nimport { printMessage } from '../../utils/Console';\n\nconst { provisionCreds, tailLogs, resolveLevel } = Log;\nconst { getConnectionProfile, saveConnectionProfile } = ConnectionProfile;\nconst { getTokens } = Authenticate;\n\nconst program = new FrodoCommand('frodo logs tail', ['realm', 'type']);\nprogram\n .description('Tail Identity Cloud logs.')\n .addOption(sourcesOptionM)\n .addOption(\n new Option(\n '-l, --level <level>',\n 'Set log level filter. You can specify the level as a number or a string. \\\nFollowing values are possible (values on the same line are equivalent): \\\n\\n0, SEVERE, FATAL, or ERROR\\n1, WARNING, WARN or CONFIG\\\n\\n2, INFO or INFORMATION\\n3, DEBUG, FINE, FINER or FINEST\\\n\\n4 or ALL'\n ).default('ERROR', `${resolveLevel('ERROR')}`)\n )\n .addOption(\n new Option('-t, --transaction-id <txid>', 'Filter by transactionId')\n )\n .addOption(\n new Option('-d, --defaults', 'Use default logging noise filters').default(\n false,\n `Use custom logging noise filters defined in $HOME/${config.FRODO_LOG_NOISEFILTER_FILENAME}`\n )\n )\n .action(async (host, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(host, user, password, options, command);\n let credsFromParameters = true;\n const conn = await getConnectionProfile();\n if (conn) {\n state.setHost(conn.tenant);\n if (conn.logApiKey != null && conn.logApiSecret != null) {\n credsFromParameters = false;\n state.setLogApiKey(conn.logApiKey);\n state.setLogApiSecret(conn.logApiSecret);\n } else {\n if (conn.username == null && conn.password == null) {\n if (!state.getUsername() && !state.getPassword()) {\n credsFromParameters = false;\n printMessage(\n 'User credentials not specified as parameters and no saved API key and secret found!',\n 'warn'\n );\n return;\n }\n } else {\n state.setUsername(conn.username);\n state.setPassword(conn.password);\n }\n if (await getTokens()) {\n const creds = await provisionCreds();\n state.setLogApiKey(creds.api_key_id);\n state.setLogApiSecret(creds.api_key_secret);\n }\n }\n printMessage(\n `Tailing ID Cloud logs from the following sources: ${\n command.opts().sources\n } and levels [${resolveLevel(command.opts().level)}] of ${\n conn.tenant\n }...`\n );\n if (credsFromParameters) await saveConnectionProfile(host); // save new values if they were specified on CLI\n await tailLogs(\n command.opts().sources,\n resolveLevel(command.opts().level),\n command.opts().transactionId,\n null,\n config.getNoiseFilters(options.defaults)\n );\n }\n });\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,cAAc,QAAQ,QAAQ;AACvC,SAASC,MAAM,QAAQ,WAAW;AAClC,SACEC,YAAY,EACZC,iBAAiB,EACjBC,GAAG,EACHC,KAAK,QACA,uBAAuB;AAC9B,OAAO,KAAKC,MAAM,MAAM,oBAAoB;AAC5C,SAASC,YAAY,QAAQ,qBAAqB;AAElD,MAAM;EAAEC,cAAc;EAAEC,QAAQ;EAAEC;AAAa,CAAC,GAAGN,GAAG;AACtD,MAAM;EAAEO,oBAAoB;EAAEC;AAAsB,CAAC,GAAGT,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",
3
+ "version": "0.20.1-1",
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": [
@@ -104,7 +104,7 @@
104
104
  ]
105
105
  },
106
106
  "dependencies": {
107
- "@rockcarver/frodo-lib": "0.18.0",
107
+ "@rockcarver/frodo-lib": "0.18.1-0",
108
108
  "cli-progress": "^3.11.2",
109
109
  "cli-table3": "^0.6.3",
110
110
  "colors": "^1.4.0",