@achinet/nestjs-async 0.1.1 → 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 +57 -37
  54. package/.prettierrc +0 -5
  55. package/CHANGELOG.md +0 -20
  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
@@ -2,4 +2,4 @@ export * from './asyncapi.generator';
2
2
  export * from './operation-object.factory';
3
3
  export * from './asyncapi.explorer';
4
4
  export * from './asyncapi.scanner';
5
- export * from './asyncapi.scanner';
5
+ export * from './swagger-schema.factory';
@@ -18,5 +18,5 @@ __exportStar(require("./asyncapi.generator"), exports);
18
18
  __exportStar(require("./operation-object.factory"), exports);
19
19
  __exportStar(require("./asyncapi.explorer"), exports);
20
20
  __exportStar(require("./asyncapi.scanner"), exports);
21
- __exportStar(require("./asyncapi.scanner"), exports);
21
+ __exportStar(require("./swagger-schema.factory"), exports);
22
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,6DAA2C;AAC3C,sDAAoC;AACpC,qDAAmC;AACnC,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,6DAA2C;AAC3C,sDAAoC;AACpC,qDAAmC;AACnC,2DAAyC"}
@@ -1,9 +1,5 @@
1
- import { SchemaObject } from '@nestjs/swagger/dist/interfaces/open-api-spec.interface';
2
1
  import { AsyncApiOperationOptionsRaw, AsyncOperationObject } from '../interface';
3
2
  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;
3
+ create(operation: AsyncApiOperationOptionsRaw, produces: string[], models: Set<Function>): AsyncOperationObject;
4
+ private registerPayloadModel;
9
5
  }
