Skip to content

Workery / types

Module: types

Table of contents

Interfaces

Type Aliases

Type Aliases

HTTPMethod

Ƭ HTTPMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "TRACE"

Defined in

src/types.ts:6


HTTPMethodLower

Ƭ HTTPMethodLower: "get" | "post" | "put" | "patch" | "delete" | "head" | "options" | "trace"

Defined in

src/types.ts:7


ResponseClass

Ƭ ResponseClass: (body: any, init?: ResponseInit) => Response

Type declaration

• (body, init?): Response

Parameters
NameType
bodyany
init?ResponseInit
Returns

Response

Defined in

src/types.ts:17


Next

Ƭ Next: () => Promise<Response>

Type declaration

▸ (): Promise<Response>

Returns

Promise<Response>

Defined in

src/types.ts:19


Later

Ƭ Later: (fn: (res: Response) => void) => void

Type declaration

▸ (fn): void

Parameters
NameType
fn(res: Response) => void
Returns

void

Defined in

src/types.ts:21


Preprocessor

Ƭ Preprocessor: <Out, In>(value: In) => Out | In

Type declaration

▸ <Out, In>(value): Out | In

Type parameters
NameType
Outany
Inany
Parameters
NameType
valueIn
Returns

Out | In

Defined in

src/types.ts:23


ZodBodyable

Ƭ ZodBodyable: z.ZodType | typeof String | typeof Blob | typeof ReadableStream

Defined in

src/types.ts:40


RouteParameterLocation

Ƭ RouteParameterLocation: "path" | "query" | "header" | "cookie" | "body" | "$depends"

Defined in

src/types.ts:42


PathParameter

Ƭ PathParameter<S>: RouteParameter<S> & { location: "path" ; schema: S }

Type parameters

NameType
Sextends z.ZodType

Defined in

src/types.ts:52


QueryParameter

Ƭ QueryParameter<S>: RouteParameter<S> & { location: "query" ; schema: S }

Type parameters

NameType
Sextends z.ZodType

Defined in

src/types.ts:56


HeaderParameter

Ƭ HeaderParameter<S>: RouteParameter<S> & { location: "header" ; schema: S }

Type parameters

NameType
Sextends z.ZodType

Defined in

src/types.ts:60


CookieParameter

Ƭ CookieParameter<S>: RouteParameter<S> & { location: "cookie" ; schema: S }

Type parameters

NameType
Sextends z.ZodType

Defined in

src/types.ts:64


BodyParameter

Ƭ BodyParameter<S>: RouteParameter<S> & { location: "body" ; schema: S ; options: { mediaType: string } }

Type parameters

NameType
Sextends z.ZodType

Defined in

src/types.ts:68


DependsParameter

Ƭ DependsParameter<S>: RouteParameter<S> & { location: "$depends" ; dependency: Dependency<any, RouteParameters, any> }

Type parameters

NameType
Sextends z.ZodType

Defined in

src/types.ts:73


RouteParameters

Ƭ RouteParameters: { [k: string]: RouteParameter<z.ZodType>; } & { req?: never }

Defined in

src/types.ts:78


TypeOf

Ƭ TypeOf<T>: T extends RouteParameter<infer S> ? z.TypeOf<S> : T extends z.ZodType ? z.TypeOf<T> : T extends Dependency<infer R, any, any> ? R : unknown

Type parameters

Name
T

Defined in

src/types.ts:82


ArgsOf

Ƭ ArgsOf<Ps, E>: { req: Request ; env: E ; ctx: ExecutionContext } & { [K in keyof Ps]: TypeOf<Ps[K]> }

Type parameters

NameType
Psextends RouteParameters
Eunknown

Defined in

src/types.ts:91


InitOf

Ƭ InitOf<C>: C extends (init: infer I) => InstanceType<C> ? I : never

Type parameters

NameType
Cextends (...args: any) => any

Defined in

src/types.ts:99


ExceptionHandler

Ƭ ExceptionHandler<E>: (args: ArgsOf<{}, E>, e: any) => Promise<Response> | (args: ArgsOf<{}, E>, e: any) => Response

Type parameters

NameType
Eunknown

Defined in

src/types.ts:105


RouteHandler

Ƭ RouteHandler<R, Ps, E>: (args: ArgsOf<Ps, E>) => Promise<R> | (args: ArgsOf<Ps, E>) => R

Type parameters

NameType
RR
Psextends RouteParameters
Eunknown

Defined in

src/types.ts:109


DependencyHandler

Ƭ DependencyHandler<R, Ps, E>: (args: ArgsOf<Ps, E>, later: Later) => Promise<R> | (args: ArgsOf<Ps, E>, later: Later) => R

Type parameters

NameType
RR
Psextends RouteParameters
Eunknown

Defined in

src/types.ts:113


MiddlewareHandler

Ƭ MiddlewareHandler<E>: (args: ArgsOf<{}, E>, next: Next) => Promise<Response> | (args: ArgsOf<{}, E>, next: Next) => Response

Type parameters

NameType
Eunknown

Defined in

src/types.ts:117


UnboundRoute

Ƭ UnboundRoute<R, Ps, E>: Omit<InitOf<typeof Route>, "method" | "path">

Type parameters

NameType
RR
Psextends RouteParameters
EE

Defined in

src/types.ts:121