vona-module-a-swagger 5.0.2

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 (458) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +2 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/common/index.d.ts +2 -0
  7. package/dist/lib/common/index.d.ts.map +1 -0
  8. package/dist/lib/common/index.js +2 -0
  9. package/dist/lib/common/index.js.map +1 -0
  10. package/dist/lib/common/type.interface.d.ts +4 -0
  11. package/dist/lib/common/type.interface.d.ts.map +1 -0
  12. package/dist/lib/common/type.interface.js +2 -0
  13. package/dist/lib/common/type.interface.js.map +1 -0
  14. package/dist/lib/constants.d.ts +22 -0
  15. package/dist/lib/constants.d.ts.map +1 -0
  16. package/dist/lib/constants.js +22 -0
  17. package/dist/lib/constants.js.map +1 -0
  18. package/dist/lib/decorators/api-basic.decorator.d.ts +2 -0
  19. package/dist/lib/decorators/api-basic.decorator.d.ts.map +1 -0
  20. package/dist/lib/decorators/api-basic.decorator.js +5 -0
  21. package/dist/lib/decorators/api-basic.decorator.js.map +1 -0
  22. package/dist/lib/decorators/api-bearer.decorator.d.ts +2 -0
  23. package/dist/lib/decorators/api-bearer.decorator.d.ts.map +1 -0
  24. package/dist/lib/decorators/api-bearer.decorator.js +5 -0
  25. package/dist/lib/decorators/api-bearer.decorator.js.map +1 -0
  26. package/dist/lib/decorators/api-body.decorator.d.ts +17 -0
  27. package/dist/lib/decorators/api-body.decorator.d.ts.map +1 -0
  28. package/dist/lib/decorators/api-body.decorator.js +24 -0
  29. package/dist/lib/decorators/api-body.decorator.js.map +1 -0
  30. package/dist/lib/decorators/api-callbacks.decorator.d.ts +3 -0
  31. package/dist/lib/decorators/api-callbacks.decorator.d.ts.map +1 -0
  32. package/dist/lib/decorators/api-callbacks.decorator.js +6 -0
  33. package/dist/lib/decorators/api-callbacks.decorator.js.map +1 -0
  34. package/dist/lib/decorators/api-consumes.decorator.d.ts +2 -0
  35. package/dist/lib/decorators/api-consumes.decorator.d.ts.map +1 -0
  36. package/dist/lib/decorators/api-consumes.decorator.js +6 -0
  37. package/dist/lib/decorators/api-consumes.decorator.js.map +1 -0
  38. package/dist/lib/decorators/api-cookie.decorator.d.ts +2 -0
  39. package/dist/lib/decorators/api-cookie.decorator.d.ts.map +1 -0
  40. package/dist/lib/decorators/api-cookie.decorator.js +5 -0
  41. package/dist/lib/decorators/api-cookie.decorator.js.map +1 -0
  42. package/dist/lib/decorators/api-default-getter.decorator.d.ts +25 -0
  43. package/dist/lib/decorators/api-default-getter.decorator.d.ts.map +1 -0
  44. package/dist/lib/decorators/api-default-getter.decorator.js +32 -0
  45. package/dist/lib/decorators/api-default-getter.decorator.js.map +1 -0
  46. package/dist/lib/decorators/api-exclude-controller.decorator.d.ts +2 -0
  47. package/dist/lib/decorators/api-exclude-controller.decorator.d.ts.map +1 -0
  48. package/dist/lib/decorators/api-exclude-controller.decorator.js +6 -0
  49. package/dist/lib/decorators/api-exclude-controller.decorator.js.map +1 -0
  50. package/dist/lib/decorators/api-exclude-endpoint.decorator.d.ts +2 -0
  51. package/dist/lib/decorators/api-exclude-endpoint.decorator.d.ts.map +1 -0
  52. package/dist/lib/decorators/api-exclude-endpoint.decorator.js +8 -0
  53. package/dist/lib/decorators/api-exclude-endpoint.decorator.js.map +1 -0
  54. package/dist/lib/decorators/api-extension.decorator.d.ts +2 -0
  55. package/dist/lib/decorators/api-extension.decorator.d.ts.map +1 -0
  56. package/dist/lib/decorators/api-extension.decorator.js +13 -0
  57. package/dist/lib/decorators/api-extension.decorator.js.map +1 -0
  58. package/dist/lib/decorators/api-extra-models.decorator.d.ts +2 -0
  59. package/dist/lib/decorators/api-extra-models.decorator.d.ts.map +1 -0
  60. package/dist/lib/decorators/api-extra-models.decorator.js +14 -0
  61. package/dist/lib/decorators/api-extra-models.decorator.js.map +1 -0
  62. package/dist/lib/decorators/api-header.decorator.d.ts +8 -0
  63. package/dist/lib/decorators/api-header.decorator.d.ts.map +1 -0
  64. package/dist/lib/decorators/api-header.decorator.js +40 -0
  65. package/dist/lib/decorators/api-header.decorator.js.map +1 -0
  66. package/dist/lib/decorators/api-hide-property.decorator.d.ts +2 -0
  67. package/dist/lib/decorators/api-hide-property.decorator.d.ts.map +1 -0
  68. package/dist/lib/decorators/api-hide-property.decorator.js +5 -0
  69. package/dist/lib/decorators/api-hide-property.decorator.js.map +1 -0
  70. package/dist/lib/decorators/api-link.decorator.d.ts +48 -0
  71. package/dist/lib/decorators/api-link.decorator.d.ts.map +1 -0
  72. package/dist/lib/decorators/api-link.decorator.js +50 -0
  73. package/dist/lib/decorators/api-link.decorator.js.map +1 -0
  74. package/dist/lib/decorators/api-oauth2.decorator.d.ts +2 -0
  75. package/dist/lib/decorators/api-oauth2.decorator.d.ts.map +1 -0
  76. package/dist/lib/decorators/api-oauth2.decorator.js +5 -0
  77. package/dist/lib/decorators/api-oauth2.decorator.js.map +1 -0
  78. package/dist/lib/decorators/api-operation.decorator.d.ts +6 -0
  79. package/dist/lib/decorators/api-operation.decorator.d.ts.map +1 -0
  80. package/dist/lib/decorators/api-operation.decorator.js +13 -0
  81. package/dist/lib/decorators/api-operation.decorator.js.map +1 -0
  82. package/dist/lib/decorators/api-param.decorator.d.ts +23 -0
  83. package/dist/lib/decorators/api-param.decorator.d.ts.map +1 -0
  84. package/dist/lib/decorators/api-param.decorator.js +19 -0
  85. package/dist/lib/decorators/api-param.decorator.js.map +1 -0
  86. package/dist/lib/decorators/api-produces.decorator.d.ts +2 -0
  87. package/dist/lib/decorators/api-produces.decorator.d.ts.map +1 -0
  88. package/dist/lib/decorators/api-produces.decorator.js +6 -0
  89. package/dist/lib/decorators/api-produces.decorator.js.map +1 -0
  90. package/dist/lib/decorators/api-property.decorator.d.ts +25 -0
  91. package/dist/lib/decorators/api-property.decorator.d.ts.map +1 -0
  92. package/dist/lib/decorators/api-property.decorator.js +53 -0
  93. package/dist/lib/decorators/api-property.decorator.js.map +1 -0
  94. package/dist/lib/decorators/api-query.decorator.d.ts +25 -0
  95. package/dist/lib/decorators/api-query.decorator.d.ts.map +1 -0
  96. package/dist/lib/decorators/api-query.decorator.js +28 -0
  97. package/dist/lib/decorators/api-query.decorator.js.map +1 -0
  98. package/dist/lib/decorators/api-response.decorator.d.ts +40 -0
  99. package/dist/lib/decorators/api-response.decorator.d.ts.map +1 -0
  100. package/dist/lib/decorators/api-response.decorator.js +63 -0
  101. package/dist/lib/decorators/api-response.decorator.js.map +1 -0
  102. package/dist/lib/decorators/api-schema.decorator.d.ts +9 -0
  103. package/dist/lib/decorators/api-schema.decorator.d.ts.map +1 -0
  104. package/dist/lib/decorators/api-schema.decorator.js +6 -0
  105. package/dist/lib/decorators/api-schema.decorator.js.map +1 -0
  106. package/dist/lib/decorators/api-security.decorator.d.ts +3 -0
  107. package/dist/lib/decorators/api-security.decorator.d.ts.map +1 -0
  108. package/dist/lib/decorators/api-security.decorator.js +23 -0
  109. package/dist/lib/decorators/api-security.decorator.js.map +1 -0
  110. package/dist/lib/decorators/api-use-tags.decorator.d.ts +2 -0
  111. package/dist/lib/decorators/api-use-tags.decorator.d.ts.map +1 -0
  112. package/dist/lib/decorators/api-use-tags.decorator.js +6 -0
  113. package/dist/lib/decorators/api-use-tags.decorator.js.map +1 -0
  114. package/dist/lib/decorators/helpers.d.ts +9 -0
  115. package/dist/lib/decorators/helpers.d.ts.map +1 -0
  116. package/dist/lib/decorators/helpers.js +120 -0
  117. package/dist/lib/decorators/helpers.js.map +1 -0
  118. package/dist/lib/decorators/index.d.ts +25 -0
  119. package/dist/lib/decorators/index.d.ts.map +1 -0
  120. package/dist/lib/decorators/index.js +25 -0
  121. package/dist/lib/decorators/index.js.map +1 -0
  122. package/dist/lib/document-builder.d.ts +28 -0
  123. package/dist/lib/document-builder.d.ts.map +1 -0
  124. package/dist/lib/document-builder.js +167 -0
  125. package/dist/lib/document-builder.js.map +1 -0
  126. package/dist/lib/explorers/api-callbacks.explorer.d.ts +3 -0
  127. package/dist/lib/explorers/api-callbacks.explorer.d.ts.map +1 -0
  128. package/dist/lib/explorers/api-callbacks.explorer.js +35 -0
  129. package/dist/lib/explorers/api-callbacks.explorer.js.map +1 -0
  130. package/dist/lib/explorers/api-consumes.explorer.d.ts +6 -0
  131. package/dist/lib/explorers/api-consumes.explorer.d.ts.map +1 -0
  132. package/dist/lib/explorers/api-consumes.explorer.js +7 -0
  133. package/dist/lib/explorers/api-consumes.explorer.js.map +1 -0
  134. package/dist/lib/explorers/api-exclude-controller.explorer.d.ts +3 -0
  135. package/dist/lib/explorers/api-exclude-controller.explorer.d.ts.map +1 -0
  136. package/dist/lib/explorers/api-exclude-controller.explorer.js +3 -0
  137. package/dist/lib/explorers/api-exclude-controller.explorer.js.map +1 -0
  138. package/dist/lib/explorers/api-exclude-endpoint.explorer.d.ts +3 -0
  139. package/dist/lib/explorers/api-exclude-endpoint.explorer.d.ts.map +1 -0
  140. package/dist/lib/explorers/api-exclude-endpoint.explorer.js +3 -0
  141. package/dist/lib/explorers/api-exclude-endpoint.explorer.js.map +1 -0
  142. package/dist/lib/explorers/api-extra-models.explorer.d.ts +4 -0
  143. package/dist/lib/explorers/api-extra-models.explorer.d.ts.map +1 -0
  144. package/dist/lib/explorers/api-extra-models.explorer.js +7 -0
  145. package/dist/lib/explorers/api-extra-models.explorer.js.map +1 -0
  146. package/dist/lib/explorers/api-headers.explorer.d.ts +8 -0
  147. package/dist/lib/explorers/api-headers.explorer.d.ts.map +1 -0
  148. package/dist/lib/explorers/api-headers.explorer.js +6 -0
  149. package/dist/lib/explorers/api-headers.explorer.js.map +1 -0
  150. package/dist/lib/explorers/api-operation.explorer.d.ts +3 -0
  151. package/dist/lib/explorers/api-operation.explorer.d.ts.map +1 -0
  152. package/dist/lib/explorers/api-operation.explorer.js +38 -0
  153. package/dist/lib/explorers/api-operation.explorer.js.map +1 -0
  154. package/dist/lib/explorers/api-parameters.explorer.d.ts +6 -0
  155. package/dist/lib/explorers/api-parameters.explorer.d.ts.map +1 -0
  156. package/dist/lib/explorers/api-parameters.explorer.js +44 -0
  157. package/dist/lib/explorers/api-parameters.explorer.js.map +1 -0
  158. package/dist/lib/explorers/api-produces.explorer.d.ts +6 -0
  159. package/dist/lib/explorers/api-produces.explorer.d.ts.map +1 -0
  160. package/dist/lib/explorers/api-produces.explorer.js +7 -0
  161. package/dist/lib/explorers/api-produces.explorer.js.map +1 -0
  162. package/dist/lib/explorers/api-response.explorer.d.ts +8 -0
  163. package/dist/lib/explorers/api-response.explorer.d.ts.map +1 -0
  164. package/dist/lib/explorers/api-response.explorer.js +77 -0
  165. package/dist/lib/explorers/api-response.explorer.js.map +1 -0
  166. package/dist/lib/explorers/api-security.explorer.d.ts +6 -0
  167. package/dist/lib/explorers/api-security.explorer.d.ts.map +1 -0
  168. package/dist/lib/explorers/api-security.explorer.js +9 -0
  169. package/dist/lib/explorers/api-security.explorer.js.map +1 -0
  170. package/dist/lib/explorers/api-use-tags.explorer.d.ts +6 -0
  171. package/dist/lib/explorers/api-use-tags.explorer.d.ts.map +1 -0
  172. package/dist/lib/explorers/api-use-tags.explorer.js +17 -0
  173. package/dist/lib/explorers/api-use-tags.explorer.js.map +1 -0
  174. package/dist/lib/extra/swagger-shim.d.ts +97 -0
  175. package/dist/lib/extra/swagger-shim.d.ts.map +1 -0
  176. package/dist/lib/extra/swagger-shim.js +265 -0
  177. package/dist/lib/extra/swagger-shim.js.map +1 -0
  178. package/dist/lib/fixtures/document.base.d.ts +3 -0
  179. package/dist/lib/fixtures/document.base.d.ts.map +1 -0
  180. package/dist/lib/fixtures/document.base.js +13 -0
  181. package/dist/lib/fixtures/document.base.js.map +1 -0
  182. package/dist/lib/index.d.ts +8 -0
  183. package/dist/lib/index.d.ts.map +1 -0
  184. package/dist/lib/index.js +8 -0
  185. package/dist/lib/index.js.map +1 -0
  186. package/dist/lib/interfaces/callback-object.interface.d.ts +13 -0
  187. package/dist/lib/interfaces/callback-object.interface.d.ts.map +1 -0
  188. package/dist/lib/interfaces/callback-object.interface.js +2 -0
  189. package/dist/lib/interfaces/callback-object.interface.js.map +1 -0
  190. package/dist/lib/interfaces/denormalized-doc-resolvers.interface.d.ts +8 -0
  191. package/dist/lib/interfaces/denormalized-doc-resolvers.interface.d.ts.map +1 -0
  192. package/dist/lib/interfaces/denormalized-doc-resolvers.interface.js +2 -0
  193. package/dist/lib/interfaces/denormalized-doc-resolvers.interface.js.map +1 -0
  194. package/dist/lib/interfaces/denormalized-doc.interface.d.ts +9 -0
  195. package/dist/lib/interfaces/denormalized-doc.interface.d.ts.map +1 -0
  196. package/dist/lib/interfaces/denormalized-doc.interface.js +2 -0
  197. package/dist/lib/interfaces/denormalized-doc.interface.js.map +1 -0
  198. package/dist/lib/interfaces/enum-schema-attributes.interface.d.ts +3 -0
  199. package/dist/lib/interfaces/enum-schema-attributes.interface.d.ts.map +1 -0
  200. package/dist/lib/interfaces/enum-schema-attributes.interface.js +2 -0
  201. package/dist/lib/interfaces/enum-schema-attributes.interface.js.map +1 -0
  202. package/dist/lib/interfaces/index.d.ts +4 -0
  203. package/dist/lib/interfaces/index.d.ts.map +1 -0
  204. package/dist/lib/interfaces/index.js +3 -0
  205. package/dist/lib/interfaces/index.js.map +1 -0
  206. package/dist/lib/interfaces/module-route.interface.d.ts +3 -0
  207. package/dist/lib/interfaces/module-route.interface.d.ts.map +1 -0
  208. package/dist/lib/interfaces/module-route.interface.js +2 -0
  209. package/dist/lib/interfaces/module-route.interface.js.map +1 -0
  210. package/dist/lib/interfaces/open-api-spec.interface.d.ts +241 -0
  211. package/dist/lib/interfaces/open-api-spec.interface.d.ts.map +1 -0
  212. package/dist/lib/interfaces/open-api-spec.interface.js +6 -0
  213. package/dist/lib/interfaces/open-api-spec.interface.js.map +1 -0
  214. package/dist/lib/interfaces/schema-object-metadata.interface.d.ts +24 -0
  215. package/dist/lib/interfaces/schema-object-metadata.interface.d.ts.map +1 -0
  216. package/dist/lib/interfaces/schema-object-metadata.interface.js +2 -0
  217. package/dist/lib/interfaces/schema-object-metadata.interface.js.map +1 -0
  218. package/dist/lib/interfaces/swagger-custom-options.interface.d.ts +85 -0
  219. package/dist/lib/interfaces/swagger-custom-options.interface.d.ts.map +1 -0
  220. package/dist/lib/interfaces/swagger-custom-options.interface.js +2 -0
  221. package/dist/lib/interfaces/swagger-custom-options.interface.js.map +1 -0
  222. package/dist/lib/interfaces/swagger-document-options.interface.d.ts +36 -0
  223. package/dist/lib/interfaces/swagger-document-options.interface.d.ts.map +1 -0
  224. package/dist/lib/interfaces/swagger-document-options.interface.js +2 -0
  225. package/dist/lib/interfaces/swagger-document-options.interface.js.map +1 -0
  226. package/dist/lib/interfaces/swagger-ui-init-options.interface.d.ts +8 -0
  227. package/dist/lib/interfaces/swagger-ui-init-options.interface.d.ts.map +1 -0
  228. package/dist/lib/interfaces/swagger-ui-init-options.interface.js +2 -0
  229. package/dist/lib/interfaces/swagger-ui-init-options.interface.js.map +1 -0
  230. package/dist/lib/interfaces/swagger-ui-options.interface.d.ts +21 -0
  231. package/dist/lib/interfaces/swagger-ui-options.interface.d.ts.map +1 -0
  232. package/dist/lib/interfaces/swagger-ui-options.interface.js +2 -0
  233. package/dist/lib/interfaces/swagger-ui-options.interface.js.map +1 -0
  234. package/dist/lib/plugin/compiler-plugin.d.ts +3 -0
  235. package/dist/lib/plugin/compiler-plugin.d.ts.map +1 -0
  236. package/dist/lib/plugin/compiler-plugin.js +27 -0
  237. package/dist/lib/plugin/compiler-plugin.js.map +1 -0
  238. package/dist/lib/plugin/index.d.ts +3 -0
  239. package/dist/lib/plugin/index.d.ts.map +1 -0
  240. package/dist/lib/plugin/index.js +3 -0
  241. package/dist/lib/plugin/index.js.map +1 -0
  242. package/dist/lib/plugin/merge-options.d.ts +15 -0
  243. package/dist/lib/plugin/merge-options.d.ts.map +1 -0
  244. package/dist/lib/plugin/merge-options.js +35 -0
  245. package/dist/lib/plugin/merge-options.js.map +1 -0
  246. package/dist/lib/plugin/metadata-loader.d.ts +8 -0
  247. package/dist/lib/plugin/metadata-loader.d.ts.map +1 -0
  248. package/dist/lib/plugin/metadata-loader.js +41 -0
  249. package/dist/lib/plugin/metadata-loader.js.map +1 -0
  250. package/dist/lib/plugin/plugin-constants.d.ts +4 -0
  251. package/dist/lib/plugin/plugin-constants.d.ts.map +1 -0
  252. package/dist/lib/plugin/plugin-constants.js +4 -0
  253. package/dist/lib/plugin/plugin-constants.js.map +1 -0
  254. package/dist/lib/plugin/plugin-debug-logger.d.ts +6 -0
  255. package/dist/lib/plugin/plugin-debug-logger.d.ts.map +1 -0
  256. package/dist/lib/plugin/plugin-debug-logger.js +5 -0
  257. package/dist/lib/plugin/plugin-debug-logger.js.map +1 -0
  258. package/dist/lib/plugin/utils/ast-utils.d.ts +31 -0
  259. package/dist/lib/plugin/utils/ast-utils.d.ts.map +1 -0
  260. package/dist/lib/plugin/utils/ast-utils.js +242 -0
  261. package/dist/lib/plugin/utils/ast-utils.js.map +1 -0
  262. package/dist/lib/plugin/utils/external-imports.util.d.ts +4 -0
  263. package/dist/lib/plugin/utils/external-imports.util.d.ts.map +1 -0
  264. package/dist/lib/plugin/utils/external-imports.util.js +31 -0
  265. package/dist/lib/plugin/utils/external-imports.util.js.map +1 -0
  266. package/dist/lib/plugin/utils/is-filename-matched.util.d.ts +2 -0
  267. package/dist/lib/plugin/utils/is-filename-matched.util.d.ts.map +1 -0
  268. package/dist/lib/plugin/utils/is-filename-matched.util.js +2 -0
  269. package/dist/lib/plugin/utils/is-filename-matched.util.js.map +1 -0
  270. package/dist/lib/plugin/utils/plugin-utils.d.ts +58 -0
  271. package/dist/lib/plugin/utils/plugin-utils.d.ts.map +1 -0
  272. package/dist/lib/plugin/utils/plugin-utils.js +282 -0
  273. package/dist/lib/plugin/utils/plugin-utils.js.map +1 -0
  274. package/dist/lib/plugin/utils/type-reference-to-identifier.util.d.ts +8 -0
  275. package/dist/lib/plugin/utils/type-reference-to-identifier.util.d.ts.map +1 -0
  276. package/dist/lib/plugin/utils/type-reference-to-identifier.util.js +50 -0
  277. package/dist/lib/plugin/utils/type-reference-to-identifier.util.js.map +1 -0
  278. package/dist/lib/plugin/visitors/abstract.visitor.d.ts +5 -0
  279. package/dist/lib/plugin/visitors/abstract.visitor.d.ts.map +1 -0
  280. package/dist/lib/plugin/visitors/abstract.visitor.js +20 -0
  281. package/dist/lib/plugin/visitors/abstract.visitor.js.map +1 -0
  282. package/dist/lib/plugin/visitors/controller-class.visitor.d.ts +21 -0
  283. package/dist/lib/plugin/visitors/controller-class.visitor.d.ts.map +1 -0
  284. package/dist/lib/plugin/visitors/controller-class.visitor.js +266 -0
  285. package/dist/lib/plugin/visitors/controller-class.visitor.js.map +1 -0
  286. package/dist/lib/plugin/visitors/model-class.visitor.d.ts +40 -0
  287. package/dist/lib/plugin/visitors/model-class.visitor.d.ts.map +1 -0
  288. package/dist/lib/plugin/visitors/model-class.visitor.js +445 -0
  289. package/dist/lib/plugin/visitors/model-class.visitor.js.map +1 -0
  290. package/dist/lib/plugin/visitors/readonly.visitor.d.ts +22 -0
  291. package/dist/lib/plugin/visitors/readonly.visitor.d.ts.map +1 -0
  292. package/dist/lib/plugin/visitors/readonly.visitor.js +60 -0
  293. package/dist/lib/plugin/visitors/readonly.visitor.js.map +1 -0
  294. package/dist/lib/services/constants.d.ts +2 -0
  295. package/dist/lib/services/constants.d.ts.map +1 -0
  296. package/dist/lib/services/constants.js +2 -0
  297. package/dist/lib/services/constants.js.map +1 -0
  298. package/dist/lib/services/decorators-properties.d.ts +27 -0
  299. package/dist/lib/services/decorators-properties.d.ts.map +1 -0
  300. package/dist/lib/services/decorators-properties.js +147 -0
  301. package/dist/lib/services/decorators-properties.js.map +1 -0
  302. package/dist/lib/services/mimetype-content-wrapper.d.ts +5 -0
  303. package/dist/lib/services/mimetype-content-wrapper.d.ts.map +1 -0
  304. package/dist/lib/services/mimetype-content-wrapper.js +8 -0
  305. package/dist/lib/services/mimetype-content-wrapper.js.map +1 -0
  306. package/dist/lib/services/model-properties-accessor.d.ts +7 -0
  307. package/dist/lib/services/model-properties-accessor.d.ts.map +1 -0
  308. package/dist/lib/services/model-properties-accessor.js +33 -0
  309. package/dist/lib/services/model-properties-accessor.js.map +1 -0
  310. package/dist/lib/services/parameter-metadata-accessor.d.ts +22 -0
  311. package/dist/lib/services/parameter-metadata-accessor.d.ts.map +1 -0
  312. package/dist/lib/services/parameter-metadata-accessor.js +38 -0
  313. package/dist/lib/services/parameter-metadata-accessor.js.map +1 -0
  314. package/dist/lib/services/parameters-metadata-mapper.d.ts +10 -0
  315. package/dist/lib/services/parameters-metadata-mapper.d.ts.map +1 -0
  316. package/dist/lib/services/parameters-metadata-mapper.js +45 -0
  317. package/dist/lib/services/parameters-metadata-mapper.js.map +1 -0
  318. package/dist/lib/services/response-object-factory.d.ts +15 -0
  319. package/dist/lib/services/response-object-factory.d.ts.map +1 -0
  320. package/dist/lib/services/response-object-factory.js +123 -0
  321. package/dist/lib/services/response-object-factory.js.map +1 -0
  322. package/dist/lib/services/response-object-mapper.d.ts +8 -0
  323. package/dist/lib/services/response-object-mapper.d.ts.map +1 -0
  324. package/dist/lib/services/response-object-mapper.js +55 -0
  325. package/dist/lib/services/response-object-mapper.js.map +1 -0
  326. package/dist/lib/services/schema-object-factory.d.ts +160 -0
  327. package/dist/lib/services/schema-object-factory.d.ts.map +1 -0
  328. package/dist/lib/services/schema-object-factory.js +484 -0
  329. package/dist/lib/services/schema-object-factory.js.map +1 -0
  330. package/dist/lib/services/swagger-types-mapper.d.ts +19 -0
  331. package/dist/lib/services/swagger-types-mapper.d.ts.map +1 -0
  332. package/dist/lib/services/swagger-types-mapper.js +132 -0
  333. package/dist/lib/services/swagger-types-mapper.js.map +1 -0
  334. package/dist/lib/storages/global-parameters.storage.d.ts +9 -0
  335. package/dist/lib/storages/global-parameters.storage.d.ts.map +1 -0
  336. package/dist/lib/storages/global-parameters.storage.js +23 -0
  337. package/dist/lib/storages/global-parameters.storage.js.map +1 -0
  338. package/dist/lib/swagger-transformer.d.ts +8 -0
  339. package/dist/lib/swagger-transformer.d.ts.map +1 -0
  340. package/dist/lib/swagger-transformer.js +36 -0
  341. package/dist/lib/swagger-transformer.js.map +1 -0
  342. package/dist/lib/swagger-ui/constants.d.ts +4 -0
  343. package/dist/lib/swagger-ui/constants.d.ts.map +1 -0
  344. package/dist/lib/swagger-ui/constants.js +130 -0
  345. package/dist/lib/swagger-ui/constants.js.map +1 -0
  346. package/dist/lib/swagger-ui/helpers.d.ts +6 -0
  347. package/dist/lib/swagger-ui/helpers.d.ts.map +1 -0
  348. package/dist/lib/swagger-ui/helpers.js +17 -0
  349. package/dist/lib/swagger-ui/helpers.js.map +1 -0
  350. package/dist/lib/swagger-ui/index.d.ts +2 -0
  351. package/dist/lib/swagger-ui/index.d.ts.map +1 -0
  352. package/dist/lib/swagger-ui/index.js +2 -0
  353. package/dist/lib/swagger-ui/index.js.map +1 -0
  354. package/dist/lib/swagger-ui/swagger-ui.d.ts +14 -0
  355. package/dist/lib/swagger-ui/swagger-ui.d.ts.map +1 -0
  356. package/dist/lib/swagger-ui/swagger-ui.js +64 -0
  357. package/dist/lib/swagger-ui/swagger-ui.js.map +1 -0
  358. package/dist/lib/type-helpers/index.d.ts +5 -0
  359. package/dist/lib/type-helpers/index.d.ts.map +1 -0
  360. package/dist/lib/type-helpers/index.js +5 -0
  361. package/dist/lib/type-helpers/index.js.map +1 -0
  362. package/dist/lib/type-helpers/intersection-type.helper.d.ts +9 -0
  363. package/dist/lib/type-helpers/intersection-type.helper.d.ts.map +1 -0
  364. package/dist/lib/type-helpers/intersection-type.helper.js +40 -0
  365. package/dist/lib/type-helpers/intersection-type.helper.js.map +1 -0
  366. package/dist/lib/type-helpers/mapped-types.utils.d.ts +3 -0
  367. package/dist/lib/type-helpers/mapped-types.utils.d.ts.map +1 -0
  368. package/dist/lib/type-helpers/mapped-types.utils.js +33 -0
  369. package/dist/lib/type-helpers/mapped-types.utils.js.map +1 -0
  370. package/dist/lib/type-helpers/omit-type.helper.d.ts +3 -0
  371. package/dist/lib/type-helpers/omit-type.helper.d.ts.map +1 -0
  372. package/dist/lib/type-helpers/omit-type.helper.js +38 -0
  373. package/dist/lib/type-helpers/omit-type.helper.js.map +1 -0
  374. package/dist/lib/type-helpers/partial-type.helper.d.ts +14 -0
  375. package/dist/lib/type-helpers/partial-type.helper.d.ts.map +1 -0
  376. package/dist/lib/type-helpers/partial-type.helper.js +52 -0
  377. package/dist/lib/type-helpers/partial-type.helper.js.map +1 -0
  378. package/dist/lib/type-helpers/pick-type.helper.d.ts +3 -0
  379. package/dist/lib/type-helpers/pick-type.helper.d.ts.map +1 -0
  380. package/dist/lib/type-helpers/pick-type.helper.js +38 -0
  381. package/dist/lib/type-helpers/pick-type.helper.js.map +1 -0
  382. package/dist/lib/types/swagger-enum.type.d.ts +2 -0
  383. package/dist/lib/types/swagger-enum.type.d.ts.map +1 -0
  384. package/dist/lib/types/swagger-enum.type.js +2 -0
  385. package/dist/lib/types/swagger-enum.type.js.map +1 -0
  386. package/dist/lib/utils/assign-two-levels-deep.d.ts +16 -0
  387. package/dist/lib/utils/assign-two-levels-deep.d.ts.map +1 -0
  388. package/dist/lib/utils/assign-two-levels-deep.js +24 -0
  389. package/dist/lib/utils/assign-two-levels-deep.js.map +1 -0
  390. package/dist/lib/utils/enum.utils.d.ts +10 -0
  391. package/dist/lib/utils/enum.utils.d.ts.map +1 -0
  392. package/dist/lib/utils/enum.utils.js +68 -0
  393. package/dist/lib/utils/enum.utils.js.map +1 -0
  394. package/dist/lib/utils/extend-metadata.util.d.ts +3 -0
  395. package/dist/lib/utils/extend-metadata.util.d.ts.map +1 -0
  396. package/dist/lib/utils/extend-metadata.util.js +9 -0
  397. package/dist/lib/utils/extend-metadata.util.js.map +1 -0
  398. package/dist/lib/utils/get-global-prefix.d.ts +3 -0
  399. package/dist/lib/utils/get-global-prefix.d.ts.map +1 -0
  400. package/dist/lib/utils/get-global-prefix.js +5 -0
  401. package/dist/lib/utils/get-global-prefix.js.map +1 -0
  402. package/dist/lib/utils/get-schema-path.util.d.ts +5 -0
  403. package/dist/lib/utils/get-schema-path.util.d.ts.map +1 -0
  404. package/dist/lib/utils/get-schema-path.util.js +22 -0
  405. package/dist/lib/utils/get-schema-path.util.js.map +1 -0
  406. package/dist/lib/utils/index.d.ts +2 -0
  407. package/dist/lib/utils/index.d.ts.map +1 -0
  408. package/dist/lib/utils/index.js +2 -0
  409. package/dist/lib/utils/index.js.map +1 -0
  410. package/dist/lib/utils/is-body-parameter.util.d.ts +3 -0
  411. package/dist/lib/utils/is-body-parameter.util.d.ts.map +1 -0
  412. package/dist/lib/utils/is-body-parameter.util.js +4 -0
  413. package/dist/lib/utils/is-body-parameter.util.js.map +1 -0
  414. package/dist/lib/utils/is-built-in-type.util.d.ts +3 -0
  415. package/dist/lib/utils/is-built-in-type.util.d.ts.map +1 -0
  416. package/dist/lib/utils/is-built-in-type.util.js +6 -0
  417. package/dist/lib/utils/is-built-in-type.util.js.map +1 -0
  418. package/dist/lib/utils/is-date-ctor.util.d.ts +3 -0
  419. package/dist/lib/utils/is-date-ctor.util.d.ts.map +1 -0
  420. package/dist/lib/utils/is-date-ctor.util.js +4 -0
  421. package/dist/lib/utils/is-date-ctor.util.js.map +1 -0
  422. package/dist/lib/utils/merge-and-uniq.util.d.ts +2 -0
  423. package/dist/lib/utils/merge-and-uniq.util.d.ts.map +1 -0
  424. package/dist/lib/utils/merge-and-uniq.util.js +5 -0
  425. package/dist/lib/utils/merge-and-uniq.util.js.map +1 -0
  426. package/dist/lib/utils/normalize-rel-path.d.ts +2 -0
  427. package/dist/lib/utils/normalize-rel-path.d.ts.map +1 -0
  428. package/dist/lib/utils/normalize-rel-path.js +6 -0
  429. package/dist/lib/utils/normalize-rel-path.js.map +1 -0
  430. package/dist/lib/utils/remove-undefined-keys.d.ts +6 -0
  431. package/dist/lib/utils/remove-undefined-keys.d.ts.map +1 -0
  432. package/dist/lib/utils/remove-undefined-keys.js +9 -0
  433. package/dist/lib/utils/remove-undefined-keys.js.map +1 -0
  434. package/dist/lib/utils/resolve-path.util.d.ts +2 -0
  435. package/dist/lib/utils/resolve-path.util.d.ts.map +1 -0
  436. package/dist/lib/utils/resolve-path.util.js +5 -0
  437. package/dist/lib/utils/resolve-path.util.js.map +1 -0
  438. package/dist/lib/utils/reverse-object-keys.util.d.ts +2 -0
  439. package/dist/lib/utils/reverse-object-keys.util.d.ts.map +1 -0
  440. package/dist/lib/utils/reverse-object-keys.util.js +9 -0
  441. package/dist/lib/utils/reverse-object-keys.util.js.map +1 -0
  442. package/dist/lib/utils/sort-object-lexicographically.d.ts +6 -0
  443. package/dist/lib/utils/sort-object-lexicographically.d.ts.map +1 -0
  444. package/dist/lib/utils/sort-object-lexicographically.js +9 -0
  445. package/dist/lib/utils/sort-object-lexicographically.js.map +1 -0
  446. package/dist/lib/utils/strip-last-slash.util.d.ts +2 -0
  447. package/dist/lib/utils/strip-last-slash.util.d.ts.map +1 -0
  448. package/dist/lib/utils/strip-last-slash.util.js +4 -0
  449. package/dist/lib/utils/strip-last-slash.util.js.map +1 -0
  450. package/dist/lib/utils/validate-global-prefix.util.d.ts +2 -0
  451. package/dist/lib/utils/validate-global-prefix.util.d.ts.map +1 -0
  452. package/dist/lib/utils/validate-global-prefix.util.js +4 -0
  453. package/dist/lib/utils/validate-global-prefix.util.js.map +1 -0
  454. package/dist/lib/utils/validate-path.util.d.ts +2 -0
  455. package/dist/lib/utils/validate-path.util.d.ts.map +1 -0
  456. package/dist/lib/utils/validate-path.util.js +4 -0
  457. package/dist/lib/utils/validate-path.util.js.map +1 -0
  458. package/package.json +40 -0
