UNPKG

rajt

Version:

A serverless bundler layer, fully typed for AWS Lambda (Node.js and LLRT) and Cloudflare Workers.

51 lines (42 loc) 1.24 kB
import { Handler } from 'hono' import { ResponseHeader } from 'hono/utils/headers' import { StatusCode } from 'hono/utils/http-status' import { BaseMime } from 'hono/utils/mime' import Action from './action' export type Route = { method: string, path: string, name: string, file: string, middlewares: Function[], handle: Handlers, } export type Handlers = (Function | Handler | (new () => Action))[] export type Routes = Route[] export type LambdaResponse = { statusCode: StatusCode, body: string, } export type Errors = Record<string, string | string[]> export type ErrorResponse = { m?: string, // message e?: Errors, // error bag } export type ResponseHeadersInit = [ string, string ][] | Record<"Content-Type", BaseMime> | Record<ResponseHeader, string> | Record<string, string> | Headers export type ResponseInit<T extends StatusCode = StatusCode> = { headers?: ResponseHeadersInit, status?: T, statusText?: string, } export type ResponseOrInit<T extends StatusCode = StatusCode> = ResponseInit<T> | Response // export type JSONValue = // | string // | number // | boolean // | null // | { [key: string]: JSONValue } // | JSONValue[] export type { Context, Next } from 'hono'