@rockcarver/frodo-cli 3.0.4 → 3.0.5

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,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Fixed
11
+
12
+ - \#494: Frodo CLI now properly imports script from separate files using `frodo script import -A`.
13
+
14
+ ## [3.0.4] - 2025-04-04
15
+
10
16
  ### Changed
11
17
 
12
18
  - Update to frodo-lib 3.0.4
@@ -2065,7 +2071,8 @@ Frodo CLI 2.x automatically refreshes session and access tokens before they expi
2065
2071
  - Fixed problem with adding connection profiles
2066
2072
  - Miscellaneous bug fixes
2067
2073
 
2068
- [unreleased]: https://github.com/rockcarver/frodo-cli/compare/v3.0.4-1...HEAD
2074
+ [unreleased]: https://github.com/rockcarver/frodo-cli/compare/v3.0.4...HEAD
2075
+ [3.0.4]: https://github.com/rockcarver/frodo-cli/compare/v3.0.4-1...v3.0.4
2069
2076
  [3.0.4-1]: https://github.com/rockcarver/frodo-cli/compare/v3.0.4-0...v3.0.4-1
2070
2077
  [3.0.4-0]: https://github.com/rockcarver/frodo-cli/compare/v3.0.3...v3.0.4-0
2071
2078
  [3.0.3]: https://github.com/rockcarver/frodo-cli/compare/v3.0.2...v3.0.3
