[READ ONLY MIRROR] Spark Social AppView Server
github.com/sprksocial/server
atproto
deno
hono
lexicon
1import { IdResolver } from "@atp/identity";
2import { Database } from "./db/index.ts";
3import { getLogger, Logger } from "@logtape/logtape";
4import { Blocks } from "./routes/blocks.ts";
5import { Feeds } from "./routes/feeds.ts";
6import { Follows } from "./routes/follows.ts";
7import { Likes } from "./routes/likes.ts";
8import { Moderation } from "./routes/moderation.ts";
9import { Actors } from "./routes/actors.ts";
10import { Identity } from "./routes/identity.ts";
11import { Records } from "./routes/records.ts";
12import { Relationships } from "./routes/relationships.ts";
13import { Interactions } from "./routes/interactions.ts";
14import { Reposts } from "./routes/reposts.ts";
15import { Stories } from "./routes/stories.ts";
16import { Sync } from "./routes/sync.ts";
17import { Threads } from "./routes/threads.ts";
18import { Preferences } from "./routes/preferences.ts";
19import { Search } from "./routes/search.ts";
20
21export { RepoSubscription } from "./subscription.ts";
22
23export type ServerContext = {
24 db: Database;
25 idResolver?: IdResolver;
26};
27
28export class DataPlane {
29 private db: Database;
30 public logger: Logger;
31 private idResolver?: IdResolver;
32
33 // Route handlers as root-level properties
34 public blocks: Blocks;
35 public feeds: Feeds;
36 public follows: Follows;
37 public likes: Likes;
38 public moderation: Moderation;
39 public actors: Actors;
40 public identity: Identity;
41 public records: Records;
42 public relationships: Relationships;
43 public interactions: Interactions;
44 public reposts: Reposts;
45 public stories: Stories;
46 public sync: Sync;
47 public threads: Threads;
48 public preferences: Preferences;
49 public search: Search;
50
51 constructor(
52 db: Database,
53 idResolver?: IdResolver,
54 ) {
55 this.db = db;
56 this.idResolver = idResolver;
57 this.logger = getLogger(["appview", "data-plane"]);
58
59 // Initialize all route handlers
60 this.blocks = new Blocks(db);
61 this.feeds = new Feeds(db);
62 this.follows = new Follows(db);
63 this.likes = new Likes(db);
64 this.moderation = new Moderation(db);
65 this.actors = new Actors(db);
66 this.identity = new Identity(idResolver);
67 this.records = new Records(db);
68 this.relationships = new Relationships(db);
69 this.interactions = new Interactions(db);
70 this.reposts = new Reposts(db);
71 this.stories = new Stories(db);
72 this.sync = new Sync(db);
73 this.threads = new Threads(db);
74 this.preferences = new Preferences(db);
75 this.search = new Search(db);
76 }
77}