fix: close competition cutover integrity gaps

This commit is contained in:
dahyeon committed 2026-07-12 21:22:22 +00:00
1 parent 7ea2002975
commit 683d602d63
57 files changed
+4805 -1582

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
export interface AuthQueryScopeInput {
authUserId: string | null;
accountKey: string | null;
msalConfigured: boolean;
msalReady: boolean;
}
interface ExecuteAuthScopedQueryInput<T> {
accountKey: string | null;
acquireAccessToken: () => Promise<string>;
request: (authorizationHeader: string | null) => Promise<T>;
}
export function resolveAuthQueryScope({
authUserId,
accountKey,
msalConfigured,
msalReady,
}: AuthQueryScopeInput) {
return {
cacheKey: [authUserId, accountKey] as const,
ready: Boolean(authUserId || !msalConfigured || msalReady),
};
}
export async function executeAuthScopedQuery<T>({
accountKey,
acquireAccessToken,
request,
}: ExecuteAuthScopedQueryInput<T>): Promise<T> {
if (!accountKey) return request(null);
const accessToken = await acquireAccessToken();
return request(`Bearer ${accessToken}`);
}