Better lifecycle handling (#242758)

I moved to a factory model because there was just so much that needed to be async.

I think the amount of async code will be reduced in the future as we remove some migration logic, but this makes sure we don't accidentally create instances without awaiting their initialization.
This commit is contained in:
Tyler James Leonhardt
2025-03-05 17:50:14 -08:00
committed by GitHub
parent 0664c2e142
commit eab6f90c72
7 changed files with 137 additions and 57 deletions

View File

@@ -5,8 +5,7 @@
import type { AccountInfo, AuthenticationResult, InteractiveRequest, RefreshTokenRequest, SilentFlowRequest } from '@azure/msal-node';
import type { Disposable, Event } from 'vscode';
export interface ICachedPublicClientApplication extends Disposable {
initialize(): Promise<void>;
export interface ICachedPublicClientApplication {
onDidAccountsChange: Event<{ added: AccountInfo[]; changed: AccountInfo[]; deleted: AccountInfo[] }>;
onDidRemoveLastAccount: Event<void>;
acquireTokenSilent(request: SilentFlowRequest): Promise<AuthenticationResult>;