hono-takibi 0.16.0 → 0.18.0

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
@@ -9,7 +9,7 @@
9
9
  From one document it can generate:
10
10
 
11
11
  - [Zod](https://zod.dev/) schemas and [@hono/zod-openapi](https://hono.dev/examples/zod-openapi) route definitions
12
- - App entry, handler stubs and test files
12
+ - App entry and handler stubs
13
13
  - RPC client and hooks for SWR, TanStack Query, Preact / Solid / Vue / Svelte / Angular Query
14
14
  - Mock server, TypeScript types and API reference docs
15
15
 
@@ -48,7 +48,7 @@ npx hono-takibi
48
48
  - [Configuration](https://hono-takibi.dev/docs/guides/config)
49
49
  - [Template](https://hono-takibi.dev/docs/guides/template)
50
50
  - [Client](https://hono-takibi.dev/docs/guides/client)
51
- - [Test & Mock](https://hono-takibi.dev/docs/guides/test-mock)
51
+ - [Mock](https://hono-takibi.dev/docs/guides/mock)
52
52
  - [API Docs](https://hono-takibi.dev/docs/guides/api-docs)
53
53
  - [Vendor Extensions](https://hono-takibi.dev/docs/guides/vendor)
54
54
  - [Vite Plugin](https://hono-takibi.dev/docs/guides/vite-plugin)
package/dist/cli.js CHANGED
@@ -1,11 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
3
- import * as NodeServices from "@effect/platform-node/NodeServices";
4
- import { Console, Effect, FileSystem, Option, Ref, Result, Schema, Stream } from "effect";
5
- import path from "node:path";
6
- import { Argument, CliError, Command, Flag } from "effect/unstable/cli";
2
+ import { NodeRuntime, NodeServices } from "@effect/platform-node";
3
+ import { Console, Effect, FileSystem, Option, Path, Ref, Schema, Stream } from "effect";
4
+ import { Argument, CliError, Command, Flag } from "effect/cli";
7
5
  //#region package.json
8
- var version = "0.16.0";
6
+ var version = "0.18.0";
9
7
  var description = "Hono Takibi is a code generator from OpenAPI to @hono/zod-openapi";
10
8
  //#endregion
11
9
  //#region src/cli/index.ts
@@ -48,14 +46,15 @@ function loadConfig(configPath, reload) {
48
46
  }
49
47
  function runJobs(config) {
50
48
  return Effect.gen(function* () {
51
- const [{ parseOpenAPI }, { FormatOptions }, { cleanSplitOutputs, makeJob }] = yield* Effect.promise(() => Promise.all([
49
+ const [{ parseOpenAPI }, { FormatOptions }, { cleanSplitOutputs, makeJob, packageRoots }] = yield* Effect.promise(() => Promise.all([
52
50
  import("./openapi-DQRxq2_O.js").then((n) => n.t),
53
51
  import("./format-CuHABcKC.js").then((n) => n.r),
54
- import("./shared-C6tCzlhg.js").then((n) => n.o)
52
+ import("./shared-CMgxc-KQ.js").then((n) => n.a)
55
53
  ]));
56
- const jobs = makeJob(yield* parseOpenAPI(config.input), config);
54
+ const openAPI = yield* parseOpenAPI(config.input);
55
+ const jobs = makeJob(openAPI, config, yield* packageRoots(openAPI, config));
57
56
  yield* cleanSplitOutputs(jobs.filter((job) => job.split).map((job) => job.output));
58
- return (yield* Effect.all(jobs.map((job) => job.run(job.output)), { concurrency: "unbounded" }).pipe(Effect.provideService(FormatOptions, config.format ?? {}))).filter((message) => message !== "").join("\n");
57
+ return (yield* Effect.forEach(jobs, (job) => job.run(job.output), { concurrency: "unbounded" }).pipe(Effect.provideService(FormatOptions, config.format ?? {}))).filter((message) => message !== "").join("\n");
59
58
  });
60
59
  }
61
60
  function runConfigPass(configPath, reload) {
@@ -71,48 +70,57 @@ function isSameTarget(left, right) {
71
70
  return left?.inputDirectory === right?.inputDirectory && left?.outside.join("\n") === right?.outside.join("\n");
72
71
  }
73
72
  /**
74
- * Runs one pass and answers what to watch for the documents.
73
+ * Generates from a config that was read, and answers what to watch for its documents.
75
74
  *
76
- * Two separate things happen to the document here. `runJobs` generates from it, reading
77
- * it the way every other mode does. `outsideSources` then only asks which files it was
78
- * read from, so that an edit to any of them brings the session back to this function;
79
- * what it answers never reaches a generator.
80
- *
81
- * The directory comes from the config alone, so a pass that fails after the config was
82
- * read — a document that does not parse, say — still names it. Otherwise the very edit
83
- * that fixes the document would never be seen. The answer is `undefined` only when the
84
- * config itself could not be read.
75
+ * The directory comes from the config alone, so a pass that fails here — a document
76
+ * that does not parse, say — still names it. Otherwise the very edit that fixes the
77
+ * document would never be seen.
85
78
  *
86
79
  * The files outside the directory come from the document, and a broken document cannot
87
80
  * list them. `previous` is what stands in then: the fix may well belong in one of the
88
81
  * files the last readable version pointed at.
89
82
  */
90
- function reportConfigPass(configPath, reload, previous) {
83
+ function reportJobs(config, previous) {
91
84
  return Effect.gen(function* () {
92
- const config = yield* Effect.result(loadConfig(configPath, reload));
93
- if (Result.isFailure(config)) {
94
- yield* Console.error(`❌ ${config.failure.message}`);
95
- return;
96
- }
97
- const report = yield* Effect.result(runJobs(config.success));
98
- if (Result.isSuccess(report)) yield* Console.log(report.success);
99
- else yield* Console.error(`❌ ${report.failure.message}`);
100
- const { outsideSources } = yield* Effect.promise(() => import("./shared-C6tCzlhg.js").then((n) => n.o));
101
- const inputDirectory = path.dirname(path.resolve(process.cwd(), config.success.input));
85
+ const path = yield* Path.Path;
86
+ yield* runJobs(config).pipe(Effect.matchEffect({
87
+ onFailure: (error) => Console.error(`❌ ${error.message}`),
88
+ onSuccess: (report) => Console.log(report)
89
+ }));
90
+ const { outsideSources } = yield* Effect.promise(() => import("./shared-CMgxc-KQ.js").then((n) => n.a));
91
+ const inputDirectory = path.dirname(path.resolve(config.input));
102
92
  return {
103
93
  inputDirectory,
104
- outside: yield* outsideSources(config.success.input).pipe(Effect.orElseSucceed(() => previous?.inputDirectory === inputDirectory ? previous.outside : []))
94
+ outside: yield* outsideSources(config.input).pipe(Effect.orElseSucceed(() => previous?.inputDirectory === inputDirectory ? previous.outside : []))
105
95
  };
106
96
  });
107
97
  }
108
98
  /**
99
+ * Runs one pass and answers what to watch for the documents.
100
+ *
101
+ * Two separate things happen to the document here. `runJobs` generates from it, reading
102
+ * it the way every other mode does. `outsideSources` then only asks which files it was
103
+ * read from, so that an edit to any of them brings the session back to this function;
104
+ * what it answers never reaches a generator.
105
+ *
106
+ * The answer is `undefined` only when the config itself could not be read.
107
+ */
108
+ function reportConfigPass(configPath, reload, previous) {
109
+ return loadConfig(configPath, reload).pipe(Effect.matchEffect({
110
+ onFailure: (error) => Console.error(`❌ ${error.message}`).pipe(Effect.as(void 0)),
111
+ onSuccess: (config) => reportJobs(config, previous)
112
+ }));
113
+ }
114
+ /**
109
115
  * `directory`, or the closest directory above it that exists.
110
116
  *
111
117
  * A directory that is not there cannot be watched, but the one it will appear in can.
112
118
  */
113
119
  function nearestExisting(directory) {
114
120
  return Effect.gen(function* () {
115
- const exists = yield* (yield* FileSystem.FileSystem).exists(directory).pipe(Effect.orElseSucceed(() => false));
121
+ const fs = yield* FileSystem.FileSystem;
122
+ const path = yield* Path.Path;
123
+ const exists = yield* fs.exists(directory).pipe(Effect.orElseSucceed(() => false));
116
124
  const parent = path.dirname(directory);
117
125
  return exists || parent === directory ? directory : yield* nearestExisting(parent);
118
126
  });
@@ -138,8 +146,9 @@ function watchPass(configPath, target, watched, nextTarget) {
138
146
  function outsideEvents(outside) {
139
147
  return Effect.gen(function* () {
140
148
  const fs = yield* FileSystem.FileSystem;
149
+ const path = yield* Path.Path;
141
150
  const directories = [...new Set(outside.map((file) => path.dirname(file)))];
142
- const present = yield* Effect.all(directories.map((directory) => fs.exists(directory).pipe(Effect.orElseSucceed(() => false))), { concurrency: "unbounded" });
151
+ const present = yield* Effect.forEach(directories, (directory) => fs.exists(directory).pipe(Effect.orElseSucceed(() => false)), { concurrency: "unbounded" });
143
152
  return directories.filter((_, index) => present[index]).map((directory) => fs.watch(directory).pipe(Stream.filter((event) => outside.includes(path.join(directory, event.path)))));
144
153
  });
145
154
  }
@@ -155,6 +164,7 @@ function outsideEvents(outside) {
155
164
  function watchRound(configPath, target, watched) {
156
165
  return Effect.gen(function* () {
157
166
  const fs = yield* FileSystem.FileSystem;
167
+ const path = yield* Path.Path;
158
168
  const configFile = path.basename(configPath);
159
169
  const nextTarget = yield* Ref.make(target);
160
170
  const configEvents = fs.watch(path.dirname(configPath)).pipe(Stream.filter((event) => event.path === configFile));
@@ -167,12 +177,22 @@ function watchRound(configPath, target, watched) {
167
177
  return yield* Ref.get(nextTarget);
168
178
  });
169
179
  }
170
- function watchConfig(configPath, target) {
180
+ /**
181
+ * Announces what a round watches, runs it, and leaves the next target in `current`.
182
+ */
183
+ function watchCycle(configPath, current) {
171
184
  return Effect.gen(function* () {
185
+ const target = yield* Ref.get(current);
172
186
  const watched = target === void 0 ? void 0 : yield* nearestExisting(target.inputDirectory);
173
187
  const documents = [target?.inputDirectory, ...target?.outside ?? []].filter((entry) => entry !== void 0).join(", ");
174
188
  yield* Console.log(target === void 0 ? `\n👀 Watching ${configPath} — Ctrl-C to stop` : watched === target.inputDirectory ? `\n👀 Watching ${documents} and ${configPath} — Ctrl-C to stop` : `\n👀 Watching ${configPath}, waiting for ${target.inputDirectory} — Ctrl-C to stop`);
175
- return yield* watchConfig(configPath, yield* watchRound(configPath, target, watched));
189
+ yield* Ref.set(current, yield* watchRound(configPath, target, watched));
190
+ });
191
+ }
192
+ function watchConfig(configPath, target) {
193
+ return Effect.gen(function* () {
194
+ const current = yield* Ref.make(target);
195
+ return yield* Effect.forever(watchCycle(configPath, current));
176
196
  });
177
197
  }
178
198
  function generate(args) {
@@ -194,18 +214,18 @@ function generate(args) {
194
214
  })]
195
215
  });
196
216
  if (input !== void 0 && output !== void 0) {
197
- const [{ parseOpenAPI }, { takibi }] = yield* Effect.promise(() => Promise.all([import("./openapi-DQRxq2_O.js").then((n) => n.t), import("./core-BTIn-SV7.js").then((n) => n.t)]));
217
+ const [{ parseOpenAPI }, { takibi }] = yield* Effect.promise(() => Promise.all([import("./openapi-DQRxq2_O.js").then((n) => n.t), import("./core-BuSZBtYC.js").then((n) => n.t)]));
198
218
  return yield* Console.log(yield* takibi(yield* parseOpenAPI(input), output));
199
219
  }
200
220
  const resolvedConfig = configPath ?? DEFAULT_CONFIG_FILE;
201
221
  if (args.watch) return yield* watchConfig(resolvedConfig, yield* reportConfigPass(resolvedConfig, false, void 0));
202
- const first = yield* runConfigPass(resolvedConfig, false).pipe(Effect.mapError((error) => configPath === void 0 && error._tag === "ConfigError" && error.notFound === true ? new CliError.ShowHelp({
222
+ const first = yield* runConfigPass(resolvedConfig, false).pipe(Effect.catchTag("ConfigError", (error) => Effect.fail(configPath === void 0 && error.notFound === true ? new CliError.ShowHelp({
203
223
  commandPath: [COMMAND_NAME],
204
224
  errors: [new CliError.UserError({
205
225
  cause: error,
206
226
  userMessage: error.message
207
227
  })]
208
- }) : error));
228
+ }) : error)));
209
229
  yield* Console.log(first.report);
210
230
  }).pipe(Effect.mapError((error) => CliError.isCliError(error) ? error : new CliError.UserError({
211
231
  cause: error,
@@ -232,11 +252,11 @@ function makeCli() {
232
252
  }
233
253
  ]));
234
254
  }
235
- function honoTakibi(argv) {
236
- return Command.runWith(makeCli(), { version })(argv);
255
+ function honoTakibi() {
256
+ return Command.run(makeCli(), { version });
237
257
  }
238
258
  //#endregion
239
259
  //#region src/index.ts
240
- NodeRuntime.runMain(honoTakibi(process.argv.slice(2)).pipe(Effect.provide(NodeServices.layer)));
260
+ NodeRuntime.runMain(honoTakibi().pipe(Effect.provide(NodeServices.layer)));
241
261
  //#endregion
242
262
  export {};
@@ -0,0 +1,42 @@
1
+ //#region src/constants/index.ts
2
+ /** The kinds of the OpenAPI Components Object, in declaration and config-field order. */
3
+ const COMPONENT_NAMES = [
4
+ "schemas",
5
+ "responses",
6
+ "parameters",
7
+ "examples",
8
+ "requestBodies",
9
+ "headers",
10
+ "securitySchemes",
11
+ "links",
12
+ "callbacks",
13
+ "pathItems",
14
+ "mediaTypes"
15
+ ];
16
+ /** The query libraries the hooks are generated for, each a config key of its own. */
17
+ const HOOK_LIBRARIES = [
18
+ "swr",
19
+ "tanstack-query",
20
+ "preact-query",
21
+ "solid-query",
22
+ "vue-query",
23
+ "svelte-query",
24
+ "angular-query"
25
+ ];
26
+ /**
27
+ * The HTTP methods an OpenAPI path item can hold, in the order the specification lists
28
+ * them: OpenAPI 3.2 adds `query`. Operations of one path are generated in this order.
29
+ */
30
+ const HTTP_METHODS = [
31
+ "get",
32
+ "put",
33
+ "post",
34
+ "delete",
35
+ "options",
36
+ "head",
37
+ "patch",
38
+ "trace",
39
+ "query"
40
+ ];
41
+ //#endregion
42
+ export { HOOK_LIBRARIES as n, HTTP_METHODS as r, COMPONENT_NAMES as t };
@@ -1,2 +1,2 @@
1
- import { t as docs } from "../../docs-BUk6OQGb.js";
1
+ import { t as docs } from "../../docs-DJps1WGq.js";
2
2
  export { docs };
@@ -1,5 +1,6 @@
1
1
  import { t as OpenAPI } from "../../index-tsPqeV6H.js";
2
2
  import { n as GenerateError, t as FormatError } from "../../index-D_gf3Xzx.js";
3
+ import { t as Grouping } from "../../index-Dn5Bw8ov.js";
3
4
  //#region src/core/hooks/index.d.ts
4
5
  declare const HOOK_CONFIGS: {
5
6
  readonly swr: {
@@ -163,5 +164,7 @@ declare const HOOK_CONFIGS: {
163
164
  export type HookLibrary = keyof typeof HOOK_CONFIGS;
164
165
  export declare function hooks(openAPI: OpenAPI, output: string, importPath: string, library: HookLibrary, options?: {
165
166
  readonly clientName?: string;
167
+ readonly grouping?: Grouping;
168
+ readonly basePath?: string;
166
169
  }): import("effect/Effect").Effect<string, FormatError | GenerateError | import("effect/PlatformError").PlatformError, import("effect/FileSystem").FileSystem>;
167
170
  //#endregion
@@ -1,2 +1,2 @@
1
- import { t as hooks } from "../../hooks-BI33t89i.js";
1
+ import { t as hooks } from "../../hooks-CQMtSLZv.js";
2
2
  export { hooks };
@@ -1,9 +1,10 @@
1
1
  import { t as OpenAPI } from "../../index-tsPqeV6H.js";
2
2
  import { n as GenerateError, t as FormatError } from "../../index-D_gf3Xzx.js";
3
+ import { t as Grouping } from "../../index-Dn5Bw8ov.js";
3
4
  import { Effect } from "effect";
4
5
  //#region src/core/rpc/index.d.ts
5
6
  /**
6
7
  * Generates RPC client wrapper functions from OpenAPI specification.
7
8
  */
8
- export declare function rpc(openAPI: OpenAPI, output: string, importPath: string, clientName?: string, useParseResponse?: boolean, basePath?: string, docs?: boolean): Effect.Effect<string, FormatError | GenerateError | import("effect/PlatformError").PlatformError, import("effect/FileSystem").FileSystem>;
9
+ export declare function rpc(openAPI: OpenAPI, output: string, importPath: string, clientName?: string, useParseResponse?: boolean, basePath?: string, docs?: boolean, grouping?: Grouping): Effect.Effect<string, FormatError | GenerateError | import("effect/PlatformError").PlatformError, import("effect/FileSystem").FileSystem>;
9
10
  //#endregion
@@ -1,7 +1,8 @@
1
+ import { r as HTTP_METHODS } from "../../constants-DlWc79pw.js";
1
2
  import { i as GenerateError } from "../../format-CuHABcKC.js";
2
- import { A as isOperationLike, O as isOpenAPIPaths, R as isRecord, f as methodPath, l as makeInferRequestType } from "../../utils-DNYSWwCh.js";
3
- import { t as emit } from "../../emit-CSV6od97.js";
4
- import { a as parsePathItem, i as operationHasArgs, r as makeOperationDeps, t as formatPath } from "../../rpc-UzOYe2mc.js";
3
+ import { D as isOpenAPIPaths, L as isRecord, f as methodPath, k as isOperationLike, l as makeInferRequestType } from "../../utils-7HBCrio0.js";
4
+ import { t as emit } from "../../emit-uwlZZeRM.js";
5
+ import { a as parsePathItem, c as operationTags, i as operationHasArgs, o as groupClientName, r as makeOperationDeps, t as formatPath } from "../../rpc-Bl9hcXCo.js";
5
6
  import { Effect } from "effect";
6
7
  import { dirname } from "node:path";
7
8
  //#region src/core/rpc/index.ts
@@ -20,9 +21,14 @@ function makeJsDoc(operation, method, path) {
20
21
  sections.push([`${method.toUpperCase()} ${path}`]);
21
22
  return `/**\n${sections.map((lines) => lines.join("\n")).join("\n\n").split("\n").map((line) => line ? ` * ${line}` : " *").join("\n")}\n */\n`;
22
23
  }
23
- function makeOperationCode(path, method, item, deps, useParseResponse, hasBasePath, docs) {
24
+ function makeOperationCode(path, method, item, base, useParseResponse, hasBasePath, docs, grouping) {
24
25
  const operation = item[method];
25
26
  if (!isOperationLike(operation)) return null;
27
+ const group = grouping?.(path, operationTags(operation));
28
+ const deps = group === void 0 ? base : {
29
+ ...base,
30
+ client: groupClientName(group)
31
+ };
26
32
  const funcName = methodPath(method, path);
27
33
  const pathResult = formatPath(path, hasBasePath);
28
34
  const hasArgs = operationHasArgs(item, operation, deps);
@@ -32,41 +38,34 @@ function makeOperationCode(path, method, item, deps, useParseResponse, hasBasePa
32
38
  const call = useParseResponse ? `parseResponse(${clientCall})` : clientCall;
33
39
  return {
34
40
  code: `${docs ? makeJsDoc(operation, method, path) : ""}export async function ${funcName}(${argSig}){return await ${call}}`,
35
- hasArgs
41
+ hasArgs,
42
+ client: deps.client
36
43
  };
37
44
  }
38
- function makeOperationCodes(paths, deps, useParseResponse, hasBasePath, docs) {
45
+ function makeOperationCodes(paths, deps, useParseResponse, hasBasePath, docs, grouping) {
39
46
  return Object.entries(paths).filter((entry) => isRecord(entry[1])).flatMap(([p, rawItem]) => {
40
47
  const pathItem = parsePathItem(rawItem);
41
- return [
42
- "get",
43
- "put",
44
- "post",
45
- "delete",
46
- "options",
47
- "head",
48
- "patch",
49
- "trace",
50
- "query"
51
- ].map((method) => makeOperationCode(p, method, pathItem, deps, useParseResponse, hasBasePath, docs)).filter((item) => item !== null);
48
+ return HTTP_METHODS.map((method) => makeOperationCode(p, method, pathItem, deps, useParseResponse, hasBasePath, docs, grouping)).filter((item) => item !== null);
52
49
  });
53
50
  }
54
- function makeHeader(importPath, needsInferRequestType, clientName, useParseResponse) {
55
- return `import type{${needsInferRequestType ? "InferRequestType,ClientRequestOptions" : "ClientRequestOptions"}}from'hono/client'\n${useParseResponse ? `import{parseResponse}from'hono/client'\n` : ""}import{${clientName}}from'${importPath}'\n\n`;
51
+ function makeHeader(importPath, needsInferRequestType, clientNames, useParseResponse) {
52
+ return `import type{${needsInferRequestType ? "InferRequestType,ClientRequestOptions" : "ClientRequestOptions"}}from'hono/client'\n${useParseResponse ? `import{parseResponse}from'hono/client'\n` : ""}import{${clientNames.join(",")}}from'${importPath}'\n\n`;
56
53
  }
57
54
  /**
58
55
  * Generates RPC client wrapper functions from OpenAPI specification.
59
56
  */
60
- function rpc(openAPI, output, importPath, clientName = "client", useParseResponse, basePath, docs) {
57
+ function rpc(openAPI, output, importPath, clientName = "client", useParseResponse, basePath, docs, grouping) {
61
58
  return Effect.gen(function* () {
62
59
  const paths = openAPI.paths;
63
60
  if (!isOpenAPIPaths(paths)) return yield* new GenerateError({ message: "Invalid OpenAPI paths" });
64
61
  const hasBasePath = basePath !== void 0 && basePath !== "/";
65
62
  const componentsParameters = openAPI.components?.parameters ?? {};
66
63
  const componentsRequestBodies = openAPI.components?.requestBodies ?? {};
67
- const operationCodes = makeOperationCodes(paths, makeOperationDeps(clientName, componentsParameters, componentsRequestBodies), useParseResponse, hasBasePath, docs);
64
+ const operationCodes = makeOperationCodes(paths, makeOperationDeps(clientName, componentsParameters, componentsRequestBodies), useParseResponse, hasBasePath, docs, grouping);
68
65
  const body = operationCodes.map(({ code }) => code).join("\n\n");
69
- const code = `${makeHeader(importPath, operationCodes.some(({ hasArgs }) => hasArgs), clientName, useParseResponse)}${body}${operationCodes.length > 0 ? "\n" : ""}`;
66
+ const needsInferRequestType = operationCodes.some(({ hasArgs }) => hasArgs);
67
+ const clientNames = [...new Set(operationCodes.map(({ client }) => client))];
68
+ const code = `${makeHeader(importPath, needsInferRequestType, clientNames.length > 0 ? clientNames : [clientName], useParseResponse)}${body}${operationCodes.length > 0 ? "\n" : ""}`;
70
69
  yield* emit(code, dirname(output), output);
71
70
  return `Generated rpc code written to ${output}`;
72
71
  });
@@ -1,5 +1,5 @@
1
- import { D as isMediaWithSchema, M as isParameterArray, O as isOpenAPIPaths, T as isHttpMethod, U as isSchemaArray, V as isRequestBody, Y as isStringRef, g as statusCodeToNumber, j as isParameter, k as isOperation, u as makeSafeKey } from "../../utils-DNYSWwCh.js";
2
- import { t as emit } from "../../emit-CSV6od97.js";
1
+ import { A as isParameter, B as isRequestBody, D as isOpenAPIPaths, E as isMediaWithSchema, H as isSchemaArray, J as isStringRef, O as isOperation, g as statusCodeToNumber, j as isParameterArray, u as makeSafeKey, w as isHttpMethod } from "../../utils-7HBCrio0.js";
2
+ import { t as emit } from "../../emit-uwlZZeRM.js";
3
3
  import { Effect } from "effect";
4
4
  import path from "node:path";
5
5
  //#region src/core/type/index.ts
@@ -161,9 +161,11 @@ function makeSchemaTypeString(schema, components, visited) {
161
161
  if (schema.oneOf && schema.oneOf.length > 0) return schema.oneOf.map((s) => makeSchemaTypeString(s, components, visited)).join("|");
162
162
  if (schema.anyOf && schema.anyOf.length > 0) return schema.anyOf.map((s) => makeSchemaTypeString(s, components, visited)).join("|");
163
163
  if (schema.allOf && schema.allOf.length > 0) return makeAllOfTypeString(schema.allOf, components, visited);
164
- if (schema.enum && schema.enum.length > 0) return schema.enum.map((v) => typeof v === "string" ? `'${v.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'` : String(v)).join("|");
164
+ const isBigintLiteral = (value) => typeof value === "number" && Number.isInteger(value) && (Array.isArray(schema.type) ? schema.type.includes("integer") : schema.type === "integer") && (schema.format === "int64" || schema.format === "uint64" || schema.format === "bigint");
165
+ if (schema.enum && schema.enum.length > 0) return schema.enum.map((v) => typeof v === "string" ? `'${v.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'` : isBigintLiteral(v) ? `${v}n` : String(v)).join("|");
165
166
  if (schema.const !== void 0) {
166
167
  if (typeof schema.const === "string") return `'${schema.const.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
168
+ if (isBigintLiteral(schema.const)) return `${schema.const}n`;
167
169
  if (typeof schema.const === "number" || typeof schema.const === "boolean") return String(schema.const);
168
170
  return JSON.stringify(schema.const);
169
171
  }