@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
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { parser$19 as parser } from "./index.d-Dvtsr9g-.mjs";
|
|
2
|
-
import { config$15 as config } from "./index.d-Ceqrd7FN.mjs";
|
|
3
|
-
import { compiler, compiler as compiler$1, dest, dest as dest$1, generate, generate as generate$1, original, original as original$1 } from "@genapi/pipeline";
|
|
4
|
-
import { ApiPipeline } from "@genapi/shared";
|
|
5
|
-
|
|
6
|
-
//#region src/ky/ts/index.d.ts
|
|
7
|
-
declare function openapiPipeline(userConfig: ApiPipeline.Config): Promise<void>;
|
|
8
|
-
declare namespace openapiPipeline {
|
|
9
|
-
var config: typeof config;
|
|
10
|
-
var original: typeof original;
|
|
11
|
-
var parser: typeof parser;
|
|
12
|
-
var compiler: typeof compiler;
|
|
13
|
-
var generate: typeof generate;
|
|
14
|
-
var dest: typeof dest;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
export { compiler$1 as compiler$23, dest$1 as dest$23, generate$1 as generate$23, openapiPipeline as openapiPipeline$11, original$1 as original$23 };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ApiPipeline, StatementFunction, StatementInterface } from "@genapi/shared";
|
|
2
|
-
import { Paths } from "openapi-specification-types";
|
|
3
|
-
|
|
4
|
-
//#region src/got/ts/parser/index.d.ts
|
|
5
|
-
interface PathsTransformOptions {
|
|
6
|
-
configRead: ApiPipeline.ConfigRead;
|
|
7
|
-
interfaces: StatementInterface[];
|
|
8
|
-
functions: StatementFunction[];
|
|
9
|
-
}
|
|
10
|
-
declare function parser(configRead: ApiPipeline.ConfigRead): ApiPipeline.ConfigRead<ApiPipeline.Config>;
|
|
11
|
-
declare function transformPaths(paths: Paths): void;
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
export { PathsTransformOptions as PathsTransformOptions$3, parser as parser$15, transformPaths as transformPaths$15 };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ApiPipeline, StatementFunction, StatementInterface } from "@genapi/shared";
|
|
2
|
-
import { Paths } from "openapi-specification-types";
|
|
3
|
-
|
|
4
|
-
//#region src/fetch/ts/parser/index.d.ts
|
|
5
|
-
interface PathsTransformOptions {
|
|
6
|
-
configRead: ApiPipeline.ConfigRead;
|
|
7
|
-
interfaces: StatementInterface[];
|
|
8
|
-
functions: StatementFunction[];
|
|
9
|
-
}
|
|
10
|
-
declare function parser(configRead: ApiPipeline.ConfigRead): ApiPipeline.ConfigRead<ApiPipeline.Config>;
|
|
11
|
-
declare function transformPaths(paths: Paths): void;
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
export { PathsTransformOptions as PathsTransformOptions$5, parser as parser$17, transformPaths as transformPaths$17 };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { parser$21 as parser } from "./index.d-xPgxVw9l.mjs";
|
|
2
|
-
import { config$23 as config } from "./index.d-C5ya5SE3.mjs";
|
|
3
|
-
import { compiler, compiler as compiler$1, dest, dest as dest$1, generate, generate as generate$1, original, original as original$1 } from "@genapi/pipeline";
|
|
4
|
-
import { ApiPipeline } from "@genapi/shared";
|
|
5
|
-
|
|
6
|
-
//#region src/uni/js/index.d.ts
|
|
7
|
-
declare function openapiPipeline(userConfig: ApiPipeline.Config): Promise<void>;
|
|
8
|
-
declare namespace openapiPipeline {
|
|
9
|
-
var config: typeof config;
|
|
10
|
-
var original: typeof original;
|
|
11
|
-
var parser: typeof parser;
|
|
12
|
-
var compiler: typeof compiler;
|
|
13
|
-
var generate: typeof generate;
|
|
14
|
-
var dest: typeof dest;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
export { compiler$1 as compiler$18, dest$1 as dest$18, generate$1 as generate$18, openapiPipeline as openapiPipeline$6, original$1 as original$18 };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ApiPipeline, StatementFunction, StatementInterface } from "@genapi/shared";
|
|
2
|
-
import { Paths } from "openapi-specification-types";
|
|
3
|
-
|
|
4
|
-
//#region src/uni/js/parser/index.d.ts
|
|
5
|
-
interface PathsTransformOptions {
|
|
6
|
-
configRead: ApiPipeline.ConfigRead;
|
|
7
|
-
interfaces: StatementInterface[];
|
|
8
|
-
functions: StatementFunction[];
|
|
9
|
-
}
|
|
10
|
-
declare function parser(configRead: ApiPipeline.ConfigRead): ApiPipeline.ConfigRead<ApiPipeline.Config>;
|
|
11
|
-
declare function transformPaths(paths: Paths): void;
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
export { PathsTransformOptions as PathsTransformOptions$9, parser as parser$21, transformPaths as transformPaths$21 };
|
package/dist/js-BHy43BOA.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { config$6 as config } from "./config-DdUVYIe0.mjs";
|
|
2
|
-
import { parser$6 as parser } from "./parser-B_pvME5o.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/js/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 js_default = openapiPipeline;
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { compiler$1 as compiler$6, dest$1 as dest$6, generate$1 as generate$6, js_default as js_default$3, original$1 as original$6 };
|
package/dist/js-CsFu-S2j.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { config$4 as config } from "./config-DgC2f2AO.mjs";
|
|
2
|
-
import { parser$4 as parser } from "./parser-C267rNUI.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/js/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 js_default = openapiPipeline;
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { compiler$1 as compiler$4, dest$1 as dest$4, generate$1 as generate$4, js_default as js_default$2, original$1 as original$4 };
|
package/dist/js-SMul0x9Q.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { config } from "./config-CwmGeydd.mjs";
|
|
2
|
-
import { parser } from "./parser-By1vGa1J.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/js/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 js_default = openapiPipeline;
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { compiler$1 as compiler, dest$1 as dest, generate$1 as generate, js_default, original$1 as original };
|
package/dist/js-Swp-o6ZG.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { config$8 as config } from "./config-Dm0OCPw8.mjs";
|
|
2
|
-
import { parser$8 as parser } from "./parser-CFUtEOtZ.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/js/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 js_default = openapiPipeline;
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { compiler$1 as compiler$8, dest$1 as dest$8, generate$1 as generate$8, js_default as js_default$4, original$1 as original$8 };
|
package/dist/js-jTe7QP2M.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { config$2 as config } from "./config-BJZnXcL3.mjs";
|
|
2
|
-
import { parser$2 as parser } from "./parser-820U-7tY.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/js/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 js_default = openapiPipeline;
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { compiler$1 as compiler$2, dest$1 as dest$2, generate$1 as generate$2, js_default as js_default$1, original$1 as original$2 };
|
package/dist/js-rCsJDgHU.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { config$10 as config } from "./config-Dn-mxTew.mjs";
|
|
2
|
-
import { parser$10 as parser } from "./parser-BMWMb1tW.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/js/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 js_default = openapiPipeline;
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { compiler$1 as compiler$10, dest$1 as dest$10, generate$1 as generate$10, js_default as js_default$5, original$1 as original$10 };
|
package/dist/ky--lXnn0gU.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { __export } from "./chunk-BL35Yyzp.mjs";
|
|
2
|
-
import { js_default$3 as js_default } from "./js-BHy43BOA.mjs";
|
|
3
|
-
import { ts_default$3 as ts_default } from "./ts-ILF3D-J-.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 };
|
package/dist/ofetch-qhtvI1gy.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { __export } from "./chunk-BL35Yyzp.mjs";
|
|
2
|
-
import { js_default$4 as js_default } from "./js-Swp-o6ZG.mjs";
|
|
3
|
-
import { ts_default$4 as ts_default } from "./ts-CKsdt6vA.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 };
|
package/dist/parser-820U-7tY.mjs
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformBodyStringify, transformDefinitions, transformHeaderOptions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
|
|
2
|
-
import { inject, provide } from "@genapi/shared";
|
|
3
|
-
|
|
4
|
-
//#region src/fetch/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, { formData: "body" });
|
|
31
|
-
let { name, description, url, responseType, body } = parseMethodMetadata(config);
|
|
32
|
-
interfaces.push(...attachInters);
|
|
33
|
-
parameters.push({
|
|
34
|
-
name: "config",
|
|
35
|
-
type: "RequestInit",
|
|
36
|
-
required: false
|
|
37
|
-
});
|
|
38
|
-
if (config.method.toLowerCase() !== "get") options.unshift(["method", `"${config.method}"`]);
|
|
39
|
-
transformHeaderOptions("body", {
|
|
40
|
-
options,
|
|
41
|
-
parameters
|
|
42
|
-
});
|
|
43
|
-
options.push(["...", "config"]);
|
|
44
|
-
transformParameters(parameters, {
|
|
45
|
-
syntax: "ecmascript",
|
|
46
|
-
configRead,
|
|
47
|
-
description,
|
|
48
|
-
interfaces,
|
|
49
|
-
responseType
|
|
50
|
-
});
|
|
51
|
-
transformBodyStringify("body", {
|
|
52
|
-
options,
|
|
53
|
-
parameters
|
|
54
|
-
});
|
|
55
|
-
url = transformQueryParams("query", {
|
|
56
|
-
body,
|
|
57
|
-
options,
|
|
58
|
-
url
|
|
59
|
-
});
|
|
60
|
-
url = transformUrlSyntax(url, { baseURL: configRead.config.baseURL });
|
|
61
|
-
functions.push({
|
|
62
|
-
export: true,
|
|
63
|
-
async: true,
|
|
64
|
-
name,
|
|
65
|
-
description,
|
|
66
|
-
parameters,
|
|
67
|
-
body: [
|
|
68
|
-
...body,
|
|
69
|
-
`const response = await fetch(${url}, {
|
|
70
|
-
${literalFieldsToString(options)}
|
|
71
|
-
})`,
|
|
72
|
-
"return response.json()"
|
|
73
|
-
]
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
//#endregion
|
|
79
|
-
export { parser as parser$2, transformPaths as transformPaths$2 };
|
package/dist/parser-BEbsKXRG.mjs
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformBodyStringify, transformDefinitions, transformFetchBody, transformHeaderOptions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
|
|
2
|
-
import { inject, provide } from "@genapi/shared";
|
|
3
|
-
|
|
4
|
-
//#region src/fetch/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, body } = parseMethodMetadata(config);
|
|
32
|
-
interfaces.push(...attachInters);
|
|
33
|
-
parameters.push({
|
|
34
|
-
name: "config",
|
|
35
|
-
type: "RequestInit",
|
|
36
|
-
required: false
|
|
37
|
-
});
|
|
38
|
-
if (config.method.toLowerCase() !== "get") options.unshift(["method", `"${config.method}"`]);
|
|
39
|
-
transformHeaderOptions("body", {
|
|
40
|
-
options,
|
|
41
|
-
parameters
|
|
42
|
-
});
|
|
43
|
-
options.push(["...", "config"]);
|
|
44
|
-
const { spaceResponseType } = transformParameters(parameters, {
|
|
45
|
-
syntax: "typescript",
|
|
46
|
-
configRead,
|
|
47
|
-
description,
|
|
48
|
-
interfaces,
|
|
49
|
-
responseType
|
|
50
|
-
});
|
|
51
|
-
transformBodyStringify("body", {
|
|
52
|
-
options,
|
|
53
|
-
parameters
|
|
54
|
-
});
|
|
55
|
-
url = transformQueryParams("query", {
|
|
56
|
-
body,
|
|
57
|
-
options,
|
|
58
|
-
url
|
|
59
|
-
});
|
|
60
|
-
url = transformUrlSyntax(url, { baseURL: configRead.config.baseURL });
|
|
61
|
-
const fetch = transformFetchBody(url, options, spaceResponseType);
|
|
62
|
-
functions.push({
|
|
63
|
-
export: true,
|
|
64
|
-
async: true,
|
|
65
|
-
name,
|
|
66
|
-
description,
|
|
67
|
-
parameters,
|
|
68
|
-
body: [...body, ...fetch]
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
//#endregion
|
|
74
|
-
export { parser as parser$3, transformPaths as transformPaths$3 };
|
package/dist/parser-BMWMb1tW.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/uni/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('@uni-helper/uni-network').UnConfig<never>",
|
|
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('@uni-helper/uni-network').UnResponse<{__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 as parser$10, transformPaths as transformPaths$10 };
|
package/dist/parser-BMaYANAS.mjs
DELETED
|
@@ -1,70 +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/ky/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: "Options",
|
|
36
|
-
required: false
|
|
37
|
-
});
|
|
38
|
-
options.push(["...", "config"]);
|
|
39
|
-
if (configRead.config.baseURL) options.unshift(["prefixUrl", "baseURL"]);
|
|
40
|
-
const { spaceResponseType } = transformParameters(parameters, {
|
|
41
|
-
syntax: "typescript",
|
|
42
|
-
configRead,
|
|
43
|
-
description,
|
|
44
|
-
interfaces,
|
|
45
|
-
responseType
|
|
46
|
-
});
|
|
47
|
-
transformBodyStringify("body", {
|
|
48
|
-
options,
|
|
49
|
-
parameters
|
|
50
|
-
});
|
|
51
|
-
transformQueryParams("query", {
|
|
52
|
-
optionKey: "searchParams",
|
|
53
|
-
options
|
|
54
|
-
});
|
|
55
|
-
url = transformUrlSyntax(url);
|
|
56
|
-
functions.push({
|
|
57
|
-
export: true,
|
|
58
|
-
async: true,
|
|
59
|
-
name,
|
|
60
|
-
description,
|
|
61
|
-
parameters,
|
|
62
|
-
body: [`const response = await http(${url}, {
|
|
63
|
-
${literalFieldsToString(options)}
|
|
64
|
-
})`, `return response.json<${spaceResponseType}>()`]
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
//#endregion
|
|
70
|
-
export { parser as parser$7, transformPaths as transformPaths$7 };
|
package/dist/parser-BOXlubkg.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/uni/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: "UnConfig<never>",
|
|
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$11, transformPaths as transformPaths$11 };
|
package/dist/parser-B_pvME5o.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/ky/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('ky').Options",
|
|
36
|
-
required: false
|
|
37
|
-
});
|
|
38
|
-
options.push(["...", "config"]);
|
|
39
|
-
if (configRead.config.baseURL) options.unshift(["prefixUrl", "baseURL"]);
|
|
40
|
-
transformParameters(parameters, {
|
|
41
|
-
syntax: "ecmascript",
|
|
42
|
-
configRead,
|
|
43
|
-
description,
|
|
44
|
-
interfaces,
|
|
45
|
-
responseType,
|
|
46
|
-
generic: "import('ky').KyResponse<{__type__}>"
|
|
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$6, transformPaths as transformPaths$6 };
|