[SDK] Remove @atproto/api (#11386)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import {type AppBskyFeedDefs, AppBskyFeedPost} from '@atproto/api'
|
||||
import * as bcp47Match from 'bcp-47-match'
|
||||
import lande from 'lande'
|
||||
|
||||
import {hasProp} from '#/lib/type-guards'
|
||||
import {app} from '#/lexicons'
|
||||
import * as bsky from '#/types/bsky'
|
||||
import {
|
||||
AppLanguage,
|
||||
type Language,
|
||||
@@ -61,8 +62,8 @@ function getLocalizedLanguage(
|
||||
}
|
||||
}
|
||||
|
||||
export function getPostLanguageTags(post: AppBskyFeedDefs.PostView) {
|
||||
return AppBskyFeedPost.isRecord(post.record) &&
|
||||
export function getPostLanguageTags(post: app.bsky.feed.defs.PostView) {
|
||||
return bsky.isType(app.bsky.feed.post, post.record) &&
|
||||
hasProp(post.record, 'langs') &&
|
||||
Array.isArray(post.record.langs)
|
||||
? post.record.langs
|
||||
@@ -86,7 +87,7 @@ export function codeToLanguageName(lang2or3: string, appLang: string): string {
|
||||
}
|
||||
|
||||
export function getPostLanguage(
|
||||
post: AppBskyFeedDefs.PostView,
|
||||
post: app.bsky.feed.defs.PostView,
|
||||
): string | undefined {
|
||||
let candidates: string[] = getPostLanguageTags(post)
|
||||
let postText: string = ''
|
||||
@@ -121,7 +122,7 @@ export function getPostLanguage(
|
||||
}
|
||||
|
||||
export function isPostInLanguage(
|
||||
post: AppBskyFeedDefs.PostView,
|
||||
post: app.bsky.feed.defs.PostView,
|
||||
targetLangs: string[],
|
||||
): boolean {
|
||||
const lang = getPostLanguage(post)
|
||||
|
||||
Reference in New Issue
Block a user