hono-takibi 0.9.99995 → 0.9.99997

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,7 +30,7 @@ npx hono-takibi path/to/input.{yaml,json,tsp} -o path/to/output.ts
30
30
  Create `hono-takibi.config.ts`:
31
31
 
32
32
  ```ts
33
- import { defineConfig } from 'hono-takibi/config'
33
+ import { defineConfig } from 'hono-takibi'
34
34
 
35
35
  export default defineConfig({
36
36
  input: 'openapi.yaml',
@@ -307,7 +307,7 @@ export default defineConfig({
307
307
  Some options are mutually exclusive: `output` ↔ `routes`, `template.define` ↔ `routes`, `components.output` ↔ per-type components, `template.define` ↔ `routeHandler`.
308
308
 
309
309
  ```ts
310
- import { defineConfig } from 'hono-takibi/config'
310
+ import { defineConfig } from 'hono-takibi'
311
311
 
312
312
  export default defineConfig({
313
313
  input: 'openapi.yaml',
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/dist/cli.js ADDED
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env node
2
+ import { readConfig } from "./index.js";
3
+ import { r as setFormatOptions } from "./emit-CFR63U4L.js";
4
+ import { n as parseOpenAPI, r as takibi, t as makeJob } from "./shared-66qmwvRi.js";
5
+ import { existsSync } from "node:fs";
6
+ import { resolve } from "node:path";
7
+ //#region src/cli/index.ts
8
+ const HELP_TEXT = `Usage: hono-takibi <input.{yaml,json,tsp}> -o <output.ts>
9
+
10
+ Options:
11
+ -h, --help display help for command`;
12
+ function parseCli(args) {
13
+ const input = args[0];
14
+ const oIdx = args.indexOf("-o");
15
+ const output = oIdx !== -1 ? args[oIdx + 1] : void 0;
16
+ const isYamlOrJsonOrTsp = (i) => i.endsWith(".yaml") || i.endsWith(".json") || i.endsWith(".tsp");
17
+ const isTs = (o) => o.endsWith(".ts");
18
+ if (!(input && output && isYamlOrJsonOrTsp(input) && isTs(output))) return {
19
+ ok: false,
20
+ error: HELP_TEXT
21
+ };
22
+ return {
23
+ ok: true,
24
+ value: {
25
+ input,
26
+ output
27
+ }
28
+ };
29
+ }
30
+ async function honoTakibi() {
31
+ const args = process.argv.slice(2);
32
+ if (args.length === 1 && (args[0] === "--help" || args[0] === "-h")) return {
33
+ ok: true,
34
+ value: HELP_TEXT
35
+ };
36
+ const abs = resolve(process.cwd(), "hono-takibi.config.ts");
37
+ if (!existsSync(abs)) {
38
+ const cliResult = parseCli(args);
39
+ if (!cliResult.ok) return {
40
+ ok: false,
41
+ error: cliResult.error
42
+ };
43
+ const { input, output } = cliResult.value;
44
+ const openAPIResult = await parseOpenAPI(input);
45
+ if (!openAPIResult.ok) return {
46
+ ok: false,
47
+ error: openAPIResult.error
48
+ };
49
+ const openAPI = openAPIResult.value;
50
+ const takibiResult = await takibi(openAPI, output, {
51
+ readonly: false,
52
+ exportSchemas: false,
53
+ exportSchemasTypes: false,
54
+ exportResponses: false,
55
+ exportParameters: false,
56
+ exportParametersTypes: false,
57
+ exportExamples: false,
58
+ exportRequestBodies: false,
59
+ exportHeaders: false,
60
+ exportHeadersTypes: false,
61
+ exportSecuritySchemes: false,
62
+ exportLinks: false,
63
+ exportCallbacks: false,
64
+ exportPathItems: false,
65
+ exportMediaTypes: false,
66
+ exportMediaTypesTypes: false
67
+ });
68
+ if (!takibiResult.ok) return {
69
+ ok: false,
70
+ error: takibiResult.error
71
+ };
72
+ return {
73
+ ok: true,
74
+ value: takibiResult.value
75
+ };
76
+ }
77
+ const readConfigResult = await readConfig();
78
+ if (!readConfigResult.ok) return {
79
+ ok: false,
80
+ error: readConfigResult.error
81
+ };
82
+ const config = readConfigResult.value;
83
+ if (config.format) setFormatOptions(config.format);
84
+ const openAPIResult = await parseOpenAPI(config.input);
85
+ if (!openAPIResult.ok) return {
86
+ ok: false,
87
+ error: openAPIResult.error
88
+ };
89
+ const openAPI = openAPIResult.value;
90
+ const jobs = makeJob(openAPI, config);
91
+ const results = await Promise.all(jobs.map((job) => job.run(job.output)));
92
+ const e = results.find((result) => !result.ok);
93
+ if (e) return e;
94
+ return {
95
+ ok: true,
96
+ value: results.map((result) => result.ok ? result.value : "").filter((v) => v !== "").join("\n")
97
+ };
98
+ }
99
+ //#endregion
100
+ //#region src/index.ts
101
+ honoTakibi().then((result) => {
102
+ if (result.ok) {
103
+ console.log(result.value);
104
+ process.exit(0);
105
+ } else {
106
+ console.error(result.error);
107
+ process.exit(1);
108
+ }
109
+ });
110
+ //#endregion
111
+ export {};
@@ -1,14 +1,13 @@
1
- import { t as OpenAPI } from "../../index-BFnCNZSw.js";
2
-
1
+ import { t as OpenAPI } from "../../index-CQcc43cH.js";
3
2
  //#region src/core/docs/index.d.ts
4
3
  declare function docs(openAPI: OpenAPI, output: string, entry?: string, basePath?: string, curl?: boolean, baseUrl?: string): Promise<{
4
+ readonly value?: never;
5
5
  readonly ok: false;
6
6
  readonly error: string;
7
- readonly value?: never;
8
7
  } | {
8
+ readonly error?: never;
9
9
  readonly ok: true;
10
10
  readonly value: `Generated docs written to ${string}`;
11
- readonly error?: never;
12
11
  }>;
13
12
  //#endregion
14
13
  export { docs };
@@ -1,2 +1,2 @@
1
- import { t as docs } from "../../docs-DbknIWmx.js";
1
+ import { t as docs } from "../../docs-D6-_1ql4.js";
2
2
  export { docs };
@@ -1,109 +1,108 @@
1
- import { t as OpenAPI } from "../../index-BFnCNZSw.js";
2
-
1
+ import { t as OpenAPI } from "../../index-CQcc43cH.js";
3
2
  //#region src/core/hooks/index.d.ts
4
3
  declare const HOOK_CONFIGS: {
5
4
  readonly swr: {
6
- readonly packageName: "swr";
7
- readonly frameworkName: "SWR";
8
- readonly hookPrefix: "use";
9
- readonly queryFn: "useSWR";
10
- readonly mutationFn: "useSWRMutation";
11
- readonly useQueryOptionsType: "SWRConfiguration";
12
- readonly useMutationOptionsType: "SWRMutationConfiguration";
5
+ readonly packageName: 'swr';
6
+ readonly frameworkName: 'SWR';
7
+ readonly hookPrefix: 'use';
8
+ readonly queryFn: 'useSWR';
9
+ readonly mutationFn: 'useSWRMutation';
10
+ readonly useQueryOptionsType: 'SWRConfiguration';
11
+ readonly useMutationOptionsType: 'SWRMutationConfiguration';
13
12
  readonly isSWR: true;
14
- readonly immutableQueryFn: "useSWRImmutable";
15
- readonly infiniteQueryFn: "useSWRInfinite";
16
- readonly useInfiniteQueryOptionsType: "SWRInfiniteConfiguration";
13
+ readonly immutableQueryFn: 'useSWRImmutable';
14
+ readonly infiniteQueryFn: 'useSWRInfinite';
15
+ readonly useInfiniteQueryOptionsType: 'SWRInfiniteConfiguration';
17
16
  };
18
17
  readonly 'tanstack-query': {
19
- readonly packageName: "@tanstack/react-query";
20
- readonly frameworkName: "TanStack Query";
21
- readonly hookPrefix: "use";
22
- readonly queryFn: "useQuery";
23
- readonly mutationFn: "useMutation";
24
- readonly useQueryOptionsType: "UseQueryOptions";
25
- readonly useMutationOptionsType: "UseMutationOptions";
18
+ readonly packageName: '@tanstack/react-query';
19
+ readonly frameworkName: 'TanStack Query';
20
+ readonly hookPrefix: 'use';
21
+ readonly queryFn: 'useQuery';
22
+ readonly mutationFn: 'useMutation';
23
+ readonly useQueryOptionsType: 'UseQueryOptions';
24
+ readonly useMutationOptionsType: 'UseMutationOptions';
26
25
  readonly hasQueryOptionsHelper: true;
27
26
  readonly hasMutationOptionsHelper: true;
28
- readonly suspenseQueryFn: "useSuspenseQuery";
29
- readonly infiniteQueryFn: "useInfiniteQuery";
30
- readonly suspenseInfiniteQueryFn: "useSuspenseInfiniteQuery";
31
- readonly useInfiniteQueryOptionsType: "UseInfiniteQueryOptions";
32
- readonly useSuspenseInfiniteQueryOptionsType: "UseSuspenseInfiniteQueryOptions";
27
+ readonly suspenseQueryFn: 'useSuspenseQuery';
28
+ readonly infiniteQueryFn: 'useInfiniteQuery';
29
+ readonly suspenseInfiniteQueryFn: 'useSuspenseInfiniteQuery';
30
+ readonly useInfiniteQueryOptionsType: 'UseInfiniteQueryOptions';
31
+ readonly useSuspenseInfiniteQueryOptionsType: 'UseSuspenseInfiniteQueryOptions';
33
32
  readonly hasInfiniteQueryOptionsHelper: true;
34
- readonly useSuspenseQueryOptionsType: "UseSuspenseQueryOptions";
33
+ readonly useSuspenseQueryOptionsType: 'UseSuspenseQueryOptions';
35
34
  };
36
35
  readonly 'preact-query': {
37
- readonly packageName: "@tanstack/preact-query";
38
- readonly frameworkName: "Preact Query";
39
- readonly hookPrefix: "use";
40
- readonly queryFn: "useQuery";
41
- readonly mutationFn: "useMutation";
42
- readonly useQueryOptionsType: "UseQueryOptions";
43
- readonly useMutationOptionsType: "UseMutationOptions";
36
+ readonly packageName: '@tanstack/preact-query';
37
+ readonly frameworkName: 'Preact Query';
38
+ readonly hookPrefix: 'use';
39
+ readonly queryFn: 'useQuery';
40
+ readonly mutationFn: 'useMutation';
41
+ readonly useQueryOptionsType: 'UseQueryOptions';
42
+ readonly useMutationOptionsType: 'UseMutationOptions';
44
43
  readonly hasQueryOptionsHelper: true;
45
44
  readonly hasMutationOptionsHelper: true;
46
- readonly suspenseQueryFn: "useSuspenseQuery";
47
- readonly infiniteQueryFn: "useInfiniteQuery";
48
- readonly suspenseInfiniteQueryFn: "useSuspenseInfiniteQuery";
49
- readonly useInfiniteQueryOptionsType: "UseInfiniteQueryOptions";
50
- readonly useSuspenseInfiniteQueryOptionsType: "UseSuspenseInfiniteQueryOptions";
45
+ readonly suspenseQueryFn: 'useSuspenseQuery';
46
+ readonly infiniteQueryFn: 'useInfiniteQuery';
47
+ readonly suspenseInfiniteQueryFn: 'useSuspenseInfiniteQuery';
48
+ readonly useInfiniteQueryOptionsType: 'UseInfiniteQueryOptions';
49
+ readonly useSuspenseInfiniteQueryOptionsType: 'UseSuspenseInfiniteQueryOptions';
51
50
  readonly hasInfiniteQueryOptionsHelper: true;
52
- readonly useSuspenseQueryOptionsType: "UseSuspenseQueryOptions";
51
+ readonly useSuspenseQueryOptionsType: 'UseSuspenseQueryOptions';
53
52
  };
54
53
  readonly 'solid-query': {
55
- readonly packageName: "@tanstack/solid-query";
56
- readonly frameworkName: "Solid Query";
57
- readonly hookPrefix: "create";
58
- readonly queryFn: "createQuery";
59
- readonly mutationFn: "createMutation";
54
+ readonly packageName: '@tanstack/solid-query';
55
+ readonly frameworkName: 'Solid Query';
56
+ readonly hookPrefix: 'create';
57
+ readonly queryFn: 'createQuery';
58
+ readonly mutationFn: 'createMutation';
60
59
  readonly useThunk: true;
61
- readonly useQueryOptionsType: "CreateQueryOptions";
62
- readonly useMutationOptionsType: "CreateMutationOptions";
60
+ readonly useQueryOptionsType: 'CreateQueryOptions';
61
+ readonly useMutationOptionsType: 'CreateMutationOptions';
63
62
  readonly hasQueryOptionsHelper: true;
64
- readonly infiniteQueryFn: "createInfiniteQuery";
65
- readonly useInfiniteQueryOptionsType: "CreateInfiniteQueryOptions";
63
+ readonly infiniteQueryFn: 'createInfiniteQuery';
64
+ readonly useInfiniteQueryOptionsType: 'CreateInfiniteQueryOptions';
66
65
  readonly hasInfiniteQueryOptionsHelper: true;
67
66
  };
68
67
  readonly 'vue-query': {
69
- readonly packageName: "@tanstack/vue-query";
70
- readonly frameworkName: "Vue Query";
71
- readonly hookPrefix: "use";
72
- readonly queryFn: "useQuery";
73
- readonly mutationFn: "useMutation";
74
- readonly useQueryOptionsType: "UseQueryOptions";
75
- readonly useMutationOptionsType: "UseMutationOptions";
68
+ readonly packageName: '@tanstack/vue-query';
69
+ readonly frameworkName: 'Vue Query';
70
+ readonly hookPrefix: 'use';
71
+ readonly queryFn: 'useQuery';
72
+ readonly mutationFn: 'useMutation';
73
+ readonly useQueryOptionsType: 'UseQueryOptions';
74
+ readonly useMutationOptionsType: 'UseMutationOptions';
76
75
  readonly isVueQuery: true;
77
- readonly infiniteQueryFn: "useInfiniteQuery";
78
- readonly useInfiniteQueryOptionsType: "UseInfiniteQueryOptions";
76
+ readonly infiniteQueryFn: 'useInfiniteQuery';
77
+ readonly useInfiniteQueryOptionsType: 'UseInfiniteQueryOptions';
79
78
  };
80
79
  readonly 'svelte-query': {
81
- readonly packageName: "@tanstack/svelte-query";
82
- readonly frameworkName: "Svelte Query";
83
- readonly hookPrefix: "create";
84
- readonly queryFn: "createQuery";
85
- readonly mutationFn: "createMutation";
80
+ readonly packageName: '@tanstack/svelte-query';
81
+ readonly frameworkName: 'Svelte Query';
82
+ readonly hookPrefix: 'create';
83
+ readonly queryFn: 'createQuery';
84
+ readonly mutationFn: 'createMutation';
86
85
  readonly useThunk: true;
87
- readonly useQueryOptionsType: "CreateQueryOptions";
88
- readonly useMutationOptionsType: "CreateMutationOptions";
86
+ readonly useQueryOptionsType: 'CreateQueryOptions';
87
+ readonly useMutationOptionsType: 'CreateMutationOptions';
89
88
  readonly hasQueryOptionsHelper: true;
90
- readonly infiniteQueryFn: "createInfiniteQuery";
91
- readonly useInfiniteQueryOptionsType: "CreateInfiniteQueryOptions";
89
+ readonly infiniteQueryFn: 'createInfiniteQuery';
90
+ readonly useInfiniteQueryOptionsType: 'CreateInfiniteQueryOptions';
92
91
  readonly hasInfiniteQueryOptionsHelper: true;
93
92
  };
94
93
  readonly 'angular-query': {
95
- readonly packageName: "@tanstack/angular-query-experimental";
96
- readonly frameworkName: "Angular Query";
97
- readonly hookPrefix: "inject";
98
- readonly queryFn: "injectQuery";
99
- readonly mutationFn: "injectMutation";
100
- readonly useQueryOptionsType: "CreateQueryOptions";
101
- readonly useMutationOptionsType: "CreateMutationOptions";
94
+ readonly packageName: '@tanstack/angular-query-experimental';
95
+ readonly frameworkName: 'Angular Query';
96
+ readonly hookPrefix: 'inject';
97
+ readonly queryFn: 'injectQuery';
98
+ readonly mutationFn: 'injectMutation';
99
+ readonly useQueryOptionsType: 'CreateQueryOptions';
100
+ readonly useMutationOptionsType: 'CreateMutationOptions';
102
101
  readonly hasQueryOptionsHelper: true;
103
102
  readonly hasMutationOptionsHelper: false;
104
103
  readonly hasInfiniteQueryOptionsHelper: true;
105
- readonly infiniteQueryFn: "injectInfiniteQuery";
106
- readonly useInfiniteQueryOptionsType: "CreateInfiniteQueryOptions";
104
+ readonly infiniteQueryFn: 'injectInfiniteQuery';
105
+ readonly useInfiniteQueryOptionsType: 'CreateInfiniteQueryOptions';
107
106
  readonly useThunk: true;
108
107
  };
109
108
  };
@@ -111,9 +110,9 @@ declare function hooks(openAPI: OpenAPI, output: string, importPath: string, lib
111
110
  readonly split?: boolean;
112
111
  readonly clientName?: string;
113
112
  }): Promise<{
113
+ readonly value?: never;
114
114
  readonly ok: false;
115
115
  readonly error: string;
116
- readonly value?: never;
117
116
  } | {
118
117
  readonly ok: true;
119
118
  readonly value: `Generated ${string} hooks written to ${string}`;
@@ -1,2 +1,2 @@
1
- import { t as hooks } from "../../hooks-CCw7jm8g.js";
1
+ import { t as hooks } from "../../hooks-qJjGH61L.js";
2
2
  export { hooks };
@@ -1,5 +1,4 @@
1
- import { t as OpenAPI } from "../../index-BFnCNZSw.js";
2
-
1
+ import { t as OpenAPI } from "../../index-CQcc43cH.js";
3
2
  //#region src/core/rpc/index.d.ts
4
3
  /**
5
4
  * Generates RPC client wrapper functions from OpenAPI specification.
@@ -15,9 +14,9 @@ import { t as OpenAPI } from "../../index-BFnCNZSw.js";
15
14
  * @returns Promise resolving to success message or error
16
15
  */
17
16
  declare function rpc(openAPI: OpenAPI, output: string, importPath: string, split?: boolean, clientName?: string, useParseResponse?: boolean, basePath?: string, docs?: boolean): Promise<{
17
+ readonly value?: never;
18
18
  readonly ok: false;
19
19
  readonly error: string;
20
- readonly value?: never;
21
20
  } | {
22
21
  readonly ok: true;
23
22
  readonly value: `Generated rpc code written to ${string}`;
@@ -1,7 +1,6 @@
1
- import { f as methodPath, u as makeInferRequestType } from "../../utils-B5PbMfWs.js";
2
1
  import { t as emit } from "../../emit-CFR63U4L.js";
3
- import { c as isOperationLike, f as isRecord, o as isOpenAPIPaths } from "../../guard-BSZ8ezEv.js";
4
- import { a as parsePathItem, i as operationHasArgs, o as resolveSplitOutDir, r as makeOperationDeps, t as formatPath } from "../../rpc-BzPo2tZf.js";
2
+ import { N as methodPath, c as isOperationLike, f as isRecord, j as makeInferRequestType, o as isOpenAPIPaths } from "../../guard-C_eRJ0au.js";
3
+ import { a as parsePathItem, i as operationHasArgs, o as resolveSplitOutDir, r as makeOperationDeps, t as formatPath } from "../../rpc-BDZmSva1.js";
5
4
  import path from "node:path";
6
5
  //#region src/core/rpc/index.ts
7
6
  /**
@@ -79,10 +78,13 @@ async function rpc(openAPI, output, importPath, split, clientName = "client", us
79
78
  error: "Invalid OpenAPI paths"
80
79
  };
81
80
  const hasBasePath = basePath !== void 0 && basePath !== "/";
82
- const operationCodes = makeOperationCodes(paths, makeOperationDeps(clientName, openAPI.components?.parameters ?? {}, openAPI.components?.requestBodies ?? {}), useParseResponse, hasBasePath, docs);
81
+ const componentsParameters = openAPI.components?.parameters ?? {};
82
+ const componentsRequestBodies = openAPI.components?.requestBodies ?? {};
83
+ const operationCodes = makeOperationCodes(paths, makeOperationDeps(clientName, componentsParameters, componentsRequestBodies), useParseResponse, hasBasePath, docs);
83
84
  if (!split) {
84
85
  const body = operationCodes.map(({ code }) => code).join("\n\n");
85
- const emitResult = await emit(`${makeHeader(importPath, operationCodes.some(({ hasArgs }) => hasArgs), clientName, useParseResponse)}${body}${operationCodes.length ? "\n" : ""}`, path.dirname(output), output);
86
+ const code = `${makeHeader(importPath, operationCodes.some(({ hasArgs }) => hasArgs), clientName, useParseResponse)}${body}${operationCodes.length ? "\n" : ""}`;
87
+ const emitResult = await emit(code, path.dirname(output), output);
86
88
  if (!emitResult.ok) return {
87
89
  ok: false,
88
90
  error: emitResult.error
@@ -1,5 +1,4 @@
1
- import { t as OpenAPI } from "../../index-BFnCNZSw.js";
2
-
1
+ import { t as OpenAPI } from "../../index-CQcc43cH.js";
3
2
  //#region src/core/type/index.d.ts
4
3
  /**
5
4
  * Generates TypeScript type declarations from OpenAPI specification.
@@ -10,13 +9,13 @@ import { t as OpenAPI } from "../../index-BFnCNZSw.js";
10
9
  * @returns Result with success message or error
11
10
  */
12
11
  declare function type(openAPI: OpenAPI, output: `${string}.ts`, readonly?: boolean): Promise<{
12
+ readonly error?: never;
13
13
  readonly ok: true;
14
14
  readonly value: `Generated type code written to ${string}.ts`;
15
- readonly error?: never;
16
15
  } | {
16
+ readonly value?: never;
17
17
  readonly ok: false;
18
18
  readonly error: string;
19
- readonly value?: never;
20
19
  }>;
21
20
  //#endregion
22
21
  export { type };
@@ -1,6 +1,5 @@
1
- import { d as makeSafeKey, g as statusCodeToNumber } from "../../utils-B5PbMfWs.js";
2
1
  import { t as emit } from "../../emit-CFR63U4L.js";
3
- import { g as isSchemaArray, i as isMediaWithSchema, l as isParameter, m as isRequestBody, n as isHttpMethod, s as isOperation, u as isParameterArray, x as isStringRef } from "../../guard-BSZ8ezEv.js";
2
+ import { L as statusCodeToNumber, M as makeSafeKey, g as isSchemaArray, i as isMediaWithSchema, l as isParameter, m as isRequestBody, n as isHttpMethod, s as isOperation, u as isParameterArray, x as isStringRef } from "../../guard-C_eRJ0au.js";
4
3
  import path from "node:path";
5
4
  //#region src/core/type/index.ts
6
5
  /**
@@ -18,7 +17,8 @@ const DEEP_READONLY_TYPE = "type DeepReadonly<T>=T extends(infer R)[]?readonly D
18
17
  async function type(openAPI, output, readonly) {
19
18
  const schemaType = makeHonoSchemaType(openAPI);
20
19
  const wrappedType = readonly ? `DeepReadonly<${schemaType}>` : schemaType;
21
- const emitResult = await emit(`${readonly ? DEEP_READONLY_TYPE : ""}declare const routes:import('@hono/zod-openapi').OpenAPIHono<import('hono/types').Env,${wrappedType},'/'>\nexport default routes\n`, path.dirname(output), output);
20
+ const dts = `${readonly ? DEEP_READONLY_TYPE : ""}declare const routes:import('@hono/zod-openapi').OpenAPIHono<import('hono/types').Env,${wrappedType},'/'>\nexport default routes\n`;
21
+ const emitResult = await emit(dts, path.dirname(output), output);
22
22
  return emitResult.ok ? {
23
23
  ok: true,
24
24
  value: `Generated type code written to ${output}`
@@ -1,6 +1,5 @@
1
- import { s as escapeHtml } from "./utils-B5PbMfWs.js";
2
1
  import { a as writeFile, t as mkdir } from "./fsp-BXry-Hx5.js";
3
- import { a as isOAuthFlowValue, b as isSecurityScheme, f as isRecord, h as isResponses, m as isRequestBody, p as isRefObject, r as isMedia, y as isSecurityArray } from "./guard-BSZ8ezEv.js";
2
+ import { O as escapeHtml, a as isOAuthFlowValue, b as isSecurityScheme, f as isRecord, h as isResponses, m as isRequestBody, p as isRefObject, r as isMedia, y as isSecurityArray } from "./guard-C_eRJ0au.js";
4
3
  import path from "node:path";
5
4
  import { STATUS_CODES } from "node:http";
6
5
  //#region src/generator/docs/index.ts
@@ -497,18 +496,18 @@ function flattenResponseSchemaFields(schema, components, prefix, visited = /* @_
497
496
  description: propSchema.description ?? "none"
498
497
  };
499
498
  const nestedPrefix = (prefix ? `${prefix}»` : "»").replace(/»/g, "» ").trimEnd();
500
- if (propSchema.type === "object" && propSchema.properties) return [row, ...flattenResponseSchemaFields(propSchema, components, `${nestedPrefix}`, visited, depth + 1)];
499
+ if (propSchema.type === "object" && propSchema.properties) return [row, ...flattenResponseSchemaFields(propSchema, components, nestedPrefix, visited, depth + 1)];
501
500
  if (propSchema.$ref) {
502
501
  if (visited.has(propSchema.$ref)) return [row];
503
502
  visited.add(propSchema.$ref);
504
503
  const innerResolved = resolveRef(propSchema.$ref, components);
505
- if (isSchemaLike(innerResolved) && innerResolved.type === "object") return [row, ...flattenResponseSchemaFields(innerResolved, components, `${nestedPrefix}`, visited, depth + 1)];
504
+ if (isSchemaLike(innerResolved) && innerResolved.type === "object") return [row, ...flattenResponseSchemaFields(innerResolved, components, nestedPrefix, visited, depth + 1)];
506
505
  }
507
506
  if (propSchema.type === "array" && propSchema.items) {
508
507
  const itemSchema = Array.isArray(propSchema.items) ? propSchema.items[0] : propSchema.items;
509
508
  if (itemSchema) {
510
509
  const resolvedItem = resolveArrayItem(itemSchema, components, visited);
511
- if (resolvedItem.type === "object" && resolvedItem.properties) return [row, ...flattenResponseSchemaFields(resolvedItem, components, `${nestedPrefix}`, visited, depth + 1)];
510
+ if (resolvedItem.type === "object" && resolvedItem.properties) return [row, ...flattenResponseSchemaFields(resolvedItem, components, nestedPrefix, visited, depth + 1)];
512
511
  }
513
512
  }
514
513
  return [row];
@@ -1,5 +1,4 @@
1
- import { t as OpenAPI } from "../../../index-BFnCNZSw.js";
2
-
1
+ import { t as OpenAPI } from "../../../index-CQcc43cH.js";
3
2
  //#region src/generator/zod-openapi-hono/openapi/index.d.ts
4
3
  declare function zodOpenAPIHono(openapi: OpenAPI, options: {
5
4
  readonly readonly?: boolean;
@@ -1,2 +1,2 @@
1
- import { t as zodOpenAPIHono } from "../../../openapi-BlTDQFFF.js";
1
+ import { t as zodOpenAPIHono } from "../../../openapi-QvfGV6Gp.js";
2
2
  export { zodOpenAPIHono };
@@ -21,7 +21,7 @@ function normalizeTypes(t) {
21
21
  function methodPath(method, path) {
22
22
  const hasTrailingSlash = path !== "/" && path.endsWith("/");
23
23
  const apiPath = path.replace(/[^A-Za-z0-9]/g, " ").trim().split(/\s+/).map((str) => `${str.charAt(0).toUpperCase()}${str.slice(1)}`).join("");
24
- return apiPath ? `${method}${apiPath}${hasTrailingSlash ? "Index" : ""}` : `${method}`;
24
+ return apiPath ? `${method}${apiPath}${hasTrailingSlash ? "Index" : ""}` : method;
25
25
  }
26
26
  /**
27
27
  * Generates an array of Zod validator strings from OpenAPI parameter objects.
@@ -231,28 +231,7 @@ function zodToOpenAPISchema(schemaName, zodSchema, exportSchema, exportType, not
231
231
  * ```
232
232
  */
233
233
  function makeBarrel(value) {
234
- return `${Object.keys(value).sort().map((k) => `export * from './${k.charAt(0).toLowerCase() + k.slice(1)}'`).join("\n")}\n`;
235
- }
236
- /**
237
- * Derives the define-mode app entry from a components output path.
238
- *
239
- * The path is read as `<anchor>/<module>` where module is either a flat
240
- * `.ts` file or a `<dir>/index.ts` pair; the app entry is `<anchor>/index.ts`.
241
- *
242
- * @param componentsOutput - The components output path (a `.ts` file).
243
- * @returns The derived app entry path.
244
- *
245
- * @example
246
- * ```ts
247
- * deriveAppEntry('./server/components/index.ts') // → './server/index.ts'
248
- * deriveAppEntry('server/components.ts') // → 'server/index.ts'
249
- * deriveAppEntry('components/index.ts') // → 'index.ts'
250
- * ```
251
- */
252
- function deriveAppEntry(componentsOutput) {
253
- const container = componentsOutput.endsWith("/index.ts") ? componentsOutput.slice(0, -9) : componentsOutput;
254
- const anchor = container.includes("/") ? container.slice(0, container.lastIndexOf("/")) : "";
255
- return anchor === "" || anchor === "." ? "index.ts" : `${anchor}/index.ts`;
234
+ return `${Object.keys(value).toSorted().map((k) => `export * from './${k.charAt(0).toLowerCase() + k.slice(1)}'`).join("\n")}\n`;
256
235
  }
257
236
  /**
258
237
  * Formats an error message argument using the Zod v4 unified `error` parameter.
@@ -345,4 +324,86 @@ function cyclicNodes(deps) {
345
324
  return result;
346
325
  }
347
326
  //#endregion
348
- export { toIdentifierPascalCase as _, ensureSuffix as a, escapeRegexLiteral as c, makeSafeKey as d, methodPath as f, statusCodeToNumber as g, requestParamsArray as h, deriveAppEntry as i, makeBarrel as l, renderNamedImport as m, capitalize as n, error as o, normalizeTypes as p, cyclicNodes as r, escapeHtml as s, baseError as t, makeInferRequestType as u, uncapitalize as v, zodToOpenAPISchema as y };
327
+ //#region src/guard/index.ts
328
+ function isRecord(v) {
329
+ return typeof v === "object" && v !== null && !Array.isArray(v);
330
+ }
331
+ function isHttpMethod(method) {
332
+ return method === "get" || method === "put" || method === "post" || method === "delete" || method === "patch" || method === "options" || method === "head" || method === "trace";
333
+ }
334
+ function isValidIdent(str) {
335
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(str);
336
+ }
337
+ function isOpenAPIPaths(v) {
338
+ if (typeof v !== "object" || v === null || Array.isArray(v)) return false;
339
+ return Object.values(v).every((entry) => typeof entry === "object" && entry !== null && !Array.isArray(entry));
340
+ }
341
+ function isRefObject(v) {
342
+ return typeof v === "object" && v !== null && !Array.isArray(v) && "$ref" in v && typeof v.$ref === "string";
343
+ }
344
+ function isStringRef(v) {
345
+ return "$ref" in v && typeof v.$ref === "string";
346
+ }
347
+ function isParameterObject(v) {
348
+ if (typeof v !== "object" || v === null || Array.isArray(v)) return false;
349
+ if (!("name" in v) || typeof v.name !== "string") return false;
350
+ if (!("in" in v)) return false;
351
+ const pos = v.in;
352
+ return pos === "path" || pos === "query" || pos === "header" || pos === "cookie";
353
+ }
354
+ function isParameter(v) {
355
+ return typeof v === "object" && v !== null && "name" in v && "in" in v && ("schema" in v || "content" in v);
356
+ }
357
+ function isParameterArray(v) {
358
+ return Array.isArray(v);
359
+ }
360
+ function isOperationLike(v) {
361
+ return typeof v === "object" && v !== null && !Array.isArray(v) && "responses" in v;
362
+ }
363
+ function isOperation(v) {
364
+ return typeof v === "object" && v !== null && "responses" in v;
365
+ }
366
+ function isSchemaProperty(v) {
367
+ return typeof v === "object" && v !== null && !Array.isArray(v) && "schema" in v;
368
+ }
369
+ function isSchemaArray(v) {
370
+ return Array.isArray(v);
371
+ }
372
+ /**
373
+ * JSON Schema 2020-12 §4.3.2 / §10.3.1.2 type guard for schema-vs-boolean
374
+ * discrimination. `items`, `additionalProperties`, `unevaluatedItems`, and
375
+ * `unevaluatedProperties` may be either an object schema or a boolean schema
376
+ * (`true` = pass-through, `false` = reject). This narrows the union to the
377
+ * object form so callers can recurse without `as` casts.
378
+ */
379
+ function isSchemaObject(v) {
380
+ return typeof v === "object" && v !== null && !Array.isArray(v);
381
+ }
382
+ function isMediaWithSchema(v) {
383
+ return typeof v === "object" && v !== null && "schema" in v;
384
+ }
385
+ function isMedia(v) {
386
+ return typeof v === "object" && v !== null && "schema" in v;
387
+ }
388
+ function isRequestBody(v) {
389
+ return typeof v === "object" && v !== null && ("content" in v || "required" in v || "description" in v);
390
+ }
391
+ function isContentBody(v) {
392
+ return typeof v === "object" && v !== null && !("$ref" in v);
393
+ }
394
+ function isSecurityScheme(v) {
395
+ return typeof v === "object" && v !== null && !("$ref" in v);
396
+ }
397
+ function isSecurityArray(v) {
398
+ return Array.isArray(v);
399
+ }
400
+ function isResponses(v) {
401
+ if (typeof v !== "object" || v === null || Array.isArray(v)) return false;
402
+ return "$ref" in v || "description" in v || "content" in v || "headers" in v || "links" in v;
403
+ }
404
+ function isOAuthFlowValue(v) {
405
+ if (typeof v !== "object" || v === null || Array.isArray(v)) return false;
406
+ return "authorizationUrl" in v || "tokenUrl" in v || "scopes" in v;
407
+ }
408
+ //#endregion
409
+ export { makeBarrel as A, zodToOpenAPISchema as B, baseError as C, error as D, ensureSuffix as E, renderNamedImport as F, requestParamsArray as I, statusCodeToNumber as L, makeSafeKey as M, methodPath as N, escapeHtml as O, normalizeTypes as P, toIdentifierPascalCase as R, isValidIdent as S, cyclicNodes as T, isSchemaObject as _, isOAuthFlowValue as a, isSecurityScheme as b, isOperationLike as c, isParameterObject as d, isRecord as f, isSchemaArray as g, isResponses as h, isMediaWithSchema as i, makeInferRequestType as j, escapeRegexLiteral as k, isParameter as l, isRequestBody as m, isHttpMethod as n, isOpenAPIPaths as o, isRefObject as p, isMedia as r, isOperation as s, isContentBody as t, isParameterArray as u, isSchemaProperty as v, capitalize as w, isStringRef as x, isSecurityArray as y, uncapitalize as z };