@rockcarver/frodo-cli 2.0.6-1 → 2.0.6-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.0.6-1] - 2024-09-09
11
+
10
12
  ## [2.0.6-0] - 2024-08-26
11
13
 
12
14
  ### Added
@@ -1974,7 +1976,8 @@ Frodo CLI 2.x automatically refreshes session and access tokens before they expi
1974
1976
  - Fixed problem with adding connection profiles
1975
1977
  - Miscellaneous bug fixes
1976
1978
 
1977
- [unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.6-0...HEAD
1979
+ [unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.6-1...HEAD
1980
+ [2.0.6-1]: https://github.com/rockcarver/frodo-cli/compare/v2.0.6-0...v2.0.6-1
1978
1981
  [2.0.6-0]: https://github.com/rockcarver/frodo-cli/compare/v2.0.5...v2.0.6-0
1979
1982
  [2.0.5]: https://github.com/rockcarver/frodo-cli/compare/v2.0.5-0...v2.0.5
1980
1983
  [2.0.5-0]: https://github.com/rockcarver/frodo-cli/compare/v2.0.4...v2.0.5-0
package/dist/app.cjs CHANGED
@@ -67475,7 +67475,7 @@ var require_basic_auth = __commonJS2({
67475
67475
  var header = getAuthorization(req);
67476
67476
  return parse7(header);
67477
67477
  }
67478
- function decodeBase643(str2) {
67478
+ function decodeBase644(str2) {
67479
67479
  return Buffer3.from(str2, "base64").toString();
67480
67480
  }
67481
67481
  function getAuthorization(req) {
@@ -67492,7 +67492,7 @@ var require_basic_auth = __commonJS2({
67492
67492
  if (!match2) {
67493
67493
  return void 0;
67494
67494
  }
67495
- var userPass = USER_PASS_REGEXP.exec(decodeBase643(match2[1]));
67495
+ var userPass = USER_PASS_REGEXP.exec(decodeBase644(match2[1]));
67496
67496
  if (!userPass) {
67497
67497
  return void 0;
67498
67498
  }
@@ -177537,7 +177537,8 @@ var {
177537
177537
  isBase64Encoded: isBase64Encoded2,
177538
177538
  getFilePath: getFilePath12,
177539
177539
  getWorkingDirectory: getWorkingDirectory10,
177540
- saveToFile: saveToFile3
177540
+ saveToFile: saveToFile3,
177541
+ decodeBase64
177541
177542
  } = frodo.utils;
177542
177543
  var {
177543
177544
  readScript: readScript2,
@@ -177596,6 +177597,7 @@ async function listScripts(long = false, usage = false, file = null) {
177596
177597
  return true;
177597
177598
  }
177598
177599
  let fullExport = null;
177600
+ let scriptExport = null;
177599
177601
  const headers2 = long ? ["Name", "UUID", "Language", "Context", "Description"] : ["Name"];
177600
177602
  if (usage) {
177601
177603
  try {
@@ -177604,9 +177606,7 @@ async function listScripts(long = false, usage = false, file = null) {
177604
177606
  printError2(error2);
177605
177607
  return false;
177606
177608
  }
177607
- for (const realmExport of Object.values(fullExport.realm)) {
177608
- delete realmExport.script;
177609
- }
177609
+ scriptExport = separateScriptsFromFullExport(fullExport);
177610
177610
  headers2.push("Used");
177611
177611
  }
177612
177612
  const table = createTable(headers2);
@@ -177619,7 +177619,9 @@ async function listScripts(long = false, usage = false, file = null) {
177619
177619
  wordwrap(script.description, 30)
177620
177620
  ] : [wordwrap(script.name, 25, " ")];
177621
177621
  if (usage) {
177622
- const locations = getIdLocations(fullExport, script._id, false);
177622
+ const locations = getIdLocations(fullExport, script._id, false).concat(
177623
+ getScriptLocations(scriptExport, script.name)
177624
+ );
177623
177625
  values3.push(
177624
177626
  locations.length > 0 ? `${"yes"["brightGreen"]} (${locations.length === 1 ? `at` : `${locations.length} uses, including:`} ${locations[0]})` : "no"["brightRed"]
177625
177627
  );
@@ -177646,10 +177648,10 @@ async function describeScript(scriptId, scriptName, file, usage = false, json =
177646
177648
  if (usage) {
177647
177649
  try {
177648
177650
  const fullExport = await getFullExportConfig(file);
177649
- for (const realmExport of Object.values(fullExport.realm)) {
177650
- delete realmExport.script;
177651
- }
177652
- script.locations = getIdLocations(fullExport, script._id, false);
177651
+ const scriptExport = separateScriptsFromFullExport(fullExport);
177652
+ script.locations = getIdLocations(fullExport, script._id, false).concat(
177653
+ getScriptLocations(scriptExport, script.name)
177654
+ );
177653
177655
  } catch (error2) {
177654
177656
  stopProgressIndicator2(
177655
177657
  spinnerId,
@@ -178050,6 +178052,37 @@ async function deleteAllScripts() {
178050
178052
  }
178051
178053
  return false;
178052
178054
  }
178055
+ function separateScriptsFromFullExport(fullExport) {
178056
+ const scripts = { realm: {} };
178057
+ for (const [realm2, realmExport] of Object.entries(fullExport.realm)) {
178058
+ if (!scripts.realm[realm2]) {
178059
+ scripts.realm[realm2] = {};
178060
+ }
178061
+ scripts.realm[realm2].script = realmExport.script;
178062
+ delete realmExport.script;
178063
+ }
178064
+ return scripts;
178065
+ }
178066
+ function getScriptLocations(configuration, scriptName) {
178067
+ const locations = [];
178068
+ const regex2 = new RegExp(`require\\(['|"]${scriptName}['|"]\\)`);
178069
+ for (const [realm2, realmExport] of Object.entries(configuration.realm)) {
178070
+ for (const scriptData of Object.values(realmExport.script)) {
178071
+ let scriptString = scriptData.script;
178072
+ if (Array.isArray(scriptData.script)) {
178073
+ scriptString = scriptData.script.join("\n");
178074
+ } else if (isBase64Encoded2(scriptData.script)) {
178075
+ scriptString = decodeBase64(scriptData.script);
178076
+ }
178077
+ if (regex2.test(scriptString)) {
178078
+ locations.push(
178079
+ `realm.${realm2}.script.${scriptData._id}(name: '${scriptData.name}').script`
178080
+ );
178081
+ }
178082
+ }
178083
+ }
178084
+ return locations;
178085
+ }
178053
178086
 
178054
178087
  // src/utils/Config.ts
178055
178088
  var { getFilePath: getFilePath13, readFiles: readFiles4 } = frodo.utils;
@@ -181406,7 +181439,7 @@ _chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
181406
181439
  _chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
181407
181440
 
181408
181441
  var {
181409
- decodeBase64,
181442
+ decodeBase64: decodeBase642,
181410
181443
  getFilePath: getFilePath17,
181411
181444
  getTypedFilename: getTypedFilename16,
181412
181445
  getWorkingDirectory: getWorkingDirectory14,
@@ -181476,7 +181509,7 @@ async function listVariables(long = false, usage = false, file = null) {
181476
181509
  const values3 = long ? [
181477
181510
  variable._id,
181478
181511
  wordwrap(
181479
- variable.valueBase64 ? decodeBase64(variable.valueBase64) : variable.value,
181512
+ variable.valueBase64 ? decodeBase642(variable.valueBase64) : variable.value,
181480
181513
  40
181481
181514
  ),
181482
181515
  variable.loaded ? "loaded"["brightGreen"] : "unloaded"["brightRed"],
@@ -181658,7 +181691,7 @@ async function describeVariable(variableId, file, usage = false, json = false) {
181658
181691
  table.push([
181659
181692
  "Value"["brightCyan"],
181660
181693
  wordwrap(
181661
- variable.valueBase64 ? decodeBase64(variable.valueBase64) : variable.value,
181694
+ variable.valueBase64 ? decodeBase642(variable.valueBase64) : variable.value,
181662
181695
  40
181663
181696
  )
181664
181697
  ]);
@@ -183489,7 +183522,7 @@ function getTableRowMd5(nodeObj, nodeRef) {
183489
183522
  // src/ops/Saml2Ops.ts
183490
183523
  _chunkMPPKDFVIcjs.init_cjs_shims.call(void 0, );
183491
183524
 
183492
- var { decodeBase64: decodeBase642, saveTextToFile: saveTextToFile4, getFilePath: getFilePath20, getWorkingDirectory: getWorkingDirectory17 } = frodo.utils;
183525
+ var { decodeBase64: decodeBase643, saveTextToFile: saveTextToFile4, getFilePath: getFilePath20, getWorkingDirectory: getWorkingDirectory17 } = frodo.utils;
183493
183526
  var { getTypedFilename: getTypedFilename19, saveJsonToFile: saveJsonToFile19, getRealmString: getRealmString3 } = frodo.utils;
183494
183527
  var {
183495
183528
  readSaml2ProviderStubs: readSaml2ProviderStubs2,
@@ -183737,7 +183770,7 @@ async function importFirstSaml2ProviderFromFile(file, options2 = { deps: true })
183737
183770
  const data2 = _fs3.default.readFileSync(getFilePath20(file), "utf8");
183738
183771
  const fileData = JSON.parse(data2);
183739
183772
  const entityId64 = Object.keys(fileData.saml.remote)[0] || Object.keys(fileData.saml.hosted)[0];
183740
- const entityId = decodeBase642(entityId64);
183773
+ const entityId = decodeBase643(entityId64);
183741
183774
  indicatorId = createProgressIndicator2(
183742
183775
  "indeterminate",
183743
183776
  0,
@@ -188926,7 +188959,7 @@ var compareVersions = (v12, v2) => {
188926
188959
  // package.json
188927
188960
  var package_default2 = {
188928
188961
  name: "@rockcarver/frodo-cli",
188929
- version: "2.0.6-1",
188962
+ version: "2.0.6-2",
188930
188963
  type: "module",
188931
188964
  description: "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
188932
188965
  keywords: [