@@ -0,0 +1,58 @@
1
+ import * as ts from 'typescript';
2
+ import { PluginOptions } from '../merge-options.js';
3
+ export declare function getDecoratorOrUndefinedByNames(names: string[], decorators: readonly ts.Decorator[], factory: ts.NodeFactory): ts.Decorator | undefined;
4
+ export declare function getTypeReferenceAsString(type: ts.Type, typeChecker: ts.TypeChecker, arrayDepth?: number): {
5
+ typeName: string;
6
+ isArray?: boolean;
7
+ arrayDepth?: number;
8
+ };
9
+ export declare function isPromiseOrObservable(type: string): boolean;
10
+ export declare function hasPropertyKey(key: string, properties: ts.NodeArray<ts.PropertyAssignment>): boolean;
11
+ export declare function replaceImportPath(typeReference: string, fileName: string, options: PluginOptions): {
12
+ typeReference: string;
13
+ importPath: null;
14
+ typeName?: undefined;
15
+ } | {
16
+ typeReference: undefined;
17
+ importPath: null;
18
+ typeName?: undefined;
19
+ } | {
20
+ typeReference: string;
21
+ typeName: string | undefined;
22
+ importPath: string;
23
+ } | {
24
+ typeReference: string;
25
+ importPath: string;
26
+ typeName?: undefined;
27
+ };
28
+ export declare function insertAt(string: string, index: number, substring: string): string;
29
+ export declare function isDynamicallyAdded(identifier: ts.Node): boolean;
30
+ /**
31
+ * When "strict" mode enabled, TypeScript transform the enum type to a union composed of
32
+ * the enum values and the undefined type. Hence, we have to lookup all the union types to get the original type
33
+ * @param type
34
+ * @param typeChecker
35
+ */
36
+ export declare function isAutoGeneratedEnumUnion(type: ts.Type, typeChecker: ts.TypeChecker): ts.Type | undefined;
37
+ /**
38
+ * when "strict" mode enabled, TypeScript transform the type signature of optional properties to
39
+ * the {undefined | T} where T is the original type. Hence, we have to extract the last type of type union
40
+ * @param type
41
+ */
42
+ export declare function isAutoGeneratedTypeUnion(type: ts.Type): boolean;
43
+ export declare function extractTypeArgumentIfArray(type: ts.Type): {
44
+ type: ts.Type;
45
+ isArray: boolean;
46
+ } | undefined;
47
+ /**
48
+ * Converts Windows specific file paths to posix
49
+ * @param windowsPath
50
+ */
51
+ export declare function convertPath(windowsPath: string): string;
52
+ /**
53
+ * Checks if a node can be directly referenced.
54
+ * In the readonly mode, only literals can be referenced directly.
55
+ * Nodes like identifiers or call expressions are not available in the auto-generated code.
56
+ */
57
+ export declare function canReferenceNode(node: ts.Node, options: PluginOptions): boolean;
58
+ //# sourceMappingURL=plugin-utils.d.ts.map
@@ -0,0 +1 @@
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;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,OAAO,CAa/D;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI;;;cAevD;AAUD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,UAK9C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,aAAa,WAwBrE"}
@@ -0,0 +1,282 @@
1
+ import { head } from 'lodash';
2
+ import { isAbsolute, posix } from 'path';
3
+ import * as ts from 'typescript';
4
+ import { getDecoratorName, getText, getTypeArguments, isArray, isBigInt, isBoolean, isEnum, isInterface, isNumber, isString, isStringLiteral, isStringMapping, } from './ast-utils.js';
5
+ export function getDecoratorOrUndefinedByNames(names, decorators, factory) {
6
+ return (decorators || factory.createNodeArray()).find(item => {
7
+ try {
8
+ const decoratorName = getDecoratorName(item);
9
+ return names.includes(decoratorName);
10
+ }
11
+ catch {
12
+ return false;
13
+ }
14
+ });
15
+ }
16
+ export function getTypeReferenceAsString(type, typeChecker, arrayDepth = 0) {
17
+ if (isArray(type)) {
18
+ const arrayType = getTypeArguments(type)[0];
19
+ const { typeName, arrayDepth: depth } = getTypeReferenceAsString(arrayType, typeChecker, arrayDepth + 1);
20
+ if (!typeName) {
21
+ return { typeName: undefined };
22
+ }
23
+ return {
24
+ typeName: `${typeName}`,
25
+ isArray: true,
26
+ arrayDepth: depth,
27
+ };
28
+ }
29
+ if (isBoolean(type)) {
30
+ return { typeName: Boolean.name, arrayDepth };
31
+ }
32
+ if (isNumber(type)) {
33
+ return { typeName: Number.name, arrayDepth };
34
+ }
35
+ if (isBigInt(type)) {
36
+ return { typeName: BigInt.name, arrayDepth };
37
+ }
38
+ if (isString(type) || isStringLiteral(type) || isStringMapping(type)) {
39
+ return { typeName: String.name, arrayDepth };
40
+ }
41
+ if (isPromiseOrObservable(getText(type, typeChecker))) {
42
+ const typeArguments = getTypeArguments(type);
43
+ const elementType = getTypeReferenceAsString(head(typeArguments), typeChecker, arrayDepth);
44
+ return elementType;
45
+ }
46
+ if (type.isClass()) {
47
+ return { typeName: getText(type, typeChecker), arrayDepth };
48
+ }
49
+ try {
50
+ const text = getText(type, typeChecker);
51
+ if (text === Date.name) {
52
+ return { typeName: text, arrayDepth };
53
+ }
54
+ if (isOptionalBoolean(text)) {
55
+ return { typeName: Boolean.name, arrayDepth };
56
+ }
57
+ if (isAutoGeneratedTypeUnion(type) || isAutoGeneratedEnumUnion(type, typeChecker)) {
58
+ const types = type.types;
59
+ return getTypeReferenceAsString(types[types.length - 1], typeChecker, arrayDepth);
60
+ }
61
+ if (text === 'any' ||
62
+ text === 'unknown' ||
63
+ text === 'object' ||
64
+ isInterface(type) ||
65
+ (type.isUnionOrIntersection() && !isEnum(type))) {
66
+ return { typeName: 'Object', arrayDepth };
67
+ }
68
+ if (isEnum(type)) {
69
+ return { typeName: undefined, arrayDepth };
70
+ }
71
+ if (type.aliasSymbol) {
72
+ return { typeName: 'Object', arrayDepth };
73
+ }
74
+ if (typeChecker.getApparentType(type).getSymbol()?.getEscapedName() === 'String') {
75
+ return { typeName: String.name, arrayDepth };
76
+ }
77
+ return { typeName: undefined };
78
+ }
79
+ catch {
80
+ return { typeName: undefined };
81
+ }
82
+ }
83
+ export function isPromiseOrObservable(type) {
84
+ return type.includes('Promise<') || type.includes('Observable<');
85
+ }
86
+ export function hasPropertyKey(key, properties) {
87
+ return properties.filter(item => !isDynamicallyAdded(item)).some(item => item.name.getText() === key);
88
+ }
89
+ export function replaceImportPath(typeReference, fileName, options) {
90
+ if (!typeReference.includes('import')) {
91
+ return { typeReference, importPath: null };
92
+ }
93
+ let importPath = /\(\"([^)]).+(\")/.exec(typeReference)?.[0];
94
+ if (!importPath) {
95
+ return { typeReference: undefined, importPath: null };
96
+ }
97
+ importPath = convertPath(importPath);
98
+ importPath = importPath.slice(2, importPath.length - 1);
99
+ try {
100
+ if (isAbsolute(importPath)) {
101
+ throw {};
102
+ }
103
+ require.resolve(importPath);
104
+ typeReference = typeReference.replace('import', 'require');
105
+ return {
106
+ typeReference,
107
+ importPath: null,
108
+ };
109
+ }
110
+ catch (_error) {
111
+ const from = options?.readonly ? convertPath(options.pathToSource) : posix.dirname(convertPath(fileName));
112
+ let relativePath = posix.relative(from, importPath);
113
+ relativePath = relativePath[0] !== '.' ? './' + relativePath : relativePath;
114
+ const nodeModulesText = 'node_modules';
115
+ const nodeModulePos = relativePath.indexOf(nodeModulesText);
116
+ if (nodeModulePos >= 0) {
117
+ relativePath = relativePath.slice(nodeModulePos + nodeModulesText.length + 1);
118
+ const typesText = '@types';
119
+ const typesPos = relativePath.indexOf(typesText);
120
+ if (typesPos >= 0) {
121
+ relativePath = relativePath.slice(typesPos + typesText.length + 1);
122
+ }
123
+ const indexText = '/index';
124
+ const indexPos = relativePath.indexOf(indexText);
125
+ if (indexPos >= 0) {
126
+ relativePath = relativePath.slice(0, indexPos);
127
+ }
128
+ }
129
+ typeReference = typeReference.replace(importPath, relativePath);
130
+ if (options.readonly) {
131
+ const { typeName, typeImportStatement } = convertToAsyncImport(typeReference);
132
+ return {
133
+ typeReference: typeImportStatement,
134
+ typeName,
135
+ importPath: relativePath,
136
+ };
137
+ }
138
+ return {
139
+ typeReference: typeReference.replace('import', 'require'),
140
+ importPath: relativePath,
141
+ };
142
+ }
143
+ }
144
+ function convertToAsyncImport(typeReference) {
145
+ const regexp = /import\(.+\).([^\]]+)(\])?/;
146
+ const match = regexp.exec(typeReference);
147
+ if (match && match.length >= 2) {
148
+ const importPos = typeReference.indexOf(match[0]);
149
+ typeReference = typeReference.replace(`.${match[1]}`, '');
150
+ return {
151
+ typeImportStatement: insertAt(typeReference, importPos, 'await '),
152
+ typeName: match[1],
153
+ };
154
+ }
155
+ return { typeImportStatement: typeReference };
156
+ }
157
+ export function insertAt(string, index, substring) {
158
+ return string.slice(0, index) + substring + string.slice(index);
159
+ }
160
+ export function isDynamicallyAdded(identifier) {
161
+ return identifier && !identifier.parent && identifier.pos === -1;
162
+ }
163
+ /**
164
+ * When "strict" mode enabled, TypeScript transform the enum type to a union composed of
165
+ * the enum values and the undefined type. Hence, we have to lookup all the union types to get the original type
166
+ * @param type
167
+ * @param typeChecker
168
+ */
169
+ export function isAutoGeneratedEnumUnion(type, typeChecker) {
170
+ if (type.isUnionOrIntersection() && !isEnum(type)) {
171
+ if (!type.types) {
172
+ return undefined;
173
+ }
174
+ const undefinedTypeIndex = type.types.findIndex((type) => type.intrinsicName === 'undefined' || type.intrinsicName === 'null');
175
+ if (undefinedTypeIndex < 0) {
176
+ return undefined;
177
+ }
178
+ // "strict" mode for enums
179
+ let parentType = undefined;
180
+ const isParentSymbolEqual = type.types.every((item, index) => {
181
+ if (index === undefinedTypeIndex) {
182
+ return true;
183
+ }
184
+ if (!item.symbol) {
185
+ return false;
186
+ }
187
+ if (!item.symbol.parent || item.symbol.flags !== ts.SymbolFlags.EnumMember) {
188
+ return false;
189
+ }
190
+ const symbolType = typeChecker.getDeclaredTypeOfSymbol(item.symbol.parent);
191
+ if (symbolType === parentType || !parentType) {
192
+ parentType = symbolType;
193
+ return true;
194
+ }
195
+ return false;
196
+ });
197
+ if (isParentSymbolEqual) {
198
+ return parentType;
199
+ }
200
+ }
201
+ return undefined;
202
+ }
203
+ /**
204
+ * when "strict" mode enabled, TypeScript transform the type signature of optional properties to
205
+ * the {undefined | T} where T is the original type. Hence, we have to extract the last type of type union
206
+ * @param type
207
+ */
208
+ export function isAutoGeneratedTypeUnion(type) {
209
+ if (type.isUnionOrIntersection() && !isEnum(type)) {
210
+ if (!type.types) {
211
+ return false;
212
+ }
213
+ const undefinedTypeIndex = type.types.findIndex((type) => type.intrinsicName === 'undefined');
214
+ // "strict" mode for non-enum properties
215
+ if (type.types.length === 2 && undefinedTypeIndex >= 0) {
216
+ return true;
217
+ }
218
+ }
219
+ return false;
220
+ }
221
+ export function extractTypeArgumentIfArray(type) {
222
+ if (isArray(type)) {
223
+ type = getTypeArguments(type)[0];
224
+ if (!type) {
225
+ return undefined;
226
+ }
227
+ return {
228
+ type,
229
+ isArray: true,
230
+ };
231
+ }
232
+ return {
233
+ type,
234
+ isArray: false,
235
+ };
236
+ }
237
+ /**
238
+ * when "strict" mode enabled, TypeScript transform optional boolean properties to "boolean | undefined"
239
+ * @param text
240
+ */
241
+ function isOptionalBoolean(text) {
242
+ return typeof text === 'string' && text === 'boolean | undefined';
243
+ }
244
+ /**
245
+ * Converts Windows specific file paths to posix
246
+ * @param windowsPath
247
+ */
248
+ export function convertPath(windowsPath) {
249
+ return windowsPath
250
+ .replace(/^\\\\\?\\/, '')
251
+ .replace(/\\/g, '/')
252
+ .replace(/\/\/+/g, '/');
253
+ }
254
+ /**
255
+ * Checks if a node can be directly referenced.
256
+ * In the readonly mode, only literals can be referenced directly.
257
+ * Nodes like identifiers or call expressions are not available in the auto-generated code.
258
+ */
259
+ export function canReferenceNode(node, options) {
260
+ if (!options.readonly) {
261
+ return true;
262
+ }
263
+ if (ts.isCallExpression(node) || ts.isIdentifier(node)) {
264
+ return false;
265
+ }
266
+ if (ts.isNewExpression(node)) {
267
+ if (node.expression?.escapedText === 'Date') {
268
+ return true;
269
+ }
270
+ return false;
271
+ }
272
+ if (node.kind === ts.SyntaxKind.FalseKeyword ||
273
+ node.kind === ts.SyntaxKind.TrueKeyword ||
274
+ node.kind === ts.SyntaxKind.NullKeyword) {
275
+ return true;
276
+ }
277
+ if (ts.isNumericLiteral(node) || ts.isPrefixUnaryExpression(node) || ts.isStringLiteral(node)) {
278
+ return true;
279
+ }
280
+ return false;
281
+ }
282
+ //# sourceMappingURL=plugin-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-utils.js","sourceRoot":"","sources":["../../../../src/lib/plugin/utils/plugin-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,UAAU,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../merge-options.js';
3
+ export declare function typeReferenceToIdentifier(typeReferenceDescriptor: {
4
+ typeName: string;
5
+ isArray?: boolean;
6
+ arrayDepth?: number;
7
+ }, hostFilename: string, options: PluginOptions, factory: ts.NodeFactory, type: ts.Type, typeImports: Record<string, string>): ts.Identifier;
8
+ //# sourceMappingURL=type-reference-to-identifier.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-reference-to-identifier.util.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugin/utils/type-reference-to-identifier.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD,wBAAgB,yBAAyB,CACvC,uBAAuB,EAAE;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,EACD,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,iBA+BpC"}
@@ -0,0 +1,50 @@
1
+ import { pluginDebugLogger } from '../plugin-debug-logger.js';
2
+ import { replaceImportPath } from './plugin-utils.js';
3
+ export function typeReferenceToIdentifier(typeReferenceDescriptor, hostFilename, options, factory, type, typeImports) {
4
+ if (options.readonly) {
5
+ assertReferenceableType(type, typeReferenceDescriptor.typeName, hostFilename, options);
6
+ }
7
+ const { typeReference, importPath, typeName } = replaceImportPath(typeReferenceDescriptor.typeName, hostFilename, options);
8
+ let identifier;
9
+ if (options.readonly && typeReference?.includes('import')) {
10
+ if (!typeImports[importPath]) {
11
+ typeImports[importPath] = typeReference;
12
+ }
13
+ let ref = `t["${importPath}"].${typeName}`;
14
+ if (typeReferenceDescriptor.isArray) {
15
+ ref = wrapTypeInArray(ref, typeReferenceDescriptor.arrayDepth);
16
+ }
17
+ identifier = factory.createIdentifier(ref);
18
+ }
19
+ else {
20
+ let ref = typeReference;
21
+ if (typeReferenceDescriptor.isArray) {
22
+ ref = wrapTypeInArray(ref, typeReferenceDescriptor.arrayDepth);
23
+ }
24
+ identifier = factory.createIdentifier(ref);
25
+ }
26
+ return identifier;
27
+ }
28
+ function wrapTypeInArray(typeRef, arrayDepth) {
29
+ for (let i = 0; i < arrayDepth; i++) {
30
+ typeRef = `[${typeRef}]`;
31
+ }
32
+ return typeRef;
33
+ }
34
+ function assertReferenceableType(type, parsedTypeName, hostFilename, options) {
35
+ if (!type.symbol) {
36
+ return true;
37
+ }
38
+ if (!type.symbol.isReferenced) {
39
+ return true;
40
+ }
41
+ if (parsedTypeName.includes('import')) {
42
+ return true;
43
+ }
44
+ const errorMessage = `Type "${parsedTypeName}" is not referenceable ("${hostFilename}"). To fix this, make sure to export this type.`;
45
+ if (options.debug) {
46
+ pluginDebugLogger.debug(errorMessage);
47
+ }
48
+ throw new Error(errorMessage);
49
+ }
50
+ //# sourceMappingURL=type-reference-to-identifier.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-reference-to-identifier.util.js","sourceRoot":"","sources":["../../../../src/lib/plugin/utils/type-reference-to-identifier.util.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,UAAU,yBAAyB,CACvC,uBAIC,EACD,YAAoB,EACpB,OAAsB,EACtB,OAAuB,EACvB,IAAa,EACb,WAAmC;IAEnC,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrB,uBAAuB,CAAC,IAAI,EAAE,uBAAuB,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IACzF,CAAC;IAED,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ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I,CAAC;IACd,CAAC;IACD,IAAI,CAAE,IAAI,CAAC,MAAc,CAAC,YAAY,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,YAAY,GAAG,SAAS,cAAc,4BAA4B,YAAY,iDAAiD,CAAC;IACtI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,iBAAiB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import * as ts from 'typescript';
2
+ export declare class AbstractFileVisitor {
3
+ updateImports(sourceFile: ts.SourceFile, factory: ts.NodeFactory | undefined, program: ts.Program): ts.SourceFile;
4
+ }
5
+ //# sourceMappingURL=abstract.visitor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract.visitor.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugin/visitors/abstract.visitor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAKjC,qBAAa,mBAAmB;IAC9B,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU;CA4BlH"}
@@ -0,0 +1,20 @@
1
+ import * as ts from 'typescript';
2
+ import { OPENAPI_NAMESPACE, OPENAPI_PACKAGE_NAME } from '../plugin-constants.js';
3
+ const [major, minor] = ts.versionMajorMinor?.split('.').map(x => +x);
4
+ export class AbstractFileVisitor {
5
+ updateImports(sourceFile, factory, program) {
6
+ if (major <= 4 && minor < 8) {
7
+ throw new Error('Nest CLI plugin does not support TypeScript < v4.8');
8
+ }
9
+ const importEqualsDeclaration = factory.createImportEqualsDeclaration(undefined, false, factory.createIdentifier(OPENAPI_NAMESPACE), factory.createExternalModuleReference(factory.createStringLiteral(OPENAPI_PACKAGE_NAME)));
10
+ const compilerOptions = program.getCompilerOptions();
11
+ if (compilerOptions.module >= ts.ModuleKind.ES2015 && compilerOptions.module <= ts.ModuleKind.ESNext) {
12
+ const importAsDeclaration = factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamespaceImport(factory.createIdentifier(OPENAPI_NAMESPACE))), factory.createStringLiteral(OPENAPI_PACKAGE_NAME), undefined);
13
+ return factory.updateSourceFile(sourceFile, [importAsDeclaration, ...sourceFile.statements]);
14
+ }
15
+ else {
16
+ return factory.updateSourceFile(sourceFile, [importEqualsDeclaration, ...sourceFile.statements]);
17
+ }
18
+ }
19
+ }
20
+ //# sourceMappingURL=abstract.visitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract.visitor.js","sourceRoot":"","sources":["../../../../src/lib/plugin/visitors/abstract.visitor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEjF,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,iBAAiB,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAErE,MAAM,OAAO,mBAAmB;IAC9B,aAAa,CAAC,UAAyB,EAAE,OAAmC,EAAE,OAAmB;QAC/F,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACxE,CAAC;QACD,MAAM,uBAAuB,GAA+B,OAAQ,CAAC,6BAA6B,CAChG,SAAS,EACT,KAAK,EACL,OAAQ,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,EAC5C,OAAQ,CAAC,6BAA6B,CAAC,OAAQ,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,CAAC,CAC3F,CAAC;QAEF,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;QACrD,IAAI,eAAe,CAAC,MAAO,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,IAAI,eAAe,CAAC,MAAO,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACvG,MAAM,mBAAmB,GAAI,OAAQ,CAAC,uBAA+B,CACnE,SAAS,EACT,OAAQ,CAAC,kBAAkB,CACzB,KAAK,EACL,SAAS,EACT,OAAQ,CAAC,qBAAqB,CAAC,OAAQ,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAC7E,EACD,OAAQ,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,EAClD,SAAS,CACV,CAAC;YACF,OAAO,OAAQ,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,mBAAmB,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;QAChG,CAAC;aAAM,CAAC;YACN,OAAO,OAAQ,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,uBAAuB,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;QACpG,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ import * as ts from 'typescript';
2
+ import { PluginOptions } from '../merge-options.js';
3
+ import { AbstractFileVisitor } from './abstract.visitor.js';
4
+ type ClassMetadata = Record<string, ts.ObjectLiteralExpression>;
5
+ export declare class ControllerClassVisitor extends AbstractFileVisitor {
6
+ private readonly _collectedMetadata;
7
+ private readonly _typeImports;
8
+ get typeImports(): Record<string, string>;
9
+ get collectedMetadata(): Array<[ts.CallExpression, Record<string, ClassMetadata>]>;
10
+ visit(sourceFile: ts.SourceFile, ctx: ts.TransformationContext, program: ts.Program, options: PluginOptions): ts.Node | undefined;
11
+ addDecoratorToNode(factory: ts.NodeFactory, compilerNode: ts.MethodDeclaration, typeChecker: ts.TypeChecker, options: PluginOptions, sourceFile: ts.SourceFile, metadata: ClassMetadata): ts.MethodDeclaration;
12
+ createApiOperationDecorator(factory: ts.NodeFactory, node: ts.MethodDeclaration, decorators: readonly ts.Decorator[], options: PluginOptions, sourceFile: ts.SourceFile, typeChecker: ts.TypeChecker, metadata: ClassMetadata): ts.Decorator[];
13
+ createApiResponseDecorator(factory: ts.NodeFactory, node: ts.MethodDeclaration, options: PluginOptions, metadata: ClassMetadata): ts.Decorator[];
14
+ createDecoratorObjectLiteralExpr(factory: ts.NodeFactory, node: ts.MethodDeclaration, typeChecker: ts.TypeChecker, existingProperties: ts.NodeArray<ts.PropertyAssignment> | undefined, hostFilename: string, metadata: ClassMetadata, options: PluginOptions): ts.ObjectLiteralExpression;
15
+ createTypePropertyAssignment(factory: ts.NodeFactory, node: ts.MethodDeclaration, typeChecker: ts.TypeChecker, existingProperties: ts.NodeArray<ts.PropertyAssignment>, hostFilename: string, options: PluginOptions): ts.PropertyAssignment | undefined;
16
+ createStatusPropertyAssignment(factory: ts.NodeFactory, node: ts.MethodDeclaration, existingProperties: ts.NodeArray<ts.PropertyAssignment>): ts.PropertyAssignment | undefined;
17
+ getStatusCodeIdentifier(factory: ts.NodeFactory, node: ts.MethodDeclaration): any;
18
+ private normalizeImportPath;
19
+ }
20
+ export {};
21
+ //# sourceMappingURL=controller-class.visitor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller-class.visitor.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugin/visitors/controller-class.visitor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAiBpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,KAAK,aAAa,GAAG,MAAM,CAA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