[SDK] Remove @atproto/api (#11386)

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 54da80dfb0
commit 9fe0084874
391 changed files with 3130 additions and 3589 deletions
+2 -15
View File
@@ -7,7 +7,6 @@
jest.unmock('multiformats/cid')
jest.unmock('multiformats/hashes/hasher')
import {BlobRef} from '@atproto/api'
import {CID} from 'multiformats/cid'
import {computeCid} from '#/lib/api/computeCid'
@@ -67,8 +66,8 @@ describe('computeCid', () => {
* `{$type: 'blob', ref, mimeType, size}` with `ref` a parsed CID. The
* structural lex-blob guard passes it through `prepareForHashing`
* untouched and DAG-CBOR encodes its CID `ref` as a CID link. The golden
* CID below is the byte-identical value the pre-migration `BlobRef` class
* instance produced via `.ipld()`.
* CID below is the byte-identical value the pre-migration legacy blob
* class instance produced via `.ipld()`.
*/
const blob = {
$type: 'blob' as const,
@@ -81,18 +80,6 @@ describe('computeCid', () => {
)
})
it('case 2b: a legacy BlobRef instance hashes to the same CID', async () => {
/*
* The video pipeline still yields legacy `BlobRef` class instances, so
* `prepareForHashing` keeps its `instanceof` guard. Both branches must
* agree: this asserts the SAME golden CID as case 2.
*/
const blob = new BlobRef(CID.parse(BLOB_CID), 'image/jpeg', 12345)
expect(await computeCid(postWithImageBlob(blob))).toBe(
'bafyreiem7g6vja66nebr7he4fshfnlyndyldbvle2n265oixscmepjcbii',
)
})
it('case 3: three-post thread chains reply StrongRef CIDs', async () => {
const did = 'did:plc:abc123'
const base = new Date('2024-01-01T00:00:00.000Z')
-12
View File
@@ -1,4 +1,3 @@
import {BlobRef} from '@atproto/api'
import {sha256} from 'js-sha256'
import {CID} from 'multiformats/cid'
import * as Hasher from 'multiformats/hashes/hasher'
@@ -73,17 +72,6 @@ function prepareForHashing(v: any): any {
return v
}
/*
* The video pipeline still reads its blob off the legacy agent
* (`app.bsky.video.getJobStatus` in composer `state/video`), which yields a
* `BlobRef` class instance. `ipld()` gives the same IPLD shape a lex blob
* already has, so both branches hash identically. Drop this guard once the
* video client is migrated.
*/
if (v instanceof BlobRef) {
return v.ipld()
}
// Walk through arrays
if (Array.isArray(v)) {
let pure = true
+41 -45
View File
@@ -1,17 +1,10 @@
import {
type AppBskyActorDefs,
AppBskyEmbedRecord,
AppBskyEmbedRecordWithMedia,
AppBskyFeedDefs,
AppBskyFeedPost,
} from '@atproto/api'
import {app} from '#/lexicons'
import * as bsky from '#/types/bsky'
import {isPostInLanguage} from '../../locale/helpers'
import {FALLBACK_MARKER_POST} from './feed/home'
import {type ReasonFeedSource} from './feed/types'
type FeedViewPost = AppBskyFeedDefs.FeedViewPost
type FeedViewPost = app.bsky.feed.defs.FeedViewPost
export type FeedTunerFn = (
tuner: FeedTuner,
@@ -20,18 +13,18 @@ export type FeedTunerFn = (
) => FeedViewPostsSlice[]
type FeedSliceItem = {
post: AppBskyFeedDefs.PostView
record: AppBskyFeedPost.Record
parentAuthor: AppBskyActorDefs.ProfileViewBasic | undefined
post: app.bsky.feed.defs.PostView
record: app.bsky.feed.post.Main
parentAuthor: app.bsky.actor.defs.ProfileViewBasic | undefined
isParentBlocked: boolean
isParentNotFound: boolean
}
type AuthorContext = {
author: AppBskyActorDefs.ProfileViewBasic
parentAuthor: AppBskyActorDefs.ProfileViewBasic | undefined
grandparentAuthor: AppBskyActorDefs.ProfileViewBasic | undefined
rootAuthor: AppBskyActorDefs.ProfileViewBasic | undefined
author: app.bsky.actor.defs.ProfileViewBasic
parentAuthor: app.bsky.actor.defs.ProfileViewBasic | undefined
grandparentAuthor: app.bsky.actor.defs.ProfileViewBasic | undefined
rootAuthor: app.bsky.actor.defs.ProfileViewBasic | undefined
}
export class FeedViewPostsSlice {
@@ -53,7 +46,7 @@ export class FeedViewPostsSlice {
this.isOrphan = false
this.isThreadMuted = post.viewer?.threadMuted ?? false
this.feedPostUri = post.uri
if (AppBskyFeedDefs.isPostView(reply?.root)) {
if (bsky.isType(app.bsky.feed.defs.postView, reply?.root)) {
this.rootUri = reply.root.uri
} else {
this.rootUri = post.uri
@@ -69,16 +62,19 @@ export class FeedViewPostsSlice {
return
}
if (
!AppBskyFeedPost.isRecord(post.record) ||
!bsky.validate(post.record, AppBskyFeedPost.validateRecord)
!bsky.isType(app.bsky.feed.post, post.record) ||
!bsky.matches(app.bsky.feed.post, post.record)
) {
return
}
const parent = reply?.parent
const isParentBlocked = AppBskyFeedDefs.isBlockedPost(parent)
const isParentNotFound = AppBskyFeedDefs.isNotFoundPost(parent)
let parentAuthor: AppBskyActorDefs.ProfileViewBasic | undefined
if (AppBskyFeedDefs.isPostView(parent)) {
const isParentBlocked = bsky.isType(app.bsky.feed.defs.blockedPost, parent)
const isParentNotFound = bsky.isType(
app.bsky.feed.defs.notFoundPost,
parent,
)
let parentAuthor: app.bsky.actor.defs.ProfileViewBasic | undefined
if (bsky.isType(app.bsky.feed.defs.postView, parent)) {
parentAuthor = parent.author
}
this.items.push({
@@ -100,18 +96,18 @@ export class FeedViewPostsSlice {
return
}
if (
!AppBskyFeedDefs.isPostView(parent) ||
!AppBskyFeedPost.isRecord(parent.record) ||
!bsky.validate(parent.record, AppBskyFeedPost.validateRecord)
!bsky.isType(app.bsky.feed.defs.postView, parent) ||
!bsky.isType(app.bsky.feed.post, parent.record) ||
!bsky.matches(app.bsky.feed.post, parent.record)
) {
this.isOrphan = true
return
}
const root = reply.root
const rootIsView =
AppBskyFeedDefs.isPostView(root) ||
AppBskyFeedDefs.isBlockedPost(root) ||
AppBskyFeedDefs.isNotFoundPost(root)
bsky.isType(app.bsky.feed.defs.postView, root) ||
bsky.isType(app.bsky.feed.defs.blockedPost, root) ||
bsky.isType(app.bsky.feed.defs.notFoundPost, root)
/*
* If the parent is also the root, we just so happen to have the data we
* need to compute if the parent's parent (grandparent) is blocked. This
@@ -124,10 +120,10 @@ export class FeedViewPostsSlice {
: undefined
const grandparentAuthor = reply.grandparentAuthor
const isGrandparentBlocked = Boolean(
grandparent && AppBskyFeedDefs.isBlockedPost(grandparent),
grandparent && bsky.isType(app.bsky.feed.defs.blockedPost, grandparent),
)
const isGrandparentNotFound = Boolean(
grandparent && AppBskyFeedDefs.isNotFoundPost(grandparent),
grandparent && bsky.isType(app.bsky.feed.defs.notFoundPost, grandparent),
)
this.items.unshift({
post: parent,
@@ -142,9 +138,9 @@ export class FeedViewPostsSlice {
// de-deduping
}
if (
!AppBskyFeedDefs.isPostView(root) ||
!AppBskyFeedPost.isRecord(root.record) ||
!bsky.validate(root.record, AppBskyFeedPost.validateRecord)
!bsky.isType(app.bsky.feed.defs.postView, root) ||
!bsky.isType(app.bsky.feed.post, root.record) ||
!bsky.matches(app.bsky.feed.post, root.record)
) {
this.isOrphan = true
return
@@ -167,14 +163,14 @@ export class FeedViewPostsSlice {
get isQuotePost() {
const embed = this._feedPost.post.embed
return (
AppBskyEmbedRecord.isView(embed) ||
AppBskyEmbedRecordWithMedia.isView(embed)
bsky.isType(app.bsky.embed.record.view, embed) ||
bsky.isType(app.bsky.embed.recordWithMedia.view, embed)
)
}
get isReply() {
return (
AppBskyFeedPost.isRecord(this._feedPost.post.record) &&
bsky.isType(app.bsky.feed.post, this._feedPost.post.record) &&
!!this._feedPost.post.record.reply
)
}
@@ -195,7 +191,7 @@ export class FeedViewPostsSlice {
get isRepost() {
const reason = this._feedPost.reason
return AppBskyFeedDefs.isReasonRepost(reason)
return bsky.isType(app.bsky.feed.defs.reasonRepost, reason)
}
get likeCount() {
@@ -208,18 +204,18 @@ export class FeedViewPostsSlice {
getAuthors(): AuthorContext {
const feedPost = this._feedPost
let author: AppBskyActorDefs.ProfileViewBasic = feedPost.post.author
let parentAuthor: AppBskyActorDefs.ProfileViewBasic | undefined
let grandparentAuthor: AppBskyActorDefs.ProfileViewBasic | undefined
let rootAuthor: AppBskyActorDefs.ProfileViewBasic | undefined
let author: app.bsky.actor.defs.ProfileViewBasic = feedPost.post.author
let parentAuthor: app.bsky.actor.defs.ProfileViewBasic | undefined
let grandparentAuthor: app.bsky.actor.defs.ProfileViewBasic | undefined
let rootAuthor: app.bsky.actor.defs.ProfileViewBasic | undefined
if (feedPost.reply) {
if (AppBskyFeedDefs.isPostView(feedPost.reply.parent)) {
if (bsky.isType(app.bsky.feed.defs.postView, feedPost.reply.parent)) {
parentAuthor = feedPost.reply.parent.author
}
if (feedPost.reply.grandparentAuthor) {
grandparentAuthor = feedPost.reply.grandparentAuthor
}
if (AppBskyFeedDefs.isPostView(feedPost.reply.root)) {
if (bsky.isType(app.bsky.feed.defs.postView, feedPost.reply.root)) {
rootAuthor = feedPost.reply.root.author
}
}
@@ -514,7 +510,7 @@ function shouldDisplayReplyInFollowing(
}
function isSelfOrFollowing(
profile: AppBskyActorDefs.ProfileViewBasic,
profile: app.bsky.actor.defs.ProfileViewBasic,
userDid: string,
) {
return Boolean(profile.did === userDid || profile.viewer?.following)
+11 -8
View File
@@ -1,7 +1,7 @@
import {AppBskyFeedDefs} from '@atproto/api'
import {type Client, type XrpcRequestParams} from '@atproto/lex'
import {app} from '#/lexicons'
import * as bsky from '#/types/bsky'
import {type FeedAPI, type FeedAPIResponse} from './types'
type GetAuthorFeedParams = XrpcRequestParams<
@@ -29,7 +29,7 @@ export class AuthorFeedAPI implements FeedAPI {
return params
}
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
async peekLatest(): Promise<app.bsky.feed.defs.FeedViewPost> {
const data = await this.client.call(app.bsky.feed.getAuthorFeed, {
...this.params,
limit: 1,
@@ -61,12 +61,15 @@ export class AuthorFeedAPI implements FeedAPI {
}
}
_filter(feed: AppBskyFeedDefs.FeedViewPost[]) {
_filter(feed: app.bsky.feed.defs.FeedViewPost[]) {
if (this.params.filter === 'posts_and_author_threads') {
return feed.filter(post => {
const isReply = post.reply
const isRepost = AppBskyFeedDefs.isReasonRepost(post.reason)
const isPin = AppBskyFeedDefs.isReasonPin(post.reason)
const isRepost = bsky.isType(
app.bsky.feed.defs.reasonRepost,
post.reason,
)
const isPin = bsky.isType(app.bsky.feed.defs.reasonPin, post.reason)
if (!isReply) return true
if (isRepost || isPin) return true
return isReply && isAuthorReplyChain(this.params.actor, post, feed)
@@ -79,15 +82,15 @@ export class AuthorFeedAPI implements FeedAPI {
function isAuthorReplyChain(
actor: string,
post: AppBskyFeedDefs.FeedViewPost,
posts: AppBskyFeedDefs.FeedViewPost[],
post: app.bsky.feed.defs.FeedViewPost,
posts: app.bsky.feed.defs.FeedViewPost[],
): boolean {
// current post is by a different user (shouldn't happen)
if (post.post.author.did !== actor) return false
const replyParent = post.reply?.parent
if (AppBskyFeedDefs.isPostView(replyParent)) {
if (bsky.isType(app.bsky.feed.defs.postView, replyParent)) {
// reply parent is by a different user
if (replyParent.author.did !== actor) return false
+4 -5
View File
@@ -1,5 +1,4 @@
import {type AppBskyFeedDefs, jsonStringToLex} from '@atproto/api'
import {Client, type XrpcRequestParams} from '@atproto/lex'
import {Client, lexParse, type XrpcRequestParams} from '@atproto/lex'
import {
getAppLanguageAsContentLanguage,
@@ -30,7 +29,7 @@ export class CustomFeedAPI implements FeedAPI {
this.userInterests = userInterests
}
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
async peekLatest(): Promise<app.bsky.feed.defs.FeedViewPost> {
const contentLangs = getContentLanguages().join(',')
const data = await this.client.call(
app.bsky.feed.getFeed,
@@ -140,7 +139,7 @@ async function loggedOutFetch({
* is asserted here just as the old-world one was.
*/
let data = res.ok
? (jsonStringToLex(await res.text()) as app.bsky.feed.getFeed.$OutputBody)
? (lexParse(await res.text()) as app.bsky.feed.getFeed.$OutputBody)
: null
if (data?.feed?.length) {
return data
@@ -154,7 +153,7 @@ async function loggedOutFetch({
{method: 'GET', headers: {'Accept-Language': '', ...labelersHeader}},
)
data = res.ok
? (jsonStringToLex(await res.text()) as app.bsky.feed.getFeed.$OutputBody)
? (lexParse(await res.text()) as app.bsky.feed.getFeed.$OutputBody)
: null
if (data?.feed?.length) {
return data
+2 -2
View File
@@ -1,7 +1,7 @@
import {type AppBskyFeedDefs} from '@atproto/api'
import {type Client} from '@atproto/lex'
import {DEMO_FEED} from '#/lib/demo'
import {type app} from '#/lexicons'
import {type FeedAPI, type FeedAPIResponse} from './types'
export class DemoFeedAPI implements FeedAPI {
@@ -11,7 +11,7 @@ export class DemoFeedAPI implements FeedAPI {
this.client = client
}
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
async peekLatest(): Promise<app.bsky.feed.defs.FeedViewPost> {
return DEMO_FEED.feed[0]
}
+1 -2
View File
@@ -1,4 +1,3 @@
import {type AppBskyFeedDefs} from '@atproto/api'
import {type Client} from '@atproto/lex'
import {app} from '#/lexicons'
@@ -11,7 +10,7 @@ export class FollowingFeedAPI implements FeedAPI {
this.client = client
}
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
async peekLatest(): Promise<app.bsky.feed.defs.FeedViewPost> {
const data = await this.client.call(app.bsky.feed.getTimeline, {
limit: 1,
})
+10 -5
View File
@@ -1,8 +1,8 @@
import {type AppBskyFeedDefs} from '@atproto/api'
import {type Client} from '@atproto/lex'
import {type AtUriString} from '@atproto/syntax'
import {PROD_DEFAULT_FEED} from '#/lib/constants'
import {type app} from '#/lexicons'
import {CustomFeedAPI} from './custom'
import {FollowingFeedAPI} from './following'
import {type FeedAPI, type FeedAPIResponse} from './types'
@@ -15,7 +15,12 @@ import {type FeedAPI, type FeedAPIResponse} from './types'
// we use this fallback marker post to drive this instead. see Feed.tsx
// for the usage.
// -prf
export const FALLBACK_MARKER_POST: AppBskyFeedDefs.FeedViewPost = {
/*
* A synthetic marker, not a real view: its `uri`/`did`/`indexedAt` are
* deliberately not well-formed, so the literal is asserted rather than branded.
* Only `post.uri` is ever read (see Feed.tsx).
*/
export const FALLBACK_MARKER_POST = {
post: {
uri: 'fallback-marker-post',
cid: 'fake',
@@ -26,7 +31,7 @@ export const FALLBACK_MARKER_POST: AppBskyFeedDefs.FeedViewPost = {
},
indexedAt: new Date().toISOString(),
},
}
} as unknown as app.bsky.feed.defs.FeedViewPost
export class HomeFeedAPI implements FeedAPI {
client: Client
@@ -63,7 +68,7 @@ export class HomeFeedAPI implements FeedAPI {
this.itemCursor = 0
}
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
async peekLatest(): Promise<app.bsky.feed.defs.FeedViewPost> {
if (this.usingDiscover) {
return this.discover.peekLatest()
}
@@ -82,7 +87,7 @@ export class HomeFeedAPI implements FeedAPI {
}
let returnCursor
let posts: AppBskyFeedDefs.FeedViewPost[] = []
let posts: app.bsky.feed.defs.FeedViewPost[] = []
if (!this.usingDiscover) {
const res = await this.following.fetch({cursor, limit})
+1 -2
View File
@@ -1,4 +1,3 @@
import {type AppBskyFeedDefs} from '@atproto/api'
import {type Client, type XrpcRequestParams} from '@atproto/lex'
import {app} from '#/lexicons'
@@ -23,7 +22,7 @@ export class LikesFeedAPI implements FeedAPI {
this.params = feedParams
}
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
async peekLatest(): Promise<app.bsky.feed.defs.FeedViewPost> {
const data = await this.client.call(app.bsky.feed.getActorLikes, {
...this.params,
limit: 1,
+1 -2
View File
@@ -1,4 +1,3 @@
import {type AppBskyFeedDefs} from '@atproto/api'
import {type Client, type XrpcRequestParams} from '@atproto/lex'
import {app} from '#/lexicons'
@@ -23,7 +22,7 @@ export class ListFeedAPI implements FeedAPI {
this.params = feedParams
}
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
async peekLatest(): Promise<app.bsky.feed.defs.FeedViewPost> {
const data = await this.client.call(app.bsky.feed.getListFeed, {
...this.params,
limit: 1,
+6 -7
View File
@@ -1,4 +1,3 @@
import {type AppBskyFeedDefs} from '@atproto/api'
import {type Client} from '@atproto/lex'
import {type AtUriString} from '@atproto/syntax'
import shuffle from 'lodash.shuffle'
@@ -28,7 +27,7 @@ const POST_AGE_CUTOFF = 60e3 * 60 * 24 // 24hours
*/
type MergeFeedPage = {
cursor?: string
feed: AppBskyFeedDefs.FeedViewPost[]
feed: app.bsky.feed.defs.FeedViewPost[]
} | null
export class MergeFeedAPI implements FeedAPI {
@@ -89,7 +88,7 @@ export class MergeFeedAPI implements FeedAPI {
}
}
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
async peekLatest(): Promise<app.bsky.feed.defs.FeedViewPost> {
const data = await this.client.call(app.bsky.feed.getTimeline, {
limit: 1,
})
@@ -136,7 +135,7 @@ export class MergeFeedAPI implements FeedAPI {
await Promise.all(promises)
// assemble a response by sampling from feeds with content
const posts: AppBskyFeedDefs.FeedViewPost[] = []
const posts: app.bsky.feed.defs.FeedViewPost[] = []
while (posts.length < limit) {
let slice = this.sampleItem()
if (slice[0]) {
@@ -188,7 +187,7 @@ class MergeFeedSource {
feedTuners: FeedTunerFn[]
sourceInfo: ReasonFeedSource | undefined
cursor: string | undefined = undefined
queue: AppBskyFeedDefs.FeedViewPost[] = []
queue: app.bsky.feed.defs.FeedViewPost[] = []
hasMore = true
constructor({
@@ -210,7 +209,7 @@ class MergeFeedSource {
return this.hasMore && this.queue.length === 0
}
take(n: number): AppBskyFeedDefs.FeedViewPost[] {
take(n: number): app.bsky.feed.defs.FeedViewPost[] {
return this.queue.splice(0, n)
}
@@ -327,7 +326,7 @@ class MergeFeedSource_Custom extends MergeFeedSource {
// some custom feeds fail to enforce the pagination limit
// so we manually truncate here
// -prf
let feed: AppBskyFeedDefs.FeedViewPost[] =
let feed: app.bsky.feed.defs.FeedViewPost[] =
limit && data.feed.length > limit
? data.feed.slice(0, limit)
: data.feed
+2 -3
View File
@@ -1,4 +1,3 @@
import {type AppBskyFeedDefs} from '@atproto/api'
import {type Client, type XrpcRequestParams} from '@atproto/lex'
import {logger} from '#/logger'
@@ -10,7 +9,7 @@ type GetPostsParams = XrpcRequestParams<typeof app.bsky.feed.getPosts.main>
export class PostListFeedAPI implements FeedAPI {
client: Client
params: GetPostsParams
peek: AppBskyFeedDefs.FeedViewPost | null = null
peek: app.bsky.feed.defs.FeedViewPost | null = null
constructor({
client,
@@ -30,7 +29,7 @@ export class PostListFeedAPI implements FeedAPI {
}
}
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
async peekLatest(): Promise<app.bsky.feed.defs.FeedViewPost> {
if (this.peek) return this.peek
throw new Error('Has not fetched yet')
}
+3 -3
View File
@@ -1,12 +1,12 @@
import {type AppBskyFeedDefs} from '@atproto/api'
import {type app} from '#/lexicons'
export interface FeedAPIResponse {
cursor?: string
feed: AppBskyFeedDefs.FeedViewPost[]
feed: app.bsky.feed.defs.FeedViewPost[]
}
export interface FeedAPI {
peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost>
peekLatest(): Promise<app.bsky.feed.defs.FeedViewPost>
fetch({
cursor,
limit,
+1 -1
View File
@@ -1,4 +1,4 @@
import {AtUri} from '@atproto/api'
import {AtUri} from '@atproto/syntax'
import {BSKY_FEED_OWNER_DIDS} from '#/lib/constants'
import {type UsePreferencesQueryResponse} from '#/state/queries/preferences'
+5 -8
View File
@@ -1,4 +1,3 @@
import {ChatBskyGroupDefs} from '@atproto/api'
import {TID} from '@atproto/common-web'
import {type $Typed, type Client} from '@atproto/lex'
import {
@@ -29,7 +28,7 @@ import {
type PostDraft,
type ThreadDraft,
} from '#/view/com/composer/state/composer'
import {app, com} from '#/lexicons'
import {app, chat, com} from '#/lexicons'
import * as bsky from '#/types/bsky'
import {createGIFDescription} from '../gif-alt-text'
import {computeCid} from './computeCid'
@@ -313,7 +312,7 @@ async function resolveEmbed(
* unbranded strings. Assert at the boundary until it moves to the
* clients.
*/
record: resolvedLink.record as com.atproto.repo.strongRef.Main,
record: resolvedLink.record,
}
}
}
@@ -475,15 +474,13 @@ async function resolveMedia(
title: resolvedLink.title,
description: resolvedLink.description,
thumb: blob,
associatedRefs: resolvedLink.associatedRefs as
| com.atproto.repo.strongRef.Main[]
| undefined,
associatedRefs: resolvedLink.associatedRefs,
},
}
}
if (
resolvedLink.type === 'chat-invite' &&
ChatBskyGroupDefs.isJoinLinkPreviewView(resolvedLink.view)
bsky.isType(chat.bsky.group.defs.joinLinkPreviewView, resolvedLink.view)
) {
return {
$type: 'app.bsky.embed.external',
@@ -512,5 +509,5 @@ async function resolveRecord(
if (resolvedLink.type !== 'record') {
throw Error(t`Expected uri to resolve to a record`)
}
return resolvedLink.record as com.atproto.repo.strongRef.Main
return resolvedLink.record
}
+9 -15
View File
@@ -1,11 +1,5 @@
import {
type AppBskyFeedDefs,
type AppBskyGraphDefs,
type ComAtprotoRepoStrongRef,
} from '@atproto/api'
import {AtUri} from '@atproto/api'
import {type Client} from '@atproto/lex'
import {type AtUriString, type HandleString} from '@atproto/syntax'
import {AtUri, type AtUriString, type HandleString} from '@atproto/syntax'
import {IMAGE_SIZE_CONFIG_2K_1MB} from '#/lib/constants'
import {getLinkMeta, type LinkMeta} from '#/lib/link-meta/link-meta'
@@ -49,30 +43,30 @@ type ResolvedExternalLink = {
type ResolvedPostRecord = {
type: 'record'
record: ComAtprotoRepoStrongRef.Main
record: com.atproto.repo.strongRef.Main
kind: 'post'
view: AppBskyFeedDefs.PostView
view: app.bsky.feed.defs.PostView
}
type ResolvedFeedRecord = {
type: 'record'
record: ComAtprotoRepoStrongRef.Main
record: com.atproto.repo.strongRef.Main
kind: 'feed'
view: AppBskyFeedDefs.GeneratorView
view: app.bsky.feed.defs.GeneratorView
}
type ResolvedListRecord = {
type: 'record'
record: ComAtprotoRepoStrongRef.Main
record: com.atproto.repo.strongRef.Main
kind: 'list'
view: AppBskyGraphDefs.ListView
view: app.bsky.graph.defs.ListView
}
type ResolvedStarterPackRecord = {
type: 'record'
record: ComAtprotoRepoStrongRef.Main
record: com.atproto.repo.strongRef.Main
kind: 'starter-pack'
view: AppBskyGraphDefs.StarterPackView
view: app.bsky.graph.defs.StarterPackView
}
type ResolvedChatInvite = {