@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.
Files changed (215) hide show
  1. package/README.md +108 -0
  2. package/dist/_shared/schema/compiler.d.mts +10 -0
  3. package/dist/_shared/schema/compiler.mjs +68 -0
  4. package/dist/_shared/schema/config.d.mts +12 -0
  5. package/dist/_shared/schema/config.mjs +45 -0
  6. package/dist/_shared/schema/index.d.mts +4 -0
  7. package/dist/_shared/schema/index.mjs +5 -0
  8. package/dist/_shared/schema/parser.d.mts +14 -0
  9. package/dist/_shared/schema/parser.mjs +49 -0
  10. package/dist/axios/index.d.mts +8 -8
  11. package/dist/axios/index.mjs +11 -8
  12. package/dist/axios/js/config/index.d.mts +4 -1
  13. package/dist/axios/js/config/index.mjs +18 -1
  14. package/dist/axios/js/index.d.mts +16 -3
  15. package/dist/axios/js/index.mjs +16 -4
  16. package/dist/axios/js/parser/index.d.mts +5 -2
  17. package/dist/axios/js/parser/index.mjs +38 -2
  18. package/dist/axios/ts/config/index.d.mts +4 -1
  19. package/dist/axios/ts/config/index.mjs +20 -1
  20. package/dist/axios/ts/index.d.mts +16 -3
  21. package/dist/axios/ts/index.mjs +16 -4
  22. package/dist/axios/ts/parser/index.d.mts +5 -2
  23. package/dist/axios/ts/parser/index.mjs +37 -2
  24. package/dist/chunk-DQk6qfdC.mjs +18 -0
  25. package/dist/fetch/index.d.mts +9 -8
  26. package/dist/fetch/index.mjs +13 -8
  27. package/dist/fetch/js/config/index.d.mts +4 -1
  28. package/dist/fetch/js/config/index.mjs +12 -1
  29. package/dist/fetch/js/index.d.mts +16 -3
  30. package/dist/fetch/js/index.mjs +16 -4
  31. package/dist/fetch/js/parser/index.d.mts +5 -2
  32. package/dist/fetch/js/parser/index.mjs +52 -2
  33. package/dist/fetch/schema/compiler/index.d.mts +6 -0
  34. package/dist/fetch/schema/compiler/index.mjs +7 -0
  35. package/dist/fetch/schema/config/index.d.mts +6 -0
  36. package/dist/fetch/schema/config/index.mjs +7 -0
  37. package/dist/fetch/schema/index.d.mts +19 -0
  38. package/dist/fetch/schema/index.mjs +18 -0
  39. package/dist/fetch/schema/parser/index.d.mts +2 -0
  40. package/dist/fetch/schema/parser/index.mjs +3 -0
  41. package/dist/fetch/ts/config/index.d.mts +4 -1
  42. package/dist/fetch/ts/config/index.mjs +10 -1
  43. package/dist/fetch/ts/index.d.mts +16 -3
  44. package/dist/fetch/ts/index.mjs +16 -4
  45. package/dist/fetch/ts/parser/index.d.mts +5 -2
  46. package/dist/fetch/ts/parser/index.mjs +47 -2
  47. package/dist/got/index.d.mts +8 -8
  48. package/dist/got/index.mjs +11 -8
  49. package/dist/got/js/config/index.d.mts +4 -1
  50. package/dist/got/js/config/index.mjs +18 -1
  51. package/dist/got/js/index.d.mts +16 -3
  52. package/dist/got/js/index.mjs +16 -4
  53. package/dist/got/js/parser/index.d.mts +5 -2
  54. package/dist/got/js/parser/index.mjs +44 -2
  55. package/dist/got/ts/config/index.d.mts +4 -1
  56. package/dist/got/ts/config/index.mjs +20 -1
  57. package/dist/got/ts/index.d.mts +16 -3
  58. package/dist/got/ts/index.mjs +16 -4
  59. package/dist/got/ts/parser/index.d.mts +5 -2
  60. package/dist/got/ts/parser/index.mjs +44 -2
  61. package/dist/index.d.mts +21 -50
  62. package/dist/index.mjs +15 -43
  63. package/dist/ky/index.d.mts +8 -8
  64. package/dist/ky/index.mjs +11 -8
  65. package/dist/ky/js/config/index.d.mts +4 -1
  66. package/dist/ky/js/config/index.mjs +18 -1
  67. package/dist/ky/js/index.d.mts +16 -3
  68. package/dist/ky/js/index.mjs +16 -4
  69. package/dist/ky/js/parser/index.d.mts +5 -2
  70. package/dist/ky/js/parser/index.mjs +44 -2
  71. package/dist/ky/ts/config/index.d.mts +4 -1
  72. package/dist/ky/ts/config/index.mjs +20 -1
  73. package/dist/ky/ts/index.d.mts +16 -3
  74. package/dist/ky/ts/index.mjs +16 -4
  75. package/dist/ky/ts/parser/index.d.mts +5 -2
  76. package/dist/ky/ts/parser/index.mjs +43 -2
  77. package/dist/ofetch/index.d.mts +9 -8
  78. package/dist/ofetch/index.mjs +13 -8
  79. package/dist/ofetch/js/config/index.d.mts +4 -1
  80. package/dist/ofetch/js/config/index.mjs +18 -1
  81. package/dist/ofetch/js/index.d.mts +16 -3
  82. package/dist/ofetch/js/index.mjs +16 -4
  83. package/dist/ofetch/js/parser/index.d.mts +5 -2
  84. package/dist/ofetch/js/parser/index.mjs +42 -2
  85. package/dist/ofetch/schema/compiler/index.d.mts +6 -0
  86. package/dist/ofetch/schema/compiler/index.mjs +7 -0
  87. package/dist/ofetch/schema/config/index.d.mts +6 -0
  88. package/dist/ofetch/schema/config/index.mjs +10 -0
  89. package/dist/ofetch/schema/index.d.mts +19 -0
  90. package/dist/ofetch/schema/index.mjs +18 -0
  91. package/dist/ofetch/schema/parser/index.d.mts +2 -0
  92. package/dist/ofetch/schema/parser/index.mjs +3 -0
  93. package/dist/ofetch/ts/config/index.d.mts +4 -1
  94. package/dist/ofetch/ts/config/index.mjs +19 -1
  95. package/dist/ofetch/ts/index.d.mts +16 -3
  96. package/dist/ofetch/ts/index.mjs +16 -4
  97. package/dist/ofetch/ts/parser/index.d.mts +5 -2
  98. package/dist/ofetch/ts/parser/index.mjs +41 -2
  99. package/dist/{index.d-Ceqrd7FN.d.mts → tanstack/colada/config/index.d.mts} +2 -3
  100. package/dist/tanstack/colada/config/index.mjs +16 -0
  101. package/dist/tanstack/colada/index.d.mts +18 -0
  102. package/dist/tanstack/colada/index.mjs +17 -0
  103. package/dist/tanstack/colada/parser/index.d.mts +6 -0
  104. package/dist/tanstack/colada/parser/index.mjs +71 -0
  105. package/dist/tanstack/index.d.mts +10 -0
  106. package/dist/tanstack/index.mjs +14 -0
  107. package/dist/{index.d-7vIBcqWp.d.mts → tanstack/react/config/index.d.mts} +2 -3
  108. package/dist/tanstack/react/config/index.mjs +16 -0
  109. package/dist/tanstack/react/index.d.mts +18 -0
  110. package/dist/tanstack/react/index.mjs +17 -0
  111. package/dist/tanstack/react/parser/index.d.mts +6 -0
  112. package/dist/tanstack/react/parser/index.mjs +75 -0
  113. package/dist/{index.d-C5ya5SE3.d.mts → tanstack/vue/config/index.d.mts} +2 -3
  114. package/dist/tanstack/vue/config/index.mjs +16 -0
  115. package/dist/tanstack/vue/index.d.mts +18 -0
  116. package/dist/tanstack/vue/index.mjs +17 -0
  117. package/dist/tanstack/vue/parser/index.d.mts +6 -0
  118. package/dist/tanstack/vue/parser/index.mjs +71 -0
  119. package/dist/uni/index.d.mts +8 -8
  120. package/dist/uni/index.mjs +11 -8
  121. package/dist/uni/js/config/index.d.mts +4 -1
  122. package/dist/uni/js/config/index.mjs +18 -1
  123. package/dist/uni/js/index.d.mts +16 -3
  124. package/dist/uni/js/index.mjs +16 -4
  125. package/dist/uni/js/parser/index.d.mts +5 -2
  126. package/dist/uni/js/parser/index.mjs +38 -2
  127. package/dist/uni/ts/config/index.d.mts +4 -1
  128. package/dist/uni/ts/config/index.mjs +20 -1
  129. package/dist/uni/ts/index.d.mts +16 -3
  130. package/dist/uni/ts/index.mjs +16 -4
  131. package/dist/uni/ts/parser/index.d.mts +5 -2
  132. package/dist/uni/ts/parser/index.mjs +37 -2
  133. package/package.json +26 -6
  134. package/dist/axios-C--VNFKW.mjs +0 -13
  135. package/dist/chunk-BL35Yyzp.mjs +0 -12
  136. package/dist/config-B89EoGE7.mjs +0 -21
  137. package/dist/config-BGwXcXx1.mjs +0 -21
  138. package/dist/config-BHBub1xl.mjs +0 -12
  139. package/dist/config-BJZnXcL3.mjs +0 -14
  140. package/dist/config-C94x0Nge.mjs +0 -21
  141. package/dist/config-CEngTpXa.mjs +0 -21
  142. package/dist/config-CwmGeydd.mjs +0 -19
  143. package/dist/config-DdUVYIe0.mjs +0 -19
  144. package/dist/config-DgC2f2AO.mjs +0 -19
  145. package/dist/config-Dm0OCPw8.mjs +0 -19
  146. package/dist/config-Dn-mxTew.mjs +0 -19
  147. package/dist/config-aVU8JEKy.mjs +0 -21
  148. package/dist/fetch-TYDXDaTS.mjs +0 -13
  149. package/dist/got-D5A7dJdZ.mjs +0 -13
  150. package/dist/index.d-1kS19nJx.d.mts +0 -18
  151. package/dist/index.d-1qaowKKm.d.mts +0 -18
  152. package/dist/index.d-42t92mX0.d.mts +0 -7
  153. package/dist/index.d-B0xaEiBX.d.mts +0 -18
  154. package/dist/index.d-B1m7PaBv.d.mts +0 -14
  155. package/dist/index.d-B6j2V4Az.d.mts +0 -18
  156. package/dist/index.d-BCWDJjEV.d.mts +0 -7
  157. package/dist/index.d-BN2_wiGD.d.mts +0 -18
  158. package/dist/index.d-BNkgVflG.d.mts +0 -14
  159. package/dist/index.d-BY4lF6QY.d.mts +0 -7
  160. package/dist/index.d-BxDzXRov.d.mts +0 -12
  161. package/dist/index.d-BxQraJfG.d.mts +0 -18
  162. package/dist/index.d-Bxgqqjp3.d.mts +0 -7
  163. package/dist/index.d-C0EKSJ26.d.mts +0 -7
  164. package/dist/index.d-C6gpVbqC.d.mts +0 -12
  165. package/dist/index.d-CFvCqVRj.d.mts +0 -7
  166. package/dist/index.d-CJ27pjS6.d.mts +0 -7
  167. package/dist/index.d-CM3KHaZM.d.mts +0 -12
  168. package/dist/index.d-CTkBXgsL.d.mts +0 -7
  169. package/dist/index.d-CXNw0ZkA.d.mts +0 -14
  170. package/dist/index.d-C_cfONoz.d.mts +0 -14
  171. package/dist/index.d-Cgflcv1m.d.mts +0 -18
  172. package/dist/index.d-CmW7DwIV.d.mts +0 -18
  173. package/dist/index.d-DDTGaUmA.d.mts +0 -14
  174. package/dist/index.d-DHMHzs8Q.d.mts +0 -14
  175. package/dist/index.d-DJv4EMYu.d.mts +0 -7
  176. package/dist/index.d-DOPIfZ0r.d.mts +0 -12
  177. package/dist/index.d-Dd6ZDpp9.d.mts +0 -12
  178. package/dist/index.d-DgbGF4C3.d.mts +0 -12
  179. package/dist/index.d-DmOkv7N9.d.mts +0 -18
  180. package/dist/index.d-DpQbWiOh.d.mts +0 -14
  181. package/dist/index.d-Dvtsr9g-.d.mts +0 -14
  182. package/dist/index.d-LlaJb0pD.d.mts +0 -18
  183. package/dist/index.d-RZUAACu-.d.mts +0 -14
  184. package/dist/index.d-SxIr6Uhl.d.mts +0 -18
  185. package/dist/index.d-TD1X3MeU.d.mts +0 -14
  186. package/dist/index.d-mJ3Pcxey.d.mts +0 -14
  187. package/dist/index.d-mXlHJ3vm.d.mts +0 -18
  188. package/dist/index.d-xPgxVw9l.d.mts +0 -14
  189. package/dist/js-BHy43BOA.mjs +0 -19
  190. package/dist/js-CsFu-S2j.mjs +0 -19
  191. package/dist/js-SMul0x9Q.mjs +0 -19
  192. package/dist/js-Swp-o6ZG.mjs +0 -19
  193. package/dist/js-jTe7QP2M.mjs +0 -19
  194. package/dist/js-rCsJDgHU.mjs +0 -19
  195. package/dist/ky--lXnn0gU.mjs +0 -13
  196. package/dist/ofetch-qhtvI1gy.mjs +0 -13
  197. package/dist/parser-820U-7tY.mjs +0 -79
  198. package/dist/parser-BEbsKXRG.mjs +0 -74
  199. package/dist/parser-BMWMb1tW.mjs +0 -65
  200. package/dist/parser-BMaYANAS.mjs +0 -70
  201. package/dist/parser-BOXlubkg.mjs +0 -64
  202. package/dist/parser-B_pvME5o.mjs +0 -71
  203. package/dist/parser-By1vGa1J.mjs +0 -65
  204. package/dist/parser-C267rNUI.mjs +0 -71
  205. package/dist/parser-CFUtEOtZ.mjs +0 -69
  206. package/dist/parser-CedZCyxl.mjs +0 -68
  207. package/dist/parser-OUoEsF2d.mjs +0 -64
  208. package/dist/parser-kk99DwsW.mjs +0 -71
  209. package/dist/ts-B-VDMOmJ.mjs +0 -19
  210. package/dist/ts-CBFVpM-p.mjs +0 -19
  211. package/dist/ts-CBWxAza5.mjs +0 -19
  212. package/dist/ts-CKsdt6vA.mjs +0 -19
  213. package/dist/ts-Cnuezdyy.mjs +0 -19
  214. package/dist/ts-ILF3D-J-.mjs +0 -19
  215. package/dist/uni-CQMaFViG.mjs +0 -13
@@ -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 };
@@ -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 };
@@ -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 };
@@ -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 };
@@ -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 };
@@ -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 };
@@ -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 };
@@ -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 };
@@ -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 };
@@ -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 };
@@ -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 };
@@ -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 };
@@ -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 };