@genapi/presets 3.7.1 → 4.1.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.
Files changed (225) hide show
  1. package/LICENSE.md +21 -21
  2. package/README.md +36 -0
  3. package/dist/_shared/query/config.d.mts +14 -0
  4. package/dist/_shared/query/config.mjs +58 -0
  5. package/dist/_shared/query/index.d.mts +3 -0
  6. package/dist/_shared/query/index.mjs +4 -0
  7. package/dist/_shared/query/parser.d.mts +7 -0
  8. package/dist/_shared/query/parser.mjs +75 -0
  9. package/dist/_shared/schema/compiler.d.mts +10 -0
  10. package/dist/_shared/schema/compiler.mjs +70 -0
  11. package/dist/_shared/schema/config.d.mts +12 -0
  12. package/dist/_shared/schema/config.mjs +48 -0
  13. package/dist/_shared/schema/index.d.mts +4 -0
  14. package/dist/_shared/schema/index.mjs +5 -0
  15. package/dist/_shared/schema/parser.d.mts +14 -0
  16. package/dist/_shared/schema/parser.mjs +49 -0
  17. package/dist/axios/index.d.mts +8 -8
  18. package/dist/axios/index.mjs +11 -8
  19. package/dist/axios/js/config/index.d.mts +4 -1
  20. package/dist/axios/js/config/index.mjs +20 -1
  21. package/dist/axios/js/index.d.mts +16 -3
  22. package/dist/axios/js/index.mjs +16 -4
  23. package/dist/axios/js/parser/index.d.mts +5 -2
  24. package/dist/axios/js/parser/index.mjs +38 -2
  25. package/dist/axios/ts/config/index.d.mts +4 -1
  26. package/dist/axios/ts/config/index.mjs +22 -1
  27. package/dist/axios/ts/index.d.mts +16 -3
  28. package/dist/axios/ts/index.mjs +16 -4
  29. package/dist/axios/ts/parser/index.d.mts +5 -2
  30. package/dist/axios/ts/parser/index.mjs +37 -2
  31. package/dist/chunk-DQk6qfdC.mjs +18 -0
  32. package/dist/fetch/index.d.mts +9 -8
  33. package/dist/fetch/index.mjs +13 -8
  34. package/dist/fetch/js/config/index.d.mts +4 -1
  35. package/dist/fetch/js/config/index.mjs +12 -1
  36. package/dist/fetch/js/index.d.mts +16 -3
  37. package/dist/fetch/js/index.mjs +16 -4
  38. package/dist/fetch/js/parser/index.d.mts +5 -2
  39. package/dist/fetch/js/parser/index.mjs +52 -2
  40. package/dist/fetch/schema/compiler/index.d.mts +6 -0
  41. package/dist/fetch/schema/compiler/index.mjs +7 -0
  42. package/dist/fetch/schema/config/index.d.mts +6 -0
  43. package/dist/fetch/schema/config/index.mjs +7 -0
  44. package/dist/fetch/schema/index.d.mts +20 -0
  45. package/dist/fetch/schema/index.mjs +18 -0
  46. package/dist/fetch/schema/parser/index.d.mts +3 -0
  47. package/dist/fetch/schema/parser/index.mjs +3 -0
  48. package/dist/fetch/ts/config/index.d.mts +4 -1
  49. package/dist/fetch/ts/config/index.mjs +10 -1
  50. package/dist/fetch/ts/index.d.mts +16 -3
  51. package/dist/fetch/ts/index.mjs +16 -4
  52. package/dist/fetch/ts/parser/index.d.mts +5 -2
  53. package/dist/fetch/ts/parser/index.mjs +47 -2
  54. package/dist/got/index.d.mts +8 -8
  55. package/dist/got/index.mjs +11 -8
  56. package/dist/got/js/config/index.d.mts +4 -1
  57. package/dist/got/js/config/index.mjs +20 -1
  58. package/dist/got/js/index.d.mts +16 -3
  59. package/dist/got/js/index.mjs +16 -4
  60. package/dist/got/js/parser/index.d.mts +5 -2
  61. package/dist/got/js/parser/index.mjs +44 -2
  62. package/dist/got/ts/config/index.d.mts +4 -1
  63. package/dist/got/ts/config/index.mjs +22 -1
  64. package/dist/got/ts/index.d.mts +16 -3
  65. package/dist/got/ts/index.mjs +16 -4
  66. package/dist/got/ts/parser/index.d.mts +5 -2
  67. package/dist/got/ts/parser/index.mjs +44 -2
  68. package/dist/index.d.mts +24 -50
  69. package/dist/index.mjs +21 -46
  70. package/dist/ky/index.d.mts +8 -8
  71. package/dist/ky/index.mjs +11 -8
  72. package/dist/ky/js/config/index.d.mts +4 -1
  73. package/dist/ky/js/config/index.mjs +20 -1
  74. package/dist/ky/js/index.d.mts +16 -3
  75. package/dist/ky/js/index.mjs +16 -4
  76. package/dist/ky/js/parser/index.d.mts +5 -2
  77. package/dist/ky/js/parser/index.mjs +44 -2
  78. package/dist/ky/ts/config/index.d.mts +4 -1
  79. package/dist/ky/ts/config/index.mjs +22 -1
  80. package/dist/ky/ts/index.d.mts +16 -3
  81. package/dist/ky/ts/index.mjs +16 -4
  82. package/dist/ky/ts/parser/index.d.mts +5 -2
  83. package/dist/ky/ts/parser/index.mjs +43 -2
  84. package/dist/ofetch/index.d.mts +9 -8
  85. package/dist/ofetch/index.mjs +13 -8
  86. package/dist/ofetch/js/config/index.d.mts +4 -1
  87. package/dist/ofetch/js/config/index.mjs +20 -1
  88. package/dist/ofetch/js/index.d.mts +16 -3
  89. package/dist/ofetch/js/index.mjs +16 -4
  90. package/dist/ofetch/js/parser/index.d.mts +5 -2
  91. package/dist/ofetch/js/parser/index.mjs +42 -2
  92. package/dist/ofetch/schema/compiler/index.d.mts +6 -0
  93. package/dist/ofetch/schema/compiler/index.mjs +7 -0
  94. package/dist/ofetch/schema/config/index.d.mts +6 -0
  95. package/dist/ofetch/schema/config/index.mjs +10 -0
  96. package/dist/ofetch/schema/index.d.mts +20 -0
  97. package/dist/ofetch/schema/index.mjs +18 -0
  98. package/dist/ofetch/schema/parser/index.d.mts +3 -0
  99. package/dist/ofetch/schema/parser/index.mjs +3 -0
  100. package/dist/ofetch/ts/config/index.d.mts +4 -1
  101. package/dist/ofetch/ts/config/index.mjs +21 -1
  102. package/dist/ofetch/ts/index.d.mts +16 -3
  103. package/dist/ofetch/ts/index.mjs +16 -4
  104. package/dist/ofetch/ts/parser/index.d.mts +5 -2
  105. package/dist/ofetch/ts/parser/index.mjs +41 -2
  106. package/dist/tanstack/colada/config/index.d.mts +6 -0
  107. package/dist/tanstack/colada/config/index.mjs +7 -0
  108. package/dist/tanstack/colada/index.d.mts +18 -0
  109. package/dist/tanstack/colada/index.mjs +17 -0
  110. package/dist/tanstack/colada/parser/index.d.mts +6 -0
  111. package/dist/tanstack/colada/parser/index.mjs +7 -0
  112. package/dist/tanstack/index.d.mts +10 -0
  113. package/dist/tanstack/index.mjs +14 -0
  114. package/dist/tanstack/react/config/index.d.mts +6 -0
  115. package/dist/tanstack/react/config/index.mjs +7 -0
  116. package/dist/tanstack/react/index.d.mts +18 -0
  117. package/dist/tanstack/react/index.mjs +17 -0
  118. package/dist/tanstack/react/parser/index.d.mts +6 -0
  119. package/dist/tanstack/react/parser/index.mjs +7 -0
  120. package/dist/tanstack/vue/config/index.d.mts +6 -0
  121. package/dist/tanstack/vue/config/index.mjs +7 -0
  122. package/dist/tanstack/vue/index.d.mts +18 -0
  123. package/dist/tanstack/vue/index.mjs +17 -0
  124. package/dist/tanstack/vue/parser/index.d.mts +6 -0
  125. package/dist/tanstack/vue/parser/index.mjs +7 -0
  126. package/dist/uni/index.d.mts +8 -8
  127. package/dist/uni/index.mjs +11 -8
  128. package/dist/uni/js/config/index.d.mts +4 -1
  129. package/dist/uni/js/config/index.mjs +20 -1
  130. package/dist/uni/js/index.d.mts +16 -3
  131. package/dist/uni/js/index.mjs +16 -4
  132. package/dist/uni/js/parser/index.d.mts +5 -2
  133. package/dist/uni/js/parser/index.mjs +38 -2
  134. package/dist/uni/ts/config/index.d.mts +4 -1
  135. package/dist/uni/ts/config/index.mjs +22 -1
  136. package/dist/uni/ts/index.d.mts +16 -3
  137. package/dist/uni/ts/index.mjs +16 -4
  138. package/dist/uni/ts/parser/index.d.mts +5 -2
  139. package/dist/uni/ts/parser/index.mjs +37 -2
  140. package/package.json +26 -6
  141. package/dist/axios-C-GYxVyS.mjs +0 -13
  142. package/dist/chunk-BL35Yyzp.mjs +0 -12
  143. package/dist/config-Bt-OVtrF.mjs +0 -21
  144. package/dist/config-CCf0xLx5.mjs +0 -12
  145. package/dist/config-CDvaM7ZL.mjs +0 -19
  146. package/dist/config-CEngTpXa.mjs +0 -21
  147. package/dist/config-CRdZhud4.mjs +0 -19
  148. package/dist/config-CTDgiXdv.mjs +0 -19
  149. package/dist/config-Dn-mxTew.mjs +0 -19
  150. package/dist/config-Dp9C4aUE.mjs +0 -21
  151. package/dist/config-Duv2zgs0.mjs +0 -14
  152. package/dist/config-IeVj3de_.mjs +0 -21
  153. package/dist/config-SP_VEcsX.mjs +0 -19
  154. package/dist/config-aVU8JEKy.mjs +0 -21
  155. package/dist/fetch-DNLodiAP.mjs +0 -13
  156. package/dist/got-BIOwnc0x.mjs +0 -13
  157. package/dist/index.d-99mf5fZX.d.mts +0 -7
  158. package/dist/index.d-B0Dj119v.d.mts +0 -7
  159. package/dist/index.d-B1n6Tnt1.d.mts +0 -12
  160. package/dist/index.d-BAZgb_b9.d.mts +0 -18
  161. package/dist/index.d-BG_KI3-b.d.mts +0 -7
  162. package/dist/index.d-BfFQykLh.d.mts +0 -12
  163. package/dist/index.d-BkDRl56J.d.mts +0 -7
  164. package/dist/index.d-BsBf_9LO.d.mts +0 -7
  165. package/dist/index.d-BumPVmi6.d.mts +0 -14
  166. package/dist/index.d-Bxb1Ew8J.d.mts +0 -14
  167. package/dist/index.d-BxhX9ZHb.d.mts +0 -14
  168. package/dist/index.d-C7snKiSp.d.mts +0 -18
  169. package/dist/index.d-CBozMBWF.d.mts +0 -14
  170. package/dist/index.d-CDWq1HYV.d.mts +0 -18
  171. package/dist/index.d-CEAmhQXE.d.mts +0 -14
  172. package/dist/index.d-CJvL62Un.d.mts +0 -12
  173. package/dist/index.d-CTkBXgsL.d.mts +0 -7
  174. package/dist/index.d-CV6YWGPd.d.mts +0 -18
  175. package/dist/index.d-C_cfONoz.d.mts +0 -14
  176. package/dist/index.d-CkaW5o1S.d.mts +0 -7
  177. package/dist/index.d-CoyMx1eg.d.mts +0 -14
  178. package/dist/index.d-D2DYrmcB.d.mts +0 -14
  179. package/dist/index.d-D31630wD.d.mts +0 -18
  180. package/dist/index.d-D4dt4SN4.d.mts +0 -12
  181. package/dist/index.d-D8QZqVyr.d.mts +0 -18
  182. package/dist/index.d-DJrTX9xf.d.mts +0 -18
  183. package/dist/index.d-DMF-u4U9.d.mts +0 -18
  184. package/dist/index.d-DRC1cM3h.d.mts +0 -18
  185. package/dist/index.d-DZt4GzNR.d.mts +0 -18
  186. package/dist/index.d-DbmCOzZ_.d.mts +0 -12
  187. package/dist/index.d-Df6nDub9.d.mts +0 -7
  188. package/dist/index.d-DhevLWeK.d.mts +0 -18
  189. package/dist/index.d-Gm6xdqdc.d.mts +0 -14
  190. package/dist/index.d-KiVamk2z.d.mts +0 -12
  191. package/dist/index.d-Oclhn_rY.d.mts +0 -7
  192. package/dist/index.d-SEFhGKxl.d.mts +0 -7
  193. package/dist/index.d-dxrAw57N.d.mts +0 -7
  194. package/dist/index.d-fRobkY_s.d.mts +0 -18
  195. package/dist/index.d-ltrmOwIz.d.mts +0 -14
  196. package/dist/index.d-lzQFIw8d.d.mts +0 -7
  197. package/dist/index.d-mJ3Pcxey.d.mts +0 -14
  198. package/dist/index.d-xPgxVw9l.d.mts +0 -14
  199. package/dist/js-BIi60-ws.mjs +0 -19
  200. package/dist/js-CbvjSthC.mjs +0 -19
  201. package/dist/js-DrRwXaos.mjs +0 -19
  202. package/dist/js-_HvDqbMK.mjs +0 -19
  203. package/dist/js-rCsJDgHU.mjs +0 -19
  204. package/dist/js-tqiiLynG.mjs +0 -19
  205. package/dist/ky-P-rg3kH4.mjs +0 -13
  206. package/dist/ofetch-B_VRlsTN.mjs +0 -13
  207. package/dist/parser-BMWMb1tW.mjs +0 -65
  208. package/dist/parser-BOXlubkg.mjs +0 -64
  209. package/dist/parser-BYrX-ru-.mjs +0 -71
  210. package/dist/parser-BcgivITa.mjs +0 -79
  211. package/dist/parser-BtnVu9-k.mjs +0 -68
  212. package/dist/parser-ChqBZo9I.mjs +0 -70
  213. package/dist/parser-DqCzNFba.mjs +0 -65
  214. package/dist/parser-ZusEtk4G.mjs +0 -74
  215. package/dist/parser-ie6DpPJX.mjs +0 -64
  216. package/dist/parser-kk99DwsW.mjs +0 -71
  217. package/dist/parser-p29Uia9I.mjs +0 -69
  218. package/dist/parser-v9oBdoth.mjs +0 -71
  219. package/dist/ts-B-VDMOmJ.mjs +0 -19
  220. package/dist/ts-BAOPMwAr.mjs +0 -19
  221. package/dist/ts-BEo8NDau.mjs +0 -19
  222. package/dist/ts-C0RacOIG.mjs +0 -19
  223. package/dist/ts-CBWxAza5.mjs +0 -19
  224. package/dist/ts-UnhKokN_.mjs +0 -19
  225. package/dist/uni-CQMaFViG.mjs +0 -13