package/dist/app.cjs CHANGED
@@ -167829,13 +167829,20 @@ async function importScriptsFromFile(id7 = "", name = "", file, options = {
167829
167829
  return false;
167830
167830
  }
167831
167831
  async function importScriptsFromFiles(watch2, options, validateScripts) {
167832
+ debugMessage2(`Cli.ScriptOps.importScriptsFromFiles: start`);
167832
167833
  options.reUuid = watch2 ? false : options.reUuid;
167833
167834
  let initialImport = true;
167834
167835
  const scriptPathToJsonMapping = {};
167835
167836
  const scriptPathToIdMapping = {};
167836
167837
  async function onChange(path9, _stats) {
167838
+ debugMessage2(
167839
+ `Cli.ScriptOps.importScriptsFromFiles.onChange: start [initialImport=${initialImport}, path=${path9}]`
167840
+ );
167837
167841
  try {
167838
167842
  if (initialImport && path9.endsWith(".script.json")) {
167843
+ debugMessage2(
167844
+ `Cli.ScriptOps.importScriptsFromFiles.onChange: initial import of ${path9}`
167845
+ );
167839
167846
  if (watch2) {
167840
167847
  scriptPathToJsonMapping[path9] = path9;
167841
167848
  for (const extracted of getExtractedPathsAndNames(path9)) {
@@ -167857,43 +167864,47 @@ async function importScriptsFromFiles(watch2, options, validateScripts) {
167857
167864
  } catch (error2) {
167858
167865
  printError2(error2, `${path9}`);
167859
167866
  }
167860
- }
167861
- const watcher = esm_default2.watch(
167862
- [
167863
- `${getWorkingDirectory11()}/**/*.script.json`,
167864
- `${getWorkingDirectory11()}/**/*.script.js`,
167865
- `${getWorkingDirectory11()}/**/*.script.groovy`
167866
- ],
167867
- {
167868
- persistent: watch2,
167869
- ignoreInitial: false
167870
- }
167871
- );
167867
+ debugMessage2(`Cli.ScriptOps.importScriptsFromFiles.onChange: end`);
167868
+ }
167869
+ const watcher = esm_default2.watch(getWorkingDirectory11(), {
167870
+ // ignored: (path, stats) =>
167871
+ // watch
167872
+ // ? // in watch mode, ignore everything but raw scripts
167873
+ // stats?.isFile() &&
167874
+ // !path?.endsWith('.script.js') &&
167875
+ // !path?.endsWith('.script.groovy')
167876
+ // : // in regular mode, ignore everything but frodo script exports
167877
+ // stats?.isFile() && !path?.endsWith('.script.json'),
167878
+ ignored: (path9, stats) => _optionalChain([stats, 'optionalAccess', _372 => _372.isFile, 'call', _373 => _373()]) && !_optionalChain([path9, 'optionalAccess', _374 => _374.endsWith, 'call', _375 => _375(".script.json")]) && !_optionalChain([path9, 'optionalAccess', _376 => _376.endsWith, 'call', _377 => _377(".script.js")]) && !_optionalChain([path9, 'optionalAccess', _378 => _378.endsWith, 'call', _379 => _379(".script.groovy")]),
167879
+ persistent: watch2,
167880
+ ignoreInitial: false
167881
+ });
167872
167882
  watcher.on("add", onChange).on("change", onChange).on("error", (error2) => {
167873
167883
  printError2(error2, `Watcher error`);
167874
167884
  watcher.close();
167875
- }).on("ready", () => {
167885
+ }).on("ready", async () => {
167886
+ debugMessage2(
167887
+ `Cli.ScriptOps.importScriptsFromFiles: Watcher ready: ${JSON.stringify(watcher.getWatched())}`
167888
+ );
167876
167889
  if (watch2) {
167877
167890
  initialImport = false;
167878
167891
  printMessage2("Watching for changes...");
167879
167892
  } else {
167880
- watcher.close();
167881
- printMessage2("Done.");
167893
+ await watcher.close();
167882
167894
  }
167883
167895
  });
167896
+ debugMessage2(`Cli.ScriptOps.importScriptsFromFiles: end`);
167884
167897
  }
167885
167898
  async function handleScriptFileImport(id7 = "", name = "", file, options, validateScripts) {
167886
167899
  debugMessage2(`Cli.ScriptOps.handleScriptFileImport: start`);
167887
167900
  const script = getScriptExportByScriptFile(file);
167888
- const imported = await importScripts3(
167889
- id7,
167890
- name,
167891
- script,
167892
- options,
167893
- validateScripts
167894
- );
167895
- if (imported) {
167896
- printMessage2(`Imported '${file}'`);
167901
+ const indicatorId = createProgressIndicator2("determinate", 1, `${file}`);
167902
+ try {
167903
+ await importScripts3(id7, name, script, options, validateScripts);
167904
+ updateProgressIndicator2(indicatorId, `${file}`);
167905
+ stopProgressIndicator2(indicatorId, `${file}`);
167906
+ } catch (error2) {
167907
+ stopProgressIndicator2(indicatorId, `${file}: ${error2}`);
167897
167908
  }
167898
167909
  debugMessage2(`Cli.ScriptOps.handleScriptFileImport: end`);
167899
167910
  }
@@ -169250,7 +169261,7 @@ async function tailLogs(source, levels, txid, cookie, nf) {
169250
169261
  filteredLogs = logsObject.result.filter(
169251
169262
  (el) => !noiseFilter.includes(
169252
169263
  el.payload.logger
169253
- ) && !noiseFilter.includes(el.type) && (levels[0] === "ALL" || levels.includes(resolvePayloadLevel2(el))) && (typeof txid === "undefined" || txid === null || _optionalChain([el, 'access', _372 => _372.payload, 'access', _373 => _373.transactionId, 'optionalAccess', _374 => _374.includes, 'call', _375 => _375(
169264
+ ) && !noiseFilter.includes(el.type) && (levels[0] === "ALL" || levels.includes(resolvePayloadLevel2(el))) && (typeof txid === "undefined" || txid === null || _optionalChain([el, 'access', _380 => _380.payload, 'access', _381 => _381.transactionId, 'optionalAccess', _382 => _382.includes, 'call', _383 => _383(
169254
169265
  txid
169255
169266
  )]))
169256
169267
  );
@@ -169274,7 +169285,7 @@ async function fetchLogs(source, startTs, endTs, levels, txid, ffString, cookie,
169274
169285
  filteredLogs = logsObject.result.filter(
169275
169286
  (el) => !noiseFilter.includes(
169276
169287
  el.payload.logger
169277
- ) && !noiseFilter.includes(el.type) && (levels[0] === "ALL" || levels.includes(resolvePayloadLevel2(el))) && (typeof txid === "undefined" || txid === null || _optionalChain([el, 'access', _376 => _376.payload, 'access', _377 => _377.transactionId, 'optionalAccess', _378 => _378.includes, 'call', _379 => _379(
169288
+ ) && !noiseFilter.includes(el.type) && (levels[0] === "ALL" || levels.includes(resolvePayloadLevel2(el))) && (typeof txid === "undefined" || txid === null || _optionalChain([el, 'access', _384 => _384.payload, 'access', _385 => _385.transactionId, 'optionalAccess', _386 => _386.includes, 'call', _387 => _387(
169278
169289
  txid
169279
169290
  )]))
169280
169291
  );
@@ -169428,9 +169439,9 @@ function setup79() {
169428
169439
  `Created log API key ${creds.api_key_id} and secret.`
169429
169440
  );
169430
169441
  } catch (error2) {
169431
- printMessage2(_optionalChain([error2, 'access', _380 => _380.response, 'optionalAccess', _381 => _381.data]), "error");
169442
+ printMessage2(_optionalChain([error2, 'access', _388 => _388.response, 'optionalAccess', _389 => _389.data]), "error");
169432
169443
  printMessage2(
169433
- `Error creating log API key and secret: ${_optionalChain([error2, 'access', _382 => _382.response, 'optionalAccess', _383 => _383.data, 'optionalAccess', _384 => _384.message])}`,
169444
+ `Error creating log API key and secret: ${_optionalChain([error2, 'access', _390 => _390.response, 'optionalAccess', _391 => _391.data, 'optionalAccess', _392 => _392.message])}`,
169434
169445
  "error"
169435
169446
  );
169436
169447
  process.exitCode = 1;
@@ -170136,7 +170147,7 @@ function setup86() {
170136
170147
  printMessage2(updatesTable.toString(), "data");
170137
170148
  }
170138
170149
  if (!options.checkOnly) {
170139
- if (_optionalChain([updates, 'access', _385 => _385.secrets, 'optionalAccess', _386 => _386.length]) || _optionalChain([updates, 'access', _387 => _387.variables, 'optionalAccess', _388 => _388.length]) || options.force) {
170150
+ if (_optionalChain([updates, 'access', _393 => _393.secrets, 'optionalAccess', _394 => _394.length]) || _optionalChain([updates, 'access', _395 => _395.variables, 'optionalAccess', _396 => _396.length]) || options.force) {
170140
170151
  const ok = options.yes || await (0, import_yesno.default)({
170141
170152
  question: `
170142
170153
  Changes may take up to 10 minutes to propagate, during which time you will not be able to make further updates.
@@ -173845,7 +173856,7 @@ function getNodeClassificationMd(nodeType) {
173845
173856
  function getOneLineDescription5(nodeObj, nodeRef) {
173846
173857
  const description = `[${nodeObj._id["brightCyan"]}] (${getNodeClassification2(
173847
173858
  nodeObj._type._id
173848
- ).join(", ")}) ${nodeObj._type._id}${nodeRef ? " - " + _optionalChain([nodeRef, 'optionalAccess', _389 => _389.displayName]) : ""}`;
173859
+ ).join(", ")}) ${nodeObj._type._id}${nodeRef ? " - " + _optionalChain([nodeRef, 'optionalAccess', _397 => _397.displayName]) : ""}`;
173849
173860
  return description;
173850
173861
  }
173851
173862
  function getTableHeaderMd5() {
@@ -174581,7 +174592,7 @@ async function listJourneys(long = false, analyze = false) {
174581
174592
  table.push([
174582
174593
  `${journeyStub._id}`,
174583
174594
  journeyStub.enabled === false ? "disabled"["brightRed"] : "enabled"["brightGreen"],
174584
- _optionalChain([journeyStub, 'access', _390 => _390.uiConfig, 'optionalAccess', _391 => _391.categories]) ? wordwrap(
174595
+ _optionalChain([journeyStub, 'access', _398 => _398.uiConfig, 'optionalAccess', _399 => _399.categories]) ? wordwrap(
174585
174596
  JSON.parse(journeyStub.uiConfig.categories).join(", "),
174586
174597
  60
174587
174598
  ) : ""
@@ -174623,7 +174634,7 @@ async function listJourneys(long = false, analyze = false) {
174623
174634
  `${journeyExport.tree._id}`,
174624
174635
  journeyExport.tree.enabled === false ? "disabled"["brightRed"] : "enabled"["brightGreen"],
174625
174636
  getJourneyClassification2(journeyExport).join(", "),
174626
- _optionalChain([journeyExport, 'access', _392 => _392.tree, 'access', _393 => _393.uiConfig, 'optionalAccess', _394 => _394.categories]) ? wordwrap(
174637
+ _optionalChain([journeyExport, 'access', _400 => _400.tree, 'access', _401 => _401.uiConfig, 'optionalAccess', _402 => _402.categories]) ? wordwrap(
174627
174638
  JSON.parse(journeyExport.tree.uiConfig.categories).join(
174628
174639
  ", "
174629
174640
  ),
@@ -175028,7 +175039,7 @@ async function describeJourney(journeyData, resolveTreeExport = onlineTreeExport
175028
175039
  nodeTypeMap[nodeData._type._id] = 1;
175029
175040
  }
175030
175041
  }
175031
- if (!state.getAmVersion() && _optionalChain([journeyData, 'access', _395 => _395.meta, 'optionalAccess', _396 => _396.originAmVersion])) {
175042
+ if (!state.getAmVersion() && _optionalChain([journeyData, 'access', _403 => _403.meta, 'optionalAccess', _404 => _404.originAmVersion])) {
175032
175043
  state.setAmVersion(journeyData.meta.originAmVersion);
175033
175044
  }
175034
175045
  printMessage2(`${getOneLineDescription8(journeyData.tree)}`, "data");
@@ -175052,7 +175063,7 @@ ${getJourneyClassification2(journeyData).join(", ")}`,
175052
175063
  "data"
175053
175064
  );
175054
175065
  }
175055
- if (_optionalChain([journeyData, 'access', _397 => _397.tree, 'access', _398 => _398.uiConfig, 'optionalAccess', _399 => _399.categories]) && journeyData.tree.uiConfig.categories != "[]") {
175066
+ if (_optionalChain([journeyData, 'access', _405 => _405.tree, 'access', _406 => _406.uiConfig, 'optionalAccess', _407 => _407.categories]) && journeyData.tree.uiConfig.categories != "[]") {
175056
175067
  printMessage2("\nCategories/Tags", "data");
175057
175068
  printMessage2(
175058
175069
  `${JSON.parse(journeyData.tree.uiConfig.categories).join(", ")}`,
@@ -175094,7 +175105,7 @@ Nodes (${Object.entries(allNodes).length}):`, "data");
175094
175105
  );
175095
175106
  }
175096
175107
  }
175097
- if (_optionalChain([journeyData, 'access', _400 => _400.themes, 'optionalAccess', _401 => _401.length])) {
175108
+ if (_optionalChain([journeyData, 'access', _408 => _408.themes, 'optionalAccess', _409 => _409.length])) {
175098
175109
  printMessage2(`
175099
175110
  Themes (${journeyData.themes.length}):`, "data");
175100
175111
  for (const themeData of journeyData.themes) {
@@ -175188,14 +175199,14 @@ async function describeJourneyMd(journeyData, resolveTreeExport = onlineTreeExpo
175188
175199
  nodeTypeMap[nodeData._type._id] = 1;
175189
175200
  }
175190
175201
  }
175191
- if (!state.getAmVersion() && _optionalChain([journeyData, 'access', _402 => _402.meta, 'optionalAccess', _403 => _403.originAmVersion])) {
175202
+ if (!state.getAmVersion() && _optionalChain([journeyData, 'access', _410 => _410.meta, 'optionalAccess', _411 => _411.originAmVersion])) {
175192
175203
  state.setAmVersion(journeyData.meta.originAmVersion);
175193
175204
  }
175194
175205
  printMessage2(
175195
175206
  `# ${getOneLineDescriptionMd(journeyData.tree)} - ${journeyData.tree.enabled === false ? ":o: `disabled`" : ":white_check_mark: `enabled`"}, ${getJourneyClassificationMd(journeyData).join(", ")}`,
175196
175207
  "data"
175197
175208
  );
175198
- if (_optionalChain([journeyData, 'access', _404 => _404.tree, 'access', _405 => _405.uiConfig, 'optionalAccess', _406 => _406.categories]) && journeyData.tree.uiConfig.categories != "[]") {
175209
+ if (_optionalChain([journeyData, 'access', _412 => _412.tree, 'access', _413 => _413.uiConfig, 'optionalAccess', _414 => _414.categories]) && journeyData.tree.uiConfig.categories != "[]") {
175199
175210
  printMessage2(
175200
175211
  `\`${JSON.parse(journeyData.tree.uiConfig.categories).join("`, `")}\``,
175201
175212
  "data"
@@ -175239,7 +175250,7 @@ ${journeyData.tree.description}`, "data");
175239
175250
  );
175240
175251
  }
175241
175252
  }
175242
- if (_optionalChain([journeyData, 'access', _407 => _407.themes, 'optionalAccess', _408 => _408.length])) {
175253
+ if (_optionalChain([journeyData, 'access', _415 => _415.themes, 'optionalAccess', _416 => _416.length])) {
175243
175254
  printMessage2(`## Themes (${journeyData.themes.length})`, "data");
175244
175255
  printMessage2(getTableHeaderMd7(), "data");
175245
175256
  for (const themeData of journeyData.themes) {
@@ -175509,9 +175520,9 @@ function setup127() {
175509
175520
  journeyData = fileData.trees[options.journeyId];
175510
175521
  } else if (typeof options.journeyId === "undefined" && fileData.trees) {
175511
175522
  [journeyData] = Object.values(fileData.trees);
175512
- } else if (typeof options.journeyId !== "undefined" && options.journeyId === _optionalChain([fileData, 'access', _409 => _409.tree, 'optionalAccess', _410 => _410._id])) {
175523
+ } else if (typeof options.journeyId !== "undefined" && options.journeyId === _optionalChain([fileData, 'access', _417 => _417.tree, 'optionalAccess', _418 => _418._id])) {
175513
175524
  journeyData = fileData;
175514
- } else if (typeof options.journeyId === "undefined" && _optionalChain([fileData, 'access', _411 => _411.tree, 'optionalAccess', _412 => _412._id])) {
175525
+ } else if (typeof options.journeyId === "undefined" && _optionalChain([fileData, 'access', _419 => _419.tree, 'optionalAccess', _420 => _420._id])) {
175515
175526
  journeyData = fileData;
175516
175527
  } else {
175517
175528
  throw new Error(
@@ -177387,7 +177398,7 @@ async function importServiceFromFile(serviceId, file, options = {
177387
177398
  );
177388
177399
  const data2 = fs35.default.readFileSync(filePath, "utf8");
177389
177400
  const importData = JSON.parse(data2);
177390
- if (_optionalChain([importData, 'optionalAccess', _413 => _413.service, 'access', _414 => _414[serviceId]])) {
177401
+ if (_optionalChain([importData, 'optionalAccess', _421 => _421.service, 'access', _422 => _422[serviceId]])) {
177391
177402
  await importService2(serviceId, importData, options);
177392
177403
  stopProgressIndicator2(
177393
177404
  indicatorId,
@@ -178604,7 +178615,7 @@ async function listRealms(long = false) {
178604
178615
  } catch (error2) {
178605
178616
  printMessage2(error2, "error");
178606
178617
  printMessage2(`Error listing realms: ${error2.message}`, "error");
178607
- printMessage2(_optionalChain([error2, 'access', _415 => _415.response, 'optionalAccess', _416 => _416.data]), "error");
178618
+ printMessage2(_optionalChain([error2, 'access', _423 => _423.response, 'optionalAccess', _424 => _424.data]), "error");
178608
178619
  }
178609
178620
  }
178610
178621
  async function exportRealmById(realmId, file, includeMeta = true) {
@@ -180433,7 +180444,7 @@ function setup182() {
180433
180444
  if (!outcome) process.exitCode = 1;
180434
180445
  } else if (options.allSeparate && await getTokens2()) {
180435
180446
  verboseMessage2(
180436
- `Importing script(s) into realm "${state.getRealm()}"...`
180447
+ `Importing all script files into realm "${state.getRealm()}"...`
180437
180448
  );
180438
180449
  try {
180439
180450
  await importScriptsFromFiles(
@@ -181401,7 +181412,7 @@ var compareVersions = (v12, v2) => {
181401
181412
  // package.json
181402
181413
  var package_default2 = {
181403
181414
  name: "@rockcarver/frodo-cli",
181404
- version: "3.0.4",
181415
+ version: "3.0.5",
181405
181416
  type: "module",
181406
181417
  description: "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
181407
181418
  keywords: [