[SDK] Validate and brand the persisted account did (#11387)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-13 22:26:22 +03:00
committed by GitHub
parent 9fe0084874
commit 3677c98873
46 changed files with 154 additions and 205 deletions
@@ -1,5 +1,5 @@
import {type $Typed} from '@atproto/lex'
import {AtUri} from '@atproto/syntax'
import {AtUri, toDatetimeString} from '@atproto/syntax'
import {
type InfiniteData,
type QueryClient,
@@ -71,19 +71,14 @@ export async function optimisticallySaveBookmark(
pages: data.pages.map((page, index) => {
if (index === 0) {
post.$type = 'app.bsky.feed.defs#postView'
/*
* The optimistic entry is synthesized with unbranded string
* fields, so it is asserted to the generated view type the query
* data is keyed on.
*/
const bookmark = {
createdAt: new Date().toISOString(),
const bookmark: app.bsky.bookmark.defs.BookmarkView = {
createdAt: toDatetimeString(new Date()),
subject: {
uri: post.uri,
cid: post.cid,
},
item: post as $Typed<app.bsky.feed.defs.PostView>,
} as unknown as app.bsky.bookmark.defs.BookmarkView
}
return {
...page,
bookmarks: [bookmark, ...page.bookmarks],