@rockcarver/frodo-cli 3.0.5 → 3.0.7

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.1",
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
  },
@@ -124655,6 +124661,26 @@ function generateLogApi({
124655
124661
  requestOverride
124656
124662
  );
124657
124663
  const request = createAxiosInstance(state2, requestConfig);
124664
+ request.interceptors.response.use(
124665
+ (response) => {
124666
+ return response;
124667
+ },
124668
+ async (error2) => {
124669
+ const originalRequest = error2.config;
124670
+ const status = error2.response ? error2.response.status : null;
124671
+ if (status === 429 && error2.response.headers["retry-after"] && !originalRequest._retry) {
124672
+ originalRequest._retry = true;
124673
+ const retryAfterSeconds = parseInt(
124674
+ error2.response.headers["retry-after"],
124675
+ 10
124676
+ );
124677
+ const delayMs = (retryAfterSeconds + 1) * 1e3;
124678
+ await new Promise((resolve52) => setTimeout(resolve52, delayMs));
124679
+ return request(originalRequest);
124680
+ }
124681
+ return Promise.reject(error2);
124682
+ }
124683
+ );
124658
124684
  if (state2.getCurlirize()) {
124659
124685
  curlirize(request, state2);
124660
124686
  }
@@ -124829,6 +124855,81 @@ async function deleteRealm({
124829
124855
  }
124830
124856
  var import_replaceall = __toESM2(require_replaceall_min());
124831
124857
  var import_slugify2 = __toESM2(require_slugify());
124858
+ var FrodoError = class extends Error {
124859
+ constructor(message, originalErrors = null) {
124860
+ super(message);
124861
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "originalErrors", []);
124862
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "isHttpError", false);
124863
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpCode");
124864
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpStatus");
124865
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpMessage");
124866
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpDetail");
124867
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpErrorText");
124868
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpErrorReason");
124869
+ _chunkHEKQUNOBcjs.__publicField.call(void 0, this, "httpDescription");
124870
+ this.name = this.constructor.name;
124871
+ if (typeof Error.captureStackTrace === "function") {
124872
+ Error.captureStackTrace(this, this.constructor);
124873
+ } else {
124874
+ this.stack = new Error(message).stack;
124875
+ }
124876
+ if (originalErrors && Array.isArray(originalErrors)) {
124877
+ this.originalErrors = originalErrors;
124878
+ } else if (originalErrors) {
124879
+ this.originalErrors = [originalErrors];
124880
+ }
124881
+ if (originalErrors) {
124882
+ const error2 = this.originalErrors[0];
124883
+ this.isHttpError = error2.name === "AxiosError";
124884
+ this.httpCode = error2["code"];
124885
+ this.httpStatus = error2["response"] ? error2["response"].status : null;
124886
+ this.httpMessage = error2["response"] ? error2["response"].data ? error2["response"].data.message : null : null;
124887
+ this.httpDetail = error2["response"] ? error2["response"].data ? error2["response"].data.detail : null : null;
124888
+ this.httpErrorText = error2["response"] ? error2["response"].data ? error2["response"].data.error : null : null;
124889
+ this.httpErrorReason = error2["response"] ? error2["response"].data ? error2["response"].data.reason : null : null;
124890
+ this.httpDescription = error2["response"] ? error2["response"].data ? error2["response"].data.error_description : null : null;
124891
+ }
124892
+ }
124893
+ getOriginalErrors() {
124894
+ return this.originalErrors;
124895
+ }
124896
+ getCombinedMessage() {
124897
+ let combinedMessage = this.message || "";
124898
+ this.originalErrors.forEach((error2) => {
124899
+ switch (error2.name) {
124900
+ case "FrodoError":
124901
+ combinedMessage += "\n " + error2.getCombinedMessage();
124902
+ break;
124903
+ case "AxiosError":
124904
+ {
124905
+ combinedMessage += "\n HTTP client error";
124906
+ combinedMessage += this.httpCode ? `
124907
+ Code: ${this.httpCode}` : "";
124908
+ combinedMessage += this.httpStatus ? `
124909
+ Status: ${this.httpStatus}` : "";
124910
+ combinedMessage += this.httpErrorText ? `
124911
+ Error: ${this.httpErrorText}` : "";
124912
+ combinedMessage += this.httpErrorReason ? `
124913
+ Reason: ${this.httpErrorReason}` : "";
124914
+ combinedMessage += this.httpMessage ? `
124915
+ Message: ${this.httpMessage}` : "";
124916
+ combinedMessage += this.httpDetail ? `
124917
+ Detail: ${this.httpDetail}` : "";
124918
+ combinedMessage += this.httpDescription ? `
124919
+ Description: ${this.httpDescription}` : "";
124920
+ }
124921
+ break;
124922
+ default:
124923
+ combinedMessage += "\n " + error2.message;
124924
+ break;
124925
+ }
124926
+ });
124927
+ return combinedMessage;
124928
+ }
124929
+ toString() {
124930
+ return this.getCombinedMessage();
124931
+ }
124932
+ };
124832
124933
  var DEFAULT_REALM_KEY = "__default__realm__";
124833
124934
  var CLASSIC_DEPLOYMENT_TYPE_KEY = "classic";
124834
124935
  var CLOUD_DEPLOYMENT_TYPE_KEY = "cloud";
@@ -125229,102 +125330,55 @@ function isValidUrl(urlString) {
125229
125330
  return false;
125230
125331
  }
125231
125332
  }
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
- }
125333
+ async function exportWithErrorHandling(func, parameters, type, resultCallback = void 0, perform = true) {
125334
+ return perform ? await getResult(
125335
+ resultCallback,
125336
+ `Error Exporting ${type}`,
125337
+ func,
125338
+ parameters
125339
+ ) : null;
125241
125340
  }