@@ -1,5 +1,18 @@
1
- import { parser$13 as parser } from "../../index.d-CBozMBWF.mjs";
2
- import { config$19 as config } from "../../index.d-CTkBXgsL.mjs";
3
- import { compiler$16 as compiler, dest$16 as dest, generate$16 as generate, openapiPipeline$4 as openapiPipeline, original$16 as original } from "../../index.d-C7snKiSp.mjs";
1
+ import { config } from "./config/index.mjs";
2
+ import { parser } from "./parser/index.mjs";
3
+ import * as _genapi_pipeline0 from "@genapi/pipeline";
4
+ import { compiler, dest, generate, original } from "@genapi/pipeline";
5
+ import { ApiPipeline } from "@genapi/shared";
4
6
 
7
+ //#region src/got/js/index.d.ts
8
+ declare function openapiPipeline(userConfig: ApiPipeline.Config): Promise<void>;
9
+ declare namespace openapiPipeline {
10
+ var config: typeof config;
11
+ var original: typeof _genapi_pipeline0.original;
12
+ var parser: (configRead: ApiPipeline.ConfigRead) => ApiPipeline.ConfigRead;
13
+ var compiler: typeof _genapi_pipeline0.compiler;
14
+ var generate: typeof _genapi_pipeline0.generate;
15
+ var dest: typeof _genapi_pipeline0.dest;
16
+ }
17
+ //#endregion
5
18
  export { compiler, config, openapiPipeline as default, dest, generate, original, parser };
