Skip to content

Commit

Permalink
Nullable ratelimit calcKey (#3274)
Browse files Browse the repository at this point in the history
* fix codegen

* re-codegen

* changeset
  • Loading branch information
dholms authored Dec 19, 2024
1 parent 85a4378 commit 672243a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/wet-bottles-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/lex-cli": patch
---

Allow ratelimit calcKey to return null
4 changes: 2 additions & 2 deletions packages/bsky/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2177,13 +2177,13 @@ export class ChatBskyModerationNS {

type SharedRateLimitOpts<T> = {
name: string
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type RouteRateLimitOpts<T> = {
durationMs: number
points: number
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type HandlerOpts = { blobLimit?: number }
Expand Down
4 changes: 2 additions & 2 deletions packages/lex-cli/src/codegen/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const indexTs = (
typeParameters: [{ name: 'T' }],
type: `{
name: string
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}`,
})
Expand All @@ -191,7 +191,7 @@ const indexTs = (
type: `{
durationMs: number
points: number
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}`,
})
Expand Down
4 changes: 2 additions & 2 deletions packages/ozone/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2638,13 +2638,13 @@ export class ToolsOzoneTeamNS {

type SharedRateLimitOpts<T> = {
name: string
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type RouteRateLimitOpts<T> = {
durationMs: number
points: number
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type HandlerOpts = { blobLimit?: number }
Expand Down
4 changes: 2 additions & 2 deletions packages/pds/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2638,13 +2638,13 @@ export class ToolsOzoneTeamNS {

type SharedRateLimitOpts<T> = {
name: string
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type RouteRateLimitOpts<T> = {
durationMs: number
points: number
calcKey?: (ctx: T) => string
calcKey?: (ctx: T) => string | null
calcPoints?: (ctx: T) => number
}
type HandlerOpts = { blobLimit?: number }
Expand Down

0 comments on commit 672243a

Please sign in to comment.