hono-takibi 0.9.99994 → 0.9.99996
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 +5 -7
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +110 -0
- package/dist/config/index.js +1 -215
- package/dist/core/docs/index.d.ts +3 -4
- package/dist/core/docs/index.js +1 -1
- package/dist/core/hooks/index.d.ts +74 -75
- package/dist/core/hooks/index.js +1 -1
- package/dist/core/rpc/index.d.ts +2 -3
- package/dist/core/rpc/index.js +2 -2
- package/dist/core/type/index.d.ts +3 -4
- package/dist/core/type/index.js +1 -1
- package/dist/{docs-380Wcu6a.js → docs-DJEuJ8Cn.js} +1 -1
- package/dist/generator/zod-openapi-hono/openapi/index.d.ts +1 -2
- package/dist/generator/zod-openapi-hono/openapi/index.js +1 -1
- package/dist/{guard-zvkMUVYD.js → guard-B2ZfZYyO.js} +52 -1
- package/dist/{hooks-CkiatAe9.js → hooks-BfmklyQ_.js} +4 -4
- package/dist/{index-BFnCNZSw.d.ts → index-CQcc43cH.d.ts} +3 -3
- package/dist/index.d.ts +1176 -1
- package/dist/index.js +223 -96
- package/dist/{openapi-8ZYAMj_e.js → openapi-CmhbPLWG.js} +46 -119
- package/dist/{rpc-CepeggWU.js → rpc-vbCXB2S_.js} +1 -1
- package/dist/{shared-n3ZMLfl9.js → shared-DnibnCI5.js} +271 -268
- package/dist/vite-plugin/index.js +118 -23
- package/package.json +24 -11
- package/dist/config/index.d.ts +0 -1185
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ npx hono-takibi path/to/input.{yaml,json,tsp} -o path/to/output.ts
|
|
|
30
30
|
Create `hono-takibi.config.ts`:
|
|
31
31
|
|
|
32
32
|
```ts
|
|
33
|
-
import { defineConfig } from 'hono-takibi
|
|
33
|
+
import { defineConfig } from 'hono-takibi'
|
|
34
34
|
|
|
35
35
|
export default defineConfig({
|
|
36
36
|
input: 'openapi.yaml',
|
|
@@ -200,7 +200,6 @@ export default app
|
|
|
200
200
|
```ts
|
|
201
201
|
export default defineConfig({
|
|
202
202
|
input: 'openapi.yaml',
|
|
203
|
-
output: './src/index.ts',
|
|
204
203
|
template: { define: true },
|
|
205
204
|
})
|
|
206
205
|
```
|
|
@@ -221,7 +220,7 @@ export const getUsersIdRoute = defineOpenAPIRoute({
|
|
|
221
220
|
})
|
|
222
221
|
```
|
|
223
222
|
|
|
224
|
-
|
|
223
|
+
The app entry defaults to `src/index.ts` (override with `output`, which must be an `index.ts` path such as `./server/index.ts`). Route files always go to `routes/` next to the app entry, and component schemas to `components/index.ts` (override with `components.output`). When `output` is omitted, `components.output` also anchors the layout: `components: { output: './server/components/index.ts' }` puts the app entry at `server/index.ts` and routes at `server/routes/`.
|
|
225
224
|
|
|
226
225
|
## Client Library Integrations
|
|
227
226
|
|
|
@@ -305,15 +304,15 @@ export default defineConfig({
|
|
|
305
304
|
|
|
306
305
|
## Full Config Reference
|
|
307
306
|
|
|
308
|
-
Some options are mutually exclusive: `output` ↔ `routes`, `components.output` ↔ per-type components, `template.define` ↔ `routeHandler`.
|
|
307
|
+
Some options are mutually exclusive: `output` ↔ `routes`, `template.define` ↔ `routes`, `components.output` ↔ per-type components, `template.define` ↔ `routeHandler`.
|
|
309
308
|
|
|
310
309
|
```ts
|
|
311
|
-
import { defineConfig } from 'hono-takibi
|
|
310
|
+
import { defineConfig } from 'hono-takibi'
|
|
312
311
|
|
|
313
312
|
export default defineConfig({
|
|
314
313
|
input: 'openapi.yaml',
|
|
315
314
|
|
|
316
|
-
output: './src/routes.ts', // single-file mode; with template.define, the app entry (
|
|
315
|
+
output: './src/routes.ts', // single-file mode; with template.define, the app entry (an index.ts path, default ./src/index.ts)
|
|
317
316
|
basePath: '/api',
|
|
318
317
|
readonly: true,
|
|
319
318
|
// format: {}, // oxfmt FormatConfig
|
|
@@ -322,7 +321,6 @@ export default defineConfig({
|
|
|
322
321
|
test: true,
|
|
323
322
|
routeHandler: false, // true: RouteHandler exports
|
|
324
323
|
define: false, // true: defineOpenAPIRoute output
|
|
325
|
-
// output: './src/routes', // define mode dir (default ./src/routes)
|
|
326
324
|
pathAlias: '@/',
|
|
327
325
|
testFramework: 'vitest', // "vitest" | "vite-plus" | "bun"
|
|
328
326
|
},
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readConfig } from "./index.js";
|
|
3
|
+
import { r as setFormatOptions } from "./emit-CFR63U4L.js";
|
|
4
|
+
import { n as parseOpenAPI, r as takibi, t as makeJob } from "./shared-DnibnCI5.js";
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
6
|
+
import { resolve } from "node:path";
|
|
7
|
+
//#region src/cli/index.ts
|
|
8
|
+
const HELP_TEXT = `Usage: hono-takibi <input.{yaml,json,tsp}> -o <output.ts>
|
|
9
|
+
|
|
10
|
+
Options:
|
|
11
|
+
-h, --help display help for command`;
|
|
12
|
+
function parseCli(args) {
|
|
13
|
+
const input = args[0];
|
|
14
|
+
const oIdx = args.indexOf("-o");
|
|
15
|
+
const output = oIdx !== -1 ? args[oIdx + 1] : void 0;
|
|
16
|
+
const isYamlOrJsonOrTsp = (i) => i.endsWith(".yaml") || i.endsWith(".json") || i.endsWith(".tsp");
|
|
17
|
+
const isTs = (o) => o.endsWith(".ts");
|
|
18
|
+
if (!(input && output && isYamlOrJsonOrTsp(input) && isTs(output))) return {
|
|
19
|
+
ok: false,
|
|
20
|
+
error: HELP_TEXT
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
ok: true,
|
|
24
|
+
value: {
|
|
25
|
+
input,
|
|
26
|
+
output
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
async function honoTakibi() {
|
|
31
|
+
const args = process.argv.slice(2);
|
|
32
|
+
if (args.length === 1 && (args[0] === "--help" || args[0] === "-h")) return {
|
|
33
|
+
ok: true,
|
|
34
|
+
value: HELP_TEXT
|
|
35
|
+
};
|
|
36
|
+
if (!existsSync(resolve(process.cwd(), "hono-takibi.config.ts"))) {
|
|
37
|
+
const cliResult = parseCli(args);
|
|
38
|
+
if (!cliResult.ok) return {
|
|
39
|
+
ok: false,
|
|
40
|
+
error: cliResult.error
|
|
41
|
+
};
|
|
42
|
+
const { input, output } = cliResult.value;
|
|
43
|
+
const openAPIResult = await parseOpenAPI(input);
|
|
44
|
+
if (!openAPIResult.ok) return {
|
|
45
|
+
ok: false,
|
|
46
|
+
error: openAPIResult.error
|
|
47
|
+
};
|
|
48
|
+
const openAPI = openAPIResult.value;
|
|
49
|
+
const takibiResult = await takibi(openAPI, output, {
|
|
50
|
+
readonly: false,
|
|
51
|
+
exportSchemas: false,
|
|
52
|
+
exportSchemasTypes: false,
|
|
53
|
+
exportResponses: false,
|
|
54
|
+
exportParameters: false,
|
|
55
|
+
exportParametersTypes: false,
|
|
56
|
+
exportExamples: false,
|
|
57
|
+
exportRequestBodies: false,
|
|
58
|
+
exportHeaders: false,
|
|
59
|
+
exportHeadersTypes: false,
|
|
60
|
+
exportSecuritySchemes: false,
|
|
61
|
+
exportLinks: false,
|
|
62
|
+
exportCallbacks: false,
|
|
63
|
+
exportPathItems: false,
|
|
64
|
+
exportMediaTypes: false,
|
|
65
|
+
exportMediaTypesTypes: false
|
|
66
|
+
});
|
|
67
|
+
if (!takibiResult.ok) return {
|
|
68
|
+
ok: false,
|
|
69
|
+
error: takibiResult.error
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
ok: true,
|
|
73
|
+
value: takibiResult.value
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const readConfigResult = await readConfig();
|
|
77
|
+
if (!readConfigResult.ok) return {
|
|
78
|
+
ok: false,
|
|
79
|
+
error: readConfigResult.error
|
|
80
|
+
};
|
|
81
|
+
const config = readConfigResult.value;
|
|
82
|
+
if (config.format) setFormatOptions(config.format);
|
|
83
|
+
const openAPIResult = await parseOpenAPI(config.input);
|
|
84
|
+
if (!openAPIResult.ok) return {
|
|
85
|
+
ok: false,
|
|
86
|
+
error: openAPIResult.error
|
|
87
|
+
};
|
|
88
|
+
const openAPI = openAPIResult.value;
|
|
89
|
+
const jobs = makeJob(openAPI, config);
|
|
90
|
+
const results = await Promise.all(jobs.map((job) => job.run(job.output)));
|
|
91
|
+
const e = results.find((result) => !result.ok);
|
|
92
|
+
if (e) return e;
|
|
93
|
+
return {
|
|
94
|
+
ok: true,
|
|
95
|
+
value: results.map((result) => result.ok ? result.value : "").filter((v) => v !== "").join("\n")
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/index.ts
|
|
100
|
+
honoTakibi().then((result) => {
|
|
101
|
+
if (result.ok) {
|
|
102
|
+
console.log(result.value);
|
|
103
|
+
process.exit(0);
|
|
104
|
+
} else {
|
|
105
|
+
console.error(result.error);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
//#endregion
|
|
110
|
+
export {};
|
package/dist/config/index.js
CHANGED
|
@@ -1,216 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
|
-
import { pathToFileURL } from "node:url";
|
|
4
|
-
import "oxfmt";
|
|
5
|
-
import * as z from "zod";
|
|
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();
|
|
55
|
-
const ConfigSchema = z.object({
|
|
56
|
-
input: z.templateLiteral([z.string().min(1), z.enum([
|
|
57
|
-
".yaml",
|
|
58
|
-
".json",
|
|
59
|
-
".tsp"
|
|
60
|
-
])], { error: "must be .yaml | .json | .tsp" }),
|
|
61
|
-
output: z.templateLiteral([z.string().min(1), z.enum([".ts"])], { error: "must be .ts file" }).exactOptional(),
|
|
62
|
-
basePath: z.string().default("/"),
|
|
63
|
-
readonly: z.boolean().exactOptional(),
|
|
64
|
-
format: z.custom(() => true).exactOptional(),
|
|
65
|
-
template: z.discriminatedUnion("define", [z.object({
|
|
66
|
-
define: z.literal(true),
|
|
67
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "template.output must be a directory, not a .ts file" }).default("src/routes"),
|
|
68
|
-
test: z.boolean().default(false),
|
|
69
|
-
pathAlias: z.string().exactOptional(),
|
|
70
|
-
testFramework: z.enum([
|
|
71
|
-
"vitest",
|
|
72
|
-
"vite-plus",
|
|
73
|
-
"bun"
|
|
74
|
-
]).default("vitest").exactOptional()
|
|
75
|
-
}).readonly(), z.object({
|
|
76
|
-
define: z.literal(false).optional().default(false),
|
|
77
|
-
routeHandler: z.boolean().default(false),
|
|
78
|
-
output: z.string().regex(/^(?!.*\.ts$).+/, { error: "template.output must be a directory, not a .ts file" }).exactOptional(),
|
|
79
|
-
test: z.boolean().default(false),
|
|
80
|
-
pathAlias: z.string().exactOptional(),
|
|
81
|
-
testFramework: z.enum([
|
|
82
|
-
"vitest",
|
|
83
|
-
"vite-plus",
|
|
84
|
-
"bun"
|
|
85
|
-
]).default("vitest").exactOptional()
|
|
86
|
-
}).readonly()]).exactOptional(),
|
|
87
|
-
exportSchemas: z.boolean().default(false),
|
|
88
|
-
exportSchemasTypes: z.boolean().default(false),
|
|
89
|
-
exportResponses: z.boolean().default(false),
|
|
90
|
-
exportParameters: z.boolean().default(false),
|
|
91
|
-
exportParametersTypes: z.boolean().default(false),
|
|
92
|
-
exportExamples: z.boolean().default(false),
|
|
93
|
-
exportRequestBodies: z.boolean().default(false),
|
|
94
|
-
exportHeaders: z.boolean().default(false),
|
|
95
|
-
exportHeadersTypes: z.boolean().default(false),
|
|
96
|
-
exportSecuritySchemes: z.boolean().default(false),
|
|
97
|
-
exportLinks: z.boolean().default(false),
|
|
98
|
-
exportCallbacks: z.boolean().default(false),
|
|
99
|
-
exportPathItems: z.boolean().default(false),
|
|
100
|
-
exportMediaTypes: z.boolean().default(false),
|
|
101
|
-
exportMediaTypesTypes: z.boolean().default(false),
|
|
102
|
-
routes: OutputSchema,
|
|
103
|
-
webhooks: OutputSchema,
|
|
104
|
-
components: z.object({
|
|
105
|
-
output: z.templateLiteral([z.string().min(1), z.enum([".ts"])], { error: "must be .ts file" }).exactOptional(),
|
|
106
|
-
schemas: ExportTypesOutputSchema,
|
|
107
|
-
responses: OutputSchema,
|
|
108
|
-
parameters: ExportTypesOutputSchema,
|
|
109
|
-
examples: OutputSchema,
|
|
110
|
-
requestBodies: OutputSchema,
|
|
111
|
-
headers: ExportTypesOutputSchema,
|
|
112
|
-
securitySchemes: OutputSchema,
|
|
113
|
-
links: OutputSchema,
|
|
114
|
-
callbacks: OutputSchema,
|
|
115
|
-
pathItems: OutputSchema,
|
|
116
|
-
mediaTypes: ExportTypesOutputSchema
|
|
117
|
-
}).readonly().refine((v) => !(v.output && [
|
|
118
|
-
"schemas",
|
|
119
|
-
"responses",
|
|
120
|
-
"parameters",
|
|
121
|
-
"examples",
|
|
122
|
-
"requestBodies",
|
|
123
|
-
"headers",
|
|
124
|
-
"securitySchemes",
|
|
125
|
-
"links",
|
|
126
|
-
"callbacks",
|
|
127
|
-
"pathItems",
|
|
128
|
-
"mediaTypes"
|
|
129
|
-
].some((k) => v[k] !== void 0)), { message: "components.output is mutually exclusive with per-type component outputs (schemas, responses, ...). Use output for single-file mode, or per-type fields for split mode." }).exactOptional(),
|
|
130
|
-
type: z.object({
|
|
131
|
-
readonly: z.boolean().exactOptional(),
|
|
132
|
-
output: z.templateLiteral([z.string().min(1), z.enum([".ts"])], { error: "must be .ts file" })
|
|
133
|
-
}).readonly().exactOptional(),
|
|
134
|
-
rpc: RpcSchema,
|
|
135
|
-
swr: HooksSchema,
|
|
136
|
-
"tanstack-query": HooksSchema,
|
|
137
|
-
"preact-query": HooksSchema,
|
|
138
|
-
"solid-query": HooksSchema,
|
|
139
|
-
"vue-query": HooksSchema,
|
|
140
|
-
"svelte-query": HooksSchema,
|
|
141
|
-
"angular-query": HooksSchema,
|
|
142
|
-
test: z.object({
|
|
143
|
-
output: FileOutputSchema,
|
|
144
|
-
import: z.string(),
|
|
145
|
-
testFramework: z.enum([
|
|
146
|
-
"vitest",
|
|
147
|
-
"vite-plus",
|
|
148
|
-
"bun"
|
|
149
|
-
]).default("vitest").exactOptional()
|
|
150
|
-
}).readonly().exactOptional(),
|
|
151
|
-
mock: z.object({
|
|
152
|
-
output: FileOutputSchema,
|
|
153
|
-
useExamples: z.boolean().exactOptional(),
|
|
154
|
-
locale: z.string().regex(/^[A-Za-z_]{1,40}$/, { error: "Invalid faker locale. Use a code like 'ja', 'en', or 'zh_CN'." }).exactOptional(),
|
|
155
|
-
delay: z.union([
|
|
156
|
-
z.number().int().nonnegative().max(6e4),
|
|
157
|
-
z.literal(false),
|
|
158
|
-
z.object({
|
|
159
|
-
min: z.number().int().nonnegative().max(6e4),
|
|
160
|
-
max: z.number().int().nonnegative().max(6e4)
|
|
161
|
-
}).readonly().refine((v) => v.min <= v.max, { message: "delay.min must be <= delay.max. Swap the values or remove one." })
|
|
162
|
-
]).exactOptional(),
|
|
163
|
-
arrayMin: z.number().int().nonnegative().max(1e3).exactOptional(),
|
|
164
|
-
arrayMax: z.number().int().nonnegative().max(1e3).exactOptional()
|
|
165
|
-
}).readonly().refine((v) => v.arrayMin === void 0 || v.arrayMax === void 0 || v.arrayMin <= v.arrayMax, { message: "arrayMin must be <= arrayMax. Swap the values or remove one." }).exactOptional(),
|
|
166
|
-
docs: z.discriminatedUnion("curl", [z.object({
|
|
167
|
-
output: z.templateLiteral([z.string().min(1), z.enum([".md"])], { error: "must be .md file" }),
|
|
168
|
-
curl: z.literal(true),
|
|
169
|
-
baseUrl: z.string({ error: "baseUrl is required when curl is true" }),
|
|
170
|
-
entry: z.never({ error: "entry cannot be specified when curl is true" }).optional()
|
|
171
|
-
}).readonly(), z.object({
|
|
172
|
-
output: z.templateLiteral([z.string().min(1), z.enum([".md"])], { error: "must be .md file" }),
|
|
173
|
-
curl: z.literal(false).default(false).optional(),
|
|
174
|
-
entry: z.string().exactOptional(),
|
|
175
|
-
baseUrl: z.string().exactOptional()
|
|
176
|
-
}).readonly()]).exactOptional()
|
|
177
|
-
}).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." }).refine((v) => !(v.template?.define && !v.output), { message: "template.define requires output (the app entry file, e.g. ./src/index.ts)." });
|
|
178
|
-
function parseConfig(config) {
|
|
179
|
-
const result = ConfigSchema.safeParse(config);
|
|
180
|
-
if (!result.success) {
|
|
181
|
-
const issue = result.error.issues[0];
|
|
182
|
-
return {
|
|
183
|
-
ok: false,
|
|
184
|
-
error: `Invalid config: ${issue.path.length > 0 ? `${issue.path.join(".")}: ` : ""}${issue.message}`
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
return {
|
|
188
|
-
ok: true,
|
|
189
|
-
value: result.data
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
async function readConfig() {
|
|
193
|
-
const abs = resolve(process.cwd(), "hono-takibi.config.ts");
|
|
194
|
-
if (!existsSync(abs)) return {
|
|
195
|
-
ok: false,
|
|
196
|
-
error: `Config not found: ${abs}`
|
|
197
|
-
};
|
|
198
|
-
try {
|
|
199
|
-
const mod = await import(pathToFileURL(abs).href);
|
|
200
|
-
if (typeof mod !== "object" || mod === null || !("default" in mod) || mod.default === void 0) return {
|
|
201
|
-
ok: false,
|
|
202
|
-
error: "Config must export default object"
|
|
203
|
-
};
|
|
204
|
-
return parseConfig(mod.default);
|
|
205
|
-
} catch (e) {
|
|
206
|
-
return {
|
|
207
|
-
ok: false,
|
|
208
|
-
error: e instanceof Error ? e.message : String(e)
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
function defineConfig(config) {
|
|
213
|
-
return config;
|
|
214
|
-
}
|
|
215
|
-
//#endregion
|
|
1
|
+
import { defineConfig, parseConfig, readConfig } from "../index.js";
|
|
216
2
|
export { defineConfig, parseConfig, readConfig };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { t as OpenAPI } from "../../index-
|
|
2
|
-
|
|
1
|
+
import { t as OpenAPI } from "../../index-CQcc43cH.js";
|
|
3
2
|
//#region src/core/docs/index.d.ts
|
|
4
3
|
declare function docs(openAPI: OpenAPI, output: string, entry?: string, basePath?: string, curl?: boolean, baseUrl?: string): Promise<{
|
|
4
|
+
readonly value?: never;
|
|
5
5
|
readonly ok: false;
|
|
6
6
|
readonly error: string;
|
|
7
|
-
readonly value?: never;
|
|
8
7
|
} | {
|
|
8
|
+
readonly error?: never;
|
|
9
9
|
readonly ok: true;
|
|
10
10
|
readonly value: `Generated docs written to ${string}`;
|
|
11
|
-
readonly error?: never;
|
|
12
11
|
}>;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { docs };
|
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-DJEuJ8Cn.js";
|
|
2
2
|
export { docs };
|
|
@@ -1,109 +1,108 @@
|
|
|
1
|
-
import { t as OpenAPI } from "../../index-
|
|
2
|
-
|
|
1
|
+
import { t as OpenAPI } from "../../index-CQcc43cH.js";
|
|
3
2
|
//#region src/core/hooks/index.d.ts
|
|
4
3
|
declare const HOOK_CONFIGS: {
|
|
5
4
|
readonly swr: {
|
|
6
|
-
readonly packageName:
|
|
7
|
-
readonly frameworkName:
|
|
8
|
-
readonly hookPrefix:
|
|
9
|
-
readonly queryFn:
|
|
10
|
-
readonly mutationFn:
|
|
11
|
-
readonly useQueryOptionsType:
|
|
12
|
-
readonly useMutationOptionsType:
|
|
5
|
+
readonly packageName: 'swr';
|
|
6
|
+
readonly frameworkName: 'SWR';
|
|
7
|
+
readonly hookPrefix: 'use';
|
|
8
|
+
readonly queryFn: 'useSWR';
|
|
9
|
+
readonly mutationFn: 'useSWRMutation';
|
|
10
|
+
readonly useQueryOptionsType: 'SWRConfiguration';
|
|
11
|
+
readonly useMutationOptionsType: 'SWRMutationConfiguration';
|
|
13
12
|
readonly isSWR: true;
|
|
14
|
-
readonly immutableQueryFn:
|
|
15
|
-
readonly infiniteQueryFn:
|
|
16
|
-
readonly useInfiniteQueryOptionsType:
|
|
13
|
+
readonly immutableQueryFn: 'useSWRImmutable';
|
|
14
|
+
readonly infiniteQueryFn: 'useSWRInfinite';
|
|
15
|
+
readonly useInfiniteQueryOptionsType: 'SWRInfiniteConfiguration';
|
|
17
16
|
};
|
|
18
17
|
readonly 'tanstack-query': {
|
|
19
|
-
readonly packageName:
|
|
20
|
-
readonly frameworkName:
|
|
21
|
-
readonly hookPrefix:
|
|
22
|
-
readonly queryFn:
|
|
23
|
-
readonly mutationFn:
|
|
24
|
-
readonly useQueryOptionsType:
|
|
25
|
-
readonly useMutationOptionsType:
|
|
18
|
+
readonly packageName: '@tanstack/react-query';
|
|
19
|
+
readonly frameworkName: 'TanStack Query';
|
|
20
|
+
readonly hookPrefix: 'use';
|
|
21
|
+
readonly queryFn: 'useQuery';
|
|
22
|
+
readonly mutationFn: 'useMutation';
|
|
23
|
+
readonly useQueryOptionsType: 'UseQueryOptions';
|
|
24
|
+
readonly useMutationOptionsType: 'UseMutationOptions';
|
|
26
25
|
readonly hasQueryOptionsHelper: true;
|
|
27
26
|
readonly hasMutationOptionsHelper: true;
|
|
28
|
-
readonly suspenseQueryFn:
|
|
29
|
-
readonly infiniteQueryFn:
|
|
30
|
-
readonly suspenseInfiniteQueryFn:
|
|
31
|
-
readonly useInfiniteQueryOptionsType:
|
|
32
|
-
readonly useSuspenseInfiniteQueryOptionsType:
|
|
27
|
+
readonly suspenseQueryFn: 'useSuspenseQuery';
|
|
28
|
+
readonly infiniteQueryFn: 'useInfiniteQuery';
|
|
29
|
+
readonly suspenseInfiniteQueryFn: 'useSuspenseInfiniteQuery';
|
|
30
|
+
readonly useInfiniteQueryOptionsType: 'UseInfiniteQueryOptions';
|
|
31
|
+
readonly useSuspenseInfiniteQueryOptionsType: 'UseSuspenseInfiniteQueryOptions';
|
|
33
32
|
readonly hasInfiniteQueryOptionsHelper: true;
|
|
34
|
-
readonly useSuspenseQueryOptionsType:
|
|
33
|
+
readonly useSuspenseQueryOptionsType: 'UseSuspenseQueryOptions';
|
|
35
34
|
};
|
|
36
35
|
readonly 'preact-query': {
|
|
37
|
-
readonly packageName:
|
|
38
|
-
readonly frameworkName:
|
|
39
|
-
readonly hookPrefix:
|
|
40
|
-
readonly queryFn:
|
|
41
|
-
readonly mutationFn:
|
|
42
|
-
readonly useQueryOptionsType:
|
|
43
|
-
readonly useMutationOptionsType:
|
|
36
|
+
readonly packageName: '@tanstack/preact-query';
|
|
37
|
+
readonly frameworkName: 'Preact Query';
|
|
38
|
+
readonly hookPrefix: 'use';
|
|
39
|
+
readonly queryFn: 'useQuery';
|
|
40
|
+
readonly mutationFn: 'useMutation';
|
|
41
|
+
readonly useQueryOptionsType: 'UseQueryOptions';
|
|
42
|
+
readonly useMutationOptionsType: 'UseMutationOptions';
|
|
44
43
|
readonly hasQueryOptionsHelper: true;
|
|
45
44
|
readonly hasMutationOptionsHelper: true;
|
|
46
|
-
readonly suspenseQueryFn:
|
|
47
|
-
readonly infiniteQueryFn:
|
|
48
|
-
readonly suspenseInfiniteQueryFn:
|
|
49
|
-
readonly useInfiniteQueryOptionsType:
|
|
50
|
-
readonly useSuspenseInfiniteQueryOptionsType:
|
|
45
|
+
readonly suspenseQueryFn: 'useSuspenseQuery';
|
|
46
|
+
readonly infiniteQueryFn: 'useInfiniteQuery';
|
|
47
|
+
readonly suspenseInfiniteQueryFn: 'useSuspenseInfiniteQuery';
|
|
48
|
+
readonly useInfiniteQueryOptionsType: 'UseInfiniteQueryOptions';
|
|
49
|
+
readonly useSuspenseInfiniteQueryOptionsType: 'UseSuspenseInfiniteQueryOptions';
|
|
51
50
|
readonly hasInfiniteQueryOptionsHelper: true;
|
|
52
|
-
readonly useSuspenseQueryOptionsType:
|
|
51
|
+
readonly useSuspenseQueryOptionsType: 'UseSuspenseQueryOptions';
|
|
53
52
|
};
|
|
54
53
|
readonly 'solid-query': {
|
|
55
|
-
readonly packageName:
|
|
56
|
-
readonly frameworkName:
|
|
57
|
-
readonly hookPrefix:
|
|
58
|
-
readonly queryFn:
|
|
59
|
-
readonly mutationFn:
|
|
54
|
+
readonly packageName: '@tanstack/solid-query';
|
|
55
|
+
readonly frameworkName: 'Solid Query';
|
|
56
|
+
readonly hookPrefix: 'create';
|
|
57
|
+
readonly queryFn: 'createQuery';
|
|
58
|
+
readonly mutationFn: 'createMutation';
|
|
60
59
|
readonly useThunk: true;
|
|
61
|
-
readonly useQueryOptionsType:
|
|
62
|
-
readonly useMutationOptionsType:
|
|
60
|
+
readonly useQueryOptionsType: 'CreateQueryOptions';
|
|
61
|
+
readonly useMutationOptionsType: 'CreateMutationOptions';
|
|
63
62
|
readonly hasQueryOptionsHelper: true;
|
|
64
|
-
readonly infiniteQueryFn:
|
|
65
|
-
readonly useInfiniteQueryOptionsType:
|
|
63
|
+
readonly infiniteQueryFn: 'createInfiniteQuery';
|
|
64
|
+
readonly useInfiniteQueryOptionsType: 'CreateInfiniteQueryOptions';
|
|
66
65
|
readonly hasInfiniteQueryOptionsHelper: true;
|
|
67
66
|
};
|
|
68
67
|
readonly 'vue-query': {
|
|
69
|
-
readonly packageName:
|
|
70
|
-
readonly frameworkName:
|
|
71
|
-
readonly hookPrefix:
|
|
72
|
-
readonly queryFn:
|
|
73
|
-
readonly mutationFn:
|
|
74
|
-
readonly useQueryOptionsType:
|
|
75
|
-
readonly useMutationOptionsType:
|
|
68
|
+
readonly packageName: '@tanstack/vue-query';
|
|
69
|
+
readonly frameworkName: 'Vue Query';
|
|
70
|
+
readonly hookPrefix: 'use';
|
|
71
|
+
readonly queryFn: 'useQuery';
|
|
72
|
+
readonly mutationFn: 'useMutation';
|
|
73
|
+
readonly useQueryOptionsType: 'UseQueryOptions';
|
|
74
|
+
readonly useMutationOptionsType: 'UseMutationOptions';
|
|
76
75
|
readonly isVueQuery: true;
|
|
77
|
-
readonly infiniteQueryFn:
|
|
78
|
-
readonly useInfiniteQueryOptionsType:
|
|
76
|
+
readonly infiniteQueryFn: 'useInfiniteQuery';
|
|
77
|
+
readonly useInfiniteQueryOptionsType: 'UseInfiniteQueryOptions';
|
|
79
78
|
};
|
|
80
79
|
readonly 'svelte-query': {
|
|
81
|
-
readonly packageName:
|
|
82
|
-
readonly frameworkName:
|
|
83
|
-
readonly hookPrefix:
|
|
84
|
-
readonly queryFn:
|
|
85
|
-
readonly mutationFn:
|
|
80
|
+
readonly packageName: '@tanstack/svelte-query';
|
|
81
|
+
readonly frameworkName: 'Svelte Query';
|
|
82
|
+
readonly hookPrefix: 'create';
|
|
83
|
+
readonly queryFn: 'createQuery';
|
|
84
|
+
readonly mutationFn: 'createMutation';
|
|
86
85
|
readonly useThunk: true;
|
|
87
|
-
readonly useQueryOptionsType:
|
|
88
|
-
readonly useMutationOptionsType:
|
|
86
|
+
readonly useQueryOptionsType: 'CreateQueryOptions';
|
|
87
|
+
readonly useMutationOptionsType: 'CreateMutationOptions';
|
|
89
88
|
readonly hasQueryOptionsHelper: true;
|
|
90
|
-
readonly infiniteQueryFn:
|
|
91
|
-
readonly useInfiniteQueryOptionsType:
|
|
89
|
+
readonly infiniteQueryFn: 'createInfiniteQuery';
|
|
90
|
+
readonly useInfiniteQueryOptionsType: 'CreateInfiniteQueryOptions';
|
|
92
91
|
readonly hasInfiniteQueryOptionsHelper: true;
|
|
93
92
|
};
|
|
94
93
|
readonly 'angular-query': {
|
|
95
|
-
readonly packageName:
|
|
96
|
-
readonly frameworkName:
|
|
97
|
-
readonly hookPrefix:
|
|
98
|
-
readonly queryFn:
|
|
99
|
-
readonly mutationFn:
|
|
100
|
-
readonly useQueryOptionsType:
|
|
101
|
-
readonly useMutationOptionsType:
|
|
94
|
+
readonly packageName: '@tanstack/angular-query-experimental';
|
|
95
|
+
readonly frameworkName: 'Angular Query';
|
|
96
|
+
readonly hookPrefix: 'inject';
|
|
97
|
+
readonly queryFn: 'injectQuery';
|
|
98
|
+
readonly mutationFn: 'injectMutation';
|
|
99
|
+
readonly useQueryOptionsType: 'CreateQueryOptions';
|
|
100
|
+
readonly useMutationOptionsType: 'CreateMutationOptions';
|
|
102
101
|
readonly hasQueryOptionsHelper: true;
|
|
103
102
|
readonly hasMutationOptionsHelper: false;
|
|
104
103
|
readonly hasInfiniteQueryOptionsHelper: true;
|
|
105
|
-
readonly infiniteQueryFn:
|
|
106
|
-
readonly useInfiniteQueryOptionsType:
|
|
104
|
+
readonly infiniteQueryFn: 'injectInfiniteQuery';
|
|
105
|
+
readonly useInfiniteQueryOptionsType: 'CreateInfiniteQueryOptions';
|
|
107
106
|
readonly useThunk: true;
|
|
108
107
|
};
|
|
109
108
|
};
|
|
@@ -111,9 +110,9 @@ declare function hooks(openAPI: OpenAPI, output: string, importPath: string, lib
|
|
|
111
110
|
readonly split?: boolean;
|
|
112
111
|
readonly clientName?: string;
|
|
113
112
|
}): Promise<{
|
|
113
|
+
readonly value?: never;
|
|
114
114
|
readonly ok: false;
|
|
115
115
|
readonly error: string;
|
|
116
|
-
readonly value?: never;
|
|
117
116
|
} | {
|
|
118
117
|
readonly ok: true;
|
|
119
118
|
readonly value: `Generated ${string} hooks written to ${string}`;
|
package/dist/core/hooks/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as hooks } from "../../hooks-
|
|
1
|
+
import { t as hooks } from "../../hooks-BfmklyQ_.js";
|
|
2
2
|
export { hooks };
|
package/dist/core/rpc/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as OpenAPI } from "../../index-
|
|
2
|
-
|
|
1
|
+
import { t as OpenAPI } from "../../index-CQcc43cH.js";
|
|
3
2
|
//#region src/core/rpc/index.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Generates RPC client wrapper functions from OpenAPI specification.
|
|
@@ -15,9 +14,9 @@ import { t as OpenAPI } from "../../index-BFnCNZSw.js";
|
|
|
15
14
|
* @returns Promise resolving to success message or error
|
|
16
15
|
*/
|
|
17
16
|
declare function rpc(openAPI: OpenAPI, output: string, importPath: string, split?: boolean, clientName?: string, useParseResponse?: boolean, basePath?: string, docs?: boolean): Promise<{
|
|
17
|
+
readonly value?: never;
|
|
18
18
|
readonly ok: false;
|
|
19
19
|
readonly error: string;
|
|
20
|
-
readonly value?: never;
|
|
21
20
|
} | {
|
|
22
21
|
readonly ok: true;
|
|
23
22
|
readonly value: `Generated rpc code written to ${string}`;
|
package/dist/core/rpc/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as emit } from "../../emit-CFR63U4L.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as parsePathItem, i as operationHasArgs, o as resolveSplitOutDir, r as makeOperationDeps, t as formatPath } from "../../rpc-
|
|
2
|
+
import { N as methodPath, c as isOperationLike, f as isRecord, j as makeInferRequestType, o as isOpenAPIPaths } from "../../guard-B2ZfZYyO.js";
|
|
3
|
+
import { a as parsePathItem, i as operationHasArgs, o as resolveSplitOutDir, r as makeOperationDeps, t as formatPath } from "../../rpc-vbCXB2S_.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
//#region src/core/rpc/index.ts
|
|
6
6
|
/**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as OpenAPI } from "../../index-
|
|
2
|
-
|
|
1
|
+
import { t as OpenAPI } from "../../index-CQcc43cH.js";
|
|
3
2
|
//#region src/core/type/index.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Generates TypeScript type declarations from OpenAPI specification.
|
|
@@ -10,13 +9,13 @@ import { t as OpenAPI } from "../../index-BFnCNZSw.js";
|
|
|
10
9
|
* @returns Result with success message or error
|
|
11
10
|
*/
|
|
12
11
|
declare function type(openAPI: OpenAPI, output: `${string}.ts`, readonly?: boolean): Promise<{
|
|
12
|
+
readonly error?: never;
|
|
13
13
|
readonly ok: true;
|
|
14
14
|
readonly value: `Generated type code written to ${string}.ts`;
|
|
15
|
-
readonly error?: never;
|
|
16
15
|
} | {
|
|
16
|
+
readonly value?: never;
|
|
17
17
|
readonly ok: false;
|
|
18
18
|
readonly error: string;
|
|
19
|
-
readonly value?: never;
|
|
20
19
|
}>;
|
|
21
20
|
//#endregion
|
|
22
21
|
export { type };
|