Update to latest APIs

zio/stable
Paul Frazee 2022-10-26 14:34:47 -05:00
parent 349cfe7177
commit 1983512fef
74 changed files with 2334 additions and 525 deletions

View File

@ -1,5 +1,5 @@
import {autorun} from 'mobx'
import AdxApi from '../third-party/api'
import AtpApi from '../third-party/api'
import {RootStoreModel} from './models/root-store'
import * as libapi from './lib/api'
import * as storage from './lib/storage'
@ -17,7 +17,7 @@ export async function setupState() {
libapi.doPolyfill()
const api = AdxApi.service(DEFAULT_SERVICE)
const api = AtpApi.service(DEFAULT_SERVICE)
rootStore = new RootStoreModel(api)
try {
data = (await storage.load(ROOT_STATE_STORAGE_KEY)) || {}

View File

@ -4,32 +4,37 @@
*/
// import {ReactNativeStore} from './auth'
import AdxApi from '../../third-party/api'
import AtpApi from '../../third-party/api'
import * as Profile from '../../third-party/api/src/types/app/bsky/profile'
import {AdxUri} from '../../third-party/uri'
import * as Post from '../../third-party/api/src/types/app/bsky/post'
import {AtUri} from '../../third-party/uri'
import {RootStoreModel} from '../models/root-store'
import {extractEntities} from '../../view/lib/strings'
export function doPolyfill() {
AdxApi.xrpc.fetch = fetchHandler
AtpApi.xrpc.fetch = fetchHandler
}
export async function post(
store: RootStoreModel,
text: string,
replyToUri?: string,
replyTo?: Post.PostRef,
) {
let reply
if (replyToUri) {
const replyToUrip = new AdxUri(replyToUri)
if (replyTo) {
const replyToUrip = new AtUri(replyTo.uri)
const parentPost = await store.api.app.bsky.post.get({
nameOrDid: replyToUrip.host,
tid: replyToUrip.recordKey,
user: replyToUrip.host,
rkey: replyToUrip.rkey,
})
if (parentPost) {
const parentRef = {
uri: parentPost.uri,
cid: parentPost.cid,
}
reply = {
root: parentPost.value.reply?.root || parentPost.uri,
parent: parentPost.uri,
root: parentPost.value.reply?.root || parentRef,
parent: parentRef,
}
}
}
@ -45,39 +50,39 @@ export async function post(
)
}
export async function like(store: RootStoreModel, uri: string) {
export async function like(store: RootStoreModel, uri: string, cid: string) {
return await store.api.app.bsky.like.create(
{did: store.me.did || ''},
{
subject: uri,
subject: {uri, cid},
createdAt: new Date().toISOString(),
},
)
}
export async function unlike(store: RootStoreModel, likeUri: string) {
const likeUrip = new AdxUri(likeUri)
const likeUrip = new AtUri(likeUri)
return await store.api.app.bsky.like.delete({
did: likeUrip.hostname,
tid: likeUrip.recordKey,
rkey: likeUrip.rkey,
})
}
export async function repost(store: RootStoreModel, uri: string) {
export async function repost(store: RootStoreModel, uri: string, cid: string) {
return await store.api.app.bsky.repost.create(
{did: store.me.did || ''},
{
subject: uri,
subject: {uri, cid},
createdAt: new Date().toISOString(),
},
)
}
export async function unrepost(store: RootStoreModel, repostUri: string) {
const repostUrip = new AdxUri(repostUri)
const repostUrip = new AtUri(repostUri)
return await store.api.app.bsky.repost.delete({
did: repostUrip.hostname,
tid: repostUrip.recordKey,
rkey: repostUrip.rkey,
})
}
@ -92,10 +97,10 @@ export async function follow(store: RootStoreModel, subject: string) {
}
export async function unfollow(store: RootStoreModel, followUri: string) {
const followUrip = new AdxUri(followUri)
const followUrip = new AtUri(followUri)
return await store.api.app.bsky.follow.delete({
did: followUrip.hostname,
tid: followUrip.recordKey,
rkey: followUrip.rkey,
})
}
@ -103,15 +108,16 @@ export async function updateProfile(
store: RootStoreModel,
modifyFn: (existing?: Profile.Record) => Profile.Record,
) {
// TODO: replaceme
const res = await store.api.app.bsky.profile.list({
nameOrDid: store.me.did || '',
user: store.me.did || '',
})
const existing = res.records[0]
if (existing) {
await store.api.app.bsky.profile.put(
{
did: store.me.did || '',
tid: new AdxUri(existing.uri).recordKey,
rkey: new AtUri(existing.uri).rkey,
},
modifyFn(existing.value),
)

View File

@ -18,8 +18,8 @@ export class FeedItemModel implements GetHomeFeed.FeedItem {
_reactKey: string = ''
// data
cursor: string = ''
uri: string = ''
cid: string = ''
author: GetHomeFeed.User = {did: '', name: '', displayName: ''}
repostedBy?: GetHomeFeed.User
record: Record<string, unknown> = {}
@ -44,8 +44,8 @@ export class FeedItemModel implements GetHomeFeed.FeedItem {
}
copy(v: GetHomeFeed.FeedItem | GetAuthorFeed.FeedItem) {
this.cursor = v.cursor
this.uri = v.uri
this.cid = v.cid
this.author = v.author
this.repostedBy = v.repostedBy
this.record = v.record
@ -68,7 +68,7 @@ export class FeedItemModel implements GetHomeFeed.FeedItem {
this.myState.like = undefined
})
} else {
const res = await apilib.like(this.rootStore, this.uri)
const res = await apilib.like(this.rootStore, this.uri, this.cid)
runInAction(() => {
this.likeCount++
this.myState.like = res.uri
@ -84,7 +84,7 @@ export class FeedItemModel implements GetHomeFeed.FeedItem {
this.myState.repost = undefined
})
} else {
const res = await apilib.repost(this.rootStore, this.uri)
const res = await apilib.repost(this.rootStore, this.uri, this.cid)
runInAction(() => {
this.repostCount++
this.myState.repost = res.uri
@ -101,6 +101,7 @@ export class FeedModel {
hasReachedEnd = false
error = ''
params: GetHomeFeed.QueryParams | GetAuthorFeed.QueryParams
loadMoreCursor: string | undefined
_loadPromise: Promise<void> | undefined
_loadMorePromise: Promise<void> | undefined
_loadLatestPromise: Promise<void> | undefined
@ -119,6 +120,7 @@ export class FeedModel {
{
rootStore: false,
params: false,
loadMoreCursor: false,
_loadPromise: false,
_loadMorePromise: false,
_loadLatestPromise: false,
@ -141,13 +143,6 @@ export class FeedModel {
return this.hasLoaded && !this.hasContent
}
get loadMoreCursor() {
if (this.hasContent) {
return this.feed[this.feed.length - 1].cursor
}
return undefined
}
// public api
// =
@ -316,6 +311,7 @@ export class FeedModel {
}
private _appendAll(res: GetHomeFeed.Response | GetAuthorFeed.Response) {
this.loadMoreCursor = res.data.cursor
let counter = this.feed.length
for (const item of res.data.feed) {
this._append(counter++, item)

View File

@ -1,5 +1,5 @@
import {makeAutoObservable, runInAction} from 'mobx'
import {AdxUri} from '../../third-party/uri'
import {AtUri} from '../../third-party/uri'
import * as GetLikedBy from '../../third-party/api/src/types/app/bsky/getLikedBy'
import {RootStoreModel} from './root-store'
@ -101,7 +101,7 @@ export class LikedByViewModel {
// =
private async _resolveUri() {
const urip = new AdxUri(this.params.uri)
const urip = new AtUri(this.params.uri)
if (!urip.host.startsWith('did:')) {
urip.host = await this.rootStore.resolveName(urip.host)
}

View File

@ -13,6 +13,7 @@ export class NotificationsViewItemModel implements GroupedNotification {
// data
uri: string = ''
cid: string = ''
author: {
did: string
name: string
@ -37,6 +38,7 @@ export class NotificationsViewItemModel implements GroupedNotification {
copy(v: GroupedNotification) {
this.uri = v.uri
this.cid = v.cid
this.author = v.author
this.reason = v.reason
this.reasonSubject = v.reasonSubject
@ -92,6 +94,7 @@ export class NotificationsViewModel {
hasLoaded = false
error = ''
params: GetNotifications.QueryParams
loadMoreCursor?: string
_loadPromise: Promise<void> | undefined
_loadMorePromise: Promise<void> | undefined
_updatePromise: Promise<void> | undefined
@ -129,21 +132,6 @@ export class NotificationsViewModel {
return this.hasLoaded && !this.hasContent
}
get loadMoreCursor() {
if (this.hasContent) {
const last = this.notifications[this.notifications.length - 1]
if (last.additional?.length) {
// get the lowest indexedAt from all available
return [last, ...last.additional].reduce(
(acc, v) => (v.indexedAt < acc ? v.indexedAt : acc),
last.indexedAt,
)
}
return last.indexedAt
}
return undefined
}
// public api
// =
@ -283,6 +271,7 @@ export class NotificationsViewModel {
}
private _appendAll(res: GetNotifications.Response) {
this.loadMoreCursor = res.data.cursor
let counter = this.notifications.length
for (const item of groupNotifications(res.data.notifications)) {
this._append(counter++, item)

View File

@ -1,6 +1,6 @@
import {makeAutoObservable, runInAction} from 'mobx'
import * as GetPostThread from '../../third-party/api/src/types/app/bsky/getPostThread'
import {AdxUri} from '../../third-party/uri'
import {AtUri} from '../../third-party/uri'
import _omit from 'lodash.omit'
import {RootStoreModel} from './root-store'
import * as apilib from '../lib/api'
@ -29,6 +29,7 @@ export class PostThreadViewPostModel implements GetPostThread.Post {
// data
uri: string = ''
cid: string = ''
author: GetPostThread.User = {did: '', name: '', displayName: ''}
record: Record<string, unknown> = {}
embed?:
@ -112,7 +113,7 @@ export class PostThreadViewPostModel implements GetPostThread.Post {
this.myState.like = undefined
})
} else {
const res = await apilib.like(this.rootStore, this.uri)
const res = await apilib.like(this.rootStore, this.uri, this.cid)
runInAction(() => {
this.likeCount++
this.myState.like = res.uri
@ -128,7 +129,7 @@ export class PostThreadViewPostModel implements GetPostThread.Post {
this.myState.repost = undefined
})
} else {
const res = await apilib.repost(this.rootStore, this.uri)
const res = await apilib.repost(this.rootStore, this.uri, this.cid)
runInAction(() => {
this.repostCount++
this.myState.repost = res.uri
@ -226,7 +227,7 @@ export class PostThreadViewModel {
// =
private async _resolveUri() {
const urip = new AdxUri(this.params.uri)
const urip = new AtUri(this.params.uri)
if (!urip.host.startsWith('did:')) {
urip.host = await this.rootStore.resolveName(urip.host)
}

View File

@ -1,6 +1,6 @@
import {makeAutoObservable} from 'mobx'
import * as Post from '../../third-party/api/src/types/app/bsky/post'
import {AdxUri} from '../../third-party/uri'
import {AtUri} from '../../third-party/uri'
import {RootStoreModel} from './root-store'
export type PostEntities = Post.Record['entities']
@ -76,10 +76,10 @@ export class PostModel implements RemoveIndex<Post.Record> {
private async _load() {
this._xLoading()
try {
const urip = new AdxUri(this.uri)
const urip = new AtUri(this.uri)
const res = await this.rootStore.api.app.bsky.post.get({
nameOrDid: urip.host,
tid: urip.recordKey,
user: urip.host,
rkey: urip.rkey,
})
// TODO
// if (!res.valid) {

View File

@ -28,7 +28,7 @@ export class ProfileViewModel {
followersCount: number = 0
followsCount: number = 0
postsCount: number = 0
badges: GetProfile.Badge[] = []
pinnedBadges: GetProfile.Badge[] = []
myState = new ProfileViewMyStateModel()
constructor(
@ -134,7 +134,7 @@ export class ProfileViewModel {
this.followersCount = res.data.followersCount
this.followsCount = res.data.followsCount
this.postsCount = res.data.postsCount
this.badges = res.data.badges
this.pinnedBadges = res.data.pinnedBadges
if (res.data.myState) {
Object.assign(this.myState, res.data.myState)
}

View File

@ -1,5 +1,5 @@
import {makeAutoObservable, runInAction} from 'mobx'
import {AdxUri} from '../../third-party/uri'
import {AtUri} from '../../third-party/uri'
import * as GetRepostedBy from '../../third-party/api/src/types/app/bsky/getRepostedBy'
import {RootStoreModel} from './root-store'
@ -101,7 +101,7 @@ export class RepostedByViewModel {
// =
private async _resolveUri() {
const urip = new AdxUri(this.params.uri)
const urip = new AtUri(this.params.uri)
if (!urip.host.startsWith('did:')) {
urip.host = await this.rootStore.resolveName(urip.host)
}

View File

@ -3,7 +3,7 @@
*/
import {makeAutoObservable} from 'mobx'
import AdxApi from '../../third-party/api'
import AtpApi from '../../third-party/api'
import type {ServiceClient} from '../../third-party/api/src/index'
import {createContext, useContext} from 'react'
import {isObj, hasProp} from '../lib/type-guards'
@ -74,7 +74,7 @@ export class RootStoreModel {
}
}
const throwawayInst = new RootStoreModel(AdxApi.service('http://localhost')) // this will be replaced by the loader
const throwawayInst = new RootStoreModel(AtpApi.service('http://localhost')) // this will be replaced by the loader
const RootStoreContext = createContext<RootStoreModel>(throwawayInst)
export const RootStoreProvider = RootStoreContext.Provider
export const useStores = () => useContext(RootStoreContext)

View File

@ -1,5 +1,5 @@
import {makeAutoObservable} from 'mobx'
import AdxApi from '../../third-party/api'
import AtpApi from '../../third-party/api'
import type * as GetAccountsConfig from '../../third-party/api/src/types/com/atproto/getAccountsConfig'
import {isObj, hasProp} from '../lib/type-guards'
import {RootStoreModel} from './root-store'
@ -135,7 +135,7 @@ export class SessionModel {
}
async describeService(service: string): Promise<ServiceDescription> {
const api = AdxApi.service(service)
const api = AtpApi.service(service)
const res = await api.com.atproto.getAccountsConfig({})
return res.data
}
@ -149,7 +149,7 @@ export class SessionModel {
username: string
password: string
}) {
const api = AdxApi.service(service)
const api = AtpApi.service(service)
const res = await api.com.atproto.createSession({}, {username, password})
if (res.data.jwt) {
this.setState({
@ -178,7 +178,7 @@ export class SessionModel {
username: string
inviteCode?: string
}) {
const api = AdxApi.service(service)
const api = AtpApi.service(service)
const res = await api.com.atproto.createAccount(
{},
{username, password, email, inviteCode},

View File

@ -1,5 +1,6 @@
import {makeAutoObservable, runInAction} from 'mobx'
import {makeAutoObservable} from 'mobx'
import {ProfileViewModel} from './profile-view'
import * as Post from '../../third-party/api/src/types/app/bsky/post'
export class TabsSelectorModel {
name = 'tabs-selector'
@ -35,12 +36,12 @@ export class SharePostModel {
}
export interface ComposePostModelOpts {
replyTo?: string
replyTo?: Post.PostRef
onPost?: () => void
}
export class ComposePostModel {
name = 'compose-post'
replyTo?: string
replyTo?: Post.PostRef
onPost?: () => void
constructor(opts?: ComposePostModelOpts) {

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import { Client as XrpcClient, ServiceClient as XrpcServiceClient } from '@adxp/xrpc';
import { Client as XrpcClient, ServiceClient as XrpcServiceClient } from '@atproto/xrpc';
import * as ComAtprotoCreateAccount from './types/com/atproto/createAccount';
import * as ComAtprotoCreateInviteCode from './types/com/atproto/createInviteCode';
import * as ComAtprotoCreateSession from './types/com/atproto/createSession';
@ -21,8 +21,11 @@ import * as ComAtprotoSyncGetRepo from './types/com/atproto/syncGetRepo';
import * as ComAtprotoSyncGetRoot from './types/com/atproto/syncGetRoot';
import * as ComAtprotoSyncUpdateRepo from './types/com/atproto/syncUpdateRepo';
import * as AppBskyBadge from './types/app/bsky/badge';
import * as AppBskyBadgeAccept from './types/app/bsky/badgeAccept';
import * as AppBskyBadgeOffer from './types/app/bsky/badgeOffer';
import * as AppBskyFollow from './types/app/bsky/follow';
import * as AppBskyGetAuthorFeed from './types/app/bsky/getAuthorFeed';
import * as AppBskyGetBadgeMembers from './types/app/bsky/getBadgeMembers';
import * as AppBskyGetHomeFeed from './types/app/bsky/getHomeFeed';
import * as AppBskyGetLikedBy from './types/app/bsky/getLikedBy';
import * as AppBskyGetNotificationCount from './types/app/bsky/getNotificationCount';
@ -32,12 +35,15 @@ import * as AppBskyGetProfile from './types/app/bsky/getProfile';
import * as AppBskyGetRepostedBy from './types/app/bsky/getRepostedBy';
import * as AppBskyGetUserFollowers from './types/app/bsky/getUserFollowers';
import * as AppBskyGetUserFollows from './types/app/bsky/getUserFollows';
import * as AppBskyGetUsersSearch from './types/app/bsky/getUsersSearch';
import * as AppBskyGetUsersTypeahead from './types/app/bsky/getUsersTypeahead';
import * as AppBskyLike from './types/app/bsky/like';
import * as AppBskyMediaEmbed from './types/app/bsky/mediaEmbed';
import * as AppBskyPost from './types/app/bsky/post';
import * as AppBskyPostNotificationsSeen from './types/app/bsky/postNotificationsSeen';
import * as AppBskyProfile from './types/app/bsky/profile';
import * as AppBskyRepost from './types/app/bsky/repost';
import * as AppBskyUpdateProfile from './types/app/bsky/updateProfile';
export * as ComAtprotoCreateAccount from './types/com/atproto/createAccount';
export * as ComAtprotoCreateInviteCode from './types/com/atproto/createInviteCode';
export * as ComAtprotoCreateSession from './types/com/atproto/createSession';
@ -60,8 +66,11 @@ export * as ComAtprotoSyncGetRepo from './types/com/atproto/syncGetRepo';
export * as ComAtprotoSyncGetRoot from './types/com/atproto/syncGetRoot';
export * as ComAtprotoSyncUpdateRepo from './types/com/atproto/syncUpdateRepo';
export * as AppBskyBadge from './types/app/bsky/badge';
export * as AppBskyBadgeAccept from './types/app/bsky/badgeAccept';
export * as AppBskyBadgeOffer from './types/app/bsky/badgeOffer';
export * as AppBskyFollow from './types/app/bsky/follow';
export * as AppBskyGetAuthorFeed from './types/app/bsky/getAuthorFeed';
export * as AppBskyGetBadgeMembers from './types/app/bsky/getBadgeMembers';
export * as AppBskyGetHomeFeed from './types/app/bsky/getHomeFeed';
export * as AppBskyGetLikedBy from './types/app/bsky/getLikedBy';
export * as AppBskyGetNotificationCount from './types/app/bsky/getNotificationCount';
@ -71,12 +80,15 @@ export * as AppBskyGetProfile from './types/app/bsky/getProfile';
export * as AppBskyGetRepostedBy from './types/app/bsky/getRepostedBy';
export * as AppBskyGetUserFollowers from './types/app/bsky/getUserFollowers';
export * as AppBskyGetUserFollows from './types/app/bsky/getUserFollows';
export * as AppBskyGetUsersSearch from './types/app/bsky/getUsersSearch';
export * as AppBskyGetUsersTypeahead from './types/app/bsky/getUsersTypeahead';
export * as AppBskyLike from './types/app/bsky/like';
export * as AppBskyMediaEmbed from './types/app/bsky/mediaEmbed';
export * as AppBskyPost from './types/app/bsky/post';
export * as AppBskyPostNotificationsSeen from './types/app/bsky/postNotificationsSeen';
export * as AppBskyProfile from './types/app/bsky/profile';
export * as AppBskyRepost from './types/app/bsky/repost';
export * as AppBskyUpdateProfile from './types/app/bsky/updateProfile';
export declare class Client {
xrpc: XrpcClient;
constructor();
@ -130,6 +142,8 @@ export declare class AppNS {
export declare class BskyNS {
_service: ServiceClient;
badge: BadgeRecord;
badgeAccept: BadgeAcceptRecord;
badgeOffer: BadgeOfferRecord;
follow: FollowRecord;
like: LikeRecord;
mediaEmbed: MediaEmbedRecord;
@ -138,6 +152,7 @@ export declare class BskyNS {
repost: RepostRecord;
constructor(service: ServiceClient);
getAuthorFeed(params: AppBskyGetAuthorFeed.QueryParams, data?: AppBskyGetAuthorFeed.InputSchema, opts?: AppBskyGetAuthorFeed.CallOptions): Promise<AppBskyGetAuthorFeed.Response>;
getBadgeMembers(params: AppBskyGetBadgeMembers.QueryParams, data?: AppBskyGetBadgeMembers.InputSchema, opts?: AppBskyGetBadgeMembers.CallOptions): Promise<AppBskyGetBadgeMembers.Response>;
getHomeFeed(params: AppBskyGetHomeFeed.QueryParams, data?: AppBskyGetHomeFeed.InputSchema, opts?: AppBskyGetHomeFeed.CallOptions): Promise<AppBskyGetHomeFeed.Response>;
getLikedBy(params: AppBskyGetLikedBy.QueryParams, data?: AppBskyGetLikedBy.InputSchema, opts?: AppBskyGetLikedBy.CallOptions): Promise<AppBskyGetLikedBy.Response>;
getNotificationCount(params: AppBskyGetNotificationCount.QueryParams, data?: AppBskyGetNotificationCount.InputSchema, opts?: AppBskyGetNotificationCount.CallOptions): Promise<AppBskyGetNotificationCount.Response>;
@ -147,152 +162,197 @@ export declare class BskyNS {
getRepostedBy(params: AppBskyGetRepostedBy.QueryParams, data?: AppBskyGetRepostedBy.InputSchema, opts?: AppBskyGetRepostedBy.CallOptions): Promise<AppBskyGetRepostedBy.Response>;
getUserFollowers(params: AppBskyGetUserFollowers.QueryParams, data?: AppBskyGetUserFollowers.InputSchema, opts?: AppBskyGetUserFollowers.CallOptions): Promise<AppBskyGetUserFollowers.Response>;
getUserFollows(params: AppBskyGetUserFollows.QueryParams, data?: AppBskyGetUserFollows.InputSchema, opts?: AppBskyGetUserFollows.CallOptions): Promise<AppBskyGetUserFollows.Response>;
getUsersSearch(params: AppBskyGetUsersSearch.QueryParams, data?: AppBskyGetUsersSearch.InputSchema, opts?: AppBskyGetUsersSearch.CallOptions): Promise<AppBskyGetUsersSearch.Response>;
getUsersTypeahead(params: AppBskyGetUsersTypeahead.QueryParams, data?: AppBskyGetUsersTypeahead.InputSchema, opts?: AppBskyGetUsersTypeahead.CallOptions): Promise<AppBskyGetUsersTypeahead.Response>;
postNotificationsSeen(params: AppBskyPostNotificationsSeen.QueryParams, data?: AppBskyPostNotificationsSeen.InputSchema, opts?: AppBskyPostNotificationsSeen.CallOptions): Promise<AppBskyPostNotificationsSeen.Response>;
updateProfile(params: AppBskyUpdateProfile.QueryParams, data?: AppBskyUpdateProfile.InputSchema, opts?: AppBskyUpdateProfile.CallOptions): Promise<AppBskyUpdateProfile.Response>;
}
export declare class BadgeRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyBadge.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyBadge.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'type'>, record: AppBskyBadge.Record, headers?: Record<string, string>): Promise<{
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyBadge.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
put(params: Omit<ComAtprotoRepoPutRecord.QueryParams, 'type'>, record: AppBskyBadge.Record, headers?: Record<string, string>): Promise<{
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class BadgeAcceptRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyBadgeAccept.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyBadgeAccept.Record;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'type'>, headers?: Record<string, string>): Promise<void>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyBadgeAccept.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class BadgeOfferRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyBadgeOffer.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyBadgeOffer.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyBadgeOffer.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class FollowRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyFollow.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyFollow.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'type'>, record: AppBskyFollow.Record, headers?: Record<string, string>): Promise<{
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyFollow.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
put(params: Omit<ComAtprotoRepoPutRecord.QueryParams, 'type'>, record: AppBskyFollow.Record, headers?: Record<string, string>): Promise<{
uri: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'type'>, headers?: Record<string, string>): Promise<void>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class LikeRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyLike.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyLike.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'type'>, record: AppBskyLike.Record, headers?: Record<string, string>): Promise<{
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyLike.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
put(params: Omit<ComAtprotoRepoPutRecord.QueryParams, 'type'>, record: AppBskyLike.Record, headers?: Record<string, string>): Promise<{
uri: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'type'>, headers?: Record<string, string>): Promise<void>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class MediaEmbedRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyMediaEmbed.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyMediaEmbed.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'type'>, record: AppBskyMediaEmbed.Record, headers?: Record<string, string>): Promise<{
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyMediaEmbed.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
put(params: Omit<ComAtprotoRepoPutRecord.QueryParams, 'type'>, record: AppBskyMediaEmbed.Record, headers?: Record<string, string>): Promise<{
uri: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'type'>, headers?: Record<string, string>): Promise<void>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class PostRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyPost.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyPost.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'type'>, record: AppBskyPost.Record, headers?: Record<string, string>): Promise<{
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyPost.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
put(params: Omit<ComAtprotoRepoPutRecord.QueryParams, 'type'>, record: AppBskyPost.Record, headers?: Record<string, string>): Promise<{
uri: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'type'>, headers?: Record<string, string>): Promise<void>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class ProfileRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyProfile.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyProfile.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'type'>, record: AppBskyProfile.Record, headers?: Record<string, string>): Promise<{
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyProfile.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
put(params: Omit<ComAtprotoRepoPutRecord.QueryParams, 'type'>, record: AppBskyProfile.Record, headers?: Record<string, string>): Promise<{
uri: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'type'>, headers?: Record<string, string>): Promise<void>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class RepostRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyRepost.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyRepost.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'type'>, record: AppBskyRepost.Record, headers?: Record<string, string>): Promise<{
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyRepost.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
put(params: Omit<ComAtprotoRepoPutRecord.QueryParams, 'type'>, record: AppBskyRepost.Record, headers?: Record<string, string>): Promise<{
uri: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'type'>, headers?: Record<string, string>): Promise<void>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}

View File

@ -1,3 +1,16 @@
import { MethodSchema, RecordSchema } from '@adxp/lexicon';
import { MethodSchema, RecordSchema } from '@atproto/lexicon';
export declare const methodSchemaDict: Record<string, MethodSchema>;
export declare const methodSchemas: MethodSchema[];
export declare const ids: {
AppBskyBadge: string;
AppBskyBadgeAccept: string;
AppBskyBadgeOffer: string;
AppBskyFollow: string;
AppBskyLike: string;
AppBskyMediaEmbed: string;
AppBskyPost: string;
AppBskyProfile: string;
AppBskyRepost: string;
};
export declare const recordSchemaDict: Record<string, RecordSchema>;
export declare const recordSchemas: RecordSchema[];

View File

@ -1,6 +1,5 @@
export interface Record {
assertion: InviteAssertion | EmployeeAssertion | TagAssertion | UnknownAssertion;
subject: string;
createdAt: string;
[k: string]: unknown;
}

View File

@ -0,0 +1,11 @@
export interface Record {
badge: Subject;
offer: Subject;
createdAt: string;
[k: string]: unknown;
}
export interface Subject {
uri: string;
cid: string;
[k: string]: unknown;
}

View File

@ -0,0 +1,11 @@
export interface Record {
badge: Badge;
subject: string;
createdAt: string;
[k: string]: unknown;
}
export interface Badge {
uri: string;
cid: string;
[k: string]: unknown;
}

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
author: string;
limit?: number;
@ -9,11 +9,12 @@ export interface CallOptions {
}
export declare type InputSchema = undefined;
export interface OutputSchema {
cursor?: string;
feed: FeedItem[];
}
export interface FeedItem {
cursor: string;
uri: string;
cid: string;
author: User;
repostedBy?: User;
record: {};

View File

@ -0,0 +1,29 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
uri: string;
cid?: string;
limit?: number;
before?: string;
}
export interface CallOptions {
headers?: Headers;
}
export declare type InputSchema = undefined;
export interface OutputSchema {
uri: string;
cid?: string;
cursor?: string;
members: {
did: string;
name: string;
displayName?: string;
offeredAt: string;
acceptedAt: string;
}[];
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
algorithm?: string;
limit?: number;
@ -9,11 +9,12 @@ export interface CallOptions {
}
export declare type InputSchema = undefined;
export interface OutputSchema {
cursor?: string;
feed: FeedItem[];
}
export interface FeedItem {
cursor: string;
uri: string;
cid: string;
author: User;
repostedBy?: User;
record: {};

View File

@ -1,6 +1,7 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
uri: string;
cid?: string;
limit?: number;
before?: string;
}
@ -10,6 +11,8 @@ export interface CallOptions {
export declare type InputSchema = undefined;
export interface OutputSchema {
uri: string;
cid?: string;
cursor?: string;
likedBy: {
did: string;
name: string;

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
limit?: number;
before?: string;
@ -8,10 +8,12 @@ export interface CallOptions {
}
export declare type InputSchema = undefined;
export interface OutputSchema {
cursor?: string;
notifications: Notification[];
}
export interface Notification {
uri: string;
cid: string;
author: {
did: string;
name: string;

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
uri: string;
depth?: number;
@ -12,6 +12,7 @@ export interface OutputSchema {
}
export interface Post {
uri: string;
cid: string;
author: User;
record: {};
embed?: RecordEmbed | ExternalEmbed | UnknownEmbed;

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
user: string;
}
@ -14,21 +14,23 @@ export interface OutputSchema {
followersCount: number;
followsCount: number;
postsCount: number;
badges: Badge[];
pinnedBadges: Badge[];
myState?: {
follow?: string;
};
}
export interface Badge {
uri: string;
cid: string;
error?: string;
issuer?: {
did: string;
name: string;
displayName: string;
displayName?: string;
};
assertion?: {
type: string;
tag?: string;
};
createdAt?: string;
}

View File

@ -1,6 +1,7 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
uri: string;
cid?: string;
limit?: number;
before?: string;
}
@ -10,6 +11,8 @@ export interface CallOptions {
export declare type InputSchema = undefined;
export interface OutputSchema {
uri: string;
cid?: string;
cursor?: string;
repostedBy: {
did: string;
name: string;

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
user: string;
limit?: number;
@ -14,6 +14,7 @@ export interface OutputSchema {
name: string;
displayName?: string;
};
cursor?: string;
followers: {
did: string;
name: string;

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
user: string;
limit?: number;
@ -14,6 +14,7 @@ export interface OutputSchema {
name: string;
displayName?: string;
};
cursor?: string;
follows: {
did: string;
name: string;

View File

@ -0,0 +1,27 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
term: string;
limit?: number;
before?: string;
}
export interface CallOptions {
headers?: Headers;
}
export declare type InputSchema = undefined;
export interface OutputSchema {
cursor?: string;
users: {
did: string;
name: string;
displayName?: string;
description?: string;
createdAt: string;
indexedAt: string;
}[];
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;

View File

@ -0,0 +1,22 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
term: string;
limit?: number;
}
export interface CallOptions {
headers?: Headers;
}
export declare type InputSchema = undefined;
export interface OutputSchema {
users: {
did: string;
name: string;
displayName?: string;
}[];
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;

View File

@ -1,5 +1,10 @@
export interface Record {
subject: string;
subject: Subject;
createdAt: string;
[k: string]: unknown;
}
export interface Subject {
uri: string;
cid: string;
[k: string]: unknown;
}

View File

@ -9,10 +9,15 @@ export interface Record {
text: string;
entities?: Entity;
reply?: {
root: string;
parent?: string;
root: PostRef;
parent: PostRef;
[k: string]: unknown;
};
createdAt: string;
[k: string]: unknown;
}
export interface PostRef {
uri: string;
cid: string;
[k: string]: unknown;
}

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {

View File

@ -1,10 +1,11 @@
export interface Record {
displayName: string;
description?: string;
badges?: BadgeRef[];
pinnedBadges?: BadgeRef[];
[k: string]: unknown;
}
export interface BadgeRef {
uri: string;
cid: string;
[k: string]: unknown;
}

View File

@ -1,5 +1,10 @@
export interface Record {
subject: string;
subject: Subject;
createdAt: string;
[k: string]: unknown;
}
export interface Subject {
uri: string;
cid: string;
[k: string]: unknown;
}

View File

@ -0,0 +1,27 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: 'application/json';
}
export interface InputSchema {
displayName?: string;
description?: string;
pinnedBadges?: BadgeRef[];
}
export interface BadgeRef {
uri: string;
cid: string;
}
export interface OutputSchema {
uri: string;
cid: string;
record: {};
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;

View File

@ -1,4 +1,4 @@
import { Headers, XRPCError } from '@adxp/xrpc';
import { Headers, XRPCError } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {
@ -10,6 +10,7 @@ export interface InputSchema {
username: string;
inviteCode?: string;
password: string;
recoveryKey?: string;
}
export interface OutputSchema {
jwt: string;

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
did: string;
validate?: boolean;
@ -11,16 +11,17 @@ export interface InputSchema {
writes: ({
action: 'create';
collection: string;
rkey?: string;
value: unknown;
} | {
action: 'update';
collection: string;
tid: string;
rkey: string;
value: unknown;
} | {
action: 'delete';
collection: string;
tid: string;
rkey: string;
})[];
}
export interface OutputSchema {

View File

@ -1,7 +1,7 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
did: string;
type: string;
collection: string;
validate?: boolean;
}
export interface CallOptions {
@ -13,6 +13,7 @@ export interface InputSchema {
}
export interface OutputSchema {
uri: string;
cid: string;
}
export interface Response {
success: boolean;

View File

@ -1,8 +1,8 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
did: string;
type: string;
tid: string;
collection: string;
rkey: string;
}
export interface CallOptions {
headers?: Headers;

View File

@ -1,6 +1,6 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
nameOrDid: string;
user: string;
}
export interface CallOptions {
headers?: Headers;

View File

@ -1,8 +1,9 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
nameOrDid: string;
type: string;
tid: string;
user: string;
collection: string;
rkey: string;
cid?: string;
}
export interface CallOptions {
headers?: Headers;
@ -10,6 +11,7 @@ export interface CallOptions {
export declare type InputSchema = undefined;
export interface OutputSchema {
uri: string;
cid?: string;
value: {};
}
export interface Response {

View File

@ -1,7 +1,7 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
nameOrDid: string;
type: string;
user: string;
collection: string;
limit?: number;
before?: string;
after?: string;
@ -12,8 +12,10 @@ export interface CallOptions {
}
export declare type InputSchema = undefined;
export interface OutputSchema {
cursor?: string;
records: {
uri: string;
cid: string;
value: {};
}[];
}

View File

@ -1,8 +1,8 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
did: string;
type: string;
tid: string;
collection: string;
rkey: string;
validate?: boolean;
}
export interface CallOptions {
@ -14,6 +14,7 @@ export interface InputSchema {
}
export interface OutputSchema {
uri: string;
cid: string;
}
export interface Response {
success: boolean;

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {

View File

@ -1,4 +1,4 @@
import { Headers, XRPCError } from '@adxp/xrpc';
import { Headers, XRPCError } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
name?: string;
}

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
did: string;
from?: string;

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
did: string;
}

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
did: string;
}

File diff suppressed because one or more lines are too long

View File

@ -20,19 +20,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
// src/index.ts
var src_exports = {};
__export(src_exports, {
ADX_URI_REGEX: () => ADX_URI_REGEX,
AdxUri: () => AdxUri
ATP_URI_REGEX: () => ATP_URI_REGEX,
AtUri: () => AtUri
});
module.exports = __toCommonJS(src_exports);
var ADX_URI_REGEX = /^(adx:\/\/)?((?:did:[a-z0-9:%-]+)|(?:[a-z][a-z0-9.:-]*))(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;
var ATP_URI_REGEX = /^(at:\/\/)?((?:did:[a-z0-9:%-]+)|(?:[a-z][a-z0-9.:-]*))(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;
var RELATIVE_REGEX = /^(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;
var AdxUri = class {
var AtUri = class {
constructor(uri, base) {
let parsed;
if (base) {
parsed = parse(base);
if (!parsed) {
throw new Error(`Invalid adx uri: ${base}`);
throw new Error(`Invalid at uri: ${base}`);
}
const relativep = parseRelative(uri);
if (!relativep) {
@ -42,7 +42,7 @@ var AdxUri = class {
} else {
parsed = parse(uri);
if (!parsed) {
throw new Error(`Invalid adx uri: ${uri}`);
throw new Error(`Invalid at uri: ${uri}`);
}
}
this.hash = parsed.hash;
@ -51,10 +51,10 @@ var AdxUri = class {
this.searchParams = parsed.searchParams;
}
get protocol() {
return "adx:";
return "at:";
}
get origin() {
return `adx://${this.host}`;
return `at://${this.host}`;
}
get hostname() {
return this.host;
@ -76,10 +76,10 @@ var AdxUri = class {
parts[0] = v;
this.pathname = parts.join("/");
}
get recordKey() {
get rkey() {
return this.pathname.split("/").filter(Boolean)[1] || "";
}
set recordKey(v) {
set rkey(v) {
const parts = this.pathname.split("/").filter(Boolean);
if (!parts[0])
parts[0] = "undefined";
@ -102,11 +102,11 @@ var AdxUri = class {
if (hash && !hash.startsWith("#")) {
hash = `#${hash}`;
}
return `adx://${this.host}${path}${qs}${hash}`;
return `at://${this.host}${path}${qs}${hash}`;
}
};
function parse(str) {
const match = ADX_URI_REGEX.exec(str);
const match = ATP_URI_REGEX.exec(str);
if (match) {
return {
hash: match[5] || "",
@ -130,7 +130,7 @@ function parseRelative(str) {
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ADX_URI_REGEX,
AdxUri
ATP_URI_REGEX,
AtUri
});
//# sourceMappingURL=index.js.map

View File

@ -1,7 +1,7 @@
{
"version": 3,
"sources": ["../src/index.ts"],
"sourcesContent": ["export const ADX_URI_REGEX =\n // protocol- --did-------------- --name------------- --path---- --query-- --hash--\n /^(adx:\\/\\/)?((?:did:[a-z0-9:%-]+)|(?:[a-z][a-z0-9.:-]*))(\\/[^?#\\s]*)?(\\?[^#\\s]+)?(#[^\\s]+)?$/i\n// --path----- --query-- --hash--\nconst RELATIVE_REGEX = /^(\\/[^?#\\s]*)?(\\?[^#\\s]+)?(#[^\\s]+)?$/i\n\nexport class AdxUri {\n hash: string\n host: string\n pathname: string\n searchParams: URLSearchParams\n\n constructor(uri: string, base?: string) {\n let parsed\n if (base) {\n parsed = parse(base)\n if (!parsed) {\n throw new Error(`Invalid adx uri: ${base}`)\n }\n const relativep = parseRelative(uri)\n if (!relativep) {\n throw new Error(`Invalid path: ${uri}`)\n }\n Object.assign(parsed, relativep)\n } else {\n parsed = parse(uri)\n if (!parsed) {\n throw new Error(`Invalid adx uri: ${uri}`)\n }\n }\n\n this.hash = parsed.hash\n this.host = parsed.host\n this.pathname = parsed.pathname\n this.searchParams = parsed.searchParams\n }\n\n get protocol() {\n return 'adx:'\n }\n\n get origin() {\n return `adx://${this.host}`\n }\n\n get hostname() {\n return this.host\n }\n\n set hostname(v: string) {\n this.host = v\n }\n\n get search() {\n return this.searchParams.toString()\n }\n\n set search(v: string) {\n this.searchParams = new URLSearchParams(v)\n }\n\n get collection() {\n return this.pathname.split('/').filter(Boolean)[0] || ''\n }\n\n set collection(v: string) {\n const parts = this.pathname.split('/').filter(Boolean)\n parts[0] = v\n this.pathname = parts.join('/')\n }\n\n get recordKey() {\n return this.pathname.split('/').filter(Boolean)[1] || ''\n }\n\n set recordKey(v: string) {\n const parts = this.pathname.split('/').filter(Boolean)\n if (!parts[0]) parts[0] = 'undefined'\n parts[1] = v\n this.pathname = parts.join('/')\n }\n\n get href() {\n return this.toString()\n }\n\n toString() {\n let path = this.pathname || '/'\n if (!path.startsWith('/')) {\n path = `/${path}`\n }\n let qs = this.searchParams.toString()\n if (qs && !qs.startsWith('?')) {\n qs = `?${qs}`\n }\n let hash = this.hash\n if (hash && !hash.startsWith('#')) {\n hash = `#${hash}`\n }\n return `adx://${this.host}${path}${qs}${hash}`\n }\n}\n\nfunction parse(str: string) {\n const match = ADX_URI_REGEX.exec(str)\n if (match) {\n return {\n hash: match[5] || '',\n host: match[2] || '',\n pathname: match[3] || '',\n searchParams: new URLSearchParams(match[4] || ''),\n }\n }\n return undefined\n}\n\nfunction parseRelative(str: string) {\n const match = RELATIVE_REGEX.exec(str)\n if (match) {\n return {\n hash: match[3] || '',\n pathname: match[1] || '',\n searchParams: new URLSearchParams(match[2] || ''),\n }\n }\n return undefined\n}\n"],
"mappings": "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",
"sourcesContent": ["export const ATP_URI_REGEX =\n // proto- --did-------------- --name------------- --path---- --query-- --hash--\n /^(at:\\/\\/)?((?:did:[a-z0-9:%-]+)|(?:[a-z][a-z0-9.:-]*))(\\/[^?#\\s]*)?(\\?[^#\\s]+)?(#[^\\s]+)?$/i\n// --path----- --query-- --hash--\nconst RELATIVE_REGEX = /^(\\/[^?#\\s]*)?(\\?[^#\\s]+)?(#[^\\s]+)?$/i\n\nexport class AtUri {\n hash: string\n host: string\n pathname: string\n searchParams: URLSearchParams\n\n constructor(uri: string, base?: string) {\n let parsed\n if (base) {\n parsed = parse(base)\n if (!parsed) {\n throw new Error(`Invalid at uri: ${base}`)\n }\n const relativep = parseRelative(uri)\n if (!relativep) {\n throw new Error(`Invalid path: ${uri}`)\n }\n Object.assign(parsed, relativep)\n } else {\n parsed = parse(uri)\n if (!parsed) {\n throw new Error(`Invalid at uri: ${uri}`)\n }\n }\n\n this.hash = parsed.hash\n this.host = parsed.host\n this.pathname = parsed.pathname\n this.searchParams = parsed.searchParams\n }\n\n get protocol() {\n return 'at:'\n }\n\n get origin() {\n return `at://${this.host}`\n }\n\n get hostname() {\n return this.host\n }\n\n set hostname(v: string) {\n this.host = v\n }\n\n get search() {\n return this.searchParams.toString()\n }\n\n set search(v: string) {\n this.searchParams = new URLSearchParams(v)\n }\n\n get collection() {\n return this.pathname.split('/').filter(Boolean)[0] || ''\n }\n\n set collection(v: string) {\n const parts = this.pathname.split('/').filter(Boolean)\n parts[0] = v\n this.pathname = parts.join('/')\n }\n\n get rkey() {\n return this.pathname.split('/').filter(Boolean)[1] || ''\n }\n\n set rkey(v: string) {\n const parts = this.pathname.split('/').filter(Boolean)\n if (!parts[0]) parts[0] = 'undefined'\n parts[1] = v\n this.pathname = parts.join('/')\n }\n\n get href() {\n return this.toString()\n }\n\n toString() {\n let path = this.pathname || '/'\n if (!path.startsWith('/')) {\n path = `/${path}`\n }\n let qs = this.searchParams.toString()\n if (qs && !qs.startsWith('?')) {\n qs = `?${qs}`\n }\n let hash = this.hash\n if (hash && !hash.startsWith('#')) {\n hash = `#${hash}`\n }\n return `at://${this.host}${path}${qs}${hash}`\n }\n}\n\nfunction parse(str: string) {\n const match = ATP_URI_REGEX.exec(str)\n if (match) {\n return {\n hash: match[5] || '',\n host: match[2] || '',\n pathname: match[3] || '',\n searchParams: new URLSearchParams(match[4] || ''),\n }\n }\n return undefined\n}\n\nfunction parseRelative(str: string) {\n const match = RELATIVE_REGEX.exec(str)\n if (match) {\n return {\n hash: match[3] || '',\n pathname: match[1] || '',\n searchParams: new URLSearchParams(match[2] || ''),\n }\n }\n return undefined\n}\n"],
"mappings": "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",
"names": []
}

View File

@ -1,5 +1,5 @@
export declare const ADX_URI_REGEX: RegExp;
export declare class AdxUri {
export declare const ATP_URI_REGEX: RegExp;
export declare class AtUri {
hash: string;
host: string;
pathname: string;
@ -13,8 +13,8 @@ export declare class AdxUri {
set search(v: string);
get collection(): string;
set collection(v: string);
get recordKey(): string;
set recordKey(v: string);
get rkey(): string;
set rkey(v: string);
get href(): string;
toString(): string;
}

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,7 @@ import {BottomSheetTextInput} from '@gorhom/bottom-sheet'
import LinearGradient from 'react-native-linear-gradient'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import * as GetUserFollows from '../../../third-party/api/src/types/app/bsky/getUserFollows'
import * as Post from '../../../third-party/api/src/types/app/bsky/post'
import {Autocomplete} from './composer/Autocomplete'
import Toast from '../util/Toast'
import ProgressCircle from '../util/ProgressCircle'
@ -20,7 +21,7 @@ export function Component({
replyTo,
onPost,
}: {
replyTo?: string
replyTo?: Post.PostRef
onPost?: () => void
}) {
const store = useStores()

View File

@ -1,7 +1,7 @@
import React, {useMemo} from 'react'
import {observer} from 'mobx-react-lite'
import {Image, StyleSheet, Text, View} from 'react-native'
import {AdxUri} from '../../../third-party/uri'
import {AtUri} from '../../../third-party/uri'
import {FontAwesomeIcon, Props} from '@fortawesome/react-native-fontawesome'
import {NotificationsViewItemModel} from '../../../state/models/notifications-view'
import {s, colors} from '../../lib/styles'
@ -20,13 +20,13 @@ export const FeedItem = observer(function FeedItem({
}) {
const itemHref = useMemo(() => {
if (item.isLike || item.isRepost) {
const urip = new AdxUri(item.subjectUri)
return `/profile/${urip.host}/post/${urip.recordKey}`
const urip = new AtUri(item.subjectUri)
return `/profile/${urip.host}/post/${urip.rkey}`
} else if (item.isFollow) {
return `/profile/${item.author.name}`
} else if (item.isReply) {
const urip = new AdxUri(item.uri)
return `/profile/${urip.host}/post/${urip.recordKey}`
const urip = new AtUri(item.uri)
return `/profile/${urip.host}/post/${urip.rkey}`
}
return ''
}, [item])

View File

@ -2,7 +2,7 @@ import React, {useMemo} from 'react'
import {observer} from 'mobx-react-lite'
import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native'
import Svg, {Line} from 'react-native-svg'
import {AdxUri} from '../../../third-party/uri'
import {AtUri} from '../../../third-party/uri'
import * as PostType from '../../../third-party/api/src/types/app/bsky/post'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {PostThreadViewPostModel} from '../../../state/models/post-thread-view'
@ -31,26 +31,29 @@ export const PostThreadItem = observer(function PostThreadItem({
const hasEngagement = item.likeCount || item.repostCount
const itemHref = useMemo(() => {
const urip = new AdxUri(item.uri)
return `/profile/${item.author.name}/post/${urip.recordKey}`
const urip = new AtUri(item.uri)
return `/profile/${item.author.name}/post/${urip.rkey}`
}, [item.uri, item.author.name])
const itemTitle = `Post by ${item.author.name}`
const authorHref = `/profile/${item.author.name}`
const authorTitle = item.author.name
const likesHref = useMemo(() => {
const urip = new AdxUri(item.uri)
return `/profile/${item.author.name}/post/${urip.recordKey}/liked-by`
const urip = new AtUri(item.uri)
return `/profile/${item.author.name}/post/${urip.rkey}/liked-by`
}, [item.uri, item.author.name])
const likesTitle = 'Likes on this post'
const repostsHref = useMemo(() => {
const urip = new AdxUri(item.uri)
return `/profile/${item.author.name}/post/${urip.recordKey}/reposted-by`
const urip = new AtUri(item.uri)
return `/profile/${item.author.name}/post/${urip.rkey}/reposted-by`
}, [item.uri, item.author.name])
const repostsTitle = 'Reposts of this post'
const onPressReply = () => {
store.shell.openModal(
new ComposePostModel({replyTo: item.uri, onPost: onPostReply}),
new ComposePostModel({
replyTo: {uri: item.uri, cid: item.cid},
onPost: onPostReply,
}),
)
}
const onPressToggleRepost = () => {

View File

@ -1,6 +1,6 @@
import React, {useState, useEffect, useMemo} from 'react'
import {observer} from 'mobx-react-lite'
import {AdxUri} from '../../../third-party/uri'
import {AtUri} from '../../../third-party/uri'
import * as PostType from '../../../third-party/api/src/types/app/bsky/post'
import {
ActivityIndicator,
@ -59,20 +59,22 @@ export const Post = observer(function Post({uri}: {uri: string}) {
const item = view.thread
const record = view.thread?.record as unknown as PostType.Record
const itemUrip = new AdxUri(item.uri)
const itemHref = `/profile/${item.author.name}/post/${itemUrip.recordKey}`
const itemUrip = new AtUri(item.uri)
const itemHref = `/profile/${item.author.name}/post/${itemUrip.rkey}`
const itemTitle = `Post by ${item.author.name}`
const authorHref = `/profile/${item.author.name}`
const authorTitle = item.author.name
let replyAuthorDid = ''
let replyHref = ''
if (record.reply) {
const urip = new AdxUri(record.reply.parent || record.reply.root)
const urip = new AtUri(record.reply.parent?.uri || record.reply.root.uri)
replyAuthorDid = urip.hostname
replyHref = `/profile/${urip.hostname}/post/${urip.recordKey}`
replyHref = `/profile/${urip.hostname}/post/${urip.rkey}`
}
const onPressReply = () => {
store.shell.openModal(new ComposePostModel({replyTo: item.uri}))
store.shell.openModal(
new ComposePostModel({replyTo: {uri: item.uri, cid: item.cid}}),
)
}
const onPressToggleRepost = () => {
item

View File

@ -1,7 +1,7 @@
import React, {useMemo} from 'react'
import {observer} from 'mobx-react-lite'
import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native'
import {AdxUri} from '../../../third-party/uri'
import {AtUri} from '../../../third-party/uri'
import * as PostType from '../../../third-party/api/src/types/app/bsky/post'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {FeedViewItemModel} from '../../../state/models/feed-view'
@ -23,24 +23,26 @@ export const FeedItem = observer(function FeedItem({
const store = useStores()
const record = item.record as unknown as PostType.Record
const itemHref = useMemo(() => {
const urip = new AdxUri(item.uri)
return `/profile/${item.author.name}/post/${urip.recordKey}`
const urip = new AtUri(item.uri)
return `/profile/${item.author.name}/post/${urip.rkey}`
}, [item.uri, item.author.name])
const itemTitle = `Post by ${item.author.name}`
const authorHref = `/profile/${item.author.name}`
const replyAuthorDid = useMemo(() => {
if (!record.reply) return ''
const urip = new AdxUri(record.reply.parent || record.reply.root)
const urip = new AtUri(record.reply.parent?.uri || record.reply.root.uri)
return urip.hostname
}, [record.reply])
const replyHref = useMemo(() => {
if (!record.reply) return ''
const urip = new AdxUri(record.reply.parent || record.reply.root)
return `/profile/${urip.hostname}/post/${urip.recordKey}`
const urip = new AtUri(record.reply.parent?.uri || record.reply.root.uri)
return `/profile/${urip.hostname}/post/${urip.rkey}`
}, [record.reply])
const onPressReply = () => {
store.shell.openModal(new ComposePostModel({replyTo: item.uri}))
store.shell.openModal(
new ComposePostModel({replyTo: {uri: item.uri, cid: item.cid}}),
)
}
const onPressToggleRepost = () => {
item

View File

@ -1,4 +1,4 @@
import {AdxUri} from '../../third-party/uri'
import {AtUri} from '../../third-party/uri'
import {Entity as Entities} from '../../third-party/api/src/types/app/bsky/post'
type Entity = Entities[0]
@ -16,12 +16,12 @@ export function pluralize(n: number, base: string, plural?: string): string {
export function makeRecordUri(
didOrName: string,
collection: string,
recordKey: string,
rkey: string,
) {
const urip = new AdxUri(`adx://host/`)
const urip = new AtUri(`at://host/`)
urip.host = didOrName
urip.collection = collection
urip.recordKey = recordKey
urip.rkey = rkey
return urip.toString()
}

View File

@ -39,17 +39,17 @@ export const routes: Route[] = [
[
PostThread,
['far', 'message'],
r('/profile/(?<name>[^/]+)/post/(?<recordKey>[^/]+)'),
r('/profile/(?<name>[^/]+)/post/(?<rkey>[^/]+)'),
],
[
PostLikedBy,
'heart',
r('/profile/(?<name>[^/]+)/post/(?<recordKey>[^/]+)/liked-by'),
r('/profile/(?<name>[^/]+)/post/(?<rkey>[^/]+)/liked-by'),
],
[
PostRepostedBy,
'retweet',
r('/profile/(?<name>[^/]+)/post/(?<recordKey>[^/]+)/reposted-by'),
r('/profile/(?<name>[^/]+)/post/(?<rkey>[^/]+)/reposted-by'),
],
]

View File

@ -6,8 +6,8 @@ import {useStores} from '../../state'
export const PostLikedBy = ({visible, params}: ScreenParams) => {
const store = useStores()
const {name, recordKey} = params
const uri = makeRecordUri(name, 'app.bsky.post', recordKey)
const {name, rkey} = params
const uri = makeRecordUri(name, 'app.bsky.post', rkey)
useEffect(() => {
if (visible) {

View File

@ -6,8 +6,8 @@ import {useStores} from '../../state'
export const PostRepostedBy = ({visible, params}: ScreenParams) => {
const store = useStores()
const {name, recordKey} = params
const uri = makeRecordUri(name, 'app.bsky.post', recordKey)
const {name, rkey} = params
const uri = makeRecordUri(name, 'app.bsky.post', rkey)
useEffect(() => {
if (visible) {

View File

@ -6,8 +6,8 @@ import {useStores} from '../../state'
export const PostThread = ({visible, params}: ScreenParams) => {
const store = useStores()
const {name, recordKey} = params
const uri = makeRecordUri(name, 'app.bsky.post', recordKey)
const {name, rkey} = params
const uri = makeRecordUri(name, 'app.bsky.post', rkey)
useEffect(() => {
if (visible) {