hono-takibi 0.32.3 → 0.32.4

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/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
5
5
  import { Console, Effect, FileSystem, Option, Path, Ref, Schema, Stream } from "effect";
6
6
  import { Argument, CliError, Command, Flag } from "effect/cli";
7
7
  // package.json
8
- var version = "0.32.3";
8
+ var version = "0.32.4";
9
9
  var description = "Hono Takibi is a code generator from OpenAPI to @hono/zod-openapi";
10
10
  // src/cli/index.ts
11
11
  const COMMAND_NAME = "hono-takibi";
@@ -41,7 +41,7 @@ function runJobs(config) {
41
41
  const [{ parseOpenAPI }, { FormatOptions }, { cleanSplitOutputs, makeJob, openAPI3, packageRoots }] = yield* Effect.promise(() => Promise.all([
42
42
  import("./openapi-BxSVfs_l.js").then((n) => n.t),
43
43
  import("./format-BF7SbaMP.js").then((n) => n.r),
44
- import("./shared-C7pHMuGq.js").then((n) => n.o)
44
+ import("./shared-BDYWF9wQ.js").then((n) => n.o)
45
45
  ]));
46
46
  const openAPI = yield* openAPI3(yield* parseOpenAPI(config.input), config.input);
47
47
  const jobs = makeJob(openAPI, config, yield* packageRoots(openAPI, config));
@@ -79,7 +79,7 @@ function reportJobs(config, previous) {
79
79
  onFailure: (error) => Console.error(`❌ ${error.message}`),
80
80
  onSuccess: (report) => Console.log(report)
81
81
  }));
82
- const { outsideSources } = yield* Effect.promise(() => import("./shared-C7pHMuGq.js").then((n) => n.o));
82
+ const { outsideSources } = yield* Effect.promise(() => import("./shared-BDYWF9wQ.js").then((n) => n.o));
83
83
  const inputDirectory = path.dirname(path.resolve(config.input));
