@genapi/presets 3.7.0 → 4.0.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/README.md +108 -0
- package/dist/_shared/schema/compiler.d.mts +10 -0
- package/dist/_shared/schema/compiler.mjs +68 -0
- package/dist/_shared/schema/config.d.mts +12 -0
- package/dist/_shared/schema/config.mjs +45 -0
- package/dist/_shared/schema/index.d.mts +4 -0
- package/dist/_shared/schema/index.mjs +5 -0
- package/dist/_shared/schema/parser.d.mts +14 -0
- package/dist/_shared/schema/parser.mjs +49 -0
- package/dist/axios/index.d.mts +8 -8
- package/dist/axios/index.mjs +11 -8
- package/dist/axios/js/config/index.d.mts +4 -1
- package/dist/axios/js/config/index.mjs +18 -1
- package/dist/axios/js/index.d.mts +16 -3
- package/dist/axios/js/index.mjs +16 -4
- package/dist/axios/js/parser/index.d.mts +5 -2
- package/dist/axios/js/parser/index.mjs +38 -2
- package/dist/axios/ts/config/index.d.mts +4 -1
- package/dist/axios/ts/config/index.mjs +20 -1
- package/dist/axios/ts/index.d.mts +16 -3
- package/dist/axios/ts/index.mjs +16 -4
- package/dist/axios/ts/parser/index.d.mts +5 -2
- package/dist/axios/ts/parser/index.mjs +37 -2
- package/dist/chunk-DQk6qfdC.mjs +18 -0
- package/dist/fetch/index.d.mts +9 -8
- package/dist/fetch/index.mjs +13 -8
- package/dist/fetch/js/config/index.d.mts +4 -1
- package/dist/fetch/js/config/index.mjs +12 -1
- package/dist/fetch/js/index.d.mts +16 -3
- package/dist/fetch/js/index.mjs +16 -4
- package/dist/fetch/js/parser/index.d.mts +5 -2
- package/dist/fetch/js/parser/index.mjs +52 -2
- package/dist/fetch/schema/compiler/index.d.mts +6 -0
- package/dist/fetch/schema/compiler/index.mjs +7 -0
- package/dist/fetch/schema/config/index.d.mts +6 -0
- package/dist/fetch/schema/config/index.mjs +7 -0
- package/dist/fetch/schema/index.d.mts +19 -0
- package/dist/fetch/schema/index.mjs +18 -0
- package/dist/fetch/schema/parser/index.d.mts +2 -0
- package/dist/fetch/schema/parser/index.mjs +3 -0
- package/dist/fetch/ts/config/index.d.mts +4 -1
- package/dist/fetch/ts/config/index.mjs +10 -1
- package/dist/fetch/ts/index.d.mts +16 -3
- package/dist/fetch/ts/index.mjs +16 -4
- package/dist/fetch/ts/parser/index.d.mts +5 -2
- package/dist/fetch/ts/parser/index.mjs +47 -2
- package/dist/got/index.d.mts +8 -8
- package/dist/got/index.mjs +11 -8
- package/dist/got/js/config/index.d.mts +4 -1
- package/dist/got/js/config/index.mjs +18 -1
- package/dist/got/js/index.d.mts +16 -3
- package/dist/got/js/index.mjs +16 -4
- package/dist/got/js/parser/index.d.mts +5 -2
- package/dist/got/js/parser/index.mjs +44 -2
- package/dist/got/ts/config/index.d.mts +4 -1
- package/dist/got/ts/config/index.mjs +20 -1
- package/dist/got/ts/index.d.mts +16 -3
- package/dist/got/ts/index.mjs +16 -4
- package/dist/got/ts/parser/index.d.mts +5 -2
- package/dist/got/ts/parser/index.mjs +44 -2
- package/dist/index.d.mts +21 -50
- package/dist/index.mjs +15 -43
- package/dist/ky/index.d.mts +8 -8
- package/dist/ky/index.mjs +11 -8
- package/dist/ky/js/config/index.d.mts +4 -1
- package/dist/ky/js/config/index.mjs +18 -1
- package/dist/ky/js/index.d.mts +16 -3
- package/dist/ky/js/index.mjs +16 -4
- package/dist/ky/js/parser/index.d.mts +5 -2
- package/dist/ky/js/parser/index.mjs +44 -2
- package/dist/ky/ts/config/index.d.mts +4 -1
- package/dist/ky/ts/config/index.mjs +20 -1
- package/dist/ky/ts/index.d.mts +16 -3
- package/dist/ky/ts/index.mjs +16 -4
- package/dist/ky/ts/parser/index.d.mts +5 -2
- package/dist/ky/ts/parser/index.mjs +43 -2
- package/dist/ofetch/index.d.mts +9 -8
- package/dist/ofetch/index.mjs +13 -8
- package/dist/ofetch/js/config/index.d.mts +4 -1
- package/dist/ofetch/js/config/index.mjs +18 -1
- package/dist/ofetch/js/index.d.mts +16 -3
- package/dist/ofetch/js/index.mjs +16 -4
- package/dist/ofetch/js/parser/index.d.mts +5 -2
- package/dist/ofetch/js/parser/index.mjs +42 -2
- package/dist/ofetch/schema/compiler/index.d.mts +6 -0
- package/dist/ofetch/schema/compiler/index.mjs +7 -0
- package/dist/ofetch/schema/config/index.d.mts +6 -0
- package/dist/ofetch/schema/config/index.mjs +10 -0
- package/dist/ofetch/schema/index.d.mts +19 -0
- package/dist/ofetch/schema/index.mjs +18 -0
- package/dist/ofetch/schema/parser/index.d.mts +2 -0
- package/dist/ofetch/schema/parser/index.mjs +3 -0
- package/dist/ofetch/ts/config/index.d.mts +4 -1
- package/dist/ofetch/ts/config/index.mjs +19 -1
- package/dist/ofetch/ts/index.d.mts +16 -3
- package/dist/ofetch/ts/index.mjs +16 -4
- package/dist/ofetch/ts/parser/index.d.mts +5 -2
- package/dist/ofetch/ts/parser/index.mjs +41 -2
- package/dist/{index.d-Ceqrd7FN.d.mts → tanstack/colada/config/index.d.mts} +2 -3
- package/dist/tanstack/colada/config/index.mjs +16 -0
- package/dist/tanstack/colada/index.d.mts +18 -0
- package/dist/tanstack/colada/index.mjs +17 -0
- package/dist/tanstack/colada/parser/index.d.mts +6 -0
- package/dist/tanstack/colada/parser/index.mjs +71 -0
- package/dist/tanstack/index.d.mts +10 -0
- package/dist/tanstack/index.mjs +14 -0
- package/dist/{index.d-7vIBcqWp.d.mts → tanstack/react/config/index.d.mts} +2 -3
- package/dist/tanstack/react/config/index.mjs +16 -0
- package/dist/tanstack/react/index.d.mts +18 -0
- package/dist/tanstack/react/index.mjs +17 -0
- package/dist/tanstack/react/parser/index.d.mts +6 -0
- package/dist/tanstack/react/parser/index.mjs +75 -0
- package/dist/{index.d-C5ya5SE3.d.mts → tanstack/vue/config/index.d.mts} +2 -3
- package/dist/tanstack/vue/config/index.mjs +16 -0
- package/dist/tanstack/vue/index.d.mts +18 -0
- package/dist/tanstack/vue/index.mjs +17 -0
- package/dist/tanstack/vue/parser/index.d.mts +6 -0
- package/dist/tanstack/vue/parser/index.mjs +71 -0
- package/dist/uni/index.d.mts +8 -8
- package/dist/uni/index.mjs +11 -8
- package/dist/uni/js/config/index.d.mts +4 -1
- package/dist/uni/js/config/index.mjs +18 -1
- package/dist/uni/js/index.d.mts +16 -3
- package/dist/uni/js/index.mjs +16 -4
- package/dist/uni/js/parser/index.d.mts +5 -2
- package/dist/uni/js/parser/index.mjs +38 -2
- package/dist/uni/ts/config/index.d.mts +4 -1
- package/dist/uni/ts/config/index.mjs +20 -1
- package/dist/uni/ts/index.d.mts +16 -3
- package/dist/uni/ts/index.mjs +16 -4
- package/dist/uni/ts/parser/index.d.mts +5 -2
- package/dist/uni/ts/parser/index.mjs +37 -2
- package/package.json +26 -6
- package/dist/axios-C--VNFKW.mjs +0 -13
- package/dist/chunk-BL35Yyzp.mjs +0 -12
- package/dist/config-B89EoGE7.mjs +0 -21
- package/dist/config-BGwXcXx1.mjs +0 -21
- package/dist/config-BHBub1xl.mjs +0 -12
- package/dist/config-BJZnXcL3.mjs +0 -14
- package/dist/config-C94x0Nge.mjs +0 -21
- package/dist/config-CEngTpXa.mjs +0 -21
- package/dist/config-CwmGeydd.mjs +0 -19
- package/dist/config-DdUVYIe0.mjs +0 -19
- package/dist/config-DgC2f2AO.mjs +0 -19
- package/dist/config-Dm0OCPw8.mjs +0 -19
- package/dist/config-Dn-mxTew.mjs +0 -19
- package/dist/config-aVU8JEKy.mjs +0 -21
- package/dist/fetch-TYDXDaTS.mjs +0 -13
- package/dist/got-D5A7dJdZ.mjs +0 -13
- package/dist/index.d-1kS19nJx.d.mts +0 -18
- package/dist/index.d-1qaowKKm.d.mts +0 -18
- package/dist/index.d-42t92mX0.d.mts +0 -7
- package/dist/index.d-B0xaEiBX.d.mts +0 -18
- package/dist/index.d-B1m7PaBv.d.mts +0 -14
- package/dist/index.d-B6j2V4Az.d.mts +0 -18
- package/dist/index.d-BCWDJjEV.d.mts +0 -7
- package/dist/index.d-BN2_wiGD.d.mts +0 -18
- package/dist/index.d-BNkgVflG.d.mts +0 -14
- package/dist/index.d-BY4lF6QY.d.mts +0 -7
- package/dist/index.d-BxDzXRov.d.mts +0 -12
- package/dist/index.d-BxQraJfG.d.mts +0 -18
- package/dist/index.d-Bxgqqjp3.d.mts +0 -7
- package/dist/index.d-C0EKSJ26.d.mts +0 -7
- package/dist/index.d-C6gpVbqC.d.mts +0 -12
- package/dist/index.d-CFvCqVRj.d.mts +0 -7
- package/dist/index.d-CJ27pjS6.d.mts +0 -7
- package/dist/index.d-CM3KHaZM.d.mts +0 -12
- package/dist/index.d-CTkBXgsL.d.mts +0 -7
- package/dist/index.d-CXNw0ZkA.d.mts +0 -14
- package/dist/index.d-C_cfONoz.d.mts +0 -14
- package/dist/index.d-Cgflcv1m.d.mts +0 -18
- package/dist/index.d-CmW7DwIV.d.mts +0 -18
- package/dist/index.d-DDTGaUmA.d.mts +0 -14
- package/dist/index.d-DHMHzs8Q.d.mts +0 -14
- package/dist/index.d-DJv4EMYu.d.mts +0 -7
- package/dist/index.d-DOPIfZ0r.d.mts +0 -12
- package/dist/index.d-Dd6ZDpp9.d.mts +0 -12
- package/dist/index.d-DgbGF4C3.d.mts +0 -12
- package/dist/index.d-DmOkv7N9.d.mts +0 -18
- package/dist/index.d-DpQbWiOh.d.mts +0 -14
- package/dist/index.d-Dvtsr9g-.d.mts +0 -14
- package/dist/index.d-LlaJb0pD.d.mts +0 -18
- package/dist/index.d-RZUAACu-.d.mts +0 -14
- package/dist/index.d-SxIr6Uhl.d.mts +0 -18
- package/dist/index.d-TD1X3MeU.d.mts +0 -14
- package/dist/index.d-mJ3Pcxey.d.mts +0 -14
- package/dist/index.d-mXlHJ3vm.d.mts +0 -18
- package/dist/index.d-xPgxVw9l.d.mts +0 -14
- package/dist/js-BHy43BOA.mjs +0 -19
- package/dist/js-CsFu-S2j.mjs +0 -19
- package/dist/js-SMul0x9Q.mjs +0 -19
- package/dist/js-Swp-o6ZG.mjs +0 -19
- package/dist/js-jTe7QP2M.mjs +0 -19
- package/dist/js-rCsJDgHU.mjs +0 -19
- package/dist/ky--lXnn0gU.mjs +0 -13
- package/dist/ofetch-qhtvI1gy.mjs +0 -13
- package/dist/parser-820U-7tY.mjs +0 -79
- package/dist/parser-BEbsKXRG.mjs +0 -74
- package/dist/parser-BMWMb1tW.mjs +0 -65
- package/dist/parser-BMaYANAS.mjs +0 -70
- package/dist/parser-BOXlubkg.mjs +0 -64
- package/dist/parser-B_pvME5o.mjs +0 -71
- package/dist/parser-By1vGa1J.mjs +0 -65
- package/dist/parser-C267rNUI.mjs +0 -71
- package/dist/parser-CFUtEOtZ.mjs +0 -69
- package/dist/parser-CedZCyxl.mjs +0 -68
- package/dist/parser-OUoEsF2d.mjs +0 -64
- package/dist/parser-kk99DwsW.mjs +0 -71
- package/dist/ts-B-VDMOmJ.mjs +0 -19
- package/dist/ts-CBFVpM-p.mjs +0 -19
- package/dist/ts-CBWxAza5.mjs +0 -19
- package/dist/ts-CKsdt6vA.mjs +0 -19
- package/dist/ts-Cnuezdyy.mjs +0 -19
- package/dist/ts-ILF3D-J-.mjs +0 -19
- package/dist/uni-CQMaFViG.mjs +0 -13
package/dist/parser-By1vGa1J.mjs
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformDefinitions, transformParameters, transformUrlSyntax, traversePaths } from "@genapi/parser";
|
|
2
|
-
import { inject, provide } from "@genapi/shared";
|
|
3
|
-
|
|
4
|
-
//#region src/axios/js/parser/index.ts
|
|
5
|
-
function parser(configRead) {
|
|
6
|
-
const source = parseOpenapiSpecification(configRead.source);
|
|
7
|
-
const comments = parseHeaderCommits(source);
|
|
8
|
-
const interfaces = [];
|
|
9
|
-
const functions = [];
|
|
10
|
-
provide({
|
|
11
|
-
interfaces,
|
|
12
|
-
functions
|
|
13
|
-
});
|
|
14
|
-
transformBaseURL(source);
|
|
15
|
-
transformDefinitions(source.definitions);
|
|
16
|
-
transformPaths(source.paths);
|
|
17
|
-
configRead.graphs.comments = comments;
|
|
18
|
-
configRead.graphs.functions = functions;
|
|
19
|
-
configRead.graphs.interfaces = interfaces;
|
|
20
|
-
return configRead;
|
|
21
|
-
}
|
|
22
|
-
function transformPaths(paths) {
|
|
23
|
-
const { configRead, functions, interfaces } = inject();
|
|
24
|
-
traversePaths(paths, (config) => {
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
* function params/function options/function use interfaces
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
const { parameters, interfaces: attachInters, options } = parseMethodParameters(config, {
|
|
31
|
-
body: "data",
|
|
32
|
-
query: "params"
|
|
33
|
-
});
|
|
34
|
-
let { name, description, url, responseType } = parseMethodMetadata(config);
|
|
35
|
-
options.push(["...", "config"]);
|
|
36
|
-
interfaces.push(...attachInters);
|
|
37
|
-
parameters.push({
|
|
38
|
-
type: "import('axios').AxiosRequestConfig",
|
|
39
|
-
name: "config",
|
|
40
|
-
required: false
|
|
41
|
-
});
|
|
42
|
-
options.unshift("url");
|
|
43
|
-
options.unshift(["method", `"${config.method}"`]);
|
|
44
|
-
if (configRead.config.baseURL) options.unshift("baseURL");
|
|
45
|
-
transformParameters(parameters, {
|
|
46
|
-
syntax: "ecmascript",
|
|
47
|
-
configRead,
|
|
48
|
-
description,
|
|
49
|
-
interfaces,
|
|
50
|
-
responseType,
|
|
51
|
-
generic: "import('axios').AxiosResponse<{__type__}>"
|
|
52
|
-
});
|
|
53
|
-
url = transformUrlSyntax(url);
|
|
54
|
-
functions.push({
|
|
55
|
-
export: true,
|
|
56
|
-
name,
|
|
57
|
-
description,
|
|
58
|
-
parameters,
|
|
59
|
-
body: [`const url = ${url}`, `return http.request({ ${literalFieldsToString(options)} })`]
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
//#endregion
|
|
65
|
-
export { parser, transformPaths };
|
package/dist/parser-C267rNUI.mjs
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformBodyStringify, transformDefinitions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
|
|
2
|
-
import { inject, provide } from "@genapi/shared";
|
|
3
|
-
|
|
4
|
-
//#region src/got/js/parser/index.ts
|
|
5
|
-
function parser(configRead) {
|
|
6
|
-
const source = parseOpenapiSpecification(configRead.source);
|
|
7
|
-
const comments = parseHeaderCommits(source);
|
|
8
|
-
const interfaces = [];
|
|
9
|
-
const functions = [];
|
|
10
|
-
provide({
|
|
11
|
-
interfaces,
|
|
12
|
-
functions
|
|
13
|
-
});
|
|
14
|
-
transformBaseURL(source);
|
|
15
|
-
transformDefinitions(source.definitions);
|
|
16
|
-
transformPaths(source.paths);
|
|
17
|
-
configRead.graphs.comments = comments;
|
|
18
|
-
configRead.graphs.functions = functions;
|
|
19
|
-
configRead.graphs.interfaces = interfaces;
|
|
20
|
-
return configRead;
|
|
21
|
-
}
|
|
22
|
-
function transformPaths(paths) {
|
|
23
|
-
const { configRead, functions, interfaces } = inject();
|
|
24
|
-
traversePaths(paths, (config) => {
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
* function params/function options/function use interfaces
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
const { parameters, interfaces: attachInters, options } = parseMethodParameters(config);
|
|
31
|
-
let { name, description, url, responseType } = parseMethodMetadata(config);
|
|
32
|
-
interfaces.push(...attachInters);
|
|
33
|
-
parameters.push({
|
|
34
|
-
name: "config",
|
|
35
|
-
type: "import('got').OptionsOfTextResponseBody",
|
|
36
|
-
required: false
|
|
37
|
-
});
|
|
38
|
-
options.push(["...", "config"]);
|
|
39
|
-
if (configRead.config.baseURL) options.unshift(["prefixUrl", "baseURL"]);
|
|
40
|
-
for (const parameter of parameters) if (parameter.type === "FormData") parameter.type = "any";
|
|
41
|
-
transformParameters(parameters, {
|
|
42
|
-
syntax: "ecmascript",
|
|
43
|
-
configRead,
|
|
44
|
-
description,
|
|
45
|
-
interfaces,
|
|
46
|
-
responseType
|
|
47
|
-
});
|
|
48
|
-
transformBodyStringify("body", {
|
|
49
|
-
options,
|
|
50
|
-
parameters
|
|
51
|
-
});
|
|
52
|
-
transformQueryParams("query", {
|
|
53
|
-
optionKey: "searchParams",
|
|
54
|
-
options
|
|
55
|
-
});
|
|
56
|
-
url = transformUrlSyntax(url);
|
|
57
|
-
functions.push({
|
|
58
|
-
export: true,
|
|
59
|
-
async: true,
|
|
60
|
-
name,
|
|
61
|
-
description,
|
|
62
|
-
parameters,
|
|
63
|
-
body: [`const response = await http(${url}, {
|
|
64
|
-
${literalFieldsToString(options)}
|
|
65
|
-
})`, "return response.json()"]
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
export { parser as parser$4, transformPaths as transformPaths$4 };
|
package/dist/parser-CFUtEOtZ.mjs
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformDefinitions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
|
|
2
|
-
import { inject, provide } from "@genapi/shared";
|
|
3
|
-
|
|
4
|
-
//#region src/ofetch/js/parser/index.ts
|
|
5
|
-
function parser(configRead) {
|
|
6
|
-
const source = parseOpenapiSpecification(configRead.source);
|
|
7
|
-
const comments = parseHeaderCommits(source);
|
|
8
|
-
const interfaces = [];
|
|
9
|
-
const functions = [];
|
|
10
|
-
provide({
|
|
11
|
-
interfaces,
|
|
12
|
-
functions
|
|
13
|
-
});
|
|
14
|
-
transformBaseURL(source);
|
|
15
|
-
transformDefinitions(source.definitions);
|
|
16
|
-
transformPaths(source.paths);
|
|
17
|
-
configRead.graphs.comments = comments;
|
|
18
|
-
configRead.graphs.functions = functions;
|
|
19
|
-
configRead.graphs.interfaces = interfaces;
|
|
20
|
-
return configRead;
|
|
21
|
-
}
|
|
22
|
-
function transformPaths(paths) {
|
|
23
|
-
const { configRead, functions, interfaces } = inject();
|
|
24
|
-
traversePaths(paths, (config) => {
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
* function params/function options/function use interfaces
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
const { parameters, interfaces: attachInters, options } = parseMethodParameters(config, {
|
|
31
|
-
formData: "body",
|
|
32
|
-
query: "params"
|
|
33
|
-
});
|
|
34
|
-
let { name, description, url, responseType, body } = parseMethodMetadata(config);
|
|
35
|
-
interfaces.push(...attachInters);
|
|
36
|
-
parameters.push({
|
|
37
|
-
name: "options",
|
|
38
|
-
type: "import('ofetch').FetchOptions",
|
|
39
|
-
required: false
|
|
40
|
-
});
|
|
41
|
-
options.push(["...", "options"]);
|
|
42
|
-
options.unshift(["method", `"${config.method}"`]);
|
|
43
|
-
if (configRead.config.baseURL) options.unshift("baseURL");
|
|
44
|
-
transformParameters(parameters, {
|
|
45
|
-
syntax: "ecmascript",
|
|
46
|
-
configRead,
|
|
47
|
-
description,
|
|
48
|
-
interfaces,
|
|
49
|
-
responseType
|
|
50
|
-
});
|
|
51
|
-
url = transformQueryParams("query", {
|
|
52
|
-
body,
|
|
53
|
-
options,
|
|
54
|
-
url
|
|
55
|
-
});
|
|
56
|
-
url = transformUrlSyntax(url, { baseURL: configRead.config.baseURL });
|
|
57
|
-
functions.push({
|
|
58
|
-
export: true,
|
|
59
|
-
async: true,
|
|
60
|
-
name,
|
|
61
|
-
description,
|
|
62
|
-
parameters,
|
|
63
|
-
body: [...body, `return ofetch(${url}, {${literalFieldsToString(options)}})`]
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
//#endregion
|
|
69
|
-
export { parser as parser$8, transformPaths as transformPaths$8 };
|
package/dist/parser-CedZCyxl.mjs
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformDefinitions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
|
|
2
|
-
import { inject, provide } from "@genapi/shared";
|
|
3
|
-
|
|
4
|
-
//#region src/ofetch/ts/parser/index.ts
|
|
5
|
-
function parser(configRead) {
|
|
6
|
-
const source = parseOpenapiSpecification(configRead.source);
|
|
7
|
-
const comments = parseHeaderCommits(source);
|
|
8
|
-
const interfaces = [];
|
|
9
|
-
const functions = [];
|
|
10
|
-
provide({
|
|
11
|
-
interfaces,
|
|
12
|
-
functions
|
|
13
|
-
});
|
|
14
|
-
transformBaseURL(source);
|
|
15
|
-
transformDefinitions(source.definitions);
|
|
16
|
-
transformPaths(source.paths);
|
|
17
|
-
configRead.graphs.comments = comments;
|
|
18
|
-
configRead.graphs.functions = functions;
|
|
19
|
-
configRead.graphs.interfaces = interfaces;
|
|
20
|
-
return configRead;
|
|
21
|
-
}
|
|
22
|
-
function transformPaths(paths) {
|
|
23
|
-
const { configRead, functions, interfaces } = inject();
|
|
24
|
-
traversePaths(paths, (config) => {
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
* function params/function options/function use interfaces
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
const { parameters, interfaces: attachInters, options } = parseMethodParameters(config, {
|
|
31
|
-
formData: "body",
|
|
32
|
-
query: "params"
|
|
33
|
-
});
|
|
34
|
-
let { name, description, url, responseType, body } = parseMethodMetadata(config);
|
|
35
|
-
interfaces.push(...attachInters);
|
|
36
|
-
parameters.push({
|
|
37
|
-
name: "options",
|
|
38
|
-
type: "FetchOptions",
|
|
39
|
-
required: false
|
|
40
|
-
});
|
|
41
|
-
options.push(["...", "options"]);
|
|
42
|
-
options.unshift(["method", `"${config.method}"`]);
|
|
43
|
-
if (configRead.config.baseURL) options.unshift("baseURL");
|
|
44
|
-
const { spaceResponseType } = transformParameters(parameters, {
|
|
45
|
-
syntax: "typescript",
|
|
46
|
-
configRead,
|
|
47
|
-
description,
|
|
48
|
-
interfaces,
|
|
49
|
-
responseType
|
|
50
|
-
});
|
|
51
|
-
url = transformQueryParams("query", {
|
|
52
|
-
body,
|
|
53
|
-
options,
|
|
54
|
-
url
|
|
55
|
-
});
|
|
56
|
-
url = transformUrlSyntax(url);
|
|
57
|
-
functions.push({
|
|
58
|
-
export: true,
|
|
59
|
-
name,
|
|
60
|
-
description,
|
|
61
|
-
parameters,
|
|
62
|
-
body: [`return ofetch<${spaceResponseType}>(${url}, {${literalFieldsToString(options)}})`]
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
//#endregion
|
|
68
|
-
export { parser as parser$9, transformPaths as transformPaths$9 };
|
package/dist/parser-OUoEsF2d.mjs
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformDefinitions, transformParameters, transformUrlSyntax, traversePaths } from "@genapi/parser";
|
|
2
|
-
import { inject, provide } from "@genapi/shared";
|
|
3
|
-
|
|
4
|
-
//#region src/axios/ts/parser/index.ts
|
|
5
|
-
function parser(configRead) {
|
|
6
|
-
const source = parseOpenapiSpecification(configRead.source);
|
|
7
|
-
const comments = parseHeaderCommits(source);
|
|
8
|
-
const interfaces = [];
|
|
9
|
-
const functions = [];
|
|
10
|
-
provide({
|
|
11
|
-
interfaces,
|
|
12
|
-
functions
|
|
13
|
-
});
|
|
14
|
-
transformBaseURL(source);
|
|
15
|
-
transformDefinitions(source.definitions);
|
|
16
|
-
transformPaths(source.paths);
|
|
17
|
-
configRead.graphs.comments = comments;
|
|
18
|
-
configRead.graphs.functions = functions;
|
|
19
|
-
configRead.graphs.interfaces = interfaces;
|
|
20
|
-
return configRead;
|
|
21
|
-
}
|
|
22
|
-
function transformPaths(paths) {
|
|
23
|
-
const { configRead, functions, interfaces } = inject();
|
|
24
|
-
traversePaths(paths, (config) => {
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
* function params/function options/function use interfaces
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
const { parameters, interfaces: attachInters, options } = parseMethodParameters(config, {
|
|
31
|
-
body: "data",
|
|
32
|
-
query: "params"
|
|
33
|
-
});
|
|
34
|
-
let { name, description, url, responseType } = parseMethodMetadata(config);
|
|
35
|
-
options.push(["...", "config"]);
|
|
36
|
-
interfaces.push(...attachInters);
|
|
37
|
-
parameters.push({
|
|
38
|
-
name: "config",
|
|
39
|
-
type: "AxiosRequestConfig",
|
|
40
|
-
required: false
|
|
41
|
-
});
|
|
42
|
-
options.unshift("url");
|
|
43
|
-
options.unshift(["method", `"${config.method}"`]);
|
|
44
|
-
if (configRead.config.baseURL) options.unshift("baseURL");
|
|
45
|
-
const { spaceResponseType } = transformParameters(parameters, {
|
|
46
|
-
syntax: "typescript",
|
|
47
|
-
configRead,
|
|
48
|
-
description,
|
|
49
|
-
interfaces,
|
|
50
|
-
responseType
|
|
51
|
-
});
|
|
52
|
-
url = transformUrlSyntax(url);
|
|
53
|
-
functions.push({
|
|
54
|
-
export: true,
|
|
55
|
-
name,
|
|
56
|
-
description,
|
|
57
|
-
parameters,
|
|
58
|
-
body: [`const url = ${url}`, `return http.request<${spaceResponseType}>({ ${literalFieldsToString(options)} })`]
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
//#endregion
|
|
64
|
-
export { parser as parser$1, transformPaths as transformPaths$1 };
|
package/dist/parser-kk99DwsW.mjs
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformBodyStringify, transformDefinitions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
|
|
2
|
-
import { inject, provide } from "@genapi/shared";
|
|
3
|
-
|
|
4
|
-
//#region src/got/ts/parser/index.ts
|
|
5
|
-
function parser(configRead) {
|
|
6
|
-
const source = parseOpenapiSpecification(configRead.source);
|
|
7
|
-
const comments = parseHeaderCommits(source);
|
|
8
|
-
const interfaces = [];
|
|
9
|
-
const functions = [];
|
|
10
|
-
provide({
|
|
11
|
-
interfaces,
|
|
12
|
-
functions
|
|
13
|
-
});
|
|
14
|
-
transformBaseURL(source);
|
|
15
|
-
transformDefinitions(source.definitions);
|
|
16
|
-
transformPaths(source.paths);
|
|
17
|
-
configRead.graphs.comments = comments;
|
|
18
|
-
configRead.graphs.functions = functions;
|
|
19
|
-
configRead.graphs.interfaces = interfaces;
|
|
20
|
-
return configRead;
|
|
21
|
-
}
|
|
22
|
-
function transformPaths(paths) {
|
|
23
|
-
const { configRead, functions, interfaces } = inject();
|
|
24
|
-
traversePaths(paths, (config) => {
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
* function params/function options/function use interfaces
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
const { parameters, interfaces: attachInters, options } = parseMethodParameters(config);
|
|
31
|
-
let { name, description, url, responseType } = parseMethodMetadata(config);
|
|
32
|
-
interfaces.push(...attachInters);
|
|
33
|
-
parameters.push({
|
|
34
|
-
name: "config",
|
|
35
|
-
type: "OptionsOfTextResponseBody",
|
|
36
|
-
required: false
|
|
37
|
-
});
|
|
38
|
-
options.push(["...", "config"]);
|
|
39
|
-
if (configRead.config.baseURL) options.unshift(["prefixUrl", "baseURL"]);
|
|
40
|
-
for (const parameter of parameters) if (parameter.type === "FormData") parameter.type = "any";
|
|
41
|
-
const { spaceResponseType } = transformParameters(parameters, {
|
|
42
|
-
syntax: "typescript",
|
|
43
|
-
configRead,
|
|
44
|
-
description,
|
|
45
|
-
interfaces,
|
|
46
|
-
responseType
|
|
47
|
-
});
|
|
48
|
-
transformBodyStringify("body", {
|
|
49
|
-
options,
|
|
50
|
-
parameters
|
|
51
|
-
});
|
|
52
|
-
transformQueryParams("query", {
|
|
53
|
-
optionKey: "searchParams",
|
|
54
|
-
options
|
|
55
|
-
});
|
|
56
|
-
url = transformUrlSyntax(url);
|
|
57
|
-
functions.push({
|
|
58
|
-
export: true,
|
|
59
|
-
async: true,
|
|
60
|
-
name,
|
|
61
|
-
description,
|
|
62
|
-
parameters,
|
|
63
|
-
body: [`const response = http.${config.method}(${url}, {
|
|
64
|
-
${literalFieldsToString(options)}
|
|
65
|
-
})`, `return response.json<${spaceResponseType}>()`]
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
export { parser as parser$5, transformPaths as transformPaths$5 };
|
package/dist/ts-B-VDMOmJ.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { config$11 as config } from "./config-CEngTpXa.mjs";
|
|
2
|
-
import { parser$11 as parser } from "./parser-BOXlubkg.mjs";
|
|
3
|
-
import pipeline, { compiler as compiler$1, dest as dest$1, generate as generate$1, original as original$1 } from "@genapi/pipeline";
|
|
4
|
-
|
|
5
|
-
//#region src/uni/ts/index.ts
|
|
6
|
-
function openapiPipeline(userConfig) {
|
|
7
|
-
const process = pipeline((userConfig$1) => config(userConfig$1), (configRead) => original$1(configRead), (configRead) => parser(configRead), (configRead) => compiler$1(configRead), (configRead) => generate$1(configRead), (configRead) => dest$1(configRead));
|
|
8
|
-
return process(userConfig);
|
|
9
|
-
}
|
|
10
|
-
openapiPipeline.config = config;
|
|
11
|
-
openapiPipeline.original = original$1;
|
|
12
|
-
openapiPipeline.parser = parser;
|
|
13
|
-
openapiPipeline.compiler = compiler$1;
|
|
14
|
-
openapiPipeline.generate = generate$1;
|
|
15
|
-
openapiPipeline.dest = dest$1;
|
|
16
|
-
var ts_default = openapiPipeline;
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { compiler$1 as compiler$11, dest$1 as dest$11, generate$1 as generate$11, original$1 as original$11, ts_default as ts_default$5 };
|
package/dist/ts-CBFVpM-p.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { config$1 as config } from "./config-B89EoGE7.mjs";
|
|
2
|
-
import { parser$1 as parser } from "./parser-OUoEsF2d.mjs";
|
|
3
|
-
import pipeline, { compiler as compiler$1, dest as dest$1, generate as generate$1, original as original$1 } from "@genapi/pipeline";
|
|
4
|
-
|
|
5
|
-
//#region src/axios/ts/index.ts
|
|
6
|
-
function openapiPipeline(userConfig) {
|
|
7
|
-
const process = pipeline((userConfig$1) => config(userConfig$1), (configRead) => original$1(configRead), (configRead) => parser(configRead), (configRead) => compiler$1(configRead), (configRead) => generate$1(configRead), (configRead) => dest$1(configRead));
|
|
8
|
-
return process(userConfig);
|
|
9
|
-
}
|
|
10
|
-
openapiPipeline.config = config;
|
|
11
|
-
openapiPipeline.original = original$1;
|
|
12
|
-
openapiPipeline.parser = parser;
|
|
13
|
-
openapiPipeline.compiler = compiler$1;
|
|
14
|
-
openapiPipeline.generate = generate$1;
|
|
15
|
-
openapiPipeline.dest = dest$1;
|
|
16
|
-
var ts_default = openapiPipeline;
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { compiler$1, dest$1, generate$1, original$1, ts_default };
|
package/dist/ts-CBWxAza5.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { config$5 as config } from "./config-aVU8JEKy.mjs";
|
|
2
|
-
import { parser$5 as parser } from "./parser-kk99DwsW.mjs";
|
|
3
|
-
import pipeline, { compiler as compiler$1, dest as dest$1, generate as generate$1, original as original$1 } from "@genapi/pipeline";
|
|
4
|
-
|
|
5
|
-
//#region src/got/ts/index.ts
|
|
6
|
-
function openapiPipeline(userConfig) {
|
|
7
|
-
const process = pipeline((userConfig$1) => config(userConfig$1), (configRead) => original$1(configRead), (configRead) => parser(configRead), (configRead) => compiler$1(configRead), (configRead) => generate$1(configRead), (configRead) => dest$1(configRead));
|
|
8
|
-
return process(userConfig);
|
|
9
|
-
}
|
|
10
|
-
openapiPipeline.config = config;
|
|
11
|
-
openapiPipeline.original = original$1;
|
|
12
|
-
openapiPipeline.parser = parser;
|
|
13
|
-
openapiPipeline.compiler = compiler$1;
|
|
14
|
-
openapiPipeline.generate = generate$1;
|
|
15
|
-
openapiPipeline.dest = dest$1;
|
|
16
|
-
var ts_default = openapiPipeline;
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { compiler$1 as compiler$5, dest$1 as dest$5, generate$1 as generate$5, original$1 as original$5, ts_default as ts_default$2 };
|
package/dist/ts-CKsdt6vA.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { config$9 as config } from "./config-C94x0Nge.mjs";
|
|
2
|
-
import { parser$9 as parser } from "./parser-CedZCyxl.mjs";
|
|
3
|
-
import pipeline, { compiler as compiler$1, dest as dest$1, generate as generate$1, original as original$1 } from "@genapi/pipeline";
|
|
4
|
-
|
|
5
|
-
//#region src/ofetch/ts/index.ts
|
|
6
|
-
function openapiPipeline(userConfig) {
|
|
7
|
-
const process = pipeline((userConfig$1) => config(userConfig$1), (configRead) => original$1(configRead), (configRead) => parser(configRead), (configRead) => compiler$1(configRead), (configRead) => generate$1(configRead), (configRead) => dest$1(configRead));
|
|
8
|
-
return process(userConfig);
|
|
9
|
-
}
|
|
10
|
-
openapiPipeline.config = config;
|
|
11
|
-
openapiPipeline.original = original$1;
|
|
12
|
-
openapiPipeline.parser = parser;
|
|
13
|
-
openapiPipeline.compiler = compiler$1;
|
|
14
|
-
openapiPipeline.generate = generate$1;
|
|
15
|
-
openapiPipeline.dest = dest$1;
|
|
16
|
-
var ts_default = openapiPipeline;
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { compiler$1 as compiler$9, dest$1 as dest$9, generate$1 as generate$9, original$1 as original$9, ts_default as ts_default$4 };
|
package/dist/ts-Cnuezdyy.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { config$3 as config } from "./config-BHBub1xl.mjs";
|
|
2
|
-
import { parser$3 as parser } from "./parser-BEbsKXRG.mjs";
|
|
3
|
-
import pipeline, { compiler as compiler$1, dest as dest$1, generate as generate$1, original as original$1 } from "@genapi/pipeline";
|
|
4
|
-
|
|
5
|
-
//#region src/fetch/ts/index.ts
|
|
6
|
-
function openapiPipeline(userConfig) {
|
|
7
|
-
const process = pipeline((userConfig$1) => config(userConfig$1), (configRead) => original$1(configRead), (configRead) => parser(configRead), (configRead) => compiler$1(configRead), (configRead) => generate$1(configRead), (configRead) => dest$1(configRead));
|
|
8
|
-
return process(userConfig);
|
|
9
|
-
}
|
|
10
|
-
openapiPipeline.config = config;
|
|
11
|
-
openapiPipeline.original = original$1;
|
|
12
|
-
openapiPipeline.parser = parser;
|
|
13
|
-
openapiPipeline.compiler = compiler$1;
|
|
14
|
-
openapiPipeline.generate = generate$1;
|
|
15
|
-
openapiPipeline.dest = dest$1;
|
|
16
|
-
var ts_default = openapiPipeline;
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { compiler$1 as compiler$3, dest$1 as dest$3, generate$1 as generate$3, original$1 as original$3, ts_default as ts_default$1 };
|
package/dist/ts-ILF3D-J-.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { config$7 as config } from "./config-BGwXcXx1.mjs";
|
|
2
|
-
import { parser$7 as parser } from "./parser-BMaYANAS.mjs";
|
|
3
|
-
import pipeline, { compiler as compiler$1, dest as dest$1, generate as generate$1, original as original$1 } from "@genapi/pipeline";
|
|
4
|
-
|
|
5
|
-
//#region src/ky/ts/index.ts
|
|
6
|
-
function openapiPipeline(userConfig) {
|
|
7
|
-
const process = pipeline((userConfig$1) => config(userConfig$1), (configRead) => original$1(configRead), (configRead) => parser(configRead), (configRead) => compiler$1(configRead), (configRead) => generate$1(configRead), (configRead) => dest$1(configRead));
|
|
8
|
-
return process(userConfig);
|
|
9
|
-
}
|
|
10
|
-
openapiPipeline.config = config;
|
|
11
|
-
openapiPipeline.original = original$1;
|
|
12
|
-
openapiPipeline.parser = parser;
|
|
13
|
-
openapiPipeline.compiler = compiler$1;
|
|
14
|
-
openapiPipeline.generate = generate$1;
|
|
15
|
-
openapiPipeline.dest = dest$1;
|
|
16
|
-
var ts_default = openapiPipeline;
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { compiler$1 as compiler$7, dest$1 as dest$7, generate$1 as generate$7, original$1 as original$7, ts_default as ts_default$3 };
|
package/dist/uni-CQMaFViG.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { __export } from "./chunk-BL35Yyzp.mjs";
|
|
2
|
-
import { js_default$5 as js_default } from "./js-rCsJDgHU.mjs";
|
|
3
|
-
import { ts_default$5 as ts_default } from "./ts-B-VDMOmJ.mjs";
|
|
4
|
-
|
|
5
|
-
//#region src/uni/index.ts
|
|
6
|
-
var uni_exports = {};
|
|
7
|
-
__export(uni_exports, {
|
|
8
|
-
js: () => js_default,
|
|
9
|
-
ts: () => ts_default
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
export { uni_exports };
|