@genapi/presets 3.4.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/axios/index.d.mts +9 -0
  2. package/dist/axios/index.mjs +9 -7
  3. package/dist/axios/js/config/index.d.mts +3 -0
  4. package/dist/axios/js/config/index.mjs +3 -18
  5. package/dist/axios/js/index.d.mts +5 -0
  6. package/dist/axios/js/index.mjs +5 -31
  7. package/dist/axios/js/parser/index.d.mts +3 -0
  8. package/dist/axios/js/parser/index.mjs +3 -77
  9. package/dist/axios/ts/config/index.d.mts +3 -0
  10. package/dist/axios/ts/config/index.mjs +3 -22
  11. package/dist/axios/ts/index.d.mts +5 -0
  12. package/dist/axios/ts/index.mjs +5 -31
  13. package/dist/axios/ts/parser/index.d.mts +3 -0
  14. package/dist/axios/ts/parser/index.mjs +3 -76
  15. package/dist/axios-CG6HLmR9.mjs +13 -0
  16. package/dist/chunk-BL35Yyzp.mjs +12 -0
  17. package/dist/config-B6UDPRkS.mjs +12 -0
  18. package/dist/config-B89EoGE7.mjs +21 -0
  19. package/dist/config-BGwXcXx1.mjs +21 -0
  20. package/dist/config-C94x0Nge.mjs +21 -0
  21. package/dist/config-CEngTpXa.mjs +21 -0
  22. package/dist/config-CwmGeydd.mjs +19 -0
  23. package/dist/config-DAHoeaDU.mjs +19 -0
  24. package/dist/config-DdUVYIe0.mjs +19 -0
  25. package/dist/config-Dm0OCPw8.mjs +19 -0
  26. package/dist/config-Dn-mxTew.mjs +19 -0
  27. package/dist/config-DuQgIn7U.mjs +14 -0
  28. package/dist/config-aVU8JEKy.mjs +21 -0
  29. package/dist/fetch/index.d.mts +9 -0
  30. package/dist/fetch/index.mjs +9 -7
  31. package/dist/fetch/js/config/index.d.mts +3 -0
  32. package/dist/fetch/js/config/index.mjs +3 -13
  33. package/dist/fetch/js/index.d.mts +5 -0
  34. package/dist/fetch/js/index.mjs +5 -31
  35. package/dist/fetch/js/parser/index.d.mts +3 -0
  36. package/dist/fetch/js/parser/index.mjs +3 -83
  37. package/dist/fetch/ts/config/index.d.mts +3 -0
  38. package/dist/fetch/ts/config/index.mjs +3 -11
  39. package/dist/fetch/ts/index.d.mts +5 -0
  40. package/dist/fetch/ts/index.mjs +5 -31
  41. package/dist/fetch/ts/parser/index.d.mts +3 -0
  42. package/dist/fetch/ts/parser/index.mjs +3 -79
  43. package/dist/fetch-BtwC6Lll.mjs +13 -0
  44. package/dist/got/index.d.mts +9 -0
  45. package/dist/got/index.mjs +9 -7
  46. package/dist/got/js/config/index.d.mts +3 -0
  47. package/dist/got/js/config/index.mjs +3 -18
  48. package/dist/got/js/index.d.mts +5 -0
  49. package/dist/got/js/index.mjs +5 -31
  50. package/dist/got/js/parser/index.d.mts +3 -0
  51. package/dist/got/js/parser/index.mjs +3 -82
  52. package/dist/got/ts/config/index.d.mts +3 -0
  53. package/dist/got/ts/config/index.mjs +3 -22
  54. package/dist/got/ts/index.d.mts +5 -0
  55. package/dist/got/ts/index.mjs +5 -31
  56. package/dist/got/ts/parser/index.d.mts +3 -0
  57. package/dist/got/ts/parser/index.mjs +3 -82
  58. package/dist/got-xeCavgZc.mjs +13 -0
  59. package/dist/{axios/js/parser/index.d.ts → index.d-4OvQY24D.d.mts} +5 -3
  60. package/dist/index.d-B0n5Pe6-.d.mts +12 -0
  61. package/dist/index.d-B1KgwGJV.d.mts +14 -0
  62. package/dist/index.d-B9C3SJsw.d.mts +7 -0
  63. package/dist/index.d-BB-bpoWw.d.mts +14 -0
  64. package/dist/index.d-BDMFuIpi.d.mts +12 -0
  65. package/dist/index.d-BDy4V2O7.d.mts +18 -0
  66. package/dist/index.d-BFJinzUY.d.mts +12 -0
  67. package/dist/index.d-BS6Sm47l.d.mts +18 -0
  68. package/dist/index.d-BSQRPGuK.d.mts +18 -0
  69. package/dist/index.d-BXgDnKDv.d.mts +7 -0
  70. package/dist/{axios/ts/parser/index.d.ts → index.d-BYOoHBar.d.mts} +5 -3
  71. package/dist/index.d-BahMmqz0.d.mts +18 -0
  72. package/dist/index.d-BbxRLLMX.d.mts +12 -0
  73. package/dist/index.d-BguloXfs.d.mts +7 -0
  74. package/dist/index.d-BgvbkDJL.d.mts +18 -0
  75. package/dist/index.d-Bknp-d4G.d.mts +14 -0
  76. package/dist/index.d-BulZ76hJ.d.mts +18 -0
  77. package/dist/index.d-BupSEh4R.d.mts +18 -0
  78. package/dist/index.d-CAirdOCT.d.mts +14 -0
  79. package/dist/index.d-CDf5ausb.d.mts +12 -0
  80. package/dist/index.d-CN37Zl7u.d.mts +14 -0
  81. package/dist/index.d-CVL676ax.d.mts +18 -0
  82. package/dist/index.d-Cb9k2mo6.d.mts +7 -0
  83. package/dist/index.d-CdRfZiCo.d.mts +18 -0
  84. package/dist/index.d-CfS61_iH.d.mts +7 -0
  85. package/dist/index.d-Ckbfjm0G.d.mts +7 -0
  86. package/dist/index.d-CljgOS4p.d.mts +18 -0
  87. package/dist/{fetch/js/parser/index.d.ts → index.d-D1pp_HCy.d.mts} +5 -3
  88. package/dist/index.d-D33XWXy5.d.mts +14 -0
  89. package/dist/index.d-D6gcSlpm.d.mts +14 -0
  90. package/dist/index.d-DCtFuYUN.d.mts +18 -0
  91. package/dist/index.d-DQZa03Va.d.mts +7 -0
  92. package/dist/index.d-DW8ts-IU.d.mts +14 -0
  93. package/dist/index.d-D_aZcN-0.d.mts +7 -0
  94. package/dist/index.d-DgggRtXp.d.mts +7 -0
  95. package/dist/index.d-DpLq-R_p.d.mts +12 -0
  96. package/dist/index.d-DrCRTA_-.d.mts +7 -0
  97. package/dist/index.d-DuVpMG8_.d.mts +18 -0
  98. package/dist/{fetch/ts/parser/index.d.ts → index.d-KQGa1SFg.d.mts} +5 -3
  99. package/dist/index.d-O3Nkol5h.d.mts +7 -0
  100. package/dist/index.d-lzQFIw8d.d.mts +7 -0
  101. package/dist/index.d.mts +55 -0
  102. package/dist/index.mjs +54 -20
  103. package/dist/js-CfKFwY21.mjs +19 -0
  104. package/dist/js-DGjfw_hH.mjs +19 -0
  105. package/dist/js-DwgoBEjQ.mjs +19 -0
  106. package/dist/js-DxwOJyF7.mjs +19 -0
  107. package/dist/js-nNB2l-OU.mjs +19 -0
  108. package/dist/js-uo8fh9bT.mjs +19 -0
  109. package/dist/ky/index.d.mts +9 -0
  110. package/dist/ky/index.mjs +9 -7
  111. package/dist/ky/js/config/index.d.mts +3 -0
  112. package/dist/ky/js/config/index.mjs +3 -18
  113. package/dist/ky/js/index.d.mts +5 -0
  114. package/dist/ky/js/index.mjs +5 -31
  115. package/dist/ky/js/parser/index.d.mts +3 -0
  116. package/dist/ky/js/parser/index.mjs +3 -79
  117. package/dist/ky/ts/config/index.d.mts +3 -0
  118. package/dist/ky/ts/config/index.mjs +3 -22
  119. package/dist/ky/ts/index.d.mts +5 -0
  120. package/dist/ky/ts/index.mjs +5 -31
  121. package/dist/ky/ts/parser/index.d.mts +3 -0
  122. package/dist/ky/ts/parser/index.mjs +3 -78
  123. package/dist/ky-B7lRjugo.mjs +13 -0
  124. package/dist/ofetch/index.d.mts +9 -0
  125. package/dist/ofetch/index.mjs +9 -7
  126. package/dist/ofetch/js/config/index.d.mts +3 -0
  127. package/dist/ofetch/js/config/index.mjs +3 -18
  128. package/dist/ofetch/js/index.d.mts +5 -0
  129. package/dist/ofetch/js/index.mjs +5 -31
  130. package/dist/ofetch/js/parser/index.d.mts +3 -0
  131. package/dist/ofetch/js/parser/index.mjs +3 -78
  132. package/dist/ofetch/ts/config/index.d.mts +3 -0
  133. package/dist/ofetch/ts/config/index.mjs +3 -22
  134. package/dist/ofetch/ts/index.d.mts +5 -0
  135. package/dist/ofetch/ts/index.mjs +5 -31
  136. package/dist/ofetch/ts/parser/index.d.mts +3 -0
  137. package/dist/ofetch/ts/parser/index.mjs +3 -76
  138. package/dist/ofetch-2rci5G0X.mjs +13 -0
  139. package/dist/parser-8NB1Nfwt.mjs +63 -0
  140. package/dist/parser-BJWwcP0S.mjs +69 -0
  141. package/dist/parser-CCXpH6OE.mjs +63 -0
  142. package/dist/parser-CE48730h.mjs +69 -0
  143. package/dist/parser-CFOZ5-GF.mjs +62 -0
  144. package/dist/parser-CSJYNO0a.mjs +69 -0
  145. package/dist/parser-C_kpdHgT.mjs +68 -0
  146. package/dist/parser-CaRC8JQj.mjs +67 -0
  147. package/dist/parser-DCA-N9mk.mjs +77 -0
  148. package/dist/parser-DY9NSCKJ.mjs +72 -0
  149. package/dist/parser-Dnqps2TD.mjs +66 -0
  150. package/dist/parser-GwoAS3rw.mjs +62 -0
  151. package/dist/ts-4mi0Q-kd.mjs +19 -0
  152. package/dist/ts-BaRFvnl0.mjs +19 -0
  153. package/dist/ts-BwAPOUdE.mjs +19 -0
  154. package/dist/ts-C9t_rVQx.mjs +19 -0
  155. package/dist/ts-CMn2aSnV.mjs +19 -0
  156. package/dist/ts-D-cZHoFQ.mjs +19 -0
  157. package/dist/uni/index.d.mts +9 -0
  158. package/dist/uni/index.mjs +9 -0
  159. package/dist/uni/js/config/index.d.mts +3 -0
  160. package/dist/uni/js/config/index.mjs +3 -0
  161. package/dist/uni/js/index.d.mts +5 -0
  162. package/dist/uni/js/index.mjs +5 -0
  163. package/dist/uni/js/parser/index.d.mts +3 -0
  164. package/dist/uni/js/parser/index.mjs +3 -0
  165. package/dist/uni/ts/config/index.d.mts +3 -0
  166. package/dist/uni/ts/config/index.mjs +3 -0
  167. package/dist/uni/ts/index.d.mts +5 -0
  168. package/dist/uni/ts/index.mjs +5 -0
  169. package/dist/uni/ts/parser/index.d.mts +3 -0
  170. package/dist/uni/ts/parser/index.mjs +3 -0
  171. package/dist/uni-DZmF7VCX.mjs +13 -0
  172. package/package.json +15 -15
  173. package/dist/axios/index.d.ts +0 -9
  174. package/dist/axios/js/config/index.d.ts +0 -5
  175. package/dist/axios/js/index.d.ts +0 -18
  176. package/dist/axios/ts/config/index.d.ts +0 -5
  177. package/dist/axios/ts/index.d.ts +0 -18
  178. package/dist/fetch/index.d.ts +0 -9
  179. package/dist/fetch/js/config/index.d.ts +0 -5
  180. package/dist/fetch/js/index.d.ts +0 -18
  181. package/dist/fetch/ts/config/index.d.ts +0 -5
  182. package/dist/fetch/ts/index.d.ts +0 -18
  183. package/dist/got/index.d.ts +0 -9
  184. package/dist/got/js/config/index.d.ts +0 -5
  185. package/dist/got/js/index.d.ts +0 -18
  186. package/dist/got/js/parser/index.d.ts +0 -12
  187. package/dist/got/ts/config/index.d.ts +0 -5
  188. package/dist/got/ts/index.d.ts +0 -18
  189. package/dist/got/ts/parser/index.d.ts +0 -12
  190. package/dist/index-BoRNV5uE.d.ts +0 -8
  191. package/dist/index-C-Of8dmT.d.ts +0 -8
  192. package/dist/index-DUlkpebX.d.ts +0 -8
  193. package/dist/index-doIz4HN1.d.ts +0 -8
  194. package/dist/index-ln0OpJQY.d.ts +0 -8
  195. package/dist/index.d.ts +0 -48
  196. package/dist/ky/index.d.ts +0 -9
  197. package/dist/ky/js/config/index.d.ts +0 -5
  198. package/dist/ky/js/index.d.ts +0 -18
  199. package/dist/ky/js/parser/index.d.ts +0 -12
  200. package/dist/ky/ts/config/index.d.ts +0 -5
  201. package/dist/ky/ts/index.d.ts +0 -18
  202. package/dist/ky/ts/parser/index.d.ts +0 -12
  203. package/dist/ofetch/index.d.ts +0 -9
  204. package/dist/ofetch/js/config/index.d.ts +0 -5
  205. package/dist/ofetch/js/index.d.ts +0 -18
  206. package/dist/ofetch/js/parser/index.d.ts +0 -12
  207. package/dist/ofetch/ts/config/index.d.ts +0 -5
  208. package/dist/ofetch/ts/index.d.ts +0 -18
  209. package/dist/ofetch/ts/parser/index.d.ts +0 -12
