@azure/msal-common 14.14.2 → 14.16.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/browser/README.md +1 -0
- package/browser/package.json +5 -0
- package/dist/account/AccountInfo.d.ts +1 -1
- package/dist/account/AccountInfo.d.ts.map +1 -1
- package/dist/account/AccountInfo.mjs +1 -1
- package/dist/account/AuthToken.d.ts +1 -1
- package/dist/account/AuthToken.d.ts.map +1 -1
- package/dist/account/AuthToken.mjs +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/ClientInfo.mjs +1 -1
- package/dist/account/TokenClaims.mjs +1 -1
- package/dist/authority/Authority.d.ts +12 -12
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.mjs +1 -1
- package/dist/authority/AuthorityFactory.d.ts +6 -6
- package/dist/authority/AuthorityFactory.d.ts.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +1 -1
- package/dist/authority/AuthorityMetadata.d.ts +6 -6
- package/dist/authority/AuthorityMetadata.d.ts.map +1 -1
- package/dist/authority/AuthorityMetadata.mjs +1 -1
- package/dist/authority/AuthorityOptions.d.ts +4 -4
- package/dist/authority/AuthorityOptions.d.ts.map +1 -1
- package/dist/authority/AuthorityOptions.mjs +1 -1
- package/dist/authority/AuthorityType.mjs +1 -1
- package/dist/authority/AzureRegionConfiguration.d.ts +1 -1
- package/dist/authority/AzureRegionConfiguration.d.ts.map +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.d.ts +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.d.ts.map +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
- package/dist/authority/OIDCOptions.d.ts +1 -1
- package/dist/authority/OIDCOptions.d.ts.map +1 -1
- package/dist/authority/OpenIdConfigResponse.mjs +1 -1
- package/dist/authority/ProtocolMode.mjs +1 -1
- package/dist/authority/RegionDiscovery.d.ts +5 -5
- package/dist/authority/RegionDiscovery.d.ts.map +1 -1
- package/dist/authority/RegionDiscovery.mjs +1 -1
- package/dist/authority/RegionDiscoveryMetadata.d.ts +1 -1
- package/dist/authority/RegionDiscoveryMetadata.d.ts.map +1 -1
- package/dist/broker/nativeBroker/INativeBrokerPlugin.d.ts +6 -6
- package/dist/broker/nativeBroker/INativeBrokerPlugin.d.ts.map +1 -1
- package/dist/cache/CacheManager.d.ts +18 -23
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +1 -4
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.d.ts +2 -2
- package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.d.ts +6 -6
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.mjs +1 -1
- package/dist/cache/entities/CacheRecord.d.ts +5 -5
- package/dist/cache/entities/CacheRecord.d.ts.map +1 -1
- package/dist/cache/entities/CredentialEntity.d.ts +1 -1
- package/dist/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/dist/cache/entities/IdTokenEntity.d.ts +1 -1
- package/dist/cache/entities/IdTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/RefreshTokenEntity.d.ts +1 -1
- package/dist/cache/entities/RefreshTokenEntity.d.ts.map +1 -1
- package/dist/cache/interface/ICacheManager.d.ts +12 -12
- package/dist/cache/interface/ICacheManager.d.ts.map +1 -1
- package/dist/cache/interface/ICachePlugin.d.ts +1 -1
- package/dist/cache/interface/ICachePlugin.d.ts.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.d.ts +1 -1
- package/dist/cache/persistence/TokenCacheContext.d.ts.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/CacheHelpers.d.ts +9 -9
- package/dist/cache/utils/CacheHelpers.d.ts.map +1 -1
- package/dist/cache/utils/CacheHelpers.mjs +1 -1
- package/dist/cache/utils/CacheTypes.d.ts +11 -11
- package/dist/cache/utils/CacheTypes.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts +10 -9
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +35 -16
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.d.ts +21 -14
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.mjs +62 -10
- package/dist/client/BaseClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts +6 -6
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +10 -4
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts +6 -6
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +1 -1
- package/dist/config/ClientConfiguration.d.ts +15 -11
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.mjs +2 -1
- package/dist/config/ClientConfiguration.mjs.map +1 -1
- package/dist/constants/AADServerParamKeys.d.ts +2 -0
- package/dist/constants/AADServerParamKeys.d.ts.map +1 -1
- package/dist/constants/AADServerParamKeys.mjs +5 -3
- package/dist/constants/AADServerParamKeys.mjs.map +1 -1
- package/dist/crypto/ICrypto.d.ts +2 -2
- package/dist/crypto/ICrypto.d.ts.map +1 -1
- package/dist/crypto/ICrypto.mjs +1 -1
- package/dist/crypto/JoseHeader.d.ts +1 -1
- package/dist/crypto/JoseHeader.d.ts.map +1 -1
- package/dist/crypto/JoseHeader.mjs +1 -1
- package/dist/crypto/PopTokenGenerator.d.ts +3 -3
- package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.d.ts +1 -1
- package/dist/crypto/SignedHttpRequest.d.ts.map +1 -1
- package/dist/error/AuthError.d.ts +1 -1
- package/dist/error/AuthError.d.ts.map +1 -1
- package/dist/error/AuthError.mjs +1 -1
- package/dist/error/AuthErrorCodes.mjs +1 -1
- package/dist/error/CacheError.d.ts +1 -1
- package/dist/error/CacheError.d.ts.map +1 -1
- package/dist/error/CacheError.mjs +1 -1
- package/dist/error/CacheErrorCodes.mjs +1 -1
- package/dist/error/ClientAuthError.d.ts +2 -2
- package/dist/error/ClientAuthError.d.ts.map +1 -1
- package/dist/error/ClientAuthError.mjs +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +1 -1
- package/dist/error/ClientConfigurationError.d.ts +2 -2
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +1 -1
- package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
- package/dist/error/InteractionRequiredAuthError.d.ts +2 -2
- package/dist/error/InteractionRequiredAuthError.d.ts.map +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +1 -1
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
- package/dist/error/JoseHeaderError.d.ts +2 -2
- package/dist/error/JoseHeaderError.d.ts.map +1 -1
- package/dist/error/JoseHeaderError.mjs +1 -1
- package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
- package/dist/error/NetworkError.d.ts +19 -0
- package/dist/error/NetworkError.d.ts.map +1 -0
- package/dist/error/NetworkError.mjs +34 -0
- package/dist/error/NetworkError.mjs.map +1 -0
- package/dist/error/ServerError.d.ts +1 -1
- package/dist/error/ServerError.d.ts.map +1 -1
- package/dist/error/ServerError.mjs +1 -1
- package/dist/exports-browser-only.d.ts +10 -0
- package/dist/exports-browser-only.d.ts.map +1 -0
- package/dist/exports-common.d.ts +81 -0
- package/dist/exports-common.d.ts.map +1 -0
- package/dist/exports-node-only.d.ts +18 -0
- package/dist/exports-node-only.d.ts.map +1 -0
- package/dist/index-browser.d.ts +7 -0
- package/dist/index-browser.d.ts.map +1 -0
- package/dist/index-browser.mjs +67 -0
- package/dist/index-browser.mjs.map +1 -0
- package/dist/index-node.d.ts +7 -0
- package/dist/index-node.d.ts.map +1 -0
- package/dist/index-node.mjs +66 -0
- package/dist/index-node.mjs.map +1 -0
- package/dist/index.d.ts +7 -103
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +31 -31
- package/dist/logger/Logger.d.ts +1 -1
- package/dist/logger/Logger.d.ts.map +1 -1
- package/dist/logger/Logger.mjs +1 -1
- package/dist/network/INetworkModule.d.ts +1 -1
- package/dist/network/INetworkModule.d.ts.map +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/NetworkResponse.d.ts +6 -0
- package/dist/network/NetworkResponse.d.ts.map +1 -0
- package/dist/network/RequestThumbprint.d.ts +2 -2
- package/dist/network/RequestThumbprint.d.ts.map +1 -1
- package/dist/network/ThrottlingUtils.d.ts +5 -5
- package/dist/network/ThrottlingUtils.d.ts.map +1 -1
- package/dist/network/ThrottlingUtils.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist/request/BaseAuthRequest.d.ts +7 -5
- package/dist/request/BaseAuthRequest.d.ts.map +1 -1
- package/dist/request/CommonAuthorizationCodeRequest.d.ts +3 -3
- package/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
- package/dist/request/CommonAuthorizationUrlRequest.d.ts +4 -4
- package/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/CommonClientCredentialRequest.d.ts +3 -3
- package/dist/request/CommonClientCredentialRequest.d.ts.map +1 -1
- package/dist/request/CommonDeviceCodeRequest.d.ts +3 -3
- package/dist/request/CommonDeviceCodeRequest.d.ts.map +1 -1
- package/dist/request/CommonEndSessionRequest.d.ts +2 -2
- package/dist/request/CommonEndSessionRequest.d.ts.map +1 -1
- package/dist/request/CommonOnBehalfOfRequest.d.ts +1 -1
- package/dist/request/CommonOnBehalfOfRequest.d.ts.map +1 -1
- package/dist/request/CommonRefreshTokenRequest.d.ts +3 -3
- package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
- package/dist/request/CommonSilentFlowRequest.d.ts +3 -3
- package/dist/request/CommonSilentFlowRequest.d.ts.map +1 -1
- package/dist/request/CommonUsernamePasswordRequest.d.ts +1 -1
- package/dist/request/CommonUsernamePasswordRequest.d.ts.map +1 -1
- package/dist/request/NativeRequest.d.ts +1 -1
- package/dist/request/NativeRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts +13 -6
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +26 -3
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/RequestValidator.mjs +1 -1
- package/dist/request/ScopeSet.mjs +1 -1
- package/dist/response/AuthenticationResult.d.ts +1 -1
- package/dist/response/AuthenticationResult.d.ts.map +1 -1
- package/dist/response/ExternalTokenResponse.d.ts +1 -1
- package/dist/response/ExternalTokenResponse.d.ts.map +1 -1
- package/dist/response/ResponseHandler.d.ts +16 -16
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/response/ServerAuthorizationTokenResponse.d.ts +1 -1
- package/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -1
- package/dist/telemetry/performance/IPerformanceClient.d.ts +2 -2
- package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.d.ts +5 -5
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +29 -10
- package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +9 -0
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +6 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.d.ts +3 -3
- package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.d.ts +5 -5
- package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
- package/dist/url/UrlString.d.ts +1 -1
- package/dist/url/UrlString.d.ts.map +1 -1
- package/dist/url/UrlString.mjs +1 -1
- package/dist/utils/ClientAssertionUtils.d.ts +1 -1
- package/dist/utils/ClientAssertionUtils.d.ts.map +1 -1
- package/dist/utils/ClientAssertionUtils.mjs +1 -1
- package/dist/utils/Constants.d.ts +1 -0
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +2 -1
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/FunctionWrappers.d.ts +2 -2
- package/dist/utils/FunctionWrappers.d.ts.map +1 -1
- package/dist/utils/FunctionWrappers.mjs +1 -1
- package/dist/utils/ProtocolUtils.d.ts +1 -1
- package/dist/utils/ProtocolUtils.d.ts.map +1 -1
- package/dist/utils/ProtocolUtils.mjs +1 -1
- package/dist/utils/StringUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/dist/utils/UrlUtils.d.ts +1 -1
- package/dist/utils/UrlUtils.d.ts.map +1 -1
- package/dist/utils/UrlUtils.mjs +1 -1
- package/lib/index-browser.cjs +858 -0
- package/lib/index-browser.cjs.map +1 -0
- package/{dist/index.cjs → lib/index-node-C9XsExml.js} +352 -990
- package/lib/index-node-C9XsExml.js.map +1 -0
- package/lib/index-node.cjs +104 -0
- package/lib/index-node.cjs.map +1 -0
- package/lib/index.cjs +112 -0
- package/lib/index.cjs.map +1 -0
- package/lib/package.json +1 -0
- package/lib/types/account/AccountInfo.d.ts +67 -0
- package/lib/types/account/AccountInfo.d.ts.map +1 -0
- package/lib/types/account/AuthToken.d.ts +18 -0
- package/lib/types/account/AuthToken.d.ts.map +1 -0
- package/lib/types/account/CcsCredential.d.ts +10 -0
- package/lib/types/account/CcsCredential.d.ts.map +1 -0
- package/lib/types/account/ClientCredentials.d.ts +20 -0
- package/lib/types/account/ClientCredentials.d.ts.map +1 -0
- package/lib/types/account/ClientInfo.d.ts +19 -0
- package/lib/types/account/ClientInfo.d.ts.map +1 -0
- package/lib/types/account/TokenClaims.d.ts +84 -0
- package/lib/types/account/TokenClaims.d.ts.map +1 -0
- package/lib/types/authority/Authority.d.ts +255 -0
- package/lib/types/authority/Authority.d.ts.map +1 -0
- package/lib/types/authority/AuthorityFactory.d.ts +19 -0
- package/lib/types/authority/AuthorityFactory.d.ts.map +1 -0
- package/lib/types/authority/AuthorityMetadata.d.ts +44 -0
- package/lib/types/authority/AuthorityMetadata.d.ts.map +1 -0
- package/lib/types/authority/AuthorityOptions.d.ts +28 -0
- package/lib/types/authority/AuthorityOptions.d.ts.map +1 -0
- package/lib/types/authority/AuthorityType.d.ts +11 -0
- package/lib/types/authority/AuthorityType.d.ts.map +1 -0
- package/lib/types/authority/AzureRegion.d.ts +2 -0
- package/lib/types/authority/AzureRegion.d.ts.map +1 -0
- package/lib/types/authority/AzureRegionConfiguration.d.ts +6 -0
- package/lib/types/authority/AzureRegionConfiguration.d.ts.map +1 -0
- package/lib/types/authority/CloudDiscoveryMetadata.d.ts +6 -0
- package/lib/types/authority/CloudDiscoveryMetadata.d.ts.map +1 -0
- package/lib/types/authority/CloudInstanceDiscoveryErrorResponse.d.ts +14 -0
- package/lib/types/authority/CloudInstanceDiscoveryErrorResponse.d.ts.map +1 -0
- package/lib/types/authority/CloudInstanceDiscoveryResponse.d.ts +10 -0
- package/lib/types/authority/CloudInstanceDiscoveryResponse.d.ts.map +1 -0
- package/lib/types/authority/ImdsOptions.d.ts +6 -0
- package/lib/types/authority/ImdsOptions.d.ts.map +1 -0
- package/lib/types/authority/OIDCOptions.d.ts +9 -0
- package/lib/types/authority/OIDCOptions.d.ts.map +1 -0
- package/lib/types/authority/OpenIdConfigResponse.d.ts +12 -0
- package/lib/types/authority/OpenIdConfigResponse.d.ts.map +1 -0
- package/lib/types/authority/ProtocolMode.d.ts +9 -0
- package/lib/types/authority/ProtocolMode.d.ts.map +1 -0
- package/lib/types/authority/RegionDiscovery.d.ts +33 -0
- package/lib/types/authority/RegionDiscovery.d.ts.map +1 -0
- package/lib/types/authority/RegionDiscoveryMetadata.d.ts +7 -0
- package/lib/types/authority/RegionDiscoveryMetadata.d.ts.map +1 -0
- package/lib/types/broker/nativeBroker/INativeBrokerPlugin.d.ts +16 -0
- package/lib/types/broker/nativeBroker/INativeBrokerPlugin.d.ts.map +1 -0
- package/lib/types/cache/CacheManager.d.ts +493 -0
- package/lib/types/cache/CacheManager.d.ts.map +1 -0
- package/lib/types/cache/entities/AccessTokenEntity.d.ts +26 -0
- package/lib/types/cache/entities/AccessTokenEntity.d.ts.map +1 -0
- package/lib/types/cache/entities/AccountEntity.d.ts +107 -0
- package/lib/types/cache/entities/AccountEntity.d.ts.map +1 -0
- package/lib/types/cache/entities/AppMetadataEntity.d.ts +12 -0
- package/lib/types/cache/entities/AppMetadataEntity.d.ts.map +1 -0
- package/lib/types/cache/entities/AuthorityMetadataEntity.d.ts +16 -0
- package/lib/types/cache/entities/AuthorityMetadataEntity.d.ts.map +1 -0
- package/lib/types/cache/entities/CacheRecord.d.ts +14 -0
- package/lib/types/cache/entities/CacheRecord.d.ts.map +1 -0
- package/lib/types/cache/entities/CredentialEntity.d.ts +31 -0
- package/lib/types/cache/entities/CredentialEntity.d.ts.map +1 -0
- package/lib/types/cache/entities/IdTokenEntity.d.ts +9 -0
- package/lib/types/cache/entities/IdTokenEntity.d.ts.map +1 -0
- package/lib/types/cache/entities/RefreshTokenEntity.d.ts +8 -0
- package/lib/types/cache/entities/RefreshTokenEntity.d.ts.map +1 -0
- package/lib/types/cache/entities/ServerTelemetryEntity.d.ts +7 -0
- package/lib/types/cache/entities/ServerTelemetryEntity.d.ts.map +1 -0
- package/lib/types/cache/entities/ThrottlingEntity.d.ts +8 -0
- package/lib/types/cache/entities/ThrottlingEntity.d.ts.map +1 -0
- package/lib/types/cache/interface/ICacheManager.d.ts +167 -0
- package/lib/types/cache/interface/ICacheManager.d.ts.map +1 -0
- package/lib/types/cache/interface/ICachePlugin.d.ts +6 -0
- package/lib/types/cache/interface/ICachePlugin.d.ts.map +1 -0
- package/lib/types/cache/interface/ISerializableTokenCache.d.ts +5 -0
- package/lib/types/cache/interface/ISerializableTokenCache.d.ts.map +1 -0
- package/lib/types/cache/persistence/TokenCacheContext.d.ts +24 -0
- package/lib/types/cache/persistence/TokenCacheContext.d.ts.map +1 -0
- package/lib/types/cache/utils/CacheHelpers.d.ts +95 -0
- package/lib/types/cache/utils/CacheHelpers.d.ts.map +1 -0
- package/lib/types/cache/utils/CacheTypes.d.ts +70 -0
- package/lib/types/cache/utils/CacheTypes.d.ts.map +1 -0
- package/lib/types/client/AuthorizationCodeClient.d.ts +76 -0
- package/lib/types/client/AuthorizationCodeClient.d.ts.map +1 -0
- package/lib/types/client/BaseClient.d.ts +59 -0
- package/lib/types/client/BaseClient.d.ts.map +1 -0
- package/lib/types/client/RefreshTokenClient.d.ts +36 -0
- package/lib/types/client/RefreshTokenClient.d.ts.map +1 -0
- package/lib/types/client/SilentFlowClient.d.ts +28 -0
- package/lib/types/client/SilentFlowClient.d.ts.map +1 -0
- package/lib/types/config/AppTokenProvider.d.ts +39 -0
- package/lib/types/config/AppTokenProvider.d.ts.map +1 -0
- package/lib/types/config/ClientConfiguration.d.ts +155 -0
- package/lib/types/config/ClientConfiguration.d.ts.map +1 -0
- package/lib/types/constants/AADServerParamKeys.d.ts +56 -0
- package/lib/types/constants/AADServerParamKeys.d.ts.map +1 -0
- package/lib/types/crypto/ICrypto.d.ts +69 -0
- package/lib/types/crypto/ICrypto.d.ts.map +1 -0
- package/lib/types/crypto/IGuidGenerator.d.ts +5 -0
- package/lib/types/crypto/IGuidGenerator.d.ts.map +1 -0
- package/lib/types/crypto/JoseHeader.d.ts +23 -0
- package/lib/types/crypto/JoseHeader.d.ts.map +1 -0
- package/lib/types/crypto/PopTokenGenerator.d.ts +60 -0
- package/lib/types/crypto/PopTokenGenerator.d.ts.map +1 -0
- package/lib/types/crypto/SignedHttpRequest.d.ts +16 -0
- package/lib/types/crypto/SignedHttpRequest.d.ts.map +1 -0
- package/lib/types/error/AuthError.d.ts +45 -0
- package/lib/types/error/AuthError.d.ts.map +1 -0
- package/lib/types/error/AuthErrorCodes.d.ts +6 -0
- package/lib/types/error/AuthErrorCodes.d.ts.map +1 -0
- package/lib/types/error/CacheError.d.ts +21 -0
- package/lib/types/error/CacheError.d.ts.map +1 -0
- package/lib/types/error/CacheErrorCodes.d.ts +3 -0
- package/lib/types/error/CacheErrorCodes.d.ts.map +1 -0
- package/lib/types/error/ClientAuthError.d.ts +238 -0
- package/lib/types/error/ClientAuthError.d.ts.map +1 -0
- package/lib/types/error/ClientAuthErrorCodes.d.ts +45 -0
- package/lib/types/error/ClientAuthErrorCodes.d.ts.map +1 -0
- package/lib/types/error/ClientConfigurationError.d.ts +129 -0
- package/lib/types/error/ClientConfigurationError.d.ts.map +1 -0
- package/lib/types/error/ClientConfigurationErrorCodes.d.ts +23 -0
- package/lib/types/error/ClientConfigurationErrorCodes.d.ts.map +1 -0
- package/lib/types/error/InteractionRequiredAuthError.d.ts +66 -0
- package/lib/types/error/InteractionRequiredAuthError.d.ts.map +1 -0
- package/lib/types/error/InteractionRequiredAuthErrorCodes.d.ts +8 -0
- package/lib/types/error/InteractionRequiredAuthErrorCodes.d.ts.map +1 -0
- package/lib/types/error/JoseHeaderError.d.ts +16 -0
- package/lib/types/error/JoseHeaderError.d.ts.map +1 -0
- package/lib/types/error/JoseHeaderErrorCodes.d.ts +3 -0
- package/lib/types/error/JoseHeaderErrorCodes.d.ts.map +1 -0
- package/lib/types/error/NetworkError.d.ts +19 -0
- package/lib/types/error/NetworkError.d.ts.map +1 -0
- package/lib/types/error/ServerError.d.ts +16 -0
- package/lib/types/error/ServerError.d.ts.map +1 -0
- package/lib/types/exports-browser-only.d.ts +10 -0
- package/lib/types/exports-browser-only.d.ts.map +1 -0
- package/lib/types/exports-common.d.ts +81 -0
- package/lib/types/exports-common.d.ts.map +1 -0
- package/lib/types/exports-node-only.d.ts +18 -0
- package/lib/types/exports-node-only.d.ts.map +1 -0
- package/lib/types/index-browser.d.ts +7 -0
- package/lib/types/index-browser.d.ts.map +1 -0
- package/lib/types/index-node.d.ts +7 -0
- package/lib/types/index-node.d.ts.map +1 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/logger/Logger.d.ts +96 -0
- package/lib/types/logger/Logger.d.ts.map +1 -0
- package/lib/types/network/INetworkModule.d.ts +30 -0
- package/lib/types/network/INetworkModule.d.ts.map +1 -0
- package/lib/types/network/NetworkResponse.d.ts +6 -0
- package/lib/types/network/NetworkResponse.d.ts.map +1 -0
- package/lib/types/network/RequestThumbprint.d.ts +19 -0
- package/lib/types/network/RequestThumbprint.d.ts.map +1 -0
- package/lib/types/network/ThrottlingUtils.d.ts +43 -0
- package/lib/types/network/ThrottlingUtils.d.ts.map +1 -0
- package/lib/types/packageMetadata.d.ts +3 -0
- package/lib/types/packageMetadata.d.ts.map +1 -0
- package/lib/types/request/AuthenticationHeaderParser.d.ts +20 -0
- package/lib/types/request/AuthenticationHeaderParser.d.ts.map +1 -0
- package/lib/types/request/BaseAuthRequest.d.ts +50 -0
- package/lib/types/request/BaseAuthRequest.d.ts.map +1 -0
- package/lib/types/request/CommonAuthorizationCodeRequest.d.ts +28 -0
- package/lib/types/request/CommonAuthorizationCodeRequest.d.ts.map +1 -0
- package/lib/types/request/CommonAuthorizationUrlRequest.d.ts +51 -0
- package/lib/types/request/CommonAuthorizationUrlRequest.d.ts.map +1 -0
- package/lib/types/request/CommonClientCredentialRequest.d.ts +18 -0
- package/lib/types/request/CommonClientCredentialRequest.d.ts.map +1 -0
- package/lib/types/request/CommonDeviceCodeRequest.d.ts +22 -0
- package/lib/types/request/CommonDeviceCodeRequest.d.ts.map +1 -0
- package/lib/types/request/CommonEndSessionRequest.d.ts +22 -0
- package/lib/types/request/CommonEndSessionRequest.d.ts.map +1 -0
- package/lib/types/request/CommonOnBehalfOfRequest.d.ts +14 -0
- package/lib/types/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
- package/lib/types/request/CommonRefreshTokenRequest.d.ts +23 -0
- package/lib/types/request/CommonRefreshTokenRequest.d.ts.map +1 -0
- package/lib/types/request/CommonSilentFlowRequest.d.ts +28 -0
- package/lib/types/request/CommonSilentFlowRequest.d.ts.map +1 -0
- package/lib/types/request/CommonUsernamePasswordRequest.d.ts +18 -0
- package/lib/types/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
- package/lib/types/request/NativeRequest.d.ts +20 -0
- package/lib/types/request/NativeRequest.d.ts.map +1 -0
- package/lib/types/request/NativeSignOutRequest.d.ts +6 -0
- package/lib/types/request/NativeSignOutRequest.d.ts.map +1 -0
- package/lib/types/request/RequestParameterBuilder.d.ts +225 -0
- package/lib/types/request/RequestParameterBuilder.d.ts.map +1 -0
- package/lib/types/request/RequestValidator.d.ts +28 -0
- package/lib/types/request/RequestValidator.d.ts.map +1 -0
- package/lib/types/request/ScopeSet.d.ts +89 -0
- package/lib/types/request/ScopeSet.d.ts.map +1 -0
- package/lib/types/request/StoreInCache.d.ts +9 -0
- package/lib/types/request/StoreInCache.d.ts.map +1 -0
- package/lib/types/response/AuthenticationResult.d.ts +42 -0
- package/lib/types/response/AuthenticationResult.d.ts.map +1 -0
- package/lib/types/response/AuthorizationCodePayload.d.ts +14 -0
- package/lib/types/response/AuthorizationCodePayload.d.ts.map +1 -0
- package/lib/types/response/DeviceCodeResponse.d.ts +26 -0
- package/lib/types/response/DeviceCodeResponse.d.ts.map +1 -0
- package/lib/types/response/ExternalTokenResponse.d.ts +16 -0
- package/lib/types/response/ExternalTokenResponse.d.ts.map +1 -0
- package/lib/types/response/IMDSBadResponse.d.ts +5 -0
- package/lib/types/response/IMDSBadResponse.d.ts.map +1 -0
- package/lib/types/response/ResponseHandler.d.ts +70 -0
- package/lib/types/response/ResponseHandler.d.ts.map +1 -0
- package/lib/types/response/ServerAuthorizationCodeResponse.d.ts +27 -0
- package/lib/types/response/ServerAuthorizationCodeResponse.d.ts.map +1 -0
- package/lib/types/response/ServerAuthorizationTokenResponse.d.ts +48 -0
- package/lib/types/response/ServerAuthorizationTokenResponse.d.ts.map +1 -0
- package/lib/types/telemetry/performance/IPerformanceClient.d.ts +58 -0
- package/lib/types/telemetry/performance/IPerformanceClient.d.ts.map +1 -0
- package/lib/types/telemetry/performance/IPerformanceMeasurement.d.ts +6 -0
- package/lib/types/telemetry/performance/IPerformanceMeasurement.d.ts.map +1 -0
- package/lib/types/telemetry/performance/PerformanceClient.d.ts +243 -0
- package/lib/types/telemetry/performance/PerformanceClient.d.ts.map +1 -0
- package/lib/types/telemetry/performance/PerformanceEvent.d.ts +521 -0
- package/lib/types/telemetry/performance/PerformanceEvent.d.ts.map +1 -0
- package/lib/types/telemetry/performance/StubPerformanceClient.d.ts +25 -0
- package/lib/types/telemetry/performance/StubPerformanceClient.d.ts.map +1 -0
- package/lib/types/telemetry/server/ServerTelemetryManager.d.ts +79 -0
- package/lib/types/telemetry/server/ServerTelemetryManager.d.ts.map +1 -0
- package/lib/types/telemetry/server/ServerTelemetryRequest.d.ts +9 -0
- package/lib/types/telemetry/server/ServerTelemetryRequest.d.ts.map +1 -0
- package/lib/types/url/IUri.d.ts +13 -0
- package/lib/types/url/IUri.d.ts.map +1 -0
- package/lib/types/url/UrlString.d.ts +49 -0
- package/lib/types/url/UrlString.d.ts.map +1 -0
- package/lib/types/utils/ClientAssertionUtils.d.ts +3 -0
- package/lib/types/utils/ClientAssertionUtils.d.ts.map +1 -0
- package/lib/types/utils/Constants.d.ts +311 -0
- package/lib/types/utils/Constants.d.ts.map +1 -0
- package/lib/types/utils/FunctionWrappers.d.ts +28 -0
- package/lib/types/utils/FunctionWrappers.d.ts.map +1 -0
- package/lib/types/utils/MsalTypes.d.ts +7 -0
- package/lib/types/utils/MsalTypes.d.ts.map +1 -0
- package/lib/types/utils/ProtocolUtils.d.ts +43 -0
- package/lib/types/utils/ProtocolUtils.d.ts.map +1 -0
- package/lib/types/utils/StringUtils.d.ts +41 -0
- package/lib/types/utils/StringUtils.d.ts.map +1 -0
- package/lib/types/utils/TimeUtils.d.ts +26 -0
- package/lib/types/utils/TimeUtils.d.ts.map +1 -0
- package/lib/types/utils/UrlUtils.d.ts +11 -0
- package/lib/types/utils/UrlUtils.d.ts.map +1 -0
- package/node/README.md +1 -0
- package/node/package.json +5 -0
- package/package.json +38 -11
- package/src/account/AccountInfo.ts +1 -1
- package/src/account/AuthToken.ts +2 -2
- package/src/account/ClientInfo.ts +2 -2
- package/src/authority/Authority.ts +26 -26
- package/src/authority/AuthorityFactory.ts +9 -9
- package/src/authority/AuthorityMetadata.ts +7 -7
- package/src/authority/AuthorityOptions.ts +4 -4
- package/src/authority/AzureRegionConfiguration.ts +1 -1
- package/src/authority/CloudInstanceDiscoveryResponse.ts +1 -1
- package/src/authority/OIDCOptions.ts +1 -1
- package/src/authority/RegionDiscovery.ts +10 -10
- package/src/authority/RegionDiscoveryMetadata.ts +1 -1
- package/src/broker/nativeBroker/INativeBrokerPlugin.ts +5 -5
- package/src/cache/CacheManager.ts +28 -36
- package/src/cache/entities/AccessTokenEntity.ts +2 -2
- package/src/cache/entities/AccountEntity.ts +10 -10
- package/src/cache/entities/CacheRecord.ts +5 -5
- package/src/cache/entities/CredentialEntity.ts +1 -1
- package/src/cache/entities/IdTokenEntity.ts +1 -1
- package/src/cache/entities/RefreshTokenEntity.ts +1 -1
- package/src/cache/interface/ICacheManager.ts +12 -12
- package/src/cache/interface/ICachePlugin.ts +1 -1
- package/src/cache/persistence/TokenCacheContext.ts +1 -1
- package/src/cache/utils/CacheHelpers.ts +13 -13
- package/src/cache/utils/CacheTypes.ts +11 -11
- package/src/client/AuthorizationCodeClient.ts +86 -52
- package/src/client/BaseClient.ts +121 -39
- package/src/client/RefreshTokenClient.ts +42 -33
- package/src/client/SilentFlowClient.ts +17 -17
- package/src/config/ClientConfiguration.ts +20 -15
- package/src/constants/AADServerParamKeys.ts +2 -0
- package/src/crypto/ICrypto.ts +3 -3
- package/src/crypto/JoseHeader.ts +2 -2
- package/src/crypto/PopTokenGenerator.ts +7 -7
- package/src/crypto/SignedHttpRequest.ts +1 -1
- package/src/error/AuthError.ts +2 -2
- package/src/error/CacheError.ts +1 -1
- package/src/error/ClientAuthError.ts +2 -2
- package/src/error/ClientConfigurationError.ts +2 -2
- package/src/error/InteractionRequiredAuthError.ts +3 -3
- package/src/error/JoseHeaderError.ts +2 -2
- package/src/error/NetworkError.ts +44 -0
- package/src/error/ServerError.ts +1 -1
- package/src/exports-browser-only.ts +29 -0
- package/src/exports-common.ts +189 -0
- package/src/exports-node-only.ts +35 -0
- package/src/index-browser.ts +11 -0
- package/src/index-node.ts +11 -0
- package/src/index.ts +7 -250
- package/src/logger/Logger.ts +2 -2
- package/src/network/INetworkModule.ts +2 -2
- package/src/network/NetworkResponse.ts +10 -0
- package/src/network/RequestThumbprint.ts +2 -2
- package/src/network/ThrottlingUtils.ts +8 -8
- package/src/packageMetadata.ts +1 -1
- package/src/request/AuthenticationHeaderParser.ts +2 -2
- package/src/request/BaseAuthRequest.ts +7 -5
- package/src/request/CommonAuthorizationCodeRequest.ts +3 -3
- package/src/request/CommonAuthorizationUrlRequest.ts +4 -4
- package/src/request/CommonClientCredentialRequest.ts +3 -3
- package/src/request/CommonDeviceCodeRequest.ts +3 -3
- package/src/request/CommonEndSessionRequest.ts +2 -2
- package/src/request/CommonOnBehalfOfRequest.ts +1 -1
- package/src/request/CommonRefreshTokenRequest.ts +3 -3
- package/src/request/CommonSilentFlowRequest.ts +3 -3
- package/src/request/CommonUsernamePasswordRequest.ts +1 -1
- package/src/request/NativeRequest.ts +1 -1
- package/src/request/RequestParameterBuilder.ts +60 -10
- package/src/request/RequestValidator.ts +2 -2
- package/src/request/ScopeSet.ts +4 -4
- package/src/response/AuthenticationResult.ts +1 -1
- package/src/response/ExternalTokenResponse.ts +1 -1
- package/src/response/ResponseHandler.ts +31 -31
- package/src/response/ServerAuthorizationTokenResponse.ts +1 -1
- package/src/telemetry/performance/IPerformanceClient.ts +2 -2
- package/src/telemetry/performance/PerformanceClient.ts +52 -22
- package/src/telemetry/performance/PerformanceEvent.ts +15 -0
- package/src/telemetry/performance/StubPerformanceClient.ts +6 -3
- package/src/telemetry/server/ServerTelemetryManager.ts +6 -6
- package/src/url/UrlString.ts +5 -5
- package/src/utils/ClientAssertionUtils.ts +1 -1
- package/src/utils/Constants.ts +1 -0
- package/src/utils/FunctionWrappers.ts +2 -2
- package/src/utils/ProtocolUtils.ts +3 -3
- package/src/utils/UrlUtils.ts +2 -2
- package/dist/index.cjs.map +0 -1
- package/dist/network/NetworkManager.d.ts +0 -34
- package/dist/network/NetworkManager.d.ts.map +0 -1
- package/dist/network/NetworkManager.mjs +0 -44
- package/dist/network/NetworkManager.mjs.map +0 -1
- package/src/network/NetworkManager.ts +0 -76
|
@@ -0,0 +1,858 @@
|
|
|
1
|
+
/*! @azure/msal-common v14.16.0 2024-11-05 */
|
|
2
|
+
'use strict';
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
var indexNode = require('./index-node-C9XsExml.js');
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
+
* Licensed under the MIT License.
|
|
10
|
+
*/
|
|
11
|
+
const missingKidError = "missing_kid_error";
|
|
12
|
+
const missingAlgError = "missing_alg_error";
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
16
|
+
* Licensed under the MIT License.
|
|
17
|
+
*/
|
|
18
|
+
const JoseHeaderErrorMessages = {
|
|
19
|
+
[missingKidError]: "The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided.",
|
|
20
|
+
[missingAlgError]: "The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided.",
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Error thrown when there is an error in the client code running on the browser.
|
|
24
|
+
*/
|
|
25
|
+
class JoseHeaderError extends indexNode.AuthError {
|
|
26
|
+
constructor(errorCode, errorMessage) {
|
|
27
|
+
super(errorCode, errorMessage);
|
|
28
|
+
this.name = "JoseHeaderError";
|
|
29
|
+
Object.setPrototypeOf(this, JoseHeaderError.prototype);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** Returns JoseHeaderError object */
|
|
33
|
+
function createJoseHeaderError(code) {
|
|
34
|
+
return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
39
|
+
* Licensed under the MIT License.
|
|
40
|
+
*/
|
|
41
|
+
/** @internal */
|
|
42
|
+
class JoseHeader {
|
|
43
|
+
constructor(options) {
|
|
44
|
+
this.typ = options.typ;
|
|
45
|
+
this.alg = options.alg;
|
|
46
|
+
this.kid = options.kid;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Builds SignedHttpRequest formatted JOSE Header from the
|
|
50
|
+
* JOSE Header options provided or previously set on the object and returns
|
|
51
|
+
* the stringified header object.
|
|
52
|
+
* Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
|
|
53
|
+
* @param shrHeaderOptions
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
static getShrHeaderString(shrHeaderOptions) {
|
|
57
|
+
// KeyID is required on the SHR header
|
|
58
|
+
if (!shrHeaderOptions.kid) {
|
|
59
|
+
throw createJoseHeaderError(missingKidError);
|
|
60
|
+
}
|
|
61
|
+
// Alg is required on the SHR header
|
|
62
|
+
if (!shrHeaderOptions.alg) {
|
|
63
|
+
throw createJoseHeaderError(missingAlgError);
|
|
64
|
+
}
|
|
65
|
+
const shrHeader = new JoseHeader({
|
|
66
|
+
// Access Token PoP headers must have type pop, but the type header can be overriden for special cases
|
|
67
|
+
typ: shrHeaderOptions.typ || indexNode.JsonWebTokenTypes.Pop,
|
|
68
|
+
kid: shrHeaderOptions.kid,
|
|
69
|
+
alg: shrHeaderOptions.alg,
|
|
70
|
+
});
|
|
71
|
+
return JSON.stringify(shrHeader);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
77
|
+
* Licensed under the MIT License.
|
|
78
|
+
*/
|
|
79
|
+
class StubPerformanceMeasurement {
|
|
80
|
+
startMeasurement() {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
endMeasurement() {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
flushMeasurement() {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
class StubPerformanceClient {
|
|
91
|
+
generateId() {
|
|
92
|
+
return "callback-id";
|
|
93
|
+
}
|
|
94
|
+
startMeasurement(measureName, correlationId) {
|
|
95
|
+
return {
|
|
96
|
+
end: () => null,
|
|
97
|
+
discard: () => { },
|
|
98
|
+
add: () => { },
|
|
99
|
+
increment: () => { },
|
|
100
|
+
event: {
|
|
101
|
+
eventId: this.generateId(),
|
|
102
|
+
status: indexNode.PerformanceEventStatus.InProgress,
|
|
103
|
+
authority: "",
|
|
104
|
+
libraryName: "",
|
|
105
|
+
libraryVersion: "",
|
|
106
|
+
clientId: "",
|
|
107
|
+
name: measureName,
|
|
108
|
+
startTimeMs: Date.now(),
|
|
109
|
+
correlationId: correlationId || "",
|
|
110
|
+
},
|
|
111
|
+
measurement: new StubPerformanceMeasurement(),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
startPerformanceMeasurement() {
|
|
115
|
+
return new StubPerformanceMeasurement();
|
|
116
|
+
}
|
|
117
|
+
calculateQueuedTime() {
|
|
118
|
+
return 0;
|
|
119
|
+
}
|
|
120
|
+
addQueueMeasurement() {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
setPreQueueTime() {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
endMeasurement() {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
discardMeasurements() {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
removePerformanceCallback() {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
addPerformanceCallback() {
|
|
136
|
+
return "";
|
|
137
|
+
}
|
|
138
|
+
emitEvents() {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
addFields() {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
incrementFields() {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
cacheEventByCorrelationId() {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/*
|
|
153
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
154
|
+
* Licensed under the MIT License.
|
|
155
|
+
*/
|
|
156
|
+
/**
|
|
157
|
+
* Starts context by adding payload to the stack
|
|
158
|
+
* @param event {PerformanceEvent}
|
|
159
|
+
* @param abbreviations {Map<string, string>} event name abbreviations
|
|
160
|
+
* @param stack {?PerformanceEventStackedContext[]} stack
|
|
161
|
+
*/
|
|
162
|
+
function startContext(event, abbreviations, stack) {
|
|
163
|
+
if (!stack) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
stack.push({
|
|
167
|
+
name: abbreviations.get(event.name) || event.name,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Ends context by removing payload from the stack and returning parent or self, if stack is empty, payload
|
|
172
|
+
*
|
|
173
|
+
* @param event {PerformanceEvent}
|
|
174
|
+
* @param abbreviations {Map<string, string>} event name abbreviations
|
|
175
|
+
* @param stack {?PerformanceEventStackedContext[]} stack
|
|
176
|
+
* @param error {?unknown} error
|
|
177
|
+
*/
|
|
178
|
+
function endContext(event, abbreviations, stack, error) {
|
|
179
|
+
if (!stack?.length) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const peek = (stack) => {
|
|
183
|
+
return stack.length ? stack[stack.length - 1] : undefined;
|
|
184
|
+
};
|
|
185
|
+
const abbrEventName = abbreviations.get(event.name) || event.name;
|
|
186
|
+
const top = peek(stack);
|
|
187
|
+
if (top?.name !== abbrEventName) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const current = stack?.pop();
|
|
191
|
+
if (!current) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const errorCode = error instanceof indexNode.AuthError
|
|
195
|
+
? error.errorCode
|
|
196
|
+
: error instanceof Error
|
|
197
|
+
? error.name
|
|
198
|
+
: undefined;
|
|
199
|
+
const subErr = error instanceof indexNode.AuthError ? error.subError : undefined;
|
|
200
|
+
if (errorCode && current.childErr !== errorCode) {
|
|
201
|
+
current.err = errorCode;
|
|
202
|
+
if (subErr) {
|
|
203
|
+
current.subErr = subErr;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
delete current.name;
|
|
207
|
+
delete current.childErr;
|
|
208
|
+
const context = {
|
|
209
|
+
...current,
|
|
210
|
+
dur: event.durationMs,
|
|
211
|
+
};
|
|
212
|
+
if (!event.success) {
|
|
213
|
+
context.fail = 1;
|
|
214
|
+
}
|
|
215
|
+
const parent = peek(stack);
|
|
216
|
+
if (!parent) {
|
|
217
|
+
return { [abbrEventName]: context };
|
|
218
|
+
}
|
|
219
|
+
if (errorCode) {
|
|
220
|
+
parent.childErr = errorCode;
|
|
221
|
+
}
|
|
222
|
+
let childName;
|
|
223
|
+
if (!parent[abbrEventName]) {
|
|
224
|
+
childName = abbrEventName;
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
const siblings = Object.keys(parent).filter((key) => key.startsWith(abbrEventName)).length;
|
|
228
|
+
childName = `${abbrEventName}_${siblings + 1}`;
|
|
229
|
+
}
|
|
230
|
+
parent[childName] = context;
|
|
231
|
+
return parent;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Adds error name and stack trace to the telemetry event
|
|
235
|
+
* @param error {Error}
|
|
236
|
+
* @param logger {Logger}
|
|
237
|
+
* @param event {PerformanceEvent}
|
|
238
|
+
* @param stackMaxSize {number} max error stack size to capture
|
|
239
|
+
*/
|
|
240
|
+
function addError(error, logger, event, stackMaxSize = 5) {
|
|
241
|
+
if (!(error instanceof Error)) {
|
|
242
|
+
logger.trace("PerformanceClient.addErrorStack: Input error is not instance of Error", event.correlationId);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
else if (error instanceof indexNode.AuthError) {
|
|
246
|
+
event.errorCode = error.errorCode;
|
|
247
|
+
event.subErrorCode = error.subError;
|
|
248
|
+
if (error instanceof indexNode.ServerError ||
|
|
249
|
+
error instanceof indexNode.InteractionRequiredAuthError) {
|
|
250
|
+
event.serverErrorNo = error.errorNo;
|
|
251
|
+
}
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
else if (error instanceof indexNode.CacheError) {
|
|
255
|
+
event.errorCode = error.errorCode;
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
else if (event.errorStack?.length) {
|
|
259
|
+
logger.trace("PerformanceClient.addErrorStack: Stack already exist", event.correlationId);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
else if (!error.stack?.length) {
|
|
263
|
+
logger.trace("PerformanceClient.addErrorStack: Input stack is empty", event.correlationId);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (error.stack) {
|
|
267
|
+
event.errorStack = compactStack(error.stack, stackMaxSize);
|
|
268
|
+
}
|
|
269
|
+
event.errorName = error.name;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Compacts error stack into array by fetching N first entries
|
|
273
|
+
* @param stack {string} error stack
|
|
274
|
+
* @param stackMaxSize {number} max error stack size to capture
|
|
275
|
+
* @returns {string[]}
|
|
276
|
+
*/
|
|
277
|
+
function compactStack(stack, stackMaxSize) {
|
|
278
|
+
if (stackMaxSize < 0) {
|
|
279
|
+
return [];
|
|
280
|
+
}
|
|
281
|
+
const stackArr = stack.split("\n") || [];
|
|
282
|
+
const res = [];
|
|
283
|
+
// Check for a handful of known, common runtime errors and log them (with redaction where applicable).
|
|
284
|
+
const firstLine = stackArr[0];
|
|
285
|
+
if (firstLine.startsWith("TypeError: Cannot read property") ||
|
|
286
|
+
firstLine.startsWith("TypeError: Cannot read properties of") ||
|
|
287
|
+
firstLine.startsWith("TypeError: Cannot set property") ||
|
|
288
|
+
firstLine.startsWith("TypeError: Cannot set properties of") ||
|
|
289
|
+
firstLine.endsWith("is not a function")) {
|
|
290
|
+
// These types of errors are not at risk of leaking PII. They will indicate unavailable APIs
|
|
291
|
+
res.push(compactStackLine(firstLine));
|
|
292
|
+
}
|
|
293
|
+
else if (firstLine.startsWith("SyntaxError") ||
|
|
294
|
+
firstLine.startsWith("TypeError")) {
|
|
295
|
+
// Prevent unintentional leaking of arbitrary info by redacting contents between both single and double quotes
|
|
296
|
+
res.push(compactStackLine(
|
|
297
|
+
// Example: SyntaxError: Unexpected token 'e', "test" is not valid JSON -> SyntaxError: Unexpected token <redacted>, <redacted> is not valid JSON
|
|
298
|
+
firstLine.replace(/['].*[']|["].*["]/g, "<redacted>")));
|
|
299
|
+
}
|
|
300
|
+
// Get top N stack lines
|
|
301
|
+
for (let ix = 1; ix < stackArr.length; ix++) {
|
|
302
|
+
if (res.length >= stackMaxSize) {
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
const line = stackArr[ix];
|
|
306
|
+
res.push(compactStackLine(line));
|
|
307
|
+
}
|
|
308
|
+
return res;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Compacts error stack line by shortening file path
|
|
312
|
+
* Example: https://localhost/msal-common/src/authority/Authority.js:100:1 -> Authority.js:100:1
|
|
313
|
+
* @param line {string} stack line
|
|
314
|
+
* @returns {string}
|
|
315
|
+
*/
|
|
316
|
+
function compactStackLine(line) {
|
|
317
|
+
const filePathIx = line.lastIndexOf(" ") + 1;
|
|
318
|
+
if (filePathIx < 1) {
|
|
319
|
+
return line;
|
|
320
|
+
}
|
|
321
|
+
const filePath = line.substring(filePathIx);
|
|
322
|
+
let fileNameIx = filePath.lastIndexOf("/");
|
|
323
|
+
fileNameIx = fileNameIx < 0 ? filePath.lastIndexOf("\\") : fileNameIx;
|
|
324
|
+
if (fileNameIx >= 0) {
|
|
325
|
+
return (line.substring(0, filePathIx) +
|
|
326
|
+
"(" +
|
|
327
|
+
filePath.substring(fileNameIx + 1) +
|
|
328
|
+
(filePath.charAt(filePath.length - 1) === ")" ? "" : ")")).trimStart();
|
|
329
|
+
}
|
|
330
|
+
return line.trimStart();
|
|
331
|
+
}
|
|
332
|
+
class PerformanceClient {
|
|
333
|
+
/**
|
|
334
|
+
* Creates an instance of PerformanceClient,
|
|
335
|
+
* an abstract class containing core performance telemetry logic.
|
|
336
|
+
*
|
|
337
|
+
* @constructor
|
|
338
|
+
* @param {string} clientId Client ID of the application
|
|
339
|
+
* @param {string} authority Authority used by the application
|
|
340
|
+
* @param {Logger} logger Logger used by the application
|
|
341
|
+
* @param {string} libraryName Name of the library
|
|
342
|
+
* @param {string} libraryVersion Version of the library
|
|
343
|
+
* @param {ApplicationTelemetry} applicationTelemetry application name and version
|
|
344
|
+
* @param {Set<String>} intFields integer fields to be truncated
|
|
345
|
+
* @param {Map<string, string>} abbreviations event name abbreviations
|
|
346
|
+
*/
|
|
347
|
+
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, intFields, abbreviations) {
|
|
348
|
+
this.authority = authority;
|
|
349
|
+
this.libraryName = libraryName;
|
|
350
|
+
this.libraryVersion = libraryVersion;
|
|
351
|
+
this.applicationTelemetry = applicationTelemetry;
|
|
352
|
+
this.clientId = clientId;
|
|
353
|
+
this.logger = logger;
|
|
354
|
+
this.callbacks = new Map();
|
|
355
|
+
this.eventsByCorrelationId = new Map();
|
|
356
|
+
this.eventStack = new Map();
|
|
357
|
+
this.queueMeasurements = new Map();
|
|
358
|
+
this.preQueueTimeByCorrelationId = new Map();
|
|
359
|
+
this.intFields = intFields || new Set();
|
|
360
|
+
for (const item of indexNode.IntFields) {
|
|
361
|
+
this.intFields.add(item);
|
|
362
|
+
}
|
|
363
|
+
this.abbreviations = abbreviations || new Map();
|
|
364
|
+
for (const [key, value] of indexNode.PerformanceEventAbbreviations) {
|
|
365
|
+
this.abbreviations.set(key, value);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Starts and returns an platform-specific implementation of IPerformanceMeasurement.
|
|
370
|
+
* Note: this function can be changed to abstract at the next major version bump.
|
|
371
|
+
*
|
|
372
|
+
* @param {string} measureName
|
|
373
|
+
* @param {string} correlationId
|
|
374
|
+
* @returns {IPerformanceMeasurement}
|
|
375
|
+
* @deprecated This method will be removed in the next major version
|
|
376
|
+
*/
|
|
377
|
+
startPerformanceMeasurement(measureName, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
378
|
+
correlationId // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
379
|
+
) {
|
|
380
|
+
return {};
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Gets map of pre-queue times by correlation Id
|
|
384
|
+
*
|
|
385
|
+
* @param {PerformanceEvents} eventName
|
|
386
|
+
* @param {string} correlationId
|
|
387
|
+
* @returns {number}
|
|
388
|
+
*/
|
|
389
|
+
getPreQueueTime(eventName, correlationId) {
|
|
390
|
+
const preQueueEvent = this.preQueueTimeByCorrelationId.get(correlationId);
|
|
391
|
+
if (!preQueueEvent) {
|
|
392
|
+
this.logger.trace(`PerformanceClient.getPreQueueTime: no pre-queue times found for correlationId: ${correlationId}, unable to add queue measurement`);
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
else if (preQueueEvent.name !== eventName) {
|
|
396
|
+
this.logger.trace(`PerformanceClient.getPreQueueTime: no pre-queue time found for ${eventName}, unable to add queue measurement`);
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
return preQueueEvent.time;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Calculates the difference between current time and time when function was queued.
|
|
403
|
+
* Note: It is possible to have 0 as the queue time if the current time and the queued time was the same.
|
|
404
|
+
*
|
|
405
|
+
* @param {number} preQueueTime
|
|
406
|
+
* @param {number} currentTime
|
|
407
|
+
* @returns {number}
|
|
408
|
+
*/
|
|
409
|
+
calculateQueuedTime(preQueueTime, currentTime) {
|
|
410
|
+
if (preQueueTime < 1) {
|
|
411
|
+
this.logger.trace(`PerformanceClient: preQueueTime should be a positive integer and not ${preQueueTime}`);
|
|
412
|
+
return 0;
|
|
413
|
+
}
|
|
414
|
+
if (currentTime < 1) {
|
|
415
|
+
this.logger.trace(`PerformanceClient: currentTime should be a positive integer and not ${currentTime}`);
|
|
416
|
+
return 0;
|
|
417
|
+
}
|
|
418
|
+
if (currentTime < preQueueTime) {
|
|
419
|
+
this.logger.trace("PerformanceClient: currentTime is less than preQueueTime, check how time is being retrieved");
|
|
420
|
+
return 0;
|
|
421
|
+
}
|
|
422
|
+
return currentTime - preQueueTime;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Adds queue measurement time to QueueMeasurements array for given correlation ID.
|
|
426
|
+
*
|
|
427
|
+
* @param {PerformanceEvents} eventName
|
|
428
|
+
* @param {?string} correlationId
|
|
429
|
+
* @param {?number} queueTime
|
|
430
|
+
* @param {?boolean} manuallyCompleted - indicator for manually completed queue measurements
|
|
431
|
+
* @returns
|
|
432
|
+
*/
|
|
433
|
+
addQueueMeasurement(eventName, correlationId, queueTime, manuallyCompleted) {
|
|
434
|
+
if (!correlationId) {
|
|
435
|
+
this.logger.trace(`PerformanceClient.addQueueMeasurement: correlationId not provided for ${eventName}, cannot add queue measurement`);
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
if (queueTime === 0) {
|
|
439
|
+
// Possible for there to be no queue time after calculation
|
|
440
|
+
this.logger.trace(`PerformanceClient.addQueueMeasurement: queue time provided for ${eventName} is ${queueTime}`);
|
|
441
|
+
}
|
|
442
|
+
else if (!queueTime) {
|
|
443
|
+
this.logger.trace(`PerformanceClient.addQueueMeasurement: no queue time provided for ${eventName}`);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
const queueMeasurement = {
|
|
447
|
+
eventName,
|
|
448
|
+
// Always default queue time to 0 for manually completed (improperly instrumented)
|
|
449
|
+
queueTime: manuallyCompleted ? 0 : queueTime,
|
|
450
|
+
manuallyCompleted,
|
|
451
|
+
};
|
|
452
|
+
// Adds to existing correlation Id if present in queueMeasurements
|
|
453
|
+
const existingMeasurements = this.queueMeasurements.get(correlationId);
|
|
454
|
+
if (existingMeasurements) {
|
|
455
|
+
existingMeasurements.push(queueMeasurement);
|
|
456
|
+
this.queueMeasurements.set(correlationId, existingMeasurements);
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
// Sets new correlation Id if not present in queueMeasurements
|
|
460
|
+
this.logger.trace(`PerformanceClient.addQueueMeasurement: adding correlationId ${correlationId} to queue measurements`);
|
|
461
|
+
const measurementArray = [queueMeasurement];
|
|
462
|
+
this.queueMeasurements.set(correlationId, measurementArray);
|
|
463
|
+
}
|
|
464
|
+
// Delete processed pre-queue event.
|
|
465
|
+
this.preQueueTimeByCorrelationId.delete(correlationId);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
|
|
469
|
+
*
|
|
470
|
+
* @param {PerformanceEvents} measureName
|
|
471
|
+
* @param {?string} [correlationId]
|
|
472
|
+
* @returns {InProgressPerformanceEvent}
|
|
473
|
+
*/
|
|
474
|
+
startMeasurement(measureName, correlationId) {
|
|
475
|
+
// Generate a placeholder correlation if the request does not provide one
|
|
476
|
+
const eventCorrelationId = correlationId || this.generateId();
|
|
477
|
+
if (!correlationId) {
|
|
478
|
+
this.logger.info(`PerformanceClient: No correlation id provided for ${measureName}, generating`, eventCorrelationId);
|
|
479
|
+
}
|
|
480
|
+
this.logger.trace(`PerformanceClient: Performance measurement started for ${measureName}`, eventCorrelationId);
|
|
481
|
+
const inProgressEvent = {
|
|
482
|
+
eventId: this.generateId(),
|
|
483
|
+
status: indexNode.PerformanceEventStatus.InProgress,
|
|
484
|
+
authority: this.authority,
|
|
485
|
+
libraryName: this.libraryName,
|
|
486
|
+
libraryVersion: this.libraryVersion,
|
|
487
|
+
clientId: this.clientId,
|
|
488
|
+
name: measureName,
|
|
489
|
+
startTimeMs: Date.now(),
|
|
490
|
+
correlationId: eventCorrelationId,
|
|
491
|
+
appName: this.applicationTelemetry?.appName,
|
|
492
|
+
appVersion: this.applicationTelemetry?.appVersion,
|
|
493
|
+
};
|
|
494
|
+
// Store in progress events so they can be discarded if not ended properly
|
|
495
|
+
this.cacheEventByCorrelationId(inProgressEvent);
|
|
496
|
+
startContext(inProgressEvent, this.abbreviations, this.eventStack.get(eventCorrelationId));
|
|
497
|
+
// Return the event and functions the caller can use to properly end/flush the measurement
|
|
498
|
+
return {
|
|
499
|
+
end: (event, error) => {
|
|
500
|
+
return this.endMeasurement({
|
|
501
|
+
// Initial set of event properties
|
|
502
|
+
...inProgressEvent,
|
|
503
|
+
// Properties set when event ends
|
|
504
|
+
...event,
|
|
505
|
+
}, error);
|
|
506
|
+
},
|
|
507
|
+
discard: () => {
|
|
508
|
+
return this.discardMeasurements(inProgressEvent.correlationId);
|
|
509
|
+
},
|
|
510
|
+
add: (fields) => {
|
|
511
|
+
return this.addFields(fields, inProgressEvent.correlationId);
|
|
512
|
+
},
|
|
513
|
+
increment: (fields) => {
|
|
514
|
+
return this.incrementFields(fields, inProgressEvent.correlationId);
|
|
515
|
+
},
|
|
516
|
+
event: inProgressEvent,
|
|
517
|
+
measurement: new StubPerformanceMeasurement(),
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Stops measuring the performance for an operation. Should only be called directly by PerformanceClient classes,
|
|
522
|
+
* as consumers should instead use the function returned by startMeasurement.
|
|
523
|
+
* Adds a new field named as "[event name]DurationMs" for sub-measurements, completes and emits an event
|
|
524
|
+
* otherwise.
|
|
525
|
+
*
|
|
526
|
+
* @param {PerformanceEvent} event
|
|
527
|
+
* @param {unknown} error
|
|
528
|
+
* @returns {(PerformanceEvent | null)}
|
|
529
|
+
*/
|
|
530
|
+
endMeasurement(event, error) {
|
|
531
|
+
const rootEvent = this.eventsByCorrelationId.get(event.correlationId);
|
|
532
|
+
if (!rootEvent) {
|
|
533
|
+
this.logger.trace(`PerformanceClient: Measurement not found for ${event.eventId}`, event.correlationId);
|
|
534
|
+
return null;
|
|
535
|
+
}
|
|
536
|
+
const isRoot = event.eventId === rootEvent.eventId;
|
|
537
|
+
let queueInfo = {
|
|
538
|
+
totalQueueTime: 0,
|
|
539
|
+
totalQueueCount: 0,
|
|
540
|
+
manuallyCompletedCount: 0,
|
|
541
|
+
};
|
|
542
|
+
event.durationMs = Math.round(event.durationMs || this.getDurationMs(event.startTimeMs));
|
|
543
|
+
const context = JSON.stringify(endContext(event, this.abbreviations, this.eventStack.get(rootEvent.correlationId), error));
|
|
544
|
+
if (isRoot) {
|
|
545
|
+
queueInfo = this.getQueueInfo(event.correlationId);
|
|
546
|
+
this.discardMeasurements(rootEvent.correlationId);
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
rootEvent.incompleteSubMeasurements?.delete(event.eventId);
|
|
550
|
+
}
|
|
551
|
+
this.logger.trace(`PerformanceClient: Performance measurement ended for ${event.name}: ${event.durationMs} ms`, event.correlationId);
|
|
552
|
+
if (error) {
|
|
553
|
+
addError(error, this.logger, rootEvent);
|
|
554
|
+
}
|
|
555
|
+
// Add sub-measurement attribute to root event.
|
|
556
|
+
if (!isRoot) {
|
|
557
|
+
rootEvent[event.name + "DurationMs"] = Math.floor(event.durationMs);
|
|
558
|
+
return { ...rootEvent };
|
|
559
|
+
}
|
|
560
|
+
if (isRoot &&
|
|
561
|
+
!error &&
|
|
562
|
+
(rootEvent.errorCode || rootEvent.subErrorCode)) {
|
|
563
|
+
this.logger.trace(`PerformanceClient: Remove error and sub-error codes for root event ${event.name} as intermediate error was successfully handled`, event.correlationId);
|
|
564
|
+
rootEvent.errorCode = undefined;
|
|
565
|
+
rootEvent.subErrorCode = undefined;
|
|
566
|
+
}
|
|
567
|
+
let finalEvent = { ...rootEvent, ...event };
|
|
568
|
+
let incompleteSubsCount = 0;
|
|
569
|
+
// Incomplete sub-measurements are discarded. They are likely an instrumentation bug that should be fixed.
|
|
570
|
+
finalEvent.incompleteSubMeasurements?.forEach((subMeasurement) => {
|
|
571
|
+
this.logger.trace(`PerformanceClient: Incomplete submeasurement ${subMeasurement.name} found for ${event.name}`, finalEvent.correlationId);
|
|
572
|
+
incompleteSubsCount++;
|
|
573
|
+
});
|
|
574
|
+
finalEvent.incompleteSubMeasurements = undefined;
|
|
575
|
+
finalEvent = {
|
|
576
|
+
...finalEvent,
|
|
577
|
+
queuedTimeMs: queueInfo.totalQueueTime,
|
|
578
|
+
queuedCount: queueInfo.totalQueueCount,
|
|
579
|
+
queuedManuallyCompletedCount: queueInfo.manuallyCompletedCount,
|
|
580
|
+
status: indexNode.PerformanceEventStatus.Completed,
|
|
581
|
+
incompleteSubsCount,
|
|
582
|
+
context,
|
|
583
|
+
};
|
|
584
|
+
this.truncateIntegralFields(finalEvent);
|
|
585
|
+
this.emitEvents([finalEvent], event.correlationId);
|
|
586
|
+
return finalEvent;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Saves extra information to be emitted when the measurements are flushed
|
|
590
|
+
* @param fields
|
|
591
|
+
* @param correlationId
|
|
592
|
+
*/
|
|
593
|
+
addFields(fields, correlationId) {
|
|
594
|
+
this.logger.trace("PerformanceClient: Updating static fields");
|
|
595
|
+
const event = this.eventsByCorrelationId.get(correlationId);
|
|
596
|
+
if (event) {
|
|
597
|
+
this.eventsByCorrelationId.set(correlationId, {
|
|
598
|
+
...event,
|
|
599
|
+
...fields,
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
this.logger.trace("PerformanceClient: Event not found for", correlationId);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Increment counters to be emitted when the measurements are flushed
|
|
608
|
+
* @param fields {string[]}
|
|
609
|
+
* @param correlationId {string} correlation identifier
|
|
610
|
+
*/
|
|
611
|
+
incrementFields(fields, correlationId) {
|
|
612
|
+
this.logger.trace("PerformanceClient: Updating counters");
|
|
613
|
+
const event = this.eventsByCorrelationId.get(correlationId);
|
|
614
|
+
if (event) {
|
|
615
|
+
for (const counter in fields) {
|
|
616
|
+
if (!event.hasOwnProperty(counter)) {
|
|
617
|
+
event[counter] = 0;
|
|
618
|
+
}
|
|
619
|
+
else if (isNaN(Number(event[counter]))) {
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
event[counter] += fields[counter];
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
else {
|
|
626
|
+
this.logger.trace("PerformanceClient: Event not found for", correlationId);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Upserts event into event cache.
|
|
631
|
+
* First key is the correlation id, second key is the event id.
|
|
632
|
+
* Allows for events to be grouped by correlation id,
|
|
633
|
+
* and to easily allow for properties on them to be updated.
|
|
634
|
+
*
|
|
635
|
+
* @private
|
|
636
|
+
* @param {PerformanceEvent} event
|
|
637
|
+
*/
|
|
638
|
+
cacheEventByCorrelationId(event) {
|
|
639
|
+
const rootEvent = this.eventsByCorrelationId.get(event.correlationId);
|
|
640
|
+
if (rootEvent) {
|
|
641
|
+
this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} added/updated`, event.correlationId);
|
|
642
|
+
rootEvent.incompleteSubMeasurements =
|
|
643
|
+
rootEvent.incompleteSubMeasurements || new Map();
|
|
644
|
+
rootEvent.incompleteSubMeasurements.set(event.eventId, {
|
|
645
|
+
name: event.name,
|
|
646
|
+
startTimeMs: event.startTimeMs,
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} started`, event.correlationId);
|
|
651
|
+
this.eventsByCorrelationId.set(event.correlationId, { ...event });
|
|
652
|
+
this.eventStack.set(event.correlationId, []);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
getQueueInfo(correlationId) {
|
|
656
|
+
const queueMeasurementForCorrelationId = this.queueMeasurements.get(correlationId);
|
|
657
|
+
if (!queueMeasurementForCorrelationId) {
|
|
658
|
+
this.logger.trace(`PerformanceClient: no queue measurements found for for correlationId: ${correlationId}`);
|
|
659
|
+
}
|
|
660
|
+
let totalQueueTime = 0;
|
|
661
|
+
let totalQueueCount = 0;
|
|
662
|
+
let manuallyCompletedCount = 0;
|
|
663
|
+
queueMeasurementForCorrelationId?.forEach((measurement) => {
|
|
664
|
+
totalQueueTime += measurement.queueTime;
|
|
665
|
+
totalQueueCount++;
|
|
666
|
+
manuallyCompletedCount += measurement.manuallyCompleted ? 1 : 0;
|
|
667
|
+
});
|
|
668
|
+
return {
|
|
669
|
+
totalQueueTime,
|
|
670
|
+
totalQueueCount,
|
|
671
|
+
manuallyCompletedCount,
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Removes measurements and aux data for a given correlation id.
|
|
676
|
+
*
|
|
677
|
+
* @param {string} correlationId
|
|
678
|
+
*/
|
|
679
|
+
discardMeasurements(correlationId) {
|
|
680
|
+
this.logger.trace("PerformanceClient: Performance measurements discarded", correlationId);
|
|
681
|
+
this.eventsByCorrelationId.delete(correlationId);
|
|
682
|
+
this.logger.trace("PerformanceClient: QueueMeasurements discarded", correlationId);
|
|
683
|
+
this.queueMeasurements.delete(correlationId);
|
|
684
|
+
this.logger.trace("PerformanceClient: Pre-queue times discarded", correlationId);
|
|
685
|
+
this.preQueueTimeByCorrelationId.delete(correlationId);
|
|
686
|
+
this.logger.trace("PerformanceClient: Event stack discarded", correlationId);
|
|
687
|
+
this.eventStack.delete(correlationId);
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Registers a callback function to receive performance events.
|
|
691
|
+
*
|
|
692
|
+
* @param {PerformanceCallbackFunction} callback
|
|
693
|
+
* @returns {string}
|
|
694
|
+
*/
|
|
695
|
+
addPerformanceCallback(callback) {
|
|
696
|
+
for (const [id, cb] of this.callbacks) {
|
|
697
|
+
if (cb.toString() === callback.toString()) {
|
|
698
|
+
this.logger.warning(`PerformanceClient: Performance callback is already registered with id: ${id}`);
|
|
699
|
+
return id;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
const callbackId = this.generateId();
|
|
703
|
+
this.callbacks.set(callbackId, callback);
|
|
704
|
+
this.logger.verbose(`PerformanceClient: Performance callback registered with id: ${callbackId}`);
|
|
705
|
+
return callbackId;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Removes a callback registered with addPerformanceCallback.
|
|
709
|
+
*
|
|
710
|
+
* @param {string} callbackId
|
|
711
|
+
* @returns {boolean}
|
|
712
|
+
*/
|
|
713
|
+
removePerformanceCallback(callbackId) {
|
|
714
|
+
const result = this.callbacks.delete(callbackId);
|
|
715
|
+
if (result) {
|
|
716
|
+
this.logger.verbose(`PerformanceClient: Performance callback ${callbackId} removed.`);
|
|
717
|
+
}
|
|
718
|
+
else {
|
|
719
|
+
this.logger.verbose(`PerformanceClient: Performance callback ${callbackId} not removed.`);
|
|
720
|
+
}
|
|
721
|
+
return result;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Emits events to all registered callbacks.
|
|
725
|
+
*
|
|
726
|
+
* @param {PerformanceEvent[]} events
|
|
727
|
+
* @param {?string} [correlationId]
|
|
728
|
+
*/
|
|
729
|
+
emitEvents(events, correlationId) {
|
|
730
|
+
this.logger.verbose("PerformanceClient: Emitting performance events", correlationId);
|
|
731
|
+
this.callbacks.forEach((callback, callbackId) => {
|
|
732
|
+
this.logger.trace(`PerformanceClient: Emitting event to callback ${callbackId}`, correlationId);
|
|
733
|
+
callback.apply(null, [events]);
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Enforce truncation of integral fields in performance event.
|
|
738
|
+
* @param {PerformanceEvent} event performance event to update.
|
|
739
|
+
*/
|
|
740
|
+
truncateIntegralFields(event) {
|
|
741
|
+
this.intFields.forEach((key) => {
|
|
742
|
+
if (key in event && typeof event[key] === "number") {
|
|
743
|
+
event[key] = Math.floor(event[key]);
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Returns event duration in milliseconds
|
|
749
|
+
* @param startTimeMs {number}
|
|
750
|
+
* @returns {number}
|
|
751
|
+
*/
|
|
752
|
+
getDurationMs(startTimeMs) {
|
|
753
|
+
const durationMs = Date.now() - startTimeMs;
|
|
754
|
+
// Handle clock skew
|
|
755
|
+
return durationMs < 0 ? durationMs : 0;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
exports.AADAuthorityConstants = indexNode.AADAuthorityConstants;
|
|
760
|
+
exports.AADServerParamKeys = indexNode.AADServerParamKeys;
|
|
761
|
+
exports.AccountEntity = indexNode.AccountEntity;
|
|
762
|
+
exports.AuthError = indexNode.AuthError;
|
|
763
|
+
exports.AuthErrorCodes = indexNode.AuthErrorCodes;
|
|
764
|
+
exports.AuthErrorMessage = indexNode.AuthErrorMessage;
|
|
765
|
+
exports.AuthToken = indexNode.AuthToken;
|
|
766
|
+
exports.AuthenticationHeaderParser = indexNode.AuthenticationHeaderParser;
|
|
767
|
+
exports.AuthenticationScheme = indexNode.AuthenticationScheme;
|
|
768
|
+
exports.Authority = indexNode.Authority;
|
|
769
|
+
exports.AuthorityFactory = indexNode.AuthorityFactory;
|
|
770
|
+
exports.AuthorityType = indexNode.AuthorityType;
|
|
771
|
+
exports.AuthorizationCodeClient = indexNode.AuthorizationCodeClient;
|
|
772
|
+
exports.AzureCloudInstance = indexNode.AzureCloudInstance;
|
|
773
|
+
exports.BaseClient = indexNode.BaseClient;
|
|
774
|
+
exports.CacheAccountType = indexNode.CacheAccountType;
|
|
775
|
+
exports.CacheError = indexNode.CacheError;
|
|
776
|
+
exports.CacheErrorCodes = indexNode.CacheErrorCodes;
|
|
777
|
+
exports.CacheHelpers = indexNode.CacheHelpers;
|
|
778
|
+
exports.CacheManager = indexNode.CacheManager;
|
|
779
|
+
exports.CacheOutcome = indexNode.CacheOutcome;
|
|
780
|
+
exports.CacheType = indexNode.CacheType;
|
|
781
|
+
exports.CcsCredentialType = indexNode.CcsCredentialType;
|
|
782
|
+
exports.ClaimsRequestKeys = indexNode.ClaimsRequestKeys;
|
|
783
|
+
exports.ClientAuthError = indexNode.ClientAuthError;
|
|
784
|
+
exports.ClientAuthErrorCodes = indexNode.ClientAuthErrorCodes;
|
|
785
|
+
exports.ClientAuthErrorMessage = indexNode.ClientAuthErrorMessage;
|
|
786
|
+
exports.ClientConfigurationError = indexNode.ClientConfigurationError;
|
|
787
|
+
exports.ClientConfigurationErrorCodes = indexNode.ClientConfigurationErrorCodes;
|
|
788
|
+
exports.ClientConfigurationErrorMessage = indexNode.ClientConfigurationErrorMessage;
|
|
789
|
+
exports.CodeChallengeMethodValues = indexNode.CodeChallengeMethodValues;
|
|
790
|
+
exports.Constants = indexNode.Constants;
|
|
791
|
+
exports.CredentialType = indexNode.CredentialType;
|
|
792
|
+
exports.DEFAULT_CRYPTO_IMPLEMENTATION = indexNode.DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
793
|
+
exports.DEFAULT_SYSTEM_OPTIONS = indexNode.DEFAULT_SYSTEM_OPTIONS;
|
|
794
|
+
exports.DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = indexNode.DEFAULT_TOKEN_RENEWAL_OFFSET_SEC;
|
|
795
|
+
exports.DefaultStorageClass = indexNode.DefaultStorageClass;
|
|
796
|
+
exports.Errors = indexNode.Errors;
|
|
797
|
+
exports.GrantType = indexNode.GrantType;
|
|
798
|
+
exports.HeaderNames = indexNode.HeaderNames;
|
|
799
|
+
exports.HttpStatus = indexNode.HttpStatus;
|
|
800
|
+
exports.IntFields = indexNode.IntFields;
|
|
801
|
+
exports.InteractionRequiredAuthError = indexNode.InteractionRequiredAuthError;
|
|
802
|
+
exports.InteractionRequiredAuthErrorCodes = indexNode.InteractionRequiredAuthErrorCodes;
|
|
803
|
+
exports.InteractionRequiredAuthErrorMessage = indexNode.InteractionRequiredAuthErrorMessage;
|
|
804
|
+
exports.JsonWebTokenTypes = indexNode.JsonWebTokenTypes;
|
|
805
|
+
Object.defineProperty(exports, "LogLevel", {
|
|
806
|
+
enumerable: true,
|
|
807
|
+
get: function () { return indexNode.LogLevel; }
|
|
808
|
+
});
|
|
809
|
+
exports.Logger = indexNode.Logger;
|
|
810
|
+
exports.NetworkError = indexNode.NetworkError;
|
|
811
|
+
exports.OIDC_DEFAULT_SCOPES = indexNode.OIDC_DEFAULT_SCOPES;
|
|
812
|
+
exports.ONE_DAY_IN_MS = indexNode.ONE_DAY_IN_MS;
|
|
813
|
+
exports.PasswordGrantConstants = indexNode.PasswordGrantConstants;
|
|
814
|
+
exports.PerformanceEventStatus = indexNode.PerformanceEventStatus;
|
|
815
|
+
exports.PerformanceEvents = indexNode.PerformanceEvents;
|
|
816
|
+
exports.PersistentCacheKeys = indexNode.PersistentCacheKeys;
|
|
817
|
+
exports.PopTokenGenerator = indexNode.PopTokenGenerator;
|
|
818
|
+
exports.PromptValue = indexNode.PromptValue;
|
|
819
|
+
exports.ProtocolMode = indexNode.ProtocolMode;
|
|
820
|
+
exports.ProtocolUtils = indexNode.ProtocolUtils;
|
|
821
|
+
exports.RefreshTokenClient = indexNode.RefreshTokenClient;
|
|
822
|
+
exports.RequestParameterBuilder = indexNode.RequestParameterBuilder;
|
|
823
|
+
exports.ResponseHandler = indexNode.ResponseHandler;
|
|
824
|
+
exports.ResponseMode = indexNode.ResponseMode;
|
|
825
|
+
exports.ScopeSet = indexNode.ScopeSet;
|
|
826
|
+
exports.ServerError = indexNode.ServerError;
|
|
827
|
+
exports.ServerResponseType = indexNode.ServerResponseType;
|
|
828
|
+
exports.ServerTelemetryManager = indexNode.ServerTelemetryManager;
|
|
829
|
+
exports.SilentFlowClient = indexNode.SilentFlowClient;
|
|
830
|
+
exports.StringUtils = indexNode.StringUtils;
|
|
831
|
+
exports.StubbedNetworkModule = indexNode.StubbedNetworkModule;
|
|
832
|
+
exports.THE_FAMILY_ID = indexNode.THE_FAMILY_ID;
|
|
833
|
+
exports.ThrottlingConstants = indexNode.ThrottlingConstants;
|
|
834
|
+
exports.ThrottlingUtils = indexNode.ThrottlingUtils;
|
|
835
|
+
exports.TimeUtils = indexNode.TimeUtils;
|
|
836
|
+
exports.UrlString = indexNode.UrlString;
|
|
837
|
+
exports.UrlUtils = indexNode.UrlUtils;
|
|
838
|
+
exports.buildAccountToCache = indexNode.buildAccountToCache;
|
|
839
|
+
exports.buildClientInfo = indexNode.buildClientInfo;
|
|
840
|
+
exports.buildClientInfoFromHomeAccountId = indexNode.buildClientInfoFromHomeAccountId;
|
|
841
|
+
exports.buildStaticAuthorityOptions = indexNode.buildStaticAuthorityOptions;
|
|
842
|
+
exports.buildTenantProfile = indexNode.buildTenantProfile;
|
|
843
|
+
exports.createAuthError = indexNode.createAuthError;
|
|
844
|
+
exports.createClientAuthError = indexNode.createClientAuthError;
|
|
845
|
+
exports.createClientConfigurationError = indexNode.createClientConfigurationError;
|
|
846
|
+
exports.createInteractionRequiredAuthError = indexNode.createInteractionRequiredAuthError;
|
|
847
|
+
exports.createNetworkError = indexNode.createNetworkError;
|
|
848
|
+
exports.formatAuthorityUri = indexNode.formatAuthorityUri;
|
|
849
|
+
exports.getTenantIdFromIdTokenClaims = indexNode.getTenantIdFromIdTokenClaims;
|
|
850
|
+
exports.invoke = indexNode.invoke;
|
|
851
|
+
exports.invokeAsync = indexNode.invokeAsync;
|
|
852
|
+
exports.tenantIdMatchesHomeTenant = indexNode.tenantIdMatchesHomeTenant;
|
|
853
|
+
exports.updateAccountTenantProfileData = indexNode.updateAccountTenantProfileData;
|
|
854
|
+
exports.version = indexNode.version;
|
|
855
|
+
exports.JoseHeader = JoseHeader;
|
|
856
|
+
exports.PerformanceClient = PerformanceClient;
|
|
857
|
+
exports.StubPerformanceClient = StubPerformanceClient;
|
|
858
|
+
//# sourceMappingURL=index-browser.cjs.map
|