hono-takibi 0.9.9996 → 0.9.9997
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/config/index.d.ts +4 -4
- package/dist/config/index.js +72 -220
- package/dist/core/docs/index.d.ts +1 -1
- package/dist/core/docs/index.js +1 -1
- package/dist/core/hooks/index.d.ts +122 -0
- package/dist/core/hooks/index.js +2 -0
- package/dist/core/rpc/index.d.ts +1 -1
- package/dist/core/rpc/index.js +2 -3
- package/dist/core/type/index.d.ts +1 -1
- package/dist/core/type/index.js +1 -2
- package/dist/{docs-BAt1_N22.js → docs-D6Vw7rcN.js} +8 -7
- package/dist/generator/zod-openapi-hono/openapi/index.d.ts +1 -1
- package/dist/generator/zod-openapi-hono/openapi/index.js +1 -1
- package/dist/{utils-Dhc0-ra6.js → guard-DWr6QVCo.js} +130 -12
- package/dist/{query-nt-tOucg.js → hooks-9DoWHJ6y.js} +141 -23
- package/dist/{index-D8guYWoV.d.ts → index-CGhcPgew.d.ts} +3 -3
- package/dist/index.js +6 -64
- package/dist/{openapi-DNST00z0.js → openapi-B5hESREK.js} +82 -74
- package/dist/{rpc-BzPo2tZf.js → rpc-DV5n7BOG.js} +1 -1
- package/dist/{openapi-DwwK7GTc.js → shared-DWuGN1cr.js} +187 -6
- package/dist/vite-plugin/index.js +15 -201
- package/package.json +6 -30
- package/dist/core/angular-query/index.d.ts +0 -13
- package/dist/core/angular-query/index.js +0 -21
- package/dist/core/preact-query/index.d.ts +0 -13
- package/dist/core/preact-query/index.js +0 -24
- package/dist/core/solid-query/index.d.ts +0 -13
- package/dist/core/solid-query/index.js +0 -20
- package/dist/core/svelte-query/index.d.ts +0 -13
- package/dist/core/svelte-query/index.js +0 -20
- package/dist/core/swr/index.d.ts +0 -13
- package/dist/core/swr/index.js +0 -19
- package/dist/core/tanstack-query/index.d.ts +0 -13
- package/dist/core/tanstack-query/index.js +0 -24
- package/dist/core/vue-query/index.d.ts +0 -13
- package/dist/core/vue-query/index.js +0 -18
- package/dist/guard-BSZ8ezEv.js +0 -83
package/dist/config/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as z from "zod";
|
|
|
4
4
|
//#region src/config/index.d.ts
|
|
5
5
|
declare const ConfigSchema: z.ZodReadonly<z.ZodObject<{
|
|
6
6
|
input: z.ZodTemplateLiteral<`${string}.yaml` | `${string}.json` | `${string}.tsp`>;
|
|
7
|
-
basePath: z.
|
|
7
|
+
basePath: z.ZodDefault<z.ZodString>;
|
|
8
8
|
format: z.ZodExactOptional<z.ZodCustom<FormatConfig, FormatConfig>>;
|
|
9
9
|
'zod-openapi': z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
10
10
|
output: z.ZodExactOptional<z.ZodTemplateLiteral<`${string}.ts`>>;
|
|
@@ -290,7 +290,7 @@ declare function parseConfig(config: unknown): {
|
|
|
290
290
|
readonly ok: true;
|
|
291
291
|
readonly value: Readonly<{
|
|
292
292
|
input: `${string}.yaml` | `${string}.json` | `${string}.tsp`;
|
|
293
|
-
basePath
|
|
293
|
+
basePath: string;
|
|
294
294
|
format?: FormatConfig;
|
|
295
295
|
'zod-openapi'?: Readonly<{
|
|
296
296
|
exportSchemas: boolean;
|
|
@@ -570,7 +570,7 @@ declare function readConfig(): Promise<{
|
|
|
570
570
|
readonly ok: true;
|
|
571
571
|
readonly value: Readonly<{
|
|
572
572
|
input: `${string}.yaml` | `${string}.json` | `${string}.tsp`;
|
|
573
|
-
basePath
|
|
573
|
+
basePath: string;
|
|
574
574
|
format?: FormatConfig;
|
|
575
575
|
'zod-openapi'?: Readonly<{
|
|
576
576
|
exportSchemas: boolean;
|
|
@@ -847,7 +847,7 @@ declare function readConfig(): Promise<{
|
|
|
847
847
|
}>;
|
|
848
848
|
declare function defineConfig(config: z.input<typeof ConfigSchema>): Readonly<{
|
|
849
849
|
input: `${string}.yaml` | `${string}.json` | `${string}.tsp`;
|
|
850
|
-
basePath?: string;
|
|
850
|
+
basePath?: string | undefined;
|
|
851
851
|
format?: FormatConfig;
|
|
852
852
|
'zod-openapi'?: Readonly<{
|
|
853
853
|
output?: `${string}.ts`;
|
package/dist/config/index.js
CHANGED
|
@@ -4,13 +4,61 @@ import { pathToFileURL } from "node:url";
|
|
|
4
4
|
import "oxfmt";
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
//#region src/config/index.ts
|
|
7
|
+
const DirectoryOutputSchema = z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" });
|
|
8
|
+
const FileOutputSchema = z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`);
|
|
9
|
+
const OutputSchema = z.discriminatedUnion("split", [z.object({
|
|
10
|
+
split: z.literal(true),
|
|
11
|
+
output: DirectoryOutputSchema,
|
|
12
|
+
import: z.string().exactOptional()
|
|
13
|
+
}).readonly(), z.object({
|
|
14
|
+
split: z.literal(false).optional().default(false),
|
|
15
|
+
output: FileOutputSchema,
|
|
16
|
+
import: z.string().exactOptional()
|
|
17
|
+
}).readonly()]).exactOptional();
|
|
18
|
+
const ExportTypesOutputSchema = z.discriminatedUnion("split", [z.object({
|
|
19
|
+
split: z.literal(true),
|
|
20
|
+
output: DirectoryOutputSchema,
|
|
21
|
+
import: z.string().exactOptional(),
|
|
22
|
+
exportTypes: z.boolean().default(false)
|
|
23
|
+
}).readonly(), z.object({
|
|
24
|
+
split: z.literal(false).optional().default(false),
|
|
25
|
+
output: FileOutputSchema,
|
|
26
|
+
import: z.string().exactOptional(),
|
|
27
|
+
exportTypes: z.boolean().default(false)
|
|
28
|
+
}).readonly()]).exactOptional();
|
|
29
|
+
const HooksSchema = z.discriminatedUnion("split", [z.object({
|
|
30
|
+
split: z.literal(true),
|
|
31
|
+
output: DirectoryOutputSchema,
|
|
32
|
+
import: z.string(),
|
|
33
|
+
client: z.string().default("client")
|
|
34
|
+
}).readonly(), z.object({
|
|
35
|
+
split: z.literal(false).optional().default(false),
|
|
36
|
+
output: FileOutputSchema,
|
|
37
|
+
import: z.string(),
|
|
38
|
+
client: z.string().default("client")
|
|
39
|
+
}).readonly()]).exactOptional();
|
|
40
|
+
const RpcSchema = z.discriminatedUnion("split", [z.object({
|
|
41
|
+
split: z.literal(true),
|
|
42
|
+
output: DirectoryOutputSchema,
|
|
43
|
+
import: z.string(),
|
|
44
|
+
client: z.string().default("client"),
|
|
45
|
+
parseResponse: z.boolean().default(false),
|
|
46
|
+
docs: z.boolean().default(false)
|
|
47
|
+
}).readonly(), z.object({
|
|
48
|
+
split: z.literal(false).optional().default(false),
|
|
49
|
+
output: FileOutputSchema,
|
|
50
|
+
import: z.string(),
|
|
51
|
+
client: z.string().default("client"),
|
|
52
|
+
parseResponse: z.boolean().default(false),
|
|
53
|
+
docs: z.boolean().default(false)
|
|
54
|
+
}).readonly()]).exactOptional();
|
|
7
55
|
const ConfigSchema = z.object({
|
|
8
56
|
input: z.templateLiteral([z.string().min(1), z.enum([
|
|
9
57
|
".yaml",
|
|
10
58
|
".json",
|
|
11
59
|
".tsp"
|
|
12
60
|
])], { error: "must be .yaml | .json | .tsp" }),
|
|
13
|
-
basePath: z.string().
|
|
61
|
+
basePath: z.string().default("/"),
|
|
14
62
|
format: z.custom(() => true).exactOptional(),
|
|
15
63
|
"zod-openapi": z.object({
|
|
16
64
|
output: z.templateLiteral([z.string().min(1), z.enum([".ts"])], { error: "must be .ts file" }).exactOptional(),
|
|
@@ -40,232 +88,36 @@ const ConfigSchema = z.object({
|
|
|
40
88
|
exportPathItems: z.boolean().default(false),
|
|
41
89
|
exportMediaTypes: z.boolean().default(false),
|
|
42
90
|
exportMediaTypesTypes: z.boolean().default(false),
|
|
43
|
-
routes:
|
|
44
|
-
|
|
45
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
46
|
-
import: z.string().exactOptional()
|
|
47
|
-
}).readonly(), z.object({
|
|
48
|
-
split: z.literal(false).optional().default(false),
|
|
49
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
50
|
-
import: z.string().exactOptional()
|
|
51
|
-
}).readonly()]).exactOptional(),
|
|
52
|
-
webhooks: z.discriminatedUnion("split", [z.object({
|
|
53
|
-
split: z.literal(true),
|
|
54
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
55
|
-
import: z.string().exactOptional()
|
|
56
|
-
}).readonly(), z.object({
|
|
57
|
-
split: z.literal(false).optional().default(false),
|
|
58
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
59
|
-
import: z.string().exactOptional()
|
|
60
|
-
}).readonly()]).exactOptional(),
|
|
91
|
+
routes: OutputSchema,
|
|
92
|
+
webhooks: OutputSchema,
|
|
61
93
|
components: z.object({
|
|
62
|
-
schemas:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
responses: z.discriminatedUnion("split", [z.object({
|
|
74
|
-
split: z.literal(true),
|
|
75
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
76
|
-
import: z.string().exactOptional()
|
|
77
|
-
}).readonly(), z.object({
|
|
78
|
-
split: z.literal(false).optional().default(false),
|
|
79
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
80
|
-
import: z.string().exactOptional()
|
|
81
|
-
}).readonly()]).exactOptional(),
|
|
82
|
-
parameters: z.discriminatedUnion("split", [z.object({
|
|
83
|
-
split: z.literal(true),
|
|
84
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
85
|
-
import: z.string().exactOptional(),
|
|
86
|
-
exportTypes: z.boolean().default(false)
|
|
87
|
-
}).readonly(), z.object({
|
|
88
|
-
split: z.literal(false).optional().default(false),
|
|
89
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
90
|
-
import: z.string().exactOptional(),
|
|
91
|
-
exportTypes: z.boolean().default(false)
|
|
92
|
-
}).readonly()]).exactOptional(),
|
|
93
|
-
examples: z.discriminatedUnion("split", [z.object({
|
|
94
|
-
split: z.literal(true),
|
|
95
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
96
|
-
import: z.string().exactOptional()
|
|
97
|
-
}).readonly(), z.object({
|
|
98
|
-
split: z.literal(false).optional().default(false),
|
|
99
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
100
|
-
import: z.string().exactOptional()
|
|
101
|
-
}).readonly()]).exactOptional(),
|
|
102
|
-
requestBodies: z.discriminatedUnion("split", [z.object({
|
|
103
|
-
split: z.literal(true),
|
|
104
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
105
|
-
import: z.string().exactOptional()
|
|
106
|
-
}).readonly(), z.object({
|
|
107
|
-
split: z.literal(false).optional().default(false),
|
|
108
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
109
|
-
import: z.string().exactOptional()
|
|
110
|
-
}).readonly()]).exactOptional(),
|
|
111
|
-
headers: z.discriminatedUnion("split", [z.object({
|
|
112
|
-
split: z.literal(true),
|
|
113
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
114
|
-
import: z.string().exactOptional(),
|
|
115
|
-
exportTypes: z.boolean().default(false)
|
|
116
|
-
}).readonly(), z.object({
|
|
117
|
-
split: z.literal(false).optional().default(false),
|
|
118
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
119
|
-
import: z.string().exactOptional(),
|
|
120
|
-
exportTypes: z.boolean().default(false)
|
|
121
|
-
}).readonly()]).exactOptional(),
|
|
122
|
-
securitySchemes: z.discriminatedUnion("split", [z.object({
|
|
123
|
-
split: z.literal(true),
|
|
124
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
125
|
-
import: z.string().exactOptional()
|
|
126
|
-
}).readonly(), z.object({
|
|
127
|
-
split: z.literal(false).optional().default(false),
|
|
128
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
129
|
-
import: z.string().exactOptional()
|
|
130
|
-
}).readonly()]).exactOptional(),
|
|
131
|
-
links: z.discriminatedUnion("split", [z.object({
|
|
132
|
-
split: z.literal(true),
|
|
133
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
134
|
-
import: z.string().exactOptional()
|
|
135
|
-
}).readonly(), z.object({
|
|
136
|
-
split: z.literal(false).optional().default(false),
|
|
137
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
138
|
-
import: z.string().exactOptional()
|
|
139
|
-
}).readonly()]).exactOptional(),
|
|
140
|
-
callbacks: z.discriminatedUnion("split", [z.object({
|
|
141
|
-
split: z.literal(true),
|
|
142
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
143
|
-
import: z.string().exactOptional()
|
|
144
|
-
}).readonly(), z.object({
|
|
145
|
-
split: z.literal(false).optional().default(false),
|
|
146
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
147
|
-
import: z.string().exactOptional()
|
|
148
|
-
}).readonly()]).exactOptional(),
|
|
149
|
-
pathItems: z.discriminatedUnion("split", [z.object({
|
|
150
|
-
split: z.literal(true),
|
|
151
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
152
|
-
import: z.string().exactOptional()
|
|
153
|
-
}).readonly(), z.object({
|
|
154
|
-
split: z.literal(false).optional().default(false),
|
|
155
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
156
|
-
import: z.string().exactOptional()
|
|
157
|
-
}).readonly()]).exactOptional(),
|
|
158
|
-
mediaTypes: z.discriminatedUnion("split", [z.object({
|
|
159
|
-
split: z.literal(true),
|
|
160
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
161
|
-
import: z.string().exactOptional(),
|
|
162
|
-
exportTypes: z.boolean().default(false)
|
|
163
|
-
}).readonly(), z.object({
|
|
164
|
-
split: z.literal(false).optional().default(false),
|
|
165
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
166
|
-
import: z.string().exactOptional(),
|
|
167
|
-
exportTypes: z.boolean().default(false)
|
|
168
|
-
}).readonly()]).exactOptional()
|
|
94
|
+
schemas: ExportTypesOutputSchema,
|
|
95
|
+
responses: OutputSchema,
|
|
96
|
+
parameters: ExportTypesOutputSchema,
|
|
97
|
+
examples: OutputSchema,
|
|
98
|
+
requestBodies: OutputSchema,
|
|
99
|
+
headers: ExportTypesOutputSchema,
|
|
100
|
+
securitySchemes: OutputSchema,
|
|
101
|
+
links: OutputSchema,
|
|
102
|
+
callbacks: OutputSchema,
|
|
103
|
+
pathItems: OutputSchema,
|
|
104
|
+
mediaTypes: ExportTypesOutputSchema
|
|
169
105
|
}).exactOptional()
|
|
170
106
|
}).readonly().refine((v) => !(v.output && v.routes), { message: "output and routes are mutually exclusive. Use output for single-file mode, or routes for separate route output." }).exactOptional(),
|
|
171
107
|
type: z.object({
|
|
172
108
|
readonly: z.boolean().exactOptional(),
|
|
173
109
|
output: z.templateLiteral([z.string().min(1), z.enum([".ts"])], { error: "must be .ts file" })
|
|
174
110
|
}).readonly().exactOptional(),
|
|
175
|
-
rpc:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
split: z.literal(false).optional().default(false),
|
|
184
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
185
|
-
import: z.string(),
|
|
186
|
-
client: z.string().default("client"),
|
|
187
|
-
parseResponse: z.boolean().default(false),
|
|
188
|
-
docs: z.boolean().default(false)
|
|
189
|
-
}).readonly()]).exactOptional(),
|
|
190
|
-
swr: z.discriminatedUnion("split", [z.object({
|
|
191
|
-
split: z.literal(true),
|
|
192
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
193
|
-
import: z.string(),
|
|
194
|
-
client: z.string().default("client")
|
|
195
|
-
}).readonly(), z.object({
|
|
196
|
-
split: z.literal(false).optional().default(false),
|
|
197
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
198
|
-
import: z.string(),
|
|
199
|
-
client: z.string().default("client")
|
|
200
|
-
}).readonly()]).exactOptional(),
|
|
201
|
-
"tanstack-query": z.discriminatedUnion("split", [z.object({
|
|
202
|
-
split: z.literal(true),
|
|
203
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
204
|
-
import: z.string(),
|
|
205
|
-
client: z.string().default("client")
|
|
206
|
-
}).readonly(), z.object({
|
|
207
|
-
split: z.literal(false).optional().default(false),
|
|
208
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
209
|
-
import: z.string(),
|
|
210
|
-
client: z.string().default("client")
|
|
211
|
-
}).readonly()]).exactOptional(),
|
|
212
|
-
"preact-query": z.discriminatedUnion("split", [z.object({
|
|
213
|
-
split: z.literal(true),
|
|
214
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
215
|
-
import: z.string(),
|
|
216
|
-
client: z.string().default("client")
|
|
217
|
-
}).readonly(), z.object({
|
|
218
|
-
split: z.literal(false).optional().default(false),
|
|
219
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
220
|
-
import: z.string(),
|
|
221
|
-
client: z.string().default("client")
|
|
222
|
-
}).readonly()]).exactOptional(),
|
|
223
|
-
"solid-query": z.discriminatedUnion("split", [z.object({
|
|
224
|
-
split: z.literal(true),
|
|
225
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
226
|
-
import: z.string(),
|
|
227
|
-
client: z.string().default("client")
|
|
228
|
-
}).readonly(), z.object({
|
|
229
|
-
split: z.literal(false).optional().default(false),
|
|
230
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
231
|
-
import: z.string(),
|
|
232
|
-
client: z.string().default("client")
|
|
233
|
-
}).readonly()]).exactOptional(),
|
|
234
|
-
"vue-query": z.discriminatedUnion("split", [z.object({
|
|
235
|
-
split: z.literal(true),
|
|
236
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
237
|
-
import: z.string(),
|
|
238
|
-
client: z.string().default("client")
|
|
239
|
-
}).readonly(), z.object({
|
|
240
|
-
split: z.literal(false).optional().default(false),
|
|
241
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
242
|
-
import: z.string(),
|
|
243
|
-
client: z.string().default("client")
|
|
244
|
-
}).readonly()]).exactOptional(),
|
|
245
|
-
"svelte-query": z.discriminatedUnion("split", [z.object({
|
|
246
|
-
split: z.literal(true),
|
|
247
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
248
|
-
import: z.string(),
|
|
249
|
-
client: z.string().default("client")
|
|
250
|
-
}).readonly(), z.object({
|
|
251
|
-
split: z.literal(false).optional().default(false),
|
|
252
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
253
|
-
import: z.string(),
|
|
254
|
-
client: z.string().default("client")
|
|
255
|
-
}).readonly()]).exactOptional(),
|
|
256
|
-
"angular-query": z.discriminatedUnion("split", [z.object({
|
|
257
|
-
split: z.literal(true),
|
|
258
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" }),
|
|
259
|
-
import: z.string(),
|
|
260
|
-
client: z.string().default("client")
|
|
261
|
-
}).readonly(), z.object({
|
|
262
|
-
split: z.literal(false).optional().default(false),
|
|
263
|
-
output: z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`),
|
|
264
|
-
import: z.string(),
|
|
265
|
-
client: z.string().default("client")
|
|
266
|
-
}).readonly()]).exactOptional(),
|
|
111
|
+
rpc: RpcSchema,
|
|
112
|
+
swr: HooksSchema,
|
|
113
|
+
"tanstack-query": HooksSchema,
|
|
114
|
+
"preact-query": HooksSchema,
|
|
115
|
+
"solid-query": HooksSchema,
|
|
116
|
+
"vue-query": HooksSchema,
|
|
117
|
+
"svelte-query": HooksSchema,
|
|
118
|
+
"angular-query": HooksSchema,
|
|
267
119
|
test: z.object({
|
|
268
|
-
output:
|
|
120
|
+
output: FileOutputSchema,
|
|
269
121
|
import: z.string(),
|
|
270
122
|
testFramework: z.enum([
|
|
271
123
|
"vitest",
|
|
@@ -273,7 +125,7 @@ const ConfigSchema = z.object({
|
|
|
273
125
|
"bun"
|
|
274
126
|
]).default("vitest").exactOptional()
|
|
275
127
|
}).readonly().exactOptional(),
|
|
276
|
-
mock: z.object({ output:
|
|
128
|
+
mock: z.object({ output: FileOutputSchema }).readonly().exactOptional(),
|
|
277
129
|
docs: z.discriminatedUnion("curl", [z.object({
|
|
278
130
|
output: z.templateLiteral([z.string().min(1), z.enum([".md"])], { error: "must be .md file" }),
|
|
279
131
|
curl: z.literal(true),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as OpenAPI } from "../../index-
|
|
1
|
+
import { t as OpenAPI } from "../../index-CGhcPgew.js";
|
|
2
2
|
|
|
3
3
|
//#region src/core/docs/index.d.ts
|
|
4
4
|
declare function docs(openAPI: OpenAPI, output: string, entry?: string, basePath?: string, curl?: boolean, baseUrl?: string): Promise<{
|
package/dist/core/docs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as docs } from "../../docs-
|
|
1
|
+
import { t as docs } from "../../docs-D6Vw7rcN.js";
|
|
2
2
|
export { docs };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { t as OpenAPI } from "../../index-CGhcPgew.js";
|
|
2
|
+
|
|
3
|
+
//#region src/core/hooks/index.d.ts
|
|
4
|
+
declare const HOOK_CONFIGS: {
|
|
5
|
+
readonly swr: {
|
|
6
|
+
readonly packageName: "swr";
|
|
7
|
+
readonly frameworkName: "SWR";
|
|
8
|
+
readonly hookPrefix: "use";
|
|
9
|
+
readonly queryFn: "useSWR";
|
|
10
|
+
readonly mutationFn: "useSWRMutation";
|
|
11
|
+
readonly useQueryOptionsType: "SWRConfiguration";
|
|
12
|
+
readonly useMutationOptionsType: "SWRMutationConfiguration";
|
|
13
|
+
readonly isSWR: true;
|
|
14
|
+
readonly immutableQueryFn: "useSWRImmutable";
|
|
15
|
+
readonly infiniteQueryFn: "useSWRInfinite";
|
|
16
|
+
readonly useInfiniteQueryOptionsType: "SWRInfiniteConfiguration";
|
|
17
|
+
};
|
|
18
|
+
readonly 'tanstack-query': {
|
|
19
|
+
readonly packageName: "@tanstack/react-query";
|
|
20
|
+
readonly frameworkName: "TanStack Query";
|
|
21
|
+
readonly hookPrefix: "use";
|
|
22
|
+
readonly queryFn: "useQuery";
|
|
23
|
+
readonly mutationFn: "useMutation";
|
|
24
|
+
readonly useQueryOptionsType: "UseQueryOptions";
|
|
25
|
+
readonly useMutationOptionsType: "UseMutationOptions";
|
|
26
|
+
readonly hasQueryOptionsHelper: true;
|
|
27
|
+
readonly hasMutationOptionsHelper: true;
|
|
28
|
+
readonly suspenseQueryFn: "useSuspenseQuery";
|
|
29
|
+
readonly infiniteQueryFn: "useInfiniteQuery";
|
|
30
|
+
readonly suspenseInfiniteQueryFn: "useSuspenseInfiniteQuery";
|
|
31
|
+
readonly useInfiniteQueryOptionsType: "UseInfiniteQueryOptions";
|
|
32
|
+
readonly useSuspenseInfiniteQueryOptionsType: "UseSuspenseInfiniteQueryOptions";
|
|
33
|
+
readonly hasInfiniteQueryOptionsHelper: true;
|
|
34
|
+
readonly useSuspenseQueryOptionsType: "UseSuspenseQueryOptions";
|
|
35
|
+
};
|
|
36
|
+
readonly 'preact-query': {
|
|
37
|
+
readonly packageName: "@tanstack/preact-query";
|
|
38
|
+
readonly frameworkName: "Preact Query";
|
|
39
|
+
readonly hookPrefix: "use";
|
|
40
|
+
readonly queryFn: "useQuery";
|
|
41
|
+
readonly mutationFn: "useMutation";
|
|
42
|
+
readonly useQueryOptionsType: "UseQueryOptions";
|
|
43
|
+
readonly useMutationOptionsType: "UseMutationOptions";
|
|
44
|
+
readonly hasQueryOptionsHelper: true;
|
|
45
|
+
readonly hasMutationOptionsHelper: true;
|
|
46
|
+
readonly suspenseQueryFn: "useSuspenseQuery";
|
|
47
|
+
readonly infiniteQueryFn: "useInfiniteQuery";
|
|
48
|
+
readonly suspenseInfiniteQueryFn: "useSuspenseInfiniteQuery";
|
|
49
|
+
readonly useInfiniteQueryOptionsType: "UseInfiniteQueryOptions";
|
|
50
|
+
readonly useSuspenseInfiniteQueryOptionsType: "UseSuspenseInfiniteQueryOptions";
|
|
51
|
+
readonly hasInfiniteQueryOptionsHelper: true;
|
|
52
|
+
readonly useSuspenseQueryOptionsType: "UseSuspenseQueryOptions";
|
|
53
|
+
};
|
|
54
|
+
readonly 'solid-query': {
|
|
55
|
+
readonly packageName: "@tanstack/solid-query";
|
|
56
|
+
readonly frameworkName: "Solid Query";
|
|
57
|
+
readonly hookPrefix: "create";
|
|
58
|
+
readonly queryFn: "createQuery";
|
|
59
|
+
readonly mutationFn: "createMutation";
|
|
60
|
+
readonly useThunk: true;
|
|
61
|
+
readonly useQueryOptionsType: "CreateQueryOptions";
|
|
62
|
+
readonly useMutationOptionsType: "CreateMutationOptions";
|
|
63
|
+
readonly hasQueryOptionsHelper: true;
|
|
64
|
+
readonly infiniteQueryFn: "createInfiniteQuery";
|
|
65
|
+
readonly useInfiniteQueryOptionsType: "CreateInfiniteQueryOptions";
|
|
66
|
+
readonly hasInfiniteQueryOptionsHelper: true;
|
|
67
|
+
};
|
|
68
|
+
readonly 'vue-query': {
|
|
69
|
+
readonly packageName: "@tanstack/vue-query";
|
|
70
|
+
readonly frameworkName: "Vue Query";
|
|
71
|
+
readonly hookPrefix: "use";
|
|
72
|
+
readonly queryFn: "useQuery";
|
|
73
|
+
readonly mutationFn: "useMutation";
|
|
74
|
+
readonly useQueryOptionsType: "UseQueryOptions";
|
|
75
|
+
readonly useMutationOptionsType: "UseMutationOptions";
|
|
76
|
+
readonly isVueQuery: true;
|
|
77
|
+
readonly infiniteQueryFn: "useInfiniteQuery";
|
|
78
|
+
readonly useInfiniteQueryOptionsType: "UseInfiniteQueryOptions";
|
|
79
|
+
};
|
|
80
|
+
readonly 'svelte-query': {
|
|
81
|
+
readonly packageName: "@tanstack/svelte-query";
|
|
82
|
+
readonly frameworkName: "Svelte Query";
|
|
83
|
+
readonly hookPrefix: "create";
|
|
84
|
+
readonly queryFn: "createQuery";
|
|
85
|
+
readonly mutationFn: "createMutation";
|
|
86
|
+
readonly useThunk: true;
|
|
87
|
+
readonly useQueryOptionsType: "CreateQueryOptions";
|
|
88
|
+
readonly useMutationOptionsType: "CreateMutationOptions";
|
|
89
|
+
readonly hasQueryOptionsHelper: true;
|
|
90
|
+
readonly infiniteQueryFn: "createInfiniteQuery";
|
|
91
|
+
readonly useInfiniteQueryOptionsType: "CreateInfiniteQueryOptions";
|
|
92
|
+
readonly hasInfiniteQueryOptionsHelper: true;
|
|
93
|
+
};
|
|
94
|
+
readonly 'angular-query': {
|
|
95
|
+
readonly packageName: "@tanstack/angular-query-experimental";
|
|
96
|
+
readonly frameworkName: "Angular Query";
|
|
97
|
+
readonly hookPrefix: "inject";
|
|
98
|
+
readonly queryFn: "injectQuery";
|
|
99
|
+
readonly mutationFn: "injectMutation";
|
|
100
|
+
readonly useQueryOptionsType: "CreateQueryOptions";
|
|
101
|
+
readonly useMutationOptionsType: "CreateMutationOptions";
|
|
102
|
+
readonly hasQueryOptionsHelper: true;
|
|
103
|
+
readonly hasMutationOptionsHelper: false;
|
|
104
|
+
readonly hasInfiniteQueryOptionsHelper: true;
|
|
105
|
+
readonly infiniteQueryFn: "injectInfiniteQuery";
|
|
106
|
+
readonly useInfiniteQueryOptionsType: "CreateInfiniteQueryOptions";
|
|
107
|
+
readonly useThunk: true;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
declare function hooks(openAPI: OpenAPI, output: string, importPath: string, library: keyof typeof HOOK_CONFIGS, options?: {
|
|
111
|
+
readonly split?: boolean;
|
|
112
|
+
readonly clientName?: string;
|
|
113
|
+
}): Promise<{
|
|
114
|
+
readonly ok: false;
|
|
115
|
+
readonly error: string;
|
|
116
|
+
readonly value?: never;
|
|
117
|
+
} | {
|
|
118
|
+
readonly ok: true;
|
|
119
|
+
readonly value: `Generated ${string} hooks written to ${string}`;
|
|
120
|
+
}>;
|
|
121
|
+
//#endregion
|
|
122
|
+
export { hooks };
|
package/dist/core/rpc/index.d.ts
CHANGED
package/dist/core/rpc/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { t as emit } from "../../emit-CFR63U4L.js";
|
|
2
|
-
import { c as isOperationLike, f as isRecord, o as isOpenAPIPaths } from "../../guard-
|
|
3
|
-
import {
|
|
4
|
-
import { a as parsePathItem, i as operationHasArgs, o as resolveSplitOutDir, r as makeOperationDeps, t as formatPath } from "../../rpc-BzPo2tZf.js";
|
|
2
|
+
import { A as makeInferRequestType, M as methodPath, c as isOperationLike, f as isRecord, o as isOpenAPIPaths } from "../../guard-DWr6QVCo.js";
|
|
3
|
+
import { a as parsePathItem, i as operationHasArgs, o as resolveSplitOutDir, r as makeOperationDeps, t as formatPath } from "../../rpc-DV5n7BOG.js";
|
|
5
4
|
import path from "node:path";
|
|
6
5
|
//#region src/core/rpc/index.ts
|
|
7
6
|
/**
|
package/dist/core/type/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { t as emit } from "../../emit-CFR63U4L.js";
|
|
2
|
-
import { g as isSchemaArray, i as isMediaWithSchema, l as isParameter, m as isRequestBody, n as isHttpMethod, s as isOperation, u as isParameterArray, x as isStringRef } from "../../guard-
|
|
3
|
-
import { s as makeSafeKey } from "../../utils-Dhc0-ra6.js";
|
|
2
|
+
import { g as isSchemaArray, i as isMediaWithSchema, j as makeSafeKey, l as isParameter, m as isRequestBody, n as isHttpMethod, s as isOperation, u as isParameterArray, x as isStringRef } from "../../guard-DWr6QVCo.js";
|
|
4
3
|
import path from "node:path";
|
|
5
4
|
//#region src/core/type/index.ts
|
|
6
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as writeFile, t as mkdir } from "./fsp-BXry-Hx5.js";
|
|
2
|
-
import { a as isOAuthFlowValue, b as isSecurityScheme, f as isRecord, h as isResponses, m as isRequestBody, p as isRefObject, r as isMedia, y as isSecurityArray } from "./guard-
|
|
2
|
+
import { D as escapeHtml, a as isOAuthFlowValue, b as isSecurityScheme, f as isRecord, h as isResponses, m as isRequestBody, p as isRefObject, r as isMedia, y as isSecurityArray } from "./guard-DWr6QVCo.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { STATUS_CODES } from "node:http";
|
|
5
5
|
//#region src/generator/docs/index.ts
|
|
@@ -342,7 +342,7 @@ function resolveOperationParameters(operation, components) {
|
|
|
342
342
|
if (isParameter(resolved)) return [resolved];
|
|
343
343
|
return [];
|
|
344
344
|
}
|
|
345
|
-
return [parameter];
|
|
345
|
+
return isParameter(parameter) ? [parameter] : [];
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
348
|
function getPathParameters(openAPI, pathStr) {
|
|
@@ -575,6 +575,7 @@ function collectEnumeratedValues(operation, components) {
|
|
|
575
575
|
const rows = [];
|
|
576
576
|
if (operation.parameters) for (const p of operation.parameters) {
|
|
577
577
|
if ("$ref" in p && p.$ref) continue;
|
|
578
|
+
if (!isParameter(p)) continue;
|
|
578
579
|
if (p.schema?.enum) for (const v of p.schema.enum) rows.push({
|
|
579
580
|
param: p.name,
|
|
580
581
|
value: v
|
|
@@ -710,17 +711,17 @@ function makeDocs(openAPI, entry = "src/index.ts", basePath = "/", curl = false,
|
|
|
710
711
|
const titleSlug = toTitleSlug(title);
|
|
711
712
|
const securitySchemes = openAPI.components?.securitySchemes;
|
|
712
713
|
const lines = [];
|
|
713
|
-
lines.push(`<h1 id="${titleSlug}">${fullTitle}</h1>`, "");
|
|
714
|
+
lines.push(`<h1 id="${titleSlug}">${escapeHtml(fullTitle)}</h1>`, "");
|
|
714
715
|
lines.push("> Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.", "");
|
|
715
716
|
if (openAPI.info?.description) lines.push(openAPI.info.description.trimEnd(), "");
|
|
716
717
|
if (openAPI.servers && openAPI.servers.length > 0) {
|
|
717
718
|
lines.push("Base URLs:", "");
|
|
718
|
-
for (const server of openAPI.servers) lines.push(`* <a href="${server.url}">${server.url}</a>`, "");
|
|
719
|
+
for (const server of openAPI.servers) lines.push(`* <a href="${escapeHtml(server.url)}">${escapeHtml(server.url)}</a>`, "");
|
|
719
720
|
}
|
|
720
|
-
if (openAPI.info?.contact?.email && openAPI.info?.contact?.name) lines.push(`Email: <a href="mailto:${openAPI.info.contact.email}">${openAPI.info.contact.name}</a> `);
|
|
721
|
+
if (openAPI.info?.contact?.email && openAPI.info?.contact?.name) lines.push(`Email: <a href="mailto:${escapeHtml(openAPI.info.contact.email)}">${escapeHtml(openAPI.info.contact.name)}</a> `);
|
|
721
722
|
if (openAPI.info?.license?.name) {
|
|
722
723
|
const licenseUrl = openAPI.info.license.url;
|
|
723
|
-
if (licenseUrl) lines.push(`License: <a href="${licenseUrl}">${openAPI.info.license.name}</a>`);
|
|
724
|
+
if (licenseUrl) lines.push(`License: <a href="${escapeHtml(licenseUrl)}">${escapeHtml(openAPI.info.license.name)}</a>`);
|
|
724
725
|
else lines.push(`License: ${openAPI.info.license.name}`);
|
|
725
726
|
}
|
|
726
727
|
if (openAPI.info?.contact?.email || openAPI.info?.license) lines.push("");
|
|
@@ -729,7 +730,7 @@ function makeDocs(openAPI, entry = "src/index.ts", basePath = "/", curl = false,
|
|
|
729
730
|
const tagGroups = groupByTag(collectEndpoints(openAPI), openAPI);
|
|
730
731
|
for (const group of tagGroups) {
|
|
731
732
|
const tagSlug = toSlug(group.name);
|
|
732
|
-
lines.push(`<h1 id="${titleSlug}-${tagSlug}">${group.name}</h1>`, "");
|
|
733
|
+
lines.push(`<h1 id="${titleSlug}-${tagSlug}">${escapeHtml(group.name)}</h1>`, "");
|
|
733
734
|
if (group.description) lines.push(group.description, "");
|
|
734
735
|
for (const { method, path: pathStr, operation } of group.endpoints) {
|
|
735
736
|
const heading = operation.summary ?? operation.operationId ?? `${method}${pathStr}`;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as zodOpenAPIHono } from "../../../openapi-
|
|
1
|
+
import { t as zodOpenAPIHono } from "../../../openapi-B5hESREK.js";
|
|
2
2
|
export { zodOpenAPIHono };
|