daftari 3.13.1 → 3.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/distill/propose.d.ts.map +1 -1
- package/dist/distill/propose.js +10 -3
- package/dist/distill/propose.js.map +1 -1
- package/dist/extract/index.d.ts +16 -0
- package/dist/extract/index.d.ts.map +1 -0
- package/dist/extract/index.js +95 -0
- package/dist/extract/index.js.map +1 -0
- package/dist/extract/normalize.d.ts +7 -0
- package/dist/extract/normalize.d.ts.map +1 -0
- package/dist/extract/normalize.js +52 -0
- package/dist/extract/normalize.js.map +1 -0
- package/dist/extract/office.d.ts +63 -0
- package/dist/extract/office.d.ts.map +1 -0
- package/dist/extract/office.js +763 -0
- package/dist/extract/office.js.map +1 -0
- package/dist/extract/pdf.d.ts +16 -0
- package/dist/extract/pdf.d.ts.map +1 -0
- package/dist/extract/pdf.js +196 -0
- package/dist/extract/pdf.js.map +1 -0
- package/dist/extract/types.d.ts +55 -0
- package/dist/extract/types.d.ts.map +1 -0
- package/dist/extract/types.js +47 -0
- package/dist/extract/types.js.map +1 -0
- package/dist/extract/worker.d.ts +2 -0
- package/dist/extract/worker.d.ts.map +1 -0
- package/dist/extract/worker.js +57 -0
- package/dist/extract/worker.js.map +1 -0
- package/dist/integrations/engine.d.ts +174 -3
- package/dist/integrations/engine.d.ts.map +1 -1
- package/dist/integrations/engine.js +184 -16
- package/dist/integrations/engine.js.map +1 -1
- package/dist/integrations/google.d.ts +2 -1
- package/dist/integrations/google.d.ts.map +1 -1
- package/dist/integrations/google.js +12 -117
- package/dist/integrations/google.js.map +1 -1
- package/dist/integrations/http-json.d.ts +27 -0
- package/dist/integrations/http-json.d.ts.map +1 -0
- package/dist/integrations/http-json.js +148 -0
- package/dist/integrations/http-json.js.map +1 -0
- package/dist/integrations/microsoft.d.ts +22 -0
- package/dist/integrations/microsoft.d.ts.map +1 -0
- package/dist/integrations/microsoft.js +1780 -0
- package/dist/integrations/microsoft.js.map +1 -0
- package/dist/integrations/microsoft.ui.d.ts +18 -0
- package/dist/integrations/microsoft.ui.d.ts.map +1 -0
- package/dist/integrations/microsoft.ui.js +131 -0
- package/dist/integrations/microsoft.ui.js.map +1 -0
- package/dist/integrations/oauth.d.ts.map +1 -1
- package/dist/integrations/oauth.js +10 -2
- package/dist/integrations/oauth.js.map +1 -1
- package/dist/integrations/queue.d.ts +1 -1
- package/dist/integrations/queue.d.ts.map +1 -1
- package/dist/integrations/queue.js +23 -1
- package/dist/integrations/queue.js.map +1 -1
- package/dist/integrations/routes.d.ts +26 -0
- package/dist/integrations/routes.d.ts.map +1 -1
- package/dist/integrations/routes.js +502 -8
- package/dist/integrations/routes.js.map +1 -1
- package/dist/integrations/runtime.d.ts +14 -2
- package/dist/integrations/runtime.d.ts.map +1 -1
- package/dist/integrations/runtime.js +39 -7
- package/dist/integrations/runtime.js.map +1 -1
- package/dist/integrations/state.d.ts +1 -1
- package/dist/integrations/state.d.ts.map +1 -1
- package/dist/integrations/state.js +48 -8
- package/dist/integrations/state.js.map +1 -1
- package/dist/integrations/types.d.ts +54 -3
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/types.js +21 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/search/watcher.d.ts.map +1 -1
- package/dist/search/watcher.js +3 -22
- package/dist/search/watcher.js.map +1 -1
- package/dist/serve/index.d.ts.map +1 -1
- package/dist/serve/index.js +7 -0
- package/dist/serve/index.js.map +1 -1
- package/dist/sleep/index.js +2 -2
- package/dist/sleep/report.js +1 -1
- package/dist/sleep/report.js.map +1 -1
- package/dist/sleep/tension-scan.d.ts.map +1 -1
- package/dist/sleep/tension-scan.js +0 -0
- package/dist/sleep/tension-scan.js.map +1 -1
- package/dist/storage/local.d.ts +1 -0
- package/dist/storage/local.d.ts.map +1 -1
- package/dist/storage/local.js +8 -1
- package/dist/storage/local.js.map +1 -1
- package/dist/utils/config.d.ts +8 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +143 -19
- package/dist/utils/config.js.map +1 -1
- package/dist/view/pages.d.ts.map +1 -1
- package/dist/view/pages.js +11 -0
- package/dist/view/pages.js.map +1 -1
- package/dist/view/render.d.ts.map +1 -1
- package/dist/view/render.js +37 -2
- package/dist/view/render.js.map +1 -1
- package/package.json +8 -3
- package/src/integrations/microsoft/assets/VENDORING.md +109 -0
- package/src/integrations/microsoft/assets/glue.js +244 -0
- package/src/integrations/microsoft/assets/picker-serializer.js +99 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/app/IPublicClientApplication.mjs +91 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/app/PublicClientApplication.mjs +355 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/broker/nativeBroker/NativeStatusCodes.mjs +15 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/broker/nativeBroker/PlatformAuthDOMHandler.mjs +153 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +271 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/broker/nativeBroker/PlatformAuthProvider.mjs +95 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/AccountManager.mjs +49 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/AsyncMemoryStorage.mjs +144 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/BrowserCacheManager.mjs +1465 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/CacheHelpers.mjs +45 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/CacheKeys.mjs +32 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/CookieStorage.mjs +94 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/DatabaseStorage.mjs +208 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/EncryptedData.mjs +13 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/LocalStorage.mjs +319 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/MemoryStorage.mjs +48 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/SessionStorage.mjs +46 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/TokenCache.mjs +220 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/config/Configuration.mjs +138 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/controllers/NestedAppAuthController.mjs +483 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/controllers/StandardController.mjs +1532 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/BrowserCrypto.mjs +354 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/CryptoOps.mjs +146 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/PkceGenerator.mjs +63 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/SignedHttpRequest.mjs +50 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/TokenBindingKeyManager.mjs +156 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/encode/Base64Decode.mjs +43 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/encode/Base64Encode.mjs +47 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/BrowserAuthError.mjs +26 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/BrowserAuthErrorCodes.mjs +65 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/BrowserConfigurationAuthError.mjs +24 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/BrowserConfigurationAuthErrorCodes.mjs +11 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/NativeAuthError.mjs +79 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/NativeAuthErrorCodes.mjs +12 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/NestedAppAuthError.mjs +25 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/event/EventHandler.mjs +110 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/event/EventMessage.mjs +60 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/event/EventType.mjs +30 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/index.mjs +48 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/BaseInteractionClient.mjs +150 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/HybridSpaAuthorizationCodeClient.mjs +16 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/PlatformAuthInteractionClient.mjs +734 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/PopupClient.mjs +528 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/RedirectClient.mjs +464 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/SilentAuthCodeClient.mjs +85 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/SilentCacheClient.mjs +58 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/SilentIframeClient.mjs +255 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/SilentRefreshClient.mjs +77 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/StandardInteractionClient.mjs +217 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_handler/InteractionHandler.mjs +95 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_handler/SilentHandler.mjs +71 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/naa/BridgeError.mjs +11 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/naa/BridgeProxy.mjs +152 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/naa/BridgeStatusCode.mjs +18 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/naa/mapping/NestedAppAuthAdapter.mjs +239 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/navigation/NavigationClient.mjs +47 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/network/FetchClient.mjs +153 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/operatingcontext/BaseOperatingContext.mjs +112 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/operatingcontext/NestedAppOperatingContext.mjs +79 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/operatingcontext/StandardOperatingContext.mjs +50 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/packageMetadata.mjs +7 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/popup_relay/constants.mjs +20 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/popup_relay/relayClient.mjs +113 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/protocol/Authorize.mjs +326 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/request/RequestHelpers.mjs +143 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/response/ResponseHandler.mjs +45 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/telemetry/BrowserPerformanceClient.mjs +126 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/telemetry/BrowserPerformanceEvents.mjs +133 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/telemetry/BrowserPerformanceMeasurement.mjs +96 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/telemetry/BrowserRootPerformanceEvents.mjs +53 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/utils/BrowserConstants.mjs +220 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/utils/BrowserProtocolUtils.mjs +27 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/utils/BrowserUtils.mjs +364 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/utils/Helpers.mjs +19 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/utils/MsalFrameStatsUtils.mjs +38 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/webBrokerBridge/PendingRequestRegistry.mjs +63 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/webBrokerBridge/WebBrokerBridgeError.mjs +38 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +57 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/account/AccountInfo.mjs +91 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/account/AuthToken.mjs +70 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/account/CcsCredential.mjs +12 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/account/ClientInfo.mjs +43 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/account/TokenClaims.mjs +24 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/Authority.mjs +988 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/AuthorityFactory.mjs +41 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/AuthorityMetadata.mjs +158 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/AuthorityOptions.mjs +20 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/AuthorityType.mjs +16 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/CloudInstanceDiscoveryErrorResponse.mjs +12 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/CloudInstanceDiscoveryResponse.mjs +12 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/OpenIdConfigResponse.mjs +14 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/ProtocolMode.mjs +26 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/RegionDiscovery.mjs +116 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/cache/CacheManager.mjs +1202 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/cache/persistence/TokenCacheContext.mjs +29 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/cache/utils/AccountEntityUtils.mjs +222 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/cache/utils/CacheHelpers.mjs +294 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/client/AuthorizationCodeClient.mjs +289 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/client/RefreshTokenClient.mjs +262 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/client/SilentFlowClient.mjs +142 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/config/ClientConfiguration.mjs +111 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/constants/AADServerParamKeys.mjs +74 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/crypto/DpopProofGenerator.mjs +152 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/crypto/ICrypto.mjs +52 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/crypto/ITokenBindingKeyManager.mjs +27 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/crypto/JoseHeader.mjs +72 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/crypto/PopTokenGenerator.mjs +109 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/AuthError.mjs +31 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/AuthErrorCodes.mjs +13 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/CacheError.mjs +44 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/CacheErrorCodes.mjs +10 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/ClientAuthError.mjs +26 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/ClientAuthErrorCodes.mjs +46 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/ClientConfigurationError.mjs +23 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/ClientConfigurationErrorCodes.mjs +38 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/InteractionRequiredAuthError.mjs +73 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/InteractionRequiredAuthErrorCodes.mjs +53 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/JoseHeaderError.mjs +24 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/JoseHeaderErrorCodes.mjs +12 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/NetworkError.mjs +34 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/PlatformBrokerError.mjs +48 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/ServerError.mjs +22 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/index-browser.mjs +79 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/logger/Logger.mjs +291 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/network/INetworkModule.mjs +20 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/network/RequestThumbprint.mjs +27 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/network/ThrottlingUtils.mjs +91 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/packageMetadata.mjs +7 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/protocol/Authorize.mjs +239 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/protocol/Token.mjs +148 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/request/AuthenticationHeaderParser.mjs +63 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/request/BaseAuthRequest.mjs +37 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/request/RequestParameterBuilder.mjs +529 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/request/ScopeSet.mjs +204 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/response/ResponseHandler.mjs +432 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/performance/PerformanceClient.mjs +557 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/performance/PerformanceEvent.mjs +68 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/performance/PerformanceEvents.mjs +73 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/performance/StubPerformanceClient.mjs +61 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/server/ServerTelemetryManager.mjs +297 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/url/UrlString.mjs +164 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/ClientAssertionUtils.mjs +21 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/Constants.mjs +304 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/FunctionWrappers.mjs +95 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/ObjectUtils.mjs +27 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/ProtocolUtils.mjs +76 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/StringUtils.mjs +82 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/TimeUtils.mjs +75 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/UrlUtils.mjs +128 -0
|
@@ -0,0 +1,557 @@
|
|
|
1
|
+
/*! @azure/msal-common v16.14.0 2026-08-28 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { getAndFlushLogsFromCache } from '../../logger/Logger.mjs';
|
|
4
|
+
import { IntFields, PerformanceEventStatus, EXT_FIELD_PREFIX } from './PerformanceEvent.mjs';
|
|
5
|
+
import { AuthError } from '../../error/AuthError.mjs';
|
|
6
|
+
import { CacheError } from '../../error/CacheError.mjs';
|
|
7
|
+
import { ServerError } from '../../error/ServerError.mjs';
|
|
8
|
+
import { InteractionRequiredAuthError } from '../../error/InteractionRequiredAuthError.mjs';
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
+
* Licensed under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Starts context by adding payload to the stack
|
|
16
|
+
* @param event {PerformanceEvent}
|
|
17
|
+
* @param stack {?PerformanceEventStackedContext[]} stack
|
|
18
|
+
*/
|
|
19
|
+
function startContext(event, stack) {
|
|
20
|
+
if (!stack) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
stack.push({
|
|
24
|
+
name: event.name,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Ends context by removing payload from the stack and returning parent or self, if stack is empty, payload
|
|
29
|
+
*
|
|
30
|
+
* @param event {PerformanceEvent}
|
|
31
|
+
* @param stack {?PerformanceEventStackedContext[]} stack
|
|
32
|
+
* @param error {?unknown} error
|
|
33
|
+
*/
|
|
34
|
+
function endContext(event, stack, error) {
|
|
35
|
+
if (!stack?.length) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const peek = (stack) => {
|
|
39
|
+
return stack.length ? stack[stack.length - 1] : undefined;
|
|
40
|
+
};
|
|
41
|
+
const abbrEventName = event.name;
|
|
42
|
+
const top = peek(stack);
|
|
43
|
+
if (top?.name !== abbrEventName) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const current = stack?.pop();
|
|
47
|
+
if (!current) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const errorCode = error instanceof AuthError
|
|
51
|
+
? error.errorCode
|
|
52
|
+
: error instanceof Error
|
|
53
|
+
? error.name
|
|
54
|
+
: undefined;
|
|
55
|
+
const subErr = error instanceof AuthError ? error.subError : undefined;
|
|
56
|
+
if (errorCode && current.childErr !== errorCode) {
|
|
57
|
+
current.err = errorCode;
|
|
58
|
+
if (subErr) {
|
|
59
|
+
current.subErr = subErr;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
delete current.name;
|
|
63
|
+
delete current.childErr;
|
|
64
|
+
const context = {
|
|
65
|
+
...current,
|
|
66
|
+
dur: event.durationMs,
|
|
67
|
+
};
|
|
68
|
+
if (!event.success) {
|
|
69
|
+
context.fail = 1;
|
|
70
|
+
}
|
|
71
|
+
const parent = peek(stack);
|
|
72
|
+
if (!parent) {
|
|
73
|
+
return { [abbrEventName]: context };
|
|
74
|
+
}
|
|
75
|
+
if (errorCode) {
|
|
76
|
+
parent.childErr = errorCode;
|
|
77
|
+
}
|
|
78
|
+
let childName;
|
|
79
|
+
if (!parent[abbrEventName]) {
|
|
80
|
+
childName = abbrEventName;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
const siblings = Object.keys(parent).filter((key) => key.startsWith(abbrEventName)).length;
|
|
84
|
+
childName = `${abbrEventName}_${siblings + 1}`;
|
|
85
|
+
}
|
|
86
|
+
parent[childName] = context;
|
|
87
|
+
return parent;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Adds error name and stack trace to the telemetry event
|
|
91
|
+
* @param error {Error}
|
|
92
|
+
* @param logger {Logger}
|
|
93
|
+
* @param event {PerformanceEvent}
|
|
94
|
+
* @param stackMaxSize {number} max error stack size to capture
|
|
95
|
+
*/
|
|
96
|
+
function addError(error, logger, event, stackMaxSize = 5) {
|
|
97
|
+
if (!(error instanceof Error)) {
|
|
98
|
+
logger.trace("0gcyox", event.correlationId);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
else if (error instanceof AuthError) {
|
|
102
|
+
event.errorCode = error.errorCode;
|
|
103
|
+
event.subErrorCode = error.subError;
|
|
104
|
+
if (!event.serverErrorNo &&
|
|
105
|
+
(error instanceof ServerError ||
|
|
106
|
+
error instanceof InteractionRequiredAuthError) &&
|
|
107
|
+
error.errorNo) {
|
|
108
|
+
event.serverErrorNo = error.errorNo;
|
|
109
|
+
}
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
else if (error instanceof CacheError) {
|
|
113
|
+
event.errorCode = error.errorCode;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
else if (event.errorStack?.length) {
|
|
117
|
+
logger.trace("0lmqrh", event.correlationId);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
else if (!error.stack?.length) {
|
|
121
|
+
logger.trace("1cnpwa", event.correlationId);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (error.stack) {
|
|
125
|
+
event.errorStack = compactStack(error.stack, stackMaxSize);
|
|
126
|
+
}
|
|
127
|
+
event.errorName = error.name;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Compacts error stack into array by fetching N first entries
|
|
131
|
+
* @param stack {string} error stack
|
|
132
|
+
* @param stackMaxSize {number} max error stack size to capture
|
|
133
|
+
* @returns {string[]}
|
|
134
|
+
*/
|
|
135
|
+
function compactStack(stack, stackMaxSize) {
|
|
136
|
+
if (stackMaxSize < 0) {
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
const stackArr = stack.split("\n") || [];
|
|
140
|
+
const res = [];
|
|
141
|
+
// Check for a handful of known, common runtime errors and log them (with redaction where applicable).
|
|
142
|
+
const firstLine = stackArr[0];
|
|
143
|
+
if (firstLine.startsWith("TypeError: Cannot read property") ||
|
|
144
|
+
firstLine.startsWith("TypeError: Cannot read properties of") ||
|
|
145
|
+
firstLine.startsWith("TypeError: Cannot set property") ||
|
|
146
|
+
firstLine.startsWith("TypeError: Cannot set properties of") ||
|
|
147
|
+
firstLine.endsWith("is not a function")) {
|
|
148
|
+
// These types of errors are not at risk of leaking PII. They will indicate unavailable APIs
|
|
149
|
+
res.push(compactStackLine(firstLine));
|
|
150
|
+
}
|
|
151
|
+
else if (firstLine.startsWith("SyntaxError") ||
|
|
152
|
+
firstLine.startsWith("TypeError")) {
|
|
153
|
+
// Prevent unintentional leaking of arbitrary info by redacting contents between both single and double quotes
|
|
154
|
+
res.push(compactStackLine(
|
|
155
|
+
// Example: SyntaxError: Unexpected token 'e', "test" is not valid JSON -> SyntaxError: Unexpected token <redacted>, <redacted> is not valid JSON
|
|
156
|
+
firstLine.replace(/['].*[']|["].*["]/g, "<redacted>")));
|
|
157
|
+
}
|
|
158
|
+
// Get top N stack lines
|
|
159
|
+
for (let ix = 1; ix < stackArr.length; ix++) {
|
|
160
|
+
if (res.length >= stackMaxSize) {
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
const line = stackArr[ix];
|
|
164
|
+
res.push(compactStackLine(line));
|
|
165
|
+
}
|
|
166
|
+
return res;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Compacts error stack line by shortening file path
|
|
170
|
+
* Example: https://localhost/msal-common/src/authority/Authority.js:100:1 -> Authority.js:100:1
|
|
171
|
+
* @param line {string} stack line
|
|
172
|
+
* @returns {string}
|
|
173
|
+
*/
|
|
174
|
+
function compactStackLine(line) {
|
|
175
|
+
const filePathIx = line.lastIndexOf(" ") + 1;
|
|
176
|
+
if (filePathIx < 1) {
|
|
177
|
+
return line;
|
|
178
|
+
}
|
|
179
|
+
const filePath = line.substring(filePathIx);
|
|
180
|
+
let fileNameIx = filePath.lastIndexOf("/");
|
|
181
|
+
fileNameIx = fileNameIx < 0 ? filePath.lastIndexOf("\\") : fileNameIx;
|
|
182
|
+
if (fileNameIx >= 0) {
|
|
183
|
+
return (line.substring(0, filePathIx) +
|
|
184
|
+
"(" +
|
|
185
|
+
filePath.substring(fileNameIx + 1) +
|
|
186
|
+
(filePath.charAt(filePath.length - 1) === ")" ? "" : ")")).trimStart();
|
|
187
|
+
}
|
|
188
|
+
return line.trimStart();
|
|
189
|
+
}
|
|
190
|
+
function getAccountType(account) {
|
|
191
|
+
const idTokenClaims = account?.idTokenClaims;
|
|
192
|
+
if (idTokenClaims?.tfp || idTokenClaims?.acr) {
|
|
193
|
+
return "B2C";
|
|
194
|
+
}
|
|
195
|
+
if (!idTokenClaims?.tid) {
|
|
196
|
+
return undefined;
|
|
197
|
+
}
|
|
198
|
+
else if (idTokenClaims?.tid === "9188040d-6c67-4c5b-b112-36a304b66dad") {
|
|
199
|
+
return "MSA";
|
|
200
|
+
}
|
|
201
|
+
return "AAD";
|
|
202
|
+
}
|
|
203
|
+
class PerformanceClient {
|
|
204
|
+
/**
|
|
205
|
+
* Creates an instance of PerformanceClient,
|
|
206
|
+
* an abstract class containing core performance telemetry logic.
|
|
207
|
+
*
|
|
208
|
+
* @constructor
|
|
209
|
+
* @param {string} clientId Client ID of the application
|
|
210
|
+
* @param {string} authority Authority used by the application
|
|
211
|
+
* @param {Logger} logger Logger used by the application
|
|
212
|
+
* @param {string} libraryName Name of the library
|
|
213
|
+
* @param {string} libraryVersion Version of the library
|
|
214
|
+
* @param {ApplicationTelemetry} applicationTelemetry application name and version
|
|
215
|
+
* @param {Set<String>} intFields integer fields to be truncated
|
|
216
|
+
*/
|
|
217
|
+
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, intFields) {
|
|
218
|
+
this.authority = authority;
|
|
219
|
+
this.libraryName = libraryName;
|
|
220
|
+
this.libraryVersion = libraryVersion;
|
|
221
|
+
this.globalFields = {};
|
|
222
|
+
this.applicationTelemetry = applicationTelemetry;
|
|
223
|
+
this.clientId = clientId;
|
|
224
|
+
this.logger = logger;
|
|
225
|
+
this.callbacks = new Map();
|
|
226
|
+
this.eventsByCorrelationId = new Map();
|
|
227
|
+
this.eventStack = new Map();
|
|
228
|
+
this.intFields = intFields || new Set();
|
|
229
|
+
for (const item of IntFields) {
|
|
230
|
+
this.intFields.add(item);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
|
|
235
|
+
*
|
|
236
|
+
* @param {PerformanceEvents} measureName
|
|
237
|
+
* @param {?string} [correlationId]
|
|
238
|
+
* @returns {InProgressPerformanceEvent}
|
|
239
|
+
*/
|
|
240
|
+
startMeasurement(measureName, correlationId) {
|
|
241
|
+
// Generate a placeholder correlation if the request does not provide one
|
|
242
|
+
const eventCorrelationId = correlationId || this.generateId();
|
|
243
|
+
const inProgressEvent = {
|
|
244
|
+
eventId: this.generateId(),
|
|
245
|
+
status: PerformanceEventStatus.InProgress,
|
|
246
|
+
authority: this.authority,
|
|
247
|
+
libraryName: this.libraryName,
|
|
248
|
+
libraryVersion: this.libraryVersion,
|
|
249
|
+
clientId: this.clientId,
|
|
250
|
+
name: measureName,
|
|
251
|
+
startTimeMs: Date.now(),
|
|
252
|
+
correlationId: eventCorrelationId,
|
|
253
|
+
appName: this.applicationTelemetry?.appName,
|
|
254
|
+
appVersion: this.applicationTelemetry?.appVersion,
|
|
255
|
+
};
|
|
256
|
+
// Store in progress events so they can be discarded if not ended properly
|
|
257
|
+
this.cacheEventByCorrelationId(inProgressEvent);
|
|
258
|
+
startContext(inProgressEvent, this.eventStack.get(eventCorrelationId));
|
|
259
|
+
// Return the event and functions the caller can use to properly end/flush the measurement
|
|
260
|
+
return {
|
|
261
|
+
end: (event, error, account) => {
|
|
262
|
+
return this.endMeasurement({
|
|
263
|
+
// Initial set of event properties
|
|
264
|
+
...inProgressEvent,
|
|
265
|
+
// Properties set when event ends
|
|
266
|
+
...event,
|
|
267
|
+
}, error, account);
|
|
268
|
+
},
|
|
269
|
+
discard: () => {
|
|
270
|
+
return this.discardMeasurements(inProgressEvent.correlationId);
|
|
271
|
+
},
|
|
272
|
+
add: (fields) => {
|
|
273
|
+
return this.addFields(fields, inProgressEvent.correlationId);
|
|
274
|
+
},
|
|
275
|
+
increment: (fields) => {
|
|
276
|
+
return this.incrementFields(fields, inProgressEvent.correlationId);
|
|
277
|
+
},
|
|
278
|
+
event: inProgressEvent,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Stops measuring the performance for an operation. Should only be called directly by PerformanceClient classes,
|
|
283
|
+
* as consumers should instead use the function returned by startMeasurement.
|
|
284
|
+
* Adds a new field named as "[event name]DurationMs" for sub-measurements, completes and emits an event
|
|
285
|
+
* otherwise.
|
|
286
|
+
*
|
|
287
|
+
* @param {PerformanceEvent} event
|
|
288
|
+
* @param {unknown} error
|
|
289
|
+
* @param {AccountInfo?} account
|
|
290
|
+
* @returns {(PerformanceEvent | null)}
|
|
291
|
+
*/
|
|
292
|
+
endMeasurement(event, error, account) {
|
|
293
|
+
const rootEvent = this.eventsByCorrelationId.get(event.correlationId);
|
|
294
|
+
if (!rootEvent) {
|
|
295
|
+
this.logger.trace(`0k9ti8 ${event.eventId}`, event.correlationId);
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
const isRoot = event.eventId === rootEvent.eventId;
|
|
299
|
+
event.durationMs = Math.round(event.durationMs || this.getDurationMs(event.startTimeMs));
|
|
300
|
+
const context = JSON.stringify(endContext(event, this.eventStack.get(rootEvent.correlationId), error));
|
|
301
|
+
if (isRoot) {
|
|
302
|
+
this.discardMeasurements(rootEvent.correlationId);
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
rootEvent.incompleteSubMeasurements?.delete(event.eventId);
|
|
306
|
+
}
|
|
307
|
+
if (error) {
|
|
308
|
+
addError(error, this.logger, rootEvent);
|
|
309
|
+
}
|
|
310
|
+
// Add sub-measurement attribute to root event's ext field.
|
|
311
|
+
if (!isRoot) {
|
|
312
|
+
rootEvent.ext = {
|
|
313
|
+
...rootEvent.ext,
|
|
314
|
+
...event.ext,
|
|
315
|
+
};
|
|
316
|
+
rootEvent.ext[event.name + "DurationMs"] = Math.floor(event.durationMs);
|
|
317
|
+
return { ...rootEvent };
|
|
318
|
+
}
|
|
319
|
+
if (isRoot &&
|
|
320
|
+
!error &&
|
|
321
|
+
(rootEvent.errorCode || rootEvent.subErrorCode)) {
|
|
322
|
+
this.logger.trace(`1fm1tm ${event.name}`, event.correlationId);
|
|
323
|
+
rootEvent.errorCode = undefined;
|
|
324
|
+
rootEvent.subErrorCode = undefined;
|
|
325
|
+
}
|
|
326
|
+
let finalEvent = { ...rootEvent, ...event };
|
|
327
|
+
let incompleteSubsCount = 0;
|
|
328
|
+
// Incomplete sub-measurements are discarded. They are likely an instrumentation bug that should be fixed.
|
|
329
|
+
finalEvent.incompleteSubMeasurements?.forEach((subMeasurement) => {
|
|
330
|
+
this.logger.trace(`0nxk52 ${subMeasurement.name} ${event.name}`, finalEvent.correlationId);
|
|
331
|
+
incompleteSubsCount++;
|
|
332
|
+
});
|
|
333
|
+
finalEvent.incompleteSubMeasurements = undefined;
|
|
334
|
+
const logs = getAndFlushLogsFromCache(event.correlationId);
|
|
335
|
+
// Format logs: [millis1,hash1;millis2,hash2;...]
|
|
336
|
+
const formattedLogs = logs
|
|
337
|
+
.map((logMessage) => `${logMessage.milliseconds},${logMessage.hash}`)
|
|
338
|
+
.join(";");
|
|
339
|
+
finalEvent = {
|
|
340
|
+
...finalEvent,
|
|
341
|
+
status: PerformanceEventStatus.Completed,
|
|
342
|
+
incompleteSubsCount,
|
|
343
|
+
context,
|
|
344
|
+
logs: formattedLogs,
|
|
345
|
+
/*
|
|
346
|
+
* Global fields are spread last so they are always present on the
|
|
347
|
+
* emitted event and never overridden, even when registered after
|
|
348
|
+
* the measurement started.
|
|
349
|
+
*/
|
|
350
|
+
...this.globalFields,
|
|
351
|
+
};
|
|
352
|
+
if (account) {
|
|
353
|
+
finalEvent.accountType = getAccountType(account);
|
|
354
|
+
finalEvent.dataBoundary = account.dataBoundary;
|
|
355
|
+
}
|
|
356
|
+
this.truncateIntegralFields(finalEvent);
|
|
357
|
+
this.emitEvents([finalEvent], event.correlationId);
|
|
358
|
+
return finalEvent;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Saves extra information to be emitted when the measurements are flushed
|
|
362
|
+
* @param fields
|
|
363
|
+
* @param correlationId
|
|
364
|
+
*/
|
|
365
|
+
addFields(fields, correlationId) {
|
|
366
|
+
const event = this.eventsByCorrelationId.get(correlationId);
|
|
367
|
+
if (event) {
|
|
368
|
+
const staticFields = {};
|
|
369
|
+
const dynamicFields = {};
|
|
370
|
+
for (const key in fields) {
|
|
371
|
+
if (key.startsWith(EXT_FIELD_PREFIX)) {
|
|
372
|
+
const dynamicKey = key.slice(EXT_FIELD_PREFIX.length);
|
|
373
|
+
const value = fields[key];
|
|
374
|
+
if (typeof value === "string" ||
|
|
375
|
+
typeof value === "number") {
|
|
376
|
+
dynamicFields[dynamicKey] = value;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
staticFields[key] = fields[key];
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
const updatedEvent = {
|
|
384
|
+
...event,
|
|
385
|
+
...staticFields,
|
|
386
|
+
};
|
|
387
|
+
if (Object.keys(dynamicFields).length) {
|
|
388
|
+
updatedEvent.ext = {
|
|
389
|
+
...updatedEvent.ext,
|
|
390
|
+
...dynamicFields,
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
this.eventsByCorrelationId.set(correlationId, updatedEvent);
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
this.logger.trace("0thl6s", correlationId);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Saves fields to be emitted on every event measured by this client.
|
|
401
|
+
* Unlike addFields, these are not scoped to a single correlationId and persist for the
|
|
402
|
+
* lifetime of the client (e.g. previousLibraryVersion for upgrade/downgrade telemetry).
|
|
403
|
+
* @param fields
|
|
404
|
+
*/
|
|
405
|
+
addGlobalFields(fields) {
|
|
406
|
+
this.globalFields = {
|
|
407
|
+
...this.globalFields,
|
|
408
|
+
...fields,
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Increment counters to be emitted when the measurements are flushed
|
|
413
|
+
* @param fields {string[]}
|
|
414
|
+
* @param correlationId {string} correlation identifier
|
|
415
|
+
*/
|
|
416
|
+
incrementFields(fields, correlationId) {
|
|
417
|
+
const event = this.eventsByCorrelationId.get(correlationId);
|
|
418
|
+
if (event) {
|
|
419
|
+
for (const counter in fields) {
|
|
420
|
+
if (counter.startsWith(EXT_FIELD_PREFIX)) {
|
|
421
|
+
event.ext = event.ext || {};
|
|
422
|
+
// Route to ext sub-object
|
|
423
|
+
const dynamicKey = counter.slice(EXT_FIELD_PREFIX.length);
|
|
424
|
+
const currentValue = event.ext[dynamicKey];
|
|
425
|
+
if (currentValue === undefined) {
|
|
426
|
+
event.ext[dynamicKey] = 0;
|
|
427
|
+
}
|
|
428
|
+
else if (isNaN(Number(currentValue))) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
event.ext[dynamicKey] =
|
|
432
|
+
(Number(event.ext[dynamicKey]) || 0) +
|
|
433
|
+
(fields[counter] ?? 0);
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
/* eslint-disable custom-msal/no-dynamic-telemetry-fields -- internal dispatching of static fields by name */
|
|
437
|
+
if (!event.hasOwnProperty(counter)) {
|
|
438
|
+
event[counter] = 0;
|
|
439
|
+
}
|
|
440
|
+
else if (isNaN(Number(event[counter]))) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
event[counter] += fields[counter];
|
|
444
|
+
/* eslint-enable custom-msal/no-dynamic-telemetry-fields */
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
this.logger.trace("0thl6s", correlationId);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Upserts event into event cache.
|
|
454
|
+
* First key is the correlation id, second key is the event id.
|
|
455
|
+
* Allows for events to be grouped by correlation id,
|
|
456
|
+
* and to easily allow for properties on them to be updated.
|
|
457
|
+
*
|
|
458
|
+
* @private
|
|
459
|
+
* @param {PerformanceEvent} event
|
|
460
|
+
*/
|
|
461
|
+
cacheEventByCorrelationId(event) {
|
|
462
|
+
const rootEvent = this.eventsByCorrelationId.get(event.correlationId);
|
|
463
|
+
if (rootEvent) {
|
|
464
|
+
rootEvent.incompleteSubMeasurements =
|
|
465
|
+
rootEvent.incompleteSubMeasurements || new Map();
|
|
466
|
+
rootEvent.incompleteSubMeasurements.set(event.eventId, {
|
|
467
|
+
name: event.name,
|
|
468
|
+
startTimeMs: event.startTimeMs,
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
this.eventsByCorrelationId.set(event.correlationId, { ...event });
|
|
473
|
+
this.eventStack.set(event.correlationId, []);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Removes measurements and aux data for a given correlation id.
|
|
478
|
+
*
|
|
479
|
+
* @param {string} correlationId
|
|
480
|
+
*/
|
|
481
|
+
discardMeasurements(correlationId) {
|
|
482
|
+
this.eventsByCorrelationId.delete(correlationId);
|
|
483
|
+
this.eventStack.delete(correlationId);
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Registers a callback function to receive performance events.
|
|
487
|
+
*
|
|
488
|
+
* @param {PerformanceCallbackFunction} callback
|
|
489
|
+
* @returns {string}
|
|
490
|
+
*/
|
|
491
|
+
addPerformanceCallback(callback) {
|
|
492
|
+
for (const [id, cb] of this.callbacks) {
|
|
493
|
+
if (cb.toString() === callback.toString()) {
|
|
494
|
+
this.logger.warning(`1eap5p ${id}`, "");
|
|
495
|
+
return id;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
const callbackId = this.generateId();
|
|
499
|
+
this.callbacks.set(callbackId, callback);
|
|
500
|
+
this.logger.verbose(`0c9ujz ${callbackId}`, "");
|
|
501
|
+
return callbackId;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Removes a callback registered with addPerformanceCallback.
|
|
505
|
+
*
|
|
506
|
+
* @param {string} callbackId
|
|
507
|
+
* @returns {boolean}
|
|
508
|
+
*/
|
|
509
|
+
removePerformanceCallback(callbackId) {
|
|
510
|
+
const result = this.callbacks.delete(callbackId);
|
|
511
|
+
if (result) {
|
|
512
|
+
this.logger.verbose(`0253if ${callbackId}`, "");
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
this.logger.verbose(`0iqk07 ${callbackId}`, "");
|
|
516
|
+
}
|
|
517
|
+
return result;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Emits events to all registered callbacks.
|
|
521
|
+
*
|
|
522
|
+
* @param {PerformanceEvent[]} events
|
|
523
|
+
* @param {?string} [correlationId]
|
|
524
|
+
*/
|
|
525
|
+
emitEvents(events, correlationId) {
|
|
526
|
+
this.logger.verbose("11jb1y", correlationId);
|
|
527
|
+
this.callbacks.forEach((callback, callbackId) => {
|
|
528
|
+
this.logger.trace(`0p2pjl ${callbackId}`, correlationId);
|
|
529
|
+
callback.apply(null, [events]);
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Enforce truncation of integral fields in performance event.
|
|
534
|
+
* @param {PerformanceEvent} event performance event to update.
|
|
535
|
+
*/
|
|
536
|
+
truncateIntegralFields(event) {
|
|
537
|
+
this.intFields.forEach((key) => {
|
|
538
|
+
/* eslint-disable custom-msal/no-dynamic-telemetry-fields -- internal truncation of known integer fields */
|
|
539
|
+
if (key in event && typeof event[key] === "number") {
|
|
540
|
+
event[key] = Math.floor(event[key]);
|
|
541
|
+
}
|
|
542
|
+
/* eslint-enable custom-msal/no-dynamic-telemetry-fields */
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Returns event duration in milliseconds
|
|
547
|
+
* @param startTimeMs {number}
|
|
548
|
+
* @returns {number}
|
|
549
|
+
*/
|
|
550
|
+
getDurationMs(startTimeMs) {
|
|
551
|
+
const durationMs = Date.now() - startTimeMs;
|
|
552
|
+
// Handle clock skew
|
|
553
|
+
return durationMs < 0 ? durationMs : 0;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
export { PerformanceClient, addError, compactStack, compactStackLine, endContext, getAccountType, startContext };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*! @azure/msal-common v16.14.0 2026-08-28 */
|
|
2
|
+
'use strict';
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
* Licensed under the MIT License.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* State of the performance event.
|
|
9
|
+
*
|
|
10
|
+
* @export
|
|
11
|
+
* @enum {number}
|
|
12
|
+
*/
|
|
13
|
+
const PerformanceEventStatus = {
|
|
14
|
+
NotStarted: 0,
|
|
15
|
+
InProgress: 1,
|
|
16
|
+
Completed: 2,
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Prefix used to mark telemetry field names as dynamic.
|
|
20
|
+
* Fields with this prefix in addFields/incrementFields calls will be routed
|
|
21
|
+
* to the PerformanceEvent.ext sub-object.
|
|
22
|
+
*/
|
|
23
|
+
const EXT_FIELD_PREFIX = "ext.";
|
|
24
|
+
const IntFields = new Set([
|
|
25
|
+
"accessTokenSize",
|
|
26
|
+
"durationMs",
|
|
27
|
+
"idTokenSize",
|
|
28
|
+
"matsSilentStatus",
|
|
29
|
+
"matsHttpStatus",
|
|
30
|
+
"refreshTokenSize",
|
|
31
|
+
"startTimeMs",
|
|
32
|
+
"status",
|
|
33
|
+
"multiMatchedAT",
|
|
34
|
+
"multiMatchedID",
|
|
35
|
+
"multiMatchedRT",
|
|
36
|
+
"unencryptedCacheCount",
|
|
37
|
+
"encryptedCacheExpiredCount",
|
|
38
|
+
"oldAccountCount",
|
|
39
|
+
"oldAccessCount",
|
|
40
|
+
"oldIdCount",
|
|
41
|
+
"oldRefreshCount",
|
|
42
|
+
"currAccountCount",
|
|
43
|
+
"currAccessCount",
|
|
44
|
+
"currIdCount",
|
|
45
|
+
"currRefreshCount",
|
|
46
|
+
"ttlExpiredAcntCount",
|
|
47
|
+
"ttlExpiredITCount",
|
|
48
|
+
"ttlExpiredATCount",
|
|
49
|
+
"ttlExpiredRTCount",
|
|
50
|
+
"decryptFailedAcntCount",
|
|
51
|
+
"decryptFailedITCount",
|
|
52
|
+
"decryptFailedATCount",
|
|
53
|
+
"decryptFailedRTCount",
|
|
54
|
+
"invalidAcntCount",
|
|
55
|
+
"invalidITCount",
|
|
56
|
+
"invalidATCount",
|
|
57
|
+
"invalidRTCount",
|
|
58
|
+
"expiredATCount",
|
|
59
|
+
"expiredRTCount",
|
|
60
|
+
"upgradedCacheCount",
|
|
61
|
+
"cacheMatchedAccounts",
|
|
62
|
+
"networkRtt",
|
|
63
|
+
"redirectBridgeTimeoutMs",
|
|
64
|
+
"redirectBridgeMessageVersion",
|
|
65
|
+
"fetchRetryCount",
|
|
66
|
+
]);
|
|
67
|
+
|
|
68
|
+
export { EXT_FIELD_PREFIX, IntFields, PerformanceEventStatus };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*! @azure/msal-common v16.14.0 2026-08-28 */
|
|
2
|
+
'use strict';
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
* Licensed under the MIT License.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Time spent sending/waiting for the response of a request to the token endpoint
|
|
9
|
+
*/
|
|
10
|
+
const NetworkClientSendPostRequestAsync = "networkClientSendPostRequestAsync";
|
|
11
|
+
const RefreshTokenClientExecutePostToTokenEndpoint = "refreshTokenClientExecutePostToTokenEndpoint";
|
|
12
|
+
const AuthorizationCodeClientExecutePostToTokenEndpoint = "authorizationCodeClientExecutePostToTokenEndpoint";
|
|
13
|
+
/**
|
|
14
|
+
* Time spent on the network for refresh token acquisition
|
|
15
|
+
*/
|
|
16
|
+
const RefreshTokenClientExecuteTokenRequest = "refreshTokenClientExecuteTokenRequest";
|
|
17
|
+
/**
|
|
18
|
+
* Time taken for acquiring refresh token , records RT size
|
|
19
|
+
*/
|
|
20
|
+
const RefreshTokenClientAcquireToken = "refreshTokenClientAcquireToken";
|
|
21
|
+
/**
|
|
22
|
+
* Time taken for acquiring cached refresh token
|
|
23
|
+
*/
|
|
24
|
+
const RefreshTokenClientAcquireTokenWithCachedRefreshToken = "refreshTokenClientAcquireTokenWithCachedRefreshToken";
|
|
25
|
+
/**
|
|
26
|
+
* Helper function to create token request body in RefreshTokenClient (msal-common).
|
|
27
|
+
*/
|
|
28
|
+
const RefreshTokenClientCreateTokenRequestBody = "refreshTokenClientCreateTokenRequestBody";
|
|
29
|
+
const SilentFlowClientGenerateResultFromCacheRecord = "silentFlowClientGenerateResultFromCacheRecord";
|
|
30
|
+
/**
|
|
31
|
+
* getAuthCodeUrl API (msal-browser and msal-node).
|
|
32
|
+
*/
|
|
33
|
+
const GetAuthCodeUrl = "getAuthCodeUrl";
|
|
34
|
+
/**
|
|
35
|
+
* Functions from InteractionHandler (msal-browser)
|
|
36
|
+
*/
|
|
37
|
+
const HandleCodeResponseFromServer = "handleCodeResponseFromServer";
|
|
38
|
+
/**
|
|
39
|
+
* APIs in Authorization Code Client (msal-common)
|
|
40
|
+
*/
|
|
41
|
+
const AuthClientExecuteTokenRequest = "authClientExecuteTokenRequest";
|
|
42
|
+
const AuthClientCreateTokenRequestBody = "authClientCreateTokenRequestBody";
|
|
43
|
+
const UpdateTokenEndpointAuthority = "updateTokenEndpointAuthority";
|
|
44
|
+
/**
|
|
45
|
+
* Generate functions in PopTokenGenerator (msal-common)
|
|
46
|
+
*/
|
|
47
|
+
const PopTokenGenerateCnf = "popTokenGenerateCnf";
|
|
48
|
+
/**
|
|
49
|
+
* handleServerTokenResponse API in ResponseHandler (msal-common)
|
|
50
|
+
*/
|
|
51
|
+
const HandleServerTokenResponse = "handleServerTokenResponse";
|
|
52
|
+
/**
|
|
53
|
+
* Authority functions
|
|
54
|
+
*/
|
|
55
|
+
const AuthorityResolveEndpointsAsync = "authorityResolveEndpointsAsync";
|
|
56
|
+
const AuthorityGetCloudDiscoveryMetadataFromNetwork = "authorityGetCloudDiscoveryMetadataFromNetwork";
|
|
57
|
+
const AuthorityUpdateCloudDiscoveryMetadata = "authorityUpdateCloudDiscoveryMetadata";
|
|
58
|
+
const AuthorityGetEndpointMetadataFromNetwork = "authorityGetEndpointMetadataFromNetwork";
|
|
59
|
+
const AuthorityUpdateEndpointMetadata = "authorityUpdateEndpointMetadata";
|
|
60
|
+
const AuthorityUpdateMetadataWithRegionalInformation = "authorityUpdateMetadataWithRegionalInformation";
|
|
61
|
+
/**
|
|
62
|
+
* Region Discovery functions
|
|
63
|
+
*/
|
|
64
|
+
const RegionDiscoveryDetectRegion = "regionDiscoveryDetectRegion";
|
|
65
|
+
const RegionDiscoveryGetRegionFromIMDS = "regionDiscoveryGetRegionFromIMDS";
|
|
66
|
+
const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
|
|
67
|
+
/**
|
|
68
|
+
* Cache operations
|
|
69
|
+
*/
|
|
70
|
+
const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
|
|
71
|
+
const SetUserData = "setUserData";
|
|
72
|
+
|
|
73
|
+
export { AuthClientCreateTokenRequestBody, AuthClientExecuteTokenRequest, AuthorityGetCloudDiscoveryMetadataFromNetwork, AuthorityGetEndpointMetadataFromNetwork, AuthorityResolveEndpointsAsync, AuthorityUpdateCloudDiscoveryMetadata, AuthorityUpdateEndpointMetadata, AuthorityUpdateMetadataWithRegionalInformation, AuthorizationCodeClientExecutePostToTokenEndpoint, CacheManagerGetRefreshToken, GetAuthCodeUrl, HandleCodeResponseFromServer, HandleServerTokenResponse, NetworkClientSendPostRequestAsync, PopTokenGenerateCnf, RefreshTokenClientAcquireToken, RefreshTokenClientAcquireTokenWithCachedRefreshToken, RefreshTokenClientCreateTokenRequestBody, RefreshTokenClientExecutePostToTokenEndpoint, RefreshTokenClientExecuteTokenRequest, RegionDiscoveryDetectRegion, RegionDiscoveryGetCurrentVersion, RegionDiscoveryGetRegionFromIMDS, SetUserData, SilentFlowClientGenerateResultFromCacheRecord, UpdateTokenEndpointAuthority };
|