Run codemod for replacing BskyAgent with AtpAgent (#10862)
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
import {
|
||||
AppBskyFeedDefs,
|
||||
type AppBskyFeedGetAuthorFeed as GetAuthorFeed,
|
||||
type BskyAgent,
|
||||
type AtpAgent,
|
||||
} from '@atproto/api'
|
||||
|
||||
import {type FeedAPI, type FeedAPIResponse} from './types'
|
||||
|
||||
export class AuthorFeedAPI implements FeedAPI {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
_params: GetAuthorFeed.QueryParams
|
||||
|
||||
constructor({
|
||||
agent,
|
||||
feedParams,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
feedParams: GetAuthorFeed.QueryParams
|
||||
}) {
|
||||
this.agent = agent
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
type AppBskyFeedDefs,
|
||||
type AppBskyFeedGetFeed as GetCustomFeed,
|
||||
BskyAgent,
|
||||
AtpAgent,
|
||||
jsonStringToLex,
|
||||
} from '@atproto/api'
|
||||
|
||||
@@ -13,7 +13,7 @@ import {type FeedAPI, type FeedAPIResponse} from './types'
|
||||
import {createBskyTopicsHeader, isBlueskyOwnedFeed} from './utils'
|
||||
|
||||
export class CustomFeedAPI implements FeedAPI {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
params: GetCustomFeed.QueryParams
|
||||
userInterests?: string
|
||||
|
||||
@@ -22,7 +22,7 @@ export class CustomFeedAPI implements FeedAPI {
|
||||
feedParams,
|
||||
userInterests,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
feedParams: GetCustomFeed.QueryParams
|
||||
userInterests?: string
|
||||
}) {
|
||||
@@ -113,7 +113,7 @@ async function loggedOutFetch({
|
||||
* @see https://github.com/bluesky-social/atproto/blob/60df3fc652b00cdff71dd9235d98a7a4bb828f05/packages/api/src/agent.ts#L120
|
||||
*/
|
||||
const labelersHeader = {
|
||||
'atproto-accept-labelers': BskyAgent.appLabelers
|
||||
'atproto-accept-labelers': AtpAgent.appLabelers
|
||||
.map(l => `${l};redact`)
|
||||
.join(', '),
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import {type AppBskyFeedDefs, type BskyAgent} from '@atproto/api'
|
||||
import {type AppBskyFeedDefs, type AtpAgent} from '@atproto/api'
|
||||
|
||||
import {DEMO_FEED} from '#/lib/demo'
|
||||
import {type FeedAPI, type FeedAPIResponse} from './types'
|
||||
|
||||
export class DemoFeedAPI implements FeedAPI {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
|
||||
constructor({agent}: {agent: BskyAgent}) {
|
||||
constructor({agent}: {agent: AtpAgent}) {
|
||||
this.agent = agent
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {type AppBskyFeedDefs, type BskyAgent} from '@atproto/api'
|
||||
import {type AppBskyFeedDefs, type AtpAgent} from '@atproto/api'
|
||||
|
||||
import {type FeedAPI, type FeedAPIResponse} from './types'
|
||||
|
||||
export class FollowingFeedAPI implements FeedAPI {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
|
||||
constructor({agent}: {agent: BskyAgent}) {
|
||||
constructor({agent}: {agent: AtpAgent}) {
|
||||
this.agent = agent
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {type AppBskyFeedDefs, type BskyAgent} from '@atproto/api'
|
||||
import {type AppBskyFeedDefs, type AtpAgent} from '@atproto/api'
|
||||
|
||||
import {PROD_DEFAULT_FEED} from '#/lib/constants'
|
||||
import {CustomFeedAPI} from './custom'
|
||||
@@ -27,7 +27,7 @@ export const FALLBACK_MARKER_POST: AppBskyFeedDefs.FeedViewPost = {
|
||||
}
|
||||
|
||||
export class HomeFeedAPI implements FeedAPI {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
following: FollowingFeedAPI
|
||||
discover: CustomFeedAPI
|
||||
usingDiscover = false
|
||||
@@ -39,7 +39,7 @@ export class HomeFeedAPI implements FeedAPI {
|
||||
agent,
|
||||
}: {
|
||||
userInterests?: string
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
}) {
|
||||
this.agent = agent
|
||||
this.following = new FollowingFeedAPI({agent})
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import {
|
||||
type AppBskyFeedDefs,
|
||||
type AppBskyFeedGetActorLikes as GetActorLikes,
|
||||
type BskyAgent,
|
||||
type AtpAgent,
|
||||
} from '@atproto/api'
|
||||
|
||||
import {type FeedAPI, type FeedAPIResponse} from './types'
|
||||
|
||||
export class LikesFeedAPI implements FeedAPI {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
params: GetActorLikes.QueryParams
|
||||
|
||||
constructor({
|
||||
agent,
|
||||
feedParams,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
feedParams: GetActorLikes.QueryParams
|
||||
}) {
|
||||
this.agent = agent
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
type AppBskyFeedDefs,
|
||||
type AppBskyFeedGetTimeline,
|
||||
type BskyAgent,
|
||||
type AtpAgent,
|
||||
} from '@atproto/api'
|
||||
import shuffle from 'lodash.shuffle'
|
||||
|
||||
@@ -24,7 +24,7 @@ const POST_AGE_CUTOFF = 60e3 * 60 * 24 // 24hours
|
||||
|
||||
export class MergeFeedAPI implements FeedAPI {
|
||||
userInterests?: string
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
params: FeedParams
|
||||
feedTuners: FeedTunerFn[]
|
||||
following: MergeFeedSource_Following
|
||||
@@ -39,7 +39,7 @@ export class MergeFeedAPI implements FeedAPI {
|
||||
feedTuners,
|
||||
userInterests,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
feedParams: FeedParams
|
||||
feedTuners: FeedTunerFn[]
|
||||
userInterests?: string
|
||||
@@ -175,7 +175,7 @@ export class MergeFeedAPI implements FeedAPI {
|
||||
}
|
||||
|
||||
class MergeFeedSource {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
feedTuners: FeedTunerFn[]
|
||||
sourceInfo: ReasonFeedSource | undefined
|
||||
cursor: string | undefined = undefined
|
||||
@@ -186,7 +186,7 @@ class MergeFeedSource {
|
||||
agent,
|
||||
feedTuners,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
feedTuners: FeedTunerFn[]
|
||||
}) {
|
||||
this.agent = agent
|
||||
@@ -253,7 +253,7 @@ class MergeFeedSource_Following extends MergeFeedSource {
|
||||
}
|
||||
|
||||
class MergeFeedSource_Custom extends MergeFeedSource {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
minDate: Date
|
||||
feedUri: string
|
||||
userInterests?: string
|
||||
@@ -264,7 +264,7 @@ class MergeFeedSource_Custom extends MergeFeedSource {
|
||||
feedTuners,
|
||||
userInterests,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
feedUri: string
|
||||
feedTuners: FeedTunerFn[]
|
||||
userInterests?: string
|
||||
|
||||
Reference in New Issue
Block a user