[SDK] Migrate the repo writes cluster (#11379)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-13 22:26:20 +03:00
committed by GitHub
parent ca226f589d
commit 75e4180800
22 changed files with 488 additions and 399 deletions
@@ -1,15 +1,22 @@
import {type AppBskyActorGetProfile} from '@atproto/api'
import {
type AtIdentifierString,
type DidString,
type HandleString,
toDatetimeString,
} from '@atproto/syntax'
import {useMutation} from '@tanstack/react-query'
import {until} from '#/lib/async/until'
import {useUpdateProfileVerificationCache} from '#/state/queries/verification/useUpdateProfileVerificationCache'
import {useAgent, useSession} from '#/state/session'
import {useAppviewClient, usePdsClient, useSession} from '#/state/session'
import {useAnalytics} from '#/analytics'
import {app} from '#/lexicons'
import type * as bsky from '#/types/bsky'
export function useVerificationCreateMutation() {
const ax = useAnalytics()
const agent = useAgent()
const appviewClient = useAppviewClient()
const pdsClient = usePdsClient()
const {currentAccount} = useSession()
const updateProfileVerificationCache = useUpdateProfileVerificationCache()
@@ -19,20 +26,18 @@ export function useVerificationCreateMutation() {
throw new Error('User not logged in')
}
const {uri} = await agent.app.bsky.graph.verification.create(
{repo: currentAccount.did},
{
subject: profile.did,
createdAt: new Date().toISOString(),
handle: profile.handle,
displayName: profile.displayName || '',
},
)
const {uri} = await pdsClient.create(app.bsky.graph.verification, {
// the profile view is still legacy-typed, so its strings are unbranded
subject: profile.did as DidString,
createdAt: toDatetimeString(new Date()),
handle: profile.handle as HandleString,
displayName: profile.displayName || '',
})
await until(
5,
1e3,
({data: profile}: AppBskyActorGetProfile.Response) => {
(profile: app.bsky.actor.getProfile.$OutputBody) => {
if (
profile.verification &&
profile.verification.verifications.find(v => v.uri === uri)
@@ -42,7 +47,9 @@ export function useVerificationCreateMutation() {
return false
},
() => {
return agent.getProfile({actor: profile.did ?? ''})
return appviewClient.call(app.bsky.actor.getProfile, {
actor: (profile.did ?? '') as AtIdentifierString,
})
},
)
},