This repository has no description
1/**
2 * GENERATED CODE - DO NOT MODIFY
3 */
4import {
5 createServer as createXrpcServer,
6 Server as XrpcServer,
7 type Options as XrpcOptions,
8 type AuthVerifier,
9 type StreamAuthVerifier,
10} from '@atproto/xrpc-server';
11import { schemas } from './lexicons.js';
12
13export function createServer(options?: XrpcOptions): Server {
14 return new Server(options);
15}
16
17export class Server {
18 xrpc: XrpcServer;
19 network: NetworkNS;
20 com: ComNS;
21
22 constructor(options?: XrpcOptions) {
23 this.xrpc = createXrpcServer(schemas, options);
24 this.network = new NetworkNS(this);
25 this.com = new ComNS(this);
26 }
27}
28
29export class NetworkNS {
30 _server: Server;
31 cosmik: NetworkCosmikNS;
32
33 constructor(server: Server) {
34 this._server = server;
35 this.cosmik = new NetworkCosmikNS(server);
36 }
37}
38
39export class NetworkCosmikNS {
40 _server: Server;
41
42 constructor(server: Server) {
43 this._server = server;
44 }
45}
46
47export class ComNS {
48 _server: Server;
49 atproto: ComAtprotoNS;
50
51 constructor(server: Server) {
52 this._server = server;
53 this.atproto = new ComAtprotoNS(server);
54 }
55}
56
57export class ComAtprotoNS {
58 _server: Server;
59 repo: ComAtprotoRepoNS;
60
61 constructor(server: Server) {
62 this._server = server;
63 this.repo = new ComAtprotoRepoNS(server);
64 }
65}
66
67export class ComAtprotoRepoNS {
68 _server: Server;
69
70 constructor(server: Server) {
71 this._server = server;
72 }
73}
74
75type SharedRateLimitOpts<T> = {
76 name: string;
77 calcKey?: (ctx: T) => string | null;
78 calcPoints?: (ctx: T) => number;
79};
80type RouteRateLimitOpts<T> = {
81 durationMs: number;
82 points: number;
83 calcKey?: (ctx: T) => string | null;
84 calcPoints?: (ctx: T) => number;
85};
86type HandlerOpts = { blobLimit?: number };
87type HandlerRateLimitOpts<T> = SharedRateLimitOpts<T> | RouteRateLimitOpts<T>;
88type ConfigOf<Auth, Handler, ReqCtx> =
89 | Handler
90 | {
91 auth?: Auth;
92 opts?: HandlerOpts;
93 rateLimit?: HandlerRateLimitOpts<ReqCtx> | HandlerRateLimitOpts<ReqCtx>[];
94 handler: Handler;
95 };
96type ExtractAuth<AV extends AuthVerifier | StreamAuthVerifier> = Extract<
97 Awaited<ReturnType<AV>>,
98 { credentials: unknown }
99>;