84
84
  return {
85
85
  inputDirectory,
@@ -208,8 +208,8 @@ function generate(args) {
208
208
  if (input !== void 0 && output !== void 0) {
209
209
  const [{ parseOpenAPI }, { takibi }, { openAPI3 }] = yield* Effect.promise(() => Promise.all([
210
210
  import("./openapi-BxSVfs_l.js").then((n) => n.t),
211
- import("./core-BH4uT5Z5.js").then((n) => n.t),
212
- import("./shared-C7pHMuGq.js").then((n) => n.o)
211
+ import("./core-DuBKXeEi.js").then((n) => n.t),
212
+ import("./shared-BDYWF9wQ.js").then((n) => n.o)
213
213
  ]));
214
214
  const document = yield* openAPI3(yield* parseOpenAPI(input), input);
215
215
  return yield* Console.log(yield* takibi(document, output));
@@ -2,9 +2,9 @@ import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
2
2
  import { $ as HTTP_METHODS, G as isValidIdent, M as isRecord, O as isPathItem, S as isOperation, k as isPathItemEntry, m as isHttpMethod, q as COMPONENT_NAMES, u as isCallbacks, x as isOpenAPIPaths } from "./guard-Rvg4ztIZ.js";
3
3
  import { i as GenerateError, n as fmt } from "./format-BF7SbaMP.js";
4
4
  import { S as zodToOpenAPISchema, _ as routeName, a as ensureSuffix, b as uncapitalize, c as escapeRegexLiteral, h as renderNamedImport, l as makeBarrel, x as uncapitalizeWord, y as toIdentifierPascalCase } from "./utils-yHmzthJJ.js";
5
- import { C as makePathItem, D as makeWebhookEntries, E as makeRouteProperties, O as resolveParameter, S as makeCallback, T as makeRouteEntries, _ as identifierNames, a as requestBodiesCode, b as textOf, c as makeSplitSchemaFile, d as makeImports, f as makeModuleSpec, g as descendantsWhere, h as declarationOf, i as responsesCode, k as resolvePathItem, l as makeConst, m as ast, n as componentsCode, o as parametersCode, p as analyzeCircularSchemas, r as schemasCode, s as headersCode, u as makeExportConst, v as parseModule, w as makeRef, x as zodToOpenAPI, y as parseSource } from "./routes-BLjJU-RS.js";
6
- import { t as zodOpenAPIHono } from "./openapi-CJCgn7NT.js";
7
- import { t as makeMock } from "./mock-CkcuVVvQ.js";
5
+ import { C as makePathItem, D as makeWebhookEntries, E as makeRouteProperties, O as resolveParameter, S as makeCallback, T as makeRouteEntries, _ as identifierNames, a as requestBodiesCode, b as textOf, c as makeSplitSchemaFile, d as makeImports, f as makeModuleSpec, g as descendantsWhere, h as declarationOf, i as responsesCode, k as resolvePathItem, l as makeConst, m as ast, n as componentsCode, o as parametersCode, p as analyzeCircularSchemas, r as schemasCode, s as headersCode, u as makeExportConst, v as parseModule, w as makeRef, x as zodToOpenAPI, y as parseSource } from "./routes-g-suwftT.js";
6
+ import { t as zodOpenAPIHono } from "./openapi-Dy5PycHC.js";
7
+ import { t as makeMock } from "./mock-m2jO1vos.js";
8
8
  import { a as entryNames, c as makeGroupClientName, l as operationTags, o as freeName, s as groupNameOf } from "./rpc-yhnsv_ji.js";
9
9
  import { i as readdir, n as mkdir, o as writeFile, r as readFile } from "./file-hO_bjDys.js";
10
10
  import { t as emit } from "./emit-8SmO5pHF.js";
@@ -1,7 +1,7 @@
1
1
  import { parseConfig } from "../index.js";
2
2
  import { t as FormatOptions } from "../format-BF7SbaMP.js";
3
3
  import { n as parseOpenAPI } from "../openapi-BxSVfs_l.js";
4
- import { a as packageRoots, n as makeJob, r as openAPI3, t as cleanSplitOutputs } from "../shared-C7pHMuGq.js";
4
+ import { a as packageRoots, n as makeJob, r as openAPI3, t as cleanSplitOutputs } from "../shared-BDYWF9wQ.js";
5
5
  import * as NodeServices from "@effect/platform-node/NodeServices";
6
6
  import { Effect } from "effect";
7
7
  // src/generate/index.ts
@@ -1 +1 @@
1
- export { t as makeMock } from "../../mock-CkcuVVvQ.js";
1
+ export { t as makeMock } from "../../mock-m2jO1vos.js";
@@ -1 +1 @@
1
- export { t as zodOpenAPIHono } from "../../../openapi-CJCgn7NT.js";
1
+ export { t as zodOpenAPIHono } from "../../../openapi-Dy5PycHC.js";
@@ -1,6 +1,6 @@
1
1
  import { $ as HTTP_METHODS, A as isPathItemRef, B as isSecurityArray, J as COMPONENT_REF_PREFIX, L as isSchemaArray, N as isRefObject, R as isSchemaObject, S as isOperation, V as isSecurityScheme, a as hasNumericConstraint, at as TEXT_MEDIA_TYPE, g as isInlineMedia, j as isPresent, k as isPathItemEntry, m as isHttpMethod, nt as JSON_MEDIA_TYPE, o as hasRequestBodyContent, w as isParameter, y as isMediaWithSchema } from "./guard-Rvg4ztIZ.js";
2
2
  import { _ as routeName, a as ensureSuffix, d as makeSafeKey, f as makeStringLiteral, p as normalizeTypes, r as cyclicNodes, v as statusCodeToNumber, y as toIdentifierPascalCase } from "./utils-yHmzthJJ.js";
3
- import { n as componentsCode, t as routeCode } from "./routes-BLjJU-RS.js";
3
+ import { n as componentsCode, t as routeCode } from "./routes-g-suwftT.js";
4
4
  // src/helper/faker.ts
5
5
  const FORMAT_TO_FAKER = {
6
6
  date: "faker.date.past().toISOString().slice(0, 10)",
@@ -1,6 +1,6 @@
1
1
  import { $ as HTTP_METHODS, M as isRecord, Y as COMPONENT_SUFFIXES, q as COMPONENT_NAMES } from "./guard-Rvg4ztIZ.js";
2
2
  import { a as ensureSuffix, i as decodePercent, y as toIdentifierPascalCase } from "./utils-yHmzthJJ.js";
3
- import { D as makeWebhookEntries, n as componentsCode, t as routeCode } from "./routes-BLjJU-RS.js";
3
+ import { D as makeWebhookEntries, n as componentsCode, t as routeCode } from "./routes-g-suwftT.js";
4
4
  // src/helper/names.ts
5
5
  /**
6
6
  * Renames the components whose identifiers would collide, and every `$ref` to them.
@@ -319,7 +319,7 @@ function resolveObject(schema, schemas, seen = []) {
319
319
  const target = resolveSchemaRef(schema.$ref, schemas);
320
320
  return target === void 0 ? void 0 : resolveObject(target, schemas, [...seen, schema.$ref]);
321
321
  }
322
- return normalizeTypes(schema.type).includes("object") || schema.properties !== void 0 ? schema : void 0;
322
+ return normalizeTypes(schema.type).includes("object") || schema.type === void 0 && schema.properties !== void 0 || isUntypedObject(schema) ? schema : void 0;
323
323
  }
324
324
  /**
325
325
  * The function that reads one value holding an object, as source. `separator` is what
@@ -1569,6 +1569,7 @@ function wrap(zod, schema, meta, options) {
1569
1569
  return `${v}`;
1570
1570
  }
1571
1571
  if (schema.type === "date" && typeof v === "string") return `new Date(${JSON.stringify(v)})`;
1572
+ if ((v === "true" || v === "false") && ((schema.enum?.includes(v) ?? false) || schema.const === v)) return JSON.stringify(v);
1572
1573
  if (typeList.includes("boolean") && (v === "true" || v === "false")) return v;
1573
1574
  return JSON.stringify(v);
1574
1575
  };
@@ -2628,7 +2629,7 @@ function zodToOpenAPI(schema, meta, options) {
2628
2629
  return done(isJson && isBigintFormat && schema.enum.some((member) => typeof member === "number") ? `z.preprocess(${JSON_BIGINT},${members})` : members, schema);
2629
2630
  }
2630
2631
  if (schema.properties !== void 0 && schema.type === void 0 && !isUntypedObject(schema)) return done(emitTypelessRefine(schema, (s) => zodToOpenAPI(s, void 0, childOptions)), schema);
2631
- if (schema.properties !== void 0 || isUntypedObject(schema)) {
2632
+ if (schema.properties !== void 0 && normalizeTypes(schema.type).includes("object") || isUntypedObject(schema)) {
2632
2633
  const needsDefaultRequired = schema.required === void 0 && Object.keys(schema.properties ?? {}).length > 0 && schema.anyOf === void 0;
2633
2634
  return done(object(schema, childOptions), needsDefaultRequired ? {
2634
2635
  ...schema,
@@ -1,13 +1,13 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
2
2
  import { Q as HOOK_LIBRARIES, q as COMPONENT_NAMES } from "./guard-Rvg4ztIZ.js";
3
- import { C as isInsideDirectory, E as makeGeneratedImport, S as appEntryOutput, T as makeAppEntryImport, _ as headers, a as takibi, b as client, c as securitySchemes, d as requestBodies, f as pathItems, g as links, h as mediaTypes, i as defineTemplate, l as schemas, m as components, n as webhooks, o as route, p as parameters, r as template, s as mock, u as responses, v as examples, w as makeAppEntryFile, x as handlerGroupOf, y as callbacks } from "./core-BH4uT5Z5.js";
3
+ import { C as isInsideDirectory, E as makeGeneratedImport, S as appEntryOutput, T as makeAppEntryImport, _ as headers, a as takibi, b as client, c as securitySchemes, d as requestBodies, f as pathItems, g as links, h as mediaTypes, i as defineTemplate, l as schemas, m as components, n as webhooks, o as route, p as parameters, r as template, s as mock, u as responses, v as examples, w as makeAppEntryFile, x as handlerGroupOf, y as callbacks } from "./core-DuBKXeEi.js";
4
4
  import { t as docs } from "./docs-DC7Q_-PY.js";
5
5
  import { t as hooks } from "./hooks-B2Fcpr_z.js";
6
6
  import { rpc } from "./core/rpc/index.js";
7
7
  import { type } from "./core/type/index.js";
8
8
  import { i as GenerateError } from "./format-BF7SbaMP.js";
9
9
  import { a as unlink, i as readdir, t as exists } from "./file-hO_bjDys.js";
10
- import { n as normalizeOpenAPI } from "./openapi-CJCgn7NT.js";
10
+ import { n as normalizeOpenAPI } from "./openapi-Dy5PycHC.js";
11
11
  import { Effect, FileSystem, Schema } from "effect";
12
12
  import path from "node:path";
13
13
  import SwaggerParser from "@apidevtools/swagger-parser";
@@ -1,9 +1,9 @@
1
1
  import { parseConfig } from "../index.js";
2
2
  import { M as isRecord, tt as INPUT_EXTENSIONS } from "../guard-Rvg4ztIZ.js";
3
3
  import { t as FormatOptions } from "../format-BF7SbaMP.js";
4
- import { C as isInsideDirectory, S as appEntryOutput } from "../core-BH4uT5Z5.js";
4
+ import { C as isInsideDirectory, S as appEntryOutput } from "../core-DuBKXeEi.js";
5
5
  import { n as parseOpenAPI } from "../openapi-BxSVfs_l.js";
6
- import { a as packageRoots, i as outsideSources, n as makeJob, r as openAPI3, t as cleanSplitOutputs } from "../shared-C7pHMuGq.js";
6
+ import { a as packageRoots, i as outsideSources, n as makeJob, r as openAPI3, t as cleanSplitOutputs } from "../shared-BDYWF9wQ.js";
7
7
  import { Effect, FileSystem, Option, Result } from "effect";
8
8
  import path from "node:path";
9
9
  import crypto from "node:crypto";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono-takibi",
3
- "version": "0.32.3",
3
+ "version": "0.32.4",
4
4
  "description": "Hono Takibi is a code generator from OpenAPI to @hono/zod-openapi",
5
5
  "keywords": [
6
6
  "hono",