@rockcarver/frodo-lib 0.16.2-8 → 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 +221 -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 +32 -118
- 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 +6 -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 +3 -160
- 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 +140 -371
- 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 +258 -802
- package/cjs/ops/Saml2Ops.js.map +1 -1
- package/cjs/ops/Saml2Ops.test.js.map +1 -1
- package/cjs/ops/ScriptOps.js +28 -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 +184 -80
- 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/Saml2Api/findSaml2Providers/https:sts.windows.net711ffa9c-5972-4713-ace3-688c9732614a_stub.json +18 -0
- package/cjs/test/mocks/Saml2Api/findSaml2Providers/iSPAzure_stub.json +18 -0
- package/cjs/test/mocks/Saml2Api/getProvider/aVNQQXp1cmU.json +1 -2
- package/cjs/test/mocks/Saml2Api/getProvider/dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.json +1 -3
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/U1BBenVyZQ.json +147 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQQXp1cmU.json +182 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQQnJvYWRjb20.json +149 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQRmVkbGV0.json +141 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aVNQQXp1cmU.json +1 -2
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/dm9sa2VyRGV2U1A.json +118 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aHR0cHM6Ly9zYW1sLm15dGVzdHJ1bi5jb20vc3A.json +66 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzExZmZhOWMtNTk3Mi00NzEzLWFjZTMtNjg4Yzk3MzI2MTRhLw.json +35 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aWRw.json +83 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/remote/dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.json +1 -3
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/SPAzure.xml +74 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPAzure.xml +78 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPBroadcom.xml +78 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPFedlet.xml +78 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fsaml.mytestrun.com%2Fsp.xml +13 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/{dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.xml → https%3A%2F%2Fsts.windows.net%2F711ffa9c-5972-4713-ace3-688c9732614a%2F.xml} +0 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/{aVNQQXp1cmU.xml → iSPAzure.xml} +0 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/urn%3Afederation%3AMicrosoftOnline.xml +84 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/SPAzure.saml.json +243 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/iSPAzure.saml.json +242 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPAzure.saml.json +454 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPBroadcom.saml.json +586 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPFedlet.saml.json +241 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/idp.saml.json +185 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/saml.mytestrun.comsp.saml.json +101 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/sts.windows.net711ffa9c-5972-4713-ace3-688c9732614a.saml.json +113 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/urn:federation:MicrosoftOnline.saml.json +199 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/volkerDevSP.saml.json +212 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Providers/allAlphaProviders.saml.json +2414 -0
- package/cjs/test/mocks/ScriptApi/getScript/5b29c5b7-b161-4a42-a41f-d6c85316b951.json +13 -0
- package/cjs/test/mocks/ScriptApi/getScript/85523e71-2d77-4577-b078-6f9674cc54e2.json +13 -0
- package/cjs/test/mocks/ScriptApi/getScript/90c4eca5-05f0-42f5-b9bf-88b693eabbbd.json +13 -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 +31 -61
- 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 +6 -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 +38 -81
- 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 +147 -290
- package/esm/ops/JourneyOps.test.mjs +30 -28
- 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 +199 -587
- package/esm/ops/Saml2Ops.test.mjs +303 -84
- package/esm/ops/ScriptOps.mjs +31 -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 +169 -33
- 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/Saml2Api/findSaml2Providers/https:sts.windows.net711ffa9c-5972-4713-ace3-688c9732614a_stub.json +18 -0
- package/esm/test/mocks/Saml2Api/findSaml2Providers/iSPAzure_stub.json +18 -0
- package/esm/test/mocks/Saml2Api/getProvider/aVNQQXp1cmU.json +1 -2
- package/esm/test/mocks/Saml2Api/getProvider/dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.json +1 -3
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/U1BBenVyZQ.json +147 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQQXp1cmU.json +182 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQQnJvYWRjb20.json +149 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQRmVkbGV0.json +141 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aVNQQXp1cmU.json +1 -2
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/dm9sa2VyRGV2U1A.json +118 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aHR0cHM6Ly9zYW1sLm15dGVzdHJ1bi5jb20vc3A.json +66 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzExZmZhOWMtNTk3Mi00NzEzLWFjZTMtNjg4Yzk3MzI2MTRhLw.json +35 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aWRw.json +83 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/remote/dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.json +1 -3
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/SPAzure.xml +74 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPAzure.xml +78 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPBroadcom.xml +78 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPFedlet.xml +78 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fsaml.mytestrun.com%2Fsp.xml +13 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/{dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.xml → https%3A%2F%2Fsts.windows.net%2F711ffa9c-5972-4713-ace3-688c9732614a%2F.xml} +0 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/{aVNQQXp1cmU.xml → iSPAzure.xml} +0 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/urn%3Afederation%3AMicrosoftOnline.xml +84 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/SPAzure.saml.json +243 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/iSPAzure.saml.json +242 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPAzure.saml.json +454 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPBroadcom.saml.json +586 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPFedlet.saml.json +241 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/idp.saml.json +185 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/saml.mytestrun.comsp.saml.json +101 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/sts.windows.net711ffa9c-5972-4713-ace3-688c9732614a.saml.json +113 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/urn:federation:MicrosoftOnline.saml.json +199 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/volkerDevSP.saml.json +212 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Providers/allAlphaProviders.saml.json +2414 -0
- package/esm/test/mocks/ScriptApi/getScript/5b29c5b7-b161-4a42-a41f-d6c85316b951.json +13 -0
- package/esm/test/mocks/ScriptApi/getScript/85523e71-2d77-4577-b078-6f9674cc54e2.json +13 -0
- package/esm/test/mocks/ScriptApi/getScript/90c4eca5-05f0-42f5-b9bf-88b693eabbbd.json +13 -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 +38 -27
- package/types/api/AgentApi.d.ts.map +1 -1
- package/types/api/ApiTypes.d.ts +19 -15
- 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 +7 -13
- 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/api/utils/Base64.d.ts +1 -0
- package/types/api/utils/Base64.d.ts.map +1 -1
- package/types/index.d.ts +11 -5
- package/types/index.d.ts.map +1 -1
- package/types/ops/AgentOps.d.ts +1 -1
- package/types/ops/AgentOps.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 +17 -1
- package/types/ops/OpsTypes.d.ts.map +1 -1
- package/types/ops/OrganizationOps.d.ts.map +1 -1
- package/types/ops/Saml2Ops.d.ts +52 -55
- package/types/ops/Saml2Ops.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 +21 -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
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
-
|
|
10
|
-
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
|
|
12
|
-
var _url = require("url");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
var _dirname = _path.default.dirname((0, _url.fileURLToPath)(require('url').pathToFileURL(__filename).toString()));
|
|
17
|
-
|
|
18
|
-
var pkg = JSON.parse(_fs.default.readFileSync(_path.default.resolve(_dirname, '../../package.json'), 'utf8'));
|
|
19
|
-
var _sessionStorage = {
|
|
20
|
-
authenticationHeaderOverrides: {}
|
|
21
|
-
};
|
|
22
|
-
var _default = {
|
|
23
|
-
session: {
|
|
24
|
-
setItem: (key, value) => _sessionStorage[key] = value,
|
|
25
|
-
getItem: key => _sessionStorage[key],
|
|
26
|
-
removeItem: key => delete _sessionStorage[key],
|
|
27
|
-
raw: _sessionStorage,
|
|
28
|
-
setUsername: value => _sessionStorage['username'] = value,
|
|
29
|
-
getUsername: () => _sessionStorage['username'],
|
|
30
|
-
setPassword: value => _sessionStorage['password'] = value,
|
|
31
|
-
getPassword: () => _sessionStorage['password'],
|
|
32
|
-
setTenant: value => _sessionStorage['tenant'] = value,
|
|
33
|
-
getTenant: () => _sessionStorage['tenant'],
|
|
34
|
-
setDeploymentType: value => _sessionStorage['deploymentType'] = value,
|
|
35
|
-
getDeploymentType: () => _sessionStorage['deploymentType'],
|
|
36
|
-
setRealm: value => _sessionStorage['realm'] = value,
|
|
37
|
-
getRealm: () => _sessionStorage['realm'],
|
|
38
|
-
setCookieName: value => _sessionStorage['cookieName'] = value,
|
|
39
|
-
getCookieName: () => _sessionStorage['cookieName'],
|
|
40
|
-
setCookieValue: value => _sessionStorage['cookieValue'] = value,
|
|
41
|
-
getCookieValue: () => _sessionStorage['cookieValue'],
|
|
42
|
-
setAuthenticationService: value => _sessionStorage['authenticationService'] = value,
|
|
43
|
-
getAuthenticationService: () => _sessionStorage['authenticationService'],
|
|
44
|
-
setAuthenticationHeaderOverrides: value => _sessionStorage['authenticationHeaderOverrides'] = value,
|
|
45
|
-
getAuthenticationHeaderOverrides: () => _sessionStorage['authenticationHeaderOverrides'],
|
|
46
|
-
setBearerToken: value => _sessionStorage['bearerToken'] = value,
|
|
47
|
-
getBearerToken: () => _sessionStorage['bearerToken'],
|
|
48
|
-
setLogApiKey: value => _sessionStorage['logApiKey'] = value,
|
|
49
|
-
getLogApiKey: () => _sessionStorage['logApiKey'],
|
|
50
|
-
setLogApiSecret: value => _sessionStorage['logApiSecret'] = value,
|
|
51
|
-
getLogApiSecret: () => _sessionStorage['logApiSecret'],
|
|
52
|
-
setAmVersion: value => _sessionStorage['amVersion'] = value,
|
|
53
|
-
getAmVersion: () => _sessionStorage['amVersion'],
|
|
54
|
-
setFrodoVersion: value => _sessionStorage['frodoVersion'] = value,
|
|
55
|
-
getFrodoVersion: () => _sessionStorage['frodoVersion'] || "v".concat(pkg.version, " [").concat(process.version, "]"),
|
|
56
|
-
setAllowInsecureConnection: value => _sessionStorage['insecure'] = value,
|
|
57
|
-
getAllowInsecureConnection: () => _sessionStorage['insecure'],
|
|
58
|
-
setConnectionProfilesPath: value => _sessionStorage['connectionProfilesPath'] = value,
|
|
59
|
-
getConnectionProfilesPath: () => _sessionStorage['connectionProfilesPath'],
|
|
60
|
-
setMasterKeyPath: value => _sessionStorage['masterKeyPath'] = value,
|
|
61
|
-
getMasterKeyPath: () => _sessionStorage['masterKeyPath'],
|
|
62
|
-
setOutputFile: value => _sessionStorage['outputFile'] = value,
|
|
63
|
-
getOutputFile: () => _sessionStorage['outputFile'],
|
|
64
|
-
setDirectory: value => _sessionStorage['directory'] = value,
|
|
65
|
-
getDirectory: () => _sessionStorage['directory'],
|
|
66
|
-
setPrintHandler: printHandler => _sessionStorage['printHandler'] = printHandler,
|
|
67
|
-
getPrintHandler: () => _sessionStorage['printHandler'],
|
|
68
|
-
setErrorHandler: errorHandler => _sessionStorage['errorHandler'] = errorHandler,
|
|
69
|
-
getErrorHandler: () => _sessionStorage['errorHandler'],
|
|
70
|
-
setVerboseHandler: verboseHandler => _sessionStorage['verboseHandler'] = verboseHandler,
|
|
71
|
-
getVerboseHandler: () => _sessionStorage['verboseHandler'],
|
|
72
|
-
setVerbose: verbose => _sessionStorage['verbose'] = verbose,
|
|
73
|
-
getVerbose: () => _sessionStorage['verbose'],
|
|
74
|
-
setDebugHandler: debugHandler => _sessionStorage['debugHandler'] = debugHandler,
|
|
75
|
-
getDebugHandler: () => _sessionStorage['debugHandler'],
|
|
76
|
-
setDebug: debug => _sessionStorage['debug'] = debug,
|
|
77
|
-
getDebug: () => _sessionStorage['debug'],
|
|
78
|
-
setCurlirizeHandler: debugHandler => _sessionStorage['curlirizeHandler'] = debugHandler,
|
|
79
|
-
getCurlirizeHandler: () => _sessionStorage['curlirizeHandler'],
|
|
80
|
-
setCurlirize: debug => _sessionStorage['curlirize'] = debug,
|
|
81
|
-
getCurlirize: () => _sessionStorage['curlirize'],
|
|
82
|
-
setCreateProgressHandler: handler => _sessionStorage['createProgressHandler'] = handler,
|
|
83
|
-
getCreateProgressHandler: () => _sessionStorage['createProgressHandler'],
|
|
84
|
-
setUpdateProgressHandler: handler => _sessionStorage['updateProgressHandler'] = handler,
|
|
85
|
-
getUpdateProgressHandler: () => _sessionStorage['updateProgressHandler'],
|
|
86
|
-
setStopProgressHandler: handler => _sessionStorage['stopProgressHandler'] = handler,
|
|
87
|
-
getStopProgressHandler: () => _sessionStorage['stopProgressHandler']
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
exports.default = _default;
|
|
91
|
-
//# sourceMappingURL=SessionStorage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SessionStorage.js","names":["__dirname","path","dirname","fileURLToPath","pkg","JSON","parse","fs","readFileSync","resolve","_sessionStorage","authenticationHeaderOverrides","session","setItem","key","value","getItem","removeItem","raw","setUsername","getUsername","setPassword","getPassword","setTenant","getTenant","setDeploymentType","getDeploymentType","setRealm","getRealm","setCookieName","getCookieName","setCookieValue","getCookieValue","setAuthenticationService","getAuthenticationService","setAuthenticationHeaderOverrides","getAuthenticationHeaderOverrides","setBearerToken","getBearerToken","setLogApiKey","getLogApiKey","setLogApiSecret","getLogApiSecret","setAmVersion","getAmVersion","setFrodoVersion","getFrodoVersion","version","process","setAllowInsecureConnection","getAllowInsecureConnection","setConnectionProfilesPath","getConnectionProfilesPath","setMasterKeyPath","getMasterKeyPath","setOutputFile","getOutputFile","setDirectory","getDirectory","setPrintHandler","printHandler","getPrintHandler","setErrorHandler","errorHandler","getErrorHandler","setVerboseHandler","verboseHandler","getVerboseHandler","setVerbose","verbose","getVerbose","setDebugHandler","debugHandler","getDebugHandler","setDebug","debug","getDebug","setCurlirizeHandler","getCurlirizeHandler","setCurlirize","getCurlirize","setCreateProgressHandler","handler","getCreateProgressHandler","setUpdateProgressHandler","getUpdateProgressHandler","setStopProgressHandler","getStopProgressHandler"],"sources":["storage/SessionStorage.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst pkg = JSON.parse(\n fs.readFileSync(path.resolve(__dirname, '../../package.json'), 'utf8')\n);\n\nconst _sessionStorage = {\n authenticationHeaderOverrides: {},\n};\n\nexport default {\n session: {\n setItem: (key, value) => (_sessionStorage[key] = value),\n getItem: (key) => _sessionStorage[key],\n removeItem: (key) => delete _sessionStorage[key],\n raw: _sessionStorage,\n\n setUsername: (value) => (_sessionStorage['username'] = value),\n getUsername: () => _sessionStorage['username'],\n\n setPassword: (value) => (_sessionStorage['password'] = value),\n getPassword: () => _sessionStorage['password'],\n\n setTenant: (value) => (_sessionStorage['tenant'] = value),\n getTenant: () => _sessionStorage['tenant'],\n\n setDeploymentType: (value) => (_sessionStorage['deploymentType'] = value),\n getDeploymentType: () => _sessionStorage['deploymentType'],\n\n setRealm: (value) => (_sessionStorage['realm'] = value),\n getRealm: () => _sessionStorage['realm'],\n\n setCookieName: (value) => (_sessionStorage['cookieName'] = value),\n getCookieName: () => _sessionStorage['cookieName'],\n setCookieValue: (value) => (_sessionStorage['cookieValue'] = value),\n getCookieValue: () => _sessionStorage['cookieValue'],\n\n setAuthenticationService: (value) =>\n (_sessionStorage['authenticationService'] = value),\n getAuthenticationService: () => _sessionStorage['authenticationService'],\n setAuthenticationHeaderOverrides: (value) =>\n (_sessionStorage['authenticationHeaderOverrides'] = value),\n getAuthenticationHeaderOverrides: () =>\n _sessionStorage['authenticationHeaderOverrides'],\n\n setBearerToken: (value) => (_sessionStorage['bearerToken'] = value),\n getBearerToken: () => _sessionStorage['bearerToken'],\n\n setLogApiKey: (value) => (_sessionStorage['logApiKey'] = value),\n getLogApiKey: () => _sessionStorage['logApiKey'],\n setLogApiSecret: (value) => (_sessionStorage['logApiSecret'] = value),\n getLogApiSecret: () => _sessionStorage['logApiSecret'],\n\n setAmVersion: (value) => (_sessionStorage['amVersion'] = value),\n getAmVersion: () => _sessionStorage['amVersion'],\n\n setFrodoVersion: (value) => (_sessionStorage['frodoVersion'] = value),\n getFrodoVersion: () =>\n _sessionStorage['frodoVersion'] || `v${pkg.version} [${process.version}]`,\n\n setAllowInsecureConnection: (value) =>\n (_sessionStorage['insecure'] = value),\n getAllowInsecureConnection: () => _sessionStorage['insecure'],\n\n setConnectionProfilesPath: (value) =>\n (_sessionStorage['connectionProfilesPath'] = value),\n getConnectionProfilesPath: () => _sessionStorage['connectionProfilesPath'],\n\n setMasterKeyPath: (value) => (_sessionStorage['masterKeyPath'] = value),\n getMasterKeyPath: () => _sessionStorage['masterKeyPath'],\n\n setOutputFile: (value) => (_sessionStorage['outputFile'] = value),\n getOutputFile: () => _sessionStorage['outputFile'],\n\n setDirectory: (value) => (_sessionStorage['directory'] = value),\n getDirectory: () => _sessionStorage['directory'],\n\n setPrintHandler: (printHandler) =>\n (_sessionStorage['printHandler'] = printHandler),\n getPrintHandler: () => _sessionStorage['printHandler'],\n\n setErrorHandler: (errorHandler) =>\n (_sessionStorage['errorHandler'] = errorHandler),\n getErrorHandler: () => _sessionStorage['errorHandler'],\n\n setVerboseHandler: (verboseHandler) =>\n (_sessionStorage['verboseHandler'] = verboseHandler),\n getVerboseHandler: () => _sessionStorage['verboseHandler'],\n setVerbose: (verbose: boolean) => (_sessionStorage['verbose'] = verbose),\n getVerbose: (): boolean => _sessionStorage['verbose'],\n\n setDebugHandler: (debugHandler) =>\n (_sessionStorage['debugHandler'] = debugHandler),\n getDebugHandler: () => _sessionStorage['debugHandler'],\n setDebug: (debug: boolean) => (_sessionStorage['debug'] = debug),\n getDebug: (): boolean => _sessionStorage['debug'],\n\n setCurlirizeHandler: (debugHandler) =>\n (_sessionStorage['curlirizeHandler'] = debugHandler),\n getCurlirizeHandler: () => _sessionStorage['curlirizeHandler'],\n setCurlirize: (debug: boolean) => (_sessionStorage['curlirize'] = debug),\n getCurlirize: (): boolean => _sessionStorage['curlirize'],\n\n setCreateProgressHandler: (handler) =>\n (_sessionStorage['createProgressHandler'] = handler),\n getCreateProgressHandler: () => _sessionStorage['createProgressHandler'],\n setUpdateProgressHandler: (handler) =>\n (_sessionStorage['updateProgressHandler'] = handler),\n getUpdateProgressHandler: () => _sessionStorage['updateProgressHandler'],\n setStopProgressHandler: (handler) =>\n (_sessionStorage['stopProgressHandler'] = handler),\n getStopProgressHandler: () => _sessionStorage['stopProgressHandler'],\n },\n};\n"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotResolve.js","names":["path","require","module","exports","resolveSnapshotPath","testPath","snapshotExtension","snapshotFilePath","indexOf","replace","concat","resolveTestPath","testFilePath","substring","testPathForConsistencyCheck"],"sources":["test/mocks/snapshotResolve.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst path = require('path');\n\nmodule.exports = {\n resolveSnapshotPath: (testPath, snapshotExtension) => {\n let snapshotFilePath = '';\n if (testPath.indexOf('cjs') !== -1) {\n snapshotFilePath = testPath\n .replace('cjs', 'src')\n .concat(snapshotExtension);\n } else {\n snapshotFilePath = testPath\n .replace('esm', 'src')\n .concat(snapshotExtension);\n }\n return snapshotFilePath;\n },\n\n // resolves from snapshot to test path\n resolveTestPath: (snapshotFilePath, snapshotExtension) => {\n let testFilePath = '';\n if (snapshotFilePath.indexOf('cjs') !== -1) {\n testFilePath = snapshotFilePath.replace('src', 'cjs');\n } else {\n testFilePath = snapshotFilePath.replace('src', 'esm');\n }\n testFilePath = testFilePath.substring(\n 0,\n testFilePath.indexOf(snapshotExtension)\n );\n\n return testFilePath;\n },\n\n // Example test path, used for preflight consistency check of the implementation above\n testPathForConsistencyCheck: 'some/__tests__/example.test.js',\n};\n"],"mappings":";;AAAA;AACA,IAAMA,IAAI,GAAGC,OAAO,CAAC,MAAD,CAApB;;AAEAC,MAAM,CAACC,OAAP,GAAiB;EACfC,mBAAmB,EAAE,CAACC,QAAD,EAAWC,iBAAX,KAAiC;IACpD,IAAIC,gBAAgB,GAAG,EAAvB;;IACA,IAAIF,QAAQ,CAACG,OAAT,CAAiB,KAAjB,MAA4B,CAAC,CAAjC,EAAoC;MAClCD,gBAAgB,GAAGF,QAAQ,CACxBI,OADgB,CACR,KADQ,EACD,KADC,EAEhBC,MAFgB,CAETJ,iBAFS,CAAnB;IAGD,CAJD,MAIO;MACLC,gBAAgB,GAAGF,QAAQ,CACxBI,OADgB,CACR,KADQ,EACD,KADC,EAEhBC,MAFgB,CAETJ,iBAFS,CAAnB;IAGD;;IACD,OAAOC,gBAAP;EACD,CAbc;EAef;EACAI,eAAe,EAAE,CAACJ,gBAAD,EAAmBD,iBAAnB,KAAyC;IACxD,IAAIM,YAAY,GAAG,EAAnB;;IACA,IAAIL,gBAAgB,CAACC,OAAjB,CAAyB,KAAzB,MAAoC,CAAC,CAAzC,EAA4C;MAC1CI,YAAY,GAAGL,gBAAgB,CAACE,OAAjB,CAAyB,KAAzB,EAAgC,KAAhC,CAAf;IACD,CAFD,MAEO;MACLG,YAAY,GAAGL,gBAAgB,CAACE,OAAjB,CAAyB,KAAzB,EAAgC,KAAhC,CAAf;IACD;;IACDG,YAAY,GAAGA,YAAY,CAACC,SAAb,CACb,CADa,EAEbD,YAAY,CAACJ,OAAb,CAAqBF,iBAArB,CAFa,CAAf;IAKA,OAAOM,YAAP;EACD,CA7Bc;EA+Bf;EACAE,2BAA2B,EAAE;AAhCd,CAAjB"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { getConfigEntitiesByType, getConfigEntity, putConfigEntity } from './IdmConfigApi';
|
|
2
|
-
/**
|
|
3
|
-
* Email template type key used to build the IDM id: 'emailTemplate/<id>'
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export const EMAIL_TEMPLATE_TYPE = 'emailTemplate';
|
|
7
|
-
/**
|
|
8
|
-
* Get all email templates
|
|
9
|
-
* @returns {Promise} a promise that resolves to an array of email template objects
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
export async function getEmailTemplates() {
|
|
13
|
-
return getConfigEntitiesByType(EMAIL_TEMPLATE_TYPE);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Get email template
|
|
17
|
-
* @param {string} templateId id/name of the email template without the type prefix
|
|
18
|
-
* @returns {Promise} a promise that resolves an email template object
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
export async function getEmailTemplate(templateId) {
|
|
22
|
-
return getConfigEntity(`${EMAIL_TEMPLATE_TYPE}/${templateId}`);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Put email template
|
|
26
|
-
* @param {string} templateId id/name of the email template without the type prefix
|
|
27
|
-
* @param {Object} templateData email template object
|
|
28
|
-
* @returns {Promise} a promise that resolves to an email template object
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
export async function putEmailTemplate(templateId, templateData) {
|
|
32
|
-
return putConfigEntity(`${EMAIL_TEMPLATE_TYPE}/${templateId}`, templateData);
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=EmailTemplateApi.js.map
|
package/esm/api/ThemeApi.mjs
DELETED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
import { getConfigEntity, putConfigEntity } from './IdmConfigApi';
|
|
2
|
-
import { getCurrentRealmName } from './utils/ApiUtils';
|
|
3
|
-
import { debugMessage } from '../ops/utils/Console';
|
|
4
|
-
export const THEMEREALM_ID = 'ui/themerealm';
|
|
5
|
-
/**
|
|
6
|
-
* Get realm themes
|
|
7
|
-
* @param {UiThemeRealmObject} themes object containing themes
|
|
8
|
-
* @returns {ThemeSkeleton[]} array of theme pertaining to the current realm
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
function getRealmThemes(themes) {
|
|
12
|
-
if (themes.realm && themes.realm[getCurrentRealmName()]) {
|
|
13
|
-
return themes.realm[getCurrentRealmName()];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return [];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Get all themes
|
|
20
|
-
* @returns {Promise<ThemeSkeleton[]>} a promise that resolves to an array of themes
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export async function getThemes() {
|
|
25
|
-
const themes = await getConfigEntity(THEMEREALM_ID);
|
|
26
|
-
return getRealmThemes(themes);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Get theme by id
|
|
30
|
-
* @param {string} themeId theme id
|
|
31
|
-
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
export async function getTheme(themeId) {
|
|
35
|
-
const themes = await getConfigEntity(THEMEREALM_ID);
|
|
36
|
-
const found = getRealmThemes(themes).filter(theme => theme._id === themeId);
|
|
37
|
-
|
|
38
|
-
if (found.length === 1) {
|
|
39
|
-
return found[0];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (found.length > 1) {
|
|
43
|
-
throw new Error(`Multiple themes with id "${themeId}" found!`);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
throw new Error(`Theme with id "${themeId}" not found!`);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Get theme by name
|
|
50
|
-
* @param {string} themeName theme name
|
|
51
|
-
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
export async function getThemeByName(themeName) {
|
|
55
|
-
const themes = await getConfigEntity(THEMEREALM_ID);
|
|
56
|
-
const found = getRealmThemes(themes).filter(theme => theme.name === themeName);
|
|
57
|
-
|
|
58
|
-
if (found.length === 1) {
|
|
59
|
-
return found[0];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (found.length > 1) {
|
|
63
|
-
throw new Error(`Multiple themes with the name "${themeName}" found!`);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
throw new Error(`Theme "${themeName}" not found!`);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Put theme by id
|
|
70
|
-
* @param {string} themeId theme id
|
|
71
|
-
* @param {ThemeSkeleton} themeData theme object
|
|
72
|
-
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
export async function putTheme(themeId, themeData) {
|
|
76
|
-
const data = themeData;
|
|
77
|
-
data._id = themeId;
|
|
78
|
-
const themes = await getConfigEntity(THEMEREALM_ID);
|
|
79
|
-
let isNew = true;
|
|
80
|
-
const realmThemes = getRealmThemes(themes).map(theme => {
|
|
81
|
-
if (theme._id === themeId) {
|
|
82
|
-
isNew = false;
|
|
83
|
-
return data;
|
|
84
|
-
} // eslint-disable-next-line no-param-reassign
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (data.isDefault) theme.isDefault = false;
|
|
88
|
-
return theme;
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
if (isNew) {
|
|
92
|
-
realmThemes.push(data);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
themes.realm[getCurrentRealmName()] = realmThemes;
|
|
96
|
-
const found = getRealmThemes(await putConfigEntity(THEMEREALM_ID, themes)).filter(theme => theme._id === themeId);
|
|
97
|
-
|
|
98
|
-
if (found.length === 1) {
|
|
99
|
-
return found[0];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (found.length > 1) {
|
|
103
|
-
throw new Error(`Multiple themes with id "${themeId}" found!`);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
throw new Error(`Theme with id "${themeId}" not saved!`);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Put theme by name
|
|
110
|
-
* @param {String} themeName theme name
|
|
111
|
-
* @param {ThemeSkeleton} themeData theme object
|
|
112
|
-
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
|
-
export async function putThemeByName(themeName, themeData) {
|
|
116
|
-
const data = themeData;
|
|
117
|
-
data.name = themeName;
|
|
118
|
-
const themes = await getConfigEntity(THEMEREALM_ID);
|
|
119
|
-
let isNew = true;
|
|
120
|
-
const realmThemes = getRealmThemes(themes).map(theme => {
|
|
121
|
-
if (theme.name === themeName) {
|
|
122
|
-
isNew = false;
|
|
123
|
-
return data;
|
|
124
|
-
} // eslint-disable-next-line no-param-reassign
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (data.isDefault) theme.isDefault = false;
|
|
128
|
-
return theme;
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
if (isNew) {
|
|
132
|
-
realmThemes.push(data);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
themes['realm'][getCurrentRealmName()] = realmThemes;
|
|
136
|
-
const found = getRealmThemes(await putConfigEntity(THEMEREALM_ID, themes)).filter(theme => theme.name === themeName);
|
|
137
|
-
|
|
138
|
-
if (found.length === 1) {
|
|
139
|
-
return found[0];
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (found.length > 1) {
|
|
143
|
-
throw new Error(`Multiple themes "${themeName}" found!`);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
throw new Error(`Theme "${themeName}" not saved!`);
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Put all themes
|
|
150
|
-
* @param {Map<string, ThemeSkeleton>} allThemesData themes object containing all themes for all realms
|
|
151
|
-
* @returns {Promise<Map<string, ThemeSkeleton>>} a promise that resolves to a themes object
|
|
152
|
-
*/
|
|
153
|
-
|
|
154
|
-
export async function putThemes(themeMap) {
|
|
155
|
-
debugMessage(`ThemeApi.putThemes: start`);
|
|
156
|
-
const themes = await getConfigEntity(THEMEREALM_ID);
|
|
157
|
-
const allThemeIDs = Object.keys(themeMap);
|
|
158
|
-
const existingThemeIDs = [];
|
|
159
|
-
let defaultThemeId = null; // update existing themes
|
|
160
|
-
|
|
161
|
-
let realmThemes = getRealmThemes(themes).map(theme => {
|
|
162
|
-
if (themeMap[theme._id]) {
|
|
163
|
-
debugMessage(`Update theme: ${theme._id} - ${theme.name}`);
|
|
164
|
-
existingThemeIDs.push(theme._id); // remember the id of the last default theme
|
|
165
|
-
|
|
166
|
-
if (themeMap[theme._id].isDefault) defaultThemeId = theme._id;
|
|
167
|
-
return themeMap[theme._id];
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return theme;
|
|
171
|
-
});
|
|
172
|
-
const newThemeIDs = allThemeIDs.filter(id => !existingThemeIDs.includes(id)); // add new themes
|
|
173
|
-
|
|
174
|
-
newThemeIDs.forEach(themeId => {
|
|
175
|
-
debugMessage(`Add theme: ${themeMap[themeId]._id} - ${themeMap[themeId].name}`); // remember the id of the last default theme
|
|
176
|
-
|
|
177
|
-
if (themeMap[themeId].isDefault) defaultThemeId = themeId;
|
|
178
|
-
realmThemes.push(themeMap[themeId]);
|
|
179
|
-
}); // if we imported a default theme, flag all the other themes as not default
|
|
180
|
-
|
|
181
|
-
if (defaultThemeId) {
|
|
182
|
-
realmThemes = realmThemes.map(theme => {
|
|
183
|
-
// eslint-disable-next-line no-param-reassign
|
|
184
|
-
theme.isDefault = theme._id === defaultThemeId;
|
|
185
|
-
return theme;
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
themes.realm[getCurrentRealmName()] = realmThemes;
|
|
190
|
-
const updatedThemes = new Map(getRealmThemes(await putConfigEntity(THEMEREALM_ID, themes)).map(theme => [theme._id, theme]));
|
|
191
|
-
debugMessage(updatedThemes);
|
|
192
|
-
debugMessage(`ThemeApi.putThemes: finished`);
|
|
193
|
-
return updatedThemes;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Delete theme by id
|
|
197
|
-
* @param {string} themeId theme id
|
|
198
|
-
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a themes object
|
|
199
|
-
*/
|
|
200
|
-
|
|
201
|
-
export async function deleteTheme(themeId) {
|
|
202
|
-
const themes = await getConfigEntity(THEMEREALM_ID);
|
|
203
|
-
const realmThemes = getRealmThemes(themes);
|
|
204
|
-
const deletedThemes = [];
|
|
205
|
-
const finalThemes = realmThemes.filter(theme => {
|
|
206
|
-
if (theme._id !== themeId) {
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
deletedThemes.push(theme);
|
|
211
|
-
return false;
|
|
212
|
-
});
|
|
213
|
-
if (realmThemes.length === finalThemes.length) throw new Error(`${themeId} not found`);
|
|
214
|
-
themes.realm[getCurrentRealmName()] = realmThemes;
|
|
215
|
-
const undeletedThemes = getRealmThemes(await putConfigEntity(THEMEREALM_ID, themes)).filter(theme => deletedThemes.includes(theme));
|
|
216
|
-
|
|
217
|
-
if (deletedThemes.length > 0 && undeletedThemes.length === 0) {
|
|
218
|
-
return deletedThemes[0];
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
throw new Error(`Theme(s) with id(s) "${undeletedThemes.map(theme => theme._id)}" not deleted!`);
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Delete theme by name
|
|
225
|
-
* @param {string} themeName theme name
|
|
226
|
-
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a themes object
|
|
227
|
-
*/
|
|
228
|
-
|
|
229
|
-
export async function deleteThemeByName(themeName) {
|
|
230
|
-
const themes = await getConfigEntity(THEMEREALM_ID);
|
|
231
|
-
const realmThemes = getRealmThemes(themes);
|
|
232
|
-
const deletedThemes = [];
|
|
233
|
-
const finalThemes = realmThemes.filter(theme => {
|
|
234
|
-
if (theme.name !== themeName) {
|
|
235
|
-
return true;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
deletedThemes.push(theme);
|
|
239
|
-
return false;
|
|
240
|
-
});
|
|
241
|
-
if (realmThemes.length === finalThemes.length) throw new Error(`${themeName} not found`);
|
|
242
|
-
themes.realm[getCurrentRealmName()] = finalThemes; // return putConfigEntity(THEMEREALM_ID, themes);
|
|
243
|
-
|
|
244
|
-
const undeletedThemes = getRealmThemes(await putConfigEntity(THEMEREALM_ID, themes)).filter(theme => deletedThemes.includes(theme));
|
|
245
|
-
|
|
246
|
-
if (deletedThemes.length > 0 && undeletedThemes.length === 0) {
|
|
247
|
-
return deletedThemes[0];
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
throw new Error(`Theme(s) with id(s) "${undeletedThemes.map(theme => theme._id)}" not deleted!`);
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Delete all themes
|
|
254
|
-
* @returns {Promise<ThemeSkeleton[]>} a promise that resolves to an array of themes
|
|
255
|
-
*/
|
|
256
|
-
|
|
257
|
-
export async function deleteThemes() {
|
|
258
|
-
const themes = await getConfigEntity(THEMEREALM_ID);
|
|
259
|
-
const realmThemes = themes.realm[getCurrentRealmName()];
|
|
260
|
-
if (!realmThemes) throw new Error(`No theme configuration found for realm "${getCurrentRealmName()}"`);
|
|
261
|
-
const deletedThemes = [];
|
|
262
|
-
|
|
263
|
-
for (const theme of realmThemes) {
|
|
264
|
-
deletedThemes.push(theme);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
themes.realm[getCurrentRealmName()] = [];
|
|
268
|
-
await putConfigEntity(THEMEREALM_ID, themes);
|
|
269
|
-
return deletedThemes;
|
|
270
|
-
}
|
|
271
|
-
//# sourceMappingURL=ThemeApi.js.map
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
|
|
5
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
|
|
7
|
-
const pkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../../package.json'), 'utf8'));
|
|
8
|
-
const _sessionStorage = {
|
|
9
|
-
authenticationHeaderOverrides: {}
|
|
10
|
-
};
|
|
11
|
-
export default {
|
|
12
|
-
session: {
|
|
13
|
-
setItem: (key, value) => _sessionStorage[key] = value,
|
|
14
|
-
getItem: key => _sessionStorage[key],
|
|
15
|
-
removeItem: key => delete _sessionStorage[key],
|
|
16
|
-
raw: _sessionStorage,
|
|
17
|
-
setUsername: value => _sessionStorage['username'] = value,
|
|
18
|
-
getUsername: () => _sessionStorage['username'],
|
|
19
|
-
setPassword: value => _sessionStorage['password'] = value,
|
|
20
|
-
getPassword: () => _sessionStorage['password'],
|
|
21
|
-
setTenant: value => _sessionStorage['tenant'] = value,
|
|
22
|
-
getTenant: () => _sessionStorage['tenant'],
|
|
23
|
-
setDeploymentType: value => _sessionStorage['deploymentType'] = value,
|
|
24
|
-
getDeploymentType: () => _sessionStorage['deploymentType'],
|
|
25
|
-
setRealm: value => _sessionStorage['realm'] = value,
|
|
26
|
-
getRealm: () => _sessionStorage['realm'],
|
|
27
|
-
setCookieName: value => _sessionStorage['cookieName'] = value,
|
|
28
|
-
getCookieName: () => _sessionStorage['cookieName'],
|
|
29
|
-
setCookieValue: value => _sessionStorage['cookieValue'] = value,
|
|
30
|
-
getCookieValue: () => _sessionStorage['cookieValue'],
|
|
31
|
-
setAuthenticationService: value => _sessionStorage['authenticationService'] = value,
|
|
32
|
-
getAuthenticationService: () => _sessionStorage['authenticationService'],
|
|
33
|
-
setAuthenticationHeaderOverrides: value => _sessionStorage['authenticationHeaderOverrides'] = value,
|
|
34
|
-
getAuthenticationHeaderOverrides: () => _sessionStorage['authenticationHeaderOverrides'],
|
|
35
|
-
setBearerToken: value => _sessionStorage['bearerToken'] = value,
|
|
36
|
-
getBearerToken: () => _sessionStorage['bearerToken'],
|
|
37
|
-
setLogApiKey: value => _sessionStorage['logApiKey'] = value,
|
|
38
|
-
getLogApiKey: () => _sessionStorage['logApiKey'],
|
|
39
|
-
setLogApiSecret: value => _sessionStorage['logApiSecret'] = value,
|
|
40
|
-
getLogApiSecret: () => _sessionStorage['logApiSecret'],
|
|
41
|
-
setAmVersion: value => _sessionStorage['amVersion'] = value,
|
|
42
|
-
getAmVersion: () => _sessionStorage['amVersion'],
|
|
43
|
-
setFrodoVersion: value => _sessionStorage['frodoVersion'] = value,
|
|
44
|
-
getFrodoVersion: () => _sessionStorage['frodoVersion'] || `v${pkg.version} [${process.version}]`,
|
|
45
|
-
setAllowInsecureConnection: value => _sessionStorage['insecure'] = value,
|
|
46
|
-
getAllowInsecureConnection: () => _sessionStorage['insecure'],
|
|
47
|
-
setConnectionProfilesPath: value => _sessionStorage['connectionProfilesPath'] = value,
|
|
48
|
-
getConnectionProfilesPath: () => _sessionStorage['connectionProfilesPath'],
|
|
49
|
-
setMasterKeyPath: value => _sessionStorage['masterKeyPath'] = value,
|
|
50
|
-
getMasterKeyPath: () => _sessionStorage['masterKeyPath'],
|
|
51
|
-
setOutputFile: value => _sessionStorage['outputFile'] = value,
|
|
52
|
-
getOutputFile: () => _sessionStorage['outputFile'],
|
|
53
|
-
setDirectory: value => _sessionStorage['directory'] = value,
|
|
54
|
-
getDirectory: () => _sessionStorage['directory'],
|
|
55
|
-
setPrintHandler: printHandler => _sessionStorage['printHandler'] = printHandler,
|
|
56
|
-
getPrintHandler: () => _sessionStorage['printHandler'],
|
|
57
|
-
setErrorHandler: errorHandler => _sessionStorage['errorHandler'] = errorHandler,
|
|
58
|
-
getErrorHandler: () => _sessionStorage['errorHandler'],
|
|
59
|
-
setVerboseHandler: verboseHandler => _sessionStorage['verboseHandler'] = verboseHandler,
|
|
60
|
-
getVerboseHandler: () => _sessionStorage['verboseHandler'],
|
|
61
|
-
setVerbose: verbose => _sessionStorage['verbose'] = verbose,
|
|
62
|
-
getVerbose: () => _sessionStorage['verbose'],
|
|
63
|
-
setDebugHandler: debugHandler => _sessionStorage['debugHandler'] = debugHandler,
|
|
64
|
-
getDebugHandler: () => _sessionStorage['debugHandler'],
|
|
65
|
-
setDebug: debug => _sessionStorage['debug'] = debug,
|
|
66
|
-
getDebug: () => _sessionStorage['debug'],
|
|
67
|
-
setCurlirizeHandler: debugHandler => _sessionStorage['curlirizeHandler'] = debugHandler,
|
|
68
|
-
getCurlirizeHandler: () => _sessionStorage['curlirizeHandler'],
|
|
69
|
-
setCurlirize: debug => _sessionStorage['curlirize'] = debug,
|
|
70
|
-
getCurlirize: () => _sessionStorage['curlirize'],
|
|
71
|
-
setCreateProgressHandler: handler => _sessionStorage['createProgressHandler'] = handler,
|
|
72
|
-
getCreateProgressHandler: () => _sessionStorage['createProgressHandler'],
|
|
73
|
-
setUpdateProgressHandler: handler => _sessionStorage['updateProgressHandler'] = handler,
|
|
74
|
-
getUpdateProgressHandler: () => _sessionStorage['updateProgressHandler'],
|
|
75
|
-
setStopProgressHandler: handler => _sessionStorage['stopProgressHandler'] = handler,
|
|
76
|
-
getStopProgressHandler: () => _sessionStorage['stopProgressHandler']
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
//# sourceMappingURL=SessionStorage.js.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Email template type key used to build the IDM id: 'emailTemplate/<id>'
|
|
3
|
-
*/
|
|
4
|
-
export declare const EMAIL_TEMPLATE_TYPE = "emailTemplate";
|
|
5
|
-
/**
|
|
6
|
-
* Get all email templates
|
|
7
|
-
* @returns {Promise} a promise that resolves to an array of email template objects
|
|
8
|
-
*/
|
|
9
|
-
export declare function getEmailTemplates(): Promise<any>;
|
|
10
|
-
/**
|
|
11
|
-
* Get email template
|
|
12
|
-
* @param {string} templateId id/name of the email template without the type prefix
|
|
13
|
-
* @returns {Promise} a promise that resolves an email template object
|
|
14
|
-
*/
|
|
15
|
-
export declare function getEmailTemplate(templateId: any): Promise<any>;
|
|
16
|
-
/**
|
|
17
|
-
* Put email template
|
|
18
|
-
* @param {string} templateId id/name of the email template without the type prefix
|
|
19
|
-
* @param {Object} templateData email template object
|
|
20
|
-
* @returns {Promise} a promise that resolves to an email template object
|
|
21
|
-
*/
|
|
22
|
-
export declare function putEmailTemplate(templateId: any, templateData: any): Promise<any>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/EmailTemplateApi.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AAEnD;;;GAGG;AACH,wBAAsB,iBAAiB,iBAEtC;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,KAAA,gBAEhD;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,KAAA,EAAE,YAAY,KAAA,gBAE9D","file":"EmailTemplateApi.d.ts","sourcesContent":["import {\n getConfigEntitiesByType,\n getConfigEntity,\n putConfigEntity,\n} from './IdmConfigApi';\n\n/**\n * Email template type key used to build the IDM id: 'emailTemplate/<id>'\n */\nexport const EMAIL_TEMPLATE_TYPE = 'emailTemplate';\n\n/**\n * Get all email templates\n * @returns {Promise} a promise that resolves to an array of email template objects\n */\nexport async function getEmailTemplates() {\n return getConfigEntitiesByType(EMAIL_TEMPLATE_TYPE);\n}\n\n/**\n * Get email template\n * @param {string} templateId id/name of the email template without the type prefix\n * @returns {Promise} a promise that resolves an email template object\n */\nexport async function getEmailTemplate(templateId) {\n return getConfigEntity(`${EMAIL_TEMPLATE_TYPE}/${templateId}`);\n}\n\n/**\n * Put email template\n * @param {string} templateId id/name of the email template without the type prefix\n * @param {Object} templateData email template object\n * @returns {Promise} a promise that resolves to an email template object\n */\nexport async function putEmailTemplate(templateId, templateData) {\n return putConfigEntity(`${EMAIL_TEMPLATE_TYPE}/${templateId}`, templateData);\n}\n"]}
|
package/types/api/ThemeApi.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ThemeSkeleton } from './ApiTypes';
|
|
2
|
-
export declare const THEMEREALM_ID = "ui/themerealm";
|
|
3
|
-
/**
|
|
4
|
-
* Get all themes
|
|
5
|
-
* @returns {Promise<ThemeSkeleton[]>} a promise that resolves to an array of themes
|
|
6
|
-
*/
|
|
7
|
-
export declare function getThemes(): Promise<ThemeSkeleton[]>;
|
|
8
|
-
/**
|
|
9
|
-
* Get theme by id
|
|
10
|
-
* @param {string} themeId theme id
|
|
11
|
-
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object
|
|
12
|
-
*/
|
|
13
|
-
export declare function getTheme(themeId: string): Promise<ThemeSkeleton>;
|
|
14
|
-
/**
|
|
15
|
-
* Get theme by name
|
|
16
|
-
* @param {string} themeName theme name
|
|
17
|
-
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object
|
|
18
|
-
*/
|
|
19
|
-
export declare function getThemeByName(themeName: string): Promise<ThemeSkeleton>;
|
|
20
|
-
/**
|
|
21
|
-
* Put theme by id
|
|
22
|
-
* @param {string} themeId theme id
|
|
23
|
-
* @param {ThemeSkeleton} themeData theme object
|
|
24
|
-
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object
|
|
25
|
-
*/
|
|
26
|
-
export declare function putTheme(themeId: string, themeData: ThemeSkeleton): Promise<ThemeSkeleton>;
|
|
27
|
-
/**
|
|
28
|
-
* Put theme by name
|
|
29
|
-
* @param {String} themeName theme name
|
|
30
|
-
* @param {ThemeSkeleton} themeData theme object
|
|
31
|
-
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object
|
|
32
|
-
*/
|
|
33
|
-
export declare function putThemeByName(themeName: string, themeData: ThemeSkeleton): Promise<ThemeSkeleton>;
|
|
34
|
-
/**
|
|
35
|
-
* Put all themes
|
|
36
|
-
* @param {Map<string, ThemeSkeleton>} allThemesData themes object containing all themes for all realms
|
|
37
|
-
* @returns {Promise<Map<string, ThemeSkeleton>>} a promise that resolves to a themes object
|
|
38
|
-
*/
|
|
39
|
-
export declare function putThemes(themeMap: Map<string, ThemeSkeleton>): Promise<Map<string, ThemeSkeleton>>;
|
|
40
|
-
/**
|
|
41
|
-
* Delete theme by id
|
|
42
|
-
* @param {string} themeId theme id
|
|
43
|
-
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a themes object
|
|
44
|
-
*/
|
|
45
|
-
export declare function deleteTheme(themeId: string): Promise<ThemeSkeleton>;
|
|
46
|
-
/**
|
|
47
|
-
* Delete theme by name
|
|
48
|
-
* @param {string} themeName theme name
|
|
49
|
-
* @returns {Promise<ThemeSkeleton>} a promise that resolves to a themes object
|
|
50
|
-
*/
|
|
51
|
-
export declare function deleteThemeByName(themeName: string): Promise<ThemeSkeleton>;
|
|
52
|
-
/**
|
|
53
|
-
* Delete all themes
|
|
54
|
-
* @returns {Promise<ThemeSkeleton[]>} a promise that resolves to an array of themes
|
|
55
|
-
*/
|
|
56
|
-
export declare function deleteThemes(): Promise<ThemeSkeleton[]>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/ThemeApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAsB,MAAM,YAAY,CAAC;AAK/D,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAc7C;;;GAGG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAG1D;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAUtE;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,CAAC,CAYxB;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,aAAa,GACvB,OAAO,CAAC,aAAa,CAAC,CA4BxB;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,aAAa,GACvB,OAAO,CAAC,aAAa,CAAC,CA4BxB;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CA8CrC;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAyBzE;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,CAAC,CA0BxB;AAED;;;GAGG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAc7D","file":"ThemeApi.d.ts","sourcesContent":["import { ThemeSkeleton, UiThemeRealmObject } from './ApiTypes';\nimport { getConfigEntity, putConfigEntity } from './IdmConfigApi';\nimport { getCurrentRealmName } from './utils/ApiUtils';\nimport { debugMessage } from '../ops/utils/Console';\n\nexport const THEMEREALM_ID = 'ui/themerealm';\n\n/**\n * Get realm themes\n * @param {UiThemeRealmObject} themes object containing themes\n * @returns {ThemeSkeleton[]} array of theme pertaining to the current realm\n */\nfunction getRealmThemes(themes: UiThemeRealmObject): ThemeSkeleton[] {\n if (themes.realm && themes.realm[getCurrentRealmName()]) {\n return themes.realm[getCurrentRealmName()];\n }\n return [];\n}\n\n/**\n * Get all themes\n * @returns {Promise<ThemeSkeleton[]>} a promise that resolves to an array of themes\n */\nexport async function getThemes(): Promise<ThemeSkeleton[]> {\n const themes = await getConfigEntity(THEMEREALM_ID);\n return getRealmThemes(themes);\n}\n\n/**\n * Get theme by id\n * @param {string} themeId theme id\n * @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object\n */\nexport async function getTheme(themeId: string): Promise<ThemeSkeleton> {\n const themes = await getConfigEntity(THEMEREALM_ID);\n const found = getRealmThemes(themes).filter((theme) => theme._id === themeId);\n if (found.length === 1) {\n return found[0];\n }\n if (found.length > 1) {\n throw new Error(`Multiple themes with id \"${themeId}\" found!`);\n }\n throw new Error(`Theme with id \"${themeId}\" not found!`);\n}\n\n/**\n * Get theme by name\n * @param {string} themeName theme name\n * @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object\n */\nexport async function getThemeByName(\n themeName: string\n): Promise<ThemeSkeleton> {\n const themes = await getConfigEntity(THEMEREALM_ID);\n const found = getRealmThemes(themes).filter(\n (theme) => theme.name === themeName\n );\n if (found.length === 1) {\n return found[0];\n }\n if (found.length > 1) {\n throw new Error(`Multiple themes with the name \"${themeName}\" found!`);\n }\n throw new Error(`Theme \"${themeName}\" not found!`);\n}\n\n/**\n * Put theme by id\n * @param {string} themeId theme id\n * @param {ThemeSkeleton} themeData theme object\n * @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object\n */\nexport async function putTheme(\n themeId: string,\n themeData: ThemeSkeleton\n): Promise<ThemeSkeleton> {\n const data = themeData;\n data._id = themeId;\n const themes = await getConfigEntity(THEMEREALM_ID);\n let isNew = true;\n const realmThemes = getRealmThemes(themes).map((theme) => {\n if (theme._id === themeId) {\n isNew = false;\n return data;\n }\n // eslint-disable-next-line no-param-reassign\n if (data.isDefault) theme.isDefault = false;\n return theme;\n });\n if (isNew) {\n realmThemes.push(data);\n }\n themes.realm[getCurrentRealmName()] = realmThemes;\n const found = getRealmThemes(\n await putConfigEntity(THEMEREALM_ID, themes)\n ).filter((theme) => theme._id === themeId);\n if (found.length === 1) {\n return found[0];\n }\n if (found.length > 1) {\n throw new Error(`Multiple themes with id \"${themeId}\" found!`);\n }\n throw new Error(`Theme with id \"${themeId}\" not saved!`);\n}\n\n/**\n * Put theme by name\n * @param {String} themeName theme name\n * @param {ThemeSkeleton} themeData theme object\n * @returns {Promise<ThemeSkeleton>} a promise that resolves to a theme object\n */\nexport async function putThemeByName(\n themeName: string,\n themeData: ThemeSkeleton\n): Promise<ThemeSkeleton> {\n const data = themeData;\n data.name = themeName;\n const themes = await getConfigEntity(THEMEREALM_ID);\n let isNew = true;\n const realmThemes = getRealmThemes(themes).map((theme) => {\n if (theme.name === themeName) {\n isNew = false;\n return data;\n }\n // eslint-disable-next-line no-param-reassign\n if (data.isDefault) theme.isDefault = false;\n return theme;\n });\n if (isNew) {\n realmThemes.push(data);\n }\n themes['realm'][getCurrentRealmName()] = realmThemes;\n const found = getRealmThemes(\n await putConfigEntity(THEMEREALM_ID, themes)\n ).filter((theme) => theme.name === themeName);\n if (found.length === 1) {\n return found[0];\n }\n if (found.length > 1) {\n throw new Error(`Multiple themes \"${themeName}\" found!`);\n }\n throw new Error(`Theme \"${themeName}\" not saved!`);\n}\n\n/**\n * Put all themes\n * @param {Map<string, ThemeSkeleton>} allThemesData themes object containing all themes for all realms\n * @returns {Promise<Map<string, ThemeSkeleton>>} a promise that resolves to a themes object\n */\nexport async function putThemes(\n themeMap: Map<string, ThemeSkeleton>\n): Promise<Map<string, ThemeSkeleton>> {\n debugMessage(`ThemeApi.putThemes: start`);\n const themes = await getConfigEntity(THEMEREALM_ID);\n const allThemeIDs = Object.keys(themeMap);\n const existingThemeIDs = [];\n let defaultThemeId = null;\n // update existing themes\n let realmThemes = getRealmThemes(themes).map((theme) => {\n if (themeMap[theme._id]) {\n debugMessage(`Update theme: ${theme._id} - ${theme.name}`);\n existingThemeIDs.push(theme._id);\n // remember the id of the last default theme\n if (themeMap[theme._id].isDefault) defaultThemeId = theme._id;\n return themeMap[theme._id];\n }\n return theme;\n });\n const newThemeIDs = allThemeIDs.filter(\n (id) => !existingThemeIDs.includes(id)\n );\n // add new themes\n newThemeIDs.forEach((themeId) => {\n debugMessage(\n `Add theme: ${themeMap[themeId]._id} - ${themeMap[themeId].name}`\n );\n // remember the id of the last default theme\n if (themeMap[themeId].isDefault) defaultThemeId = themeId;\n realmThemes.push(themeMap[themeId]);\n });\n // if we imported a default theme, flag all the other themes as not default\n if (defaultThemeId) {\n realmThemes = realmThemes.map((theme) => {\n // eslint-disable-next-line no-param-reassign\n theme.isDefault = theme._id === defaultThemeId;\n return theme;\n });\n }\n themes.realm[getCurrentRealmName()] = realmThemes;\n const updatedThemes = new Map(\n getRealmThemes(await putConfigEntity(THEMEREALM_ID, themes)).map(\n (theme) => [theme._id, theme]\n )\n );\n debugMessage(updatedThemes);\n debugMessage(`ThemeApi.putThemes: finished`);\n return updatedThemes;\n}\n\n/**\n * Delete theme by id\n * @param {string} themeId theme id\n * @returns {Promise<ThemeSkeleton>} a promise that resolves to a themes object\n */\nexport async function deleteTheme(themeId: string): Promise<ThemeSkeleton> {\n const themes = await getConfigEntity(THEMEREALM_ID);\n const realmThemes = getRealmThemes(themes);\n const deletedThemes: ThemeSkeleton[] = [];\n const finalThemes = realmThemes.filter((theme) => {\n if (theme._id !== themeId) {\n return true;\n }\n deletedThemes.push(theme);\n return false;\n });\n if (realmThemes.length === finalThemes.length)\n throw new Error(`${themeId} not found`);\n themes.realm[getCurrentRealmName()] = realmThemes;\n const undeletedThemes = getRealmThemes(\n await putConfigEntity(THEMEREALM_ID, themes)\n ).filter((theme) => deletedThemes.includes(theme));\n if (deletedThemes.length > 0 && undeletedThemes.length === 0) {\n return deletedThemes[0];\n }\n throw new Error(\n `Theme(s) with id(s) \"${undeletedThemes.map(\n (theme) => theme._id\n )}\" not deleted!`\n );\n}\n\n/**\n * Delete theme by name\n * @param {string} themeName theme name\n * @returns {Promise<ThemeSkeleton>} a promise that resolves to a themes object\n */\nexport async function deleteThemeByName(\n themeName: string\n): Promise<ThemeSkeleton> {\n const themes = await getConfigEntity(THEMEREALM_ID);\n const realmThemes = getRealmThemes(themes);\n const deletedThemes: ThemeSkeleton[] = [];\n const finalThemes = realmThemes.filter((theme) => {\n if (theme.name !== themeName) {\n return true;\n }\n deletedThemes.push(theme);\n return false;\n });\n if (realmThemes.length === finalThemes.length)\n throw new Error(`${themeName} not found`);\n themes.realm[getCurrentRealmName()] = finalThemes;\n // return putConfigEntity(THEMEREALM_ID, themes);\n const undeletedThemes = getRealmThemes(\n await putConfigEntity(THEMEREALM_ID, themes)\n ).filter((theme) => deletedThemes.includes(theme));\n if (deletedThemes.length > 0 && undeletedThemes.length === 0) {\n return deletedThemes[0];\n }\n throw new Error(\n `Theme(s) with id(s) \"${undeletedThemes.map(\n (theme) => theme._id\n )}\" not deleted!`\n );\n}\n\n/**\n * Delete all themes\n * @returns {Promise<ThemeSkeleton[]>} a promise that resolves to an array of themes\n */\nexport async function deleteThemes(): Promise<ThemeSkeleton[]> {\n const themes = await getConfigEntity(THEMEREALM_ID);\n const realmThemes = themes.realm[getCurrentRealmName()];\n if (!realmThemes)\n throw new Error(\n `No theme configuration found for realm \"${getCurrentRealmName()}\"`\n );\n const deletedThemes: ThemeSkeleton[] = [];\n for (const theme of realmThemes) {\n deletedThemes.push(theme);\n }\n themes.realm[getCurrentRealmName()] = [];\n await putConfigEntity(THEMEREALM_ID, themes);\n return deletedThemes;\n}\n"]}
|