@@ -1,5 +1,17 @@
1
- import { config$3 as config } from "../../config-CDvaM7ZL.mjs";
2
- import { parser$3 as parser } from "../../parser-BYrX-ru-.mjs";
3
- import { compiler$3 as compiler, dest$3 as dest, generate$3 as generate, js_default$1 as js_default, original$3 as original } from "../../js-CbvjSthC.mjs";
1
+ import { config } from "./config/index.mjs";
2
+ import { parser } from "./parser/index.mjs";
3
+ import pipeline, { compiler, dest, generate, original } from "@genapi/pipeline";
4
4
 
5
- export { compiler, config, js_default as default, dest, generate, original, parser };
5
+ //#region src/got/js/index.ts
6
+ function openapiPipeline(userConfig) {
7
+ return pipeline((userConfig) => config(userConfig), (configRead) => original(configRead), (configRead) => parser(configRead), (configRead) => compiler(configRead), (configRead) => generate(configRead), (configRead) => dest(configRead))(userConfig);
8
+ }
9
+ openapiPipeline.config = config;
10
+ openapiPipeline.original = original;
11
+ openapiPipeline.parser = parser;
12
+ openapiPipeline.compiler = compiler;
13
+ openapiPipeline.generate = generate;
14
+ openapiPipeline.dest = dest;
15
+
16
+ //#endregion
17
+ export { compiler, config, openapiPipeline as default, dest, generate, original, parser };
@@ -1,3 +1,6 @@
1
- import { PathsTransformOptions$1 as PathsTransformOptions, parser$13 as parser, transformPaths$13 as transformPaths } from "../../../index.d-CBozMBWF.mjs";
1
+ import * as _genapi_shared0 from "@genapi/shared";
2
2
 
