Skip to content

Commit 0f6f1b3

Browse files
committed
initial commit
1 parent 61882cd commit 0f6f1b3

20 files changed

Lines changed: 8441 additions & 6 deletions

common.d.ts

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {Pattern, Methods} from 'trouter'
2+
import {Logger} from 'pino'
23

34
export interface IRouterConfig {
45
defaultRoute?: RequestHandler
@@ -8,10 +9,44 @@ export interface IRouterConfig {
89

910
export type StepFunction = (error?: unknown) => Response | Promise<Response>
1011

11-
type ZeroRequest = Request & {
12+
export interface ParsedFile {
13+
name: string
14+
size: number
15+
type: string
16+
data: File
17+
}
18+
19+
export type ZeroRequest = Request & {
1220
params: Record<string, string>
1321
query: Record<string, string>
14-
ctx?: Record<string, any>
22+
// Legacy compatibility properties (mirrored from ctx)
23+
user?: any
24+
jwt?: {
25+
payload: any
26+
header: any
27+
token: string
28+
}
29+
apiKey?: string
30+
// Context object for middleware data
31+
ctx?: {
32+
log?: Logger
33+
user?: any
34+
jwt?: {
35+
payload: any
36+
header: any
37+
token: string
38+
}
39+
apiKey?: string
40+
rateLimit?: {
41+
limit: number
42+
used: number
43+
remaining: number
44+
resetTime: Date
45+
}
46+
body?: any
47+
files?: Record<string, ParsedFile | ParsedFile[]>
48+
[key: string]: any
49+
}
1550
}
1651

1752
export type RequestHandler = (

0 commit comments

Comments
 (0)