Add avatar images and fix some type signatures

zio/stable
Paul Frazee 2022-12-08 13:45:23 -06:00
parent 273e6d2973
commit 539bf5d350
56 changed files with 543 additions and 370 deletions

View File

@ -105,21 +105,6 @@ export async function unfollow(store: RootStoreModel, followUri: string) {
})
}
export async function updateProfile(
store: RootStoreModel,
did: string,
modifyFn: (existing?: Profile.Record) => Profile.Record,
) {
const res = await store.api.app.bsky.actor.profile.list({
user: did || '',
})
const existing = res.records[0]
await store.api.app.bsky.actor.updateProfile({
did: did || '',
...modifyFn(existing?.value),
})
}
export async function inviteToScene(
store: RootStoreModel,
sceneDid: string,
@ -183,6 +168,14 @@ async function fetchHandler(
const reqMimeType = reqHeaders['Content-Type'] || reqHeaders['content-type']
if (reqMimeType && reqMimeType.startsWith('application/json')) {
reqBody = JSON.stringify(reqBody)
} else if (
typeof reqBody === 'string' &&
(reqBody.startsWith('/') || reqBody.startsWith('file:'))
) {
// NOTE
// React native treats bodies with {uri: string} as file uploads to pull from cache
// -prf
reqBody = {uri: reqBody}
}
const controller = new AbortController()
@ -219,51 +212,4 @@ async function fetchHandler(
headers: resHeaders,
body: resBody,
}
// const res = await fetch(httpUri, {
// method: httpMethod,
// headers: httpHeaders,
// body: encodeMethodCallBody(httpHeaders, httpReqBody),
// })
// const resBody = await res.arrayBuffer()
// return {
// status: res.status,
// headers: Object.fromEntries(res.headers.entries()),
// body: httpResponseBodyParse(res.headers.get('content-type'), resBody),
// }
}
/*type WherePred = (_record: GetRecordResponseValidated) => Boolean
async function deleteWhere(
coll: AdxRepoCollectionClient,
schema: SchemaOpt,
cond: WherePred,
) {
const toDelete: string[] = []
await iterateAll(coll, schema, record => {
if (cond(record)) {
toDelete.push(record.key)
}
})
for (const key of toDelete) {
await coll.del(key)
}
return toDelete.length
}
type IterateAllCb = (_record: GetRecordResponseValidated) => void
async function iterateAll(
coll: AdxRepoCollectionClient,
schema: SchemaOpt,
cb: IterateAllCb,
) {
let cursor
let res: ListRecordsResponseValidated
do {
res = await coll.list(schema, {after: cursor, limit: 100})
for (const record of res.records) {
if (record.valid) {
cb(record)
cursor = record.key
}
}
} while (res.records.length === 100)
}*/

View File

@ -1,4 +0,0 @@
export interface Declaration {
cid: string
actorType: string
}

View File

@ -1,6 +1,7 @@
import {makeAutoObservable, runInAction} from 'mobx'
import {Record as PostRecord} from '../../third-party/api/src/client/types/app/bsky/feed/post'
import * as GetTimeline from '../../third-party/api/src/client/types/app/bsky/feed/getTimeline'
import * as ActorRef from '../../third-party/api/src/client/types/app/bsky/actor/ref'
import * as GetAuthorFeed from '../../third-party/api/src/client/types/app/bsky/feed/getAuthorFeed'
import {PostThreadViewModel} from './post-thread-view'
import {AtUri} from '../../third-party/uri'
@ -36,14 +37,15 @@ export class FeedItemModel implements GetTimeline.FeedItem {
// data
uri: string = ''
cid: string = ''
author: GetTimeline.Actor = {
author: ActorRef.WithInfo = {
did: '',
handle: '',
displayName: '',
declaration: {cid: '', actorType: ''},
avatar: undefined,
}
repostedBy?: GetTimeline.Actor
trendedBy?: GetTimeline.Actor
repostedBy?: ActorRef.WithInfo
trendedBy?: ActorRef.WithInfo
record: Record<string, unknown> = {}
replyCount: number = 0
repostCount: number = 0

View File

@ -9,6 +9,7 @@ export class MeModel {
handle: string = ''
displayName: string = ''
description: string = ''
avatar: string = ''
notificationCount: number = 0
memberships?: MembershipsViewModel
notifications: NotificationsViewModel
@ -27,6 +28,7 @@ export class MeModel {
this.handle = ''
this.displayName = ''
this.description = ''
this.avatar = ''
this.notificationCount = 0
this.memberships = undefined
}
@ -37,12 +39,13 @@ export class MeModel {
handle: this.handle,
displayName: this.displayName,
description: this.description,
avatar: this.avatar,
}
}
hydrate(v: unknown) {
if (isObj(v)) {
let did, handle, displayName, description
let did, handle, displayName, description, avatar
if (hasProp(v, 'did') && typeof v.did === 'string') {
did = v.did
}
@ -55,11 +58,15 @@ export class MeModel {
if (hasProp(v, 'description') && typeof v.description === 'string') {
description = v.description
}
if (hasProp(v, 'avatar') && typeof v.avatar === 'string') {
avatar = v.avatar
}
if (did && handle) {
this.did = did
this.handle = handle
this.displayName = displayName || ''
this.description = description || ''
this.avatar = avatar || ''
}
}
}
@ -76,9 +83,11 @@ export class MeModel {
if (profile?.data) {
this.displayName = profile.data.displayName || ''
this.description = profile.data.description || ''
this.avatar = profile.data.avatar || ''
} else {
this.displayName = ''
this.description = ''
this.avatar = ''
}
})
this.memberships = new MembershipsViewModel(this.rootStore, {

View File

@ -1,11 +1,11 @@
import {makeAutoObservable, runInAction} from 'mobx'
import * as GetMembers from '../../third-party/api/src/client/types/app/bsky/graph/getMembers'
import * as ActorRef from '../../third-party/api/src/client/types/app/bsky/actor/ref'
import {APP_BSKY_GRAPH} from '../../third-party/api'
import {AtUri} from '../../third-party/uri'
import {RootStoreModel} from './root-store'
type Subject = GetMembers.OutputSchema['subject']
export type MemberItem = GetMembers.OutputSchema['members'][number] & {
export type MemberItem = GetMembers.Member & {
_reactKey: string
}
@ -18,11 +18,12 @@ export class MembersViewModel {
params: GetMembers.QueryParams
// data
subject: Subject = {
subject: ActorRef.WithInfo = {
did: '',
handle: '',
displayName: '',
declaration: {cid: '', actorType: ''},
avatar: undefined,
}
members: MemberItem[] = []
@ -129,6 +130,7 @@ export class MembersViewModel {
this.subject.handle = res.data.subject.handle
this.subject.displayName = res.data.subject.displayName
this.subject.declaration = res.data.subject.declaration
this.subject.avatar = res.data.subject.avatar
this.members.length = 0
let counter = 0
for (const item of res.data.members) {

View File

@ -1,12 +1,11 @@
import {makeAutoObservable} from 'mobx'
import * as GetMemberships from '../../third-party/api/src/client/types/app/bsky/graph/getMemberships'
import * as ActorRef from '../../third-party/api/src/client/types/app/bsky/actor/ref'
import {RootStoreModel} from './root-store'
type Subject = GetMemberships.OutputSchema['subject']
export type MembershipItem =
GetMemberships.OutputSchema['memberships'][number] & {
_reactKey: string
}
export type MembershipItem = GetMemberships.Membership & {
_reactKey: string
}
export class MembershipsViewModel {
// state
@ -17,11 +16,12 @@ export class MembershipsViewModel {
params: GetMemberships.QueryParams
// data
subject: Subject = {
subject: ActorRef.WithInfo = {
did: '',
handle: '',
displayName: '',
declaration: {cid: '', actorType: ''},
avatar: undefined,
}
memberships: MembershipItem[] = []
@ -107,6 +107,8 @@ export class MembershipsViewModel {
this.subject.did = res.data.subject.did
this.subject.handle = res.data.subject.handle
this.subject.displayName = res.data.subject.displayName
this.subject.declaration = res.data.subject.declaration
this.subject.avatar = res.data.subject.avatar
this.memberships.length = 0
let counter = 0
for (const item of res.data.memberships) {

View File

@ -1,8 +1,8 @@
import {makeAutoObservable, runInAction} from 'mobx'
import * as ListNotifications from '../../third-party/api/src/client/types/app/bsky/notification/list'
import * as ActorRef from '../../third-party/api/src/client/types/app/bsky/actor/ref'
import {RootStoreModel} from './root-store'
import {PostThreadViewModel} from './post-thread-view'
import {Declaration} from './_common'
import {hasProp} from '../lib/type-guards'
import {APP_BSKY_GRAPH} from '../../third-party/api'
import {cleanError} from '../../lib/strings'
@ -22,12 +22,11 @@ export class NotificationsViewItemModel implements GroupedNotification {
// data
uri: string = ''
cid: string = ''
author: {
did: string
handle: string
displayName?: string
declaration: Declaration
} = {did: '', handle: '', declaration: {cid: '', actorType: ''}}
author: ActorRef.WithInfo = {
did: '',
handle: '',
declaration: {cid: '', actorType: ''},
}
reason: string = ''
reasonSubject?: string
record: any = {}

View File

@ -1,10 +1,20 @@
import {makeAutoObservable, runInAction} from 'mobx'
import {AppBskyFeedGetPostThread as GetPostThread} from '../../third-party/api'
import * as Embed from '../../third-party/api/src/client/types/app/bsky/feed/embed'
import * as ActorRef from '../../third-party/api/src/client/types/app/bsky/actor/ref'
import {AtUri} from '../../third-party/uri'
import _omit from 'lodash.omit'
import {RootStoreModel} from './root-store'
import * as apilib from '../lib/api'
type MaybePost =
| GetPostThread.Post
| GetPostThread.NotFoundPost
| {
$type: string
[k: string]: unknown
}
function* reactKeyGenerator(): Generator<string> {
let counter = 0
while (true) {
@ -16,6 +26,7 @@ interface ReplyingTo {
author: {
handle: string
displayName?: string
avatar?: string
}
text: string
}
@ -40,19 +51,16 @@ export class PostThreadViewPostModel implements GetPostThread.Post {
_isHighlightedPost = false
// data
$type: string = ''
uri: string = ''
cid: string = ''
author: GetPostThread.User = {
author: ActorRef.WithInfo = {
did: '',
handle: '',
displayName: '',
declaration: {cid: '', actorType: ''},
}
record: Record<string, unknown> = {}
embed?:
| GetPostThread.RecordEmbed
| GetPostThread.ExternalEmbed
| GetPostThread.UnknownEmbed
embed?: Embed.Main = undefined
parent?: PostThreadViewPostModel
replyCount: number = 0
replies?: PostThreadViewPostModel[]
@ -106,6 +114,7 @@ export class PostThreadViewPostModel implements GetPostThread.Post {
author: {
handle: v.parent.author.handle,
displayName: v.parent.author.displayName,
avatar: v.parent.author.avatar,
},
text: (v.parent.record as OriginalRecord).text,
}
@ -331,17 +340,30 @@ export class PostThreadViewModel {
const thread = new PostThreadViewPostModel(
this.rootStore,
keyGen.next().value,
res.data.thread,
res.data.thread as GetPostThread.Post,
)
thread._isHighlightedPost = true
thread.assignTreeModels(keyGen, res.data.thread)
thread.assignTreeModels(keyGen, res.data.thread as GetPostThread.Post)
this.thread = thread
}
}
function sortThread(post: GetPostThread.Post) {
function sortThread(post: MaybePost) {
if (post.notFound) {
return
}
post = post as GetPostThread.Post
if (post.replies) {
post.replies.sort((a: GetPostThread.Post, b: GetPostThread.Post) => {
post.replies.sort((a: MaybePost, b: MaybePost) => {
post = post as GetPostThread.Post
if (a.notFound) {
return 1
}
if (b.notFound) {
return -1
}
a = a as GetPostThread.Post
b = b as GetPostThread.Post
const aIsByOp = a.author.did === post.author.did
const bIsByOp = b.author.did === post.author.did
if (aIsByOp && bIsByOp) {

View File

@ -4,8 +4,6 @@ import {AtUri} from '../../third-party/uri'
import {RootStoreModel} from './root-store'
import {cleanError} from '../../lib/strings'
export type PostEntities = Post.Record['entities']
export type PostReply = Post.Record['reply']
type RemoveIndex<T> = {
[P in keyof T as string extends P
? never
@ -22,8 +20,8 @@ export class PostModel implements RemoveIndex<Post.Record> {
// data
text: string = ''
entities?: PostEntities
reply?: PostReply
entities?: Post.Entity[]
reply?: Post.ReplyRef
createdAt: string = ''
constructor(public rootStore: RootStoreModel, uri: string) {

View File

@ -1,9 +1,10 @@
import {makeAutoObservable, runInAction} from 'mobx'
import {Image as PickedImage} from 'react-native-image-crop-picker'
import * as GetProfile from '../../third-party/api/src/client/types/app/bsky/actor/getProfile'
import * as Profile from '../../third-party/api/src/client/types/app/bsky/actor/profile'
import {Main as DeclRef} from '../../third-party/api/src/client/types/app/bsky/system/declRef'
import {Entity} from '../../third-party/api/src/client/types/app/bsky/feed/post'
import {extractEntities} from '../../lib/strings'
import {Declaration} from './_common'
import {RootStoreModel} from './root-store'
import * as apilib from '../lib/api'
@ -30,13 +31,14 @@ export class ProfileViewModel {
// data
did: string = ''
handle: string = ''
declaration: Declaration = {
declaration: DeclRef = {
cid: '',
actorType: '',
}
creator: string = ''
displayName?: string
description?: string
avatar?: string
followersCount: number = 0
followsCount: number = 0
membersCount: number = 0
@ -44,7 +46,6 @@ export class ProfileViewModel {
myState = new ProfileViewMyStateModel()
// TODO TEMP data to be implemented in the protocol
userAvatar: string | null = null
userBanner: string | null = null
// added data
@ -120,15 +121,27 @@ export class ProfileViewModel {
}
async updateProfile(
fn: (existing?: Profile.Record) => Profile.Record,
userAvatar: string | null, // TODO TEMP
updates: Profile.Record,
newUserAvatar: PickedImage | undefined,
userBanner: string | null, // TODO TEMP
) {
// TODO TEMP add userBanner & userAvatar in the protocol when suported
this.userAvatar = userAvatar
// TODO TEMP add userBanner to the protocol when suported
this.userBanner = userBanner
await apilib.updateProfile(this.rootStore, this.did, fn)
if (newUserAvatar) {
const res = await this.rootStore.api.com.atproto.blob.upload(
newUserAvatar.path, // this will be special-cased by the fetch monkeypatch in /src/state/lib/api.ts
{
encoding: newUserAvatar.mime,
},
)
updates.avatar = {
cid: res.data.cid,
mimeType: newUserAvatar.mime,
}
}
await this.rootStore.api.app.bsky.actor.updateProfile(updates)
await this.rootStore.me.load()
await this.refresh()
}
@ -173,6 +186,7 @@ export class ProfileViewModel {
this.creator = res.data.creator
this.displayName = res.data.displayName
this.description = res.data.description
this.avatar = res.data.avatar
this.followersCount = res.data.followersCount
this.followsCount = res.data.followsCount
this.membersCount = res.data.membersCount

View File

@ -1,12 +1,10 @@
import {makeAutoObservable, runInAction} from 'mobx'
import {AtUri} from '../../third-party/uri'
import * as GetRepostedBy from '../../third-party/api/src/client/types/app/bsky/feed/getRepostedBy'
import {Main as DeclRef} from '../../third-party/api/src/client/types/app/bsky/system/declRef'
import {RootStoreModel} from './root-store'
import {Declaration} from './_common'
type RepostedByItem = GetRepostedBy.OutputSchema['repostedBy'][number]
export class RepostedByViewItemModel implements RepostedByItem {
export class RepostedByViewItemModel implements GetRepostedBy.RepostedBy {
// ui state
_reactKey: string = ''
@ -14,7 +12,8 @@ export class RepostedByViewItemModel implements RepostedByItem {
did: string = ''
handle: string = ''
displayName: string = ''
declaration: Declaration = {cid: '', actorType: ''}
avatar?: string
declaration: DeclRef = {cid: '', actorType: ''}
createdAt?: string
indexedAt: string = ''

View File

@ -30,7 +30,6 @@ export class SessionModel {
rootStore: false,
serialize: false,
hydrate: false,
_connectPromise: false,
})
}

View File

@ -58,6 +58,7 @@ export interface ComposerOptsPostRef {
author: {
handle: string
displayName?: string
avatar?: string
}
}
export interface ComposerOpts {

View File

@ -2,8 +2,7 @@ import {makeAutoObservable} from 'mobx'
import * as GetSuggestions from '../../third-party/api/src/client/types/app/bsky/actor/getSuggestions'
import {RootStoreModel} from './root-store'
type ResponseSuggestedActor = GetSuggestions.OutputSchema['actors'][number]
export type SuggestedActor = ResponseSuggestedActor & {
export type SuggestedActor = GetSuggestions.Actor & {
_reactKey: string
}

View File

@ -11,8 +11,8 @@ export class UserAutocompleteViewModel {
_searchPromise: Promise<any> | undefined
// data
follows: GetFollows.OutputSchema['follows'] = []
searchRes: SearchTypeahead.OutputSchema['users'] = []
follows: GetFollows.Follow[] = []
searchRes: SearchTypeahead.User[] = []
knownHandles: Set<string> = new Set()
constructor(public rootStore: RootStoreModel) {
@ -34,11 +34,13 @@ export class UserAutocompleteViewModel {
return this.searchRes.map(user => ({
handle: user.handle,
displayName: user.displayName,
avatar: user.avatar,
}))
}
return this.follows.map(follow => ({
handle: follow.handle,
displayName: follow.displayName,
avatar: follow.avatar,
}))
}

View File

@ -1,9 +1,9 @@
import {makeAutoObservable} from 'mobx'
import * as GetFollowers from '../../third-party/api/src/client/types/app/bsky/graph/getFollowers'
import * as ActorRef from '../../third-party/api/src/client/types/app/bsky/actor/ref'
import {RootStoreModel} from './root-store'
type Subject = GetFollowers.OutputSchema['subject']
export type FollowerItem = GetFollowers.OutputSchema['followers'][number] & {
export type FollowerItem = GetFollowers.Follower & {
_reactKey: string
}
@ -16,10 +16,9 @@ export class UserFollowersViewModel {
params: GetFollowers.QueryParams
// data
subject: Subject = {
subject: ActorRef.WithInfo = {
did: '',
handle: '',
displayName: '',
declaration: {cid: '', actorType: ''},
}
followers: FollowerItem[] = []
@ -102,6 +101,7 @@ export class UserFollowersViewModel {
this.subject.did = res.data.subject.did
this.subject.handle = res.data.subject.handle
this.subject.displayName = res.data.subject.displayName
this.subject.avatar = res.data.subject.avatar
this.followers.length = 0
let counter = 0
for (const item of res.data.followers) {

View File

@ -1,9 +1,9 @@
import {makeAutoObservable} from 'mobx'
import * as GetFollows from '../../third-party/api/src/client/types/app/bsky/graph/getFollows'
import * as ActorRef from '../../third-party/api/src/client/types/app/bsky/actor/ref'
import {RootStoreModel} from './root-store'
type Subject = GetFollows.OutputSchema['subject']
export type FollowItem = GetFollows.OutputSchema['follows'][number] & {
export type FollowItem = GetFollows.Follow & {
_reactKey: string
}
@ -16,10 +16,9 @@ export class UserFollowsViewModel {
params: GetFollows.QueryParams
// data
subject: Subject = {
subject: ActorRef.WithInfo = {
did: '',
handle: '',
displayName: '',
declaration: {cid: '', actorType: ''},
}
follows: FollowItem[] = []
@ -102,6 +101,7 @@ export class UserFollowsViewModel {
this.subject.did = res.data.subject.did
this.subject.handle = res.data.subject.handle
this.subject.displayName = res.data.subject.displayName
this.subject.avatar = res.data.subject.avatar
this.follows.length = 0
let counter = 0
for (const item of res.data.follows) {

View File

@ -1,11 +1,10 @@
import {makeAutoObservable, runInAction} from 'mobx'
import {AtUri} from '../../third-party/uri'
import * as GetVotes from '../../third-party/api/src/client/types/app/bsky/feed/getVotes'
import * as ActorRef from '../../third-party/api/src/client/types/app/bsky/actor/ref'
import {RootStoreModel} from './root-store'
type VoteItem = GetVotes.OutputSchema['votes'][number]
export class VotesViewItemModel implements VoteItem {
export class VotesViewItemModel implements GetVotes.Vote {
// ui state
_reactKey: string = ''
@ -13,9 +12,13 @@ export class VotesViewItemModel implements VoteItem {
direction: 'up' | 'down' = 'up'
indexedAt: string = ''
createdAt: string = ''
actor: GetVotes.Actor = {did: '', handle: ''}
actor: ActorRef.WithInfo = {
did: '',
handle: '',
declaration: {cid: '', actorType: ''},
}
constructor(reactKey: string, v: VoteItem) {
constructor(reactKey: string, v: GetVotes.Vote) {
makeAutoObservable(this)
this._reactKey = reactKey
Object.assign(this, v)
@ -127,7 +130,7 @@ export class VotesViewModel {
}
}
private _append(keyId: number, item: VoteItem) {
private _append(keyId: number, item: GetVotes.Vote) {
this.votes.push(new VotesViewItemModel(`item-${keyId}`, item))
}
}

View File

@ -69,6 +69,7 @@ __export(src_exports, {
AppNS: () => AppNS,
AssertionRecord: () => AssertionRecord,
AtprotoNS: () => AtprotoNS,
BlobNS: () => BlobNS,
BskyNS: () => BskyNS,
Client: () => Client2,
ComAtprotoAccountCreate: () => create_exports,
@ -77,6 +78,7 @@ __export(src_exports, {
ComAtprotoAccountGet: () => get_exports,
ComAtprotoAccountRequestPasswordReset: () => requestPasswordReset_exports,
ComAtprotoAccountResetPassword: () => resetPassword_exports,
ComAtprotoBlobUpload: () => upload_exports,
ComAtprotoHandleResolve: () => resolve_exports,
ComAtprotoRepoBatchWrite: () => batchWrite_exports,
ComAtprotoRepoCreateRecord: () => createRecord_exports,
@ -4375,6 +4377,36 @@ var lexicons = [
}
}
},
{
lexicon: 1,
id: "com.atproto.blob.upload",
defs: {
main: {
type: "procedure",
description: "Upload a new blob to be added to repo in a later request.",
input: {
encoding: "*/*"
},
output: {
encoding: "application/json",
schema: {
type: "object",
required: ["cid"],
properties: {
cid: {
type: "string"
}
}
}
},
errors: [
{
name: "InvalidBlob"
}
]
}
}
},
{
lexicon: 1,
id: "com.atproto.handle.resolve",
@ -5176,6 +5208,9 @@ var lexicons = [
type: "string",
maxLength: 256
},
avatar: {
type: "string"
},
followersCount: {
type: "integer"
},
@ -5271,6 +5306,9 @@ var lexicons = [
description: {
type: "string"
},
avatar: {
type: "string"
},
indexedAt: {
type: "datetime"
},
@ -5308,6 +5346,13 @@ var lexicons = [
description: {
type: "string",
maxLength: 256
},
avatar: {
type: "image",
accept: ["image/png", "image/jpeg"],
maxWidth: 500,
maxHeight: 500,
maxSize: 3e5
}
}
}
@ -5348,6 +5393,9 @@ var lexicons = [
displayName: {
type: "string",
maxLength: 64
},
avatar: {
type: "string"
}
}
}
@ -5416,6 +5464,9 @@ var lexicons = [
type: "string",
maxLength: 64
},
avatar: {
type: "string"
},
description: {
type: "string"
},
@ -5482,6 +5533,9 @@ var lexicons = [
displayName: {
type: "string",
maxLength: 64
},
avatar: {
type: "string"
}
}
}
@ -5509,6 +5563,13 @@ var lexicons = [
description: {
type: "string",
maxLength: 256
},
avatar: {
type: "image",
accept: ["image/png", "image/jpeg"],
maxWidth: 500,
maxHeight: 500,
maxSize: 1e5
}
}
}
@ -5943,6 +6004,9 @@ var lexicons = [
type: "string",
maxLength: 64
},
avatar: {
type: "string"
},
createdAt: {
type: "datetime"
},
@ -6589,7 +6653,7 @@ var lexicons = [
properties: {
subject: {
type: "ref",
ref: "lex:app.bsky.graph.getFollowers#subject"
ref: "lex:app.bsky.actor.ref#withInfo"
},
cursor: {
type: "string"
@ -6605,26 +6669,6 @@ var lexicons = [
}
}
},
subject: {
type: "object",
required: ["did", "declaration", "handle"],
properties: {
did: {
type: "string"
},
declaration: {
type: "ref",
ref: "lex:app.bsky.system.declRef"
},
handle: {
type: "string"
},
displayName: {
type: "string",
maxLength: 64
}
}
},
follower: {
type: "object",
required: ["did", "declaration", "handle", "indexedAt"],
@ -6643,6 +6687,9 @@ var lexicons = [
type: "string",
maxLength: 64
},
avatar: {
type: "string"
},
createdAt: {
type: "datetime"
},
@ -7201,20 +7248,28 @@ function toKnownErr6(e) {
return e;
}
// src/client/types/com/atproto/handle/resolve.ts
var resolve_exports = {};
__export(resolve_exports, {
// src/client/types/com/atproto/blob/upload.ts
var upload_exports = {};
__export(upload_exports, {
InvalidBlobError: () => InvalidBlobError,
toKnownErr: () => toKnownErr7
});
var InvalidBlobError = class extends XRPCError {
constructor(src) {
super(src.status, src.error, src.message);
}
};
function toKnownErr7(e) {
if (e instanceof XRPCError) {
if (e.error === "InvalidBlob")
return new InvalidBlobError(e);
}
return e;
}
// src/client/types/com/atproto/repo/batchWrite.ts
var batchWrite_exports = {};
__export(batchWrite_exports, {
// src/client/types/com/atproto/handle/resolve.ts
var resolve_exports = {};
__export(resolve_exports, {
toKnownErr: () => toKnownErr8
});
function toKnownErr8(e) {
@ -7223,9 +7278,9 @@ function toKnownErr8(e) {
return e;
}
// src/client/types/com/atproto/repo/createRecord.ts
var createRecord_exports = {};
__export(createRecord_exports, {
// src/client/types/com/atproto/repo/batchWrite.ts
var batchWrite_exports = {};
__export(batchWrite_exports, {
toKnownErr: () => toKnownErr9
});
function toKnownErr9(e) {
@ -7234,9 +7289,9 @@ function toKnownErr9(e) {
return e;
}
// src/client/types/com/atproto/repo/deleteRecord.ts
var deleteRecord_exports = {};
__export(deleteRecord_exports, {
// src/client/types/com/atproto/repo/createRecord.ts
var createRecord_exports = {};
__export(createRecord_exports, {
toKnownErr: () => toKnownErr10
});
function toKnownErr10(e) {
@ -7245,9 +7300,9 @@ function toKnownErr10(e) {
return e;
}
// src/client/types/com/atproto/repo/describe.ts
var describe_exports = {};
__export(describe_exports, {
// src/client/types/com/atproto/repo/deleteRecord.ts
var deleteRecord_exports = {};
__export(deleteRecord_exports, {
toKnownErr: () => toKnownErr11
});
function toKnownErr11(e) {
@ -7256,9 +7311,9 @@ function toKnownErr11(e) {
return e;
}
// src/client/types/com/atproto/repo/getRecord.ts
var getRecord_exports = {};
__export(getRecord_exports, {
// src/client/types/com/atproto/repo/describe.ts
var describe_exports = {};
__export(describe_exports, {
toKnownErr: () => toKnownErr12
});
function toKnownErr12(e) {
@ -7267,9 +7322,9 @@ function toKnownErr12(e) {
return e;
}
// src/client/types/com/atproto/repo/listRecords.ts
var listRecords_exports = {};
__export(listRecords_exports, {
// src/client/types/com/atproto/repo/getRecord.ts
var getRecord_exports = {};
__export(getRecord_exports, {
toKnownErr: () => toKnownErr13
});
function toKnownErr13(e) {
@ -7278,9 +7333,9 @@ function toKnownErr13(e) {
return e;
}
// src/client/types/com/atproto/repo/putRecord.ts
var putRecord_exports = {};
__export(putRecord_exports, {
// src/client/types/com/atproto/repo/listRecords.ts
var listRecords_exports = {};
__export(listRecords_exports, {
toKnownErr: () => toKnownErr14
});
function toKnownErr14(e) {
@ -7289,9 +7344,9 @@ function toKnownErr14(e) {
return e;
}
// src/client/types/com/atproto/server/getAccountsConfig.ts
var getAccountsConfig_exports = {};
__export(getAccountsConfig_exports, {
// src/client/types/com/atproto/repo/putRecord.ts
var putRecord_exports = {};
__export(putRecord_exports, {
toKnownErr: () => toKnownErr15
});
function toKnownErr15(e) {
@ -7300,9 +7355,9 @@ function toKnownErr15(e) {
return e;
}
// src/client/types/com/atproto/session/create.ts
var create_exports2 = {};
__export(create_exports2, {
// src/client/types/com/atproto/server/getAccountsConfig.ts
var getAccountsConfig_exports = {};
__export(getAccountsConfig_exports, {
toKnownErr: () => toKnownErr16
});
function toKnownErr16(e) {
@ -7311,9 +7366,9 @@ function toKnownErr16(e) {
return e;
}
// src/client/types/com/atproto/session/delete.ts
var delete_exports2 = {};
__export(delete_exports2, {
// src/client/types/com/atproto/session/create.ts
var create_exports2 = {};
__export(create_exports2, {
toKnownErr: () => toKnownErr17
});
function toKnownErr17(e) {
@ -7322,9 +7377,9 @@ function toKnownErr17(e) {
return e;
}
// src/client/types/com/atproto/session/get.ts
var get_exports2 = {};
__export(get_exports2, {
// src/client/types/com/atproto/session/delete.ts
var delete_exports2 = {};
__export(delete_exports2, {
toKnownErr: () => toKnownErr18
});
function toKnownErr18(e) {
@ -7333,9 +7388,9 @@ function toKnownErr18(e) {
return e;
}
// src/client/types/com/atproto/session/refresh.ts
var refresh_exports = {};
__export(refresh_exports, {
// src/client/types/com/atproto/session/get.ts
var get_exports2 = {};
__export(get_exports2, {
toKnownErr: () => toKnownErr19
});
function toKnownErr19(e) {
@ -7344,9 +7399,9 @@ function toKnownErr19(e) {
return e;
}
// src/client/types/com/atproto/sync/getRepo.ts
var getRepo_exports = {};
__export(getRepo_exports, {
// src/client/types/com/atproto/session/refresh.ts
var refresh_exports = {};
__export(refresh_exports, {
toKnownErr: () => toKnownErr20
});
function toKnownErr20(e) {
@ -7355,9 +7410,9 @@ function toKnownErr20(e) {
return e;
}
// src/client/types/com/atproto/sync/getRoot.ts
var getRoot_exports = {};
__export(getRoot_exports, {
// src/client/types/com/atproto/sync/getRepo.ts
var getRepo_exports = {};
__export(getRepo_exports, {
toKnownErr: () => toKnownErr21
});
function toKnownErr21(e) {
@ -7366,9 +7421,9 @@ function toKnownErr21(e) {
return e;
}
// src/client/types/com/atproto/sync/updateRepo.ts
var updateRepo_exports = {};
__export(updateRepo_exports, {
// src/client/types/com/atproto/sync/getRoot.ts
var getRoot_exports = {};
__export(getRoot_exports, {
toKnownErr: () => toKnownErr22
});
function toKnownErr22(e) {
@ -7377,12 +7432,23 @@ function toKnownErr22(e) {
return e;
}
// src/client/types/com/atproto/sync/updateRepo.ts
var updateRepo_exports = {};
__export(updateRepo_exports, {
toKnownErr: () => toKnownErr23
});
function toKnownErr23(e) {
if (e instanceof XRPCError) {
}
return e;
}
// src/client/types/app/bsky/actor/createScene.ts
var createScene_exports = {};
__export(createScene_exports, {
HandleNotAvailableError: () => HandleNotAvailableError2,
InvalidHandleError: () => InvalidHandleError2,
toKnownErr: () => toKnownErr23
toKnownErr: () => toKnownErr24
});
var InvalidHandleError2 = class extends XRPCError {
constructor(src) {
@ -7394,7 +7460,7 @@ var HandleNotAvailableError2 = class extends XRPCError {
super(src.status, src.error, src.message);
}
};
function toKnownErr23(e) {
function toKnownErr24(e) {
if (e instanceof XRPCError) {
if (e.error === "InvalidHandle")
return new InvalidHandleError2(e);
@ -7407,17 +7473,6 @@ function toKnownErr23(e) {
// src/client/types/app/bsky/actor/getProfile.ts
var getProfile_exports = {};
__export(getProfile_exports, {
toKnownErr: () => toKnownErr24
});
function toKnownErr24(e) {
if (e instanceof XRPCError) {
}
return e;
}
// src/client/types/app/bsky/actor/getSuggestions.ts
var getSuggestions_exports = {};
__export(getSuggestions_exports, {
toKnownErr: () => toKnownErr25
});
function toKnownErr25(e) {
@ -7426,9 +7481,9 @@ function toKnownErr25(e) {
return e;
}
// src/client/types/app/bsky/actor/search.ts
var search_exports = {};
__export(search_exports, {
// src/client/types/app/bsky/actor/getSuggestions.ts
var getSuggestions_exports = {};
__export(getSuggestions_exports, {
toKnownErr: () => toKnownErr26
});
function toKnownErr26(e) {
@ -7437,9 +7492,9 @@ function toKnownErr26(e) {
return e;
}
// src/client/types/app/bsky/actor/searchTypeahead.ts
var searchTypeahead_exports = {};
__export(searchTypeahead_exports, {
// src/client/types/app/bsky/actor/search.ts
var search_exports = {};
__export(search_exports, {
toKnownErr: () => toKnownErr27
});
function toKnownErr27(e) {
@ -7448,9 +7503,9 @@ function toKnownErr27(e) {
return e;
}
// src/client/types/app/bsky/actor/updateProfile.ts
var updateProfile_exports = {};
__export(updateProfile_exports, {
// src/client/types/app/bsky/actor/searchTypeahead.ts
var searchTypeahead_exports = {};
__export(searchTypeahead_exports, {
toKnownErr: () => toKnownErr28
});
function toKnownErr28(e) {
@ -7459,9 +7514,9 @@ function toKnownErr28(e) {
return e;
}
// src/client/types/app/bsky/feed/getAuthorFeed.ts
var getAuthorFeed_exports = {};
__export(getAuthorFeed_exports, {
// src/client/types/app/bsky/actor/updateProfile.ts
var updateProfile_exports = {};
__export(updateProfile_exports, {
toKnownErr: () => toKnownErr29
});
function toKnownErr29(e) {
@ -7470,18 +7525,29 @@ function toKnownErr29(e) {
return e;
}
// src/client/types/app/bsky/feed/getAuthorFeed.ts
var getAuthorFeed_exports = {};
__export(getAuthorFeed_exports, {
toKnownErr: () => toKnownErr30
});
function toKnownErr30(e) {
if (e instanceof XRPCError) {
}
return e;
}
// src/client/types/app/bsky/feed/getPostThread.ts
var getPostThread_exports = {};
__export(getPostThread_exports, {
NotFoundError: () => NotFoundError,
toKnownErr: () => toKnownErr30
toKnownErr: () => toKnownErr31
});
var NotFoundError = class extends XRPCError {
constructor(src) {
super(src.status, src.error, src.message);
}
};
function toKnownErr30(e) {
function toKnownErr31(e) {
if (e instanceof XRPCError) {
if (e.error === "NotFound")
return new NotFoundError(e);
@ -7492,17 +7558,6 @@ function toKnownErr30(e) {
// src/client/types/app/bsky/feed/getRepostedBy.ts
var getRepostedBy_exports = {};
__export(getRepostedBy_exports, {
toKnownErr: () => toKnownErr31
});
function toKnownErr31(e) {
if (e instanceof XRPCError) {
}
return e;
}
// src/client/types/app/bsky/feed/getTimeline.ts
var getTimeline_exports = {};
__export(getTimeline_exports, {
toKnownErr: () => toKnownErr32
});
function toKnownErr32(e) {
@ -7511,9 +7566,9 @@ function toKnownErr32(e) {
return e;
}
// src/client/types/app/bsky/feed/getVotes.ts
var getVotes_exports = {};
__export(getVotes_exports, {
// src/client/types/app/bsky/feed/getTimeline.ts
var getTimeline_exports = {};
__export(getTimeline_exports, {
toKnownErr: () => toKnownErr33
});
function toKnownErr33(e) {
@ -7522,9 +7577,9 @@ function toKnownErr33(e) {
return e;
}
// src/client/types/app/bsky/feed/setVote.ts
var setVote_exports = {};
__export(setVote_exports, {
// src/client/types/app/bsky/feed/getVotes.ts
var getVotes_exports = {};
__export(getVotes_exports, {
toKnownErr: () => toKnownErr34
});
function toKnownErr34(e) {
@ -7533,9 +7588,9 @@ function toKnownErr34(e) {
return e;
}
// src/client/types/app/bsky/graph/getAssertions.ts
var getAssertions_exports = {};
__export(getAssertions_exports, {
// src/client/types/app/bsky/feed/setVote.ts
var setVote_exports = {};
__export(setVote_exports, {
toKnownErr: () => toKnownErr35
});
function toKnownErr35(e) {
@ -7544,9 +7599,9 @@ function toKnownErr35(e) {
return e;
}
// src/client/types/app/bsky/graph/getFollowers.ts
var getFollowers_exports = {};
__export(getFollowers_exports, {
// src/client/types/app/bsky/graph/getAssertions.ts
var getAssertions_exports = {};
__export(getAssertions_exports, {
toKnownErr: () => toKnownErr36
});
function toKnownErr36(e) {
@ -7555,9 +7610,9 @@ function toKnownErr36(e) {
return e;
}
// src/client/types/app/bsky/graph/getFollows.ts
var getFollows_exports = {};
__export(getFollows_exports, {
// src/client/types/app/bsky/graph/getFollowers.ts
var getFollowers_exports = {};
__export(getFollowers_exports, {
toKnownErr: () => toKnownErr37
});
function toKnownErr37(e) {
@ -7566,9 +7621,9 @@ function toKnownErr37(e) {
return e;
}
// src/client/types/app/bsky/graph/getMembers.ts
var getMembers_exports = {};
__export(getMembers_exports, {
// src/client/types/app/bsky/graph/getFollows.ts
var getFollows_exports = {};
__export(getFollows_exports, {
toKnownErr: () => toKnownErr38
});
function toKnownErr38(e) {
@ -7577,9 +7632,9 @@ function toKnownErr38(e) {
return e;
}
// src/client/types/app/bsky/graph/getMemberships.ts
var getMemberships_exports = {};
__export(getMemberships_exports, {
// src/client/types/app/bsky/graph/getMembers.ts
var getMembers_exports = {};
__export(getMembers_exports, {
toKnownErr: () => toKnownErr39
});
function toKnownErr39(e) {
@ -7588,9 +7643,9 @@ function toKnownErr39(e) {
return e;
}
// src/client/types/app/bsky/notification/getCount.ts
var getCount_exports = {};
__export(getCount_exports, {
// src/client/types/app/bsky/graph/getMemberships.ts
var getMemberships_exports = {};
__export(getMemberships_exports, {
toKnownErr: () => toKnownErr40
});
function toKnownErr40(e) {
@ -7599,9 +7654,9 @@ function toKnownErr40(e) {
return e;
}
// src/client/types/app/bsky/notification/list.ts
var list_exports = {};
__export(list_exports, {
// src/client/types/app/bsky/notification/getCount.ts
var getCount_exports = {};
__export(getCount_exports, {
toKnownErr: () => toKnownErr41
});
function toKnownErr41(e) {
@ -7610,9 +7665,9 @@ function toKnownErr41(e) {
return e;
}
// src/client/types/app/bsky/notification/updateSeen.ts
var updateSeen_exports = {};
__export(updateSeen_exports, {
// src/client/types/app/bsky/notification/list.ts
var list_exports = {};
__export(list_exports, {
toKnownErr: () => toKnownErr42
});
function toKnownErr42(e) {
@ -7621,6 +7676,17 @@ function toKnownErr42(e) {
return e;
}
// src/client/types/app/bsky/notification/updateSeen.ts
var updateSeen_exports = {};
__export(updateSeen_exports, {
toKnownErr: () => toKnownErr43
});
function toKnownErr43(e) {
if (e instanceof XRPCError) {
}
return e;
}
// src/client/types/com/atproto/repo/strongRef.ts
var strongRef_exports = {};
@ -7729,6 +7795,7 @@ var AtprotoNS = class {
constructor(service) {
this._service = service;
this.account = new AccountNS(service);
this.blob = new BlobNS(service);
this.handle = new HandleNS(service);
this.repo = new RepoNS(service);
this.server = new ServerNS(service);
@ -7771,13 +7838,23 @@ var AccountNS = class {
});
}
};
var BlobNS = class {
constructor(service) {
this._service = service;
}
upload(data, opts) {
return this._service.xrpc.call("com.atproto.blob.upload", opts?.qp, data, opts).catch((e) => {
throw toKnownErr7(e);
});
}
};
var HandleNS = class {
constructor(service) {
this._service = service;
}
resolve(params2, opts) {
return this._service.xrpc.call("com.atproto.handle.resolve", params2, void 0, opts).catch((e) => {
throw toKnownErr7(e);
throw toKnownErr8(e);
});
}
};
@ -7787,37 +7864,37 @@ var RepoNS = class {
}
batchWrite(data, opts) {
return this._service.xrpc.call("com.atproto.repo.batchWrite", opts?.qp, data, opts).catch((e) => {
throw toKnownErr8(e);
throw toKnownErr9(e);
});
}
createRecord(data, opts) {
return this._service.xrpc.call("com.atproto.repo.createRecord", opts?.qp, data, opts).catch((e) => {
throw toKnownErr9(e);
throw toKnownErr10(e);
});
}
deleteRecord(data, opts) {
return this._service.xrpc.call("com.atproto.repo.deleteRecord", opts?.qp, data, opts).catch((e) => {
throw toKnownErr10(e);
throw toKnownErr11(e);
});
}
describe(params2, opts) {
return this._service.xrpc.call("com.atproto.repo.describe", params2, void 0, opts).catch((e) => {
throw toKnownErr11(e);
throw toKnownErr12(e);
});
}
getRecord(params2, opts) {
return this._service.xrpc.call("com.atproto.repo.getRecord", params2, void 0, opts).catch((e) => {
throw toKnownErr12(e);
throw toKnownErr13(e);
});
}
listRecords(params2, opts) {
return this._service.xrpc.call("com.atproto.repo.listRecords", params2, void 0, opts).catch((e) => {
throw toKnownErr13(e);
throw toKnownErr14(e);
});
}
putRecord(data, opts) {
return this._service.xrpc.call("com.atproto.repo.putRecord", opts?.qp, data, opts).catch((e) => {
throw toKnownErr14(e);
throw toKnownErr15(e);
});
}
};
@ -7827,7 +7904,7 @@ var ServerNS = class {
}
getAccountsConfig(params2, opts) {
return this._service.xrpc.call("com.atproto.server.getAccountsConfig", params2, void 0, opts).catch((e) => {
throw toKnownErr15(e);
throw toKnownErr16(e);
});
}
};
@ -7837,22 +7914,22 @@ var SessionNS = class {
}
create(data, opts) {
return this._service.xrpc.call("com.atproto.session.create", opts?.qp, data, opts).catch((e) => {
throw toKnownErr16(e);
throw toKnownErr17(e);
});
}
delete(data, opts) {
return this._service.xrpc.call("com.atproto.session.delete", opts?.qp, data, opts).catch((e) => {
throw toKnownErr17(e);
throw toKnownErr18(e);
});
}
get(params2, opts) {
return this._service.xrpc.call("com.atproto.session.get", params2, void 0, opts).catch((e) => {
throw toKnownErr18(e);
throw toKnownErr19(e);
});
}
refresh(data, opts) {
return this._service.xrpc.call("com.atproto.session.refresh", opts?.qp, data, opts).catch((e) => {
throw toKnownErr19(e);
throw toKnownErr20(e);
});
}
};
@ -7862,17 +7939,17 @@ var SyncNS = class {
}
getRepo(params2, opts) {
return this._service.xrpc.call("com.atproto.sync.getRepo", params2, void 0, opts).catch((e) => {
throw toKnownErr20(e);
throw toKnownErr21(e);
});
}
getRoot(params2, opts) {
return this._service.xrpc.call("com.atproto.sync.getRoot", params2, void 0, opts).catch((e) => {
throw toKnownErr21(e);
throw toKnownErr22(e);
});
}
updateRepo(data, opts) {
return this._service.xrpc.call("com.atproto.sync.updateRepo", opts?.qp, data, opts).catch((e) => {
throw toKnownErr22(e);
throw toKnownErr23(e);
});
}
};
@ -7899,32 +7976,32 @@ var ActorNS = class {
}
createScene(data, opts) {
return this._service.xrpc.call("app.bsky.actor.createScene", opts?.qp, data, opts).catch((e) => {
throw toKnownErr23(e);
throw toKnownErr24(e);
});
}
getProfile(params2, opts) {
return this._service.xrpc.call("app.bsky.actor.getProfile", params2, void 0, opts).catch((e) => {
throw toKnownErr24(e);
throw toKnownErr25(e);
});
}
getSuggestions(params2, opts) {
return this._service.xrpc.call("app.bsky.actor.getSuggestions", params2, void 0, opts).catch((e) => {
throw toKnownErr25(e);
throw toKnownErr26(e);
});
}
search(params2, opts) {
return this._service.xrpc.call("app.bsky.actor.search", params2, void 0, opts).catch((e) => {
throw toKnownErr26(e);
throw toKnownErr27(e);
});
}
searchTypeahead(params2, opts) {
return this._service.xrpc.call("app.bsky.actor.searchTypeahead", params2, void 0, opts).catch((e) => {
throw toKnownErr27(e);
throw toKnownErr28(e);
});
}
updateProfile(data, opts) {
return this._service.xrpc.call("app.bsky.actor.updateProfile", opts?.qp, data, opts).catch((e) => {
throw toKnownErr28(e);
throw toKnownErr29(e);
});
}
};
@ -7975,32 +8052,32 @@ var FeedNS = class {
}
getAuthorFeed(params2, opts) {
return this._service.xrpc.call("app.bsky.feed.getAuthorFeed", params2, void 0, opts).catch((e) => {
throw toKnownErr29(e);
throw toKnownErr30(e);
});
}
getPostThread(params2, opts) {
return this._service.xrpc.call("app.bsky.feed.getPostThread", params2, void 0, opts).catch((e) => {
throw toKnownErr30(e);
throw toKnownErr31(e);
});
}
getRepostedBy(params2, opts) {
return this._service.xrpc.call("app.bsky.feed.getRepostedBy", params2, void 0, opts).catch((e) => {
throw toKnownErr31(e);
throw toKnownErr32(e);
});
}
getTimeline(params2, opts) {
return this._service.xrpc.call("app.bsky.feed.getTimeline", params2, void 0, opts).catch((e) => {
throw toKnownErr32(e);
throw toKnownErr33(e);
});
}
getVotes(params2, opts) {
return this._service.xrpc.call("app.bsky.feed.getVotes", params2, void 0, opts).catch((e) => {
throw toKnownErr33(e);
throw toKnownErr34(e);
});
}
setVote(data, opts) {
return this._service.xrpc.call("app.bsky.feed.setVote", opts?.qp, data, opts).catch((e) => {
throw toKnownErr34(e);
throw toKnownErr35(e);
});
}
};
@ -8161,27 +8238,27 @@ var GraphNS = class {
}
getAssertions(params2, opts) {
return this._service.xrpc.call("app.bsky.graph.getAssertions", params2, void 0, opts).catch((e) => {
throw toKnownErr35(e);
throw toKnownErr36(e);
});
}
getFollowers(params2, opts) {
return this._service.xrpc.call("app.bsky.graph.getFollowers", params2, void 0, opts).catch((e) => {
throw toKnownErr36(e);
throw toKnownErr37(e);
});
}
getFollows(params2, opts) {
return this._service.xrpc.call("app.bsky.graph.getFollows", params2, void 0, opts).catch((e) => {
throw toKnownErr37(e);
throw toKnownErr38(e);
});
}
getMembers(params2, opts) {
return this._service.xrpc.call("app.bsky.graph.getMembers", params2, void 0, opts).catch((e) => {
throw toKnownErr38(e);
throw toKnownErr39(e);
});
}
getMemberships(params2, opts) {
return this._service.xrpc.call("app.bsky.graph.getMemberships", params2, void 0, opts).catch((e) => {
throw toKnownErr39(e);
throw toKnownErr40(e);
});
}
};
@ -8302,17 +8379,17 @@ var NotificationNS = class {
}
getCount(params2, opts) {
return this._service.xrpc.call("app.bsky.notification.getCount", params2, void 0, opts).catch((e) => {
throw toKnownErr40(e);
throw toKnownErr41(e);
});
}
list(params2, opts) {
return this._service.xrpc.call("app.bsky.notification.list", params2, void 0, opts).catch((e) => {
throw toKnownErr41(e);
throw toKnownErr42(e);
});
}
updateSeen(data, opts) {
return this._service.xrpc.call("app.bsky.notification.updateSeen", opts?.qp, data, opts).catch((e) => {
throw toKnownErr42(e);
throw toKnownErr43(e);
});
}
};
@ -8528,6 +8605,7 @@ var SessionManager = class extends import_events.default {
AppNS,
AssertionRecord,
AtprotoNS,
BlobNS,
BskyNS,
Client,
ComAtprotoAccountCreate,
@ -8536,6 +8614,7 @@ var SessionManager = class extends import_events.default {
ComAtprotoAccountGet,
ComAtprotoAccountRequestPasswordReset,
ComAtprotoAccountResetPassword,
ComAtprotoBlobUpload,
ComAtprotoHandleResolve,
ComAtprotoRepoBatchWrite,
ComAtprotoRepoCreateRecord,

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,7 @@ import * as ComAtprotoAccountDelete from './types/com/atproto/account/delete';
import * as ComAtprotoAccountGet from './types/com/atproto/account/get';
import * as ComAtprotoAccountRequestPasswordReset from './types/com/atproto/account/requestPasswordReset';
import * as ComAtprotoAccountResetPassword from './types/com/atproto/account/resetPassword';
import * as ComAtprotoBlobUpload from './types/com/atproto/blob/upload';
import * as ComAtprotoHandleResolve from './types/com/atproto/handle/resolve';
import * as ComAtprotoRepoBatchWrite from './types/com/atproto/repo/batchWrite';
import * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createRecord';
@ -56,6 +57,7 @@ export * as ComAtprotoAccountDelete from './types/com/atproto/account/delete';
export * as ComAtprotoAccountGet from './types/com/atproto/account/get';
export * as ComAtprotoAccountRequestPasswordReset from './types/com/atproto/account/requestPasswordReset';
export * as ComAtprotoAccountResetPassword from './types/com/atproto/account/resetPassword';
export * as ComAtprotoBlobUpload from './types/com/atproto/blob/upload';
export * as ComAtprotoHandleResolve from './types/com/atproto/handle/resolve';
export * as ComAtprotoRepoBatchWrite from './types/com/atproto/repo/batchWrite';
export * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createRecord';
@ -140,6 +142,7 @@ export declare class ComNS {
export declare class AtprotoNS {
_service: ServiceClient;
account: AccountNS;
blob: BlobNS;
handle: HandleNS;
repo: RepoNS;
server: ServerNS;
@ -157,6 +160,11 @@ export declare class AccountNS {
requestPasswordReset(data?: ComAtprotoAccountRequestPasswordReset.InputSchema, opts?: ComAtprotoAccountRequestPasswordReset.CallOptions): Promise<ComAtprotoAccountRequestPasswordReset.Response>;
resetPassword(data?: ComAtprotoAccountResetPassword.InputSchema, opts?: ComAtprotoAccountResetPassword.CallOptions): Promise<ComAtprotoAccountResetPassword.Response>;
}
export declare class BlobNS {
_service: ServiceClient;
constructor(service: ServiceClient);
upload(data?: ComAtprotoBlobUpload.InputSchema, opts?: ComAtprotoBlobUpload.CallOptions): Promise<ComAtprotoBlobUpload.Response>;
}
export declare class HandleNS {
_service: ServiceClient;
constructor(service: ServiceClient);

View File

@ -7,6 +7,7 @@ export declare const ids: {
ComAtprotoAccountGet: string;
ComAtprotoAccountRequestPasswordReset: string;
ComAtprotoAccountResetPassword: string;
ComAtprotoBlobUpload: string;
ComAtprotoHandleResolve: string;
ComAtprotoRepoBatchWrite: string;
ComAtprotoRepoCreateRecord: string;

View File

@ -11,6 +11,7 @@ export interface OutputSchema {
creator: string;
displayName?: string;
description?: string;
avatar?: string;
followersCount: number;
followsCount: number;
membersCount: number;

View File

@ -25,6 +25,7 @@ export interface Actor {
handle: string;
displayName?: string;
description?: string;
avatar?: string;
indexedAt?: string;
myState?: MyState;
[k: string]: unknown;

View File

@ -1,5 +1,10 @@
export interface Record {
displayName: string;
description?: string;
avatar?: {
cid: string;
mimeType: string;
[k: string]: unknown;
};
[k: string]: unknown;
}

View File

@ -9,5 +9,6 @@ export interface WithInfo {
declaration: AppBskySystemDeclRef.Main;
handle: string;
displayName?: string;
avatar?: string;
[k: string]: unknown;
}

View File

@ -25,6 +25,7 @@ export interface User {
declaration: AppBskySystemDeclRef.Main;
handle: string;
displayName?: string;
avatar?: string;
description?: string;
indexedAt?: string;
[k: string]: unknown;

View File

@ -23,5 +23,6 @@ export interface User {
declaration: AppBskySystemDeclRef.Main;
handle: string;
displayName?: string;
avatar?: string;
[k: string]: unknown;
}

View File

@ -5,6 +5,11 @@ export interface InputSchema {
did?: string;
displayName?: string;
description?: string;
avatar?: {
cid: string;
mimeType: string;
[k: string]: unknown;
};
[k: string]: unknown;
}
export interface OutputSchema {

View File

@ -28,6 +28,7 @@ export interface RepostedBy {
declaration: AppBskySystemDeclRef.Main;
handle: string;
displayName?: string;
avatar?: string;
createdAt?: string;
indexedAt: string;
[k: string]: unknown;

View File

@ -1,4 +1,5 @@
import { Headers } from '@atproto/xrpc';
import * as AppBskyActorRef from '../actor/ref';
import * as AppBskySystemDeclRef from '../system/declRef';
export interface QueryParams {
user: string;
@ -7,7 +8,7 @@ export interface QueryParams {
}
export declare type InputSchema = undefined;
export interface OutputSchema {
subject: Subject;
subject: AppBskyActorRef.WithInfo;
cursor?: string;
followers: Follower[];
[k: string]: unknown;
@ -21,18 +22,12 @@ export interface Response {
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;
export interface Subject {
did: string;
declaration: AppBskySystemDeclRef.Main;
handle: string;
displayName?: string;
[k: string]: unknown;
}
export interface Follower {
did: string;
declaration: AppBskySystemDeclRef.Main;
handle: string;
displayName?: string;
avatar?: string;
createdAt?: string;
indexedAt: string;
[k: string]: unknown;

View File

@ -0,0 +1,22 @@
import { Headers, XRPCError } from '@atproto/xrpc';
export interface QueryParams {
}
export declare type InputSchema = string | Uint8Array;
export interface OutputSchema {
cid: string;
[k: string]: unknown;
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: '*/*';
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare class InvalidBlobError extends XRPCError {
constructor(src: XRPCError);
}
export declare function toKnownErr(e: any): any;

View File

@ -0,0 +1,22 @@
import { Headers, XRPCError } from '@atproto/xrpc';
export interface QueryParams {
}
export declare type InputSchema = string | Uint8Array;
export interface OutputSchema {
cid: string;
[k: string]: unknown;
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: '*/*';
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare class InvalidBlobError extends XRPCError {
constructor(src: XRPCError);
}
export declare function toKnownErr(e: any): any;

File diff suppressed because one or more lines are too long

View File

@ -205,6 +205,7 @@ export const ComposePost = observer(function ComposePost({
<UserAvatar
handle={replyTo.author.handle}
displayName={replyTo.author.displayName}
avatar={replyTo.author.avatar}
size={50}
/>
<View style={styles.replyToPost}>
@ -223,6 +224,7 @@ export const ComposePost = observer(function ComposePost({
<UserAvatar
handle={store.me.handle || ''}
displayName={store.me.displayName}
avatar={store.me.avatar}
size={50}
/>
<TextInput

View File

@ -29,6 +29,7 @@ export function ComposePrompt({
size={50}
handle={store.me.handle || ''}
displayName={store.me.displayName}
avatar={store.me.avatar}
/>
</TouchableOpacity>
) : undefined}

View File

@ -149,6 +149,7 @@ const User = ({
size={40}
displayName={item.displayName}
handle={item.handle}
avatar={item.avatar}
/>
</View>
<View style={styles.actorContent}>

View File

@ -1,8 +1,10 @@
import React, {useState} from 'react'
import {ComAtprotoBlobUpload} from '../../../third-party/api/index'
import * as Toast from '../util/Toast'
import {StyleSheet, Text, TouchableOpacity, View} from 'react-native'
import LinearGradient from 'react-native-linear-gradient'
import {BottomSheetScrollView, BottomSheetTextInput} from '@gorhom/bottom-sheet'
import {Image as PickedImage} from 'react-native-image-crop-picker'
import {ErrorMessage} from '../util/ErrorMessage'
import {useStores} from '../../../state'
import {ProfileViewModel} from '../../../state/models/profile-view'
@ -12,7 +14,6 @@ import {
MAX_DISPLAY_NAME,
MAX_DESCRIPTION,
} from '../../../lib/strings'
import * as Profile from '../../../third-party/api/src/client/types/app/bsky/actor/profile'
import {UserBanner} from '../util/UserBanner'
import {UserAvatar} from '../util/UserAvatar'
@ -36,40 +37,44 @@ export function Component({
const [userBanner, setUserBanner] = useState<string | null>(
profileView.userBanner,
)
const [userAvatar, setUserAvatar] = useState<string | null>(
profileView.userAvatar,
const [userAvatar, setUserAvatar] = useState<string | undefined>(
profileView.avatar,
)
const [newUserAvatar, setNewUserAvatar] = useState<PickedImage | undefined>()
const onPressCancel = () => {
store.shell.closeModal()
}
const onSelectNewAvatar = (img: PickedImage) => {
console.log(img)
setNewUserAvatar(img)
setUserAvatar(img.path)
}
const onPressSave = async () => {
if (error) {
setError('')
}
try {
await profileView.updateProfile(
(existing?: Profile.Record): Profile.Record => {
if (existing) {
existing.displayName = displayName
existing.description = description
return existing
}
return {
displayName,
description,
}
{
displayName,
description,
},
userAvatar, // TEMP
newUserAvatar,
userBanner, // TEMP
)
Toast.show('Profile updated')
onUpdate?.()
store.shell.closeModal()
} catch (e: any) {
console.error(e)
setError(
'Failed to save your profile. Check your internet connection and try again.',
)
if (e instanceof ComAtprotoBlobUpload.InvalidBlobError) {
setError(e.message)
} else {
// TODO replace when error detection is correct
setError(e.message)
// setError(
// 'Failed to save your profile. Check your internet connection and try again.',
// )
}
}
}
@ -86,15 +91,15 @@ export function Component({
<View style={styles.avi}>
<UserAvatar
size={80}
userAvatar={userAvatar}
avatar={userAvatar}
handle={profileView.handle}
setUserAvatar={setUserAvatar}
onSelectNewAvatar={onSelectNewAvatar}
displayName={profileView.displayName}
/>
</View>
</View>
{error !== '' && (
<View style={s.mb10}>
<View style={{marginTop: 20}}>
<ErrorMessage message={error} />
</View>
)}

View File

@ -130,6 +130,7 @@ export const Component = observer(function Component({
did={item.did}
handle={item.handle}
displayName={item.displayName}
avatar={item.avatar}
renderButton={() =>
!createdInvite ? (
<>
@ -162,6 +163,7 @@ export const Component = observer(function Component({
did={item.subject.did}
handle={item.subject.handle}
displayName={item.subject.displayName}
avatar={item.subject.avatar}
renderButton={() => (
<>
<FontAwesomeIcon icon="x" style={[s.mr5]} size={14} />

View File

@ -139,6 +139,7 @@ export const FeedItem = observer(function FeedItem({
size={30}
displayName={author.displayName}
handle={author.handle}
avatar={author.avatar}
/>
</Link>
))}

View File

@ -26,6 +26,7 @@ export function InviteAccepter({item}: {item: NotificationsViewItemModel}) {
did={item.author.did}
handle={item.author.handle}
displayName={item.author.displayName}
avatar={item.author.avatar}
/>
</View>
</View>

View File

@ -93,6 +93,7 @@ const RepostedByItem = ({item}: {item: RepostedByViewItemModel}) => {
size={40}
displayName={item.displayName}
handle={item.handle}
avatar={item.avatar}
/>
</View>
<View style={styles.layoutContent}>

View File

@ -61,6 +61,7 @@ export const PostThreadItem = observer(function PostThreadItem({
author: {
handle: item.author.handle,
displayName: item.author.displayName,
avatar: item.author.avatar,
},
},
onPost: onPostReply,
@ -113,6 +114,7 @@ export const PostThreadItem = observer(function PostThreadItem({
size={50}
displayName={item.author.displayName}
handle={item.author.handle}
avatar={item.author.avatar}
/>
</Link>
</View>
@ -236,6 +238,7 @@ export const PostThreadItem = observer(function PostThreadItem({
<UserAvatar
handle={item.replyingTo.author.handle}
displayName={item.replyingTo.author.displayName}
avatar={item.replyingTo.author.avatar}
size={30}
/>
</View>
@ -251,6 +254,7 @@ export const PostThreadItem = observer(function PostThreadItem({
size={50}
displayName={item.author.displayName}
handle={item.author.handle}
avatar={item.author.avatar}
/>
</Link>
</View>

View File

@ -93,6 +93,7 @@ const LikedByItem = ({item}: {item: VotesViewItemModel}) => {
size={40}
displayName={item.actor.displayName}
handle={item.actor.handle}
avatar={item.actor.avatar}
/>
</View>
<View style={styles.layoutContent}>

View File

@ -97,6 +97,7 @@ export const Post = observer(function Post({
author: {
handle: item.author.handle,
displayName: item.author.displayName,
avatar: item.author.avatar,
},
},
})
@ -137,6 +138,7 @@ export const Post = observer(function Post({
size={50}
displayName={item.author.displayName}
handle={item.author.handle}
avatar={item.author.avatar}
/>
</Link>
</View>

View File

@ -54,6 +54,7 @@ export const FeedItem = observer(function FeedItem({
author: {
handle: item.author.handle,
displayName: item.author.displayName,
avatar: item.author.avatar,
},
},
})
@ -139,6 +140,7 @@ export const FeedItem = observer(function FeedItem({
displayName={
item.additionalParentPost?.thread?.author.displayName
}
avatar={item.additionalParentPost?.thread?.author.avatar}
size={32}
/>
</View>
@ -159,6 +161,7 @@ export const FeedItem = observer(function FeedItem({
size={item._isThreadChild ? 30 : 50}
displayName={item.author.displayName}
handle={item.author.handle}
avatar={item.author.avatar}
/>
</Link>
</View>

View File

@ -8,14 +8,14 @@ export function ProfileCard({
did,
handle,
displayName,
description,
avatar,
renderButton,
onPressButton,
}: {
did: string
handle: string
displayName?: string
description?: string
avatar?: string
renderButton?: () => JSX.Element
onPressButton?: () => void
}) {
@ -23,7 +23,12 @@ export function ProfileCard({
<Link style={styles.outer} href={`/profile/${handle}`} title={handle}>
<View style={styles.layout}>
<View style={styles.layoutAvi}>
<UserAvatar size={40} displayName={displayName} handle={handle} />
<UserAvatar
size={40}
displayName={displayName}
handle={handle}
avatar={avatar}
/>
</View>
<View style={styles.layoutContent}>
<Text style={[s.f16, s.bold]} numberOfLines={1}>

View File

@ -91,6 +91,7 @@ const User = ({item}: {item: FollowerItem}) => {
size={40}
displayName={item.displayName}
handle={item.handle}
avatar={item.avatar}
/>
</View>
<View style={styles.layoutContent}>

View File

@ -91,6 +91,7 @@ const User = ({item}: {item: FollowItem}) => {
size={40}
displayName={item.displayName}
handle={item.handle}
avatar={item.avatar}
/>
</View>
<View style={styles.layoutContent}>

View File

@ -158,7 +158,7 @@ export const ProfileHeader = observer(function ProfileHeader({
size={80}
handle={view.handle}
displayName={view.displayName}
userAvatar={view.userAvatar}
avatar={view.avatar}
/>
</View>
<View style={styles.content}>

View File

@ -65,6 +65,7 @@ export const ProfileMembers = observer(function ProfileMembers({
did={item.did}
handle={item.handle}
displayName={item.displayName}
avatar={item.avatar}
/>
)
return (

View File

@ -6,23 +6,23 @@ import {
openCamera,
openCropper,
openPicker,
Image as PickedImage,
} from 'react-native-image-crop-picker'
import {getGradient} from '../../lib/asset-gen'
import {colors} from '../../lib/styles'
import {IMAGES_ENABLED} from '../../../build-flags'
export function UserAvatar({
size,
handle,
userAvatar,
avatar,
displayName,
setUserAvatar,
onSelectNewAvatar,
}: {
size: number
handle: string
displayName: string | undefined
userAvatar?: string | null
setUserAvatar?: React.Dispatch<React.SetStateAction<string | null>>
avatar?: string | null
onSelectNewAvatar?: (img: PickedImage) => void
}) {
const initials = getInitials(displayName || handle)
const gradient = getGradient(handle)
@ -35,14 +35,12 @@ export function UserAvatar({
openCamera({
mediaType: 'photo',
cropping: true,
width: 80,
height: 80,
width: 400,
height: 400,
cropperCircleOverlay: true,
}).then(item => {
if (setUserAvatar != null) {
setUserAvatar(item.path)
}
})
forceJpg: true, // ios only
compressImageQuality: 0.7,
}).then(onSelectNewAvatar)
},
},
{
@ -54,19 +52,17 @@ export function UserAvatar({
await openCropper({
mediaType: 'photo',
path: item.path,
width: 80,
height: 80,
width: 400,
height: 400,
cropperCircleOverlay: true,
}).then(croppedItem => {
if (setUserAvatar != null) {
setUserAvatar(croppedItem.path)
}
})
forceJpg: true, // ios only
compressImageQuality: 0.7,
}).then(onSelectNewAvatar)
})
},
},
])
}, [setUserAvatar])
}, [onSelectNewAvatar])
const renderSvg = (size: number, initials: string) => (
<Svg width={size} height={size} viewBox="0 0 100 100">
@ -89,11 +85,14 @@ export function UserAvatar({
</Svg>
)
// setUserAvatar is only passed as prop on the EditProfile component
return setUserAvatar != null && IMAGES_ENABLED ? (
// onSelectNewAvatar is only passed as prop on the EditProfile component
return onSelectNewAvatar ? (
<TouchableOpacity onPress={handleEditAvatar}>
{userAvatar ? (
<Image style={styles.avatarImage} source={{uri: userAvatar}} />
{avatar ? (
<Image
style={{width: size, height: size, borderRadius: (size / 2) | 0}}
source={{uri: avatar}}
/>
) : (
renderSvg(size, initials)
)}
@ -105,11 +104,11 @@ export function UserAvatar({
/>
</View>
</TouchableOpacity>
) : userAvatar ? (
) : avatar ? (
<Image
style={styles.avatarImage}
style={{width: size, height: size, borderRadius: (size / 2) | 0}}
resizeMode="stretch"
source={{uri: userAvatar}}
source={{uri: avatar}}
/>
) : (
renderSvg(size, initials)

View File

@ -103,6 +103,7 @@ export const Menu = ({navIdx, visible}: ScreenParams) => {
size={24}
displayName={store.me.displayName}
handle={store.me.handle}
avatar={store.me.avatar}
/>
}
label={store.me.displayName || store.me.handle}
@ -163,6 +164,7 @@ export const Menu = ({navIdx, visible}: ScreenParams) => {
size={24}
displayName={membership.displayName}
handle={membership.handle}
avatar={membership.avatar}
/>
}
label={membership.displayName || membership.handle}

View File

@ -165,6 +165,7 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
did={item.did}
handle={item.handle}
displayName={item.displayName}
avatar={item.avatar}
/>
)
}
@ -199,6 +200,7 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
did={item.did}
handle={item.handle}
displayName={item.displayName}
avatar={item.avatar}
renderButton={renderButton}
onPressButton={() => onPressRemoveMember(item)}
/>

View File

@ -74,6 +74,7 @@ export const Search = ({navIdx, visible, params}: ScreenParams) => {
<UserAvatar
handle={item.handle}
displayName={item.displayName}
avatar={item.avatar}
size={36}
/>
<View style={[s.ml10]}>

View File

@ -42,6 +42,7 @@ export const Settings = observer(function Settings({
size={40}
displayName={store.me.displayName}
handle={store.me.handle || ''}
avatar={store.me.avatar}
/>
<View style={[s.ml10]}>
<Text style={[s.f18]}>