@rockcarver/frodo-lib 2.0.0-3 → 2.0.0-4

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.
Files changed (149) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/cjs/api/AgentApi.js +64 -16
  3. package/cjs/api/AgentApi.js.map +1 -1
  4. package/cjs/api/ApiTypes.js +0 -55
  5. package/cjs/api/ApiTypes.js.map +1 -1
  6. package/cjs/api/BaseApi.js +21 -11
  7. package/cjs/api/BaseApi.js.map +1 -1
  8. package/cjs/api/cloud/SecretsApi.js +7 -14
  9. package/cjs/api/cloud/SecretsApi.js.map +1 -1
  10. package/cjs/api/cloud/SecretsApi.test.js.map +1 -1
  11. package/cjs/ops/AdminOps.js +254 -60
  12. package/cjs/ops/AdminOps.js.map +1 -1
  13. package/cjs/ops/AgentOps.js +352 -108
  14. package/cjs/ops/AgentOps.js.map +1 -1
  15. package/cjs/ops/AuthenticateOps.js +253 -60
  16. package/cjs/ops/AuthenticateOps.js.map +1 -1
  17. package/cjs/ops/CirclesOfTrustOps.js +16 -4
  18. package/cjs/ops/CirclesOfTrustOps.js.map +1 -1
  19. package/cjs/ops/ConnectionProfileOps.js +163 -40
  20. package/cjs/ops/ConnectionProfileOps.js.map +1 -1
  21. package/cjs/ops/EmailTemplateOps.js +7 -1
  22. package/cjs/ops/EmailTemplateOps.js.map +1 -1
  23. package/cjs/ops/IdpOps.js +55 -12
  24. package/cjs/ops/IdpOps.js.map +1 -1
  25. package/cjs/ops/JourneyOps.js +645 -136
  26. package/cjs/ops/JourneyOps.js.map +1 -1
  27. package/cjs/ops/NodeOps.js +96 -24
  28. package/cjs/ops/NodeOps.js.map +1 -1
  29. package/cjs/ops/OAuth2ClientOps.js +45 -11
  30. package/cjs/ops/OAuth2ClientOps.js.map +1 -1
  31. package/cjs/ops/OpsTypes.js +0 -23
  32. package/cjs/ops/OpsTypes.js.map +1 -1
  33. package/cjs/ops/OrganizationOps.js +44 -10
  34. package/cjs/ops/OrganizationOps.js.map +1 -1
  35. package/cjs/ops/PolicyOps.js +86 -24
  36. package/cjs/ops/PolicyOps.js.map +1 -1
  37. package/cjs/ops/PolicySetOps.js +72 -18
  38. package/cjs/ops/PolicySetOps.js.map +1 -1
  39. package/cjs/ops/ResourceTypeOps.js +24 -6
  40. package/cjs/ops/ResourceTypeOps.js.map +1 -1
  41. package/cjs/ops/Saml2Ops.js +120 -33
  42. package/cjs/ops/Saml2Ops.js.map +1 -1
  43. package/cjs/ops/Saml2Ops.test.js.map +1 -1
  44. package/cjs/ops/ScriptOps.js +73 -17
  45. package/cjs/ops/ScriptOps.js.map +1 -1
  46. package/cjs/ops/ServiceOps.js +152 -35
  47. package/cjs/ops/ServiceOps.js.map +1 -1
  48. package/cjs/ops/ThemeOps.js +20 -5
  49. package/cjs/ops/ThemeOps.js.map +1 -1
  50. package/cjs/ops/cloud/FeatureOps.js +4 -1
  51. package/cjs/ops/cloud/FeatureOps.js.map +1 -1
  52. package/cjs/ops/cloud/SecretsOps.js.map +1 -1
  53. package/cjs/ops/cloud/ServiceAccountOps.js +24 -6
  54. package/cjs/ops/cloud/ServiceAccountOps.js.map +1 -1
  55. package/cjs/ops/cloud/StartupOps.js +55 -11
  56. package/cjs/ops/cloud/StartupOps.js.map +1 -1
  57. package/cjs/ops/utils/Console.js +47 -22
  58. package/cjs/ops/utils/Console.js.map +1 -1
  59. package/cjs/ops/utils/DataProtection.js +12 -5
  60. package/cjs/ops/utils/DataProtection.js.map +1 -1
  61. package/cjs/ops/utils/DataProtection.test.js.map +1 -1
  62. package/cjs/ops/utils/ExportImportUtils.js +15 -8
  63. package/cjs/ops/utils/ExportImportUtils.js.map +1 -1
  64. package/cjs/ops/utils/ScriptValidationUtils.js +33 -8
  65. package/cjs/ops/utils/ScriptValidationUtils.js.map +1 -1
  66. package/cjs/ops/utils/ScriptValidationUtils.test.js.map +1 -1
  67. package/cjs/utils/SetupPollyForFrodoLib.js +67 -19
  68. package/cjs/utils/SetupPollyForFrodoLib.js.map +1 -1
  69. package/esm/api/AgentApi.mjs +64 -16
  70. package/esm/api/ApiTypes.mjs +1 -50
  71. package/esm/api/BaseApi.mjs +21 -11
  72. package/esm/api/cloud/SecretsApi.mjs +0 -5
  73. package/esm/api/cloud/SecretsApi.test.mjs +3 -3
  74. package/esm/ops/AdminOps.mjs +254 -60
  75. package/esm/ops/AgentOps.mjs +352 -104
  76. package/esm/ops/AuthenticateOps.mjs +253 -60
  77. package/esm/ops/CirclesOfTrustOps.mjs +16 -4
  78. package/esm/ops/ConnectionProfileOps.mjs +163 -40
  79. package/esm/ops/EmailTemplateOps.mjs +5 -0
  80. package/esm/ops/IdpOps.mjs +55 -12
  81. package/esm/ops/JourneyOps.mjs +639 -132
  82. package/esm/ops/NodeOps.mjs +90 -19
  83. package/esm/ops/OAuth2ClientOps.mjs +45 -11
  84. package/esm/ops/OpsTypes.mjs +1 -22
  85. package/esm/ops/OrganizationOps.mjs +44 -10
  86. package/esm/ops/PolicyOps.mjs +86 -24
  87. package/esm/ops/PolicySetOps.mjs +72 -18
  88. package/esm/ops/ResourceTypeOps.mjs +24 -6
  89. package/esm/ops/Saml2Ops.mjs +120 -33
  90. package/esm/ops/Saml2Ops.test.mjs +10 -11
  91. package/esm/ops/ScriptOps.mjs +73 -17
  92. package/esm/ops/ServiceOps.mjs +152 -35
  93. package/esm/ops/ThemeOps.mjs +20 -5
  94. package/esm/ops/cloud/FeatureOps.mjs +4 -1
  95. package/esm/ops/cloud/ServiceAccountOps.mjs +24 -6
  96. package/esm/ops/cloud/StartupOps.mjs +55 -11
  97. package/esm/ops/utils/Console.mjs +33 -9
  98. package/esm/ops/utils/DataProtection.mjs +9 -2
  99. package/esm/ops/utils/DataProtection.test.mjs +8 -2
  100. package/esm/ops/utils/ExportImportUtils.mjs +15 -8
  101. package/esm/ops/utils/ScriptValidationUtils.mjs +30 -8
  102. package/esm/ops/utils/ScriptValidationUtils.test.mjs +14 -3
  103. package/esm/utils/SetupPollyForFrodoLib.mjs +64 -18
  104. package/package.json +1 -1
  105. package/types/api/AgentApi.d.ts +6 -6
  106. package/types/api/AgentApi.d.ts.map +1 -1
  107. package/types/api/ApiTypes.d.ts +12 -49
  108. package/types/api/ApiTypes.d.ts.map +1 -1
  109. package/types/api/BaseApi.d.ts.map +1 -1
  110. package/types/api/cloud/SecretsApi.d.ts +1 -4
  111. package/types/api/cloud/SecretsApi.d.ts.map +1 -1
  112. package/types/ops/AdminOps.d.ts.map +1 -1
  113. package/types/ops/AgentOps.d.ts +3 -6
  114. package/types/ops/AgentOps.d.ts.map +1 -1
  115. package/types/ops/AuthenticateOps.d.ts.map +1 -1
  116. package/types/ops/CirclesOfTrustOps.d.ts.map +1 -1
  117. package/types/ops/ConnectionProfileOps.d.ts.map +1 -1
  118. package/types/ops/EmailTemplateOps.d.ts +4 -0
  119. package/types/ops/EmailTemplateOps.d.ts.map +1 -1
  120. package/types/ops/IdpOps.d.ts.map +1 -1
  121. package/types/ops/JourneyOps.d.ts +10 -4
  122. package/types/ops/JourneyOps.d.ts.map +1 -1
  123. package/types/ops/NodeOps.d.ts +10 -4
  124. package/types/ops/NodeOps.d.ts.map +1 -1
  125. package/types/ops/OAuth2ClientOps.d.ts.map +1 -1
  126. package/types/ops/OpsTypes.d.ts +2 -12
  127. package/types/ops/OpsTypes.d.ts.map +1 -1
  128. package/types/ops/OrganizationOps.d.ts.map +1 -1
  129. package/types/ops/PolicyOps.d.ts.map +1 -1
  130. package/types/ops/PolicySetOps.d.ts.map +1 -1
  131. package/types/ops/ResourceTypeOps.d.ts.map +1 -1
  132. package/types/ops/Saml2Ops.d.ts.map +1 -1
  133. package/types/ops/ScriptOps.d.ts.map +1 -1
  134. package/types/ops/ServiceOps.d.ts.map +1 -1
  135. package/types/ops/ThemeOps.d.ts.map +1 -1
  136. package/types/ops/cloud/FeatureOps.d.ts.map +1 -1
  137. package/types/ops/cloud/SecretsOps.d.ts +1 -1
  138. package/types/ops/cloud/SecretsOps.d.ts.map +1 -1
  139. package/types/ops/cloud/ServiceAccountOps.d.ts.map +1 -1
  140. package/types/ops/cloud/StartupOps.d.ts.map +1 -1
  141. package/types/ops/utils/Console.d.ts +34 -7
  142. package/types/ops/utils/Console.d.ts.map +1 -1
  143. package/types/ops/utils/DataProtection.d.ts +5 -1
  144. package/types/ops/utils/DataProtection.d.ts.map +1 -1
  145. package/types/ops/utils/ExportImportUtils.d.ts.map +1 -1
  146. package/types/ops/utils/ScriptValidationUtils.d.ts +14 -4
  147. package/types/ops/utils/ScriptValidationUtils.d.ts.map +1 -1
  148. package/types/utils/SetupPollyForFrodoLib.d.ts +5 -1
  149. package/types/utils/SetupPollyForFrodoLib.d.ts.map +1 -1
