import { HonoBase } from "hono/hono-base";
import { Hono } from "hono";
import { ClientResponse, InferRequestType, hc } from "hono/client";
import { ExtractSchema, Schema as Schema$1 } from "hono/types";
//#region src/types/openapi.d.ts
type ConvertPath
= P extends `${infer A}{${infer Param}}${infer B}` ? `${A}:${Param}${ConvertPath}` : P;
type HttpMethod = "get" | "query" | "put" | "post" | "delete" | "options" | "head" | "patch" | "trace";
declare const optionalResponseStatuses: unique symbol;
type WithOptionalResponseStatuses = Paths & {
readonly [optionalResponseStatuses]?: Status;
};
type ExtractOptionalResponseStatuses = Paths extends {
readonly [optionalResponseStatuses]?: infer Status;
} ? Extract : never;
type NormalizeBasePathInner = BasePath extends `${infer Prefix}/` ? NormalizeBasePathInner : BasePath;
type NormalizeBasePath = BasePath extends "" | "/" ? "" : NormalizeBasePathInner;
type StripBasePath = NormalizeBasePath extends (infer NormalizedBasePath extends string) ? NormalizedBasePath extends "" ? Path : Path extends NormalizedBasePath ? "/" : Path extends `${NormalizedBasePath}/${infer Rest}` ? `/${Rest}` : never : never;
type ParameterLocation = "path" | "query" | "header" | "cookie";
type ExtractParameterRecord = Source extends {
parameters: infer Parameters extends object;
} ? Location extends keyof Parameters ? NonNullable extends object ? NonNullable : never : never : never;
type ExtractMergedParameterRecord = [ExtractParameterRecord] extends [never] ? ExtractParameterRecord : ExtractParameterRecord;
type ExtractRequestBodyContent = Op extends {
requestBody: {
content: infer Content extends object;
};
} ? ContentType extends keyof Content ? Content[ContentType] : never : never;
type ExtractParam = ExtractMergedParameterRecord;
type ExtractQuery = ExtractMergedParameterRecord;
type ExtractHeader = ExtractMergedParameterRecord;
type ExtractCookie = ExtractMergedParameterRecord;
type ExtractJsonBody = ExtractRequestBodyContent;
type ExtractFormBody = ExtractRequestBodyContent | ExtractRequestBodyContent;
type HttpStatusFromKey = Key extends number ? Key : Key extends `${infer Status extends number}` ? Status : never;
type ExtractResponseContent = Response extends {
content: infer Content;
} ? NonNullable extends object ? NonNullable : never : Response extends {
content?: infer Content;
} ? NonNullable extends object ? NonNullable : never : never;
type OutputFormatForContentType = ContentType extends "application/json" | `${string}+json` ? "json" : ContentType extends "text/plain" ? "text" : "body";
type IntoHonoInput = ([ExtractParam] extends [never] ? object : {
param: ExtractParam;
}) & ([ExtractQuery] extends [never] ? object : {
query: ExtractQuery;
}) & ([ExtractHeader] extends [never] ? object : {
header: ExtractHeader;
}) & ([ExtractCookie] extends [never] ? object : {
cookie: ExtractCookie;
}) & ([ExtractJsonBody] extends [never] ? object : {
json: ExtractJsonBody;
}) & ([ExtractFormBody] extends [never] ? object : {
form: ExtractFormBody;
});
type IntoHonoResponseWithContent = { [ContentType in keyof Content & string]: {
input: IntoHonoInput;
output: Content[ContentType];
outputFormat: OutputFormatForContentType;
status: Status;
responseLabel: `${Status} ${ContentType}`;
}; }[keyof Content & string];
type IntoHonoEmptyResponse = {
input: IntoHonoInput;
output: null;
outputFormat: "body";
status: Status;
responseLabel: `${Status} no content`;
};
type IntoHonoResponse = HttpStatusFromKey extends (infer Status) ? [Status] extends [never] ? never : Status extends number ? [ExtractResponseContent] extends [never] ? IntoHonoEmptyResponse : ExtractResponseContent extends (infer Content extends object) ? IntoHonoResponseWithContent : never : never : never;
type IntoHonoMethod = Op extends {
responses: infer Responses extends object;
} ? { [ResponseKey in keyof Responses]: IntoHonoResponse; }[keyof Responses] : {
input: IntoHonoInput;
};
type IntoHonoMethodOrInputOnly = [IntoHonoMethod] extends [never] ? {
input: IntoHonoInput;
} : IntoHonoMethod;
type IntoHonoEndpoint = IntoHonoMethodOrInputOnly;
type IntoSchemaMethod = IntoHonoEndpoint;
type IntoSchema = { [P in keyof Paths as [StripBasePath