@@ -1,36 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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");
4
+ const swagger_1 = require("@nestjs/swagger");
8
5
  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) {
6
+ create(operation, produces, models) {
15
7
  const { message } = operation;
16
8
  const { oneOf } = message;
17
9
  if (oneOf) {
18
10
  return Object.assign(Object.assign({}, operation), { message: {
19
11
  oneOf: oneOf.map((i) => (Object.assign(Object.assign({}, i), { payload: {
20
- $ref: (0, utils_1.getSchemaPath)(this.getDtoName(i, schemas)),
12
+ $ref: this.registerPayloadModel(i, models),
21
13
  } }))),
22
14
  } });
23
15
  }
24
16
  return Object.assign(Object.assign({}, operation), { message: Object.assign(Object.assign({}, operation.message), { payload: {
25
- $ref: (0, utils_1.getSchemaPath)(this.getDtoName(message, schemas)),
17
+ $ref: this.registerPayloadModel(message, models),
26
18
  } }) });
27
19
  }
28
- getDtoName(message, schemas) {
20
+ registerPayloadModel(message, models) {
29
21
  if (!message.payload || !message.payload.type) {
30
22
  throw new Error('Async message payload or payload.type is undefined; ensure message.payload is provided.');
31
23
  }
32
24
  const messagePayloadType = message.payload.type;
33
- return this.schemaObjectFactory.exploreModelSchema(messagePayloadType, schemas);
25
+ models.add(messagePayloadType);
26
+ return (0, swagger_1.getSchemaPath)(messagePayloadType);
34
27
  }
35
28
  }
36
29
  exports.OperationObjectFactory = OperationObjectFactory;
@@ -1 +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;IA2CxH,CAAC;IAzCC,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;QAED,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;AAhDD,wDAgDC"}
1
+ {"version":3,"file":"operation-object.factory.js","sourceRoot":"","sources":["../../src/services/operation-object.factory.ts"],"names":[],"mappings":";;;AAAA,6CAAgD;AAGhD,MAAa,sBAAsB;IACjC,MAAM,CACJ,SAAsC,EACtC,QAAkB,EAClB,MAAqB;QAErB,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,IAAI,CAAC,oBAAoB,CAAC,CAAuB,EAAE,MAAM,CAAC;yBACjE,IACD,CAAC;iBACJ,IACD;QACJ,CAAC;QAED,uCACK,SAAS,KACZ,OAAO,kCACF,SAAS,CAAC,OAAO,KACpB,OAAO,EAAE;oBACP,IAAI,EAAE,IAAI,CAAC,oBAAoB,CAAC,OAA6B,EAAE,MAAM,CAAC;iBACvE,OAEH;IACJ,CAAC;IAKO,oBAAoB,CAAC,OAA2B,EAAE,MAAqB;QAC7E,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,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAC/B,OAAO,IAAA,uBAAa,EAAC,kBAAkB,CAAC,CAAC;IAC3C,CAAC;CACF;AA7CD,wDA6CC"}
@@ -0,0 +1,6 @@
1
+ import { INestApplicationContext } from '@nestjs/common';
2
+ import { SchemaObject, SwaggerDocumentOptions } from '@nestjs/swagger';
3
+ export declare class SwaggerSchemaFactory {
4
+ generate(app: INestApplicationContext, models: Function[], options?: SwaggerDocumentOptions): Record<string, SchemaObject>;
5
+ private toSwaggerHost;
6
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SwaggerSchemaFactory = void 0;
4
+ const swagger_1 = require("@nestjs/swagger");
5
+ class NoRoutesSentinelModule {
6
+ }
7
+ class SwaggerSchemaFactory {
8
+ generate(app, models, options = {}) {
9
+ var _a, _b;
10
+ if (models.length === 0) {
11
+ return {};
12
+ }
13
+ const document = swagger_1.SwaggerModule.createDocument(this.toSwaggerHost(app), new swagger_1.DocumentBuilder().build(), Object.assign(Object.assign({}, options), { include: [NoRoutesSentinelModule], extraModels: models, deepScanRoutes: false }));
14
+ return ((_b = (_a = document.components) === null || _a === void 0 ? void 0 : _a.schemas) !== null && _b !== void 0 ? _b : {});
15
+ }
16
+ toSwaggerHost(app) {
17
+ if (typeof app.getHttpAdapter === 'function') {
18
+ return app;
19
+ }
20
+ const stubAdapter = { getType: () => 'none' };
21
+ return new Proxy(app, {
22
+ get: (target, prop) => prop === 'getHttpAdapter' ? () => stubAdapter : Reflect.get(target, prop, target),
23
+ });
24
+ }
25
+ }
26
+ exports.SwaggerSchemaFactory = SwaggerSchemaFactory;
27
+ //# sourceMappingURL=swagger-schema.factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swagger-schema.factory.js","sourceRoot":"","sources":["../../src/services/swagger-schema.factory.ts"],"names":[],"mappings":";;;AACA,6CAAuG;AAMvG,MAAM,sBAAsB;CAAG;AAM/B,MAAa,oBAAoB;IACxB,QAAQ,CACb,GAA4B,EAC5B,MAAkB,EAClB,UAAkC,EAAE;;QAEpC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,QAAQ,GAAG,uBAAa,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,IAAI,yBAAe,EAAE,CAAC,KAAK,EAAE,kCAC/F,OAAO,KACV,OAAO,EAAE,CAAC,sBAAsB,CAAC,EACjC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,KAAK,IACrB,CAAC;QAEH,OAAO,CAAC,MAAA,MAAA,QAAQ,CAAC,UAAU,0CAAE,OAAO,mCAAI,EAAE,CAAiC,CAAC;IAC9E,CAAC;IAMO,aAAa,CAAC,GAA4B;QAChD,IAAI,OAAQ,GAAiC,CAAC,cAAc,KAAK,UAAU,EAAE,CAAC;YAC5E,OAAO,GAAuB,CAAC;QACjC,CAAC;QAED,MAAM,WAAW,GAAG,EAAE,OAAO,EAAE,GAAW,EAAE,CAAC,MAAM,EAAE,CAAC;QACtD,OAAO,IAAI,KAAK,CAAC,GAAG,EAAE;YACpB,GAAG,EAAE,CAAC,MAAM,EAAE,IAAI,EAAW,EAAE,CAC7B,IAAI,KAAK,gBAAgB,CAAC,CAAC,CAAC,GAAuB,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC;SACxG,CAAqB,CAAC;IACzB,CAAC;CACF;AAnCD,oDAmCC"}
@@ -0,0 +1,2 @@
1
+ export declare function createMethodDecorator<T = unknown>(metakey: string, metadata: T): MethodDecorator;
2
+ export declare function createMixedDecorator<T = unknown>(metakey: string, metadata: T): ClassDecorator & MethodDecorator;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createMethodDecorator = createMethodDecorator;
4
+ exports.createMixedDecorator = createMixedDecorator;
5
+ function createMethodDecorator(metakey, metadata) {
6
+ return (_target, _key, descriptor) => {
7
+ if (typeof metadata === 'object') {
8
+ const prevValue = Reflect.getMetadata(metakey, descriptor.value);
9
+ Reflect.defineMetadata(metakey, Object.assign(Object.assign({}, prevValue), metadata), descriptor.value);
10
+ return descriptor;
11
+ }
12
+ Reflect.defineMetadata(metakey, metadata, descriptor.value);
13
+ return descriptor;
14
+ };
15
+ }
16
+ function createMixedDecorator(metakey, metadata) {
17
+ return ((target, _key, descriptor) => {
18
+ const metadataTarget = descriptor ? descriptor.value : target;
19
+ const merged = Array.isArray(metadata)
20
+ ? [...(Reflect.getMetadata(metakey, metadataTarget) || []), ...metadata]
21
+ : Object.assign(Object.assign({}, (Reflect.getMetadata(metakey, metadataTarget) || {})), metadata);
22
+ Reflect.defineMetadata(metakey, merged, metadataTarget);
23
+ return descriptor !== null && descriptor !== void 0 ? descriptor : target;
24
+ });
25
+ }
26
+ //# sourceMappingURL=decorator.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator.utils.js","sourceRoot":"","sources":["../../src/utils/decorator.utils.ts"],"names":[],"mappings":";;AAKA,sDAUC;AAED,oDAUC;AAtBD,SAAgB,qBAAqB,CAAc,OAAe,EAAE,QAAW;IAC7E,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,UAA8B,EAAE,EAAE;QACvD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACjC,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;YACjE,OAAO,CAAC,cAAc,CAAC,OAAO,kCAAO,SAAS,GAAK,QAAQ,GAAI,UAAU,CAAC,KAAK,CAAC,CAAC;YACjF,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QAC5D,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,oBAAoB,CAAc,OAAe,EAAE,QAAW;IAC5E,OAAO,CAAC,CAAC,MAAc,EAAE,IAAsB,EAAE,UAA+B,EAAE,EAAE;QAClF,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QAC9D,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YACpC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC;YACxE,CAAC,iCAAM,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,EAAE,CAAC,GAAM,QAAmB,CAAE,CAAC;QAEzF,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;QACxD,OAAO,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,MAAM,CAAC;IAC9B,CAAC,CAAqC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './decorator.utils';
2
+ export * from './path.utils';
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./feline.rto"), exports);
17
+ __exportStar(require("./decorator.utils"), exports);
18
+ __exportStar(require("./path.utils"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,+CAA6B"}
@@ -0,0 +1,2 @@
1
+ export declare const validatePath: (inputPath: string) => string;
2
+ export declare const stripLastSlash: (path: string) => string;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stripLastSlash = exports.validatePath = void 0;
4
+ const validatePath = (inputPath) => (inputPath.charAt(0) !== '/' ? `/${inputPath}` : inputPath);
5
+ exports.validatePath = validatePath;
6
+ const stripLastSlash = (path) => path && path[path.length - 1] === '/' ? path.slice(0, path.length - 1) : path;
7
+ exports.stripLastSlash = stripLastSlash;
8
+ //# sourceMappingURL=path.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.utils.js","sourceRoot":"","sources":["../../src/utils/path.utils.ts"],"names":[],"mappings":";;;AAGO,MAAM,YAAY,GAAG,CAAC,SAAiB,EAAU,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAA1G,QAAA,YAAY,gBAA8F;AAKhH,MAAM,cAAc,GAAG,CAAC,IAAY,EAAU,EAAE,CACrD,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AADnE,QAAA,cAAc,kBACqD"}
package/package.json CHANGED
@@ -1,18 +1,26 @@
1
1
  {
2
2
  "name": "@achinet/nestjs-async",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/jelcaf/achinet.git",
10
+ "directory": "packages/nestjs-asyncapi"
11
+ },
7
12
  "main": "dist/index.js",
8
13
  "types": "dist/index.d.ts",
9
14
  "scripts": {
10
- "build": "tsc",
15
+ "build": "rimraf dist && tsc -p tsconfig.build.json",
11
16
  "lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
12
17
  "lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
13
18
  "clean": "rimraf dist",
14
19
  "test": "jest --passWithNoTests",
15
- "test:e2e": "jest --runInBand --config test/configs/jest-e2e.config.js"
20
+ "test:e2e": "jest --runInBand --config test/configs/jest-e2e.config.js",
21
+ "start:sample": "nest start",
22
+ "start:sample:watch": "nest start --watch",
23
+ "prepublishOnly": "yarn build"
16
24
  },
17
25
  "jest": {
18
26
  "moduleFileExtensions": [
@@ -42,9 +50,6 @@
42
50
  }
43
51
  ]
44
52
  },
45
- "moduleNameMapper": {
46
- "^@asyncapi/generator$": "<rootDir>/test/__mocks__/@asyncapi/generator.js"
47
- },
48
53
  "collectCoverageFrom": [
49
54
  "**/*.(t|j)s"
50
55
  ],
@@ -52,50 +57,65 @@
52
57
  "testEnvironment": "node"
53
58
  },
54
59
  "devDependencies": {
55
- "@nestjs/cli": "11.0.16",
56
- "@nestjs/microservices": "11.1.13",
57
- "@nestjs/platform-express": "11.1.13",
58
- "@nestjs/platform-fastify": "11.1.13",
59
- "@nestjs/platform-socket.io": "11.1.13",
60
- "@nestjs/schematics": "11.0.9",
61
- "@nestjs/testing": "11.1.13",
60
+ "@nestjs/cli": "11.0.24",
61
+ "@nestjs/common": "11.2.8",
62
+ "@nestjs/core": "11.2.8",
63
+ "@nestjs/microservices": "11.2.8",
64
+ "@nestjs/platform-express": "11.2.8",
65
+ "@nestjs/platform-fastify": "11.2.8",
66
+ "@nestjs/platform-socket.io": "11.2.8",
67
+ "@nestjs/schematics": "11.1.0",
68
+ "@nestjs/swagger": "11.4.8",
69
+ "@nestjs/testing": "11.2.8",
70
+ "@nestjs/websockets": "11.2.8",
62
71
  "@types/express": "5.0.6",
63
72
  "@types/jest": "30.0.0",
64
73
  "@types/js-yaml": "4.0.9",
65
- "@types/lodash": "^4.17.23",
66
- "@types/node": "25.2.1",
74
+ "@types/lodash": "^4.17.27",
75
+ "@types/node": "25.9.9",
67
76
  "@types/supertest": "6.0.3",
68
77
  "@types/url-join": "5.0.0",
69
- "@typescript-eslint/eslint-plugin": "8.54.0",
70
- "@typescript-eslint/parser": "8.54.0",
71
- "eslint": "10.0.0",
78
+ "@typescript-eslint/eslint-plugin": "8.72.1",
79
+ "@typescript-eslint/parser": "8.72.1",
80
+ "eslint": "10.14.0",
72
81
  "eslint-config-prettier": "10.1.8",
73
82
  "eslint-plugin-import": "2.32.0",
74
- "eslint-plugin-prettier": "5.5.5",
83
+ "eslint-plugin-prettier": "5.5.7",
75
84
  "husky": "9.1.7",
76
- "jest": "30.2.0",
77
- "lint-staged": "16.2.7",
78
- "prettier": "3.8.1",
79
- "release-it": "19.2.4",
80
- "socket.io": "4.8.3",
81
- "socket.io-client": "4.8.3",
82
- "supertest": "7.2.2",
83
- "ts-jest": "^29.4.6",
84
- "ts-loader": "9.5.4",
85
+ "jest": "30.5.2",
86
+ "lint-staged": "16.4.0",
87
+ "prettier": "3.9.10",
88
+ "reflect-metadata": "0.2.2",
89
+ "rimraf": "^6.1.4",
90
+ "socket.io": "4.8.4",
91
+ "socket.io-client": "4.8.4",
92
+ "supertest": "7.3.2",
93
+ "ts-jest": "^29.4.15",
94
+ "ts-loader": "9.6.2",
85
95
  "ts-node": "^10.9.2",
86
96
  "tsconfig-paths": "4.2.0",
87
97
  "typescript": "5.9.3"
88
98
  },
89
99
  "dependencies": {
90
- "@asyncapi/generator": "^3.1.2",
91
- "@asyncapi/html-template": "^3.5.4",
92
- "@nestjs/common": "^11.1.13",
93
- "@nestjs/core": "^11.1.13",
100
+ "@asyncapi/react-component": "^3.2.3",
101
+ "@swc/core": "1.16.22",
102
+ "js-yaml": "5.4.1",
103
+ "lodash": "^4.18.1"
104
+ },
105
+ "peerDependencies": {
106
+ "@nestjs/common": "^11.1.14",
107
+ "@nestjs/core": "^11.1.14",
94
108
  "@nestjs/swagger": "^11.2.6",
95
- "@nestjs/websockets": "^11.1.13",
96
- "@swc/core": "1.15.11",
97
- "js-yaml": "4.1.1",
98
- "lodash": "^4.17.23",
99
- "reflect-metadata": "0.2.2"
109
+ "@nestjs/websockets": "^11.1.14",
110
+ "reflect-metadata": "^0.1.12 || ^0.2.0"
111
+ },
112
+ "files": [
113
+ "dist",
114
+ "!dist/**/*.tsbuildinfo"
115
+ ],
116
+ "peerDependenciesMeta": {
117
+ "@nestjs/websockets": {
118
+ "optional": true
119
+ }
100
120
  }
101
121
  }
package/.prettierrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "trailingComma": "all",
4
- "printWidth": 120
5
- }
package/CHANGELOG.md DELETED
@@ -1,20 +0,0 @@
1
- # @achinet/nestjs-async
2
-
3
- ## 0.1.1
4
-
5
- ### Patch Changes
6
-
7
- - b32903e: Upgrade dependencies
8
- - 436f491: Upgrade dependencies
9
-
10
- ## 0.1.0
11
-
12
- ### Minor Changes
13
-
14
- - ef21291: Upgrade `@asyncapi` dependencies and adjust code
15
-
16
- ## 0.0.1
17
-
18
- ### Patch Changes
19
-
20
- - 7ca0b6b: First version of the package
@@ -1,22 +0,0 @@
1
- import { AsyncApiDocument } from './asyncapi-common.interfaces';
2
- import { AsyncApiTemplateOptions } from './asyncapi-template-options.interface';
3
- export interface GeneratorOptions {
4
- templateName: string;
5
- targetDir: string;
6
- entrypoint?: string;
7
- noOverwriteGlobs: string[];
8
- disabledHooks: {
9
- [key: string]: string | boolean | string[];
10
- };
11
- output: 'string' | 'fs';
12
- forceWrite: boolean;
13
- debug: boolean;
14
- install: boolean;
15
- templateConfig: Record<string, unknown>;
16
- hooks: Record<string, unknown>;
17
- templateParams: AsyncApiTemplateOptions;
18
- generate: (document: AsyncApiDocument) => Promise<void>;
19
- generateFromURL: (url: string) => Promise<void>;
20
- generateFromFile: (path: string) => Promise<void>;
21
- generateFromString: (yaml: string, args?: unknown) => Promise<string>;
22
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generator-options.interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator-options.interface.js","sourceRoot":"","sources":["../../src/interface/generator-options.interface.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export declare class AppModule {
2
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.AppModule = void 0;
10
- const common_1 = require("@nestjs/common");
11
- const felines_module_1 = require("./felines/felines.module");
12
- let AppModule = class AppModule {
13
- };
14
- exports.AppModule = AppModule;
15
- exports.AppModule = AppModule = __decorate([
16
- (0, common_1.Module)({
17
- imports: [felines_module_1.FelinesModule],
18
- })
19
- ], AppModule);
20
- //# sourceMappingURL=app.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../sample/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6DAAyD;AAKlD,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IAHrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,8BAAa,CAAC;KACzB,CAAC;GACW,SAAS,CAAG"}
@@ -1,3 +0,0 @@
1
- import { INestApplicationContext } from '@nestjs/common';
2
- import { AsyncApiDocument } from '../src';
3
- export declare function makeAsyncapiDocument(app: INestApplicationContext): Promise<AsyncApiDocument>;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeAsyncapiDocument = makeAsyncapiDocument;
4
- const constants_1 = require("./constants");
5
- const class_1 = require("./felines/class");
6
- const felines_module_1 = require("./felines/felines.module");
7
- const src_1 = require("../src");
8
- async function makeAsyncapiDocument(app) {
9
- const asyncApiServer = {
10
- url: `ws://${constants_1.HOST}:${constants_1.PORT}`,
11
- protocol: 'socket.io',
12
- protocolVersion: '4',
13
- description: 'Allows you to connect using the websocket protocol to our Socket.io server.',
14
- security: [{ 'user-password': [] }],
15
- variables: {
16
- port: {
17
- description: 'Secure connection (TLS) is available through port 443.',
18
- default: '443',
19
- },
20
- },
21
- bindings: {},
22
- };
23
- const servers = Object.keys(constants_1.SERVER).map((i) => ({
24
- name: constants_1.SERVER[i],
25
- server: asyncApiServer,
26
- }));
27
- const asyncApiOptions = new src_1.AsyncApiDocumentBuilder()
28
- .setTitle('Feline')
29
- .setDescription('Feline server description here')
30
- .setVersion('1.0')
31
- .setDefaultContentType('application/json')
32
- .addSecurity('user-password', { type: 'userPassword' })
33
- .addServers(servers)
34
- .build();
35
- return src_1.AsyncApiModule.createDocument(app, asyncApiOptions, {
36
- include: [felines_module_1.FelinesModule],
37
- extraModels: [class_1.Cat, class_1.Lion, class_1.Tiger, class_1.Feline],
38
- });
39
- }
40
- //# sourceMappingURL=common.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../sample/common.ts"],"names":[],"mappings":";;AAWA,oDAqCC;AA/CD,2CAAiD;AACjD,2CAA2D;AAC3D,6DAAyD;AACzD,gCAKgB;AAET,KAAK,UAAU,oBAAoB,CACxC,GAA4B;IAE5B,MAAM,cAAc,GAAsB;QACxC,GAAG,EAAE,QAAQ,gBAAI,IAAI,gBAAI,EAAE;QAC3B,QAAQ,EAAE,WAAW;QACrB,eAAe,EAAE,GAAG;QACpB,WAAW,EACT,6EAA6E;QAC/E,QAAQ,EAAE,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC;QACnC,SAAS,EAAE;YACT,IAAI,EAAE;gBACJ,WAAW,EAAE,wDAAwD;gBACrE,OAAO,EAAE,KAAK;aACf;SACF;QACD,QAAQ,EAAE,EAAE;KACb,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,kBAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9C,IAAI,EAAE,kBAAM,CAAC,CAAC,CAAC;QACf,MAAM,EAAE,cAAc;KACvB,CAAC,CAAC,CAAC;IAEJ,MAAM,eAAe,GAAG,IAAI,6BAAuB,EAAE;SAClD,QAAQ,CAAC,QAAQ,CAAC;SAClB,cAAc,CAAC,gCAAgC,CAAC;SAChD,UAAU,CAAC,KAAK,CAAC;SACjB,qBAAqB,CAAC,kBAAkB,CAAC;SACzC,WAAW,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;SACtD,UAAU,CAAC,OAAO,CAAC;SACnB,KAAK,EAAE,CAAC;IAEX,OAAO,oBAAc,CAAC,cAAc,CAAC,GAAG,EAAE,eAAe,EAAE;QACzD,OAAO,EAAE,CAAC,8BAAa,CAAC;QACxB,WAAW,EAAE,CAAC,WAAG,EAAE,YAAI,EAAE,aAAK,EAAE,cAAM,CAAC;KACxC,CAAC,CAAC;AACL,CAAC"}
@@ -1,12 +0,0 @@
1
- export declare const DOC_RELATIVE_PATH = "/async-api";
2
- export declare const BOOTSTRAP = "Bootstrap";
3
- export declare const PORT = 4001;
4
- export declare const HOST = "0.0.0.0";
5
- export declare const SERVER: {
6
- europe: string;
7
- asia: string;
8
- northAmerica: string;
9
- southAmerica: string;
10
- africa: string;
11
- australia: string;
12
- };
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SERVER = exports.HOST = exports.PORT = exports.BOOTSTRAP = exports.DOC_RELATIVE_PATH = void 0;
4
- exports.DOC_RELATIVE_PATH = '/async-api';
5
- exports.BOOTSTRAP = 'Bootstrap';
6
- exports.PORT = 4001;
7
- exports.HOST = '0.0.0.0';
8
- exports.SERVER = {
9
- europe: 'europe',
10
- asia: 'asia',
11
- northAmerica: 'north-america',
12
- southAmerica: 'south-america',
13
- africa: 'africa',
14
- australia: 'australia',
15
- };
16
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../sample/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,YAAY,CAAC;AACjC,QAAA,SAAS,GAAG,WAAW,CAAC;AACxB,QAAA,IAAI,GAAG,IAAI,CAAC;AACZ,QAAA,IAAI,GAAG,SAAS,CAAC;AACjB,QAAA,MAAM,GAAG;IACpB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,YAAY,EAAE,eAAe;IAC7B,YAAY,EAAE,eAAe;IAC7B,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,WAAW;CACvB,CAAC"}
@@ -1,4 +0,0 @@
1
- import { Feline } from './feline.class';
2
- export declare class Cat extends Feline {
3
- breed: string;
4
- }
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Cat = void 0;
13
- const swagger_1 = require("@nestjs/swagger");
14
- const feline_class_1 = require("./feline.class");
15
- class Cat extends feline_class_1.Feline {
16
- }
17
- exports.Cat = Cat;
18
- __decorate([
19
- (0, swagger_1.ApiProperty)({
20
- example: 'Maine Coon',
21
- }),
22
- __metadata("design:type", String)
23
- ], Cat.prototype, "breed", void 0);
24
- //# sourceMappingURL=cat.class.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cat.class.js","sourceRoot":"","sources":["../../../../sample/felines/class/cat.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,iDAAwC;AAExC,MAAa,GAAI,SAAQ,qBAAM;CAK9B;AALD,kBAKC;AADC;IAHC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,YAAY;KACtB,CAAC;;kCACY"}
@@ -1,19 +0,0 @@
1
- declare enum PawsEnum {
2
- left = "left",
3
- right = "right"
4
- }
5
- declare enum GendersEnum {
6
- male = "male",
7
- female = "female"
8
- }
9
- export declare abstract class Feline {
10
- id: number;
11
- name: string;
12
- age: number;
13
- gender: GendersEnum;
14
- dominantPaw: PawsEnum;
15
- tags: string[];
16
- birthDatetime: Date;
17
- constructor(initializer: Record<string, unknown>);
18
- }
19
- export {};
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Feline = void 0;
4
- var PawsEnum;
5
- (function (PawsEnum) {
6
- PawsEnum["left"] = "left";
7
- PawsEnum["right"] = "right";
8
- })(PawsEnum || (PawsEnum = {}));
9
- var GendersEnum;
10
- (function (GendersEnum) {
11
- GendersEnum["male"] = "male";
12
- GendersEnum["female"] = "female";
13
- })(GendersEnum || (GendersEnum = {}));
14
- class Feline {
15
- constructor(initializer) {
16
- Object.assign(this, initializer);
17
- }
18
- }
19
- exports.Feline = Feline;
20
- //# sourceMappingURL=feline.class.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"feline.class.js","sourceRoot":"","sources":["../../../../sample/felines/class/feline.class.ts"],"names":[],"mappings":";;;AAAA,IAAK,QAGJ;AAHD,WAAK,QAAQ;IACX,yBAAa,CAAA;IACb,2BAAe,CAAA;AACjB,CAAC,EAHI,QAAQ,KAAR,QAAQ,QAGZ;AAED,IAAK,WAGJ;AAHD,WAAK,WAAW;IACd,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAHI,WAAW,KAAX,WAAW,QAGf;AAED,MAAsB,MAAM;IAe1B,YAAY,WAAoC;QAC9C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACnC,CAAC;CACF;AAlBD,wBAkBC"}
@@ -1,5 +0,0 @@
1
- export * from './feline.class';
2
- export * from './cat.class';
3
- export * from './lion.class';
4
- export * from './tiger.class';
5
- export * from './message.class';
@@ -1,22 +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("./feline.class"), exports);
18
- __exportStar(require("./cat.class"), exports);
19
- __exportStar(require("./lion.class"), exports);
20
- __exportStar(require("./tiger.class"), exports);
21
- __exportStar(require("./message.class"), exports);
22
- //# sourceMappingURL=index.js.map