hono-takibi 0.9.99995 → 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 +2 -2
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +110 -0
- package/dist/config/index.js +1 -235
- 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 -3
- package/dist/core/type/index.d.ts +3 -4
- package/dist/core/type/index.js +1 -2
- package/dist/{docs-DbknIWmx.js → docs-DJEuJ8Cn.js} +1 -2
- 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/{utils-B5PbMfWs.js → guard-B2ZfZYyO.js} +83 -22
- package/dist/{hooks-CCw7jm8g.js → hooks-BfmklyQ_.js} +2 -3
- 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-BlTDQFFF.js → openapi-CmhbPLWG.js} +13 -10
- package/dist/{rpc-BzPo2tZf.js → rpc-vbCXB2S_.js} +1 -1
- package/dist/{shared-B-TUm7Fa.js → shared-DnibnCI5.js} +228 -197
- package/dist/vite-plugin/index.js +3 -3
- package/package.json +22 -13
- package/dist/config/index.d.ts +0 -1177
- package/dist/guard-BSZ8ezEv.js +0 -83
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',
|
|
@@ -307,7 +307,7 @@ export default defineConfig({
|
|
|
307
307
|
Some options are mutually exclusive: `output` ↔ `routes`, `template.define` ↔ `routes`, `components.output` ↔ per-type components, `template.define` ↔ `routeHandler`.
|
|
308
308
|
|
|
309
309
|
```ts
|
|
310
|
-
import { defineConfig } from 'hono-takibi
|
|
310
|
+
import { defineConfig } from 'hono-takibi'
|
|
311
311
|
|
|
312
312
|
export default defineConfig({
|
|
313
313
|
input: 'openapi.yaml',
|
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,236 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { resolve } from "node:path";
|
|
4
|
-
import { pathToFileURL } from "node:url";
|
|
5
|
-
import "oxfmt";
|
|
6
|
-
import * as z from "zod";
|
|
7
|
-
//#region src/config/index.ts
|
|
8
|
-
const DirectoryOutputSchema = z.string().regex(/^(?!.*\.ts$).+/, { error: "split mode requires directory, not .ts file" });
|
|
9
|
-
const FileOutputSchema = z.string().transform((v) => v.endsWith(".ts") ? v : `${v}/index.ts`);
|
|
10
|
-
const OutputSchema = z.discriminatedUnion("split", [z.object({
|
|
11
|
-
split: z.literal(true),
|
|
12
|
-
output: DirectoryOutputSchema,
|
|
13
|
-
import: z.string().exactOptional()
|
|
14
|
-
}).readonly(), z.object({
|
|
15
|
-
split: z.literal(false).optional().default(false),
|
|
16
|
-
output: FileOutputSchema,
|
|
17
|
-
import: z.string().exactOptional()
|
|
18
|
-
}).readonly()]).exactOptional();
|
|
19
|
-
const ExportTypesOutputSchema = z.discriminatedUnion("split", [z.object({
|
|
20
|
-
split: z.literal(true),
|
|
21
|
-
output: DirectoryOutputSchema,
|
|
22
|
-
import: z.string().exactOptional(),
|
|
23
|
-
exportTypes: z.boolean().default(false)
|
|
24
|
-
}).readonly(), z.object({
|
|
25
|
-
split: z.literal(false).optional().default(false),
|
|
26
|
-
output: FileOutputSchema,
|
|
27
|
-
import: z.string().exactOptional(),
|
|
28
|
-
exportTypes: z.boolean().default(false)
|
|
29
|
-
}).readonly()]).exactOptional();
|
|
30
|
-
const HooksSchema = z.discriminatedUnion("split", [z.object({
|
|
31
|
-
split: z.literal(true),
|
|
32
|
-
output: DirectoryOutputSchema,
|
|
33
|
-
import: z.string(),
|
|
34
|
-
client: z.string().default("client")
|
|
35
|
-
}).readonly(), z.object({
|
|
36
|
-
split: z.literal(false).optional().default(false),
|
|
37
|
-
output: FileOutputSchema,
|
|
38
|
-
import: z.string(),
|
|
39
|
-
client: z.string().default("client")
|
|
40
|
-
}).readonly()]).exactOptional();
|
|
41
|
-
const RpcSchema = z.discriminatedUnion("split", [z.object({
|
|
42
|
-
split: z.literal(true),
|
|
43
|
-
output: DirectoryOutputSchema,
|
|
44
|
-
import: z.string(),
|
|
45
|
-
client: z.string().default("client"),
|
|
46
|
-
parseResponse: z.boolean().default(false),
|
|
47
|
-
docs: z.boolean().default(false)
|
|
48
|
-
}).readonly(), z.object({
|
|
49
|
-
split: z.literal(false).optional().default(false),
|
|
50
|
-
output: FileOutputSchema,
|
|
51
|
-
import: z.string(),
|
|
52
|
-
client: z.string().default("client"),
|
|
53
|
-
parseResponse: z.boolean().default(false),
|
|
54
|
-
docs: z.boolean().default(false)
|
|
55
|
-
}).readonly()]).exactOptional();
|
|
56
|
-
const ConfigSchema = z.object({
|
|
57
|
-
input: z.templateLiteral([z.string().min(1), z.enum([
|
|
58
|
-
".yaml",
|
|
59
|
-
".json",
|
|
60
|
-
".tsp"
|
|
61
|
-
])], { error: "must be .yaml | .json | .tsp" }),
|
|
62
|
-
output: z.templateLiteral([z.string().min(1), z.enum([".ts"])], { error: "must be .ts file" }).exactOptional(),
|
|
63
|
-
basePath: z.string().default("/"),
|
|
64
|
-
readonly: z.boolean().exactOptional(),
|
|
65
|
-
format: z.custom(() => true).exactOptional(),
|
|
66
|
-
template: z.discriminatedUnion("define", [z.object({
|
|
67
|
-
define: z.literal(true),
|
|
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
|
-
test: z.boolean().default(false),
|
|
79
|
-
pathAlias: z.string().exactOptional(),
|
|
80
|
-
testFramework: z.enum([
|
|
81
|
-
"vitest",
|
|
82
|
-
"vite-plus",
|
|
83
|
-
"bun"
|
|
84
|
-
]).default("vitest").exactOptional()
|
|
85
|
-
}).readonly()]).exactOptional(),
|
|
86
|
-
exportSchemas: z.boolean().default(false),
|
|
87
|
-
exportSchemasTypes: z.boolean().default(false),
|
|
88
|
-
exportResponses: z.boolean().default(false),
|
|
89
|
-
exportParameters: z.boolean().default(false),
|
|
90
|
-
exportParametersTypes: z.boolean().default(false),
|
|
91
|
-
exportExamples: z.boolean().default(false),
|
|
92
|
-
exportRequestBodies: z.boolean().default(false),
|
|
93
|
-
exportHeaders: z.boolean().default(false),
|
|
94
|
-
exportHeadersTypes: z.boolean().default(false),
|
|
95
|
-
exportSecuritySchemes: z.boolean().default(false),
|
|
96
|
-
exportLinks: z.boolean().default(false),
|
|
97
|
-
exportCallbacks: z.boolean().default(false),
|
|
98
|
-
exportPathItems: z.boolean().default(false),
|
|
99
|
-
exportMediaTypes: z.boolean().default(false),
|
|
100
|
-
exportMediaTypesTypes: z.boolean().default(false),
|
|
101
|
-
routes: OutputSchema,
|
|
102
|
-
webhooks: OutputSchema,
|
|
103
|
-
components: z.object({
|
|
104
|
-
output: z.templateLiteral([z.string().min(1), z.enum([".ts"])], { error: "must be .ts file" }).exactOptional(),
|
|
105
|
-
schemas: ExportTypesOutputSchema,
|
|
106
|
-
responses: OutputSchema,
|
|
107
|
-
parameters: ExportTypesOutputSchema,
|
|
108
|
-
examples: OutputSchema,
|
|
109
|
-
requestBodies: OutputSchema,
|
|
110
|
-
headers: ExportTypesOutputSchema,
|
|
111
|
-
securitySchemes: OutputSchema,
|
|
112
|
-
links: OutputSchema,
|
|
113
|
-
callbacks: OutputSchema,
|
|
114
|
-
pathItems: OutputSchema,
|
|
115
|
-
mediaTypes: ExportTypesOutputSchema
|
|
116
|
-
}).readonly().refine((v) => !(v.output && [
|
|
117
|
-
"schemas",
|
|
118
|
-
"responses",
|
|
119
|
-
"parameters",
|
|
120
|
-
"examples",
|
|
121
|
-
"requestBodies",
|
|
122
|
-
"headers",
|
|
123
|
-
"securitySchemes",
|
|
124
|
-
"links",
|
|
125
|
-
"callbacks",
|
|
126
|
-
"pathItems",
|
|
127
|
-
"mediaTypes"
|
|
128
|
-
].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(),
|
|
129
|
-
type: z.object({
|
|
130
|
-
readonly: z.boolean().exactOptional(),
|
|
131
|
-
output: z.templateLiteral([z.string().min(1), z.enum([".ts"])], { error: "must be .ts file" })
|
|
132
|
-
}).readonly().exactOptional(),
|
|
133
|
-
rpc: RpcSchema,
|
|
134
|
-
swr: HooksSchema,
|
|
135
|
-
"tanstack-query": HooksSchema,
|
|
136
|
-
"preact-query": HooksSchema,
|
|
137
|
-
"solid-query": HooksSchema,
|
|
138
|
-
"vue-query": HooksSchema,
|
|
139
|
-
"svelte-query": HooksSchema,
|
|
140
|
-
"angular-query": HooksSchema,
|
|
141
|
-
test: z.object({
|
|
142
|
-
output: FileOutputSchema,
|
|
143
|
-
import: z.string(),
|
|
144
|
-
testFramework: z.enum([
|
|
145
|
-
"vitest",
|
|
146
|
-
"vite-plus",
|
|
147
|
-
"bun"
|
|
148
|
-
]).default("vitest").exactOptional()
|
|
149
|
-
}).readonly().exactOptional(),
|
|
150
|
-
mock: z.object({
|
|
151
|
-
output: FileOutputSchema,
|
|
152
|
-
useExamples: z.boolean().exactOptional(),
|
|
153
|
-
locale: z.string().regex(/^[A-Za-z_]{1,40}$/, { error: "Invalid faker locale. Use a code like 'ja', 'en', or 'zh_CN'." }).exactOptional(),
|
|
154
|
-
delay: z.union([
|
|
155
|
-
z.number().int().nonnegative().max(6e4),
|
|
156
|
-
z.literal(false),
|
|
157
|
-
z.object({
|
|
158
|
-
min: z.number().int().nonnegative().max(6e4),
|
|
159
|
-
max: z.number().int().nonnegative().max(6e4)
|
|
160
|
-
}).readonly().refine((v) => v.min <= v.max, { message: "delay.min must be <= delay.max. Swap the values or remove one." })
|
|
161
|
-
]).exactOptional(),
|
|
162
|
-
arrayMin: z.number().int().nonnegative().max(1e3).exactOptional(),
|
|
163
|
-
arrayMax: z.number().int().nonnegative().max(1e3).exactOptional()
|
|
164
|
-
}).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(),
|
|
165
|
-
docs: z.discriminatedUnion("curl", [z.object({
|
|
166
|
-
output: z.templateLiteral([z.string().min(1), z.enum([".md"])], { error: "must be .md file" }),
|
|
167
|
-
curl: z.literal(true),
|
|
168
|
-
baseUrl: z.string({ error: "baseUrl is required when curl is true" }),
|
|
169
|
-
entry: z.never({ error: "entry cannot be specified when curl is true" }).optional()
|
|
170
|
-
}).readonly(), z.object({
|
|
171
|
-
output: z.templateLiteral([z.string().min(1), z.enum([".md"])], { error: "must be .md file" }),
|
|
172
|
-
curl: z.literal(false).default(false).optional(),
|
|
173
|
-
entry: z.string().exactOptional(),
|
|
174
|
-
baseUrl: z.string().exactOptional()
|
|
175
|
-
}).readonly()]).exactOptional()
|
|
176
|
-
}).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 === true && v.routes), { message: "template.define and routes are mutually exclusive. define derives routes/ next to the app entry (output, default src/index.ts)." }).refine((v) => !(v.template?.define === true && v.output !== void 0 && !(v.output === "index.ts" || v.output.endsWith("/index.ts"))), { message: "with template.define, output is the app entry and must be an index.ts file (e.g. ./src/index.ts), or omitted to default to src/index.ts. Other names collide with the derived routes/ directory." }).refine((v) => !(v.template?.define === true && v.components !== void 0 && [
|
|
177
|
-
"schemas",
|
|
178
|
-
"responses",
|
|
179
|
-
"parameters",
|
|
180
|
-
"examples",
|
|
181
|
-
"requestBodies",
|
|
182
|
-
"headers",
|
|
183
|
-
"securitySchemes",
|
|
184
|
-
"links",
|
|
185
|
-
"callbacks",
|
|
186
|
-
"pathItems",
|
|
187
|
-
"mediaTypes"
|
|
188
|
-
].some((k) => v.components?.[k] !== void 0)), { message: "with template.define, per-type component outputs (components.schemas, components.responses, ...) are not supported. Use components.output for a single components file." }).refine((v) => {
|
|
189
|
-
if (v.template?.define !== true || v.components?.output === void 0) return true;
|
|
190
|
-
const normalize = (p) => p.replace(/^\.\//, "");
|
|
191
|
-
const componentsOutput = normalize(v.components.output);
|
|
192
|
-
const appEntry = normalize(v.output ?? deriveAppEntry(componentsOutput));
|
|
193
|
-
if (!appEntry.endsWith("index.ts")) return true;
|
|
194
|
-
const baseDir = appEntry === "index.ts" ? "" : appEntry.slice(0, -9);
|
|
195
|
-
const routesDir = baseDir === "" ? "routes" : `${baseDir}/routes`;
|
|
196
|
-
return componentsOutput !== appEntry && !componentsOutput.startsWith(`${routesDir}/`);
|
|
197
|
-
}, { message: "with template.define, components.output must not point at the app entry or inside the derived routes/ directory (it would be overwritten). Choose another path, e.g. src/components/index.ts." });
|
|
198
|
-
function parseConfig(config) {
|
|
199
|
-
const result = ConfigSchema.safeParse(config);
|
|
200
|
-
if (!result.success) {
|
|
201
|
-
const issue = result.error.issues[0];
|
|
202
|
-
return {
|
|
203
|
-
ok: false,
|
|
204
|
-
error: `Invalid config: ${issue.path.length > 0 ? `${issue.path.join(".")}: ` : ""}${issue.message}`
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
return {
|
|
208
|
-
ok: true,
|
|
209
|
-
value: result.data
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
async function readConfig() {
|
|
213
|
-
const abs = resolve(process.cwd(), "hono-takibi.config.ts");
|
|
214
|
-
if (!existsSync(abs)) return {
|
|
215
|
-
ok: false,
|
|
216
|
-
error: `Config not found: ${abs}`
|
|
217
|
-
};
|
|
218
|
-
try {
|
|
219
|
-
const mod = await import(pathToFileURL(abs).href);
|
|
220
|
-
if (typeof mod !== "object" || mod === null || !("default" in mod) || mod.default === void 0) return {
|
|
221
|
-
ok: false,
|
|
222
|
-
error: "Config must export default object"
|
|
223
|
-
};
|
|
224
|
-
return parseConfig(mod.default);
|
|
225
|
-
} catch (e) {
|
|
226
|
-
return {
|
|
227
|
-
ok: false,
|
|
228
|
-
error: e instanceof Error ? e.message : String(e)
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
function defineConfig(config) {
|
|
233
|
-
return config;
|
|
234
|
-
}
|
|
235
|
-
//#endregion
|
|
1
|
+
import { defineConfig, parseConfig, readConfig } from "../index.js";
|
|
236
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,7 +1,6 @@
|
|
|
1
|
-
import { f as methodPath, u as makeInferRequestType } from "../../utils-B5PbMfWs.js";
|
|
2
1
|
import { t as emit } from "../../emit-CFR63U4L.js";
|
|
3
|
-
import { c as isOperationLike, f as isRecord, o as isOpenAPIPaths } from "../../guard-
|
|
4
|
-
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";
|
|
5
4
|
import path from "node:path";
|
|
6
5
|
//#region src/core/rpc/index.ts
|
|
7
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 };
|
package/dist/core/type/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { d as makeSafeKey, g as statusCodeToNumber } from "../../utils-B5PbMfWs.js";
|
|
2
1
|
import { t as emit } from "../../emit-CFR63U4L.js";
|
|
3
|
-
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-
|
|
2
|
+
import { L as statusCodeToNumber, M as makeSafeKey, 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-B2ZfZYyO.js";
|
|
4
3
|
import path from "node:path";
|
|
5
4
|
//#region src/core/type/index.ts
|
|
6
5
|
/**
|