@rockcarver/frodo-cli 3.0.5 → 3.0.6

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/dist/app.cjs CHANGED
@@ -106883,7 +106883,7 @@ function stringify(obj) {
106883
106883
  }
106884
106884
  var package_default = {
106885
106885
  name: "@rockcarver/frodo-lib",
106886
- version: "3.1.0",
106886
+ version: "3.3.0",
106887
106887
  type: "commonjs",
106888
106888
  main: "./dist/index.js",
106889
106889
  module: "./dist/index.mjs",
@@ -107079,6 +107079,12 @@ var State_default = (initialState) => {
107079
107079
  getRealm() {
107080
107080
  return state2.realm || process.env.FRODO_REALM;
107081
107081
  },
107082
+ setUseRealmPrefixOnManagedObjects(useRealmPrefixOnManagedObjects) {
107083
+ state2.useRealmPrefixOnManagedObjects = useRealmPrefixOnManagedObjects;
107084
+ },
107085
+ getUseRealmPrefixOnManagedObjects() {
107086
+ return state2.useRealmPrefixOnManagedObjects || false;
107087
+ },
107082
107088
  setDeploymentType(type) {
107083
107089
  state2.deploymentType = type;
107084
107090
  },
@@ -124829,6 +124835,81 @@ async function deleteRealm({
124829
124835
  }
124830
124836
  var import_replaceall = __toESM2(require_replaceall_min());
124831
124837
  var import_slugify2 = __toESM2(require_slugify());
124838
+ var FrodoError = class extends Error {
124839
+ constructor(message, originalErrors = null) {
124840
+ super(message);
124841
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "originalErrors", []);
124842
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "isHttpError", false);
124843
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpCode");
124844
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpStatus");
124845
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpMessage");
124846
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpDetail");
124847
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpErrorText");
124848
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpErrorReason");
124849
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpDescription");
124850
+ this.name = this.constructor.name;
124851
+ if (typeof Error.captureStackTrace === "function") {
124852
+ Error.captureStackTrace(this, this.constructor);
124853
+ } else {
124854
+ this.stack = new Error(message).stack;
124855
+ }
124856
+ if (originalErrors && Array.isArray(originalErrors)) {
124857
+ this.originalErrors = originalErrors;
124858
+ } else if (originalErrors) {
124859
+ this.originalErrors = [originalErrors];
124860
+ }
124861
+ if (originalErrors) {
124862
+ const error2 = this.originalErrors[0];
124863
+ this.isHttpError = error2.name === "AxiosError";
124864
+ this.httpCode = error2["code"];
124865
+ this.httpStatus = error2["response"] ? error2["response"].status : null;
124866
+ this.httpMessage = error2["response"] ? error2["response"].data ? error2["response"].data.message : null : null;
124867
+ this.httpDetail = error2["response"] ? error2["response"].data ? error2["response"].data.detail : null : null;
124868
+ this.httpErrorText = error2["response"] ? error2["response"].data ? error2["response"].data.error : null : null;
124869
+ this.httpErrorReason = error2["response"] ? error2["response"].data ? error2["response"].data.reason : null : null;
124870
+ this.httpDescription = error2["response"] ? error2["response"].data ? error2["response"].data.error_description : null : null;
124871
+ }
124872
+ }
124873
+ getOriginalErrors() {
124874
+ return this.originalErrors;
124875
+ }
124876
+ getCombinedMessage() {
124877
+ let combinedMessage = this.message || "";
124878
+ this.originalErrors.forEach((error2) => {
124879
+ switch (error2.name) {
124880
+ case "FrodoError":
124881
+ combinedMessage += "\n " + error2.getCombinedMessage();
124882
+ break;
124883
+ case "AxiosError":
124884
+ {
124885
+ combinedMessage += "\n HTTP client error";
124886
+ combinedMessage += this.httpCode ? `
124887
+ Code: ${this.httpCode}` : "";
124888
+ combinedMessage += this.httpStatus ? `
124889
+ Status: ${this.httpStatus}` : "";
124890
+ combinedMessage += this.httpErrorText ? `
124891
+ Error: ${this.httpErrorText}` : "";
124892
+ combinedMessage += this.httpErrorReason ? `
124893
+ Reason: ${this.httpErrorReason}` : "";
124894
+ combinedMessage += this.httpMessage ? `
124895
+ Message: ${this.httpMessage}` : "";
124896
+ combinedMessage += this.httpDetail ? `
124897
+ Detail: ${this.httpDetail}` : "";
124898
+ combinedMessage += this.httpDescription ? `
124899
+ Description: ${this.httpDescription}` : "";
124900
+ }
124901
+ break;
124902
+ default:
124903
+ combinedMessage += "\n " + error2.message;
124904
+ break;
124905
+ }
124906
+ });
124907
+ return combinedMessage;
124908
+ }
124909
+ toString() {
124910
+ return this.getCombinedMessage();
124911
+ }
124912
+ };
124832
124913
  var DEFAULT_REALM_KEY = "__default__realm__";
124833
124914
  var CLASSIC_DEPLOYMENT_TYPE_KEY = "classic";
124834
124915
  var CLOUD_DEPLOYMENT_TYPE_KEY = "cloud";
@@ -125229,102 +125310,55 @@ function isValidUrl(urlString) {
125229
125310
  return false;
125230
125311
  }
125231
125312
  }
