@goast/core 0.3.8 → 0.4.0-beta2

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 (310) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2 -4
  3. package/esm/_dnt.shims.d.ts +11 -0
  4. package/esm/_dnt.shims.d.ts.map +1 -0
  5. package/esm/_dnt.shims.js +66 -0
  6. package/esm/index.d.ts +6 -0
  7. package/esm/index.d.ts.map +1 -0
  8. package/esm/lib/ast/index.d.ts +2 -0
  9. package/esm/lib/ast/index.d.ts.map +1 -0
  10. package/{types → esm}/lib/ast/node.d.ts +2 -1
  11. package/esm/lib/ast/node.d.ts.map +1 -0
  12. package/esm/lib/ast/node.js +6 -0
  13. package/{types → esm}/lib/codegen/config.d.ts +3 -2
  14. package/esm/lib/codegen/config.d.ts.map +1 -0
  15. package/{types → esm}/lib/codegen/endpoints-generator.d.ts +9 -6
  16. package/esm/lib/codegen/endpoints-generator.d.ts.map +1 -0
  17. package/esm/lib/codegen/endpoints-generator.js +9 -4
  18. package/{types → esm}/lib/codegen/generator.d.ts +11 -11
  19. package/esm/lib/codegen/generator.d.ts.map +1 -0
  20. package/esm/lib/codegen/generator.js +24 -10
  21. package/esm/lib/codegen/index.d.ts +7 -0
  22. package/esm/lib/codegen/index.d.ts.map +1 -0
  23. package/{types → esm}/lib/codegen/internal-utils.d.ts +1 -0
  24. package/esm/lib/codegen/internal-utils.d.ts.map +1 -0
  25. package/{types → esm}/lib/codegen/schemas-generator.d.ts +9 -6
  26. package/esm/lib/codegen/schemas-generator.d.ts.map +1 -0
  27. package/esm/lib/codegen/schemas-generator.js +11 -5
  28. package/{types → esm}/lib/codegen/services-generator.d.ts +9 -6
  29. package/esm/lib/codegen/services-generator.d.ts.map +1 -0
  30. package/esm/lib/codegen/services-generator.js +9 -4
  31. package/{types → esm}/lib/codegen/types.d.ts +5 -3
  32. package/esm/lib/codegen/types.d.ts.map +1 -0
  33. package/esm/lib/collect/collector.d.ts +4 -0
  34. package/esm/lib/collect/collector.d.ts.map +1 -0
  35. package/{types → esm}/lib/collect/helpers.d.ts +3 -2
  36. package/esm/lib/collect/helpers.d.ts.map +1 -0
  37. package/esm/lib/collect/index.d.ts +4 -0
  38. package/esm/lib/collect/index.d.ts.map +1 -0
  39. package/{types → esm}/lib/collect/types.d.ts +2 -1
  40. package/esm/lib/collect/types.d.ts.map +1 -0
  41. package/{types → esm}/lib/internal-utils.d.ts +1 -0
  42. package/esm/lib/internal-utils.d.ts.map +1 -0
  43. package/esm/lib/parse/deref-proxy.d.ts +4 -0
  44. package/esm/lib/parse/deref-proxy.d.ts.map +1 -0
  45. package/esm/lib/parse/deref-proxy.js +18 -3
  46. package/esm/lib/parse/index.d.ts +4 -0
  47. package/esm/lib/parse/index.d.ts.map +1 -0
  48. package/{types → esm}/lib/parse/openapi-types.d.ts +1 -0
  49. package/esm/lib/parse/openapi-types.d.ts.map +1 -0
  50. package/{types → esm}/lib/parse/parser.d.ts +4 -3
  51. package/esm/lib/parse/parser.d.ts.map +1 -0
  52. package/esm/lib/parse/parser.js +17 -6
  53. package/{types → esm}/lib/parse/types.d.ts +3 -2
  54. package/esm/lib/parse/types.d.ts.map +1 -0
  55. package/{types → esm}/lib/transform/api-types.d.ts +3 -2
  56. package/esm/lib/transform/api-types.d.ts.map +1 -0
  57. package/{types → esm}/lib/transform/helpers.d.ts +4 -3
  58. package/esm/lib/transform/helpers.d.ts.map +1 -0
  59. package/esm/lib/transform/helpers.js +9 -3
  60. package/esm/lib/transform/index.d.ts +3 -0
  61. package/esm/lib/transform/index.d.ts.map +1 -0
  62. package/esm/lib/transform/transform-document.d.ts +4 -0
  63. package/esm/lib/transform/transform-document.d.ts.map +1 -0
  64. package/esm/lib/transform/transform-endpoint.d.ts +5 -0
  65. package/esm/lib/transform/transform-endpoint.d.ts.map +1 -0
  66. package/esm/lib/transform/transform-schema.d.ts +5 -0
  67. package/esm/lib/transform/transform-schema.d.ts.map +1 -0
  68. package/esm/lib/transform/transform-schema.js +3 -1
  69. package/esm/lib/transform/transformer.d.ts +5 -0
  70. package/esm/lib/transform/transformer.d.ts.map +1 -0
  71. package/esm/lib/transform/transformer.js +1 -1
  72. package/{types → esm}/lib/transform/types.d.ts +5 -4
  73. package/esm/lib/transform/types.d.ts.map +1 -0
  74. package/{types → esm}/lib/utils/action-provider.d.ts +2 -1
  75. package/esm/lib/utils/action-provider.d.ts.map +1 -0
  76. package/esm/lib/utils/action-provider.js +6 -1
  77. package/{types → esm}/lib/utils/array.utils.d.ts +1 -0
  78. package/esm/lib/utils/array.utils.d.ts.map +1 -0
  79. package/esm/lib/utils/asset-manager.d.ts +8 -0
  80. package/esm/lib/utils/asset-manager.d.ts.map +1 -0
  81. package/esm/lib/utils/asset-manager.js +49 -0
  82. package/{types → esm}/lib/utils/class.utils.d.ts +1 -0
  83. package/esm/lib/utils/class.utils.d.ts.map +1 -0
  84. package/{types → esm}/lib/utils/common.utils.d.ts +2 -1
  85. package/esm/lib/utils/common.utils.d.ts.map +1 -0
  86. package/{types → esm}/lib/utils/condition.d.ts +1 -0
  87. package/esm/lib/utils/condition.d.ts.map +1 -0
  88. package/esm/lib/utils/endpoint.utils.d.ts +3 -0
  89. package/esm/lib/utils/endpoint.utils.d.ts.map +1 -0
  90. package/{types → esm}/lib/utils/error.utils.d.ts +1 -0
  91. package/esm/lib/utils/error.utils.d.ts.map +1 -0
  92. package/{types → esm}/lib/utils/factory.d.ts +2 -1
  93. package/esm/lib/utils/factory.d.ts.map +1 -0
  94. package/esm/lib/utils/factory.js +6 -1
  95. package/{types → esm}/lib/utils/file-system.utils.d.ts +2 -1
  96. package/esm/lib/utils/file-system.utils.d.ts.map +1 -0
  97. package/esm/lib/utils/file-system.utils.js +1 -1
  98. package/{types → esm}/lib/utils/generator.utils.d.ts +1 -0
  99. package/esm/lib/utils/generator.utils.d.ts.map +1 -0
  100. package/esm/lib/utils/index.d.ts +16 -0
  101. package/esm/lib/utils/index.d.ts.map +1 -0
  102. package/esm/lib/utils/index.js +1 -0
  103. package/{types → esm}/lib/utils/object.utils.d.ts +1 -0
  104. package/esm/lib/utils/object.utils.d.ts.map +1 -0
  105. package/esm/lib/utils/object.utils.js +6 -1
  106. package/{types → esm}/lib/utils/schema.utils.d.ts +3 -2
  107. package/esm/lib/utils/schema.utils.d.ts.map +1 -0
  108. package/{types → esm}/lib/utils/source-builder.d.ts +8 -6
  109. package/esm/lib/utils/source-builder.d.ts.map +1 -0
  110. package/esm/lib/utils/source-builder.js +39 -6
  111. package/esm/lib/utils/string-builder/index.d.ts +4 -0
  112. package/esm/lib/utils/string-builder/index.d.ts.map +1 -0
  113. package/{types → esm}/lib/utils/string-builder/options.d.ts +1 -0
  114. package/esm/lib/utils/string-builder/options.d.ts.map +1 -0
  115. package/esm/lib/utils/string-builder/options.js +1 -1
  116. package/{types → esm}/lib/utils/string-builder/string-builder.d.ts +3 -2
  117. package/esm/lib/utils/string-builder/string-builder.d.ts.map +1 -0
  118. package/esm/lib/utils/string-builder/string-builder.js +12 -1
  119. package/{types → esm}/lib/utils/string-builder/utils.d.ts +3 -2
  120. package/esm/lib/utils/string-builder/utils.d.ts.map +1 -0
  121. package/{types → esm}/lib/utils/string.utils.d.ts +3 -2
  122. package/esm/lib/utils/string.utils.d.ts.map +1 -0
  123. package/{types → esm}/lib/utils/string.utils.types.d.ts +1 -0
  124. package/esm/lib/utils/string.utils.types.d.ts.map +1 -0
  125. package/{types → esm}/lib/utils/type.utils.d.ts +2 -0
  126. package/esm/lib/utils/type.utils.d.ts.map +1 -0
  127. package/esm/package.json +3 -0
  128. package/package.json +23 -31
  129. package/script/_dnt.shims.d.ts +11 -0
  130. package/script/_dnt.shims.d.ts.map +1 -0
  131. package/script/_dnt.shims.js +75 -0
  132. package/script/index.d.ts +6 -0
  133. package/script/index.d.ts.map +1 -0
  134. package/script/index.js +8 -0
  135. package/script/lib/ast/index.d.ts +2 -0
  136. package/script/lib/ast/index.d.ts.map +1 -0
  137. package/{cjs → script}/lib/ast/index.js +1 -1
  138. package/script/lib/ast/node.d.ts +15 -0
  139. package/script/lib/ast/node.d.ts.map +1 -0
  140. package/{cjs → script}/lib/ast/node.js +6 -0
  141. package/script/lib/codegen/config.d.ts +16 -0
  142. package/script/lib/codegen/config.d.ts.map +1 -0
  143. package/script/lib/codegen/config.js +11 -0
  144. package/script/lib/codegen/endpoints-generator.d.ts +18 -0
  145. package/script/lib/codegen/endpoints-generator.d.ts.map +1 -0
  146. package/{cjs → script}/lib/codegen/endpoints-generator.js +13 -8
  147. package/script/lib/codegen/generator.d.ts +39 -0
  148. package/script/lib/codegen/generator.d.ts.map +1 -0
  149. package/{cjs → script}/lib/codegen/generator.js +33 -19
  150. package/script/lib/codegen/index.d.ts +7 -0
  151. package/script/lib/codegen/index.d.ts.map +1 -0
  152. package/script/lib/codegen/index.js +9 -0
  153. package/script/lib/codegen/internal-utils.d.ts +2 -0
  154. package/script/lib/codegen/internal-utils.d.ts.map +1 -0
  155. package/script/lib/codegen/schemas-generator.d.ts +19 -0
  156. package/script/lib/codegen/schemas-generator.d.ts.map +1 -0
  157. package/{cjs → script}/lib/codegen/schemas-generator.js +17 -11
  158. package/script/lib/codegen/services-generator.d.ts +18 -0
  159. package/script/lib/codegen/services-generator.d.ts.map +1 -0
  160. package/{cjs → script}/lib/codegen/services-generator.js +13 -8
  161. package/script/lib/codegen/types.d.ts +19 -0
  162. package/script/lib/codegen/types.d.ts.map +1 -0
  163. package/script/lib/collect/collector.d.ts +4 -0
  164. package/script/lib/collect/collector.d.ts.map +1 -0
  165. package/{cjs → script}/lib/collect/collector.js +28 -28
  166. package/script/lib/collect/helpers.d.ts +5 -0
  167. package/script/lib/collect/helpers.d.ts.map +1 -0
  168. package/{cjs → script}/lib/collect/helpers.js +2 -2
  169. package/script/lib/collect/index.d.ts +4 -0
  170. package/script/lib/collect/index.d.ts.map +1 -0
  171. package/script/lib/collect/index.js +6 -0
  172. package/script/lib/collect/types.d.ts +13 -0
  173. package/script/lib/collect/types.d.ts.map +1 -0
  174. package/script/lib/internal-utils.d.ts +2 -0
  175. package/script/lib/internal-utils.d.ts.map +1 -0
  176. package/script/lib/parse/deref-proxy.d.ts +4 -0
  177. package/script/lib/parse/deref-proxy.d.ts.map +1 -0
  178. package/{cjs → script}/lib/parse/deref-proxy.js +21 -6
  179. package/script/lib/parse/index.d.ts +4 -0
  180. package/script/lib/parse/index.d.ts.map +1 -0
  181. package/script/lib/parse/index.js +6 -0
  182. package/script/lib/parse/openapi-types.d.ts +898 -0
  183. package/script/lib/parse/openapi-types.d.ts.map +1 -0
  184. package/script/lib/parse/parser.d.ts +19 -0
  185. package/script/lib/parse/parser.d.ts.map +1 -0
  186. package/{cjs → script}/lib/parse/parser.js +32 -21
  187. package/script/lib/parse/types.d.ts +24 -0
  188. package/script/lib/parse/types.d.ts.map +1 -0
  189. package/script/lib/parse/types.js +5 -0
  190. package/script/lib/transform/api-types.d.ts +195 -0
  191. package/script/lib/transform/api-types.d.ts.map +1 -0
  192. package/script/lib/transform/helpers.d.ts +51 -0
  193. package/script/lib/transform/helpers.d.ts.map +1 -0
  194. package/{cjs → script}/lib/transform/helpers.js +16 -10
  195. package/script/lib/transform/index.d.ts +3 -0
  196. package/script/lib/transform/index.d.ts.map +1 -0
  197. package/script/lib/transform/index.js +5 -0
  198. package/script/lib/transform/transform-document.d.ts +4 -0
  199. package/script/lib/transform/transform-document.d.ts.map +1 -0
  200. package/{cjs → script}/lib/transform/transform-document.js +2 -2
  201. package/script/lib/transform/transform-endpoint.d.ts +5 -0
  202. package/script/lib/transform/transform-endpoint.d.ts.map +1 -0
  203. package/{cjs → script}/lib/transform/transform-endpoint.js +18 -18
  204. package/script/lib/transform/transform-schema.d.ts +5 -0
  205. package/script/lib/transform/transform-schema.d.ts.map +1 -0
  206. package/{cjs → script}/lib/transform/transform-schema.js +14 -12
  207. package/script/lib/transform/transformer.d.ts +5 -0
  208. package/script/lib/transform/transformer.d.ts.map +1 -0
  209. package/{cjs → script}/lib/transform/transformer.js +10 -10
  210. package/script/lib/transform/types.d.ts +36 -0
  211. package/script/lib/transform/types.d.ts.map +1 -0
  212. package/script/lib/utils/action-provider.d.ts +29 -0
  213. package/script/lib/utils/action-provider.d.ts.map +1 -0
  214. package/{cjs → script}/lib/utils/action-provider.js +6 -1
  215. package/script/lib/utils/array.utils.d.ts +2 -0
  216. package/script/lib/utils/array.utils.d.ts.map +1 -0
  217. package/script/lib/utils/asset-manager.d.ts +8 -0
  218. package/script/lib/utils/asset-manager.d.ts.map +1 -0
  219. package/script/lib/utils/asset-manager.js +54 -0
  220. package/script/lib/utils/class.utils.d.ts +8 -0
  221. package/script/lib/utils/class.utils.d.ts.map +1 -0
  222. package/script/lib/utils/common.utils.d.ts +16 -0
  223. package/script/lib/utils/common.utils.d.ts.map +1 -0
  224. package/script/lib/utils/condition.d.ts +4 -0
  225. package/script/lib/utils/condition.d.ts.map +1 -0
  226. package/script/lib/utils/endpoint.utils.d.ts +3 -0
  227. package/script/lib/utils/endpoint.utils.d.ts.map +1 -0
  228. package/script/lib/utils/error.utils.d.ts +2 -0
  229. package/script/lib/utils/error.utils.d.ts.map +1 -0
  230. package/script/lib/utils/factory.d.ts +21 -0
  231. package/script/lib/utils/factory.d.ts.map +1 -0
  232. package/{cjs → script}/lib/utils/factory.js +6 -1
  233. package/script/lib/utils/file-system.utils.d.ts +9 -0
  234. package/script/lib/utils/file-system.utils.d.ts.map +1 -0
  235. package/{cjs → script}/lib/utils/file-system.utils.js +2 -2
  236. package/script/lib/utils/generator.utils.d.ts +2 -0
  237. package/script/lib/utils/generator.utils.d.ts.map +1 -0
  238. package/script/lib/utils/index.d.ts +16 -0
  239. package/script/lib/utils/index.d.ts.map +1 -0
  240. package/script/lib/utils/index.js +18 -0
  241. package/script/lib/utils/object.utils.d.ts +3 -0
  242. package/script/lib/utils/object.utils.d.ts.map +1 -0
  243. package/{cjs → script}/lib/utils/object.utils.js +6 -1
  244. package/script/lib/utils/schema.utils.d.ts +11 -0
  245. package/script/lib/utils/schema.utils.d.ts.map +1 -0
  246. package/{cjs → script}/lib/utils/schema.utils.js +2 -2
  247. package/script/lib/utils/source-builder.d.ts +233 -0
  248. package/script/lib/utils/source-builder.d.ts.map +1 -0
  249. package/{cjs → script}/lib/utils/source-builder.js +59 -26
  250. package/script/lib/utils/string-builder/index.d.ts +4 -0
  251. package/script/lib/utils/string-builder/index.d.ts.map +1 -0
  252. package/script/lib/utils/string-builder/index.js +8 -0
  253. package/script/lib/utils/string-builder/options.d.ts +15 -0
  254. package/script/lib/utils/string-builder/options.d.ts.map +1 -0
  255. package/{cjs → script}/lib/utils/string-builder/options.js +2 -2
  256. package/script/lib/utils/string-builder/string-builder.d.ts +73 -0
  257. package/script/lib/utils/string-builder/string-builder.d.ts.map +1 -0
  258. package/{cjs → script}/lib/utils/string-builder/string-builder.js +17 -6
  259. package/script/lib/utils/string-builder/utils.d.ts +22 -0
  260. package/script/lib/utils/string-builder/utils.d.ts.map +1 -0
  261. package/{cjs → script}/lib/utils/string-builder/utils.js +4 -4
  262. package/script/lib/utils/string.utils.d.ts +130 -0
  263. package/script/lib/utils/string.utils.d.ts.map +1 -0
  264. package/{cjs → script}/lib/utils/string.utils.js +2 -2
  265. package/script/lib/utils/string.utils.types.d.ts +150 -0
  266. package/script/lib/utils/string.utils.types.d.ts.map +1 -0
  267. package/script/lib/utils/type.utils.d.ts +57 -0
  268. package/script/lib/utils/type.utils.d.ts.map +1 -0
  269. package/script/package.json +3 -0
  270. package/cjs/index.js +0 -8
  271. package/cjs/lib/codegen/config.js +0 -11
  272. package/cjs/lib/codegen/index.js +0 -9
  273. package/cjs/lib/collect/index.js +0 -6
  274. package/cjs/lib/parse/index.js +0 -6
  275. package/cjs/lib/parse/types.js +0 -5
  276. package/cjs/lib/transform/index.js +0 -5
  277. package/cjs/lib/utils/index.js +0 -17
  278. package/cjs/lib/utils/string-builder/index.js +0 -8
  279. package/cjs/package.json +0 -1
  280. package/types/index.d.ts +0 -5
  281. package/types/lib/ast/index.d.ts +0 -1
  282. package/types/lib/codegen/index.d.ts +0 -6
  283. package/types/lib/collect/collector.d.ts +0 -3
  284. package/types/lib/collect/index.d.ts +0 -3
  285. package/types/lib/parse/deref-proxy.d.ts +0 -3
  286. package/types/lib/parse/index.d.ts +0 -3
  287. package/types/lib/transform/index.d.ts +0 -2
  288. package/types/lib/transform/transform-document.d.ts +0 -3
  289. package/types/lib/transform/transform-endpoint.d.ts +0 -4
  290. package/types/lib/transform/transform-schema.d.ts +0 -4
  291. package/types/lib/transform/transformer.d.ts +0 -4
  292. package/types/lib/utils/endpoint.utils.d.ts +0 -2
  293. package/types/lib/utils/index.d.ts +0 -14
  294. package/types/lib/utils/string-builder/index.d.ts +0 -3
  295. /package/{cjs → script}/lib/codegen/internal-utils.js +0 -0
  296. /package/{cjs → script}/lib/codegen/types.js +0 -0
  297. /package/{cjs → script}/lib/collect/types.js +0 -0
  298. /package/{cjs → script}/lib/internal-utils.js +0 -0
  299. /package/{cjs → script}/lib/parse/openapi-types.js +0 -0
  300. /package/{cjs → script}/lib/transform/api-types.js +0 -0
  301. /package/{cjs → script}/lib/transform/types.js +0 -0
  302. /package/{cjs → script}/lib/utils/array.utils.js +0 -0
  303. /package/{cjs → script}/lib/utils/class.utils.js +0 -0
  304. /package/{cjs → script}/lib/utils/common.utils.js +0 -0
  305. /package/{cjs → script}/lib/utils/condition.js +0 -0
  306. /package/{cjs → script}/lib/utils/endpoint.utils.js +0 -0
  307. /package/{cjs → script}/lib/utils/error.utils.js +0 -0
  308. /package/{cjs → script}/lib/utils/generator.utils.js +0 -0
  309. /package/{cjs → script}/lib/utils/string.utils.types.js +0 -0
  310. /package/{cjs → script}/lib/utils/type.utils.js +0 -0
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OpenApiEndpointsGenerationProviderBase = void 0;
4
- const generator_1 = require("./generator");
5
- const internal_utils_1 = require("./internal-utils");
6
- class OpenApiEndpointsGenerationProviderBase extends generator_1.OpenApiGenerationProviderBase {
4
+ const generator_js_1 = require("./generator.js");
5
+ const internal_utils_js_1 = require("./internal-utils.js");
6
+ class OpenApiEndpointsGenerationProviderBase extends generator_js_1.OpenApiGenerationProviderBase {
7
7
  getProviderContext(context, config, defaultConfig) {
8
8
  const ctx = super.getProviderContext(context, config, defaultConfig);
9
9
  return Object.assign(ctx, {
@@ -11,20 +11,25 @@ class OpenApiEndpointsGenerationProviderBase extends generator_1.OpenApiGenerati
11
11
  output: this.initResult(ctx),
12
12
  });
13
13
  }
14
- onGenerate(ctx) {
14
+ async onGenerate(ctx) {
15
15
  for (const endpoint of ctx.data.endpoints) {
16
- this.getEndpointResult(ctx, endpoint);
16
+ await this.getEndpointResult(ctx, endpoint);
17
17
  }
18
+ await this.generateAdditionalFiles(ctx);
18
19
  return ctx.output;
19
20
  }
20
- getEndpointResult(ctx, endpoint) {
21
+ async getEndpointResult(ctx, endpoint) {
21
22
  const existingResult = ctx.existingEndpointResults.get(endpoint.id);
22
23
  if (existingResult)
23
24
  return existingResult;
24
- const result = this.generateEndpoint(ctx, endpoint);
25
- (0, internal_utils_1.addSourceIfTest)(ctx.config, result, () => `${endpoint.$src.file}#${endpoint.$src.path}`);
25
+ const result = await this.generateEndpoint(ctx, endpoint);
26
+ (0, internal_utils_js_1.addSourceIfTest)(ctx.config, result, () => `${endpoint.$src.file}#${endpoint.$src.path}`);
26
27
  this.addEndpointResult(ctx, endpoint, result);
27
28
  return result;
28
29
  }
30
+ // deno-lint-ignore no-unused-vars
31
+ generateAdditionalFiles(ctx) {
32
+ // Override if needed
33
+ }
29
34
  }
30
35
  exports.OpenApiEndpointsGenerationProviderBase = OpenApiEndpointsGenerationProviderBase;
@@ -0,0 +1,39 @@
1
+ import { type OpenApiGeneratorConfig } from './config.js';
2
+ import type { AnyConfig, OpenApiGenerationProvider, OpenApiGenerationProviderContext, OpenApiGenerationProviderFn, OpenApiGeneratorContext, OpenApiGeneratorInput, OpenApiGeneratorOutput } from './types.js';
3
+ import { OpenApiParser } from '../parse/parser.js';
4
+ import type { ApiData } from '../transform/index.js';
5
+ import { ActionProvider } from '../utils/action-provider.js';
6
+ import { type DirectoryScanOptions } from '../utils/file-system.utils.js';
7
+ import type { EmptyConstructor, Merge } from '../utils/type.utils.js';
8
+ type OpenApiGenerationProviders = {
9
+ provider: ActionProvider<OpenApiGenerationProviderFn>;
10
+ config: AnyConfig | undefined;
11
+ }[];
12
+ type VInput<TActual, TExpected> = TExpected extends TActual ? TActual : {
13
+ __error: 'The current output of the generator does not satisfy the input of this generator.';
14
+ };
15
+ declare class _OpenApiGenerator<TOutput extends OpenApiGeneratorInput> {
16
+ private readonly _providers;
17
+ private readonly _config;
18
+ private readonly _parser;
19
+ constructor(config: OpenApiGeneratorConfig, providers: OpenApiGenerationProviders, parser: OpenApiParser);
20
+ use<PInput extends OpenApiGeneratorInput, POutput extends OpenApiGeneratorOutput, PConfig extends AnyConfig>(provider: ActionProvider<OpenApiGenerationProviderFn<VInput<PInput, TOutput>, POutput, PConfig>>, config?: Partial<PConfig>): _OpenApiGenerator<Merge<[TOutput, POutput]>>;
21
+ useType<PInput extends OpenApiGeneratorInput, POutput extends OpenApiGeneratorOutput, PConfig extends AnyConfig>(type: EmptyConstructor<OpenApiGenerationProvider<VInput<PInput, TOutput>, POutput, PConfig>>, config?: Partial<PConfig>): _OpenApiGenerator<Merge<[TOutput, POutput]>>;
22
+ useFn<PInput extends TOutput, POutput extends OpenApiGeneratorOutput, PConfig extends AnyConfig>(fn: OpenApiGenerationProviderFn<VInput<PInput, TOutput>, POutput, PConfig>, config?: Partial<PConfig>): _OpenApiGenerator<Merge<[TOutput, POutput]>>;
23
+ useValue<PInput extends TOutput, POutput extends OpenApiGeneratorOutput, PConfig extends AnyConfig>(value: OpenApiGenerationProvider<VInput<PInput, TOutput>, POutput, PConfig>, config?: Partial<PConfig>): _OpenApiGenerator<Merge<[TOutput, POutput]>>;
24
+ generate<T extends ApiData>(data: T): Promise<TOutput>;
25
+ parseAndGenerate(...fileNames: (string | string[])[]): Promise<TOutput>;
26
+ parseAndGenerateFromDir(dir: string, options?: Partial<DirectoryScanOptions>): Promise<TOutput>;
27
+ }
28
+ export declare class OpenApiGenerator extends _OpenApiGenerator<{}> {
29
+ constructor(config?: Partial<OpenApiGeneratorConfig>);
30
+ }
31
+ export type DefaultGenerationProviderConfig<T extends AnyConfig> = Omit<T, keyof OpenApiGeneratorConfig> & Partial<Pick<T, keyof OpenApiGeneratorConfig>>;
32
+ export declare abstract class OpenApiGenerationProviderBase<TInput extends OpenApiGeneratorInput, TOutput extends OpenApiGeneratorOutput, TConfig extends AnyConfig, TContext extends OpenApiGenerationProviderContext<TInput, TConfig>> implements OpenApiGenerationProvider<TInput, TOutput, TConfig> {
33
+ generate(context: OpenApiGeneratorContext<TInput>, config?: Partial<TConfig> | undefined): Promise<TOutput>;
34
+ protected getProviderContext(context: OpenApiGeneratorContext<TInput>, config: Partial<TConfig> | undefined, defaultConfig: DefaultGenerationProviderConfig<TConfig>): OpenApiGenerationProviderContext<TInput, TConfig>;
35
+ protected abstract buildContext(context: OpenApiGeneratorContext<TInput>, config?: Partial<TConfig> | undefined): TContext | Promise<TContext>;
36
+ protected abstract onGenerate(ctx: TContext): TOutput | Promise<TOutput>;
37
+ }
38
+ export {};
39
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/lib/codegen/generator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiC,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,KAAK,EACV,SAAS,EACT,yBAAyB,EACzB,gCAAgC,EAChC,2BAA2B,EAC3B,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM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AAyBD,MAAM,MAAM,+BAA+B,CAAC,CAAC,SAAS,SAAS,IAC3D,IAAI,CAAC,CAAC,EAAE,MAAM,sBAAsB,CAAC,GACrC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,sBAAsB,CAAC,CAAC,CAAC;AAEnD,8BAAsB,6BAA6B,CACjD,MAAM,SAAS,qBAAqB,EACpC,OAAO,SAAS,sBAAsB,EACtC,OAAO,SAAS,SAAS,EACzB,QAAQ,SAAS,gCAAgC,CAAC,MAAM,EAAE,OAAO,CAAC,CAClE,YAAW,yBAAyB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;IACjD,QAAQ,CACnB,OAAO,EAAE,uBAAuB,CAAC,MAAM,CAAC,EACxC,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,GACpC,OAAO,CAAC,OAAO,CAAC;IAKnB,SAAS,CAAC,kBAAkB,CAC1B,OAAO,EAAE,uBAAuB,CAAC,MAAM,CAAC,EACxC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,EACpC,aAAa,EAAE,+BAA+B,CAAC,OAAO,CAAC,GACtD,gCAAgC,CAAC,MAAM,EAAE,OAAO,CAAC;IAOpD,SAAS,CAAC,QAAQ,CAAC,YAAY,CAC7B,OAAO,EAAE,uBAAuB,CAAC,MAAM,CAAC,EACxC,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,GACpC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAE/B,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CACzE"}
@@ -2,14 +2,32 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OpenApiGenerationProviderBase = exports.OpenApiGenerator = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const path_1 = require("path");
5
+ const node_path_1 = require("node:path");
6
6
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
7
- const config_1 = require("./config");
8
- const parser_1 = require("../parse/parser");
9
- const action_provider_1 = require("../utils/action-provider");
10
- const file_system_utils_1 = require("../utils/file-system.utils");
7
+ const config_js_1 = require("./config.js");
8
+ const parser_js_1 = require("../parse/parser.js");
9
+ const action_provider_js_1 = require("../utils/action-provider.js");
10
+ const file_system_utils_js_1 = require("../utils/file-system.utils.js");
11
11
  class _OpenApiGenerator {
12
12
  constructor(config, providers, parser) {
13
+ Object.defineProperty(this, "_providers", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: void 0
18
+ });
19
+ Object.defineProperty(this, "_config", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: void 0
24
+ });
25
+ Object.defineProperty(this, "_parser", {
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true,
29
+ value: void 0
30
+ });
13
31
  this._providers = providers;
14
32
  this._config = config;
15
33
  this._parser = parser;
@@ -19,16 +37,16 @@ class _OpenApiGenerator {
19
37
  return new _OpenApiGenerator(this._config, [...this._providers], this._parser);
20
38
  }
21
39
  useType(type, config) {
22
- return this.use(action_provider_1.ActionProvider.fromType(type, 'generate'), config);
40
+ return this.use(action_provider_js_1.ActionProvider.fromType(type, 'generate'), config);
23
41
  }
24
42
  useFn(fn, config) {
25
- return this.use(action_provider_1.ActionProvider.fromFn(fn), config);
43
+ return this.use(action_provider_js_1.ActionProvider.fromFn(fn), config);
26
44
  }
27
45
  useValue(value, config) {
28
- return this.use(action_provider_1.ActionProvider.fromValue(value, 'generate'), config);
46
+ return this.use(action_provider_js_1.ActionProvider.fromValue(value, 'generate'), config);
29
47
  }
30
48
  async generate(data) {
31
- const absOutputPath = (0, path_1.resolve)(this._config.outputDir);
49
+ const absOutputPath = (0, node_path_1.resolve)(this._config.outputDir);
32
50
  if (this._config.clearOutputDir) {
33
51
  await fs_extra_1.default.emptyDir(absOutputPath);
34
52
  }
@@ -42,7 +60,7 @@ class _OpenApiGenerator {
42
60
  input,
43
61
  config: this._config,
44
62
  };
45
- const result = generator.provider.run(context, generator.config);
63
+ const result = await generator.provider.run(context, generator.config);
46
64
  if (result) {
47
65
  input = mergeDeep(input, result);
48
66
  }
@@ -55,16 +73,12 @@ class _OpenApiGenerator {
55
73
  }
56
74
  async parseAndGenerateFromDir(dir, options) {
57
75
  const filter = (file) => { var _a, _b; return (file.endsWith('.yml') || file.endsWith('.yaml') || file.endsWith('.json')) && ((_b = (_a = options === null || options === void 0 ? void 0 : options.filter) === null || _a === void 0 ? void 0 : _a.call(options, file)) !== null && _b !== void 0 ? _b : true); };
58
- return this.parseAndGenerate(...(await (0, file_system_utils_1.getFiles)(dir, { ...options, filter })));
76
+ return this.parseAndGenerate(...(await (0, file_system_utils_js_1.getFiles)(dir, { ...options, filter })));
59
77
  }
60
78
  }
61
79
  class OpenApiGenerator extends _OpenApiGenerator {
62
80
  constructor(config) {
63
- super(...OpenApiGenerator.getCtorArgs(config));
64
- }
65
- static getCtorArgs(config) {
66
- const c = { ...config_1.defaultOpenApiGeneratorConfig, ...config };
67
- return [c, [], new parser_1.OpenApiParser(c)];
81
+ super({ ...config_js_1.defaultOpenApiGeneratorConfig, ...config }, [], new parser_js_1.OpenApiParser({ ...config_js_1.defaultOpenApiGeneratorConfig, ...config }));
68
82
  }
69
83
  }
70
84
  exports.OpenApiGenerator = OpenApiGenerator;
@@ -93,9 +107,9 @@ function mergeDeep(target, ...sources) {
93
107
  return mergeDeep(target, ...sources);
94
108
  }
95
109
  class OpenApiGenerationProviderBase {
96
- generate(context, config) {
97
- const ctx = this.buildContext(context, config);
98
- return this.onGenerate(ctx);
110
+ async generate(context, config) {
111
+ const ctx = await this.buildContext(context, config);
112
+ return await this.onGenerate(ctx);
99
113
  }
100
114
  getProviderContext(context, config, defaultConfig) {
101
115
  const c = { ...context.config, ...defaultConfig, ...config };
@@ -0,0 +1,7 @@
1
+ export * from './config.js';
2
+ export * from './endpoints-generator.js';
3
+ export * from './generator.js';
4
+ export * from './schemas-generator.js';
5
+ export * from './services-generator.js';
6
+ export * from './types.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/codegen/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./config.js"), exports);
5
+ tslib_1.__exportStar(require("./endpoints-generator.js"), exports);
6
+ tslib_1.__exportStar(require("./generator.js"), exports);
7
+ tslib_1.__exportStar(require("./schemas-generator.js"), exports);
8
+ tslib_1.__exportStar(require("./services-generator.js"), exports);
9
+ tslib_1.__exportStar(require("./types.js"), exports);
@@ -0,0 +1,2 @@
1
+ export declare function addSourceIfTest(config: any, result: any, sourceFn: () => any): void;
2
+ //# sourceMappingURL=internal-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/codegen/internal-utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAG,QAI5E"}
@@ -0,0 +1,19 @@
1
+ import { type DefaultGenerationProviderConfig, OpenApiGenerationProviderBase } from './generator.js';
2
+ import type { AnyConfig, OpenApiGenerationProviderContext, OpenApiGeneratorContext, OpenApiGeneratorInput, OpenApiGeneratorOutput } from './types.js';
3
+ import type { ApiSchema } from '../transform/index.js';
4
+ import type { MaybePromise } from '../utils/type.utils.js';
5
+ export type OpenApiSchemasGenerationProviderContext<TInput extends OpenApiGeneratorInput, TOutput extends OpenApiGeneratorOutput, TConfig extends AnyConfig, TSchemaOutput extends OpenApiGeneratorOutput> = OpenApiGenerationProviderContext<TInput, TConfig> & {
6
+ existingSchemaResults: Map<string, TSchemaOutput>;
7
+ output: TOutput;
8
+ };
9
+ export declare abstract class OpenApiSchemasGenerationProviderBase<TInput extends OpenApiGeneratorInput, TOutput extends OpenApiGeneratorOutput, TConfig extends AnyConfig, TSchemaOutput extends OpenApiGeneratorOutput, TContext extends OpenApiSchemasGenerationProviderContext<TInput, TOutput, TConfig, TSchemaOutput>> extends OpenApiGenerationProviderBase<TInput, TOutput, TConfig, TContext> {
10
+ protected getProviderContext(context: OpenApiGeneratorContext<TInput>, config: Partial<TConfig> | undefined, defaultConfig: DefaultGenerationProviderConfig<TConfig>): OpenApiSchemasGenerationProviderContext<TInput, TOutput, TConfig, TSchemaOutput>;
11
+ protected onGenerate(ctx: TContext): Promise<TOutput>;
12
+ getSchemaResult(ctx: TContext, schema: ApiSchema): Promise<TSchemaOutput>;
13
+ protected getSchemaReference(ctx: TContext, schema: ApiSchema): ApiSchema | undefined;
14
+ protected abstract initResult(ctx: OpenApiGenerationProviderContext<TInput, TConfig>): TOutput;
15
+ protected abstract generateSchema(ctx: TContext, schema: ApiSchema): MaybePromise<TSchemaOutput>;
16
+ protected abstract addSchemaResult(ctx: TContext, schema: ApiSchema, result: TSchemaOutput): void;
17
+ protected generateAdditionalFiles(ctx: TContext): MaybePromise<void>;
18
+ }
19
+ //# sourceMappingURL=schemas-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas-generator.d.ts","sourceRoot":"","sources":["../../../src/lib/codegen/schemas-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAErG,OAAO,KAAK,EACV,SAAS,EACT,gCAAgC,EAChC,uBAAuB,EACvB,qBAAqB,EACrB,sBAA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,CAAC,UAAU,CAAC,GAAG,EAAE,gCAAgC,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO;IAE9F,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAG,YAAY,CAAC,aAAa,CAAC;IAEhG,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI;IAGjG,SAAS,CAAC,uBAAuB,CAAC,GAAG,EAAE,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC;CAGrE"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OpenApiSchemasGenerationProviderBase = void 0;
4
- const generator_1 = require("./generator");
5
- const internal_utils_1 = require("./internal-utils");
6
- const utils_1 = require("../utils");
7
- class OpenApiSchemasGenerationProviderBase extends generator_1.OpenApiGenerationProviderBase {
4
+ const generator_js_1 = require("./generator.js");
5
+ const internal_utils_js_1 = require("./internal-utils.js");
6
+ const index_js_1 = require("../utils/index.js");
7
+ class OpenApiSchemasGenerationProviderBase extends generator_js_1.OpenApiGenerationProviderBase {
8
8
  getProviderContext(context, config, defaultConfig) {
9
9
  const ctx = super.getProviderContext(context, config, defaultConfig);
10
10
  return Object.assign(ctx, {
@@ -12,32 +12,38 @@ class OpenApiSchemasGenerationProviderBase extends generator_1.OpenApiGeneration
12
12
  output: this.initResult(ctx),
13
13
  });
14
14
  }
15
- onGenerate(ctx) {
15
+ async onGenerate(ctx) {
16
16
  for (const schema of ctx.data.schemas) {
17
- this.getSchemaResult(ctx, schema);
17
+ await this.getSchemaResult(ctx, schema);
18
18
  }
19
+ await this.generateAdditionalFiles(ctx);
19
20
  return ctx.output;
20
21
  }
21
- getSchemaResult(ctx, schema) {
22
+ async getSchemaResult(ctx, schema) {
22
23
  const existingResult = ctx.existingSchemaResults.get(schema.id);
23
24
  if (existingResult)
24
25
  return existingResult;
25
26
  let result;
26
27
  const reference = this.getSchemaReference(ctx, schema);
27
28
  if (reference) {
28
- result = this.getSchemaResult(ctx, reference);
29
+ result = await this.getSchemaResult(ctx, reference);
29
30
  }
30
31
  else {
31
- result = this.generateSchema(ctx, schema);
32
+ result = await this.generateSchema(ctx, schema);
32
33
  }
33
- (0, internal_utils_1.addSourceIfTest)(ctx.config, result, () => `${schema.$src.file}#${schema.$src.path}`);
34
+ (0, internal_utils_js_1.addSourceIfTest)(ctx.config, result, () => `${schema.$src.file}#${schema.$src.path}`);
34
35
  ctx.existingSchemaResults.set(schema.id, result);
35
36
  this.addSchemaResult(ctx, schema, result);
36
37
  return result;
37
38
  }
39
+ // deno-lint-ignore no-unused-vars
38
40
  getSchemaReference(ctx, schema) {
39
- const ref = (0, utils_1.getSchemaReference)(schema, ['description']);
41
+ const ref = (0, index_js_1.getSchemaReference)(schema, ['description']);
40
42
  return ref.id !== schema.id ? ref : undefined;
41
43
  }
44
+ // deno-lint-ignore no-unused-vars
45
+ generateAdditionalFiles(ctx) {
46
+ // Override if needed
47
+ }
42
48
  }
43
49
  exports.OpenApiSchemasGenerationProviderBase = OpenApiSchemasGenerationProviderBase;
@@ -0,0 +1,18 @@
1
+ import { type DefaultGenerationProviderConfig, OpenApiGenerationProviderBase } from './generator.js';
2
+ import type { AnyConfig, OpenApiGenerationProviderContext, OpenApiGeneratorContext, OpenApiGeneratorInput, OpenApiGeneratorOutput } from './types.js';
3
+ import type { ApiService } from '../transform/index.js';
4
+ import type { MaybePromise } from '../utils/type.utils.js';
5
+ export type OpenApiServicesGenerationProviderContext<TInput extends OpenApiGeneratorInput, TOutput extends OpenApiGeneratorOutput, TConfig extends AnyConfig, TServiceOutput extends OpenApiGeneratorOutput> = OpenApiGenerationProviderContext<TInput, TConfig> & {
6
+ existingServiceResults: Map<string, TServiceOutput>;
7
+ output: TOutput;
8
+ };
9
+ export declare abstract class OpenApiServicesGenerationProviderBase<TInput extends OpenApiGeneratorInput, TOutput extends OpenApiGeneratorOutput, TConfig extends AnyConfig, TServiceOutput extends OpenApiGeneratorOutput, TContext extends OpenApiServicesGenerationProviderContext<TInput, TOutput, TConfig, TServiceOutput>> extends OpenApiGenerationProviderBase<TInput, TOutput, TConfig, TContext> {
10
+ protected getProviderContext(context: OpenApiGeneratorContext<TInput>, config: Partial<TConfig> | undefined, defaultConfig: DefaultGenerationProviderConfig<TConfig>): OpenApiServicesGenerationProviderContext<TInput, TOutput, TConfig, TServiceOutput>;
11
+ protected onGenerate(ctx: TContext): Promise<TOutput>;
12
+ protected getServiceResult(ctx: TContext, service: ApiService): Promise<TServiceOutput>;
13
+ protected abstract initResult(ctx: OpenApiGenerationProviderContext<TInput, TConfig>): TOutput;
14
+ protected abstract generateService(ctx: TContext, service: ApiService): MaybePromise<TServiceOutput>;
15
+ protected abstract addServiceResult(ctx: TContext, service: ApiService, result: TServiceOutput): void;
16
+ protected generateAdditionalFiles(ctx: TContext): MaybePromise<void>;
17
+ }
18
+ //# sourceMappingURL=services-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services-generator.d.ts","sourceRoot":"","sources":["../../../src/lib/codegen/services-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAErG,OAAO,KAAK,EACV,SAAS,EACT,gCAAgC,EAChC,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,MAAM,wCAAwC,CAClD,MAAM,SAAS,qBAAqB,EACpC,OAAO,SAAS,sBAAsB,EACtC,OAAO,SAAS,SAAS,EACzB,cAAc,SAAS,sBAAsB,IAC3C,gCAAgC,CAAC,MAA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AAI,CAAC;CAGrE"}
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OpenApiServicesGenerationProviderBase = void 0;
4
- const generator_1 = require("./generator");
5
- const internal_utils_1 = require("./internal-utils");
6
- class OpenApiServicesGenerationProviderBase extends generator_1.OpenApiGenerationProviderBase {
4
+ const generator_js_1 = require("./generator.js");
5
+ const internal_utils_js_1 = require("./internal-utils.js");
6
+ class OpenApiServicesGenerationProviderBase extends generator_js_1.OpenApiGenerationProviderBase {
7
7
  getProviderContext(context, config, defaultConfig) {
8
8
  const ctx = super.getProviderContext(context, config, defaultConfig);
9
9
  return Object.assign(ctx, {
@@ -11,20 +11,25 @@ class OpenApiServicesGenerationProviderBase extends generator_1.OpenApiGeneratio
11
11
  output: this.initResult(ctx),
12
12
  });
13
13
  }
14
- onGenerate(ctx) {
14
+ async onGenerate(ctx) {
15
15
  for (const service of ctx.data.services) {
16
- this.getServiceResult(ctx, service);
16
+ await this.getServiceResult(ctx, service);
17
17
  }
18
+ await this.generateAdditionalFiles(ctx);
18
19
  return ctx.output;
19
20
  }
20
- getServiceResult(ctx, service) {
21
+ async getServiceResult(ctx, service) {
21
22
  const existingResult = ctx.existingServiceResults.get(service.id);
22
23
  if (existingResult)
23
24
  return existingResult;
24
- const result = this.generateService(ctx, service);
25
- (0, internal_utils_1.addSourceIfTest)(ctx.config, result, () => service.$src ? `${service.$src.file}#${service.$src.path}` : `tag:${service.name}`);
25
+ const result = await this.generateService(ctx, service);
26
+ (0, internal_utils_js_1.addSourceIfTest)(ctx.config, result, () => service.$src ? `${service.$src.file}#${service.$src.path}` : `tag:${service.name}`);
26
27
  this.addServiceResult(ctx, service, result);
27
28
  return result;
28
29
  }
30
+ // deno-lint-ignore no-unused-vars
31
+ generateAdditionalFiles(ctx) {
32
+ // Override if needed
33
+ }
29
34
  }
30
35
  exports.OpenApiServicesGenerationProviderBase = OpenApiServicesGenerationProviderBase;
@@ -0,0 +1,19 @@
1
+ import type { OpenApiGeneratorConfig } from './config.js';
2
+ import type { ApiData } from '../transform/index.js';
3
+ import type { MaybePromise } from '../utils/type.utils.js';
4
+ export type AnyConfig = Readonly<Record<string, unknown>>;
5
+ export type OpenApiGeneratorInput = Record<string, unknown>;
6
+ export type OpenApiGeneratorOutput = Record<string, unknown> | undefined;
7
+ export type OpenApiGeneratorContext<TInput extends OpenApiGeneratorInput = OpenApiGeneratorInput> = {
8
+ data: ApiData;
9
+ input: TInput;
10
+ config: OpenApiGeneratorConfig;
11
+ };
12
+ export type OpenApiGenerationProviderContext<TInput extends OpenApiGeneratorInput, TConfig extends AnyConfig> = Omit<OpenApiGeneratorContext<TInput>, 'config'> & {
13
+ config: OpenApiGeneratorConfig & TConfig;
14
+ };
15
+ export interface OpenApiGenerationProvider<TInput extends OpenApiGeneratorInput = OpenApiGeneratorInput, TOutput extends OpenApiGeneratorOutput = OpenApiGeneratorOutput, TConfig extends AnyConfig = AnyConfig> {
16
+ generate(...args: Parameters<OpenApiGenerationProviderFn<TInput, TOutput, TConfig>>): ReturnType<OpenApiGenerationProviderFn<TInput, TOutput, TConfig>>;
17
+ }
18
+ export type OpenApiGenerationProviderFn<TInput extends OpenApiGeneratorInput = OpenApiGeneratorInput, TOutput extends OpenApiGeneratorOutput = OpenApiGeneratorOutput, TConfig extends AnyConfig = AnyConfig> = (context: OpenApiGeneratorContext<TInput>, config?: Partial<TConfig>) => MaybePromise<TOutput>;
19
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/codegen/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,MAAM,SAAS,GAAG,QA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+1,4 @@
1
+ import type { OpenApiCollectorData } from './types.js';
2
+ import type { Deref, OpenApiDocument } from '../parse/index.js';
3
+ export declare function collectOpenApi(apis: Deref<OpenApiDocument>[]): OpenApiCollectorData;
4
+ //# sourceMappingURL=collector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../../src/lib/collect/collector.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EAQhB,MAAM,mBAAmB,CAAC;AAI3B,wBAAgB,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,eAAe,CAAC,EAAE,GAAG,oBAAoB,CAUnF"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.collectOpenApi = collectOpenApi;
4
- const helpers_1 = require("./helpers");
4
+ const helpers_js_1 = require("./helpers.js");
5
5
  function collectOpenApi(apis) {
6
6
  const data = {
7
7
  documents: [],
@@ -13,30 +13,30 @@ function collectOpenApi(apis) {
13
13
  }
14
14
  const jsonSchemaProperties = ['$id', 'allOf', 'anyOf', 'oneOf', 'enum', 'not', 'properties', 'title', 'type'];
15
15
  function collectDocument(data, documents) {
16
- (0, helpers_1.collect)(data, documents, (data, document) => {
16
+ (0, helpers_js_1.collect)(data, documents, (data, document) => {
17
17
  var _a, _b, _c, _d, _e;
18
18
  data.documents.push(document);
19
19
  collectPaths(data, document.paths);
20
- (0, helpers_1.collectRecord)(data, (_a = document.components) === null || _a === void 0 ? void 0 : _a.schemas, collectSchema);
21
- (0, helpers_1.collectRecord)(data, document.definitions, collectSchema);
22
- (0, helpers_1.collectRecord)(data, (_b = document.components) === null || _b === void 0 ? void 0 : _b.parameters, collectParameter);
23
- (0, helpers_1.collectRecord)(data, document.parameters, collectParameter);
24
- (0, helpers_1.collectRecord)(data, (_c = document.components) === null || _c === void 0 ? void 0 : _c.requestBodies, collectRequestBody);
25
- (0, helpers_1.collectRecord)(data, (_d = document.components) === null || _d === void 0 ? void 0 : _d.responses, collectResponse);
26
- (0, helpers_1.collectRecord)(data, document.responses, collectResponse);
27
- (0, helpers_1.collectRecord)(data, (_e = document.components) === null || _e === void 0 ? void 0 : _e.headers, collectHeader);
20
+ (0, helpers_js_1.collectRecord)(data, (_a = document.components) === null || _a === void 0 ? void 0 : _a.schemas, collectSchema);
21
+ (0, helpers_js_1.collectRecord)(data, document.definitions, collectSchema);
22
+ (0, helpers_js_1.collectRecord)(data, (_b = document.components) === null || _b === void 0 ? void 0 : _b.parameters, collectParameter);
23
+ (0, helpers_js_1.collectRecord)(data, document.parameters, collectParameter);
24
+ (0, helpers_js_1.collectRecord)(data, (_c = document.components) === null || _c === void 0 ? void 0 : _c.requestBodies, collectRequestBody);
25
+ (0, helpers_js_1.collectRecord)(data, (_d = document.components) === null || _d === void 0 ? void 0 : _d.responses, collectResponse);
26
+ (0, helpers_js_1.collectRecord)(data, document.responses, collectResponse);
27
+ (0, helpers_js_1.collectRecord)(data, (_e = document.components) === null || _e === void 0 ? void 0 : _e.headers, collectHeader);
28
28
  if (Object.keys(document).some((key) => jsonSchemaProperties.includes(key))) {
29
29
  collectSchema(data, document);
30
30
  }
31
31
  });
32
32
  }
33
33
  function collectPaths(data, paths) {
34
- (0, helpers_1.collect)(data, paths, (data, path) => {
35
- (0, helpers_1.collectRecord)(data, path, collectPathItem);
34
+ (0, helpers_js_1.collect)(data, paths, (data, path) => {
35
+ (0, helpers_js_1.collectRecord)(data, path, collectPathItem);
36
36
  });
37
37
  }
38
38
  function collectPathItem(data, pathItems, path) {
39
- (0, helpers_1.collect)(data, pathItems, (data, pathItem) => {
39
+ (0, helpers_js_1.collect)(data, pathItems, (data, pathItem) => {
40
40
  collectParameter(data, pathItem.parameters);
41
41
  for (const m of ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']) {
42
42
  const operation = pathItem[m];
@@ -53,12 +53,12 @@ function collectPathItem(data, pathItems, path) {
53
53
  });
54
54
  collectParameter(data, operation.parameters);
55
55
  collectRequestBody(data, operation.requestBody);
56
- (0, helpers_1.collectRecord)(data, operation.responses, collectResponse);
56
+ (0, helpers_js_1.collectRecord)(data, operation.responses, collectResponse);
57
57
  }
58
58
  });
59
59
  }
60
60
  function collectSchema(data, schemas) {
61
- (0, helpers_1.collect)(data, schemas, (data, schema) => {
61
+ (0, helpers_js_1.collect)(data, schemas, (data, schema) => {
62
62
  var _a;
63
63
  const key = `${schema.$src.file}#${schema.$src.path}`;
64
64
  if (data.schemas.has(key))
@@ -69,10 +69,10 @@ function collectSchema(data, schemas) {
69
69
  collectSchema(data, schema.oneOf);
70
70
  collectSchema(data, schema.items);
71
71
  collectSchema(data, schema.not);
72
- (0, helpers_1.collectRecord)(data, schema.properties, collectSchema);
73
- (0, helpers_1.collectRecord)(data, schema.patternProperties, collectSchema);
74
- (0, helpers_1.collectRecord)(data, schema.dependencies, collectSchema);
75
- (0, helpers_1.collectRecord)(data, schema.definitions, collectSchema);
72
+ (0, helpers_js_1.collectRecord)(data, schema.properties, collectSchema);
73
+ (0, helpers_js_1.collectRecord)(data, schema.patternProperties, collectSchema);
74
+ (0, helpers_js_1.collectRecord)(data, schema.dependencies, collectSchema);
75
+ (0, helpers_js_1.collectRecord)(data, schema.definitions, collectSchema);
76
76
  if (typeof schema.additionalProperties === 'object') {
77
77
  collectSchema(data, schema.additionalProperties);
78
78
  }
@@ -80,32 +80,32 @@ function collectSchema(data, schemas) {
80
80
  collectSchema(data, schema.additionalItems);
81
81
  }
82
82
  if (typeof schema.discriminator === 'object') {
83
- (0, helpers_1.collectRecord)(data, (_a = schema.discriminator) === null || _a === void 0 ? void 0 : _a.mapping, collectSchema);
83
+ (0, helpers_js_1.collectRecord)(data, (_a = schema.discriminator) === null || _a === void 0 ? void 0 : _a.mapping, collectSchema);
84
84
  }
85
85
  });
86
86
  }
87
87
  function collectParameter(data, parameters) {
88
- (0, helpers_1.collect)(data, parameters, (data, parameter) => {
88
+ (0, helpers_js_1.collect)(data, parameters, (data, parameter) => {
89
89
  collectSchema(data, parameter.schema);
90
90
  });
91
91
  }
92
92
  function collectMediaType(data, mediaTypes) {
93
- (0, helpers_1.collect)(data, mediaTypes, (data, mediaType) => {
93
+ (0, helpers_js_1.collect)(data, mediaTypes, (data, mediaType) => {
94
94
  collectSchema(data, mediaType.schema);
95
95
  });
96
96
  }
97
97
  function collectRequestBody(data, requestBody) {
98
- (0, helpers_1.collect)(data, requestBody, (data, requestBody) => {
99
- (0, helpers_1.collectRecord)(data, requestBody.content, collectMediaType);
98
+ (0, helpers_js_1.collect)(data, requestBody, (data, requestBody) => {
99
+ (0, helpers_js_1.collectRecord)(data, requestBody.content, collectMediaType);
100
100
  });
101
101
  }
102
102
  function isSchema(obj) {
103
103
  return obj && typeof obj === 'object' && obj['type'] !== undefined;
104
104
  }
105
105
  function collectResponse(data, responses) {
106
- (0, helpers_1.collect)(data, responses, (data, responses) => {
107
- (0, helpers_1.collectRecord)(data, responses.content, collectMediaType);
108
- (0, helpers_1.collect)(data, responses.headers, (data, header) => {
106
+ (0, helpers_js_1.collect)(data, responses, (data, responses) => {
107
+ (0, helpers_js_1.collectRecord)(data, responses.content, collectMediaType);
108
+ (0, helpers_js_1.collect)(data, responses.headers, (data, header) => {
109
109
  if (isSchema(header)) {
110
110
  collectSchema(data, header);
111
111
  }
@@ -116,7 +116,7 @@ function collectResponse(data, responses) {
116
116
  });
117
117
  }
118
118
  function collectHeader(data, headers) {
119
- (0, helpers_1.collect)(data, headers, (data, headers) => {
119
+ (0, helpers_js_1.collect)(data, headers, (data, headers) => {
120
120
  collectSchema(data, headers.schema);
121
121
  });
122
122
  }
@@ -0,0 +1,5 @@
1
+ import type { OpenApiCollectorData } from './types.js';
2
+ import type { Nullable } from '../utils/index.js';
3
+ export declare function collect<T extends Record<`x-${string}`, unknown>>(data: OpenApiCollectorData, obj: Nullable<T | Nullable<T>[]>, func: (data: OpenApiCollectorData, obj: NonNullable<T>) => void): void;
4
+ export declare function collectRecord<T extends Record<`x-${string}`, unknown>>(data: OpenApiCollectorData, obj: Nullable<Record<string, Nullable<T>>>, func: (data: OpenApiCollectorData, obj: NonNullable<T>, key: string) => void): void;
5
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/collect/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,OAAO,CAAC,EAC9D,IAAI,EAAE,oBAAoB,EAC1B,GAAG,EAAE,QAAQ,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAChC,IAAI,EAAE,CAAC,IAAI,EAAE,oBAAoB,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,QAahE;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,OAAO,CAAC,EACpE,IAAI,EAAE,oBAAoB,EAC1B,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1C,IAAI,EAAE,CAAC,IAAI,EAAE,oBAAoB,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,QAU7E"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.collect = collect;
4
4
  exports.collectRecord = collectRecord;
5
- const internal_utils_1 = require("../internal-utils");
5
+ const internal_utils_js_1 = require("../internal-utils.js");
6
6
  function collect(data, obj, func) {
7
7
  if (!obj)
8
8
  return;
@@ -25,7 +25,7 @@ function collectRecord(data, obj, func) {
25
25
  if (!obj)
26
26
  return;
27
27
  for (const key in obj) {
28
- if (!(0, internal_utils_1.isOpenApiObjectProperty)(key))
28
+ if (!(0, internal_utils_js_1.isOpenApiObjectProperty)(key))
29
29
  continue;
30
30
  const value = obj[key];
31
31
  if (!value)
@@ -0,0 +1,4 @@
1
+ export * from './collector.js';
2
+ export * from './helpers.js';
3
+ export * from './types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/collect/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./collector.js"), exports);
5
+ tslib_1.__exportStar(require("./helpers.js"), exports);
6
+ tslib_1.__exportStar(require("./types.js"), exports);
@@ -0,0 +1,13 @@
1
+ import type { Deref, OpenApiDocument, OpenApiHttpMethod, OpenApiOperation, OpenApiPathItem, OpenApiSchema } from '../parse/index.js';
2
+ export type OpenApiCollectorEndpointInfo = {
3
+ path: string;
4
+ method: OpenApiHttpMethod;
5
+ pathItem: Deref<OpenApiPathItem>;
6
+ operation: Deref<OpenApiOperation>;
7
+ };
8
+ export type OpenApiCollectorData = {
9
+ documents: Deref<OpenApiDocument>[];
10
+ schemas: Map<string, Deref<OpenApiSchema>>;
11
+ endpoints: Map<string, OpenApiCollectorEndpointInfo>;
12
+ };
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/collect/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACjC,SAAS,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC;IACpC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAC3C,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;CACtD,CAAC"}