Unvendor the api and switch to @atproto/api

This commit is contained in:
Paul Frazee 2022-12-22 09:17:07 -06:00
parent 7f4a54ff0d
commit 4913a07e33
109 changed files with 140 additions and 13781 deletions

View file

@ -1,7 +1,6 @@
import {autorun} from 'mobx'
import {Platform} from 'react-native'
import {sessionClient as AtpApi} from '../third-party/api'
import type {SessionServiceClient} from '../third-party/api/src/index'
import {sessionClient as AtpApi, SessionServiceClient} from '@atproto/api'
import {RootStoreModel} from './models/root-store'
import * as libapi from './lib/api'
import * as storage from './lib/storage'

View file

@ -4,11 +4,13 @@
*/
// import {ReactNativeStore} from './auth'
import {sessionClient as AtpApi} from '../../third-party/api'
import {
sessionClient as AtpApi,
APP_BSKY_GRAPH,
AppBskyEmbedImages,
AppBskyEmbedExternal,
} from '@atproto/api'
import {AtUri} from '../../third-party/uri'
import {APP_BSKY_GRAPH} from '../../third-party/api'
import * as AppBskyEmbedImages from '../../third-party/api/src/client/types/app/bsky/embed/images'
import * as AppBskyEmbedExternal from '../../third-party/api/src/client/types/app/bsky/embed/External'
import {RootStoreModel} from '../models/root-store'
import {extractEntities} from '../../lib/strings'
import {isNetworkError} from '../../lib/errors'

View file

@ -1,12 +1,14 @@
import {makeAutoObservable, runInAction} from 'mobx'
import * as GetTimeline from '../../third-party/api/src/client/types/app/bsky/feed/getTimeline'
import {
Main as FeedViewPost,
ReasonTrend,
ReasonRepost,
} from '../../third-party/api/src/client/types/app/bsky/feed/feedViewPost'
import {View as PostView} from '../../third-party/api/src/client/types/app/bsky/feed/post'
import * as GetAuthorFeed from '../../third-party/api/src/client/types/app/bsky/feed/getAuthorFeed'
AppBskyFeedGetTimeline as GetTimeline,
AppBskyFeedFeedViewPost,
AppBskyFeedPost,
AppBskyFeedGetAuthorFeed as GetAuthorFeed,
} from '@atproto/api'
type FeedViewPost = AppBskyFeedFeedViewPost.Main
type ReasonTrend = AppBskyFeedFeedViewPost.ReasonTrend
type ReasonRepost = AppBskyFeedFeedViewPost.ReasonRepost
type PostView = AppBskyFeedPost.View
import {AtUri} from '../../third-party/uri'
import {RootStoreModel} from './root-store'
import * as apilib from '../lib/api'

View file

