hono-takibi 0.9.99999 → 0.10.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
@@ -993,6 +993,17 @@ If you find any issues with the generated code or have suggestions for improveme
993
993
  - Open an issue at [GitHub Issues](https://github.com/nakita628/hono-takibi/issues)
994
994
  - Submit a pull request with your improvements
995
995
 
996
+ Lint and tests run from the repo root:
997
+
998
+ ```bash
999
+ pnpm check # format, lint, type checks, then `pnpm lint`
1000
+ pnpm lint # what the Lint workflow runs
1001
+ pnpm lint:actions # actionlint (syntax) and zizmor (security) over .github/workflows, when installed
1002
+ pnpm test # unit tests, then the generated cases under test/
1003
+ ```
1004
+
1005
+ `actionlint` and `zizmor` are not npm packages: install them with `pipx install actionlint-py` and `pipx install zizmor` to run them locally; without them the script only prints a note. The Lint workflow always runs both.
1006
+
996
1007
  ## License
997
1008
 
998
1009
  Distributed under the MIT License. See [LICENSE](https://github.com/nakita628/hono-takibi?tab=MIT-1-ov-file) for more information.
package/dist/cli.js CHANGED
@@ -71,7 +71,7 @@ function runConfigPass(configPath, reload) {
71
71
  import("./index.js"),
72
72
  import("./openapi-CzAVsFDt.js").then((n) => n.t),
73
73
  import("./format-Bm9LZ_ki.js").then((n) => n.r),
74
- import("./shared-C--8NGku.js").then((n) => n.i)
74
+ import("./shared-Ck7P2pO5.js").then((n) => n.i)
75
75
  ]));
76
76
  const config = yield* readConfig(configPath, reload);
77
77
  const jobs = makeJob(yield* parseOpenAPI(config.input), config);
@@ -204,7 +204,7 @@ function generate(args) {
204
204
  });
205
205
  }
206
206
  if (input !== void 0 && output !== void 0) {
207
- const [{ parseOpenAPI }, { takibi }] = yield* Effect.promise(() => Promise.all([import("./openapi-CzAVsFDt.js").then((n) => n.t), import("./core-BAPac8s5.js").then((n) => n.t)]));
207
+ const [{ parseOpenAPI }, { takibi }] = yield* Effect.promise(() => Promise.all([import("./openapi-CzAVsFDt.js").then((n) => n.t), import("./core-BdG_5KX8.js").then((n) => n.t)]));
208
208
  return yield* Console.log(yield* takibi(yield* parseOpenAPI(input), output, ONE_SHOT_COMPONENTS));
209
209
  }
210
210
  const resolvedConfig = configPath ?? DEFAULT_CONFIG_FILE;
@@ -1,2 +1,2 @@
1
- import { t as hooks } from "../../hooks-CjzX1UzR.js";
1
+ import { t as hooks } from "../../hooks-iffNFEYy.js";
2
2
  export { hooks };
