Run codemod for replacing BskyAgent with AtpAgent (#10862)
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* Codemod to replace BskyAgent with AtpAgent
|
||||
*
|
||||
* Before:
|
||||
* import {BskyAgent} from '@atproto/api`
|
||||
* BskyAgent.appLabelers.includes(labeler)
|
||||
*
|
||||
* After:
|
||||
* import {AtpAgent} from '@atproto/api`
|
||||
* AtpAgent.appLabelers.includes(labeler)
|
||||
*
|
||||
* Handles import specifiers, type annotations, static member access
|
||||
* (BskyAgent.configure), `extends BskyAgent`, and `new BskyAgent()`. Whole
|
||||
* identifiers only, so names like `OpaqueBskyAgent` are left untouched.
|
||||
*
|
||||
* Usage: jscodeshift -t .jscodeshift/repo/bsky-agent.js <file-path>
|
||||
* Example: jscodeshift -t .jscodeshift/repo/bsky-agent.js src/lib/moderation.ts
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
export const parser = 'tsx'
|
||||
|
||||
export default function transformer(file, api) {
|
||||
const j = api.jscodeshift
|
||||
const root = j(file.source)
|
||||
|
||||
// Replace every standalone `BskyAgent` identifier with `AtpAgent`. This
|
||||
// covers imports, type references, member expressions, `extends`, and `new`.
|
||||
root
|
||||
.find(j.Identifier, {name: 'BskyAgent'})
|
||||
.replaceWith(() => j.identifier('AtpAgent'))
|
||||
|
||||
// Renaming can leave a duplicate `AtpAgent` specifier on the @atproto/api
|
||||
// import if the file already imported it. Dedupe by imported name, keeping
|
||||
// the type-only modifier only if every duplicate was type-only.
|
||||
root
|
||||
.find(j.ImportDeclaration, {source: {value: '@atproto/api'}})
|
||||
.forEach(path => {
|
||||
const seen = new Map()
|
||||
for (const spec of path.value.specifiers) {
|
||||
if (spec.type !== 'ImportSpecifier') {
|
||||
seen.set(Symbol(), spec)
|
||||
continue
|
||||
}
|
||||
const name = spec.imported.name
|
||||
const existing = seen.get(name)
|
||||
if (!existing) {
|
||||
seen.set(name, spec)
|
||||
} else if (
|
||||
existing.importKind === 'type' &&
|
||||
spec.importKind !== 'type'
|
||||
) {
|
||||
// Prefer the value (non-type) import if either usage needs it.
|
||||
seen.set(name, spec)
|
||||
}
|
||||
}
|
||||
path.value.specifiers = Array.from(seen.values())
|
||||
})
|
||||
|
||||
return root.toSource()
|
||||
}
|
||||
@@ -67,7 +67,6 @@ export function DateField({
|
||||
isInvalid={isInvalid}
|
||||
accessibilityHint={accessibilityHint}
|
||||
/>
|
||||
|
||||
{open && (
|
||||
// Android implementation of DatePicker currently does not change default button colors according to theme and only takes hex values for buttonColor
|
||||
// Can remove the buttonColor setting if/when this PR is merged: https://github.com/henninghall/react-native-date-picker/pull/871
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
type AppBskyEmbedRecordWithMedia,
|
||||
type AppBskyEmbedVideo,
|
||||
AppBskyFeedPost,
|
||||
type AtpAgent,
|
||||
BlobRef,
|
||||
type BskyAgent,
|
||||
ChatBskyGroupDefs,
|
||||
type ComAtprotoLabelDefs,
|
||||
type ComAtprotoRepoApplyWrites,
|
||||
@@ -55,7 +55,7 @@ interface PostOpts {
|
||||
}
|
||||
|
||||
export async function post(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
queryClient: QueryClient,
|
||||
opts: PostOpts,
|
||||
) {
|
||||
@@ -197,7 +197,7 @@ export async function post(
|
||||
return {uris}
|
||||
}
|
||||
|
||||
async function resolveRT(agent: BskyAgent, richtext: RichText) {
|
||||
async function resolveRT(agent: AtpAgent, richtext: RichText) {
|
||||
const trimmedText = richtext.text
|
||||
// Trim leading whitespace-only lines (but don't break ASCII art).
|
||||
.replace(/^(\s*\n)+/, '')
|
||||
@@ -217,7 +217,7 @@ export class ReplyDeletedError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
async function resolveReply(agent: BskyAgent, replyTo: string) {
|
||||
async function resolveReply(agent: AtpAgent, replyTo: string) {
|
||||
const {data} = await agent.app.bsky.feed.getPosts({
|
||||
uris: [replyTo],
|
||||
})
|
||||
@@ -250,7 +250,7 @@ async function resolveReply(agent: BskyAgent, replyTo: string) {
|
||||
}
|
||||
|
||||
async function resolveEmbed(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
queryClient: QueryClient,
|
||||
draft: PostDraft,
|
||||
onStateChange: ((state: string) => void) | undefined,
|
||||
@@ -309,7 +309,7 @@ async function resolveEmbed(
|
||||
}
|
||||
|
||||
async function resolveMedia(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
queryClient: QueryClient,
|
||||
embedDraft: EmbedDraft,
|
||||
onStateChange: ((state: string) => void) | undefined,
|
||||
@@ -482,7 +482,7 @@ async function resolveMedia(
|
||||
}
|
||||
|
||||
async function resolveRecord(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
queryClient: QueryClient,
|
||||
uri: string,
|
||||
): Promise<ComAtprotoRepoStrongRef.Main> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {copyAsync} from 'expo-file-system/legacy'
|
||||
import {type BskyAgent, type ComAtprotoRepoUploadBlob} from '@atproto/api'
|
||||
import {type AtpAgent, type ComAtprotoRepoUploadBlob} from '@atproto/api'
|
||||
|
||||
import {safeDeleteAsync} from '#/lib/media/manip'
|
||||
|
||||
@@ -7,7 +7,7 @@ import {safeDeleteAsync} from '#/lib/media/manip'
|
||||
* @param encoding Allows overriding the blob's type
|
||||
*/
|
||||
export async function uploadBlob(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
input: string | Blob,
|
||||
encoding?: string,
|
||||
): Promise<ComAtprotoRepoUploadBlob.Response> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {type BskyAgent, type ComAtprotoRepoUploadBlob} from '@atproto/api'
|
||||
import {type AtpAgent, type ComAtprotoRepoUploadBlob} from '@atproto/api'
|
||||
|
||||
/**
|
||||
* @note It is recommended, on web, to use the `file` instance of the file
|
||||
@@ -7,7 +7,7 @@ import {type BskyAgent, type ComAtprotoRepoUploadBlob} from '@atproto/api'
|
||||
* be passed directly to this function.
|
||||
*/
|
||||
export async function uploadBlob(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
input: string | Blob,
|
||||
encoding?: string,
|
||||
): Promise<ComAtprotoRepoUploadBlob.Response> {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
type $Typed,
|
||||
type AppBskyActorDefs,
|
||||
type AppBskyGraphGetStarterPack,
|
||||
type BskyAgent,
|
||||
type AtpAgent,
|
||||
type ComAtprotoRepoApplyWrites,
|
||||
type Facet,
|
||||
} from '@atproto/api'
|
||||
@@ -28,7 +28,7 @@ export const createStarterPackList = async ({
|
||||
description?: string
|
||||
descriptionFacets?: Facet[]
|
||||
profiles: bsky.profile.AnyProfileView[]
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
}): Promise<{uri: string; cid: string}> => {
|
||||
if (profiles.length === 0) throw new Error('No profiles given')
|
||||
|
||||
@@ -152,7 +152,7 @@ function createListItem({
|
||||
}
|
||||
|
||||
async function whenAppViewReady(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
uri: string,
|
||||
fn: (res?: AppBskyGraphGetStarterPack.Response) => boolean,
|
||||
) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {type AppBskyEmbedExternal, type BskyAgent} from '@atproto/api'
|
||||
import {type AppBskyEmbedExternal, type AtpAgent} from '@atproto/api'
|
||||
|
||||
import {LINK_META_PROXY} from '#/lib/constants'
|
||||
import {getGiphyMetaUri} from '#/lib/strings/embed-player'
|
||||
@@ -31,7 +31,7 @@ export interface LinkMeta {
|
||||
}
|
||||
|
||||
export async function getLinkMeta(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
url: string,
|
||||
timeout = 15e3,
|
||||
): Promise<LinkMeta> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {type BskyAgent} from '@atproto/api'
|
||||
import {type AtpAgent} from '@atproto/api'
|
||||
import {type I18n} from '@lingui/core'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
|
||||
@@ -13,7 +13,7 @@ export async function getServiceAuthToken({
|
||||
lxm,
|
||||
exp,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
aud?: string
|
||||
lxm: string
|
||||
exp?: number
|
||||
@@ -30,7 +30,7 @@ export async function getServiceAuthToken({
|
||||
return serviceAuth.token
|
||||
}
|
||||
|
||||
export async function getVideoUploadLimits(agent: BskyAgent, i18n: I18n) {
|
||||
export async function getVideoUploadLimits(agent: AtpAgent, i18n: I18n) {
|
||||
const token = await getServiceAuthToken({
|
||||
agent,
|
||||
lxm: 'app.bsky.video.getUploadLimits',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {createUploadTask, FileSystemUploadType} from 'expo-file-system/legacy'
|
||||
import {type AppBskyVideoDefs, type BskyAgent} from '@atproto/api'
|
||||
import {type AppBskyVideoDefs, type AtpAgent} from '@atproto/api'
|
||||
import {type I18n} from '@lingui/core'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {nanoid} from 'nanoid/non-secure'
|
||||
@@ -19,7 +19,7 @@ export async function uploadVideo({
|
||||
i18n,
|
||||
}: {
|
||||
video: CompressedVideo
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
did: string
|
||||
setProgress: (progress: number) => void
|
||||
signal: AbortSignal
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {type AppBskyVideoDefs, type BskyAgent} from '@atproto/api'
|
||||
import {type AppBskyVideoDefs, type AtpAgent} from '@atproto/api'
|
||||
import {type I18n} from '@lingui/core'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {nanoid} from 'nanoid/non-secure'
|
||||
@@ -18,7 +18,7 @@ export async function uploadVideo({
|
||||
i18n,
|
||||
}: {
|
||||
video: CompressedVideo
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
did: string
|
||||
setProgress: (progress: number) => void
|
||||
signal: AbortSignal
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {useMemo} from 'react'
|
||||
import {
|
||||
type AppBskyLabelerDefs,
|
||||
BskyAgent,
|
||||
AtpAgent,
|
||||
type ComAtprotoLabelDefs,
|
||||
type InterpretedLabelValueDefinition,
|
||||
LABELS,
|
||||
@@ -91,9 +91,9 @@ export function isAppLabeler(
|
||||
| AppBskyLabelerDefs.LabelerViewDetailed,
|
||||
): boolean {
|
||||
if (typeof labeler === 'string') {
|
||||
return BskyAgent.appLabelers.includes(labeler)
|
||||
return AtpAgent.appLabelers.includes(labeler)
|
||||
}
|
||||
return BskyAgent.appLabelers.includes(labeler.creator.did)
|
||||
return AtpAgent.appLabelers.includes(labeler.creator.did)
|
||||
}
|
||||
|
||||
export function isLabelerSubscribed(
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
type $Typed,
|
||||
type AppBskyGraphFollow,
|
||||
type AppBskyGraphGetFollows,
|
||||
type BskyAgent,
|
||||
type AtpAgent,
|
||||
type ComAtprotoRepoApplyWrites,
|
||||
type ComAtprotoRepoStrongRef,
|
||||
} from '@atproto/api'
|
||||
@@ -12,7 +12,7 @@ import chunk from 'lodash.chunk'
|
||||
import {until} from '#/lib/async/until'
|
||||
|
||||
export async function bulkWriteFollows(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
dids: string[],
|
||||
via?: ComAtprotoRepoStrongRef.Main,
|
||||
) {
|
||||
@@ -59,7 +59,7 @@ export async function bulkWriteFollows(
|
||||
}
|
||||
|
||||
async function whenFollowsIndexed(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
actor: string,
|
||||
fn: (res: AppBskyGraphGetFollows.Response) => boolean,
|
||||
) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
type $Typed,
|
||||
type AppBskyEmbedRecord,
|
||||
type BskyAgent,
|
||||
type AtpAgent,
|
||||
type ChatBskyActorDefs,
|
||||
type ChatBskyConvoDefs,
|
||||
type ChatBskyConvoSendMessage,
|
||||
@@ -13,7 +13,7 @@ import {type ConvoWithDetails} from '#/components/dms/util'
|
||||
|
||||
export type ConvoParams = {
|
||||
convoId: string
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
events: MessagesEventBus
|
||||
placeholderData?: {
|
||||
convo: ChatBskyConvoDefs.ConvoView
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {type BskyAgent, type ChatBskyConvoGetLog} from '@atproto/api'
|
||||
import {type AtpAgent, type ChatBskyConvoGetLog} from '@atproto/api'
|
||||
import {EventEmitter} from 'eventemitter3'
|
||||
import {nanoid} from 'nanoid/non-secure'
|
||||
|
||||
@@ -27,7 +27,7 @@ const logger = Logger.create(Logger.Context.DMsAgent)
|
||||
export class MessagesEventBus {
|
||||
private id: string
|
||||
|
||||
private agent: BskyAgent
|
||||
private agent: AtpAgent
|
||||
private emitter = new EventEmitter<{event: [MessagesEventBusEvent]}>()
|
||||
|
||||
private status: MessagesEventBusStatus = MessagesEventBusStatus.Initializing
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {type BskyAgent, type ChatBskyConvoGetLog} from '@atproto/api'
|
||||
import {type AtpAgent, type ChatBskyConvoGetLog} from '@atproto/api'
|
||||
|
||||
export type MessagesEventBusParams = {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
}
|
||||
|
||||
export enum MessagesEventBusStatus {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
type AppBskyActorDefs,
|
||||
type AppBskyGraphDefs,
|
||||
type AppBskyGraphGetList,
|
||||
type BskyAgent,
|
||||
type AtpAgent,
|
||||
} from '@atproto/api'
|
||||
import {
|
||||
type InfiniteData,
|
||||
@@ -60,7 +60,7 @@ export function useAllListMembersQuery(uri?: string) {
|
||||
})
|
||||
}
|
||||
|
||||
export async function getAllListMembers(agent: BskyAgent, uri: string) {
|
||||
export async function getAllListMembers(agent: AtpAgent, uri: string) {
|
||||
let hasMore = true
|
||||
let cursor: string | undefined
|
||||
const listItems: AppBskyGraphDefs.ListItemView[] = []
|
||||
|
||||
@@ -3,8 +3,8 @@ import {
|
||||
type AppBskyGraphDefs,
|
||||
type AppBskyGraphGetList,
|
||||
type AppBskyGraphList,
|
||||
type AtpAgent,
|
||||
AtUri,
|
||||
type BskyAgent,
|
||||
type ComAtprotoRepoApplyWrites,
|
||||
type Facet,
|
||||
type Un$Typed,
|
||||
@@ -305,7 +305,7 @@ export function useListBlockMutation() {
|
||||
}
|
||||
|
||||
async function whenAppViewReady(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
uri: string,
|
||||
fn: (res: AppBskyGraphGetList.Response) => boolean,
|
||||
) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
type AppBskyGraphDefs,
|
||||
AppBskyGraphStarterpack,
|
||||
type AppBskyNotificationListNotifications,
|
||||
type BskyAgent,
|
||||
type AtpAgent,
|
||||
hasMutedWord,
|
||||
moderateNotification,
|
||||
type ModerationOpts,
|
||||
@@ -46,7 +46,7 @@ export async function fetchPage({
|
||||
fetchAdditionalData,
|
||||
reasons,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
cursor: string | undefined
|
||||
limit: number
|
||||
queryClient: QueryClient
|
||||
@@ -204,7 +204,7 @@ export function groupNotifications(
|
||||
}
|
||||
|
||||
async function fetchSubjects(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
groupedNotifs: FeedNotification[],
|
||||
): Promise<{
|
||||
posts: Map<string, AppBskyFeedDefs.PostView>
|
||||
|
||||
@@ -4,8 +4,8 @@ import {
|
||||
type AppBskyActorDefs,
|
||||
AppBskyFeedDefs,
|
||||
type AppBskyFeedPost,
|
||||
type AtpAgent,
|
||||
AtUri,
|
||||
type BskyAgent,
|
||||
moderatePost,
|
||||
type ModerationDecision,
|
||||
type ModerationPrefs,
|
||||
@@ -450,7 +450,7 @@ function createApi({
|
||||
feedParams: FeedParams
|
||||
feedTuners: FeedTunerFn[]
|
||||
userInterests?: string
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
enableFollowingToDiscoverFallback: boolean
|
||||
}) {
|
||||
if (feedDesc === 'following') {
|
||||
|
||||
@@ -4,8 +4,8 @@ import {
|
||||
AppBskyEmbedRecordWithMedia,
|
||||
type AppBskyFeedDefs,
|
||||
AppBskyFeedPostgate,
|
||||
type AtpAgent,
|
||||
AtUri,
|
||||
type BskyAgent,
|
||||
} from '@atproto/api'
|
||||
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function getPostgateRecord({
|
||||
agent,
|
||||
postUri,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
postUri: string
|
||||
}): Promise<AppBskyFeedPostgate.Record | undefined> {
|
||||
const urip = new AtUri(postUri)
|
||||
@@ -89,7 +89,7 @@ export async function writePostgateRecord({
|
||||
postUri,
|
||||
postgate,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
postUri: string
|
||||
postgate: AppBskyFeedPostgate.Record
|
||||
}) {
|
||||
@@ -110,7 +110,7 @@ export async function upsertPostgate(
|
||||
agent,
|
||||
postUri,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
postUri: string
|
||||
},
|
||||
callback: (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {useMemo} from 'react'
|
||||
import {BskyAgent, interpretLabelValueDefinitions} from '@atproto/api'
|
||||
import {AtpAgent, interpretLabelValueDefinitions} from '@atproto/api'
|
||||
|
||||
import {isNonConfigurableModerationAuthority} from '#/state/session/additional-moderation-authorities'
|
||||
import {useLabelersDetailedInfoQuery} from '../labeler'
|
||||
@@ -13,7 +13,7 @@ export function useMyLabelersQuery({
|
||||
const prefs = usePreferencesQuery()
|
||||
let dids = Array.from(
|
||||
new Set(
|
||||
BskyAgent.appLabelers.concat(
|
||||
AtpAgent.appLabelers.concat(
|
||||
prefs.data?.moderationPrefs.labelers.map(l => l.did) || [],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {AtUri, type BskyAgent} from '@atproto/api'
|
||||
import {type AtpAgent, AtUri} from '@atproto/api'
|
||||
import {type QueryClient, queryOptions, useQuery} from '@tanstack/react-query'
|
||||
|
||||
import {STALE} from '#/state/queries'
|
||||
@@ -9,7 +9,7 @@ const RQKEY_ROOT = 'resolved-did'
|
||||
export const RQKEY = (didOrHandle: string) => [RQKEY_ROOT, didOrHandle]
|
||||
|
||||
const resolvedDidQueryOptions = (
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
getUnstableProfile: (did: string) => {did: string} | undefined,
|
||||
didOrHandle: string | undefined,
|
||||
) =>
|
||||
|
||||
@@ -4,8 +4,8 @@ import {
|
||||
type AppBskyGraphGetStarterPack,
|
||||
AppBskyGraphStarterpack,
|
||||
type AppBskyRichtextFacet,
|
||||
type AtpAgent,
|
||||
AtUri,
|
||||
type BskyAgent,
|
||||
RichText,
|
||||
} from '@atproto/api'
|
||||
import {
|
||||
@@ -340,7 +340,7 @@ export function useDeleteStarterPackMutation({
|
||||
}
|
||||
|
||||
async function whenAppViewReady(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
uri: string,
|
||||
fn: (res?: AppBskyGraphGetStarterPack.Response) => boolean,
|
||||
) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
type AppBskyFeedDefs,
|
||||
AppBskyFeedThreadgate,
|
||||
type AtpAgent,
|
||||
AtUri,
|
||||
type BskyAgent,
|
||||
} from '@atproto/api'
|
||||
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
|
||||
|
||||
@@ -88,7 +88,7 @@ export async function getThreadgateRecord({
|
||||
agent,
|
||||
postUri,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
postUri: string
|
||||
}): Promise<AppBskyFeedThreadgate.Record | null> {
|
||||
const urip = new AtUri(postUri)
|
||||
@@ -150,7 +150,7 @@ export async function writeThreadgateRecord({
|
||||
postUri,
|
||||
threadgate,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
postUri: string
|
||||
threadgate: AppBskyFeedThreadgate.Record
|
||||
}) {
|
||||
@@ -176,7 +176,7 @@ export async function upsertThreadgate(
|
||||
agent,
|
||||
postUri,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
postUri: string
|
||||
},
|
||||
callback: (
|
||||
@@ -205,7 +205,7 @@ export async function updateThreadgateAllow({
|
||||
postUri,
|
||||
allow,
|
||||
}: {
|
||||
agent: BskyAgent
|
||||
agent: AtpAgent
|
||||
postUri: string
|
||||
allow: ThreadgateAllowUISetting[]
|
||||
}) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {BskyAgent} from '@atproto/api'
|
||||
import {AtpAgent} from '@atproto/api'
|
||||
import {describe, expect, it, jest} from '@jest/globals'
|
||||
|
||||
import {agentToSessionAccountOrThrow} from '../agent'
|
||||
@@ -16,7 +16,7 @@ jest.mock('../../../ageAssurance/state', () => ({
|
||||
unsafeGetAndComputeAgeAssurance: () => ({state: {}}),
|
||||
}))
|
||||
jest.mock('#/lib/notifications/notifications', () => ({
|
||||
unregisterPushToken(_agents: BskyAgent[]) {
|
||||
unregisterPushToken(_agents: AtpAgent[]) {
|
||||
return Promise.resolve()
|
||||
},
|
||||
}))
|
||||
@@ -37,7 +37,7 @@ describe('session', () => {
|
||||
}
|
||||
`)
|
||||
|
||||
const agent = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent = new AtpAgent({service: 'https://alice.com'})
|
||||
agent.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -130,7 +130,7 @@ describe('session', () => {
|
||||
it('switches to the latest account, stores all of them', () => {
|
||||
let state = getInitialState([])
|
||||
|
||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -179,7 +179,7 @@ describe('session', () => {
|
||||
}
|
||||
`)
|
||||
|
||||
const agent2 = new BskyAgent({service: 'https://bob.com'})
|
||||
const agent2 = new AtpAgent({service: 'https://bob.com'})
|
||||
agent2.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'bob-did',
|
||||
@@ -245,7 +245,7 @@ describe('session', () => {
|
||||
}
|
||||
`)
|
||||
|
||||
const agent3 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent3 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent3.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -311,7 +311,7 @@ describe('session', () => {
|
||||
}
|
||||
`)
|
||||
|
||||
const agent4 = new BskyAgent({service: 'https://jay.com'})
|
||||
const agent4 = new AtpAgent({service: 'https://jay.com'})
|
||||
agent4.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'jay-did',
|
||||
@@ -468,7 +468,7 @@ describe('session', () => {
|
||||
it('can log back in after logging out', () => {
|
||||
let state = getInitialState([])
|
||||
|
||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -526,7 +526,7 @@ describe('session', () => {
|
||||
}
|
||||
`)
|
||||
|
||||
const agent2 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent2 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent2.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -578,7 +578,7 @@ describe('session', () => {
|
||||
it('can remove active account', () => {
|
||||
let state = getInitialState([])
|
||||
|
||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -623,7 +623,7 @@ describe('session', () => {
|
||||
it('can remove inactive account', () => {
|
||||
let state = getInitialState([])
|
||||
|
||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -631,7 +631,7 @@ describe('session', () => {
|
||||
accessJwt: 'alice-access-jwt-1',
|
||||
refreshJwt: 'alice-refresh-jwt-1',
|
||||
}
|
||||
const agent2 = new BskyAgent({service: 'https://bob.com'})
|
||||
const agent2 = new AtpAgent({service: 'https://bob.com'})
|
||||
agent2.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'bob-did',
|
||||
@@ -704,7 +704,7 @@ describe('session', () => {
|
||||
it('can log out of the current account', () => {
|
||||
let state = getInitialState([])
|
||||
|
||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -724,7 +724,7 @@ describe('session', () => {
|
||||
expect(state.accounts[0].refreshJwt).toBe('alice-refresh-jwt-1')
|
||||
expect(state.currentAgentState.did).toBe('alice-did')
|
||||
|
||||
const agent2 = new BskyAgent({service: 'https://bob.com'})
|
||||
const agent2 = new AtpAgent({service: 'https://bob.com'})
|
||||
agent2.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'bob-did',
|
||||
@@ -803,7 +803,7 @@ describe('session', () => {
|
||||
it('updates stored account with refreshed tokens', () => {
|
||||
let state = getInitialState([])
|
||||
|
||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -987,7 +987,7 @@ describe('session', () => {
|
||||
it('bails out of update on identical objects', () => {
|
||||
let state = getInitialState([])
|
||||
|
||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -1059,7 +1059,7 @@ describe('session', () => {
|
||||
it('accepts updates from a stale agent', () => {
|
||||
let state = getInitialState([])
|
||||
|
||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -1068,7 +1068,7 @@ describe('session', () => {
|
||||
refreshJwt: 'alice-refresh-jwt-1',
|
||||
}
|
||||
|
||||
const agent2 = new BskyAgent({service: 'https://bob.com'})
|
||||
const agent2 = new AtpAgent({service: 'https://bob.com'})
|
||||
agent2.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'bob-did',
|
||||
@@ -1258,7 +1258,7 @@ describe('session', () => {
|
||||
it('ignores updates from a removed agent', () => {
|
||||
let state = getInitialState([])
|
||||
|
||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -1267,7 +1267,7 @@ describe('session', () => {
|
||||
refreshJwt: 'alice-refresh-jwt-1',
|
||||
}
|
||||
|
||||
const agent2 = new BskyAgent({service: 'https://bob.com'})
|
||||
const agent2 = new AtpAgent({service: 'https://bob.com'})
|
||||
agent2.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'bob-did',
|
||||
@@ -1320,7 +1320,7 @@ describe('session', () => {
|
||||
it('ignores network errors', () => {
|
||||
let state = getInitialState([])
|
||||
|
||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -1386,7 +1386,7 @@ describe('session', () => {
|
||||
it('resets tokens on expired event', () => {
|
||||
let state = getInitialState([])
|
||||
|
||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -1452,7 +1452,7 @@ describe('session', () => {
|
||||
it('resets tokens on created-failed event', () => {
|
||||
let state = getInitialState([])
|
||||
|
||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -1518,7 +1518,7 @@ describe('session', () => {
|
||||
it('replaces local accounts with synced accounts', () => {
|
||||
let state = getInitialState([])
|
||||
|
||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
||||
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||
agent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'alice-did',
|
||||
@@ -1526,7 +1526,7 @@ describe('session', () => {
|
||||
accessJwt: 'alice-access-jwt-1',
|
||||
refreshJwt: 'alice-refresh-jwt-1',
|
||||
}
|
||||
const agent2 = new BskyAgent({service: 'https://bob.com'})
|
||||
const agent2 = new AtpAgent({service: 'https://bob.com'})
|
||||
agent2.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'bob-did',
|
||||
@@ -1549,7 +1549,7 @@ describe('session', () => {
|
||||
expect(state.accounts.length).toBe(2)
|
||||
expect(state.currentAgentState.did).toBe('bob-did')
|
||||
|
||||
const anotherTabAgent1 = new BskyAgent({service: 'https://jay.com'})
|
||||
const anotherTabAgent1 = new AtpAgent({service: 'https://jay.com'})
|
||||
anotherTabAgent1.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'jay-did',
|
||||
@@ -1557,7 +1557,7 @@ describe('session', () => {
|
||||
accessJwt: 'jay-access-jwt-1',
|
||||
refreshJwt: 'jay-refresh-jwt-1',
|
||||
}
|
||||
const anotherTabAgent2 = new BskyAgent({service: 'https://alice.com'})
|
||||
const anotherTabAgent2 = new AtpAgent({service: 'https://alice.com'})
|
||||
anotherTabAgent2.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'bob-did',
|
||||
@@ -1627,7 +1627,7 @@ describe('session', () => {
|
||||
}
|
||||
`)
|
||||
|
||||
const anotherTabAgent3 = new BskyAgent({service: 'https://clarence.com'})
|
||||
const anotherTabAgent3 = new AtpAgent({service: 'https://clarence.com'})
|
||||
anotherTabAgent3.sessionManager.session = {
|
||||
active: true,
|
||||
did: 'clarence-did',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {BskyAgent} from '@atproto/api'
|
||||
import {AtpAgent} from '@atproto/api'
|
||||
|
||||
import {device} from '#/storage'
|
||||
|
||||
@@ -83,8 +83,8 @@ export function configureAdditionalModerationAuthorities() {
|
||||
}
|
||||
|
||||
const appLabelers = Array.from(
|
||||
new Set([...BskyAgent.appLabelers, ...additionalLabelers]),
|
||||
new Set([...AtpAgent.appLabelers, ...additionalLabelers]),
|
||||
)
|
||||
|
||||
BskyAgent.configure({appLabelers})
|
||||
AtpAgent.configure({appLabelers})
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import {
|
||||
Agent as BaseAgent,
|
||||
type AppBskyActorProfile,
|
||||
AtpAgent,
|
||||
type AtprotoServiceType,
|
||||
type AtpSessionData,
|
||||
type AtpSessionEvent,
|
||||
BskyAgent,
|
||||
type Did,
|
||||
type Un$Typed,
|
||||
} from '@atproto/api'
|
||||
@@ -52,7 +52,7 @@ export function createPublicAgent() {
|
||||
export async function createAgentAndResume(
|
||||
storedAccount: SessionAccount,
|
||||
onSessionChange: (
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
did: string,
|
||||
event: AtpSessionEvent,
|
||||
) => void,
|
||||
@@ -96,7 +96,7 @@ export async function createAgentAndLogin(
|
||||
authFactorToken?: string
|
||||
},
|
||||
onSessionChange: (
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
did: string,
|
||||
event: AtpSessionEvent,
|
||||
) => void,
|
||||
@@ -143,7 +143,7 @@ export async function createAgentAndCreateAccount(
|
||||
verificationCode?: string
|
||||
},
|
||||
onSessionChange: (
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
did: string,
|
||||
event: AtpSessionEvent,
|
||||
) => void,
|
||||
@@ -282,7 +282,7 @@ export async function createAgentAndCreateAccount(
|
||||
})
|
||||
}
|
||||
|
||||
export function agentToSessionAccountOrThrow(agent: BskyAgent): SessionAccount {
|
||||
export function agentToSessionAccountOrThrow(agent: AtpAgent): SessionAccount {
|
||||
const account = agentToSessionAccount(agent)
|
||||
if (!account) {
|
||||
throw Error('Expected an active session')
|
||||
@@ -291,7 +291,7 @@ export function agentToSessionAccountOrThrow(agent: BskyAgent): SessionAccount {
|
||||
}
|
||||
|
||||
export function agentToSessionAccount(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
): SessionAccount | undefined {
|
||||
if (!agent.session) {
|
||||
return undefined
|
||||
@@ -350,7 +350,7 @@ export class Agent extends BaseAgent {
|
||||
// Ideally, we wouldn't be doing this. However, since there is so much logic that requires making calls to the PDS right now, it
|
||||
// feels safer to just let those run as-is and set the header afterward.
|
||||
let realFetch = globalThis.fetch
|
||||
class BskyAppAgent extends BskyAgent {
|
||||
class BskyAppAgent extends AtpAgent {
|
||||
persistSessionHandler: ((event: AtpSessionEvent) => void) | undefined =
|
||||
undefined
|
||||
|
||||
@@ -389,7 +389,7 @@ class BskyAppAgent extends BskyAgent {
|
||||
// Not awaited in the calling code so we can delay blocking on them.
|
||||
resolvers: Promise<unknown>[]
|
||||
onSessionChange: (
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
did: string,
|
||||
event: AtpSessionEvent,
|
||||
) => void
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {BSKY_LABELER_DID, BskyAgent} from '@atproto/api'
|
||||
import {AtpAgent, BSKY_LABELER_DID} from '@atproto/api'
|
||||
|
||||
import {IS_TEST_USER} from '#/lib/constants'
|
||||
import {configureAdditionalModerationAuthorities} from './additional-moderation-authorities'
|
||||
@@ -13,7 +13,7 @@ export function configureModerationForGuest() {
|
||||
}
|
||||
|
||||
export async function configureModerationForAccount(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
account: SessionAccount,
|
||||
) {
|
||||
// This global mutation is *only* OK because this code is only relevant for testing.
|
||||
@@ -38,10 +38,10 @@ export async function configureModerationForAccount(
|
||||
}
|
||||
|
||||
function switchToBskyAppLabeler() {
|
||||
BskyAgent.configure({appLabelers: [BSKY_LABELER_DID]})
|
||||
AtpAgent.configure({appLabelers: [BSKY_LABELER_DID]})
|
||||
}
|
||||
|
||||
async function trySwitchToTestAppLabeler(agent: BskyAgent) {
|
||||
async function trySwitchToTestAppLabeler(agent: AtpAgent) {
|
||||
const did = (
|
||||
await agent
|
||||
.resolveHandle({handle: 'mod-authority.test'})
|
||||
@@ -49,6 +49,6 @@ async function trySwitchToTestAppLabeler(agent: BskyAgent) {
|
||||
)?.data.did
|
||||
if (did) {
|
||||
console.warn('USING TEST ENV MODERATION')
|
||||
BskyAgent.configure({appLabelers: [did]})
|
||||
AtpAgent.configure({appLabelers: [did]})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ import {
|
||||
AppBskyDraftCreateDraft,
|
||||
AppBskyUnspeccedDefs,
|
||||
type AppBskyUnspeccedGetPostThreadV2,
|
||||
type AtpAgent,
|
||||
AtUri,
|
||||
type BskyAgent,
|
||||
ChatBskyGroupDefs,
|
||||
type RichText,
|
||||
} from '@atproto/api'
|
||||
@@ -2358,7 +2358,7 @@ function useKeyboardVerticalOffset() {
|
||||
}
|
||||
|
||||
async function whenAppViewReady(
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
uri: string,
|
||||
fn: (res: AppBskyUnspeccedGetPostThreadV2.Response) => boolean,
|
||||
) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {type ImagePickerAsset} from 'expo-image-picker'
|
||||
import {type AppBskyVideoDefs, type BlobRef, type BskyAgent} from '@atproto/api'
|
||||
import {type AppBskyVideoDefs, type AtpAgent, type BlobRef} from '@atproto/api'
|
||||
import {type I18n} from '@lingui/core'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
|
||||
@@ -261,7 +261,7 @@ function trunc2dp(num: number) {
|
||||
export async function processVideo(
|
||||
asset: ImagePickerAsset,
|
||||
dispatch: (action: VideoAction) => void,
|
||||
agent: BskyAgent,
|
||||
agent: AtpAgent,
|
||||
did: string,
|
||||
signal: AbortSignal,
|
||||
i18n: I18n,
|
||||
|
||||
Reference in New Issue
Block a user