@@ -424,19 +424,29 @@ async function addAdminScopes({
424
424
  addDefaultScope = true;
425
425
  modClient.coreOAuth2ClientConfig.defaultScopes.value = adminDefaultScopes;
426
426
  } else {
427
- printMessage(`Client "${clientId}" already has default scopes configured, not adding admin default scope.`);
427
+ printMessage({
428
+ message: `Client "${clientId}" already has default scopes configured, not adding admin default scope.`,
429
+ state
430
+ });
428
431
  }
429
432
  }
430
433
  if (addScopes.length > 0 || addDefaultScope) {
431
- printMessage(`Adding admin scopes to client "${clientId}"...`);
434
+ printMessage({
435
+ message: `Adding admin scopes to client "${clientId}"...`,
436
+ state
437
+ });
432
438
  } else {
433
- printMessage(`Client "${clientId}" already has admin scopes.`);
439
+ printMessage({
440
+ message: `Client "${clientId}" already has admin scopes.`,
441
+ state
442
+ });
434
443
  }
435
444
  return modClient;
436
445
  }
437
446
  function addClientCredentialsGrantType({
438
447
  clientId,
439
- client
448
+ client,
449
+ state
440
450
  }) {
441
451
  const modClient = client;
442
452
  let modified = false;
@@ -450,9 +460,15 @@ function addClientCredentialsGrantType({
450
460
  }
451
461
  modClient.advancedOAuth2ClientConfig.grantTypes.inherited = false;
452
462
  if (modified) {
453
- printMessage(`Adding client credentials grant type to client "${clientId}"...`);
463
+ printMessage({
464
+ message: `Adding client credentials grant type to client "${clientId}"...`,
465
+ state
466
+ });
454
467
  } else {
455
- printMessage(`Client "${clientId}" already has client credentials grant type.`);
468
+ printMessage({
469
+ message: `Client "${clientId}" already has client credentials grant type.`,
470
+ state
471
+ });
456
472
  }
457
473
  return modClient;
458
474
  }
@@ -467,7 +483,11 @@ async function addAdminStaticUserMapping({
467
483
  state
468
484
  });
469
485
  } catch (error) {
470
- printMessage(`Error reading IDM authentication configuration: ${error.message}`, 'error');
486
+ printMessage({
487
+ message: `Error reading IDM authentication configuration: ${error.message}`,
488
+ type: 'error',
489
+ state
490
+ });
471
491
  }
