hono-takibi 0.9.98 → 0.9.99
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 +46 -4
- package/dist/config/index.d.ts +52 -38
- package/dist/config/index.js +34 -83
- package/dist/core/docs/index.d.ts +1 -1
- package/dist/core/docs/index.js +1 -23
- package/dist/core/rpc/index.d.ts +1 -1
- package/dist/core/rpc/index.js +3 -3
- package/dist/core/svelte-query/index.d.ts +1 -1
- package/dist/core/svelte-query/index.js +5 -2
- package/dist/core/swr/index.d.ts +1 -1
- package/dist/core/swr/index.js +5 -2
- package/dist/core/tanstack-query/index.d.ts +1 -1
- package/dist/core/tanstack-query/index.js +10 -2
- package/dist/core/type/index.d.ts +1 -1
- package/dist/core/type/index.js +2 -2
- package/dist/core/vue-query/index.d.ts +1 -1
- package/dist/core/vue-query/index.js +5 -3
- package/dist/{docs-EJtBjiC0.js → docs-BS3qWwsM.js} +41 -18
- package/dist/generator/zod-openapi-hono/openapi/index.d.ts +1 -1
- package/dist/generator/zod-openapi-hono/openapi/index.js +1 -18
- package/dist/{guard-sR2aJ5o7.js → guard-BaWEf02f.js} +15 -1
- package/dist/{hono-rpc-DC-G2VEi.js → hono-rpc-CP5P2snC.js} +2 -9
- package/dist/{index-Dirud7Xt.d.ts → index-Djc2X5Cl.d.ts} +14 -0
- package/dist/index.js +14 -127
- package/dist/{webhooks-Bpm9Djut.js → openapi-BB9b3Dop.js} +250 -87
- package/dist/{openapi-GQ5RidiS.js → openapi-CpUr6Adh.js} +144 -119
- package/dist/query-V4Zp3WIX.js +724 -0
- package/dist/{utils-Bfda9ORl.js → utils-B_qLBvSg.js} +32 -11
- package/dist/vite-plugin/index.js +8 -6
- package/package.json +5 -5
- package/dist/query-B-cMeoTm.js +0 -444
package/README.md
CHANGED
|
@@ -102,6 +102,38 @@ export const getRoute = createRoute({
|
|
|
102
102
|
});
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
## Custom Validation Error Messages
|
|
106
|
+
|
|
107
|
+
Use `x-*` vendor extensions to customize Zod error messages:
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
name:
|
|
111
|
+
type: string
|
|
112
|
+
minLength: 1
|
|
113
|
+
x-error-message: "Name is required"
|
|
114
|
+
x-minimum-message: "Name cannot be empty"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
// Generated output
|
|
119
|
+
z.string({ error: "Name is required" }).min(1, { error: "Name cannot be empty" });
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
| Extension | Applies to |
|
|
123
|
+
|-----------|-----------|
|
|
124
|
+
| `x-error-message` | Schema constructor (`z.string()`, `z.number()`, `z.enum()`, etc.) |
|
|
125
|
+
| `x-minimum-message` | `.min()`, `.gte()` |
|
|
126
|
+
| `x-maximum-message` | `.max()`, `.lte()` |
|
|
127
|
+
| `x-size-message` | `.length()` |
|
|
128
|
+
| `x-pattern-message` | `.regex()` |
|
|
129
|
+
| `x-multipleOf-message` | `.multipleOf()` |
|
|
130
|
+
| `x-enum-error-messages` | Per-value enum messages (`{ "value": "message" }`) |
|
|
131
|
+
| `x-anyOf-message` | `anyOf` |
|
|
132
|
+
| `x-oneOf-message` | `oneOf` |
|
|
133
|
+
| `x-not-message` | `not` |
|
|
134
|
+
| `x-propertyNames-message` | `propertyNames` |
|
|
135
|
+
| `x-dependentRequired-message` | `dependentRequired` |
|
|
136
|
+
|
|
105
137
|
## Vite Plugin
|
|
106
138
|
|
|
107
139
|
Watches your OpenAPI spec and `hono-takibi.config.ts` for changes, then auto-regenerates code on save.
|
|
@@ -132,6 +164,7 @@ export default defineConfig({
|
|
|
132
164
|
template: {
|
|
133
165
|
test: true,
|
|
134
166
|
pathAlias: "@/",
|
|
167
|
+
framework: "bun", // "vitest" (default) | "bun"
|
|
135
168
|
},
|
|
136
169
|
},
|
|
137
170
|
});
|
|
@@ -141,7 +174,7 @@ This generates:
|
|
|
141
174
|
|
|
142
175
|
- `src/index.ts` - App entry point with route registrations
|
|
143
176
|
- `src/handlers/*.ts` - Handler stubs for each resource
|
|
144
|
-
- `src/handlers/*.test.ts` -
|
|
177
|
+
- `src/handlers/*.test.ts` - Test files with `@faker-js/faker` mock data (imports from `vitest` or `bun:test`)
|
|
145
178
|
|
|
146
179
|
Re-running after updating your OpenAPI spec is safe — your hand-written handler logic and test customizations are preserved. Only new routes are added as stubs.
|
|
147
180
|
|
|
@@ -151,12 +184,14 @@ Re-running after updating your OpenAPI spec is safe — your hand-written handle
|
|
|
151
184
|
|
|
152
185
|
#### `routeHandler: false` (default)
|
|
153
186
|
|
|
154
|
-
|
|
187
|
+
Each handler creates its own sub-router and registers routes:
|
|
155
188
|
|
|
156
189
|
```ts
|
|
157
190
|
// src/handlers/health.ts
|
|
191
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
158
192
|
import { getHealthRoute } from "@/routes";
|
|
159
|
-
|
|
193
|
+
|
|
194
|
+
const app = new OpenAPIHono();
|
|
160
195
|
|
|
161
196
|
export const healthHandler = app.openapi(getHealthRoute, (c) => {});
|
|
162
197
|
```
|
|
@@ -166,7 +201,7 @@ The app mounts handlers via `.route()`:
|
|
|
166
201
|
```ts
|
|
167
202
|
// src/index.ts
|
|
168
203
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
169
|
-
import { healthHandler } from "./handlers
|
|
204
|
+
import { healthHandler } from "./handlers";
|
|
170
205
|
|
|
171
206
|
const app = new OpenAPIHono();
|
|
172
207
|
|
|
@@ -234,6 +269,7 @@ export default defineConfig({
|
|
|
234
269
|
test: {
|
|
235
270
|
output: "./src/test.ts",
|
|
236
271
|
import: "../index",
|
|
272
|
+
framework: "bun", // "vitest" (default) | "bun"
|
|
237
273
|
},
|
|
238
274
|
});
|
|
239
275
|
```
|
|
@@ -340,6 +376,7 @@ export default defineConfig({
|
|
|
340
376
|
test: true, // Generate test files
|
|
341
377
|
routeHandler: false, // false: inline .openapi() (default), true: RouteHandler exports
|
|
342
378
|
pathAlias: "@/", // TypeScript path alias for imports
|
|
379
|
+
framework: "vitest", // "vitest" (default) | "bun" — test import source
|
|
343
380
|
},
|
|
344
381
|
|
|
345
382
|
// Export options (OpenAPI Components Object)
|
|
@@ -480,6 +517,7 @@ export default defineConfig({
|
|
|
480
517
|
test: {
|
|
481
518
|
output: "./src/test.ts",
|
|
482
519
|
import: "../index", // Import path for the app instance
|
|
520
|
+
framework: "vitest", // "vitest" (default) | "bun" — test import source
|
|
483
521
|
},
|
|
484
522
|
|
|
485
523
|
// Mock server generation
|
|
@@ -497,6 +535,10 @@ export default defineConfig({
|
|
|
497
535
|
});
|
|
498
536
|
```
|
|
499
537
|
|
|
538
|
+
## Projects Using Hono Takibi
|
|
539
|
+
|
|
540
|
+
- **[resend-local](https://github.com/y-hiraoka/resend-local)** — A local emulator for the Resend email API.
|
|
541
|
+
|
|
500
542
|
## Limitations
|
|
501
543
|
|
|
502
544
|
**This package is in active development and may introduce breaking changes without prior notice.**
|
package/dist/config/index.d.ts
CHANGED
|
@@ -87,6 +87,10 @@ declare const ConfigSchema: z.ZodReadonly<z.ZodPipe<z.ZodObject<{
|
|
|
87
87
|
test: z.ZodDefault<z.ZodBoolean>;
|
|
88
88
|
routeHandler: z.ZodDefault<z.ZodBoolean>;
|
|
89
89
|
pathAlias: z.ZodExactOptional<z.ZodString>;
|
|
90
|
+
framework: z.ZodExactOptional<z.ZodDefault<z.ZodEnum<{
|
|
91
|
+
vitest: "vitest";
|
|
92
|
+
bun: "bun";
|
|
93
|
+
}>>>;
|
|
90
94
|
}, z.core.$strip>>;
|
|
91
95
|
exportSchemas: z.ZodExactOptional<z.ZodBoolean>;
|
|
92
96
|
exportSchemasTypes: z.ZodExactOptional<z.ZodBoolean>;
|
|
@@ -213,6 +217,10 @@ declare const ConfigSchema: z.ZodReadonly<z.ZodPipe<z.ZodObject<{
|
|
|
213
217
|
test: z.ZodExactOptional<z.ZodObject<{
|
|
214
218
|
output: z.ZodCustom<string, string>;
|
|
215
219
|
import: z.ZodString;
|
|
220
|
+
framework: z.ZodExactOptional<z.ZodDefault<z.ZodEnum<{
|
|
221
|
+
vitest: "vitest";
|
|
222
|
+
bun: "bun";
|
|
223
|
+
}>>>;
|
|
216
224
|
}, z.core.$strip>>;
|
|
217
225
|
mock: z.ZodExactOptional<z.ZodObject<{
|
|
218
226
|
output: z.ZodCustom<string, string>;
|
|
@@ -224,44 +232,6 @@ declare const ConfigSchema: z.ZodReadonly<z.ZodPipe<z.ZodObject<{
|
|
|
224
232
|
baseUrl: z.ZodExactOptional<z.ZodString>;
|
|
225
233
|
}, z.core.$strip>>;
|
|
226
234
|
}, z.core.$strip>, z.ZodTransform<{
|
|
227
|
-
mock?: {
|
|
228
|
-
output: string;
|
|
229
|
-
};
|
|
230
|
-
test?: {
|
|
231
|
-
output: string;
|
|
232
|
-
import: string;
|
|
233
|
-
};
|
|
234
|
-
'vue-query'?: {
|
|
235
|
-
output: string;
|
|
236
|
-
import: string;
|
|
237
|
-
split?: boolean;
|
|
238
|
-
client?: string;
|
|
239
|
-
};
|
|
240
|
-
'svelte-query'?: {
|
|
241
|
-
output: string;
|
|
242
|
-
import: string;
|
|
243
|
-
split?: boolean;
|
|
244
|
-
client?: string;
|
|
245
|
-
};
|
|
246
|
-
'tanstack-query'?: {
|
|
247
|
-
output: string;
|
|
248
|
-
import: string;
|
|
249
|
-
split?: boolean;
|
|
250
|
-
client?: string;
|
|
251
|
-
};
|
|
252
|
-
swr?: {
|
|
253
|
-
output: string;
|
|
254
|
-
import: string;
|
|
255
|
-
split?: boolean;
|
|
256
|
-
client?: string;
|
|
257
|
-
};
|
|
258
|
-
rpc?: {
|
|
259
|
-
output: string;
|
|
260
|
-
import: string;
|
|
261
|
-
split?: boolean;
|
|
262
|
-
client?: string;
|
|
263
|
-
parseResponse?: boolean;
|
|
264
|
-
};
|
|
265
235
|
'zod-openapi'?: {
|
|
266
236
|
output?: `${string}.ts`;
|
|
267
237
|
readonly?: boolean;
|
|
@@ -269,6 +239,7 @@ declare const ConfigSchema: z.ZodReadonly<z.ZodPipe<z.ZodObject<{
|
|
|
269
239
|
test: boolean;
|
|
270
240
|
routeHandler: boolean;
|
|
271
241
|
pathAlias?: string;
|
|
242
|
+
framework?: "vitest" | "bun";
|
|
272
243
|
};
|
|
273
244
|
exportSchemas?: boolean;
|
|
274
245
|
exportSchemasTypes?: boolean;
|
|
@@ -407,6 +378,45 @@ declare const ConfigSchema: z.ZodReadonly<z.ZodPipe<z.ZodObject<{
|
|
|
407
378
|
output: `${string}.ts`;
|
|
408
379
|
readonly?: boolean;
|
|
409
380
|
};
|
|
381
|
+
rpc?: {
|
|
382
|
+
output: string;
|
|
383
|
+
import: string;
|
|
384
|
+
split?: boolean;
|
|
385
|
+
client?: string;
|
|
386
|
+
parseResponse?: boolean;
|
|
387
|
+
};
|
|
388
|
+
swr?: {
|
|
389
|
+
output: string;
|
|
390
|
+
import: string;
|
|
391
|
+
split?: boolean;
|
|
392
|
+
client?: string;
|
|
393
|
+
};
|
|
394
|
+
'tanstack-query'?: {
|
|
395
|
+
output: string;
|
|
396
|
+
import: string;
|
|
397
|
+
split?: boolean;
|
|
398
|
+
client?: string;
|
|
399
|
+
};
|
|
400
|
+
'svelte-query'?: {
|
|
401
|
+
output: string;
|
|
402
|
+
import: string;
|
|
403
|
+
split?: boolean;
|
|
404
|
+
client?: string;
|
|
405
|
+
};
|
|
406
|
+
'vue-query'?: {
|
|
407
|
+
output: string;
|
|
408
|
+
import: string;
|
|
409
|
+
split?: boolean;
|
|
410
|
+
client?: string;
|
|
411
|
+
};
|
|
412
|
+
test?: {
|
|
413
|
+
output: string;
|
|
414
|
+
import: string;
|
|
415
|
+
framework?: "vitest" | "bun";
|
|
416
|
+
};
|
|
417
|
+
mock?: {
|
|
418
|
+
output: string;
|
|
419
|
+
};
|
|
410
420
|
docs?: {
|
|
411
421
|
output: `${string}.md`;
|
|
412
422
|
entry?: string;
|
|
@@ -467,6 +477,7 @@ declare const ConfigSchema: z.ZodReadonly<z.ZodPipe<z.ZodObject<{
|
|
|
467
477
|
test: boolean;
|
|
468
478
|
routeHandler: boolean;
|
|
469
479
|
pathAlias?: string;
|
|
480
|
+
framework?: "vitest" | "bun";
|
|
470
481
|
};
|
|
471
482
|
exportSchemas?: boolean;
|
|
472
483
|
exportSchemasTypes?: boolean;
|
|
@@ -593,6 +604,7 @@ declare const ConfigSchema: z.ZodReadonly<z.ZodPipe<z.ZodObject<{
|
|
|
593
604
|
test?: {
|
|
594
605
|
output: string;
|
|
595
606
|
import: string;
|
|
607
|
+
framework?: "vitest" | "bun";
|
|
596
608
|
};
|
|
597
609
|
mock?: {
|
|
598
610
|
output: string;
|
|
@@ -683,6 +695,7 @@ declare function defineConfig(config: ConfigInput): Readonly<{
|
|
|
683
695
|
test?: boolean | undefined;
|
|
684
696
|
routeHandler?: boolean | undefined;
|
|
685
697
|
pathAlias?: string;
|
|
698
|
+
framework?: "vitest" | "bun" | undefined;
|
|
686
699
|
};
|
|
687
700
|
exportSchemas?: boolean;
|
|
688
701
|
exportSchemasTypes?: boolean;
|
|
@@ -809,6 +822,7 @@ declare function defineConfig(config: ConfigInput): Readonly<{
|
|
|
809
822
|
test?: {
|
|
810
823
|
output: string;
|
|
811
824
|
import: string;
|
|
825
|
+
framework?: "vitest" | "bun" | undefined;
|
|
812
826
|
};
|
|
813
827
|
mock?: {
|
|
814
828
|
output: string;
|
package/dist/config/index.js
CHANGED
|
@@ -78,7 +78,8 @@ const ConfigSchema = z.object({
|
|
|
78
78
|
template: z.object({
|
|
79
79
|
test: z.boolean().default(false),
|
|
80
80
|
routeHandler: z.boolean().default(false),
|
|
81
|
-
pathAlias: z.string().exactOptional()
|
|
81
|
+
pathAlias: z.string().exactOptional(),
|
|
82
|
+
framework: z.enum(["vitest", "bun"]).default("vitest").exactOptional()
|
|
82
83
|
}).exactOptional(),
|
|
83
84
|
exportSchemas: z.boolean().exactOptional(),
|
|
84
85
|
exportSchemasTypes: z.boolean().exactOptional(),
|
|
@@ -204,7 +205,8 @@ const ConfigSchema = z.object({
|
|
|
204
205
|
}).refine((v) => !(v.split === true && v.output.endsWith(".ts")), { message: "split mode requires directory, not .ts file" }).exactOptional(),
|
|
205
206
|
test: z.object({
|
|
206
207
|
output: z.custom((v) => typeof v === "string"),
|
|
207
|
-
import: z.string()
|
|
208
|
+
import: z.string(),
|
|
209
|
+
framework: z.enum(["vitest", "bun"]).default("vitest").exactOptional()
|
|
208
210
|
}).exactOptional(),
|
|
209
211
|
mock: z.object({ output: z.custom((v) => typeof v === "string") }).exactOptional(),
|
|
210
212
|
docs: z.object({
|
|
@@ -214,94 +216,43 @@ const ConfigSchema = z.object({
|
|
|
214
216
|
baseUrl: z.string().exactOptional()
|
|
215
217
|
}).refine((v) => !(v.curl === true && v.entry !== void 0), { message: "entry cannot be specified when curl is true" }).refine((v) => !(v.curl === true && v.baseUrl === void 0), { message: "baseUrl is required when curl is true" }).exactOptional()
|
|
216
218
|
}).transform((config) => {
|
|
217
|
-
const normalize = (
|
|
219
|
+
const normalize = (v) => ({
|
|
220
|
+
...v,
|
|
221
|
+
output: v.split !== true && !v.output.endsWith(".ts") ? `${v.output}/index.ts` : v.output
|
|
222
|
+
});
|
|
223
|
+
const normalized = Object.fromEntries([
|
|
224
|
+
"rpc",
|
|
225
|
+
"swr",
|
|
226
|
+
"tanstack-query",
|
|
227
|
+
"svelte-query",
|
|
228
|
+
"vue-query",
|
|
229
|
+
"test",
|
|
230
|
+
"mock"
|
|
231
|
+
].flatMap((k) => {
|
|
232
|
+
const v = config[k];
|
|
233
|
+
return v !== void 0 ? [[k, normalize(v)]] : [];
|
|
234
|
+
}));
|
|
218
235
|
return {
|
|
219
236
|
...config,
|
|
220
237
|
...config["zod-openapi"] && { "zod-openapi": {
|
|
221
238
|
...config["zod-openapi"],
|
|
222
|
-
...config["zod-openapi"].routes && { routes:
|
|
223
|
-
...config["zod-openapi"].routes,
|
|
224
|
-
output: normalize(config["zod-openapi"].routes.output, config["zod-openapi"].routes.split)
|
|
225
|
-
} },
|
|
239
|
+
...config["zod-openapi"].routes && { routes: normalize(config["zod-openapi"].routes) },
|
|
226
240
|
...config["zod-openapi"].components && { components: {
|
|
227
|
-
...config["zod-openapi"].components.schemas && { schemas:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
...config["zod-openapi"].components.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
...config["zod-openapi"].components.
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
...config["zod-openapi"].components.securitySchemes && { securitySchemes: {
|
|
240
|
-
...config["zod-openapi"].components.securitySchemes,
|
|
241
|
-
output: normalize(config["zod-openapi"].components.securitySchemes.output, config["zod-openapi"].components.securitySchemes.split)
|
|
242
|
-
} },
|
|
243
|
-
...config["zod-openapi"].components.requestBodies && { requestBodies: {
|
|
244
|
-
...config["zod-openapi"].components.requestBodies,
|
|
245
|
-
output: normalize(config["zod-openapi"].components.requestBodies.output, config["zod-openapi"].components.requestBodies.split)
|
|
246
|
-
} },
|
|
247
|
-
...config["zod-openapi"].components.responses && { responses: {
|
|
248
|
-
...config["zod-openapi"].components.responses,
|
|
249
|
-
output: normalize(config["zod-openapi"].components.responses.output, config["zod-openapi"].components.responses.split)
|
|
250
|
-
} },
|
|
251
|
-
...config["zod-openapi"].components.examples && { examples: {
|
|
252
|
-
...config["zod-openapi"].components.examples,
|
|
253
|
-
output: normalize(config["zod-openapi"].components.examples.output, config["zod-openapi"].components.examples.split)
|
|
254
|
-
} },
|
|
255
|
-
...config["zod-openapi"].components.links && { links: {
|
|
256
|
-
...config["zod-openapi"].components.links,
|
|
257
|
-
output: normalize(config["zod-openapi"].components.links.output, config["zod-openapi"].components.links.split)
|
|
258
|
-
} },
|
|
259
|
-
...config["zod-openapi"].components.callbacks && { callbacks: {
|
|
260
|
-
...config["zod-openapi"].components.callbacks,
|
|
261
|
-
output: normalize(config["zod-openapi"].components.callbacks.output, config["zod-openapi"].components.callbacks.split)
|
|
262
|
-
} },
|
|
263
|
-
...config["zod-openapi"].components.pathItems && { pathItems: {
|
|
264
|
-
...config["zod-openapi"].components.pathItems,
|
|
265
|
-
output: normalize(config["zod-openapi"].components.pathItems.output, config["zod-openapi"].components.pathItems.split)
|
|
266
|
-
} },
|
|
267
|
-
...config["zod-openapi"].components.mediaTypes && { mediaTypes: {
|
|
268
|
-
...config["zod-openapi"].components.mediaTypes,
|
|
269
|
-
output: normalize(config["zod-openapi"].components.mediaTypes.output, config["zod-openapi"].components.mediaTypes.split)
|
|
270
|
-
} },
|
|
271
|
-
...config["zod-openapi"].components.webhooks && { webhooks: {
|
|
272
|
-
...config["zod-openapi"].components.webhooks,
|
|
273
|
-
output: normalize(config["zod-openapi"].components.webhooks.output, config["zod-openapi"].components.webhooks.split)
|
|
274
|
-
} }
|
|
241
|
+
...config["zod-openapi"].components.schemas && { schemas: normalize(config["zod-openapi"].components.schemas) },
|
|
242
|
+
...config["zod-openapi"].components.parameters && { parameters: normalize(config["zod-openapi"].components.parameters) },
|
|
243
|
+
...config["zod-openapi"].components.headers && { headers: normalize(config["zod-openapi"].components.headers) },
|
|
244
|
+
...config["zod-openapi"].components.securitySchemes && { securitySchemes: normalize(config["zod-openapi"].components.securitySchemes) },
|
|
245
|
+
...config["zod-openapi"].components.requestBodies && { requestBodies: normalize(config["zod-openapi"].components.requestBodies) },
|
|
246
|
+
...config["zod-openapi"].components.responses && { responses: normalize(config["zod-openapi"].components.responses) },
|
|
247
|
+
...config["zod-openapi"].components.examples && { examples: normalize(config["zod-openapi"].components.examples) },
|
|
248
|
+
...config["zod-openapi"].components.links && { links: normalize(config["zod-openapi"].components.links) },
|
|
249
|
+
...config["zod-openapi"].components.callbacks && { callbacks: normalize(config["zod-openapi"].components.callbacks) },
|
|
250
|
+
...config["zod-openapi"].components.pathItems && { pathItems: normalize(config["zod-openapi"].components.pathItems) },
|
|
251
|
+
...config["zod-openapi"].components.mediaTypes && { mediaTypes: normalize(config["zod-openapi"].components.mediaTypes) },
|
|
252
|
+
...config["zod-openapi"].components.webhooks && { webhooks: normalize(config["zod-openapi"].components.webhooks) }
|
|
275
253
|
} }
|
|
276
254
|
} },
|
|
277
|
-
...
|
|
278
|
-
...config.rpc,
|
|
279
|
-
output: normalize(config.rpc.output, config.rpc.split)
|
|
280
|
-
} },
|
|
281
|
-
...config.swr && { swr: {
|
|
282
|
-
...config.swr,
|
|
283
|
-
output: normalize(config.swr.output, config.swr.split)
|
|
284
|
-
} },
|
|
285
|
-
...config["tanstack-query"] && { "tanstack-query": {
|
|
286
|
-
...config["tanstack-query"],
|
|
287
|
-
output: normalize(config["tanstack-query"].output, config["tanstack-query"].split)
|
|
288
|
-
} },
|
|
289
|
-
...config["svelte-query"] && { "svelte-query": {
|
|
290
|
-
...config["svelte-query"],
|
|
291
|
-
output: normalize(config["svelte-query"].output, config["svelte-query"].split)
|
|
292
|
-
} },
|
|
293
|
-
...config["vue-query"] && { "vue-query": {
|
|
294
|
-
...config["vue-query"],
|
|
295
|
-
output: normalize(config["vue-query"].output, config["vue-query"].split)
|
|
296
|
-
} },
|
|
297
|
-
...config.test && { test: {
|
|
298
|
-
...config.test,
|
|
299
|
-
output: config.test.output.endsWith(".ts") ? config.test.output : `${config.test.output}/index.ts`
|
|
300
|
-
} },
|
|
301
|
-
...config.mock && { mock: {
|
|
302
|
-
...config.mock,
|
|
303
|
-
output: config.mock.output.endsWith(".ts") ? config.mock.output : `${config.mock.output}/index.ts`
|
|
304
|
-
} }
|
|
255
|
+
...normalized
|
|
305
256
|
};
|
|
306
257
|
}).readonly();
|
|
307
258
|
/**
|
package/dist/core/docs/index.js
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as makeDocs } from "../../docs-EJtBjiC0.js";
|
|
3
|
-
import path from "node:path";
|
|
1
|
+
import { n as makeDocs, t as docs } from "../../docs-BS3qWwsM.js";
|
|
4
2
|
|
|
5
|
-
//#region src/core/docs/index.ts
|
|
6
|
-
async function docs(openAPI, output, entry = "src/index.ts", basePath = "/", curl = false, baseUrl) {
|
|
7
|
-
const markdown = makeDocs(openAPI, entry, basePath, curl, baseUrl);
|
|
8
|
-
const mkdirResult = await mkdir(path.dirname(output));
|
|
9
|
-
if (!mkdirResult.ok) return {
|
|
10
|
-
ok: false,
|
|
11
|
-
error: mkdirResult.error
|
|
12
|
-
};
|
|
13
|
-
const writeResult = await writeFile(output, markdown);
|
|
14
|
-
if (!writeResult.ok) return {
|
|
15
|
-
ok: false,
|
|
16
|
-
error: writeResult.error
|
|
17
|
-
};
|
|
18
|
-
return {
|
|
19
|
-
ok: true,
|
|
20
|
-
value: `Generated docs written to ${output}`
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
3
|
export { docs, makeDocs };
|
package/dist/core/rpc/index.d.ts
CHANGED
package/dist/core/rpc/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as isOperationLike, f as isRecord, o as isOpenAPIPaths } from "../../guard-BaWEf02f.js";
|
|
2
|
+
import { l as methodPath, o as makeInferRequestType, s as makeOperationDocs } from "../../utils-B_qLBvSg.js";
|
|
3
3
|
import { t as core } from "../../core-BV2z-qh-.js";
|
|
4
|
-
import { a as
|
|
4
|
+
import { a as parsePathItem, i as operationHasArgs, o as resolveSplitOutDir, r as makeOperationDeps, t as formatPath } from "../../hono-rpc-CP5P2snC.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
|
|
7
7
|
//#region src/core/rpc/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as makeQueryHooks } from "../../query-
|
|
1
|
+
import { t as makeQueryHooks } from "../../query-V4Zp3WIX.js";
|
|
2
2
|
|
|
3
3
|
//#region src/core/svelte-query/index.ts
|
|
4
4
|
/**
|
|
@@ -23,7 +23,10 @@ async function svelteQuery(openAPI, output, importPath, split, clientName = "cli
|
|
|
23
23
|
mutationFn: "createMutation",
|
|
24
24
|
useThunk: true,
|
|
25
25
|
useQueryOptionsType: "CreateQueryOptions",
|
|
26
|
-
useMutationOptionsType: "CreateMutationOptions"
|
|
26
|
+
useMutationOptionsType: "CreateMutationOptions",
|
|
27
|
+
hasQueryOptionsHelper: true,
|
|
28
|
+
infiniteQueryFn: "createInfiniteQuery",
|
|
29
|
+
useInfiniteQueryOptionsType: "CreateInfiniteQueryOptions"
|
|
27
30
|
}, split, clientName);
|
|
28
31
|
}
|
|
29
32
|
|
package/dist/core/swr/index.d.ts
CHANGED
package/dist/core/swr/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as makeQueryHooks } from "../../query-
|
|
1
|
+
import { t as makeQueryHooks } from "../../query-V4Zp3WIX.js";
|
|
2
2
|
|
|
3
3
|
//#region src/core/swr/index.ts
|
|
4
4
|
/**
|
|
@@ -23,7 +23,10 @@ async function swr(openAPI, output, importPath, split, clientName = "client") {
|
|
|
23
23
|
mutationFn: "useSWRMutation",
|
|
24
24
|
useQueryOptionsType: "SWRConfiguration",
|
|
25
25
|
useMutationOptionsType: "SWRMutationConfiguration",
|
|
26
|
-
isSWR: true
|
|
26
|
+
isSWR: true,
|
|
27
|
+
immutableQueryFn: "useSWRImmutable",
|
|
28
|
+
infiniteQueryFn: "useSWRInfinite",
|
|
29
|
+
useInfiniteQueryOptionsType: "SWRInfiniteConfiguration"
|
|
27
30
|
}, split, clientName);
|
|
28
31
|
if (result.ok) {
|
|
29
32
|
if (split) return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as makeQueryHooks } from "../../query-
|
|
1
|
+
import { t as makeQueryHooks } from "../../query-V4Zp3WIX.js";
|
|
2
2
|
|
|
3
3
|
//#region src/core/tanstack-query/index.ts
|
|
4
4
|
/**
|
|
@@ -22,7 +22,15 @@ async function tanstackQuery(openAPI, output, importPath, split, clientName = "c
|
|
|
22
22
|
queryFn: "useQuery",
|
|
23
23
|
mutationFn: "useMutation",
|
|
24
24
|
useQueryOptionsType: "UseQueryOptions",
|
|
25
|
-
useMutationOptionsType: "UseMutationOptions"
|
|
25
|
+
useMutationOptionsType: "UseMutationOptions",
|
|
26
|
+
hasQueryOptionsHelper: true,
|
|
27
|
+
hasMutationOptionsHelper: true,
|
|
28
|
+
suspenseQueryFn: "useSuspenseQuery",
|
|
29
|
+
infiniteQueryFn: "useInfiniteQuery",
|
|
30
|
+
suspenseInfiniteQueryFn: "useSuspenseInfiniteQuery",
|
|
31
|
+
useSuspenseQueryOptionsType: "UseSuspenseQueryOptions",
|
|
32
|
+
useInfiniteQueryOptionsType: "UseInfiniteQueryOptions",
|
|
33
|
+
useSuspenseInfiniteQueryOptionsType: "UseSuspenseInfiniteQueryOptions"
|
|
26
34
|
}, split, clientName);
|
|
27
35
|
}
|
|
28
36
|
|
package/dist/core/type/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { b as isStringRef, g as isSchemaArray, i as isMediaWithSchema, l as isParameter, m as isRequestBody, n as isHttpMethod, s as isOperation, u as isParameterArray } from "../../guard-BaWEf02f.js";
|
|
2
|
+
import { c as makeSafeKey } from "../../utils-B_qLBvSg.js";
|
|
3
3
|
import { t as core } from "../../core-BV2z-qh-.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as makeQueryHooks } from "../../query-
|
|
1
|
+
import { t as makeQueryHooks } from "../../query-V4Zp3WIX.js";
|
|
2
2
|
|
|
3
3
|
//#region src/core/vue-query/index.ts
|
|
4
4
|
/**
|
|
@@ -23,8 +23,10 @@ async function vueQuery(openAPI, output, importPath, split, clientName = "client
|
|
|
23
23
|
mutationFn: "useMutation",
|
|
24
24
|
useQueryOptionsType: "UseQueryOptions",
|
|
25
25
|
useMutationOptionsType: "UseMutationOptions",
|
|
26
|
-
|
|
27
|
-
isVueQuery: true
|
|
26
|
+
hasQueryOptionsHelper: true,
|
|
27
|
+
isVueQuery: true,
|
|
28
|
+
infiniteQueryFn: "useInfiniteQuery",
|
|
29
|
+
useInfiniteQueryOptionsType: "UseInfiniteQueryOptions"
|
|
28
30
|
}, split, clientName);
|
|
29
31
|
}
|
|
30
32
|
|