diff --git a/change/@azure-msal-browser-f198cf62-fc18-4c1b-99d3-2317f048ed7c.json b/change/@azure-msal-browser-f198cf62-fc18-4c1b-99d3-2317f048ed7c.json new file mode 100644 index 0000000000..0613840531 --- /dev/null +++ b/change/@azure-msal-browser-f198cf62-fc18-4c1b-99d3-2317f048ed7c.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Upgrade/rollback telemetry #7738", + "packageName": "@azure/msal-browser", + "email": "thomas.norling@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/change/@azure-msal-common-5480aa2a-a988-4371-a778-2c3c77a7a30a.json b/change/@azure-msal-common-5480aa2a-a988-4371-a778-2c3c77a7a30a.json new file mode 100644 index 0000000000..133d620c40 --- /dev/null +++ b/change/@azure-msal-common-5480aa2a-a988-4371-a778-2c3c77a7a30a.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Upgrade/rollback telemetry #7738", + "packageName": "@azure/msal-common", + "email": "thomas.norling@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/lib/msal-browser/src/cache/BrowserCacheManager.ts b/lib/msal-browser/src/cache/BrowserCacheManager.ts index 3b6217e1ed..81f72bb195 100644 --- a/lib/msal-browser/src/cache/BrowserCacheManager.ts +++ b/lib/msal-browser/src/cache/BrowserCacheManager.ts @@ -66,6 +66,7 @@ import { getAccountKeys, getTokenKeys } from "./CacheHelpers.js"; import { EventType } from "../event/EventType.js"; import { EventHandler } from "../event/EventHandler.js"; import { clearHash } from "../utils/BrowserUtils.js"; +import { version } from "../packageMetadata.js"; /** * This class implements the cache storage interface for MSAL through browser local or session storage. @@ -123,6 +124,29 @@ export class BrowserCacheManager extends CacheManager { async initialize(correlationId: string): Promise { await this.browserStorage.initialize(correlationId); + this.trackVersionChanges(correlationId); + } + + /** + * Tracks upgrades and downgrades for telemetry and debugging purposes + */ + private trackVersionChanges(correlationId: string): void { + const previousVersion = this.browserStorage.getItem( + StaticCacheKeys.VERSION + ); + if (previousVersion) { + this.logger.info( + `MSAL.js was last initialized by version: ${previousVersion}` + ); + this.performanceClient.addFields( + { previousLibraryVersion: previousVersion }, + correlationId + ); + } + + if (previousVersion !== version) { + this.browserStorage.setItem(StaticCacheKeys.VERSION, version); + } } /** diff --git a/lib/msal-browser/src/utils/BrowserConstants.ts b/lib/msal-browser/src/utils/BrowserConstants.ts index 750c5318fc..ca2b1fb772 100644 --- a/lib/msal-browser/src/utils/BrowserConstants.ts +++ b/lib/msal-browser/src/utils/BrowserConstants.ts @@ -103,6 +103,7 @@ export type TemporaryCacheKeys = export const StaticCacheKeys = { ACCOUNT_KEYS: "msal.account.keys", TOKEN_KEYS: "msal.token.keys", + VERSION: "msal.version", } as const; export type StaticCacheKeys = (typeof StaticCacheKeys)[keyof typeof StaticCacheKeys]; diff --git a/lib/msal-browser/test/app/PublicClientApplication.spec.ts b/lib/msal-browser/test/app/PublicClientApplication.spec.ts index 8e889e5b9f..c7d30b8c65 100644 --- a/lib/msal-browser/test/app/PublicClientApplication.spec.ts +++ b/lib/msal-browser/test/app/PublicClientApplication.spec.ts @@ -30,7 +30,6 @@ import { CacheHelpers, CacheManager, ClientAuthErrorCodes, - CommonAuthorizationCodeRequest, CommonAuthorizationUrlRequest, CommonSilentFlowRequest, Constants, @@ -60,6 +59,7 @@ import { BrowserConstants, CacheLookupPolicy, InteractionType, + StaticCacheKeys, PlatformAuthConstants, TemporaryCacheKeys, WrapperSKU, @@ -76,7 +76,6 @@ import { NavigationOptions } from "../../src/navigation/NavigationOptions.js"; import { EventMessage } from "../../src/event/EventMessage.js"; import { EventHandler } from "../../src/event/EventHandler.js"; import { SilentIframeClient } from "../../src/interaction_client/SilentIframeClient.js"; -import { base64Encode } from "../../src/encode/Base64Encode.js"; import { FetchClient } from "../../src/network/FetchClient.js"; import { BrowserAuthError, @@ -89,10 +88,6 @@ import { RedirectClient } from "../../src/interaction_client/RedirectClient.js"; import { PopupClient } from "../../src/interaction_client/PopupClient.js"; import { SilentCacheClient } from "../../src/interaction_client/SilentCacheClient.js"; import { SilentRefreshClient } from "../../src/interaction_client/SilentRefreshClient.js"; -import { - AuthorizationCodeRequest, - EndSessionRequest, -} from "../../src/index.js"; import { SilentAuthCodeClient } from "../../src/interaction_client/SilentAuthCodeClient.js"; import { BrowserCacheManager } from "../../src/cache/BrowserCacheManager.js"; import { PlatformAuthExtensionHandler } from "../../src/broker/nativeBroker/PlatformAuthExtensionHandler.js"; @@ -117,6 +112,9 @@ import { TestTimeUtils, } from "msal-test-utils"; import { INTERACTION_TYPE } from "../../src/utils/BrowserConstants.js"; +import { version } from "../../src/packageMetadata.js"; +import { AuthorizationCodeRequest } from "../../src/request/AuthorizationCodeRequest.js"; +import { EndSessionRequest } from "../../src/request/EndSessionRequest.js"; import { BaseOperatingContext } from "../../src/operatingcontext/BaseOperatingContext.js"; import { PlatformAuthDOMHandler } from "../../src/broker/nativeBroker/PlatformAuthDOMHandler.js"; import { config } from "process"; @@ -832,7 +830,10 @@ describe("PublicClientApplication.ts Class Unit Tests", () => { pca.handleRedirectPromise().catch((e) => { expect(e).toMatchObject(testError); expect(window.localStorage.length).toEqual(0); - expect(window.sessionStorage.length).toEqual(0); + expect(window.sessionStorage.length).toEqual(1); + expect( + window.sessionStorage.getItem(StaticCacheKeys.VERSION) + ).toEqual(version); // Validate that the one item in sessionStorage is what we expect done(); }); }); @@ -2104,7 +2105,10 @@ describe("PublicClientApplication.ts Class Unit Tests", () => { expect(redirectClientSpy).toHaveBeenCalledTimes(1); expect(browserStorage.isInteractionInProgress()).toBe(false); expect(window.localStorage.length).toBe(0); - expect(window.sessionStorage.length).toBe(0); + expect(window.sessionStorage.length).toBe(1); + expect( + window.sessionStorage.getItem(StaticCacheKeys.VERSION) + ).toEqual(version); // Validate that the one item in sessionStorage is what we expect done(); }); }); @@ -5480,7 +5484,10 @@ describe("PublicClientApplication.ts Class Unit Tests", () => { }); } catch (e) { // Test that error was cached for telemetry purposes and then thrown - expect(window.sessionStorage).toHaveLength(1); + expect(window.sessionStorage).toHaveLength(2); + expect( + window.sessionStorage.getItem(StaticCacheKeys.VERSION) + ).toEqual(version); const failures = window.sessionStorage.getItem( `server-telemetry-${TEST_CONFIG.MSAL_CLIENT_ID}` ); @@ -5536,7 +5543,10 @@ describe("PublicClientApplication.ts Class Unit Tests", () => { await silentRequest3.catch(() => {}); // Test that error was cached for telemetry purposes and then thrown expect(atsSpy).toHaveBeenCalledTimes(1); - expect(window.sessionStorage).toHaveLength(1); + expect(window.sessionStorage).toHaveLength(2); + expect( + window.sessionStorage.getItem(StaticCacheKeys.VERSION) + ).toEqual(version); const failures = window.sessionStorage.getItem( `server-telemetry-${TEST_CONFIG.MSAL_CLIENT_ID}` ); diff --git a/lib/msal-browser/test/cache/BrowserCacheManager.spec.ts b/lib/msal-browser/test/cache/BrowserCacheManager.spec.ts index 9c9355ef23..6ba0daed97 100644 --- a/lib/msal-browser/test/cache/BrowserCacheManager.spec.ts +++ b/lib/msal-browser/test/cache/BrowserCacheManager.spec.ts @@ -16,9 +16,7 @@ import { import { CacheOptions } from "../../src/config/Configuration.js"; import { Constants, - PersistentCacheKeys, CommonAuthorizationCodeRequest as AuthorizationCodeRequest, - ProtocolUtils, Logger, LogLevel, AuthenticationScheme, @@ -41,18 +39,18 @@ import { import { BrowserCacheLocation, INTERACTION_TYPE, - InteractionType, + StaticCacheKeys, TemporaryCacheKeys, } from "../../src/utils/BrowserConstants.js"; import { CryptoOps } from "../../src/crypto/CryptoOps.js"; import { DatabaseStorage } from "../../src/cache/DatabaseStorage.js"; import { BrowserCacheManager } from "../../src/cache/BrowserCacheManager.js"; -import { BrowserStateObject } from "../../src/utils/BrowserProtocolUtils.js"; import { base64Decode } from "../../src/encode/Base64Decode.js"; import { getDefaultPerformanceClient } from "../utils/TelemetryUtils.js"; import { BrowserPerformanceClient } from "../../src/telemetry/BrowserPerformanceClient.js"; import { CookieStorage } from "../../src/cache/CookieStorage.js"; import { EventHandler } from "../../src/event/EventHandler.js"; +import { version } from "../../src/packageMetadata.js"; describe("BrowserCacheManager tests", () => { let cacheConfig: Required; @@ -140,6 +138,85 @@ describe("BrowserCacheManager tests", () => { }); }); + describe("initialize", () => { + it("sets MSAL version in localStorage if not already set", async () => { + const browserCacheManager = new BrowserCacheManager( + TEST_CONFIG.MSAL_CLIENT_ID, + { + ...cacheConfig, + cacheLocation: BrowserCacheLocation.LocalStorage, + }, + browserCrypto, + logger, + new StubPerformanceClient(), + new EventHandler() + ); + await browserCacheManager.initialize(TEST_CONFIG.CORRELATION_ID); + expect(window.localStorage.getItem(StaticCacheKeys.VERSION)).toBe( + version + ); + }); + + it("sets MSAL version in localStorage if previous version doesn't match", async () => { + window.localStorage.setItem(StaticCacheKeys.VERSION, "1.0.0"); + const browserCacheManager = new BrowserCacheManager( + TEST_CONFIG.MSAL_CLIENT_ID, + { + ...cacheConfig, + cacheLocation: BrowserCacheLocation.LocalStorage, + }, + browserCrypto, + logger, + new StubPerformanceClient(), + new EventHandler() + ); + await browserCacheManager.initialize(TEST_CONFIG.CORRELATION_ID); + expect(window.localStorage.getItem(StaticCacheKeys.VERSION)).toBe( + version + ); + }); + + it("does not set MSAL version in localStorage if existing version already matches", async () => { + // First make sure the version gets set + const browserCacheManager1 = new BrowserCacheManager( + TEST_CONFIG.MSAL_CLIENT_ID, + { + ...cacheConfig, + cacheLocation: BrowserCacheLocation.LocalStorage, + }, + browserCrypto, + logger, + new StubPerformanceClient(), + new EventHandler() + ); + await browserCacheManager1.initialize(TEST_CONFIG.CORRELATION_ID); + expect(window.localStorage.getItem(StaticCacheKeys.VERSION)).toBe( + version + ); + + const setSpy = jest.spyOn(Storage.prototype, "setItem"); + const browserCacheManager2 = new BrowserCacheManager( + TEST_CONFIG.MSAL_CLIENT_ID, + { + ...cacheConfig, + cacheLocation: BrowserCacheLocation.LocalStorage, + }, + browserCrypto, + logger, + new StubPerformanceClient(), + new EventHandler() + ); + await browserCacheManager2.initialize(TEST_CONFIG.CORRELATION_ID); + expect(window.localStorage.getItem(StaticCacheKeys.VERSION)).toBe( + version + ); + expect(setSpy).not.toHaveBeenCalledWith( + StaticCacheKeys.VERSION, + expect.anything() + ); + }); + }); + describe("Interface functions", () => { let browserSessionStorage: BrowserCacheManager; let authority: Authority; @@ -251,6 +328,7 @@ describe("BrowserCacheManager tests", () => { expect(browserLocalStorage.getKeys()).toEqual([ "msal.account.keys", `msal.token.keys.${TEST_CONFIG.MSAL_CLIENT_ID}`, + StaticCacheKeys.VERSION, msalCacheKey, msalCacheKey2, ]); diff --git a/lib/msal-browser/test/interaction_client/PopupClient.spec.ts b/lib/msal-browser/test/interaction_client/PopupClient.spec.ts index d149ce07f5..f91d78b419 100644 --- a/lib/msal-browser/test/interaction_client/PopupClient.spec.ts +++ b/lib/msal-browser/test/interaction_client/PopupClient.spec.ts @@ -43,6 +43,7 @@ import { TemporaryCacheKeys, ApiId, BrowserConstants, + StaticCacheKeys, } from "../../src/utils/BrowserConstants.js"; import * as BrowserCrypto from "../../src/crypto/BrowserCrypto.js"; import * as PkceGenerator from "../../src/crypto/PkceGenerator.js"; @@ -66,6 +67,7 @@ import * as BrowserUtils from "../../src/utils/BrowserUtils.js"; import { FetchClient } from "../../src/network/FetchClient.js"; import { TestTimeUtils } from "msal-test-utils"; import { PopupRequest } from "../../src/request/PopupRequest.js"; +import { version } from "../../src/packageMetadata.js"; const testPopupWondowDefaults = { height: BrowserConstants.POPUP_HEIGHT, @@ -814,7 +816,10 @@ describe("PopupClient", () => { }); } catch (e) { // Test that error was cached for telemetry purposes and then thrown - expect(window.sessionStorage).toHaveLength(1); + expect(window.sessionStorage).toHaveLength(2); + expect( + window.sessionStorage.getItem(StaticCacheKeys.VERSION) + ).toEqual(version); const failures = window.sessionStorage.getItem( `server-telemetry-${TEST_CONFIG.MSAL_CLIENT_ID}` ); diff --git a/lib/msal-browser/test/interaction_client/RedirectClient.spec.ts b/lib/msal-browser/test/interaction_client/RedirectClient.spec.ts index e4b240beae..62811be193 100644 --- a/lib/msal-browser/test/interaction_client/RedirectClient.spec.ts +++ b/lib/msal-browser/test/interaction_client/RedirectClient.spec.ts @@ -57,6 +57,7 @@ import { ApiId, BrowserCacheLocation, InteractionType, + StaticCacheKeys, } from "../../src/utils/BrowserConstants.js"; import { base64Encode } from "../../src/encode/Base64Encode.js"; import { FetchClient } from "../../src/network/FetchClient.js"; @@ -87,6 +88,7 @@ import { TestTimeUtils, } from "msal-test-utils"; import { BrowserPerformanceClient } from "../../src/telemetry/BrowserPerformanceClient.js"; +import { version } from "../../src/packageMetadata.js"; const cacheConfig = { cacheLocation: BrowserCacheLocation.SessionStorage, @@ -205,7 +207,10 @@ describe("RedirectClient", () => { .then((response) => { expect(response).toBe(null); expect(window.localStorage.length).toEqual(0); - expect(window.sessionStorage.length).toEqual(0); + expect(window.sessionStorage.length).toEqual(1); + expect( + window.sessionStorage.getItem(StaticCacheKeys.VERSION) + ).toEqual(version); // Validate that the one item in sessionStorage is what we expect done(); }); }); @@ -223,7 +228,10 @@ describe("RedirectClient", () => { .then((response) => { expect(response).toBe(null); expect(window.localStorage.length).toEqual(0); - expect(window.sessionStorage.length).toEqual(0); + expect(window.sessionStorage.length).toEqual(1); + expect( + window.sessionStorage.getItem(StaticCacheKeys.VERSION) + ).toEqual(version); // Validate that the one item in sessionStorage is what we expect done(); }); }); @@ -241,7 +249,10 @@ describe("RedirectClient", () => { .then((response) => { expect(response).toBe(null); expect(window.localStorage.length).toEqual(0); - expect(window.sessionStorage.length).toEqual(0); + expect(window.sessionStorage.length).toEqual(1); + expect( + window.sessionStorage.getItem(StaticCacheKeys.VERSION) + ).toEqual(version); // Validate that the one item in sessionStorage is what we expect expect(window.location.hash).toEqual( TEST_HASHES.TEST_SUCCESS_CODE_HASH_POPUP ); diff --git a/lib/msal-common/apiReview/msal-common.api.md b/lib/msal-common/apiReview/msal-common.api.md index 1266452976..550ba3a03f 100644 --- a/lib/msal-common/apiReview/msal-common.api.md +++ b/lib/msal-common/apiReview/msal-common.api.md @@ -3369,6 +3369,7 @@ export type PerformanceEvent = { serverErrorNo?: string; libraryName: string; libraryVersion: string; + previousLibraryVersion?: string; isNativeBroker?: boolean; requestId?: string; cacheLookupPolicy?: number | undefined; @@ -4675,44 +4676,44 @@ const X_MS_LIB_CAPABILITY = "x-ms-lib-capability"; // src/telemetry/performance/PerformanceEvent.ts:702:21 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag // src/telemetry/performance/PerformanceEvent.ts:702:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" // src/telemetry/performance/PerformanceEvent.ts:702:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration -// src/telemetry/performance/PerformanceEvent.ts:709:23 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceEvent.ts:709:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" -// src/telemetry/performance/PerformanceEvent.ts:709:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration -// src/telemetry/performance/PerformanceEvent.ts:716:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceEvent.ts:716:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" -// src/telemetry/performance/PerformanceEvent.ts:716:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration -// src/telemetry/performance/PerformanceEvent.ts:723:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceEvent.ts:723:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" -// src/telemetry/performance/PerformanceEvent.ts:723:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration -// src/telemetry/performance/PerformanceEvent.ts:729:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceEvent.ts:729:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" -// src/telemetry/performance/PerformanceEvent.ts:729:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration -// src/telemetry/performance/PerformanceEvent.ts:736:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceEvent.ts:736:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" -// src/telemetry/performance/PerformanceEvent.ts:736:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration -// src/telemetry/performance/PerformanceEvent.ts:755:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceEvent.ts:755:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" -// src/telemetry/performance/PerformanceEvent.ts:755:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration -// src/telemetry/performance/PerformanceEvent.ts:761:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceEvent.ts:761:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" -// src/telemetry/performance/PerformanceEvent.ts:761:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration -// src/telemetry/performance/PerformanceEvent.ts:768:21 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceEvent.ts:768:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" -// src/telemetry/performance/PerformanceEvent.ts:768:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration -// src/telemetry/performance/PerformanceEvent.ts:776:21 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceEvent.ts:776:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" -// src/telemetry/performance/PerformanceEvent.ts:776:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration -// src/telemetry/performance/PerformanceEvent.ts:785:21 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceEvent.ts:785:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" -// src/telemetry/performance/PerformanceEvent.ts:785:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration -// src/telemetry/performance/PerformanceEvent.ts:793:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceEvent.ts:793:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" -// src/telemetry/performance/PerformanceEvent.ts:793:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration -// src/telemetry/performance/PerformanceEvent.ts:800:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceEvent.ts:800:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" -// src/telemetry/performance/PerformanceEvent.ts:800:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration -// src/telemetry/performance/PerformanceEvent.ts:870:21 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceEvent.ts:870:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" -// src/telemetry/performance/PerformanceEvent.ts:870:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration +// src/telemetry/performance/PerformanceEvent.ts:714:23 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceEvent.ts:714:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceEvent.ts:714:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration +// src/telemetry/performance/PerformanceEvent.ts:721:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceEvent.ts:721:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceEvent.ts:721:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration +// src/telemetry/performance/PerformanceEvent.ts:728:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceEvent.ts:728:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceEvent.ts:728:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration +// src/telemetry/performance/PerformanceEvent.ts:734:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceEvent.ts:734:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceEvent.ts:734:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration +// src/telemetry/performance/PerformanceEvent.ts:741:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceEvent.ts:741:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceEvent.ts:741:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration +// src/telemetry/performance/PerformanceEvent.ts:760:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceEvent.ts:760:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceEvent.ts:760:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration +// src/telemetry/performance/PerformanceEvent.ts:766:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceEvent.ts:766:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceEvent.ts:766:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration +// src/telemetry/performance/PerformanceEvent.ts:773:21 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceEvent.ts:773:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceEvent.ts:773:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration +// src/telemetry/performance/PerformanceEvent.ts:781:21 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceEvent.ts:781:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceEvent.ts:781:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration +// src/telemetry/performance/PerformanceEvent.ts:790:21 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceEvent.ts:790:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceEvent.ts:790:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration +// src/telemetry/performance/PerformanceEvent.ts:798:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceEvent.ts:798:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceEvent.ts:798:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration +// src/telemetry/performance/PerformanceEvent.ts:805:22 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceEvent.ts:805:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceEvent.ts:805:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration +// src/telemetry/performance/PerformanceEvent.ts:875:21 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceEvent.ts:875:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceEvent.ts:875:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration ``` diff --git a/lib/msal-common/src/telemetry/performance/PerformanceEvent.ts b/lib/msal-common/src/telemetry/performance/PerformanceEvent.ts index b2fa072096..da632d012b 100644 --- a/lib/msal-common/src/telemetry/performance/PerformanceEvent.ts +++ b/lib/msal-common/src/telemetry/performance/PerformanceEvent.ts @@ -703,6 +703,11 @@ export type PerformanceEvent = { */ libraryVersion: string; + /** + * Version of the library used last. Used to track upgrades and downgrades + */ + previousLibraryVersion?: string; + /** * Whether the response is from a native component (e.g., WAM) * diff --git a/samples/msal-browser-samples/VanillaJSTestApp2.0/app/customizable-e2e-test/test/localStorage.spec.ts b/samples/msal-browser-samples/VanillaJSTestApp2.0/app/customizable-e2e-test/test/localStorage.spec.ts index d2f74fcef1..8061c1ba68 100644 --- a/samples/msal-browser-samples/VanillaJSTestApp2.0/app/customizable-e2e-test/test/localStorage.spec.ts +++ b/samples/msal-browser-samples/VanillaJSTestApp2.0/app/customizable-e2e-test/test/localStorage.spec.ts @@ -125,9 +125,9 @@ describe("LocalStorage Tests", function () { const sessionStorage = await sessionBrowserStorage.getWindowStorage(); const localStorage = await BrowserCache.getWindowStorage(); - expect(Object.keys(localStorage).length).toBeLessThanOrEqual(2); + expect(Object.keys(localStorage).length).toBeLessThanOrEqual(3); Object.keys(localStorage).forEach((key) => { - expect(key.startsWith("msal.token.keys") || key === "msal.account.keys").toBe(true); + expect(key.startsWith("msal.token.keys") || key === "msal.account.keys" || key == "msal.version").toBe(true); }); expect(Object.keys(sessionStorage).length).toEqual(0); }, ONE_SECOND_IN_MS); @@ -180,7 +180,7 @@ describe("LocalStorage Tests", function () { const sessionStorage = await sessionBrowserStorage.getWindowStorage(); const localStorage = await BrowserCache.getWindowStorage(); - expect(Object.keys(localStorage).length).toEqual(1); // Telemetry + expect(Object.keys(localStorage).length).toEqual(2); // Telemetry expect(Object.keys(sessionStorage).length).toEqual(0); }, ONE_SECOND_IN_MS); });