@ -1,9 +1,8 @@
import {makeAutoObservable} from 'mobx'
import * as GetAssertions from '../../third-party/api/src/client/types/app/bsky/graph/getAssertions'
import {AppBskyGraphGetAssertions as GetAssertions} from '@atproto/api'
import {RootStoreModel} from './root-store'
type ResponseAssertion = GetAssertions.OutputSchema['assertions'][number]
export type Assertion = ResponseAssertion & {
export type Assertion = GetAssertions.Assertion & {
_reactKey: string
}

View file

@ -1,7 +1,9 @@
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 {
AppBskyGraphGetMembers as GetMembers,
AppBskyActorRef as ActorRef,
APP_BSKY_GRAPH,
} from '@atproto/api'
import {AtUri} from '../../third-party/uri'
import {RootStoreModel} from './root-store'

View file

@ -1,6 +1,8 @@
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 {
AppBskyGraphGetMemberships as GetMemberships,
AppBskyActorRef as ActorRef,
} from '@atproto/api'
import {RootStoreModel} from './root-store'
export type MembershipItem = GetMemberships.Membership & {

View file

@ -1,10 +1,12 @@
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 {
AppBskyNotificationList as ListNotifications,
AppBskyActorRef as ActorRef,
APP_BSKY_GRAPH,
} from '@atproto/api'
import {RootStoreModel} from './root-store'
import {PostThreadViewModel} from './post-thread-view'
import {hasProp} from '../lib/type-guards'
import {APP_BSKY_GRAPH} from '../../third-party/api'
import {cleanError} from '../../lib/strings'
const UNGROUPABLE_REASONS = ['trend', 'assertion']

View file

@ -1,6 +1,5 @@
import {makeAutoObservable, runInAction} from 'mobx'
import {AppBskyFeedGetPostThread as GPT} from '../../third-party/api'
import type * as GetPostThread from '../../third-party/api/src/client/types/app/bsky/feed/getPostThread'
import {AppBskyFeedGetPostThread as GetPostThread} from '@atproto/api'
import {AtUri} from '../../third-party/uri'
import {RootStoreModel} from './root-store'
import * as apilib from '../lib/api'
@ -297,7 +296,7 @@ export class PostThreadViewModel {
this.isRefreshing = false
this.hasLoaded = true
this.error = err ? err.toString() : ''
this.notFound = err instanceof GPT.NotFoundError
this.notFound = err instanceof GetPostThread.NotFoundError
}
// loader functions

View file

@ -1,5 +1,5 @@
import {makeAutoObservable} from 'mobx'
import * as Post from '../../third-party/api/src/client/types/app/bsky/feed/post'
import {AppBskyFeedPost as Post} from '@atproto/api'
import {AtUri} from '../../third-party/uri'
import {RootStoreModel} from './root-store'
import {cleanError} from '../../lib/strings'

View file

@ -1,9 +1,13 @@
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 {
AppBskyActorGetProfile as GetProfile,
AppBskyActorProfile as Profile,
AppBskySystemDeclRef,
AppBskyFeedPost,
} from '@atproto/api'
type DeclRef = AppBskySystemDeclRef.Main
type Entity = AppBskyFeedPost.Entity
import {extractEntities} from '../../lib/strings'
import {RootStoreModel} from './root-store'
import * as apilib from '../lib/api'

View file

@ -1,7 +1,7 @@
import {makeAutoObservable} from 'mobx'
import {LRUMap} from 'lru_map'
import {RootStoreModel} from './root-store'
import * as GetProfile from '../../third-party/api/src/client/types/app/bsky/actor/getProfile'
import {AppBskyActorGetProfile as GetProfile} from '@atproto/api'
type CacheValue = Promise<GetProfile.Response> | GetProfile.Response
export class ProfilesViewModel {

View file

@ -1,7 +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 {
AppBskyFeedGetRepostedBy as GetRepostedBy,
AppBskySystemDeclRef,
} from '@atproto/api'
type DeclRef = AppBskySystemDeclRef.Main
import {RootStoreModel} from './root-store'
export class RepostedByViewItemModel implements GetRepostedBy.RepostedBy {

View file

@ -3,8 +3,7 @@
*/
import {makeAutoObservable} from 'mobx'
import {sessionClient as AtpApi} from '../../third-party/api'
import type {SessionServiceClient} from '../../third-party/api/src/index'
import {sessionClient as AtpApi, SessionServiceClient} from '@atproto/api'
import {createContext, useContext} from 'react'
import {isObj, hasProp} from '../lib/type-guards'
import {SessionModel} from './session'

View file

@ -1,10 +1,10 @@
import {makeAutoObservable} from 'mobx'
import {sessionClient as AtpApi} from '../../third-party/api/index'
import type {
SessionServiceClient,
import {
sessionClient as AtpApi,
Session,
} from '../../third-party/api/src/index'
import type * as GetAccountsConfig from '../../third-party/api/src/client/types/com/atproto/server/getAccountsConfig'
SessionServiceClient,
ComAtprotoServerGetAccountsConfig as GetAccountsConfig,
} from '@atproto/api'
import {isObj, hasProp} from '../lib/type-guards'
import {RootStoreModel} from './root-store'
import {isNetworkError} from '../../lib/errors'

View file

@ -1,5 +1,5 @@
import {makeAutoObservable} from 'mobx'
import * as GetSuggestions from '../../third-party/api/src/client/types/app/bsky/actor/getSuggestions'
import {AppBskyActorGetSuggestions as GetSuggestions} from '@atproto/api'
import {RootStoreModel} from './root-store'
export type SuggestedActor = GetSuggestions.Actor & {

View file

@ -2,7 +2,7 @@ import {makeAutoObservable, runInAction} from 'mobx'
import {RootStoreModel} from './root-store'
import {UserFollowsViewModel, FollowItem} from './user-follows-view'
import {GetAssertionsView} from './get-assertions-view'
import {APP_BSKY_SYSTEM, APP_BSKY_GRAPH} from '../../third-party/api'
import {APP_BSKY_SYSTEM, APP_BSKY_GRAPH} from '@atproto/api'
export interface SuggestedInvitesViewParams {
sceneDid: string

View file

@ -1,6 +1,8 @@
import {makeAutoObservable, runInAction} from 'mobx'
import * as GetFollows from '../../third-party/api/src/client/types/app/bsky/graph/getFollows'
import * as SearchTypeahead from '../../third-party/api/src/client/types/app/bsky/actor/searchTypeahead'
import {
AppBskyGraphGetFollows as GetFollows,
AppBskyActorSearchTypeahead as SearchTypeahead,
} from '@atproto/api'
import {RootStoreModel} from './root-store'
export class UserAutocompleteViewModel {

View file

@ -1,6 +1,8 @@
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 {
AppBskyGraphGetFollowers as GetFollowers,
AppBskyActorRef as ActorRef,
} from '@atproto/api'
import {RootStoreModel} from './root-store'
export type FollowerItem = GetFollowers.Follower & {

View file

@ -1,6 +1,8 @@
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 {
AppBskyGraphGetFollows as GetFollows,
AppBskyActorRef as ActorRef,
} from '@atproto/api'
import {RootStoreModel} from './root-store'
export type FollowItem = GetFollows.Follow & {

View file

@ -1,7 +1,9 @@
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 {
AppBskyFeedGetVotes as GetVotes,
AppBskyActorRef as ActorRef,
} from '@atproto/api'
import {RootStoreModel} from './root-store'
export class VotesViewItemModel implements GetVotes.Vote {