import type { Schema } from "@/schema/common.js"; import type { ApiContext } from "@/types/api.js"; import type { Env, Context as HonoContext, Input } from "hono"; export type Context< schema extends Schema = Schema, path extends string = string, input extends Input = {}, > = ApiContext & { /** * Hono request object. * * @see https://hono.dev/docs/api/context#req */ req: HonoContext["req"]; /** * Hono response object. * * @see https://hono.dev/docs/api/context#res */ res: HonoContext["req"]; /** * Return the HTTP response. * * @see https://hono.dev/docs/api/context#body */ body: HonoContext["body"]; /** * Render text as `Content-Type:text/plain`. * * @see https://hono.dev/docs/api/context#text */ text: HonoContext["text"]; /** * Render JSON as `Content-Type:application/json`. * * @see https://hono.dev/docs/api/context#json */ json: HonoContext["json"]; /** * Hono redirect. * * @see https://hono.dev/docs/api/context#redirect */ redirect: HonoContext["redirect"]; }; export type MiddlewareContext< schema extends Schema = Schema, path extends string = string, input extends Input = {}, > = ApiContext & HonoContext;