@rockcarver/frodo-lib 0.16.2-9 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +222 -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 +266 -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 +242 -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/utils/Console.js
CHANGED
|
@@ -13,13 +13,11 @@ exports.printMessage = printMessage;
|
|
|
13
13
|
exports.stopProgressIndicator = stopProgressIndicator;
|
|
14
14
|
exports.updateProgressIndicator = updateProgressIndicator;
|
|
15
15
|
exports.verboseMessage = verboseMessage;
|
|
16
|
-
|
|
17
16
|
var _cliTable = _interopRequireDefault(require("cli-table3"));
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
17
|
+
var state = _interopRequireWildcard(require("../../shared/State"));
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
|
|
23
21
|
/**
|
|
24
22
|
* Handles data / messages output. The caller decides and implements how
|
|
25
23
|
* the data and messages are handled, by implementing the handler function
|
|
@@ -35,13 +33,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
35
33
|
function printMessage(message) {
|
|
36
34
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text';
|
|
37
35
|
var newline = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
38
|
-
|
|
39
|
-
var handler = _SessionStorage.default.session.getPrintHandler();
|
|
40
|
-
|
|
36
|
+
var handler = state.getPrintHandler();
|
|
41
37
|
if (handler) {
|
|
42
38
|
handler(message, type, newline);
|
|
43
39
|
}
|
|
44
40
|
}
|
|
41
|
+
|
|
45
42
|
/**
|
|
46
43
|
* Handles verbose output. The caller decides and implements how
|
|
47
44
|
* the messages are handled, by implementing the handler function
|
|
@@ -49,15 +46,13 @@ function printMessage(message) {
|
|
|
49
46
|
*
|
|
50
47
|
* @param {string | unknown} message The verbose output message
|
|
51
48
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
49
|
function verboseMessage(message) {
|
|
55
|
-
var handler =
|
|
56
|
-
|
|
50
|
+
var handler = state.getVerboseHandler();
|
|
57
51
|
if (handler) {
|
|
58
52
|
handler(message);
|
|
59
53
|
}
|
|
60
54
|
}
|
|
55
|
+
|
|
61
56
|
/**
|
|
62
57
|
* Handles debug output. The caller decides and implements how
|
|
63
58
|
* the messages are handled, by implementing the handler function
|
|
@@ -65,28 +60,25 @@ function verboseMessage(message) {
|
|
|
65
60
|
*
|
|
66
61
|
* @param {string | object} message The debug output message
|
|
67
62
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
63
|
function debugMessage(message) {
|
|
71
|
-
var handler =
|
|
72
|
-
|
|
64
|
+
var handler = state.getDebugHandler();
|
|
73
65
|
if (handler) {
|
|
74
66
|
handler(message);
|
|
75
67
|
}
|
|
76
68
|
}
|
|
69
|
+
|
|
77
70
|
/**
|
|
78
71
|
* Helper function to mask password header in curl command
|
|
79
72
|
* @param curlCommand curl command to mask
|
|
80
73
|
* @returns masked curl command
|
|
81
74
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
75
|
function maskPasswordHeader(curlCommand) {
|
|
85
76
|
var header = 'X-OpenAM-Password:';
|
|
86
77
|
var mask = '<suppressed>';
|
|
87
78
|
var regex = new RegExp('"' + header + '.+?"', 'g');
|
|
88
79
|
return curlCommand.replace(regex, '"' + header + mask + '"');
|
|
89
80
|
}
|
|
81
|
+
|
|
90
82
|
/**
|
|
91
83
|
* Handles curlirize output. The caller decides and implements how
|
|
92
84
|
* the messages are handled, by implementing the handler function
|
|
@@ -94,15 +86,13 @@ function maskPasswordHeader(curlCommand) {
|
|
|
94
86
|
*
|
|
95
87
|
* @param {string} message The curlirize output message
|
|
96
88
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
89
|
function curlirizeMessage(message) {
|
|
100
|
-
var handler =
|
|
101
|
-
|
|
90
|
+
var handler = state.getCurlirizeHandler();
|
|
102
91
|
if (handler) {
|
|
103
92
|
handler(maskPasswordHeader(message));
|
|
104
93
|
}
|
|
105
94
|
}
|
|
95
|
+
|
|
106
96
|
/**
|
|
107
97
|
* Calls a callback on client to create a progress indicator.
|
|
108
98
|
* The actual implementation of the indicator is left to the client
|
|
@@ -121,58 +111,47 @@ function curlirizeMessage(message) {
|
|
|
121
111
|
* @param {String} type optional type of progress indicator. default is 'determinate'
|
|
122
112
|
*
|
|
123
113
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
114
|
function createProgressIndicator(total) {
|
|
127
115
|
var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
128
116
|
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'determinate';
|
|
129
|
-
|
|
130
|
-
var handler = _SessionStorage.default.session.getCreateProgressHandler();
|
|
131
|
-
|
|
117
|
+
var handler = state.getCreateProgressHandler();
|
|
132
118
|
if (handler) {
|
|
133
119
|
handler(type, total, message);
|
|
134
120
|
}
|
|
135
121
|
}
|
|
122
|
+
|
|
136
123
|
/**
|
|
137
124
|
* Updates the progress indicator with new data/updated status.
|
|
138
125
|
* @param {string} message optional message to show with the indicator
|
|
139
126
|
*
|
|
140
127
|
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
128
|
function updateProgressIndicator() {
|
|
144
129
|
var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
145
|
-
|
|
146
|
-
var handler = _SessionStorage.default.session.getUpdateProgressHandler();
|
|
147
|
-
|
|
130
|
+
var handler = state.getUpdateProgressHandler();
|
|
148
131
|
if (handler) {
|
|
149
132
|
handler(message);
|
|
150
133
|
}
|
|
151
134
|
}
|
|
135
|
+
|
|
152
136
|
/**
|
|
153
137
|
* Stop and hide the progress indicator
|
|
154
138
|
* @param {string} message optional message to show with the indicator
|
|
155
139
|
* @param {string} status one of 'none', 'success', 'warn', 'fail'
|
|
156
140
|
*/
|
|
157
|
-
|
|
158
|
-
|
|
159
141
|
function stopProgressIndicator() {
|
|
160
142
|
var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
161
143
|
var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'none';
|
|
162
|
-
|
|
163
|
-
var handler = _SessionStorage.default.session.getStopProgressHandler();
|
|
164
|
-
|
|
144
|
+
var handler = state.getStopProgressHandler();
|
|
165
145
|
if (handler) {
|
|
166
146
|
handler(message, status);
|
|
167
147
|
}
|
|
168
148
|
}
|
|
149
|
+
|
|
169
150
|
/**
|
|
170
151
|
* Create an empty table
|
|
171
152
|
* @param {[String]} head header row as an array of strings
|
|
172
153
|
* @returns {CliTable3} an empty table
|
|
173
154
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
176
155
|
function createTable(head) {
|
|
177
156
|
return new _cliTable.default({
|
|
178
157
|
head,
|
|
@@ -199,12 +178,11 @@ function createTable(head) {
|
|
|
199
178
|
}
|
|
200
179
|
});
|
|
201
180
|
}
|
|
181
|
+
|
|
202
182
|
/**
|
|
203
183
|
* Create a new key/value table
|
|
204
184
|
* @returns {CliTable3} an empty key/value table
|
|
205
185
|
*/
|
|
206
|
-
|
|
207
|
-
|
|
208
186
|
function createKeyValueTable() {
|
|
209
187
|
return new _cliTable.default({
|
|
210
188
|
chars: {
|
|
@@ -230,37 +208,33 @@ function createKeyValueTable() {
|
|
|
230
208
|
wordWrap: true
|
|
231
209
|
});
|
|
232
210
|
}
|
|
211
|
+
|
|
233
212
|
/**
|
|
234
213
|
* Helper function to determine the total depth of an object
|
|
235
214
|
* @param {Object} object input object
|
|
236
215
|
* @returns {Number} total depth of the input object
|
|
237
216
|
*/
|
|
238
|
-
|
|
239
|
-
|
|
240
217
|
function getObjectDepth(object) {
|
|
241
218
|
return Object(object) === object ? 1 + Math.max(-1, ...Object.values(object).map(getObjectDepth)) : 0;
|
|
242
219
|
}
|
|
220
|
+
|
|
243
221
|
/**
|
|
244
222
|
* Helper function to determine if an object has values
|
|
245
223
|
* @param {Object} object input object
|
|
246
224
|
* @returns {boolean} true of the object or any of its sub-objects contain values, false otherwise
|
|
247
225
|
*/
|
|
248
|
-
|
|
249
|
-
|
|
250
226
|
function hasValues(object) {
|
|
251
227
|
var has = false;
|
|
252
228
|
var keys = Object.keys(object);
|
|
253
|
-
|
|
254
229
|
for (var key of keys) {
|
|
255
230
|
if (Object(object[key]) !== object[key]) {
|
|
256
231
|
return true;
|
|
257
232
|
}
|
|
258
|
-
|
|
259
233
|
has = has || hasValues(object[key]);
|
|
260
234
|
}
|
|
261
|
-
|
|
262
235
|
return has;
|
|
263
236
|
}
|
|
237
|
+
|
|
264
238
|
/**
|
|
265
239
|
* Helper function (recursive) to add rows to an object table
|
|
266
240
|
* @param {Object} object object to render
|
|
@@ -269,12 +243,9 @@ function hasValues(object) {
|
|
|
269
243
|
* @param {CliTable3} table the object table to add the rows to
|
|
270
244
|
* @returns the updated object table
|
|
271
245
|
*/
|
|
272
|
-
|
|
273
|
-
|
|
274
246
|
function addRows(object, depth, level, table, keyMap) {
|
|
275
247
|
var space = ' ';
|
|
276
248
|
var keys = Object.keys(object);
|
|
277
|
-
|
|
278
249
|
for (var key of keys) {
|
|
279
250
|
if (Object(object[key]) !== object[key]) {
|
|
280
251
|
if (level === 1) {
|
|
@@ -287,7 +258,6 @@ function addRows(object, depth, level, table, keyMap) {
|
|
|
287
258
|
}
|
|
288
259
|
}
|
|
289
260
|
}
|
|
290
|
-
|
|
291
261
|
for (var _key of keys) {
|
|
292
262
|
if (Object(object[_key]) === object[_key]) {
|
|
293
263
|
// only print header if there are any values below
|
|
@@ -295,29 +265,26 @@ function addRows(object, depth, level, table, keyMap) {
|
|
|
295
265
|
var indention = new Array(level).fill(space).join('');
|
|
296
266
|
if (level < 3) indention = "\n".concat(indention);
|
|
297
267
|
table.push([indention.concat(keyMap[_key] ? keyMap[_key]['brightCyan'] : _key['brightCyan']), '']);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
268
|
+
}
|
|
269
|
+
// eslint-disable-next-line no-param-reassign
|
|
301
270
|
table = addRows(object[_key], depth, level + 1, table, keyMap);
|
|
302
271
|
}
|
|
303
272
|
}
|
|
304
|
-
|
|
305
273
|
return table;
|
|
306
274
|
}
|
|
275
|
+
|
|
307
276
|
/**
|
|
308
277
|
* Create and populate an object table from any JSON object. Use for describe commands.
|
|
309
278
|
* @param {Object} object JSON object to create
|
|
310
279
|
* @returns {CliTable3} a table that can be printed to the console
|
|
311
280
|
*/
|
|
312
|
-
|
|
313
|
-
|
|
314
281
|
function createObjectTable(object) {
|
|
315
282
|
var keyMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
316
283
|
// eslint-disable-next-line no-param-reassign
|
|
317
|
-
var depth = getObjectDepth(object);
|
|
318
|
-
|
|
319
|
-
var level = 0;
|
|
320
|
-
|
|
284
|
+
var depth = getObjectDepth(object);
|
|
285
|
+
// eslint-disable-next-line no-param-reassign
|
|
286
|
+
var level = 0;
|
|
287
|
+
// eslint-disable-next-line no-param-reassign
|
|
321
288
|
var table = new _cliTable.default({
|
|
322
289
|
chars: {
|
|
323
290
|
top: '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Console.js","names":["printMessage","message","type","newline","handler","storage","session","getPrintHandler","verboseMessage","getVerboseHandler","debugMessage","getDebugHandler","maskPasswordHeader","curlCommand","header","mask","regex","RegExp","replace","curlirizeMessage","getCurlirizeHandler","createProgressIndicator","total","getCreateProgressHandler","updateProgressIndicator","getUpdateProgressHandler","stopProgressIndicator","status","getStopProgressHandler","createTable","head","Table","chars","top","bottom","left","mid","right","style","createKeyValueTable","wordWrap","getObjectDepth","object","Object","Math","max","values","map","hasValues","has","keys","key","addRows","depth","level","table","keyMap","space","push","hAlign","content","indention","Array","fill","join","concat","createObjectTable"],"sources":["ops/utils/Console.ts"],"sourcesContent":["import Table from 'cli-table3';\nimport storage from '../../storage/SessionStorage';\n\n/**\n * Handles data / messages output. The caller decides and implements how\n * the data and messages are handled, by implementing the handler function\n * on its side. `handler` is optional, and if not included by the caller,\n * the data and messages will be lost.\n *\n * @param {string | unknown} message The string message to return\n * @param {string} [type=text] \"text\", \"info\", \"warn\", \"error\" or \"data\". All but\n * type=\"data\" will be written to stderr.\n * @param {boolean} [newline=true] Whether to add a newline at the end of message\n * messages returned\n */\nexport function printMessage(\n message: string | unknown,\n type = 'text',\n newline = true\n) {\n const handler = storage.session.getPrintHandler();\n if (handler) {\n handler(message, type, newline);\n }\n}\n\n/**\n * Handles verbose output. The caller decides and implements how\n * the messages are handled, by implementing the handler function\n * on its side. Implementing and registering a `handler` is optional.\n *\n * @param {string | unknown} message The verbose output message\n */\nexport function verboseMessage(message: string | object) {\n const handler = storage.session.getVerboseHandler();\n if (handler) {\n handler(message);\n }\n}\n\n/**\n * Handles debug output. The caller decides and implements how\n * the messages are handled, by implementing the handler function\n * on its side. Implementing and registering a `handler` is optional.\n *\n * @param {string | object} message The debug output message\n */\nexport function debugMessage(message: string | object) {\n const handler = storage.session.getDebugHandler();\n if (handler) {\n handler(message);\n }\n}\n\n/**\n * Helper function to mask password header in curl command\n * @param curlCommand curl command to mask\n * @returns masked curl command\n */\nfunction maskPasswordHeader(curlCommand: string) {\n const header = 'X-OpenAM-Password:';\n const mask = '<suppressed>';\n const regex = new RegExp('\"' + header + '.+?\"', 'g');\n return curlCommand.replace(regex, '\"' + header + mask + '\"');\n}\n\n/**\n * Handles curlirize output. The caller decides and implements how\n * the messages are handled, by implementing the handler function\n * on its side. Implementing and registering a `handler` is optional.\n *\n * @param {string} message The curlirize output message\n */\nexport function curlirizeMessage(message: string) {\n const handler = storage.session.getCurlirizeHandler();\n if (handler) {\n handler(maskPasswordHeader(message));\n }\n}\n\n/**\n * Calls a callback on client to create a progress indicator.\n * The actual implementation of the indicator is left to the client\n * Two types of indicators are supported:\n * - determinate: should be used when the process completion rate\n * can be detected (example: progress bar showing percentage or count)\n * - indeterminate: used when progress isn’t detectable, or if\n * it’s not necessary to indicate how long an activity will take.\n * (example: spinner showing progress, but not quantifying the progress)\n *\n * Example:\n * [========================================] 100% | 49/49 | Analyzing journey - transactional_auth\n *\n * @param {Number} total The total number of entries to track progress for\n * @param {String} message optional progress bar message\n * @param {String} type optional type of progress indicator. default is 'determinate'\n *\n */\nexport function createProgressIndicator(\n total,\n message: string = null,\n type = 'determinate'\n) {\n const handler = storage.session.getCreateProgressHandler();\n if (handler) {\n handler(type, total, message);\n }\n}\n\n/**\n * Updates the progress indicator with new data/updated status.\n * @param {string} message optional message to show with the indicator\n *\n */\nexport function updateProgressIndicator(message: string = null) {\n const handler = storage.session.getUpdateProgressHandler();\n if (handler) {\n handler(message);\n }\n}\n\n/**\n * Stop and hide the progress indicator\n * @param {string} message optional message to show with the indicator\n * @param {string} status one of 'none', 'success', 'warn', 'fail'\n */\nexport function stopProgressIndicator(message: string = null, status = 'none') {\n const handler = storage.session.getStopProgressHandler();\n if (handler) {\n handler(message, status);\n }\n}\n\n/**\n * Create an empty table\n * @param {[String]} head header row as an array of strings\n * @returns {CliTable3} an empty table\n */\nexport function createTable(head) {\n return new Table({\n head,\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n },\n style: { 'padding-left': 0, 'padding-right': 0, head: ['brightCyan'] },\n });\n}\n\n/**\n * Create a new key/value table\n * @returns {CliTable3} an empty key/value table\n */\nexport function createKeyValueTable() {\n return new Table({\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n },\n style: { 'padding-left': 0, 'padding-right': 0 },\n wordWrap: true,\n });\n}\n\n/**\n * Helper function to determine the total depth of an object\n * @param {Object} object input object\n * @returns {Number} total depth of the input object\n */\nfunction getObjectDepth(object) {\n return Object(object) === object\n ? 1 + Math.max(-1, ...Object.values(object).map(getObjectDepth))\n : 0;\n}\n\n/**\n * Helper function to determine if an object has values\n * @param {Object} object input object\n * @returns {boolean} true of the object or any of its sub-objects contain values, false otherwise\n */\nfunction hasValues(object) {\n let has = false;\n const keys = Object.keys(object);\n for (const key of keys) {\n if (Object(object[key]) !== object[key]) {\n return true;\n }\n has = has || hasValues(object[key]);\n }\n return has;\n}\n\n/**\n * Helper function (recursive) to add rows to an object table\n * @param {Object} object object to render\n * @param {Number} depth total depth of initial object\n * @param {Number} level current level\n * @param {CliTable3} table the object table to add the rows to\n * @returns the updated object table\n */\nfunction addRows(object, depth, level, table, keyMap) {\n const space = ' ';\n const keys = Object.keys(object);\n for (const key of keys) {\n if (Object(object[key]) !== object[key]) {\n if (level === 1) {\n table.push([\n keyMap[key] ? keyMap[key]['brightCyan'] : key['brightCyan'],\n object[key],\n ]);\n } else {\n table.push([\n {\n hAlign: 'right',\n content: keyMap[key] ? keyMap[key]['gray'] : key['gray'],\n },\n object[key],\n ]);\n }\n }\n }\n for (const key of keys) {\n if (Object(object[key]) === object[key]) {\n // only print header if there are any values below\n if (hasValues(object[key])) {\n let indention = new Array(level).fill(space).join('');\n if (level < 3) indention = `\\n${indention}`;\n table.push([\n indention.concat(\n keyMap[key] ? keyMap[key]['brightCyan'] : key['brightCyan']\n ),\n '',\n ]);\n }\n // eslint-disable-next-line no-param-reassign\n table = addRows(object[key], depth, level + 1, table, keyMap);\n }\n }\n return table;\n}\n\n/**\n * Create and populate an object table from any JSON object. Use for describe commands.\n * @param {Object} object JSON object to create\n * @returns {CliTable3} a table that can be printed to the console\n */\nexport function createObjectTable(object, keyMap = {}) {\n // eslint-disable-next-line no-param-reassign\n const depth = getObjectDepth(object);\n // eslint-disable-next-line no-param-reassign\n const level = 0;\n // eslint-disable-next-line no-param-reassign\n const table = new Table({\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n },\n style: { 'padding-left': 0, 'padding-right': 0, head: ['brightCyan'] },\n });\n addRows(object, depth, level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;MAYL,WAAW,EAZN;MAaLC,KAAK,EAAE,EAbF;MAcL,aAAa;IAdR,CADe;IAiBtBC,KAAK,EAAE;MAAE,gBAAgB,CAAlB;MAAqB,iBAAiB,CAAtC;MAAyCR,IAAI,EAAE,CAAC,YAAD;IAA/C;EAjBe,CAAV,CAAd;EAmBAsB,OAAO,CAACV,MAAD,EAASW,KAAT,EAAgBC,KAAK,GAAG,CAAxB,EAA2BC,KAA3B,EAAkCC,MAAlC,CAAP;EACA,OAAOD,KAAP;AACD"}
|
|
1
|
+
{"version":3,"file":"Console.js","names":["printMessage","message","type","newline","handler","state","getPrintHandler","verboseMessage","getVerboseHandler","debugMessage","getDebugHandler","maskPasswordHeader","curlCommand","header","mask","regex","RegExp","replace","curlirizeMessage","getCurlirizeHandler","createProgressIndicator","total","getCreateProgressHandler","updateProgressIndicator","getUpdateProgressHandler","stopProgressIndicator","status","getStopProgressHandler","createTable","head","Table","chars","top","bottom","left","mid","right","style","createKeyValueTable","wordWrap","getObjectDepth","object","Object","Math","max","values","map","hasValues","has","keys","key","addRows","depth","level","table","keyMap","space","push","hAlign","content","indention","Array","fill","join","concat","createObjectTable"],"sources":["ops/utils/Console.ts"],"sourcesContent":["import Table from 'cli-table3';\nimport * as state from '../../shared/State';\n\n/**\n * Handles data / messages output. The caller decides and implements how\n * the data and messages are handled, by implementing the handler function\n * on its side. `handler` is optional, and if not included by the caller,\n * the data and messages will be lost.\n *\n * @param {string | unknown} message The string message to return\n * @param {string} [type=text] \"text\", \"info\", \"warn\", \"error\" or \"data\". All but\n * type=\"data\" will be written to stderr.\n * @param {boolean} [newline=true] Whether to add a newline at the end of message\n * messages returned\n */\nexport function printMessage(\n message: string | object,\n type = 'text',\n newline = true\n) {\n const handler = state.getPrintHandler();\n if (handler) {\n handler(message, type, newline);\n }\n}\n\n/**\n * Handles verbose output. The caller decides and implements how\n * the messages are handled, by implementing the handler function\n * on its side. Implementing and registering a `handler` is optional.\n *\n * @param {string | unknown} message The verbose output message\n */\nexport function verboseMessage(message: string | object) {\n const handler = state.getVerboseHandler();\n if (handler) {\n handler(message);\n }\n}\n\n/**\n * Handles debug output. The caller decides and implements how\n * the messages are handled, by implementing the handler function\n * on its side. Implementing and registering a `handler` is optional.\n *\n * @param {string | object} message The debug output message\n */\nexport function debugMessage(message: string | object) {\n const handler = state.getDebugHandler();\n if (handler) {\n handler(message);\n }\n}\n\n/**\n * Helper function to mask password header in curl command\n * @param curlCommand curl command to mask\n * @returns masked curl command\n */\nfunction maskPasswordHeader(curlCommand: string) {\n const header = 'X-OpenAM-Password:';\n const mask = '<suppressed>';\n const regex = new RegExp('\"' + header + '.+?\"', 'g');\n return curlCommand.replace(regex, '\"' + header + mask + '\"');\n}\n\n/**\n * Handles curlirize output. The caller decides and implements how\n * the messages are handled, by implementing the handler function\n * on its side. Implementing and registering a `handler` is optional.\n *\n * @param {string} message The curlirize output message\n */\nexport function curlirizeMessage(message: string) {\n const handler = state.getCurlirizeHandler();\n if (handler) {\n handler(maskPasswordHeader(message));\n }\n}\n\n/**\n * Calls a callback on client to create a progress indicator.\n * The actual implementation of the indicator is left to the client\n * Two types of indicators are supported:\n * - determinate: should be used when the process completion rate\n * can be detected (example: progress bar showing percentage or count)\n * - indeterminate: used when progress isn’t detectable, or if\n * it’s not necessary to indicate how long an activity will take.\n * (example: spinner showing progress, but not quantifying the progress)\n *\n * Example:\n * [========================================] 100% | 49/49 | Analyzing journey - transactional_auth\n *\n * @param {Number} total The total number of entries to track progress for\n * @param {String} message optional progress bar message\n * @param {String} type optional type of progress indicator. default is 'determinate'\n *\n */\nexport function createProgressIndicator(\n total,\n message: string = null,\n type = 'determinate'\n) {\n const handler = state.getCreateProgressHandler();\n if (handler) {\n handler(type, total, message);\n }\n}\n\n/**\n * Updates the progress indicator with new data/updated status.\n * @param {string} message optional message to show with the indicator\n *\n */\nexport function updateProgressIndicator(message: string = null) {\n const handler = state.getUpdateProgressHandler();\n if (handler) {\n handler(message);\n }\n}\n\n/**\n * Stop and hide the progress indicator\n * @param {string} message optional message to show with the indicator\n * @param {string} status one of 'none', 'success', 'warn', 'fail'\n */\nexport function stopProgressIndicator(message: string = null, status = 'none') {\n const handler = state.getStopProgressHandler();\n if (handler) {\n handler(message, status);\n }\n}\n\n/**\n * Create an empty table\n * @param {[String]} head header row as an array of strings\n * @returns {CliTable3} an empty table\n */\nexport function createTable(head) {\n return new Table({\n head,\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n },\n style: { 'padding-left': 0, 'padding-right': 0, head: ['brightCyan'] },\n });\n}\n\n/**\n * Create a new key/value table\n * @returns {CliTable3} an empty key/value table\n */\nexport function createKeyValueTable() {\n return new Table({\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n },\n style: { 'padding-left': 0, 'padding-right': 0 },\n wordWrap: true,\n });\n}\n\n/**\n * Helper function to determine the total depth of an object\n * @param {Object} object input object\n * @returns {Number} total depth of the input object\n */\nfunction getObjectDepth(object) {\n return Object(object) === object\n ? 1 + Math.max(-1, ...Object.values(object).map(getObjectDepth))\n : 0;\n}\n\n/**\n * Helper function to determine if an object has values\n * @param {Object} object input object\n * @returns {boolean} true of the object or any of its sub-objects contain values, false otherwise\n */\nfunction hasValues(object) {\n let has = false;\n const keys = Object.keys(object);\n for (const key of keys) {\n if (Object(object[key]) !== object[key]) {\n return true;\n }\n has = has || hasValues(object[key]);\n }\n return has;\n}\n\n/**\n * Helper function (recursive) to add rows to an object table\n * @param {Object} object object to render\n * @param {Number} depth total depth of initial object\n * @param {Number} level current level\n * @param {CliTable3} table the object table to add the rows to\n * @returns the updated object table\n */\nfunction addRows(object, depth, level, table, keyMap) {\n const space = ' ';\n const keys = Object.keys(object);\n for (const key of keys) {\n if (Object(object[key]) !== object[key]) {\n if (level === 1) {\n table.push([\n keyMap[key] ? keyMap[key]['brightCyan'] : key['brightCyan'],\n object[key],\n ]);\n } else {\n table.push([\n {\n hAlign: 'right',\n content: keyMap[key] ? keyMap[key]['gray'] : key['gray'],\n },\n object[key],\n ]);\n }\n }\n }\n for (const key of keys) {\n if (Object(object[key]) === object[key]) {\n // only print header if there are any values below\n if (hasValues(object[key])) {\n let indention = new Array(level).fill(space).join('');\n if (level < 3) indention = `\\n${indention}`;\n table.push([\n indention.concat(\n keyMap[key] ? keyMap[key]['brightCyan'] : key['brightCyan']\n ),\n '',\n ]);\n }\n // eslint-disable-next-line no-param-reassign\n table = addRows(object[key], depth, level + 1, table, keyMap);\n }\n }\n return table;\n}\n\n/**\n * Create and populate an object table from any JSON object. Use for describe commands.\n * @param {Object} object JSON object to create\n * @returns {CliTable3} a table that can be printed to the console\n */\nexport function createObjectTable(object, keyMap = {}) {\n // eslint-disable-next-line no-param-reassign\n const depth = getObjectDepth(object);\n // eslint-disable-next-line no-param-reassign\n const level = 0;\n // eslint-disable-next-line no-param-reassign\n const table = new Table({\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n },\n style: { 'padding-left': 0, 'padding-right': 0, head: ['brightCyan'] },\n });\n addRows(object, depth, level + 1, table, keyMap);\n return table;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AAA4C;AAAA;AAAA;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAY,CAC1BC,OAAwB,EAGxB;EAAA,IAFAC,IAAI,uEAAG,MAAM;E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AC;EAChD,OAAOD,KAAK;AACd"}
|
|
@@ -4,72 +4,50 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _fs = _interopRequireWildcard(require("fs"));
|
|
9
|
-
|
|
10
8
|
var _crypto = _interopRequireDefault(require("crypto"));
|
|
11
|
-
|
|
12
9
|
var _os = require("os");
|
|
13
|
-
|
|
14
10
|
var _util = require("util");
|
|
15
|
-
|
|
16
11
|
var _Console = require("./Console");
|
|
17
|
-
|
|
18
|
-
var _SessionStorage = _interopRequireDefault(require("../../storage/SessionStorage"));
|
|
19
|
-
|
|
12
|
+
var state = _interopRequireWildcard(require("../../shared/State"));
|
|
20
13
|
var _StaticStorage = require("../../storage/StaticStorage");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
-
|
|
26
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
17
|
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); } }
|
|
29
|
-
|
|
30
18
|
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); }); }; }
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
var scrypt = (0, _util.promisify)(_crypto.default.scrypt);
|
|
20
|
+
// using WeakMaps for added security since it gets garbage collected
|
|
34
21
|
var _masterKey = new WeakMap();
|
|
35
|
-
|
|
36
22
|
var _nonce = new WeakMap();
|
|
37
|
-
|
|
38
23
|
var _salt = new WeakMap();
|
|
39
|
-
|
|
40
24
|
var _key = new WeakMap();
|
|
41
|
-
|
|
42
25
|
var _encrypt = new WeakMap();
|
|
43
|
-
|
|
44
26
|
class DataProtection {
|
|
45
27
|
constructor() {
|
|
46
|
-
var masterKeyPath = () =>
|
|
47
|
-
|
|
48
|
-
|
|
28
|
+
var masterKeyPath = () => state.getMasterKeyPath() || process.env[_StaticStorage.FRODO_MASTER_KEY_PATH_KEY] || "".concat((0, _os.homedir)(), "/.frodo/masterkey.key");
|
|
29
|
+
// Generates a master key in base64 format. This master key will be used to derive the key for encryption. this key should be protected by an HSM or KMS
|
|
49
30
|
_masterKey.set(this, /*#__PURE__*/_asyncToGenerator(function* () {
|
|
50
31
|
try {
|
|
51
32
|
if (process.env[_StaticStorage.FRODO_MASTER_KEY_KEY]) return process.env[_StaticStorage.FRODO_MASTER_KEY_KEY];
|
|
52
|
-
|
|
53
33
|
if (!_fs.default.existsSync(masterKeyPath())) {
|
|
54
34
|
var masterKey = _crypto.default.randomBytes(32).toString('base64');
|
|
55
|
-
|
|
56
35
|
yield _fs.promises.writeFile(masterKeyPath(), masterKey);
|
|
57
36
|
}
|
|
58
|
-
|
|
59
37
|
return yield _fs.promises.readFile(masterKeyPath(), 'utf8');
|
|
60
38
|
} catch (err) {
|
|
61
39
|
(0, _Console.printMessage)(err.message, 'error');
|
|
62
40
|
return '';
|
|
63
41
|
}
|
|
64
|
-
}));
|
|
65
|
-
|
|
42
|
+
}));
|
|
66
43
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
_salt.set(this, () => _crypto.default.randomBytes(64)); // The function that derives the key, this supports sync and async operations
|
|
44
|
+
// the nonce for AES GCM
|
|
45
|
+
_nonce.set(this, () => _crypto.default.randomBytes(16));
|
|
71
46
|
|
|
47
|
+
// The salt
|
|
48
|
+
_salt.set(this, () => _crypto.default.randomBytes(64));
|
|
72
49
|
|
|
50
|
+
// The function that derives the key, this supports sync and async operations
|
|
73
51
|
_key.set(this,
|
|
74
52
|
/*#__PURE__*/
|
|
75
53
|
// eslint-disable-next-line no-return-await
|
|
@@ -77,40 +55,32 @@ class DataProtection {
|
|
|
77
55
|
var _ref2 = _asyncToGenerator(function* (masterKey, salt) {
|
|
78
56
|
return yield scrypt(masterKey, salt, 32);
|
|
79
57
|
});
|
|
80
|
-
|
|
81
58
|
return function (_x, _x2) {
|
|
82
59
|
return _ref2.apply(this, arguments);
|
|
83
60
|
};
|
|
84
|
-
}());
|
|
85
|
-
|
|
61
|
+
}());
|
|
86
62
|
|
|
63
|
+
// private method to encrypt and return encrypted data. cleaner code
|
|
87
64
|
_encrypt.set(this, (key, nonce, data, salt) => {
|
|
88
65
|
var cipher = _crypto.default.createCipheriv('aes-256-gcm', key, nonce);
|
|
89
|
-
|
|
90
66
|
var encrypted = Buffer.concat([cipher.update(JSON.stringify(data), 'utf8'), cipher.final()]);
|
|
91
67
|
var tag = cipher.getAuthTag();
|
|
92
68
|
var buffer = Buffer.concat([salt, nonce, tag, encrypted]);
|
|
93
69
|
return buffer.toString('base64');
|
|
94
70
|
});
|
|
95
71
|
}
|
|
96
|
-
|
|
97
72
|
encrypt(data) {
|
|
98
73
|
var _this = this;
|
|
99
|
-
|
|
100
74
|
return _asyncToGenerator(function* () {
|
|
101
75
|
var nonce = _nonce.get(_this)();
|
|
102
|
-
|
|
103
76
|
var salt = _salt.get(_this)();
|
|
104
|
-
|
|
105
77
|
var masterKey = yield _masterKey.get(_this)();
|
|
106
78
|
var key = yield _key.get(_this)(masterKey, salt);
|
|
107
79
|
return _encrypt.get(_this)(key, nonce, data, salt);
|
|
108
80
|
})();
|
|
109
81
|
}
|
|
110
|
-
|
|
111
82
|
decrypt(data) {
|
|
112
83
|
var _this2 = this;
|
|
113
|
-
|
|
114
84
|
return _asyncToGenerator(function* () {
|
|
115
85
|
var buffer = Buffer.from(data.toString(), 'base64');
|
|
116
86
|
var salt = buffer.slice(0, 64);
|
|
@@ -119,16 +89,12 @@ class DataProtection {
|
|
|
119
89
|
var encrypted = buffer.slice(96);
|
|
120
90
|
var masterKey = yield _masterKey.get(_this2)();
|
|
121
91
|
var key = yield _key.get(_this2)(masterKey, salt);
|
|
122
|
-
|
|
123
92
|
var decipher = _crypto.default.createDecipheriv('aes-256-gcm', key, nonce);
|
|
124
|
-
|
|
125
93
|
decipher.setAuthTag(tag);
|
|
126
94
|
return JSON.parse(decipher.update(encrypted.toString('binary'), 'binary', 'utf8') + decipher.final('utf8'));
|
|
127
95
|
})();
|
|
128
96
|
}
|
|
129
|
-
|
|
130
97
|
}
|
|
131
|
-
|
|
132
98
|
var _default = DataProtection;
|
|
133
99
|
exports.default = _default;
|
|
134
100
|
//# sourceMappingURL=DataProtection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataProtection.js","names":["scrypt","promisify","crypto","_masterKey","WeakMap","_nonce","_salt","_key","_encrypt","DataProtection","constructor","masterKeyPath","
|
|
1
|
+
{"version":3,"file":"DataProtection.js","names":["scrypt","promisify","crypto","_masterKey","WeakMap","_nonce","_salt","_key","_encrypt","DataProtection","constructor","masterKeyPath","state","getMasterKeyPath","process","env","FRODO_MASTER_KEY_PATH_KEY","homedir","set","FRODO_MASTER_KEY_KEY","fs","existsSync","masterKey","randomBytes","toString","fsp","writeFile","readFile","err","printMessage","message","salt","key","nonce","data","cipher","createCipheriv","encrypted","Buffer","concat","update","JSON","stringify","final","tag","getAuthTag","buffer","encrypt","get","decrypt","from","slice","decipher","createDecipheriv","setAuthTag","parse"],"sources":["ops/utils/DataProtection.ts"],"sourcesContent":["/**\n * Data is stored in base64 format. Initially it was binary data\n * Format used in this encryption module.\n * inspired by AndiDittrich\n * +--------------------+-----------------------+----------------+----------------+\n * | SALT | Initialization Vector | Auth Tag | Payload |\n * | Used to derive key | AES GCM XOR Init | Data Integrity | Encrypted Data |\n * | 64 Bytes, random | 16 Bytes, random | 16 Bytes | (N-96) Bytes |\n * +--------------------+-----------------------+----------------+----------------+\n * This module doesn't take care of data persistence, it's assumed the consuming method/class/package will do so.\n */\nimport fs, { promises as fsp } from 'fs';\nimport crypto from 'crypto';\nimport { homedir } from 'os';\nimport { promisify } from 'util';\nimport { printMessage } from './Console';\nimport * as state from '../../shared/State';\nimport {\n FRODO_MASTER_KEY_PATH_KEY,\n FRODO_MASTER_KEY_KEY,\n} from '../../storage/StaticStorage';\n\nconst scrypt = promisify(crypto.scrypt);\n// using WeakMaps for added security since it gets garbage collected\nconst _masterKey = new WeakMap();\nconst _nonce = new WeakMap();\nconst _salt = new WeakMap();\nconst _key = new WeakMap();\nconst _encrypt = new WeakMap();\n\nclass DataProtection {\n constructor() {\n const masterKeyPath = () =>\n state.getMasterKeyPath() ||\n process.env[FRODO_MASTER_KEY_PATH_KEY] ||\n `${homedir()}/.frodo/masterkey.key`;\n // Generates a master key in base64 format. This master key will be used to derive the key for encryption. this key should be protected by an HSM or KMS\n _masterKey.set(this, async () => {\n try {\n if (process.env[FRODO_MASTER_KEY_KEY])\n return process.env[FRODO_MASTER_KEY_KEY];\n if (!fs.existsSync(masterKeyPath())) {\n const masterKey = crypto.randomBytes(32).toString('base64');\n await fsp.writeFile(masterKeyPath(), masterKey);\n }\n return await fsp.readFile(masterKeyPath(), 'utf8');\n } catch (err) {\n printMessage(err.message, 'error');\n return '';\n }\n });\n\n // the nonce for AES GCM\n _nonce.set(this, () => crypto.randomBytes(16));\n\n // The salt\n _salt.set(this, () => crypto.randomBytes(64));\n\n // The function that derives the key, this supports sync and async operations\n _key.set(\n this,\n // eslint-disable-next-line no-return-await\n async (masterKey, salt) => await scrypt(masterKey, salt, 32)\n );\n\n // private method to encrypt and return encrypted data. cleaner code\n _encrypt.set(this, (key, nonce, data, salt) => {\n const cipher = crypto.createCipheriv('aes-256-gcm', key, nonce);\n const encrypted = Buffer.concat([\n cipher.update(JSON.stringify(data), 'utf8'),\n cipher.final(),\n ]);\n const tag = cipher.getAuthTag();\n const buffer = Buffer.concat([salt, nonce, tag, encrypted]);\n return buffer.toString('base64');\n });\n }\n\n async encrypt(data) {\n const nonce = _nonce.get(this)();\n const salt = _salt.get(this)();\n const masterKey = await _masterKey.get(this)();\n const key = await _key.get(this)(masterKey, salt);\n return _encrypt.get(this)(key, nonce, data, salt);\n }\n\n async decrypt(data) {\n const buffer = Buffer.from(data.toString(), 'base64');\n const salt = buffer.slice(0, 64);\n const nonce = buffer.slice(64, 80);\n const tag = buffer.slice(80, 96);\n const encrypted = buffer.slice(96);\n const masterKey = await _masterKey.get(this)();\n const key = await _key.get(this)(masterKey, salt);\n const decipher = crypto.createDecipheriv('aes-256-gcm', key, nonce);\n decipher.setAuthTag(tag);\n return JSON.parse(\n decipher.update(encrypted.toString('binary'), 'binary', 'utf8') +\n decipher.final('utf8')\n );\n }\n}\nexport default DataProtection;\n"],"mappings":";;;;;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AAGqC;AAAA;AAAA;AAAA;AAAA;AAErC,IAAMA,MAAM,GAAG,IAAAC,eAAS,EAACC,eAAM,CAACF,MAAM,CA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wC,GAAG,CAAC,KAAI,CAAC,CAAChB,GAAG,EAAEC,KAAK,EAAEC,IAAI,EAAEH,IAAI,CAAC;IAAC;EACpD;EAEMkB,OAAO,CAACf,IAAI,EAAE;IAAA;IAAA;MAClB,IAAMY,MAAM,GAAGR,MAAM,CAACY,IAAI,CAAChB,IAAI,CAACV,QAAQ,EAAE,EAAE,QAAQ,CAAC;MACrD,IAAMO,IAAI,GAAGe,MAAM,CAACK,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;MAChC,IAAMlB,KAAK,GAAGa,MAAM,CAACK,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC;MAClC,IAAMP,GAAG,GAAGE,MAAM,CAACK,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC;MAChC,IAAMd,SAAS,GAAGS,MAAM,CAACK,KAAK,CAAC,EAAE,CAAC;MAClC,IAAM7B,SAAS,SAASnB,UAAU,CAAC6C,GAAG,CAAC,MAAI,CAAC,EAAE;MAC9C,IAAMhB,GAAG,SAASzB,IAAI,CAACyC,GAAG,CAAC,MAAI,CAAC,CAAC1B,SAAS,EAAES,IAAI,CAAC;MACjD,IAAMqB,QAAQ,GAAGlD,eAAM,CAACmD,gBAAgB,CAAC,aAAa,EAAErB,GAAG,EAAEC,KAAK,CAAC;MACnEmB,QAAQ,CAACE,UAAU,CAACV,GAAG,CAAC;MACxB,OAAOH,IAAI,CAACc,KAAK,CACfH,QAAQ,CAACZ,MAAM,CAACH,SAAS,CAACb,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAC7D4B,QAAQ,CAACT,KAAK,CAAC,MAAM,CAAC,CACzB;IAAC;EACJ;AACF;AAAC,eACclC,cAAc;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataProtection.test.js","names":["test","dp","DataProtection","EXPECTED","originalString","RESULT","encrypt","expect","length","toBe","encrypted","decrypt"],"sources":["ops/utils/DataProtection.test.ts"],"sourcesContent":["import DataProtection from './DataProtection';\n\ntest('DataProtection to encrypt', async () => {\n // Note this test checks that encyption happned not that encryption is correct\n // this test relys on other tests to proove the likelyhood of successful encryption\n // Arrange\n const dp = new DataProtection();\n const EXPECTED =\n 'aMLtCqK1b+d3d88DDKrmIV7A6pifP77IItLKX7N7/UTOPxf8YCQWHCpTrmNnM5wNXue8HllEFIS+sxXRb20oCb4HImpbQM0so5DrHIqcIlF5LYDKjvzBOz1PdlclhIuIV+Gr8M3GRbNkQxXJuUZ4th5ISLpOjM+k8bDAlnHsRx5LLlbLFnAKq8Pu9DaTYUkZABOCOjfkoTb6re1p9c7xE2pAe213';\n const originalString =\n 'Go not to the Elves for counsel, for they will say both no and yes.';\n // Act\n const RESULT = await dp.encrypt(originalString);\n // Assert\n expect(RESULT.length).toBe(EXPECTED.length);\n});\n\ntest('DataProtection to decrypt', async () => {\n // Arrange\n const dp = new DataProtection();\n const originalString =\n 'Go not to the Elves for counsel, for they will say both no and yes.';\n // Act\n const encrypted = await dp.encrypt(originalString);\n const RESULT = await dp.decrypt(encrypted);\n // Assert\n expect(RESULT).toBe(originalString);\n});\n"],"mappings":";;AAAA
|
|
1
|
+
{"version":3,"file":"DataProtection.test.js","names":["test","dp","DataProtection","EXPECTED","originalString","RESULT","encrypt","expect","length","toBe","encrypted","decrypt"],"sources":["ops/utils/DataProtection.test.ts"],"sourcesContent":["import DataProtection from './DataProtection';\n\ntest('DataProtection to encrypt', async () => {\n // Note this test checks that encyption happned not that encryption is correct\n // this test relys on other tests to proove the likelyhood of successful encryption\n // Arrange\n const dp = new DataProtection();\n const EXPECTED =\n 'aMLtCqK1b+d3d88DDKrmIV7A6pifP77IItLKX7N7/UTOPxf8YCQWHCpTrmNnM5wNXue8HllEFIS+sxXRb20oCb4HImpbQM0so5DrHIqcIlF5LYDKjvzBOz1PdlclhIuIV+Gr8M3GRbNkQxXJuUZ4th5ISLpOjM+k8bDAlnHsRx5LLlbLFnAKq8Pu9DaTYUkZABOCOjfkoTb6re1p9c7xE2pAe213';\n const originalString =\n 'Go not to the Elves for counsel, for they will say both no and yes.';\n // Act\n const RESULT = await dp.encrypt(originalString);\n // Assert\n expect(RESULT.length).toBe(EXPECTED.length);\n});\n\ntest('DataProtection to decrypt', async () => {\n // Arrange\n const dp = new DataProtection();\n const originalString =\n 'Go not to the Elves for counsel, for they will say both no and yes.';\n // Act\n const encrypted = await dp.encrypt(originalString);\n const RESULT = await dp.decrypt(encrypted);\n // Assert\n expect(RESULT).toBe(originalString);\n});\n"],"mappings":";;AAAA;AAA8C;AAAA;AAAA;AAE9CA,IAAI,CAAC,2BAA2B,iCAAE,aAAY;EAC5C;EACA;EACA;EACA,IAAMC,EAAE,GAAG,IAAIC,uBAAc,EAAE;EAC/B,IAAMC,QAAQ,GACZ,8NAA8N;EAChO,IAAMC,cAAc,GAClB,qEAAqE;EACvE;EACA,IAAMC,MAAM,SAASJ,EAAE,CAACK,OAAO,CAACF,cAAc,CAAC;EAC/C;EACAG,MAAM,CAACF,MAAM,CAACG,MAAM,CAAC,CAACC,IAAI,CAACN,QAAQ,CAACK,MAAM,CAAC;AAC7C,CAAC,EAAC;AAEFR,IAAI,CAAC,2BAA2B,iCAAE,aAAY;EAC5C;EACA,IAAMC,EAAE,GAAG,IAAIC,uBAAc,EAAE;EAC/B,IAAME,cAAc,GAClB,qEAAqE;EACvE;EACA,IAAMM,SAAS,SAAST,EAAE,CAACK,OAAO,CAACF,cAAc,CAAC;EAClD,IAAMC,MAAM,SAASJ,EAAE,CAACU,OAAO,CAACD,SAAS,CAAC;EAC1C;EACAH,MAAM,CAACF,MAAM,CAAC,CAACI,IAAI,CAACL,cAAc,CAAC;AACrC,CAAC,EAAC"}
|