3
- export { PathsTransformOptions, parser, transformPaths };
3
+ //#region src/got/js/parser/index.d.ts
4
+ declare const parser: (configRead: _genapi_shared0.ApiPipeline.ConfigRead) => _genapi_shared0.ApiPipeline.ConfigRead;
5
+ //#endregion
6
+ export { parser };
@@ -1,3 +1,45 @@
1
- import { parser$3 as parser, transformPaths$3 as transformPaths } from "../../../parser-BYrX-ru-.mjs";
1
+ import { createParser, literalFieldsToString, parseMethodMetadata, parseMethodParameters, transformBodyStringify, transformParameters, transformQueryParams, transformUrlSyntax } from "@genapi/parser";
2
2
 
3
- export { parser, transformPaths };
3
+ //#region src/got/js/parser/index.ts
4
+ const parser = createParser((config, { configRead, functions, interfaces }) => {
5
+ const { parameters, interfaces: attachInters, options } = parseMethodParameters(config);
6
+ let { name, description, url, responseType } = parseMethodMetadata(config);
7
+ attachInters.forEach((i) => interfaces.add("type", i));
8
+ parameters.push({
9
+ name: "config",
10
+ type: "import('got').OptionsOfTextResponseBody",
11
+ required: false
12
+ });
13
+ options.push(["...", "config"]);
14
+ if (configRead.config.meta?.baseURL) options.unshift(["prefixUrl", "baseURL"]);
15
+ for (const parameter of parameters) if (parameter.type === "FormData") parameter.type = "any";
16
+ transformParameters(parameters, {
17
+ syntax: "ecmascript",
18
+ configRead,
19
+ description,
20
+ interfaces: interfaces.all(),
21
+ responseType
22
+ });
23
+ transformBodyStringify("body", {
24
+ options,
25
+ parameters
26
+ });
27
+ transformQueryParams("query", {
28
+ optionKey: "searchParams",
29
+ options
30
+ });
31
+ url = transformUrlSyntax(url);
32
+ functions.add("main", {
33
+ export: true,
34
+ async: true,
35
+ name,
36
+ description,
37
+ parameters,
38
+ body: [`const response = await http(${url}, {
39
+ ${literalFieldsToString(options)}
40
+ })`, "return response.json()"]
41
+ });
42
+ });
43
+
44
+ //#endregion
45
+ export { parser };
@@ -1,3 +1,6 @@
1
- import { config$14 as config } from "../../../index.d-99mf5fZX.mjs";
1
+ import { ApiPipeline } from "@genapi/shared";
2
2
 
3
+ //#region src/got/ts/config/index.d.ts
4
+ declare function config(userConfig: ApiPipeline.Config): ApiPipeline.ConfigRead;
5
+ //#endregion
3
6
  export { config };
@@ -1,3 +1,24 @@
1
- import { config$5 as config } from "../../../config-aVU8JEKy.mjs";
1
+ import { config as config$1 } from "@genapi/pipeline";
2
+ import { inject } from "@genapi/shared";
2
3
 
4
+ //#region src/got/ts/config/index.ts
5
+ function config(userConfig) {
6
+ userConfig.meta = userConfig.meta || {};
7
+ userConfig.meta.import = userConfig.meta.import || {};
8
+ userConfig.meta.import.http = userConfig.meta.import.http || "got";
9
+ const configRead = config$1(userConfig);
10
+ const { imports } = inject();
11
+ imports.add("main", {
12
+ name: "http",
13
+ names: userConfig.meta.import.http === "got" ? ["OptionsOfTextResponseBody"] : void 0,
14
+ value: userConfig.meta.import.http
15
+ });
16
+ if (userConfig.meta.import.http !== "got") imports.add("main", {
17
+ names: ["OptionsOfTextResponseBody"],
18
+ value: "got"
19
+ });
20
+ return configRead;
21
+ }
22
+
23
+ //#endregion
3
24
  export { config };
@@ -1,5 +1,18 @@
1
- import { parser$16 as parser } from "../../index.d-BxhX9ZHb.mjs";
2
- import { config$14 as config } from "../../index.d-99mf5fZX.mjs";
3
- import { compiler$19 as compiler, dest$19 as dest, generate$19 as generate, openapiPipeline$7 as openapiPipeline, original$19 as original } from "../../index.d-D31630wD.mjs";
1
+ import { config } from "./config/index.mjs";
2
+ import { parser } from "./parser/index.mjs";
3
+ import * as _genapi_pipeline0 from "@genapi/pipeline";
4
+ import { compiler, dest, generate, original } from "@genapi/pipeline";
5
+ import { ApiPipeline } from "@genapi/shared";
4
6
 
7
+ //#region src/got/ts/index.d.ts
8
+ declare function openapiPipeline(userConfig: ApiPipeline.Config): Promise<void>;
9
+ declare namespace openapiPipeline {
10
+ var config: typeof config;
11
+ var original: typeof _genapi_pipeline0.original;
12
+ var parser: (configRead: ApiPipeline.ConfigRead) => ApiPipeline.ConfigRead;
13
+ var compiler: typeof _genapi_pipeline0.compiler;
14
+ var generate: typeof _genapi_pipeline0.generate;
15
+ var dest: typeof _genapi_pipeline0.dest;
16
+ }
17
+ //#endregion
5
18
  export { compiler, config, openapiPipeline as default, dest, generate, original, parser };
@@ -1,5 +1,17 @@
1
- import { config$5 as config } from "../../config-aVU8JEKy.mjs";
2
- import { parser$5 as parser } from "../../parser-kk99DwsW.mjs";
3
- import { compiler$5 as compiler, dest$5 as dest, generate$5 as generate, original$5 as original, ts_default$2 as ts_default } from "../../ts-CBWxAza5.mjs";
1
+ import { config } from "./config/index.mjs";
2
+ import { parser } from "./parser/index.mjs";
3
+ import pipeline, { compiler, dest, generate, original } from "@genapi/pipeline";
4
4
 
