@@ -27,16 +27,17 @@ interface AccountInsertData {
2727
2828/**
2929 * Resolves a credential ID to its underlying account ID.
30- * If `credentialId` matches a `credential` row, returns its `accountId`.
30+ * If `credentialId` matches a `credential` row, returns its `accountId` and `workspaceId` .
3131 * Otherwise assumes `credentialId` is already a raw `account.id` (legacy).
3232 */
3333export async function resolveOAuthAccountId (
3434 credentialId : string
35- ) : Promise < { accountId : string ; usedCredentialTable : boolean } | null > {
35+ ) : Promise < { accountId : string ; workspaceId ?: string ; usedCredentialTable : boolean } | null > {
3636 const [ credentialRow ] = await db
3737 . select ( {
3838 type : credential . type ,
3939 accountId : credential . accountId ,
40+ workspaceId : credential . workspaceId ,
4041 } )
4142 . from ( credential )
4243 . where ( eq ( credential . id , credentialId ) )
@@ -46,7 +47,11 @@ export async function resolveOAuthAccountId(
4647 if ( credentialRow . type !== 'oauth' || ! credentialRow . accountId ) {
4748 return null
4849 }
49- return { accountId : credentialRow . accountId , usedCredentialTable : true }
50+ return {
51+ accountId : credentialRow . accountId ,
52+ workspaceId : credentialRow . workspaceId ,
53+ usedCredentialTable : true ,
54+ }
5055 }
5156
5257 return { accountId : credentialId , usedCredentialTable : false }
0 commit comments