@@ -0,0 +1,69 @@
1
+ import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformBodyStringify, transformDefinitions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
2
+
3
+ //#region src/got/js/parser/index.ts
4
+ function parser(configRead) {
5
+ const source = parseOpenapiSpecification(configRead.source);
6
+ const comments = parseHeaderCommits(source);
7
+ const interfaces = [];
8
+ const functions = [];
9
+ transformBaseURL(source, { configRead });
10
+ transformDefinitions(source.definitions, { interfaces });
11
+ transformPaths(source.paths, {
12
+ configRead,
13
+ functions,
14
+ interfaces
15
+ });
16
+ configRead.graphs.comments = comments;
17
+ configRead.graphs.functions = functions;
18
+ configRead.graphs.interfaces = interfaces;
19
+ return configRead;
20
+ }
21
+ function transformPaths(paths, { configRead, functions, interfaces }) {
22
+ traversePaths(paths, (config) => {
23
+ /**
24
+
25
+ * function params/function options/function use interfaces
26
+
27
+ */
28
+ const { parameters, interfaces: attachInters, options } = parseMethodParameters(config);
29
+ let { name, description, url, responseType } = parseMethodMetadata(config);
30
+ interfaces.push(...attachInters);
31
+ parameters.push({
32
+ name: "config",
33
+ type: "import('got').OptionsOfTextResponseBody",
34
+ required: false
35
+ });
36
+ options.push(["...", "config"]);
37
+ if (configRead.config.baseURL) options.unshift(["prefixUrl", "baseURL"]);
38
+ for (const parameter of parameters) if (parameter.type === "FormData") parameter.type = "any";
39
+ transformParameters(parameters, {
40
+ syntax: "ecmascript",
41
+ configRead,
42
+ description,
43
+ interfaces,
44
+ responseType
45
+ });
46
+ transformBodyStringify("body", {
47
+ options,
48
+ parameters
49
+ });
50
+ transformQueryParams("query", {
51
+ optionKey: "searchParams",
52
+ options
53
+ });
54
+ url = transformUrlSyntax(url);
55
+ functions.push({
56
+ export: true,
57
+ async: true,
58
+ name,
59
+ description,
60
+ parameters,
61
+ body: [`const response = await http(${url}, {
62
+ ${literalFieldsToString(options)}
63
+ })`, "return response.json()"]
64
+ });
65
+ });
66
+ }
67
+
68
+ //#endregion
69
+ export { parser as parser$2, transformPaths as transformPaths$2 };
@@ -0,0 +1,62 @@
1
+ import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformDefinitions, transformParameters, transformUrlSyntax, traversePaths } from "@genapi/parser";
2
+
3
+ //#region src/uni/ts/parser/index.ts
4
+ function parser(configRead) {
5
+ const source = parseOpenapiSpecification(configRead.source);
6
+ const comments = parseHeaderCommits(source);
7
+ const interfaces = [];
8
+ const functions = [];
9
+ transformBaseURL(source, { configRead });
10
+ transformDefinitions(source.definitions, { interfaces });
11
+ transformPaths(source.paths, {
12
+ configRead,
13
+ functions,
14
+ interfaces
15
+ });
16
+ configRead.graphs.comments = comments;
17
+ configRead.graphs.functions = functions;
18
+ configRead.graphs.interfaces = interfaces;
19
+ return configRead;
20
+ }
21
+ function transformPaths(paths, { configRead, functions, interfaces }) {
22
+ traversePaths(paths, (config) => {
23
+ /**
24
+
25
+ * function params/function options/function use interfaces
26
+
27
+ */
28
+ const { parameters, interfaces: attachInters, options } = parseMethodParameters(config, {
29
+ body: "data",
30
+ query: "params"
31
+ });
32
+ let { name, description, url, responseType } = parseMethodMetadata(config);
33
+ options.push(["...", "config"]);
34
+ interfaces.push(...attachInters);
35
+ parameters.push({
36
+ name: "config",
37
+ type: "UnConfig<never>",
38
+ required: false
39
+ });
40
+ options.unshift("url");
41
+ options.unshift(["method", `"${config.method}"`]);
42
+ if (configRead.config.baseURL) options.unshift("baseURL");
43
+ const { spaceResponseType } = transformParameters(parameters, {
44
+ syntax: "typescript",
45
+ configRead,
46
+ description,
47
+ interfaces,
48
+ responseType
49
+ });
50
+ url = transformUrlSyntax(url);
51
+ functions.push({
52
+ export: true,
53
+ name,
54
+ description,
55
+ parameters,
56
+ body: [`const url = ${url}`, `return http.request<${spaceResponseType}>({ ${literalFieldsToString(options)} })`]
57
+ });
58
+ });
59
+ }
60
+
61
+ //#endregion
62
+ export { parser as parser$11, transformPaths as transformPaths$11 };
@@ -0,0 +1,69 @@
1
+ import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformBodyStringify, transformDefinitions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
2
+
3
+ //#region src/ky/js/parser/index.ts
4
+ function parser(configRead) {
5
+ const source = parseOpenapiSpecification(configRead.source);
6
+ const comments = parseHeaderCommits(source);
7
+ const interfaces = [];
8
+ const functions = [];
9
+ transformBaseURL(source, { configRead });
10
+ transformDefinitions(source.definitions, { interfaces });
11
+ transformPaths(source.paths, {
12
+ configRead,
13
+ functions,
14
+ interfaces
15
+ });
16
+ configRead.graphs.comments = comments;
17
+ configRead.graphs.functions = functions;
18
+ configRead.graphs.interfaces = interfaces;
19
+ return configRead;
20
+ }
21
+ function transformPaths(paths, { configRead, functions, interfaces }) {
22
+ traversePaths(paths, (config) => {
23
+ /**
24
+
25
+ * function params/function options/function use interfaces
26
+
27
+ */
28
+ const { parameters, interfaces: attachInters, options } = parseMethodParameters(config);
29
+ let { name, description, url, responseType } = parseMethodMetadata(config);
30
+ interfaces.push(...attachInters);
31
+ parameters.push({
32
+ name: "config",
33
+ type: "import('ky').Options",
34
+ required: false
35
+ });
36
+ options.push(["...", "config"]);
37
+ if (configRead.config.baseURL) options.unshift(["prefixUrl", "baseURL"]);
38
+ transformParameters(parameters, {
39
+ syntax: "ecmascript",
40
+ configRead,
41
+ description,
42
+ interfaces,
43
+ responseType,
44
+ generic: "import('ky').KyResponse<{__type__}>"
45
+ });
46
+ transformBodyStringify("body", {
47
+ options,
48
+ parameters
49
+ });
50
+ transformQueryParams("query", {
51
+ optionKey: "searchParams",
52
+ options
53
+ });
54
+ url = transformUrlSyntax(url);
55
+ functions.push({
56
+ export: true,
57
+ async: true,
58
+ name,
59
+ description,
60
+ parameters,
61
+ body: [`const response = await http(${url}, {
62
+ ${literalFieldsToString(options)}
63
+ })`, "return response.json()"]
64
+ });
65
+ });
66
+ }
67
+
68
+ //#endregion
69
+ export { parser as parser$6, transformPaths as transformPaths$6 };
@@ -0,0 +1,68 @@
1
+ import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformBodyStringify, transformDefinitions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
2
+
3
+ //#region src/ky/ts/parser/index.ts
4
+ function parser(configRead) {
5
+ const source = parseOpenapiSpecification(configRead.source);
6
+ const comments = parseHeaderCommits(source);
7
+ const interfaces = [];
8
+ const functions = [];
9
+ transformBaseURL(source, { configRead });
10
+ transformDefinitions(source.definitions, { interfaces });
11
+ transformPaths(source.paths, {
12
+ configRead,
13
+ functions,
14
+ interfaces
15
+ });
16
+ configRead.graphs.comments = comments;
17
+ configRead.graphs.functions = functions;
18
+ configRead.graphs.interfaces = interfaces;
19
+ return configRead;
20
+ }
21
+ function transformPaths(paths, { configRead, functions, interfaces }) {
22
+ traversePaths(paths, (config) => {
23
+ /**
24
+
25
+ * function params/function options/function use interfaces
26
+
27
+ */
28
+ const { parameters, interfaces: attachInters, options } = parseMethodParameters(config);
29
+ let { name, description, url, responseType } = parseMethodMetadata(config);
30
+ interfaces.push(...attachInters);
31
+ parameters.push({
32
+ name: "config",
33
+ type: "Options",
34
+ required: false
35
+ });
36
+ options.push(["...", "config"]);
37
+ if (configRead.config.baseURL) options.unshift(["prefixUrl", "baseURL"]);
38
+ const { spaceResponseType } = transformParameters(parameters, {
39
+ syntax: "typescript",
40
+ configRead,
41
+ description,
42
+ interfaces,
43
+ responseType
44
+ });
45
+ transformBodyStringify("body", {
46
+ options,
47
+ parameters
48
+ });
49
+ transformQueryParams("query", {
50
+ optionKey: "searchParams",
51
+ options
52
+ });
53
+ url = transformUrlSyntax(url);
54
+ functions.push({
55
+ export: true,
56
+ async: true,
57
+ name,
58
+ description,
59
+ parameters,
60
+ body: [`const response = await http(${url}, {
61
+ ${literalFieldsToString(options)}
62
+ })`, `return response.json<${spaceResponseType}>()`]
63
+ });
64
+ });
65
+ }
66
+
67
+ //#endregion
68
+ export { parser as parser$7, transformPaths as transformPaths$7 };
@@ -0,0 +1,67 @@
1
+ import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformDefinitions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
2
+
3
+ //#region src/ofetch/js/parser/index.ts
4
+ function parser(configRead) {
5
+ const source = parseOpenapiSpecification(configRead.source);
6
+ const comments = parseHeaderCommits(source);
7
+ const interfaces = [];
8
+ const functions = [];
9
+ transformBaseURL(source, { configRead });
10
+ transformDefinitions(source.definitions, { interfaces });
11
+ transformPaths(source.paths, {
12
+ configRead,
13
+ functions,
14
+ interfaces
15
+ });
16
+ configRead.graphs.comments = comments;
17
+ configRead.graphs.functions = functions;
18
+ configRead.graphs.interfaces = interfaces;
19
+ return configRead;
20
+ }
21
+ function transformPaths(paths, { configRead, functions, interfaces }) {
22
+ traversePaths(paths, (config) => {
23
+ /**
24
+
25
+ * function params/function options/function use interfaces
26
+
27
+ */
28
+ const { parameters, interfaces: attachInters, options } = parseMethodParameters(config, {
29
+ formData: "body",
30
+ query: "params"
31
+ });
32
+ let { name, description, url, responseType, body } = parseMethodMetadata(config);
33
+ interfaces.push(...attachInters);
34
+ parameters.push({
35
+ name: "options",
36
+ type: "import('ofetch').FetchOptions",
37
+ required: false
38
+ });
39
+ options.push(["...", "options"]);
40
+ options.unshift(["method", `"${config.method}"`]);
41
+ if (configRead.config.baseURL) options.unshift("baseURL");
42
+ transformParameters(parameters, {
43
+ syntax: "ecmascript",
44
+ configRead,
45
+ description,
46
+ interfaces,
47
+ responseType
48
+ });
49
+ url = transformQueryParams("query", {
50
+ body,
51
+ options,
52
+ url
53
+ });
54
+ url = transformUrlSyntax(url, { baseURL: configRead.config.baseURL });
55
+ functions.push({
56
+ export: true,
57
+ async: true,
58
+ name,
59
+ description,
60
+ parameters,
61
+ body: [...body, `return ofetch(${url}, {${literalFieldsToString(options)}})`]
62
+ });
63
+ });
64
+ }
65
+
66
+ //#endregion
67
+ export { parser as parser$8, transformPaths as transformPaths$8 };
@@ -0,0 +1,77 @@
1
+ import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformBodyStringify, transformDefinitions, transformHeaderOptions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
2
+
3
+ //#region src/fetch/js/parser/index.ts
4
+ function parser(configRead) {
5
+ const source = parseOpenapiSpecification(configRead.source);
6
+ const comments = parseHeaderCommits(source);
7
+ const interfaces = [];
8
+ const functions = [];
9
+ transformBaseURL(source, { configRead });
10
+ transformDefinitions(source.definitions, { interfaces });
11
+ transformPaths(source.paths, {
12
+ configRead,
13
+ functions,
14
+ interfaces
15
+ });
16
+ configRead.graphs.comments = comments;
17
+ configRead.graphs.functions = functions;
18
+ configRead.graphs.interfaces = interfaces;
19
+ return configRead;
20
+ }
21
+ function transformPaths(paths, { configRead, functions, interfaces }) {
22
+ traversePaths(paths, (config) => {
23
+ /**
24
+
25
+ * function params/function options/function use interfaces
26
+
27
+ */
28
+ const { parameters, interfaces: attachInters, options } = parseMethodParameters(config, { formData: "body" });
29
+ let { name, description, url, responseType, body } = parseMethodMetadata(config);
30
+ interfaces.push(...attachInters);
31
+ parameters.push({
32
+ name: "config",
33
+ type: "RequestInit",
34
+ required: false
35
+ });
36
+ if (config.method.toLowerCase() !== "get") options.unshift(["method", `"${config.method}"`]);
37
+ transformHeaderOptions("body", {
38
+ options,
39
+ parameters
40
+ });
41
+ options.push(["...", "config"]);
42
+ transformParameters(parameters, {
43
+ syntax: "ecmascript",
44
+ configRead,
45
+ description,
46
+ interfaces,
47
+ responseType
48
+ });
49
+ transformBodyStringify("body", {
50
+ options,
51
+ parameters
52
+ });
53
+ url = transformQueryParams("query", {
54
+ body,
55
+ options,
56
+ url
57
+ });
58
+ url = transformUrlSyntax(url, { baseURL: configRead.config.baseURL });
59
+ functions.push({
60
+ export: true,
61
+ async: true,
62
+ name,
63
+ description,
64
+ parameters,
65
+ body: [
66
+ ...body,
67
+ `const response = await fetch(${url}, {
68
+ ${literalFieldsToString(options)}
69
+ })`,
70
+ "return response.json()"
71
+ ]
72
+ });
73
+ });
74
+ }
75
+
76
+ //#endregion
77
+ export { parser as parser$4, transformPaths as transformPaths$4 };
@@ -0,0 +1,72 @@
1
+ import { parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformBodyStringify, transformDefinitions, transformFetchBody, transformHeaderOptions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
2
+
3
+ //#region src/fetch/ts/parser/index.ts
4
+ function parser(configRead) {
5
+ const source = parseOpenapiSpecification(configRead.source);
6
+ const comments = parseHeaderCommits(source);
7
+ const interfaces = [];
8
+ const functions = [];
9
+ transformBaseURL(source, { configRead });
10
+ transformDefinitions(source.definitions, { interfaces });
11
+ transformPaths(source.paths, {
12
+ configRead,
13
+ functions,
14
+ interfaces
15
+ });
16
+ configRead.graphs.comments = comments;
17
+ configRead.graphs.functions = functions;
18
+ configRead.graphs.interfaces = interfaces;
19
+ return configRead;
20
+ }
21
+ function transformPaths(paths, { configRead, functions, interfaces }) {
22
+ traversePaths(paths, (config) => {
23
+ /**
24
+
25
+ * function params/function options/function use interfaces
26
+
27
+ */
28
+ const { parameters, interfaces: attachInters, options } = parseMethodParameters(config);
29
+ let { name, description, url, responseType, body } = parseMethodMetadata(config);
30
+ interfaces.push(...attachInters);
31
+ parameters.push({
32
+ name: "config",
33
+ type: "RequestInit",
34
+ required: false
35
+ });
36
+ if (config.method.toLowerCase() !== "get") options.unshift(["method", `"${config.method}"`]);
37
+ transformHeaderOptions("body", {
38
+ options,
39
+ parameters
40
+ });
41
+ options.push(["...", "config"]);
42
+ const { spaceResponseType } = transformParameters(parameters, {
43
+ syntax: "typescript",
44
+ configRead,
45
+ description,
46
+ interfaces,
47
+ responseType
48
+ });
49
+ transformBodyStringify("body", {
50
+ options,
51
+ parameters
52
+ });
53
+ url = transformQueryParams("query", {
54
+ body,
55
+ options,
56
+ url
57
+ });
58
+ url = transformUrlSyntax(url, { baseURL: configRead.config.baseURL });
59
+ const fetch = transformFetchBody(url, options, spaceResponseType);
60
+ functions.push({
61
+ export: true,
62
+ async: true,
63
+ name,
64
+ description,
65
+ parameters,
66
+ body: [...body, ...fetch]
67
+ });
68
+ });
69
+ }
70
+
71
+ //#endregion
72
+ export { parser as parser$3, transformPaths as transformPaths$3 };
@@ -0,0 +1,66 @@
1
+ import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformDefinitions, transformParameters, transformQueryParams, transformUrlSyntax, traversePaths } from "@genapi/parser";
2
+
3
+ //#region src/ofetch/ts/parser/index.ts
4
+ function parser(configRead) {
5
+ const source = parseOpenapiSpecification(configRead.source);
6
+ const comments = parseHeaderCommits(source);
7
+ const interfaces = [];
8
+ const functions = [];
9
+ transformBaseURL(source, { configRead });
10
+ transformDefinitions(source.definitions, { interfaces });
11
+ transformPaths(source.paths, {
12
+ configRead,
13
+ functions,
14
+ interfaces
15
+ });
16
+ configRead.graphs.comments = comments;
17
+ configRead.graphs.functions = functions;
18
+ configRead.graphs.interfaces = interfaces;
19
+ return configRead;
20
+ }
21
+ function transformPaths(paths, { configRead, functions, interfaces }) {
22
+ traversePaths(paths, (config) => {
23
+ /**
24
+
25
+ * function params/function options/function use interfaces
26
+
27
+ */
28
+ const { parameters, interfaces: attachInters, options } = parseMethodParameters(config, {
29
+ formData: "body",
30
+ query: "params"
31
+ });
32
+ let { name, description, url, responseType, body } = parseMethodMetadata(config);
33
+ interfaces.push(...attachInters);
34
+ parameters.push({
35
+ name: "options",
36
+ type: "FetchOptions",
37
+ required: false
38
+ });
39
+ options.push(["...", "options"]);
40
+ options.unshift(["method", `"${config.method}"`]);
41
+ if (configRead.config.baseURL) options.unshift("baseURL");
42
+ const { spaceResponseType } = transformParameters(parameters, {
43
+ syntax: "typescript",
44
+ configRead,
45
+ description,
46
+ interfaces,
47
+ responseType
48
+ });
49
+ url = transformQueryParams("query", {
50
+ body,
51
+ options,
52
+ url
53
+ });
54
+ url = transformUrlSyntax(url);
55
+ functions.push({
56
+ export: true,
57
+ name,
58
+ description,
59
+ parameters,
60
+ body: [`return ofetch<${spaceResponseType}>(${url}, {${literalFieldsToString(options)}})`]
61
+ });
62
+ });
63
+ }
64
+
65
+ //#endregion
66
+ export { parser as parser$10, transformPaths as transformPaths$10 };
@@ -0,0 +1,62 @@
1
+ import { literalFieldsToString, parseHeaderCommits, parseMethodMetadata, parseMethodParameters, parseOpenapiSpecification, transformBaseURL, transformDefinitions, transformParameters, transformUrlSyntax, traversePaths } from "@genapi/parser";
2
+
3
+ //#region src/axios/ts/parser/index.ts
4
+ function parser(configRead) {
5
+ const source = parseOpenapiSpecification(configRead.source);
6
+ const comments = parseHeaderCommits(source);
7
+ const interfaces = [];
8
+ const functions = [];
9
+ transformBaseURL(source, { configRead });
10
+ transformDefinitions(source.definitions, { interfaces });
11
+ transformPaths(source.paths, {
12
+ configRead,
13
+ functions,
14
+ interfaces
15
+ });
16
+ configRead.graphs.comments = comments;
17
+ configRead.graphs.functions = functions;
18
+ configRead.graphs.interfaces = interfaces;
19
+ return configRead;
20
+ }
21
+ function transformPaths(paths, { configRead, functions, interfaces }) {
22
+ traversePaths(paths, (config) => {
23
+ /**
24
+
25
+ * function params/function options/function use interfaces
26
+
27
+ */
28
+ const { parameters, interfaces: attachInters, options } = parseMethodParameters(config, {
29
+ body: "data",
30
+ query: "params"
31
+ });
32
+ let { name, description, url, responseType } = parseMethodMetadata(config);
33
+ options.push(["...", "config"]);
34
+ interfaces.push(...attachInters);
35
+ parameters.push({
36
+ name: "config",
37
+ type: "AxiosRequestConfig",
38
+ required: false
39
+ });
40
+ options.unshift("url");
41
+ options.unshift(["method", `"${config.method}"`]);
42
+ if (configRead.config.baseURL) options.unshift("baseURL");
43
+ const { spaceResponseType } = transformParameters(parameters, {
44
+ syntax: "typescript",
45
+ configRead,
46
+ description,
47
+ interfaces,
48
+ responseType
49
+ });
50
+ url = transformUrlSyntax(url);
51
+ functions.push({
52
+ export: true,
53
+ name,
54
+ description,
55
+ parameters,
56
+ body: [`const url = ${url}`, `return http.request<${spaceResponseType}>({ ${literalFieldsToString(options)} })`]
57
+ });
58
+ });
59
+ }
60
+
61
+ //#endregion
62
+ export { parser as parser$1, transformPaths as transformPaths$1 };
@@ -0,0 +1,19 @@
1
+ import { config$1 as config } from "./config-B89EoGE7.mjs";
2
+ import { parser$1 as parser } from "./parser-GwoAS3rw.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 };
@@ -0,0 +1,19 @@
1
+ import { config$9 as config } from "./config-C94x0Nge.mjs";
2
+ import { parser$10 as parser } from "./parser-Dnqps2TD.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$10, dest$1 as dest$10, generate$1 as generate$10, original$1 as original$10, ts_default as ts_default$4 };
@@ -0,0 +1,19 @@
1
+ import { config$11 as config } from "./config-CEngTpXa.mjs";
2
+ import { parser$11 as parser } from "./parser-CFOZ5-GF.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 };