5
- export { compiler, config, ts_default as default, dest, generate, original, parser };
5
+ //#region src/got/ts/index.ts
6
+ function openapiPipeline(userConfig) {
7
+ return pipeline((userConfig) => config(userConfig), (configRead) => original(configRead), (configRead) => parser(configRead), (configRead) => compiler(configRead), (configRead) => generate(configRead), (configRead) => dest(configRead))(userConfig);
8
+ }
9
+ openapiPipeline.config = config;
10
+ openapiPipeline.original = original;
11
+ openapiPipeline.parser = parser;
12
+ openapiPipeline.compiler = compiler;
13
+ openapiPipeline.generate = generate;
14
+ openapiPipeline.dest = dest;
15
+
16
+ //#endregion
17
+ export { compiler, config, openapiPipeline as default, dest, generate, original, parser };
@@ -1,3 +1,6 @@
1
- import { PathsTransformOptions$4 as PathsTransformOptions, parser$16 as parser, transformPaths$16 as transformPaths } from "../../../index.d-BxhX9ZHb.mjs";
1
+ import * as _genapi_shared0 from "@genapi/shared";
2
2
 
3
- export { PathsTransformOptions, parser, transformPaths };
3
+ //#region src/got/ts/parser/index.d.ts
4
+ declare const parser: (configRead: _genapi_shared0.ApiPipeline.ConfigRead) => _genapi_shared0.ApiPipeline.ConfigRead;
5
+ //#endregion
6
+ export { parser };
@@ -1,3 +1,45 @@
1
- import { parser$5 as parser, transformPaths$5 as transformPaths } from "../../../parser-kk99DwsW.mjs";
1
+ import { createParser, literalFieldsToString, parseMethodMetadata, parseMethodParameters, transformBodyStringify, transformParameters, transformQueryParams, transformUrlSyntax } from "@genapi/parser";
2
2
 
3
- export { parser, transformPaths };
3
+ //#region src/got/ts/parser/index.ts
4
+ const parser = createParser((config, { configRead, functions, interfaces }) => {
5
+ const { parameters, interfaces: attachInters, options } = parseMethodParameters(config);
6
+ let { name, description, url, responseType } = parseMethodMetadata(config);
7
+ attachInters.forEach((i) => interfaces.add("type", i));
8
+ parameters.push({
9
+ name: "config",
10
+ type: "OptionsOfTextResponseBody",
11
+ required: false
12
+ });
13
+ options.push(["...", "config"]);
14
+ if (configRead.config.meta?.baseURL) options.unshift(["prefixUrl", "baseURL"]);
15
+ for (const parameter of parameters) if (parameter.type === "FormData") parameter.type = "any";
16
+ const { spaceResponseType } = transformParameters(parameters, {
17
+ syntax: "typescript",
18
+ configRead,
19
+ description,
20
+ interfaces: interfaces.all(),
21
+ responseType
22
+ });
23
+ transformBodyStringify("body", {
24
+ options,
25
+ parameters
26
+ });
27
+ transformQueryParams("query", {
28
+ optionKey: "searchParams",
29
+ options
30
+ });
31
+ url = transformUrlSyntax(url);
32
+ functions.add("main", {
33
+ export: true,
34
+ async: true,
35
+ name,
36
+ description,
37
+ parameters,
38
+ body: [`const response = http.${config.method}(${url}, {
39
+ ${literalFieldsToString(options)}
40
+ })`, `return response.json<${spaceResponseType}>()`]
41
+ });
42
+ });
43
+
44
+ //#endregion
45
+ export { parser };
package/dist/index.d.mts CHANGED
@@ -1,55 +1,29 @@
1
- import "./index.d-C_cfONoz.mjs";
2
- import "./index.d-Oclhn_rY.mjs";
3
- import "./index.d-DJrTX9xf.mjs";
4
- import "./index.d-BumPVmi6.mjs";
5
- import "./index.d-SEFhGKxl.mjs";
6
- import "./index.d-fRobkY_s.mjs";
7
- import { index_d_exports$2 as index_d_exports } from "./index.d-CJvL62Un.mjs";
8
- import "./index.d-Gm6xdqdc.mjs";
9
- import "./index.d-BG_KI3-b.mjs";
10
- import "./index.d-DhevLWeK.mjs";
11
- import "./index.d-mJ3Pcxey.mjs";
12
- import "./index.d-B0Dj119v.mjs";
13
- import "./index.d-CDWq1HYV.mjs";
14
- import { index_d_exports$5 as index_d_exports$1 } from "./index.d-B1n6Tnt1.mjs";
15
- import "./index.d-CBozMBWF.mjs";
16
- import "./index.d-CTkBXgsL.mjs";
17
- import "./index.d-C7snKiSp.mjs";
18
- import "./index.d-BxhX9ZHb.mjs";
19
- import "./index.d-99mf5fZX.mjs";
20
- import "./index.d-D31630wD.mjs";
21
- import { index_d_exports$4 as index_d_exports$2 } from "./index.d-BfFQykLh.mjs";
22
- import "./index.d-CEAmhQXE.mjs";
23
- import "./index.d-BsBf_9LO.mjs";
24
- import "./index.d-DZt4GzNR.mjs";
25
- import "./index.d-ltrmOwIz.mjs";
26
- import "./index.d-Df6nDub9.mjs";
27
- import "./index.d-D8QZqVyr.mjs";
28
- import { index_d_exports$1 as index_d_exports$3 } from "./index.d-KiVamk2z.mjs";
29
- import "./index.d-D2DYrmcB.mjs";
30
- import "./index.d-lzQFIw8d.mjs";
31
- import "./index.d-DMF-u4U9.mjs";
32
- import "./index.d-CoyMx1eg.mjs";
33
- import "./index.d-CkaW5o1S.mjs";
34
- import "./index.d-CV6YWGPd.mjs";
35
- import { index_d_exports as index_d_exports$4 } from "./index.d-DbmCOzZ_.mjs";
36
- import "./index.d-xPgxVw9l.mjs";
37
- import "./index.d-dxrAw57N.mjs";
38
- import "./index.d-BAZgb_b9.mjs";
39
- import "./index.d-Bxb1Ew8J.mjs";
40
- import "./index.d-BkDRl56J.mjs";
41
- import "./index.d-DRC1cM3h.mjs";
42
- import { index_d_exports$3 as index_d_exports$5 } from "./index.d-D4dt4SN4.mjs";
1
+ import { t as index_d_exports } from "./axios/index.mjs";
2
+ import { t as index_d_exports$1 } from "./fetch/index.mjs";
3
+ import { t as index_d_exports$2 } from "./got/index.mjs";
4
+ import { t as index_d_exports$3 } from "./ky/index.mjs";
5
+ import { t as index_d_exports$4 } from "./ofetch/index.mjs";
6
+ import { t as index_d_exports$5 } from "./tanstack/index.mjs";
7
+ import { t as index_d_exports$6 } from "./uni/index.mjs";
43
8
 
