Skip to content

Commit

Permalink
Refactor PDS appview routes (bluesky-social#1673)
Browse files Browse the repository at this point in the history
move routes around
  • Loading branch information
dholms authored Sep 26, 2023
1 parent d34354d commit 64288a0
Show file tree
Hide file tree
Showing 50 changed files with 243 additions and 253 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { authPassthru } from '../../../../../api/com/atproto/admin/util'
import { OutputSchema } from '../../../../../lexicon/types/app/bsky/actor/getProfile'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import { authPassthru } from '../../../../api/com/atproto/admin/util'
import { OutputSchema } from '../../../../lexicon/types/app/bsky/actor/getProfile'
import { handleReadAfterWrite } from '../util/read-after-write'
import { LocalRecords } from '../../../../../services/local'
import { LocalRecords } from '../../../../services/local'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.actor.getProfile({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import AppContext from '../../../../../context'
import { Server } from '../../../../../lexicon'
import { OutputSchema } from '../../../../../lexicon/types/app/bsky/actor/getProfiles'
import { LocalRecords } from '../../../../../services/local'
import AppContext from '../../../../context'
import { Server } from '../../../../lexicon'
import { OutputSchema } from '../../../../lexicon/types/app/bsky/actor/getProfiles'
import { LocalRecords } from '../../../../services/local'
import { handleReadAfterWrite } from '../util/read-after-write'

export default function (server: Server, ctx: AppContext) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import AppContext from '../../../../../context'
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../context'
import { Server } from '../../../../lexicon'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.actor.getSuggestions({
Expand Down
10 changes: 10 additions & 0 deletions packages/pds/src/api/app/bsky/actor/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import getPreferences from './getPreferences'
import getProfile from './getProfile'
import getProfiles from './getProfiles'
import getSuggestions from './getSuggestions'
import putPreferences from './putPreferences'
import searchActors from './searchActors'
import searchActorsTypeahead from './searchActorsTypeahead'

export default function (server: Server, ctx: AppContext) {
getPreferences(server, ctx)
getProfile(server, ctx)
getProfiles(server, ctx)
getSuggestions(server, ctx)
putPreferences(server, ctx)
searchActors(server, ctx)
searchActorsTypeahead(server, ctx)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import AppContext from '../../../../../context'
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../context'
import { Server } from '../../../../lexicon'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.actor.searchActors({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import AppContext from '../../../../../context'
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../context'
import { Server } from '../../../../lexicon'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.actor.searchActorsTypeahead({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.feed.getActorFeeds({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { OutputSchema } from '../../../../../lexicon/types/app/bsky/feed/getAuthorFeed'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import { OutputSchema } from '../../../../lexicon/types/app/bsky/feed/getAuthorFeed'
import { handleReadAfterWrite } from '../util/read-after-write'
import { authPassthru } from '../../../../../api/com/atproto/admin/util'
import { LocalRecords } from '../../../../../services/local'
import { authPassthru } from '../../../../api/com/atproto/admin/util'
import { LocalRecords } from '../../../../services/local'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.feed.getActorLikes({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { OutputSchema } from '../../../../../lexicon/types/app/bsky/feed/getAuthorFeed'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import { OutputSchema } from '../../../../lexicon/types/app/bsky/feed/getAuthorFeed'
import { handleReadAfterWrite } from '../util/read-after-write'
import { authPassthru } from '../../../../../api/com/atproto/admin/util'
import { LocalRecords } from '../../../../../services/local'
import { isReasonRepost } from '../../../../../lexicon/types/app/bsky/feed/defs'
import { authPassthru } from '../../../../api/com/atproto/admin/util'
import { LocalRecords } from '../../../../services/local'
import { isReasonRepost } from '../../../../lexicon/types/app/bsky/feed/defs'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.feed.getAuthorFeed({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.feed.getFeed({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.feed.getFeedGenerator({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.feed.getFeedGenerators({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.feed.getLikes({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.feed.getListFeed({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { AtUri } from '@atproto/syntax'
import { AppBskyFeedGetPostThread } from '@atproto/api'
import { Headers } from '@atproto/xrpc'
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import {
ThreadViewPost,
isThreadViewPost,
} from '../../../../../lexicon/types/app/bsky/feed/defs'
import { Record as PostRecord } from '../../../../../lexicon/types/app/bsky/feed/post'
} from '../../../../lexicon/types/app/bsky/feed/defs'
import { Record as PostRecord } from '../../../../lexicon/types/app/bsky/feed/post'
import {
OutputSchema,
QueryParams,
} from '../../../../../lexicon/types/app/bsky/feed/getPostThread'
} from '../../../../lexicon/types/app/bsky/feed/getPostThread'
import {
LocalRecords,
LocalService,
RecordDescript,
} from '../../../../../services/local'
} from '../../../../services/local'
import {
getLocalLag,
getRepoRev,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.feed.getPosts({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.feed.getRepostedBy({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.feed.getSuggestedFeeds({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { OutputSchema } from '../../../../../lexicon/types/app/bsky/feed/getTimeline'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import { OutputSchema } from '../../../../lexicon/types/app/bsky/feed/getTimeline'
import { handleReadAfterWrite } from '../util/read-after-write'
import { LocalRecords } from '../../../../../services/local'
import { LocalRecords } from '../../../../services/local'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.feed.getTimeline({
Expand Down
31 changes: 31 additions & 0 deletions packages/pds/src/api/app/bsky/feed/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import getActorFeeds from './getActorFeeds'
import getActorLikes from './getActorLikes'
import getAuthorFeed from './getAuthorFeed'
import getFeed from './getFeed'
import getFeedGenerator from './getFeedGenerator'
import getFeedGenerators from './getFeedGenerators'
import getLikes from './getLikes'
import getListFeed from './getListFeed'
import getPosts from './getPosts'
import getPostThread from './getPostThread'
import getRepostedBy from './getRepostedBy'
import getSuggestedFeeds from './getSuggestedFeeds'
import getTimeline from './getTimeline'

export default function (server: Server, ctx: AppContext) {
getActorFeeds(server, ctx)
getActorLikes(server, ctx)
getAuthorFeed(server, ctx)
getFeed(server, ctx)
getFeedGenerator(server, ctx)
getFeedGenerators(server, ctx)
getLikes(server, ctx)
getListFeed(server, ctx)
getPosts(server, ctx)
getPostThread(server, ctx)
getRepostedBy(server, ctx)
getSuggestedFeeds(server, ctx)
getTimeline(server, ctx)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.graph.getBlocks({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { authPassthru } from '../../../../../api/com/atproto/admin/util'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import { authPassthru } from '../../../../api/com/atproto/admin/util'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.graph.getFollowers({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { authPassthru } from '../../../../../api/com/atproto/admin/util'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import { authPassthru } from '../../../../api/com/atproto/admin/util'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.graph.getFollows({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.graph.getList({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.graph.getListBlocks({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.graph.getListMutes({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.graph.getLists({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.graph.getMutes({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.graph.getSuggestedFollowsByActor({
Expand Down
31 changes: 31 additions & 0 deletions packages/pds/src/api/app/bsky/graph/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import getBlocks from './getBlocks'
import getFollowers from './getFollowers'
import getFollows from './getFollows'
import getList from './getList'
import getListBlocks from './getListBlocks'
import getListMutes from './getListMutes'
import getLists from './getLists'
import getMutes from './getMutes'
import getSuggestedFollowsByActor from './getSuggestedFollowsByActor'
import muteActor from './muteActor'
import muteActorList from './muteActorList'
import unmuteActor from './unmuteActor'
import unmuteActorList from './unmuteActorList'

export default function (server: Server, ctx: AppContext) {
getBlocks(server, ctx)
getFollowers(server, ctx)
getFollows(server, ctx)
getList(server, ctx)
getListBlocks(server, ctx)
getListMutes(server, ctx)
getLists(server, ctx)
getMutes(server, ctx)
getSuggestedFollowsByActor(server, ctx)
muteActor(server, ctx)
muteActorList(server, ctx)
unmuteActor(server, ctx)
unmuteActorList(server, ctx)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { InvalidRequestError } from '@atproto/xrpc-server'
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.graph.muteActor({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Server } from '../../../../../lexicon'
import * as lex from '../../../../../lexicon/lexicons'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import * as lex from '../../../../lexicon/lexicons'
import AppContext from '../../../../context'
import { AtUri } from '@atproto/syntax'
import { InvalidRequestError } from '@atproto/xrpc-server'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Server } from '../../../../../lexicon'
import { Server } from '../../../../lexicon'
import { InvalidRequestError } from '@atproto/xrpc-server'
import AppContext from '../../../../../context'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.graph.unmuteActor({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Server } from '../../../../../lexicon'
import AppContext from '../../../../../context'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'

export default function (server: Server, ctx: AppContext) {
server.app.bsky.graph.unmuteActorList({
Expand Down
Loading

0 comments on commit 64288a0

Please sign in to comment.