125242
- async function exportWithErrorHandling(func, parameters, errors, perform = true) {
125243
- return exportOrImportWithErrorHandling(func, parameters, errors, perform);
125244
- }
125245
- async function importWithErrorHandling(func, parameters, errors, id7, type, perform = true) {
125341
+ async function importWithErrorHandling(func, parameters, id7, type, resultCallback = void 0, perform = true) {
125246
125342
  updateProgressIndicator({
125247
125343
  id: id7,
125248
125344
  message: perform ? `Importing ${type}...` : `Skipping ${type}...`,
125249
125345
  state: parameters.state
125250
125346
  });
125251
- return exportOrImportWithErrorHandling(func, parameters, errors, perform);
125347
+ return perform ? await getResult(
125348
+ resultCallback,
125349
+ `Error Importing ${type}`,
125350
+ func,
125351
+ parameters
125352
+ ) : null;
125252
125353
  }
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);
125354
+ async function getResult(resultCallback, errorMessage, func, ...parameters) {
125355
+ try {
125356
+ const result = await func(...parameters);
125357
+ if (resultCallback) {
125358
+ resultCallback(void 0, result);
125359
+ }
125360
+ return result;
125361
+ } catch (e) {
125362
+ const error2 = errorMessage ? new FrodoError(errorMessage, e) : e;
125363
+ if (resultCallback) {
125364
+ resultCallback(error2, void 0);
125268
125365
  } else {
125269
- this.stack = new Error(message).stack;
125366
+ throw error2;
125270
125367
  }
125271
- if (originalErrors && Array.isArray(originalErrors)) {
125272
- this.originalErrors = originalErrors;
125273
- } else if (originalErrors) {
125274
- this.originalErrors = [originalErrors];
125368
+ }
125369
+ }
125370
+ function getErrorCallback(resultCallback, errorFilter = () => true) {
125371
+ return (e) => {
125372
+ if (!e || !errorFilter(e)) {
125373
+ return;
125275
125374
  }
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;
125375
+ if (resultCallback) {
125376
+ resultCallback(e, void 0);
125377
+ return;
125286
125378
  }
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
- };
125379
+ throw e;
125380
+ };
125381
+ }
125328
125382
  var RealmOps_default = (state2) => {
125329
125383
  return {
125330
125384
  readRealms() {
@@ -125668,8 +125722,12 @@ function getCurrentRealmManagedUser({
125668
125722
  state: state2
125669
125723
  }) {
125670
125724
  let realmManagedUser = "user";
125671
- if (state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY) {
125725
+ if (state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY || state2.getUseRealmPrefixOnManagedObjects() === true) {
125672
125726
  realmManagedUser = `${getCurrentRealmName(state2)}_user`;
125727
+ debugMessage({
125728
+ message: `DeploymentType === cloud or UseRealmPrefixOnManagedObjects is true, returning '${realmManagedUser}'`,
125729
+ state: state2
125730
+ });
125673
125731
  }
125674
125732
  return realmManagedUser;
125675
125733
  }
@@ -127588,8 +127646,8 @@ var IdmConfigOps_default = (state2) => {
127588
127646
  async exportConfigEntities(options = {
127589
127647
  envReplaceParams: void 0,
127590
127648
  entitiesToExport: void 0
127591
- }) {
127592
- return exportConfigEntities({ options, state: state2 });
127649
+ }, resultCallback = void 0) {
127650
+ return exportConfigEntities({ options, resultCallback, state: state2 });
127593
127651
  },
127594
127652
  async createConfigEntity(entityId, entityData, wait = false) {
127595
127653
  return createConfigEntity({ entityId, entityData, wait, state: state2 });
@@ -127597,14 +127655,20 @@ var IdmConfigOps_default = (state2) => {
127597
127655
  async updateConfigEntity(entityId, entityData, wait = false) {
127598
127656
  return updateConfigEntity({ entityId, entityData, wait, state: state2 });
127599
127657
  },
127600
- async importConfigEntities(importData, entityId, options = { validate: false }) {
127601
- return importConfigEntities({ entityId, importData, options, state: state2 });
127658
+ async importConfigEntities(importData, entityId, options = { validate: false }, resultCallback = void 0) {
127659
+ return importConfigEntities({
127660
+ entityId,
127661
+ importData,
127662
+ options,
127663
+ resultCallback,
127664
+ state: state2
127665
+ });
127602
127666
  },
127603
- async deleteConfigEntities() {
127604
- return deleteConfigEntities({ state: state2 });
127667
+ async deleteConfigEntities(resultCallback = void 0) {
127668
+ return deleteConfigEntities({ resultCallback, state: state2 });
127605
127669
  },
127606
- async deleteConfigEntitiesByType(type) {
127607
- return deleteConfigEntitiesByType({ type, state: state2 });
127670
+ async deleteConfigEntitiesByType(type, resultCallback = void 0) {
127671
+ return deleteConfigEntitiesByType({ type, resultCallback, state: state2 });
127608
127672
  },
127609
127673
  async deleteConfigEntity(entityId) {
127610
127674
  return deleteConfigEntity({ entityId, state: state2 });
@@ -127757,75 +127821,65 @@ async function exportConfigEntity({
127757
127821
  exportData.idm[entity._id] = entity;
127758
127822
  return exportData;
127759
127823
  } catch (error2) {
127760
- printError(error2);
127824
+ throw new FrodoError(`Error getting config entity ${entityId}`, error2);
127761
127825
  }
127762
127826
  }
127763
127827
  async function exportConfigEntities({
127764
127828
  options = { envReplaceParams: void 0, entitiesToExport: void 0 },
127829
+ resultCallback = void 0,
127765
127830
  state: state2
127766
127831
  }) {
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({
127832
+ const exportData = createConfigEntityExportTemplate({ state: state2 });
127833
+ let configurations = await readConfigEntities({ state: state2 });
127834
+ if (options.entitiesToExport && options.entitiesToExport.length > 0) {
127835
+ configurations = configurations.filter(
127836
+ (c) => options.entitiesToExport.includes(c._id)
127837
+ );
127838
+ }
127839
+ const indicatorId = createProgressIndicator({
127840
+ total: configurations.length,
127841
+ message: "Exporting config entities...",
127842
+ state: state2
127843
+ });
127844
+ const entityPromises = [];
127845
+ for (const configEntity of configurations) {
127846
+ updateProgressIndicator({
127820
127847
  id: indicatorId,
127821
- message: `Exported ${configurations.length} config entities.`,
127822
- status: "success",
127848
+ message: `Exporting config entity ${configEntity._id}`,
127823
127849
  state: state2
127824
127850
  });
127825
- return exportData;
127826
- } catch (error2) {
127827
- printError(error2);
127851
+ entityPromises.push(
127852
+ getResult(
127853
+ getErrorCallback(
127854
+ resultCallback,
127855
+ (error2) => !// operation is not available in PingOne Advanced Identity Cloud
127856
+ (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.
127857
+ !(IDM_UNAVAILABLE_ENTITIES.includes(configEntity._id) && error2.httpStatus === 404 && error2.httpErrorReason === "Not Found") && // https://bugster.forgerock.org/jira/browse/OPENIDM-18270
127858
+ !(error2.httpStatus === 404 && error2.httpMessage === "No configuration exists for id org.apache.felix.fileinstall/openidm")
127859
+ ),
127860
+ `Error exporting idm config entity ${configEntity._id}`,
127861
+ readConfigEntity,
127862
+ { entityId: configEntity._id, state: state2 }
127863
+ )
127864
+ );
127828
127865
  }
127866
+ (await Promise.all(entityPromises)).filter((c) => c).forEach((entity) => {
127867
+ const substitutedEntity = substituteEntityWithEnv(
127868
+ entity,
127869
+ options.envReplaceParams
127870
+ );
127871
+ exportData.idm[entity._id] = substitutedEntity;
127872
+ if (resultCallback) {
127873
+ resultCallback(void 0, substitutedEntity);
127874
+ }
127875
+ });
127876
+ stopProgressIndicator({
127877
+ id: indicatorId,
127878
+ message: `Exported ${configurations.length} config entities.`,
127879
+ status: "success",
127880
+ state: state2
127881
+ });
127882
+ return exportData;
127829
127883
  }
127830
127884
  async function createConfigEntity({
127831
127885
  entityId,
@@ -127878,11 +127932,11 @@ async function importConfigEntities({
127878
127932
  entitiesToImport: void 0,
127879
127933
  validate: false
127880
127934
  },
127935
+ resultCallback = void 0,
127881
127936
  state: state2
127882
127937
  }) {
127883
127938
  debugMessage({ message: `IdmConfigOps.importConfigEntities: start`, state: state2 });
127884
127939
  const response = [];
127885
- const errors = [];
127886
127940
  let ids = Object.keys(importData.idm);
127887
127941
  if (options.entitiesToImport && options.entitiesToImport.length > 0) {
127888
127942
  ids = ids.filter((id7) => options.entitiesToImport.includes(id7));
@@ -127905,32 +127959,36 @@ async function importConfigEntities({
127905
127959
  `Invalid script hook in the config object '${id7}'`
127906
127960
  );
127907
127961
  }
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
- }
127962
+ const result = await updateConfigEntity({
127963
+ entityId: id7,
127964
+ entityData,
127965
+ state: state2
127966
+ });
127967
+ response.push(result);
127968
+ if (resultCallback) {
127969
+ resultCallback(void 0, result);
127922
127970
  }
127923
127971
  } catch (error2) {
127924
- errors.push(error2);
127972
+ if (
127973
+ // protected entities (e.g. root realm email templates)
127974
+ !(state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY && AIC_PROTECTED_ENTITIES.includes(id7) && error2.httpStatus === 403 && error2.httpCode === "ERR_BAD_REQUEST")
127975
+ ) {
127976
+ if (resultCallback) {
127977
+ resultCallback(error2, void 0);
127978
+ } else {
127979
+ throw new FrodoError(
127980
+ `Error importing idm config entity ${id7}`,
127981
+ error2
127982
+ );
127983
+ }
127984
+ }
127925
127985
  }
127926
127986
  }
127927
- if (errors.length > 0) {
127928
- throw new FrodoError(`Error importing config entities`, errors);
127929
- }
127930
127987
  debugMessage({ message: `IdmConfigOps.importConfigEntities: end`, state: state2 });
127931
127988
  return response;
127932
127989
  }
127933
127990
  async function deleteConfigEntities({
127991
+ resultCallback = void 0,
127934
127992
  state: state2
127935
127993
  }) {
127936
127994
  debugMessage({
@@ -127938,30 +127996,23 @@ async function deleteConfigEntities({
127938
127996
  state: state2
127939
127997
  });
127940
127998
  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"]}'`,
127999
+ const configEntityStubs = await readConfigEntityStubs({ state: state2 });
128000
+ for (const configEntityStub of configEntityStubs) {
128001
+ debugMessage({
128002
+ message: `IdmConfigOps.deleteConfigEntities: '${configEntityStub["_id"]}'`,
128003
+ state: state2
128004
+ });
128005
+ result.push(
128006
+ await getResult(
128007
+ resultCallback,
128008
+ `Error deleting idm config entity ${configEntityStub._id}`,
128009
+ deleteConfigEntity2,
128010
+ {
128011
+ entityId: configEntityStub["_id"],
127948
128012
  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);
128013
+ }
128014
+ )
128015
+ );
127965
128016
  }
127966
128017
  debugMessage({
127967
128018
  message: `IdmConfigOps.deleteConfigEntities: end`,
@@ -127971,6 +128022,7 @@ async function deleteConfigEntities({
127971
128022
  }
127972
128023
  async function deleteConfigEntitiesByType({
127973
128024
  type,
128025
+ resultCallback = void 0,
127974
128026
  state: state2
127975
128027
  }) {
127976
128028
  debugMessage({
@@ -127978,39 +128030,29 @@ async function deleteConfigEntitiesByType({
127978
128030
  state: state2
127979
128031
  });
127980
128032
  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
- }
128033
+ const configEntities = await readConfigEntitiesByType({ type, state: state2 });
128034
+ for (const configEntity of configEntities) {
128003
128035
  debugMessage({
128004
- message: `IdmConfigOps.deleteConfigEntitiesByType: end`,
128036
+ message: `IdmConfigOps.deleteConfigEntitiesByType: '${configEntity["_id"]}'`,
128005
128037
  state: state2
128006
128038
  });
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);
128039
+ result.push(
128040
+ await getResult(
128041
+ resultCallback,
128042
+ `Error deleting idm config entity ${configEntity._id}`,
128043
+ deleteConfigEntity2,
128044
+ {
128045
+ entityId: configEntity["_id"],
128046
+ state: state2
128047
+ }
128048
+ )
128049
+ );
128013
128050
  }
128051
+ debugMessage({
128052
+ message: `IdmConfigOps.deleteConfigEntitiesByType: end`,
128053
+ state: state2
128054
+ });
128055
+ return result;
128014
128056
  }
128015
128057
  async function deleteConfigEntity({
128016
128058
  entityId,
@@ -128043,7 +128085,7 @@ async function readSubConfigEntity({
128043
128085
  }
128044
128086
  return subEntity;
128045
128087
  } catch (error2) {
128046
- printError(error2);
128088
+ throw new FrodoError(`Error reading sub config ${entityId} ${name}`, error2);
128047
128089
  }
128048
128090
  }
128049
128091
  async function importSubConfigEntity({
@@ -128061,13 +128103,13 @@ async function importSubConfigEntity({
128061
128103
  entityId,
128062
128104
  state: state2
128063
128105
  });
128064
- const subEntityKey = Object.keys(_optionalChain([entityExport, 'access', _94 => _94.idm, 'optionalAccess', _95 => _95[entityId]])).find(
128106
+ const subEntityKey = Object.keys(_optionalChain([entityExport, 'access', _92 => _92.idm, 'optionalAccess', _93 => _93[entityId]])).find(
128065
128107
  (key) => key !== "_id"
128066
128108
  );
128067
- if (!Array.isArray(_optionalChain([entityExport, 'access', _96 => _96.idm, 'optionalAccess', _97 => _97[entityId], 'optionalAccess', _98 => _98[subEntityKey]]))) {
128109
+ if (!Array.isArray(_optionalChain([entityExport, 'access', _94 => _94.idm, 'optionalAccess', _95 => _95[entityId], 'optionalAccess', _96 => _96[subEntityKey]]))) {
128068
128110
  throw new FrodoError(`Error importing sub config of ${entityId}`);
128069
128111
  }
128070
- const existingSubEntityIndex = (_optionalChain([entityExport, 'access', _99 => _99.idm, 'optionalAccess', _100 => _100[entityId], 'optionalAccess', _101 => _101[subEntityKey]])).findIndex((item) => item.name === updatedSubConfigEntity.name);
128112
+ const existingSubEntityIndex = (_optionalChain([entityExport, 'access', _97 => _97.idm, 'optionalAccess', _98 => _98[entityId], 'optionalAccess', _99 => _99[subEntityKey]])).findIndex((item) => item.name === updatedSubConfigEntity.name);
128071
128113
  if (existingSubEntityIndex !== -1) {
128072
128114
  entityExport.idm[entityId][subEntityKey][existingSubEntityIndex] = updatedSubConfigEntity;
128073
128115
  } else {
@@ -128725,7 +128767,7 @@ async function readOAuth2Provider({
128725
128767
  try {
128726
128768
  return await getOAuth2Provider({ state: state2 });
128727
128769
  } catch (error2) {
128728
- if (error2.httpStatus === 404 || _optionalChain([error2, 'access', _102 => _102.response, 'optionalAccess', _103 => _103.status]) === 404) {
128770
+ if (error2.httpStatus === 404 || _optionalChain([error2, 'access', _100 => _100.response, 'optionalAccess', _101 => _101.status]) === 404) {
128729
128771
  return null;
128730
128772
  } else {
128731
128773
  throw new FrodoError(`Error reading oauth2 provider`, error2);
@@ -128884,32 +128926,6 @@ async function deleteScriptByName({
128884
128926
  state: state2
128885
128927
  });
128886
128928
  }
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
128929
  var ScriptOps_default = (state2) => {
128914
128930
  return {
128915
128931
  createScriptExportTemplate() {
@@ -128939,8 +128955,8 @@ var ScriptOps_default = (state2) => {
128939
128955
  async deleteScriptByName(scriptName) {
128940
128956
  return deleteScriptByName2({ scriptName, state: state2 });
128941
128957
  },
128942
- async deleteScripts() {
128943
- return deleteScripts2({ state: state2 });
128958
+ async deleteScripts(resultCallback = void 0) {
128959
+ return deleteScripts({ resultCallback, state: state2 });
128944
128960
  },
128945
128961
  async exportScript(scriptId, options = {
128946
128962
  deps: true,
@@ -128960,20 +128976,21 @@ var ScriptOps_default = (state2) => {
128960
128976
  deps: true,
128961
128977
  includeDefault: false,
128962
128978
  useStringArrays: true
128963
- }) {
128964
- return exportScripts({ options, state: state2 });
128979
+ }, resultCallback = void 0) {
128980
+ return exportScripts({ options, resultCallback, state: state2 });
128965
128981
  },
128966
128982
  async importScripts(scriptId, scriptName, importData, options = {
128967
128983
  deps: true,
128968
128984
  reUuid: false,
128969
128985
  includeDefault: false
128970
- }, validate3 = false) {
128986
+ }, validate3 = false, resultCallback = void 0) {
128971
128987
  return importScripts2({
128972
128988
  scriptId,
128973
128989
  scriptName,
128974
128990
  importData,
128975
128991
  options,
128976
128992
  validate: validate3,
128993
+ resultCallback,
128977
128994
  state: state2
128978
128995
  });
128979
128996
  },
@@ -129116,7 +129133,7 @@ async function updateScript({
129116
129133
  }
129117
129134
  result = await putScript({ scriptId, scriptData, state: state2 });
129118
129135
  } catch (error2) {
129119
- if (_optionalChain([error2, 'access', _104 => _104.response, 'optionalAccess', _105 => _105.status]) === 409) {
129136
+ if (_optionalChain([error2, 'access', _102 => _102.response, 'optionalAccess', _103 => _103.status]) === 409) {
129120
129137
  verboseMessage({
129121
129138
  message: `createOrUpdateScript WARNING: script with name ${scriptData.name} already exists, using renaming policy... <name> => <name - imported (n)>`,
129122
129139
  state: state2
@@ -129152,14 +129169,26 @@ async function deleteScriptByName2({
129152
129169
  throw new FrodoError(`Error deleting script ${scriptName}`, error2);
129153
129170
  }
129154
129171
  }
129155
- async function deleteScripts2({
129172
+ async function deleteScripts({
129173
+ resultCallback = void 0,
129156
129174
  state: state2
129157
129175
  }) {
129158
- try {
129159
- return deleteScripts({ state: state2 });
129160
- } catch (error2) {
129161
- throw new FrodoError(`Error deleting scripts`, error2);
129176
+ const result = await readScripts({ state: state2 });
129177
+ const scripts = result.filter((s4) => !s4.default);
129178
+ const deletedScripts = [];
129179
+ for (const script of scripts) {
129180
+ const result2 = await getResult(
129181
+ resultCallback,
129182
+ `Error deleting script ${script.name}`,
129183
+ deleteScript2,
129184
+ {
129185
+ scriptId: script._id,
129186
+ state: state2
129187
+ }
129188
+ );
129189
+ deletedScripts.push(result2);
129162
129190
  }
129191
+ return deletedScripts;
129163
129192
  }
129164
129193
  async function exportScript({
129165
129194
  scriptId,
@@ -129205,58 +129234,42 @@ async function exportScripts({
129205
129234
  includeDefault: false,
129206
129235
  useStringArrays: true
129207
129236
  },
129237
+ resultCallback = void 0,
129208
129238
  state: state2
129209
129239
  }) {
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({
129240
+ const { includeDefault, useStringArrays } = options;
129241
+ let scriptList = await readScripts({ state: state2 });
129242
+ if (!includeDefault)
129243
+ scriptList = scriptList.filter((script) => !script.default);
129244
+ const exportData = createScriptExportTemplate({ state: state2 });
129245
+ const indicatorId = createProgressIndicator({
129246
+ total: scriptList.length,
129247
+ message: `Exporting ${scriptList.length} scripts...`,
129248
+ state: state2
129249
+ });
129250
+ for (const scriptData of scriptList) {
129251
+ updateProgressIndicator({
129250
129252
  id: indicatorId,
129251
- message: `Error exporting scripts`,
129252
- status: "fail",
129253
+ message: `Reading script ${scriptData.name}`,
129253
129254
  state: state2
129254
129255
  });
129255
- if (errors.length > 0) {
129256
- throw error2;
129257
- }
129258
- throw new FrodoError(`Error exporting scripts`, error2);
129256
+ exportData.script[scriptData._id] = await getResult(
129257
+ resultCallback,
129258
+ `Error exporting script ${scriptData.name}`,
129259
+ prepareScriptForExport,
129260
+ {
129261
+ scriptData,
129262
+ useStringArrays,
129263
+ state: state2
129264
+ }
129265
+ );
129259
129266
  }
129267
+ stopProgressIndicator({
129268
+ id: indicatorId,
129269
+ message: `Exported ${scriptList.length} scripts.`,
129270
+ state: state2
129271
+ });
129272
+ return exportData;
129260
129273
  }
129261
129274
  async function importScripts2({
129262
129275
  scriptId,
@@ -129268,61 +129281,57 @@ async function importScripts2({
129268
129281
  includeDefault: false
129269
129282
  },
129270
129283
  validate: validate3 = false,
129284
+ resultCallback = void 0,
129271
129285
  state: state2
129272
129286
  }) {
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;
129287
+ debugMessage({ message: `ScriptOps.importScripts: start`, state: state2 });
129288
+ const response = [];
129289
+ for (const existingId of Object.keys(importData.script)) {
129290
+ try {
129291
+ const scriptData = importData.script[existingId];
129292
+ const isDefault = !options.includeDefault && scriptData.default;
129293
+ const shouldNotImportScript = !options.deps && (scriptId && scriptId !== scriptData._id || !scriptId && scriptName && scriptName !== scriptData.name);
129294
+ if (isDefault || shouldNotImportScript) continue;
129295
+ debugMessage({
129296
+ message: `ScriptOps.importScripts: Importing script ${scriptData.name} (${existingId})`,
129297
+ state: state2
129298
+ });
129299
+ let newId = existingId;
129300
+ if (options.reUuid) {
129301
+ newId = v4_default();
129283
129302
  debugMessage({
129284
- message: `ScriptOps.importScripts: Importing script ${scriptData.name} (${existingId})`,
129303
+ message: `ScriptOps.importScripts: Re-uuid-ing script ${scriptData.name} ${existingId} => ${newId}...`,
129285
129304
  state: state2
129286
129305
  });
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
- }
129306
+ scriptData._id = newId;
129307
+ }
129308
+ if (validate3) {
129309
+ if (!isScriptValid({ scriptData, state: state2 })) {
129310
+ throw new FrodoError(`Script is invalid`);
129304
129311
  }
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);
129312
+ }
129313
+ const result = await updateScript({
129314
+ scriptId: newId,
129315
+ scriptData,
129316
+ state: state2
129317
+ });
129318
+ if (resultCallback) {
129319
+ resultCallback(void 0, result);
129320
+ }
129321
+ response.push(result);
129322
+ } catch (e) {
129323
+ if (resultCallback) {
129324
+ resultCallback(e, void 0);
129325
+ } else {
129326
+ throw new FrodoError(
129327
+ `Error importing script '${importData.script[existingId].name}'`,
129328
+ e
129329
+ );
129313
129330
  }
129314
129331
  }
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
129332
  }
129333
+ debugMessage({ message: `ScriptOps.importScripts: end`, state: state2 });
129334
+ return response;
129326
129335
  }
129327
129336
  async function prepareScriptExport({
129328
129337
  scriptData,
@@ -129498,7 +129507,7 @@ async function updateOAuth2Client({
129498
129507
  debugMessage({ message: `OAuth2ClientOps.putOAuth2Client: end`, state: state2 });
129499
129508
  return response;
129500
129509
  } 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.") {
129510
+ 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
129511
  try {
129503
129512
  const { validAttributes } = error2.response.data.detail;
129504
129513
  validAttributes.push("_id");
@@ -130230,7 +130239,7 @@ async function updateOAuth2TrustedJwtIssuer({
130230
130239
  });
130231
130240
  return response;
130232
130241
  } 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.") {
130242
+ 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
130243
  try {
130235
130244
  const { validAttributes } = error2.response.data.detail;
130236
130245
  validAttributes.push("_id");
@@ -130620,8 +130629,12 @@ var OrganizationOps_default = (state2) => {
130620
130629
  };
130621
130630
  function getRealmManagedOrganization({ state: state2 }) {
130622
130631
  let realmManagedOrg = "organization";
130623
- if (state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY) {
130632
+ if (state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY || state2.getUseRealmPrefixOnManagedObjects() === true) {
130624
130633
  realmManagedOrg = `${state2.getRealm()}_organization`;
130634
+ debugMessage({
130635
+ message: `DeploymentType === cloud or UseRealmPrefixOnManagedObjects is true, returning '${realmManagedOrg}'`,
130636
+ state: state2
130637
+ });
130625
130638
  }
130626
130639
  return realmManagedOrg;
130627
130640
  }
@@ -133509,7 +133522,7 @@ async function readAgents({
133509
133522
  (t) => t !== "SoapSTSAgent" || state2.getDeploymentType() === Constants_default.CLASSIC_DEPLOYMENT_TYPE_KEY
133510
133523
  ).map(
133511
133524
  (agentType) => getAgentsByType({ agentType, state: state2 }).catch((err) => {
133512
- if (err.httpStatus !== 501 && _optionalChain([err, 'access', _116 => _116.response, 'optionalAccess', _117 => _117.status]) !== 501) {
133525
+ if (err.httpStatus !== 501 && _optionalChain([err, 'access', _114 => _114.response, 'optionalAccess', _115 => _115.status]) !== 501) {
133513
133526
  throw err;
133514
133527
  } else {
133515
133528
  return { result: [] };
@@ -134187,7 +134200,7 @@ async function importAgents({
134187
134200
  })
134188
134201
  );
134189
134202
  } catch (error2) {
134190
- if (error2.httpStatus !== 501 && _optionalChain([error2, 'access', _118 => _118.response, 'optionalAccess', _119 => _119.status]) !== 501) {
134203
+ if (error2.httpStatus !== 501 && _optionalChain([error2, 'access', _116 => _116.response, 'optionalAccess', _117 => _117.status]) !== 501) {
134191
134204
  errors.push(
134192
134205
  new FrodoError(
134193
134206
  `Error importing agent ${agentId} of type ${agentType}`,
@@ -134239,7 +134252,7 @@ async function importAgentGroups({
134239
134252
  })
134240
134253
  );
134241
134254
  } catch (error2) {
134242
- if (error2.httpStatus !== 501 && _optionalChain([error2, 'access', _120 => _120.response, 'optionalAccess', _121 => _121.status]) !== 501) {
134255
+ if (error2.httpStatus !== 501 && _optionalChain([error2, 'access', _118 => _118.response, 'optionalAccess', _119 => _119.status]) !== 501) {
134243
134256
  errors.push(
134244
134257
  new FrodoError(
134245
134258
  `Error importing agent group ${agentGroupId} of type ${agentType}`,
@@ -134401,7 +134414,7 @@ async function importAgent({
134401
134414
  }) {
134402
134415
  try {
134403
134416
  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]);
134417
+ const agentType = _optionalChain([importData, 'access', _120 => _120.agent, 'access', _121 => _121[agentId], 'optionalAccess', _122 => _122._type, 'access', _123 => _123._id]);
134405
134418
  if (agentType === "SoapSTSAgent" && state2.getDeploymentType() !== Constants_default.CLASSIC_DEPLOYMENT_TYPE_KEY) {
134406
134419
  throw new FrodoError(
134407
134420
  `Can't import Soap STS agents for '${state2.getDeploymentType()}' deployment type.`
@@ -134427,7 +134440,7 @@ async function importAgentGroup({
134427
134440
  }) {
134428
134441
  try {
134429
134442
  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]);
134443
+ const agentType = _optionalChain([importData, 'access', _124 => _124.agentGroup, 'access', _125 => _125[agentGroupId], 'optionalAccess', _126 => _126._type, 'access', _127 => _127._id]);
134431
134444
  if (agentType === "SoapSTSAgent" && state2.getDeploymentType() !== Constants_default.CLASSIC_DEPLOYMENT_TYPE_KEY) {
134432
134445
  throw new FrodoError(
134433
134446
  `Can't import Soap STS agent groups for '${state2.getDeploymentType()}' deployment type.`
@@ -134455,7 +134468,7 @@ async function importIdentityGatewayAgent({
134455
134468
  message: `AgentOps.importIdentityGatewayAgent: start`,
134456
134469
  state: state2
134457
134470
  });
134458
- const agentType = _optionalChain([importData, 'access', _130 => _130.agent, 'access', _131 => _131[agentId], 'optionalAccess', _132 => _132._type, 'access', _133 => _133._id]);
134471
+ const agentType = _optionalChain([importData, 'access', _128 => _128.agent, 'access', _129 => _129[agentId], 'optionalAccess', _130 => _130._type, 'access', _131 => _131._id]);
134459
134472
  if (agentType !== "IdentityGatewayAgent")
134460
134473
  throw new FrodoError(
134461
134474
  `Wrong agent type! Expected 'IdentityGatewayAgent' but got '${agentType}'.`
@@ -134486,7 +134499,7 @@ async function importJavaAgent({
134486
134499
  }) {
134487
134500
  try {
134488
134501
  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]);
134502
+ const agentType = _optionalChain([importData, 'access', _132 => _132.agent, 'access', _133 => _133[agentId], 'optionalAccess', _134 => _134._type, 'access', _135 => _135._id]);
134490
134503
  if (agentType !== "J2EEAgent")
134491
134504
  throw new FrodoError(
134492
134505
  `Wrong agent type! Expected 'J2EEAgent' but got '${agentType}'.`
@@ -134511,7 +134524,7 @@ async function importWebAgent({
134511
134524
  }) {
134512
134525
  try {
134513
134526
  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]);
134527
+ const agentType = _optionalChain([importData, 'access', _136 => _136.agent, 'access', _137 => _137[agentId], 'optionalAccess', _138 => _138._type, 'access', _139 => _139._id]);
134515
134528
  if (agentType !== "WebAgent")
134516
134529
  throw new FrodoError(
134517
134530
  `Wrong agent type! Expected 'WebAgent' but got '${agentType}'.`
@@ -134969,17 +134982,17 @@ async function getConfigEntity2({
134969
134982
  state2.setRealm(currentRealm);
134970
134983
  return data2;
134971
134984
  } catch (error2) {
134972
- printError({
134973
- error: error2,
134974
- message: `Error getting config entity from resource path '${urlString}'`,
134975
- state: state2
134976
- });
134985
+ throw new FrodoError(
134986
+ `Error getting config entity from resource path '${urlString}'`,
134987
+ error2
134988
+ );
134977
134989
  }
134978
134990
  }
134979
134991
  async function getConfigEntities2({
134980
134992
  includeReadOnly = false,
134981
134993
  onlyRealm = false,
134982
134994
  onlyGlobal = false,
134995
+ resultCallback = void 0,
134983
134996
  state: state2
134984
134997
  }) {
134985
134998
  const realms2 = await getRealmsForExport({ state: state2 });
@@ -134994,22 +135007,19 @@ async function getConfigEntities2({
134994
135007
  }
134995
135008
  const deploymentAllowed = entityInfo.deployments && entityInfo.deployments.includes(state2.getDeploymentType());
134996
135009
  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({
135010
+ entities.global[key] = await getResult(
135011
+ resultCallback,
135012
+ `Error getting '${key}' from resource path '${entityInfo.global.path}'`,
135013
+ getConfigEntity2,
135014
+ {
134999
135015
  state: state2,
135000
135016
  path: entityInfo.global.path,
135001
135017
  version: entityInfo.global.version,
135002
135018
  protocol: entityInfo.global.protocol,
135003
135019
  queryFilter: entityInfo.global.queryFilter ? entityInfo.global.queryFilter : entityInfo.queryFilter,
135004
135020
  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
- }
135021
+ }
135022
+ );
135013
135023
  }
135014
135024
  if ((!onlyGlobal || onlyRealm) && entityInfo.realm && (entityInfo.realm.deployments && entityInfo.realm.deployments.includes(state2.getDeploymentType()) || entityInfo.realm.deployments == void 0 && deploymentAllowed)) {
135015
135025
  const activeRealm = state2.getRealm();
@@ -135017,8 +135027,11 @@ async function getConfigEntities2({
135017
135027
  if (onlyRealm && (activeRealm.startsWith("/") ? activeRealm : "/" + activeRealm) !== stateRealms[i2]) {
135018
135028
  continue;
135019
135029
  }
135020
- try {
135021
- entities.realm[realms2[i2]][key] = await getConfigEntity2({
135030
+ entities.realm[realms2[i2]][key] = await getResult(
135031
+ resultCallback,
135032
+ `Error getting '${key}' from resource path '${entityInfo.realm.path}'`,
135033
+ getConfigEntity2,
135034
+ {
135022
135035
  state: state2,
135023
135036
  path: entityInfo.realm.path,
135024
135037
  version: entityInfo.realm.version,
@@ -135026,14 +135039,8 @@ async function getConfigEntities2({
135026
135039
  realm: stateRealms[i2],
135027
135040
  queryFilter: entityInfo.realm.queryFilter ? entityInfo.realm.queryFilter : entityInfo.queryFilter,
135028
135041
  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
- }
135042
+ }
135043
+ );
135037
135044
  }
135038
135045
  }
135039
135046
  }
@@ -135070,15 +135077,15 @@ async function putConfigEntity2({
135070
135077
  state2.setRealm(currentRealm);
135071
135078
  return data2;
135072
135079
  } catch (error2) {
135073
- printError({
135074
- error: error2,
135075
- message: `Error putting config entity at resource path '${urlString}'`,
135076
- state: state2
135077
- });
135080
+ throw new FrodoError(
135081
+ `Error putting config entity at resource path '${urlString}'`,
135082
+ error2
135083
+ );
135078
135084
  }
135079
135085
  }
135080
135086
  async function putConfigEntities({
135081
135087
  config,
135088
+ resultCallback = void 0,
135082
135089
  state: state2
135083
135090
  }) {
135084
135091
  const realms2 = config.realm ? Object.keys(config.realm) : [];
@@ -135093,26 +135100,23 @@ async function putConfigEntities({
135093
135100
  }
135094
135101
  const deploymentAllowed = entityInfo.deployments && entityInfo.deployments.includes(state2.getDeploymentType());
135095
135102
  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({
135103
+ for (const [id7, entityData] of Object.entries(config.global[key])) {
135104
+ if (!entities.global[key]) {
135105
+ entities.global[key] = {};
135106
+ }
135107
+ entities.global[key][id7] = await getResult(
135108
+ resultCallback,
135109
+ `Error putting entity '${id7}' of type '${key}' to global resource path '${entityInfo.global.path}'`,
135110
+ putConfigEntity2,
135111
+ {
135102
135112
  state: state2,
135103
135113
  entityData,
135104
135114
  path: entityInfo.global.path + (entityInfo.global.importWithId ? `/${id7}` : ""),
135105
135115
  version: entityInfo.global.version,
135106
135116
  protocol: entityInfo.global.protocol,
135107
135117
  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
- });
135118
+ }
135119
+ );
135116
135120
  }
135117
135121
  }
135118
135122
  if (entityInfo.realm && (entityInfo.realm.deployments && entityInfo.realm.deployments.includes(state2.getDeploymentType()) || entityInfo.realm.deployments == void 0 && deploymentAllowed)) {
@@ -135120,14 +135124,17 @@ async function putConfigEntities({
135120
135124
  if (!config.realm[realms2[i2]][key]) {
135121
135125
  continue;
135122
135126
  }
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({
135127
+ for (const [id7, entityData] of Object.entries(
135128
+ config.realm[realms2[i2]][key]
135129
+ )) {
135130
+ if (!entities.realm[realms2[i2]][key]) {
135131
+ entities.realm[realms2[i2]][key] = {};
135132
+ }
135133
+ entities.realm[realms2[i2]][key][id7] = await getResult(
135134
+ resultCallback,
135135
+ `Error putting entity '${id7}' of type '${key}' to realm resource path '${entityInfo.realm.path}'`,
135136
+ putConfigEntity2,
135137
+ {
135131
135138
  state: state2,
135132
135139
  entityData,
135133
135140
  path: entityInfo.realm.path + (entityInfo.realm.importWithId ? `/${id7}` : ""),
@@ -135135,14 +135142,8 @@ async function putConfigEntities({
135135
135142
  protocol: entityInfo.realm.protocol,
135136
135143
  ifMatch: entityInfo.realm.ifMatch,
135137
135144
  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
- });
135145
+ }
135146
+ );
135146
135147
  }
135147
135148
  }
135148
135149
  }
@@ -135154,16 +135155,17 @@ var AmConfigOps_default = (state2) => {
135154
135155
  async createConfigEntityExportTemplate(realms2) {
135155
135156
  return createConfigEntityExportTemplate2({ realms: realms2, state: state2 });
135156
135157
  },
135157
- async exportAmConfigEntities(includeReadOnly = false, onlyRealm = false, onlyGlobal = false) {
135158
+ async exportAmConfigEntities(includeReadOnly = false, onlyRealm = false, onlyGlobal = false, resultCallback = void 0) {
135158
135159
  return exportAmConfigEntities({
135159
135160
  includeReadOnly,
135160
135161
  onlyRealm,
135161
135162
  onlyGlobal,
135163
+ resultCallback,
135162
135164
  state: state2
135163
135165
  });
135164
135166
  },
135165
- async importAmConfigEntities(importData) {
135166
- return importAmConfigEntities({ importData, state: state2 });
135167
+ async importAmConfigEntities(importData, resultCallback = void 0) {
135168
+ return importAmConfigEntities({ importData, resultCallback, state: state2 });
135167
135169
  }
135168
135170
  };
135169
135171
  };
@@ -135184,88 +135186,79 @@ async function exportAmConfigEntities({
135184
135186
  includeReadOnly = false,
135185
135187
  onlyRealm = false,
135186
135188
  onlyGlobal = false,
135189
+ resultCallback = void 0,
135187
135190
  state: state2
135188
135191
  }) {
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({
135192
+ debugMessage({
135193
+ message: `AmConfigOps.exportAmConfigEntities: start`,
135194
+ state: state2
135195
+ });
135196
+ const entities = await getConfigEntities2({
135197
+ includeReadOnly,
135198
+ onlyRealm,
135199
+ onlyGlobal,
135200
+ resultCallback: getErrorCallback(resultCallback),
135201
+ state: state2
135202
+ });
135203
+ const exportData = await createConfigEntityExportTemplate2({
135204
+ state: state2,
135205
+ realms: Object.keys(entities.realm)
135206
+ });
135207
+ const totalEntities = Object.keys(entities.global).length + Object.values(entities.realm).reduce(
135208
+ (total, realmEntities) => total + Object.keys(realmEntities).length,
135209
+ 0
135210
+ );
135211
+ const indicatorId = createProgressIndicator({
135212
+ total: totalEntities,
135213
+ message: "Exporting am config entities...",
135214
+ state: state2
135215
+ });
135216
+ exportData.global = processConfigEntitiesForExport({
135217
+ state: state2,
135218
+ indicatorId,
135219
+ entities: entities.global,
135220
+ resultCallback
135221
+ });
135222
+ Object.entries(entities.realm).forEach(
135223
+ ([key, value]) => exportData.realm[key] = processConfigEntitiesForExport({
135215
135224
  state: state2,
135216
135225
  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
- }
135226
+ entities: value,
135227
+ resultCallback
135228
+ })
135229
+ );
135230
+ stopProgressIndicator({
135231
+ id: indicatorId,
135232
+ message: `Exported ${totalEntities} am config entities.`,
135233
+ state: state2
135234
+ });
135235
+ return exportData;
135242
135236
  }
135243
135237
  async function importAmConfigEntities({
135244
135238
  importData,
135239
+ resultCallback = void 0,
135245
135240
  state: state2
135246
135241
  }) {
135247
135242
  debugMessage({
135248
135243
  message: `ServiceOps.importAmConfigEntities: start`,
135249
135244
  state: state2
135250
135245
  });
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);
135246
+ const result = await putConfigEntities({
135247
+ config: importData,
135248
+ resultCallback,
135249
+ state: state2
135250
+ });
135251
+ debugMessage({ message: `AmConfigOps.importAmConfigEntities: end`, state: state2 });
135252
+ if (Object.keys(result.global).length === 0 && !Object.values(result.realm).find((r) => Object.keys(r).length > 0)) {
135253
+ return null;
135263
135254
  }
135255
+ return result;
135264
135256
  }
135265
135257
  function processConfigEntitiesForExport({
135266
135258
  state: state2,
135267
135259
  entities,
135268
- indicatorId
135260
+ indicatorId,
135261
+ resultCallback
135269
135262
  }) {
135270
135263
  const exportedEntities = {};
135271
135264
  const entries = Object.entries(entities);
@@ -135275,25 +135268,30 @@ function processConfigEntitiesForExport({
135275
135268
  message: `Exporting ${key}`,
135276
135269
  state: state2
135277
135270
  });
135278
- const exportedValue = {};
135279
135271
  if (!value) {
135280
135272
  continue;
135281
135273
  }
135282
135274
  if (!value.result) {
135283
135275
  if (value._id) {
135284
- exportedValue[value._id] = value;
135285
- exportedEntities[key] = exportedValue;
135276
+ exportedEntities[key] = {
135277
+ [value._id]: value
135278
+ };
135286
135279
  } else if (value._type && value._type._id) {
135287
- exportedValue[value._type._id] = value;
135288
- exportedEntities[key] = exportedValue;
135280
+ exportedEntities[key] = {
135281
+ [value._type._id]: value
135282
+ };
135289
135283
  } else {
135290
135284
  exportedEntities[key] = value;
135291
135285
  }
135292
- continue;
135286
+ } else {
135287
+ const { result } = value;
135288
+ const exportedValue = {};
135289
+ result.forEach((o) => exportedValue[o._id] = o);
135290
+ exportedEntities[key] = exportedValue;
135291
+ }
135292
+ if (resultCallback) {
135293
+ resultCallback(void 0, exportedEntities[key]);
135293
135294
  }
135294
- const { result } = value;
135295
- result.forEach((o) => exportedValue[o._id] = o);
135296
- exportedEntities[key] = exportedValue;
135297
135295
  }
135298
135296
  return exportedEntities;
135299
135297
  }
@@ -136354,7 +136352,7 @@ async function createCircleOfTrust2({
136354
136352
  const response = await createCircleOfTrust({ cotData, state: state2 });
136355
136353
  return response;
136356
136354
  } 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") {
136355
+ 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
136356
  try {
136359
136357
  const response = await updateCircleOfTrust({ cotId, cotData, state: state2 });
136360
136358
  return response;
@@ -136381,7 +136379,7 @@ async function updateCircleOfTrust2({
136381
136379
  const response = await updateCircleOfTrust({ cotId, cotData, state: state2 });
136382
136380
  return response || cotData;
136383
136381
  } 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")) {
136382
+ 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
136383
  try {
136386
136384
  const response = await updateCircleOfTrust({ cotId, cotData, state: state2 });
136387
136385
  return response || cotData;
@@ -136777,7 +136775,7 @@ ${providers.map((it) => it.split("|")[0]).join("\n")}.`,
136777
136775
  }
136778
136776
  } catch (error2) {
136779
136777
  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])}`,
136778
+ 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
136779
  state: state2
136782
136780
  });
136783
136781
  errors.push(error2);
@@ -137285,11 +137283,15 @@ function createApplicationExportTemplate({
137285
137283
  };
137286
137284
  }
137287
137285
  function getRealmManagedApplication({ state: state2 }) {
137288
- let realmManagedOrg = "application";
137289
- if (state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY) {
137290
- realmManagedOrg = `${getCurrentRealmName(state2)}_application`;
137286
+ let realmManagedApp = "application";
137287
+ if (state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY || state2.getUseRealmPrefixOnManagedObjects() === true) {
137288
+ realmManagedApp = `${getCurrentRealmName(state2)}_application`;
137289
+ debugMessage({
137290
+ message: `DeploymentType === cloud or UseRealmPrefixOnManagedObjects is true, returning '${realmManagedApp}'`,
137291
+ state: state2
137292
+ });
137291
137293
  }
137292
- return realmManagedOrg;
137294
+ return realmManagedApp;
137293
137295
  }
137294
137296
  async function createApplication({
137295
137297
  applicationId,
@@ -138186,7 +138188,7 @@ async function readFeatures({
138186
138188
  const { result } = await getFeatures({ state: state2 });
138187
138189
  state2.setFeatures(JSON.parse(JSON.stringify(result)));
138188
138190
  } catch (error2) {
138189
- debugMessage({ message: _optionalChain([error2, 'access', _162 => _162.response, 'optionalAccess', _163 => _163.data]), state: state2 });
138191
+ debugMessage({ message: _optionalChain([error2, 'access', _160 => _160.response, 'optionalAccess', _161 => _161.data]), state: state2 });
138190
138192
  state2.setFeatures([]);
138191
138193
  }
138192
138194
  return state2.getFeatures();
@@ -139782,7 +139784,7 @@ async function determineDeploymentType(state2) {
139782
139784
  state: state2
139783
139785
  });
139784
139786
  } 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) {
139787
+ 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
139788
  verboseMessage({
139787
139789
  message: `ForgeRock Identity Cloud`["brightCyan"] + ` detected.`,
139788
139790
  state: state2
@@ -139798,7 +139800,7 @@ async function determineDeploymentType(state2) {
139798
139800
  state: state2
139799
139801
  });
139800
139802
  } 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) {
139803
+ 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
139804
  adminClientId = state2.getAdminClientId() || forgeopsClientId;
139803
139805
  verboseMessage({
139804
139806
  message: `ForgeOps deployment`["brightCyan"] + ` detected.`,
@@ -139998,7 +140000,7 @@ async function getAuthCode(redirectUri, codeChallenge, codeChallengeMethod, stat
139998
140000
  throw error2;
139999
140001
  }
140000
140002
  }
140001
- const redirectLocationURL = _optionalChain([response, 'access', _178 => _178.headers, 'optionalAccess', _179 => _179.location]);
140003
+ const redirectLocationURL = _optionalChain([response, 'access', _176 => _176.headers, 'optionalAccess', _177 => _177.location]);
140002
140004
  const queryObject = _url2.default.parse(redirectLocationURL, true).query;
140003
140005
  if ("code" in queryObject) {
140004
140006
  debugMessage({
@@ -140148,7 +140150,7 @@ async function getFreshSaBearerToken({
140148
140150
  });
140149
140151
  } catch (error2) {
140150
140152
  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: ")])) {
140153
+ 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
140154
  const invalidScopes = err.httpDescription.substring(39).split(",");
140153
140155
  const finalScopes = scope.split(" ").filter((el) => {
140154
140156
  return !invalidScopes.includes(el);
@@ -140265,9 +140267,9 @@ function scheduleAutoRefresh(forceLoginAsUser, autoRefresh, state2) {
140265
140267
  clearTimeout(timer);
140266
140268
  }
140267
140269
  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])
140270
+ 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(
140271
+ _optionalChain([state2, 'access', _187 => _187.getBearerTokenMeta, 'call', _188 => _188(), 'optionalAccess', _189 => _189.expires]),
140272
+ _optionalChain([state2, 'access', _190 => _190.getUserSessionTokenMeta, 'call', _191 => _191(), 'optionalAccess', _192 => _192.expires])
140271
140273
  );
140272
140274
  let timeout4 = expires - Date.now() - 1e3 * 25;
140273
140275
  if (timeout4 < 1e3 * 30) {
@@ -140379,10 +140381,10 @@ async function getTokens({
140379
140381
  throw new FrodoError(`Incomplete or no credentials`);
140380
140382
  }
140381
140383
  if (state2.getCookieValue() || state2.getUseBearerTokenForAmApis() && state2.getBearerToken()) {
140382
- if (_optionalChain([state2, 'access', _195 => _195.getBearerTokenMeta, 'call', _196 => _196(), 'optionalAccess', _197 => _197.from_cache])) {
140384
+ if (_optionalChain([state2, 'access', _193 => _193.getBearerTokenMeta, 'call', _194 => _194(), 'optionalAccess', _195 => _195.from_cache])) {
140383
140385
  verboseMessage({ message: `Using cached bearer token.`, state: state2 });
140384
140386
  }
140385
- if (!state2.getUseBearerTokenForAmApis() && _optionalChain([state2, 'access', _198 => _198.getUserSessionTokenMeta, 'call', _199 => _199(), 'optionalAccess', _200 => _200.from_cache])) {
140387
+ if (!state2.getUseBearerTokenForAmApis() && _optionalChain([state2, 'access', _196 => _196.getUserSessionTokenMeta, 'call', _197 => _197(), 'optionalAccess', _198 => _198.from_cache])) {
140386
140388
  verboseMessage({ message: `Using cached session token.`, state: state2 });
140387
140389
  }
140388
140390
  scheduleAutoRefresh(forceLoginAsUser, autoRefresh, state2);
@@ -140788,7 +140790,7 @@ async function readSecretStoreMappings({
140788
140790
  });
140789
140791
  return result;
140790
140792
  } catch (error2) {
140791
- if (error2.httpStatus === 404 || _optionalChain([error2, 'access', _201 => _201.response, 'optionalAccess', _202 => _202.status]) === 404) {
140793
+ if (error2.httpStatus === 404 || _optionalChain([error2, 'access', _199 => _199.response, 'optionalAccess', _200 => _200.status]) === 404) {
140792
140794
  } else {
140793
140795
  throw new FrodoError(
140794
140796
  `Error reading secret store mappings for the secret store '${secretStoreId}'`,
@@ -141402,7 +141404,7 @@ async function importServers({
141402
141404
  state: state2
141403
141405
  });
141404
141406
  } 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") {
141407
+ 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
141408
  throw new FrodoError(
141407
141409
  `Error creating server with id '${server._id}' and URL '${server.url}'`,
141408
141410
  e
@@ -141884,7 +141886,7 @@ async function updateAdminFederationProvider({
141884
141886
  });
141885
141887
  return response;
141886
141888
  } 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.") {
141889
+ 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
141890
  const { validAttributes } = importError.response.data.detail;
141889
141891
  validAttributes.push("_id", "_type");
141890
141892
  for (const attribute of Object.keys(providerData)) {
@@ -143798,7 +143800,7 @@ async function getEsvCount2({
143798
143800
  }
143799
143801
  }
143800
143802
  var logsTailURLTemplate = "%s/monitoring/logs/tail?source=%s";
143801
- var logsFetchURLTemplate = "%s/monitoring/logs?source=%s&beginTime=%s&endTime=%s";
143803
+ var logsFetchURLTemplate = "%s/monitoring/logs?source=%s";
143802
143804
  var logsSourcesURLTemplate = "%s/monitoring/logs/sources";
143803
143805
  var logsCreateAPIKeyAndSecretURLTemplate = "%s/keys?_action=create";
143804
143806
  var logsGetAPIKeysURLTemplate = "%s/keys";
@@ -143905,15 +143907,25 @@ async function fetch2({
143905
143907
  startTs,
143906
143908
  endTs,
143907
143909
  cookie,
143910
+ txid,
143911
+ filter: filter2,
143908
143912
  state: state2
143909
143913
  }) {
143910
143914
  let urlString = _util2.default.format(
143911
143915
  logsFetchURLTemplate,
143912
143916
  getHostOnlyUrl(state2.getHost()),
143913
- encodeURIComponent(source),
143914
- startTs,
143915
- endTs
143917
+ encodeURIComponent(source)
143916
143918
  );
143919
+ if (startTs && endTs) {
143920
+ urlString += `&beginTime=${startTs}&endTime=${endTs}`;
143921
+ }
143922
+ if (txid) {
143923
+ urlString += `&transactionId=${txid}`;
143924
+ }
143925
+ if (filter2) {
143926
+ const filterParam = `_queryFilter=${filter2}`;
143927
+ urlString += `&${encodeURIComponent(filterParam)}`;
143928
+ }
143917
143929
  if (cookie) {
143918
143930
  urlString += `&_pagedResultsCookie=${encodeURIComponent(cookie)}`;
143919
143931
  }
@@ -143958,8 +143970,8 @@ var LogOps_default = (state2) => {
143958
143970
  tail(source, cookie) {
143959
143971
  return tail2({ source, cookie, state: state2 });
143960
143972
  },
143961
- async fetch(source, startTs, endTs, cookie) {
143962
- return fetch3({ source, startTs, endTs, cookie, state: state2 });
143973
+ async fetch(source, startTs, endTs, cookie, txid, filter2) {
143974
+ return fetch3({ source, startTs, endTs, cookie, txid, filter: filter2, state: state2 });
143963
143975
  }
143964
143976
  };
143965
143977
  };
@@ -144278,10 +144290,12 @@ async function fetch3({
144278
144290
  startTs,
144279
144291
  endTs,
144280
144292
  cookie,
144293
+ txid,
144294
+ filter: filter2,
144281
144295
  state: state2
144282
144296
  }) {
144283
144297
  try {
144284
- return fetch2({ source, startTs, endTs, cookie, state: state2 });
144298
+ return fetch2({ source, startTs, endTs, cookie, txid, filter: filter2, state: state2 });
144285
144299
  } catch (error2) {
144286
144300
  throw new FrodoError(`Error fetching logs`, error2);
144287
144301
  }
@@ -145735,7 +145749,7 @@ async function checkForUpdates({
145735
145749
  state: state2
145736
145750
  });
145737
145751
  }
145738
- const updateCount = _optionalChain([updates, 'access', _213 => _213.secrets, 'optionalAccess', _214 => _214.length]) + _optionalChain([updates, 'access', _215 => _215.variables, 'optionalAccess', _216 => _216.length]) || 0;
145752
+ const updateCount = _optionalChain([updates, 'access', _211 => _211.secrets, 'optionalAccess', _212 => _212.length]) + _optionalChain([updates, 'access', _213 => _213.variables, 'optionalAccess', _214 => _214.length]) || 0;
145739
145753
  if (updateCount > 0) {
145740
145754
  stopProgressIndicator({
145741
145755
  id: indicatorId,
@@ -145828,7 +145842,7 @@ async function applyUpdates({
145828
145842
  } catch (error2) {
145829
145843
  stopProgressIndicator({
145830
145844
  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])}`,
145845
+ 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
145846
  status: "fail",
145833
145847
  state: state2
145834
145848
  });
@@ -146091,7 +146105,7 @@ async function updateSocialIdentityProvider({
146091
146105
  });
146092
146106
  return response;
146093
146107
  } 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.") {
146108
+ 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
146109
  const { validAttributes } = error2.response.data.detail;
146096
146110
  validAttributes.push("_id", "_type");
146097
146111
  for (const attribute of Object.keys(providerData)) {
@@ -148575,8 +148589,8 @@ var JourneyOps_default = (state2) => {
148575
148589
  useStringArrays: true,
148576
148590
  deps: true,
148577
148591
  coords: true
148578
- }) {
148579
- return exportJourneys({ options, state: state2 });
148592
+ }, resultCallback = void 0) {
148593
+ return exportJourneys({ options, resultCallback, state: state2 });
148580
148594
  },
148581
148595
  async readJourneys() {
148582
148596
  return readJourneys({ state: state2 });
@@ -148602,8 +148616,13 @@ var JourneyOps_default = (state2) => {
148602
148616
  index2
148603
148617
  );
148604
148618
  },
148605
- async importJourneys(treesMap, options) {
148606
- return importJourneys({ importData: treesMap, options, state: state2 });
148619
+ async importJourneys(treesMap, options, resultCallback = void 0) {
148620
+ return importJourneys({
148621
+ importData: treesMap,
148622
+ options,
148623
+ resultCallback,
148624
+ state: state2
148625
+ });
148607
148626
  },
148608
148627
  getNodeRef(nodeObj, singleTreeExport) {
148609
148628
  return getNodeRef(nodeObj, singleTreeExport);
@@ -148636,8 +148655,8 @@ var JourneyOps_default = (state2) => {
148636
148655
  async deleteJourney(journeyId, options) {
148637
148656
  return deleteJourney({ journeyId, options, state: state2 });
148638
148657
  },
148639
- async deleteJourneys(options) {
148640
- return deleteJourneys({ options, state: state2 });
148658
+ async deleteJourneys(options, resultCallback = void 0) {
148659
+ return deleteJourneys({ options, resultCallback, state: state2 });
148641
148660
  },
148642
148661
  async enableJourney(journeyId) {
148643
148662
  return enableJourney({ journeyId, state: state2 });
@@ -148797,7 +148816,7 @@ async function getSaml2NodeDependencies(nodeObject, allProviders, allCirclesOfTr
148797
148816
  }
148798
148817
  saml2EntityPromises.push(providerResponse);
148799
148818
  } 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}`;
148819
+ error2.message = `Error reading saml2 dependencies: ${_optionalChain([error2, 'access', _226 => _226.response, 'optionalAccess', _227 => _227.data, 'optionalAccess', _228 => _228.message]) || error2.message}`;
148801
148820
  errors.push(error2);
148802
148821
  }
148803
148822
  }
@@ -148826,7 +148845,7 @@ async function getSaml2NodeDependencies(nodeObject, allProviders, allCirclesOfTr
148826
148845
  circlesOfTrust
148827
148846
  };
148828
148847
  } 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}`;
148848
+ error2.message = `Error reading saml2 dependencies: ${_optionalChain([error2, 'access', _229 => _229.response, 'optionalAccess', _230 => _230.data, 'optionalAccess', _231 => _231.message]) || error2.message}`;
148830
148849
  errors.push(error2);
148831
148850
  }
148832
148851
  if (errors.length) {
@@ -148937,7 +148956,7 @@ async function exportJourney({
148937
148956
  });
148938
148957
  emailTemplatePromises.push(emailTemplate);
148939
148958
  } 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}`;
148959
+ 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
148960
  errors.push(error2);
148942
148961
  }
148943
148962
  }
@@ -149239,7 +149258,7 @@ async function exportJourney({
149239
149258
  for (const themeObject of themePromiseResults) {
149240
149259
  if (themeObject && // has the theme been specified by id or name in a page node?
149241
149260
  (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)]))) {
149261
+ _optionalChain([themeObject, 'access', _235 => _235.linkedTrees, 'optionalAccess', _236 => _236.includes, 'call', _237 => _237(treeObject._id)]))) {
149243
149262
  if (verbose)
149244
149263
  printMessage({
149245
149264
  message: `
@@ -149281,57 +149300,41 @@ async function exportJourneys({
149281
149300
  deps: true,
149282
149301
  coords: true
149283
149302
  },
149303
+ resultCallback = void 0,
149284
149304
  state: state2
149285
149305
  }) {
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({
149306
+ const multiTreeExport = createMultiTreeExportTemplate({ state: state2 });
149307
+ const trees = await readJourneys({ state: state2 });
149308
+ const indicatorId = createProgressIndicator({
149309
+ total: trees.length,
149310
+ message: "Exporting journeys...",
149311
+ state: state2
149312
+ });
149313
+ for (const tree of trees) {
149314
+ updateProgressIndicator({
149325
149315
  id: indicatorId,
149326
- message: `Error exporting journeys.`,
149327
- status: "fail",
149316
+ message: `Exporting journey ${tree._id}`,
149328
149317
  state: state2
149329
149318
  });
149330
- if (errors.length > 0) {
149331
- throw error2;
149332
- }
149333
- throw new FrodoError(`Error exporting journeys`, error2);
149319
+ const exportData = await getResult(
149320
+ resultCallback,
149321
+ `Error exporting the journey ${tree._id}`,
149322
+ exportJourney,
149323
+ {
149324
+ journeyId: tree._id,
149325
+ options,
149326
+ state: state2
149327
+ }
149328
+ );
149329
+ delete exportData.meta;
149330
+ multiTreeExport.trees[tree._id] = exportData;
149334
149331
  }
149332
+ stopProgressIndicator({
149333
+ id: indicatorId,
149334
+ message: `Exported ${trees.length} journeys.`,
149335
+ state: state2
149336
+ });
149337
+ return multiTreeExport;
149335
149338
  }
149336
149339
  async function readJourneys({
149337
149340
  state: state2
@@ -149522,7 +149525,7 @@ async function importJourney({
149522
149525
  state: state2
149523
149526
  });
149524
149527
  } 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") {
149528
+ 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
149529
  providerData["redirectAfterFormPostURI"] = "";
149527
149530
  try {
149528
149531
  await putProviderByTypeAndId2({
@@ -149633,7 +149636,7 @@ async function importJourney({
149633
149636
  try {
149634
149637
  await createCircleOfTrust({ cotData, state: state2 });
149635
149638
  } 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) {
149639
+ if (_optionalChain([error2, 'access', _243 => _243.response, 'optionalAccess', _244 => _244.status]) === 409 || _optionalChain([error2, 'access', _245 => _245.response, 'optionalAccess', _246 => _246.status]) === 500) {
149637
149640
  try {
149638
149641
  await updateCircleOfTrust({ cotId, cotData, state: state2 });
149639
149642
  } catch (updateCotErr) {
@@ -149720,12 +149723,12 @@ async function importJourney({
149720
149723
  state: state2
149721
149724
  });
149722
149725
  } 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") {
149726
+ 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
149727
  throw new FrodoError(
149725
149728
  `Missing script ${innerNodeData["script"]} referenced by inner node ${innerNodeId}${innerNodeId === newUuid ? "" : ` [${newUuid}]`} (${innerNodeData["_type"]["_id"]}) in journey ${treeId}`,
149726
149729
  nodeImportError
149727
149730
  );
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.") {
149731
+ } 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
149732
  const { validAttributes } = nodeImportError.response.data.detail;
149730
149733
  validAttributes.push("_id");
149731
149734
  for (const attribute of Object.keys(innerNodeData)) {
@@ -149754,7 +149757,7 @@ async function importJourney({
149754
149757
  nodeImportError2
149755
149758
  );
149756
149759
  }
149757
- } else if (_optionalChain([nodeImportError, 'access', _259 => _259.response, 'optionalAccess', _260 => _260.status]) === 404) {
149760
+ } else if (_optionalChain([nodeImportError, 'access', _257 => _257.response, 'optionalAccess', _258 => _258.status]) === 404) {
149758
149761
  throw new FrodoError(
149759
149762
  `Unable to import node ${innerNodeId}${innerNodeId === newUuid ? "" : ` [${newUuid}]`} in journey ${treeId} because its type ${innerNodeData._type._id} doesn't exist in deployment`,
149760
149763
  nodeImportError
@@ -149829,12 +149832,12 @@ async function importJourney({
149829
149832
  try {
149830
149833
  await putNode({ nodeId: newUuid, nodeType, nodeData, state: state2 });
149831
149834
  } 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") {
149835
+ 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
149836
  throw new FrodoError(
149834
149837
  `Missing script ${nodeData["script"]} referenced by node ${nodeId}${nodeId === newUuid ? "" : ` [${newUuid}]`} (${nodeData["_type"]["_id"]}) in journey ${treeId}`,
149835
149838
  nodeImportError
149836
149839
  );
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.") {
149840
+ } 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
149841
  const { validAttributes } = nodeImportError.response.data.detail;
149839
149842
  validAttributes.push("_id");
149840
149843
  for (const attribute of Object.keys(nodeData)) {
@@ -149858,7 +149861,7 @@ async function importJourney({
149858
149861
  nodeImportError2
149859
149862
  );
149860
149863
  }
149861
- } else if (_optionalChain([nodeImportError, 'access', _271 => _271.response, 'optionalAccess', _272 => _272.status]) === 404) {
149864
+ } else if (_optionalChain([nodeImportError, 'access', _269 => _269.response, 'optionalAccess', _270 => _270.status]) === 404) {
149862
149865
  throw new FrodoError(
149863
149866
  `Unable to import node ${nodeId}${nodeId === newUuid ? "" : ` [${newUuid}]`} in journey ${treeId} because its type ${nodeData._type._id} doesn't exist in deployment`,
149864
149867
  nodeImportError
@@ -149922,7 +149925,7 @@ async function importJourney({
149922
149925
  state: state2
149923
149926
  });
149924
149927
  } 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.") {
149928
+ 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
149929
  const { validAttributes } = importError.response.data.detail;
149927
149930
  validAttributes.push("_id");
149928
149931
  for (const attribute of Object.keys(importData.tree)) {
@@ -150020,10 +150023,10 @@ async function resolveDependencies(installedJorneys, journeyMap, unresolvedJourn
150020
150023
  async function importJourneys({
150021
150024
  importData,
150022
150025
  options,
150026
+ resultCallback = void 0,
150023
150027
  state: state2
150024
150028
  }) {
150025
150029
  const response = [];
150026
- const errors = [];
150027
150030
  const installedJourneys = (await readJourneys({ state: state2 })).map((x) => x._id);
150028
150031
  const unresolvedJourneys = {};
150029
150032
  const resolvedJourneys = [];
@@ -150067,26 +150070,18 @@ async function importJourneys({
150067
150070
  state: state2
150068
150071
  });
150069
150072
  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);
150073
+ const result = await getResult(
150074
+ resultCallback,
150075
+ `Error importing the journey ${tree._id}`,
150076
+ importJourney,
150077
+ {
150078
+ importData: importData.trees[tree],
150079
+ options,
150080
+ state: state2
150081
+ }
150082
+ );
150083
+ response.push(result);
150084
+ updateProgressIndicator({ id: indicatorId, message: `${tree}`, state: state2 });
150090
150085
  }
150091
150086
  stopProgressIndicator({
150092
150087
  id: indicatorId,
@@ -150134,7 +150129,7 @@ var fileByIdTreeExportResolver = async function(treeId, state2) {
150134
150129
  message: `fileByIdTreeExportResolver: resolved '${treeId}' to ${file}`,
150135
150130
  state: state2
150136
150131
  });
150137
- if (_optionalChain([jsonData, 'access', _278 => _278.tree, 'optionalAccess', _279 => _279._id]) === treeId) {
150132
+ if (_optionalChain([jsonData, 'access', _276 => _276.tree, 'optionalAccess', _277 => _277._id]) === treeId) {
150138
150133
  treeExport = jsonData;
150139
150134
  } else if (jsonData.trees && jsonData.trees[treeId]) {
150140
150135
  treeExport = jsonData.trees[treeId];
@@ -150153,7 +150148,7 @@ function createFileParamTreeExportResolver(file, state2) {
150153
150148
  let treeExport = createSingleTreeExportTemplate({ state: state2 });
150154
150149
  try {
150155
150150
  const jsonData = JSON.parse(fs35.default.readFileSync(file, "utf8"));
150156
- if (_optionalChain([jsonData, 'access', _280 => _280.tree, 'optionalAccess', _281 => _281._id]) === treeId) {
150151
+ if (_optionalChain([jsonData, 'access', _278 => _278.tree, 'optionalAccess', _279 => _279._id]) === treeId) {
150157
150152
  treeExport = jsonData;
150158
150153
  } else if (jsonData.trees && jsonData.trees[treeId]) {
150159
150154
  treeExport = jsonData.trees[treeId];
@@ -150378,7 +150373,7 @@ async function deleteJourney({
150378
150373
  });
150379
150374
  return response2;
150380
150375
  }).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") {
150376
+ 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
150377
  status.nodes[containerNode._id] = { status: "success" };
150383
150378
  if (verbose)
150384
150379
  printMessage({
@@ -150477,19 +150472,19 @@ async function deleteJourney({
150477
150472
  }
150478
150473
  async function deleteJourneys({
150479
150474
  options,
150475
+ resultCallback = void 0,
150480
150476
  state: state2
150481
150477
  }) {
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) {
150478
+ const { verbose } = options;
150479
+ const status = {};
150480
+ const trees = (await getTrees({ state: state2 })).result;
150481
+ const indicatorId = createProgressIndicator({
150482
+ total: trees.length,
150483
+ message: "Deleting journeys...",
150484
+ state: state2
150485
+ });
150486
+ for (const tree of trees) {
150487
+ try {
150493
150488
  if (verbose) printMessage({ message: "", state: state2 });
150494
150489
  options["progress"] = false;
150495
150490
  status[tree._id] = await deleteJourney({
@@ -150506,34 +150501,35 @@ async function deleteJourneys({
150506
150501
  await new Promise((r) => {
150507
150502
  setTimeout(r, 100);
150508
150503
  });
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;
150504
+ } catch (e) {
150505
+ if (resultCallback) {
150506
+ resultCallback(e, void 0);
150507
+ } else {
150508
+ throw new FrodoError(`Error deleting the journey ${tree._id}`, e);
150520
150509
  }
150521
150510
  }
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
150511
  }
150512
+ let journeyCount = 0;
150513
+ let journeyErrorCount = 0;
150514
+ let nodeCount = 0;
150515
+ let nodeErrorCount = 0;
150516
+ for (const journey of Object.keys(status)) {
150517
+ journeyCount += 1;
150518
+ if (status[journey].status === "error") journeyErrorCount += 1;
150519
+ for (const node2 of Object.keys(status[journey].nodes)) {
150520
+ nodeCount += 1;
150521
+ if (status[journey].nodes[node2].status === "error") nodeErrorCount += 1;
150522
+ }
150523
+ if (resultCallback) {
150524
+ resultCallback(void 0, status[journey]);
150525
+ }
150526
+ }
150527
+ stopProgressIndicator({
150528
+ id: indicatorId,
150529
+ message: `Deleted ${journeyCount - journeyErrorCount}/${journeyCount} journeys and ${nodeCount - nodeErrorCount}/${nodeCount} nodes.`,
150530
+ state: state2
150531
+ });
150532
+ return status;
150537
150533
  }
150538
150534
  async function enableJourney({
150539
150535
  journeyId,
@@ -151370,7 +151366,7 @@ async function importPolicySet({
151370
151366
  response = await createPolicySet({ policySetData, state: state2 });
151371
151367
  imported.push(id7);
151372
151368
  } catch (error2) {
151373
- if (_optionalChain([error2, 'access', _285 => _285.response, 'optionalAccess', _286 => _286.status]) === 409) {
151369
+ if (_optionalChain([error2, 'access', _283 => _283.response, 'optionalAccess', _284 => _284.status]) === 409) {
151374
151370
  response = await updatePolicySet({ policySetData, state: state2 });
151375
151371
  imported.push(id7);
151376
151372
  } else throw error2;
@@ -151429,7 +151425,7 @@ async function importFirstPolicySet({
151429
151425
  response = await createPolicySet({ policySetData, state: state2 });
151430
151426
  imported.push(id7);
151431
151427
  } catch (error2) {
151432
- if (_optionalChain([error2, 'access', _287 => _287.response, 'optionalAccess', _288 => _288.status]) === 409) {
151428
+ if (_optionalChain([error2, 'access', _285 => _285.response, 'optionalAccess', _286 => _286.status]) === 409) {
151433
151429
  response = await updatePolicySet({ policySetData, state: state2 });
151434
151430
  imported.push(id7);
151435
151431
  } else throw error2;
@@ -151483,7 +151479,7 @@ async function importPolicySets({
151483
151479
  try {
151484
151480
  response.push(await createPolicySet({ policySetData, state: state2 }));
151485
151481
  } catch (error2) {
151486
- if (_optionalChain([error2, 'access', _289 => _289.response, 'optionalAccess', _290 => _290.status]) === 409) {
151482
+ if (_optionalChain([error2, 'access', _287 => _287.response, 'optionalAccess', _288 => _288.status]) === 409) {
151487
151483
  response.push(await updatePolicySet({ policySetData, state: state2 }));
151488
151484
  } else throw error2;
151489
151485
  }
@@ -151701,7 +151697,7 @@ async function exportResourceType({
151701
151697
  debugMessage({ message: `ResourceTypeOps.exportResourceType: end`, state: state2 });
151702
151698
  return exportData;
151703
151699
  } catch (error2) {
151704
- if (_optionalChain([error2, 'access', _291 => _291.response, 'optionalAccess', _292 => _292.status]) === 404) {
151700
+ if (_optionalChain([error2, 'access', _289 => _289.response, 'optionalAccess', _290 => _290.status]) === 404) {
151705
151701
  throw new FrodoError(
151706
151702
  `Resource type ${resourceTypeUuid} does not exist`,
151707
151703
  error2
@@ -151795,7 +151791,7 @@ async function importResourceType({
151795
151791
  try {
151796
151792
  response = await createResourceType({ resourceTypeData, state: state2 });
151797
151793
  } catch (createError) {
151798
- if (_optionalChain([createError, 'access', _293 => _293.response, 'optionalAccess', _294 => _294.status]) === 409)
151794
+ if (_optionalChain([createError, 'access', _291 => _291.response, 'optionalAccess', _292 => _292.status]) === 409)
151799
151795
  response = await putResourceType({
151800
151796
  resourceTypeUuid: id7,
151801
151797
  resourceTypeData,
@@ -151838,7 +151834,7 @@ async function importResourceTypeByName({
151838
151834
  try {
151839
151835
  response = await createResourceType({ resourceTypeData, state: state2 });
151840
151836
  } catch (createError) {
151841
- if (_optionalChain([createError, 'access', _295 => _295.response, 'optionalAccess', _296 => _296.status]) === 409)
151837
+ if (_optionalChain([createError, 'access', _293 => _293.response, 'optionalAccess', _294 => _294.status]) === 409)
151842
151838
  response = await putResourceType({
151843
151839
  resourceTypeUuid: id7,
151844
151840
  resourceTypeData,
@@ -151880,7 +151876,7 @@ async function importFirstResourceType({
151880
151876
  try {
151881
151877
  response = await createResourceType({ resourceTypeData, state: state2 });
151882
151878
  } catch (createError) {
151883
- if (_optionalChain([createError, 'access', _297 => _297.response, 'optionalAccess', _298 => _298.status]) === 409)
151879
+ if (_optionalChain([createError, 'access', _295 => _295.response, 'optionalAccess', _296 => _296.status]) === 409)
151884
151880
  response = await putResourceType({
151885
151881
  resourceTypeUuid: id7,
151886
151882
  resourceTypeData,
@@ -151915,7 +151911,7 @@ async function importResourceTypes({
151915
151911
  try {
151916
151912
  response.push(await createResourceType({ resourceTypeData, state: state2 }));
151917
151913
  } catch (createError) {
151918
- if (_optionalChain([createError, 'access', _299 => _299.response, 'optionalAccess', _300 => _300.status]) === 409)
151914
+ if (_optionalChain([createError, 'access', _297 => _297.response, 'optionalAccess', _298 => _298.status]) === 409)
151919
151915
  response.push(
151920
151916
  await putResourceType({
151921
151917
  resourceTypeUuid: id7,
@@ -152900,7 +152896,7 @@ async function exportScriptTypes({
152900
152896
  state: state2
152901
152897
  });
152902
152898
  } catch (e) {
152903
- if (e.httpStatus === 404 || _optionalChain([e, 'access', _301 => _301.response, 'optionalAccess', _302 => _302.status]) === 404) {
152899
+ if (e.httpStatus === 404 || _optionalChain([e, 'access', _299 => _299.response, 'optionalAccess', _300 => _300.status]) === 404) {
152904
152900
  } else {
152905
152901
  printMessage({
152906
152902
  message: `Unable to get engine configuration for script type '${scriptType._id}': ${e.message}`,
@@ -153303,8 +153299,8 @@ async function getFullServices({
153303
153299
  nextDescendents
153304
153300
  };
153305
153301
  } 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]);
153302
+ 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.")) {
153303
+ const message = _optionalChain([error2, 'access', _306 => _306.response, 'optionalAccess', _307 => _307.data, 'optionalAccess', _308 => _308.message]);
153308
153304
  printMessage({
153309
153305
  message: `Unable to retrieve data for ${listItem._id} with error: ${message}`,
153310
153306
  type: "error",
@@ -153345,7 +153341,7 @@ async function putFullService({
153345
153341
  debugMessage({ message: `ServiceOps.putFullService: clean`, state: state2 });
153346
153342
  await deleteFullService({ serviceId, globalConfig, state: state2 });
153347
153343
  } 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")) {
153344
+ 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
153345
  throw new FrodoError(
153350
153346
  `Error deleting service '${serviceId}' before import`,
153351
153347
  error2
@@ -153522,8 +153518,8 @@ async function deleteFullServices({
153522
153518
  state: state2
153523
153519
  });
153524
153520
  } 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]);
153521
+ 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.")) {
153522
+ const message = _optionalChain([error2, 'access', _319 => _319.response, 'optionalAccess', _320 => _320.data, 'optionalAccess', _321 => _321.message]);
153527
153523
  printMessage({
153528
153524
  message: `Delete service '${serviceListItem._id}': ${message}`,
153529
153525
  state: state2,
@@ -153704,8 +153700,8 @@ var ConfigOps_default = (state2) => {
153704
153700
  includeReadOnly: false,
153705
153701
  onlyRealm: false,
153706
153702
  onlyGlobal: false
153707
- }, collectErrors) {
153708
- return exportFullConfiguration({ options, collectErrors, state: state2 });
153703
+ }, resultCallback = void 0) {
153704
+ return exportFullConfiguration({ options, resultCallback, state: state2 });
153709
153705
  },
153710
153706
  async importFullConfiguration(importData, options = {
153711
153707
  reUuidJourneys: false,
@@ -153713,11 +153709,11 @@ var ConfigOps_default = (state2) => {
153713
153709
  cleanServices: false,
153714
153710
  includeDefault: false,
153715
153711
  includeActiveValues: true
153716
- }, collectErrors) {
153712
+ }, resultCallback = void 0) {
153717
153713
  return importFullConfiguration({
153718
153714
  importData,
153719
153715
  options,
153720
- collectErrors,
153716
+ resultCallback,
153721
153717
  state: state2
153722
153718
  });
153723
153719
  }
@@ -153735,15 +153731,9 @@ async function exportFullConfiguration({
153735
153731
  onlyRealm: false,
153736
153732
  onlyGlobal: false
153737
153733
  },
153738
- collectErrors,
153734
+ resultCallback = void 0,
153739
153735
  state: state2
153740
153736
  }) {
153741
- let errors = [];
153742
- let throwErrors = true;
153743
- if (collectErrors && Array.isArray(collectErrors)) {
153744
- throwErrors = false;
153745
- errors = collectErrors;
153746
- }
153747
153737
  const {
153748
153738
  useStringArrays,
153749
153739
  noDecode,
@@ -153762,12 +153752,19 @@ async function exportFullConfiguration({
153762
153752
  const isCloudDeployment = state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY;
153763
153753
  const isForgeOpsDeployment = state2.getDeploymentType() === Constants_default.FORGEOPS_DEPLOYMENT_TYPE_KEY;
153764
153754
  const isPlatformDeployment = isCloudDeployment || isForgeOpsDeployment;
153765
- const config = await exportAmConfigEntities({
153766
- includeReadOnly,
153767
- onlyRealm,
153768
- onlyGlobal,
153769
- state: state2
153770
- });
153755
+ const errorCallback = getErrorCallback(resultCallback);
153756
+ const config = await exportWithErrorHandling(
153757
+ exportAmConfigEntities,
153758
+ {
153759
+ includeReadOnly,
153760
+ onlyRealm,
153761
+ onlyGlobal,
153762
+ errorCallback,
153763
+ state: state2
153764
+ },
153765
+ "AM Config Entities",
153766
+ resultCallback
153767
+ );
153771
153768
  let globalConfig = {};
153772
153769
  if (!onlyRealm || onlyGlobal) {
153773
153770
  const mappings = await exportWithErrorHandling(
@@ -153781,13 +153778,15 @@ async function exportFullConfiguration({
153781
153778
  },
153782
153779
  state: state2
153783
153780
  },
153784
- errors,
153781
+ "Mappings",
153782
+ resultCallback,
153785
153783
  isPlatformDeployment
153786
153784
  );
153787
153785
  const serverExport = await exportWithErrorHandling(
153788
153786
  exportServers,
153789
153787
  { options: { includeDefault: true }, state: state2 },
153790
- errors,
153788
+ "Servers",
153789
+ resultCallback,
153791
153790
  isClassicDeployment
153792
153791
  );
153793
153792
  if (serverExport) {
@@ -153797,21 +153796,24 @@ async function exportFullConfiguration({
153797
153796
  agent: await _asyncOptionalChain([(await exportWithErrorHandling(
153798
153797
  exportAgents,
153799
153798
  globalStateObj,
153800
- errors,
153799
+ "Global Agents",
153800
+ resultCallback,
153801
153801
  isClassicDeployment
153802
- )), 'optionalAccess', async _324 => _324.agent]),
153802
+ )), 'optionalAccess', async _322 => _322.agent]),
153803
153803
  authentication: await _asyncOptionalChain([(await exportWithErrorHandling(
153804
153804
  exportAuthenticationSettings,
153805
153805
  globalStateObj,
153806
- errors,
153806
+ "Global Authentication Settings",
153807
+ resultCallback,
153807
153808
  isClassicDeployment
153808
- )), 'optionalAccess', async _325 => _325.authentication]),
153809
+ )), 'optionalAccess', async _323 => _323.authentication]),
153809
153810
  emailTemplate: await _asyncOptionalChain([(await exportWithErrorHandling(
153810
153811
  exportEmailTemplates,
153811
153812
  stateObj,
153812
- errors,
153813
+ "Email Templates",
153814
+ resultCallback,
153813
153815
  isPlatformDeployment
153814
- )), 'optionalAccess', async _326 => _326.emailTemplate]),
153816
+ )), 'optionalAccess', async _324 => _324.emailTemplate]),
153815
153817
  idm: await _asyncOptionalChain([(await exportWithErrorHandling(
153816
153818
  exportConfigEntities,
153817
153819
  {
@@ -153819,60 +153821,74 @@ async function exportFullConfiguration({
153819
153821
  envReplaceParams: void 0,
153820
153822
  entitiesToExport: void 0
153821
153823
  },
153824
+ resultCallback: errorCallback,
153822
153825
  state: state2
153823
153826
  },
153824
- errors,
153827
+ "IDM Config Entities",
153828
+ resultCallback,
153825
153829
  isPlatformDeployment
153826
- )), 'optionalAccess', async _327 => _327.idm]),
153830
+ )), 'optionalAccess', async _325 => _325.idm]),
153827
153831
  internalRole: await _asyncOptionalChain([(await exportWithErrorHandling(
153828
153832
  exportInternalRoles,
153829
153833
  stateObj,
153830
- errors,
153834
+ "Internal Roles",
153835
+ resultCallback,
153831
153836
  isPlatformDeployment
153832
- )), 'optionalAccess', async _328 => _328.internalRole]),
153833
- mapping: _optionalChain([mappings, 'optionalAccess', _329 => _329.mapping]),
153837
+ )), 'optionalAccess', async _326 => _326.internalRole]),
153838
+ mapping: _optionalChain([mappings, 'optionalAccess', _327 => _327.mapping]),
153834
153839
  realm: await _asyncOptionalChain([(await exportWithErrorHandling(
153835
153840
  exportRealms,
153836
153841
  stateObj,
153837
- errors,
153842
+ "Realms",
153843
+ resultCallback,
153838
153844
  includeReadOnly || isClassicDeployment
153839
- )), 'optionalAccess', async _330 => _330.realm]),
153845
+ )), 'optionalAccess', async _328 => _328.realm]),
153840
153846
  scripttype: await _asyncOptionalChain([(await exportWithErrorHandling(
153841
153847
  exportScriptTypes,
153842
153848
  stateObj,
153843
- errors,
153849
+ "Script Types",
153850
+ resultCallback,
153844
153851
  includeReadOnly || isClassicDeployment
153845
- )), 'optionalAccess', async _331 => _331.scripttype]),
153852
+ )), 'optionalAccess', async _329 => _329.scripttype]),
153846
153853
  secret: await _asyncOptionalChain([(await exportWithErrorHandling(
153847
153854
  exportSecrets,
153848
153855
  { options: { includeActiveValues, target }, state: state2 },
153849
- errors,
153856
+ "ESV Secrets",
153857
+ resultCallback,
153850
153858
  isCloudDeployment
153851
- )), 'optionalAccess', async _332 => _332.secret]),
153859
+ )), 'optionalAccess', async _330 => _330.secret]),
153852
153860
  secretstore: await _asyncOptionalChain([(await exportWithErrorHandling(
153853
153861
  exportSecretStores,
153854
153862
  globalStateObj,
153855
- errors,
153863
+ "Global Secret Stores",
153864
+ resultCallback,
153856
153865
  isClassicDeployment
153857
- )), 'optionalAccess', async _333 => _333.secretstore]),
153866
+ )), 'optionalAccess', async _331 => _331.secretstore]),
153858
153867
  server: serverExport,
153859
- service: await _asyncOptionalChain([(await exportWithErrorHandling(exportServices, globalStateObj, errors)), 'optionalAccess', async _334 => _334.service]),
153868
+ service: await _asyncOptionalChain([(await exportWithErrorHandling(
153869
+ exportServices,
153870
+ globalStateObj,
153871
+ "Services",
153872
+ resultCallback
153873
+ )), 'optionalAccess', async _332 => _332.service]),
153860
153874
  site: await _asyncOptionalChain([(await exportWithErrorHandling(
153861
153875
  exportSites,
153862
153876
  stateObj,
153863
- errors,
153877
+ "Sites",
153878
+ resultCallback,
153864
153879
  isClassicDeployment
153865
- )), 'optionalAccess', async _335 => _335.site]),
153866
- sync: _optionalChain([mappings, 'optionalAccess', _336 => _336.sync]),
153880
+ )), 'optionalAccess', async _333 => _333.site]),
153881
+ sync: _optionalChain([mappings, 'optionalAccess', _334 => _334.sync]),
153867
153882
  variable: await _asyncOptionalChain([(await exportWithErrorHandling(
153868
153883
  exportVariables,
153869
153884
  {
153870
153885
  noDecode,
153871
153886
  state: state2
153872
153887
  },
153873
- errors,
153888
+ "ESV Variables",
153889
+ resultCallback,
153874
153890
  isCloudDeployment
153875
- )), 'optionalAccess', async _337 => _337.variable]),
153891
+ )), 'optionalAccess', async _335 => _335.variable]),
153876
153892
  ...config.global
153877
153893
  };
153878
153894
  if (globalConfig.idm) {
@@ -153893,73 +153909,98 @@ async function exportFullConfiguration({
153893
153909
  let saml = await _asyncOptionalChain([(await exportWithErrorHandling(
153894
153910
  exportSaml2Providers,
153895
153911
  stateObj,
153896
- errors
153897
- )), 'optionalAccess', async _338 => _338.saml]);
153912
+ "SAML2 Providers",
153913
+ resultCallback
153914
+ )), 'optionalAccess', async _336 => _336.saml]);
153898
153915
  const cotExport = await exportWithErrorHandling(
153899
153916
  exportCirclesOfTrust,
153900
153917
  stateObj,
153901
- errors
153918
+ "Circle of Trusts",
153919
+ resultCallback
153902
153920
  );
153903
153921
  if (saml) {
153904
- saml.cot = _optionalChain([cotExport, 'optionalAccess', _339 => _339.saml, 'access', _340 => _340.cot]);
153922
+ saml.cot = _optionalChain([cotExport, 'optionalAccess', _337 => _337.saml, 'access', _338 => _338.cot]);
153905
153923
  } else {
153906
- saml = _optionalChain([cotExport, 'optionalAccess', _341 => _341.saml]);
153924
+ saml = _optionalChain([cotExport, 'optionalAccess', _339 => _339.saml]);
153907
153925
  }
153908
153926
  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]),
153927
+ agentGroup: await _asyncOptionalChain([(await exportWithErrorHandling(
153928
+ exportAgentGroups,
153929
+ stateObj,
153930
+ "Agent Groups",
153931
+ resultCallback
153932
+ )), 'optionalAccess', async _340 => _340.agentGroup]),
153933
+ agent: await _asyncOptionalChain([(await exportWithErrorHandling(
153934
+ exportAgents,
153935
+ realmStateObj,
153936
+ "Agents",
153937
+ resultCallback
153938
+ )), 'optionalAccess', async _341 => _341.agent]),
153911
153939
  application: await _asyncOptionalChain([(await exportWithErrorHandling(
153912
153940
  exportOAuth2Clients,
153913
153941
  {
153914
153942
  options: { deps: false, useStringArrays },
153915
153943
  state: state2
153916
153944
  },
153917
- errors
153918
- )), 'optionalAccess', async _344 => _344.application]),
153945
+ "OAuth2 Client Applications",
153946
+ resultCallback
153947
+ )), 'optionalAccess', async _342 => _342.application]),
153919
153948
  authentication: await _asyncOptionalChain([(await exportWithErrorHandling(
153920
153949
  exportAuthenticationSettings,
153921
153950
  realmStateObj,
153922
- errors
153923
- )), 'optionalAccess', async _345 => _345.authentication]),
153951
+ "Authentication Settings",
153952
+ resultCallback
153953
+ )), 'optionalAccess', async _343 => _343.authentication]),
153924
153954
  idp: await _asyncOptionalChain([(await exportWithErrorHandling(
153925
153955
  exportSocialIdentityProviders,
153926
153956
  stateObj,
153927
- errors
153928
- )), 'optionalAccess', async _346 => _346.idp]),
153957
+ "Social Identity Providers",
153958
+ resultCallback
153959
+ )), 'optionalAccess', async _344 => _344.idp]),
153929
153960
  trees: await _asyncOptionalChain([(await exportWithErrorHandling(
153930
153961
  exportJourneys,
153931
153962
  {
153932
153963
  options: { deps: false, useStringArrays, coords },
153964
+ resultCallback: errorCallback,
153933
153965
  state: state2
153934
153966
  },
153935
- errors
153936
- )), 'optionalAccess', async _347 => _347.trees]),
153967
+ "Journeys",
153968
+ resultCallback
153969
+ )), 'optionalAccess', async _345 => _345.trees]),
153937
153970
  managedApplication: await _asyncOptionalChain([(await exportWithErrorHandling(
153938
153971
  exportApplications,
153939
153972
  {
153940
153973
  options: { deps: false, useStringArrays },
153941
153974
  state: state2
153942
153975
  },
153943
- errors,
153976
+ "Applications",
153977
+ resultCallback,
153944
153978
  isPlatformDeployment
153945
- )), 'optionalAccess', async _348 => _348.managedApplication]),
153979
+ )), 'optionalAccess', async _346 => _346.managedApplication]),
153946
153980
  policy: await _asyncOptionalChain([(await exportWithErrorHandling(
153947
153981
  exportPolicies,
153948
153982
  {
153949
153983
  options: { deps: false, prereqs: false, useStringArrays },
153950
153984
  state: state2
153951
153985
  },
153952
- errors
153953
- )), 'optionalAccess', async _349 => _349.policy]),
153986
+ "Policies",
153987
+ resultCallback
153988
+ )), 'optionalAccess', async _347 => _347.policy]),
153954
153989
  policyset: await _asyncOptionalChain([(await exportWithErrorHandling(
153955
153990
  exportPolicySets,
153956
153991
  {
153957
153992
  options: { deps: false, prereqs: false, useStringArrays },
153958
153993
  state: state2
153959
153994
  },
153960
- errors
153961
- )), 'optionalAccess', async _350 => _350.policyset]),
153962
- resourcetype: await _asyncOptionalChain([(await exportWithErrorHandling(exportResourceTypes, stateObj, errors)), 'optionalAccess', async _351 => _351.resourcetype]),
153995
+ "Policy Sets",
153996
+ resultCallback
153997
+ )), 'optionalAccess', async _348 => _348.policyset]),
153998
+ resourcetype: await _asyncOptionalChain([(await exportWithErrorHandling(
153999
+ exportResourceTypes,
154000
+ stateObj,
154001
+ "Resource Types",
154002
+ resultCallback
154003
+ )), 'optionalAccess', async _349 => _349.resourcetype]),
153963
154004
  saml,
153964
154005
  script: await _asyncOptionalChain([(await exportWithErrorHandling(
153965
154006
  exportScripts,
@@ -153969,33 +154010,43 @@ async function exportFullConfiguration({
153969
154010
  includeDefault,
153970
154011
  useStringArrays
153971
154012
  },
154013
+ resultCallback: errorCallback,
153972
154014
  state: state2
153973
154015
  },
153974
- errors
153975
- )), 'optionalAccess', async _352 => _352.script]),
154016
+ "Scripts",
154017
+ resultCallback
154018
+ )), 'optionalAccess', async _350 => _350.script]),
153976
154019
  secretstore: await _asyncOptionalChain([(await exportWithErrorHandling(
153977
154020
  exportSecretStores,
153978
154021
  realmStateObj,
153979
- errors,
154022
+ "Secret Stores",
154023
+ resultCallback,
153980
154024
  isClassicDeployment
153981
- )), 'optionalAccess', async _353 => _353.secretstore]),
153982
- service: await _asyncOptionalChain([(await exportWithErrorHandling(exportServices, realmStateObj, errors)), 'optionalAccess', async _354 => _354.service]),
154025
+ )), 'optionalAccess', async _351 => _351.secretstore]),
154026
+ service: await _asyncOptionalChain([(await exportWithErrorHandling(
154027
+ exportServices,
154028
+ realmStateObj,
154029
+ "Services",
154030
+ resultCallback
154031
+ )), 'optionalAccess', async _352 => _352.service]),
153983
154032
  theme: await _asyncOptionalChain([(await exportWithErrorHandling(
153984
154033
  exportThemes,
153985
154034
  {
153986
154035
  state: state2
153987
154036
  },
153988
- errors,
154037
+ "Themes",
154038
+ resultCallback,
153989
154039
  isPlatformDeployment
153990
- )), 'optionalAccess', async _355 => _355.theme]),
154040
+ )), 'optionalAccess', async _353 => _353.theme]),
153991
154041
  trustedJwtIssuer: await _asyncOptionalChain([(await exportWithErrorHandling(
153992
154042
  exportOAuth2TrustedJwtIssuers,
153993
154043
  {
153994
154044
  options: { deps: false, useStringArrays },
153995
154045
  state: state2
153996
154046
  },
153997
- errors
153998
- )), 'optionalAccess', async _356 => _356.trustedJwtIssuer]),
154047
+ "Trusted JWT Issuers",
154048
+ resultCallback
154049
+ )), 'optionalAccess', async _354 => _354.trustedJwtIssuer]),
153999
154050
  ...config.realm[realm2]
154000
154051
  };
154001
154052
  if (realmConfig[realm2].service && realmConfig[realm2].service["SocialIdentityProviders"]) {
@@ -154004,14 +154055,12 @@ async function exportFullConfiguration({
154004
154055
  }
154005
154056
  state2.setRealm(activeRealm);
154006
154057
  }
154007
- if (throwErrors && errors.length > 0) {
154008
- throw new FrodoError(`Error exporting full config`, errors);
154009
- }
154010
- return {
154058
+ const fullConfig = {
154011
154059
  meta: getMetadata(stateObj),
154012
154060
  global: globalConfig,
154013
154061
  realm: realmConfig
154014
154062
  };
154063
+ return fullConfig;
154015
154064
  }
154016
154065
  async function importFullConfiguration({
154017
154066
  importData,
@@ -154023,16 +154072,10 @@ async function importFullConfiguration({
154023
154072
  includeActiveValues: true,
154024
154073
  source: ""
154025
154074
  },
154026
- collectErrors,
154075
+ resultCallback = void 0,
154027
154076
  state: state2
154028
154077
  }) {
154029
- const response = [];
154030
- let errors = [];
154031
- let throwErrors = true;
154032
- if (collectErrors && Array.isArray(collectErrors)) {
154033
- throwErrors = false;
154034
- errors = collectErrors;
154035
- }
154078
+ let response = [];
154036
154079
  const isClassicDeployment = state2.getDeploymentType() === Constants_default.CLASSIC_DEPLOYMENT_TYPE_KEY;
154037
154080
  const isCloudDeployment = state2.getDeploymentType() === Constants_default.CLOUD_DEPLOYMENT_TYPE_KEY;
154038
154081
  const isForgeOpsDeployment = state2.getDeploymentType() === Constants_default.FORGEOPS_DEPLOYMENT_TYPE_KEY;
@@ -154045,6 +154088,7 @@ async function importFullConfiguration({
154045
154088
  includeActiveValues,
154046
154089
  source
154047
154090
  } = options;
154091
+ const errorCallback = getErrorCallback(resultCallback);
154048
154092
  let indicatorId = createProgressIndicator({
154049
154093
  total: 14,
154050
154094
  message: `Importing everything for global...`,
@@ -154062,9 +154106,9 @@ async function importFullConfiguration({
154062
154106
  },
154063
154107
  state: state2
154064
154108
  },
154065
- errors,
154066
154109
  indicatorId,
154067
154110
  "Servers",
154111
+ resultCallback,
154068
154112
  isClassicDeployment && !!importData.global.server
154069
154113
  )
154070
154114
  );
@@ -154077,9 +154121,9 @@ async function importFullConfiguration({
154077
154121
  importData: importData.global,
154078
154122
  state: state2
154079
154123
  },
154080
- errors,
154081
154124
  indicatorId,
154082
154125
  "Sites",
154126
+ resultCallback,
154083
154127
  isClassicDeployment && !!importData.global.site
154084
154128
  )
154085
154129
  );
@@ -154092,9 +154136,9 @@ async function importFullConfiguration({
154092
154136
  importData: importData.global,
154093
154137
  state: state2
154094
154138
  },
154095
- errors,
154096
154139
  indicatorId,
154097
154140
  "Realms",
154141
+ resultCallback,
154098
154142
  isClassicDeployment && !!importData.global.realm
154099
154143
  )
154100
154144
  );
@@ -154106,9 +154150,9 @@ async function importFullConfiguration({
154106
154150
  importData: importData.global,
154107
154151
  state: state2
154108
154152
  },
154109
- errors,
154110
154153
  indicatorId,
154111
154154
  "Script Types",
154155
+ resultCallback,
154112
154156
  isClassicDeployment && !!importData.global.scripttype
154113
154157
  )
154114
154158
  );
@@ -154121,9 +154165,9 @@ async function importFullConfiguration({
154121
154165
  secretStoreId: "",
154122
154166
  state: state2
154123
154167
  },
154124
- errors,
154125
154168
  indicatorId,
154126
154169
  "Secret Stores",
154170
+ resultCallback,
154127
154171
  isClassicDeployment && !!importData.global.secretstore
154128
154172
  )
154129
154173
  );
@@ -154138,9 +154182,9 @@ async function importFullConfiguration({
154138
154182
  },
154139
154183
  state: state2
154140
154184
  },
154141
- errors,
154142
154185
  indicatorId,
154143
154186
  "Secrets",
154187
+ resultCallback,
154144
154188
  isCloudDeployment && !!importData.global.secret
154145
154189
  )
154146
154190
  );
@@ -154151,9 +154195,9 @@ async function importFullConfiguration({
154151
154195
  importData: importData.global,
154152
154196
  state: state2
154153
154197
  },
154154
- errors,
154155
154198
  indicatorId,
154156
154199
  "Variables",
154200
+ resultCallback,
154157
154201
  isCloudDeployment && !!importData.global.variable
154158
154202
  )
154159
154203
  );
@@ -154167,11 +154211,12 @@ async function importFullConfiguration({
154167
154211
  entitiesToImport: void 0,
154168
154212
  validate: false
154169
154213
  },
154214
+ resultCallback: errorCallback,
154170
154215
  state: state2
154171
154216
  },
154172
- errors,
154173
154217
  indicatorId,
154174
154218
  "IDM Config Entities",
154219
+ resultCallback,
154175
154220
  isPlatformDeployment && !!importData.global.idm
154176
154221
  )
154177
154222
  );
@@ -154182,9 +154227,9 @@ async function importFullConfiguration({
154182
154227
  importData: importData.global,
154183
154228
  state: state2
154184
154229
  },
154185
- errors,
154186
154230
  indicatorId,
154187
154231
  "Email Templates",
154232
+ resultCallback,
154188
154233
  isPlatformDeployment && !!importData.global.emailTemplate
154189
154234
  )
154190
154235
  );
@@ -154196,9 +154241,9 @@ async function importFullConfiguration({
154196
154241
  options: { deps: false },
154197
154242
  state: state2
154198
154243
  },
154199
- errors,
154200
154244
  indicatorId,
154201
154245
  "Mappings",
154246
+ resultCallback,
154202
154247
  isPlatformDeployment
154203
154248
  )
154204
154249
  );
@@ -154210,9 +154255,9 @@ async function importFullConfiguration({
154210
154255
  options: { clean: cleanServices, global: true, realm: false },
154211
154256
  state: state2
154212
154257
  },
154213
- errors,
154214
154258
  indicatorId,
154215
154259
  "Services",
154260
+ resultCallback,
154216
154261
  !!importData.global.service
154217
154262
  )
154218
154263
  );
@@ -154220,9 +154265,9 @@ async function importFullConfiguration({
154220
154265
  await importWithErrorHandling(
154221
154266
  importAgents,
154222
154267
  { importData: importData.global, globalConfig: true, state: state2 },
154223
- errors,
154224
154268
  indicatorId,
154225
154269
  "Agents",
154270
+ resultCallback,
154226
154271
  isClassicDeployment && !!importData.global.agent
154227
154272
  )
154228
154273
  );
@@ -154234,9 +154279,9 @@ async function importFullConfiguration({
154234
154279
  globalConfig: true,
154235
154280
  state: state2
154236
154281
  },
154237
- errors,
154238
154282
  indicatorId,
154239
154283
  "Authentication Settings",
154284
+ resultCallback,
154240
154285
  isClassicDeployment && !!importData.global.authentication
154241
154286
  )
154242
154287
  );
@@ -154247,9 +154292,9 @@ async function importFullConfiguration({
154247
154292
  importData: importData.global,
154248
154293
  state: state2
154249
154294
  },
154250
- errors,
154251
154295
  indicatorId,
154252
154296
  "Internal Roles",
154297
+ resultCallback,
154253
154298
  isPlatformDeployment && !!importData.global.internalRole
154254
154299
  )
154255
154300
  );
@@ -154279,11 +154324,12 @@ async function importFullConfiguration({
154279
154324
  includeDefault
154280
154325
  },
154281
154326
  validate: false,
154327
+ resultCallback: errorCallback,
154282
154328
  state: state2
154283
154329
  },
154284
- errors,
154285
154330
  indicatorId,
154286
154331
  "Scripts",
154332
+ resultCallback,
154287
154333
  !!importData.realm[realm2].script
154288
154334
  )
154289
154335
  );
@@ -154294,9 +154340,9 @@ async function importFullConfiguration({
154294
154340
  importData: importData.realm[realm2],
154295
154341
  state: state2
154296
154342
  },
154297
- errors,
154298
154343
  indicatorId,
154299
154344
  "Themes",
154345
+ resultCallback,
154300
154346
  isPlatformDeployment && !!importData.realm[realm2].theme
154301
154347
  )
154302
154348
  );
@@ -154309,9 +154355,9 @@ async function importFullConfiguration({
154309
154355
  secretStoreId: "",
154310
154356
  state: state2
154311
154357
  },
154312
- errors,
154313
154358
  indicatorId,
154314
154359
  "Secret Stores",
154360
+ resultCallback,
154315
154361
  isClassicDeployment && !!importData.realm[realm2].secretstore
154316
154362
  )
154317
154363
  );
@@ -154319,9 +154365,9 @@ async function importFullConfiguration({
154319
154365
  await importWithErrorHandling(
154320
154366
  importAgentGroups,
154321
154367
  { importData: importData.realm[realm2], state: state2 },
154322
- errors,
154323
154368
  indicatorId,
154324
154369
  "Agent Groups",
154370
+ resultCallback,
154325
154371
  !!importData.realm[realm2].agentGroup
154326
154372
  )
154327
154373
  );
@@ -154329,9 +154375,9 @@ async function importFullConfiguration({
154329
154375
  await importWithErrorHandling(
154330
154376
  importAgents,
154331
154377
  { importData: importData.realm[realm2], globalConfig: false, state: state2 },
154332
- errors,
154333
154378
  indicatorId,
154334
154379
  "Agents",
154380
+ resultCallback,
154335
154381
  !!importData.realm[realm2].agent
154336
154382
  )
154337
154383
  );
@@ -154342,9 +154388,9 @@ async function importFullConfiguration({
154342
154388
  importData: importData.realm[realm2],
154343
154389
  state: state2
154344
154390
  },
154345
- errors,
154346
154391
  indicatorId,
154347
154392
  "Resource Types",
154393
+ resultCallback,
154348
154394
  !!importData.realm[realm2].resourcetype
154349
154395
  )
154350
154396
  );
@@ -154355,9 +154401,9 @@ async function importFullConfiguration({
154355
154401
  importData: importData.realm[realm2],
154356
154402
  state: state2
154357
154403
  },
154358
- errors,
154359
154404
  indicatorId,
154360
154405
  "Circles of Trust",
154406
+ resultCallback,
154361
154407
  !!importData.realm[realm2].saml && !!importData.realm[realm2].saml.cot
154362
154408
  )
154363
154409
  );
@@ -154369,9 +154415,9 @@ async function importFullConfiguration({
154369
154415
  options: { deps: false },
154370
154416
  state: state2
154371
154417
  },
154372
- errors,
154373
154418
  indicatorId,
154374
154419
  "Saml2 Providers",
154420
+ resultCallback,
154375
154421
  !!importData.realm[realm2].saml
154376
154422
  )
154377
154423
  );
@@ -154383,9 +154429,9 @@ async function importFullConfiguration({
154383
154429
  options: { deps: false },
154384
154430
  state: state2
154385
154431
  },
154386
- errors,
154387
154432
  indicatorId,
154388
154433
  "Social Identity Providers",
154434
+ resultCallback,
154389
154435
  !!importData.realm[realm2].idp
154390
154436
  )
154391
154437
  );
@@ -154397,9 +154443,9 @@ async function importFullConfiguration({
154397
154443
  options: { deps: false },
154398
154444
  state: state2
154399
154445
  },
154400
- errors,
154401
154446
  indicatorId,
154402
154447
  "OAuth2 Clients",
154448
+ resultCallback,
154403
154449
  !!importData.realm[realm2].application
154404
154450
  )
154405
154451
  );
@@ -154410,9 +154456,9 @@ async function importFullConfiguration({
154410
154456
  importData: importData.realm[realm2],
154411
154457
  state: state2
154412
154458
  },
154413
- errors,
154414
154459
  indicatorId,
154415
154460
  "Trusted JWT Issuers",
154461
+ resultCallback,
154416
154462
  !!importData.realm[realm2].trustedJwtIssuer
154417
154463
  )
154418
154464
  );
@@ -154424,9 +154470,9 @@ async function importFullConfiguration({
154424
154470
  options: { deps: false },
154425
154471
  state: state2
154426
154472
  },
154427
- errors,
154428
154473
  indicatorId,
154429
154474
  "Applications",
154475
+ resultCallback,
154430
154476
  isPlatformDeployment && !!importData.realm[realm2].managedApplication
154431
154477
  )
154432
154478
  );
@@ -154438,9 +154484,9 @@ async function importFullConfiguration({
154438
154484
  options: { deps: false, prereqs: false },
154439
154485
  state: state2
154440
154486
  },
154441
- errors,
154442
154487
  indicatorId,
154443
154488
  "Policy Sets",
154489
+ resultCallback,
154444
154490
  !!importData.realm[realm2].policyset
154445
154491
  )
154446
154492
  );
@@ -154452,9 +154498,9 @@ async function importFullConfiguration({
154452
154498
  options: { deps: false, prereqs: false },
154453
154499
  state: state2
154454
154500
  },
154455
- errors,
154456
154501
  indicatorId,
154457
154502
  "Policies",
154503
+ resultCallback,
154458
154504
  !!importData.realm[realm2].policy
154459
154505
  )
154460
154506
  );
@@ -154464,11 +154510,12 @@ async function importFullConfiguration({
154464
154510
  {
154465
154511
  importData: importData.realm[realm2],
154466
154512
  options: { deps: false, reUuid: reUuidJourneys },
154513
+ resultCallback: errorCallback,
154467
154514
  state: state2
154468
154515
  },
154469
- errors,
154470
154516
  indicatorId,
154471
154517
  "Journeys",
154518
+ resultCallback,
154472
154519
  !!importData.realm[realm2].trees
154473
154520
  )
154474
154521
  );
@@ -154480,9 +154527,9 @@ async function importFullConfiguration({
154480
154527
  options: { clean: cleanServices, global: false, realm: true },
154481
154528
  state: state2
154482
154529
  },
154483
- errors,
154484
154530
  indicatorId,
154485
154531
  "Services",
154532
+ resultCallback,
154486
154533
  !!importData.realm[realm2].service
154487
154534
  )
154488
154535
  );
@@ -154494,9 +154541,9 @@ async function importFullConfiguration({
154494
154541
  globalConfig: false,
154495
154542
  state: state2
154496
154543
  },
154497
- errors,
154498
154544
  indicatorId,
154499
154545
  "Authentication Settings",
154546
+ resultCallback,
154500
154547
  !!importData.realm[realm2].authentication
154501
154548
  )
154502
154549
  );
@@ -154518,25 +154565,24 @@ async function importFullConfiguration({
154518
154565
  importAmConfigEntities,
154519
154566
  {
154520
154567
  importData,
154568
+ resultCallback: errorCallback,
154521
154569
  state: state2
154522
154570
  },
154523
- errors,
154524
154571
  indicatorId,
154525
- "Other AM Config Entities"
154572
+ "Other AM Config Entities",
154573
+ resultCallback
154526
154574
  )
154527
154575
  );
154576
+ response = response.filter(
154577
+ (o) => o && (!Array.isArray(o) || o.length > 0) && (!o.server || Object.keys(o.server).length > 0)
154578
+ );
154528
154579
  stopProgressIndicator({
154529
154580
  id: indicatorId,
154530
154581
  message: `Finished Importing all other AM config entities!`,
154531
154582
  status: "success",
154532
154583
  state: state2
154533
154584
  });
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
- );
154585
+ return response;
154540
154586
  }
154541
154587
  var envInfoURLTemplate2 = "%s/environment/info";
154542
154588
  var apiVersion39 = "protocol=1.0,resource=1.0";
@@ -154872,7 +154918,7 @@ async function getUserConfig({
154872
154918
  current = current[part];
154873
154919
  }
154874
154920
  } catch (e) {
154875
- if (e.httpStatus === 404 || _optionalChain([e, 'access', _357 => _357.response, 'optionalAccess', _358 => _358.status]) === 404) {
154921
+ if (e.httpStatus === 404 || _optionalChain([e, 'access', _355 => _355.response, 'optionalAccess', _356 => _356.status]) === 404) {
154876
154922
  } else {
154877
154923
  printMessage({
154878
154924
  message: `Error exporting config for user with id '${userId}' from url '${urlString}': ${e.message}`,
@@ -155531,7 +155577,7 @@ function v43(options, buf, offset) {
155531
155577
  return native_default3.randomUUID();
155532
155578
  }
155533
155579
  options = options || {};
155534
- const rnds = _nullishCoalesce(_nullishCoalesce(options.random, () => ( _optionalChain([options, 'access', _359 => _359.rng, 'optionalCall', _360 => _360()]))), () => ( rng3()));
155580
+ const rnds = _nullishCoalesce(_nullishCoalesce(options.random, () => ( _optionalChain([options, 'access', _357 => _357.rng, 'optionalCall', _358 => _358()]))), () => ( rng3()));
155535
155581
  if (rnds.length < 16) {
155536
155582
  throw new Error("Random bytes length must be >= 16");
155537
155583
  }
@@ -156937,6 +156983,11 @@ _chunkHEKQUNOBcjs.init_cjs_shims.call(void 0, );
156937
156983
  function cloneDeep2(obj) {
156938
156984
  return JSON.parse(JSON.stringify(obj));
156939
156985
  }
156986
+ function errorHandler(error2) {
156987
+ if (!error2) return;
156988
+ printError2(error2);
156989
+ process.exitCode = 1;
156990
+ }
156940
156991
 
156941
156992
  // src/ops/AdminOps.ts
156942
156993
  var {
@@ -157825,7 +157876,7 @@ In AM, create a trusted issuer in the ${state.getRealm()} realm with the followi
157825
157876
  ]);
157826
157877
  issuer.push([
157827
157878
  "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`
157879
+ _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
157880
  ]);
157830
157881
  issuer.push([
157831
157882
  "JWKS (Public Key)"["brightCyan"],
@@ -157953,7 +158004,7 @@ async function executeRfc7523AuthZGrantFlow2(clientId, iss, jwk, sub, scope, jso
157953
158004
  stopProgressIndicator2(
157954
158005
  spinnerId,
157955
158006
  `Error executing rfc7523 authz grant flow: ${stringify3(
157956
- _optionalChain([error2, 'access', _370 => _370.response, 'optionalAccess', _371 => _371.data]) || error2.message
158007
+ _optionalChain([error2, 'access', _368 => _368.response, 'optionalAccess', _369 => _369.data]) || error2.message
157957
158008
  )}`,
157958
158009
  "fail"
157959
158010
  );
@@ -165429,10 +165480,13 @@ async function exportManagedObjectToFile(name, file, envFile) {
165429
165480
  async function exportAllConfigEntitiesToFile(file, entitiesFile, envFile, includeMeta = true) {
165430
165481
  try {
165431
165482
  const options = getIdmImportExportOptions(entitiesFile, envFile);
165432
- const exportData = await exportConfigEntities2({
165433
- envReplaceParams: options.envReplaceParams,
165434
- entitiesToExport: options.entitiesToExportOrImport
165435
- });
165483
+ const exportData = await exportConfigEntities2(
165484
+ {
165485
+ envReplaceParams: options.envReplaceParams,
165486
+ entitiesToExport: options.entitiesToExportOrImport
165487
+ },
165488
+ errorHandler
165489
+ );
165436
165490
  let fileName = getTypedFilename12(`all`, `idm`);
165437
165491
  if (file) {
165438
165492
  fileName = file;
@@ -165448,10 +165502,13 @@ async function exportAllConfigEntitiesToFiles(entitiesFile, envFile, separateMap
165448
165502
  const errors = [];
165449
165503
  try {
165450
165504
  const options = getIdmImportExportOptions(entitiesFile, envFile);
165451
- const exportData = await exportConfigEntities2({
165452
- envReplaceParams: options.envReplaceParams,
165453
- entitiesToExport: options.entitiesToExportOrImport
165454
- });
165505
+ const exportData = await exportConfigEntities2(
165506
+ {
165507
+ envReplaceParams: options.envReplaceParams,
165508
+ entitiesToExport: options.entitiesToExportOrImport
165509
+ },
165510
+ errorHandler
165511
+ );
165455
165512
  for (const [id7, obj] of Object.entries(exportData.idm)) {
165456
165513
  try {
165457
165514
  if (separateMappings && id7 === "sync") {
@@ -165517,11 +165574,16 @@ async function importConfigEntityByIdFromFile(entityId, file, envFile, validate3
165517
165574
  importData = JSON.parse(fileData);
165518
165575
  }
165519
165576
  const options = getIdmImportExportOptions(void 0, envFile);
165520
- await importConfigEntities2(importData, entityId, {
165521
- envReplaceParams: options.envReplaceParams,
165522
- entitiesToImport: void 0,
165523
- validate: validate3
165524
- });
165577
+ await importConfigEntities2(
165578
+ importData,
165579
+ entityId,
165580
+ {
165581
+ envReplaceParams: options.envReplaceParams,
165582
+ entitiesToImport: void 0,
165583
+ validate: validate3
165584
+ },
165585
+ errorHandler
165586
+ );
165525
165587
  return true;
165526
165588
  } catch (error2) {
165527
165589
  printError2(error2);
@@ -165583,11 +165645,16 @@ async function importFirstConfigEntityFromFile(file, envFile, validate3 = false)
165583
165645
  ]);
165584
165646
  }
165585
165647
  const options = getIdmImportExportOptions(void 0, envFile);
165586
- await importConfigEntities2(importData, entityId, {
165587
- envReplaceParams: options.envReplaceParams,
165588
- entitiesToImport: void 0,
165589
- validate: validate3
165590
- });
165648
+ await importConfigEntities2(
165649
+ importData,
165650
+ entityId,
165651
+ {
165652
+ envReplaceParams: options.envReplaceParams,
165653
+ entitiesToImport: void 0,
165654
+ validate: validate3
165655
+ },
165656
+ errorHandler
165657
+ );
165591
165658
  stopProgressIndicator2(
165592
165659
  indicatorId,
165593
165660
  `Imported ${entityId} from ${filePath}.`,
@@ -165619,7 +165686,8 @@ async function importAllConfigEntitiesFromFile(file, entitiesFile, envFile, vali
165619
165686
  entitiesToImport: options.entitiesToExportOrImport,
165620
165687
  envReplaceParams: options.envReplaceParams,
165621
165688
  validate: validate3
165622
- }
165689
+ },
165690
+ errorHandler
165623
165691
  );
165624
165692
  stopProgressIndicator2(indicatorId, `Imported config entities`, "success");
165625
165693
  return true;
@@ -165684,7 +165752,8 @@ async function importAllConfigEntitiesFromFiles(entitiesFile, envFile, validate3
165684
165752
  entitiesToImport: options.entitiesToExportOrImport,
165685
165753
  envReplaceParams: options.envReplaceParams,
165686
165754
  validate: validate3
165687
- }
165755
+ },
165756
+ errorHandler
165688
165757
  );
165689
165758
  stopProgressIndicator2(indicatorId, `Imported config entities`, "success");
165690
165759
  return true;
@@ -167515,7 +167584,7 @@ var {
167515
167584
  importScripts: importScripts3,
167516
167585
  deleteScript: deleteScript3,
167517
167586
  deleteScriptByName: deleteScriptByName3,
167518
- deleteScripts: deleteScripts3
167587
+ deleteScripts: deleteScripts2
167519
167588
  } = frodo.script;
167520
167589
  var langMap = { JAVASCRIPT: "JavaScript", GROOVY: "Groovy" };
167521
167590
  function getOneLineDescription(scriptObj) {
@@ -167714,7 +167783,7 @@ async function exportScriptsToFile(file, includeMeta = true, options) {
167714
167783
  if (file) {
167715
167784
  fileName = file;
167716
167785
  }
167717
- const scriptExport = await exportScripts2(options);
167786
+ const scriptExport = await exportScripts2(options, errorHandler);
167718
167787
  saveJsonToFile13(scriptExport, getFilePath13(fileName, true), includeMeta);
167719
167788
  debugMessage2(`Cli.ScriptOps.exportScriptsToFile: end`);
167720
167789
  return true;
@@ -167726,56 +167795,50 @@ async function exportScriptsToFile(file, includeMeta = true, options) {
167726
167795
  async function exportScriptsToFiles(extract = false, includeMeta = true, options) {
167727
167796
  debugMessage2(`Cli.ScriptOps.exportScriptsToFiles: start`);
167728
167797
  const errors = [];
167729
- let barId;
167730
- try {
167731
- const scriptExport = await exportScripts2(options);
167732
- const scriptList = Object.values(scriptExport.script);
167733
- barId = createProgressIndicator2(
167798
+ const scriptExport = await exportScripts2(options, errorHandler);
167799
+ const scriptList = Object.values(scriptExport.script);
167800
+ const barId = createProgressIndicator2(
167801
+ "determinate",
167802
+ scriptList.length,
167803
+ "Exporting scripts to individual files..."
167804
+ );
167805
+ for (const script of scriptList) {
167806
+ const fileBarId = createProgressIndicator2(
167734
167807
  "determinate",
167735
- scriptList.length,
167736
- "Exporting scripts to individual files..."
167808
+ 1,
167809
+ `Exporting script ${script.name}...`
167737
167810
  );
167738
- for (const script of scriptList) {
167739
- const fileBarId = createProgressIndicator2(
167740
- "determinate",
167741
- 1,
167742
- `Exporting script ${script.name}...`
167743
- );
167811
+ try {
167744
167812
  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);
167813
+ if (extract) {
167814
+ extractScriptsToFiles({
167815
+ script: {
167816
+ [script._id]: script
167817
+ }
167818
+ });
167763
167819
  }
167764
- updateProgressIndicator2(barId, `Exported script ${script.name}`);
167765
- }
167766
- if (errors.length > 0) {
167767
- throw new FrodoError(`Error exporting scripts`, errors);
167820
+ saveToFile4("script", script, "_id", file, includeMeta);
167821
+ updateProgressIndicator2(fileBarId, `Saving ${script.name} to ${file}.`);
167822
+ stopProgressIndicator2(fileBarId, `${script.name} saved to ${file}.`);
167823
+ } catch (error2) {
167824
+ stopProgressIndicator2(
167825
+ fileBarId,
167826
+ `Error exporting ${script.name}`,
167827
+ "fail"
167828
+ );
167829
+ errors.push(error2);
167768
167830
  }
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);
167831
+ updateProgressIndicator2(barId, `Exported script ${script.name}`);
167778
167832
  }
167833
+ if (errors.length > 0) {
167834
+ throw new FrodoError(`Error exporting scripts`, errors);
167835
+ }
167836
+ stopProgressIndicator2(
167837
+ barId,
167838
+ `Exported ${scriptList.length} scripts to individual files.`
167839
+ );
167840
+ debugMessage2(`Cli.ScriptOps.exportScriptsToFiles: end`);
167841
+ return true;
167779
167842
  }
167780
167843
  function extractScriptsToFiles(scriptExport, scriptId, directory, useScriptNamesForFiles = true) {
167781
167844
  try {
@@ -167875,7 +167938,7 @@ async function importScriptsFromFiles(watch2, options, validateScripts) {
167875
167938
  // !path?.endsWith('.script.groovy')
167876
167939
  // : // in regular mode, ignore everything but frodo script exports
167877
167940
  // 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")]),
167941
+ 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
167942
  persistent: watch2,
167880
167943
  ignoreInitial: false
167881
167944
  });
@@ -167900,7 +167963,14 @@ async function handleScriptFileImport(id7 = "", name = "", file, options, valida
167900
167963
  const script = getScriptExportByScriptFile(file);
167901
167964
  const indicatorId = createProgressIndicator2("determinate", 1, `${file}`);
167902
167965
  try {
167903
- await importScripts3(id7, name, script, options, validateScripts);
167966
+ await importScripts3(
167967
+ id7,
167968
+ name,
167969
+ script,
167970
+ options,
167971
+ validateScripts,
167972
+ errorHandler
167973
+ );
167904
167974
  updateProgressIndicator2(indicatorId, `${file}`);
167905
167975
  stopProgressIndicator2(indicatorId, `${file}`);
167906
167976
  } catch (error2) {
@@ -167980,7 +168050,7 @@ async function deleteAllScripts() {
167980
168050
  `Deleting all non-default scripts...`
167981
168051
  );
167982
168052
  try {
167983
- await deleteScripts3();
168053
+ await deleteScripts2(errorHandler);
167984
168054
  stopProgressIndicator2(
167985
168055
  spinnerId,
167986
168056
  `Deleted all non-default scripts.`,
@@ -168076,17 +168146,20 @@ async function getFullExportConfig(file = null) {
168076
168146
  }
168077
168147
  const workingDirectory = state.getDirectory();
168078
168148
  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
- });
168149
+ return await exportFullConfiguration2(
168150
+ {
168151
+ useStringArrays: true,
168152
+ noDecode: false,
168153
+ coords: true,
168154
+ includeDefault: true,
168155
+ includeActiveValues: false,
168156
+ target: "",
168157
+ includeReadOnly: true,
168158
+ onlyRealm: false,
168159
+ onlyGlobal: false
168160
+ },
168161
+ errorHandler
168162
+ );
168090
168163
  }
168091
168164
  return await getFullExportConfigFromDirectory(workingDirectory);
168092
168165
  }
@@ -168274,16 +168347,12 @@ async function exportEverythingToFile(file, includeMeta = true, options = {
168274
168347
  onlyGlobal: false
168275
168348
  }) {
168276
168349
  try {
168277
- const collectErrors = [];
168278
- const exportData = await exportFullConfiguration3(options, collectErrors);
168350
+ const exportData = await exportFullConfiguration3(options, errorHandler);
168279
168351
  let fileName = "all.config.json";
168280
168352
  if (file) {
168281
168353
  fileName = file;
168282
168354
  }
168283
168355
  saveJsonToFile15(exportData, getFilePath15(fileName, true), includeMeta);
168284
- if (collectErrors.length > 0) {
168285
- throw new FrodoError(`Errors occurred during full export`, collectErrors);
168286
- }
168287
168356
  return true;
168288
168357
  } catch (error2) {
168289
168358
  printError2(error2);
@@ -168305,7 +168374,7 @@ async function exportEverythingToFiles(extract = false, separateMappings = false
168305
168374
  const collectErrors = [];
168306
168375
  const exportData = await exportFullConfiguration3(
168307
168376
  options,
168308
- collectErrors
168377
+ errorHandler
168309
168378
  );
168310
168379
  delete exportData.meta;
168311
168380
  const baseDirectory = getWorkingDirectory12(true);
@@ -168517,14 +168586,7 @@ async function importEverythingFromFile(file, options = {
168517
168586
  }) {
168518
168587
  try {
168519
168588
  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
- }
168589
+ await importFullConfiguration2(data2, options, errorHandler);
168528
168590
  return true;
168529
168591
  } catch (error2) {
168530
168592
  cleanupProgressIndicators();
@@ -168542,14 +168604,7 @@ async function importEverythingFromFiles(options = {
168542
168604
  }) {
168543
168605
  try {
168544
168606
  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
- }
168607
+ await importFullConfiguration2(data2, options, errorHandler);
168553
168608
  return true;
168554
168609
  } catch (error2) {
168555
168610
  printError2(error2);
@@ -168588,14 +168643,7 @@ async function importEntityfromFile(file, global2 = false, options = {
168588
168643
  data2.realm[realm2] = {};
168589
168644
  await getConfig(data2.realm[realm2], file, void 0);
168590
168645
  }
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
- }
168646
+ const imports = await importFullConfiguration2(data2, options, errorHandler);
168599
168647
  if (imports.length === 0) {
168600
168648
  throw new FrodoError(`No imports were made`);
168601
168649
  }
@@ -169261,7 +169309,7 @@ async function tailLogs(source, levels, txid, cookie, nf) {
169261
169309
  filteredLogs = logsObject.result.filter(
169262
169310
  (el) => !noiseFilter.includes(
169263
169311
  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(
169312
+ ) && !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
169313
  txid
169266
169314
  )]))
169267
169315
  );
@@ -169276,18 +169324,23 @@ async function tailLogs(source, levels, txid, cookie, nf) {
169276
169324
  printError2(error2);
169277
169325
  }
169278
169326
  }
169279
- async function fetchLogs(source, startTs, endTs, levels, txid, ffString, cookie, nf) {
169327
+ async function fetchLogs(source, startTs, endTs, levels, txid, filter2, ffString, cookie, nf) {
169280
169328
  try {
169281
- const logsObject = await fetch4(source, startTs, endTs, cookie);
169329
+ const logsObject = await fetch4(
169330
+ source,
169331
+ startTs,
169332
+ endTs,
169333
+ cookie,
169334
+ txid,
169335
+ filter2
169336
+ );
169282
169337
  let filteredLogs = [];
169283
169338
  const noiseFilter = nf == null ? getDefaultNoiseFilter3() : nf;
169284
169339
  if (Array.isArray(logsObject.result)) {
169285
169340
  filteredLogs = logsObject.result.filter(
169286
169341
  (el) => !noiseFilter.includes(
169287
169342
  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(
169289
- txid
169290
- )]))
169343
+ ) && !noiseFilter.includes(el.type) && (levels[0] === "ALL" || levels.includes(resolvePayloadLevel2(el)))
169291
169344
  );
169292
169345
  }
169293
169346
  filteredLogs.forEach((e) => {
@@ -169301,12 +169354,14 @@ async function fetchLogs(source, startTs, endTs, levels, txid, ffString, cookie,
169301
169354
  }
169302
169355
  });
169303
169356
  if (logsObject.pagedResultsCookie != null) {
169357
+ await new Promise((resolve7) => setTimeout(resolve7, 1e3));
169304
169358
  await fetchLogs(
169305
169359
  source,
169306
169360
  startTs,
169307
169361
  endTs,
169308
169362
  levels,
169309
169363
  txid,
169364
+ filter2,
169310
169365
  ffString,
169311
169366
  logsObject.pagedResultsCookie,
169312
169367
  nf
@@ -169439,9 +169494,9 @@ function setup79() {
169439
169494
  `Created log API key ${creds.api_key_id} and secret.`
169440
169495
  );
169441
169496
  } catch (error2) {
169442
- printMessage2(_optionalChain([error2, 'access', _388 => _388.response, 'optionalAccess', _389 => _389.data]), "error");
169497
+ printMessage2(_optionalChain([error2, 'access', _382 => _382.response, 'optionalAccess', _383 => _383.data]), "error");
169443
169498
  printMessage2(
169444
- `Error creating log API key and secret: ${_optionalChain([error2, 'access', _390 => _390.response, 'optionalAccess', _391 => _391.data, 'optionalAccess', _392 => _392.message])}`,
169499
+ `Error creating log API key and secret: ${_optionalChain([error2, 'access', _384 => _384.response, 'optionalAccess', _385 => _385.data, 'optionalAccess', _386 => _386.message])}`,
169445
169500
  "error"
169446
169501
  );
169447
169502
  process.exitCode = 1;
@@ -170147,7 +170202,7 @@ function setup86() {
170147
170202
  printMessage2(updatesTable.toString(), "data");
170148
170203
  }
170149
170204
  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) {
170205
+ if (_optionalChain([updates, 'access', _387 => _387.secrets, 'optionalAccess', _388 => _388.length]) || _optionalChain([updates, 'access', _389 => _389.variables, 'optionalAccess', _390 => _390.length]) || options.force) {
170151
170206
  const ok = options.yes || await (0, import_yesno.default)({
170152
170207
  question: `
170153
170208
  Changes may take up to 10 minutes to propagate, during which time you will not be able to make further updates.
@@ -173856,7 +173911,7 @@ function getNodeClassificationMd(nodeType) {
173856
173911
  function getOneLineDescription5(nodeObj, nodeRef) {
173857
173912
  const description = `[${nodeObj._id["brightCyan"]}] (${getNodeClassification2(
173858
173913
  nodeObj._type._id
173859
- ).join(", ")}) ${nodeObj._type._id}${nodeRef ? " - " + _optionalChain([nodeRef, 'optionalAccess', _397 => _397.displayName]) : ""}`;
173914
+ ).join(", ")}) ${nodeObj._type._id}${nodeRef ? " - " + _optionalChain([nodeRef, 'optionalAccess', _391 => _391.displayName]) : ""}`;
173860
173915
  return description;
173861
173916
  }
173862
173917
  function getTableHeaderMd5() {
@@ -174592,7 +174647,7 @@ async function listJourneys(long = false, analyze = false) {
174592
174647
  table.push([
174593
174648
  `${journeyStub._id}`,
174594
174649
  journeyStub.enabled === false ? "disabled"["brightRed"] : "enabled"["brightGreen"],
174595
- _optionalChain([journeyStub, 'access', _398 => _398.uiConfig, 'optionalAccess', _399 => _399.categories]) ? wordwrap(
174650
+ _optionalChain([journeyStub, 'access', _392 => _392.uiConfig, 'optionalAccess', _393 => _393.categories]) ? wordwrap(
174596
174651
  JSON.parse(journeyStub.uiConfig.categories).join(", "),
174597
174652
  60
174598
174653
  ) : ""
@@ -174634,7 +174689,7 @@ async function listJourneys(long = false, analyze = false) {
174634
174689
  `${journeyExport.tree._id}`,
174635
174690
  journeyExport.tree.enabled === false ? "disabled"["brightRed"] : "enabled"["brightGreen"],
174636
174691
  getJourneyClassification2(journeyExport).join(", "),
174637
- _optionalChain([journeyExport, 'access', _400 => _400.tree, 'access', _401 => _401.uiConfig, 'optionalAccess', _402 => _402.categories]) ? wordwrap(
174692
+ _optionalChain([journeyExport, 'access', _394 => _394.tree, 'access', _395 => _395.uiConfig, 'optionalAccess', _396 => _396.categories]) ? wordwrap(
174638
174693
  JSON.parse(journeyExport.tree.uiConfig.categories).join(
174639
174694
  ", "
174640
174695
  ),
@@ -174678,9 +174733,10 @@ async function exportJourneyToFile(journeyId, file, includeMeta = true, options
174678
174733
  journeyId,
174679
174734
  options
174680
174735
  );
174736
+ delete fileData.meta;
174681
174737
  if (verbose)
174682
174738
  spinnerId = createProgressIndicator2("indeterminate", 0, `${journeyId}`);
174683
- saveJsonToFile23(fileData, filePath, includeMeta);
174739
+ saveJsonToFile23({ trees: { [fileData.tree._id]: fileData } }, filePath, includeMeta);
174684
174740
  stopProgressIndicator2(
174685
174741
  spinnerId,
174686
174742
  `Exported ${journeyId["brightCyan"]} to ${filePath["brightCyan"]}.`,
@@ -174709,7 +174765,10 @@ async function exportJourneysToFile(file, includeMeta = true, options = {
174709
174765
  file = getTypedFilename22(`all${getRealmString5()}Journeys`, "journey");
174710
174766
  }
174711
174767
  const filePath = getFilePath23(file, true);
174712
- const fileData = await exportJourneys2(options);
174768
+ const fileData = await exportJourneys2(
174769
+ options,
174770
+ errorHandler
174771
+ );
174713
174772
  saveJsonToFile23(fileData, filePath, includeMeta);
174714
174773
  return true;
174715
174774
  } catch (error2) {
@@ -174722,7 +174781,7 @@ async function exportJourneysToFiles(includeMeta = true, options = {
174722
174781
  coords: true
174723
174782
  }) {
174724
174783
  try {
174725
- const journeysExport = await exportJourneys2(options);
174784
+ const journeysExport = await exportJourneys2(options, errorHandler);
174726
174785
  const trees = Object.entries(journeysExport.trees);
174727
174786
  for (const [treeId, treeValue] of trees) {
174728
174787
  const indicatorId = createProgressIndicator2(
@@ -174731,10 +174790,9 @@ async function exportJourneysToFiles(includeMeta = true, options = {
174731
174790
  `Saving ${treeId}...`
174732
174791
  );
174733
174792
  const file = getFilePath23(getTypedFilename22(`${treeId}`, "journey"), true);
174734
- treeValue["meta"] = journeysExport.meta;
174735
174793
  try {
174736
174794
  updateProgressIndicator2(indicatorId, `Saving ${treeId} to ${file}`);
174737
- saveJsonToFile23(treeValue, file, includeMeta);
174795
+ saveJsonToFile23({ trees: { [treeValue.tree._id]: treeValue } }, file, includeMeta);
174738
174796
  stopProgressIndicator2(indicatorId, `${treeId} saved to ${file}`);
174739
174797
  } catch (error2) {
174740
174798
  stopProgressIndicator2(indicatorId, `Error saving ${treeId} to ${file}`);
@@ -174928,7 +174986,7 @@ async function importJourneysFromFile(file, options) {
174928
174986
  try {
174929
174987
  const data2 = fs35.default.readFileSync(getFilePath23(file), "utf8");
174930
174988
  const fileData = JSON.parse(data2);
174931
- await importJourneys2(fileData, options);
174989
+ await importJourneys2(fileData, options, errorHandler);
174932
174990
  return true;
174933
174991
  } catch (error2) {
174934
174992
  printError2(error2);
@@ -174946,7 +175004,11 @@ async function importJourneysFromFiles(options) {
174946
175004
  allJourneysData.trees[id7] = obj;
174947
175005
  }
174948
175006
  }
174949
- await importJourneys2(allJourneysData, options);
175007
+ await importJourneys2(
175008
+ allJourneysData,
175009
+ options,
175010
+ errorHandler
175011
+ );
174950
175012
  return true;
174951
175013
  } catch (error2) {
174952
175014
  printError2(error2);
@@ -175039,7 +175101,7 @@ async function describeJourney(journeyData, resolveTreeExport = onlineTreeExport
175039
175101
  nodeTypeMap[nodeData._type._id] = 1;
175040
175102
  }
175041
175103
  }
175042
- if (!state.getAmVersion() && _optionalChain([journeyData, 'access', _403 => _403.meta, 'optionalAccess', _404 => _404.originAmVersion])) {
175104
+ if (!state.getAmVersion() && _optionalChain([journeyData, 'access', _397 => _397.meta, 'optionalAccess', _398 => _398.originAmVersion])) {
175043
175105
  state.setAmVersion(journeyData.meta.originAmVersion);
175044
175106
  }
175045
175107
  printMessage2(`${getOneLineDescription8(journeyData.tree)}`, "data");
@@ -175063,7 +175125,7 @@ ${getJourneyClassification2(journeyData).join(", ")}`,
175063
175125
  "data"
175064
175126
  );
175065
175127
  }
175066
- if (_optionalChain([journeyData, 'access', _405 => _405.tree, 'access', _406 => _406.uiConfig, 'optionalAccess', _407 => _407.categories]) && journeyData.tree.uiConfig.categories != "[]") {
175128
+ if (_optionalChain([journeyData, 'access', _399 => _399.tree, 'access', _400 => _400.uiConfig, 'optionalAccess', _401 => _401.categories]) && journeyData.tree.uiConfig.categories != "[]") {
175067
175129
  printMessage2("\nCategories/Tags", "data");
175068
175130
  printMessage2(
175069
175131
  `${JSON.parse(journeyData.tree.uiConfig.categories).join(", ")}`,
@@ -175105,7 +175167,7 @@ Nodes (${Object.entries(allNodes).length}):`, "data");
175105
175167
  );
175106
175168
  }
175107
175169
  }
175108
- if (_optionalChain([journeyData, 'access', _408 => _408.themes, 'optionalAccess', _409 => _409.length])) {
175170
+ if (_optionalChain([journeyData, 'access', _402 => _402.themes, 'optionalAccess', _403 => _403.length])) {
175109
175171
  printMessage2(`
175110
175172
  Themes (${journeyData.themes.length}):`, "data");
175111
175173
  for (const themeData of journeyData.themes) {
@@ -175199,14 +175261,14 @@ async function describeJourneyMd(journeyData, resolveTreeExport = onlineTreeExpo
175199
175261
  nodeTypeMap[nodeData._type._id] = 1;
175200
175262
  }
175201
175263
  }
175202
- if (!state.getAmVersion() && _optionalChain([journeyData, 'access', _410 => _410.meta, 'optionalAccess', _411 => _411.originAmVersion])) {
175264
+ if (!state.getAmVersion() && _optionalChain([journeyData, 'access', _404 => _404.meta, 'optionalAccess', _405 => _405.originAmVersion])) {
175203
175265
  state.setAmVersion(journeyData.meta.originAmVersion);
175204
175266
  }
175205
175267
  printMessage2(
175206
175268
  `# ${getOneLineDescriptionMd(journeyData.tree)} - ${journeyData.tree.enabled === false ? ":o: `disabled`" : ":white_check_mark: `enabled`"}, ${getJourneyClassificationMd(journeyData).join(", ")}`,
175207
175269
  "data"
175208
175270
  );
175209
- if (_optionalChain([journeyData, 'access', _412 => _412.tree, 'access', _413 => _413.uiConfig, 'optionalAccess', _414 => _414.categories]) && journeyData.tree.uiConfig.categories != "[]") {
175271
+ if (_optionalChain([journeyData, 'access', _406 => _406.tree, 'access', _407 => _407.uiConfig, 'optionalAccess', _408 => _408.categories]) && journeyData.tree.uiConfig.categories != "[]") {
175210
175272
  printMessage2(
175211
175273
  `\`${JSON.parse(journeyData.tree.uiConfig.categories).join("`, `")}\``,
175212
175274
  "data"
@@ -175250,7 +175312,7 @@ ${journeyData.tree.description}`, "data");
175250
175312
  );
175251
175313
  }
175252
175314
  }
175253
- if (_optionalChain([journeyData, 'access', _415 => _415.themes, 'optionalAccess', _416 => _416.length])) {
175315
+ if (_optionalChain([journeyData, 'access', _409 => _409.themes, 'optionalAccess', _410 => _410.length])) {
175254
175316
  printMessage2(`## Themes (${journeyData.themes.length})`, "data");
175255
175317
  printMessage2(getTableHeaderMd7(), "data");
175256
175318
  for (const themeData of journeyData.themes) {
@@ -175390,7 +175452,10 @@ async function deleteJourneys2(options = {
175390
175452
  `Deleting journeys...`
175391
175453
  );
175392
175454
  try {
175393
- const status = await _deleteJourneys(options);
175455
+ const status = await _deleteJourneys(
175456
+ options,
175457
+ errorHandler
175458
+ );
175394
175459
  stopProgressIndicator2(
175395
175460
  indicatorId,
175396
175461
  `Deleted ${Object.keys(status).length} journeys`
@@ -175520,9 +175585,9 @@ function setup127() {
175520
175585
  journeyData = fileData.trees[options.journeyId];
175521
175586
  } else if (typeof options.journeyId === "undefined" && fileData.trees) {
175522
175587
  [journeyData] = Object.values(fileData.trees);
175523
- } else if (typeof options.journeyId !== "undefined" && options.journeyId === _optionalChain([fileData, 'access', _417 => _417.tree, 'optionalAccess', _418 => _418._id])) {
175588
+ } else if (typeof options.journeyId !== "undefined" && options.journeyId === _optionalChain([fileData, 'access', _411 => _411.tree, 'optionalAccess', _412 => _412._id])) {
175524
175589
  journeyData = fileData;
175525
- } else if (typeof options.journeyId === "undefined" && _optionalChain([fileData, 'access', _419 => _419.tree, 'optionalAccess', _420 => _420._id])) {
175590
+ } else if (typeof options.journeyId === "undefined" && _optionalChain([fileData, 'access', _413 => _413.tree, 'optionalAccess', _414 => _414._id])) {
175526
175591
  journeyData = fileData;
175527
175592
  } else {
175528
175593
  throw new Error(
@@ -175959,7 +176024,6 @@ var { getConnectionProfile: getConnectionProfile2, saveConnectionProfile: saveCo
175959
176024
  var SECONDS_IN_30_DAYS = 2592e3;
175960
176025
  var SECONDS_IN_1_HOUR = 3600;
175961
176026
  var LOG_TIME_WINDOW_MAX = SECONDS_IN_30_DAYS;
175962
- var LOG_TIME_WINDOW_INCREMENT = 1;
175963
176027
  var deploymentTypes48 = ["cloud"];
175964
176028
  function setup135() {
175965
176029
  const program2 = new FrodoCommand(
@@ -175973,9 +176037,14 @@ function setup135() {
175973
176037
  new Option(
175974
176038
  "-l, --level <level>",
175975
176039
  "Set log level filter. You can specify the level as a number or a string. Following values are possible (values on the same line are equivalent): \n0, SEVERE, FATAL, or ERROR\n1, WARNING, WARN or CONFIG \n2, INFO or INFORMATION\n3, DEBUG, FINE, FINER or FINEST \n4 or ALL"
175976
- ).default("ERROR", `${resolveLevel2("ERROR")}`)
176040
+ ).default("ALL", `${resolveLevel2("ALL")}`)
175977
176041
  ).addOption(
175978
176042
  new Option("-t, --transaction-id <txid>", "Filter by transactionId")
176043
+ ).addOption(
176044
+ new Option(
176045
+ "-f, --query-filter <filter exp>",
176046
+ "Filter using a query expression"
176047
+ )
175979
176048
  ).addOption(
175980
176049
  new Option(
175981
176050
  "-b, --begin-timestamp <beginTs>",
@@ -176037,65 +176106,64 @@ function setup135() {
176037
176106
  if (foundCredentials) {
176038
176107
  const now = Date.now() / 1e3;
176039
176108
  const nowString = new Date(now * 1e3).toISOString();
176040
- if (typeof options.beginTimestamp === "undefined" || !options.beginTimestamp) {
176041
- const tempStartDate = /* @__PURE__ */ new Date();
176042
- tempStartDate.setTime((now - SECONDS_IN_1_HOUR) * 1e3);
176043
- options.beginTimestamp = tempStartDate.toISOString();
176044
- const tempEndDate = /* @__PURE__ */ new Date();
176045
- tempEndDate.setTime(now * 1e3);
176046
- options.endTimestamp = tempEndDate;
176047
- printMessage2(
176048
- "No timestamps specified, defaulting to logs from 1 hour ago",
176049
- "info"
176050
- );
176051
- }
176052
- if (typeof options.endTimestamp === "undefined" || !options.endTimestamp) {
176053
- options.endTimestamp = nowString;
176054
- printMessage2(
176055
- 'No end timestamp specified, defaulting end timestamp to "now"',
176056
- "info"
176057
- );
176058
- }
176059
- let beginTs = Date.parse(options.beginTimestamp) / 1e3;
176060
- const endTs = Date.parse(options.endTimestamp) / 1e3;
176061
- if (endTs < beginTs) {
176062
- printMessage2(
176063
- "End timestamp can not be before begin timestamp",
176064
- "error"
176065
- );
176066
- process.exitCode = 1;
176067
- return;
176068
- }
176069
- if (now - beginTs > LOG_TIME_WINDOW_MAX) {
176070
- printMessage2(
176071
- "Begin timestamp can not be more than 30 days in the past",
176072
- "error"
176073
- );
176074
- process.exitCode = 1;
176075
- return;
176109
+ let beginTs = -1;
176110
+ let endTs = -1;
176111
+ if ((typeof options.beginTimestamp === "undefined" || !options.beginTimestamp) && (typeof options.endTimestamp === "undefined" || !options.endTimestamp)) {
176112
+ beginTs = -1;
176113
+ endTs = -1;
176114
+ } else {
176115
+ if (typeof options.beginTimestamp === "undefined" || !options.beginTimestamp) {
176116
+ const tempStartDate = /* @__PURE__ */ new Date();
176117
+ tempStartDate.setTime((now - SECONDS_IN_1_HOUR) * 1e3);
176118
+ options.beginTimestamp = tempStartDate.toISOString();
176119
+ const tempEndDate = /* @__PURE__ */ new Date();
176120
+ tempEndDate.setTime(now * 1e3);
176121
+ options.endTimestamp = tempEndDate;
176122
+ printMessage2(
176123
+ "No begin timestamp specified, defaulting to logs from 1 hour ago",
176124
+ "info"
176125
+ );
176126
+ }
176127
+ if (typeof options.endTimestamp === "undefined" || !options.endTimestamp) {
176128
+ options.endTimestamp = nowString;
176129
+ printMessage2(
176130
+ 'No end timestamp specified, defaulting end timestamp to "now"',
176131
+ "info"
176132
+ );
176133
+ }
176134
+ beginTs = Date.parse(options.beginTimestamp) / 1e3;
176135
+ endTs = Date.parse(options.endTimestamp) / 1e3;
176136
+ if (endTs < beginTs) {
176137
+ printMessage2(
176138
+ "End timestamp can not be before begin timestamp",
176139
+ "error"
176140
+ );
176141
+ process.exitCode = 1;
176142
+ return;
176143
+ }
176144
+ if (now - beginTs > LOG_TIME_WINDOW_MAX) {
176145
+ printMessage2(
176146
+ "Begin timestamp can not be more than 30 days in the past",
176147
+ "error"
176148
+ );
176149
+ process.exitCode = 1;
176150
+ return;
176151
+ }
176076
176152
  }
176077
- let intermediateEndTs = 0;
176078
176153
  printMessage2(
176079
176154
  `Fetching ID Cloud logs from the following sources: ${command.opts().sources} and levels [${resolveLevel2(command.opts().level)}] of ${conn.tenant}...`
176080
176155
  );
176081
- let timeIncrement = LOG_TIME_WINDOW_INCREMENT;
176082
- if (endTs - beginTs > 30) {
176083
- timeIncrement = timeIncrement * 30;
176084
- }
176085
- do {
176086
- intermediateEndTs = beginTs + timeIncrement;
176087
- await fetchLogs(
176088
- command.opts().sources,
176089
- new Date(beginTs * 1e3).toISOString(),
176090
- new Date(intermediateEndTs * 1e3).toISOString(),
176091
- resolveLevel2(command.opts().level),
176092
- command.opts().transactionId,
176093
- command.opts().searchString,
176094
- null,
176095
- getNoiseFilters(options.defaults)
176096
- );
176097
- beginTs = intermediateEndTs;
176098
- } while (intermediateEndTs < endTs);
176156
+ await fetchLogs(
176157
+ command.opts().sources,
176158
+ beginTs == -1 ? null : new Date(beginTs * 1e3).toISOString(),
176159
+ endTs == -1 ? null : new Date(endTs * 1e3).toISOString(),
176160
+ resolveLevel2(command.opts().level),
176161
+ command.opts().transactionId,
176162
+ command.opts().queryFilter,
176163
+ command.opts().searchString,
176164
+ null,
176165
+ getNoiseFilters(options.defaults)
176166
+ );
176099
176167
  } else {
176100
176168
  printMessage2("No log api credentials found!");
176101
176169
  program2.help();
@@ -176334,7 +176402,7 @@ function setup141() {
176334
176402
  new Option(
176335
176403
  "-l, --level <level>",
176336
176404
  "Set log level filter. You can specify the level as a number or a string. Following values are possible (values on the same line are equivalent): \n0, SEVERE, FATAL, or ERROR\n1, WARNING, WARN or CONFIG \n2, INFO or INFORMATION\n3, DEBUG, FINE, FINER or FINEST \n4 or ALL"
176337
- ).default("ERROR", `${resolveLevel3("ERROR")}`)
176405
+ ).default("ALL", `${resolveLevel3("ALL")}`)
176338
176406
  ).addOption(
176339
176407
  new Option("-t, --transaction-id <txid>", "Filter by transactionId")
176340
176408
  ).addOption(
@@ -177398,7 +177466,7 @@ async function importServiceFromFile(serviceId, file, options = {
177398
177466
  );
177399
177467
  const data2 = fs35.default.readFileSync(filePath, "utf8");
177400
177468
  const importData = JSON.parse(data2);
177401
- if (_optionalChain([importData, 'optionalAccess', _421 => _421.service, 'access', _422 => _422[serviceId]])) {
177469
+ if (_optionalChain([importData, 'optionalAccess', _415 => _415.service, 'access', _416 => _416[serviceId]])) {
177402
177470
  await importService2(serviceId, importData, options);
177403
177471
  stopProgressIndicator2(
177404
177472
  indicatorId,
@@ -178615,7 +178683,7 @@ async function listRealms(long = false) {
178615
178683
  } catch (error2) {
178616
178684
  printMessage2(error2, "error");
178617
178685
  printMessage2(`Error listing realms: ${error2.message}`, "error");
178618
- printMessage2(_optionalChain([error2, 'access', _423 => _423.response, 'optionalAccess', _424 => _424.data]), "error");
178686
+ printMessage2(_optionalChain([error2, 'access', _417 => _417.response, 'optionalAccess', _418 => _418.data]), "error");
178619
178687
  }
178620
178688
  }
178621
178689
  async function exportRealmById(realmId, file, includeMeta = true) {
@@ -181412,7 +181480,7 @@ var compareVersions = (v12, v2) => {
181412
181480
  // package.json
181413
181481
  var package_default2 = {
181414
181482
  name: "@rockcarver/frodo-cli",
181415
- version: "3.0.5",
181483
+ version: "3.0.7",
181416
181484
  type: "module",
181417
181485
  description: "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
181418
181486
  keywords: [
@@ -181527,7 +181595,7 @@ var package_default2 = {
181527
181595
  ]
181528
181596
  },
181529
181597
  devDependencies: {
181530
- "@rockcarver/frodo-lib": "3.1.0",
181598
+ "@rockcarver/frodo-lib": "3.3.1",
181531
181599
  "@types/colors": "^1.2.1",
181532
181600
  "@types/fs-extra": "^11.0.1",
181533
181601
  "@types/jest": "^29.2.3",