44
9
  //#region src/index.d.ts
10
+ /**
11
+ * Preset pipelines by HTTP client: axios, fetch, ky, got, ofetch, tanstack (react/vue/colada), uni.
12
+ * @description Each key exposes `.ts` and `.js` pipeline modules (e.g. use `@genapi/presets/swag-axios-ts`).
13
+ * @example
14
+ * ```ts
15
+ * import presets from '@genapi/presets'
16
+ * // presets.axios, presets.fetch, presets.ofetch, presets.tanstackQuery, presets.uni, presets.colada
17
+ * ```
18
+ */
45
19
  declare const _default: {
46
- axios: typeof index_d_exports;
47
- fetch: typeof index_d_exports$1;
48
- got: typeof index_d_exports$2;
49
- ky: typeof index_d_exports$3;
50
- ofetch: typeof index_d_exports$4;
51
- uni: typeof index_d_exports$5;
20
+ tanstackQuery: typeof index_d_exports$5;
21
+ ofetch: typeof index_d_exports$4;
22
+ axios: typeof index_d_exports;
23
+ fetch: typeof index_d_exports$1;
24
+ uni: typeof index_d_exports$6;
25
+ got: typeof index_d_exports$2;
26
+ ky: typeof index_d_exports$3;
52
27
  };
53
-
54
28
  //#endregion
55
- export { index_d_exports as axios, _default as default, index_d_exports$1 as fetch, index_d_exports$2 as got, index_d_exports$3 as ky, index_d_exports$4 as ofetch, index_d_exports$5 as uni };
29
+ export { index_d_exports as axios, _default as default, index_d_exports$1 as fetch, index_d_exports$2 as got, index_d_exports$3 as ky, index_d_exports$4 as ofetch, index_d_exports$5 as tanstackQuery, index_d_exports$6 as uni };
package/dist/index.mjs CHANGED
@@ -1,55 +1,30 @@
1
- import "./config-CTDgiXdv.mjs";
2
- import "./parser-DqCzNFba.mjs";
3
- import "./js-DrRwXaos.mjs";
4
- import "./config-Bt-OVtrF.mjs";
5
- import "./parser-ie6DpPJX.mjs";
6
- import "./ts-UnhKokN_.mjs";
7
- import { axios_exports } from "./axios-C-GYxVyS.mjs";
8
- import "./config-Duv2zgs0.mjs";
9
- import "./parser-BcgivITa.mjs";
10
- import "./js-tqiiLynG.mjs";
11
- import "./config-CCf0xLx5.mjs";
12
- import "./parser-ZusEtk4G.mjs";
13
- import "./ts-BEo8NDau.mjs";
14
- import { fetch_exports } from "./fetch-DNLodiAP.mjs";
15
- import "./config-CDvaM7ZL.mjs";
16
- import "./parser-BYrX-ru-.mjs";
17
- import "./js-CbvjSthC.mjs";
18
- import "./config-aVU8JEKy.mjs";
19
- import "./parser-kk99DwsW.mjs";
20
- import "./ts-CBWxAza5.mjs";
21
- import { got_exports } from "./got-BIOwnc0x.mjs";
22
- import "./config-CRdZhud4.mjs";
23
- import "./parser-v9oBdoth.mjs";
24
- import "./js-_HvDqbMK.mjs";
25
- import "./config-IeVj3de_.mjs";
26
- import "./parser-ChqBZo9I.mjs";
27
- import "./ts-C0RacOIG.mjs";
28
- import { ky_exports } from "./ky-P-rg3kH4.mjs";
29
- import "./config-SP_VEcsX.mjs";
30
- import "./parser-p29Uia9I.mjs";
31
- import "./js-BIi60-ws.mjs";
32
- import "./config-Dp9C4aUE.mjs";
33
- import "./parser-BtnVu9-k.mjs";
34
- import "./ts-BAOPMwAr.mjs";
35
- import { ofetch_exports } from "./ofetch-B_VRlsTN.mjs";
36
- import "./config-Dn-mxTew.mjs";
37
- import "./parser-BMWMb1tW.mjs";
38
- import "./js-rCsJDgHU.mjs";
39
- import "./config-CEngTpXa.mjs";
40
- import "./parser-BOXlubkg.mjs";
41
- import "./ts-B-VDMOmJ.mjs";
42
- import { uni_exports } from "./uni-CQMaFViG.mjs";
1
+ import { t as axios_exports } from "./axios/index.mjs";
2
+ import { t as fetch_exports } from "./fetch/index.mjs";
3
+ import { t as got_exports } from "./got/index.mjs";
4
+ import { t as ky_exports } from "./ky/index.mjs";
5
+ import { t as ofetch_exports } from "./ofetch/index.mjs";
6
+ import { t as tanstack_exports } from "./tanstack/index.mjs";
7
+ import { t as uni_exports } from "./uni/index.mjs";
43
8
 
44
9
  //#region src/index.ts
10
+ /**
11
+ * Preset pipelines by HTTP client: axios, fetch, ky, got, ofetch, tanstack (react/vue/colada), uni.
12
+ * @description Each key exposes `.ts` and `.js` pipeline modules (e.g. use `@genapi/presets/swag-axios-ts`).
13
+ * @example
14
+ * ```ts
15
+ * import presets from '@genapi/presets'
16
+ * // presets.axios, presets.fetch, presets.ofetch, presets.tanstackQuery, presets.uni, presets.colada
17
+ * ```
18
+ */
45
19
  var src_default = {
20
+ tanstackQuery: tanstack_exports,
21
+ ofetch: ofetch_exports,
46
22
  axios: axios_exports,
47
23
  fetch: fetch_exports,
24
+ uni: uni_exports,
48
25
  got: got_exports,
49
- ky: ky_exports,
50
- ofetch: ofetch_exports,
51
- uni: uni_exports
26
+ ky: ky_exports
52
27
  };