472
492
  let needsAdminMapping = true;
473
493
  let addRoles = [];
@@ -489,7 +509,10 @@ async function addAdminStaticUserMapping({
489
509
  return newMapping;
490
510
  });
491
511
  if (needsAdminMapping) {
492
- printMessage(`Creating static user mapping for client "${name}"...`);
512
+ printMessage({
513
+ message: `Creating static user mapping for client "${name}"...`,
514
+ state
515
+ });
493
516
  mappings.push({
494
517
  subject: name,
495
518
  localUser: 'internal/user/openidm-admin',
@@ -499,7 +522,10 @@ async function addAdminStaticUserMapping({
499
522
  }
500
523
  authentication['rsFilter']['staticUserMapping'] = mappings;
501
524
  if (addRoles.length > 0 || needsAdminMapping) {
502
- printMessage(`Adding admin roles to static user mapping for client "${name}"...`);
525
+ printMessage({
526
+ message: `Adding admin roles to static user mapping for client "${name}"...`,
527
+ state
528
+ });
503
529
  try {
504
530
  await putConfigEntity({
505
531
  entityId: 'authentication',
@@ -507,11 +533,22 @@ async function addAdminStaticUserMapping({
507
533
  state
508
534
  });
509
535
  } catch (putConfigEntityError) {
510
- printMessage(putConfigEntityError, 'error');
511
- printMessage(`Error: ${putConfigEntityError}`, 'error');
536
+ printMessage({
537
+ message: putConfigEntityError,
538
+ type: 'error',
539
+ state
540
+ });
541
+ printMessage({
542
+ message: `Error: ${putConfigEntityError}`,
543
+ type: 'error',
544
+ state
545
+ });
512
546
  }
513
547
  } else {
514
- printMessage(`Static user mapping for client "${name}" already has admin roles.`);
548
+ printMessage({
549
+ message: `Static user mapping for client "${name}" already has admin roles.`,
550
+ state
551
+ });
515
552
  }
516
553
  }
517
554
 
@@ -564,7 +601,10 @@ export async function addAutoIdStaticUserMapping({
564
601
  return newMapping;
565
602
  });
566
603
  if (needsAdminMapping) {
567
- printMessage(`Creating static user mapping for AutoId client "${name}"...`);
604
+ printMessage({
605
+ message: `Creating static user mapping for AutoId client "${name}"...`,
606
+ state
607
+ });
568
608
  mappings.push({
569
609
  subject: name,
570
610
  localUser: 'internal/user/idm-provisioning',
@@ -574,7 +614,10 @@ export async function addAutoIdStaticUserMapping({
574
614
  }
575
615
  authentication.rsFilter.staticUserMapping = mappings;
576
616
  if (addRoles.length > 0 || needsAdminMapping) {
577
- printMessage(`Adding required roles to static user mapping for AutoId client "${name}"...`);
617
+ printMessage({
618
+ message: `Adding required roles to static user mapping for AutoId client "${name}"...`,
619
+ state
620
+ });
578
621
  try {
579
622
  await putConfigEntity({
580
623
  entityId: 'authentication',
@@ -582,11 +625,22 @@ export async function addAutoIdStaticUserMapping({
582
625
  state
583
626
  });
584
627
  } catch (putConfigEntityError) {
585
- printMessage(putConfigEntityError, 'error');
586
- printMessage(`Error: ${putConfigEntityError}`, 'error');
628
+ printMessage({
629
+ message: putConfigEntityError,
630
+ type: 'error',
631
+ state
632
+ });
633
+ printMessage({
634
+ message: `Error: ${putConfigEntityError}`,
635
+ type: 'error',
636
+ state
637
+ });
587
638
  }
588
639
  } else {
589
- printMessage(`Static user mapping for AutoId client "${name}" already has all required roles.`);
640
+ printMessage({
641
+ message: `Static user mapping for AutoId client "${name}" already has all required roles.`,
642
+ state
643
+ });
590
644
  }
591
645
  }
592
646
  export async function grantOAuth2ClientAdminPrivileges({
@@ -610,7 +664,8 @@ export async function grantOAuth2ClientAdminPrivileges({
610
664
  });
611
665
  client = addClientCredentialsGrantType({
612
666
  clientId,
613
- client
667
+ client,
668
+ state
614
669
  });
615
670
  await putOAuth2Client({
616
671
  clientId,
@@ -636,26 +691,39 @@ async function removeAdminScopes({
636
691
  finalScopes = modClient.coreOAuth2ClientConfig.scopes.value.filter(scope => !allAdminScopes.includes(scope));
637
692
  }
638
693
  if (modClient.coreOAuth2ClientConfig.scopes.value.length > finalScopes.length) {
639
- printMessage(`Removing admin scopes from client "${name}"...`);
694
+ printMessage({
695
+ message: `Removing admin scopes from client "${name}"...`,
696
+ state
697
+ });
640
698
  modClient.coreOAuth2ClientConfig.scopes.value = finalScopes;
641
699
  } else {
642
- printMessage(`Client "${name}" has no admin scopes.`);
700
+ printMessage({
701
+ message: `Client "${name}" has no admin scopes.`,
702
+ state
703
+ });
643
704
  }
644
705
  let finalDefaultScopes = [];
645
706
  if (modClient.coreOAuth2ClientConfig.defaultScopes && modClient.coreOAuth2ClientConfig.defaultScopes.value) {
646
707
  finalDefaultScopes = modClient.coreOAuth2ClientConfig.defaultScopes.value.filter(scope => !adminDefaultScopes.includes(scope));
647
708
  }
648
709
  if (modClient.coreOAuth2ClientConfig.defaultScopes.value.length > finalDefaultScopes.length) {
649
- printMessage(`Removing admin default scopes from client "${name}"...`);
710
+ printMessage({
711
+ message: `Removing admin default scopes from client "${name}"...`,
712
+ state
713
+ });
650
714
  modClient.coreOAuth2ClientConfig.defaultScopes.value = finalDefaultScopes;
651
715
  } else {
652
- printMessage(`Client "${name}" has no admin default scopes.`);
716
+ printMessage({
717
+ message: `Client "${name}" has no admin default scopes.`,
718
+ state
719
+ });
653
720
  }
654
721
  return modClient;
655
722
  }
656
723
  function removeClientCredentialsGrantType({
657
724
  clientId,
658
- client
725
+ client,
726
+ state
659
727
  }) {
660
728
  const modClient = client;
661
729
  let modified = false;
@@ -665,10 +733,16 @@ function removeClientCredentialsGrantType({
665
733
  modified = modClient.advancedOAuth2ClientConfig.grantTypes.value.length > finalGrantTypes.length;
666
734
  }
667
735
  if (modified) {
668
- printMessage(`Removing client credentials grant type from client "${clientId}"...`);
736
+ printMessage({
737
+ message: `Removing client credentials grant type from client "${clientId}"...`,
738
+ state
739
+ });
669
740
  modClient.advancedOAuth2ClientConfig.grantTypes.value = finalGrantTypes;
670
741
  } else {
671
- printMessage(`Client "${clientId}" does not allow client credentials grant type.`);
742
+ printMessage({
743
+ message: `Client "${clientId}" does not allow client credentials grant type.`,
744
+ state
745
+ });
672
746
  }
673
747
  return modClient;
674
748
  }
@@ -698,9 +772,15 @@ async function removeAdminStaticUserMapping({
698
772
  authentication.rsFilter.staticUserMapping = mappings;
699
773
  if (modified || removeMapping) {
700
774
  if (removeMapping) {
701
- printMessage(`Removing static user mapping for client "${name}"...`);
775
+ printMessage({
776
+ message: `Removing static user mapping for client "${name}"...`,
777
+ state
778
+ });
702
779
  } else {
703
- printMessage(`Removing admin roles from static user mapping for client "${name}"...`);
780
+ printMessage({
781
+ message: `Removing admin roles from static user mapping for client "${name}"...`,
782
+ state
783
+ });
704
784
  }
705
785
  try {
706
786
  await putConfigEntity({
@@ -709,11 +789,22 @@ async function removeAdminStaticUserMapping({
709
789
  state
710
790
  });
711
791
  } catch (putConfigEntityError) {
712
- printMessage(putConfigEntityError, 'error');
713
- printMessage(`Error: ${putConfigEntityError}`, 'error');
792
+ printMessage({
793
+ message: putConfigEntityError,
794
+ type: 'error',
795
+ state
796
+ });
797
+ printMessage({
798
+ message: `Error: ${putConfigEntityError}`,
799
+ type: 'error',
800
+ state
801
+ });
714
802
  }
715
803
  } else {
716
- printMessage(`Static user mapping for client "${name}" has no admin roles.`);
804
+ printMessage({
805
+ message: `Static user mapping for client "${name}" has no admin roles.`,
806
+ state
807
+ });
717
808
  }
718
809
  }
719
810
  export async function revokeOAuth2ClientAdminPrivileges({
@@ -737,7 +828,8 @@ export async function revokeOAuth2ClientAdminPrivileges({
737
828
  });
738
829
  client = removeClientCredentialsGrantType({
739
830
  clientId,
740
- client
831
+ client,
832
+ state
741
833
  });
742
834
  await putOAuth2Client({
743
835
  clientId,
@@ -774,7 +866,11 @@ export async function createOAuth2ClientWithAdminPrivileges({
774
866
  state
775
867
  });
776
868
  } catch (error) {
777
- printMessage(`Error creating oauth2 client: ${error.message}`, 'error');
869
+ printMessage({
870
+ message: `Error creating oauth2 client: ${error.message}`,
871
+ state,
872
+ type: 'error'
873
+ });
778
874
  }
779
875
  }
780
876
  export async function createLongLivedToken({
@@ -830,7 +926,11 @@ export async function createLongLivedToken({
830
926
  } catch (error) {
831
927
  if (_.get(error, 'response.data.code') === 400 && _.get(error, 'response.data.message') === 'Failed to create secret, the secret already exists') {
832
928
  const newSecret = `${secret}-${expires}`;
833
- printMessage(`esv '${secret}' already exists, using ${newSecret}`, 'warn');
929
+ printMessage({
930
+ message: `esv '${secret}' already exists, using ${newSecret}`,
931
+ type: 'warn',
932
+ state
933
+ });
834
934
  await putSecret({
835
935
  secretId: newSecret,
836
936
  value: response.access_token,
@@ -863,7 +963,10 @@ export async function removeStaticUserMapping({
863
963
  });
864
964
  authentication.rsFilter.staticUserMapping = mappings;
865
965
  if (removeMapping) {
866
- printMessage(`Removing static user mapping for subject "${subject}"...`);
966
+ printMessage({
967
+ message: `Removing static user mapping for subject "${subject}"...`,
968
+ state
969
+ });
867
970
  try {
868
971
  await putConfigEntity({
869
972
  entityId: 'authentication',
@@ -871,11 +974,22 @@ export async function removeStaticUserMapping({
871
974
  state
872
975
  });
873
976
  } catch (putConfigEntityError) {
874
- printMessage(putConfigEntityError, 'error');
875
- printMessage(`Error: ${putConfigEntityError}`, 'error');
977
+ printMessage({
978
+ message: putConfigEntityError,
979
+ type: 'error',
980
+ state
981
+ });
982
+ printMessage({
983
+ message: `Error: ${putConfigEntityError}`,
984
+ type: 'error',
985
+ state
986
+ });
876
987
  }
877
988
  } else {
878
- printMessage(`No static user mapping for subject "${subject}" found.`);
989
+ printMessage({
990
+ message: `No static user mapping for subject "${subject}" found.`,
991
+ state
992
+ });
879
993
  }
880
994
  }
881
995
  export async function hideGenericExtensionAttributes({
@@ -898,21 +1012,33 @@ export async function hideGenericExtensionAttributes({
898
1012
  propertyNames.forEach(name => {
899
1013
  if (isEqualJson(GENERIC_EXTENSION_ATTRIBUTES[name], object.schema.properties[name], ['viewable', 'usageDescription']) || includeCustomized) {
900
1014
  if (object.schema.properties[name].viewable) {
901
- printMessage(`${name}: hide`);
1015
+ printMessage({
1016
+ message: `${name}: hide`,
1017
+ state
1018
+ });
902
1019
  // eslint-disable-next-line no-param-reassign
903
1020
  object.schema.properties[name].viewable = false;
904
1021
  } else {
905
- printMessage(`${name}: ignore (already hidden)`);
1022
+ printMessage({
1023
+ message: `${name}: ignore (already hidden)`,
1024
+ state
1025
+ });
906
1026
  }
907
1027
  } else {
908
- printMessage(`${name}: skip (customized)`);
1028
+ printMessage({
1029
+ message: `${name}: skip (customized)`,
1030
+ state
1031
+ });
909
1032
  }
910
1033
  });
911
1034
  return object;
912
1035
  });
913
1036
  managed.objects = updatedObjects;
914
1037
  if (dryRun) {
915
- printMessage('Dry-run only. Changes are not saved.');
1038
+ printMessage({
1039
+ message: 'Dry-run only. Changes are not saved.',
1040
+ state
1041
+ });
916
1042
  } else {
917
1043
  try {
918
1044
  await putConfigEntity({
@@ -921,8 +1047,16 @@ export async function hideGenericExtensionAttributes({
921
1047
  state
922
1048
  });
923
1049
  } catch (putConfigEntityError) {
924
- printMessage(putConfigEntityError, 'error');
925
- printMessage(`Error: ${putConfigEntityError}`, 'error');
1050
+ printMessage({
1051
+ message: putConfigEntityError,
1052
+ type: 'error',
1053
+ state
1054
+ });
1055
+ printMessage({
1056
+ message: `Error: ${putConfigEntityError}`,
1057
+ type: 'error',
1058
+ state
1059
+ });
926
1060
  }
927
1061
  }
928
1062
  }
@@ -946,21 +1080,33 @@ export async function showGenericExtensionAttributes({
946
1080
  propertyNames.forEach(name => {
947
1081
  if (isEqualJson(GENERIC_EXTENSION_ATTRIBUTES[name], object.schema.properties[name], ['viewable', 'usageDescription']) || includeCustomized) {
948
1082
  if (!object.schema.properties[name].viewable) {
949
- printMessage(`${name}: show`);
1083
+ printMessage({
1084
+ message: `${name}: show`,
1085
+ state
1086
+ });
950
1087
  // eslint-disable-next-line no-param-reassign
951
1088
  object.schema.properties[name].viewable = true;
952
1089
  } else {
953
- printMessage(`${name}: ignore (already showing)`);
1090
+ printMessage({
1091
+ message: `${name}: ignore (already showing)`,
1092
+ state
1093
+ });
954
1094
  }
955
1095
  } else {
956
- printMessage(`${name}: skip (customized)`);
1096
+ printMessage({
1097
+ message: `${name}: skip (customized)`,
1098
+ state
1099
+ });
957
1100
  }
958
1101
  });
959
1102
  return object;
960
1103
  });
961
1104
  managed.objects = updatedObjects;
962
1105
  if (dryRun) {
963
- printMessage('Dry-run only. Changes are not saved.');
1106
+ printMessage({
1107
+ message: 'Dry-run only. Changes are not saved.',
1108
+ state
1109
+ });
964
1110
  } else {
965
1111
  try {
966
1112
  await putConfigEntity({
@@ -969,8 +1115,16 @@ export async function showGenericExtensionAttributes({
969
1115
  state
970
1116
  });
971
1117
  } catch (putConfigEntityError) {
972
- printMessage(putConfigEntityError, 'error');
973
- printMessage(`Error: ${putConfigEntityError}`, 'error');
1118
+ printMessage({
1119
+ message: putConfigEntityError,
1120
+ type: 'error',
1121
+ state
1122
+ });
1123
+ printMessage({
1124
+ message: `Error: ${putConfigEntityError}`,
1125
+ type: 'error',
1126
+ state
1127
+ });
974
1128
  }
975
1129
  }
976
1130
  }
@@ -991,15 +1145,25 @@ async function repairOrgModelUser({
991
1145
  })) {
992
1146
  return object;
993
1147
  }
994
- printMessage(`${object.name}: checking...`);
1148
+ printMessage({
1149
+ message: `${object.name}: checking...`,
1150
+ state
1151
+ });
995
1152
  RDVPs.forEach(name => {
996
1153
  if (!object.schema.properties[name].queryConfig.flattenProperties) {
997
- printMessage(`- ${name}: repairing - needs flattening`, 'warn');
1154
+ printMessage({
1155
+ message: `- ${name}: repairing - needs flattening`,
1156
+ type: 'warn',
1157
+ state
1158
+ });
998
1159
  // eslint-disable-next-line no-param-reassign
999
1160
  object.schema.properties[name].queryConfig.flattenProperties = true;
1000
1161
  repairData = true;
1001
1162
  } else {
1002
- printMessage(`- ${name}: OK`);
1163
+ printMessage({
1164
+ message: `- ${name}: OK`,
1165
+ state
1166
+ });
1003
1167
  }
1004
1168
  });
1005
1169
  return object;
@@ -1013,8 +1177,16 @@ async function repairOrgModelUser({
1013
1177
  state
1014
1178
  });
1015
1179
  } catch (putConfigEntityError) {
1016
- printMessage(putConfigEntityError, 'error');
1017
- printMessage(`Error: ${putConfigEntityError}`, 'error');
1180
+ printMessage({
1181
+ message: putConfigEntityError,
1182
+ type: 'error',
1183
+ state
1184
+ });
1185
+ printMessage({
1186
+ message: `Error: ${putConfigEntityError}`,
1187
+ type: 'error',
1188
+ state
1189
+ });
1018
1190
  }
1019
1191
  }
1020
1192
  return repairData;
@@ -1036,15 +1208,25 @@ async function repairOrgModelOrg({
1036
1208
  })) {
1037
1209
  return object;
1038
1210
  }
1039
- printMessage(`${object.name}: checking...`);
1211
+ printMessage({
1212
+ message: `${object.name}: checking...`,
1213
+ state
1214
+ });
1040
1215
  RDVPs.forEach(name => {
1041
1216
  if (!object.schema.properties[name].queryConfig.flattenProperties) {
1042
- printMessage(`- ${name}: repairing - needs flattening`, 'warn');
1217
+ printMessage({
1218
+ message: `- ${name}: repairing - needs flattening`,
1219
+ type: 'warn',
1220
+ state
1221
+ });
1043
1222
  // eslint-disable-next-line no-param-reassign
1044
1223
  object.schema.properties[name].queryConfig.flattenProperties = true;
1045
1224
  repairData = true;
1046
1225
  } else {
1047
- printMessage(`- ${name}: OK`);
1226
+ printMessage({
1227
+ message: `- ${name}: OK`,
1228
+ state
1229
+ });
1048
1230
  }
1049
1231
  });
1050
1232
  return object;
@@ -1058,8 +1240,16 @@ async function repairOrgModelOrg({
1058
1240
  state
1059
1241
  });
1060
1242
  } catch (putConfigEntityError) {
1061
- printMessage(putConfigEntityError, 'error');
1062
- printMessage(`Error: ${putConfigEntityError}`, 'error');
1243
+ printMessage({
1244
+ message: putConfigEntityError,
1245
+ type: 'error',
1246
+ state
1247
+ });
1248
+ printMessage({
1249
+ message: `Error: ${putConfigEntityError}`,
1250
+ type: 'error',
1251
+ state
1252
+ });
1063
1253
  }
1064
1254
  }
1065
1255
  return repairData;
@@ -1099,7 +1289,11 @@ export async function repairOrgModel({
1099
1289
  await extendOrgModelPermissins(dryRun);
1100
1290
  }
1101
1291
  if (dryRun) {
1102
- printMessage('Dry-run only. Changes are not saved.', 'warn');
1292
+ printMessage({
1293
+ message: 'Dry-run only. Changes are not saved.',
1294
+ type: 'warn',
1295
+ state
1296
+ });
1103
1297
  }
1104
1298
  }
1105
1299