125232
- async function exportOrImportWithErrorHandling(func, parameters, errors, perform = true) {
125233
- try {
125234
- return perform ? await func(parameters) : null;
125235
- } catch (error2) {
125236
- if (errors && Array.isArray(errors)) {
125237
- errors.push(error2);
125238
- }
125239
- return null;
125240
- }
125241
- }
125242
- async function exportWithErrorHandling(func, parameters, errors, perform = true) {
125243
- return exportOrImportWithErrorHandling(func, parameters, errors, perform);
125313
+ async function exportWithErrorHandling(func, parameters, type, resultCallback = void 0, perform = true) {
125314
+ return perform ? await getResult(
125315
+ resultCallback,
125316
+ `Error Exporting ${type}`,
125317
+ func,
125318
+ parameters
125319
+ ) : null;
125244
125320
  }
125245
- async function importWithErrorHandling(func, parameters, errors, id7, type, perform = true) {
125321
+ async function importWithErrorHandling(func, parameters, id7, type, resultCallback = void 0, perform = true) {
125246
125322
  updateProgressIndicator({
125247
125323
  id: id7,
125248
125324
  message: perform ? `Importing ${type}...` : `Skipping ${type}...`,
125249
125325
  state: parameters.state
125250
125326
  });
125251
- return exportOrImportWithErrorHandling(func, parameters, errors, perform);
125327
+ return perform ? await getResult(
125328
+ resultCallback,
125329
+ `Error Importing ${type}`,
125330
+ func,
125331
+ parameters
125332
+ ) : null;
125252
125333
  }
125253
- var FrodoError = class extends Error {
125254
- constructor(message, originalErrors = null) {
125255
- super(message);
125256
- _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "originalErrors", []);
125257
- _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "isHttpError", false);
125258
- _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpCode");
125259
- _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpStatus");
125260
- _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpMessage");
125261
- _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpDetail");
125262
- _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpErrorText");
125263
- _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpErrorReason");
125264
- _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpDescription");
125265
- this.name = this.constructor.name;
125266
- if (typeof Error.captureStackTrace === "function") {
125267
- Error.captureStackTrace(this, this.constructor);
125334
+ async function getResult(resultCallback, errorMessage, func, ...parameters) {
125335
+ try {
125336
+ const result = await func(...parameters);
125337
+ if (resultCallback) {
125338
+ resultCallback(void 0, result);
125339
+ }
125340
+ return result;
125341
+ } catch (e) {
125342
+ const error2 = errorMessage ? new FrodoError(errorMessage, e) : e;
125343
+ if (resultCallback) {
125344
+ resultCallback(error2, void 0);
125268
125345
  } else {
125269
- this.stack = new Error(message).stack;
125346
+ throw error2;
125270
125347
  }
125271
- if (originalErrors && Array.isArray(originalErrors)) {
125272
- this.originalErrors = originalErrors;
125273
- } else if (originalErrors) {
125274
- this.originalErrors = [originalErrors];
125348
+ }
125349
+ }
125350
+ function getErrorCallback(resultCallback, errorFilter = () => true) {
125351
+ return (e) => {
125352
+ if (!e || !errorFilter(e)) {
125353
+ return;
125275
125354
  }
125276
- if (originalErrors) {
125277
- const error2 = this.originalErrors[0];
125278
- this.isHttpError = error2.name === "AxiosError";
125279
- this.httpCode = error2["code"];
125280
- this.httpStatus = error2["response"] ? error2["response"].status : null;
125281
- this.httpMessage = error2["response"] ? error2["response"].data ? error2["response"].data.message : null : null;
125282
- this.httpDetail = error2["response"] ? error2["response"].data ? error2["response"].data.detail : null : null;
125283
- this.httpErrorText = error2["response"] ? error2["response"].data ? error2["response"].data.error : null : null;
125284
- this.httpErrorReason = error2["response"] ? error2["response"].data ? error2["response"].data.reason : null : null;
125285
- this.httpDescription = error2["response"] ? error2["response"].data ? error2["response"].data.error_description : null : null;
125355
+ if (resultCallback) {
125356
+ resultCallback(e, void 0);
125357
+ return;
125286
125358
  }
125287
- }
125288
- getOriginalErrors() {
125289
- return this.originalErrors;
125290
- }
125291
- getCombinedMessage() {
125292
- let combinedMessage = this.message || "";
125293
- this.originalErrors.forEach((error2) => {
125294
- switch (error2.name) {
125295
- case "FrodoError":
125296
- combinedMessage += "\n " + error2.getCombinedMessage();
125297
- break;
125298
- case "AxiosError":
125299
- {
125300
- combinedMessage += "\n HTTP client error";
125301
- combinedMessage += this.httpCode ? `
125302
- Code: ${this.httpCode}` : "";
125303
- combinedMessage += this.httpStatus ? `
125304
- Status: ${this.httpStatus}` : "";
125305
- combinedMessage += this.httpErrorText ? `
125306
- Error: ${this.httpErrorText}` : "";
125307
- combinedMessage += this.httpErrorReason ? `
125308
- Reason: ${this.httpErrorReason}` : "";
125309
- combinedMessage += this.httpMessage ? `
125310
- Message: ${this.httpMessage}` : "";
125311
- combinedMessage += this.httpDetail ? `
125312
- Detail: ${this.httpDetail}` : "";
125313
- combinedMessage += this.httpDescription ? `
125314
- Description: ${this.httpDescription}` : "";
125315
- }
125316
- break;
125317
- default:
125318
- combinedMessage += "\n " + error2.message;
125319
- break;
125320
- }
125321
- });
125322
- return combinedMessage;
125323
- }
125324
- toString() {
125325
- return this.getCombinedMessage();
125326
- }
125327
- };
125359
+ throw e;
125360
+ };
125361
+ }
125328
125362
  var RealmOps_default = (state2) => {
125329
125363
  return {
125330
125364
  readRealms() {
@@ -125668,8 +125702,12 @@ function getCurrentRealmManagedUser({
125668
125702
  state: state2
125669
125703
  }) {
125670
125704
  let realmManagedUser = "user";
125671
- if (state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY) {
125705
+ if (state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY || state2.getUseRealmPrefixOnManagedObjects() === true) {
125672
125706
  realmManagedUser = `${getCurrentRealmName(state2)}_user`;
125707
+ debugMessage({
125708
+ message: `DeploymentType === cloud or UseRealmPrefixOnManagedObjects is true, returning '${realmManagedUser}'`,
125709
+ state: state2
125710
+ });
125673
125711
  }
125674
125712
  return realmManagedUser;
125675
125713
  }
@@ -127588,8 +127626,8 @@ var IdmConfigOps_default = (state2) => {
127588
127626
  async exportConfigEntities(options = {
127589
127627
  envReplaceParams: void 0,
127590
127628
  entitiesToExport: void 0
127591
- }) {
127592
- return exportConfigEntities({ options, state: state2 });
127629
+ }, resultCallback = void 0) {
127630
+ return exportConfigEntities({ options, resultCallback, state: state2 });
127593
127631
  },
127594
127632
  async createConfigEntity(entityId, entityData, wait = false) {
127595
127633
  return createConfigEntity({ entityId, entityData, wait, state: state2 });
@@ -127597,14 +127635,20 @@ var IdmConfigOps_default = (state2) => {
127597
127635
  async updateConfigEntity(entityId, entityData, wait = false) {
127598
127636
  return updateConfigEntity({ entityId, entityData, wait, state: state2 });
127599
127637
  },
127600
- async importConfigEntities(importData, entityId, options = { validate: false }) {
127601
- return importConfigEntities({ entityId, importData, options, state: state2 });
127638
+ async importConfigEntities(importData, entityId, options = { validate: false }, resultCallback = void 0) {
127639
+ return importConfigEntities({
127640
+ entityId,
127641
+ importData,
127642
+ options,
127643
+ resultCallback,
127644
+ state: state2
127645
+ });
127602
127646
  },
127603
- async deleteConfigEntities() {
127604
- return deleteConfigEntities({ state: state2 });
127647
+ async deleteConfigEntities(resultCallback = void 0) {
127648
+ return deleteConfigEntities({ resultCallback, state: state2 });
127605
127649
  },
127606
- async deleteConfigEntitiesByType(type) {
127607
- return deleteConfigEntitiesByType({ type, state: state2 });
127650
+ async deleteConfigEntitiesByType(type, resultCallback = void 0) {
127651
+ return deleteConfigEntitiesByType({ type, resultCallback, state: state2 });
127608
127652
  },
127609
127653
  async deleteConfigEntity(entityId) {
127610
127654
  return deleteConfigEntity({ entityId, state: state2 });
@@ -127757,75 +127801,65 @@ async function exportConfigEntity({
127757
127801
  exportData.idm[entity._id] = entity;
127758
127802
  return exportData;
127759
127803
  } catch (error2) {
127760
- printError(error2);
127804
+ throw new FrodoError(`Error getting config entity ${entityId}`, error2);
127761
127805
  }
127762
127806
  }
127763
127807
  async function exportConfigEntities({
127764
127808
  options = { envReplaceParams: void 0, entitiesToExport: void 0 },
127809
+ resultCallback = void 0,
127765
127810
  state: state2
127766
127811
  }) {
127767
- let indicatorId;
127768
- try {
127769
- let configurations = await readConfigEntities({ state: state2 });
127770
- if (options.entitiesToExport && options.entitiesToExport.length > 0) {
127771
- configurations = configurations.filter(
127772
- (c) => options.entitiesToExport.includes(c._id)
127773
- );
127774
- }
127775
- indicatorId = createProgressIndicator({
127776
- total: configurations.length,
127777
- message: "Exporting config entities...",
127778
- state: state2
127779
- });
127780
- const entityPromises = [];
127781
- for (const configEntity of configurations) {
127782
- updateProgressIndicator({
127783
- id: indicatorId,
127784
- message: `Exporting config entity ${configEntity._id}`,
127785
- state: state2
127786
- });
127787
- entityPromises.push(
127788
- readConfigEntity({ entityId: configEntity._id, state: state2 }).catch(
127789
- (readConfigEntityError) => {
127790
- const error2 = readConfigEntityError;
127791
- if (
127792
- // operation is not available in PingOne Advanced Identity Cloud
127793
- !(error2.httpStatus === 403 && error2.httpMessage === "This operation is not available in PingOne Advanced Identity Cloud.") && // list of config entities, which do not exist by default or ever.
127794
- !(IDM_UNAVAILABLE_ENTITIES.includes(configEntity._id) && error2.httpStatus === 404 && error2.httpErrorReason === "Not Found") && // https://bugster.forgerock.org/jira/browse/OPENIDM-18270
127795
- !(error2.httpStatus === 404 && error2.httpMessage === "No configuration exists for id org.apache.felix.fileinstall/openidm")
127796
- ) {
127797
- printMessage({
127798
- message: _optionalChain([readConfigEntityError, 'access', _92 => _92.response, 'optionalAccess', _93 => _93.data]),
127799
- type: "error",
127800
- state: state2
127801
- });
127802
- printMessage({
127803
- message: `Error getting config entity ${configEntity._id}: ${readConfigEntityError}`,
127804
- type: "error",
127805
- state: state2
127806
- });
127807
- }
127808
- }
127809
- )
127810
- );
127811
- }
127812
- const exportData = createConfigEntityExportTemplate({ state: state2 });
127813
- (await Promise.all(entityPromises)).filter((c) => c).forEach((entity) => {
127814
- exportData.idm[entity._id] = substituteEntityWithEnv(
127815
- entity,
127816
- options.envReplaceParams
127817
- );
127818
- });
127819
- stopProgressIndicator({
127812
+ const exportData = createConfigEntityExportTemplate({ state: state2 });
127813
+ let configurations = await readConfigEntities({ state: state2 });
127814
+ if (options.entitiesToExport && options.entitiesToExport.length > 0) {
127815
+ configurations = configurations.filter(
127816
+ (c) => options.entitiesToExport.includes(c._id)
127817
+ );
127818
+ }
127819
+ const indicatorId = createProgressIndicator({
127820
+ total: configurations.length,
127821
+ message: "Exporting config entities...",
127822
+ state: state2
127823
+ });
127824
+ const entityPromises = [];
127825
+ for (const configEntity of configurations) {
127826
+ updateProgressIndicator({
127820
127827
  id: indicatorId,
127821
- message: `Exported ${configurations.length} config entities.`,
127822
- status: "success",
127828
+ message: `Exporting config entity ${configEntity._id}`,
127823
127829
  state: state2
127824
127830
  });
127825
- return exportData;
127826
- } catch (error2) {
127827
- printError(error2);
127831
+ entityPromises.push(
127832
+ getResult(
127833
+ getErrorCallback(
127834
+ resultCallback,
127835
+ (error2) => !// operation is not available in PingOne Advanced Identity Cloud
127836
+ (error2.httpStatus === 403 && error2.httpMessage === "This operation is not available in PingOne Advanced Identity Cloud.") && // list of config entities, which do not exist by default or ever.
127837
+ !(IDM_UNAVAILABLE_ENTITIES.includes(configEntity._id) && error2.httpStatus === 404 && error2.httpErrorReason === "Not Found") && // https://bugster.forgerock.org/jira/browse/OPENIDM-18270
127838
+ !(error2.httpStatus === 404 && error2.httpMessage === "No configuration exists for id org.apache.felix.fileinstall/openidm")
127839
+ ),
127840
+ `Error exporting idm config entity ${configEntity._id}`,
127841
+ readConfigEntity,
127842
+ { entityId: configEntity._id, state: state2 }
127843
+ )
127844
+ );
127828
127845
  }
127846
+ (await Promise.all(entityPromises)).filter((c) => c).forEach((entity) => {
127847
+ const substitutedEntity = substituteEntityWithEnv(
127848
+ entity,
127849
+ options.envReplaceParams
127850
+ );
127851
+ exportData.idm[entity._id] = substitutedEntity;
127852
+ if (resultCallback) {
127853
+ resultCallback(void 0, substitutedEntity);
127854
+ }
127855
+ });
127856
+ stopProgressIndicator({
127857
+ id: indicatorId,
127858
+ message: `Exported ${configurations.length} config entities.`,
127859
+ status: "success",
127860
+ state: state2
127861
+ });
127862
+ return exportData;
127829
127863
  }
127830
127864
  async function createConfigEntity({
127831
127865
  entityId,
@@ -127878,11 +127912,11 @@ async function importConfigEntities({
127878
127912
  entitiesToImport: void 0,
127879
127913
  validate: false
127880
127914
  },
127915
+ resultCallback = void 0,
127881
127916
  state: state2
127882
127917
  }) {
127883
127918
  debugMessage({ message: `IdmConfigOps.importConfigEntities: start`, state: state2 });
127884
127919
  const response = [];
127885
- const errors = [];
127886
127920
  let ids = Object.keys(importData.idm);
127887
127921
  if (options.entitiesToImport && options.entitiesToImport.length > 0) {
127888
127922
  ids = ids.filter((id7) => options.entitiesToImport.includes(id7));
@@ -127905,32 +127939,36 @@ async function importConfigEntities({
127905
127939
  `Invalid script hook in the config object '${id7}'`
127906
127940
  );
127907
127941
  }
127908
- try {
127909
- const result = await updateConfigEntity({
127910
- entityId: id7,
127911
- entityData,
127912
- state: state2
127913
- });
127914
- response.push(result);
127915
- } catch (error2) {
127916
- if (
127917
- // protected entities (e.g. root realm email templates)
127918
- !(state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY && AIC_PROTECTED_ENTITIES.includes(id7) && error2.httpStatus === 403 && error2.httpCode === "ERR_BAD_REQUEST")
127919
- ) {
127920
- throw error2;
127921
- }
127942
+ const result = await updateConfigEntity({
127943
+ entityId: id7,
127944
+ entityData,
127945
+ state: state2
127946
+ });
127947
+ response.push(result);
127948
+ if (resultCallback) {
127949
+ resultCallback(void 0, result);
127922
127950
  }
127923
127951
  } catch (error2) {
127924
- errors.push(error2);
127952
+ if (
127953
+ // protected entities (e.g. root realm email templates)
127954
+ !(state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY && AIC_PROTECTED_ENTITIES.includes(id7) && error2.httpStatus === 403 && error2.httpCode === "ERR_BAD_REQUEST")
127955
+ ) {
127956
+ if (resultCallback) {
127957
+ resultCallback(error2, void 0);
127958
+ } else {
127959
+ throw new FrodoError(
127960
+ `Error importing idm config entity ${id7}`,
127961
+ error2
127962
+ );
127963
+ }
127964
+ }
127925
127965
  }
127926
127966
  }
127927
- if (errors.length > 0) {
127928
- throw new FrodoError(`Error importing config entities`, errors);
127929
- }
127930
127967
  debugMessage({ message: `IdmConfigOps.importConfigEntities: end`, state: state2 });
127931
127968
  return response;
127932
127969
  }
127933
127970
  async function deleteConfigEntities({
127971
+ resultCallback = void 0,
127934
127972
  state: state2
127935
127973
  }) {
127936
127974
  debugMessage({
@@ -127938,30 +127976,23 @@ async function deleteConfigEntities({
127938
127976
  state: state2
127939
127977
  });
127940
127978
  const result = [];
127941
- const errors = [];
127942
- try {
127943
- const configEntityStubs = await readConfigEntityStubs({ state: state2 });
127944
- for (const configEntityStub of configEntityStubs) {
127945
- try {
127946
- debugMessage({
127947
- message: `IdmConfigOps.deleteConfigEntities: '${configEntityStub["_id"]}'`,
127979
+ const configEntityStubs = await readConfigEntityStubs({ state: state2 });
127980
+ for (const configEntityStub of configEntityStubs) {
127981
+ debugMessage({
127982
+ message: `IdmConfigOps.deleteConfigEntities: '${configEntityStub["_id"]}'`,
127983
+ state: state2
127984
+ });
127985
+ result.push(
127986
+ await getResult(
127987
+ resultCallback,
127988
+ `Error deleting idm config entity ${configEntityStub._id}`,
127989
+ deleteConfigEntity2,
127990
+ {
127991
+ entityId: configEntityStub["_id"],
127948
127992
  state: state2
127949
- });
127950
- result.push(
127951
- await deleteConfigEntity2({
127952
- entityId: configEntityStub["_id"],
127953
- state: state2
127954
- })
127955
- );
127956
- } catch (error2) {
127957
- errors.push(error2);
127958
- }
127959
- }
127960
- } catch (error2) {
127961
- errors.push(error2);
127962
- }
127963
- if (errors.length > 0) {
127964
- throw new FrodoError(`Error deleting config entities`, errors);
127993
+ }
127994
+ )
127995
+ );
127965
127996
  }
127966
127997
  debugMessage({
127967
127998
  message: `IdmConfigOps.deleteConfigEntities: end`,
@@ -127971,6 +128002,7 @@ async function deleteConfigEntities({
127971
128002
  }
127972
128003
  async function deleteConfigEntitiesByType({
127973
128004
  type,
128005
+ resultCallback = void 0,
127974
128006
  state: state2
127975
128007
  }) {
127976
128008
  debugMessage({
@@ -127978,39 +128010,29 @@ async function deleteConfigEntitiesByType({
127978
128010
  state: state2
127979
128011
  });
127980
128012
  const result = [];
127981
- const errors = [];
127982
- try {
127983
- const configEntities = await readConfigEntitiesByType({ type, state: state2 });
127984
- for (const configEntity of configEntities) {
127985
- try {
127986
- debugMessage({
127987
- message: `IdmConfigOps.deleteConfigEntitiesByType: '${configEntity["_id"]}'`,
127988
- state: state2
127989
- });
127990
- result.push(
127991
- await deleteConfigEntity2({
127992
- entityId: configEntity["_id"],
127993
- state: state2
127994
- })
127995
- );
127996
- } catch (error2) {
127997
- errors.push(error2);
127998
- }
127999
- }
128000
- if (errors.length > 0) {
128001
- throw new FrodoError(`Error deleting config entities by type`, errors);
128002
- }
128013
+ const configEntities = await readConfigEntitiesByType({ type, state: state2 });
128014
+ for (const configEntity of configEntities) {
128003
128015
  debugMessage({
128004
- message: `IdmConfigOps.deleteConfigEntitiesByType: end`,
128016
+ message: `IdmConfigOps.deleteConfigEntitiesByType: '${configEntity["_id"]}'`,
128005
128017
  state: state2
128006
128018
  });
128007
- return result;
128008
- } catch (error2) {
128009
- if (errors.length > 0) {
128010
- throw error2;
128011
- }
128012
- throw new FrodoError(`Error deleting config entities by type`, error2);
128019
+ result.push(
128020
+ await getResult(
128021
+ resultCallback,
128022
+ `Error deleting idm config entity ${configEntity._id}`,
128023
+ deleteConfigEntity2,
128024
+ {
128025
+ entityId: configEntity["_id"],
128026
+ state: state2
128027
+ }
128028
+ )
128029
+ );
128013
128030
  }
128031
+ debugMessage({
128032
+ message: `IdmConfigOps.deleteConfigEntitiesByType: end`,
128033
+ state: state2
128034
+ });
128035
+ return result;
128014
128036
  }
128015
128037
  async function deleteConfigEntity({
128016
128038
  entityId,
@@ -128043,7 +128065,7 @@ async function readSubConfigEntity({
128043
128065
  }
128044
128066
  return subEntity;
128045
128067
  } catch (error2) {
128046
- printError(error2);
128068
+ throw new FrodoError(`Error reading sub config ${entityId} ${name}`, error2);
128047
128069
  }
128048
128070
  }
128049
128071
  async function importSubConfigEntity({
@@ -128061,13 +128083,13 @@ async function importSubConfigEntity({
128061
128083
  entityId,
128062
128084
  state: state2
128063
128085
  });
128064
- const subEntityKey = Object.keys(_optionalChain([entityExport, 'access', _94 => _94.idm, 'optionalAccess', _95 => _95[entityId]])).find(
128086
+ const subEntityKey = Object.keys(_optionalChain([entityExport, 'access', _92 => _92.idm, 'optionalAccess', _93 => _93[entityId]])).find(
128065
128087
  (key) => key !== "_id"
128066
128088
  );
128067
- if (!Array.isArray(_optionalChain([entityExport, 'access', _96 => _96.idm, 'optionalAccess', _97 => _97[entityId], 'optionalAccess', _98 => _98[subEntityKey]]))) {
128089
+ if (!Array.isArray(_optionalChain([entityExport, 'access', _94 => _94.idm, 'optionalAccess', _95 => _95[entityId], 'optionalAccess', _96 => _96[subEntityKey]]))) {
128068
128090
  throw new FrodoError(`Error importing sub config of ${entityId}`);
128069
128091
  }
128070
- const existingSubEntityIndex = (_optionalChain([entityExport, 'access', _99 => _99.idm, 'optionalAccess', _100 => _100[entityId], 'optionalAccess', _101 => _101[subEntityKey]])).findIndex((item) => item.name === updatedSubConfigEntity.name);
128092
+ const existingSubEntityIndex = (_optionalChain([entityExport, 'access', _97 => _97.idm, 'optionalAccess', _98 => _98[entityId], 'optionalAccess', _99 => _99[subEntityKey]])).findIndex((item) => item.name === updatedSubConfigEntity.name);
128071
128093
  if (existingSubEntityIndex !== -1) {
128072
128094
  entityExport.idm[entityId][subEntityKey][existingSubEntityIndex] = updatedSubConfigEntity;
128073
128095
  } else {
@@ -128725,7 +128747,7 @@ async function readOAuth2Provider({
128725
128747
  try {
128726
128748
  return await getOAuth2Provider({ state: state2 });
128727
128749
  } catch (error2) {
128728
- if (error2.httpStatus === 404 || _optionalChain([error2, 'access', _102 => _102.response, 'optionalAccess', _103 => _103.status]) === 404) {
128750
+ if (error2.httpStatus === 404 || _optionalChain([error2, 'access', _100 => _100.response, 'optionalAccess', _101 => _101.status]) === 404) {
128729
128751
  return null;
128730
128752
  } else {
128731
128753
  throw new FrodoError(`Error reading oauth2 provider`, error2);
@@ -128884,32 +128906,6 @@ async function deleteScriptByName({
128884
128906
  state: state2
128885
128907
  });
128886
128908
  }
128887
- async function deleteScripts({
128888
- state: state2
128889
- }) {
128890
- const { result } = await getScripts({ state: state2 });
128891
- const scripts = result.filter((s4) => !s4.default);
128892
- const deletedScripts = [];
128893
- const errors = [];
128894
- for (const script of scripts) {
128895
- try {
128896
- deletedScripts.push(
128897
- await deleteScript({
128898
- scriptId: script._id,
128899
- state: state2
128900
- })
128901
- );
128902
- } catch (error2) {
128903
- errors.push(error2);
128904
- }
128905
- }
128906
- if (errors.length) {
128907
- const errorMessages = errors.map((error2) => error2.message).join("\n");
128908
- throw new Error(`Delete error:
128909
- ${errorMessages}`);
128910
- }
128911
- return deletedScripts;
128912
- }
128913
128909
  var ScriptOps_default = (state2) => {
128914
128910
  return {
128915
128911
  createScriptExportTemplate() {
@@ -128939,8 +128935,8 @@ var ScriptOps_default = (state2) => {
128939
128935
  async deleteScriptByName(scriptName) {
128940
128936
  return deleteScriptByName2({ scriptName, state: state2 });
128941
128937
  },
128942
- async deleteScripts() {
128943
- return deleteScripts2({ state: state2 });
128938
+ async deleteScripts(resultCallback = void 0) {
128939
+ return deleteScripts({ resultCallback, state: state2 });
128944
128940
  },
128945
128941
  async exportScript(scriptId, options = {
128946
128942
  deps: true,
@@ -128960,20 +128956,21 @@ var ScriptOps_default = (state2) => {
128960
128956
  deps: true,
128961
128957
  includeDefault: false,
128962
128958
  useStringArrays: true
128963
- }) {
128964
- return exportScripts({ options, state: state2 });
128959
+ }, resultCallback = void 0) {
128960
+ return exportScripts({ options, resultCallback, state: state2 });
128965
128961
  },
128966
128962
  async importScripts(scriptId, scriptName, importData, options = {
128967
128963
  deps: true,
128968
128964
  reUuid: false,
128969
128965
  includeDefault: false
128970
- }, validate3 = false) {
128966
+ }, validate3 = false, resultCallback = void 0) {
128971
128967
  return importScripts2({
128972
128968
  scriptId,
128973
128969
  scriptName,
128974
128970
  importData,
128975
128971
  options,
128976
128972
  validate: validate3,
128973
+ resultCallback,
128977
128974
  state: state2
128978
128975
  });
128979
128976
  },
@@ -129116,7 +129113,7 @@ async function updateScript({
129116
129113
  }
129117
129114
  result = await putScript({ scriptId, scriptData, state: state2 });
129118
129115
  } catch (error2) {
129119
- if (_optionalChain([error2, 'access', _104 => _104.response, 'optionalAccess', _105 => _105.status]) === 409) {
129116
+ if (_optionalChain([error2, 'access', _102 => _102.response, 'optionalAccess', _103 => _103.status]) === 409) {
129120
129117
  verboseMessage({
129121
129118
  message: `createOrUpdateScript WARNING: script with name ${scriptData.name} already exists, using renaming policy... <name> => <name - imported (n)>`,
129122
129119
  state: state2
@@ -129152,14 +129149,26 @@ async function deleteScriptByName2({
129152
129149
  throw new FrodoError(`Error deleting script ${scriptName}`, error2);
129153
129150
  }
129154
129151
  }
129155
- async function deleteScripts2({
129152
+ async function deleteScripts({
129153
+ resultCallback = void 0,
129156
129154
  state: state2
129157
129155
  }) {
129158
- try {
129159
- return deleteScripts({ state: state2 });
129160
- } catch (error2) {
129161
- throw new FrodoError(`Error deleting scripts`, error2);
129156
+ const result = await readScripts({ state: state2 });
129157
+ const scripts = result.filter((s4) => !s4.default);
129158
+ const deletedScripts = [];
129159
+ for (const script of scripts) {
129160
+ const result2 = await getResult(
129161
+ resultCallback,
129162
+ `Error deleting script ${script.name}`,
129163
+ deleteScript2,
129164
+ {
129165
+ scriptId: script._id,
129166
+ state: state2
129167
+ }
129168
+ );
129169
+ deletedScripts.push(result2);
129162
129170
  }
129171
+ return deletedScripts;
129163
129172
  }
129164
129173
  async function exportScript({
129165
129174
  scriptId,
@@ -129205,58 +129214,42 @@ async function exportScripts({
129205
129214
  includeDefault: false,
129206
129215
  useStringArrays: true
129207
129216
  },
129217
+ resultCallback = void 0,
129208
129218
  state: state2
129209
129219
  }) {
129210
- const errors = [];
129211
- let indicatorId;
129212
- try {
129213
- const { includeDefault, useStringArrays } = options;
129214
- let scriptList = await readScripts({ state: state2 });
129215
- if (!includeDefault)
129216
- scriptList = scriptList.filter((script) => !script.default);
129217
- const exportData = createScriptExportTemplate({ state: state2 });
129218
- indicatorId = createProgressIndicator({
129219
- total: scriptList.length,
129220
- message: `Exporting ${scriptList.length} scripts...`,
129221
- state: state2
129222
- });
129223
- for (const scriptData of scriptList) {
129224
- try {
129225
- updateProgressIndicator({
129226
- id: indicatorId,
129227
- message: `Reading script ${scriptData.name}`,
129228
- state: state2
129229
- });
129230
- exportData.script[scriptData._id] = await prepareScriptForExport({
129231
- scriptData,
129232
- useStringArrays,
129233
- state: state2
129234
- });
129235
- } catch (error2) {
129236
- errors.push(error2);
129237
- }
129238
- }
129239
- if (errors.length > 0) {
129240
- throw new FrodoError(``, errors);
129241
- }
129242
- stopProgressIndicator({
129243
- id: indicatorId,
129244
- message: `Exported ${scriptList.length} scripts.`,
129245
- state: state2
129246
- });
129247
- return exportData;
129248
- } catch (error2) {
129249
- stopProgressIndicator({
129220
+ const { includeDefault, useStringArrays } = options;
129221
+ let scriptList = await readScripts({ state: state2 });
129222
+ if (!includeDefault)
129223
+ scriptList = scriptList.filter((script) => !script.default);
129224
+ const exportData = createScriptExportTemplate({ state: state2 });
129225
+ const indicatorId = createProgressIndicator({
129226
+ total: scriptList.length,
129227
+ message: `Exporting ${scriptList.length} scripts...`,
129228
+ state: state2
129229
+ });
129230
+ for (const scriptData of scriptList) {
129231
+ updateProgressIndicator({
129250
129232
  id: indicatorId,
129251
- message: `Error exporting scripts`,
129252
- status: "fail",
129233
+ message: `Reading script ${scriptData.name}`,
129253
129234
  state: state2
129254
129235
  });
129255
- if (errors.length > 0) {
129256
- throw error2;
129257
- }
129258
- throw new FrodoError(`Error exporting scripts`, error2);
129236
+ exportData.script[scriptData._id] = await getResult(
129237
+ resultCallback,
129238
+ `Error exporting script ${scriptData.name}`,
129239
+ prepareScriptForExport,
129240
+ {
129241
+ scriptData,
129242
+ useStringArrays,
129243
+ state: state2
129244
+ }
129245
+ );
129259
129246
  }
129247
+ stopProgressIndicator({
129248
+ id: indicatorId,
129249
+ message: `Exported ${scriptList.length} scripts.`,
129250
+ state: state2
129251
+ });
129252
+ return exportData;
129260
129253
  }
129261
129254
  async function importScripts2({
129262
129255
  scriptId,
@@ -129268,61 +129261,57 @@ async function importScripts2({
129268
129261
  includeDefault: false
129269
129262
  },
129270
129263
  validate: validate3 = false,
129264
+ resultCallback = void 0,
129271
129265
  state: state2
129272
129266
  }) {
129273
- const errors = [];
129274
- try {
129275
- debugMessage({ message: `ScriptOps.importScripts: start`, state: state2 });
129276
- const response = [];
129277
- for (const existingId of Object.keys(importData.script)) {
129278
- try {
129279
- const scriptData = importData.script[existingId];
129280
- const isDefault = !options.includeDefault && scriptData.default;
129281
- const shouldNotImportScript = !options.deps && (scriptId && scriptId !== scriptData._id || !scriptId && scriptName && scriptName !== scriptData.name);
129282
- if (isDefault || shouldNotImportScript) continue;
129267
+ debugMessage({ message: `ScriptOps.importScripts: start`, state: state2 });
129268
+ const response = [];
129269
+ for (const existingId of Object.keys(importData.script)) {
129270
+ try {
129271
+ const scriptData = importData.script[existingId];
129272
+ const isDefault = !options.includeDefault && scriptData.default;
129273
+ const shouldNotImportScript = !options.deps && (scriptId && scriptId !== scriptData._id || !scriptId && scriptName && scriptName !== scriptData.name);
129274
+ if (isDefault || shouldNotImportScript) continue;
129275
+ debugMessage({
129276
+ message: `ScriptOps.importScripts: Importing script ${scriptData.name} (${existingId})`,
129277
+ state: state2
129278
+ });
129279
+ let newId = existingId;
129280
+ if (options.reUuid) {
129281
+ newId = v4_default();
129283
129282
  debugMessage({
129284
- message: `ScriptOps.importScripts: Importing script ${scriptData.name} (${existingId})`,
129283
+ message: `ScriptOps.importScripts: Re-uuid-ing script ${scriptData.name} ${existingId} => ${newId}...`,
129285
129284
  state: state2
129286
129285
  });
129287
- let newId = existingId;
129288
- if (options.reUuid) {
129289
- newId = v4_default();
129290
- debugMessage({
129291
- message: `ScriptOps.importScripts: Re-uuid-ing script ${scriptData.name} ${existingId} => ${newId}...`,
129292
- state: state2
129293
- });
129294
- scriptData._id = newId;
129295
- }
129296
- if (validate3) {
129297
- if (!isScriptValid({ scriptData, state: state2 })) {
129298
- errors.push(
129299
- new FrodoError(
129300
- `Error importing script '${scriptData.name}': Script is not valid`
129301
- )
129302
- );
129303
- }
129286
+ scriptData._id = newId;
129287
+ }
129288
+ if (validate3) {
129289
+ if (!isScriptValid({ scriptData, state: state2 })) {
129290
+ throw new FrodoError(`Script is invalid`);
129304
129291
  }
129305
- const result = await updateScript({
129306
- scriptId: newId,
129307
- scriptData,
129308
- state: state2
129309
- });
129310
- response.push(result);
129311
- } catch (error2) {
129312
- errors.push(error2);
129292
+ }
129293
+ const result = await updateScript({
129294
+ scriptId: newId,
129295
+ scriptData,
129296
+ state: state2
129297
+ });
129298
+ if (resultCallback) {
129299
+ resultCallback(void 0, result);
129300
+ }
129301
+ response.push(result);
129302
+ } catch (e) {
129303
+ if (resultCallback) {
129304
+ resultCallback(e, void 0);
129305
+ } else {
129306
+ throw new FrodoError(
129307
+ `Error importing script '${importData.script[existingId].name}'`,
129308
+ e
129309
+ );
129313
129310
  }
129314
129311
  }
129315
- if (errors.length > 0) {
129316
- throw new FrodoError(`Error importing scripts`, errors);
129317
- }
129318
- debugMessage({ message: `ScriptOps.importScripts: end`, state: state2 });
129319
- return response;
129320
- } catch (error2) {
129321
- if (errors.length > 0) {
129322
- throw error2;
129323
- }
129324
- throw new FrodoError(`Error importing scripts`, error2);
129325
129312
  }
129313
+ debugMessage({ message: `ScriptOps.importScripts: end`, state: state2 });
129314
+ return response;
129326
129315
  }
129327
129316
  async function prepareScriptExport({
129328
129317
  scriptData,
@@ -129498,7 +129487,7 @@ async function updateOAuth2Client({
129498
129487
  debugMessage({ message: `OAuth2ClientOps.putOAuth2Client: end`, state: state2 });
129499
129488
  return response;
129500
129489
  } catch (error2) {
129501
- if (_optionalChain([error2, 'access', _106 => _106.response, 'optionalAccess', _107 => _107.status]) === 400 && _optionalChain([error2, 'access', _108 => _108.response, 'optionalAccess', _109 => _109.data, 'optionalAccess', _110 => _110.message]) === "Invalid attribute specified.") {
129490
+ if (_optionalChain([error2, 'access', _104 => _104.response, 'optionalAccess', _105 => _105.status]) === 400 && _optionalChain([error2, 'access', _106 => _106.response, 'optionalAccess', _107 => _107.data, 'optionalAccess', _108 => _108.message]) === "Invalid attribute specified.") {
129502
129491
  try {
129503
129492
  const { validAttributes } = error2.response.data.detail;
129504
129493
  validAttributes.push("_id");
@@ -130230,7 +130219,7 @@ async function updateOAuth2TrustedJwtIssuer({
130230
130219
  });
130231
130220
  return response;
130232
130221
  } catch (error2) {
130233
- if (_optionalChain([error2, 'access', _111 => _111.response, 'optionalAccess', _112 => _112.status]) === 400 && _optionalChain([error2, 'access', _113 => _113.response, 'optionalAccess', _114 => _114.data, 'optionalAccess', _115 => _115.message]) === "Invalid attribute specified.") {
130222
+ if (_optionalChain([error2, 'access', _109 => _109.response, 'optionalAccess', _110 => _110.status]) === 400 && _optionalChain([error2, 'access', _111 => _111.response, 'optionalAccess', _112 => _112.data, 'optionalAccess', _113 => _113.message]) === "Invalid attribute specified.") {
130234
130223
  try {
130235
130224
  const { validAttributes } = error2.response.data.detail;
130236
130225
  validAttributes.push("_id");
@@ -130620,8 +130609,12 @@ var OrganizationOps_default = (state2) => {
130620
130609
  };
130621
130610
  function getRealmManagedOrganization({ state: state2 }) {
130622
130611
  let realmManagedOrg = "organization";
130623
- if (state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY) {
130612
+ if (state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY || state2.getUseRealmPrefixOnManagedObjects() === true) {
130624
130613
  realmManagedOrg = `${state2.getRealm()}_organization`;
130614
+ debugMessage({
130615
+ message: `DeploymentType === cloud or UseRealmPrefixOnManagedObjects is true, returning '${realmManagedOrg}'`,
130616
+ state: state2
130617
+ });
130625
130618
  }
130626
130619
  return realmManagedOrg;
130627
130620
  }
@@ -133509,7 +133502,7 @@ async function readAgents({
133509
133502
  (t) => t !== "SoapSTSAgent" || state2.getDeploymentType() === Constants_default.CLASSIC_DEPLOYMENT_TYPE_KEY
133510
133503
  ).map(
133511
133504
  (agentType) => getAgentsByType({ agentType, state: state2 }).catch((err) => {
133512
- if (err.httpStatus !== 501 && _optionalChain([err, 'access', _116 => _116.response, 'optionalAccess', _117 => _117.status]) !== 501) {
133505
+ if (err.httpStatus !== 501 && _optionalChain([err, 'access', _114 => _114.response, 'optionalAccess', _115 => _115.status]) !== 501) {
133513
133506
  throw err;
133514
133507
  } else {
133515
133508
  return { result: [] };
@@ -134187,7 +134180,7 @@ async function importAgents({
134187
134180
  })
134188
134181
  );
134189
134182
  } catch (error2) {
134190
- if (error2.httpStatus !== 501 && _optionalChain([error2, 'access', _118 => _118.response, 'optionalAccess', _119 => _119.status]) !== 501) {
134183
+ if (error2.httpStatus !== 501 && _optionalChain([error2, 'access', _116 => _116.response, 'optionalAccess', _117 => _117.status]) !== 501) {
134191
134184
  errors.push(
134192
134185
  new FrodoError(
134193
134186
  `Error importing agent ${agentId} of type ${agentType}`,
@@ -134239,7 +134232,7 @@ async function importAgentGroups({
134239
134232
  })
134240
134233
  );
134241
134234
  } catch (error2) {
134242
- if (error2.httpStatus !== 501 && _optionalChain([error2, 'access', _120 => _120.response, 'optionalAccess', _121 => _121.status]) !== 501) {
134235
+ if (error2.httpStatus !== 501 && _optionalChain([error2, 'access', _118 => _118.response, 'optionalAccess', _119 => _119.status]) !== 501) {
134243
134236
  errors.push(
134244
134237
  new FrodoError(
134245
134238
  `Error importing agent group ${agentGroupId} of type ${agentType}`,
@@ -134401,7 +134394,7 @@ async function importAgent({
134401
134394
  }) {
134402
134395
  try {
134403
134396
  debugMessage({ message: `AgentOps.importAgent: start`, state: state2 });
134404
- const agentType = _optionalChain([importData, 'access', _122 => _122.agent, 'access', _123 => _123[agentId], 'optionalAccess', _124 => _124._type, 'access', _125 => _125._id]);
134397
+ const agentType = _optionalChain([importData, 'access', _120 => _120.agent, 'access', _121 => _121[agentId], 'optionalAccess', _122 => _122._type, 'access', _123 => _123._id]);
134405
134398
  if (agentType === "SoapSTSAgent" && state2.getDeploymentType() !== Constants_default.CLASSIC_DEPLOYMENT_TYPE_KEY) {
134406
134399
  throw new FrodoError(
134407
134400
  `Can't import Soap STS agents for '${state2.getDeploymentType()}' deployment type.`
@@ -134427,7 +134420,7 @@ async function importAgentGroup({
134427
134420
  }) {
134428
134421
  try {
134429
134422
  debugMessage({ message: `AgentOps.importAgentGroup: start`, state: state2 });
134430
- const agentType = _optionalChain([importData, 'access', _126 => _126.agentGroup, 'access', _127 => _127[agentGroupId], 'optionalAccess', _128 => _128._type, 'access', _129 => _129._id]);
134423
+ const agentType = _optionalChain([importData, 'access', _124 => _124.agentGroup, 'access', _125 => _125[agentGroupId], 'optionalAccess', _126 => _126._type, 'access', _127 => _127._id]);
134431
134424
  if (agentType === "SoapSTSAgent" && state2.getDeploymentType() !== Constants_default.CLASSIC_DEPLOYMENT_TYPE_KEY) {
134432
134425
  throw new FrodoError(
134433
134426
  `Can't import Soap STS agent groups for '${state2.getDeploymentType()}' deployment type.`
@@ -134455,7 +134448,7 @@ async function importIdentityGatewayAgent({
134455
134448
  message: `AgentOps.importIdentityGatewayAgent: start`,
134456
134449
  state: state2
134457
134450
  });
134458
- const agentType = _optionalChain([importData, 'access', _130 => _130.agent, 'access', _131 => _131[agentId], 'optionalAccess', _132 => _132._type, 'access', _133 => _133._id]);
134451
+ const agentType = _optionalChain([importData, 'access', _128 => _128.agent, 'access', _129 => _129[agentId], 'optionalAccess', _130 => _130._type, 'access', _131 => _131._id]);
134459
134452
  if (agentType !== "IdentityGatewayAgent")
134460
134453
  throw new FrodoError(
134461
134454
  `Wrong agent type! Expected 'IdentityGatewayAgent' but got '${agentType}'.`
@@ -134486,7 +134479,7 @@ async function importJavaAgent({
134486
134479
  }) {
134487
134480
  try {
134488
134481
  debugMessage({ message: `AgentOps.importJavaAgent: start`, state: state2 });
134489
- const agentType = _optionalChain([importData, 'access', _134 => _134.agent, 'access', _135 => _135[agentId], 'optionalAccess', _136 => _136._type, 'access', _137 => _137._id]);
134482
+ const agentType = _optionalChain([importData, 'access', _132 => _132.agent, 'access', _133 => _133[agentId], 'optionalAccess', _134 => _134._type, 'access', _135 => _135._id]);
134490
134483
  if (agentType !== "J2EEAgent")
134491
134484
  throw new FrodoError(
134492
134485
  `Wrong agent type! Expected 'J2EEAgent' but got '${agentType}'.`
@@ -134511,7 +134504,7 @@ async function importWebAgent({
134511
134504
  }) {
134512
134505
  try {
134513
134506
  debugMessage({ message: `AgentOps.importWebAgent: start`, state: state2 });
134514
- const agentType = _optionalChain([importData, 'access', _138 => _138.agent, 'access', _139 => _139[agentId], 'optionalAccess', _140 => _140._type, 'access', _141 => _141._id]);
134507
+ const agentType = _optionalChain([importData, 'access', _136 => _136.agent, 'access', _137 => _137[agentId], 'optionalAccess', _138 => _138._type, 'access', _139 => _139._id]);
134515
134508
  if (agentType !== "WebAgent")
134516
134509
  throw new FrodoError(
134517
134510
  `Wrong agent type! Expected 'WebAgent' but got '${agentType}'.`
@@ -134969,17 +134962,17 @@ async function getConfigEntity2({
134969
134962
  state2.setRealm(currentRealm);
134970
134963
  return data2;
134971
134964
  } catch (error2) {
134972
- printError({
134973
- error: error2,
134974
- message: `Error getting config entity from resource path '${urlString}'`,
134975
- state: state2
134976
- });
134965
+ throw new FrodoError(
134966
+ `Error getting config entity from resource path '${urlString}'`,
134967
+ error2
134968
+ );
134977
134969
  }
134978
134970
  }
134979
134971
  async function getConfigEntities2({
134980
134972
  includeReadOnly = false,
134981
134973
  onlyRealm = false,
134982
134974
  onlyGlobal = false,
134975
+ resultCallback = void 0,
134983
134976
  state: state2
134984
134977
  }) {
134985
134978
  const realms2 = await getRealmsForExport({ state: state2 });
@@ -134994,22 +134987,19 @@ async function getConfigEntities2({
134994
134987
  }
134995
134988
  const deploymentAllowed = entityInfo.deployments && entityInfo.deployments.includes(state2.getDeploymentType());
134996
134989
  if ((onlyGlobal || !onlyRealm) && entityInfo.global && (entityInfo.global.deployments && entityInfo.global.deployments.includes(state2.getDeploymentType()) || entityInfo.global.deployments == void 0 && deploymentAllowed)) {
134997
- try {
134998
- entities.global[key] = await getConfigEntity2({
134990
+ entities.global[key] = await getResult(
134991
+ resultCallback,
134992
+ `Error getting '${key}' from resource path '${entityInfo.global.path}'`,
134993
+ getConfigEntity2,
134994
+ {
134999
134995
  state: state2,
135000
134996
  path: entityInfo.global.path,
135001
134997
  version: entityInfo.global.version,
135002
134998
  protocol: entityInfo.global.protocol,
135003
134999
  queryFilter: entityInfo.global.queryFilter ? entityInfo.global.queryFilter : entityInfo.queryFilter,
135004
135000
  action: entityInfo.global.action ? entityInfo.global.action : entityInfo.action
135005
- });
135006
- } catch (e) {
135007
- printMessage({
135008
- message: `Error getting '${key}' from resource path '${entityInfo.global.path}': ${e.message}`,
135009
- type: "error",
135010
- state: state2
135011
- });
135012
- }
135001
+ }
135002
+ );
135013
135003
  }
135014
135004
  if ((!onlyGlobal || onlyRealm) && entityInfo.realm && (entityInfo.realm.deployments && entityInfo.realm.deployments.includes(state2.getDeploymentType()) || entityInfo.realm.deployments == void 0 && deploymentAllowed)) {
135015
135005
  const activeRealm = state2.getRealm();
@@ -135017,8 +135007,11 @@ async function getConfigEntities2({
135017
135007
  if (onlyRealm && (activeRealm.startsWith("/") ? activeRealm : "/" + activeRealm) !== stateRealms[i2]) {
135018
135008
  continue;
135019
135009
  }
135020
- try {
135021
- entities.realm[realms2[i2]][key] = await getConfigEntity2({
135010
+ entities.realm[realms2[i2]][key] = await getResult(
135011
+ resultCallback,
135012
+ `Error getting '${key}' from resource path '${entityInfo.realm.path}'`,
135013
+ getConfigEntity2,
135014
+ {
135022
135015
  state: state2,
135023
135016
  path: entityInfo.realm.path,
135024
135017
  version: entityInfo.realm.version,
@@ -135026,14 +135019,8 @@ async function getConfigEntities2({
135026
135019
  realm: stateRealms[i2],
135027
135020
  queryFilter: entityInfo.realm.queryFilter ? entityInfo.realm.queryFilter : entityInfo.queryFilter,
135028
135021
  action: entityInfo.realm.action ? entityInfo.realm.action : entityInfo.action
135029
- });
135030
- } catch (e) {
135031
- printMessage({
135032
- message: `Error getting '${key}' from resource path '${entityInfo.realm.path}': ${e.message}`,
135033
- type: "error",
135034
- state: state2
135035
- });
135036
- }
135022
+ }
135023
+ );
135037
135024
  }
135038
135025
  }
135039
135026
  }
@@ -135070,15 +135057,15 @@ async function putConfigEntity2({
135070
135057
  state2.setRealm(currentRealm);
135071
135058
  return data2;
135072
135059
  } catch (error2) {
135073
- printError({
135074
- error: error2,
135075
- message: `Error putting config entity at resource path '${urlString}'`,
135076
- state: state2
135077
- });
135060
+ throw new FrodoError(
135061
+ `Error putting config entity at resource path '${urlString}'`,
135062
+ error2
135063
+ );
135078
135064
  }
135079
135065
  }
135080
135066
  async function putConfigEntities({
135081
135067
  config,
135068
+ resultCallback = void 0,
135082
135069
  state: state2
135083
135070
  }) {
135084
135071
  const realms2 = config.realm ? Object.keys(config.realm) : [];
@@ -135093,26 +135080,23 @@ async function putConfigEntities({
135093
135080
  }
135094
135081
  const deploymentAllowed = entityInfo.deployments && entityInfo.deployments.includes(state2.getDeploymentType());
135095
135082
  if (entityInfo.global && (entityInfo.global.deployments && entityInfo.global.deployments.includes(state2.getDeploymentType()) || entityInfo.global.deployments == void 0 && deploymentAllowed) && config.global && config.global[key]) {
135096
- try {
135097
- for (const [id7, entityData] of Object.entries(config.global[key])) {
135098
- if (!entities.global[key]) {
135099
- entities.global[key] = {};
135100
- }
135101
- entities.global[key][id7] = await putConfigEntity2({
135083
+ for (const [id7, entityData] of Object.entries(config.global[key])) {
135084
+ if (!entities.global[key]) {
135085
+ entities.global[key] = {};
135086
+ }
135087
+ entities.global[key][id7] = await getResult(
135088
+ resultCallback,
135089
+ `Error putting entity '${id7}' of type '${key}' to global resource path '${entityInfo.global.path}'`,
135090
+ putConfigEntity2,
135091
+ {
135102
135092
  state: state2,
135103
135093
  entityData,
135104
135094
  path: entityInfo.global.path + (entityInfo.global.importWithId ? `/${id7}` : ""),
135105
135095
  version: entityInfo.global.version,
135106
135096
  protocol: entityInfo.global.protocol,
135107
135097
  ifMatch: entityInfo.global.ifMatch
135108
- });
135109
- }
135110
- } catch (e) {
135111
- printMessage({
135112
- message: `Error putting '${key}' from resource path '${entityInfo.global.path}': ${e.message}`,
135113
- type: "error",
135114
- state: state2
135115
- });
135098
+ }
135099
+ );
135116
135100
  }
135117
135101
  }
135118
135102
  if (entityInfo.realm && (entityInfo.realm.deployments && entityInfo.realm.deployments.includes(state2.getDeploymentType()) || entityInfo.realm.deployments == void 0 && deploymentAllowed)) {
@@ -135120,14 +135104,17 @@ async function putConfigEntities({
135120
135104
  if (!config.realm[realms2[i2]][key]) {
135121
135105
  continue;
135122
135106
  }
135123
- try {
135124
- for (const [id7, entityData] of Object.entries(
135125
- config.realm[realms2[i2]][key]
135126
- )) {
135127
- if (!entities.realm[realms2[i2]][key]) {
135128
- entities.realm[realms2[i2]][key] = {};
135129
- }
135130
- entities.realm[realms2[i2]][key][id7] = await putConfigEntity2({
135107
+ for (const [id7, entityData] of Object.entries(
135108
+ config.realm[realms2[i2]][key]
135109
+ )) {
135110
+ if (!entities.realm[realms2[i2]][key]) {
135111
+ entities.realm[realms2[i2]][key] = {};
135112
+ }
135113
+ entities.realm[realms2[i2]][key][id7] = await getResult(
135114
+ resultCallback,
135115
+ `Error putting entity '${id7}' of type '${key}' to realm resource path '${entityInfo.realm.path}'`,
135116
+ putConfigEntity2,
135117
+ {
135131
135118
  state: state2,
135132
135119
  entityData,
135133
135120
  path: entityInfo.realm.path + (entityInfo.realm.importWithId ? `/${id7}` : ""),
@@ -135135,14 +135122,8 @@ async function putConfigEntities({
135135
135122
  protocol: entityInfo.realm.protocol,
135136
135123
  ifMatch: entityInfo.realm.ifMatch,
135137
135124
  realm: stateRealms[i2]
135138
- });
135139
- }
135140
- } catch (e) {
135141
- printMessage({
135142
- message: `Error putting '${key}' from resource path '${entityInfo.realm.path}': ${e.message}`,
135143
- type: "error",
135144
- state: state2
135145
- });
135125
+ }
135126
+ );
135146
135127
  }
135147
135128
  }
135148
135129
  }
@@ -135154,16 +135135,17 @@ var AmConfigOps_default = (state2) => {
135154
135135
  async createConfigEntityExportTemplate(realms2) {
135155
135136
  return createConfigEntityExportTemplate2({ realms: realms2, state: state2 });
135156
135137
  },
135157
- async exportAmConfigEntities(includeReadOnly = false, onlyRealm = false, onlyGlobal = false) {
135138
+ async exportAmConfigEntities(includeReadOnly = false, onlyRealm = false, onlyGlobal = false, resultCallback = void 0) {
135158
135139
  return exportAmConfigEntities({
135159
135140
  includeReadOnly,
135160
135141
  onlyRealm,
135161
135142
  onlyGlobal,
135143
+ resultCallback,
135162
135144
  state: state2
135163
135145
  });
135164
135146
  },
135165
- async importAmConfigEntities(importData) {
135166
- return importAmConfigEntities({ importData, state: state2 });
135147
+ async importAmConfigEntities(importData, resultCallback = void 0) {
135148
+ return importAmConfigEntities({ importData, resultCallback, state: state2 });
135167
135149
  }
135168
135150
  };
135169
135151
  };
@@ -135184,88 +135166,79 @@ async function exportAmConfigEntities({
135184
135166
  includeReadOnly = false,
135185
135167
  onlyRealm = false,
135186
135168
  onlyGlobal = false,
135169
+ resultCallback = void 0,
135187
135170
  state: state2
135188
135171
  }) {
135189
- let indicatorId;
135190
- try {
135191
- debugMessage({
135192
- message: `AmConfigOps.exportAmConfigEntities: start`,
135193
- state: state2
135194
- });
135195
- const entities = await getConfigEntities2({
135196
- includeReadOnly,
135197
- onlyRealm,
135198
- onlyGlobal,
135199
- state: state2
135200
- });
135201
- const exportData = await createConfigEntityExportTemplate2({
135202
- state: state2,
135203
- realms: Object.keys(entities.realm)
135204
- });
135205
- const totalEntities = Object.keys(entities.global).length + Object.values(entities.realm).reduce(
135206
- (total, realmEntities) => total + Object.keys(realmEntities).length,
135207
- 0
135208
- );
135209
- indicatorId = createProgressIndicator({
135210
- total: totalEntities,
135211
- message: "Exporting am config entities...",
135212
- state: state2
135213
- });
135214
- exportData.global = processConfigEntitiesForExport({
135172
+ debugMessage({
135173
+ message: `AmConfigOps.exportAmConfigEntities: start`,
135174
+ state: state2
135175
+ });
135176
+ const entities = await getConfigEntities2({
135177
+ includeReadOnly,
135178
+ onlyRealm,
135179
+ onlyGlobal,
135180
+ resultCallback: getErrorCallback(resultCallback),
135181
+ state: state2
135182
+ });
135183
+ const exportData = await createConfigEntityExportTemplate2({
135184
+ state: state2,
135185
+ realms: Object.keys(entities.realm)
135186
+ });
135187
+ const totalEntities = Object.keys(entities.global).length + Object.values(entities.realm).reduce(
135188
+ (total, realmEntities) => total + Object.keys(realmEntities).length,
135189
+ 0
135190
+ );
135191
+ const indicatorId = createProgressIndicator({
135192
+ total: totalEntities,
135193
+ message: "Exporting am config entities...",
135194
+ state: state2
135195
+ });
135196
+ exportData.global = processConfigEntitiesForExport({
135197
+ state: state2,
135198
+ indicatorId,
135199
+ entities: entities.global,
135200
+ resultCallback
135201
+ });
135202
+ Object.entries(entities.realm).forEach(
135203
+ ([key, value]) => exportData.realm[key] = processConfigEntitiesForExport({
135215
135204
  state: state2,
135216
135205
  indicatorId,
135217
- entities: entities.global
135218
- });
135219
- Object.entries(entities.realm).forEach(
135220
- ([key, value]) => exportData.realm[key] = processConfigEntitiesForExport({
135221
- state: state2,
135222
- indicatorId,
135223
- entities: value
135224
- })
135225
- );
135226
- stopProgressIndicator({
135227
- id: indicatorId,
135228
- message: `Exported ${totalEntities} am config entities.`,
135229
- state: state2
135230
- });
135231
- debugMessage({ message: `AmConfigOps.exportAmConfigEntities: end`, state: state2 });
135232
- return exportData;
135233
- } catch (error2) {
135234
- stopProgressIndicator({
135235
- id: indicatorId,
135236
- message: `Error exporting am config entities.`,
135237
- status: "fail",
135238
- state: state2
135239
- });
135240
- throw new FrodoError(`Error exporting am config entities`, error2);
135241
- }
135206
+ entities: value,
135207
+ resultCallback
135208
+ })
135209
+ );
135210
+ stopProgressIndicator({
135211
+ id: indicatorId,
135212
+ message: `Exported ${totalEntities} am config entities.`,
135213
+ state: state2
135214
+ });
135215
+ return exportData;
135242
135216
  }
135243
135217
  async function importAmConfigEntities({
135244
135218
  importData,
135219
+ resultCallback = void 0,
135245
135220
  state: state2
135246
135221
  }) {
135247
135222
  debugMessage({
135248
135223
  message: `ServiceOps.importAmConfigEntities: start`,
135249
135224
  state: state2
135250
135225
  });
135251
- try {
135252
- const result = await putConfigEntities({
135253
- config: importData,
135254
- state: state2
135255
- });
135256
- debugMessage({ message: `AmConfigOps.importAmConfigEntities: end`, state: state2 });
135257
- if (Object.keys(result.global).length === 0 && !Object.values(result.realm).find((r) => Object.keys(r).length > 0)) {
135258
- return null;
135259
- }
135260
- return result;
135261
- } catch (error2) {
135262
- throw new FrodoError(`Error importing am config entities`, error2);
135226
+ const result = await putConfigEntities({
135227
+ config: importData,
135228
+ resultCallback,
135229
+ state: state2
135230
+ });
135231
+ debugMessage({ message: `AmConfigOps.importAmConfigEntities: end`, state: state2 });
135232
+ if (Object.keys(result.global).length === 0 && !Object.values(result.realm).find((r) => Object.keys(r).length > 0)) {
135233
+ return null;
135263
135234
  }
135235
+ return result;
135264
135236
  }
135265
135237
  function processConfigEntitiesForExport({
135266
135238
  state: state2,
135267
135239
  entities,
135268
- indicatorId
135240
+ indicatorId,
135241
+ resultCallback
135269
135242
  }) {
135270
135243
  const exportedEntities = {};
135271
135244
  const entries = Object.entries(entities);
@@ -135275,25 +135248,30 @@ function processConfigEntitiesForExport({
135275
135248
  message: `Exporting ${key}`,
135276
135249
  state: state2
135277
135250
  });
135278
- const exportedValue = {};
135279
135251
  if (!value) {
135280
135252
  continue;
135281
135253
  }
135282
135254
  if (!value.result) {
135283
135255
  if (value._id) {
135284
- exportedValue[value._id] = value;
135285
- exportedEntities[key] = exportedValue;
135256
+ exportedEntities[key] = {
135257
+ [value._id]: value
135258
+ };
135286
135259
  } else if (value._type && value._type._id) {
135287
- exportedValue[value._type._id] = value;
135288
- exportedEntities[key] = exportedValue;
135260
+ exportedEntities[key] = {
135261
+ [value._type._id]: value
135262
+ };
135289
135263
  } else {
135290
135264
  exportedEntities[key] = value;
135291
135265
  }
135292
- continue;
135266
+ } else {
135267
+ const { result } = value;
135268
+ const exportedValue = {};
135269
+ result.forEach((o) => exportedValue[o._id] = o);
135270
+ exportedEntities[key] = exportedValue;
135271
+ }
135272
+ if (resultCallback) {
135273
+ resultCallback(void 0, exportedEntities[key]);
135293
135274
  }
135294
- const { result } = value;
135295
- result.forEach((o) => exportedValue[o._id] = o);
135296
- exportedEntities[key] = exportedValue;
135297
135275
  }
135298
135276
  return exportedEntities;
135299
135277
  }
@@ -136354,7 +136332,7 @@ async function createCircleOfTrust2({
136354
136332
  const response = await createCircleOfTrust({ cotData, state: state2 });
136355
136333
  return response;
136356
136334
  } catch (createError) {
136357
- if (_optionalChain([createError, 'access', _142 => _142.response, 'optionalAccess', _143 => _143.data, 'optionalAccess', _144 => _144.code]) === 500 && _optionalChain([createError, 'access', _145 => _145.response, 'optionalAccess', _146 => _146.data, 'optionalAccess', _147 => _147.message]) === "Unable to update entity provider's circle of trust") {
136335
+ if (_optionalChain([createError, 'access', _140 => _140.response, 'optionalAccess', _141 => _141.data, 'optionalAccess', _142 => _142.code]) === 500 && _optionalChain([createError, 'access', _143 => _143.response, 'optionalAccess', _144 => _144.data, 'optionalAccess', _145 => _145.message]) === "Unable to update entity provider's circle of trust") {
136358
136336
  try {
136359
136337
  const response = await updateCircleOfTrust({ cotId, cotData, state: state2 });
136360
136338
  return response;
@@ -136381,7 +136359,7 @@ async function updateCircleOfTrust2({
136381
136359
  const response = await updateCircleOfTrust({ cotId, cotData, state: state2 });
136382
136360
  return response || cotData;
136383
136361
  } catch (error2) {
136384
- if (_optionalChain([error2, 'access', _148 => _148.response, 'optionalAccess', _149 => _149.data, 'optionalAccess', _150 => _150.code]) === 500 && (_optionalChain([error2, 'access', _151 => _151.response, 'optionalAccess', _152 => _152.data, 'optionalAccess', _153 => _153.message]) === "Unable to update entity provider's circle of trust" || _optionalChain([error2, 'access', _154 => _154.response, 'optionalAccess', _155 => _155.data, 'optionalAccess', _156 => _156.message]) === "An error occurred while updating the COT memberships")) {
136362
+ if (_optionalChain([error2, 'access', _146 => _146.response, 'optionalAccess', _147 => _147.data, 'optionalAccess', _148 => _148.code]) === 500 && (_optionalChain([error2, 'access', _149 => _149.response, 'optionalAccess', _150 => _150.data, 'optionalAccess', _151 => _151.message]) === "Unable to update entity provider's circle of trust" || _optionalChain([error2, 'access', _152 => _152.response, 'optionalAccess', _153 => _153.data, 'optionalAccess', _154 => _154.message]) === "An error occurred while updating the COT memberships")) {
136385
136363
  try {
136386
136364
  const response = await updateCircleOfTrust({ cotId, cotData, state: state2 });
136387
136365
  return response || cotData;
@@ -136777,7 +136755,7 @@ ${providers.map((it) => it.split("|")[0]).join("\n")}.`,
136777
136755
  }
136778
136756
  } catch (error2) {
136779
136757
  debugMessage({
136780
- message: `Error ${_optionalChain([error2, 'access', _157 => _157.response, 'optionalAccess', _158 => _158.status])} creating/updating circle of trust: ${_optionalChain([error2, 'access', _159 => _159.response, 'optionalAccess', _160 => _160.data, 'optionalAccess', _161 => _161.message])}`,
136758
+ message: `Error ${_optionalChain([error2, 'access', _155 => _155.response, 'optionalAccess', _156 => _156.status])} creating/updating circle of trust: ${_optionalChain([error2, 'access', _157 => _157.response, 'optionalAccess', _158 => _158.data, 'optionalAccess', _159 => _159.message])}`,
136781
136759
  state: state2
136782
136760
  });
136783
136761
  errors.push(error2);
@@ -137285,11 +137263,15 @@ function createApplicationExportTemplate({
137285
137263
  };
137286
137264
  }
137287
137265
  function getRealmManagedApplication({ state: state2 }) {
137288
- let realmManagedOrg = "application";
137289
- if (state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY) {
137290
- realmManagedOrg = `${getCurrentRealmName(state2)}_application`;
137266
+ let realmManagedApp = "application";
137267
+ if (state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY || state2.getUseRealmPrefixOnManagedObjects() === true) {
137268
+ realmManagedApp = `${getCurrentRealmName(state2)}_application`;
137269
+ debugMessage({
137270
+ message: `DeploymentType === cloud or UseRealmPrefixOnManagedObjects is true, returning '${realmManagedApp}'`,
137271
+ state: state2
137272
+ });
137291
137273
  }
137292
- return realmManagedOrg;
137274
+ return realmManagedApp;
137293
137275
  }
137294
137276
  async function createApplication({
137295
137277
  applicationId,
@@ -138186,7 +138168,7 @@ async function readFeatures({
138186
138168
  const { result } = await getFeatures({ state: state2 });
138187
138169
  state2.setFeatures(JSON.parse(JSON.stringify(result)));
138188
138170
  } catch (error2) {
138189
- debugMessage({ message: _optionalChain([error2, 'access', _162 => _162.response, 'optionalAccess', _163 => _163.data]), state: state2 });
138171
+ debugMessage({ message: _optionalChain([error2, 'access', _160 => _160.response, 'optionalAccess', _161 => _161.data]), state: state2 });
138190
138172
  state2.setFeatures([]);
138191
138173
  }
138192
138174
  return state2.getFeatures();
@@ -139782,7 +139764,7 @@ async function determineDeploymentType(state2) {
139782
139764
  state: state2
139783
139765
  });
139784
139766
  } catch (e) {
139785
- if (_optionalChain([e, 'access', _164 => _164.response, 'optionalAccess', _165 => _165.status]) === 302 && _optionalChain([e, 'access', _166 => _166.response, 'access', _167 => _167.headers, 'optionalAccess', _168 => _168.location, 'optionalAccess', _169 => _169.indexOf, 'call', _170 => _170("code=")]) > -1) {
139767
+ if (_optionalChain([e, 'access', _162 => _162.response, 'optionalAccess', _163 => _163.status]) === 302 && _optionalChain([e, 'access', _164 => _164.response, 'access', _165 => _165.headers, 'optionalAccess', _166 => _166.location, 'optionalAccess', _167 => _167.indexOf, 'call', _168 => _168("code=")]) > -1) {
139786
139768
  verboseMessage({
139787
139769
  message: `ForgeRock Identity Cloud`["brightCyan"] + ` detected.`,
139788
139770
  state: state2
@@ -139798,7 +139780,7 @@ async function determineDeploymentType(state2) {
139798
139780
  state: state2
139799
139781
  });
139800
139782
  } catch (ex) {
139801
- if (_optionalChain([ex, 'access', _171 => _171.response, 'optionalAccess', _172 => _172.status]) === 302 && _optionalChain([ex, 'access', _173 => _173.response, 'access', _174 => _174.headers, 'optionalAccess', _175 => _175.location, 'optionalAccess', _176 => _176.indexOf, 'call', _177 => _177("code=")]) > -1) {
139783
+ if (_optionalChain([ex, 'access', _169 => _169.response, 'optionalAccess', _170 => _170.status]) === 302 && _optionalChain([ex, 'access', _171 => _171.response, 'access', _172 => _172.headers, 'optionalAccess', _173 => _173.location, 'optionalAccess', _174 => _174.indexOf, 'call', _175 => _175("code=")]) > -1) {
139802
139784
  adminClientId = state2.getAdminClientId() || forgeopsClientId;
139803
139785
  verboseMessage({
139804
139786
  message: `ForgeOps deployment`["brightCyan"] + ` detected.`,
@@ -139998,7 +139980,7 @@ async function getAuthCode(redirectUri, codeChallenge, codeChallengeMethod, stat
139998
139980
  throw error2;
139999
139981
  }
140000
139982
  }
140001
- const redirectLocationURL = _optionalChain([response, 'access', _178 => _178.headers, 'optionalAccess', _179 => _179.location]);
139983
+ const redirectLocationURL = _optionalChain([response, 'access', _176 => _176.headers, 'optionalAccess', _177 => _177.location]);
140002
139984
  const queryObject = _url2.default.parse(redirectLocationURL, true).query;
140003
139985
  if ("code" in queryObject) {
140004
139986
  debugMessage({
@@ -140148,7 +140130,7 @@ async function getFreshSaBearerToken({
140148
140130
  });
140149
140131
  } catch (error2) {
140150
140132
  const err = error2;
140151
- if (err.isHttpError && err.httpErrorText === "invalid_scope" && _optionalChain([err, 'access', _180 => _180.httpDescription, 'optionalAccess', _181 => _181.startsWith, 'call', _182 => _182("Unsupported scope for service account: ")])) {
140133
+ if (err.isHttpError && err.httpErrorText === "invalid_scope" && _optionalChain([err, 'access', _178 => _178.httpDescription, 'optionalAccess', _179 => _179.startsWith, 'call', _180 => _180("Unsupported scope for service account: ")])) {
140152
140134
  const invalidScopes = err.httpDescription.substring(39).split(",");
140153
140135
  const finalScopes = scope.split(" ").filter((el) => {
140154
140136
  return !invalidScopes.includes(el);
@@ -140265,9 +140247,9 @@ function scheduleAutoRefresh(forceLoginAsUser, autoRefresh, state2) {
140265
140247
  clearTimeout(timer);
140266
140248
  }
140267
140249
  if (autoRefresh) {
140268
- const expires = state2.getDeploymentType() === Constants_default.CLASSIC_DEPLOYMENT_TYPE_KEY ? _optionalChain([state2, 'access', _183 => _183.getUserSessionTokenMeta, 'call', _184 => _184(), 'optionalAccess', _185 => _185.expires]) : state2.getUseBearerTokenForAmApis() ? _optionalChain([state2, 'access', _186 => _186.getBearerTokenMeta, 'call', _187 => _187(), 'optionalAccess', _188 => _188.expires]) : Math.min(
140269
- _optionalChain([state2, 'access', _189 => _189.getBearerTokenMeta, 'call', _190 => _190(), 'optionalAccess', _191 => _191.expires]),
140270
- _optionalChain([state2, 'access', _192 => _192.getUserSessionTokenMeta, 'call', _193 => _193(), 'optionalAccess', _194 => _194.expires])
140250
+ const expires = state2.getDeploymentType() === Constants_default.CLASSIC_DEPLOYMENT_TYPE_KEY ? _optionalChain([state2, 'access', _181 => _181.getUserSessionTokenMeta, 'call', _182 => _182(), 'optionalAccess', _183 => _183.expires]) : state2.getUseBearerTokenForAmApis() ? _optionalChain([state2, 'access', _184 => _184.getBearerTokenMeta, 'call', _185 => _185(), 'optionalAccess', _186 => _186.expires]) : Math.min(
140251
+ _optionalChain([state2, 'access', _187 => _187.getBearerTokenMeta, 'call', _188 => _188(), 'optionalAccess', _189 => _189.expires]),
140252
+ _optionalChain([state2, 'access', _190 => _190.getUserSessionTokenMeta, 'call', _191 => _191(), 'optionalAccess', _192 => _192.expires])
140271
140253
  );
140272
140254
  let timeout4 = expires - Date.now() - 1e3 * 25;
140273
140255
  if (timeout4 < 1e3 * 30) {
@@ -140379,10 +140361,10 @@ async function getTokens({
140379
140361
  throw new FrodoError(`Incomplete or no credentials`);
140380
140362
  }
140381
140363
  if (state2.getCookieValue() || state2.getUseBearerTokenForAmApis() && state2.getBearerToken()) {
140382
- if (_optionalChain([state2, 'access', _195 => _195.getBearerTokenMeta, 'call', _196 => _196(), 'optionalAccess', _197 => _197.from_cache])) {
140364
+ if (_optionalChain([state2, 'access', _193 => _193.getBearerTokenMeta, 'call', _194 => _194(), 'optionalAccess', _195 => _195.from_cache])) {
140383
140365
  verboseMessage({ message: `Using cached bearer token.`, state: state2 });
140384
140366
  }
140385
- if (!state2.getUseBearerTokenForAmApis() && _optionalChain([state2, 'access', _198 => _198.getUserSessionTokenMeta, 'call', _199 => _199(), 'optionalAccess', _200 => _200.from_cache])) {
140367
+ if (!state2.getUseBearerTokenForAmApis() && _optionalChain([state2, 'access', _196 => _196.getUserSessionTokenMeta, 'call', _197 => _197(), 'optionalAccess', _198 => _198.from_cache])) {
140386
140368
  verboseMessage({ message: `Using cached session token.`, state: state2 });
140387
140369
  }
140388
140370
  scheduleAutoRefresh(forceLoginAsUser, autoRefresh, state2);
@@ -140788,7 +140770,7 @@ async function readSecretStoreMappings({
140788
140770
  });
140789
140771
  return result;
140790
140772
  } catch (error2) {
140791
- if (error2.httpStatus === 404 || _optionalChain([error2, 'access', _201 => _201.response, 'optionalAccess', _202 => _202.status]) === 404) {
140773
+ if (error2.httpStatus === 404 || _optionalChain([error2, 'access', _199 => _199.response, 'optionalAccess', _200 => _200.status]) === 404) {
140792
140774
  } else {
140793
140775
  throw new FrodoError(
140794
140776
  `Error reading secret store mappings for the secret store '${secretStoreId}'`,
@@ -141402,7 +141384,7 @@ async function importServers({
141402
141384
  state: state2
141403
141385
  });
141404
141386
  } catch (e) {
141405
- if (_optionalChain([e, 'access', _203 => _203.response, 'optionalAccess', _204 => _204.status]) !== 400 || _optionalChain([e, 'access', _205 => _205.response, 'optionalAccess', _206 => _206.data, 'optionalAccess', _207 => _207.message]) !== "Update not supported") {
141387
+ if (_optionalChain([e, 'access', _201 => _201.response, 'optionalAccess', _202 => _202.status]) !== 400 || _optionalChain([e, 'access', _203 => _203.response, 'optionalAccess', _204 => _204.data, 'optionalAccess', _205 => _205.message]) !== "Update not supported") {
141406
141388
  throw new FrodoError(
141407
141389
  `Error creating server with id '${server._id}' and URL '${server.url}'`,
141408
141390
  e
@@ -141884,7 +141866,7 @@ async function updateAdminFederationProvider({
141884
141866
  });
141885
141867
  return response;
141886
141868
  } catch (importError) {
141887
- if (_optionalChain([importError, 'access', _208 => _208.response, 'optionalAccess', _209 => _209.status]) === 400 && _optionalChain([importError, 'access', _210 => _210.response, 'optionalAccess', _211 => _211.data, 'optionalAccess', _212 => _212.message]) === "Invalid attribute specified.") {
141869
+ if (_optionalChain([importError, 'access', _206 => _206.response, 'optionalAccess', _207 => _207.status]) === 400 && _optionalChain([importError, 'access', _208 => _208.response, 'optionalAccess', _209 => _209.data, 'optionalAccess', _210 => _210.message]) === "Invalid attribute specified.") {
141888
141870
  const { validAttributes } = importError.response.data.detail;
141889
141871
  validAttributes.push("_id", "_type");
141890
141872
  for (const attribute of Object.keys(providerData)) {
@@ -145735,7 +145717,7 @@ async function checkForUpdates({
145735
145717
  state: state2
145736
145718
  });
145737
145719
  }
145738
- const updateCount = _optionalChain([updates, 'access', _213 => _213.secrets, 'optionalAccess', _214 => _214.length]) + _optionalChain([updates, 'access', _215 => _215.variables, 'optionalAccess', _216 => _216.length]) || 0;
145720
+ const updateCount = _optionalChain([updates, 'access', _211 => _211.secrets, 'optionalAccess', _212 => _212.length]) + _optionalChain([updates, 'access', _213 => _213.variables, 'optionalAccess', _214 => _214.length]) || 0;
145739
145721
  if (updateCount > 0) {
145740
145722
  stopProgressIndicator({
145741
145723
  id: indicatorId,
@@ -145828,7 +145810,7 @@ async function applyUpdates({
145828
145810
  } catch (error2) {
145829
145811
  stopProgressIndicator({
145830
145812
  id: indicatorId,
145831
- message: `Error: ${_optionalChain([error2, 'access', _217 => _217.response, 'optionalAccess', _218 => _218.data, 'optionalAccess', _219 => _219.code]) || error2} - ${_optionalChain([error2, 'access', _220 => _220.response, 'optionalAccess', _221 => _221.data, 'optionalAccess', _222 => _222.message])}`,
145813
+ message: `Error: ${_optionalChain([error2, 'access', _215 => _215.response, 'optionalAccess', _216 => _216.data, 'optionalAccess', _217 => _217.code]) || error2} - ${_optionalChain([error2, 'access', _218 => _218.response, 'optionalAccess', _219 => _219.data, 'optionalAccess', _220 => _220.message])}`,
145832
145814
  status: "fail",
145833
145815
  state: state2
145834
145816
  });
@@ -146091,7 +146073,7 @@ async function updateSocialIdentityProvider({
146091
146073
  });
146092
146074
  return response;
146093
146075
  } catch (error2) {
146094
- if (_optionalChain([error2, 'access', _223 => _223.response, 'optionalAccess', _224 => _224.status]) === 400 && _optionalChain([error2, 'access', _225 => _225.response, 'optionalAccess', _226 => _226.data, 'optionalAccess', _227 => _227.message]) === "Invalid attribute specified.") {
146076
+ if (_optionalChain([error2, 'access', _221 => _221.response, 'optionalAccess', _222 => _222.status]) === 400 && _optionalChain([error2, 'access', _223 => _223.response, 'optionalAccess', _224 => _224.data, 'optionalAccess', _225 => _225.message]) === "Invalid attribute specified.") {
146095
146077
  const { validAttributes } = error2.response.data.detail;
146096
146078
  validAttributes.push("_id", "_type");
146097
146079
  for (const attribute of Object.keys(providerData)) {
@@ -148575,8 +148557,8 @@ var JourneyOps_default = (state2) => {
148575
148557
  useStringArrays: true,
148576
148558
  deps: true,
148577
148559
  coords: true
148578
- }) {
148579
- return exportJourneys({ options, state: state2 });
148560
+ }, resultCallback = void 0) {
148561
+ return exportJourneys({ options, resultCallback, state: state2 });
148580
148562
  },
148581
148563
  async readJourneys() {
148582
148564
  return readJourneys({ state: state2 });
@@ -148602,8 +148584,13 @@ var JourneyOps_default = (state2) => {
148602
148584
  index2
148603
148585
  );
148604
148586
  },
148605
- async importJourneys(treesMap, options) {
148606
- return importJourneys({ importData: treesMap, options, state: state2 });
148587
+ async importJourneys(treesMap, options, resultCallback = void 0) {
148588
+ return importJourneys({
148589
+ importData: treesMap,
148590
+ options,
148591
+ resultCallback,
148592
+ state: state2
148593
+ });
148607
148594
  },
148608
148595
  getNodeRef(nodeObj, singleTreeExport) {
148609
148596
  return getNodeRef(nodeObj, singleTreeExport);
@@ -148636,8 +148623,8 @@ var JourneyOps_default = (state2) => {
148636
148623
  async deleteJourney(journeyId, options) {
148637
148624
  return deleteJourney({ journeyId, options, state: state2 });
148638
148625
  },
148639
- async deleteJourneys(options) {
148640
- return deleteJourneys({ options, state: state2 });
148626
+ async deleteJourneys(options, resultCallback = void 0) {
148627
+ return deleteJourneys({ options, resultCallback, state: state2 });
148641
148628
  },
148642
148629
  async enableJourney(journeyId) {
148643
148630
  return enableJourney({ journeyId, state: state2 });
@@ -148797,7 +148784,7 @@ async function getSaml2NodeDependencies(nodeObject, allProviders, allCirclesOfTr
148797
148784
  }
148798
148785
  saml2EntityPromises.push(providerResponse);
148799
148786
  } catch (error2) {
148800
- error2.message = `Error reading saml2 dependencies: ${_optionalChain([error2, 'access', _228 => _228.response, 'optionalAccess', _229 => _229.data, 'optionalAccess', _230 => _230.message]) || error2.message}`;
148787
+ error2.message = `Error reading saml2 dependencies: ${_optionalChain([error2, 'access', _226 => _226.response, 'optionalAccess', _227 => _227.data, 'optionalAccess', _228 => _228.message]) || error2.message}`;
148801
148788
  errors.push(error2);
148802
148789
  }
148803
148790
  }
@@ -148826,7 +148813,7 @@ async function getSaml2NodeDependencies(nodeObject, allProviders, allCirclesOfTr
148826
148813
  circlesOfTrust
148827
148814
  };
148828
148815
  } catch (error2) {
148829
- error2.message = `Error reading saml2 dependencies: ${_optionalChain([error2, 'access', _231 => _231.response, 'optionalAccess', _232 => _232.data, 'optionalAccess', _233 => _233.message]) || error2.message}`;
148816
+ error2.message = `Error reading saml2 dependencies: ${_optionalChain([error2, 'access', _229 => _229.response, 'optionalAccess', _230 => _230.data, 'optionalAccess', _231 => _231.message]) || error2.message}`;
148830
148817
  errors.push(error2);
148831
148818
  }
148832
148819
  if (errors.length) {
@@ -148937,7 +148924,7 @@ async function exportJourney({
148937
148924
  });
148938
148925
  emailTemplatePromises.push(emailTemplate);
148939
148926
  } catch (error2) {
148940
- error2.message = `Error reading email template ${nodeObject.emailTemplateName}: ${_optionalChain([error2, 'access', _234 => _234.response, 'optionalAccess', _235 => _235.data, 'optionalAccess', _236 => _236.message]) || error2.message}`;
148927
+ error2.message = `Error reading email template ${nodeObject.emailTemplateName}: ${_optionalChain([error2, 'access', _232 => _232.response, 'optionalAccess', _233 => _233.data, 'optionalAccess', _234 => _234.message]) || error2.message}`;
148941
148928
  errors.push(error2);
148942
148929
  }
148943
148930
  }
@@ -149239,7 +149226,7 @@ async function exportJourney({
149239
149226
  for (const themeObject of themePromiseResults) {
149240
149227
  if (themeObject && // has the theme been specified by id or name in a page node?
149241
149228
  (themes.includes(themeObject._id) || themes.includes(themeObject.name) || // has this journey been linked to a theme?
149242
- _optionalChain([themeObject, 'access', _237 => _237.linkedTrees, 'optionalAccess', _238 => _238.includes, 'call', _239 => _239(treeObject._id)]))) {
149229
+ _optionalChain([themeObject, 'access', _235 => _235.linkedTrees, 'optionalAccess', _236 => _236.includes, 'call', _237 => _237(treeObject._id)]))) {
149243
149230
  if (verbose)
149244
149231
  printMessage({
149245
149232
  message: `
@@ -149281,57 +149268,41 @@ async function exportJourneys({
149281
149268
  deps: true,
149282
149269
  coords: true
149283
149270
  },
149271
+ resultCallback = void 0,
149284
149272
  state: state2
149285
149273
  }) {
149286
- const errors = [];
149287
- let indicatorId;
149288
- try {
149289
- const trees = await readJourneys({ state: state2 });
149290
- const multiTreeExport = createMultiTreeExportTemplate({ state: state2 });
149291
- indicatorId = createProgressIndicator({
149292
- total: trees.length,
149293
- message: "Exporting journeys...",
149294
- state: state2
149295
- });
149296
- for (const tree of trees) {
149297
- try {
149298
- updateProgressIndicator({
149299
- id: indicatorId,
149300
- message: `Exporting journey ${tree._id}`,
149301
- state: state2
149302
- });
149303
- const exportData = await exportJourney({
149304
- journeyId: tree._id,
149305
- options,
149306
- state: state2
149307
- });
149308
- delete exportData.meta;
149309
- multiTreeExport.trees[tree._id] = exportData;
149310
- } catch (error2) {
149311
- errors.push(error2);
149312
- }
149313
- }
149314
- if (errors.length > 0) {
149315
- throw new FrodoError(`Error exporting journeys`, errors);
149316
- }
149317
- stopProgressIndicator({
149318
- id: indicatorId,
149319
- message: `Exported ${trees.length} journeys.`,
149320
- state: state2
149321
- });
149322
- return multiTreeExport;
149323
- } catch (error2) {
149324
- stopProgressIndicator({
149274
+ const multiTreeExport = createMultiTreeExportTemplate({ state: state2 });
149275
+ const trees = await readJourneys({ state: state2 });
149276
+ const indicatorId = createProgressIndicator({
149277
+ total: trees.length,
149278
+ message: "Exporting journeys...",
149279
+ state: state2
149280
+ });
149281
+ for (const tree of trees) {
149282
+ updateProgressIndicator({
149325
149283
  id: indicatorId,
149326
- message: `Error exporting journeys.`,
149327
- status: "fail",
149284
+ message: `Exporting journey ${tree._id}`,
149328
149285
  state: state2
149329
149286
  });
149330
- if (errors.length > 0) {
149331
- throw error2;
149332
- }
149333
- throw new FrodoError(`Error exporting journeys`, error2);
149287
+ const exportData = await getResult(
149288
+ resultCallback,
149289
+ `Error exporting the journey ${tree._id}`,
149290
+ exportJourney,
149291
+ {
149292
+ journeyId: tree._id,
149293
+ options,
149294
+ state: state2
149295
+ }
149296
+ );
149297
+ delete exportData.meta;
149298
+ multiTreeExport.trees[tree._id] = exportData;
149334
149299
  }
149300
+ stopProgressIndicator({
149301
+ id: indicatorId,
149302
+ message: `Exported ${trees.length} journeys.`,
149303
+ state: state2
149304
+ });
149305
+ return multiTreeExport;
149335
149306
  }
149336
149307
  async function readJourneys({
149337
149308
  state: state2
@@ -149522,7 +149493,7 @@ async function importJourney({
149522
149493
  state: state2
149523
149494
  });
149524
149495
  } catch (error2) {
149525
- if (_optionalChain([error2, 'access', _240 => _240.response, 'optionalAccess', _241 => _241.status]) === 500 && _optionalChain([error2, 'access', _242 => _242.response, 'optionalAccess', _243 => _243.data, 'optionalAccess', _244 => _244.message]) === "Unable to update SMS config: Data validation failed for the attribute, Redirect after form post URL") {
149496
+ if (_optionalChain([error2, 'access', _238 => _238.response, 'optionalAccess', _239 => _239.status]) === 500 && _optionalChain([error2, 'access', _240 => _240.response, 'optionalAccess', _241 => _241.data, 'optionalAccess', _242 => _242.message]) === "Unable to update SMS config: Data validation failed for the attribute, Redirect after form post URL") {
149526
149497
  providerData["redirectAfterFormPostURI"] = "";
149527
149498
  try {
149528
149499
  await putProviderByTypeAndId2({
@@ -149633,7 +149604,7 @@ async function importJourney({
149633
149604
  try {
149634
149605
  await createCircleOfTrust({ cotData, state: state2 });
149635
149606
  } catch (error2) {
149636
- if (_optionalChain([error2, 'access', _245 => _245.response, 'optionalAccess', _246 => _246.status]) === 409 || _optionalChain([error2, 'access', _247 => _247.response, 'optionalAccess', _248 => _248.status]) === 500) {
149607
+ if (_optionalChain([error2, 'access', _243 => _243.response, 'optionalAccess', _244 => _244.status]) === 409 || _optionalChain([error2, 'access', _245 => _245.response, 'optionalAccess', _246 => _246.status]) === 500) {
149637
149608
  try {
149638
149609
  await updateCircleOfTrust({ cotId, cotData, state: state2 });
149639
149610
  } catch (updateCotErr) {
@@ -149720,12 +149691,12 @@ async function importJourney({
149720
149691
  state: state2
149721
149692
  });
149722
149693
  } catch (nodeImportError) {
149723
- if (_optionalChain([nodeImportError, 'access', _249 => _249.response, 'optionalAccess', _250 => _250.status]) === 400 && _optionalChain([nodeImportError, 'access', _251 => _251.response, 'optionalAccess', _252 => _252.data, 'optionalAccess', _253 => _253.message]) === "Data validation failed for the attribute, Script") {
149694
+ if (_optionalChain([nodeImportError, 'access', _247 => _247.response, 'optionalAccess', _248 => _248.status]) === 400 && _optionalChain([nodeImportError, 'access', _249 => _249.response, 'optionalAccess', _250 => _250.data, 'optionalAccess', _251 => _251.message]) === "Data validation failed for the attribute, Script") {
149724
149695
  throw new FrodoError(
149725
149696
  `Missing script ${innerNodeData["script"]} referenced by inner node ${innerNodeId}${innerNodeId === newUuid ? "" : ` [${newUuid}]`} (${innerNodeData["_type"]["_id"]}) in journey ${treeId}`,
149726
149697
  nodeImportError
149727
149698
  );
149728
- } else if (_optionalChain([nodeImportError, 'access', _254 => _254.response, 'optionalAccess', _255 => _255.status]) === 400 && _optionalChain([nodeImportError, 'access', _256 => _256.response, 'optionalAccess', _257 => _257.data, 'optionalAccess', _258 => _258.message]) === "Invalid attribute specified.") {
149699
+ } else if (_optionalChain([nodeImportError, 'access', _252 => _252.response, 'optionalAccess', _253 => _253.status]) === 400 && _optionalChain([nodeImportError, 'access', _254 => _254.response, 'optionalAccess', _255 => _255.data, 'optionalAccess', _256 => _256.message]) === "Invalid attribute specified.") {
149729
149700
  const { validAttributes } = nodeImportError.response.data.detail;
149730
149701
  validAttributes.push("_id");
149731
149702
  for (const attribute of Object.keys(innerNodeData)) {
@@ -149754,7 +149725,7 @@ async function importJourney({
149754
149725
  nodeImportError2
149755
149726
  );
149756
149727
  }
149757
- } else if (_optionalChain([nodeImportError, 'access', _259 => _259.response, 'optionalAccess', _260 => _260.status]) === 404) {
149728
+ } else if (_optionalChain([nodeImportError, 'access', _257 => _257.response, 'optionalAccess', _258 => _258.status]) === 404) {
149758
149729
  throw new FrodoError(
149759
149730
  `Unable to import node ${innerNodeId}${innerNodeId === newUuid ? "" : ` [${newUuid}]`} in journey ${treeId} because its type ${innerNodeData._type._id} doesn't exist in deployment`,
149760
149731
  nodeImportError
@@ -149829,12 +149800,12 @@ async function importJourney({
149829
149800
  try {
149830
149801
  await putNode({ nodeId: newUuid, nodeType, nodeData, state: state2 });
149831
149802
  } catch (nodeImportError) {
149832
- if (_optionalChain([nodeImportError, 'access', _261 => _261.response, 'optionalAccess', _262 => _262.status]) === 400 && _optionalChain([nodeImportError, 'access', _263 => _263.response, 'optionalAccess', _264 => _264.data, 'optionalAccess', _265 => _265.message]) === "Data validation failed for the attribute, Script") {
149803
+ if (_optionalChain([nodeImportError, 'access', _259 => _259.response, 'optionalAccess', _260 => _260.status]) === 400 && _optionalChain([nodeImportError, 'access', _261 => _261.response, 'optionalAccess', _262 => _262.data, 'optionalAccess', _263 => _263.message]) === "Data validation failed for the attribute, Script") {
149833
149804
  throw new FrodoError(
149834
149805
  `Missing script ${nodeData["script"]} referenced by node ${nodeId}${nodeId === newUuid ? "" : ` [${newUuid}]`} (${nodeData["_type"]["_id"]}) in journey ${treeId}`,
149835
149806
  nodeImportError
149836
149807
  );
149837
- } else if (_optionalChain([nodeImportError, 'access', _266 => _266.response, 'optionalAccess', _267 => _267.status]) === 400 && _optionalChain([nodeImportError, 'access', _268 => _268.response, 'optionalAccess', _269 => _269.data, 'optionalAccess', _270 => _270.message]) === "Invalid attribute specified.") {
149808
+ } else if (_optionalChain([nodeImportError, 'access', _264 => _264.response, 'optionalAccess', _265 => _265.status]) === 400 && _optionalChain([nodeImportError, 'access', _266 => _266.response, 'optionalAccess', _267 => _267.data, 'optionalAccess', _268 => _268.message]) === "Invalid attribute specified.") {
149838
149809
  const { validAttributes } = nodeImportError.response.data.detail;
149839
149810
  validAttributes.push("_id");
149840
149811
  for (const attribute of Object.keys(nodeData)) {
@@ -149858,7 +149829,7 @@ async function importJourney({
149858
149829
  nodeImportError2
149859
149830
  );
149860
149831
  }
149861
- } else if (_optionalChain([nodeImportError, 'access', _271 => _271.response, 'optionalAccess', _272 => _272.status]) === 404) {
149832
+ } else if (_optionalChain([nodeImportError, 'access', _269 => _269.response, 'optionalAccess', _270 => _270.status]) === 404) {
149862
149833
  throw new FrodoError(
149863
149834
  `Unable to import node ${nodeId}${nodeId === newUuid ? "" : ` [${newUuid}]`} in journey ${treeId} because its type ${nodeData._type._id} doesn't exist in deployment`,
149864
149835
  nodeImportError
@@ -149922,7 +149893,7 @@ async function importJourney({
149922
149893
  state: state2
149923
149894
  });
149924
149895
  } catch (importError) {
149925
- if (_optionalChain([importError, 'access', _273 => _273.response, 'optionalAccess', _274 => _274.status]) === 400 && _optionalChain([importError, 'access', _275 => _275.response, 'optionalAccess', _276 => _276.data, 'optionalAccess', _277 => _277.message]) === "Invalid attribute specified.") {
149896
+ if (_optionalChain([importError, 'access', _271 => _271.response, 'optionalAccess', _272 => _272.status]) === 400 && _optionalChain([importError, 'access', _273 => _273.response, 'optionalAccess', _274 => _274.data, 'optionalAccess', _275 => _275.message]) === "Invalid attribute specified.") {
149926
149897
  const { validAttributes } = importError.response.data.detail;
149927
149898
  validAttributes.push("_id");
149928
149899
  for (const attribute of Object.keys(importData.tree)) {
@@ -150020,10 +149991,10 @@ async function resolveDependencies(installedJorneys, journeyMap, unresolvedJourn
150020
149991
  async function importJourneys({
150021
149992
  importData,
150022
149993
  options,
149994
+ resultCallback = void 0,
150023
149995
  state: state2
150024
149996
  }) {
150025
149997
  const response = [];
150026
- const errors = [];
150027
149998
  const installedJourneys = (await readJourneys({ state: state2 })).map((x) => x._id);
150028
149999
  const unresolvedJourneys = {};
150029
150000
  const resolvedJourneys = [];
@@ -150067,26 +150038,18 @@ async function importJourneys({
150067
150038
  state: state2
150068
150039
  });
150069
150040
  for (const tree of resolvedJourneys) {
150070
- try {
150071
- response.push(
150072
- await importJourney({
150073
- importData: importData.trees[tree],
150074
- options,
150075
- state: state2
150076
- })
150077
- );
150078
- updateProgressIndicator({ id: indicatorId, message: `${tree}`, state: state2 });
150079
- } catch (error2) {
150080
- errors.push(error2);
150081
- }
150082
- }
150083
- if (errors.length > 0) {
150084
- stopProgressIndicator({
150085
- id: indicatorId,
150086
- message: "Error importing journeys",
150087
- state: state2
150088
- });
150089
- throw new FrodoError(`Error importing journeys`, errors);
150041
+ const result = await getResult(
150042
+ resultCallback,
150043
+ `Error importing the journey ${tree._id}`,
150044
+ importJourney,
150045
+ {
150046
+ importData: importData.trees[tree],
150047
+ options,
150048
+ state: state2
150049
+ }
150050
+ );
150051
+ response.push(result);
150052
+ updateProgressIndicator({ id: indicatorId, message: `${tree}`, state: state2 });
150090
150053
  }
150091
150054
  stopProgressIndicator({
150092
150055
  id: indicatorId,
@@ -150134,7 +150097,7 @@ var fileByIdTreeExportResolver = async function(treeId, state2) {
150134
150097
  message: `fileByIdTreeExportResolver: resolved '${treeId}' to ${file}`,
150135
150098
  state: state2
150136
150099
  });
150137
- if (_optionalChain([jsonData, 'access', _278 => _278.tree, 'optionalAccess', _279 => _279._id]) === treeId) {
150100
+ if (_optionalChain([jsonData, 'access', _276 => _276.tree, 'optionalAccess', _277 => _277._id]) === treeId) {
150138
150101
  treeExport = jsonData;
150139
150102
  } else if (jsonData.trees && jsonData.trees[treeId]) {
150140
150103
  treeExport = jsonData.trees[treeId];
@@ -150153,7 +150116,7 @@ function createFileParamTreeExportResolver(file, state2) {
150153
150116
  let treeExport = createSingleTreeExportTemplate({ state: state2 });
150154
150117
  try {
150155
150118
  const jsonData = JSON.parse(fs35.default.readFileSync(file, "utf8"));
150156
- if (_optionalChain([jsonData, 'access', _280 => _280.tree, 'optionalAccess', _281 => _281._id]) === treeId) {
150119
+ if (_optionalChain([jsonData, 'access', _278 => _278.tree, 'optionalAccess', _279 => _279._id]) === treeId) {
150157
150120
  treeExport = jsonData;
150158
150121
  } else if (jsonData.trees && jsonData.trees[treeId]) {
150159
150122
  treeExport = jsonData.trees[treeId];
@@ -150378,7 +150341,7 @@ async function deleteJourney({
150378
150341
  });
150379
150342
  return response2;
150380
150343
  }).catch((error2) => {
150381
- if (_optionalChain([error2, 'optionalAccess', _282 => _282.response, 'optionalAccess', _283 => _283.data, 'optionalAccess', _284 => _284.code]) === 500 && error2.response.data.message === "Unable to read SMS config: Node did not exist") {
150344
+ if (_optionalChain([error2, 'optionalAccess', _280 => _280.response, 'optionalAccess', _281 => _281.data, 'optionalAccess', _282 => _282.code]) === 500 && error2.response.data.message === "Unable to read SMS config: Node did not exist") {
150382
150345
  status.nodes[containerNode._id] = { status: "success" };
150383
150346
  if (verbose)
150384
150347
  printMessage({
@@ -150477,19 +150440,19 @@ async function deleteJourney({
150477
150440
  }
150478
150441
  async function deleteJourneys({
150479
150442
  options,
150443
+ resultCallback = void 0,
150480
150444
  state: state2
150481
150445
  }) {
150482
- let indicatorId;
150483
- try {
150484
- const { verbose } = options;
150485
- const status = {};
150486
- const trees = (await getTrees({ state: state2 })).result;
150487
- indicatorId = createProgressIndicator({
150488
- total: trees.length,
150489
- message: "Deleting journeys...",
150490
- state: state2
150491
- });
150492
- for (const tree of trees) {
150446
+ const { verbose } = options;
150447
+ const status = {};
150448
+ const trees = (await getTrees({ state: state2 })).result;
150449
+ const indicatorId = createProgressIndicator({
150450
+ total: trees.length,
150451
+ message: "Deleting journeys...",
150452
+ state: state2
150453
+ });
150454
+ for (const tree of trees) {
150455
+ try {
150493
150456
  if (verbose) printMessage({ message: "", state: state2 });
150494
150457
  options["progress"] = false;
150495
150458
  status[tree._id] = await deleteJourney({
@@ -150506,34 +150469,35 @@ async function deleteJourneys({
150506
150469
  await new Promise((r) => {
150507
150470
  setTimeout(r, 100);
150508
150471
  });
150509
- }
150510
- let journeyCount = 0;
150511
- let journeyErrorCount = 0;
150512
- let nodeCount = 0;
150513
- let nodeErrorCount = 0;
150514
- for (const journey of Object.keys(status)) {
150515
- journeyCount += 1;
150516
- if (status[journey].status === "error") journeyErrorCount += 1;
150517
- for (const node2 of Object.keys(status[journey].nodes)) {
150518
- nodeCount += 1;
150519
- if (status[journey].nodes[node2].status === "error") nodeErrorCount += 1;
150472
+ } catch (e) {
150473
+ if (resultCallback) {
150474
+ resultCallback(e, void 0);
150475
+ } else {
150476
+ throw new FrodoError(`Error deleting the journey ${tree._id}`, e);
150520
150477
  }
150521
150478
  }
150522
- stopProgressIndicator({
150523
- id: indicatorId,
150524
- message: `Deleted ${journeyCount - journeyErrorCount}/${journeyCount} journeys and ${nodeCount - nodeErrorCount}/${nodeCount} nodes.`,
150525
- state: state2
150526
- });
150527
- return status;
150528
- } catch (error2) {
150529
- stopProgressIndicator({
150530
- id: indicatorId,
150531
- message: `Error deleting journeys`,
150532
- status: "fail",
150533
- state: state2
150534
- });
150535
- throw new FrodoError(`Error deleting journeys`, error2);
150536
150479
  }
150480
+ let journeyCount = 0;
150481
+ let journeyErrorCount = 0;
150482
+ let nodeCount = 0;
150483
+ let nodeErrorCount = 0;
150484
+ for (const journey of Object.keys(status)) {
150485
+ journeyCount += 1;
150486
+ if (status[journey].status === "error") journeyErrorCount += 1;
150487
+ for (const node2 of Object.keys(status[journey].nodes)) {
150488
+ nodeCount += 1;
150489
+ if (status[journey].nodes[node2].status === "error") nodeErrorCount += 1;
150490
+ }
150491
+ if (resultCallback) {
150492
+ resultCallback(void 0, status[journey]);
150493
+ }
150494
+ }
150495
+ stopProgressIndicator({
150496
+ id: indicatorId,
150497
+ message: `Deleted ${journeyCount - journeyErrorCount}/${journeyCount} journeys and ${nodeCount - nodeErrorCount}/${nodeCount} nodes.`,
150498
+ state: state2
150499
+ });
150500
+ return status;
150537
150501
  }
150538
150502
  async function enableJourney({
150539
150503
  journeyId,
@@ -151370,7 +151334,7 @@ async function importPolicySet({
151370
151334
  response = await createPolicySet({ policySetData, state: state2 });
151371
151335
  imported.push(id7);
151372
151336
  } catch (error2) {
151373
- if (_optionalChain([error2, 'access', _285 => _285.response, 'optionalAccess', _286 => _286.status]) === 409) {
151337
+ if (_optionalChain([error2, 'access', _283 => _283.response, 'optionalAccess', _284 => _284.status]) === 409) {
151374
151338
  response = await updatePolicySet({ policySetData, state: state2 });
151375
151339
  imported.push(id7);
151376
151340
  } else throw error2;
@@ -151429,7 +151393,7 @@ async function importFirstPolicySet({
151429
151393
  response = await createPolicySet({ policySetData, state: state2 });
151430
151394
  imported.push(id7);
151431
151395
  } catch (error2) {
151432
- if (_optionalChain([error2, 'access', _287 => _287.response, 'optionalAccess', _288 => _288.status]) === 409) {
151396
+ if (_optionalChain([error2, 'access', _285 => _285.response, 'optionalAccess', _286 => _286.status]) === 409) {
151433
151397
  response = await updatePolicySet({ policySetData, state: state2 });
151434
151398
  imported.push(id7);
151435
151399
  } else throw error2;
@@ -151483,7 +151447,7 @@ async function importPolicySets({
151483
151447
  try {
151484
151448
  response.push(await createPolicySet({ policySetData, state: state2 }));
151485
151449
  } catch (error2) {
151486
- if (_optionalChain([error2, 'access', _289 => _289.response, 'optionalAccess', _290 => _290.status]) === 409) {
151450
+ if (_optionalChain([error2, 'access', _287 => _287.response, 'optionalAccess', _288 => _288.status]) === 409) {
151487
151451
  response.push(await updatePolicySet({ policySetData, state: state2 }));
151488
151452
  } else throw error2;
151489
151453
  }
@@ -151701,7 +151665,7 @@ async function exportResourceType({
151701
151665
  debugMessage({ message: `ResourceTypeOps.exportResourceType: end`, state: state2 });
151702
151666
  return exportData;
151703
151667
  } catch (error2) {
151704
- if (_optionalChain([error2, 'access', _291 => _291.response, 'optionalAccess', _292 => _292.status]) === 404) {
151668
+ if (_optionalChain([error2, 'access', _289 => _289.response, 'optionalAccess', _290 => _290.status]) === 404) {
151705
151669
  throw new FrodoError(
151706
151670
  `Resource type ${resourceTypeUuid} does not exist`,
151707
151671
  error2
@@ -151795,7 +151759,7 @@ async function importResourceType({
151795
151759
  try {
151796
151760
  response = await createResourceType({ resourceTypeData, state: state2 });
151797
151761
  } catch (createError) {
151798
- if (_optionalChain([createError, 'access', _293 => _293.response, 'optionalAccess', _294 => _294.status]) === 409)
151762
+ if (_optionalChain([createError, 'access', _291 => _291.response, 'optionalAccess', _292 => _292.status]) === 409)
151799
151763
  response = await putResourceType({
151800
151764
  resourceTypeUuid: id7,
151801
151765
  resourceTypeData,
@@ -151838,7 +151802,7 @@ async function importResourceTypeByName({
151838
151802
  try {
151839
151803
  response = await createResourceType({ resourceTypeData, state: state2 });
151840
151804
  } catch (createError) {
151841
- if (_optionalChain([createError, 'access', _295 => _295.response, 'optionalAccess', _296 => _296.status]) === 409)
151805
+ if (_optionalChain([createError, 'access', _293 => _293.response, 'optionalAccess', _294 => _294.status]) === 409)
151842
151806
  response = await putResourceType({
151843
151807
  resourceTypeUuid: id7,
151844
151808
  resourceTypeData,
@@ -151880,7 +151844,7 @@ async function importFirstResourceType({
151880
151844
  try {
151881
151845
  response = await createResourceType({ resourceTypeData, state: state2 });
151882
151846
  } catch (createError) {
151883
- if (_optionalChain([createError, 'access', _297 => _297.response, 'optionalAccess', _298 => _298.status]) === 409)
151847
+ if (_optionalChain([createError, 'access', _295 => _295.response, 'optionalAccess', _296 => _296.status]) === 409)
151884
151848
  response = await putResourceType({
151885
151849
  resourceTypeUuid: id7,
151886
151850
  resourceTypeData,
@@ -151915,7 +151879,7 @@ async function importResourceTypes({
151915
151879
  try {
151916
151880
  response.push(await createResourceType({ resourceTypeData, state: state2 }));
151917
151881
  } catch (createError) {
151918
- if (_optionalChain([createError, 'access', _299 => _299.response, 'optionalAccess', _300 => _300.status]) === 409)
151882
+ if (_optionalChain([createError, 'access', _297 => _297.response, 'optionalAccess', _298 => _298.status]) === 409)
151919
151883
  response.push(
151920
151884
  await putResourceType({
151921
151885
  resourceTypeUuid: id7,
@@ -152900,7 +152864,7 @@ async function exportScriptTypes({
152900
152864
  state: state2
152901
152865
  });
152902
152866
  } catch (e) {
152903
- if (e.httpStatus === 404 || _optionalChain([e, 'access', _301 => _301.response, 'optionalAccess', _302 => _302.status]) === 404) {
152867
+ if (e.httpStatus === 404 || _optionalChain([e, 'access', _299 => _299.response, 'optionalAccess', _300 => _300.status]) === 404) {
152904
152868
  } else {
152905
152869
  printMessage({
152906
152870
  message: `Unable to get engine configuration for script type '${scriptType._id}': ${e.message}`,
@@ -153303,8 +153267,8 @@ async function getFullServices({
153303
153267
  nextDescendents
153304
153268
  };
153305
153269
  } catch (error2) {
153306
- if (!(_optionalChain([error2, 'access', _303 => _303.response, 'optionalAccess', _304 => _304.status]) === 403 && _optionalChain([error2, 'access', _305 => _305.response, 'optionalAccess', _306 => _306.data, 'optionalAccess', _307 => _307.message]) === "This operation is not available in PingOne Advanced Identity Cloud.")) {
153307
- const message = _optionalChain([error2, 'access', _308 => _308.response, 'optionalAccess', _309 => _309.data, 'optionalAccess', _310 => _310.message]);
153270
+ if (!(_optionalChain([error2, 'access', _301 => _301.response, 'optionalAccess', _302 => _302.status]) === 403 && _optionalChain([error2, 'access', _303 => _303.response, 'optionalAccess', _304 => _304.data, 'optionalAccess', _305 => _305.message]) === "This operation is not available in PingOne Advanced Identity Cloud.")) {
153271
+ const message = _optionalChain([error2, 'access', _306 => _306.response, 'optionalAccess', _307 => _307.data, 'optionalAccess', _308 => _308.message]);
153308
153272
  printMessage({
153309
153273
  message: `Unable to retrieve data for ${listItem._id} with error: ${message}`,
153310
153274
  type: "error",
@@ -153345,7 +153309,7 @@ async function putFullService({
153345
153309
  debugMessage({ message: `ServiceOps.putFullService: clean`, state: state2 });
153346
153310
  await deleteFullService({ serviceId, globalConfig, state: state2 });
153347
153311
  } catch (error2) {
153348
- if (!(_optionalChain([error2, 'access', _311 => _311.response, 'optionalAccess', _312 => _312.status]) === 404 && _optionalChain([error2, 'access', _313 => _313.response, 'optionalAccess', _314 => _314.data, 'optionalAccess', _315 => _315.message]) === "Not Found")) {
153312
+ if (!(_optionalChain([error2, 'access', _309 => _309.response, 'optionalAccess', _310 => _310.status]) === 404 && _optionalChain([error2, 'access', _311 => _311.response, 'optionalAccess', _312 => _312.data, 'optionalAccess', _313 => _313.message]) === "Not Found")) {
153349
153313
  throw new FrodoError(
153350
153314
  `Error deleting service '${serviceId}' before import`,
153351
153315
  error2
@@ -153522,8 +153486,8 @@ async function deleteFullServices({
153522
153486
  state: state2
153523
153487
  });
153524
153488
  } catch (error2) {
153525
- if (!(_optionalChain([error2, 'access', _316 => _316.response, 'optionalAccess', _317 => _317.status]) === 403 && _optionalChain([error2, 'access', _318 => _318.response, 'optionalAccess', _319 => _319.data, 'optionalAccess', _320 => _320.message]) === "This operation is not available in PingOne Advanced Identity Cloud.")) {
153526
- const message = _optionalChain([error2, 'access', _321 => _321.response, 'optionalAccess', _322 => _322.data, 'optionalAccess', _323 => _323.message]);
153489
+ if (!(_optionalChain([error2, 'access', _314 => _314.response, 'optionalAccess', _315 => _315.status]) === 403 && _optionalChain([error2, 'access', _316 => _316.response, 'optionalAccess', _317 => _317.data, 'optionalAccess', _318 => _318.message]) === "This operation is not available in PingOne Advanced Identity Cloud.")) {
153490
+ const message = _optionalChain([error2, 'access', _319 => _319.response, 'optionalAccess', _320 => _320.data, 'optionalAccess', _321 => _321.message]);
153527
153491
  printMessage({
153528
153492
  message: `Delete service '${serviceListItem._id}': ${message}`,
153529
153493
  state: state2,
@@ -153704,8 +153668,8 @@ var ConfigOps_default = (state2) => {
153704
153668
  includeReadOnly: false,
153705
153669
  onlyRealm: false,
153706
153670
  onlyGlobal: false
153707
- }, collectErrors) {
153708
- return exportFullConfiguration({ options, collectErrors, state: state2 });
153671
+ }, resultCallback = void 0) {
153672
+ return exportFullConfiguration({ options, resultCallback, state: state2 });
153709
153673
  },
153710
153674
  async importFullConfiguration(importData, options = {
153711
153675
  reUuidJourneys: false,
@@ -153713,11 +153677,11 @@ var ConfigOps_default = (state2) => {
153713
153677
  cleanServices: false,
153714
153678
  includeDefault: false,
153715
153679
  includeActiveValues: true
153716
- }, collectErrors) {
153680
+ }, resultCallback = void 0) {
153717
153681
  return importFullConfiguration({
153718
153682
  importData,
153719
153683
  options,
153720
- collectErrors,
153684
+ resultCallback,
153721
153685
  state: state2
153722
153686
  });
153723
153687
  }
@@ -153735,15 +153699,9 @@ async function exportFullConfiguration({
153735
153699
  onlyRealm: false,
153736
153700
  onlyGlobal: false
153737
153701
  },
153738
- collectErrors,
153702
+ resultCallback = void 0,
153739
153703
  state: state2
153740
153704
  }) {
153741
- let errors = [];
153742
- let throwErrors = true;
153743
- if (collectErrors && Array.isArray(collectErrors)) {
153744
- throwErrors = false;
153745
- errors = collectErrors;
153746
- }
153747
153705
  const {
153748
153706
  useStringArrays,
153749
153707
  noDecode,
@@ -153762,12 +153720,19 @@ async function exportFullConfiguration({
153762
153720
  const isCloudDeployment = state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY;
153763
153721
  const isForgeOpsDeployment = state2.getDeploymentType() === Constants_default.FORGEOPS_DEPLOYMENT_TYPE_KEY;
153764
153722
  const isPlatformDeployment = isCloudDeployment || isForgeOpsDeployment;
153765
- const config = await exportAmConfigEntities({
153766
- includeReadOnly,
153767
- onlyRealm,
153768
- onlyGlobal,
153769
- state: state2
153770
- });
153723
+ const errorCallback = getErrorCallback(resultCallback);
153724
+ const config = await exportWithErrorHandling(
153725
+ exportAmConfigEntities,
153726
+ {
153727
+ includeReadOnly,
153728
+ onlyRealm,
153729
+ onlyGlobal,
153730
+ errorCallback,
153731
+ state: state2
153732
+ },
153733
+ "AM Config Entities",
153734
+ resultCallback
153735
+ );
153771
153736
  let globalConfig = {};
153772
153737
  if (!onlyRealm || onlyGlobal) {
153773
153738
  const mappings = await exportWithErrorHandling(
@@ -153781,13 +153746,15 @@ async function exportFullConfiguration({
153781
153746
  },
153782
153747
  state: state2
153783
153748
  },
153784
- errors,
153749
+ "Mappings",
153750
+ resultCallback,
153785
153751
  isPlatformDeployment
153786
153752
  );
153787
153753
  const serverExport = await exportWithErrorHandling(
153788
153754
  exportServers,
153789
153755
  { options: { includeDefault: true }, state: state2 },
153790
- errors,
153756
+ "Servers",
153757
+ resultCallback,
153791
153758
  isClassicDeployment
153792
153759
  );
153793
153760
  if (serverExport) {
@@ -153797,21 +153764,24 @@ async function exportFullConfiguration({
153797
153764
  agent: await _asyncOptionalChain([(await exportWithErrorHandling(
153798
153765
  exportAgents,
153799
153766
  globalStateObj,
153800
- errors,
153767
+ "Global Agents",
153768
+ resultCallback,
153801
153769
  isClassicDeployment
153802
- )), 'optionalAccess', async _324 => _324.agent]),
153770
+ )), 'optionalAccess', async _322 => _322.agent]),
153803
153771
  authentication: await _asyncOptionalChain([(await exportWithErrorHandling(
153804
153772
  exportAuthenticationSettings,
153805
153773
  globalStateObj,
153806
- errors,
153774
+ "Global Authentication Settings",
153775
+ resultCallback,
153807
153776
  isClassicDeployment
153808
- )), 'optionalAccess', async _325 => _325.authentication]),
153777
+ )), 'optionalAccess', async _323 => _323.authentication]),
153809
153778
  emailTemplate: await _asyncOptionalChain([(await exportWithErrorHandling(
153810
153779
  exportEmailTemplates,
153811
153780
  stateObj,
153812
- errors,
153781
+ "Email Templates",
153782
+ resultCallback,
153813
153783
  isPlatformDeployment
153814
- )), 'optionalAccess', async _326 => _326.emailTemplate]),
153784
+ )), 'optionalAccess', async _324 => _324.emailTemplate]),
153815
153785
  idm: await _asyncOptionalChain([(await exportWithErrorHandling(
153816
153786
  exportConfigEntities,
153817
153787
  {
@@ -153819,60 +153789,74 @@ async function exportFullConfiguration({
153819
153789
  envReplaceParams: void 0,
153820
153790
  entitiesToExport: void 0
153821
153791
  },
153792
+ resultCallback: errorCallback,
153822
153793
  state: state2
153823
153794
  },
153824
- errors,
153795
+ "IDM Config Entities",
153796
+ resultCallback,
153825
153797
  isPlatformDeployment
153826
- )), 'optionalAccess', async _327 => _327.idm]),
153798
+ )), 'optionalAccess', async _325 => _325.idm]),
153827
153799
  internalRole: await _asyncOptionalChain([(await exportWithErrorHandling(
153828
153800
  exportInternalRoles,
153829
153801
  stateObj,
153830
- errors,
153802
+ "Internal Roles",
153803
+ resultCallback,
153831
153804
  isPlatformDeployment
153832
- )), 'optionalAccess', async _328 => _328.internalRole]),
153833
- mapping: _optionalChain([mappings, 'optionalAccess', _329 => _329.mapping]),
153805
+ )), 'optionalAccess', async _326 => _326.internalRole]),
153806
+ mapping: _optionalChain([mappings, 'optionalAccess', _327 => _327.mapping]),
153834
153807
  realm: await _asyncOptionalChain([(await exportWithErrorHandling(
153835
153808
  exportRealms,
153836
153809
  stateObj,
153837
- errors,
153810
+ "Realms",
153811
+ resultCallback,
153838
153812
  includeReadOnly || isClassicDeployment
153839
- )), 'optionalAccess', async _330 => _330.realm]),
153813
+ )), 'optionalAccess', async _328 => _328.realm]),
153840
153814
  scripttype: await _asyncOptionalChain([(await exportWithErrorHandling(
153841
153815
  exportScriptTypes,
153842
153816
  stateObj,
153843
- errors,
153817
+ "Script Types",
153818
+ resultCallback,
153844
153819
  includeReadOnly || isClassicDeployment
153845
- )), 'optionalAccess', async _331 => _331.scripttype]),
153820
+ )), 'optionalAccess', async _329 => _329.scripttype]),
153846
153821
  secret: await _asyncOptionalChain([(await exportWithErrorHandling(
153847
153822
  exportSecrets,
153848
153823
  { options: { includeActiveValues, target }, state: state2 },
153849
- errors,
153824
+ "ESV Secrets",
153825
+ resultCallback,
153850
153826
  isCloudDeployment
153851
- )), 'optionalAccess', async _332 => _332.secret]),
153827
+ )), 'optionalAccess', async _330 => _330.secret]),
153852
153828
  secretstore: await _asyncOptionalChain([(await exportWithErrorHandling(
153853
153829
  exportSecretStores,
153854
153830
  globalStateObj,
153855
- errors,
153831
+ "Global Secret Stores",
153832
+ resultCallback,
153856
153833
  isClassicDeployment
153857
- )), 'optionalAccess', async _333 => _333.secretstore]),
153834
+ )), 'optionalAccess', async _331 => _331.secretstore]),
153858
153835
  server: serverExport,
153859
- service: await _asyncOptionalChain([(await exportWithErrorHandling(exportServices, globalStateObj, errors)), 'optionalAccess', async _334 => _334.service]),
153836
+ service: await _asyncOptionalChain([(await exportWithErrorHandling(
153837
+ exportServices,
153838
+ globalStateObj,
153839
+ "Services",
153840
+ resultCallback
153841
+ )), 'optionalAccess', async _332 => _332.service]),
153860
153842
  site: await _asyncOptionalChain([(await exportWithErrorHandling(
153861
153843
  exportSites,
153862
153844
  stateObj,
153863
- errors,
153845
+ "Sites",
153846
+ resultCallback,
153864
153847
  isClassicDeployment
153865
- )), 'optionalAccess', async _335 => _335.site]),
153866
- sync: _optionalChain([mappings, 'optionalAccess', _336 => _336.sync]),
153848
+ )), 'optionalAccess', async _333 => _333.site]),
153849
+ sync: _optionalChain([mappings, 'optionalAccess', _334 => _334.sync]),
153867
153850
  variable: await _asyncOptionalChain([(await exportWithErrorHandling(
153868
153851
  exportVariables,
153869
153852
  {
153870
153853
  noDecode,
153871
153854
  state: state2
153872
153855
  },
153873
- errors,
153856
+ "ESV Variables",
153857
+ resultCallback,
153874
153858
  isCloudDeployment
153875
- )), 'optionalAccess', async _337 => _337.variable]),
153859
+ )), 'optionalAccess', async _335 => _335.variable]),
153876
153860
  ...config.global
153877
153861
  };
153878
153862
  if (globalConfig.idm) {
@@ -153893,73 +153877,98 @@ async function exportFullConfiguration({
153893
153877
  let saml = await _asyncOptionalChain([(await exportWithErrorHandling(
153894
153878
  exportSaml2Providers,
153895
153879
  stateObj,
153896
- errors
153897
- )), 'optionalAccess', async _338 => _338.saml]);
153880
+ "SAML2 Providers",
153881
+ resultCallback
153882
+ )), 'optionalAccess', async _336 => _336.saml]);
153898
153883
  const cotExport = await exportWithErrorHandling(
153899
153884
  exportCirclesOfTrust,
153900
153885
  stateObj,
153901
- errors
153886
+ "Circle of Trusts",
153887
+ resultCallback
153902
153888
  );
153903
153889
  if (saml) {
153904
- saml.cot = _optionalChain([cotExport, 'optionalAccess', _339 => _339.saml, 'access', _340 => _340.cot]);
153890
+ saml.cot = _optionalChain([cotExport, 'optionalAccess', _337 => _337.saml, 'access', _338 => _338.cot]);
153905
153891
  } else {
153906
- saml = _optionalChain([cotExport, 'optionalAccess', _341 => _341.saml]);
153892
+ saml = _optionalChain([cotExport, 'optionalAccess', _339 => _339.saml]);
153907
153893
  }
153908
153894
  realmConfig[realm2] = {
153909
- agentGroup: await _asyncOptionalChain([(await exportWithErrorHandling(exportAgentGroups, stateObj, errors)), 'optionalAccess', async _342 => _342.agentGroup]),
153910
- agent: await _asyncOptionalChain([(await exportWithErrorHandling(exportAgents, realmStateObj, errors)), 'optionalAccess', async _343 => _343.agent]),
153895
+ agentGroup: await _asyncOptionalChain([(await exportWithErrorHandling(
153896
+ exportAgentGroups,
153897
+ stateObj,
153898
+ "Agent Groups",
153899
+ resultCallback
153900
+ )), 'optionalAccess', async _340 => _340.agentGroup]),
153901
+ agent: await _asyncOptionalChain([(await exportWithErrorHandling(
153902
+ exportAgents,
153903
+ realmStateObj,
153904
+ "Agents",
153905
+ resultCallback
153906
+ )), 'optionalAccess', async _341 => _341.agent]),
153911
153907
  application: await _asyncOptionalChain([(await exportWithErrorHandling(
153912
153908
  exportOAuth2Clients,
153913
153909
  {
153914
153910
  options: { deps: false, useStringArrays },
153915
153911
  state: state2
153916
153912
  },
153917
- errors
153918
- )), 'optionalAccess', async _344 => _344.application]),
153913
+ "OAuth2 Client Applications",
153914
+ resultCallback
153915
+ )), 'optionalAccess', async _342 => _342.application]),
153919
153916
  authentication: await _asyncOptionalChain([(await exportWithErrorHandling(
153920
153917
  exportAuthenticationSettings,
153921
153918
  realmStateObj,
153922
- errors
153923
- )), 'optionalAccess', async _345 => _345.authentication]),
153919
+ "Authentication Settings",
153920
+ resultCallback
153921
+ )), 'optionalAccess', async _343 => _343.authentication]),
153924
153922
  idp: await _asyncOptionalChain([(await exportWithErrorHandling(
153925
153923
  exportSocialIdentityProviders,
153926
153924
  stateObj,
153927
- errors
153928
- )), 'optionalAccess', async _346 => _346.idp]),
153925
+ "Social Identity Providers",
153926
+ resultCallback
153927
+ )), 'optionalAccess', async _344 => _344.idp]),
153929
153928
  trees: await _asyncOptionalChain([(await exportWithErrorHandling(
153930
153929
  exportJourneys,
153931
153930
  {
153932
153931
  options: { deps: false, useStringArrays, coords },
153932
+ resultCallback: errorCallback,
153933
153933
  state: state2
153934
153934
  },
153935
- errors
153936
- )), 'optionalAccess', async _347 => _347.trees]),
153935
+ "Journeys",
153936
+ resultCallback
153937
+ )), 'optionalAccess', async _345 => _345.trees]),
153937
153938
  managedApplication: await _asyncOptionalChain([(await exportWithErrorHandling(
153938
153939
  exportApplications,
153939
153940
  {
153940
153941
  options: { deps: false, useStringArrays },
153941
153942
  state: state2
153942
153943
  },
153943
- errors,
153944
+ "Applications",
153945
+ resultCallback,
153944
153946
  isPlatformDeployment
153945
- )), 'optionalAccess', async _348 => _348.managedApplication]),
153947
+ )), 'optionalAccess', async _346 => _346.managedApplication]),
153946
153948
  policy: await _asyncOptionalChain([(await exportWithErrorHandling(
153947
153949
  exportPolicies,
153948
153950
  {
153949
153951
  options: { deps: false, prereqs: false, useStringArrays },
153950
153952
  state: state2
153951
153953
  },
153952
- errors
153953
- )), 'optionalAccess', async _349 => _349.policy]),
153954
+ "Policies",
153955
+ resultCallback
153956
+ )), 'optionalAccess', async _347 => _347.policy]),
153954
153957
  policyset: await _asyncOptionalChain([(await exportWithErrorHandling(
153955
153958
  exportPolicySets,
153956
153959
  {
153957
153960
  options: { deps: false, prereqs: false, useStringArrays },
153958
153961
  state: state2
153959
153962
  },
153960
- errors
153961
- )), 'optionalAccess', async _350 => _350.policyset]),
153962
- resourcetype: await _asyncOptionalChain([(await exportWithErrorHandling(exportResourceTypes, stateObj, errors)), 'optionalAccess', async _351 => _351.resourcetype]),
153963
+ "Policy Sets",
153964
+ resultCallback
153965
+ )), 'optionalAccess', async _348 => _348.policyset]),
153966
+ resourcetype: await _asyncOptionalChain([(await exportWithErrorHandling(
153967
+ exportResourceTypes,
153968
+ stateObj,
153969
+ "Resource Types",
153970
+ resultCallback
153971
+ )), 'optionalAccess', async _349 => _349.resourcetype]),
153963
153972
  saml,
153964
153973
  script: await _asyncOptionalChain([(await exportWithErrorHandling(
153965
153974
  exportScripts,
@@ -153969,33 +153978,43 @@ async function exportFullConfiguration({
153969
153978
  includeDefault,
153970
153979
  useStringArrays
153971
153980
  },
153981
+ resultCallback: errorCallback,
153972
153982
  state: state2
153973
153983
  },
153974
- errors
153975
- )), 'optionalAccess', async _352 => _352.script]),
153984
+ "Scripts",
153985
+ resultCallback
153986
+ )), 'optionalAccess', async _350 => _350.script]),
153976
153987
  secretstore: await _asyncOptionalChain([(await exportWithErrorHandling(
153977
153988
  exportSecretStores,
153978
153989
  realmStateObj,
153979
- errors,
153990
+ "Secret Stores",
153991
+ resultCallback,
153980
153992
  isClassicDeployment
153981
- )), 'optionalAccess', async _353 => _353.secretstore]),
153982
- service: await _asyncOptionalChain([(await exportWithErrorHandling(exportServices, realmStateObj, errors)), 'optionalAccess', async _354 => _354.service]),
153993
+ )), 'optionalAccess', async _351 => _351.secretstore]),
153994
+ service: await _asyncOptionalChain([(await exportWithErrorHandling(
153995
+ exportServices,
153996
+ realmStateObj,
153997
+ "Services",
153998
+ resultCallback
153999
+ )), 'optionalAccess', async _352 => _352.service]),
153983
154000
  theme: await _asyncOptionalChain([(await exportWithErrorHandling(
153984
154001
  exportThemes,
153985
154002
  {
153986
154003
  state: state2
153987
154004
  },
153988
- errors,
154005
+ "Themes",
154006
+ resultCallback,
153989
154007
  isPlatformDeployment
153990
- )), 'optionalAccess', async _355 => _355.theme]),
154008
+ )), 'optionalAccess', async _353 => _353.theme]),
153991
154009
  trustedJwtIssuer: await _asyncOptionalChain([(await exportWithErrorHandling(
153992
154010
  exportOAuth2TrustedJwtIssuers,
153993
154011
  {
153994
154012
  options: { deps: false, useStringArrays },
153995
154013
  state: state2
153996
154014
  },
153997
- errors
153998
- )), 'optionalAccess', async _356 => _356.trustedJwtIssuer]),
154015
+ "Trusted JWT Issuers",
154016
+ resultCallback
154017
+ )), 'optionalAccess', async _354 => _354.trustedJwtIssuer]),
153999
154018
  ...config.realm[realm2]
154000
154019
  };
154001
154020
  if (realmConfig[realm2].service && realmConfig[realm2].service["SocialIdentityProviders"]) {
@@ -154004,14 +154023,12 @@ async function exportFullConfiguration({
154004
154023
  }
154005
154024
  state2.setRealm(activeRealm);
154006
154025
  }
154007
- if (throwErrors && errors.length > 0) {
154008
- throw new FrodoError(`Error exporting full config`, errors);
154009
- }
154010
- return {
154026
+ const fullConfig = {
154011
154027
  meta: getMetadata(stateObj),
154012
154028
  global: globalConfig,
154013
154029
  realm: realmConfig
154014
154030
  };
154031
+ return fullConfig;
154015
154032
  }
154016
154033
  async function importFullConfiguration({
154017
154034
  importData,
@@ -154023,16 +154040,10 @@ async function importFullConfiguration({
154023
154040
  includeActiveValues: true,
154024
154041
  source: ""
154025
154042
  },
154026
- collectErrors,
154043
+ resultCallback = void 0,
154027
154044
  state: state2
154028
154045
  }) {
154029
- const response = [];
154030
- let errors = [];
154031
- let throwErrors = true;
154032
- if (collectErrors && Array.isArray(collectErrors)) {
154033
- throwErrors = false;
154034
- errors = collectErrors;
154035
- }
154046
+ let response = [];
154036
154047
  const isClassicDeployment = state2.getDeploymentType() === Constants_default.CLASSIC_DEPLOYMENT_TYPE_KEY;
154037
154048
  const isCloudDeployment = state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY;
154038
154049
  const isForgeOpsDeployment = state2.getDeploymentType() === Constants_default.FORGEOPS_DEPLOYMENT_TYPE_KEY;
@@ -154045,6 +154056,7 @@ async function importFullConfiguration({
154045
154056
  includeActiveValues,
154046
154057
  source
154047
154058
  } = options;
154059
+ const errorCallback = getErrorCallback(resultCallback);
154048
154060
  let indicatorId = createProgressIndicator({
154049
154061
  total: 14,
154050
154062
  message: `Importing everything for global...`,
@@ -154062,9 +154074,9 @@ async function importFullConfiguration({
154062
154074
  },
154063
154075
  state: state2
154064
154076
  },
154065
- errors,
154066
154077
  indicatorId,
154067
154078
  "Servers",
154079
+ resultCallback,
154068
154080
  isClassicDeployment && !!importData.global.server
154069
154081
  )
154070
154082
  );
@@ -154077,9 +154089,9 @@ async function importFullConfiguration({
154077
154089
  importData: importData.global,
154078
154090
  state: state2
154079
154091
  },
154080
- errors,
154081
154092
  indicatorId,
154082
154093
  "Sites",
154094
+ resultCallback,
154083
154095
  isClassicDeployment && !!importData.global.site
154084
154096
  )
154085
154097
  );
@@ -154092,9 +154104,9 @@ async function importFullConfiguration({
154092
154104
  importData: importData.global,
154093
154105
  state: state2
154094
154106
  },
154095
- errors,
154096
154107
  indicatorId,
154097
154108
  "Realms",
154109
+ resultCallback,
154098
154110
  isClassicDeployment && !!importData.global.realm
154099
154111
  )
154100
154112
  );
@@ -154106,9 +154118,9 @@ async function importFullConfiguration({
154106
154118
  importData: importData.global,
154107
154119
  state: state2
154108
154120
  },
154109
- errors,
154110
154121
  indicatorId,
154111
154122
  "Script Types",
154123
+ resultCallback,
154112
154124
  isClassicDeployment && !!importData.global.scripttype
154113
154125
  )
154114
154126
  );
@@ -154121,9 +154133,9 @@ async function importFullConfiguration({
154121
154133
  secretStoreId: "",
154122
154134
  state: state2
154123
154135
  },
154124
- errors,
154125
154136
  indicatorId,
154126
154137
  "Secret Stores",
154138
+ resultCallback,
154127
154139
  isClassicDeployment && !!importData.global.secretstore
154128
154140
  )
154129
154141
  );
@@ -154138,9 +154150,9 @@ async function importFullConfiguration({
154138
154150
  },
154139
154151
  state: state2
154140
154152
  },
154141
- errors,
154142
154153
  indicatorId,
154143
154154
  "Secrets",
154155
+ resultCallback,
154144
154156
  isCloudDeployment && !!importData.global.secret
154145
154157
  )
154146
154158
  );
@@ -154151,9 +154163,9 @@ async function importFullConfiguration({
154151
154163
  importData: importData.global,
154152
154164
  state: state2
154153
154165
  },
154154
- errors,
154155
154166
  indicatorId,
154156
154167
  "Variables",
154168
+ resultCallback,
154157
154169
  isCloudDeployment && !!importData.global.variable
154158
154170
  )
154159
154171
  );
@@ -154167,11 +154179,12 @@ async function importFullConfiguration({
154167
154179
  entitiesToImport: void 0,
154168
154180
  validate: false
154169
154181
  },
154182
+ resultCallback: errorCallback,
154170
154183
  state: state2
154171
154184
  },
154172
- errors,
154173
154185
  indicatorId,
154174
154186
  "IDM Config Entities",
154187
+ resultCallback,
154175
154188
  isPlatformDeployment && !!importData.global.idm
154176
154189
  )
154177
154190
  );
@@ -154182,9 +154195,9 @@ async function importFullConfiguration({
154182
154195
  importData: importData.global,
154183
154196
  state: state2
154184
154197
  },
154185
- errors,
154186
154198
  indicatorId,
154187
154199
  "Email Templates",
154200
+ resultCallback,
154188
154201
  isPlatformDeployment && !!importData.global.emailTemplate
154189
154202
  )
154190
154203
  );
@@ -154196,9 +154209,9 @@ async function importFullConfiguration({
154196
154209
  options: { deps: false },
154197
154210
  state: state2
154198
154211
  },
154199
- errors,
154200
154212
  indicatorId,
154201
154213
  "Mappings",
154214
+ resultCallback,
154202
154215
  isPlatformDeployment
154203
154216
  )
154204
154217
  );
@@ -154210,9 +154223,9 @@ async function importFullConfiguration({
154210
154223
  options: { clean: cleanServices, global: true, realm: false },
154211
154224
  state: state2
154212
154225
  },
154213
- errors,
154214
154226
  indicatorId,
154215
154227
  "Services",
154228
+ resultCallback,
154216
154229
  !!importData.global.service
154217
154230
  )
154218
154231
  );
@@ -154220,9 +154233,9 @@ async function importFullConfiguration({
154220
154233
  await importWithErrorHandling(
154221
154234
  importAgents,
154222
154235
  { importData: importData.global, globalConfig: true, state: state2 },
154223
- errors,
154224
154236
  indicatorId,
154225
154237
  "Agents",
154238
+ resultCallback,
154226
154239
  isClassicDeployment && !!importData.global.agent
154227
154240
  )
154228
154241
  );
@@ -154234,9 +154247,9 @@ async function importFullConfiguration({
154234
154247
  globalConfig: true,
154235
154248
  state: state2
154236
154249
  },
154237
- errors,
154238
154250
  indicatorId,
154239
154251
  "Authentication Settings",
154252
+ resultCallback,
154240
154253
  isClassicDeployment && !!importData.global.authentication
154241
154254
  )
154242
154255
  );
@@ -154247,9 +154260,9 @@ async function importFullConfiguration({
154247
154260
  importData: importData.global,
154248
154261
  state: state2
154249
154262
  },
154250
- errors,
154251
154263
  indicatorId,
154252
154264
  "Internal Roles",
154265
+ resultCallback,
154253
154266
  isPlatformDeployment && !!importData.global.internalRole
154254
154267
  )
154255
154268
  );
@@ -154279,11 +154292,12 @@ async function importFullConfiguration({
154279
154292
  includeDefault
154280
154293
  },
154281
154294
  validate: false,
154295
+ resultCallback: errorCallback,
154282
154296
  state: state2
154283
154297
  },
154284
- errors,
154285
154298
  indicatorId,
154286
154299
  "Scripts",
154300
+ resultCallback,
154287
154301
  !!importData.realm[realm2].script
154288
154302
  )
154289
154303
  );
@@ -154294,9 +154308,9 @@ async function importFullConfiguration({
154294
154308
  importData: importData.realm[realm2],
154295
154309
  state: state2
154296
154310
  },
154297
- errors,
154298
154311
  indicatorId,
154299
154312
  "Themes",
154313
+ resultCallback,
154300
154314
  isPlatformDeployment && !!importData.realm[realm2].theme
154301
154315
  )
154302
154316
  );
@@ -154309,9 +154323,9 @@ async function importFullConfiguration({
154309
154323
  secretStoreId: "",
154310
154324
  state: state2
154311
154325
  },
154312
- errors,
154313
154326
  indicatorId,
154314
154327
  "Secret Stores",
154328
+ resultCallback,
154315
154329
  isClassicDeployment && !!importData.realm[realm2].secretstore
154316
154330
  )
154317
154331
  );
@@ -154319,9 +154333,9 @@ async function importFullConfiguration({
154319
154333
  await importWithErrorHandling(
154320
154334
  importAgentGroups,
154321
154335
  { importData: importData.realm[realm2], state: state2 },
154322
- errors,
154323
154336
  indicatorId,
154324
154337
  "Agent Groups",
154338
+ resultCallback,
154325
154339
  !!importData.realm[realm2].agentGroup
154326
154340
  )
154327
154341
  );
@@ -154329,9 +154343,9 @@ async function importFullConfiguration({
154329
154343
  await importWithErrorHandling(
154330
154344
  importAgents,
154331
154345
  { importData: importData.realm[realm2], globalConfig: false, state: state2 },
154332
- errors,
154333
154346
  indicatorId,
154334
154347
  "Agents",
154348
+ resultCallback,
154335
154349
  !!importData.realm[realm2].agent
154336
154350
  )
154337
154351
  );
@@ -154342,9 +154356,9 @@ async function importFullConfiguration({
154342
154356
  importData: importData.realm[realm2],
154343
154357
  state: state2
154344
154358
  },
154345
- errors,
154346
154359
  indicatorId,
154347
154360
  "Resource Types",
154361
+ resultCallback,
154348
154362
  !!importData.realm[realm2].resourcetype
154349
154363
  )
154350
154364
  );
@@ -154355,9 +154369,9 @@ async function importFullConfiguration({
154355
154369
  importData: importData.realm[realm2],
154356
154370
  state: state2
154357
154371
  },
154358
- errors,
154359
154372
  indicatorId,
154360
154373
  "Circles of Trust",
154374
+ resultCallback,
154361
154375
  !!importData.realm[realm2].saml && !!importData.realm[realm2].saml.cot
154362
154376
  )
154363
154377
  );
@@ -154369,9 +154383,9 @@ async function importFullConfiguration({
154369
154383
  options: { deps: false },
154370
154384
  state: state2
154371
154385
  },
154372
- errors,
154373
154386
  indicatorId,
154374
154387
  "Saml2 Providers",
154388
+ resultCallback,
154375
154389
  !!importData.realm[realm2].saml
154376
154390
  )
154377
154391
  );
@@ -154383,9 +154397,9 @@ async function importFullConfiguration({
154383
154397
  options: { deps: false },
154384
154398
  state: state2
154385
154399
  },
154386
- errors,
154387
154400
  indicatorId,
154388
154401
  "Social Identity Providers",
154402
+ resultCallback,
154389
154403
  !!importData.realm[realm2].idp
154390
154404
  )
154391
154405
  );
@@ -154397,9 +154411,9 @@ async function importFullConfiguration({
154397
154411
  options: { deps: false },
154398
154412
  state: state2
154399
154413
  },
154400
- errors,
154401
154414
  indicatorId,
154402
154415
  "OAuth2 Clients",
154416
+ resultCallback,
154403
154417
  !!importData.realm[realm2].application
154404
154418
  )
154405
154419
  );
@@ -154410,9 +154424,9 @@ async function importFullConfiguration({
154410
154424
  importData: importData.realm[realm2],
154411
154425
  state: state2
154412
154426
  },
154413
- errors,
154414
154427
  indicatorId,
154415
154428
  "Trusted JWT Issuers",
154429
+ resultCallback,
154416
154430
  !!importData.realm[realm2].trustedJwtIssuer
154417
154431
  )
154418
154432
  );
@@ -154424,9 +154438,9 @@ async function importFullConfiguration({
154424
154438
  options: { deps: false },
154425
154439
  state: state2
154426
154440
  },
154427
- errors,
154428
154441
  indicatorId,
154429
154442
  "Applications",
154443
+ resultCallback,
154430
154444
  isPlatformDeployment && !!importData.realm[realm2].managedApplication
154431
154445
  )
154432
154446
  );
@@ -154438,9 +154452,9 @@ async function importFullConfiguration({
154438
154452
  options: { deps: false, prereqs: false },
154439
154453
  state: state2
154440
154454
  },
154441
- errors,
154442
154455
  indicatorId,
154443
154456
  "Policy Sets",
154457
+ resultCallback,
154444
154458
  !!importData.realm[realm2].policyset
154445
154459
  )
154446
154460
  );
@@ -154452,9 +154466,9 @@ async function importFullConfiguration({
154452
154466
  options: { deps: false, prereqs: false },
154453
154467
  state: state2
154454
154468
  },
154455
- errors,
154456
154469
  indicatorId,
154457
154470
  "Policies",
154471
+ resultCallback,
154458
154472
  !!importData.realm[realm2].policy
154459
154473
  )
154460
154474
  );
@@ -154464,11 +154478,12 @@ async function importFullConfiguration({
154464
154478
  {
154465
154479
  importData: importData.realm[realm2],
154466
154480
  options: { deps: false, reUuid: reUuidJourneys },
154481
+ resultCallback: errorCallback,
154467
154482
  state: state2
154468
154483
  },
154469
- errors,
154470
154484
  indicatorId,
154471
154485
  "Journeys",
154486
+ resultCallback,
154472
154487
  !!importData.realm[realm2].trees
154473
154488
  )
154474
154489
  );
@@ -154480,9 +154495,9 @@ async function importFullConfiguration({
154480
154495
  options: { clean: cleanServices, global: false, realm: true },
154481
154496
  state: state2
154482
154497
  },
154483
- errors,
154484
154498
  indicatorId,
154485
154499
  "Services",
154500
+ resultCallback,
154486
154501
  !!importData.realm[realm2].service
154487
154502
  )
154488
154503
  );
@@ -154494,9 +154509,9 @@ async function importFullConfiguration({
154494
154509
  globalConfig: false,
154495
154510
  state: state2
154496
154511
  },
154497
- errors,
154498
154512
  indicatorId,
154499
154513
  "Authentication Settings",
154514
+ resultCallback,
154500
154515
  !!importData.realm[realm2].authentication
154501
154516
  )
154502
154517
  );
@@ -154518,25 +154533,24 @@ async function importFullConfiguration({
154518
154533
  importAmConfigEntities,
154519
154534
  {
154520
154535
  importData,
154536
+ resultCallback: errorCallback,
154521
154537
  state: state2
154522
154538
  },
154523
- errors,
154524
154539
  indicatorId,
154525
- "Other AM Config Entities"
154540
+ "Other AM Config Entities",
154541
+ resultCallback
154526
154542
  )
154527
154543
  );
154544
+ response = response.filter(
154545
+ (o) => o && (!Array.isArray(o) || o.length > 0) && (!o.server || Object.keys(o.server).length > 0)
154546
+ );
154528
154547
  stopProgressIndicator({
154529
154548
  id: indicatorId,
154530
154549
  message: `Finished Importing all other AM config entities!`,
154531
154550
  status: "success",
154532
154551
  state: state2
154533
154552
  });
154534
- if (throwErrors && errors.length > 0) {
154535
- throw new FrodoError(`Error importing full config`, errors);
154536
- }
154537
- return response.filter(
154538
- (o) => o && (!Array.isArray(o) || o.length > 0) && (!o.server || Object.keys(o.server).length > 0)
154539
- );
154553
+ return response;
154540
154554
  }
154541
154555
  var envInfoURLTemplate2 = "%s/environment/info";
154542
154556
  var apiVersion39 = "protocol=1.0,resource=1.0";
@@ -154872,7 +154886,7 @@ async function getUserConfig({
154872
154886
  current = current[part];
154873
154887
  }
154874
154888
  } catch (e) {
154875
- if (e.httpStatus === 404 || _optionalChain([e, 'access', _357 => _357.response, 'optionalAccess', _358 => _358.status]) === 404) {
154889
+ if (e.httpStatus === 404 || _optionalChain([e, 'access', _355 => _355.response, 'optionalAccess', _356 => _356.status]) === 404) {
154876
154890
  } else {
154877
154891
  printMessage({
154878
154892
  message: `Error exporting config for user with id '${userId}' from url '${urlString}': ${e.message}`,
@@ -155531,7 +155545,7 @@ function v43(options, buf, offset) {
155531
155545
  return native_default3.randomUUID();
155532
155546
  }
155533
155547
  options = options || {};
155534
- const rnds = _nullishCoalesce(_nullishCoalesce(options.random, () => ( _optionalChain([options, 'access', _359 => _359.rng, 'optionalCall', _360 => _360()]))), () => ( rng3()));
155548
+ const rnds = _nullishCoalesce(_nullishCoalesce(options.random, () => ( _optionalChain([options, 'access', _357 => _357.rng, 'optionalCall', _358 => _358()]))), () => ( rng3()));
155535
155549
  if (rnds.length < 16) {
155536
155550
  throw new Error("Random bytes length must be >= 16");
155537
155551
  }
@@ -156937,6 +156951,11 @@ _chunkHEKQUNOBcjs.init_cjs_shims.call(void 0, );
156937
156951
  function cloneDeep2(obj) {
156938
156952
  return JSON.parse(JSON.stringify(obj));
156939
156953
  }
156954
+ function errorHandler(error2) {
156955
+ if (!error2) return;
156956
+ printError2(error2);
156957
+ process.exitCode = 1;
156958
+ }
156940
156959
 
156941
156960
  // src/ops/AdminOps.ts
156942
156961
  var {
@@ -157825,7 +157844,7 @@ In AM, create a trusted issuer in the ${state.getRealm()} realm with the followi
157825
157844
  ]);
157826
157845
  issuer.push([
157827
157846
  "Allowed Subjects "["brightCyan"],
157828
- _optionalChain([artefacts, 'access', _361 => _361.issuer, 'access', _362 => _362.allowedSubjects, 'optionalAccess', _363 => _363.value, 'access', _364 => _364.length]) ? _optionalChain([artefacts, 'access', _365 => _365.issuer, 'access', _366 => _366.allowedSubjects, 'optionalAccess', _367 => _367.value, 'access', _368 => _368.join, 'call', _369 => _369(", ")]) : `Any ${state.getRealm()} realm user`
157847
+ _optionalChain([artefacts, 'access', _359 => _359.issuer, 'access', _360 => _360.allowedSubjects, 'optionalAccess', _361 => _361.value, 'access', _362 => _362.length]) ? _optionalChain([artefacts, 'access', _363 => _363.issuer, 'access', _364 => _364.allowedSubjects, 'optionalAccess', _365 => _365.value, 'access', _366 => _366.join, 'call', _367 => _367(", ")]) : `Any ${state.getRealm()} realm user`
157829
157848
  ]);
157830
157849
  issuer.push([
157831
157850
  "JWKS (Public Key)"["brightCyan"],
@@ -157953,7 +157972,7 @@ async function executeRfc7523AuthZGrantFlow2(clientId, iss, jwk, sub, scope, jso
157953
157972
  stopProgressIndicator2(
157954
157973
  spinnerId,
157955
157974
  `Error executing rfc7523 authz grant flow: ${stringify3(
157956
- _optionalChain([error2, 'access', _370 => _370.response, 'optionalAccess', _371 => _371.data]) || error2.message
157975
+ _optionalChain([error2, 'access', _368 => _368.response, 'optionalAccess', _369 => _369.data]) || error2.message
157957
157976
  )}`,
157958
157977
  "fail"
157959
157978
  );
@@ -165429,10 +165448,13 @@ async function exportManagedObjectToFile(name, file, envFile) {
165429
165448
  async function exportAllConfigEntitiesToFile(file, entitiesFile, envFile, includeMeta = true) {
165430
165449
  try {
165431
165450
  const options = getIdmImportExportOptions(entitiesFile, envFile);
165432
- const exportData = await exportConfigEntities2({
165433
- envReplaceParams: options.envReplaceParams,
165434
- entitiesToExport: options.entitiesToExportOrImport
165435
- });
165451
+ const exportData = await exportConfigEntities2(
165452
+ {
165453
+ envReplaceParams: options.envReplaceParams,
165454
+ entitiesToExport: options.entitiesToExportOrImport
165455
+ },
165456
+ errorHandler
165457
+ );
165436
165458
  let fileName = getTypedFilename12(`all`, `idm`);
165437
165459
  if (file) {
165438
165460
  fileName = file;
@@ -165448,10 +165470,13 @@ async function exportAllConfigEntitiesToFiles(entitiesFile, envFile, separateMap
165448
165470
  const errors = [];
165449
165471
  try {
165450
165472
  const options = getIdmImportExportOptions(entitiesFile, envFile);
165451
- const exportData = await exportConfigEntities2({
165452
- envReplaceParams: options.envReplaceParams,
165453
- entitiesToExport: options.entitiesToExportOrImport
165454
- });
165473
+ const exportData = await exportConfigEntities2(
165474
+ {
165475
+ envReplaceParams: options.envReplaceParams,
165476
+ entitiesToExport: options.entitiesToExportOrImport
165477
+ },
165478
+ errorHandler
165479
+ );
165455
165480
  for (const [id7, obj] of Object.entries(exportData.idm)) {
165456
165481
  try {
165457
165482
  if (separateMappings && id7 === "sync") {
@@ -165517,11 +165542,16 @@ async function importConfigEntityByIdFromFile(entityId, file, envFile, validate3
165517
165542
  importData = JSON.parse(fileData);
165518
165543
  }
165519
165544
  const options = getIdmImportExportOptions(void 0, envFile);
165520
- await importConfigEntities2(importData, entityId, {
165521
- envReplaceParams: options.envReplaceParams,
165522
- entitiesToImport: void 0,
165523
- validate: validate3
165524
- });
165545
+ await importConfigEntities2(
165546
+ importData,
165547
+ entityId,
165548
+ {
165549
+ envReplaceParams: options.envReplaceParams,
165550
+ entitiesToImport: void 0,
165551
+ validate: validate3
165552
+ },
165553
+ errorHandler
165554
+ );
165525
165555
  return true;
165526
165556
  } catch (error2) {
165527
165557
  printError2(error2);
@@ -165583,11 +165613,16 @@ async function importFirstConfigEntityFromFile(file, envFile, validate3 = false)
165583
165613
  ]);
165584
165614
  }
165585
165615
  const options = getIdmImportExportOptions(void 0, envFile);
165586
- await importConfigEntities2(importData, entityId, {
165587
- envReplaceParams: options.envReplaceParams,
165588
- entitiesToImport: void 0,
165589
- validate: validate3
165590
- });
165616
+ await importConfigEntities2(
165617
+ importData,
165618
+ entityId,
165619
+ {
165620
+ envReplaceParams: options.envReplaceParams,
165621
+ entitiesToImport: void 0,
165622
+ validate: validate3
165623
+ },
165624
+ errorHandler
165625
+ );
165591
165626
  stopProgressIndicator2(
165592
165627
  indicatorId,
165593
165628
  `Imported ${entityId} from ${filePath}.`,
@@ -165619,7 +165654,8 @@ async function importAllConfigEntitiesFromFile(file, entitiesFile, envFile, vali
165619
165654
  entitiesToImport: options.entitiesToExportOrImport,
165620
165655
  envReplaceParams: options.envReplaceParams,
165621
165656
  validate: validate3
165622
- }
165657
+ },
165658
+ errorHandler
165623
165659
  );
165624
165660
  stopProgressIndicator2(indicatorId, `Imported config entities`, "success");
165625
165661
  return true;
@@ -165684,7 +165720,8 @@ async function importAllConfigEntitiesFromFiles(entitiesFile, envFile, validate3
165684
165720
  entitiesToImport: options.entitiesToExportOrImport,
165685
165721
  envReplaceParams: options.envReplaceParams,
165686
165722
  validate: validate3
165687
- }
165723
+ },
165724
+ errorHandler
165688
165725
  );
165689
165726
  stopProgressIndicator2(indicatorId, `Imported config entities`, "success");
165690
165727
  return true;
@@ -167515,7 +167552,7 @@ var {
167515
167552
  importScripts: importScripts3,
167516
167553
  deleteScript: deleteScript3,
167517
167554
  deleteScriptByName: deleteScriptByName3,
167518
- deleteScripts: deleteScripts3
167555
+ deleteScripts: deleteScripts2
167519
167556
  } = frodo.script;
167520
167557
  var langMap = { JAVASCRIPT: "JavaScript", GROOVY: "Groovy" };
167521
167558
  function getOneLineDescription(scriptObj) {
@@ -167714,7 +167751,7 @@ async function exportScriptsToFile(file, includeMeta = true, options) {
167714
167751
  if (file) {
167715
167752
  fileName = file;
167716
167753
  }
167717
- const scriptExport = await exportScripts2(options);
167754
+ const scriptExport = await exportScripts2(options, errorHandler);
167718
167755
  saveJsonToFile13(scriptExport, getFilePath13(fileName, true), includeMeta);
167719
167756
  debugMessage2(`Cli.ScriptOps.exportScriptsToFile: end`);
167720
167757
  return true;
@@ -167726,56 +167763,50 @@ async function exportScriptsToFile(file, includeMeta = true, options) {
167726
167763
  async function exportScriptsToFiles(extract = false, includeMeta = true, options) {
167727
167764
  debugMessage2(`Cli.ScriptOps.exportScriptsToFiles: start`);
167728
167765
  const errors = [];
167729
- let barId;
167730
- try {
167731
- const scriptExport = await exportScripts2(options);
167732
- const scriptList = Object.values(scriptExport.script);
167733
- barId = createProgressIndicator2(
167766
+ const scriptExport = await exportScripts2(options, errorHandler);
167767
+ const scriptList = Object.values(scriptExport.script);
167768
+ const barId = createProgressIndicator2(
167769
+ "determinate",
167770
+ scriptList.length,
167771
+ "Exporting scripts to individual files..."
167772
+ );
167773
+ for (const script of scriptList) {
167774
+ const fileBarId = createProgressIndicator2(
167734
167775
  "determinate",
167735
- scriptList.length,
167736
- "Exporting scripts to individual files..."
167776
+ 1,
167777
+ `Exporting script ${script.name}...`
167737
167778
  );
167738
- for (const script of scriptList) {
167739
- const fileBarId = createProgressIndicator2(
167740
- "determinate",
167741
- 1,
167742
- `Exporting script ${script.name}...`
167743
- );
167779
+ try {
167744
167780
  const file = getFilePath13(getTypedFilename13(script.name, "script"), true);
167745
- try {
167746
- if (extract) {
167747
- extractScriptsToFiles({
167748
- script: {
167749
- [script._id]: script
167750
- }
167751
- });
167752
- }
167753
- saveToFile4("script", script, "_id", file, includeMeta);
167754
- updateProgressIndicator2(fileBarId, `Saving ${script.name} to ${file}.`);
167755
- stopProgressIndicator2(fileBarId, `${script.name} saved to ${file}.`);
167756
- } catch (error2) {
167757
- stopProgressIndicator2(
167758
- fileBarId,
167759
- `Error exporting ${script.name}`,
167760
- "fail"
167761
- );
167762
- errors.push(error2);
167781
+ if (extract) {
167782
+ extractScriptsToFiles({
167783
+ script: {
167784
+ [script._id]: script
167785
+ }
167786
+ });
167763
167787
  }
167764
- updateProgressIndicator2(barId, `Exported script ${script.name}`);
167765
- }
167766
- if (errors.length > 0) {
167767
- throw new FrodoError(`Error exporting scripts`, errors);
167788
+ saveToFile4("script", script, "_id", file, includeMeta);
167789
+ updateProgressIndicator2(fileBarId, `Saving ${script.name} to ${file}.`);
167790
+ stopProgressIndicator2(fileBarId, `${script.name} saved to ${file}.`);
167791
+ } catch (error2) {
167792
+ stopProgressIndicator2(
167793
+ fileBarId,
167794
+ `Error exporting ${script.name}`,
167795
+ "fail"
167796
+ );
167797
+ errors.push(error2);
167768
167798
  }
167769
- stopProgressIndicator2(
167770
- barId,
167771
- `Exported ${scriptList.length} scripts to individual files.`
167772
- );
167773
- debugMessage2(`Cli.ScriptOps.exportScriptsToFiles: end`);
167774
- return true;
167775
- } catch (error2) {
167776
- stopProgressIndicator2(barId, `Error exporting scripts`);
167777
- printError2(error2);
167799
+ updateProgressIndicator2(barId, `Exported script ${script.name}`);
167800
+ }
167801
+ if (errors.length > 0) {
167802
+ throw new FrodoError(`Error exporting scripts`, errors);
167778
167803
  }
167804
+ stopProgressIndicator2(
167805
+ barId,
167806
+ `Exported ${scriptList.length} scripts to individual files.`
167807
+ );
167808
+ debugMessage2(`Cli.ScriptOps.exportScriptsToFiles: end`);
167809
+ return true;
167779
167810
  }
167780
167811
  function extractScriptsToFiles(scriptExport, scriptId, directory, useScriptNamesForFiles = true) {
167781
167812
  try {
@@ -167875,7 +167906,7 @@ async function importScriptsFromFiles(watch2, options, validateScripts) {
167875
167906
  // !path?.endsWith('.script.groovy')
167876
167907
  // : // in regular mode, ignore everything but frodo script exports
167877
167908
  // 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")]),
167909
+ ignored: (path9, stats) => _optionalChain([stats, 'optionalAccess', _370 => _370.isFile, 'call', _371 => _371()]) && !_optionalChain([path9, 'optionalAccess', _372 => _372.endsWith, 'call', _373 => _373(".script.json")]) && !_optionalChain([path9, 'optionalAccess', _374 => _374.endsWith, 'call', _375 => _375(".script.js")]) && !_optionalChain([path9, 'optionalAccess', _376 => _376.endsWith, 'call', _377 => _377(".script.groovy")]),
167879
167910
  persistent: watch2,
167880
167911
  ignoreInitial: false
167881
167912
  });
@@ -167900,7 +167931,14 @@ async function handleScriptFileImport(id7 = "", name = "", file, options, valida
167900
167931
  const script = getScriptExportByScriptFile(file);
167901
167932
  const indicatorId = createProgressIndicator2("determinate", 1, `${file}`);
167902
167933
  try {
167903
- await importScripts3(id7, name, script, options, validateScripts);
167934
+ await importScripts3(
167935
+ id7,
167936
+ name,
167937
+ script,
167938
+ options,
167939
+ validateScripts,
167940
+ errorHandler
167941
+ );
167904
167942
  updateProgressIndicator2(indicatorId, `${file}`);
167905
167943
  stopProgressIndicator2(indicatorId, `${file}`);
167906
167944
  } catch (error2) {
@@ -167980,7 +168018,7 @@ async function deleteAllScripts() {
167980
168018
  `Deleting all non-default scripts...`
167981
168019
  );
167982
168020
  try {
167983
- await deleteScripts3();
168021
+ await deleteScripts2(errorHandler);
167984
168022
  stopProgressIndicator2(
167985
168023
  spinnerId,
167986
168024
  `Deleted all non-default scripts.`,
@@ -168076,17 +168114,20 @@ async function getFullExportConfig(file = null) {
168076
168114
  }
168077
168115
  const workingDirectory = state.getDirectory();
168078
168116
  if (!workingDirectory) {
168079
- return await exportFullConfiguration2({
168080
- useStringArrays: true,
168081
- noDecode: false,
168082
- coords: true,
168083
- includeDefault: true,
168084
- includeActiveValues: false,
168085
- target: "",
168086
- includeReadOnly: true,
168087
- onlyRealm: false,
168088
- onlyGlobal: false
168089
- });
168117
+ return await exportFullConfiguration2(
168118
+ {
168119
+ useStringArrays: true,
168120
+ noDecode: false,
168121
+ coords: true,
168122
+ includeDefault: true,
168123
+ includeActiveValues: false,
168124
+ target: "",
168125
+ includeReadOnly: true,
168126
+ onlyRealm: false,
168127
+ onlyGlobal: false
168128
+ },
168129
+ errorHandler
168130
+ );
168090
168131
  }
168091
168132
  return await getFullExportConfigFromDirectory(workingDirectory);
168092
168133
  }
@@ -168274,16 +168315,12 @@ async function exportEverythingToFile(file, includeMeta = true, options = {
168274
168315
  onlyGlobal: false
168275
168316
  }) {
168276
168317
  try {
168277
- const collectErrors = [];
168278
- const exportData = await exportFullConfiguration3(options, collectErrors);
168318
+ const exportData = await exportFullConfiguration3(options, errorHandler);
168279
168319
  let fileName = "all.config.json";
168280
168320
  if (file) {
168281
168321
  fileName = file;
168282
168322
  }
168283
168323
  saveJsonToFile15(exportData, getFilePath15(fileName, true), includeMeta);
168284
- if (collectErrors.length > 0) {
168285
- throw new FrodoError(`Errors occurred during full export`, collectErrors);
168286
- }
168287
168324
  return true;
168288
168325
  } catch (error2) {
168289
168326
  printError2(error2);
@@ -168305,7 +168342,7 @@ async function exportEverythingToFiles(extract = false, separateMappings = false
168305
168342
  const collectErrors = [];
168306
168343
  const exportData = await exportFullConfiguration3(
168307
168344
  options,
168308
- collectErrors
168345
+ errorHandler
168309
168346
  );
168310
168347
  delete exportData.meta;
168311
168348
  const baseDirectory = getWorkingDirectory12(true);
@@ -168517,14 +168554,7 @@ async function importEverythingFromFile(file, options = {
168517
168554
  }) {
168518
168555
  try {
168519
168556
  const data2 = await getFullExportConfig(file);
168520
- const collectErrors = [];
168521
- await importFullConfiguration2(data2, options, collectErrors);
168522
- if (collectErrors.length > 0) {
168523
- throw new FrodoError(
168524
- `Errors occurred during full config import`,
168525
- collectErrors
168526
- );
168527
- }
168557
+ await importFullConfiguration2(data2, options, errorHandler);
168528
168558
  return true;
168529
168559
  } catch (error2) {
168530
168560
  cleanupProgressIndicators();
@@ -168542,14 +168572,7 @@ async function importEverythingFromFiles(options = {
168542
168572
  }) {
168543
168573
  try {
168544
168574
  const data2 = await getFullExportConfigFromDirectory(getWorkingDirectory12());
168545
- const collectErrors = [];
168546
- await importFullConfiguration2(data2, options, collectErrors);
168547
- if (collectErrors.length > 0) {
168548
- throw new FrodoError(
168549
- `Errors occurred during full config import`,
168550
- collectErrors
168551
- );
168552
- }
168575
+ await importFullConfiguration2(data2, options, errorHandler);
168553
168576
  return true;
168554
168577
  } catch (error2) {
168555
168578
  printError2(error2);
@@ -168588,14 +168611,7 @@ async function importEntityfromFile(file, global2 = false, options = {
168588
168611
  data2.realm[realm2] = {};
168589
168612
  await getConfig(data2.realm[realm2], file, void 0);
168590
168613
  }
168591
- const collectErrors = [];
168592
- const imports = await importFullConfiguration2(data2, options, collectErrors);
168593
- if (collectErrors.length > 0) {
168594
- throw new FrodoError(
168595
- `Error occurred during config import`,
168596
- collectErrors
168597
- );
168598
- }
168614
+ const imports = await importFullConfiguration2(data2, options, errorHandler);
168599
168615
  if (imports.length === 0) {
168600
168616
  throw new FrodoError(`No imports were made`);
168601
168617
  }
@@ -169261,7 +169277,7 @@ async function tailLogs(source, levels, txid, cookie, nf) {
169261
169277
  filteredLogs = logsObject.result.filter(
169262
169278
  (el) => !noiseFilter.includes(
169263
169279
  el.payload.logger
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(
169280
+ ) && !noiseFilter.includes(el.type) && (levels[0] === "ALL" || levels.includes(resolvePayloadLevel2(el))) && (typeof txid === "undefined" || txid === null || _optionalChain([el, 'access', _378 => _378.payload, 'access', _379 => _379.transactionId, 'optionalAccess', _380 => _380.includes, 'call', _381 => _381(
169265
169281
  txid
169266
169282
  )]))
169267
169283
  );
@@ -169285,7 +169301,7 @@ async function fetchLogs(source, startTs, endTs, levels, txid, ffString, cookie,
169285
169301
  filteredLogs = logsObject.result.filter(
169286
169302
  (el) => !noiseFilter.includes(
169287
169303
  el.payload.logger
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(
169304
+ ) && !noiseFilter.includes(el.type) && (levels[0] === "ALL" || levels.includes(resolvePayloadLevel2(el))) && (typeof txid === "undefined" || txid === null || _optionalChain([el, 'access', _382 => _382.payload, 'access', _383 => _383.transactionId, 'optionalAccess', _384 => _384.includes, 'call', _385 => _385(
169289
169305
  txid
169290
169306
  )]))
169291
169307
  );
@@ -169439,9 +169455,9 @@ function setup79() {
169439
169455
  `Created log API key ${creds.api_key_id} and secret.`
169440
169456
  );
169441
169457
  } catch (error2) {
169442
- printMessage2(_optionalChain([error2, 'access', _388 => _388.response, 'optionalAccess', _389 => _389.data]), "error");
169458
+ printMessage2(_optionalChain([error2, 'access', _386 => _386.response, 'optionalAccess', _387 => _387.data]), "error");
169443
169459
  printMessage2(
169444
- `Error creating log API key and secret: ${_optionalChain([error2, 'access', _390 => _390.response, 'optionalAccess', _391 => _391.data, 'optionalAccess', _392 => _392.message])}`,
169460
+ `Error creating log API key and secret: ${_optionalChain([error2, 'access', _388 => _388.response, 'optionalAccess', _389 => _389.data, 'optionalAccess', _390 => _390.message])}`,
169445
169461
  "error"
169446
169462
  );
169447
169463
  process.exitCode = 1;
@@ -170147,7 +170163,7 @@ function setup86() {
170147
170163
  printMessage2(updatesTable.toString(), "data");
170148
170164
  }
170149
170165
  if (!options.checkOnly) {
170150
- if (_optionalChain([updates, 'access', _393 => _393.secrets, 'optionalAccess', _394 => _394.length]) || _optionalChain([updates, 'access', _395 => _395.variables, 'optionalAccess', _396 => _396.length]) || options.force) {
170166
+ if (_optionalChain([updates, 'access', _391 => _391.secrets, 'optionalAccess', _392 => _392.length]) || _optionalChain([updates, 'access', _393 => _393.variables, 'optionalAccess', _394 => _394.length]) || options.force) {
170151
170167
  const ok = options.yes || await (0, import_yesno.default)({
170152
170168
  question: `
170153
170169
  Changes may take up to 10 minutes to propagate, during which time you will not be able to make further updates.
@@ -173856,7 +173872,7 @@ function getNodeClassificationMd(nodeType) {
173856
173872
  function getOneLineDescription5(nodeObj, nodeRef) {
173857
173873
  const description = `[${nodeObj._id["brightCyan"]}] (${getNodeClassification2(
173858
173874
  nodeObj._type._id
173859
- ).join(", ")}) ${nodeObj._type._id}${nodeRef ? " - " + _optionalChain([nodeRef, 'optionalAccess', _397 => _397.displayName]) : ""}`;
173875
+ ).join(", ")}) ${nodeObj._type._id}${nodeRef ? " - " + _optionalChain([nodeRef, 'optionalAccess', _395 => _395.displayName]) : ""}`;
173860
173876
  return description;
173861
173877
  }
173862
173878
  function getTableHeaderMd5() {
@@ -174592,7 +174608,7 @@ async function listJourneys(long = false, analyze = false) {
174592
174608
  table.push([
174593
174609
  `${journeyStub._id}`,
174594
174610
  journeyStub.enabled === false ? "disabled"["brightRed"] : "enabled"["brightGreen"],
174595
- _optionalChain([journeyStub, 'access', _398 => _398.uiConfig, 'optionalAccess', _399 => _399.categories]) ? wordwrap(
174611
+ _optionalChain([journeyStub, 'access', _396 => _396.uiConfig, 'optionalAccess', _397 => _397.categories]) ? wordwrap(
174596
174612
  JSON.parse(journeyStub.uiConfig.categories).join(", "),
174597
174613
  60
174598
174614
  ) : ""
@@ -174634,7 +174650,7 @@ async function listJourneys(long = false, analyze = false) {
174634
174650
  `${journeyExport.tree._id}`,
174635
174651
  journeyExport.tree.enabled === false ? "disabled"["brightRed"] : "enabled"["brightGreen"],
174636
174652
  getJourneyClassification2(journeyExport).join(", "),
174637
- _optionalChain([journeyExport, 'access', _400 => _400.tree, 'access', _401 => _401.uiConfig, 'optionalAccess', _402 => _402.categories]) ? wordwrap(
174653
+ _optionalChain([journeyExport, 'access', _398 => _398.tree, 'access', _399 => _399.uiConfig, 'optionalAccess', _400 => _400.categories]) ? wordwrap(
174638
174654
  JSON.parse(journeyExport.tree.uiConfig.categories).join(
174639
174655
  ", "
174640
174656
  ),
@@ -174678,9 +174694,10 @@ async function exportJourneyToFile(journeyId, file, includeMeta = true, options
174678
174694
  journeyId,
174679
174695
  options
174680
174696
  );
174697
+ delete fileData.meta;
174681
174698
  if (verbose)
174682
174699
  spinnerId = createProgressIndicator2("indeterminate", 0, `${journeyId}`);
174683
- saveJsonToFile23(fileData, filePath, includeMeta);
174700
+ saveJsonToFile23({ trees: { [fileData.tree._id]: fileData } }, filePath, includeMeta);
174684
174701
  stopProgressIndicator2(
174685
174702
  spinnerId,
174686
174703
  `Exported ${journeyId["brightCyan"]} to ${filePath["brightCyan"]}.`,
@@ -174709,7 +174726,10 @@ async function exportJourneysToFile(file, includeMeta = true, options = {
174709
174726
  file = getTypedFilename22(`all${getRealmString5()}Journeys`, "journey");
174710
174727
  }
174711
174728
  const filePath = getFilePath23(file, true);
174712
- const fileData = await exportJourneys2(options);
174729
+ const fileData = await exportJourneys2(
174730
+ options,
174731
+ errorHandler
174732
+ );
174713
174733
  saveJsonToFile23(fileData, filePath, includeMeta);
174714
174734
  return true;
174715
174735
  } catch (error2) {
@@ -174722,7 +174742,7 @@ async function exportJourneysToFiles(includeMeta = true, options = {
174722
174742
  coords: true
174723
174743
  }) {
174724
174744
  try {
174725
- const journeysExport = await exportJourneys2(options);
174745
+ const journeysExport = await exportJourneys2(options, errorHandler);
174726
174746
  const trees = Object.entries(journeysExport.trees);
174727
174747
  for (const [treeId, treeValue] of trees) {
174728
174748
  const indicatorId = createProgressIndicator2(
@@ -174731,10 +174751,9 @@ async function exportJourneysToFiles(includeMeta = true, options = {
174731
174751
  `Saving ${treeId}...`
174732
174752
  );
174733
174753
  const file = getFilePath23(getTypedFilename22(`${treeId}`, "journey"), true);
174734
- treeValue["meta"] = journeysExport.meta;
174735
174754
  try {
174736
174755
  updateProgressIndicator2(indicatorId, `Saving ${treeId} to ${file}`);
174737
- saveJsonToFile23(treeValue, file, includeMeta);
174756
+ saveJsonToFile23({ trees: { [treeValue.tree._id]: treeValue } }, file, includeMeta);
174738
174757
  stopProgressIndicator2(indicatorId, `${treeId} saved to ${file}`);
174739
174758
  } catch (error2) {
174740
174759
  stopProgressIndicator2(indicatorId, `Error saving ${treeId} to ${file}`);
@@ -174928,7 +174947,7 @@ async function importJourneysFromFile(file, options) {
174928
174947
  try {
174929
174948
  const data2 = fs35.default.readFileSync(getFilePath23(file), "utf8");
174930
174949
  const fileData = JSON.parse(data2);
174931
- await importJourneys2(fileData, options);
174950
+ await importJourneys2(fileData, options, errorHandler);
174932
174951
  return true;
174933
174952
  } catch (error2) {
174934
174953
  printError2(error2);
@@ -174946,7 +174965,11 @@ async function importJourneysFromFiles(options) {
174946
174965
  allJourneysData.trees[id7] = obj;
174947
174966
  }
174948
174967
  }
174949
- await importJourneys2(allJourneysData, options);
174968
+ await importJourneys2(
174969
+ allJourneysData,
174970
+ options,
174971
+ errorHandler
174972
+ );
174950
174973
  return true;
174951
174974
  } catch (error2) {
174952
174975
  printError2(error2);
@@ -175039,7 +175062,7 @@ async function describeJourney(journeyData, resolveTreeExport = onlineTreeExport
175039
175062
  nodeTypeMap[nodeData._type._id] = 1;
175040
175063
  }
175041
175064
  }
175042
- if (!state.getAmVersion() && _optionalChain([journeyData, 'access', _403 => _403.meta, 'optionalAccess', _404 => _404.originAmVersion])) {
175065
+ if (!state.getAmVersion() && _optionalChain([journeyData, 'access', _401 => _401.meta, 'optionalAccess', _402 => _402.originAmVersion])) {
175043
175066
  state.setAmVersion(journeyData.meta.originAmVersion);
175044
175067
  }
175045
175068
  printMessage2(`${getOneLineDescription8(journeyData.tree)}`, "data");
@@ -175063,7 +175086,7 @@ ${getJourneyClassification2(journeyData).join(", ")}`,
175063
175086
  "data"
175064
175087
  );
175065
175088
  }
175066
- if (_optionalChain([journeyData, 'access', _405 => _405.tree, 'access', _406 => _406.uiConfig, 'optionalAccess', _407 => _407.categories]) && journeyData.tree.uiConfig.categories != "[]") {
175089
+ if (_optionalChain([journeyData, 'access', _403 => _403.tree, 'access', _404 => _404.uiConfig, 'optionalAccess', _405 => _405.categories]) && journeyData.tree.uiConfig.categories != "[]") {
175067
175090
  printMessage2("\nCategories/Tags", "data");
175068
175091
  printMessage2(
175069
175092
  `${JSON.parse(journeyData.tree.uiConfig.categories).join(", ")}`,
@@ -175105,7 +175128,7 @@ Nodes (${Object.entries(allNodes).length}):`, "data");
175105
175128
  );
175106
175129
  }
175107
175130
  }
175108
- if (_optionalChain([journeyData, 'access', _408 => _408.themes, 'optionalAccess', _409 => _409.length])) {
175131
+ if (_optionalChain([journeyData, 'access', _406 => _406.themes, 'optionalAccess', _407 => _407.length])) {
175109
175132
  printMessage2(`
175110
175133
  Themes (${journeyData.themes.length}):`, "data");
175111
175134
  for (const themeData of journeyData.themes) {
@@ -175199,14 +175222,14 @@ async function describeJourneyMd(journeyData, resolveTreeExport = onlineTreeExpo
175199
175222
  nodeTypeMap[nodeData._type._id] = 1;
175200
175223
  }
175201
175224
  }
175202
- if (!state.getAmVersion() && _optionalChain([journeyData, 'access', _410 => _410.meta, 'optionalAccess', _411 => _411.originAmVersion])) {
175225
+ if (!state.getAmVersion() && _optionalChain([journeyData, 'access', _408 => _408.meta, 'optionalAccess', _409 => _409.originAmVersion])) {
175203
175226
  state.setAmVersion(journeyData.meta.originAmVersion);
175204
175227
  }
175205
175228
  printMessage2(
175206
175229
  `# ${getOneLineDescriptionMd(journeyData.tree)} - ${journeyData.tree.enabled === false ? ":o: `disabled`" : ":white_check_mark: `enabled`"}, ${getJourneyClassificationMd(journeyData).join(", ")}`,
175207
175230
  "data"
175208
175231
  );
175209
- if (_optionalChain([journeyData, 'access', _412 => _412.tree, 'access', _413 => _413.uiConfig, 'optionalAccess', _414 => _414.categories]) && journeyData.tree.uiConfig.categories != "[]") {
175232
+ if (_optionalChain([journeyData, 'access', _410 => _410.tree, 'access', _411 => _411.uiConfig, 'optionalAccess', _412 => _412.categories]) && journeyData.tree.uiConfig.categories != "[]") {
175210
175233
  printMessage2(
175211
175234
  `\`${JSON.parse(journeyData.tree.uiConfig.categories).join("`, `")}\``,
175212
175235
  "data"
@@ -175250,7 +175273,7 @@ ${journeyData.tree.description}`, "data");
175250
175273
  );
175251
175274
  }
175252
175275
  }
175253
- if (_optionalChain([journeyData, 'access', _415 => _415.themes, 'optionalAccess', _416 => _416.length])) {
175276
+ if (_optionalChain([journeyData, 'access', _413 => _413.themes, 'optionalAccess', _414 => _414.length])) {
175254
175277
  printMessage2(`## Themes (${journeyData.themes.length})`, "data");
175255
175278
  printMessage2(getTableHeaderMd7(), "data");
175256
175279
  for (const themeData of journeyData.themes) {
@@ -175390,7 +175413,10 @@ async function deleteJourneys2(options = {
175390
175413
  `Deleting journeys...`
175391
175414
  );
175392
175415
  try {
175393
- const status = await _deleteJourneys(options);
175416
+ const status = await _deleteJourneys(
175417
+ options,
175418
+ errorHandler
175419
+ );
175394
175420
  stopProgressIndicator2(
175395
175421
  indicatorId,
175396
175422
  `Deleted ${Object.keys(status).length} journeys`
@@ -175520,9 +175546,9 @@ function setup127() {
175520
175546
  journeyData = fileData.trees[options.journeyId];
175521
175547
  } else if (typeof options.journeyId === "undefined" && fileData.trees) {
175522
175548
  [journeyData] = Object.values(fileData.trees);
175523
- } else if (typeof options.journeyId !== "undefined" && options.journeyId === _optionalChain([fileData, 'access', _417 => _417.tree, 'optionalAccess', _418 => _418._id])) {
175549
+ } else if (typeof options.journeyId !== "undefined" && options.journeyId === _optionalChain([fileData, 'access', _415 => _415.tree, 'optionalAccess', _416 => _416._id])) {
175524
175550
  journeyData = fileData;
175525
- } else if (typeof options.journeyId === "undefined" && _optionalChain([fileData, 'access', _419 => _419.tree, 'optionalAccess', _420 => _420._id])) {
175551
+ } else if (typeof options.journeyId === "undefined" && _optionalChain([fileData, 'access', _417 => _417.tree, 'optionalAccess', _418 => _418._id])) {
175526
175552
  journeyData = fileData;
175527
175553
  } else {
175528
175554
  throw new Error(
@@ -177398,7 +177424,7 @@ async function importServiceFromFile(serviceId, file, options = {
177398
177424
  );
177399
177425
  const data2 = fs35.default.readFileSync(filePath, "utf8");
177400
177426
  const importData = JSON.parse(data2);
177401
- if (_optionalChain([importData, 'optionalAccess', _421 => _421.service, 'access', _422 => _422[serviceId]])) {
177427
+ if (_optionalChain([importData, 'optionalAccess', _419 => _419.service, 'access', _420 => _420[serviceId]])) {
177402
177428
  await importService2(serviceId, importData, options);
177403
177429
  stopProgressIndicator2(
177404
177430
  indicatorId,
@@ -178615,7 +178641,7 @@ async function listRealms(long = false) {
178615
178641
  } catch (error2) {
178616
178642
  printMessage2(error2, "error");
178617
178643
  printMessage2(`Error listing realms: ${error2.message}`, "error");
178618
- printMessage2(_optionalChain([error2, 'access', _423 => _423.response, 'optionalAccess', _424 => _424.data]), "error");
178644
+ printMessage2(_optionalChain([error2, 'access', _421 => _421.response, 'optionalAccess', _422 => _422.data]), "error");
178619
178645
  }
178620
178646
  }
178621
178647
  async function exportRealmById(realmId, file, includeMeta = true) {
@@ -181412,7 +181438,7 @@ var compareVersions = (v12, v2) => {
181412
181438
  // package.json
181413
181439
  var package_default2 = {
181414
181440
  name: "@rockcarver/frodo-cli",
181415
- version: "3.0.5",
181441
+ version: "3.0.6",
181416
181442
  type: "module",
181417
181443
  description: "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
181418
181444
  keywords: [
@@ -181527,7 +181553,7 @@ var package_default2 = {
181527
181553
  ]
181528
181554
  },
181529
181555
  devDependencies: {
181530
- "@rockcarver/frodo-lib": "3.1.0",
181556
+ "@rockcarver/frodo-lib": "3.3.0",
181531
181557
  "@types/colors": "^1.2.1",
181532
181558
  "@types/fs-extra": "^11.0.1",
181533
181559
  "@types/jest": "^29.2.3",