Skip to content

Commit

Permalink
feat: add path to fingerprint function
Browse files Browse the repository at this point in the history
  • Loading branch information
413n committed Apr 30, 2024
1 parent 2dfaa3a commit 33a84b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export const defineTRPCLimiter = <
) => {
const options = parseOptions(opts as any, getDefaultOptions)
const store = adapter.store(options as any)
const middleware: MwFn<TRoot> = async ({ ctx, next, input }) => {
const fp = await options.fingerprint(ctx, input)
const middleware: MwFn<TRoot> = async ({ ctx, next, input, path }) => {
const fp = await options.fingerprint(ctx, input, path)
if (!fp) {
throw new TRPCError({
code: 'INTERNAL_SERVER_ERROR',
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export type BaseOpts<TRoot extends AnyRootConfig, Res> = {
**/
fingerprint: (
ctx: TRoot['_config']['$types']['ctx'],
input: any
input: any,
path: string
) => string | Promise<string>
}

Expand Down

0 comments on commit 33a84b6

Please sign in to comment.