@achinet/nestjs-async 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/dist/asyncapi-document.builder.d.ts +1 -1
  2. package/dist/asyncapi-document.builder.js.map +1 -1
  3. package/dist/asyncapi.module.js +8 -5
  4. package/dist/asyncapi.module.js.map +1 -1
  5. package/dist/binding/asyncapi.kafka.interfaces.d.ts +1 -1
  6. package/dist/decorators/asyncapi-operation-for-meta-key.decorator.js +3 -3
  7. package/dist/decorators/asyncapi-operation-for-meta-key.decorator.js.map +1 -1
  8. package/dist/decorators/asyncapi-operation.decorator.js.map +1 -1
  9. package/dist/decorators/asyncapi-pub.decorator.js.map +1 -1
  10. package/dist/decorators/asyncapi-service.decorator.d.ts +1 -1
  11. package/dist/decorators/asyncapi-service.decorator.js +2 -2
  12. package/dist/decorators/asyncapi-service.decorator.js.map +1 -1
  13. package/dist/decorators/asyncapi-sub.decorator.js.map +1 -1
  14. package/dist/explorers/asyncapi-class.explorer.js +1 -5
  15. package/dist/explorers/asyncapi-class.explorer.js.map +1 -1
  16. package/dist/explorers/asyncapi-operation.explorer.d.ts +1 -2
  17. package/dist/explorers/asyncapi-operation.explorer.js +2 -2
  18. package/dist/explorers/asyncapi-operation.explorer.js.map +1 -1
  19. package/dist/interface/asyncapi-common.interfaces.d.ts +1 -1
  20. package/dist/interface/asyncapi-server.interface.d.ts +1 -1
  21. package/dist/interface/asyncapi-template-options.interface.d.ts +2 -3
  22. package/dist/interface/index.d.ts +0 -1
  23. package/dist/interface/index.js +0 -1
  24. package/dist/interface/index.js.map +1 -1
  25. package/dist/services/asyncapi.explorer.d.ts +2 -4
  26. package/dist/services/asyncapi.explorer.js +8 -13
  27. package/dist/services/asyncapi.explorer.js.map +1 -1
  28. package/dist/services/asyncapi.generator.d.ts +4 -3
  29. package/dist/services/asyncapi.generator.js +72 -17
  30. package/dist/services/asyncapi.generator.js.map +1 -1
  31. package/dist/services/asyncapi.scanner.d.ts +1 -4
  32. package/dist/services/asyncapi.scanner.js +10 -31
  33. package/dist/services/asyncapi.scanner.js.map +1 -1
  34. package/dist/services/asyncapi.transformer.js.map +1 -1
  35. package/dist/services/index.d.ts +1 -1
  36. package/dist/services/index.js +1 -1
  37. package/dist/services/index.js.map +1 -1
  38. package/dist/services/operation-object.factory.d.ts +2 -6
  39. package/dist/services/operation-object.factory.js +7 -14
  40. package/dist/services/operation-object.factory.js.map +1 -1
  41. package/dist/services/swagger-schema.factory.d.ts +6 -0
  42. package/dist/services/swagger-schema.factory.js +27 -0
  43. package/dist/services/swagger-schema.factory.js.map +1 -0
  44. package/dist/utils/decorator.utils.d.ts +2 -0
  45. package/dist/utils/decorator.utils.js +26 -0
  46. package/dist/utils/decorator.utils.js.map +1 -0
  47. package/dist/utils/index.d.ts +2 -0
  48. package/dist/{sample/felines/rto → utils}/index.js +2 -1
  49. package/dist/utils/index.js.map +1 -0
  50. package/dist/utils/path.utils.d.ts +2 -0
  51. package/dist/utils/path.utils.js +8 -0
  52. package/dist/utils/path.utils.js.map +1 -0
  53. package/package.json +54 -34
  54. package/.prettierrc +0 -5
  55. package/CHANGELOG.md +0 -26
  56. package/dist/interface/generator-options.interface.d.ts +0 -22
  57. package/dist/interface/generator-options.interface.js +0 -3
  58. package/dist/interface/generator-options.interface.js.map +0 -1
  59. package/dist/sample/app.module.d.ts +0 -2
  60. package/dist/sample/app.module.js +0 -20
  61. package/dist/sample/app.module.js.map +0 -1
  62. package/dist/sample/common.d.ts +0 -3
  63. package/dist/sample/common.js +0 -40
  64. package/dist/sample/common.js.map +0 -1
  65. package/dist/sample/constants.d.ts +0 -12
  66. package/dist/sample/constants.js +0 -16
  67. package/dist/sample/constants.js.map +0 -1
  68. package/dist/sample/felines/class/cat.class.d.ts +0 -4
  69. package/dist/sample/felines/class/cat.class.js +0 -24
  70. package/dist/sample/felines/class/cat.class.js.map +0 -1
  71. package/dist/sample/felines/class/feline.class.d.ts +0 -19
  72. package/dist/sample/felines/class/feline.class.js +0 -20
  73. package/dist/sample/felines/class/feline.class.js.map +0 -1
  74. package/dist/sample/felines/class/index.d.ts +0 -5
  75. package/dist/sample/felines/class/index.js +0 -22
  76. package/dist/sample/felines/class/index.js.map +0 -1
  77. package/dist/sample/felines/class/lion.class.d.ts +0 -4
  78. package/dist/sample/felines/class/lion.class.js +0 -8
  79. package/dist/sample/felines/class/lion.class.js.map +0 -1
  80. package/dist/sample/felines/class/message.class.d.ts +0 -7
  81. package/dist/sample/felines/class/message.class.js +0 -28
  82. package/dist/sample/felines/class/message.class.js.map +0 -1
  83. package/dist/sample/felines/class/tiger.class.d.ts +0 -4
  84. package/dist/sample/felines/class/tiger.class.js +0 -8
  85. package/dist/sample/felines/class/tiger.class.js.map +0 -1
  86. package/dist/sample/felines/dto/create-feline.dto.d.ts +0 -4
  87. package/dist/sample/felines/dto/create-feline.dto.js +0 -28
  88. package/dist/sample/felines/dto/create-feline.dto.js.map +0 -1
  89. package/dist/sample/felines/dto/index.d.ts +0 -2
  90. package/dist/sample/felines/dto/index.js +0 -19
  91. package/dist/sample/felines/dto/index.js.map +0 -1
  92. package/dist/sample/felines/dto/journaling-data.dto.d.ts +0 -4
  93. package/dist/sample/felines/dto/journaling-data.dto.js +0 -8
  94. package/dist/sample/felines/dto/journaling-data.dto.js.map +0 -1
  95. package/dist/sample/felines/felines.constants.d.ts +0 -1
  96. package/dist/sample/felines/felines.constants.js +0 -5
  97. package/dist/sample/felines/felines.constants.js.map +0 -1
  98. package/dist/sample/felines/felines.controller.d.ts +0 -15
  99. package/dist/sample/felines/felines.controller.js +0 -101
  100. package/dist/sample/felines/felines.controller.js.map +0 -1
  101. package/dist/sample/felines/felines.gateway.d.ts +0 -16
  102. package/dist/sample/felines/felines.gateway.js +0 -90
  103. package/dist/sample/felines/felines.gateway.js.map +0 -1
  104. package/dist/sample/felines/felines.module.d.ts +0 -2
  105. package/dist/sample/felines/felines.module.js +0 -28
  106. package/dist/sample/felines/felines.module.js.map +0 -1
  107. package/dist/sample/felines/felines.service.d.ts +0 -8
  108. package/dist/sample/felines/felines.service.js +0 -33
  109. package/dist/sample/felines/felines.service.js.map +0 -1
  110. package/dist/sample/felines/rto/feline.rto.d.ts +0 -7
  111. package/dist/sample/felines/rto/feline.rto.js +0 -31
  112. package/dist/sample/felines/rto/feline.rto.js.map +0 -1
  113. package/dist/sample/felines/rto/index.d.ts +0 -1
  114. package/dist/sample/felines/rto/index.js.map +0 -1
  115. package/dist/sample/index.d.ts +0 -3
  116. package/dist/sample/index.js +0 -20
  117. package/dist/sample/index.js.map +0 -1
  118. package/dist/sample/main.d.ts +0 -1
  119. package/dist/sample/main.js +0 -30
  120. package/dist/sample/main.js.map +0 -1
  121. package/dist/src/asyncapi-document.builder.d.ts +0 -27
  122. package/dist/src/asyncapi-document.builder.js +0 -110
  123. package/dist/src/asyncapi-document.builder.js.map +0 -1
  124. package/dist/src/asyncapi.constants.d.ts +0 -6
  125. package/dist/src/asyncapi.constants.js +0 -11
  126. package/dist/src/asyncapi.constants.js.map +0 -1
  127. package/dist/src/asyncapi.module.d.ts +0 -8
  128. package/dist/src/asyncapi.module.js +0 -47
  129. package/dist/src/asyncapi.module.js.map +0 -1
  130. package/dist/src/binding/asyncapi.amqp.interfaces.d.ts +0 -38
  131. package/dist/src/binding/asyncapi.amqp.interfaces.js +0 -3
  132. package/dist/src/binding/asyncapi.amqp.interfaces.js.map +0 -1
  133. package/dist/src/binding/asyncapi.kafka.interfaces.d.ts +0 -21
  134. package/dist/src/binding/asyncapi.kafka.interfaces.js +0 -3
  135. package/dist/src/binding/asyncapi.kafka.interfaces.js.map +0 -1
  136. package/dist/src/binding/index.d.ts +0 -2
  137. package/dist/src/binding/index.js +0 -19
  138. package/dist/src/binding/index.js.map +0 -1
  139. package/dist/src/decorators/asyncapi-operation-for-meta-key.decorator.d.ts +0 -2
  140. package/dist/src/decorators/asyncapi-operation-for-meta-key.decorator.js +0 -37
  141. package/dist/src/decorators/asyncapi-operation-for-meta-key.decorator.js.map +0 -1
  142. package/dist/src/decorators/asyncapi-operation.decorator.d.ts +0 -2
  143. package/dist/src/decorators/asyncapi-operation.decorator.js +0 -9
  144. package/dist/src/decorators/asyncapi-operation.decorator.js.map +0 -1
  145. package/dist/src/decorators/asyncapi-pub.decorator.d.ts +0 -2
  146. package/dist/src/decorators/asyncapi-pub.decorator.js +0 -10
  147. package/dist/src/decorators/asyncapi-pub.decorator.js.map +0 -1
  148. package/dist/src/decorators/asyncapi-service.decorator.d.ts +0 -1
  149. package/dist/src/decorators/asyncapi-service.decorator.js +0 -9
  150. package/dist/src/decorators/asyncapi-service.decorator.js.map +0 -1
  151. package/dist/src/decorators/asyncapi-sub.decorator.d.ts +0 -2
  152. package/dist/src/decorators/asyncapi-sub.decorator.js +0 -10
  153. package/dist/src/decorators/asyncapi-sub.decorator.js.map +0 -1
  154. package/dist/src/decorators/index.d.ts +0 -4
  155. package/dist/src/decorators/index.js +0 -21
  156. package/dist/src/decorators/index.js.map +0 -1
  157. package/dist/src/explorers/asyncapi-class.explorer.d.ts +0 -5
  158. package/dist/src/explorers/asyncapi-class.explorer.js +0 -27
  159. package/dist/src/explorers/asyncapi-class.explorer.js.map +0 -1
  160. package/dist/src/explorers/asyncapi-operation.explorer.d.ts +0 -17
  161. package/dist/src/explorers/asyncapi-operation.explorer.js +0 -26
  162. package/dist/src/explorers/asyncapi-operation.explorer.js.map +0 -1
  163. package/dist/src/explorers/index.d.ts +0 -2
  164. package/dist/src/explorers/index.js +0 -19
  165. package/dist/src/explorers/index.js.map +0 -1
  166. package/dist/src/index.d.ts +0 -4
  167. package/dist/src/index.js +0 -21
  168. package/dist/src/index.js.map +0 -1
  169. package/dist/src/interface/asyncapi-common.interfaces.d.ts +0 -126
  170. package/dist/src/interface/asyncapi-common.interfaces.js +0 -3
  171. package/dist/src/interface/asyncapi-common.interfaces.js.map +0 -1
  172. package/dist/src/interface/asyncapi-document-options.interface.d.ts +0 -3
  173. package/dist/src/interface/asyncapi-document-options.interface.js +0 -3
  174. package/dist/src/interface/asyncapi-document-options.interface.js.map +0 -1
  175. package/dist/src/interface/asyncapi-message.interface.d.ts +0 -8
  176. package/dist/src/interface/asyncapi-message.interface.js +0 -3
  177. package/dist/src/interface/asyncapi-message.interface.js.map +0 -1
  178. package/dist/src/interface/asyncapi-operation-headers.interface.d.ts +0 -6
  179. package/dist/src/interface/asyncapi-operation-headers.interface.js +0 -3
  180. package/dist/src/interface/asyncapi-operation-headers.interface.js.map +0 -1
  181. package/dist/src/interface/asyncapi-operation-options-raw.interface.d.ts +0 -21
  182. package/dist/src/interface/asyncapi-operation-options-raw.interface.js +0 -3
  183. package/dist/src/interface/asyncapi-operation-options-raw.interface.js.map +0 -1
  184. package/dist/src/interface/asyncapi-operation-options.interface.d.ts +0 -8
  185. package/dist/src/interface/asyncapi-operation-options.interface.js +0 -3
  186. package/dist/src/interface/asyncapi-operation-options.interface.js.map +0 -1
  187. package/dist/src/interface/asyncapi-operation-payload.interface.d.ts +0 -2
  188. package/dist/src/interface/asyncapi-operation-payload.interface.js +0 -3
  189. package/dist/src/interface/asyncapi-operation-payload.interface.js.map +0 -1
  190. package/dist/src/interface/asyncapi-server.interface.d.ts +0 -10
  191. package/dist/src/interface/asyncapi-server.interface.js +0 -3
  192. package/dist/src/interface/asyncapi-server.interface.js.map +0 -1
  193. package/dist/src/interface/asyncapi-template-options.interface.d.ts +0 -7
  194. package/dist/src/interface/asyncapi-template-options.interface.js +0 -3
  195. package/dist/src/interface/asyncapi-template-options.interface.js.map +0 -1
  196. package/dist/src/interface/denormalized-doc-resolvers.interface.d.ts +0 -6
  197. package/dist/src/interface/denormalized-doc-resolvers.interface.js +0 -3
  198. package/dist/src/interface/denormalized-doc-resolvers.interface.js.map +0 -1
  199. package/dist/src/interface/denormalized-doc.interface.d.ts +0 -10
  200. package/dist/src/interface/denormalized-doc.interface.js +0 -3
  201. package/dist/src/interface/denormalized-doc.interface.js.map +0 -1
  202. package/dist/src/interface/generator-options.interface.d.ts +0 -22
  203. package/dist/src/interface/generator-options.interface.js +0 -3
  204. package/dist/src/interface/generator-options.interface.js.map +0 -1
  205. package/dist/src/interface/index.d.ts +0 -11
  206. package/dist/src/interface/index.js +0 -28
  207. package/dist/src/interface/index.js.map +0 -1
  208. package/dist/src/services/asyncapi.explorer.d.ts +0 -12
  209. package/dist/src/services/asyncapi.explorer.js +0 -69
  210. package/dist/src/services/asyncapi.explorer.js.map +0 -1
  211. package/dist/src/services/asyncapi.generator.d.ts +0 -6
  212. package/dist/src/services/asyncapi.generator.js +0 -68
  213. package/dist/src/services/asyncapi.generator.js.map +0 -1
  214. package/dist/src/services/asyncapi.scanner.d.ts +0 -14
  215. package/dist/src/services/asyncapi.scanner.js +0 -71
  216. package/dist/src/services/asyncapi.scanner.js.map +0 -1
  217. package/dist/src/services/asyncapi.transformer.d.ts +0 -4
  218. package/dist/src/services/asyncapi.transformer.js +0 -33
  219. package/dist/src/services/asyncapi.transformer.js.map +0 -1
  220. package/dist/src/services/index.d.ts +0 -4
  221. package/dist/src/services/index.js +0 -21
  222. package/dist/src/services/index.js.map +0 -1
  223. package/dist/src/services/operation-object.factory.d.ts +0 -9
  224. package/dist/src/services/operation-object.factory.js +0 -37
  225. package/dist/src/services/operation-object.factory.js.map +0 -1
  226. package/dist/test/configs/jest-base.config.d.ts +0 -3
  227. package/dist/test/configs/jest-base.config.js +0 -20
  228. package/dist/test/configs/jest-base.config.js.map +0 -1
  229. package/dist/test/configs/jest-e2e.config.d.ts +0 -3
  230. package/dist/test/configs/jest-e2e.config.js +0 -16
  231. package/dist/test/configs/jest-e2e.config.js.map +0 -1
  232. package/dist/test/express.e2e-spec.d.ts +0 -1
  233. package/dist/test/express.e2e-spec.js +0 -89
  234. package/dist/test/express.e2e-spec.js.map +0 -1
  235. package/dist/test/fastify.e2e-spec.d.ts +0 -1
  236. package/dist/test/fastify.e2e-spec.js +0 -57
  237. package/dist/test/fastify.e2e-spec.js.map +0 -1
  238. package/dist/tsconfig.tsbuildinfo +0 -1
  239. package/eslint.config.mjs +0 -21
  240. package/misc/references/ref.html +0 -303
  241. package/misc/references/ref.json +0 -1
  242. package/misc/references/ref.yaml +0 -292
  243. package/misc/take-snaphots.sh +0 -8
  244. package/sample/app.module.ts +0 -7
  245. package/sample/common.ts +0 -49
  246. package/sample/constants.ts +0 -12
  247. package/sample/felines/class/cat.class.ts +0 -9
  248. package/sample/felines/class/feline.class.ts +0 -29
  249. package/sample/felines/class/index.ts +0 -5
  250. package/sample/felines/class/lion.class.ts +0 -5
  251. package/sample/felines/class/message.class.ts +0 -17
  252. package/sample/felines/class/tiger.class.ts +0 -5
  253. package/sample/felines/dto/create-feline.dto.ts +0 -13
  254. package/sample/felines/dto/index.ts +0 -2
  255. package/sample/felines/dto/journaling-data.dto.ts +0 -5
  256. package/sample/felines/felines.constants.ts +0 -1
  257. package/sample/felines/felines.controller.ts +0 -76
  258. package/sample/felines/felines.gateway.ts +0 -76
  259. package/sample/felines/felines.module.ts +0 -15
  260. package/sample/felines/felines.service.ts +0 -24
  261. package/sample/felines/rto/feline.rto.ts +0 -17
  262. package/sample/felines/rto/index.ts +0 -1
  263. package/sample/index.ts +0 -3
  264. package/sample/main.ts +0 -34
  265. package/src/asyncapi-document.builder.ts +0 -172
  266. package/src/asyncapi.constants.ts +0 -8
  267. package/src/asyncapi.module.ts +0 -65
  268. package/src/binding/asyncapi.amqp.interfaces.ts +0 -48
  269. package/src/binding/asyncapi.kafka.interfaces.ts +0 -35
  270. package/src/binding/index.ts +0 -2
  271. package/src/decorators/asyncapi-operation-for-meta-key.decorator.ts +0 -58
  272. package/src/decorators/asyncapi-operation.decorator.ts +0 -7
  273. package/src/decorators/asyncapi-pub.decorator.ts +0 -11
  274. package/src/decorators/asyncapi-service.decorator.ts +0 -9
  275. package/src/decorators/asyncapi-sub.decorator.ts +0 -11
  276. package/src/decorators/index.ts +0 -4
  277. package/src/explorers/asyncapi-class.explorer.ts +0 -26
  278. package/src/explorers/asyncapi-operation.explorer.ts +0 -40
  279. package/src/explorers/index.ts +0 -2
  280. package/src/index.ts +0 -4
  281. package/src/interface/asyncapi-common.interfaces.ts +0 -169
  282. package/src/interface/asyncapi-document-options.interface.ts +0 -3
  283. package/src/interface/asyncapi-message.interface.ts +0 -10
  284. package/src/interface/asyncapi-operation-headers.interface.ts +0 -6
  285. package/src/interface/asyncapi-operation-options-raw.interface.ts +0 -23
  286. package/src/interface/asyncapi-operation-options.interface.ts +0 -10
  287. package/src/interface/asyncapi-operation-payload.interface.ts +0 -3
  288. package/src/interface/asyncapi-server.interface.ts +0 -11
  289. package/src/interface/asyncapi-template-options.interface.ts +0 -20
  290. package/src/interface/denormalized-doc-resolvers.interface.ts +0 -6
  291. package/src/interface/denormalized-doc.interface.ts +0 -6
  292. package/src/interface/generator-options.interface.ts +0 -21
  293. package/src/interface/index.ts +0 -12
  294. package/src/services/asyncapi.explorer.ts +0 -112
  295. package/src/services/asyncapi.generator.ts +0 -45
  296. package/src/services/asyncapi.scanner.ts +0 -105
  297. package/src/services/asyncapi.transformer.ts +0 -33
  298. package/src/services/index.ts +0 -4
  299. package/src/services/operation-object.factory.ts +0 -55
  300. package/test/__mocks__/@asyncapi/generator.js +0 -41
  301. package/test/configs/jest-base.config.ts +0 -19
  302. package/test/configs/jest-e2e.config.js +0 -7
  303. package/test/configs/jest-e2e.config.ts +0 -19
  304. package/test/configs/jest-swagger-plugin.js +0 -16
  305. package/test/express.e2e-spec.ts +0 -64
  306. package/test/fastify.e2e-spec.ts +0 -65
  307. package/tsconfig.build.json +0 -4
  308. package/tsconfig.json +0 -8
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AsyncapiScanner = void 0;
4
- const constants_1 = require("@nestjs/common/constants");
5
- const model_properties_accessor_1 = require("@nestjs/swagger/dist/services/model-properties-accessor");
6
- const schema_object_factory_1 = require("@nestjs/swagger/dist/services/schema-object-factory");
7
- const swagger_types_mapper_1 = require("@nestjs/swagger/dist/services/swagger-types-mapper");
8
- const strip_last_slash_util_1 = require("@nestjs/swagger/dist/utils/strip-last-slash.util");
9
- const lodash_1 = require("lodash");
10
- const asyncapi_explorer_1 = require("./asyncapi.explorer");
11
- const asyncapi_transformer_1 = require("./asyncapi.transformer");
12
- class AsyncapiScanner {
13
- constructor() {
14
- this.transformer = new asyncapi_transformer_1.AsyncapiTransformer();
15
- this.explorer = new asyncapi_explorer_1.AsyncApiExplorer();
16
- this.modelPropertiesAccessor = new model_properties_accessor_1.ModelPropertiesAccessor();
17
- this.swaggerTypesMapper = new swagger_types_mapper_1.SwaggerTypesMapper();
18
- this.schemaObjectFactory = new schema_object_factory_1.SchemaObjectFactory(this.modelPropertiesAccessor, this.swaggerTypesMapper);
19
- }
20
- scanApplication(app, options) {
21
- const { deepScanRoutes, include: includedModules = [], extraModels = [], ignoreGlobalPrefix = false, operationIdFactory, } = options;
22
- const { container } = app;
23
- const modules = this.getModules(container.getModules(), includedModules);
24
- const globalPrefix = !ignoreGlobalPrefix ? (0, strip_last_slash_util_1.stripLastSlash)(this.getGlobalPrefix(app)) : '';
25
- const denormalizedChannels = modules.reduce((channels, { providers, metatype, imports, controllers }) => {
26
- let allProviders = new Map([...providers, ...controllers]);
27
- if (deepScanRoutes) {
28
- const isGlobal = (module) => !container.isGlobalModule(module);
29
- Array.from(imports.values())
30
- .filter(isGlobal)
31
- .map(({ providers: relatedProviders, controllers: relatedControllers }) => ({
32
- relatedProviders,
33
- relatedControllers,
34
- }))
35
- .forEach(({ relatedProviders, relatedControllers }) => {
36
- allProviders = new Map([...allProviders, ...relatedProviders, ...relatedControllers]);
37
- });
38
- }
39
- const path = metatype ? Reflect.getMetadata(constants_1.MODULE_PATH, metatype) : undefined;
40
- return [...channels, ...this.scanModuleProviders(allProviders, path, globalPrefix, operationIdFactory)];
41
- }, []);
42
- const schemas = this.explorer.getSchemas();
43
- this.addExtraModels(schemas, extraModels);
44
- const normalizedChannels = this.transformer.normalizeChannels((0, lodash_1.flatten)(denormalizedChannels));
45
- return Object.assign(Object.assign({}, normalizedChannels), { components: { schemas } });
46
- }
47
- scanModuleProviders(providers, modulePath, globalPrefix, operationIdFactory) {
48
- const denormalizedArray = [...providers.values()].reduce((denormalized, prov) => {
49
- const object = this.explorer.explorerAsyncapiServices(prov, modulePath, globalPrefix, operationIdFactory);
50
- return [...denormalized, ...object];
51
- }, []);
52
- return (0, lodash_1.flatten)(denormalizedArray);
53
- }
54
- getModules(modulesContainer, include) {
55
- if (!include || (0, lodash_1.isEmpty)(include)) {
56
- return [...modulesContainer.values()];
57
- }
58
- return [...modulesContainer.values()].filter(({ metatype }) => include.some((item) => item === metatype));
59
- }
60
- getGlobalPrefix(app) {
61
- const internalConfigRef = app.config;
62
- return (internalConfigRef === null || internalConfigRef === void 0 ? void 0 : internalConfigRef.getGlobalPrefix()) || '';
63
- }
64
- addExtraModels(schemas, extraModels) {
65
- extraModels.forEach((item) => {
66
- this.schemaObjectFactory.exploreModelSchema(item, schemas);
67
- });
68
- }
69
- }
70
- exports.AsyncapiScanner = AsyncapiScanner;
71
- //# sourceMappingURL=asyncapi.scanner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asyncapi.scanner.js","sourceRoot":"","sources":["../../../src/services/asyncapi.scanner.ts"],"names":[],"mappings":";;;AACA,wDAAuD;AAKvD,uGAAkG;AAClG,+FAA0F;AAC1F,6FAAwF;AACxF,4FAAkF;AAClF,mCAA0C;AAE1C,2DAAuD;AACvD,iEAA6D;AAE7D,MAAa,eAAe;IAA5B;QACmB,gBAAW,GAAG,IAAI,0CAAmB,EAAE,CAAC;QAExC,aAAQ,GAAG,IAAI,oCAAgB,EAAE,CAAC;QAElC,4BAAuB,GAAG,IAAI,mDAAuB,EAAE,CAAC;QAExD,uBAAkB,GAAG,IAAI,yCAAkB,EAAE,CAAC;QAE9C,wBAAmB,GAAG,IAAI,2CAAmB,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,k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IAEO,UAAU,CAAC,gBAAqC,EAAE,OAAmB;QAC3E,IAAI,CAAC,OAAO,IAAI,IAAA,gBAAO,EAAC,OAAO,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC;IAC5G,CAAC;IAEO,eAAe,CAAC,GAA4B;QAClD,MAAM,iBAAiB,GAAI,GAAW,CAAC,MAAM,CAAC;QAC9C,OAAO,CAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,eAAe,EAAE,KAAI,EAAE,CAAC;IACpD,CAAC;IAEO,cAAc,CAAC,OAAqC,EAAE,WAAuB;QACnF,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC3B,IAAI,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAzFD,0CAyFC"}
@@ -1,4 +0,0 @@
1
- import { AsyncChannelsObject, DenormalizedDoc } from '../interface';
2
- export declare class AsyncapiTransformer {
3
- normalizeChannels(denormalizedDocs: DenormalizedDoc[]): Record<'channels', AsyncChannelsObject>;
4
- }
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AsyncapiTransformer = void 0;
4
- class AsyncapiTransformer {
5
- normalizeChannels(denormalizedDocs) {
6
- const flatChannels = denormalizedDocs.map((doc) => {
7
- var _a, _b, _c, _d, _e, _f;
8
- const key = (_a = doc.root) === null || _a === void 0 ? void 0 : _a.name;
9
- const value = {
10
- description: (_b = doc.root) === null || _b === void 0 ? void 0 : _b.description,
11
- bindings: (_c = doc.root) === null || _c === void 0 ? void 0 : _c.bindings,
12
- parameters: (_d = doc.root) === null || _d === void 0 ? void 0 : _d.parameters,
13
- subscribe: (_e = doc.operations) === null || _e === void 0 ? void 0 : _e.sub,
14
- publish: (_f = doc.operations) === null || _f === void 0 ? void 0 : _f.pub,
15
- };
16
- return { key, value };
17
- });
18
- const channels = flatChannels.reduce((acc, { key, value }) => {
19
- var _a, _b;
20
- if (!key)
21
- return acc;
22
- if (!acc[key]) {
23
- acc[key] = value;
24
- }
25
- acc[key].publish = (_a = acc[key].publish) !== null && _a !== void 0 ? _a : value.publish;
26
- acc[key].subscribe = (_b = acc[key].subscribe) !== null && _b !== void 0 ? _b : value.subscribe;
27
- return acc;
28
- }, {});
29
- return { channels };
30
- }
31
- }
32
- exports.AsyncapiTransformer = AsyncapiTransformer;
33
- //# sourceMappingURL=asyncapi.transformer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asyncapi.transformer.js","sourceRoot":"","sources":["../../../src/services/asyncapi.transformer.ts"],"names":[],"mappings":";;;AAEA,MAAa,mBAAmB;IACvB,iBAAiB,CAAC,gBAAmC;QAC1D,MAAM,YAAY,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAoB,EAAE,EAAE;;YACjE,MAAM,GAAG,GAAG,MAAA,GAAG,CAAC,IAAI,0CAAE,IAAI,CAAC;YAC3B,MAAM,KAAK,GAAuB;gBAChC,WAAW,EAAE,MAAA,GAAG,CAAC,IAAI,0CAAE,WAAW;gBAClC,QAAQ,EAAE,MAAA,GAAG,CAAC,IAAI,0CAAE,QAAQ;gBAC5B,UAAU,EAAE,MAAA,GAAG,CAAC,IAAI,0CAAE,UAAU;gBAChC,SAAS,EAAE,MAAA,GAAG,CAAC,UAAU,0CAAE,GAAG;gBAC9B,OAAO,EAAE,MAAA,GAAG,CAAC,UAAU,0CAAE,GAAG;aAC7B,CAAC;YACF,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE;;YAE3D,IAAI,CAAC,GAAG;gBAAE,OAAO,GAAG,CAAC;YAErB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACd,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACnB,CAAC;YAED,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,GAAG,MAAA,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,mCAAI,KAAK,CAAC,OAAO,CAAC;YACrD,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,GAAG,MAAA,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,mCAAI,KAAK,CAAC,SAAS,CAAC;YAE3D,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAyB,CAAC,CAAC;QAE9B,OAAO,EAAE,QAAQ,EAAE,CAAC;IACtB,CAAC;CACF;AA9BD,kDA8BC"}
@@ -1,4 +0,0 @@
1
- export * from './asyncapi.generator';
2
- export * from './operation-object.factory';
3
- export * from './asyncapi.explorer';
4
- export * from './asyncapi.scanner';
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./asyncapi.generator"), exports);
18
- __exportStar(require("./operation-object.factory"), exports);
19
- __exportStar(require("./asyncapi.explorer"), exports);
20
- __exportStar(require("./asyncapi.scanner"), exports);
21
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,6DAA2C;AAC3C,sDAAoC;AACpC,qDAAmC"}
@@ -1,9 +0,0 @@
1
- import { SchemaObject } from '@nestjs/swagger/dist/interfaces/open-api-spec.interface';
2
- import { AsyncApiOperationOptionsRaw, AsyncOperationObject } from '../interface';
3
- export declare class OperationObjectFactory {
4
- private readonly modelPropertiesAccessor;
5
- private readonly swaggerTypesMapper;
6
- private readonly schemaObjectFactory;
7
- create(operation: AsyncApiOperationOptionsRaw, produces: string[], schemas: Record<string, SchemaObject>): AsyncOperationObject;
8
- private getDtoName;
9
- }
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OperationObjectFactory = void 0;
4
- const model_properties_accessor_1 = require("@nestjs/swagger/dist/services/model-properties-accessor");
5
- const schema_object_factory_1 = require("@nestjs/swagger/dist/services/schema-object-factory");
6
- const swagger_types_mapper_1 = require("@nestjs/swagger/dist/services/swagger-types-mapper");
7
- const utils_1 = require("@nestjs/swagger/dist/utils");
8
- class OperationObjectFactory {
9
- constructor() {
10
- this.modelPropertiesAccessor = new model_properties_accessor_1.ModelPropertiesAccessor();
11
- this.swaggerTypesMapper = new swagger_types_mapper_1.SwaggerTypesMapper();
12
- this.schemaObjectFactory = new schema_object_factory_1.SchemaObjectFactory(this.modelPropertiesAccessor, this.swaggerTypesMapper);
13
- }
14
- create(operation, produces, schemas) {
15
- const { message } = operation;
16
- const { oneOf } = message;
17
- if (oneOf) {
18
- return Object.assign(Object.assign({}, operation), { message: {
19
- oneOf: oneOf.map((i) => (Object.assign(Object.assign({}, i), { payload: {
20
- $ref: (0, utils_1.getSchemaPath)(this.getDtoName(i, schemas)),
21
- } }))),
22
- } });
23
- }
24
- return Object.assign(Object.assign({}, operation), { message: Object.assign(Object.assign({}, operation.message), { payload: {
25
- $ref: (0, utils_1.getSchemaPath)(this.getDtoName(message, schemas)),
26
- } }) });
27
- }
28
- getDtoName(message, schemas) {
29
- if (!message.payload || !message.payload.type) {
30
- throw new Error('Async message payload or payload.type is undefined; ensure message.payload is provided.');
31
- }
32
- const messagePayloadType = message.payload.type;
33
- return this.schemaObjectFactory.exploreModelSchema(messagePayloadType, schemas);
34
- }
35
- }
36
- exports.OperationObjectFactory = OperationObjectFactory;
37
- //# sourceMappingURL=operation-object.factory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operation-object.factory.js","sourceRoot":"","sources":["../../../src/services/operation-object.factory.ts"],"names":[],"mappings":";;;AACA,uGAAkG;AAClG,+FAA0F;AAC1F,6FAAwF;AACxF,sDAA2D;AAG3D,MAAa,sBAAsB;IAAnC;QACmB,4BAAuB,GAAG,IAAI,mDAAuB,EAAE,CAAC;QAExD,uBAAkB,GAAG,IAAI,yCAAkB,EAAE,CAAC;QAE9C,wBAAmB,GAAG,IAAI,2CAAmB,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IA0CxH,CAAC;IAxCC,MAAM,CACJ,SAAsC,EACtC,QAAkB,EAClB,OAAqC;QAErC,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;QAC9B,MAAM,EAAE,KAAK,EAAE,GAAG,OAA2B,CAAC;QAE9C,IAAI,KAAK,EAAE,CAAC;YACV,uCACK,SAAS,KACZ,OAAO,EAAE;oBACP,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iCACnB,CAAC,KACJ,OAAO,EAAE;4BACP,IAAI,EAAE,IAAA,qBAAa,EAAC,IAAI,CAAC,UAAU,CAAC,CAAuB,EAAE,OAAO,CAAC,CAAC;yBACvE,IACD,CAAC;iBACJ,IACD;QACJ,CAAC;QAED,uCACK,SAAS,KACZ,OAAO,kCACF,SAAS,CAAC,OAAO,KACpB,OAAO,EAAE;oBACP,IAAI,EAAE,IAAA,qBAAa,EAAC,IAAI,CAAC,UAAU,CAAC,OAA6B,EAAE,OAAO,CAAC,CAAC;iBAC7E,OAEH;IACJ,CAAC;IAEO,UAAU,CAAC,OAA2B,EAAE,OAAqC;QACnF,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,yFAAyF,CAAC,CAAC;QAC7G,CAAC;QACD,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,IAAgB,CAAC;QAC5D,OAAO,IAAI,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;CACF;AA/CD,wDA+CC"}
@@ -1,3 +0,0 @@
1
- import { JestConfigWithTsJest } from 'ts-jest';
2
- export declare const baseConfig: JestConfigWithTsJest;
3
- export default baseConfig;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.baseConfig = void 0;
4
- exports.baseConfig = {
5
- moduleFileExtensions: ['js', 'json', 'ts'],
6
- rootDir: '../../',
7
- transform: {
8
- '^.+\\.(t|j)s$': 'ts-jest',
9
- },
10
- collectCoverageFrom: ['**/*.(t|j)s'],
11
- coverageDirectory: './coverage',
12
- testEnvironment: 'node',
13
- moduleNameMapper: {
14
- '#lib(|/.*)$': '<rootDir>/lib/$1',
15
- '#sample(|/.*)$': '<rootDir>/sample/$1',
16
- '#test(|/.*)$': '<rootDir>/test/$1',
17
- },
18
- };
19
- exports.default = exports.baseConfig;
20
- //# sourceMappingURL=jest-base.config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest-base.config.js","sourceRoot":"","sources":["../../../test/configs/jest-base.config.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAyB;IAC9C,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC;IAC1C,OAAO,EAAE,QAAQ;IACjB,SAAS,EAAE;QACT,eAAe,EAAE,SAAS;KAC3B;IACD,mBAAmB,EAAE,CAAC,aAAa,CAAC;IACpC,iBAAiB,EAAE,YAAY;IAC/B,eAAe,EAAE,MAAM;IACvB,gBAAgB,EAAE;QAChB,aAAa,EAAE,kBAAkB;QACjC,gBAAgB,EAAE,qBAAqB;QACvC,cAAc,EAAE,mBAAmB;KACpC;CACF,CAAC;AAEF,kBAAe,kBAAU,CAAC"}
@@ -1,3 +0,0 @@
1
- import { JestConfigWithTsJest } from 'ts-jest';
2
- export declare const e2eConfig: JestConfigWithTsJest;
3
- export default e2eConfig;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.e2eConfig = void 0;
4
- const jest_base_config_1 = require("./jest-base.config");
5
- exports.e2eConfig = Object.assign(Object.assign({}, jest_base_config_1.baseConfig), { testRegex: '.\\.e2e-spec\\.ts$', transform: {
6
- '^.+\\.(t|j)s$': [
7
- 'ts-jest',
8
- {
9
- astTransformers: {
10
- before: ['test/configs/jest-swagger-plugin.js'],
11
- },
12
- },
13
- ],
14
- } });
15
- exports.default = exports.e2eConfig;
16
- //# sourceMappingURL=jest-e2e.config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest-e2e.config.js","sourceRoot":"","sources":["../../../test/configs/jest-e2e.config.ts"],"names":[],"mappings":";;;AACA,yDAAgD;AAEnC,QAAA,SAAS,mCACjB,6BAAU,KACb,SAAS,EAAE,oBAAoB,EAC/B,SAAS,EAAE;QACT,eAAe,EAAE;YACf,SAAS;YACT;gBACE,eAAe,EAAE;oBACf,MAAM,EAAE,CAAC,qCAAqC,CAAC;iBAChD;aACF;SACF;KACF,IACD;AAEF,kBAAe,iBAAS,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,89 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- const core_1 = require("@nestjs/core");
40
- const platform_express_1 = require("@nestjs/platform-express");
41
- const fs = __importStar(require("fs/promises"));
42
- const js_yaml_1 = __importDefault(require("js-yaml"));
43
- const supertest_1 = __importDefault(require("supertest"));
44
- const src_1 = require("../src");
45
- const app_module_1 = require("../sample/app.module");
46
- const common_1 = require("../sample/common");
47
- const constants_1 = require("../sample/constants");
48
- describe('Express AsyncAPI', () => {
49
- let app;
50
- beforeAll(async () => {
51
- app = await core_1.NestFactory.create(app_module_1.AppModule, new platform_express_1.ExpressAdapter(), { logger: false });
52
- const asyncapiDocument = await (0, common_1.makeAsyncapiDocument)(app);
53
- await src_1.AsyncApiModule.setup(constants_1.DOC_RELATIVE_PATH, app, asyncapiDocument);
54
- await app.init();
55
- });
56
- it('should serve doc html', async () => {
57
- const { text } = await (0, supertest_1.default)(app.getHttpServer())
58
- .get(constants_1.DOC_RELATIVE_PATH)
59
- .expect(200)
60
- .expect('Content-Type', /text\/html/);
61
- const htmlSample = await fs.readFile('./misc/references/ref.html', {
62
- encoding: 'utf8',
63
- });
64
- expect(text).toEqual(htmlSample);
65
- });
66
- it('should serve doc json', async () => {
67
- const { text } = await (0, supertest_1.default)(app.getHttpServer())
68
- .get(`${constants_1.DOC_RELATIVE_PATH}-json`)
69
- .expect(200)
70
- .expect('Content-Type', /application\/json/);
71
- const jsonFetched = JSON.parse(text);
72
- const jsonReferenceSample = JSON.parse(await fs.readFile('./misc/references/ref.json', {
73
- encoding: 'utf8',
74
- }));
75
- expect(jsonFetched).toEqual(jsonReferenceSample);
76
- });
77
- it('should serve doc yaml', async () => {
78
- const { text } = await (0, supertest_1.default)(app.getHttpServer())
79
- .get(`${constants_1.DOC_RELATIVE_PATH}-yaml`)
80
- .expect(200)
81
- .expect('Content-Type', /text\/yaml/);
82
- const yamlFetched = js_yaml_1.default.load(text);
83
- const yamlReferenceSample = js_yaml_1.default.load(await fs.readFile('./misc/references/ref.yaml', {
84
- encoding: 'utf8',
85
- }));
86
- expect(yamlFetched).toEqual(yamlReferenceSample);
87
- });
88
- });
89
- //# sourceMappingURL=express.e2e-spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"express.e2e-spec.js","sourceRoot":"","sources":["../../test/express.e2e-spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;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AG,6BAAiB,OAAO,CAAC;aAChC,MAAM,CAAC,GAAG,CAAC;aACX,MAAM,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAC;QAE/C,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,mBAAmB,GAAG,IAAI,CAAC,KAAK,CACpC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,EAAE;YAC9C,QAAQ,EAAE,MAAM;SACjB,CAAC,CACH,CAAC;QAEF,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,mBAAO,EAAC,GAAG,CAAC,aAAa,EAAE,CAAC;aAChD,GAAG,CAAC,GAAG,6BAAiB,OAAO,CAAC;aAChC,MAAM,CAAC,GAAG,CAAC;aACX,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QAExC,MAAM,WAAW,GAAG,iBAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,mBAAmB,GAAG,iBAAM,CAAC,IAAI,CACrC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,EAAE;YAC9C,QAAQ,EAAE,MAAM;SACjB,CAAC,CACH,CAAC;QAEF,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const core_1 = require("@nestjs/core");
7
- const platform_fastify_1 = require("@nestjs/platform-fastify");
8
- const promises_1 = __importDefault(require("fs/promises"));
9
- const js_yaml_1 = __importDefault(require("js-yaml"));
10
- const supertest_1 = __importDefault(require("supertest"));
11
- const src_1 = require("../src");
12
- const app_module_1 = require("../sample/app.module");
13
- const common_1 = require("../sample/common");
14
- const constants_1 = require("../sample/constants");
15
- describe('Fastify AsyncAPI', () => {
16
- let app;
17
- beforeAll(async () => {
18
- app = await core_1.NestFactory.create(app_module_1.AppModule, new platform_fastify_1.FastifyAdapter(), { logger: false });
19
- const asyncapiDocument = await (0, common_1.makeAsyncapiDocument)(app);
20
- await src_1.AsyncApiModule.setup(constants_1.DOC_RELATIVE_PATH, app, asyncapiDocument);
21
- await app.init();
22
- await app.getHttpAdapter().getInstance().ready();
23
- });
24
- it('should serve doc html', async () => {
25
- const { text } = await (0, supertest_1.default)(app.getHttpServer())
26
- .get(constants_1.DOC_RELATIVE_PATH)
27
- .expect(200)
28
- .expect('Content-Type', /text\/html/);
29
- const htmlSample = await promises_1.default.readFile('./misc/references/ref.html', {
30
- encoding: 'utf8',
31
- });
32
- expect(text).toEqual(htmlSample);
33
- });
34
- it('should serve doc json', async () => {
35
- const { text } = await (0, supertest_1.default)(app.getHttpServer())
36
- .get(`${constants_1.DOC_RELATIVE_PATH}-json`)
37
- .expect(200)
38
- .expect('Content-Type', /application\/json/);
39
- const jsonFetched = JSON.parse(text);
40
- const jsonReferenceSample = JSON.parse(await promises_1.default.readFile('./misc/references/ref.json', {
41
- encoding: 'utf8',
42
- }));
43
- expect(jsonFetched).toEqual(jsonReferenceSample);
44
- });
45
- it('should serve doc yaml', async () => {
46
- const { text } = await (0, supertest_1.default)(app.getHttpServer())
47
- .get(`${constants_1.DOC_RELATIVE_PATH}-yaml`)
48
- .expect(200)
49
- .expect('Content-Type', /text\/yaml/);
50
- const yamlFetched = js_yaml_1.default.load(text);
51
- const yamlReferenceSample = js_yaml_1.default.load(await promises_1.default.readFile('./misc/references/ref.yaml', {
52
- encoding: 'utf8',
53
- }));
54
- expect(yamlFetched).toEqual(yamlReferenceSample);
55
- });
56
- });
57
- //# sourceMappingURL=fastify.e2e-spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fastify.e2e-spec.js","sourceRoot":"","sources":["../../test/fastify.e2e-spec.ts"],"names":[],"mappings":";;;;;AAAA,uCAA2C;AAC3C,+DAAkF;AAClF,2DAA6B;AAC7B,sDAA6B;AAC7B,0DAAgC;AAChC,gCAAwC;AACxC,qDAAiD;AACjD,6CAAwD;AACxD,mDAAwD;AAExD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,GAA2B,CAAC;IAEhC,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAyB,sBAAS,EAAE,IAAI,iCAAc,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3G,MAAM,gBAAgB,GAAG,MAAM,IAAA,6BAAoB,EAAC,GAAG,CAAC,CAAC;QACzD,MAAM,oBAAc,CAAC,KAAK,CAAC,6BAAiB,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;QAErE,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,MAAM,GAAG,CAAC,cAAc,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,mBAAO,EAAC,GAAG,CAAC,aAAa,EAAE,CAAC;aAChD,GAAG,CAAC,6BAAiB,CAAC;aACtB,MAAM,CAAC,GAAG,CAAC;aACX,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QACxC,MAAM,UAAU,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,4BAA4B,EAAE;YACjE,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC;QACH,MAAM,CAAC,IA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