Skip to content

Commit

Permalink
fix lex codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Nov 30, 2023
1 parent 4433420 commit 884772a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/bsky/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1597,11 +1597,13 @@ type RouteRateLimitOpts<T> = {
calcKey?: (ctx: T) => string
calcPoints?: (ctx: T) => number
}
type HandlerOpts = { blobLimit?: number }
type HandlerRateLimitOpts<T> = SharedRateLimitOpts<T> | RouteRateLimitOpts<T>
type ConfigOf<Auth, Handler, ReqCtx> =
| Handler
| {
auth?: Auth
opts?: HandlerOpts
rateLimit?: HandlerRateLimitOpts<ReqCtx> | HandlerRateLimitOpts<ReqCtx>[]
handler: Handler
}
Expand Down
6 changes: 6 additions & 0 deletions packages/lex-cli/src/codegen/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ const indexTs = (
}`,
})

file.addTypeAlias({
name: 'HandlerOpts',
type: `{ blobLimit?: number }`,
})

file.addTypeAlias({
name: 'HandlerRateLimitOpts',
typeParameters: [{ name: 'T' }],
Expand All @@ -220,6 +225,7 @@ const indexTs = (
| Handler
| {
auth?: Auth
opts?: HandlerOpts
rateLimit?: HandlerRateLimitOpts<ReqCtx> | HandlerRateLimitOpts<ReqCtx>[]
handler: Handler
}`,
Expand Down
2 changes: 2 additions & 0 deletions packages/pds/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1597,11 +1597,13 @@ type RouteRateLimitOpts<T> = {
calcKey?: (ctx: T) => string
calcPoints?: (ctx: T) => number
}
type HandlerOpts = { blobLimit?: number }
type HandlerRateLimitOpts<T> = SharedRateLimitOpts<T> | RouteRateLimitOpts<T>
type ConfigOf<Auth, Handler, ReqCtx> =
| Handler
| {
auth?: Auth
opts?: HandlerOpts
rateLimit?: HandlerRateLimitOpts<ReqCtx> | HandlerRateLimitOpts<ReqCtx>[]
handler: Handler
}
Expand Down

0 comments on commit 884772a

Please sign in to comment.