hono-takibi 0.28.0 → 0.29.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/dist/cli.js +6 -6
- package/dist/core/docs/index.js +1 -1
- package/dist/core/hooks/index.js +1 -1
- package/dist/core/rpc/index.js +3 -3
- package/dist/core/type/index.js +5 -4
- package/dist/{core-D141ZWzp.js → core-BFsWwAXx.js} +6 -6
- package/dist/{docs-CDFG1tXT.js → docs-MRoh0U3g.js} +6 -5
- package/dist/generator/zod-openapi-hono/openapi/index.js +1 -1
- package/dist/{guard-BH6yBr0M.js → guard-D-yHkxqE.js} +11 -4
- package/dist/{hooks-CKIK30qr.js → hooks-Cu1bRToh.js} +3 -3
- package/dist/index.js +1 -1
- package/dist/{openapi-imhqgahL.js → openapi-D9J3Kaij.js} +824 -377
- package/dist/{rpc-GDi7a_Ep.js → rpc-CVE9_EnW.js} +1 -1
- package/dist/{shared-CyBkG8gM.js → shared-BNo1Lr1g.js} +17 -6
- package/dist/{utils-CDLiYepO.js → utils-Kv3B0qkM.js} +58 -3
- package/dist/vite-plugin/index.js +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Z as INPUT_EXTENSIONS, m as isInputPath } from "./guard-
|
|
2
|
+
import { Z as INPUT_EXTENSIONS, m as isInputPath } from "./guard-D-yHkxqE.js";
|
|
3
3
|
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
|
4
4
|
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.
|
|
8
|
+
var version = "0.29.0";
|
|
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-tYYvoKiU.js").then((n) => n.t),
|
|
43
43
|
import("./format-BF7SbaMP.js").then((n) => n.r),
|
|
44
|
-
import("./shared-
|
|
44
|
+
import("./shared-BNo1Lr1g.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-
|
|
82
|
+
const { outsideSources } = yield* Effect.promise(() => import("./shared-BNo1Lr1g.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-tYYvoKiU.js").then((n) => n.t),
|
|
211
|
-
import("./core-
|
|
212
|
-
import("./shared-
|
|
211
|
+
import("./core-BFsWwAXx.js").then((n) => n.t),
|
|
212
|
+
import("./shared-BNo1Lr1g.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));
|
package/dist/core/docs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as docs } from "../../docs-
|
|
1
|
+
export { t as docs } from "../../docs-MRoh0U3g.js";
|
package/dist/core/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as hooks } from "../../hooks-
|
|
1
|
+
export { t as hooks } from "../../hooks-Cu1bRToh.js";
|
package/dist/core/rpc/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { O as isRecord, Y as HTTP_METHODS, b as isOperationLike, v as isOpenAPIPaths } from "../../guard-
|
|
1
|
+
import { O as isRecord, Y as HTTP_METHODS, b as isOperationLike, v as isOpenAPIPaths } from "../../guard-D-yHkxqE.js";
|
|
2
2
|
import { i as GenerateError } from "../../format-BF7SbaMP.js";
|
|
3
|
-
import { _ as routeName, u as makeInferRequestType } from "../../utils-
|
|
4
|
-
import { c as makeGroupClientName, i as parsePathItem, l as operationTags, n as makeOperationDeps, r as operationHasArgs, t as formatPath } from "../../rpc-
|
|
3
|
+
import { _ as routeName, u as makeInferRequestType } from "../../utils-Kv3B0qkM.js";
|
|
4
|
+
import { c as makeGroupClientName, i as parsePathItem, l as operationTags, n as makeOperationDeps, r as operationHasArgs, t as formatPath } from "../../rpc-CVE9_EnW.js";
|
|
5
5
|
import { t as emit } from "../../emit-CqkT9T4Q.js";
|
|
6
6
|
import { Effect } from "effect";
|
|
7
7
|
import { dirname } from "node:path";
|
package/dist/core/type/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as isSchemaArray, S as isParameterArray, d as isHttpMethod, g as isMediaWithSchema, j as isRequestBody, v as isOpenAPIPaths, x as isParameter, y as isOperation, z as isStringRef } from "../../guard-
|
|
2
|
-
import { d as makeSafeKey, v as statusCodeToNumber, y as toIdentifierPascalCase } from "../../utils-
|
|
1
|
+
import { N as isSchemaArray, S as isParameterArray, d as isHttpMethod, g as isMediaWithSchema, j as isRequestBody, o as isBinaryFile, v as isOpenAPIPaths, x as isParameter, y as isOperation, z as isStringRef } from "../../guard-D-yHkxqE.js";
|
|
2
|
+
import { d as makeSafeKey, v as statusCodeToNumber, y as toIdentifierPascalCase } from "../../utils-Kv3B0qkM.js";
|
|
3
3
|
import { t as emit } from "../../emit-CqkT9T4Q.js";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import path from "node:path";
|
|
@@ -217,8 +217,9 @@ const PRIMITIVE_TYPE_MAP = {
|
|
|
217
217
|
null: "null"
|
|
218
218
|
};
|
|
219
219
|
function makeSingleTypeString(schema, type, aliases, visited) {
|
|
220
|
-
if (type === "string") return schema
|
|
221
|
-
if (type === "number"
|
|
220
|
+
if (type === "string") return isBinaryFile(schema) ? "File" : "string";
|
|
221
|
+
if (type === "number") return "number";
|
|
222
|
+
if (type === "integer") return schema.format === "int64" || schema.format === "uint64" || schema.format === "bigint" ? "bigint" : "number";
|
|
222
223
|
if (type === "array") return makeArrayTypeString(schema, aliases, visited);
|
|
223
224
|
if (type === "object") return makeObjectTypeString(schema, aliases, visited);
|
|
224
225
|
return PRIMITIVE_TYPE_MAP[type] ?? "unknown";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
|
|
2
|
-
import { D as isPathItemRef, E as isPathItemEntry, I as isSecurityArray, L as isSecurityScheme, N as isSchemaArray, P as isSchemaObject, Q as JSON_MEDIA_TYPE, T as isPathItem, U as COMPONENT_NAMES, V as isValidIdent, W as COMPONENT_REF_PREFIX, Y as HTTP_METHODS,
|
|
2
|
+
import { D as isPathItemRef, E as isPathItemEntry, I as isSecurityArray, L as isSecurityScheme, N as isSchemaArray, P as isSchemaObject, Q as JSON_MEDIA_TYPE, T as isPathItem, U as COMPONENT_NAMES, V as isValidIdent, W as COMPONENT_REF_PREFIX, Y as HTTP_METHODS, d as isHttpMethod, g as isMediaWithSchema, i as hasRequestBodyContent, k as isRefObject, p as isInlineMedia, r as hasNumericConstraint, s as isCallbacks, tt as TEXT_MEDIA_TYPE, v as isOpenAPIPaths, x as isParameter, y as isOperation } from "./guard-D-yHkxqE.js";
|
|
3
3
|
import { i as GenerateError, n as fmt } from "./format-BF7SbaMP.js";
|
|
4
|
-
import { S as zodToOpenAPISchema, _ as routeName, a as ensureSuffix, b as uncapitalize, c as escapeRegexLiteral, d as makeSafeKey, f as makeStringLiteral, h as renderNamedImport, l as makeBarrel, p as normalizeTypes, r as cyclicNodes, v as statusCodeToNumber, x as uncapitalizeWord, y as toIdentifierPascalCase } from "./utils-
|
|
5
|
-
import { A as
|
|
6
|
-
import { a as entryNames, c as makeGroupClientName, l as operationTags, o as freeName, s as groupNameOf } from "./rpc-
|
|
4
|
+
import { S as zodToOpenAPISchema, _ as routeName, a as ensureSuffix, b as uncapitalize, c as escapeRegexLiteral, d as makeSafeKey, f as makeStringLiteral, h as renderNamedImport, l as makeBarrel, p as normalizeTypes, r as cyclicNodes, v as statusCodeToNumber, x as uncapitalizeWord, y as toIdentifierPascalCase } from "./utils-Kv3B0qkM.js";
|
|
5
|
+
import { A as resolveParameter, C as zodToOpenAPI, D as makeRouteEntries, E as makeRef, O as makeRouteProperties, S as textOf, T as makePathItem, _ as declarationOf, a as responsesCode, b as parseModule, c as headersCode, d as makeConst, f as makeExportConst, g as ast, h as analyzeCircularSchemas, i as schemasCode, j as resolvePathItem, k as makeWebhookEntries, l as makeSplitSchemaFile, m as makeModuleSpec, n as routeCode, o as requestBodiesCode, p as makeImports, r as componentsCode, s as parametersCode, t as zodOpenAPIHono, v as descendantsWhere, w as makeCallback, x as parseSource, y as identifierNames } from "./openapi-D9J3Kaij.js";
|
|
6
|
+
import { a as entryNames, c as makeGroupClientName, l as operationTags, o as freeName, s as groupNameOf } from "./rpc-CVE9_EnW.js";
|
|
7
7
|
import { i as readdir, n as mkdir, o as writeFile, r as readFile } from "./file-Bip_L0oR.js";
|
|
8
8
|
import { t as emit } from "./emit-CqkT9T4Q.js";
|
|
9
|
-
import { t as hooks } from "./hooks-
|
|
10
|
-
import { t as docs } from "./docs-
|
|
9
|
+
import { t as hooks } from "./hooks-Cu1bRToh.js";
|
|
10
|
+
import { t as docs } from "./docs-MRoh0U3g.js";
|
|
11
11
|
import { rpc } from "./core/rpc/index.js";
|
|
12
12
|
import { type } from "./core/type/index.js";
|
|
13
13
|
import { Effect } from "effect";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as MULTIPART_MEDIA_TYPE, N as isSchemaArray, O as isRecord, Y as HTTP_METHODS, k as isRefObject } from "./guard-
|
|
2
|
-
import { i as decodePercent, s as escapeHtml } from "./utils-
|
|
1
|
+
import { $ as MULTIPART_MEDIA_TYPE, N as isSchemaArray, O as isRecord, Y as HTTP_METHODS, k as isRefObject } from "./guard-D-yHkxqE.js";
|
|
2
|
+
import { i as decodePercent, s as escapeHtml } from "./utils-Kv3B0qkM.js";
|
|
3
3
|
import { n as mkdir, o as writeFile } from "./file-Bip_L0oR.js";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import path from "node:path";
|
|
@@ -175,7 +175,7 @@ function pickMedia(content, doc) {
|
|
|
175
175
|
* line break would end the row.
|
|
176
176
|
*/
|
|
177
177
|
function escapeCell(value) {
|
|
178
|
-
return value.replaceAll("|", "\\|").replaceAll(/\r?\n/gu, "<br>");
|
|
178
|
+
return String(value).replaceAll("|", "\\|").replaceAll(/\r?\n/gu, "<br>");
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Wraps content in a code fence longer than any backtick run inside it, so the
|
|
@@ -300,8 +300,9 @@ function inferType(value) {
|
|
|
300
300
|
return "object";
|
|
301
301
|
}
|
|
302
302
|
function baseTypeOf(schema, doc, visited) {
|
|
303
|
-
if (Array.isArray(schema.type)) return schema.type.join(" | ");
|
|
304
|
-
if (schema.type
|
|
303
|
+
if (Array.isArray(schema.type)) return schema.type.map(String).join(" | ");
|
|
304
|
+
if (typeof schema.type === "string") return schema.type;
|
|
305
|
+
if (schema.type !== void 0) return "any";
|
|
305
306
|
if (isRecord(schema.properties)) return "object";
|
|
306
307
|
const variants = variantsOf(schema);
|
|
307
308
|
if (variants.length > 0) return [...new Set(variants.map((variant) => formatSchemaType(variant.schema, doc, visited)))].join(" | ");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as zodOpenAPIHono } from "../../../openapi-
|
|
1
|
+
export { t as zodOpenAPIHono } from "../../../openapi-D9J3Kaij.js";
|
|
@@ -290,6 +290,16 @@ function isUntypedObject(schema) {
|
|
|
290
290
|
return schema.type === void 0 && (schema.properties !== void 0 || schema.additionalProperties !== void 0) && TYPELESS_KEYWORDS.every((k) => schema[k] === void 0 || OBJECT_KEYWORDS.has(k));
|
|
291
291
|
}
|
|
292
292
|
/**
|
|
293
|
+
* Whether a string is emitted as `z.file()`: `format: binary` on a string, with no content
|
|
294
|
+
* encoding, media type or schema (which make it an encoded string) and no `x-codec` (which
|
|
295
|
+
* replaces the schema). What it hands out is a `File`, not a string: a `pattern` and a string
|
|
296
|
+
* `default` describe the encoded text, not the file (#413).
|
|
297
|
+
*/
|
|
298
|
+
function isBinaryFile(schema) {
|
|
299
|
+
const types = Array.isArray(schema.type) ? schema.type : [schema.type];
|
|
300
|
+
return schema.format === "binary" && types.includes("string") && schema.contentEncoding === void 0 && schema.contentMediaType === void 0 && schema.contentSchema === void 0 && schema["x-codec"] === void 0;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
293
303
|
* Whether a `time` takes an offset. `time` is an RFC 3339 full-time, `12:34:56Z` or
|
|
294
304
|
* `12:34:56+09:00`, and `z.iso.time()` takes neither. `x-isoOffset: false` asks for that.
|
|
295
305
|
*/
|
|
@@ -299,9 +309,6 @@ function isOffsetTime(schema) {
|
|
|
299
309
|
function hasNumericConstraint(schema) {
|
|
300
310
|
return schema.minimum !== void 0 || schema.maximum !== void 0 || schema.exclusiveMinimum !== void 0 || schema.exclusiveMaximum !== void 0 || schema.multipleOf !== void 0;
|
|
301
311
|
}
|
|
302
|
-
function hasNotProperty(v) {
|
|
303
|
-
return typeof v === "object" && v !== null && "not" in v;
|
|
304
|
-
}
|
|
305
312
|
function isExamplesInput(v) {
|
|
306
313
|
return typeof v === "object" && v !== null && !Array.isArray(v) && Object.values(v).every((entry) => typeof entry === "object" && entry !== null && !Array.isArray(entry));
|
|
307
314
|
}
|
|
@@ -329,4 +336,4 @@ function hasNoContentResponse(operation) {
|
|
|
329
336
|
function isInheritedName(parameter) {
|
|
330
337
|
return parameter.in !== "path" && parameter.name in Object.prototype;
|
|
331
338
|
}
|
|
332
|
-
export { MULTIPART_MEDIA_TYPE as $, isRefOnly as A, isUntypedObject as B, isParameterObject as C, isPathItemRef as D, isPathItemEntry as E, isSchemaProperty as F, COMPONENT_SUFFIXES as G, ARROW_FUNCTION_PATTERN as H, isSecurityArray as I, HOOK_LIBRARIES as J, FORM_MEDIA_TYPES as K, isSecurityScheme as L, isResponses as M, isSchemaArray as N, isRecord as O, isSchemaObject as P, JSON_MEDIA_TYPE as Q, isSingleSchema as R, isParameterArray as S, isPathItem as T, COMPONENT_NAMES as U, isValidIdent as V, COMPONENT_REF_PREFIX as W, IDENTIFIER_PATTERN as X, HTTP_METHODS as Y, INPUT_EXTENSIONS as Z, isOffsetTime as _,
|
|
339
|
+
export { MULTIPART_MEDIA_TYPE as $, isRefOnly as A, isUntypedObject as B, isParameterObject as C, isPathItemRef as D, isPathItemEntry as E, isSchemaProperty as F, COMPONENT_SUFFIXES as G, ARROW_FUNCTION_PATTERN as H, isSecurityArray as I, HOOK_LIBRARIES as J, FORM_MEDIA_TYPES as K, isSecurityScheme as L, isResponses as M, isSchemaArray as N, isRecord as O, isSchemaObject as P, JSON_MEDIA_TYPE as Q, isSingleSchema as R, isParameterArray as S, isPathItem as T, COMPONENT_NAMES as U, isValidIdent as V, COMPONENT_REF_PREFIX as W, IDENTIFIER_PATTERN as X, HTTP_METHODS as Y, INPUT_EXTENSIONS as Z, isOffsetTime as _, hasTypelessConstraint as a, isOperationLike as b, isDiscriminableBranch as c, isHttpMethod as d, OCTET_STREAM_MEDIA_TYPE as et, isInheritedName as f, isMediaWithSchema as g, isMedia as h, hasRequestBodyContent as i, isRequestBody as j, isRefObject as k, isExamplesInput as l, isInputPath as m, hasNoUserChain as n, isBinaryFile as o, isInlineMedia as p, FORM_URLENCODED_MEDIA_TYPE as q, hasNumericConstraint as r, isCallbacks as s, hasNoContentResponse as t, TEXT_MEDIA_TYPE as tt, isHeader as u, isOpenAPIPaths as v, isParameterRef as w, isParameter as x, isOperation as y, isStringRef as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { O as isRecord, Y as HTTP_METHODS, b as isOperationLike, t as hasNoContentResponse, v as isOpenAPIPaths } from "./guard-
|
|
1
|
+
import { O as isRecord, Y as HTTP_METHODS, b as isOperationLike, t as hasNoContentResponse, v as isOpenAPIPaths } from "./guard-D-yHkxqE.js";
|
|
2
2
|
import { i as GenerateError } from "./format-BF7SbaMP.js";
|
|
3
|
-
import { _ as routeName, n as capitalize, y as toIdentifierPascalCase } from "./utils-
|
|
4
|
-
import { c as makeGroupClientName, i as parsePathItem, l as operationTags, n as makeOperationDeps, r as operationHasArgs, t as formatPath } from "./rpc-
|
|
3
|
+
import { _ as routeName, n as capitalize, y as toIdentifierPascalCase } from "./utils-Kv3B0qkM.js";
|
|
4
|
+
import { c as makeGroupClientName, i as parsePathItem, l as operationTags, n as makeOperationDeps, r as operationHasArgs, t as formatPath } from "./rpc-CVE9_EnW.js";
|
|
5
5
|
import { t as emit } from "./emit-CqkT9T4Q.js";
|
|
6
6
|
import { Effect } from "effect";
|
|
7
7
|
import path from "node:path";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as HOOK_LIBRARIES, U as COMPONENT_NAMES, X as IDENTIFIER_PATTERN, m as isInputPath } from "./guard-
|
|
1
|
+
import { J as HOOK_LIBRARIES, U as COMPONENT_NAMES, X as IDENTIFIER_PATTERN, m as isInputPath } from "./guard-D-yHkxqE.js";
|
|
2
2
|
import { Effect, FileSystem, Schema, SchemaIssue, SchemaTransformation } from "effect";
|
|
3
3
|
import { posix, resolve } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|