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( export async function inviteToScene(
store: RootStoreModel, store: RootStoreModel,
sceneDid: string, sceneDid: string,
@ -183,6 +168,14 @@ async function fetchHandler(
const reqMimeType = reqHeaders['Content-Type'] || reqHeaders['content-type'] const reqMimeType = reqHeaders['Content-Type'] || reqHeaders['content-type']
if (reqMimeType && reqMimeType.startsWith('application/json')) { if (reqMimeType && reqMimeType.startsWith('application/json')) {
reqBody = JSON.stringify(reqBody) 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() const controller = new AbortController()
@ -219,51 +212,4 @@ async function fetchHandler(
headers: resHeaders, headers: resHeaders,
body: resBody, 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 {makeAutoObservable, runInAction} from 'mobx'
import {Record as PostRecord} from '../../third-party/api/src/client/types/app/bsky/feed/post' 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 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 * as GetAuthorFeed from '../../third-party/api/src/client/types/app/bsky/feed/getAuthorFeed'
import {PostThreadViewModel} from './post-thread-view' import {PostThreadViewModel} from './post-thread-view'
import {AtUri} from '../../third-party/uri' import {AtUri} from '../../third-party/uri'
@ -36,14 +37,15 @@ export class FeedItemModel implements GetTimeline.FeedItem {
// data // data
uri: string = '' uri: string = ''
cid: string = '' cid: string = ''
author: GetTimeline.Actor = { author: ActorRef.WithInfo = {
did: '', did: '',
handle: '', handle: '',
displayName: '', displayName: '',
declaration: {cid: '', actorType: ''}, declaration: {cid: '', actorType: ''},
avatar: undefined,
} }
repostedBy?: GetTimeline.Actor repostedBy?: ActorRef.WithInfo
trendedBy?: GetTimeline.Actor trendedBy?: ActorRef.WithInfo
record: Record<string, unknown> = {} record: Record<string, unknown> = {}
replyCount: number = 0 replyCount: number = 0
repostCount: number = 0 repostCount: number = 0

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,9 +1,10 @@
import {makeAutoObservable, runInAction} from 'mobx' 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 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 * 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 {Entity} from '../../third-party/api/src/client/types/app/bsky/feed/post'
import {extractEntities} from '../../lib/strings' import {extractEntities} from '../../lib/strings'
import {Declaration} from './_common'
import {RootStoreModel} from './root-store' import {RootStoreModel} from './root-store'
import * as apilib from '../lib/api' import * as apilib from '../lib/api'
@ -30,13 +31,14 @@ export class ProfileViewModel {
// data // data
did: string = '' did: string = ''
handle: string = '' handle: string = ''
declaration: Declaration = { declaration: DeclRef = {
cid: '', cid: '',
actorType: '', actorType: '',
} }
creator: string = '' creator: string = ''
displayName?: string displayName?: string
description?: string description?: string
avatar?: string
followersCount: number = 0 followersCount: number = 0
followsCount: number = 0 followsCount: number = 0
membersCount: number = 0 membersCount: number = 0
@ -44,7 +46,6 @@ export class ProfileViewModel {
myState = new ProfileViewMyStateModel() myState = new ProfileViewMyStateModel()
// TODO TEMP data to be implemented in the protocol // TODO TEMP data to be implemented in the protocol
userAvatar: string | null = null
userBanner: string | null = null userBanner: string | null = null
// added data // added data
@ -120,15 +121,27 @@ export class ProfileViewModel {
} }
async updateProfile( async updateProfile(
fn: (existing?: Profile.Record) => Profile.Record, updates: Profile.Record,
userAvatar: string | null, // TODO TEMP newUserAvatar: PickedImage | undefined,
userBanner: string | null, // TODO TEMP userBanner: string | null, // TODO TEMP
) { ) {
// TODO TEMP add userBanner & userAvatar in the protocol when suported // TODO TEMP add userBanner to the protocol when suported
this.userAvatar = userAvatar
this.userBanner = userBanner 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() await this.refresh()
} }
@ -173,6 +186,7 @@ export class ProfileViewModel {
this.creator = res.data.creator this.creator = res.data.creator
this.displayName = res.data.displayName this.displayName = res.data.displayName
this.description = res.data.description this.description = res.data.description
this.avatar = res.data.avatar
this.followersCount = res.data.followersCount this.followersCount = res.data.followersCount
this.followsCount = res.data.followsCount this.followsCount = res.data.followsCount
this.membersCount = res.data.membersCount this.membersCount = res.data.membersCount

View File

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

View File

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

View File

@ -58,6 +58,7 @@ export interface ComposerOptsPostRef {
author: { author: {
handle: string handle: string
displayName?: string displayName?: string
avatar?: string
} }
} }
export interface ComposerOpts { 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 * as GetSuggestions from '../../third-party/api/src/client/types/app/bsky/actor/getSuggestions'
import {RootStoreModel} from './root-store' import {RootStoreModel} from './root-store'
type ResponseSuggestedActor = GetSuggestions.OutputSchema['actors'][number] export type SuggestedActor = GetSuggestions.Actor & {
export type SuggestedActor = ResponseSuggestedActor & {
_reactKey: string _reactKey: string
} }

View File

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

View File

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

View File

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

View File

@ -1,11 +1,10 @@
import {makeAutoObservable, runInAction} from 'mobx' import {makeAutoObservable, runInAction} from 'mobx'
import {AtUri} from '../../third-party/uri' import {AtUri} from '../../third-party/uri'
import * as GetVotes from '../../third-party/api/src/client/types/app/bsky/feed/getVotes' 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' import {RootStoreModel} from './root-store'
type VoteItem = GetVotes.OutputSchema['votes'][number] export class VotesViewItemModel implements GetVotes.Vote {
export class VotesViewItemModel implements VoteItem {
// ui state // ui state
_reactKey: string = '' _reactKey: string = ''
@ -13,9 +12,13 @@ export class VotesViewItemModel implements VoteItem {
direction: 'up' | 'down' = 'up' direction: 'up' | 'down' = 'up'
indexedAt: string = '' indexedAt: string = ''
createdAt: 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) makeAutoObservable(this)
this._reactKey = reactKey this._reactKey = reactKey
Object.assign(this, v) 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)) this.votes.push(new VotesViewItemModel(`item-${keyId}`, item))
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
import { Headers } from '@atproto/xrpc'; import { Headers } from '@atproto/xrpc';
import * as AppBskyActorRef from '../actor/ref';
import * as AppBskySystemDeclRef from '../system/declRef'; import * as AppBskySystemDeclRef from '../system/declRef';
export interface QueryParams { export interface QueryParams {
user: string; user: string;
@ -7,7 +8,7 @@ export interface QueryParams {
} }
export declare type InputSchema = undefined; export declare type InputSchema = undefined;
export interface OutputSchema { export interface OutputSchema {
subject: Subject; subject: AppBskyActorRef.WithInfo;
cursor?: string; cursor?: string;
followers: Follower[]; followers: Follower[];
[k: string]: unknown; [k: string]: unknown;
@ -21,18 +22,12 @@ export interface Response {
data: OutputSchema; data: OutputSchema;
} }
export declare function toKnownErr(e: any): any; 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 { export interface Follower {
did: string; did: string;
declaration: AppBskySystemDeclRef.Main; declaration: AppBskySystemDeclRef.Main;
handle: string; handle: string;
displayName?: string; displayName?: string;
avatar?: string;
createdAt?: string; createdAt?: string;
indexedAt: string; indexedAt: string;
[k: string]: unknown; [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 <UserAvatar
handle={replyTo.author.handle} handle={replyTo.author.handle}
displayName={replyTo.author.displayName} displayName={replyTo.author.displayName}
avatar={replyTo.author.avatar}
size={50} size={50}
/> />
<View style={styles.replyToPost}> <View style={styles.replyToPost}>
@ -223,6 +224,7 @@ export const ComposePost = observer(function ComposePost({
<UserAvatar <UserAvatar
handle={store.me.handle || ''} handle={store.me.handle || ''}
displayName={store.me.displayName} displayName={store.me.displayName}
avatar={store.me.avatar}
size={50} size={50}
/> />
<TextInput <TextInput

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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