53
28
 
54
29
  //#endregion
55
- export { axios_exports as axios, src_default as default, fetch_exports as fetch, got_exports as got, ky_exports as ky, ofetch_exports as ofetch, uni_exports as uni };
30
+ export { axios_exports as axios, src_default as default, fetch_exports as fetch, got_exports as got, ky_exports as ky, ofetch_exports as ofetch, tanstack_exports as tanstackQuery, uni_exports as uni };
@@ -1,9 +1,9 @@
1
- import "../index.d-CEAmhQXE.mjs";
2
- import "../index.d-BsBf_9LO.mjs";
3
- import { openapiPipeline$10 as openapiPipeline } from "../index.d-DZt4GzNR.mjs";
4
- import "../index.d-ltrmOwIz.mjs";
5
- import "../index.d-Df6nDub9.mjs";
6
- import { openapiPipeline$11 as openapiPipeline$1 } from "../index.d-D8QZqVyr.mjs";
7
- import "../index.d-KiVamk2z.mjs";
1
+ import openapiPipeline from "./js/index.mjs";
2
+ import openapiPipeline$1 from "./ts/index.mjs";
8
3
 
9
- export { openapiPipeline as js, openapiPipeline$1 as ts };
4
+ //#region src/ky/index.d.ts
5
+ declare namespace index_d_exports {
6
+ export { openapiPipeline as js, openapiPipeline$1 as ts };
7
+ }
8
+ //#endregion
9
+ export { openapiPipeline as js, index_d_exports as t, openapiPipeline$1 as ts };
package/dist/ky/index.mjs CHANGED
@@ -1,9 +1,12 @@
1
- import "../config-CRdZhud4.mjs";
2
- import "../parser-v9oBdoth.mjs";
3
- import { js_default$4 as js_default } from "../js-_HvDqbMK.mjs";
4
- import "../config-IeVj3de_.mjs";
5
- import "../parser-ChqBZo9I.mjs";
6
- import { ts_default$4 as ts_default } from "../ts-C0RacOIG.mjs";
7
- import "../ky-P-rg3kH4.mjs";
1
+ import { t as __exportAll } from "../chunk-DQk6qfdC.mjs";
2
+ import openapiPipeline from "./js/index.mjs";
3
+ import openapiPipeline$1 from "./ts/index.mjs";
8
4
 
9
- export { js_default as js, ts_default as ts };
5
+ //#region src/ky/index.ts
6
+ var ky_exports = /* @__PURE__ */ __exportAll({
7
+ js: () => openapiPipeline,
8
+ ts: () => openapiPipeline$1
9
+ });
10
+
11
+ //#endregion
12
+ export { openapiPipeline as js, ky_exports as t, openapiPipeline$1 as ts };
@@ -1,3 +1,6 @@
1
- import { config$20 as config } from "../../../index.d-BsBf_9LO.mjs";
1
+ import { ApiPipeline } from "@genapi/shared";
2
2
 
3
+ //#region src/ky/js/config/index.d.ts
4
+ declare function config(userConfig: ApiPipeline.Config): ApiPipeline.ConfigRead;
5
+ //#endregion
3
6
  export { config };
@@ -1,3 +1,22 @@
1
- import { config$8 as config } from "../../../config-CRdZhud4.mjs";
1
+ import { config as config$1 } from "@genapi/pipeline";
2
+ import { replaceMainext } from "@genapi/parser";
3
+ import { inject } from "@genapi/shared";
2
4
 
5
+ //#region src/ky/js/config/index.ts
6
+ function config(userConfig) {
7
+ userConfig.meta = userConfig.meta || {};
8
+ userConfig.meta.import = userConfig.meta.import || {};
9
+ userConfig.output = userConfig.output || {};
10
+ userConfig.meta.import.http = userConfig.meta.import.http || "ky";
11
+ userConfig.output = replaceMainext(userConfig.output) || "src/api/index.js";
12
+ const configRead = config$1(userConfig);
13
+ const { imports } = inject();
14
+ imports.add("main", {
15
+ name: "http",
16
+ value: userConfig.meta.import.http
17
+ });
18
+ return configRead;
19
+ }
20
+
21
+ //#endregion
3
22
  export { config };
@@ -1,5 +1,18 @@
1
- import { parser$23 as parser } from "../../index.d-CEAmhQXE.mjs";
2
- import { config$20 as config } from "../../index.d-BsBf_9LO.mjs";
3
- import { compiler$22 as compiler, dest$22 as dest, generate$22 as generate, openapiPipeline$10 as openapiPipeline, original$22 as original } from "../../index.d-DZt4GzNR.mjs";
1
+ import { config } from "./config/index.mjs";
2
+ import { parser } from "./parser/index.mjs";
3
+ import * as _genapi_pipeline0 from "@genapi/pipeline";
4
+ import { compiler, dest, generate, original } from "@genapi/pipeline";
5
+ import { ApiPipeline } from "@genapi/shared";
4
6
 
7
+ //#region src/ky/js/index.d.ts
8
+ declare function openapiPipeline(userConfig: ApiPipeline.Config): Promise<void>;
9
+ declare namespace openapiPipeline {
10
+ var config: typeof config;
11
+ var original: typeof _genapi_pipeline0.original;
12
+ var parser: (configRead: ApiPipeline.ConfigRead) => ApiPipeline.ConfigRead;
13
+ var compiler: typeof _genapi_pipeline0.compiler;
14
+ var generate: typeof _genapi_pipeline0.generate;
15
+ var dest: typeof _genapi_pipeline0.dest;
16
+ }
17
+ //#endregion
5
18
  export { compiler, config, openapiPipeline as default, dest, generate, original, parser };
@@ -1,5 +1,17 @@
1
- import { config$8 as config } from "../../config-CRdZhud4.mjs";
2
- import { parser$8 as parser } from "../../parser-v9oBdoth.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-_HvDqbMK.mjs";
1
+ import { config } from "./config/index.mjs";
2
+ import { parser } from "./parser/index.mjs";
3
+ import pipeline, { compiler, dest, generate, original } from "@genapi/pipeline";
4
4
 
