hono-takibi 0.32.0 → 0.32.1

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.0";
8
+ var version = "0.32.1";
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-BJd1x1Sd.js").then((n) => n.o)
44
+ import("./shared-BohdqQVB.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-BJd1x1Sd.js").then((n) => n.o));
82
+ const { outsideSources } = yield* Effect.promise(() => import("./shared-BohdqQVB.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-x4lL9jCd.js").then((n) => n.t),
212
- import("./shared-BJd1x1Sd.js").then((n) => n.o)
211
+ import("./core-BErYCEq-.js").then((n) => n.t),
212
+ import("./shared-BohdqQVB.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-yM0QjWw1.js";
6
- import { t as zodOpenAPIHono } from "./openapi-BY2rTmvj.js";
7
- import { t as makeMock } from "./mock-D120XYX2.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-BaXZEgTP.js";
6
+ import { t as zodOpenAPIHono } from "./openapi-B8oA5BKZ.js";
7
+ import { t as makeMock } from "./mock-D2cCG7D7.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-BJd1x1Sd.js";
4
+ import { a as packageRoots, n as makeJob, r as openAPI3, t as cleanSplitOutputs } from "../shared-BohdqQVB.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-D120XYX2.js";
1
+ export { t as makeMock } from "../../mock-D2cCG7D7.js";
@@ -1 +1 @@
1
- export { t as zodOpenAPIHono } from "../../../openapi-BY2rTmvj.js";
1
+ export { t as zodOpenAPIHono } from "../../../openapi-B8oA5BKZ.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-yM0QjWw1.js";
3
+ import { n as componentsCode, t as routeCode } from "./routes-BaXZEgTP.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-yM0QjWw1.js";
3
+ import { D as makeWebhookEntries, n as componentsCode, t as routeCode } from "./routes-BaXZEgTP.js";
4
4
  // src/helper/names.ts
5
5
  /**
6
6
  * Renames the components whose identifiers would collide, and every `$ref` to them.
@@ -1030,6 +1030,22 @@ const SCHEMA_OBJECT_KEYS = /* @__PURE__ */ new Set([
1030
1030
  function isSchemaObjectKey(key) {
1031
1031
  return SCHEMA_OBJECT_KEYS.has(key) || key.startsWith("x-");
1032
1032
  }
1033
+ /**
1034
+ * What each key of an XML Object (OpenAPI 3.1 §4.8.26) takes. A key it has not — an
1035
+ * `example` written beside `attribute` (#442, openSUSE OBS) — does not type-check in the
1036
+ * metadata, nor does a value of another type.
1037
+ */
1038
+ const XML_OBJECT_VALUE_TYPES = {
1039
+ name: (v) => typeof v === "string",
1040
+ namespace: (v) => typeof v === "string",
1041
+ prefix: (v) => typeof v === "string",
1042
+ attribute: (v) => typeof v === "boolean",
1043
+ wrapped: (v) => typeof v === "boolean"
1044
+ };
1045
+ /** An `xml` value as an XML Object: the keys it has, each of its type, and extensions. */
1046
+ function pruneXmlObject(xml) {
1047
+ return Object.fromEntries(Object.entries(xml).filter(([key, value]) => key.startsWith("x-") || XML_OBJECT_VALUE_TYPES[key]?.(value) === true));
1048
+ }
1033
1049
  const TYPE_NAMES = /* @__PURE__ */ new Set([
1034
1050
  "integer",
1035
1051
  "number",
@@ -1137,6 +1153,11 @@ function pruneSchemaObject(schema) {
1137
1153
  };
1138
1154
  continue;
1139
1155
  }
1156
+ if (key === "xml" && isRecord(value)) {
1157
+ const xml = pruneXmlObject(value);
1158
+ if (Object.keys(xml).length > 0) pruned[key] = xml;
1159
+ continue;
1160
+ }
1140
1161
  if (SCHEMA_VALUED_KEYS.has(key)) {
1141
1162
  pruned[key] = pruneSchemaObject(value);
1142
1163
  continue;
@@ -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-x4lL9jCd.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-BErYCEq-.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-BY2rTmvj.js";
10
+ import { n as normalizeOpenAPI } from "./openapi-B8oA5BKZ.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-x4lL9jCd.js";
4
+ import { C as isInsideDirectory, S as appEntryOutput } from "../core-BErYCEq-.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-BJd1x1Sd.js";
6
+ import { a as packageRoots, i as outsideSources, n as makeJob, r as openAPI3, t as cleanSplitOutputs } from "../shared-BohdqQVB.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.0",
3
+ "version": "0.32.1",
4
4
  "description": "Hono Takibi is a code generator from OpenAPI to @hono/zod-openapi",
5
5
  "keywords": [
6
6
  "hono",