@achinet/nestjs-async 0.0.1 → 0.1.1

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 (248) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/decorators/asyncapi-operation-for-meta-key.decorator.js +1 -2
  3. package/dist/decorators/asyncapi-operation-for-meta-key.decorator.js.map +1 -1
  4. package/dist/decorators/asyncapi-operation.decorator.js +1 -2
  5. package/dist/decorators/asyncapi-operation.decorator.js.map +1 -1
  6. package/dist/decorators/asyncapi-pub.decorator.js +1 -2
  7. package/dist/decorators/asyncapi-pub.decorator.js.map +1 -1
  8. package/dist/decorators/asyncapi-service.decorator.js +1 -2
  9. package/dist/decorators/asyncapi-service.decorator.js.map +1 -1
  10. package/dist/decorators/asyncapi-sub.decorator.js +1 -2
  11. package/dist/decorators/asyncapi-sub.decorator.js.map +1 -1
  12. package/dist/explorers/asyncapi-operation.explorer.d.ts +8 -8
  13. package/dist/sample/app.module.d.ts +2 -0
  14. package/dist/sample/app.module.js +20 -0
  15. package/dist/sample/app.module.js.map +1 -0
  16. package/dist/sample/common.d.ts +3 -0
  17. package/dist/sample/common.js +40 -0
  18. package/dist/sample/common.js.map +1 -0
  19. package/dist/sample/constants.d.ts +12 -0
  20. package/dist/sample/constants.js +16 -0
  21. package/dist/sample/constants.js.map +1 -0
  22. package/dist/sample/felines/class/cat.class.d.ts +4 -0
  23. package/dist/sample/felines/class/cat.class.js +24 -0
  24. package/dist/sample/felines/class/cat.class.js.map +1 -0
  25. package/dist/sample/felines/class/feline.class.d.ts +19 -0
  26. package/dist/sample/felines/class/feline.class.js +20 -0
  27. package/dist/sample/felines/class/feline.class.js.map +1 -0
  28. package/dist/sample/felines/class/index.d.ts +5 -0
  29. package/dist/sample/felines/class/index.js +22 -0
  30. package/dist/sample/felines/class/index.js.map +1 -0
  31. package/dist/sample/felines/class/lion.class.d.ts +4 -0
  32. package/dist/sample/felines/class/lion.class.js +8 -0
  33. package/dist/sample/felines/class/lion.class.js.map +1 -0
  34. package/dist/sample/felines/class/message.class.d.ts +7 -0
  35. package/dist/sample/felines/class/message.class.js +28 -0
  36. package/dist/sample/felines/class/message.class.js.map +1 -0
  37. package/dist/sample/felines/class/tiger.class.d.ts +4 -0
  38. package/dist/sample/felines/class/tiger.class.js +8 -0
  39. package/dist/sample/felines/class/tiger.class.js.map +1 -0
  40. package/dist/sample/felines/dto/create-feline.dto.d.ts +4 -0
  41. package/dist/sample/felines/dto/create-feline.dto.js +28 -0
  42. package/dist/sample/felines/dto/create-feline.dto.js.map +1 -0
  43. package/dist/sample/felines/dto/index.d.ts +2 -0
  44. package/dist/sample/felines/dto/index.js +19 -0
  45. package/dist/sample/felines/dto/index.js.map +1 -0
  46. package/dist/sample/felines/dto/journaling-data.dto.d.ts +4 -0
  47. package/dist/sample/felines/dto/journaling-data.dto.js +8 -0
  48. package/dist/sample/felines/dto/journaling-data.dto.js.map +1 -0
  49. package/dist/sample/felines/felines.constants.d.ts +1 -0
  50. package/dist/sample/felines/felines.constants.js +5 -0
  51. package/dist/sample/felines/felines.constants.js.map +1 -0
  52. package/dist/sample/felines/felines.controller.d.ts +15 -0
  53. package/dist/sample/felines/felines.controller.js +101 -0
  54. package/dist/sample/felines/felines.controller.js.map +1 -0
  55. package/dist/sample/felines/felines.gateway.d.ts +16 -0
  56. package/dist/sample/felines/felines.gateway.js +90 -0
  57. package/dist/sample/felines/felines.gateway.js.map +1 -0
  58. package/dist/sample/felines/felines.module.d.ts +2 -0
  59. package/dist/sample/felines/felines.module.js +28 -0
  60. package/dist/sample/felines/felines.module.js.map +1 -0
  61. package/dist/sample/felines/felines.service.d.ts +8 -0
  62. package/dist/sample/felines/felines.service.js +33 -0
  63. package/dist/sample/felines/felines.service.js.map +1 -0
  64. package/dist/sample/felines/rto/feline.rto.d.ts +7 -0
  65. package/dist/sample/felines/rto/feline.rto.js +31 -0
  66. package/dist/sample/felines/rto/feline.rto.js.map +1 -0
  67. package/dist/sample/felines/rto/index.d.ts +1 -0
  68. package/dist/sample/felines/rto/index.js +18 -0
  69. package/dist/sample/felines/rto/index.js.map +1 -0
  70. package/dist/sample/index.d.ts +3 -0
  71. package/dist/sample/index.js +20 -0
  72. package/dist/sample/index.js.map +1 -0
  73. package/dist/sample/main.d.ts +1 -0
  74. package/dist/sample/main.js +30 -0
  75. package/dist/sample/main.js.map +1 -0
  76. package/dist/src/asyncapi-document.builder.d.ts +27 -0
  77. package/dist/src/asyncapi-document.builder.js +110 -0
  78. package/dist/src/asyncapi-document.builder.js.map +1 -0
  79. package/dist/src/asyncapi.constants.d.ts +6 -0
  80. package/dist/src/asyncapi.constants.js +11 -0
  81. package/dist/src/asyncapi.constants.js.map +1 -0
  82. package/dist/src/asyncapi.module.d.ts +8 -0
  83. package/dist/src/asyncapi.module.js +47 -0
  84. package/dist/src/asyncapi.module.js.map +1 -0
  85. package/dist/src/binding/asyncapi.amqp.interfaces.d.ts +38 -0
  86. package/dist/src/binding/asyncapi.amqp.interfaces.js +3 -0
  87. package/dist/src/binding/asyncapi.amqp.interfaces.js.map +1 -0
  88. package/dist/src/binding/asyncapi.kafka.interfaces.d.ts +21 -0
  89. package/dist/src/binding/asyncapi.kafka.interfaces.js +3 -0
  90. package/dist/src/binding/asyncapi.kafka.interfaces.js.map +1 -0
  91. package/dist/src/binding/index.d.ts +2 -0
  92. package/dist/src/binding/index.js +19 -0
  93. package/dist/src/binding/index.js.map +1 -0
  94. package/dist/src/decorators/asyncapi-operation-for-meta-key.decorator.d.ts +2 -0
  95. package/dist/src/decorators/asyncapi-operation-for-meta-key.decorator.js +37 -0
  96. package/dist/src/decorators/asyncapi-operation-for-meta-key.decorator.js.map +1 -0
  97. package/dist/src/decorators/asyncapi-operation.decorator.d.ts +2 -0
  98. package/dist/src/decorators/asyncapi-operation.decorator.js +9 -0
  99. package/dist/src/decorators/asyncapi-operation.decorator.js.map +1 -0
  100. package/dist/src/decorators/asyncapi-pub.decorator.d.ts +2 -0
  101. package/dist/src/decorators/asyncapi-pub.decorator.js +10 -0
  102. package/dist/src/decorators/asyncapi-pub.decorator.js.map +1 -0
  103. package/dist/src/decorators/asyncapi-service.decorator.d.ts +1 -0
  104. package/dist/src/decorators/asyncapi-service.decorator.js +9 -0
  105. package/dist/src/decorators/asyncapi-service.decorator.js.map +1 -0
  106. package/dist/src/decorators/asyncapi-sub.decorator.d.ts +2 -0
  107. package/dist/src/decorators/asyncapi-sub.decorator.js +10 -0
  108. package/dist/src/decorators/asyncapi-sub.decorator.js.map +1 -0
  109. package/dist/src/decorators/index.d.ts +4 -0
  110. package/dist/src/decorators/index.js +21 -0
  111. package/dist/src/decorators/index.js.map +1 -0
  112. package/dist/src/explorers/asyncapi-class.explorer.d.ts +5 -0
  113. package/dist/src/explorers/asyncapi-class.explorer.js +27 -0
  114. package/dist/src/explorers/asyncapi-class.explorer.js.map +1 -0
  115. package/dist/src/explorers/asyncapi-operation.explorer.d.ts +17 -0
  116. package/dist/src/explorers/asyncapi-operation.explorer.js +26 -0
  117. package/dist/src/explorers/asyncapi-operation.explorer.js.map +1 -0
  118. package/dist/src/explorers/index.d.ts +2 -0
  119. package/dist/src/explorers/index.js +19 -0
  120. package/dist/src/explorers/index.js.map +1 -0
  121. package/dist/src/index.d.ts +4 -0
  122. package/dist/src/index.js +21 -0
  123. package/dist/src/index.js.map +1 -0
  124. package/dist/src/interface/asyncapi-common.interfaces.d.ts +126 -0
  125. package/dist/src/interface/asyncapi-common.interfaces.js +3 -0
  126. package/dist/src/interface/asyncapi-common.interfaces.js.map +1 -0
  127. package/dist/src/interface/asyncapi-document-options.interface.d.ts +3 -0
  128. package/dist/src/interface/asyncapi-document-options.interface.js +3 -0
  129. package/dist/src/interface/asyncapi-document-options.interface.js.map +1 -0
  130. package/dist/src/interface/asyncapi-message.interface.d.ts +8 -0
  131. package/dist/src/interface/asyncapi-message.interface.js +3 -0
  132. package/dist/src/interface/asyncapi-message.interface.js.map +1 -0
  133. package/dist/src/interface/asyncapi-operation-headers.interface.d.ts +6 -0
  134. package/dist/src/interface/asyncapi-operation-headers.interface.js +3 -0
  135. package/dist/src/interface/asyncapi-operation-headers.interface.js.map +1 -0
  136. package/dist/src/interface/asyncapi-operation-options-raw.interface.d.ts +21 -0
  137. package/dist/src/interface/asyncapi-operation-options-raw.interface.js +3 -0
  138. package/dist/src/interface/asyncapi-operation-options-raw.interface.js.map +1 -0
  139. package/dist/src/interface/asyncapi-operation-options.interface.d.ts +8 -0
  140. package/dist/src/interface/asyncapi-operation-options.interface.js +3 -0
  141. package/dist/src/interface/asyncapi-operation-options.interface.js.map +1 -0
  142. package/dist/src/interface/asyncapi-operation-payload.interface.d.ts +2 -0
  143. package/dist/src/interface/asyncapi-operation-payload.interface.js +3 -0
  144. package/dist/src/interface/asyncapi-operation-payload.interface.js.map +1 -0
  145. package/dist/src/interface/asyncapi-server.interface.d.ts +10 -0
  146. package/dist/src/interface/asyncapi-server.interface.js +3 -0
  147. package/dist/src/interface/asyncapi-server.interface.js.map +1 -0
  148. package/dist/src/interface/asyncapi-template-options.interface.d.ts +7 -0
  149. package/dist/src/interface/asyncapi-template-options.interface.js +3 -0
  150. package/dist/src/interface/asyncapi-template-options.interface.js.map +1 -0
  151. package/dist/src/interface/denormalized-doc-resolvers.interface.d.ts +6 -0
  152. package/dist/src/interface/denormalized-doc-resolvers.interface.js +3 -0
  153. package/dist/src/interface/denormalized-doc-resolvers.interface.js.map +1 -0
  154. package/dist/src/interface/denormalized-doc.interface.d.ts +10 -0
  155. package/dist/src/interface/denormalized-doc.interface.js +3 -0
  156. package/dist/src/interface/denormalized-doc.interface.js.map +1 -0
  157. package/dist/src/interface/generator-options.interface.d.ts +22 -0
  158. package/dist/src/interface/generator-options.interface.js +3 -0
  159. package/dist/src/interface/generator-options.interface.js.map +1 -0
  160. package/dist/src/interface/index.d.ts +11 -0
  161. package/dist/src/interface/index.js +28 -0
  162. package/dist/src/interface/index.js.map +1 -0
  163. package/dist/src/services/asyncapi.explorer.d.ts +12 -0
  164. package/dist/src/services/asyncapi.explorer.js +69 -0
  165. package/dist/src/services/asyncapi.explorer.js.map +1 -0
  166. package/dist/src/services/asyncapi.generator.d.ts +6 -0
  167. package/dist/src/services/asyncapi.generator.js +68 -0
  168. package/dist/src/services/asyncapi.generator.js.map +1 -0
  169. package/dist/src/services/asyncapi.scanner.d.ts +14 -0
  170. package/dist/src/services/asyncapi.scanner.js +71 -0
  171. package/dist/src/services/asyncapi.scanner.js.map +1 -0
  172. package/dist/src/services/asyncapi.transformer.d.ts +4 -0
  173. package/dist/src/services/asyncapi.transformer.js +33 -0
  174. package/dist/src/services/asyncapi.transformer.js.map +1 -0
  175. package/dist/src/services/index.d.ts +4 -0
  176. package/dist/src/services/index.js +21 -0
  177. package/dist/src/services/index.js.map +1 -0
  178. package/dist/src/services/operation-object.factory.d.ts +9 -0
  179. package/dist/src/services/operation-object.factory.js +37 -0
  180. package/dist/src/services/operation-object.factory.js.map +1 -0
  181. package/dist/test/configs/jest-base.config.d.ts +3 -0
  182. package/dist/test/configs/jest-base.config.js +20 -0
  183. package/dist/test/configs/jest-base.config.js.map +1 -0
  184. package/dist/test/configs/jest-e2e.config.d.ts +3 -0
  185. package/dist/test/configs/jest-e2e.config.js +16 -0
  186. package/dist/test/configs/jest-e2e.config.js.map +1 -0
  187. package/dist/test/express.e2e-spec.d.ts +1 -0
  188. package/dist/test/express.e2e-spec.js +89 -0
  189. package/dist/test/express.e2e-spec.js.map +1 -0
  190. package/dist/test/fastify.e2e-spec.d.ts +1 -0
  191. package/dist/test/fastify.e2e-spec.js +57 -0
  192. package/dist/test/fastify.e2e-spec.js.map +1 -0
  193. package/dist/tsconfig.tsbuildinfo +1 -1
  194. package/eslint.config.mjs +21 -0
  195. package/misc/references/ref.html +303 -0
  196. package/misc/references/ref.json +1 -0
  197. package/misc/references/ref.yaml +292 -0
  198. package/misc/take-snaphots.sh +8 -0
  199. package/package.json +48 -41
  200. package/sample/app.module.ts +7 -0
  201. package/sample/common.ts +49 -0
  202. package/sample/constants.ts +12 -0
  203. package/sample/felines/class/cat.class.ts +9 -0
  204. package/sample/felines/class/feline.class.ts +29 -0
  205. package/sample/felines/class/index.ts +5 -0
  206. package/sample/felines/class/lion.class.ts +5 -0
  207. package/sample/felines/class/message.class.ts +17 -0
  208. package/sample/felines/class/tiger.class.ts +5 -0
  209. package/sample/felines/dto/create-feline.dto.ts +13 -0
  210. package/sample/felines/dto/index.ts +2 -0
  211. package/sample/felines/dto/journaling-data.dto.ts +5 -0
  212. package/sample/felines/felines.constants.ts +1 -0
  213. package/sample/felines/felines.controller.ts +76 -0
  214. package/sample/felines/felines.gateway.ts +76 -0
  215. package/sample/felines/felines.module.ts +15 -0
  216. package/sample/felines/felines.service.ts +24 -0
  217. package/sample/felines/rto/feline.rto.ts +17 -0
  218. package/sample/felines/rto/index.ts +1 -0
  219. package/sample/index.ts +3 -0
  220. package/sample/main.ts +34 -0
  221. package/src/asyncapi-document.builder.ts +5 -19
  222. package/src/asyncapi.module.ts +5 -16
  223. package/src/decorators/asyncapi-operation-for-meta-key.decorator.ts +4 -16
  224. package/src/decorators/asyncapi-operation.decorator.ts +1 -3
  225. package/src/decorators/asyncapi-pub.decorator.ts +6 -13
  226. package/src/decorators/asyncapi-sub.decorator.ts +6 -13
  227. package/src/explorers/asyncapi-class.explorer.ts +2 -6
  228. package/src/explorers/asyncapi-operation.explorer.ts +3 -12
  229. package/src/interface/asyncapi-common.interfaces.ts +1 -4
  230. package/src/interface/asyncapi-operation-options.interface.ts +2 -4
  231. package/src/interface/asyncapi-operation-payload.interface.ts +1 -5
  232. package/src/interface/asyncapi-server.interface.ts +1 -4
  233. package/src/interface/asyncapi-template-options.interface.ts +5 -5
  234. package/src/interface/denormalized-doc.interface.ts +1 -5
  235. package/src/services/asyncapi.explorer.ts +25 -34
  236. package/src/services/asyncapi.generator.ts +28 -16
  237. package/src/services/asyncapi.scanner.ts +39 -89
  238. package/src/services/asyncapi.transformer.ts +2 -8
  239. package/src/services/index.ts +0 -1
  240. package/src/services/operation-object.factory.ts +0 -1
  241. package/test/__mocks__/@asyncapi/generator.js +41 -0
  242. package/test/configs/jest-base.config.ts +19 -0
  243. package/test/configs/jest-e2e.config.js +7 -0
  244. package/test/configs/jest-e2e.config.ts +19 -0
  245. package/test/configs/jest-swagger-plugin.js +16 -0
  246. package/test/express.e2e-spec.ts +64 -0
  247. package/test/fastify.e2e-spec.ts +65 -0
  248. package/.eslintrc.js +0 -9
@@ -0,0 +1,37 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,3 @@
1
+ import { JestConfigWithTsJest } from 'ts-jest';
2
+ export declare const baseConfig: JestConfigWithTsJest;
3
+ export default baseConfig;
@@ -0,0 +1,20 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,3 @@
1
+ import { JestConfigWithTsJest } from 'ts-jest';
2
+ export declare const e2eConfig: JestConfigWithTsJest;
3
+ export default e2eConfig;
@@ -0,0 +1,16 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,89 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"express.e2e-spec.js","sourceRoot":"","sources":["../../test/express.e2e-spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA2C;AAC3C,+DAAkF;AAClF,gDAAkC;AAClC,sDAA6B;AAC7B,0DAAgC;AAChC,gCAAwC;AACxC,qDAAiD;AACjD,6CAAwD;AACxD,mDAAwD;AAExD,QAAQ,CAA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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"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,57 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":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