Update to latest APIs
parent
349cfe7177
commit
1983512fef
|
@ -1,5 +1,5 @@
|
||||||
import {autorun} from 'mobx'
|
import {autorun} from 'mobx'
|
||||||
import AdxApi from '../third-party/api'
|
import AtpApi from '../third-party/api'
|
||||||
import {RootStoreModel} from './models/root-store'
|
import {RootStoreModel} from './models/root-store'
|
||||||
import * as libapi from './lib/api'
|
import * as libapi from './lib/api'
|
||||||
import * as storage from './lib/storage'
|
import * as storage from './lib/storage'
|
||||||
|
@ -17,7 +17,7 @@ export async function setupState() {
|
||||||
|
|
||||||
libapi.doPolyfill()
|
libapi.doPolyfill()
|
||||||
|
|
||||||
const api = AdxApi.service(DEFAULT_SERVICE)
|
const api = AtpApi.service(DEFAULT_SERVICE)
|
||||||
rootStore = new RootStoreModel(api)
|
rootStore = new RootStoreModel(api)
|
||||||
try {
|
try {
|
||||||
data = (await storage.load(ROOT_STATE_STORAGE_KEY)) || {}
|
data = (await storage.load(ROOT_STATE_STORAGE_KEY)) || {}
|
||||||
|
|
|
@ -4,32 +4,37 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// import {ReactNativeStore} from './auth'
|
// 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 * 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 {RootStoreModel} from '../models/root-store'
|
||||||
import {extractEntities} from '../../view/lib/strings'
|
import {extractEntities} from '../../view/lib/strings'
|
||||||
|
|
||||||
export function doPolyfill() {
|
export function doPolyfill() {
|
||||||
AdxApi.xrpc.fetch = fetchHandler
|
AtpApi.xrpc.fetch = fetchHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function post(
|
export async function post(
|
||||||
store: RootStoreModel,
|
store: RootStoreModel,
|
||||||
text: string,
|
text: string,
|
||||||
replyToUri?: string,
|
replyTo?: Post.PostRef,
|
||||||
) {
|
) {
|
||||||
let reply
|
let reply
|
||||||
if (replyToUri) {
|
if (replyTo) {
|
||||||
const replyToUrip = new AdxUri(replyToUri)
|
const replyToUrip = new AtUri(replyTo.uri)
|
||||||
const parentPost = await store.api.app.bsky.post.get({
|
const parentPost = await store.api.app.bsky.post.get({
|
||||||
nameOrDid: replyToUrip.host,
|
user: replyToUrip.host,
|
||||||
tid: replyToUrip.recordKey,
|
rkey: replyToUrip.rkey,
|
||||||
})
|
})
|
||||||
if (parentPost) {
|
if (parentPost) {
|
||||||
|
const parentRef = {
|
||||||
|
uri: parentPost.uri,
|
||||||
|
cid: parentPost.cid,
|
||||||
|
}
|
||||||
reply = {
|
reply = {
|
||||||
root: parentPost.value.reply?.root || parentPost.uri,
|
root: parentPost.value.reply?.root || parentRef,
|
||||||
parent: parentPost.uri,
|
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(
|
return await store.api.app.bsky.like.create(
|
||||||
{did: store.me.did || ''},
|
{did: store.me.did || ''},
|
||||||
{
|
{
|
||||||
subject: uri,
|
subject: {uri, cid},
|
||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function unlike(store: RootStoreModel, likeUri: string) {
|
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({
|
return await store.api.app.bsky.like.delete({
|
||||||
did: likeUrip.hostname,
|
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(
|
return await store.api.app.bsky.repost.create(
|
||||||
{did: store.me.did || ''},
|
{did: store.me.did || ''},
|
||||||
{
|
{
|
||||||
subject: uri,
|
subject: {uri, cid},
|
||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function unrepost(store: RootStoreModel, repostUri: string) {
|
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({
|
return await store.api.app.bsky.repost.delete({
|
||||||
did: repostUrip.hostname,
|
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) {
|
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({
|
return await store.api.app.bsky.follow.delete({
|
||||||
did: followUrip.hostname,
|
did: followUrip.hostname,
|
||||||
tid: followUrip.recordKey,
|
rkey: followUrip.rkey,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,15 +108,16 @@ export async function updateProfile(
|
||||||
store: RootStoreModel,
|
store: RootStoreModel,
|
||||||
modifyFn: (existing?: Profile.Record) => Profile.Record,
|
modifyFn: (existing?: Profile.Record) => Profile.Record,
|
||||||
) {
|
) {
|
||||||
|
// TODO: replaceme
|
||||||
const res = await store.api.app.bsky.profile.list({
|
const res = await store.api.app.bsky.profile.list({
|
||||||
nameOrDid: store.me.did || '',
|
user: store.me.did || '',
|
||||||
})
|
})
|
||||||
const existing = res.records[0]
|
const existing = res.records[0]
|
||||||
if (existing) {
|
if (existing) {
|
||||||
await store.api.app.bsky.profile.put(
|
await store.api.app.bsky.profile.put(
|
||||||
{
|
{
|
||||||
did: store.me.did || '',
|
did: store.me.did || '',
|
||||||
tid: new AdxUri(existing.uri).recordKey,
|
rkey: new AtUri(existing.uri).rkey,
|
||||||
},
|
},
|
||||||
modifyFn(existing.value),
|
modifyFn(existing.value),
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,8 +18,8 @@ export class FeedItemModel implements GetHomeFeed.FeedItem {
|
||||||
_reactKey: string = ''
|
_reactKey: string = ''
|
||||||
|
|
||||||
// data
|
// data
|
||||||
cursor: string = ''
|
|
||||||
uri: string = ''
|
uri: string = ''
|
||||||
|
cid: string = ''
|
||||||
author: GetHomeFeed.User = {did: '', name: '', displayName: ''}
|
author: GetHomeFeed.User = {did: '', name: '', displayName: ''}
|
||||||
repostedBy?: GetHomeFeed.User
|
repostedBy?: GetHomeFeed.User
|
||||||
record: Record<string, unknown> = {}
|
record: Record<string, unknown> = {}
|
||||||
|
@ -44,8 +44,8 @@ export class FeedItemModel implements GetHomeFeed.FeedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
copy(v: GetHomeFeed.FeedItem | GetAuthorFeed.FeedItem) {
|
copy(v: GetHomeFeed.FeedItem | GetAuthorFeed.FeedItem) {
|
||||||
this.cursor = v.cursor
|
|
||||||
this.uri = v.uri
|
this.uri = v.uri
|
||||||
|
this.cid = v.cid
|
||||||
this.author = v.author
|
this.author = v.author
|
||||||
this.repostedBy = v.repostedBy
|
this.repostedBy = v.repostedBy
|
||||||
this.record = v.record
|
this.record = v.record
|
||||||
|
@ -68,7 +68,7 @@ export class FeedItemModel implements GetHomeFeed.FeedItem {
|
||||||
this.myState.like = undefined
|
this.myState.like = undefined
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const res = await apilib.like(this.rootStore, this.uri)
|
const res = await apilib.like(this.rootStore, this.uri, this.cid)
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
this.likeCount++
|
this.likeCount++
|
||||||
this.myState.like = res.uri
|
this.myState.like = res.uri
|
||||||
|
@ -84,7 +84,7 @@ export class FeedItemModel implements GetHomeFeed.FeedItem {
|
||||||
this.myState.repost = undefined
|
this.myState.repost = undefined
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const res = await apilib.repost(this.rootStore, this.uri)
|
const res = await apilib.repost(this.rootStore, this.uri, this.cid)
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
this.repostCount++
|
this.repostCount++
|
||||||
this.myState.repost = res.uri
|
this.myState.repost = res.uri
|
||||||
|
@ -101,6 +101,7 @@ export class FeedModel {
|
||||||
hasReachedEnd = false
|
hasReachedEnd = false
|
||||||
error = ''
|
error = ''
|
||||||
params: GetHomeFeed.QueryParams | GetAuthorFeed.QueryParams
|
params: GetHomeFeed.QueryParams | GetAuthorFeed.QueryParams
|
||||||
|
loadMoreCursor: string | undefined
|
||||||
_loadPromise: Promise<void> | undefined
|
_loadPromise: Promise<void> | undefined
|
||||||
_loadMorePromise: Promise<void> | undefined
|
_loadMorePromise: Promise<void> | undefined
|
||||||
_loadLatestPromise: Promise<void> | undefined
|
_loadLatestPromise: Promise<void> | undefined
|
||||||
|
@ -119,6 +120,7 @@ export class FeedModel {
|
||||||
{
|
{
|
||||||
rootStore: false,
|
rootStore: false,
|
||||||
params: false,
|
params: false,
|
||||||
|
loadMoreCursor: false,
|
||||||
_loadPromise: false,
|
_loadPromise: false,
|
||||||
_loadMorePromise: false,
|
_loadMorePromise: false,
|
||||||
_loadLatestPromise: false,
|
_loadLatestPromise: false,
|
||||||
|
@ -141,13 +143,6 @@ export class FeedModel {
|
||||||
return this.hasLoaded && !this.hasContent
|
return this.hasLoaded && !this.hasContent
|
||||||
}
|
}
|
||||||
|
|
||||||
get loadMoreCursor() {
|
|
||||||
if (this.hasContent) {
|
|
||||||
return this.feed[this.feed.length - 1].cursor
|
|
||||||
}
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
// public api
|
// public api
|
||||||
// =
|
// =
|
||||||
|
|
||||||
|
@ -316,6 +311,7 @@ export class FeedModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _appendAll(res: GetHomeFeed.Response | GetAuthorFeed.Response) {
|
private _appendAll(res: GetHomeFeed.Response | GetAuthorFeed.Response) {
|
||||||
|
this.loadMoreCursor = res.data.cursor
|
||||||
let counter = this.feed.length
|
let counter = this.feed.length
|
||||||
for (const item of res.data.feed) {
|
for (const item of res.data.feed) {
|
||||||
this._append(counter++, item)
|
this._append(counter++, item)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {makeAutoObservable, runInAction} from 'mobx'
|
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 * as GetLikedBy from '../../third-party/api/src/types/app/bsky/getLikedBy'
|
||||||
import {RootStoreModel} from './root-store'
|
import {RootStoreModel} from './root-store'
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ export class LikedByViewModel {
|
||||||
// =
|
// =
|
||||||
|
|
||||||
private async _resolveUri() {
|
private async _resolveUri() {
|
||||||
const urip = new AdxUri(this.params.uri)
|
const urip = new AtUri(this.params.uri)
|
||||||
if (!urip.host.startsWith('did:')) {
|
if (!urip.host.startsWith('did:')) {
|
||||||
urip.host = await this.rootStore.resolveName(urip.host)
|
urip.host = await this.rootStore.resolveName(urip.host)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ export class NotificationsViewItemModel implements GroupedNotification {
|
||||||
|
|
||||||
// data
|
// data
|
||||||
uri: string = ''
|
uri: string = ''
|
||||||
|
cid: string = ''
|
||||||
author: {
|
author: {
|
||||||
did: string
|
did: string
|
||||||
name: string
|
name: string
|
||||||
|
@ -37,6 +38,7 @@ export class NotificationsViewItemModel implements GroupedNotification {
|
||||||
|
|
||||||
copy(v: GroupedNotification) {
|
copy(v: GroupedNotification) {
|
||||||
this.uri = v.uri
|
this.uri = v.uri
|
||||||
|
this.cid = v.cid
|
||||||
this.author = v.author
|
this.author = v.author
|
||||||
this.reason = v.reason
|
this.reason = v.reason
|
||||||
this.reasonSubject = v.reasonSubject
|
this.reasonSubject = v.reasonSubject
|
||||||
|
@ -92,6 +94,7 @@ export class NotificationsViewModel {
|
||||||
hasLoaded = false
|
hasLoaded = false
|
||||||
error = ''
|
error = ''
|
||||||
params: GetNotifications.QueryParams
|
params: GetNotifications.QueryParams
|
||||||
|
loadMoreCursor?: string
|
||||||
_loadPromise: Promise<void> | undefined
|
_loadPromise: Promise<void> | undefined
|
||||||
_loadMorePromise: Promise<void> | undefined
|
_loadMorePromise: Promise<void> | undefined
|
||||||
_updatePromise: Promise<void> | undefined
|
_updatePromise: Promise<void> | undefined
|
||||||
|
@ -129,21 +132,6 @@ export class NotificationsViewModel {
|
||||||
return this.hasLoaded && !this.hasContent
|
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
|
// public api
|
||||||
// =
|
// =
|
||||||
|
|
||||||
|
@ -283,6 +271,7 @@ export class NotificationsViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _appendAll(res: GetNotifications.Response) {
|
private _appendAll(res: GetNotifications.Response) {
|
||||||
|
this.loadMoreCursor = res.data.cursor
|
||||||
let counter = this.notifications.length
|
let counter = this.notifications.length
|
||||||
for (const item of groupNotifications(res.data.notifications)) {
|
for (const item of groupNotifications(res.data.notifications)) {
|
||||||
this._append(counter++, item)
|
this._append(counter++, item)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {makeAutoObservable, runInAction} from 'mobx'
|
import {makeAutoObservable, runInAction} from 'mobx'
|
||||||
import * as GetPostThread from '../../third-party/api/src/types/app/bsky/getPostThread'
|
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 _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'
|
||||||
|
@ -29,6 +29,7 @@ export class PostThreadViewPostModel implements GetPostThread.Post {
|
||||||
|
|
||||||
// data
|
// data
|
||||||
uri: string = ''
|
uri: string = ''
|
||||||
|
cid: string = ''
|
||||||
author: GetPostThread.User = {did: '', name: '', displayName: ''}
|
author: GetPostThread.User = {did: '', name: '', displayName: ''}
|
||||||
record: Record<string, unknown> = {}
|
record: Record<string, unknown> = {}
|
||||||
embed?:
|
embed?:
|
||||||
|
@ -112,7 +113,7 @@ export class PostThreadViewPostModel implements GetPostThread.Post {
|
||||||
this.myState.like = undefined
|
this.myState.like = undefined
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const res = await apilib.like(this.rootStore, this.uri)
|
const res = await apilib.like(this.rootStore, this.uri, this.cid)
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
this.likeCount++
|
this.likeCount++
|
||||||
this.myState.like = res.uri
|
this.myState.like = res.uri
|
||||||
|
@ -128,7 +129,7 @@ export class PostThreadViewPostModel implements GetPostThread.Post {
|
||||||
this.myState.repost = undefined
|
this.myState.repost = undefined
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const res = await apilib.repost(this.rootStore, this.uri)
|
const res = await apilib.repost(this.rootStore, this.uri, this.cid)
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
this.repostCount++
|
this.repostCount++
|
||||||
this.myState.repost = res.uri
|
this.myState.repost = res.uri
|
||||||
|
@ -226,7 +227,7 @@ export class PostThreadViewModel {
|
||||||
// =
|
// =
|
||||||
|
|
||||||
private async _resolveUri() {
|
private async _resolveUri() {
|
||||||
const urip = new AdxUri(this.params.uri)
|
const urip = new AtUri(this.params.uri)
|
||||||
if (!urip.host.startsWith('did:')) {
|
if (!urip.host.startsWith('did:')) {
|
||||||
urip.host = await this.rootStore.resolveName(urip.host)
|
urip.host = await this.rootStore.resolveName(urip.host)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {makeAutoObservable} from 'mobx'
|
import {makeAutoObservable} from 'mobx'
|
||||||
import * as Post from '../../third-party/api/src/types/app/bsky/post'
|
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'
|
import {RootStoreModel} from './root-store'
|
||||||
|
|
||||||
export type PostEntities = Post.Record['entities']
|
export type PostEntities = Post.Record['entities']
|
||||||
|
@ -76,10 +76,10 @@ export class PostModel implements RemoveIndex<Post.Record> {
|
||||||
private async _load() {
|
private async _load() {
|
||||||
this._xLoading()
|
this._xLoading()
|
||||||
try {
|
try {
|
||||||
const urip = new AdxUri(this.uri)
|
const urip = new AtUri(this.uri)
|
||||||
const res = await this.rootStore.api.app.bsky.post.get({
|
const res = await this.rootStore.api.app.bsky.post.get({
|
||||||
nameOrDid: urip.host,
|
user: urip.host,
|
||||||
tid: urip.recordKey,
|
rkey: urip.rkey,
|
||||||
})
|
})
|
||||||
// TODO
|
// TODO
|
||||||
// if (!res.valid) {
|
// if (!res.valid) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ export class ProfileViewModel {
|
||||||
followersCount: number = 0
|
followersCount: number = 0
|
||||||
followsCount: number = 0
|
followsCount: number = 0
|
||||||
postsCount: number = 0
|
postsCount: number = 0
|
||||||
badges: GetProfile.Badge[] = []
|
pinnedBadges: GetProfile.Badge[] = []
|
||||||
myState = new ProfileViewMyStateModel()
|
myState = new ProfileViewMyStateModel()
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -134,7 +134,7 @@ export class ProfileViewModel {
|
||||||
this.followersCount = res.data.followersCount
|
this.followersCount = res.data.followersCount
|
||||||
this.followsCount = res.data.followsCount
|
this.followsCount = res.data.followsCount
|
||||||
this.postsCount = res.data.postsCount
|
this.postsCount = res.data.postsCount
|
||||||
this.badges = res.data.badges
|
this.pinnedBadges = res.data.pinnedBadges
|
||||||
if (res.data.myState) {
|
if (res.data.myState) {
|
||||||
Object.assign(this.myState, res.data.myState)
|
Object.assign(this.myState, res.data.myState)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {makeAutoObservable, runInAction} from 'mobx'
|
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 * as GetRepostedBy from '../../third-party/api/src/types/app/bsky/getRepostedBy'
|
||||||
import {RootStoreModel} from './root-store'
|
import {RootStoreModel} from './root-store'
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ export class RepostedByViewModel {
|
||||||
// =
|
// =
|
||||||
|
|
||||||
private async _resolveUri() {
|
private async _resolveUri() {
|
||||||
const urip = new AdxUri(this.params.uri)
|
const urip = new AtUri(this.params.uri)
|
||||||
if (!urip.host.startsWith('did:')) {
|
if (!urip.host.startsWith('did:')) {
|
||||||
urip.host = await this.rootStore.resolveName(urip.host)
|
urip.host = await this.rootStore.resolveName(urip.host)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {makeAutoObservable} from 'mobx'
|
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 type {ServiceClient} from '../../third-party/api/src/index'
|
||||||
import {createContext, useContext} from 'react'
|
import {createContext, useContext} from 'react'
|
||||||
import {isObj, hasProp} from '../lib/type-guards'
|
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)
|
const RootStoreContext = createContext<RootStoreModel>(throwawayInst)
|
||||||
export const RootStoreProvider = RootStoreContext.Provider
|
export const RootStoreProvider = RootStoreContext.Provider
|
||||||
export const useStores = () => useContext(RootStoreContext)
|
export const useStores = () => useContext(RootStoreContext)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {makeAutoObservable} from 'mobx'
|
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 type * as GetAccountsConfig from '../../third-party/api/src/types/com/atproto/getAccountsConfig'
|
||||||
import {isObj, hasProp} from '../lib/type-guards'
|
import {isObj, hasProp} from '../lib/type-guards'
|
||||||
import {RootStoreModel} from './root-store'
|
import {RootStoreModel} from './root-store'
|
||||||
|
@ -135,7 +135,7 @@ export class SessionModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
async describeService(service: string): Promise<ServiceDescription> {
|
async describeService(service: string): Promise<ServiceDescription> {
|
||||||
const api = AdxApi.service(service)
|
const api = AtpApi.service(service)
|
||||||
const res = await api.com.atproto.getAccountsConfig({})
|
const res = await api.com.atproto.getAccountsConfig({})
|
||||||
return res.data
|
return res.data
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ export class SessionModel {
|
||||||
username: string
|
username: string
|
||||||
password: string
|
password: string
|
||||||
}) {
|
}) {
|
||||||
const api = AdxApi.service(service)
|
const api = AtpApi.service(service)
|
||||||
const res = await api.com.atproto.createSession({}, {username, password})
|
const res = await api.com.atproto.createSession({}, {username, password})
|
||||||
if (res.data.jwt) {
|
if (res.data.jwt) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -178,7 +178,7 @@ export class SessionModel {
|
||||||
username: string
|
username: string
|
||||||
inviteCode?: string
|
inviteCode?: string
|
||||||
}) {
|
}) {
|
||||||
const api = AdxApi.service(service)
|
const api = AtpApi.service(service)
|
||||||
const res = await api.com.atproto.createAccount(
|
const res = await api.com.atproto.createAccount(
|
||||||
{},
|
{},
|
||||||
{username, password, email, inviteCode},
|
{username, password, email, inviteCode},
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {makeAutoObservable, runInAction} from 'mobx'
|
import {makeAutoObservable} from 'mobx'
|
||||||
import {ProfileViewModel} from './profile-view'
|
import {ProfileViewModel} from './profile-view'
|
||||||
|
import * as Post from '../../third-party/api/src/types/app/bsky/post'
|
||||||
|
|
||||||
export class TabsSelectorModel {
|
export class TabsSelectorModel {
|
||||||
name = 'tabs-selector'
|
name = 'tabs-selector'
|
||||||
|
@ -35,12 +36,12 @@ export class SharePostModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ComposePostModelOpts {
|
export interface ComposePostModelOpts {
|
||||||
replyTo?: string
|
replyTo?: Post.PostRef
|
||||||
onPost?: () => void
|
onPost?: () => void
|
||||||
}
|
}
|
||||||
export class ComposePostModel {
|
export class ComposePostModel {
|
||||||
name = 'compose-post'
|
name = 'compose-post'
|
||||||
replyTo?: string
|
replyTo?: Post.PostRef
|
||||||
onPost?: () => void
|
onPost?: () => void
|
||||||
|
|
||||||
constructor(opts?: ComposePostModelOpts) {
|
constructor(opts?: ComposePostModelOpts) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -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 ComAtprotoCreateAccount from './types/com/atproto/createAccount';
|
||||||
import * as ComAtprotoCreateInviteCode from './types/com/atproto/createInviteCode';
|
import * as ComAtprotoCreateInviteCode from './types/com/atproto/createInviteCode';
|
||||||
import * as ComAtprotoCreateSession from './types/com/atproto/createSession';
|
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 ComAtprotoSyncGetRoot from './types/com/atproto/syncGetRoot';
|
||||||
import * as ComAtprotoSyncUpdateRepo from './types/com/atproto/syncUpdateRepo';
|
import * as ComAtprotoSyncUpdateRepo from './types/com/atproto/syncUpdateRepo';
|
||||||
import * as AppBskyBadge from './types/app/bsky/badge';
|
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 AppBskyFollow from './types/app/bsky/follow';
|
||||||
import * as AppBskyGetAuthorFeed from './types/app/bsky/getAuthorFeed';
|
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 AppBskyGetHomeFeed from './types/app/bsky/getHomeFeed';
|
||||||
import * as AppBskyGetLikedBy from './types/app/bsky/getLikedBy';
|
import * as AppBskyGetLikedBy from './types/app/bsky/getLikedBy';
|
||||||
import * as AppBskyGetNotificationCount from './types/app/bsky/getNotificationCount';
|
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 AppBskyGetRepostedBy from './types/app/bsky/getRepostedBy';
|
||||||
import * as AppBskyGetUserFollowers from './types/app/bsky/getUserFollowers';
|
import * as AppBskyGetUserFollowers from './types/app/bsky/getUserFollowers';
|
||||||
import * as AppBskyGetUserFollows from './types/app/bsky/getUserFollows';
|
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 AppBskyLike from './types/app/bsky/like';
|
||||||
import * as AppBskyMediaEmbed from './types/app/bsky/mediaEmbed';
|
import * as AppBskyMediaEmbed from './types/app/bsky/mediaEmbed';
|
||||||
import * as AppBskyPost from './types/app/bsky/post';
|
import * as AppBskyPost from './types/app/bsky/post';
|
||||||
import * as AppBskyPostNotificationsSeen from './types/app/bsky/postNotificationsSeen';
|
import * as AppBskyPostNotificationsSeen from './types/app/bsky/postNotificationsSeen';
|
||||||
import * as AppBskyProfile from './types/app/bsky/profile';
|
import * as AppBskyProfile from './types/app/bsky/profile';
|
||||||
import * as AppBskyRepost from './types/app/bsky/repost';
|
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 ComAtprotoCreateAccount from './types/com/atproto/createAccount';
|
||||||
export * as ComAtprotoCreateInviteCode from './types/com/atproto/createInviteCode';
|
export * as ComAtprotoCreateInviteCode from './types/com/atproto/createInviteCode';
|
||||||
export * as ComAtprotoCreateSession from './types/com/atproto/createSession';
|
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 ComAtprotoSyncGetRoot from './types/com/atproto/syncGetRoot';
|
||||||
export * as ComAtprotoSyncUpdateRepo from './types/com/atproto/syncUpdateRepo';
|
export * as ComAtprotoSyncUpdateRepo from './types/com/atproto/syncUpdateRepo';
|
||||||
export * as AppBskyBadge from './types/app/bsky/badge';
|
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 AppBskyFollow from './types/app/bsky/follow';
|
||||||
export * as AppBskyGetAuthorFeed from './types/app/bsky/getAuthorFeed';
|
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 AppBskyGetHomeFeed from './types/app/bsky/getHomeFeed';
|
||||||
export * as AppBskyGetLikedBy from './types/app/bsky/getLikedBy';
|
export * as AppBskyGetLikedBy from './types/app/bsky/getLikedBy';
|
||||||
export * as AppBskyGetNotificationCount from './types/app/bsky/getNotificationCount';
|
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 AppBskyGetRepostedBy from './types/app/bsky/getRepostedBy';
|
||||||
export * as AppBskyGetUserFollowers from './types/app/bsky/getUserFollowers';
|
export * as AppBskyGetUserFollowers from './types/app/bsky/getUserFollowers';
|
||||||
export * as AppBskyGetUserFollows from './types/app/bsky/getUserFollows';
|
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 AppBskyLike from './types/app/bsky/like';
|
||||||
export * as AppBskyMediaEmbed from './types/app/bsky/mediaEmbed';
|
export * as AppBskyMediaEmbed from './types/app/bsky/mediaEmbed';
|
||||||
export * as AppBskyPost from './types/app/bsky/post';
|
export * as AppBskyPost from './types/app/bsky/post';
|
||||||
export * as AppBskyPostNotificationsSeen from './types/app/bsky/postNotificationsSeen';
|
export * as AppBskyPostNotificationsSeen from './types/app/bsky/postNotificationsSeen';
|
||||||
export * as AppBskyProfile from './types/app/bsky/profile';
|
export * as AppBskyProfile from './types/app/bsky/profile';
|
||||||
export * as AppBskyRepost from './types/app/bsky/repost';
|
export * as AppBskyRepost from './types/app/bsky/repost';
|
||||||
|
export * as AppBskyUpdateProfile from './types/app/bsky/updateProfile';
|
||||||
export declare class Client {
|
export declare class Client {
|
||||||
xrpc: XrpcClient;
|
xrpc: XrpcClient;
|
||||||
constructor();
|
constructor();
|
||||||
|
@ -130,6 +142,8 @@ export declare class AppNS {
|
||||||
export declare class BskyNS {
|
export declare class BskyNS {
|
||||||
_service: ServiceClient;
|
_service: ServiceClient;
|
||||||
badge: BadgeRecord;
|
badge: BadgeRecord;
|
||||||
|
badgeAccept: BadgeAcceptRecord;
|
||||||
|
badgeOffer: BadgeOfferRecord;
|
||||||
follow: FollowRecord;
|
follow: FollowRecord;
|
||||||
like: LikeRecord;
|
like: LikeRecord;
|
||||||
mediaEmbed: MediaEmbedRecord;
|
mediaEmbed: MediaEmbedRecord;
|
||||||
|
@ -138,6 +152,7 @@ export declare class BskyNS {
|
||||||
repost: RepostRecord;
|
repost: RepostRecord;
|
||||||
constructor(service: ServiceClient);
|
constructor(service: ServiceClient);
|
||||||
getAuthorFeed(params: AppBskyGetAuthorFeed.QueryParams, data?: AppBskyGetAuthorFeed.InputSchema, opts?: AppBskyGetAuthorFeed.CallOptions): Promise<AppBskyGetAuthorFeed.Response>;
|
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>;
|
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>;
|
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>;
|
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>;
|
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>;
|
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>;
|
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>;
|
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 {
|
export declare class BadgeRecord {
|
||||||
_service: ServiceClient;
|
_service: ServiceClient;
|
||||||
constructor(service: ServiceClient);
|
constructor(service: ServiceClient);
|
||||||
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
|
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
|
||||||
|
cursor?: string;
|
||||||
records: {
|
records: {
|
||||||
uri: string;
|
uri: string;
|
||||||
value: AppBskyBadge.Record;
|
value: AppBskyBadge.Record;
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
|
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
value: AppBskyBadge.Record;
|
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;
|
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;
|
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 {
|
export declare class FollowRecord {
|
||||||
_service: ServiceClient;
|
_service: ServiceClient;
|
||||||
constructor(service: ServiceClient);
|
constructor(service: ServiceClient);
|
||||||
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
|
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
|
||||||
|
cursor?: string;
|
||||||
records: {
|
records: {
|
||||||
uri: string;
|
uri: string;
|
||||||
value: AppBskyFollow.Record;
|
value: AppBskyFollow.Record;
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
|
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
value: AppBskyFollow.Record;
|
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;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
}>;
|
}>;
|
||||||
put(params: Omit<ComAtprotoRepoPutRecord.QueryParams, 'type'>, record: AppBskyFollow.Record, headers?: Record<string, string>): Promise<{
|
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
|
||||||
uri: string;
|
|
||||||
}>;
|
|
||||||
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'type'>, headers?: Record<string, string>): Promise<void>;
|
|
||||||
}
|
}
|
||||||
export declare class LikeRecord {
|
export declare class LikeRecord {
|
||||||
_service: ServiceClient;
|
_service: ServiceClient;
|
||||||
constructor(service: ServiceClient);
|
constructor(service: ServiceClient);
|
||||||
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
|
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
|
||||||
|
cursor?: string;
|
||||||
records: {
|
records: {
|
||||||
uri: string;
|
uri: string;
|
||||||
value: AppBskyLike.Record;
|
value: AppBskyLike.Record;
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
|
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
value: AppBskyLike.Record;
|
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;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
}>;
|
}>;
|
||||||
put(params: Omit<ComAtprotoRepoPutRecord.QueryParams, 'type'>, record: AppBskyLike.Record, headers?: Record<string, string>): Promise<{
|
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
|
||||||
uri: string;
|
|
||||||
}>;
|
|
||||||
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'type'>, headers?: Record<string, string>): Promise<void>;
|
|
||||||
}
|
}
|
||||||
export declare class MediaEmbedRecord {
|
export declare class MediaEmbedRecord {
|
||||||
_service: ServiceClient;
|
_service: ServiceClient;
|
||||||
constructor(service: ServiceClient);
|
constructor(service: ServiceClient);
|
||||||
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
|
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
|
||||||
|
cursor?: string;
|
||||||
records: {
|
records: {
|
||||||
uri: string;
|
uri: string;
|
||||||
value: AppBskyMediaEmbed.Record;
|
value: AppBskyMediaEmbed.Record;
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
|
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
value: AppBskyMediaEmbed.Record;
|
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;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
}>;
|
}>;
|
||||||
put(params: Omit<ComAtprotoRepoPutRecord.QueryParams, 'type'>, record: AppBskyMediaEmbed.Record, headers?: Record<string, string>): Promise<{
|
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
|
||||||
uri: string;
|
|
||||||
}>;
|
|
||||||
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'type'>, headers?: Record<string, string>): Promise<void>;
|
|
||||||
}
|
}
|
||||||
export declare class PostRecord {
|
export declare class PostRecord {
|
||||||
_service: ServiceClient;
|
_service: ServiceClient;
|
||||||
constructor(service: ServiceClient);
|
constructor(service: ServiceClient);
|
||||||
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
|
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
|
||||||
|
cursor?: string;
|
||||||
records: {
|
records: {
|
||||||
uri: string;
|
uri: string;
|
||||||
value: AppBskyPost.Record;
|
value: AppBskyPost.Record;
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
|
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
value: AppBskyPost.Record;
|
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;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
}>;
|
}>;
|
||||||
put(params: Omit<ComAtprotoRepoPutRecord.QueryParams, 'type'>, record: AppBskyPost.Record, headers?: Record<string, string>): Promise<{
|
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
|
||||||
uri: string;
|
|
||||||
}>;
|
|
||||||
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'type'>, headers?: Record<string, string>): Promise<void>;
|
|
||||||
}
|
}
|
||||||
export declare class ProfileRecord {
|
export declare class ProfileRecord {
|
||||||
_service: ServiceClient;
|
_service: ServiceClient;
|
||||||
constructor(service: ServiceClient);
|
constructor(service: ServiceClient);
|
||||||
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
|
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
|
||||||
|
cursor?: string;
|
||||||
records: {
|
records: {
|
||||||
uri: string;
|
uri: string;
|
||||||
value: AppBskyProfile.Record;
|
value: AppBskyProfile.Record;
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
|
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
value: AppBskyProfile.Record;
|
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;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
}>;
|
}>;
|
||||||
put(params: Omit<ComAtprotoRepoPutRecord.QueryParams, 'type'>, record: AppBskyProfile.Record, headers?: Record<string, string>): Promise<{
|
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
|
||||||
uri: string;
|
|
||||||
}>;
|
|
||||||
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'type'>, headers?: Record<string, string>): Promise<void>;
|
|
||||||
}
|
}
|
||||||
export declare class RepostRecord {
|
export declare class RepostRecord {
|
||||||
_service: ServiceClient;
|
_service: ServiceClient;
|
||||||
constructor(service: ServiceClient);
|
constructor(service: ServiceClient);
|
||||||
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'type'>): Promise<{
|
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
|
||||||
|
cursor?: string;
|
||||||
records: {
|
records: {
|
||||||
uri: string;
|
uri: string;
|
||||||
value: AppBskyRepost.Record;
|
value: AppBskyRepost.Record;
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'type'>): Promise<{
|
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
value: AppBskyRepost.Record;
|
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;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
}>;
|
}>;
|
||||||
put(params: Omit<ComAtprotoRepoPutRecord.QueryParams, 'type'>, record: AppBskyRepost.Record, headers?: Record<string, string>): Promise<{
|
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
|
||||||
uri: string;
|
|
||||||
}>;
|
|
||||||
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'type'>, headers?: Record<string, string>): Promise<void>;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 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[];
|
export declare const recordSchemas: RecordSchema[];
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export interface Record {
|
export interface Record {
|
||||||
assertion: InviteAssertion | EmployeeAssertion | TagAssertion | UnknownAssertion;
|
assertion: InviteAssertion | EmployeeAssertion | TagAssertion | UnknownAssertion;
|
||||||
subject: string;
|
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
author: string;
|
author: string;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
|
@ -9,11 +9,12 @@ export interface CallOptions {
|
||||||
}
|
}
|
||||||
export declare type InputSchema = undefined;
|
export declare type InputSchema = undefined;
|
||||||
export interface OutputSchema {
|
export interface OutputSchema {
|
||||||
|
cursor?: string;
|
||||||
feed: FeedItem[];
|
feed: FeedItem[];
|
||||||
}
|
}
|
||||||
export interface FeedItem {
|
export interface FeedItem {
|
||||||
cursor: string;
|
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
author: User;
|
author: User;
|
||||||
repostedBy?: User;
|
repostedBy?: User;
|
||||||
record: {};
|
record: {};
|
||||||
|
|
|
@ -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;
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
algorithm?: string;
|
algorithm?: string;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
|
@ -9,11 +9,12 @@ export interface CallOptions {
|
||||||
}
|
}
|
||||||
export declare type InputSchema = undefined;
|
export declare type InputSchema = undefined;
|
||||||
export interface OutputSchema {
|
export interface OutputSchema {
|
||||||
|
cursor?: string;
|
||||||
feed: FeedItem[];
|
feed: FeedItem[];
|
||||||
}
|
}
|
||||||
export interface FeedItem {
|
export interface FeedItem {
|
||||||
cursor: string;
|
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
author: User;
|
author: User;
|
||||||
repostedBy?: User;
|
repostedBy?: User;
|
||||||
record: {};
|
record: {};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid?: string;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
before?: string;
|
before?: string;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +11,8 @@ export interface CallOptions {
|
||||||
export declare type InputSchema = undefined;
|
export declare type InputSchema = undefined;
|
||||||
export interface OutputSchema {
|
export interface OutputSchema {
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid?: string;
|
||||||
|
cursor?: string;
|
||||||
likedBy: {
|
likedBy: {
|
||||||
did: string;
|
did: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
limit?: number;
|
limit?: number;
|
||||||
before?: string;
|
before?: string;
|
||||||
|
@ -8,10 +8,12 @@ export interface CallOptions {
|
||||||
}
|
}
|
||||||
export declare type InputSchema = undefined;
|
export declare type InputSchema = undefined;
|
||||||
export interface OutputSchema {
|
export interface OutputSchema {
|
||||||
|
cursor?: string;
|
||||||
notifications: Notification[];
|
notifications: Notification[];
|
||||||
}
|
}
|
||||||
export interface Notification {
|
export interface Notification {
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
author: {
|
author: {
|
||||||
did: string;
|
did: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
uri: string;
|
uri: string;
|
||||||
depth?: number;
|
depth?: number;
|
||||||
|
@ -12,6 +12,7 @@ export interface OutputSchema {
|
||||||
}
|
}
|
||||||
export interface Post {
|
export interface Post {
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
author: User;
|
author: User;
|
||||||
record: {};
|
record: {};
|
||||||
embed?: RecordEmbed | ExternalEmbed | UnknownEmbed;
|
embed?: RecordEmbed | ExternalEmbed | UnknownEmbed;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
user: string;
|
user: string;
|
||||||
}
|
}
|
||||||
|
@ -14,21 +14,23 @@ export interface OutputSchema {
|
||||||
followersCount: number;
|
followersCount: number;
|
||||||
followsCount: number;
|
followsCount: number;
|
||||||
postsCount: number;
|
postsCount: number;
|
||||||
badges: Badge[];
|
pinnedBadges: Badge[];
|
||||||
myState?: {
|
myState?: {
|
||||||
follow?: string;
|
follow?: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export interface Badge {
|
export interface Badge {
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
issuer?: {
|
issuer?: {
|
||||||
did: string;
|
did: string;
|
||||||
name: string;
|
name: string;
|
||||||
displayName: string;
|
displayName?: string;
|
||||||
};
|
};
|
||||||
assertion?: {
|
assertion?: {
|
||||||
type: string;
|
type: string;
|
||||||
|
tag?: string;
|
||||||
};
|
};
|
||||||
createdAt?: string;
|
createdAt?: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid?: string;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
before?: string;
|
before?: string;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +11,8 @@ export interface CallOptions {
|
||||||
export declare type InputSchema = undefined;
|
export declare type InputSchema = undefined;
|
||||||
export interface OutputSchema {
|
export interface OutputSchema {
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid?: string;
|
||||||
|
cursor?: string;
|
||||||
repostedBy: {
|
repostedBy: {
|
||||||
did: string;
|
did: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
user: string;
|
user: string;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
|
@ -14,6 +14,7 @@ export interface OutputSchema {
|
||||||
name: string;
|
name: string;
|
||||||
displayName?: string;
|
displayName?: string;
|
||||||
};
|
};
|
||||||
|
cursor?: string;
|
||||||
followers: {
|
followers: {
|
||||||
did: string;
|
did: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
user: string;
|
user: string;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
|
@ -14,6 +14,7 @@ export interface OutputSchema {
|
||||||
name: string;
|
name: string;
|
||||||
displayName?: string;
|
displayName?: string;
|
||||||
};
|
};
|
||||||
|
cursor?: string;
|
||||||
follows: {
|
follows: {
|
||||||
did: string;
|
did: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -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;
|
|
@ -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;
|
|
@ -1,5 +1,10 @@
|
||||||
export interface Record {
|
export interface Record {
|
||||||
subject: string;
|
subject: Subject;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
}
|
}
|
||||||
|
export interface Subject {
|
||||||
|
uri: string;
|
||||||
|
cid: string;
|
||||||
|
[k: string]: unknown;
|
||||||
|
}
|
||||||
|
|
|
@ -9,10 +9,15 @@ export interface Record {
|
||||||
text: string;
|
text: string;
|
||||||
entities?: Entity;
|
entities?: Entity;
|
||||||
reply?: {
|
reply?: {
|
||||||
root: string;
|
root: PostRef;
|
||||||
parent?: string;
|
parent: PostRef;
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
};
|
};
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
}
|
}
|
||||||
|
export interface PostRef {
|
||||||
|
uri: string;
|
||||||
|
cid: string;
|
||||||
|
[k: string]: unknown;
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
export interface Record {
|
export interface Record {
|
||||||
displayName: string;
|
displayName: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
badges?: BadgeRef[];
|
pinnedBadges?: BadgeRef[];
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
}
|
}
|
||||||
export interface BadgeRef {
|
export interface BadgeRef {
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
export interface Record {
|
export interface Record {
|
||||||
subject: string;
|
subject: Subject;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
}
|
}
|
||||||
|
export interface Subject {
|
||||||
|
uri: string;
|
||||||
|
cid: string;
|
||||||
|
[k: string]: unknown;
|
||||||
|
}
|
||||||
|
|
|
@ -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;
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers, XRPCError } from '@adxp/xrpc';
|
import { Headers, XRPCError } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
@ -10,6 +10,7 @@ export interface InputSchema {
|
||||||
username: string;
|
username: string;
|
||||||
inviteCode?: string;
|
inviteCode?: string;
|
||||||
password: string;
|
password: string;
|
||||||
|
recoveryKey?: string;
|
||||||
}
|
}
|
||||||
export interface OutputSchema {
|
export interface OutputSchema {
|
||||||
jwt: string;
|
jwt: string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
did: string;
|
did: string;
|
||||||
validate?: boolean;
|
validate?: boolean;
|
||||||
|
@ -11,16 +11,17 @@ export interface InputSchema {
|
||||||
writes: ({
|
writes: ({
|
||||||
action: 'create';
|
action: 'create';
|
||||||
collection: string;
|
collection: string;
|
||||||
|
rkey?: string;
|
||||||
value: unknown;
|
value: unknown;
|
||||||
} | {
|
} | {
|
||||||
action: 'update';
|
action: 'update';
|
||||||
collection: string;
|
collection: string;
|
||||||
tid: string;
|
rkey: string;
|
||||||
value: unknown;
|
value: unknown;
|
||||||
} | {
|
} | {
|
||||||
action: 'delete';
|
action: 'delete';
|
||||||
collection: string;
|
collection: string;
|
||||||
tid: string;
|
rkey: string;
|
||||||
})[];
|
})[];
|
||||||
}
|
}
|
||||||
export interface OutputSchema {
|
export interface OutputSchema {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
did: string;
|
did: string;
|
||||||
type: string;
|
collection: string;
|
||||||
validate?: boolean;
|
validate?: boolean;
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
@ -13,6 +13,7 @@ export interface InputSchema {
|
||||||
}
|
}
|
||||||
export interface OutputSchema {
|
export interface OutputSchema {
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
}
|
}
|
||||||
export interface Response {
|
export interface Response {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
did: string;
|
did: string;
|
||||||
type: string;
|
collection: string;
|
||||||
tid: string;
|
rkey: string;
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
headers?: Headers;
|
headers?: Headers;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
nameOrDid: string;
|
user: string;
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
headers?: Headers;
|
headers?: Headers;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
nameOrDid: string;
|
user: string;
|
||||||
type: string;
|
collection: string;
|
||||||
tid: string;
|
rkey: string;
|
||||||
|
cid?: string;
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
headers?: Headers;
|
headers?: Headers;
|
||||||
|
@ -10,6 +11,7 @@ export interface CallOptions {
|
||||||
export declare type InputSchema = undefined;
|
export declare type InputSchema = undefined;
|
||||||
export interface OutputSchema {
|
export interface OutputSchema {
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid?: string;
|
||||||
value: {};
|
value: {};
|
||||||
}
|
}
|
||||||
export interface Response {
|
export interface Response {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
nameOrDid: string;
|
user: string;
|
||||||
type: string;
|
collection: string;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
before?: string;
|
before?: string;
|
||||||
after?: string;
|
after?: string;
|
||||||
|
@ -12,8 +12,10 @@ export interface CallOptions {
|
||||||
}
|
}
|
||||||
export declare type InputSchema = undefined;
|
export declare type InputSchema = undefined;
|
||||||
export interface OutputSchema {
|
export interface OutputSchema {
|
||||||
|
cursor?: string;
|
||||||
records: {
|
records: {
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
value: {};
|
value: {};
|
||||||
}[];
|
}[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
did: string;
|
did: string;
|
||||||
type: string;
|
collection: string;
|
||||||
tid: string;
|
rkey: string;
|
||||||
validate?: boolean;
|
validate?: boolean;
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
@ -14,6 +14,7 @@ export interface InputSchema {
|
||||||
}
|
}
|
||||||
export interface OutputSchema {
|
export interface OutputSchema {
|
||||||
uri: string;
|
uri: string;
|
||||||
|
cid: string;
|
||||||
}
|
}
|
||||||
export interface Response {
|
export interface Response {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers, XRPCError } from '@adxp/xrpc';
|
import { Headers, XRPCError } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
}
|
}
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
name?: string;
|
name?: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
did: string;
|
did: string;
|
||||||
from?: string;
|
from?: string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
did: string;
|
did: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Headers } from '@adxp/xrpc';
|
import { Headers } from '@atproto/xrpc';
|
||||||
export interface QueryParams {
|
export interface QueryParams {
|
||||||
did: string;
|
did: string;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -20,19 +20,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
||||||
// src/index.ts
|
// src/index.ts
|
||||||
var src_exports = {};
|
var src_exports = {};
|
||||||
__export(src_exports, {
|
__export(src_exports, {
|
||||||
ADX_URI_REGEX: () => ADX_URI_REGEX,
|
ATP_URI_REGEX: () => ATP_URI_REGEX,
|
||||||
AdxUri: () => AdxUri
|
AtUri: () => AtUri
|
||||||
});
|
});
|
||||||
module.exports = __toCommonJS(src_exports);
|
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 RELATIVE_REGEX = /^(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;
|
||||||
var AdxUri = class {
|
var AtUri = class {
|
||||||
constructor(uri, base) {
|
constructor(uri, base) {
|
||||||
let parsed;
|
let parsed;
|
||||||
if (base) {
|
if (base) {
|
||||||
parsed = parse(base);
|
parsed = parse(base);
|
||||||
if (!parsed) {
|
if (!parsed) {
|
||||||
throw new Error(`Invalid adx uri: ${base}`);
|
throw new Error(`Invalid at uri: ${base}`);
|
||||||
}
|
}
|
||||||
const relativep = parseRelative(uri);
|
const relativep = parseRelative(uri);
|
||||||
if (!relativep) {
|
if (!relativep) {
|
||||||
|
@ -42,7 +42,7 @@ var AdxUri = class {
|
||||||
} else {
|
} else {
|
||||||
parsed = parse(uri);
|
parsed = parse(uri);
|
||||||
if (!parsed) {
|
if (!parsed) {
|
||||||
throw new Error(`Invalid adx uri: ${uri}`);
|
throw new Error(`Invalid at uri: ${uri}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.hash = parsed.hash;
|
this.hash = parsed.hash;
|
||||||
|
@ -51,10 +51,10 @@ var AdxUri = class {
|
||||||
this.searchParams = parsed.searchParams;
|
this.searchParams = parsed.searchParams;
|
||||||
}
|
}
|
||||||
get protocol() {
|
get protocol() {
|
||||||
return "adx:";
|
return "at:";
|
||||||
}
|
}
|
||||||
get origin() {
|
get origin() {
|
||||||
return `adx://${this.host}`;
|
return `at://${this.host}`;
|
||||||
}
|
}
|
||||||
get hostname() {
|
get hostname() {
|
||||||
return this.host;
|
return this.host;
|
||||||
|
@ -76,10 +76,10 @@ var AdxUri = class {
|
||||||
parts[0] = v;
|
parts[0] = v;
|
||||||
this.pathname = parts.join("/");
|
this.pathname = parts.join("/");
|
||||||
}
|
}
|
||||||
get recordKey() {
|
get rkey() {
|
||||||
return this.pathname.split("/").filter(Boolean)[1] || "";
|
return this.pathname.split("/").filter(Boolean)[1] || "";
|
||||||
}
|
}
|
||||||
set recordKey(v) {
|
set rkey(v) {
|
||||||
const parts = this.pathname.split("/").filter(Boolean);
|
const parts = this.pathname.split("/").filter(Boolean);
|
||||||
if (!parts[0])
|
if (!parts[0])
|
||||||
parts[0] = "undefined";
|
parts[0] = "undefined";
|
||||||
|
@ -102,11 +102,11 @@ var AdxUri = class {
|
||||||
if (hash && !hash.startsWith("#")) {
|
if (hash && !hash.startsWith("#")) {
|
||||||
hash = `#${hash}`;
|
hash = `#${hash}`;
|
||||||
}
|
}
|
||||||
return `adx://${this.host}${path}${qs}${hash}`;
|
return `at://${this.host}${path}${qs}${hash}`;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function parse(str) {
|
function parse(str) {
|
||||||
const match = ADX_URI_REGEX.exec(str);
|
const match = ATP_URI_REGEX.exec(str);
|
||||||
if (match) {
|
if (match) {
|
||||||
return {
|
return {
|
||||||
hash: match[5] || "",
|
hash: match[5] || "",
|
||||||
|
@ -130,7 +130,7 @@ function parseRelative(str) {
|
||||||
}
|
}
|
||||||
// Annotate the CommonJS export names for ESM import in node:
|
// Annotate the CommonJS export names for ESM import in node:
|
||||||
0 && (module.exports = {
|
0 && (module.exports = {
|
||||||
ADX_URI_REGEX,
|
ATP_URI_REGEX,
|
||||||
AdxUri
|
AtUri
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"version": 3,
|
"version": 3,
|
||||||
"sources": ["../src/index.ts"],
|
"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"],
|
"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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",
|
"mappings": "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",
|
||||||
"names": []
|
"names": []
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export declare const ADX_URI_REGEX: RegExp;
|
export declare const ATP_URI_REGEX: RegExp;
|
||||||
export declare class AdxUri {
|
export declare class AtUri {
|
||||||
hash: string;
|
hash: string;
|
||||||
host: string;
|
host: string;
|
||||||
pathname: string;
|
pathname: string;
|
||||||
|
@ -13,8 +13,8 @@ export declare class AdxUri {
|
||||||
set search(v: string);
|
set search(v: string);
|
||||||
get collection(): string;
|
get collection(): string;
|
||||||
set collection(v: string);
|
set collection(v: string);
|
||||||
get recordKey(): string;
|
get rkey(): string;
|
||||||
set recordKey(v: string);
|
set rkey(v: string);
|
||||||
get href(): string;
|
get href(): string;
|
||||||
toString(): string;
|
toString(): string;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,6 +4,7 @@ import {BottomSheetTextInput} from '@gorhom/bottom-sheet'
|
||||||
import LinearGradient from 'react-native-linear-gradient'
|
import LinearGradient from 'react-native-linear-gradient'
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import * as GetUserFollows from '../../../third-party/api/src/types/app/bsky/getUserFollows'
|
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 {Autocomplete} from './composer/Autocomplete'
|
||||||
import Toast from '../util/Toast'
|
import Toast from '../util/Toast'
|
||||||
import ProgressCircle from '../util/ProgressCircle'
|
import ProgressCircle from '../util/ProgressCircle'
|
||||||
|
@ -20,7 +21,7 @@ export function Component({
|
||||||
replyTo,
|
replyTo,
|
||||||
onPost,
|
onPost,
|
||||||
}: {
|
}: {
|
||||||
replyTo?: string
|
replyTo?: Post.PostRef
|
||||||
onPost?: () => void
|
onPost?: () => void
|
||||||
}) {
|
}) {
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React, {useMemo} from 'react'
|
import React, {useMemo} from 'react'
|
||||||
import {observer} from 'mobx-react-lite'
|
import {observer} from 'mobx-react-lite'
|
||||||
import {Image, StyleSheet, Text, View} from 'react-native'
|
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 {FontAwesomeIcon, Props} from '@fortawesome/react-native-fontawesome'
|
||||||
import {NotificationsViewItemModel} from '../../../state/models/notifications-view'
|
import {NotificationsViewItemModel} from '../../../state/models/notifications-view'
|
||||||
import {s, colors} from '../../lib/styles'
|
import {s, colors} from '../../lib/styles'
|
||||||
|
@ -20,13 +20,13 @@ export const FeedItem = observer(function FeedItem({
|
||||||
}) {
|
}) {
|
||||||
const itemHref = useMemo(() => {
|
const itemHref = useMemo(() => {
|
||||||
if (item.isLike || item.isRepost) {
|
if (item.isLike || item.isRepost) {
|
||||||
const urip = new AdxUri(item.subjectUri)
|
const urip = new AtUri(item.subjectUri)
|
||||||
return `/profile/${urip.host}/post/${urip.recordKey}`
|
return `/profile/${urip.host}/post/${urip.rkey}`
|
||||||
} else if (item.isFollow) {
|
} else if (item.isFollow) {
|
||||||
return `/profile/${item.author.name}`
|
return `/profile/${item.author.name}`
|
||||||
} else if (item.isReply) {
|
} else if (item.isReply) {
|
||||||
const urip = new AdxUri(item.uri)
|
const urip = new AtUri(item.uri)
|
||||||
return `/profile/${urip.host}/post/${urip.recordKey}`
|
return `/profile/${urip.host}/post/${urip.rkey}`
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
}, [item])
|
}, [item])
|
||||||
|
|
|
@ -2,7 +2,7 @@ import React, {useMemo} from 'react'
|
||||||
import {observer} from 'mobx-react-lite'
|
import {observer} from 'mobx-react-lite'
|
||||||
import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native'
|
import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native'
|
||||||
import Svg, {Line} from 'react-native-svg'
|
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 * as PostType from '../../../third-party/api/src/types/app/bsky/post'
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import {PostThreadViewPostModel} from '../../../state/models/post-thread-view'
|
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 hasEngagement = item.likeCount || item.repostCount
|
||||||
|
|
||||||
const itemHref = useMemo(() => {
|
const itemHref = useMemo(() => {
|
||||||
const urip = new AdxUri(item.uri)
|
const urip = new AtUri(item.uri)
|
||||||
return `/profile/${item.author.name}/post/${urip.recordKey}`
|
return `/profile/${item.author.name}/post/${urip.rkey}`
|
||||||
}, [item.uri, item.author.name])
|
}, [item.uri, item.author.name])
|
||||||
const itemTitle = `Post by ${item.author.name}`
|
const itemTitle = `Post by ${item.author.name}`
|
||||||
const authorHref = `/profile/${item.author.name}`
|
const authorHref = `/profile/${item.author.name}`
|
||||||
const authorTitle = item.author.name
|
const authorTitle = item.author.name
|
||||||
const likesHref = useMemo(() => {
|
const likesHref = useMemo(() => {
|
||||||
const urip = new AdxUri(item.uri)
|
const urip = new AtUri(item.uri)
|
||||||
return `/profile/${item.author.name}/post/${urip.recordKey}/liked-by`
|
return `/profile/${item.author.name}/post/${urip.rkey}/liked-by`
|
||||||
}, [item.uri, item.author.name])
|
}, [item.uri, item.author.name])
|
||||||
const likesTitle = 'Likes on this post'
|
const likesTitle = 'Likes on this post'
|
||||||
const repostsHref = useMemo(() => {
|
const repostsHref = useMemo(() => {
|
||||||
const urip = new AdxUri(item.uri)
|
const urip = new AtUri(item.uri)
|
||||||
return `/profile/${item.author.name}/post/${urip.recordKey}/reposted-by`
|
return `/profile/${item.author.name}/post/${urip.rkey}/reposted-by`
|
||||||
}, [item.uri, item.author.name])
|
}, [item.uri, item.author.name])
|
||||||
const repostsTitle = 'Reposts of this post'
|
const repostsTitle = 'Reposts of this post'
|
||||||
|
|
||||||
const onPressReply = () => {
|
const onPressReply = () => {
|
||||||
store.shell.openModal(
|
store.shell.openModal(
|
||||||
new ComposePostModel({replyTo: item.uri, onPost: onPostReply}),
|
new ComposePostModel({
|
||||||
|
replyTo: {uri: item.uri, cid: item.cid},
|
||||||
|
onPost: onPostReply,
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
const onPressToggleRepost = () => {
|
const onPressToggleRepost = () => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React, {useState, useEffect, useMemo} from 'react'
|
import React, {useState, useEffect, useMemo} from 'react'
|
||||||
import {observer} from 'mobx-react-lite'
|
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 * as PostType from '../../../third-party/api/src/types/app/bsky/post'
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
|
@ -59,20 +59,22 @@ export const Post = observer(function Post({uri}: {uri: string}) {
|
||||||
const item = view.thread
|
const item = view.thread
|
||||||
const record = view.thread?.record as unknown as PostType.Record
|
const record = view.thread?.record as unknown as PostType.Record
|
||||||
|
|
||||||
const itemUrip = new AdxUri(item.uri)
|
const itemUrip = new AtUri(item.uri)
|
||||||
const itemHref = `/profile/${item.author.name}/post/${itemUrip.recordKey}`
|
const itemHref = `/profile/${item.author.name}/post/${itemUrip.rkey}`
|
||||||
const itemTitle = `Post by ${item.author.name}`
|
const itemTitle = `Post by ${item.author.name}`
|
||||||
const authorHref = `/profile/${item.author.name}`
|
const authorHref = `/profile/${item.author.name}`
|
||||||
const authorTitle = item.author.name
|
const authorTitle = item.author.name
|
||||||
let replyAuthorDid = ''
|
let replyAuthorDid = ''
|
||||||
let replyHref = ''
|
let replyHref = ''
|
||||||
if (record.reply) {
|
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
|
replyAuthorDid = urip.hostname
|
||||||
replyHref = `/profile/${urip.hostname}/post/${urip.recordKey}`
|
replyHref = `/profile/${urip.hostname}/post/${urip.rkey}`
|
||||||
}
|
}
|
||||||
const onPressReply = () => {
|
const onPressReply = () => {
|
||||||
store.shell.openModal(new ComposePostModel({replyTo: item.uri}))
|
store.shell.openModal(
|
||||||
|
new ComposePostModel({replyTo: {uri: item.uri, cid: item.cid}}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
const onPressToggleRepost = () => {
|
const onPressToggleRepost = () => {
|
||||||
item
|
item
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React, {useMemo} from 'react'
|
import React, {useMemo} from 'react'
|
||||||
import {observer} from 'mobx-react-lite'
|
import {observer} from 'mobx-react-lite'
|
||||||
import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native'
|
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 * as PostType from '../../../third-party/api/src/types/app/bsky/post'
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import {FeedViewItemModel} from '../../../state/models/feed-view'
|
import {FeedViewItemModel} from '../../../state/models/feed-view'
|
||||||
|
@ -23,24 +23,26 @@ export const FeedItem = observer(function FeedItem({
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
const record = item.record as unknown as PostType.Record
|
const record = item.record as unknown as PostType.Record
|
||||||
const itemHref = useMemo(() => {
|
const itemHref = useMemo(() => {
|
||||||
const urip = new AdxUri(item.uri)
|
const urip = new AtUri(item.uri)
|
||||||
return `/profile/${item.author.name}/post/${urip.recordKey}`
|
return `/profile/${item.author.name}/post/${urip.rkey}`
|
||||||
}, [item.uri, item.author.name])
|
}, [item.uri, item.author.name])
|
||||||
const itemTitle = `Post by ${item.author.name}`
|
const itemTitle = `Post by ${item.author.name}`
|
||||||
const authorHref = `/profile/${item.author.name}`
|
const authorHref = `/profile/${item.author.name}`
|
||||||
const replyAuthorDid = useMemo(() => {
|
const replyAuthorDid = useMemo(() => {
|
||||||
if (!record.reply) return ''
|
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
|
return urip.hostname
|
||||||
}, [record.reply])
|
}, [record.reply])
|
||||||
const replyHref = useMemo(() => {
|
const replyHref = useMemo(() => {
|
||||||
if (!record.reply) return ''
|
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 `/profile/${urip.hostname}/post/${urip.recordKey}`
|
return `/profile/${urip.hostname}/post/${urip.rkey}`
|
||||||
}, [record.reply])
|
}, [record.reply])
|
||||||
|
|
||||||
const onPressReply = () => {
|
const onPressReply = () => {
|
||||||
store.shell.openModal(new ComposePostModel({replyTo: item.uri}))
|
store.shell.openModal(
|
||||||
|
new ComposePostModel({replyTo: {uri: item.uri, cid: item.cid}}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
const onPressToggleRepost = () => {
|
const onPressToggleRepost = () => {
|
||||||
item
|
item
|
||||||
|
|
|
@ -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'
|
import {Entity as Entities} from '../../third-party/api/src/types/app/bsky/post'
|
||||||
|
|
||||||
type Entity = Entities[0]
|
type Entity = Entities[0]
|
||||||
|
@ -16,12 +16,12 @@ export function pluralize(n: number, base: string, plural?: string): string {
|
||||||
export function makeRecordUri(
|
export function makeRecordUri(
|
||||||
didOrName: string,
|
didOrName: string,
|
||||||
collection: string,
|
collection: string,
|
||||||
recordKey: string,
|
rkey: string,
|
||||||
) {
|
) {
|
||||||
const urip = new AdxUri(`adx://host/`)
|
const urip = new AtUri(`at://host/`)
|
||||||
urip.host = didOrName
|
urip.host = didOrName
|
||||||
urip.collection = collection
|
urip.collection = collection
|
||||||
urip.recordKey = recordKey
|
urip.rkey = rkey
|
||||||
return urip.toString()
|
return urip.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,17 +39,17 @@ export const routes: Route[] = [
|
||||||
[
|
[
|
||||||
PostThread,
|
PostThread,
|
||||||
['far', 'message'],
|
['far', 'message'],
|
||||||
r('/profile/(?<name>[^/]+)/post/(?<recordKey>[^/]+)'),
|
r('/profile/(?<name>[^/]+)/post/(?<rkey>[^/]+)'),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
PostLikedBy,
|
PostLikedBy,
|
||||||
'heart',
|
'heart',
|
||||||
r('/profile/(?<name>[^/]+)/post/(?<recordKey>[^/]+)/liked-by'),
|
r('/profile/(?<name>[^/]+)/post/(?<rkey>[^/]+)/liked-by'),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
PostRepostedBy,
|
PostRepostedBy,
|
||||||
'retweet',
|
'retweet',
|
||||||
r('/profile/(?<name>[^/]+)/post/(?<recordKey>[^/]+)/reposted-by'),
|
r('/profile/(?<name>[^/]+)/post/(?<rkey>[^/]+)/reposted-by'),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ import {useStores} from '../../state'
|
||||||
|
|
||||||
export const PostLikedBy = ({visible, params}: ScreenParams) => {
|
export const PostLikedBy = ({visible, params}: ScreenParams) => {
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
const {name, recordKey} = params
|
const {name, rkey} = params
|
||||||
const uri = makeRecordUri(name, 'app.bsky.post', recordKey)
|
const uri = makeRecordUri(name, 'app.bsky.post', rkey)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
|
|
@ -6,8 +6,8 @@ import {useStores} from '../../state'
|
||||||
|
|
||||||
export const PostRepostedBy = ({visible, params}: ScreenParams) => {
|
export const PostRepostedBy = ({visible, params}: ScreenParams) => {
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
const {name, recordKey} = params
|
const {name, rkey} = params
|
||||||
const uri = makeRecordUri(name, 'app.bsky.post', recordKey)
|
const uri = makeRecordUri(name, 'app.bsky.post', rkey)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
|
|
@ -6,8 +6,8 @@ import {useStores} from '../../state'
|
||||||
|
|
||||||
export const PostThread = ({visible, params}: ScreenParams) => {
|
export const PostThread = ({visible, params}: ScreenParams) => {
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
const {name, recordKey} = params
|
const {name, rkey} = params
|
||||||
const uri = makeRecordUri(name, 'app.bsky.post', recordKey)
|
const uri = makeRecordUri(name, 'app.bsky.post', rkey)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
|
Loading…
Reference in New Issue