5
- export { compiler, config, js_default as default, dest, generate, original, parser };
5
+ //#region src/ky/js/index.ts
6
+ function openapiPipeline(userConfig) {
7
+ return pipeline((userConfig) => config(userConfig), (configRead) => original(configRead), (configRead) => parser(configRead), (configRead) => compiler(configRead), (configRead) => generate(configRead), (configRead) => dest(configRead))(userConfig);
8
+ }
9
+ openapiPipeline.config = config;
10
+ openapiPipeline.original = original;
11
+ openapiPipeline.parser = parser;
12
+ openapiPipeline.compiler = compiler;
13
+ openapiPipeline.generate = generate;
14
+ openapiPipeline.dest = dest;
15
+
16
+ //#endregion
17
+ export { compiler, config, openapiPipeline as default, dest, generate, original, parser };
@@ -1,3 +1,6 @@
1
- import { PathsTransformOptions$11 as PathsTransformOptions, parser$23 as parser, transformPaths$23 as transformPaths } from "../../../index.d-CEAmhQXE.mjs";
1
+ import * as _genapi_shared0 from "@genapi/shared";
2
2
 
3
- export { PathsTransformOptions, parser, transformPaths };
3
+ //#region src/ky/js/parser/index.d.ts
4
+ declare const parser: (configRead: _genapi_shared0.ApiPipeline.ConfigRead) => _genapi_shared0.ApiPipeline.ConfigRead;
5
+ //#endregion
6
+ export { parser };
@@ -1,3 +1,45 @@
1
- import { parser$8 as parser, transformPaths$8 as transformPaths } from "../../../parser-v9oBdoth.mjs";
1
+ import { createParser, literalFieldsToString, parseMethodMetadata, parseMethodParameters, transformBodyStringify, transformParameters, transformQueryParams, transformUrlSyntax } from "@genapi/parser";
2
2
 
3
- export { parser, transformPaths };
3
+ //#region src/ky/js/parser/index.ts
4
+ const parser = createParser((config, { configRead, functions, interfaces }) => {
5
+ const { parameters, interfaces: attachInters, options } = parseMethodParameters(config);
6
+ let { name, description, url, responseType } = parseMethodMetadata(config);
7
+ attachInters.forEach((i) => interfaces.add("type", i));
8
+ parameters.push({
9
+ name: "config",
10
+ type: "import('ky').Options",
11
+ required: false
12
+ });
13
+ options.push(["...", "config"]);
14
+ if (configRead.config.meta?.baseURL) options.unshift(["prefixUrl", "baseURL"]);
15
+ transformParameters(parameters, {
16
+ syntax: "ecmascript",
17
+ configRead,
18
+ description,
19
+ interfaces: interfaces.all(),
20
+ responseType,
21
+ generic: "import('ky').KyResponse<{__type__}>"
22
+ });
23
+ transformBodyStringify("body", {
24
+ options,
25
+ parameters
26
+ });
27
+ transformQueryParams("query", {
28
+ optionKey: "searchParams",
29
+ options
30
+ });
31
+ url = transformUrlSyntax(url);
32
+ functions.add("main", {
33
+ export: true,
34
+ async: true,
35
+ name,
36
+ description,
37
+ parameters,
38
+ body: [`const response = await http(${url}, {
39
+ ${literalFieldsToString(options)}
40
+ })`, "return response.json()"]
41
+ });
42
+ });
43
+
44
+ //#endregion
45
+ export { parser };
@@ -1,3 +1,6 @@
1
- import { config$22 as config } from "../../../index.d-Df6nDub9.mjs";
1
+ import { ApiPipeline } from "@genapi/shared";
2
2
 
3
+ //#region src/ky/ts/config/index.d.ts
4
+ declare function config(userConfig: ApiPipeline.Config): ApiPipeline.ConfigRead;
5
+ //#endregion
3
6
  export { config };
@@ -1,3 +1,24 @@
1
- import { config$9 as config } from "../../../config-IeVj3de_.mjs";
1
+ import { config as config$1 } from "@genapi/pipeline";
2
+ import { inject } from "@genapi/shared";
2
3
 
4
+ //#region src/ky/ts/config/index.ts
5
+ function config(userConfig) {
6
+ userConfig.meta = userConfig.meta || {};
7
+ userConfig.meta.import = userConfig.meta.import || {};
8
+ userConfig.meta.import.http = userConfig.meta.import.http || "ky";
9
+ const configRead = config$1(userConfig);
10
+ const { imports } = inject();
11
+ imports.add("main", {
12
+ name: "http",
13
+ names: userConfig.meta.import.http === "ky" ? ["Options"] : void 0,
14
+ value: userConfig.meta.import.http
15
+ });
16
+ if (userConfig.meta.import.http !== "ky") imports.add("main", {
17
+ names: ["Options"],
18
+ value: "ky"
19
+ });
20
+ return configRead;
21
+ }
22
+
23
+ //#endregion
3
24
  export { config };
@@ -1,5 +1,18 @@
1
- import { parser$22 as parser } from "../../index.d-ltrmOwIz.mjs";
2
- import { config$22 as config } from "../../index.d-Df6nDub9.mjs";
3
- import { compiler$23 as compiler, dest$23 as dest, generate$23 as generate, openapiPipeline$11 as openapiPipeline, original$23 as original } from "../../index.d-D8QZqVyr.mjs";
1
+ import { config } from "./config/index.mjs";
2
+ import { parser } from "./parser/index.mjs";
3
+ import * as _genapi_pipeline0 from "@genapi/pipeline";
4
+ import { compiler, dest, generate, original } from "@genapi/pipeline";
5
+ import { ApiPipeline } from "@genapi/shared";
4
6
 
7
+ //#region src/ky/ts/index.d.ts
8
+ declare function openapiPipeline(userConfig: ApiPipeline.Config): Promise<void>;
9
+ declare namespace openapiPipeline {
10
+ var config: typeof config;
11
+ var original: typeof _genapi_pipeline0.original;
12
+ var parser: (configRead: ApiPipeline.ConfigRead) => ApiPipeline.ConfigRead;
13
+ var compiler: typeof _genapi_pipeline0.compiler;
14
+ var generate: typeof _genapi_pipeline0.generate;
15
+ var dest: typeof _genapi_pipeline0.dest;
16
+ }
17
+ //#endregion
5
18
  export { compiler, config, openapiPipeline as default, dest, generate, original, parser };