@rockcarver/frodo-lib 0.16.2-9 → 0.17.0
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 +217 -1
- package/cjs/api/AgentApi.js +14 -61
- package/cjs/api/AgentApi.js.map +1 -1
- package/cjs/api/AgentApi.test.js.map +1 -1
- package/cjs/api/ApiTypes.js +0 -5
- package/cjs/api/ApiTypes.js.map +1 -1
- package/cjs/api/AuthenticateApi.js +9 -20
- package/cjs/api/AuthenticateApi.js.map +1 -1
- package/cjs/api/AuthenticateApi.test.js.map +1 -0
- package/cjs/api/BaseApi.js +82 -124
- package/cjs/api/BaseApi.js.map +1 -1
- package/cjs/api/CirclesOfTrustApi.js +8 -32
- package/cjs/api/CirclesOfTrustApi.js.map +1 -1
- package/cjs/api/IdmConfigApi.js +9 -34
- package/cjs/api/IdmConfigApi.js.map +1 -1
- package/cjs/api/LogApi.js +8 -31
- package/cjs/api/LogApi.js.map +1 -1
- package/cjs/api/ManagedObjectApi.js +34 -31
- package/cjs/api/ManagedObjectApi.js.map +1 -1
- package/cjs/api/NodeApi.js +10 -41
- package/cjs/api/NodeApi.js.map +1 -1
- package/cjs/api/NodeApi.test.js.map +1 -1
- package/cjs/api/OAuth2ClientApi.js +7 -26
- package/cjs/api/OAuth2ClientApi.js.map +1 -1
- package/cjs/api/OAuth2OIDCApi.js +28 -34
- package/cjs/api/OAuth2OIDCApi.js.map +1 -1
- package/cjs/api/OAuth2OIDCApi.test.js.map +1 -0
- package/cjs/api/OAuth2ProviderApi.js +5 -15
- package/cjs/api/OAuth2ProviderApi.js.map +1 -1
- package/cjs/api/RealmApi.js +8 -34
- package/cjs/api/RealmApi.js.map +1 -1
- package/cjs/api/Saml2Api.js +16 -67
- package/cjs/api/Saml2Api.js.map +1 -1
- package/cjs/api/ScriptApi.js +8 -30
- package/cjs/api/ScriptApi.js.map +1 -1
- package/cjs/api/SecretsApi.js +14 -64
- package/cjs/api/SecretsApi.js.map +1 -1
- package/cjs/api/SecretsApi.test.js.map +1 -1
- package/cjs/api/ServerInfoApi.js +6 -21
- package/cjs/api/ServerInfoApi.js.map +1 -1
- package/cjs/api/ServiceApi.js +49 -47
- package/cjs/api/ServiceApi.js.map +1 -1
- package/cjs/api/SocialIdentityProvidersApi.js +9 -36
- package/cjs/api/SocialIdentityProvidersApi.js.map +1 -1
- package/cjs/api/StartupApi.js +5 -24
- package/cjs/api/StartupApi.js.map +1 -1
- package/cjs/api/StartupApi.test.js.map +1 -1
- package/cjs/api/TreeApi.js +8 -30
- package/cjs/api/TreeApi.js.map +1 -1
- package/cjs/api/TreeApi.test.js.map +1 -1
- package/cjs/api/VariablesApi.js +9 -37
- package/cjs/api/VariablesApi.js.map +1 -1
- package/cjs/api/VariablesApi.test.js.map +1 -1
- package/cjs/api/utils/ApiUtils.js +47 -57
- package/cjs/api/utils/ApiUtils.js.map +1 -1
- package/cjs/api/utils/ApiUtils.test.js.map +1 -1
- package/cjs/api/utils/Base64.js +5 -15
- package/cjs/api/utils/Base64.js.map +1 -1
- package/cjs/ext/axios-curlirize/curlirize.js +2 -9
- package/cjs/ext/axios-curlirize/curlirize.js.map +1 -1
- package/cjs/ext/axios-curlirize/lib/CurlHelper.js +7 -22
- package/cjs/ext/axios-curlirize/lib/CurlHelper.js.map +1 -1
- package/cjs/index.js +30 -89
- package/cjs/index.js.map +1 -1
- package/cjs/ops/AdminOps.js +27 -165
- package/cjs/ops/AdminOps.js.map +1 -1
- package/cjs/ops/AgentOps.js +2 -159
- package/cjs/ops/AgentOps.js.map +1 -1
- package/cjs/ops/AgentOps.test.js.map +1 -1
- package/cjs/ops/AuthenticateOps.js +265 -226
- package/cjs/ops/AuthenticateOps.js.map +1 -1
- package/cjs/ops/AuthenticateOps.test.js.map +1 -1
- package/cjs/ops/CirclesOfTrustOps.js +13 -91
- package/cjs/ops/CirclesOfTrustOps.js.map +1 -1
- package/cjs/ops/ConnectionProfileOps.js +220 -136
- package/cjs/ops/ConnectionProfileOps.js.map +1 -1
- package/cjs/ops/ConnectionProfileOps.test.js.map +1 -1
- package/cjs/ops/EmailTemplateOps.js +35 -379
- package/cjs/ops/EmailTemplateOps.js.map +1 -1
- package/cjs/ops/EmailTemplateOps.test.js.map +1 -1
- package/cjs/ops/IdmOps.js +52 -426
- package/cjs/ops/IdmOps.js.map +1 -1
- package/cjs/ops/IdmOps.test.js.map +1 -1
- package/cjs/ops/IdpOps.js +11 -94
- package/cjs/ops/IdpOps.js.map +1 -1
- package/cjs/ops/IdpOps.test.js.map +1 -1
- package/cjs/ops/JoseOps.js +81 -0
- package/cjs/ops/JoseOps.js.map +1 -0
- package/cjs/ops/JoseOps.test.js.map +1 -0
- package/cjs/ops/JourneyOps.js +139 -370
- package/cjs/ops/JourneyOps.js.map +1 -1
- package/cjs/ops/JourneyOps.test.js.map +1 -1
- package/cjs/ops/LogOps.js +14 -47
- package/cjs/ops/LogOps.js.map +1 -1
- package/cjs/ops/ManagedObjectOps.js +4 -12
- package/cjs/ops/ManagedObjectOps.js.map +1 -1
- package/cjs/ops/NodeOps.js +9 -67
- package/cjs/ops/NodeOps.js.map +1 -1
- package/cjs/ops/OAuth2ClientOps.js +10 -40
- package/cjs/ops/OAuth2ClientOps.js.map +1 -1
- package/cjs/ops/OpsTypes.js +0 -5
- package/cjs/ops/OpsTypes.js.map +1 -1
- package/cjs/ops/OrganizationOps.js +6 -25
- package/cjs/ops/OrganizationOps.js.map +1 -1
- package/cjs/ops/RealmOps.js +0 -19
- package/cjs/ops/RealmOps.js.map +1 -1
- package/cjs/ops/Saml2Ops.js +11 -107
- package/cjs/ops/Saml2Ops.js.map +1 -1
- package/cjs/ops/Saml2Ops.test.js.map +1 -1
- package/cjs/ops/ScriptOps.js +26 -73
- package/cjs/ops/ScriptOps.js.map +1 -1
- package/cjs/ops/SecretsOps.js +2 -58
- package/cjs/ops/SecretsOps.js.map +1 -1
- package/cjs/ops/ServiceAccountOps.js +61 -0
- package/cjs/ops/ServiceAccountOps.js.map +1 -0
- package/cjs/ops/ServiceAccountOps.test.js.map +1 -0
- package/cjs/ops/ServiceOps.js +55 -101
- package/cjs/ops/ServiceOps.js.map +1 -1
- package/cjs/ops/StartupOps.js +2 -23
- package/cjs/ops/StartupOps.js.map +1 -1
- package/cjs/ops/ThemeOps.js +230 -436
- package/cjs/ops/ThemeOps.js.map +1 -1
- package/cjs/ops/ThemeOps.test.js.map +1 -0
- package/cjs/ops/VariablesOps.js +0 -38
- package/cjs/ops/VariablesOps.js.map +1 -1
- package/cjs/ops/utils/Console.js +29 -62
- package/cjs/ops/utils/Console.js.map +1 -1
- package/cjs/ops/utils/DataProtection.js +13 -47
- package/cjs/ops/utils/DataProtection.js.map +1 -1
- package/cjs/ops/utils/DataProtection.test.js.map +1 -1
- package/cjs/ops/utils/ExportImportUtils.js +36 -74
- package/cjs/ops/utils/ExportImportUtils.js.map +1 -1
- package/cjs/ops/utils/ExportImportUtils.test.js.map +1 -1
- package/cjs/ops/utils/OpsUtils.js +27 -43
- package/cjs/ops/utils/OpsUtils.js.map +1 -1
- package/cjs/ops/utils/OpsUtils.test.js.map +1 -1
- package/cjs/ops/utils/ValidationUtils.js +0 -13
- package/cjs/ops/utils/ValidationUtils.js.map +1 -1
- package/cjs/ops/utils/ValidationUtils.test.js.map +1 -1
- package/cjs/ops/utils/Version.js +2 -12
- package/cjs/ops/utils/Version.js.map +1 -1
- package/cjs/ops/utils/Version.test.js.map +1 -1
- package/cjs/ops/utils/Wordwrap.js +1 -2
- package/cjs/ops/utils/Wordwrap.js.map +1 -1
- package/cjs/ops/utils/Wordwrap.test.js.map +1 -0
- package/cjs/shared/State.js +239 -0
- package/cjs/shared/State.js.map +1 -0
- package/cjs/shared/State.test.js.map +1 -0
- package/cjs/storage/StaticStorage.js.map +1 -1
- package/cjs/test/mocks/AuthenticateApi/step/default_steps.json +88 -0
- package/cjs/test/mocks/ForgeRockApiMockEngine.js +161 -83
- package/cjs/test/mocks/ForgeRockApiMockEngine.js.map +1 -1
- package/cjs/test/mocks/IdmConfigApi/getConfigEntity/managed.json +4420 -0
- package/cjs/test/mocks/OAuth2OIDCApi/accessToken/body.json +6 -0
- package/cjs/test/mocks/OAuth2OIDCApi/accessToken/headers.json +19 -0
- package/cjs/test/mocks/OAuth2OIDCApi/authorize/headers.json +38 -0
- package/cjs/test/mocks/ServerInfoApi/getServerInfo/info.json +25 -0
- package/cjs/test/mocks/ServerInfoApi/getServerVersionInfo/version.json +8 -0
- package/cjs/utils/AutoSetupPolly.js +79 -0
- package/cjs/utils/AutoSetupPolly.js.map +1 -0
- package/cjs/utils/SetupJest.js +6 -0
- package/cjs/utils/SetupJest.js.map +1 -0
- package/cjs/{test/mocks → utils}/snapshotResolve.js +10 -12
- package/cjs/utils/snapshotResolve.js.map +1 -0
- package/esm/api/AgentApi.mjs +19 -21
- package/esm/api/AgentApi.test.mjs +6 -15
- package/esm/api/ApiTypes.mjs +0 -5
- package/esm/api/AuthenticateApi.mjs +7 -10
- package/esm/api/AuthenticateApi.test.mjs +39 -0
- package/esm/api/BaseApi.mjs +96 -81
- package/esm/api/CirclesOfTrustApi.mjs +9 -12
- package/esm/api/IdmConfigApi.mjs +11 -12
- package/esm/api/LogApi.mjs +6 -10
- package/esm/api/ManagedObjectApi.mjs +23 -8
- package/esm/api/NodeApi.mjs +13 -15
- package/esm/api/NodeApi.test.mjs +13 -17
- package/esm/api/OAuth2ClientApi.mjs +7 -9
- package/esm/api/OAuth2OIDCApi.mjs +15 -9
- package/esm/api/OAuth2OIDCApi.test.mjs +53 -0
- package/esm/api/OAuth2ProviderApi.mjs +3 -5
- package/esm/api/RealmApi.mjs +10 -13
- package/esm/api/Saml2Api.mjs +25 -29
- package/esm/api/ScriptApi.mjs +9 -11
- package/esm/api/SecretsApi.mjs +21 -24
- package/esm/api/SecretsApi.test.mjs +9 -31
- package/esm/api/ServerInfoApi.mjs +5 -9
- package/esm/api/ServiceApi.mjs +53 -26
- package/esm/api/SocialIdentityProvidersApi.mjs +11 -13
- package/esm/api/StartupApi.mjs +5 -10
- package/esm/api/StartupApi.test.mjs +4 -7
- package/esm/api/TreeApi.mjs +9 -11
- package/esm/api/TreeApi.test.mjs +24 -61
- package/esm/api/VariablesApi.mjs +11 -13
- package/esm/api/VariablesApi.test.mjs +80 -222
- package/esm/api/utils/ApiUtils.mjs +45 -48
- package/esm/api/utils/ApiUtils.test.mjs +33 -32
- package/esm/api/utils/Base64.mjs +5 -9
- package/esm/ext/axios-curlirize/curlirize.mjs +2 -7
- package/esm/ext/axios-curlirize/lib/CurlHelper.mjs +7 -20
- package/esm/index.mjs +23 -13
- package/esm/ops/AdminOps.mjs +33 -119
- package/esm/ops/AgentOps.mjs +37 -80
- package/esm/ops/AgentOps.test.mjs +5 -45
- package/esm/ops/AuthenticateOps.mjs +241 -175
- package/esm/ops/AuthenticateOps.test.mjs +7 -9
- package/esm/ops/CirclesOfTrustOps.mjs +24 -61
- package/esm/ops/ConnectionProfileOps.mjs +192 -82
- package/esm/ops/ConnectionProfileOps.test.mjs +19 -19
- package/esm/ops/EmailTemplateOps.mjs +18 -276
- package/esm/ops/EmailTemplateOps.test.mjs +19 -44
- package/esm/ops/IdmOps.mjs +30 -327
- package/esm/ops/IdmOps.test.mjs +47 -54
- package/esm/ops/IdpOps.mjs +21 -59
- package/esm/ops/IdpOps.test.mjs +5 -5
- package/esm/ops/JoseOps.mjs +41 -0
- package/esm/ops/JoseOps.test.mjs +137 -0
- package/esm/ops/JourneyOps.mjs +146 -289
- package/esm/ops/JourneyOps.test.mjs +29 -27
- package/esm/ops/LogOps.mjs +15 -25
- package/esm/ops/ManagedObjectOps.mjs +6 -6
- package/esm/ops/NodeOps.mjs +9 -47
- package/esm/ops/OAuth2ClientOps.mjs +13 -19
- package/esm/ops/OpsTypes.mjs +1 -3
- package/esm/ops/OrganizationOps.mjs +7 -14
- package/esm/ops/RealmOps.mjs +4 -7
- package/esm/ops/Saml2Ops.mjs +28 -62
- package/esm/ops/Saml2Ops.test.mjs +20 -23
- package/esm/ops/ScriptOps.mjs +29 -47
- package/esm/ops/SecretsOps.mjs +15 -31
- package/esm/ops/ServiceAccountOps.mjs +41 -0
- package/esm/ops/ServiceAccountOps.test.mjs +51 -0
- package/esm/ops/ServiceOps.mjs +66 -83
- package/esm/ops/StartupOps.mjs +4 -13
- package/esm/ops/ThemeOps.mjs +189 -298
- package/esm/{api/ThemeApi.test.mjs → ops/ThemeOps.test.mjs} +91 -96
- package/esm/ops/VariablesOps.mjs +9 -18
- package/esm/ops/utils/Console.mjs +28 -46
- package/esm/ops/utils/DataProtection.mjs +15 -28
- package/esm/ops/utils/DataProtection.test.mjs +8 -8
- package/esm/ops/utils/ExportImportUtils.mjs +34 -43
- package/esm/ops/utils/ExportImportUtils.test.mjs +20 -18
- package/esm/ops/utils/OpsUtils.mjs +27 -21
- package/esm/ops/utils/OpsUtils.test.mjs +155 -27
- package/esm/ops/utils/ValidationUtils.mjs +0 -9
- package/esm/ops/utils/Version.mjs +2 -3
- package/esm/ops/utils/Version.test.mjs +0 -2
- package/esm/ops/utils/Wordwrap.mjs +1 -1
- package/esm/ops/utils/Wordwrap.test.mjs +19 -0
- package/esm/shared/State.mjs +164 -0
- package/esm/shared/State.test.mjs +249 -0
- package/esm/test/mocks/AuthenticateApi/step/default_steps.json +88 -0
- package/esm/test/mocks/ForgeRockApiMockEngine.mjs +147 -31
- package/esm/test/mocks/IdmConfigApi/getConfigEntity/managed.json +4420 -0
- package/esm/test/mocks/OAuth2OIDCApi/accessToken/body.json +6 -0
- package/esm/test/mocks/OAuth2OIDCApi/accessToken/headers.json +19 -0
- package/esm/test/mocks/OAuth2OIDCApi/authorize/headers.json +38 -0
- package/esm/test/mocks/ServerInfoApi/getServerInfo/info.json +25 -0
- package/esm/test/mocks/ServerInfoApi/getServerVersionInfo/version.json +8 -0
- package/esm/utils/AutoSetupPolly.mjs +72 -0
- package/esm/utils/SetupJest.mjs +3 -0
- package/esm/{test/mocks → utils}/snapshotResolve.mjs +10 -12
- package/package.json +36 -26
- package/types/api/AgentApi.d.ts.map +1 -1
- package/types/api/ApiTypes.d.ts +15 -16
- package/types/api/ApiTypes.d.ts.map +1 -1
- package/types/api/AuthenticateApi.d.ts +1 -1
- package/types/api/AuthenticateApi.d.ts.map +1 -1
- package/types/api/BaseApi.d.ts +2 -0
- package/types/api/BaseApi.d.ts.map +1 -1
- package/types/api/CirclesOfTrustApi.d.ts.map +1 -1
- package/types/api/IdmConfigApi.d.ts.map +1 -1
- package/types/api/LogApi.d.ts.map +1 -1
- package/types/api/ManagedObjectApi.d.ts +9 -1
- package/types/api/ManagedObjectApi.d.ts.map +1 -1
- package/types/api/NodeApi.d.ts.map +1 -1
- package/types/api/OAuth2ClientApi.d.ts.map +1 -1
- package/types/api/OAuth2OIDCApi.d.ts +4 -2
- package/types/api/OAuth2OIDCApi.d.ts.map +1 -1
- package/types/api/OAuth2ProviderApi.d.ts.map +1 -1
- package/types/api/RealmApi.d.ts.map +1 -1
- package/types/api/Saml2Api.d.ts.map +1 -1
- package/types/api/ScriptApi.d.ts.map +1 -1
- package/types/api/SecretsApi.d.ts.map +1 -1
- package/types/api/ServerInfoApi.d.ts.map +1 -1
- package/types/api/ServiceApi.d.ts +14 -7
- package/types/api/ServiceApi.d.ts.map +1 -1
- package/types/api/SocialIdentityProvidersApi.d.ts.map +1 -1
- package/types/api/StartupApi.d.ts.map +1 -1
- package/types/api/TreeApi.d.ts.map +1 -1
- package/types/api/VariablesApi.d.ts.map +1 -1
- package/types/api/utils/ApiUtils.d.ts +1 -0
- package/types/api/utils/ApiUtils.d.ts.map +1 -1
- package/types/index.d.ts +11 -5
- package/types/index.d.ts.map +1 -1
- package/types/ops/AuthenticateOps.d.ts +10 -2
- package/types/ops/AuthenticateOps.d.ts.map +1 -1
- package/types/ops/ConnectionProfileOps.d.ts +49 -21
- package/types/ops/ConnectionProfileOps.d.ts.map +1 -1
- package/types/ops/EmailTemplateOps.d.ts +14 -33
- package/types/ops/EmailTemplateOps.d.ts.map +1 -1
- package/types/ops/IdmOps.d.ts +29 -37
- package/types/ops/IdmOps.d.ts.map +1 -1
- package/types/ops/JoseOps.d.ts +33 -0
- package/types/ops/JoseOps.d.ts.map +1 -0
- package/types/ops/JourneyOps.d.ts.map +1 -1
- package/types/ops/LogOps.d.ts.map +1 -1
- package/types/ops/NodeOps.d.ts.map +1 -1
- package/types/ops/OAuth2ClientOps.d.ts.map +1 -1
- package/types/ops/OpsTypes.d.ts +1 -1
- package/types/ops/OpsTypes.d.ts.map +1 -1
- package/types/ops/OrganizationOps.d.ts.map +1 -1
- package/types/ops/ScriptOps.d.ts.map +1 -1
- package/types/ops/ServiceAccountOps.d.ts +20 -0
- package/types/ops/ServiceAccountOps.d.ts.map +1 -0
- package/types/ops/ServiceOps.d.ts +18 -10
- package/types/ops/ServiceOps.d.ts.map +1 -1
- package/types/ops/ThemeOps.d.ts +35 -50
- package/types/ops/ThemeOps.d.ts.map +1 -1
- package/types/ops/utils/Console.d.ts +1 -1
- package/types/ops/utils/Console.d.ts.map +1 -1
- package/types/ops/utils/DataProtection.d.ts.map +1 -1
- package/types/ops/utils/ExportImportUtils.d.ts +5 -2
- package/types/ops/utils/ExportImportUtils.d.ts.map +1 -1
- package/types/ops/utils/OpsUtils.d.ts +6 -0
- package/types/ops/utils/OpsUtils.d.ts.map +1 -1
- package/types/ops/utils/Wordwrap.d.ts.map +1 -1
- package/types/shared/State.d.ts +223 -0
- package/types/shared/State.d.ts.map +1 -0
- package/types/test/mocks/ForgeRockApiMockEngine.d.ts +19 -1
- package/types/test/mocks/ForgeRockApiMockEngine.d.ts.map +1 -1
- package/types/utils/AutoSetupPolly.d.ts +1 -0
- package/types/utils/AutoSetupPolly.d.ts.map +1 -0
- package/types/utils/SetupJest.d.ts +1 -0
- package/types/utils/SetupJest.d.ts.map +1 -0
- package/types/utils/snapshotResolve.d.ts +1 -0
- package/types/utils/snapshotResolve.d.ts.map +1 -0
- package/cjs/api/EmailTemplateApi.js +0 -73
- package/cjs/api/EmailTemplateApi.js.map +0 -1
- package/cjs/api/ThemeApi.js +0 -367
- package/cjs/api/ThemeApi.js.map +0 -1
- package/cjs/api/ThemeApi.test.js.map +0 -1
- package/cjs/storage/SessionStorage.js +0 -91
- package/cjs/storage/SessionStorage.js.map +0 -1
- package/cjs/test/mocks/snapshotResolve.js.map +0 -1
- package/esm/api/EmailTemplateApi.mjs +0 -34
- package/esm/api/ThemeApi.mjs +0 -271
- package/esm/storage/SessionStorage.mjs +0 -79
- package/types/api/EmailTemplateApi.d.ts +0 -22
- package/types/api/EmailTemplateApi.d.ts.map +0 -1
- package/types/api/ThemeApi.d.ts +0 -56
- package/types/api/ThemeApi.d.ts.map +0 -1
- package/types/storage/SessionStorage.d.ts +0 -71
- package/types/storage/SessionStorage.d.ts.map +0 -1
- package/types/test/mocks/snapshotResolve.d.ts +0 -1
- package/types/test/mocks/snapshotResolve.d.ts.map +0 -1
package/cjs/ops/ThemeOps.js
CHANGED
|
@@ -3,509 +3,303 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
6
|
+
exports.THEMEREALM_ID = void 0;
|
|
7
|
+
exports.deleteTheme = deleteTheme;
|
|
8
|
+
exports.deleteThemeByName = deleteThemeByName;
|
|
8
9
|
exports.deleteThemes = deleteThemes;
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
exports.importThemesFromFiles = importThemesFromFiles;
|
|
19
|
-
exports.listThemes = listThemes;
|
|
20
|
-
|
|
21
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
22
|
-
|
|
23
|
-
var _ThemeApi = require("../api/ThemeApi");
|
|
24
|
-
|
|
25
|
-
var _Console = require("./utils/Console");
|
|
26
|
-
|
|
27
|
-
var _ExportImportUtils = require("./utils/ExportImportUtils");
|
|
28
|
-
|
|
29
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
-
|
|
10
|
+
exports.getTheme = getTheme;
|
|
11
|
+
exports.getThemeByName = getThemeByName;
|
|
12
|
+
exports.getThemes = getThemes;
|
|
13
|
+
exports.putTheme = putTheme;
|
|
14
|
+
exports.putThemeByName = putThemeByName;
|
|
15
|
+
exports.putThemes = putThemes;
|
|
16
|
+
var _IdmConfigApi = require("../api/IdmConfigApi");
|
|
17
|
+
var _ApiUtils = require("../api/utils/ApiUtils");
|
|
18
|
+
var _Console = require("../ops/utils/Console");
|
|
31
19
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
32
|
-
|
|
33
20
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
21
|
+
var THEMEREALM_ID = 'ui/themerealm';
|
|
34
22
|
|
|
35
23
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @param {
|
|
24
|
+
* Get realm themes
|
|
25
|
+
* @param {UiThemeRealmObject} themes object containing themes
|
|
26
|
+
* @returns {ThemeSkeleton[]} array of theme pertaining to the current realm
|
|
38
27
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* @param {String} file optional export file name
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
function _listThemes() {
|
|
50
|
-
_listThemes = _asyncToGenerator(function* () {
|
|
51
|
-
var long = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
52
|
-
var themeList = yield (0, _ThemeApi.getThemes)();
|
|
53
|
-
themeList.sort((a, b) => a.name.localeCompare(b.name));
|
|
54
|
-
|
|
55
|
-
if (!long) {
|
|
56
|
-
themeList.forEach(theme => {
|
|
57
|
-
(0, _Console.printMessage)("".concat(theme.isDefault ? theme.name['brightCyan'] : theme.name), 'data');
|
|
58
|
-
});
|
|
59
|
-
} else {
|
|
60
|
-
var table = (0, _Console.createTable)(['Name'['brightCyan'], 'Id'['brightCyan'], 'Default'['brightCyan']]);
|
|
61
|
-
themeList.forEach(theme => {
|
|
62
|
-
table.push(["".concat(theme.name), "".concat(theme._id), "".concat(theme.isDefault ? 'Yes'['brightGreen'] : '')]);
|
|
63
|
-
});
|
|
64
|
-
(0, _Console.printMessage)(table.toString(), 'data');
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
return _listThemes.apply(this, arguments);
|
|
28
|
+
exports.THEMEREALM_ID = THEMEREALM_ID;
|
|
29
|
+
function getRealmThemes(themes) {
|
|
30
|
+
if (themes.realm && themes.realm[(0, _ApiUtils.getCurrentRealmName)()]) {
|
|
31
|
+
return themes.realm[(0, _ApiUtils.getCurrentRealmName)()];
|
|
32
|
+
}
|
|
33
|
+
return [];
|
|
68
34
|
}
|
|
69
35
|
|
|
70
|
-
function exportThemeByName(_x, _x2) {
|
|
71
|
-
return _exportThemeByName.apply(this, arguments);
|
|
72
|
-
}
|
|
73
36
|
/**
|
|
74
|
-
*
|
|
75
|
-
* @
|
|
76
|
-
* @param {String} file optional export file name
|
|
37
|
+
* Get all themes
|
|
38
|
+
* @returns {Promise<ThemeSkeleton[]>} a promise that resolves to an array of themes
|
|
77
39
|
*/
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
function _exportThemeByName() {
|
|
81
|
-
_exportThemeByName = _asyncToGenerator(function* (name, file) {
|
|
82
|
-
var fileName = (0, _ExportImportUtils.getTypedFilename)(name, 'theme');
|
|
83
|
-
|
|
84
|
-
if (file) {
|
|
85
|
-
fileName = file;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
(0, _Console.createProgressIndicator)(1, "Exporting ".concat(name));
|
|
89
|
-
|
|
90
|
-
try {
|
|
91
|
-
var themeData = yield (0, _ThemeApi.getThemeByName)(name);
|
|
92
|
-
(0, _Console.updateProgressIndicator)("Writing file ".concat(fileName));
|
|
93
|
-
(0, _ExportImportUtils.saveToFile)('theme', [themeData], '_id', fileName);
|
|
94
|
-
(0, _Console.stopProgressIndicator)("Successfully exported theme ".concat(name, "."));
|
|
95
|
-
} catch (error) {
|
|
96
|
-
(0, _Console.stopProgressIndicator)("".concat(error.message));
|
|
97
|
-
(0, _Console.printMessage)("".concat(error.message), 'error');
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
return _exportThemeByName.apply(this, arguments);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function exportThemeById(_x3, _x4) {
|
|
104
|
-
return _exportThemeById.apply(this, arguments);
|
|
40
|
+
function getThemes() {
|
|
41
|
+
return _getThemes.apply(this, arguments);
|
|
105
42
|
}
|
|
106
43
|
/**
|
|
107
|
-
*
|
|
108
|
-
* @param {
|
|
44
|
+
* Get theme by id
|
|
45
|
+
* @param {string} themeId theme id
|
|
46
|
+
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object
|
|
109
47
|
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
var fileName = (0, _ExportImportUtils.getTypedFilename)(id, 'theme');
|
|
115
|
-
|
|
116
|
-
if (file) {
|
|
117
|
-
fileName = file;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
(0, _Console.createProgressIndicator)(1, "Exporting ".concat(id));
|
|
121
|
-
|
|
122
|
-
try {
|
|
123
|
-
var themeData = yield (0, _ThemeApi.getTheme)(id);
|
|
124
|
-
(0, _Console.updateProgressIndicator)("Writing file ".concat(fileName));
|
|
125
|
-
(0, _ExportImportUtils.saveToFile)('theme', [themeData], '_id', fileName);
|
|
126
|
-
(0, _Console.stopProgressIndicator)("Successfully exported theme ".concat(id, "."));
|
|
127
|
-
} catch (error) {
|
|
128
|
-
(0, _Console.stopProgressIndicator)("".concat(error.message));
|
|
129
|
-
(0, _Console.printMessage)("".concat(error.message), 'error');
|
|
130
|
-
}
|
|
48
|
+
function _getThemes() {
|
|
49
|
+
_getThemes = _asyncToGenerator(function* () {
|
|
50
|
+
var themes = yield (0, _IdmConfigApi.getConfigEntity)(THEMEREALM_ID);
|
|
51
|
+
return getRealmThemes(themes);
|
|
131
52
|
});
|
|
132
|
-
return
|
|
53
|
+
return _getThemes.apply(this, arguments);
|
|
133
54
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return _exportThemesToFile.apply(this, arguments);
|
|
55
|
+
function getTheme(_x) {
|
|
56
|
+
return _getTheme.apply(this, arguments);
|
|
137
57
|
}
|
|
138
58
|
/**
|
|
139
|
-
*
|
|
59
|
+
* Get theme by name
|
|
60
|
+
* @param {string} themeName theme name
|
|
61
|
+
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object
|
|
140
62
|
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (file) {
|
|
148
|
-
fileName = file;
|
|
63
|
+
function _getTheme() {
|
|
64
|
+
_getTheme = _asyncToGenerator(function* (themeId) {
|
|
65
|
+
var themes = yield (0, _IdmConfigApi.getConfigEntity)(THEMEREALM_ID);
|
|
66
|
+
var found = getRealmThemes(themes).filter(theme => theme._id === themeId);
|
|
67
|
+
if (found.length === 1) {
|
|
68
|
+
return found[0];
|
|
149
69
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
(0, _Console.createProgressIndicator)(allThemesData.length, 'Exporting themes');
|
|
153
|
-
|
|
154
|
-
for (var themeData of allThemesData) {
|
|
155
|
-
(0, _Console.updateProgressIndicator)("Exporting theme ".concat(themeData.name));
|
|
70
|
+
if (found.length > 1) {
|
|
71
|
+
throw new Error("Multiple themes with id \"".concat(themeId, "\" found!"));
|
|
156
72
|
}
|
|
157
|
-
|
|
158
|
-
(0, _ExportImportUtils.saveToFile)('theme', allThemesData, '_id', fileName);
|
|
159
|
-
(0, _Console.stopProgressIndicator)("".concat(allThemesData.length, " themes exported to ").concat(fileName, "."));
|
|
73
|
+
throw new Error("Theme with id \"".concat(themeId, "\" not found!"));
|
|
160
74
|
});
|
|
161
|
-
return
|
|
75
|
+
return _getTheme.apply(this, arguments);
|
|
162
76
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return _exportThemesToFiles.apply(this, arguments);
|
|
77
|
+
function getThemeByName(_x2) {
|
|
78
|
+
return _getThemeByName.apply(this, arguments);
|
|
166
79
|
}
|
|
167
80
|
/**
|
|
168
|
-
*
|
|
169
|
-
* @param {
|
|
170
|
-
* @param {
|
|
81
|
+
* Put theme by id
|
|
82
|
+
* @param {string} themeId theme id
|
|
83
|
+
* @param {ThemeSkeleton} themeData theme object
|
|
84
|
+
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object
|
|
171
85
|
*/
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
for (var themeData of allThemesData) {
|
|
180
|
-
(0, _Console.updateProgressIndicator)("Writing theme ".concat(themeData.name));
|
|
181
|
-
var fileName = (0, _ExportImportUtils.getTypedFilename)(themeData.name, 'theme');
|
|
182
|
-
(0, _ExportImportUtils.saveToFile)('theme', themeData, '_id', fileName);
|
|
86
|
+
function _getThemeByName() {
|
|
87
|
+
_getThemeByName = _asyncToGenerator(function* (themeName) {
|
|
88
|
+
var themes = yield (0, _IdmConfigApi.getConfigEntity)(THEMEREALM_ID);
|
|
89
|
+
var found = getRealmThemes(themes).filter(theme => theme.name === themeName);
|
|
90
|
+
if (found.length === 1) {
|
|
91
|
+
return found[0];
|
|
183
92
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function importThemeByName(_x6, _x7) {
|
|
191
|
-
return _importThemeByName.apply(this, arguments);
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Import theme by uuid from file
|
|
195
|
-
* @param {String} id theme uuid
|
|
196
|
-
* @param {String} file import file name
|
|
197
|
-
*/
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
function _importThemeByName() {
|
|
201
|
-
_importThemeByName = _asyncToGenerator(function* (name, file) {
|
|
202
|
-
_fs.default.readFile(file, 'utf8', /*#__PURE__*/function () {
|
|
203
|
-
var _ref = _asyncToGenerator(function* (err, data) {
|
|
204
|
-
if (err) throw err;
|
|
205
|
-
var themeData = JSON.parse(data);
|
|
206
|
-
|
|
207
|
-
if ((0, _ExportImportUtils.validateImport)(themeData.meta)) {
|
|
208
|
-
(0, _Console.createProgressIndicator)(1, 'Importing theme...');
|
|
209
|
-
var found = false;
|
|
210
|
-
|
|
211
|
-
for (var id in themeData.theme) {
|
|
212
|
-
if ({}.hasOwnProperty.call(themeData.theme, id)) {
|
|
213
|
-
if (themeData.theme[id].name === name) {
|
|
214
|
-
found = true;
|
|
215
|
-
(0, _Console.updateProgressIndicator)("Importing ".concat(themeData.theme[id].name));
|
|
216
|
-
|
|
217
|
-
try {
|
|
218
|
-
yield (0, _ThemeApi.putThemeByName)(name, themeData.theme[id]);
|
|
219
|
-
(0, _Console.stopProgressIndicator)("Successfully imported theme ".concat(name, "."));
|
|
220
|
-
} catch (error) {
|
|
221
|
-
(0, _Console.stopProgressIndicator)("Error importing theme ".concat(themeData.theme[id].name, ": ").concat(error.message));
|
|
222
|
-
(0, _Console.printMessage)("Error importing theme ".concat(themeData.theme[id].name, ": ").concat(error.message), 'error');
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (!found) {
|
|
231
|
-
(0, _Console.stopProgressIndicator)("Theme ".concat(name, " not found!"));
|
|
232
|
-
}
|
|
233
|
-
} else {
|
|
234
|
-
(0, _Console.printMessage)('Import validation failed...', 'error');
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
return function (_x14, _x15) {
|
|
239
|
-
return _ref.apply(this, arguments);
|
|
240
|
-
};
|
|
241
|
-
}());
|
|
242
|
-
});
|
|
243
|
-
return _importThemeByName.apply(this, arguments);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
function importThemeById(_x8, _x9) {
|
|
247
|
-
return _importThemeById.apply(this, arguments);
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Import all themes from single file
|
|
251
|
-
* @param {String} file import file name
|
|
252
|
-
*/
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
function _importThemeById() {
|
|
256
|
-
_importThemeById = _asyncToGenerator(function* (id, file) {
|
|
257
|
-
_fs.default.readFile(file, 'utf8', /*#__PURE__*/function () {
|
|
258
|
-
var _ref2 = _asyncToGenerator(function* (err, data) {
|
|
259
|
-
if (err) throw err;
|
|
260
|
-
var themeData = JSON.parse(data);
|
|
261
|
-
|
|
262
|
-
if ((0, _ExportImportUtils.validateImport)(themeData.meta)) {
|
|
263
|
-
(0, _Console.createProgressIndicator)(1, 'Importing theme...');
|
|
264
|
-
var found = false;
|
|
265
|
-
|
|
266
|
-
for (var themeId in themeData.theme) {
|
|
267
|
-
if ({}.hasOwnProperty.call(themeData.theme, themeId)) {
|
|
268
|
-
if (themeId === id) {
|
|
269
|
-
found = true;
|
|
270
|
-
(0, _Console.updateProgressIndicator)("Importing ".concat(themeData.theme[themeId]._id));
|
|
271
|
-
|
|
272
|
-
try {
|
|
273
|
-
yield (0, _ThemeApi.putTheme)(themeId, themeData.theme[themeId]);
|
|
274
|
-
(0, _Console.stopProgressIndicator)("Successfully imported theme ".concat(id, "."));
|
|
275
|
-
} catch (error) {
|
|
276
|
-
(0, _Console.stopProgressIndicator)("Error importing theme ".concat(themeData.theme[themeId]._id, ": ").concat(error.message));
|
|
277
|
-
(0, _Console.printMessage)("Error importing theme ".concat(themeData.theme[themeId]._id, ": ").concat(error.message), 'error');
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
break;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if (!found) {
|
|
286
|
-
(0, _Console.stopProgressIndicator)("Theme ".concat(id, " not found!"));
|
|
287
|
-
}
|
|
288
|
-
} else {
|
|
289
|
-
(0, _Console.printMessage)('Import validation failed...', 'error');
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
return function (_x16, _x17) {
|
|
294
|
-
return _ref2.apply(this, arguments);
|
|
295
|
-
};
|
|
296
|
-
}());
|
|
93
|
+
if (found.length > 1) {
|
|
94
|
+
throw new Error("Multiple themes with the name \"".concat(themeName, "\" found!"));
|
|
95
|
+
}
|
|
96
|
+
throw new Error("Theme \"".concat(themeName, "\" not found!"));
|
|
297
97
|
});
|
|
298
|
-
return
|
|
98
|
+
return _getThemeByName.apply(this, arguments);
|
|
299
99
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
return _importThemesFromFile.apply(this, arguments);
|
|
100
|
+
function putTheme(_x3, _x4) {
|
|
101
|
+
return _putTheme.apply(this, arguments);
|
|
303
102
|
}
|
|
304
103
|
/**
|
|
305
|
-
*
|
|
104
|
+
* Put theme by name
|
|
105
|
+
* @param {String} themeName theme name
|
|
106
|
+
* @param {ThemeSkeleton} themeData theme object
|
|
107
|
+
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object
|
|
306
108
|
*/
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
for (var id in fileData.theme) {
|
|
319
|
-
if ({}.hasOwnProperty.call(fileData.theme, id)) {
|
|
320
|
-
(0, _Console.updateProgressIndicator)("Importing ".concat(fileData.theme[id].name));
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
(0, _ThemeApi.putThemes)(fileData.theme).then(result => {
|
|
325
|
-
if (result == null) {
|
|
326
|
-
(0, _Console.stopProgressIndicator)("Error importing ".concat(Object.keys(fileData.theme).length, " themes!"));
|
|
327
|
-
(0, _Console.printMessage)("Error importing ".concat(Object.keys(fileData.theme).length, " themes from ").concat(file), 'error');
|
|
328
|
-
} else {
|
|
329
|
-
(0, _Console.stopProgressIndicator)("Successfully imported ".concat(Object.keys(fileData.theme).length, " themes."));
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
} else {
|
|
333
|
-
(0, _Console.printMessage)('Import validation failed...', 'error');
|
|
109
|
+
function _putTheme() {
|
|
110
|
+
_putTheme = _asyncToGenerator(function* (themeId, themeData) {
|
|
111
|
+
var data = themeData;
|
|
112
|
+
data._id = themeId;
|
|
113
|
+
var themes = yield (0, _IdmConfigApi.getConfigEntity)(THEMEREALM_ID);
|
|
114
|
+
var isNew = true;
|
|
115
|
+
var realmThemes = getRealmThemes(themes).map(theme => {
|
|
116
|
+
if (theme._id === themeId) {
|
|
117
|
+
isNew = false;
|
|
118
|
+
return data;
|
|
334
119
|
}
|
|
120
|
+
// eslint-disable-next-line no-param-reassign
|
|
121
|
+
if (data.isDefault) theme.isDefault = false;
|
|
122
|
+
return theme;
|
|
335
123
|
});
|
|
124
|
+
if (isNew) {
|
|
125
|
+
realmThemes.push(data);
|
|
126
|
+
}
|
|
127
|
+
themes.realm[(0, _ApiUtils.getCurrentRealmName)()] = realmThemes;
|
|
128
|
+
var found = getRealmThemes(yield (0, _IdmConfigApi.putConfigEntity)(THEMEREALM_ID, themes)).filter(theme => theme._id === themeId);
|
|
129
|
+
if (found.length === 1) {
|
|
130
|
+
return found[0];
|
|
131
|
+
}
|
|
132
|
+
if (found.length > 1) {
|
|
133
|
+
throw new Error("Multiple themes with id \"".concat(themeId, "\" found!"));
|
|
134
|
+
}
|
|
135
|
+
throw new Error("Theme with id \"".concat(themeId, "\" not saved!"));
|
|
336
136
|
});
|
|
337
|
-
return
|
|
137
|
+
return _putTheme.apply(this, arguments);
|
|
338
138
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
return _importThemesFromFiles.apply(this, arguments);
|
|
139
|
+
function putThemeByName(_x5, _x6) {
|
|
140
|
+
return _putThemeByName.apply(this, arguments);
|
|
342
141
|
}
|
|
343
142
|
/**
|
|
344
|
-
*
|
|
345
|
-
* @param {
|
|
143
|
+
* Put all themes
|
|
144
|
+
* @param {Map<string, ThemeSkeleton>} allThemesData themes object containing all themes for all realms
|
|
145
|
+
* @returns {Promise<Map<string, ThemeSkeleton>>} a promise that resolves to a themes object
|
|
346
146
|
*/
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
var
|
|
352
|
-
|
|
353
|
-
var
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
var total = 0;
|
|
358
|
-
var files = 0;
|
|
359
|
-
|
|
360
|
-
for (var file of jsonFiles) {
|
|
361
|
-
var data = _fs.default.readFileSync(file, 'utf8');
|
|
362
|
-
|
|
363
|
-
fileData = JSON.parse(data);
|
|
364
|
-
|
|
365
|
-
if ((0, _ExportImportUtils.validateImport)(fileData.meta)) {
|
|
366
|
-
count = Object.keys(fileData.theme).length; // eslint-disable-next-line no-await-in-loop
|
|
367
|
-
|
|
368
|
-
var result = yield (0, _ThemeApi.putThemes)(fileData.theme);
|
|
369
|
-
|
|
370
|
-
if (result == null) {
|
|
371
|
-
(0, _Console.printMessage)("Error importing ".concat(count, " themes from ").concat(file), 'error');
|
|
372
|
-
} else {
|
|
373
|
-
files += 1;
|
|
374
|
-
total += count;
|
|
375
|
-
(0, _Console.updateProgressIndicator)("Imported ".concat(count, " theme(s) from ").concat(file));
|
|
376
|
-
}
|
|
377
|
-
} else {
|
|
378
|
-
(0, _Console.printMessage)("Validation of ".concat(file, " failed!"), 'error');
|
|
147
|
+
function _putThemeByName() {
|
|
148
|
+
_putThemeByName = _asyncToGenerator(function* (themeName, themeData) {
|
|
149
|
+
var data = themeData;
|
|
150
|
+
data.name = themeName;
|
|
151
|
+
var themes = yield (0, _IdmConfigApi.getConfigEntity)(THEMEREALM_ID);
|
|
152
|
+
var isNew = true;
|
|
153
|
+
var realmThemes = getRealmThemes(themes).map(theme => {
|
|
154
|
+
if (theme.name === themeName) {
|
|
155
|
+
isNew = false;
|
|
156
|
+
return data;
|
|
379
157
|
}
|
|
158
|
+
// eslint-disable-next-line no-param-reassign
|
|
159
|
+
if (data.isDefault) theme.isDefault = false;
|
|
160
|
+
return theme;
|
|
161
|
+
});
|
|
162
|
+
if (isNew) {
|
|
163
|
+
realmThemes.push(data);
|
|
380
164
|
}
|
|
381
|
-
|
|
382
|
-
(0,
|
|
165
|
+
themes['realm'][(0, _ApiUtils.getCurrentRealmName)()] = realmThemes;
|
|
166
|
+
var found = getRealmThemes(yield (0, _IdmConfigApi.putConfigEntity)(THEMEREALM_ID, themes)).filter(theme => theme.name === themeName);
|
|
167
|
+
if (found.length === 1) {
|
|
168
|
+
return found[0];
|
|
169
|
+
}
|
|
170
|
+
if (found.length > 1) {
|
|
171
|
+
throw new Error("Multiple themes \"".concat(themeName, "\" found!"));
|
|
172
|
+
}
|
|
173
|
+
throw new Error("Theme \"".concat(themeName, "\" not saved!"));
|
|
383
174
|
});
|
|
384
|
-
return
|
|
175
|
+
return _putThemeByName.apply(this, arguments);
|
|
385
176
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
return _importFirstThemeFromFile.apply(this, arguments);
|
|
177
|
+
function putThemes(_x7) {
|
|
178
|
+
return _putThemes.apply(this, arguments);
|
|
389
179
|
}
|
|
390
180
|
/**
|
|
391
181
|
* Delete theme by id
|
|
392
|
-
* @param {
|
|
182
|
+
* @param {string} themeId theme id
|
|
183
|
+
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a themes object
|
|
393
184
|
*/
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
if (result == null) {
|
|
410
|
-
(0, _Console.stopProgressIndicator)("Error importing theme ".concat(themeData.theme[id].name));
|
|
411
|
-
(0, _Console.printMessage)("Error importing theme ".concat(themeData.theme[id].name), 'error');
|
|
412
|
-
} else {
|
|
413
|
-
(0, _Console.stopProgressIndicator)("Successfully imported theme ".concat(themeData.theme[id].name));
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
return "break";
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
for (var id in themeData.theme) {
|
|
421
|
-
var _ret = _loop(id);
|
|
422
|
-
|
|
423
|
-
if (_ret === "break") break;
|
|
424
|
-
}
|
|
425
|
-
} else {
|
|
426
|
-
(0, _Console.printMessage)('Import validation failed...', 'error');
|
|
185
|
+
function _putThemes() {
|
|
186
|
+
_putThemes = _asyncToGenerator(function* (themeMap) {
|
|
187
|
+
(0, _Console.debugMessage)("ThemeApi.putThemes: start");
|
|
188
|
+
var themes = yield (0, _IdmConfigApi.getConfigEntity)(THEMEREALM_ID);
|
|
189
|
+
var allThemeIDs = Object.keys(themeMap);
|
|
190
|
+
var existingThemeIDs = [];
|
|
191
|
+
var defaultThemeId = null;
|
|
192
|
+
// update existing themes
|
|
193
|
+
var realmThemes = getRealmThemes(themes).map(theme => {
|
|
194
|
+
if (themeMap[theme._id]) {
|
|
195
|
+
(0, _Console.debugMessage)("Update theme: ".concat(theme._id, " - ").concat(theme.name));
|
|
196
|
+
existingThemeIDs.push(theme._id);
|
|
197
|
+
// remember the id of the last default theme
|
|
198
|
+
if (themeMap[theme._id].isDefault) defaultThemeId = theme._id;
|
|
199
|
+
return themeMap[theme._id];
|
|
427
200
|
}
|
|
201
|
+
return theme;
|
|
202
|
+
});
|
|
203
|
+
var newThemeIDs = allThemeIDs.filter(id => !existingThemeIDs.includes(id));
|
|
204
|
+
// add new themes
|
|
205
|
+
newThemeIDs.forEach(themeId => {
|
|
206
|
+
(0, _Console.debugMessage)("Add theme: ".concat(themeMap[themeId]._id, " - ").concat(themeMap[themeId].name));
|
|
207
|
+
// remember the id of the last default theme
|
|
208
|
+
if (themeMap[themeId].isDefault) defaultThemeId = themeId;
|
|
209
|
+
realmThemes.push(themeMap[themeId]);
|
|
428
210
|
});
|
|
211
|
+
// if we imported a default theme, flag all the other themes as not default
|
|
212
|
+
if (defaultThemeId) {
|
|
213
|
+
realmThemes = realmThemes.map(theme => {
|
|
214
|
+
// eslint-disable-next-line no-param-reassign
|
|
215
|
+
theme.isDefault = theme._id === defaultThemeId;
|
|
216
|
+
return theme;
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
themes.realm[(0, _ApiUtils.getCurrentRealmName)()] = realmThemes;
|
|
220
|
+
var updatedThemes = new Map(getRealmThemes(yield (0, _IdmConfigApi.putConfigEntity)(THEMEREALM_ID, themes)).map(theme => [theme._id, theme]));
|
|
221
|
+
(0, _Console.debugMessage)(updatedThemes);
|
|
222
|
+
(0, _Console.debugMessage)("ThemeApi.putThemes: finished");
|
|
223
|
+
return updatedThemes;
|
|
429
224
|
});
|
|
430
|
-
return
|
|
225
|
+
return _putThemes.apply(this, arguments);
|
|
431
226
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
return _deleteThemeCmd.apply(this, arguments);
|
|
227
|
+
function deleteTheme(_x8) {
|
|
228
|
+
return _deleteTheme.apply(this, arguments);
|
|
435
229
|
}
|
|
436
230
|
/**
|
|
437
231
|
* Delete theme by name
|
|
438
|
-
* @param {
|
|
232
|
+
* @param {string} themeName theme name
|
|
233
|
+
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a themes object
|
|
439
234
|
*/
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
235
|
+
function _deleteTheme() {
|
|
236
|
+
_deleteTheme = _asyncToGenerator(function* (themeId) {
|
|
237
|
+
var themes = yield (0, _IdmConfigApi.getConfigEntity)(THEMEREALM_ID);
|
|
238
|
+
var realmThemes = getRealmThemes(themes);
|
|
239
|
+
var deletedThemes = [];
|
|
240
|
+
var finalThemes = realmThemes.filter(theme => {
|
|
241
|
+
if (theme._id !== themeId) {
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
deletedThemes.push(theme);
|
|
245
|
+
return false;
|
|
246
|
+
});
|
|
247
|
+
if (realmThemes.length === finalThemes.length) throw new Error("".concat(themeId, " not found"));
|
|
248
|
+
themes.realm[(0, _ApiUtils.getCurrentRealmName)()] = realmThemes;
|
|
249
|
+
var undeletedThemes = getRealmThemes(yield (0, _IdmConfigApi.putConfigEntity)(THEMEREALM_ID, themes)).filter(theme => deletedThemes.includes(theme));
|
|
250
|
+
if (deletedThemes.length > 0 && undeletedThemes.length === 0) {
|
|
251
|
+
return deletedThemes[0];
|
|
451
252
|
}
|
|
253
|
+
throw new Error("Theme(s) with id(s) \"".concat(undeletedThemes.map(theme => theme._id), "\" not deleted!"));
|
|
452
254
|
});
|
|
453
|
-
return
|
|
255
|
+
return _deleteTheme.apply(this, arguments);
|
|
454
256
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
return _deleteThemeByNameCmd.apply(this, arguments);
|
|
257
|
+
function deleteThemeByName(_x9) {
|
|
258
|
+
return _deleteThemeByName.apply(this, arguments);
|
|
458
259
|
}
|
|
459
260
|
/**
|
|
460
261
|
* Delete all themes
|
|
262
|
+
* @returns {Promise<ThemeSkeleton[]>} a promise that resolves to an array of themes
|
|
461
263
|
*/
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
264
|
+
function _deleteThemeByName() {
|
|
265
|
+
_deleteThemeByName = _asyncToGenerator(function* (themeName) {
|
|
266
|
+
var themes = yield (0, _IdmConfigApi.getConfigEntity)(THEMEREALM_ID);
|
|
267
|
+
var realmThemes = getRealmThemes(themes);
|
|
268
|
+
var deletedThemes = [];
|
|
269
|
+
var finalThemes = realmThemes.filter(theme => {
|
|
270
|
+
if (theme.name !== themeName) {
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
deletedThemes.push(theme);
|
|
274
|
+
return false;
|
|
275
|
+
});
|
|
276
|
+
if (realmThemes.length === finalThemes.length) throw new Error("".concat(themeName, " not found"));
|
|
277
|
+
themes.realm[(0, _ApiUtils.getCurrentRealmName)()] = finalThemes;
|
|
278
|
+
// return putConfigEntity(THEMEREALM_ID, themes);
|
|
279
|
+
var undeletedThemes = getRealmThemes(yield (0, _IdmConfigApi.putConfigEntity)(THEMEREALM_ID, themes)).filter(theme => deletedThemes.includes(theme));
|
|
280
|
+
if (deletedThemes.length > 0 && undeletedThemes.length === 0) {
|
|
281
|
+
return deletedThemes[0];
|
|
473
282
|
}
|
|
283
|
+
throw new Error("Theme(s) with id(s) \"".concat(undeletedThemes.map(theme => theme._id), "\" not deleted!"));
|
|
474
284
|
});
|
|
475
|
-
return
|
|
285
|
+
return _deleteThemeByName.apply(this, arguments);
|
|
476
286
|
}
|
|
477
|
-
|
|
478
287
|
function deleteThemes() {
|
|
479
|
-
return
|
|
288
|
+
return _deleteThemes.apply(this, arguments);
|
|
480
289
|
}
|
|
481
|
-
|
|
482
|
-
*
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
(0, _Console.createProgressIndicator)(undefined, "Deleting all realm themes...", 'indeterminate');
|
|
490
|
-
|
|
491
|
-
try {
|
|
492
|
-
yield (0, _ThemeApi.deleteThemes)();
|
|
493
|
-
(0, _Console.stopProgressIndicator)("Deleted all realm themes.", 'success');
|
|
494
|
-
} catch (error) {
|
|
495
|
-
(0, _Console.stopProgressIndicator)("Error: ".concat(error.message), 'fail');
|
|
290
|
+
function _deleteThemes() {
|
|
291
|
+
_deleteThemes = _asyncToGenerator(function* () {
|
|
292
|
+
var themes = yield (0, _IdmConfigApi.getConfigEntity)(THEMEREALM_ID);
|
|
293
|
+
var realmThemes = themes.realm[(0, _ApiUtils.getCurrentRealmName)()];
|
|
294
|
+
if (!realmThemes) throw new Error("No theme configuration found for realm \"".concat((0, _ApiUtils.getCurrentRealmName)(), "\""));
|
|
295
|
+
var deletedThemes = [];
|
|
296
|
+
for (var theme of realmThemes) {
|
|
297
|
+
deletedThemes.push(theme);
|
|
496
298
|
}
|
|
299
|
+
themes.realm[(0, _ApiUtils.getCurrentRealmName)()] = [];
|
|
300
|
+
yield (0, _IdmConfigApi.putConfigEntity)(THEMEREALM_ID, themes);
|
|
301
|
+
return deletedThemes;
|
|
497
302
|
});
|
|
498
|
-
return
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
function deleteThemesCmd() {
|
|
502
|
-
return _deleteThemesCmd.apply(this, arguments);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
function _deleteThemesCmd() {
|
|
506
|
-
_deleteThemesCmd = _asyncToGenerator(function* () {
|
|
507
|
-
return deleteThemes();
|
|
508
|
-
});
|
|
509
|
-
return _deleteThemesCmd.apply(this, arguments);
|
|
303
|
+
return _deleteThemes.apply(this, arguments);
|
|
510
304
|
}
|
|
511
305
|
//# sourceMappingURL=ThemeOps.js.map
|