@@ -5,7 +5,7 @@ import { E as isMediaWithSchema, F as isPathItem, I as isPathItemEntry, K as isS
5
5
  import { t as emit } from "./emit-B_3fXoto.js";
6
6
  import { s as GenerateError } from "./rpc-B95CYct5.js";
7
7
  import { S as makeModuleSpec, _ as makeRef, a as responsesCode, b as makeExportConst, c as headersCode, d as ast, f as zodToOpenAPI, g as makePathItem, h as makeOperationResponses, i as schemasCode, l as makeSplitSchemaFile, m as makeCallbacks, n as routeCode, o as requestBodiesCode, p as makeCallback, r as componentsCode, s as parametersCode, t as zodOpenAPIHono, u as analyzeCircularSchemas, v as makeRequest, x as makeImports, y as makeConst } from "./openapi-B2CqQVWF.js";
8
- import { t as hooks } from "./hooks-CjzX1UzR.js";
8
+ import { t as hooks } from "./hooks-iffNFEYy.js";
9
9
  import { t as docs } from "./docs-MzhmjfNS.js";
10
10
  import { rpc } from "./core/rpc/index.js";
11
11
  import { type } from "./core/type/index.js";
@@ -7,6 +7,11 @@ import path from "node:path";
7
7
  function wrapOptionsType(optionsType, unwrapAccessor) {
8
8
  return unwrapAccessor ? `ReturnType<${optionsType}>` : optionsType;
9
9
  }
10
+ const QUERY_OMIT_KEYS = `'queryKey'|'queryFn'`;
11
+ const INFINITE_OMIT_KEYS = `'queryKey'|'queryFn'|'initialPageParam'|'getNextPageParam'`;
12
+ function omitInjectedKeys(optionsType, keys, isVueQuery) {
13
+ return `Omit<${isVueQuery ? `Extract<${optionsType},{queryKey:unknown}>` : optionsType},${keys}>`;
14
+ }
10
15
  function makeHookName(method, pathStr, prefix) {
11
16
  const funcName = methodPath(method, pathStr);
12
17
  return `${prefix}${capitalize(funcName)}`;
@@ -158,7 +163,8 @@ function makeSWRInfiniteHookCode(hookName, infiniteKeyGetterName, hasArgs, argsT
158
163
  */
159
164
  function makeQueryHookCode(hookName, keyGetterName, runtimeAccess, hasArgs, argsType, responseType, config) {
160
165
  const generics = `<TData=${responseType},TError=${config.errorType ?? "unknown"}>`;
161
- const optionsType = `{query?:${wrapOptionsType(`${config.useQueryOptionsType}<${responseType},TError,TData>`, config.unwrapOptionsAccessor)};options?:ClientRequestOptions}`;
166
+ const optionsTypeArgs = config.isVueQuery ? `${responseType},TError,TData,${responseType},ReturnType<typeof ${keyGetterName}>` : `${responseType},TError,TData`;
167
+ const optionsType = `{query?:${omitInjectedKeys(wrapOptionsType(`${config.useQueryOptionsType}<${optionsTypeArgs}>`, config.unwrapOptionsAccessor), QUERY_OMIT_KEYS, config.isVueQuery)};options?:ClientRequestOptions}`;
162
168
  const keyCall = hasArgs ? `${keyGetterName}(args)` : `${keyGetterName}()`;
163
169
  if (config.useThunk) {
164
170
  const argsSig = hasArgs ? `args:()=>${argsType},` : "";
@@ -196,7 +202,7 @@ function makeInfiniteQueryHookCode(hookName, runtimeAccess, infiniteKeyGetterNam
196
202
  const useHelper = config.hasInfiniteQueryOptionsHelper === true;
197
203
  const generics = `<TData=${useHelper ? `InfiniteData<${responseType}>` : responseType},TError=${errorType},TPageParam=unknown>`;
198
204
  const queryKeyType = `ReturnType<typeof ${infiniteKeyGetterName}>`;
199
- const queryOptionsType = wrapOptionsType(`${config.useInfiniteQueryOptionsType}<${responseType},TError,TData,${queryKeyType},TPageParam>`, config.unwrapOptionsAccessor);
205
+ const queryOptionsType = omitInjectedKeys(wrapOptionsType(`${config.useInfiniteQueryOptionsType}<${responseType},TError,TData,${queryKeyType},TPageParam>`, config.unwrapOptionsAccessor), useHelper ? INFINITE_OMIT_KEYS : QUERY_OMIT_KEYS, config.isVueQuery);
200
206
  const optionsType = useHelper ? `{query?:${queryOptionsType};options?:ClientRequestOptions}` : `{query:${queryOptionsType};options?:ClientRequestOptions}`;
201
207
  const requestArgsCall = makeRequestArgsCall(hasArgs);
202
208
  const paginationParam = makePaginationParam(hasArgs, argsType, responseType);
@@ -1,8 +1,8 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
2
  import { a as unlink, i as readdir } from "./file-CwKqigE9.js";
3
3
  import { s as GenerateError } from "./rpc-B95CYct5.js";
4
- import { _ as links, a as defineTemplate, b as callbacks, c as mock, d as responses, f as requestBodies, g as mediaTypes, h as components, i as template, l as securitySchemes, m as parameters, n as webhooks, o as takibi, p as pathItems, r as test, s as route, u as schemas, v as headers, y as examples } from "./core-BAPac8s5.js";
5
- import { t as hooks } from "./hooks-CjzX1UzR.js";
4
+ import { _ as links, a as defineTemplate, b as callbacks, c as mock, d as responses, f as requestBodies, g as mediaTypes, h as components, i as template, l as securitySchemes, m as parameters, n as webhooks, o as takibi, p as pathItems, r as test, s as route, u as schemas, v as headers, y as examples } from "./core-BdG_5KX8.js";
5
+ import { t as hooks } from "./hooks-iffNFEYy.js";
6
6
  import { t as docs } from "./docs-MzhmjfNS.js";
7
7
  import { rpc } from "./core/rpc/index.js";
8
8
  import { type } from "./core/type/index.js";
@@ -3,7 +3,7 @@ import { t as fileSystemLayer } from "../file-CwKqigE9.js";
3
3
  import { t as FormatOptions } from "../format-Bm9LZ_ki.js";
4
4
  import { R as isRecord } from "../utils-BDa05U34.js";
5
5
  import { n as parseOpenAPI } from "../openapi-CzAVsFDt.js";
6
- import { n as cleanSplitOutputs, r as makeJob, t as appEntryOutput } from "../shared-C--8NGku.js";
6
+ import { n as cleanSplitOutputs, r as makeJob, t as appEntryOutput } from "../shared-Ck7P2pO5.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.9.99999",
3
+ "version": "0.10.0",
4
4
  "description": "Hono Takibi is a code generator from OpenAPI to @hono/zod-openapi",
5
5
  "keywords": [
6
6
  "hono",
@@ -56,8 +56,8 @@
56
56
  "dependencies": {
57
57
  "@apidevtools/swagger-parser": "^12.1.0",
58
58
  "@effect/platform-node": "4.0.0-rc.112",
59
- "@typespec/compiler": "^1.15.0",
60
- "@typespec/openapi3": "^1.15.0",
59
+ "@typespec/compiler": "^1.16.0",
60
+ "@typespec/openapi3": "^1.16.0",
61
61
  "effect": "4.0.0-rc.112",
62
62
  "oxfmt": "^0.65.0",
63
63
  "ts-morph": "^28.0.0"
@@ -66,11 +66,11 @@
66
66
  "@faker-js/faker": "^10.6.0",
67
67
  "@hono/zod-openapi": "^1.6.1",
68
68
  "@types/node": "^26.4.0",
69
- "@typespec/http": "^1.15.0",
70
- "@typespec/rest": "^0.85.0",
69
+ "@typespec/http": "^1.16.0",
70
+ "@typespec/rest": "^0.86.0",
71
71
  "hono": "^4.13.5",
72
72
  "typescript": "^7.0.2",
73
- "zod": "^4.4.3"
73
+ "zod": "^4.5.4"
74
74
  },
75
75
  "scripts": {
76
76
  "build": "vp pack",