@genapi/presets 3.4.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/axios/index.d.mts +9 -0
- package/dist/axios/index.mjs +9 -7
- package/dist/axios/js/config/index.d.mts +3 -0
- package/dist/axios/js/config/index.mjs +3 -18
- package/dist/axios/js/index.d.mts +5 -0
- package/dist/axios/js/index.mjs +5 -31
- package/dist/axios/js/parser/index.d.mts +3 -0
- package/dist/axios/js/parser/index.mjs +3 -77
- package/dist/axios/ts/config/index.d.mts +3 -0
- package/dist/axios/ts/config/index.mjs +3 -22
- package/dist/axios/ts/index.d.mts +5 -0
- package/dist/axios/ts/index.mjs +5 -31
- package/dist/axios/ts/parser/index.d.mts +3 -0
- package/dist/axios/ts/parser/index.mjs +3 -76
- package/dist/axios-CG6HLmR9.mjs +13 -0
- package/dist/chunk-BL35Yyzp.mjs +12 -0
- package/dist/config-B6UDPRkS.mjs +12 -0
- package/dist/config-B89EoGE7.mjs +21 -0
- package/dist/config-BGwXcXx1.mjs +21 -0
- package/dist/config-C94x0Nge.mjs +21 -0
- package/dist/config-CEngTpXa.mjs +21 -0
- package/dist/config-CwmGeydd.mjs +19 -0
- package/dist/config-DAHoeaDU.mjs +19 -0
- package/dist/config-DdUVYIe0.mjs +19 -0
- package/dist/config-Dm0OCPw8.mjs +19 -0
- package/dist/config-Dn-mxTew.mjs +19 -0
- package/dist/config-DuQgIn7U.mjs +14 -0
- package/dist/config-aVU8JEKy.mjs +21 -0
- package/dist/fetch/index.d.mts +9 -0
- package/dist/fetch/index.mjs +9 -7
- package/dist/fetch/js/config/index.d.mts +3 -0
- package/dist/fetch/js/config/index.mjs +3 -13
- package/dist/fetch/js/index.d.mts +5 -0
- package/dist/fetch/js/index.mjs +5 -31
- package/dist/fetch/js/parser/index.d.mts +3 -0
- package/dist/fetch/js/parser/index.mjs +3 -83
- package/dist/fetch/ts/config/index.d.mts +3 -0
- package/dist/fetch/ts/config/index.mjs +3 -11
- package/dist/fetch/ts/index.d.mts +5 -0
- package/dist/fetch/ts/index.mjs +5 -31
- package/dist/fetch/ts/parser/index.d.mts +3 -0
- package/dist/fetch/ts/parser/index.mjs +3 -79
- package/dist/fetch-BtwC6Lll.mjs +13 -0
- package/dist/got/index.d.mts +9 -0
- package/dist/got/index.mjs +9 -7
- package/dist/got/js/config/index.d.mts +3 -0
- package/dist/got/js/config/index.mjs +3 -18
- package/dist/got/js/index.d.mts +5 -0
- package/dist/got/js/index.mjs +5 -31
- package/dist/got/js/parser/index.d.mts +3 -0
- package/dist/got/js/parser/index.mjs +3 -82
- package/dist/got/ts/config/index.d.mts +3 -0
- package/dist/got/ts/config/index.mjs +3 -22
- package/dist/got/ts/index.d.mts +5 -0
- package/dist/got/ts/index.mjs +5 -31
- package/dist/got/ts/parser/index.d.mts +3 -0
- package/dist/got/ts/parser/index.mjs +3 -82
- package/dist/got-xeCavgZc.mjs +13 -0
- package/dist/{axios/js/parser/index.d.ts → index.d-4OvQY24D.d.mts} +5 -3
- package/dist/index.d-B0n5Pe6-.d.mts +12 -0
- package/dist/index.d-B1KgwGJV.d.mts +14 -0
- package/dist/index.d-B9C3SJsw.d.mts +7 -0
- package/dist/index.d-BB-bpoWw.d.mts +14 -0
- package/dist/index.d-BDMFuIpi.d.mts +12 -0
- package/dist/index.d-BDy4V2O7.d.mts +18 -0
- package/dist/index.d-BFJinzUY.d.mts +12 -0
- package/dist/index.d-BS6Sm47l.d.mts +18 -0
- package/dist/index.d-BSQRPGuK.d.mts +18 -0
- package/dist/index.d-BXgDnKDv.d.mts +7 -0
- package/dist/{axios/ts/parser/index.d.ts → index.d-BYOoHBar.d.mts} +5 -3
- package/dist/index.d-BahMmqz0.d.mts +18 -0
- package/dist/index.d-BbxRLLMX.d.mts +12 -0
- package/dist/index.d-BguloXfs.d.mts +7 -0
- package/dist/index.d-BgvbkDJL.d.mts +18 -0
- package/dist/index.d-Bknp-d4G.d.mts +14 -0
- package/dist/index.d-BulZ76hJ.d.mts +18 -0
- package/dist/index.d-BupSEh4R.d.mts +18 -0
- package/dist/index.d-CAirdOCT.d.mts +14 -0
- package/dist/index.d-CDf5ausb.d.mts +12 -0
- package/dist/index.d-CN37Zl7u.d.mts +14 -0
- package/dist/index.d-CVL676ax.d.mts +18 -0
- package/dist/index.d-Cb9k2mo6.d.mts +7 -0
- package/dist/index.d-CdRfZiCo.d.mts +18 -0
- package/dist/index.d-CfS61_iH.d.mts +7 -0
- package/dist/index.d-Ckbfjm0G.d.mts +7 -0
- package/dist/index.d-CljgOS4p.d.mts +18 -0
- package/dist/{fetch/js/parser/index.d.ts → index.d-D1pp_HCy.d.mts} +5 -3
- package/dist/index.d-D33XWXy5.d.mts +14 -0
- package/dist/index.d-D6gcSlpm.d.mts +14 -0
- package/dist/index.d-DCtFuYUN.d.mts +18 -0
- package/dist/index.d-DQZa03Va.d.mts +7 -0
- package/dist/index.d-DW8ts-IU.d.mts +14 -0
- package/dist/index.d-D_aZcN-0.d.mts +7 -0
- package/dist/index.d-DgggRtXp.d.mts +7 -0
- package/dist/index.d-DpLq-R_p.d.mts +12 -0
- package/dist/index.d-DrCRTA_-.d.mts +7 -0
- package/dist/index.d-DuVpMG8_.d.mts +18 -0
- package/dist/{fetch/ts/parser/index.d.ts → index.d-KQGa1SFg.d.mts} +5 -3
- package/dist/index.d-O3Nkol5h.d.mts +7 -0
- package/dist/index.d-lzQFIw8d.d.mts +7 -0
- package/dist/index.d.mts +55 -0
- package/dist/index.mjs +54 -20
- package/dist/js-CfKFwY21.mjs +19 -0
- package/dist/js-DGjfw_hH.mjs +19 -0
- package/dist/js-DwgoBEjQ.mjs +19 -0
- package/dist/js-DxwOJyF7.mjs +19 -0
- package/dist/js-nNB2l-OU.mjs +19 -0
- package/dist/js-uo8fh9bT.mjs +19 -0
- package/dist/ky/index.d.mts +9 -0
- package/dist/ky/index.mjs +9 -7
- package/dist/ky/js/config/index.d.mts +3 -0
- package/dist/ky/js/config/index.mjs +3 -18
- package/dist/ky/js/index.d.mts +5 -0
- package/dist/ky/js/index.mjs +5 -31
- package/dist/ky/js/parser/index.d.mts +3 -0
- package/dist/ky/js/parser/index.mjs +3 -79
- package/dist/ky/ts/config/index.d.mts +3 -0
- package/dist/ky/ts/config/index.mjs +3 -22
- package/dist/ky/ts/index.d.mts +5 -0
- package/dist/ky/ts/index.mjs +5 -31
- package/dist/ky/ts/parser/index.d.mts +3 -0
- package/dist/ky/ts/parser/index.mjs +3 -78
- package/dist/ky-B7lRjugo.mjs +13 -0
- package/dist/ofetch/index.d.mts +9 -0
- package/dist/ofetch/index.mjs +9 -7
- package/dist/ofetch/js/config/index.d.mts +3 -0
- package/dist/ofetch/js/config/index.mjs +3 -18
- package/dist/ofetch/js/index.d.mts +5 -0
- package/dist/ofetch/js/index.mjs +5 -31
- package/dist/ofetch/js/parser/index.d.mts +3 -0
- package/dist/ofetch/js/parser/index.mjs +3 -78
- package/dist/ofetch/ts/config/index.d.mts +3 -0
- package/dist/ofetch/ts/config/index.mjs +3 -22
- package/dist/ofetch/ts/index.d.mts +5 -0
- package/dist/ofetch/ts/index.mjs +5 -31
- package/dist/ofetch/ts/parser/index.d.mts +3 -0
- package/dist/ofetch/ts/parser/index.mjs +3 -76
- package/dist/ofetch-2rci5G0X.mjs +13 -0
- package/dist/parser-8NB1Nfwt.mjs +63 -0
- package/dist/parser-BJWwcP0S.mjs +69 -0
- package/dist/parser-CCXpH6OE.mjs +63 -0
- package/dist/parser-CE48730h.mjs +69 -0
- package/dist/parser-CFOZ5-GF.mjs +62 -0
- package/dist/parser-CSJYNO0a.mjs +69 -0
- package/dist/parser-C_kpdHgT.mjs +68 -0
- package/dist/parser-CaRC8JQj.mjs +67 -0
- package/dist/parser-DCA-N9mk.mjs +77 -0
- package/dist/parser-DY9NSCKJ.mjs +72 -0
- package/dist/parser-Dnqps2TD.mjs +66 -0
- package/dist/parser-GwoAS3rw.mjs +62 -0
- package/dist/ts-4mi0Q-kd.mjs +19 -0
- package/dist/ts-BaRFvnl0.mjs +19 -0
- package/dist/ts-BwAPOUdE.mjs +19 -0
- package/dist/ts-C9t_rVQx.mjs +19 -0
- package/dist/ts-CMn2aSnV.mjs +19 -0
- package/dist/ts-D-cZHoFQ.mjs +19 -0
- package/dist/uni/index.d.mts +9 -0
- package/dist/uni/index.mjs +9 -0
- package/dist/uni/js/config/index.d.mts +3 -0
- package/dist/uni/js/config/index.mjs +3 -0
- package/dist/uni/js/index.d.mts +5 -0
- package/dist/uni/js/index.mjs +5 -0
- package/dist/uni/js/parser/index.d.mts +3 -0
- package/dist/uni/js/parser/index.mjs +3 -0
- package/dist/uni/ts/config/index.d.mts +3 -0
- package/dist/uni/ts/config/index.mjs +3 -0
- package/dist/uni/ts/index.d.mts +5 -0
- package/dist/uni/ts/index.mjs +5 -0
- package/dist/uni/ts/parser/index.d.mts +3 -0
- package/dist/uni/ts/parser/index.mjs +3 -0
- package/dist/uni-DZmF7VCX.mjs +13 -0
- package/package.json +15 -15
- package/dist/axios/index.d.ts +0 -9
- package/dist/axios/js/config/index.d.ts +0 -5
- package/dist/axios/js/index.d.ts +0 -18
- package/dist/axios/ts/config/index.d.ts +0 -5
- package/dist/axios/ts/index.d.ts +0 -18
- package/dist/fetch/index.d.ts +0 -9
- package/dist/fetch/js/config/index.d.ts +0 -5
- package/dist/fetch/js/index.d.ts +0 -18
- package/dist/fetch/ts/config/index.d.ts +0 -5
- package/dist/fetch/ts/index.d.ts +0 -18
- package/dist/got/index.d.ts +0 -9
- package/dist/got/js/config/index.d.ts +0 -5
- package/dist/got/js/index.d.ts +0 -18
- package/dist/got/js/parser/index.d.ts +0 -12
- package/dist/got/ts/config/index.d.ts +0 -5
- package/dist/got/ts/index.d.ts +0 -18
- package/dist/got/ts/parser/index.d.ts +0 -12
- package/dist/index-BoRNV5uE.d.ts +0 -8
- package/dist/index-C-Of8dmT.d.ts +0 -8
- package/dist/index-DUlkpebX.d.ts +0 -8
- package/dist/index-doIz4HN1.d.ts +0 -8
- package/dist/index-ln0OpJQY.d.ts +0 -8
- package/dist/index.d.ts +0 -48
- package/dist/ky/index.d.ts +0 -9
- package/dist/ky/js/config/index.d.ts +0 -5
- package/dist/ky/js/index.d.ts +0 -18
- package/dist/ky/js/parser/index.d.ts +0 -12
- package/dist/ky/ts/config/index.d.ts +0 -5
- package/dist/ky/ts/index.d.ts +0 -18
- package/dist/ky/ts/parser/index.d.ts +0 -12
- package/dist/ofetch/index.d.ts +0 -9
- package/dist/ofetch/js/config/index.d.ts +0 -5
- package/dist/ofetch/js/index.d.ts +0 -18
- package/dist/ofetch/js/parser/index.d.ts +0 -12
- package/dist/ofetch/ts/config/index.d.ts +0 -5
- package/dist/ofetch/ts/index.d.ts +0 -18
- package/dist/ofetch/ts/parser/index.d.ts +0 -12
|
@@ -1,78 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
parseHeaderCommits,
|
|
5
|
-
parseMethodMetadata,
|
|
6
|
-
parseMethodParameters,
|
|
7
|
-
parseOpenapiSpecification,
|
|
8
|
-
transformBaseURL,
|
|
9
|
-
transformBodyStringify,
|
|
10
|
-
transformDefinitions,
|
|
11
|
-
transformParameters,
|
|
12
|
-
transformQueryParams,
|
|
13
|
-
transformUrlSyntax,
|
|
14
|
-
traversePaths
|
|
15
|
-
} from "@genapi/parser";
|
|
16
|
-
function parser(configRead) {
|
|
17
|
-
const source = parseOpenapiSpecification(configRead.source);
|
|
18
|
-
const comments = parseHeaderCommits(source);
|
|
19
|
-
const interfaces = [];
|
|
20
|
-
const functions = [];
|
|
21
|
-
transformBaseURL(source, {
|
|
22
|
-
configRead
|
|
23
|
-
});
|
|
24
|
-
transformDefinitions(source.definitions, {
|
|
25
|
-
interfaces
|
|
26
|
-
});
|
|
27
|
-
transformPaths(source.paths, {
|
|
28
|
-
configRead,
|
|
29
|
-
functions,
|
|
30
|
-
interfaces
|
|
31
|
-
});
|
|
32
|
-
configRead.graphs.comments = comments;
|
|
33
|
-
configRead.graphs.functions = functions;
|
|
34
|
-
configRead.graphs.interfaces = interfaces;
|
|
35
|
-
return configRead;
|
|
36
|
-
}
|
|
37
|
-
function transformPaths(paths, { configRead, functions, interfaces }) {
|
|
38
|
-
traversePaths(paths, (config) => {
|
|
39
|
-
const { parameters, interfaces: attachInters, options } = parseMethodParameters(config);
|
|
40
|
-
let { name, description, url, responseType } = parseMethodMetadata(config);
|
|
41
|
-
interfaces.push(...attachInters);
|
|
42
|
-
parameters.push({
|
|
43
|
-
name: "config",
|
|
44
|
-
type: "Options",
|
|
45
|
-
required: false
|
|
46
|
-
});
|
|
47
|
-
options.push(["...", "config"]);
|
|
48
|
-
if (configRead.config.baseURL)
|
|
49
|
-
options.unshift(["prefixUrl", "baseURL"]);
|
|
50
|
-
const { spaceResponseType } = transformParameters(parameters, {
|
|
51
|
-
syntax: "typescript",
|
|
52
|
-
configRead,
|
|
53
|
-
description,
|
|
54
|
-
interfaces,
|
|
55
|
-
responseType
|
|
56
|
-
});
|
|
57
|
-
transformBodyStringify("body", { options, parameters });
|
|
58
|
-
transformQueryParams("query", { optionKey: "searchParams", options });
|
|
59
|
-
url = transformUrlSyntax(url);
|
|
60
|
-
functions.push({
|
|
61
|
-
export: true,
|
|
62
|
-
async: true,
|
|
63
|
-
name,
|
|
64
|
-
description,
|
|
65
|
-
parameters,
|
|
66
|
-
body: [
|
|
67
|
-
`const response = await http(${url}, {
|
|
68
|
-
${literalFieldsToString(options)}
|
|
69
|
-
})`,
|
|
70
|
-
`return response.json<${spaceResponseType}>()`
|
|
71
|
-
]
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
export {
|
|
76
|
-
parser,
|
|
77
|
-
transformPaths
|
|
78
|
-
};
|
|
1
|
+
import { parser$7 as parser, transformPaths$7 as transformPaths } from "../../../parser-C_kpdHgT.mjs";
|
|
2
|
+
|
|
3
|
+
export { parser, transformPaths };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __export } from "./chunk-BL35Yyzp.mjs";
|
|
2
|
+
import { js_default$3 as js_default } from "./js-nNB2l-OU.mjs";
|
|
3
|
+
import { ts_default$3 as ts_default } from "./ts-D-cZHoFQ.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/ky/index.ts
|
|
6
|
+
var ky_exports = {};
|
|
7
|
+
__export(ky_exports, {
|
|
8
|
+
js: () => js_default,
|
|
9
|
+
ts: () => ts_default
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ky_exports };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "../index.d-CN37Zl7u.mjs";
|
|
2
|
+
import "../index.d-lzQFIw8d.mjs";
|
|
3
|
+
import { openapiPipeline$3 as openapiPipeline } from "../index.d-BSQRPGuK.mjs";
|
|
4
|
+
import "../index.d-B1KgwGJV.mjs";
|
|
5
|
+
import "../index.d-Ckbfjm0G.mjs";
|
|
6
|
+
import { openapiPipeline$6 as openapiPipeline$1 } from "../index.d-DCtFuYUN.mjs";
|
|
7
|
+
import "../index.d-DpLq-R_p.mjs";
|
|
8
|
+
|
|
9
|
+
export { openapiPipeline as js, openapiPipeline$1 as ts };
|
package/dist/ofetch/index.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import "../config-Dm0OCPw8.mjs";
|
|
2
|
+
import "../parser-CaRC8JQj.mjs";
|
|
3
|
+
import { js_default$4 as js_default } from "../js-DxwOJyF7.mjs";
|
|
4
|
+
import "../config-C94x0Nge.mjs";
|
|
5
|
+
import "../parser-Dnqps2TD.mjs";
|
|
6
|
+
import { ts_default$4 as ts_default } from "../ts-BaRFvnl0.mjs";
|
|
7
|
+
import "../ofetch-2rci5G0X.mjs";
|
|
8
|
+
|
|
9
|
+
export { js_default as js, ts_default as ts };
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function config(userConfig) {
|
|
5
|
-
userConfig.import = userConfig.import || {};
|
|
6
|
-
userConfig.output = userConfig.output || {};
|
|
7
|
-
userConfig.import.http = userConfig.import.http || "ofetch";
|
|
8
|
-
userConfig.output = replaceMainext(userConfig.output) || "src/api/index.js";
|
|
9
|
-
const configRead = _config(userConfig);
|
|
10
|
-
configRead.graphs.imports.push({
|
|
11
|
-
name: "ofetch",
|
|
12
|
-
value: userConfig.import.http
|
|
13
|
-
});
|
|
14
|
-
return configRead;
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
config
|
|
18
|
-
};
|
|
1
|
+
import { config$8 as config } from "../../../config-Dm0OCPw8.mjs";
|
|
2
|
+
|
|
3
|
+
export { config };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { parser$21 as parser } from "../../index.d-CN37Zl7u.mjs";
|
|
2
|
+
import { config$16 as config } from "../../index.d-lzQFIw8d.mjs";
|
|
3
|
+
import { compiler$15 as compiler, dest$15 as dest, generate$15 as generate, openapiPipeline$3 as openapiPipeline, original$15 as original } from "../../index.d-BSQRPGuK.mjs";
|
|
4
|
+
|
|
5
|
+
export { compiler, config, openapiPipeline as default, dest, generate, original, parser };
|
package/dist/ofetch/js/index.mjs
CHANGED
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const process = pipeline(
|
|
7
|
-
(userConfig2) => config(userConfig2),
|
|
8
|
-
(configRead) => original(configRead),
|
|
9
|
-
(configRead) => parser(configRead),
|
|
10
|
-
(configRead) => compiler(configRead),
|
|
11
|
-
(configRead) => generate(configRead),
|
|
12
|
-
(configRead) => dest(configRead)
|
|
13
|
-
);
|
|
14
|
-
return process(userConfig);
|
|
15
|
-
}
|
|
16
|
-
openapiPipeline.config = config;
|
|
17
|
-
openapiPipeline.original = original;
|
|
18
|
-
openapiPipeline.parser = parser;
|
|
19
|
-
openapiPipeline.compiler = compiler;
|
|
20
|
-
openapiPipeline.generate = generate;
|
|
21
|
-
openapiPipeline.dest = dest;
|
|
22
|
-
var js_default = openapiPipeline;
|
|
23
|
-
export {
|
|
24
|
-
compiler,
|
|
25
|
-
config,
|
|
26
|
-
js_default as default,
|
|
27
|
-
dest,
|
|
28
|
-
generate,
|
|
29
|
-
original,
|
|
30
|
-
parser
|
|
31
|
-
};
|
|
1
|
+
import { config$8 as config } from "../../config-Dm0OCPw8.mjs";
|
|
2
|
+
import { parser$8 as parser } from "../../parser-CaRC8JQj.mjs";
|
|
3
|
+
import { compiler$8 as compiler, dest$8 as dest, generate$8 as generate, js_default$4 as js_default, original$8 as original } from "../../js-DxwOJyF7.mjs";
|
|
4
|
+
|
|
5
|
+
export { compiler, config, js_default as default, dest, generate, original, parser };
|
|
@@ -1,78 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
parseHeaderCommits,
|
|
5
|
-
parseMethodMetadata,
|
|
6
|
-
parseMethodParameters,
|
|
7
|
-
parseOpenapiSpecification,
|
|
8
|
-
transformBaseURL,
|
|
9
|
-
transformDefinitions,
|
|
10
|
-
transformParameters,
|
|
11
|
-
transformQueryParams,
|
|
12
|
-
transformUrlSyntax,
|
|
13
|
-
traversePaths
|
|
14
|
-
} from "@genapi/parser";
|
|
15
|
-
function parser(configRead) {
|
|
16
|
-
const source = parseOpenapiSpecification(configRead.source);
|
|
17
|
-
const comments = parseHeaderCommits(source);
|
|
18
|
-
const interfaces = [];
|
|
19
|
-
const functions = [];
|
|
20
|
-
transformBaseURL(source, {
|
|
21
|
-
configRead
|
|
22
|
-
});
|
|
23
|
-
transformDefinitions(source.definitions, {
|
|
24
|
-
interfaces
|
|
25
|
-
});
|
|
26
|
-
transformPaths(source.paths, {
|
|
27
|
-
configRead,
|
|
28
|
-
functions,
|
|
29
|
-
interfaces
|
|
30
|
-
});
|
|
31
|
-
configRead.graphs.comments = comments;
|
|
32
|
-
configRead.graphs.functions = functions;
|
|
33
|
-
configRead.graphs.interfaces = interfaces;
|
|
34
|
-
return configRead;
|
|
35
|
-
}
|
|
36
|
-
function transformPaths(paths, { configRead, functions, interfaces }) {
|
|
37
|
-
traversePaths(paths, (config) => {
|
|
38
|
-
const { parameters, interfaces: attachInters, options } = parseMethodParameters(config, {
|
|
39
|
-
formData: "body",
|
|
40
|
-
query: "params"
|
|
41
|
-
});
|
|
42
|
-
let { name, description, url, responseType, body } = parseMethodMetadata(config);
|
|
43
|
-
interfaces.push(...attachInters);
|
|
44
|
-
parameters.push({
|
|
45
|
-
name: "options",
|
|
46
|
-
type: "import('ofetch').FetchOptions",
|
|
47
|
-
required: false
|
|
48
|
-
});
|
|
49
|
-
options.push(["...", "options"]);
|
|
50
|
-
options.unshift(["method", `"${config.method}"`]);
|
|
51
|
-
if (configRead.config.baseURL)
|
|
52
|
-
options.unshift("baseURL");
|
|
53
|
-
transformParameters(parameters, {
|
|
54
|
-
syntax: "ecmascript",
|
|
55
|
-
configRead,
|
|
56
|
-
description,
|
|
57
|
-
interfaces,
|
|
58
|
-
responseType
|
|
59
|
-
});
|
|
60
|
-
url = transformQueryParams("query", { body, options, url });
|
|
61
|
-
url = transformUrlSyntax(url, { baseURL: configRead.config.baseURL });
|
|
62
|
-
functions.push({
|
|
63
|
-
export: true,
|
|
64
|
-
async: true,
|
|
65
|
-
name,
|
|
66
|
-
description,
|
|
67
|
-
parameters,
|
|
68
|
-
body: [
|
|
69
|
-
...body,
|
|
70
|
-
`return ofetch(${url}, {${literalFieldsToString(options)}})`
|
|
71
|
-
]
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
export {
|
|
76
|
-
parser,
|
|
77
|
-
transformPaths
|
|
78
|
-
};
|
|
1
|
+
import { parser$8 as parser, transformPaths$8 as transformPaths } from "../../../parser-CaRC8JQj.mjs";
|
|
2
|
+
|
|
3
|
+
export { parser, transformPaths };
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
userConfig.import = userConfig.import || {};
|
|
5
|
-
userConfig.import.http = userConfig.import.http || "ofetch";
|
|
6
|
-
const configRead = _config(userConfig);
|
|
7
|
-
configRead.graphs.imports.push({
|
|
8
|
-
name: "ofetch",
|
|
9
|
-
names: userConfig.import.http === "ofetch" ? ["FetchOptions"] : void 0,
|
|
10
|
-
value: userConfig.import.http
|
|
11
|
-
});
|
|
12
|
-
if (userConfig.import.http !== "ofetch") {
|
|
13
|
-
configRead.graphs.imports.push({
|
|
14
|
-
names: ["FetchOptions"],
|
|
15
|
-
value: "ofetch"
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return configRead;
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
config
|
|
22
|
-
};
|
|
1
|
+
import { config$9 as config } from "../../../config-C94x0Nge.mjs";
|
|
2
|
+
|
|
3
|
+
export { config };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { parser$22 as parser } from "../../index.d-B1KgwGJV.mjs";
|
|
2
|
+
import { config$13 as config } from "../../index.d-Ckbfjm0G.mjs";
|
|
3
|
+
import { compiler$18 as compiler, dest$18 as dest, generate$18 as generate, openapiPipeline$6 as openapiPipeline, original$18 as original } from "../../index.d-DCtFuYUN.mjs";
|
|
4
|
+
|
|
5
|
+
export { compiler, config, openapiPipeline as default, dest, generate, original, parser };
|
package/dist/ofetch/ts/index.mjs
CHANGED
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const process = pipeline(
|
|
7
|
-
(userConfig2) => config(userConfig2),
|
|
8
|
-
(configRead) => original(configRead),
|
|
9
|
-
(configRead) => parser(configRead),
|
|
10
|
-
(configRead) => compiler(configRead),
|
|
11
|
-
(configRead) => generate(configRead),
|
|
12
|
-
(configRead) => dest(configRead)
|
|
13
|
-
);
|
|
14
|
-
return process(userConfig);
|
|
15
|
-
}
|
|
16
|
-
openapiPipeline.config = config;
|
|
17
|
-
openapiPipeline.original = original;
|
|
18
|
-
openapiPipeline.parser = parser;
|
|
19
|
-
openapiPipeline.compiler = compiler;
|
|
20
|
-
openapiPipeline.generate = generate;
|
|
21
|
-
openapiPipeline.dest = dest;
|
|
22
|
-
var ts_default = openapiPipeline;
|
|
23
|
-
export {
|
|
24
|
-
compiler,
|
|
25
|
-
config,
|
|
26
|
-
ts_default as default,
|
|
27
|
-
dest,
|
|
28
|
-
generate,
|
|
29
|
-
original,
|
|
30
|
-
parser
|
|
31
|
-
};
|
|
1
|
+
import { config$9 as config } from "../../config-C94x0Nge.mjs";
|
|
2
|
+
import { parser$10 as parser } from "../../parser-Dnqps2TD.mjs";
|
|
3
|
+
import { compiler$10 as compiler, dest$10 as dest, generate$10 as generate, original$10 as original, ts_default$4 as ts_default } from "../../ts-BaRFvnl0.mjs";
|
|
4
|
+
|
|
5
|
+
export { compiler, config, ts_default as default, dest, generate, original, parser };
|
|
@@ -1,76 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
parseHeaderCommits,
|
|
5
|
-
parseMethodMetadata,
|
|
6
|
-
parseMethodParameters,
|
|
7
|
-
parseOpenapiSpecification,
|
|
8
|
-
transformBaseURL,
|
|
9
|
-
transformDefinitions,
|
|
10
|
-
transformParameters,
|
|
11
|
-
transformQueryParams,
|
|
12
|
-
transformUrlSyntax,
|
|
13
|
-
traversePaths
|
|
14
|
-
} from "@genapi/parser";
|
|
15
|
-
function parser(configRead) {
|
|
16
|
-
const source = parseOpenapiSpecification(configRead.source);
|
|
17
|
-
const comments = parseHeaderCommits(source);
|
|
18
|
-
const interfaces = [];
|
|
19
|
-
const functions = [];
|
|
20
|
-
transformBaseURL(source, {
|
|
21
|
-
configRead
|
|
22
|
-
});
|
|
23
|
-
transformDefinitions(source.definitions, {
|
|
24
|
-
interfaces
|
|
25
|
-
});
|
|
26
|
-
transformPaths(source.paths, {
|
|
27
|
-
configRead,
|
|
28
|
-
functions,
|
|
29
|
-
interfaces
|
|
30
|
-
});
|
|
31
|
-
configRead.graphs.comments = comments;
|
|
32
|
-
configRead.graphs.functions = functions;
|
|
33
|
-
configRead.graphs.interfaces = interfaces;
|
|
34
|
-
return configRead;
|
|
35
|
-
}
|
|
36
|
-
function transformPaths(paths, { configRead, functions, interfaces }) {
|
|
37
|
-
traversePaths(paths, (config) => {
|
|
38
|
-
const { parameters, interfaces: attachInters, options } = parseMethodParameters(config, {
|
|
39
|
-
formData: "body",
|
|
40
|
-
query: "params"
|
|
41
|
-
});
|
|
42
|
-
let { name, description, url, responseType, body } = parseMethodMetadata(config);
|
|
43
|
-
interfaces.push(...attachInters);
|
|
44
|
-
parameters.push({
|
|
45
|
-
name: "options",
|
|
46
|
-
type: "FetchOptions",
|
|
47
|
-
required: false
|
|
48
|
-
});
|
|
49
|
-
options.push(["...", "options"]);
|
|
50
|
-
options.unshift(["method", `"${config.method}"`]);
|
|
51
|
-
if (configRead.config.baseURL)
|
|
52
|
-
options.unshift("baseURL");
|
|
53
|
-
const { spaceResponseType } = transformParameters(parameters, {
|
|
54
|
-
syntax: "typescript",
|
|
55
|
-
configRead,
|
|
56
|
-
description,
|
|
57
|
-
interfaces,
|
|
58
|
-
responseType
|
|
59
|
-
});
|
|
60
|
-
url = transformQueryParams("query", { body, options, url });
|
|
61
|
-
url = transformUrlSyntax(url);
|
|
62
|
-
functions.push({
|
|
63
|
-
export: true,
|
|
64
|
-
name,
|
|
65
|
-
description,
|
|
66
|
-
parameters,
|
|
67
|
-
body: [
|
|
68
|
-
`return ofetch<${spaceResponseType}>(${url}, {${literalFieldsToString(options)}})`
|
|
69
|
-
]
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
export {
|
|
74
|
-
parser,
|
|
75
|
-
transformPaths
|
|
76
|
-
};
|
|
1
|
+
import { parser$10 as parser, transformPaths$10 as transformPaths } from "../../../parser-Dnqps2TD.mjs";
|
|
2
|
+
|
|
3
|
+
export { parser, transformPaths };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __export } from "./chunk-BL35Yyzp.mjs";
|
|
2
|
+
import { js_default$4 as js_default } from "./js-DxwOJyF7.mjs";
|
|
3
|
+
import { ts_default$4 as ts_default } from "./ts-BaRFvnl0.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/ofetch/index.ts
|
|
6
|
+
var ofetch_exports = {};
|
|
7
|
+
__export(ofetch_exports, {
|
|
8
|
+
js: () => js_default,
|
|
9
|
+
ts: () => ts_default
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ofetch_exports };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformDefinitions, transformParameters, transformUrlSyntax, traversePaths } from "@genapi/parser";
|
|
2
|
+
|
|
3
|
+
//#region src/axios/js/parser/index.ts
|
|
4
|
+
function parser(configRead) {
|
|
5
|
+
const source = parseOpenapiSpecification(configRead.source);
|
|
6
|
+
const comments = parseHeaderCommits(source);
|
|
7
|
+
const interfaces = [];
|
|
8
|
+
const functions = [];
|
|
9
|
+
transformBaseURL(source, { configRead });
|
|
10
|
+
transformDefinitions(source.definitions, { interfaces });
|
|
11
|
+
transformPaths(source.paths, {
|
|
12
|
+
configRead,
|
|
13
|
+
functions,
|
|
14
|
+
interfaces
|
|
15
|
+
});
|
|
16
|
+
configRead.graphs.comments = comments;
|
|
17
|
+
configRead.graphs.functions = functions;
|
|
18
|
+
configRead.graphs.interfaces = interfaces;
|
|
19
|
+
return configRead;
|
|
20
|
+
}
|
|
21
|
+
function transformPaths(paths, { configRead, functions, interfaces }) {
|
|
22
|
+
traversePaths(paths, (config) => {
|
|
23
|
+
/**
|
|
24
|
+
|
|
25
|
+
* function params/function options/function use interfaces
|
|
26
|
+
|
|
27
|
+
*/
|
|
28
|
+
const { parameters, interfaces: attachInters, options } = parseMethodParameters(config, {
|
|
29
|
+
body: "data",
|
|
30
|
+
query: "params"
|
|
31
|
+
});
|
|
32
|
+
let { name, description, url, responseType } = parseMethodMetadata(config);
|
|
33
|
+
options.push(["...", "config"]);
|
|
34
|
+
interfaces.push(...attachInters);
|
|
35
|
+
parameters.push({
|
|
36
|
+
type: "import('axios').AxiosRequestConfig",
|
|
37
|
+
name: "config",
|
|
38
|
+
required: false
|
|
39
|
+
});
|
|
40
|
+
options.unshift("url");
|
|
41
|
+
options.unshift(["method", `"${config.method}"`]);
|
|
42
|
+
if (configRead.config.baseURL) options.unshift("baseURL");
|
|
43
|
+
transformParameters(parameters, {
|
|
44
|
+
syntax: "ecmascript",
|
|
45
|
+
configRead,
|
|
46
|
+
description,
|
|
47
|
+
interfaces,
|
|
48
|
+
responseType,
|
|
49
|
+
generic: "import('axios').AxiosResponse<{__type__}>"
|
|
50
|
+
});
|
|
51
|
+
url = transformUrlSyntax(url);
|
|
52
|
+
functions.push({
|
|
53
|
+
export: true,
|
|
54
|
+
name,
|
|
55
|
+
description,
|
|
56
|
+
parameters,
|
|
57
|
+
body: [`const url = ${url}`, `return http.request({ ${literalFieldsToString(options)} })`]
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { parser, transformPaths };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformBodyStringify, transformDefinitions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
|
|
2
|
+
|
|
3
|
+
//#region src/got/ts/parser/index.ts
|
|
4
|
+
function parser(configRead) {
|
|
5
|
+
const source = parseOpenapiSpecification(configRead.source);
|
|
6
|
+
const comments = parseHeaderCommits(source);
|
|
7
|
+
const interfaces = [];
|
|
8
|
+
const functions = [];
|
|
9
|
+
transformBaseURL(source, { configRead });
|
|
10
|
+
transformDefinitions(source.definitions, { interfaces });
|
|
11
|
+
transformPaths(source.paths, {
|
|
12
|
+
configRead,
|
|
13
|
+
functions,
|
|
14
|
+
interfaces
|
|
15
|
+
});
|
|
16
|
+
configRead.graphs.comments = comments;
|
|
17
|
+
configRead.graphs.functions = functions;
|
|
18
|
+
configRead.graphs.interfaces = interfaces;
|
|
19
|
+
return configRead;
|
|
20
|
+
}
|
|
21
|
+
function transformPaths(paths, { configRead, functions, interfaces }) {
|
|
22
|
+
traversePaths(paths, (config) => {
|
|
23
|
+
/**
|
|
24
|
+
|
|
25
|
+
* function params/function options/function use interfaces
|
|
26
|
+
|
|
27
|
+
*/
|
|
28
|
+
const { parameters, interfaces: attachInters, options } = parseMethodParameters(config);
|
|
29
|
+
let { name, description, url, responseType } = parseMethodMetadata(config);
|
|
30
|
+
interfaces.push(...attachInters);
|
|
31
|
+
parameters.push({
|
|
32
|
+
name: "config",
|
|
33
|
+
type: "OptionsOfTextResponseBody",
|
|
34
|
+
required: false
|
|
35
|
+
});
|
|
36
|
+
options.push(["...", "config"]);
|
|
37
|
+
if (configRead.config.baseURL) options.unshift(["prefixUrl", "baseURL"]);
|
|
38
|
+
for (const parameter of parameters) if (parameter.type === "FormData") parameter.type = "any";
|
|
39
|
+
const { spaceResponseType } = transformParameters(parameters, {
|
|
40
|
+
syntax: "typescript",
|
|
41
|
+
configRead,
|
|
42
|
+
description,
|
|
43
|
+
interfaces,
|
|
44
|
+
responseType
|
|
45
|
+
});
|
|
46
|
+
transformBodyStringify("body", {
|
|
47
|
+
options,
|
|
48
|
+
parameters
|
|
49
|
+
});
|
|
50
|
+
transformQueryParams("query", {
|
|
51
|
+
optionKey: "searchParams",
|
|
52
|
+
options
|
|
53
|
+
});
|
|
54
|
+
url = transformUrlSyntax(url);
|
|
55
|
+
functions.push({
|
|
56
|
+
export: true,
|
|
57
|
+
async: true,
|
|
58
|
+
name,
|
|
59
|
+
description,
|
|
60
|
+
parameters,
|
|
61
|
+
body: [`const response = http.${config.method}(${url}, {
|
|
62
|
+
${literalFieldsToString(options)}
|
|
63
|
+
})`, `return response.json<${spaceResponseType}>()`]
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { parser as parser$5, transformPaths as transformPaths$5 };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformDefinitions, transformParameters, transformUrlSyntax, traversePaths } from "@genapi/parser";
|
|
2
|
+
|
|
3
|
+
//#region src/uni/js/parser/index.ts
|
|
4
|
+
function parser(configRead) {
|
|
5
|
+
const source = parseOpenapiSpecification(configRead.source);
|
|
6
|
+
const comments = parseHeaderCommits(source);
|
|
7
|
+
const interfaces = [];
|
|
8
|
+
const functions = [];
|
|
9
|
+
transformBaseURL(source, { configRead });
|
|
10
|
+
transformDefinitions(source.definitions, { interfaces });
|
|
11
|
+
transformPaths(source.paths, {
|
|
12
|
+
configRead,
|
|
13
|
+
functions,
|
|
14
|
+
interfaces
|
|
15
|
+
});
|
|
16
|
+
configRead.graphs.comments = comments;
|
|
17
|
+
configRead.graphs.functions = functions;
|
|
18
|
+
configRead.graphs.interfaces = interfaces;
|
|
19
|
+
return configRead;
|
|
20
|
+
}
|
|
21
|
+
function transformPaths(paths, { configRead, functions, interfaces }) {
|
|
22
|
+
traversePaths(paths, (config) => {
|
|
23
|
+
/**
|
|
24
|
+
|
|
25
|
+
* function params/function options/function use interfaces
|
|
26
|
+
|
|
27
|
+
*/
|
|
28
|
+
const { parameters, interfaces: attachInters, options } = parseMethodParameters(config, {
|
|
29
|
+
body: "data",
|
|
30
|
+
query: "params"
|
|
31
|
+
});
|
|
32
|
+
let { name, description, url, responseType } = parseMethodMetadata(config);
|
|
33
|
+
options.push(["...", "config"]);
|
|
34
|
+
interfaces.push(...attachInters);
|
|
35
|
+
parameters.push({
|
|
36
|
+
type: "import('@uni-helper/uni-network').UnConfig<never>",
|
|
37
|
+
name: "config",
|
|
38
|
+
required: false
|
|
39
|
+
});
|
|
40
|
+
options.unshift("url");
|
|
41
|
+
options.unshift(["method", `"${config.method}"`]);
|
|
42
|
+
if (configRead.config.baseURL) options.unshift("baseURL");
|
|
43
|
+
transformParameters(parameters, {
|
|
44
|
+
syntax: "ecmascript",
|
|
45
|
+
configRead,
|
|
46
|
+
description,
|
|
47
|
+
interfaces,
|
|
48
|
+
responseType,
|
|
49
|
+
generic: "import('@uni-helper/uni-network').UnResponse<{__type__}>"
|
|
50
|
+
});
|
|
51
|
+
url = transformUrlSyntax(url);
|
|
52
|
+
functions.push({
|
|
53
|
+
export: true,
|
|
54
|
+
name,
|
|
55
|
+
description,
|
|
56
|
+
parameters,
|
|
57
|
+
body: [`const url = ${url}`, `return http.request({ ${literalFieldsToString(options)} })`]
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { parser as parser$9, transformPaths as transformPaths$9 };
|