@rockcarver/frodo-cli 0.18.2-9 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +120 -1
- package/esm/app.js +4 -1
- package/esm/app.js.map +1 -1
- package/esm/cli/FrodoCommand.js +140 -0
- package/esm/cli/FrodoCommand.js.map +1 -0
- package/esm/cli/_template/something-delete.js +9 -15
- package/esm/cli/_template/something-delete.js.map +1 -1
- package/esm/cli/_template/something-describe.js +9 -15
- package/esm/cli/_template/something-describe.js.map +1 -1
- package/esm/cli/_template/something-else-delete.js +9 -15
- package/esm/cli/_template/something-else-delete.js.map +1 -1
- package/esm/cli/_template/something-else-describe.js +9 -15
- package/esm/cli/_template/something-else-describe.js.map +1 -1
- package/esm/cli/_template/something-else-export.js +9 -15
- package/esm/cli/_template/something-else-export.js.map +1 -1
- package/esm/cli/_template/something-else-import.js +9 -15
- package/esm/cli/_template/something-else-import.js.map +1 -1
- package/esm/cli/_template/something-else-list.js +9 -15
- package/esm/cli/_template/something-else-list.js.map +1 -1
- package/esm/cli/_template/something-else.js +8 -8
- package/esm/cli/_template/something-else.js.map +1 -1
- package/esm/cli/_template/something-export.js +9 -15
- package/esm/cli/_template/something-export.js.map +1 -1
- package/esm/cli/_template/something-import.js +9 -15
- package/esm/cli/_template/something-import.js.map +1 -1
- package/esm/cli/_template/something-list.js +9 -15
- package/esm/cli/_template/something-list.js.map +1 -1
- package/esm/cli/_template/something-other-delete.js +9 -15
- package/esm/cli/_template/something-other-delete.js.map +1 -1
- package/esm/cli/_template/something-other-describe.js +9 -15
- package/esm/cli/_template/something-other-describe.js.map +1 -1
- package/esm/cli/_template/something-other-export.js +9 -15
- package/esm/cli/_template/something-other-export.js.map +1 -1
- package/esm/cli/_template/something-other-import.js +9 -15
- package/esm/cli/_template/something-other-import.js.map +1 -1
- package/esm/cli/_template/something-other-list.js +9 -15
- package/esm/cli/_template/something-other-list.js.map +1 -1
- package/esm/cli/_template/something-other.js +8 -8
- package/esm/cli/_template/something-other.js.map +1 -1
- package/esm/cli/_template/something.js +9 -10
- package/esm/cli/_template/something.js.map +1 -1
- package/esm/cli/admin/admin-add-autoid-static-user-mapping.js +8 -15
- package/esm/cli/admin/admin-add-autoid-static-user-mapping.js.map +1 -1
- package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js +9 -15
- package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-get-access-token.js +9 -15
- package/esm/cli/admin/admin-get-access-token.js.map +1 -1
- package/esm/cli/admin/admin-grant-oauth2-client-admin-privileges.js +9 -15
- package/esm/cli/admin/admin-grant-oauth2-client-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-hide-generic-extension-attributes.js +9 -15
- package/esm/cli/admin/admin-hide-generic-extension-attributes.js.map +1 -1
- package/esm/cli/admin/admin-list-oauth2-clients-with-admin-privileges.js +8 -15
- package/esm/cli/admin/admin-list-oauth2-clients-with-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-list-oauth2-clients-with-custom-privileges.js +8 -15
- package/esm/cli/admin/admin-list-oauth2-clients-with-custom-privileges.js.map +1 -1
- package/esm/cli/admin/admin-list-static-user-mappings.js +9 -15
- package/esm/cli/admin/admin-list-static-user-mappings.js.map +1 -1
- package/esm/cli/admin/admin-remove-static-user-mapping.js +8 -15
- package/esm/cli/admin/admin-remove-static-user-mapping.js.map +1 -1
- package/esm/cli/admin/admin-repair-org-model.js +9 -15
- package/esm/cli/admin/admin-repair-org-model.js.map +1 -1
- package/esm/cli/admin/admin-revoke-oauth2-client-admin-privileges.js +9 -15
- package/esm/cli/admin/admin-revoke-oauth2-client-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-show-generic-extension-attributes.js +9 -15
- package/esm/cli/admin/admin-show-generic-extension-attributes.js.map +1 -1
- package/esm/cli/admin/admin.js +14 -15
- package/esm/cli/admin/admin.js.map +1 -1
- package/esm/cli/agent/agent-delete.js +8 -15
- package/esm/cli/agent/agent-delete.js.map +1 -1
- package/esm/cli/agent/agent-describe.js +9 -15
- package/esm/cli/agent/agent-describe.js.map +1 -1
- package/esm/cli/agent/agent-export.js +8 -15
- package/esm/cli/agent/agent-export.js.map +1 -1
- package/esm/cli/agent/agent-gateway-delete.js +8 -15
- package/esm/cli/agent/agent-gateway-delete.js.map +1 -1
- package/esm/cli/agent/agent-gateway-describe.js +9 -15
- package/esm/cli/agent/agent-gateway-describe.js.map +1 -1
- package/esm/cli/agent/agent-gateway-export.js +8 -15
- package/esm/cli/agent/agent-gateway-export.js.map +1 -1
- package/esm/cli/agent/agent-gateway-import.js +8 -15
- package/esm/cli/agent/agent-gateway-import.js.map +1 -1
- package/esm/cli/agent/agent-gateway-list.js +9 -15
- package/esm/cli/agent/agent-gateway-list.js.map +1 -1
- package/esm/cli/agent/agent-gateway.js +8 -8
- package/esm/cli/agent/agent-gateway.js.map +1 -1
- package/esm/cli/agent/agent-import.js +8 -15
- package/esm/cli/agent/agent-import.js.map +1 -1
- package/esm/cli/agent/agent-java-delete.js +8 -15
- package/esm/cli/agent/agent-java-delete.js.map +1 -1
- package/esm/cli/agent/agent-java-describe.js +9 -15
- package/esm/cli/agent/agent-java-describe.js.map +1 -1
- package/esm/cli/agent/agent-java-export.js +8 -15
- package/esm/cli/agent/agent-java-export.js.map +1 -1
- package/esm/cli/agent/agent-java-import.js +8 -15
- package/esm/cli/agent/agent-java-import.js.map +1 -1
- package/esm/cli/agent/agent-java-list.js +9 -15
- package/esm/cli/agent/agent-java-list.js.map +1 -1
- package/esm/cli/agent/agent-java.js +8 -8
- package/esm/cli/agent/agent-java.js.map +1 -1
- package/esm/cli/agent/agent-list.js +9 -15
- package/esm/cli/agent/agent-list.js.map +1 -1
- package/esm/cli/agent/agent-web-delete.js +8 -15
- package/esm/cli/agent/agent-web-delete.js.map +1 -1
- package/esm/cli/agent/agent-web-describe.js +9 -15
- package/esm/cli/agent/agent-web-describe.js.map +1 -1
- package/esm/cli/agent/agent-web-export.js +8 -15
- package/esm/cli/agent/agent-web-export.js.map +1 -1
- package/esm/cli/agent/agent-web-import.js +8 -15
- package/esm/cli/agent/agent-web-import.js.map +1 -1
- package/esm/cli/agent/agent-web-list.js +9 -15
- package/esm/cli/agent/agent-web-list.js.map +1 -1
- package/esm/cli/agent/agent-web.js +8 -8
- package/esm/cli/agent/agent-web.js.map +1 -1
- package/esm/cli/agent/agent.js +10 -11
- package/esm/cli/agent/agent.js.map +1 -1
- package/esm/cli/app/app-delete.js +9 -12
- package/esm/cli/app/app-delete.js.map +1 -1
- package/esm/cli/app/app-describe.js +9 -12
- package/esm/cli/app/app-describe.js.map +1 -1
- package/esm/cli/app/app-export.js +28 -34
- package/esm/cli/app/app-export.js.map +1 -1
- package/esm/cli/app/app-import.js +11 -14
- package/esm/cli/app/app-import.js.map +1 -1
- package/esm/cli/app/app-list.js +11 -14
- package/esm/cli/app/app-list.js.map +1 -1
- package/esm/cli/app/app.js +8 -10
- package/esm/cli/app/app.js.map +1 -1
- package/esm/cli/conn/conn-delete.js +5 -5
- package/esm/cli/conn/conn-delete.js.map +1 -1
- package/esm/cli/conn/conn-describe.js +6 -5
- package/esm/cli/conn/conn-describe.js.map +1 -1
- package/esm/cli/conn/conn-list.js +6 -8
- package/esm/cli/conn/conn-list.js.map +1 -1
- package/esm/cli/conn/conn-save.js +72 -0
- package/esm/cli/conn/conn-save.js.map +1 -0
- package/esm/cli/conn/conn.js +10 -8
- package/esm/cli/conn/conn.js.map +1 -1
- package/esm/cli/email/email-template-export.js +27 -33
- package/esm/cli/email/email-template-export.js.map +1 -1
- package/esm/cli/email/email-template-import.js +33 -39
- package/esm/cli/email/email-template-import.js.map +1 -1
- package/esm/cli/email/email-template-list.js +11 -14
- package/esm/cli/email/email-template-list.js.map +1 -1
- package/esm/cli/email/email-template.js +6 -6
- package/esm/cli/email/email-template.js.map +1 -1
- package/esm/cli/email/email.js +2 -2
- package/esm/cli/email/email.js.map +1 -1
- package/esm/cli/esv/esv-apply.js +9 -12
- package/esm/cli/esv/esv-apply.js.map +1 -1
- package/esm/cli/esv/esv-secret-create.js +11 -14
- package/esm/cli/esv/esv-secret-create.js.map +1 -1
- package/esm/cli/esv/esv-secret-delete.js +23 -29
- package/esm/cli/esv/esv-secret-delete.js.map +1 -1
- package/esm/cli/esv/esv-secret-describe.js +11 -14
- package/esm/cli/esv/esv-secret-describe.js.map +1 -1
- package/esm/cli/esv/esv-secret-export.js +9 -12
- package/esm/cli/esv/esv-secret-export.js.map +1 -1
- package/esm/cli/esv/esv-secret-import.js +9 -12
- package/esm/cli/esv/esv-secret-import.js.map +1 -1
- package/esm/cli/esv/esv-secret-list.js +11 -14
- package/esm/cli/esv/esv-secret-list.js.map +1 -1
- package/esm/cli/esv/esv-secret-set.js +11 -14
- package/esm/cli/esv/esv-secret-set.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-activate.js +18 -24
- package/esm/cli/esv/esv-secret-version-activate.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-create.js +11 -14
- package/esm/cli/esv/esv-secret-version-create.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-deactivate.js +18 -24
- package/esm/cli/esv/esv-secret-version-deactivate.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-delete.js +23 -29
- package/esm/cli/esv/esv-secret-version-delete.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-list.js +11 -14
- package/esm/cli/esv/esv-secret-version-list.js.map +1 -1
- package/esm/cli/esv/esv-secret-version.js +8 -8
- package/esm/cli/esv/esv-secret-version.js.map +1 -1
- package/esm/cli/esv/esv-secret.js +11 -11
- package/esm/cli/esv/esv-secret.js.map +1 -1
- package/esm/cli/esv/esv-variable-create.js +10 -14
- package/esm/cli/esv/esv-variable-create.js.map +1 -1
- package/esm/cli/esv/esv-variable-delete.js +23 -29
- package/esm/cli/esv/esv-variable-delete.js.map +1 -1
- package/esm/cli/esv/esv-variable-describe.js +11 -14
- package/esm/cli/esv/esv-variable-describe.js.map +1 -1
- package/esm/cli/esv/esv-variable-export.js +9 -12
- package/esm/cli/esv/esv-variable-export.js.map +1 -1
- package/esm/cli/esv/esv-variable-import.js +9 -12
- package/esm/cli/esv/esv-variable-import.js.map +1 -1
- package/esm/cli/esv/esv-variable-list.js +11 -14
- package/esm/cli/esv/esv-variable-list.js.map +1 -1
- package/esm/cli/esv/esv-variable-set.js +19 -26
- package/esm/cli/esv/esv-variable-set.js.map +1 -1
- package/esm/cli/esv/esv-variable.js +10 -10
- package/esm/cli/esv/esv-variable.js.map +1 -1
- package/esm/cli/esv/esv.js +5 -6
- package/esm/cli/esv/esv.js.map +1 -1
- package/esm/cli/idm/idm-count.js +12 -17
- package/esm/cli/idm/idm-count.js.map +1 -1
- package/esm/cli/idm/idm-export.js +29 -39
- package/esm/cli/idm/idm-export.js.map +1 -1
- package/esm/cli/idm/idm-import.js +29 -39
- package/esm/cli/idm/idm-import.js.map +1 -1
- package/esm/cli/idm/idm-list.js +11 -17
- package/esm/cli/idm/idm-list.js.map +1 -1
- package/esm/cli/idm/idm.js +6 -9
- package/esm/cli/idm/idm.js.map +1 -1
- package/esm/cli/idp/idp-export.js +11 -15
- package/esm/cli/idp/idp-export.js.map +1 -1
- package/esm/cli/idp/idp-import.js +32 -38
- package/esm/cli/idp/idp-import.js.map +1 -1
- package/esm/cli/idp/idp-list.js +9 -13
- package/esm/cli/idp/idp-list.js.map +1 -1
- package/esm/cli/idp/idp.js +5 -6
- package/esm/cli/idp/idp.js.map +1 -1
- package/esm/cli/info/info.js +19 -20
- package/esm/cli/info/info.js.map +1 -1
- package/esm/cli/journey/journey-delete.js +22 -28
- package/esm/cli/journey/journey-delete.js.map +1 -1
- package/esm/cli/journey/journey-describe.js +12 -19
- package/esm/cli/journey/journey-describe.js.map +1 -1
- package/esm/cli/journey/journey-disable.js +20 -26
- package/esm/cli/journey/journey-disable.js.map +1 -1
- package/esm/cli/journey/journey-enable.js +20 -26
- package/esm/cli/journey/journey-enable.js.map +1 -1
- package/esm/cli/journey/journey-export.js +37 -45
- package/esm/cli/journey/journey-export.js.map +1 -1
- package/esm/cli/journey/journey-import.js +44 -52
- package/esm/cli/journey/journey-import.js.map +1 -1
- package/esm/cli/journey/journey-list.js +10 -13
- package/esm/cli/journey/journey-list.js.map +1 -1
- package/esm/cli/journey/journey-prune.js +9 -13
- package/esm/cli/journey/journey-prune.js.map +1 -1
- package/esm/cli/journey/journey.js +10 -11
- package/esm/cli/journey/journey.js.map +1 -1
- package/esm/cli/logging/logs-fetch.js +17 -19
- package/esm/cli/logging/logs-fetch.js.map +1 -1
- package/esm/cli/logging/logs-list.js +19 -25
- package/esm/cli/logging/logs-list.js.map +1 -1
- package/esm/cli/logging/logs-tail.js +17 -19
- package/esm/cli/logging/logs-tail.js.map +1 -1
- package/esm/cli/logging/logs.js +7 -6
- package/esm/cli/logging/logs.js.map +1 -1
- package/esm/cli/realm/realm-add-custom-domain.js +11 -14
- package/esm/cli/realm/realm-add-custom-domain.js.map +1 -1
- package/esm/cli/realm/realm-describe.js +10 -14
- package/esm/cli/realm/realm-describe.js.map +1 -1
- package/esm/cli/realm/realm-list.js +11 -14
- package/esm/cli/realm/realm-list.js.map +1 -1
- package/esm/cli/realm/realm-remove-custom-domain.js +11 -14
- package/esm/cli/realm/realm-remove-custom-domain.js.map +1 -1
- package/esm/cli/realm/realm.js +7 -8
- package/esm/cli/realm/realm.js.map +1 -1
- package/esm/cli/saml/saml-cot-export.js +27 -36
- package/esm/cli/saml/saml-cot-export.js.map +1 -1
- package/esm/cli/saml/saml-cot-import.js +32 -41
- package/esm/cli/saml/saml-cot-import.js.map +1 -1
- package/esm/cli/saml/saml-cot-list.js +10 -16
- package/esm/cli/saml/saml-cot-list.js.map +1 -1
- package/esm/cli/saml/saml-cot.js +6 -6
- package/esm/cli/saml/saml-cot.js.map +1 -1
- package/esm/cli/saml/saml-delete.js +8 -15
- package/esm/cli/saml/saml-delete.js.map +1 -1
- package/esm/cli/saml/saml-describe.js +10 -16
- package/esm/cli/saml/saml-describe.js.map +1 -1
- package/esm/cli/saml/saml-export.js +9 -16
- package/esm/cli/saml/saml-export.js.map +1 -1
- package/esm/cli/saml/saml-import.js +45 -54
- package/esm/cli/saml/saml-import.js.map +1 -1
- package/esm/cli/saml/saml-list.js +11 -17
- package/esm/cli/saml/saml-list.js.map +1 -1
- package/esm/cli/saml/saml-metadata-export.js +21 -30
- package/esm/cli/saml/saml-metadata-export.js.map +1 -1
- package/esm/cli/saml/saml-metadata.js +4 -4
- package/esm/cli/saml/saml-metadata.js.map +1 -1
- package/esm/cli/saml/saml.js +9 -10
- package/esm/cli/saml/saml.js.map +1 -1
- package/esm/cli/script/script-delete.js +9 -12
- package/esm/cli/script/script-delete.js.map +1 -1
- package/esm/cli/script/script-describe.js +9 -12
- package/esm/cli/script/script-describe.js.map +1 -1
- package/esm/cli/script/script-export.js +28 -34
- package/esm/cli/script/script-export.js.map +1 -1
- package/esm/cli/script/script-import.js +10 -13
- package/esm/cli/script/script-import.js.map +1 -1
- package/esm/cli/script/script-list.js +10 -13
- package/esm/cli/script/script-list.js.map +1 -1
- package/esm/cli/script/script.js +7 -8
- package/esm/cli/script/script.js.map +1 -1
- package/esm/cli/service/service-delete.js +10 -16
- package/esm/cli/service/service-delete.js.map +1 -1
- package/esm/cli/service/service-export.js +12 -17
- package/esm/cli/service/service-export.js.map +1 -1
- package/esm/cli/service/service-import.js +12 -18
- package/esm/cli/service/service-import.js.map +1 -1
- package/esm/cli/service/service-list.js +9 -15
- package/esm/cli/service/service-list.js.map +1 -1
- package/esm/cli/service/service.js +6 -7
- package/esm/cli/service/service.js.map +1 -1
- package/esm/cli/theme/theme-delete.js +12 -19
- package/esm/cli/theme/theme-delete.js.map +1 -1
- package/esm/cli/theme/theme-export.js +12 -19
- package/esm/cli/theme/theme-export.js.map +1 -1
- package/esm/cli/theme/theme-import.js +14 -21
- package/esm/cli/theme/theme-import.js.map +1 -1
- package/esm/cli/theme/theme-list.js +10 -16
- package/esm/cli/theme/theme-list.js.map +1 -1
- package/esm/cli/theme/theme.js +6 -7
- package/esm/cli/theme/theme.js.map +1 -1
- package/esm/ops/ConnectionProfileOps.js +30 -0
- package/esm/ops/ConnectionProfileOps.js.map +1 -0
- package/esm/ops/IdmOps.js +317 -0
- package/esm/ops/IdmOps.js.map +1 -0
- package/esm/ops/JourneyOps.js +2 -1
- package/esm/ops/JourneyOps.js.map +1 -1
- package/esm/ops/ServiceOps.js +20 -20
- package/esm/ops/ServiceOps.js.map +1 -1
- package/esm/utils/Console.js +15 -25
- package/esm/utils/Console.js.map +1 -1
- package/package.json +6 -6
- package/esm/cli/cmd_common.js +0 -79
- package/esm/cli/cmd_common.js.map +0 -1
- package/esm/cli/conn/conn-add.js +0 -37
- package/esm/cli/conn/conn-add.js.map +0 -1
- package/esm/cli/journey/journey-delete.e2e.test_.js.map +0 -1
- package/esm/cli/journey/journey-list.e2e.test_.js.map +0 -1
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/* eslint-disable no-await-in-loop */
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import fse from 'fs-extra';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import propertiesReader from 'properties-reader';
|
|
6
|
+
import replaceall from 'replaceall';
|
|
7
|
+
import { Idm, Utils, ValidationUtils } from '@rockcarver/frodo-lib';
|
|
8
|
+
import { createProgressIndicator, printMessage, stopProgressIndicator } from '../utils/Console';
|
|
9
|
+
import { getTypedFilename } from '../utils/ExportImportUtils';
|
|
10
|
+
const {
|
|
11
|
+
readFiles,
|
|
12
|
+
unSubstituteEnvParams
|
|
13
|
+
} = Utils;
|
|
14
|
+
const {
|
|
15
|
+
validateScriptHooks
|
|
16
|
+
} = ValidationUtils;
|
|
17
|
+
const {
|
|
18
|
+
getAllConfigEntities,
|
|
19
|
+
getConfigEntity,
|
|
20
|
+
putConfigEntity,
|
|
21
|
+
queryAllManagedObjectsByType
|
|
22
|
+
} = Idm;
|
|
23
|
+
/**
|
|
24
|
+
* List all IDM configuration objects
|
|
25
|
+
*/
|
|
26
|
+
export async function listAllConfigEntities() {
|
|
27
|
+
try {
|
|
28
|
+
const {
|
|
29
|
+
configurations
|
|
30
|
+
} = await getAllConfigEntities();
|
|
31
|
+
for (const configEntity of configurations) {
|
|
32
|
+
printMessage(`${configEntity._id}`, 'data');
|
|
33
|
+
}
|
|
34
|
+
} catch (getAllConfigEntitiesError) {
|
|
35
|
+
printMessage(getAllConfigEntitiesError, 'error');
|
|
36
|
+
printMessage(`Error getting config entities: ${getAllConfigEntitiesError}`, 'error');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Export an IDM configuration object.
|
|
42
|
+
* @param {String} id the desired configuration object
|
|
43
|
+
* @param {String} file optional export file
|
|
44
|
+
*/
|
|
45
|
+
export async function exportConfigEntity(id, file) {
|
|
46
|
+
let fileName = file;
|
|
47
|
+
if (!fileName) {
|
|
48
|
+
fileName = getTypedFilename(`${id}`, 'idm');
|
|
49
|
+
}
|
|
50
|
+
const configEntity = await getConfigEntity(id);
|
|
51
|
+
fs.writeFile(fileName, JSON.stringify(configEntity, null, 2), err => {
|
|
52
|
+
if (err) {
|
|
53
|
+
return printMessage(`ERROR - can't save ${id} export to file`, 'error');
|
|
54
|
+
}
|
|
55
|
+
return '';
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Export all IDM configuration objects into separate JSON files in a directory specified by <directory>
|
|
61
|
+
* @param {String} directory export directory
|
|
62
|
+
*/
|
|
63
|
+
export async function exportAllRawConfigEntities(directory) {
|
|
64
|
+
try {
|
|
65
|
+
const {
|
|
66
|
+
configurations
|
|
67
|
+
} = await getAllConfigEntities();
|
|
68
|
+
if (!fs.existsSync(directory)) {
|
|
69
|
+
fs.mkdirSync(directory);
|
|
70
|
+
}
|
|
71
|
+
createProgressIndicator('indeterminate', undefined, 'Exporting config objects...');
|
|
72
|
+
const entityPromises = [];
|
|
73
|
+
for (const configEntity of configurations) {
|
|
74
|
+
entityPromises.push(getConfigEntity(configEntity._id).catch(getConfigEntityError => {
|
|
75
|
+
var _getConfigEntityError, _getConfigEntityError2, _getConfigEntityError3, _getConfigEntityError4, _getConfigEntityError5, _getConfigEntityError6;
|
|
76
|
+
if (!(((_getConfigEntityError = getConfigEntityError.response) === null || _getConfigEntityError === void 0 ? void 0 : _getConfigEntityError.status) === 403 && ((_getConfigEntityError2 = getConfigEntityError.response) === null || _getConfigEntityError2 === void 0 ? void 0 : (_getConfigEntityError3 = _getConfigEntityError2.data) === null || _getConfigEntityError3 === void 0 ? void 0 : _getConfigEntityError3.message) === 'This operation is not available in ForgeRock Identity Cloud.') &&
|
|
77
|
+
// https://bugster.forgerock.org/jira/browse/OPENIDM-18270
|
|
78
|
+
!(((_getConfigEntityError4 = getConfigEntityError.response) === null || _getConfigEntityError4 === void 0 ? void 0 : _getConfigEntityError4.status) === 404 && ((_getConfigEntityError5 = getConfigEntityError.response) === null || _getConfigEntityError5 === void 0 ? void 0 : (_getConfigEntityError6 = _getConfigEntityError5.data) === null || _getConfigEntityError6 === void 0 ? void 0 : _getConfigEntityError6.message) === 'No configuration exists for id org.apache.felix.fileinstall/openidm')) {
|
|
79
|
+
var _getConfigEntityError7;
|
|
80
|
+
printMessage((_getConfigEntityError7 = getConfigEntityError.response) === null || _getConfigEntityError7 === void 0 ? void 0 : _getConfigEntityError7.data, 'error');
|
|
81
|
+
printMessage(`Error getting config entity ${configEntity._id}: ${getConfigEntityError}`, 'error');
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
const results = await Promise.all(entityPromises);
|
|
86
|
+
for (const item of results) {
|
|
87
|
+
if (item != null) {
|
|
88
|
+
fse.outputFile(`${directory}/${item._id}.json`, JSON.stringify(item, null, 2), err => {
|
|
89
|
+
if (err) {
|
|
90
|
+
return printMessage(`ERROR - can't save config ${item._id} to file - ${err}`, 'error');
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
stopProgressIndicator('Exported config objects.', 'success');
|
|
96
|
+
} catch (getAllConfigEntitiesError) {
|
|
97
|
+
printMessage(getAllConfigEntitiesError, 'error');
|
|
98
|
+
printMessage(`Error getting config entities: ${getAllConfigEntitiesError}`, 'error');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Export all IDM configuration objects
|
|
104
|
+
* @param {String} directory export directory
|
|
105
|
+
* @param {String} entitiesFile JSON file that specifies the config entities to export/import
|
|
106
|
+
* @param {String} envFile File that defines environment specific variables for replacement during configuration export/import
|
|
107
|
+
*/
|
|
108
|
+
export async function exportAllConfigEntities(directory, entitiesFile, envFile) {
|
|
109
|
+
let entriesToExport = [];
|
|
110
|
+
// read list of entities to export
|
|
111
|
+
fs.readFile(entitiesFile, 'utf8', async (err, data) => {
|
|
112
|
+
if (err) throw err;
|
|
113
|
+
const entriesData = JSON.parse(data);
|
|
114
|
+
entriesToExport = entriesData.idm;
|
|
115
|
+
// console.log(`entriesToExport ${entriesToExport}`);
|
|
116
|
+
|
|
117
|
+
// read list of configs to parameterize for environment specific values
|
|
118
|
+
const envParams = propertiesReader(envFile);
|
|
119
|
+
try {
|
|
120
|
+
const {
|
|
121
|
+
configurations
|
|
122
|
+
} = await getAllConfigEntities();
|
|
123
|
+
// create export directory if not exist
|
|
124
|
+
if (!fs.existsSync(directory)) {
|
|
125
|
+
fs.mkdirSync(directory);
|
|
126
|
+
}
|
|
127
|
+
createProgressIndicator('indeterminate', undefined, 'Exporting config objects...');
|
|
128
|
+
const entityPromises = [];
|
|
129
|
+
for (const configEntity of configurations) {
|
|
130
|
+
if (entriesToExport.includes(configEntity._id)) {
|
|
131
|
+
entityPromises.push(getConfigEntity(configEntity._id));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const results = await Promise.all(entityPromises);
|
|
135
|
+
for (const item of results) {
|
|
136
|
+
if (item != null) {
|
|
137
|
+
let configEntityString = JSON.stringify(item, null, 2);
|
|
138
|
+
envParams.each((key, value) => {
|
|
139
|
+
configEntityString = replaceall(value, `\${${key}}`, configEntityString);
|
|
140
|
+
});
|
|
141
|
+
fse.outputFile(`${directory}/${item._id}.json`, configEntityString, error => {
|
|
142
|
+
if (err) {
|
|
143
|
+
return printMessage(`ERROR - can't save config ${item._id} to file - ${error}`, 'error');
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
stopProgressIndicator(null, 'success');
|
|
149
|
+
} catch (getAllConfigEntitiesError) {
|
|
150
|
+
printMessage(getAllConfigEntitiesError, 'error');
|
|
151
|
+
printMessage(`Error getting config entities: ${getAllConfigEntitiesError}`, 'error');
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Import an IDM configuration object.
|
|
158
|
+
* @param entityId the configuration object to import
|
|
159
|
+
* @param file optional file to import
|
|
160
|
+
*/
|
|
161
|
+
export async function importConfigEntity(entityId, file, validate) {
|
|
162
|
+
if (!file) {
|
|
163
|
+
file = getTypedFilename(entityId, 'idm');
|
|
164
|
+
}
|
|
165
|
+
const entityData = fs.readFileSync(path.resolve(process.cwd(), file), 'utf8');
|
|
166
|
+
const jsObject = JSON.parse(entityData);
|
|
167
|
+
const isValid = validateScriptHooks(jsObject);
|
|
168
|
+
if (validate && !isValid) {
|
|
169
|
+
printMessage('Invalid IDM configuration object', 'error');
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
try {
|
|
173
|
+
await putConfigEntity(entityId, entityData);
|
|
174
|
+
} catch (putConfigEntityError) {
|
|
175
|
+
printMessage(putConfigEntityError, 'error');
|
|
176
|
+
printMessage(`Error: ${putConfigEntityError}`, 'error');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Import all IDM configuration objects from separate JSON files in a directory specified by <directory>
|
|
182
|
+
* @param baseDirectory export directory
|
|
183
|
+
* @param validate validate script hooks
|
|
184
|
+
*/
|
|
185
|
+
export async function importAllRawConfigEntities(baseDirectory, validate) {
|
|
186
|
+
if (!fs.existsSync(baseDirectory)) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const files = await readFiles(baseDirectory);
|
|
190
|
+
const jsonFiles = files.filter(({
|
|
191
|
+
path
|
|
192
|
+
}) => path.toLowerCase().endsWith('.json')).map(({
|
|
193
|
+
path,
|
|
194
|
+
content
|
|
195
|
+
}) => ({
|
|
196
|
+
// Remove .json extension
|
|
197
|
+
entityId: path.substring(0, path.length - 5),
|
|
198
|
+
content,
|
|
199
|
+
path
|
|
200
|
+
}));
|
|
201
|
+
let everyScriptValid = true;
|
|
202
|
+
for (const file of jsonFiles) {
|
|
203
|
+
const jsObject = JSON.parse(file.content);
|
|
204
|
+
const isScriptValid = validateScriptHooks(jsObject);
|
|
205
|
+
if (!isScriptValid) {
|
|
206
|
+
printMessage(`Invalid script hook in ${file.path}`, 'error');
|
|
207
|
+
everyScriptValid = false;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (validate && !everyScriptValid) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
createProgressIndicator('indeterminate', undefined, 'Importing config objects...');
|
|
214
|
+
const entityPromises = jsonFiles.map(file => {
|
|
215
|
+
return putConfigEntity(file.entityId, file.content);
|
|
216
|
+
});
|
|
217
|
+
const results = await Promise.allSettled(entityPromises);
|
|
218
|
+
const errors = results.filter(result => result.status === 'rejected');
|
|
219
|
+
if (errors.length > 0) {
|
|
220
|
+
printMessage(`Failed to import ${errors.length} config objects:`, 'error');
|
|
221
|
+
for (const error of errors) {
|
|
222
|
+
printMessage(`- ${error.reason}`, 'error');
|
|
223
|
+
}
|
|
224
|
+
stopProgressIndicator(`Failed to import ${errors.length} config objects`, 'error');
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
stopProgressIndicator(`Imported ${results.length} config objects`, 'success');
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Import all IDM configuration objects
|
|
232
|
+
* @param baseDirectory import directory
|
|
233
|
+
* @param entitiesFile JSON file that specifies the config entities to export/import
|
|
234
|
+
* @param envFile File that defines environment specific variables for replacement during configuration export/import
|
|
235
|
+
* @param validate validate script hooks
|
|
236
|
+
*/
|
|
237
|
+
export async function importAllConfigEntities(baseDirectory, entitiesFile, envFile, validate) {
|
|
238
|
+
if (!fs.existsSync(baseDirectory)) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const entriesToImport = JSON.parse(fs.readFileSync(entitiesFile, 'utf8')).idm;
|
|
242
|
+
const envReader = propertiesReader(envFile);
|
|
243
|
+
const files = await readFiles(baseDirectory);
|
|
244
|
+
const jsonFiles = files.filter(({
|
|
245
|
+
path
|
|
246
|
+
}) => path.toLowerCase().endsWith('.json')).map(({
|
|
247
|
+
content,
|
|
248
|
+
path
|
|
249
|
+
}) => ({
|
|
250
|
+
// Remove .json extension
|
|
251
|
+
entityId: path.substring(0, path.length - 5),
|
|
252
|
+
content,
|
|
253
|
+
path
|
|
254
|
+
}));
|
|
255
|
+
let everyScriptValid = true;
|
|
256
|
+
for (const file of jsonFiles) {
|
|
257
|
+
const jsObject = JSON.parse(file.content);
|
|
258
|
+
const isScriptValid = validateScriptHooks(jsObject);
|
|
259
|
+
if (!isScriptValid) {
|
|
260
|
+
printMessage(`Invalid script hook in ${file.path}`, 'error');
|
|
261
|
+
everyScriptValid = false;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (validate && !everyScriptValid) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
createProgressIndicator('indeterminate', undefined, 'Importing config objects...');
|
|
268
|
+
const entityPromises = jsonFiles.filter(({
|
|
269
|
+
entityId
|
|
270
|
+
}) => {
|
|
271
|
+
return entriesToImport.includes(entityId);
|
|
272
|
+
}).map(({
|
|
273
|
+
entityId,
|
|
274
|
+
content
|
|
275
|
+
}) => {
|
|
276
|
+
const unsubstituted = unSubstituteEnvParams(content, envReader);
|
|
277
|
+
return putConfigEntity(entityId, unsubstituted);
|
|
278
|
+
});
|
|
279
|
+
const results = await Promise.allSettled(entityPromises);
|
|
280
|
+
const errors = results.filter(result => result.status === 'rejected');
|
|
281
|
+
if (errors.length > 0) {
|
|
282
|
+
printMessage(`Failed to import ${errors.length} config objects:`, 'error');
|
|
283
|
+
for (const error of errors) {
|
|
284
|
+
printMessage(`- ${error.reason}`, 'error');
|
|
285
|
+
}
|
|
286
|
+
stopProgressIndicator(`Failed to import ${errors.length} config objects`, 'error');
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
stopProgressIndicator(`Imported ${results.length} config objects`, 'success');
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Count number of managed objects of a given type
|
|
294
|
+
* @param {String} type managed object type, e.g. alpha_user
|
|
295
|
+
*/
|
|
296
|
+
export async function countManagedObjects(type) {
|
|
297
|
+
let count = 0;
|
|
298
|
+
let result = {
|
|
299
|
+
result: [],
|
|
300
|
+
resultCount: 0,
|
|
301
|
+
pagedResultsCookie: null,
|
|
302
|
+
totalPagedResultsPolicy: 'NONE',
|
|
303
|
+
totalPagedResults: -1,
|
|
304
|
+
remainingPagedResults: -1
|
|
305
|
+
};
|
|
306
|
+
try {
|
|
307
|
+
do {
|
|
308
|
+
result = await queryAllManagedObjectsByType(type, [], result.pagedResultsCookie);
|
|
309
|
+
count += result.resultCount;
|
|
310
|
+
} while (result.pagedResultsCookie);
|
|
311
|
+
printMessage(`${type}: ${count}`);
|
|
312
|
+
} catch (error) {
|
|
313
|
+
printMessage(error.response.data, 'error');
|
|
314
|
+
printMessage(`Error querying managed objects by type: ${error}`, 'error');
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
//# sourceMappingURL=IdmOps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdmOps.js","names":["fs","fse","path","propertiesReader","replaceall","Idm","Utils","ValidationUtils","createProgressIndicator","printMessage","stopProgressIndicator","getTypedFilename","readFiles","unSubstituteEnvParams","validateScriptHooks","getAllConfigEntities","getConfigEntity","putConfigEntity","queryAllManagedObjectsByType","listAllConfigEntities","configurations","configEntity","_id","getAllConfigEntitiesError","exportConfigEntity","id","file","fileName","writeFile","JSON","stringify","err","exportAllRawConfigEntities","directory","existsSync","mkdirSync","undefined","entityPromises","push","catch","getConfigEntityError","response","status","data","message","results","Promise","all","item","outputFile","exportAllConfigEntities","entitiesFile","envFile","entriesToExport","readFile","entriesData","parse","idm","envParams","includes","configEntityString","each","key","value","error","importConfigEntity","entityId","validate","entityData","readFileSync","resolve","process","cwd","jsObject","isValid","putConfigEntityError","importAllRawConfigEntities","baseDirectory","files","jsonFiles","filter","toLowerCase","endsWith","map","content","substring","length","everyScriptValid","isScriptValid","allSettled","errors","result","reason","importAllConfigEntities","entriesToImport","envReader","unsubstituted","countManagedObjects","type","count","resultCount","pagedResultsCookie","totalPagedResultsPolicy","totalPagedResults","remainingPagedResults"],"sources":["ops/IdmOps.ts"],"sourcesContent":["/* eslint-disable no-await-in-loop */\nimport fs from 'fs';\nimport fse from 'fs-extra';\nimport path from 'path';\nimport propertiesReader from 'properties-reader';\nimport replaceall from 'replaceall';\n\nimport { Idm, Utils, ValidationUtils } from '@rockcarver/frodo-lib';\nimport {\n createProgressIndicator,\n printMessage,\n stopProgressIndicator,\n} from '../utils/Console';\nimport { getTypedFilename } from '../utils/ExportImportUtils';\n\nconst { readFiles, unSubstituteEnvParams } = Utils;\nconst { validateScriptHooks } = ValidationUtils;\nconst {\n getAllConfigEntities,\n getConfigEntity,\n putConfigEntity,\n queryAllManagedObjectsByType,\n} = Idm;\n/**\n * List all IDM configuration objects\n */\nexport async function listAllConfigEntities() {\n try {\n const { configurations } = await getAllConfigEntities();\n for (const configEntity of configurations) {\n printMessage(`${configEntity._id}`, 'data');\n }\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n}\n\n/**\n * Export an IDM configuration object.\n * @param {String} id the desired configuration object\n * @param {String} file optional export file\n */\nexport async function exportConfigEntity(id, file) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`${id}`, 'idm');\n }\n const configEntity = await getConfigEntity(id);\n fs.writeFile(fileName, JSON.stringify(configEntity, null, 2), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${id} export to file`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Export all IDM configuration objects into separate JSON files in a directory specified by <directory>\n * @param {String} directory export directory\n */\nexport async function exportAllRawConfigEntities(directory) {\n try {\n const { configurations } = await getAllConfigEntities();\n if (!fs.existsSync(directory)) {\n fs.mkdirSync(directory);\n }\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Exporting config objects...'\n );\n const entityPromises = [];\n for (const configEntity of configurations) {\n entityPromises.push(\n getConfigEntity(configEntity._id).catch((getConfigEntityError) => {\n if (\n !(\n getConfigEntityError.response?.status === 403 &&\n getConfigEntityError.response?.data?.message ===\n 'This operation is not available in ForgeRock Identity Cloud.'\n ) &&\n // https://bugster.forgerock.org/jira/browse/OPENIDM-18270\n !(\n getConfigEntityError.response?.status === 404 &&\n getConfigEntityError.response?.data?.message ===\n 'No configuration exists for id org.apache.felix.fileinstall/openidm'\n )\n ) {\n printMessage(getConfigEntityError.response?.data, 'error');\n printMessage(\n `Error getting config entity ${configEntity._id}: ${getConfigEntityError}`,\n 'error'\n );\n }\n })\n );\n }\n const results = await Promise.all(entityPromises);\n for (const item of results) {\n if (item != null) {\n fse.outputFile(\n `${directory}/${item._id}.json`,\n JSON.stringify(item, null, 2),\n (err) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${item._id} to file - ${err}`,\n 'error'\n );\n }\n }\n );\n }\n }\n stopProgressIndicator('Exported config objects.', 'success');\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n}\n\n/**\n * Export all IDM configuration objects\n * @param {String} directory export directory\n * @param {String} entitiesFile JSON file that specifies the config entities to export/import\n * @param {String} envFile File that defines environment specific variables for replacement during configuration export/import\n */\nexport async function exportAllConfigEntities(\n directory,\n entitiesFile,\n envFile\n) {\n let entriesToExport = [];\n // read list of entities to export\n fs.readFile(entitiesFile, 'utf8', async (err, data) => {\n if (err) throw err;\n const entriesData = JSON.parse(data);\n entriesToExport = entriesData.idm;\n // console.log(`entriesToExport ${entriesToExport}`);\n\n // read list of configs to parameterize for environment specific values\n const envParams = propertiesReader(envFile);\n\n try {\n const { configurations } = await getAllConfigEntities();\n // create export directory if not exist\n if (!fs.existsSync(directory)) {\n fs.mkdirSync(directory);\n }\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Exporting config objects...'\n );\n const entityPromises = [];\n for (const configEntity of configurations) {\n if (entriesToExport.includes(configEntity._id)) {\n entityPromises.push(getConfigEntity(configEntity._id));\n }\n }\n const results = await Promise.all(entityPromises);\n for (const item of results) {\n if (item != null) {\n let configEntityString = JSON.stringify(item, null, 2);\n envParams.each((key, value) => {\n configEntityString = replaceall(\n value,\n `\\${${key}}`,\n configEntityString\n );\n });\n fse.outputFile(\n `${directory}/${item._id}.json`,\n configEntityString,\n (error) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${item._id} to file - ${error}`,\n 'error'\n );\n }\n }\n );\n }\n }\n stopProgressIndicator(null, 'success');\n } catch (getAllConfigEntitiesError) {\n printMessage(getAllConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${getAllConfigEntitiesError}`,\n 'error'\n );\n }\n });\n}\n\n/**\n * Import an IDM configuration object.\n * @param entityId the configuration object to import\n * @param file optional file to import\n */\nexport async function importConfigEntity(\n entityId: string,\n file?: string,\n validate?: boolean\n) {\n if (!file) {\n file = getTypedFilename(entityId, 'idm');\n }\n\n const entityData = fs.readFileSync(path.resolve(process.cwd(), file), 'utf8');\n\n const jsObject = JSON.parse(entityData);\n const isValid = validateScriptHooks(jsObject);\n if (validate && !isValid) {\n printMessage('Invalid IDM configuration object', 'error');\n return;\n }\n\n try {\n await putConfigEntity(entityId, entityData);\n } catch (putConfigEntityError) {\n printMessage(putConfigEntityError, 'error');\n printMessage(`Error: ${putConfigEntityError}`, 'error');\n }\n}\n\n/**\n * Import all IDM configuration objects from separate JSON files in a directory specified by <directory>\n * @param baseDirectory export directory\n * @param validate validate script hooks\n */\nexport async function importAllRawConfigEntities(\n baseDirectory: string,\n validate?: boolean\n) {\n if (!fs.existsSync(baseDirectory)) {\n return;\n }\n const files = await readFiles(baseDirectory);\n const jsonFiles = files\n .filter(({ path }) => path.toLowerCase().endsWith('.json'))\n .map(({ path, content }) => ({\n // Remove .json extension\n entityId: path.substring(0, path.length - 5),\n content,\n path,\n }));\n\n let everyScriptValid = true;\n for (const file of jsonFiles) {\n const jsObject = JSON.parse(file.content);\n const isScriptValid = validateScriptHooks(jsObject);\n if (!isScriptValid) {\n printMessage(`Invalid script hook in ${file.path}`, 'error');\n everyScriptValid = false;\n }\n }\n\n if (validate && !everyScriptValid) {\n return;\n }\n\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Importing config objects...'\n );\n\n const entityPromises = jsonFiles.map((file) => {\n return putConfigEntity(file.entityId, file.content);\n });\n\n const results = await Promise.allSettled(entityPromises);\n const errors = results.filter(\n (result): result is PromiseRejectedResult => result.status === 'rejected'\n );\n\n if (errors.length > 0) {\n printMessage(`Failed to import ${errors.length} config objects:`, 'error');\n for (const error of errors) {\n printMessage(`- ${error.reason}`, 'error');\n }\n stopProgressIndicator(\n `Failed to import ${errors.length} config objects`,\n 'error'\n );\n return;\n }\n\n stopProgressIndicator(`Imported ${results.length} config objects`, 'success');\n}\n\n/**\n * Import all IDM configuration objects\n * @param baseDirectory import directory\n * @param entitiesFile JSON file that specifies the config entities to export/import\n * @param envFile File that defines environment specific variables for replacement during configuration export/import\n * @param validate validate script hooks\n */\nexport async function importAllConfigEntities(\n baseDirectory: string,\n entitiesFile: string,\n envFile: string,\n validate?: boolean\n) {\n if (!fs.existsSync(baseDirectory)) {\n return;\n }\n const entriesToImport = JSON.parse(fs.readFileSync(entitiesFile, 'utf8')).idm;\n\n const envReader = propertiesReader(envFile);\n\n const files = await readFiles(baseDirectory);\n const jsonFiles = files\n .filter(({ path }) => path.toLowerCase().endsWith('.json'))\n .map(({ content, path }) => ({\n // Remove .json extension\n entityId: path.substring(0, path.length - 5),\n content,\n path,\n }));\n\n let everyScriptValid = true;\n for (const file of jsonFiles) {\n const jsObject = JSON.parse(file.content);\n const isScriptValid = validateScriptHooks(jsObject);\n if (!isScriptValid) {\n printMessage(`Invalid script hook in ${file.path}`, 'error');\n everyScriptValid = false;\n }\n }\n\n if (validate && !everyScriptValid) {\n return;\n }\n\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Importing config objects...'\n );\n\n const entityPromises = jsonFiles\n .filter(({ entityId }) => {\n return entriesToImport.includes(entityId);\n })\n .map(({ entityId, content }) => {\n const unsubstituted = unSubstituteEnvParams(content, envReader);\n return putConfigEntity(entityId, unsubstituted);\n });\n\n const results = await Promise.allSettled(entityPromises);\n const errors = results.filter(\n (result): result is PromiseRejectedResult => result.status === 'rejected'\n );\n\n if (errors.length > 0) {\n printMessage(`Failed to import ${errors.length} config objects:`, 'error');\n for (const error of errors) {\n printMessage(`- ${error.reason}`, 'error');\n }\n stopProgressIndicator(\n `Failed to import ${errors.length} config objects`,\n 'error'\n );\n return;\n }\n\n stopProgressIndicator(`Imported ${results.length} config objects`, 'success');\n}\n\n/**\n * Count number of managed objects of a given type\n * @param {String} type managed object type, e.g. alpha_user\n */\nexport async function countManagedObjects(type) {\n let count = 0;\n let result = {\n result: [],\n resultCount: 0,\n pagedResultsCookie: null,\n totalPagedResultsPolicy: 'NONE',\n totalPagedResults: -1,\n remainingPagedResults: -1,\n };\n try {\n do {\n result = await queryAllManagedObjectsByType(\n type,\n [],\n result.pagedResultsCookie\n );\n count += result.resultCount;\n } while (result.pagedResultsCookie);\n printMessage(`${type}: ${count}`);\n } catch (error) {\n printMessage(error.response.data, 'error');\n printMessage(`Error querying managed objects by type: ${error}`, 'error');\n }\n}\n"],"mappings":"AAAA;AACA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,GAAG,MAAM,UAAU;AAC1B,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,gBAAgB,MAAM,mBAAmB;AAChD,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,GAAG,EAAEC,KAAK,EAAEC,eAAe,QAAQ,uBAAuB;AACnE,SACEC,uBAAuB,EACvBC,YAAY,EACZC,qBAAqB,QAChB,kBAAkB;AACzB,SAASC,gBAAgB,QAAQ,4BAA4B;AAE7D,MAAM;EAAEC,SAAS;EAAEC;AAAsB,CAAC,GAAGP,KAAK;AAClD,MAAM;EAAEQ;AAAoB,CAAC,GAAGP,eAAe;AAC/C,MAAM;EACJQ,oBAAoB;EACpBC,eAAe;EACfC,eAAe;EACfC;AACF,CAAC,GAAGb,GAAG;AACP;AACA;AACA;AACA,OAAO,eAAec,qBAAqB,GAAG;EAC5C,IAAI;IACF,MAAM;MAAEC;IAAe,CAAC,GAAG,MAAML,oBAAoB,EAAE;IACvD,KAAK,MAAMM,YAAY,IAAID,cAAc,EAAE;MACzCX,YAAY,CAAE,GAAEY,YAAY,CAACC,GAAI,EAAC,EAAE,MAAM,CAAC;IAC7C;EACF,CAAC,CAAC,OAAOC,yBAAyB,EAAE;IAClCd,YAAY,CAACc,yBAAyB,EAAE,OAAO,CAAC;IAChDd,YAAY,CACT,kCAAiCc,yBAA0B,EAAC,EAC7D,OAAO,CACR;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,kBAAkB,CAACC,EAAE,EAAEC,IAAI,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
}
|
|
75
75
|
}
|
|
76
76
|
} catch (error) {
|
|
77
|
-
|
|
77
|
+
var _error$response;
|
|
78
|
+
printMessage((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data, 'error');
|
|
78
79
|
}
|
|
79
80
|
return journeys;
|
|
80
81
|
}
|