@venok/core 1.1.0 → 2.0.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 (579) hide show
  1. package/dist/application/config.js +92 -0
  2. package/dist/application/context.js +252 -0
  3. package/dist/application/factory.js +136 -0
  4. package/dist/constants.js +100 -0
  5. package/dist/context/context-id.factory.js +58 -0
  6. package/dist/context/context.js +186 -0
  7. package/dist/context/creator.js +49 -0
  8. package/dist/context/execution-host.js +51 -0
  9. package/dist/context/proxy.js +55 -0
  10. package/dist/decorators/apply.decorator.js +33 -0
  11. package/dist/decorators/bind.decorator.js +28 -0
  12. package/dist/decorators/catch.decorator.js +29 -0
  13. package/dist/decorators/dependencies.decorator.js +30 -0
  14. package/dist/decorators/exception-filters.decorator.js +40 -0
  15. package/dist/decorators/global.decorator.js +28 -0
  16. package/dist/decorators/inject.decorator.js +42 -0
  17. package/dist/decorators/injectable.decorator.js +38 -0
  18. package/dist/decorators/module.decorator.js +42 -0
  19. package/dist/decorators/optional.decorator.js +35 -0
  20. package/dist/decorators/set-metadata.decorator.js +35 -0
  21. package/dist/decorators/use-guards.decorator.js +39 -0
  22. package/dist/decorators/use-interceptors.decorator.js +39 -0
  23. package/dist/decorators/use-pipes.decorator.js +38 -0
  24. package/dist/enums/scope.enum.js +28 -0
  25. package/dist/enums/shutdown-signal.enum.js +36 -0
  26. package/dist/errors/exceptions/circular-dependency.exception.js +30 -0
  27. package/dist/errors/exceptions/invalid-class-module.exception.js +30 -0
  28. package/dist/errors/exceptions/invalid-class-scope.exception.js +33 -0
  29. package/dist/errors/exceptions/invalid-class.exception.js +30 -0
  30. package/dist/errors/exceptions/invalid-exception-filter.exception.js +30 -0
  31. package/dist/errors/exceptions/invalid-module.exception.js +30 -0
  32. package/dist/errors/exceptions/runtime.exception.js +30 -0
  33. package/dist/errors/exceptions/undefined-dependency.exception.js +30 -0
  34. package/dist/errors/exceptions/undefined-forwardref.exception.js +30 -0
  35. package/dist/errors/exceptions/undefined-module.exception.js +30 -0
  36. package/dist/errors/exceptions/unknown-dependencies.exception.js +38 -0
  37. package/dist/errors/exceptions/unknown-element.exception.js +31 -0
  38. package/dist/errors/exceptions/unknown-export.exception.js +30 -0
  39. package/dist/errors/exceptions/unknown-module.exception.js +29 -0
  40. package/dist/errors/messages.js +134 -0
  41. package/dist/exceptions/handler.js +53 -0
  42. package/dist/exceptions/zone/handler.js +30 -0
  43. package/dist/exceptions/zone/zone.js +49 -0
  44. package/dist/filters/context-creator.js +65 -0
  45. package/dist/filters/context.js +58 -0
  46. package/dist/filters/filter.js +36 -0
  47. package/dist/guards/consumer.js +54 -0
  48. package/dist/guards/context-creator.js +76 -0
  49. package/dist/helpers/color.helper.js +35 -0
  50. package/dist/helpers/context-id-factory.helper.js +25 -0
  51. package/dist/helpers/context.helper.js +65 -0
  52. package/dist/helpers/create-param-decorator.helper.js +73 -0
  53. package/dist/helpers/filter-log-levels.util.js +38 -0
  54. package/dist/helpers/flatten.helper.js +26 -0
  55. package/dist/helpers/is-log-level-enabled.util.js +39 -0
  56. package/dist/helpers/is-log-level.util.js +26 -0
  57. package/dist/helpers/messages.helper.js +23 -0
  58. package/dist/helpers/metadata.helper.js +51 -0
  59. package/dist/helpers/noop.helper.js +23 -0
  60. package/dist/helpers/random-string-generator.helper.js +24 -0
  61. package/dist/helpers/rethrow.helper.js +25 -0
  62. package/dist/helpers/shared.helper.js +49 -0
  63. package/dist/helpers/silent.helper.js +34 -0
  64. package/dist/helpers/transient.helper.js +30 -0
  65. package/dist/helpers/uuid.helper.js +60 -0
  66. package/dist/helpers/validate-each.helper.js +42 -0
  67. package/dist/hooks/before-app-shutdown.hook.js +43 -0
  68. package/dist/hooks/on-app-bootstrap.hook.js +43 -0
  69. package/dist/hooks/on-app-shutdown.hook.js +43 -0
  70. package/dist/hooks/on-module-destroy.hook.js +43 -0
  71. package/dist/hooks/on-module-init.hook.js +43 -0
  72. package/dist/index.d.ts +3142 -0
  73. package/dist/index.js +115 -0
  74. package/dist/injector/constants.js +28 -0
  75. package/dist/injector/container.js +229 -0
  76. package/dist/injector/helpers/barrier.js +48 -0
  77. package/dist/injector/helpers/class-scope.helper.js +27 -0
  78. package/dist/injector/helpers/classifier.helper.js +35 -0
  79. package/dist/injector/helpers/is-durable.helper.js +27 -0
  80. package/dist/injector/injector.js +490 -0
  81. package/dist/injector/instance/links-host.js +68 -0
  82. package/dist/injector/instance/loader.js +95 -0
  83. package/dist/injector/instance/resolver.js +61 -0
  84. package/dist/injector/instance/wrapper.js +324 -0
  85. package/dist/injector/internal-core-module/core-providers.js +42 -0
  86. package/dist/injector/internal-core-module/internal-core-module-factory.js +66 -0
  87. package/dist/injector/internal-core-module/internal-core-module.js +46 -0
  88. package/dist/injector/module/compiler.js +47 -0
  89. package/dist/injector/module/container.js +33 -0
  90. package/dist/injector/module/lazy/loader.js +71 -0
  91. package/dist/injector/module/module.js +395 -0
  92. package/dist/injector/module/ref.js +78 -0
  93. package/dist/injector/module/token-factory.js +82 -0
  94. package/dist/injector/settlement-signal.js +50 -0
  95. package/dist/injector/topology-tree/topology-tree.js +68 -0
  96. package/dist/injector/topology-tree/tree-node.js +68 -0
  97. package/dist/inspector/graph-inspector.js +182 -0
  98. package/dist/inspector/initialize-on-preview.allowlist.js +31 -0
  99. package/dist/inspector/noop-graph-inspector.js +27 -0
  100. package/dist/inspector/partial-graph.host.js +34 -0
  101. package/dist/inspector/serialized-graph.js +128 -0
  102. package/dist/interceptors/consumer.js +54 -0
  103. package/dist/interceptors/context-creator.js +75 -0
  104. package/dist/interfaces/application/context-options.interface.js +31 -0
  105. package/dist/interfaces/application/context.interface.js +0 -0
  106. package/dist/interfaces/application/index.js +3 -0
  107. package/dist/interfaces/context/arguments-host.interface.js +0 -0
  108. package/dist/interfaces/context/context-id-factory.interface.js +0 -0
  109. package/dist/interfaces/context/context.interface.js +0 -0
  110. package/dist/interfaces/context/creator.interface.js +0 -0
  111. package/dist/interfaces/context/execution.interface.js +0 -0
  112. package/dist/interfaces/context/index.js +7 -0
  113. package/dist/interfaces/context/params.interface.js +0 -0
  114. package/dist/interfaces/features/exception-filter.interface.js +0 -0
  115. package/dist/interfaces/features/guards.interface.js +0 -0
  116. package/dist/interfaces/features/index.js +5 -0
  117. package/dist/interfaces/features/interceptor.interface.js +0 -0
  118. package/dist/interfaces/features/pipes.interface.js +0 -0
  119. package/dist/interfaces/helper.interface.js +0 -0
  120. package/dist/interfaces/hooks/before-application-shutdown.interface.js +0 -0
  121. package/dist/interfaces/hooks/index.js +6 -0
  122. package/dist/interfaces/hooks/on-application-bootstrap.interface.js +0 -0
  123. package/dist/interfaces/hooks/on-application-shutdown.interface.js +0 -0
  124. package/dist/interfaces/hooks/on-destroy.interface.js +0 -0
  125. package/dist/interfaces/hooks/on-init.interface.js +0 -0
  126. package/dist/interfaces/index.js +16 -0
  127. package/dist/interfaces/injectable.interface.js +0 -0
  128. package/dist/interfaces/injector/index.js +6 -0
  129. package/dist/interfaces/injector/injector.interface.js +0 -0
  130. package/dist/interfaces/injector/instance-wrapper.interface.js +0 -0
  131. package/dist/interfaces/injector/lazy-module-options.interface.js +0 -0
  132. package/dist/interfaces/injector/module-compiler.interface.js +0 -0
  133. package/dist/interfaces/injector/module-ref.interface.js +0 -0
  134. package/dist/interfaces/inspector/edge.interface.js +0 -0
  135. package/dist/interfaces/inspector/enhancer-metadata-cache-entry.interface.js +0 -0
  136. package/dist/interfaces/inspector/entrypoint.interface.js +0 -0
  137. package/dist/interfaces/inspector/extras.interface.js +0 -0
  138. package/dist/interfaces/inspector/index.js +8 -0
  139. package/dist/interfaces/inspector/node.interface.js +0 -0
  140. package/dist/interfaces/inspector/serialized-graph-json.interface.js +0 -0
  141. package/dist/interfaces/inspector/serialized-graph-metadata.interface.js +0 -0
  142. package/dist/interfaces/modules/definition.interface.js +0 -0
  143. package/dist/interfaces/modules/dynamic-module.interface.js +0 -0
  144. package/dist/interfaces/modules/forward-reference.interface.js +0 -0
  145. package/dist/interfaces/modules/index.js +10 -0
  146. package/dist/interfaces/modules/injection-token.interface.js +0 -0
  147. package/dist/interfaces/modules/introspection-result.interface.js +0 -0
  148. package/dist/interfaces/modules/module-metadata.interface.js +0 -0
  149. package/dist/interfaces/modules/module.interface.js +0 -0
  150. package/dist/interfaces/modules/optional-factory-dependency.interface.js +0 -0
  151. package/dist/interfaces/modules/override.interface.js +0 -0
  152. package/dist/interfaces/modules/provider.interface.js +0 -0
  153. package/dist/interfaces/param-decorator.interface.js +0 -0
  154. package/dist/interfaces/scope.interface.js +0 -0
  155. package/dist/interfaces/services/console.interface.js +0 -0
  156. package/dist/interfaces/services/index.js +4 -0
  157. package/dist/interfaces/services/logger.interface.js +0 -0
  158. package/dist/interfaces/services/reflector.interface.js +0 -0
  159. package/dist/interfaces/set-metadata.interface.js +0 -0
  160. package/dist/interfaces/type.interface.js +0 -0
  161. package/dist/metadata-scanner.js +50 -0
  162. package/dist/pipes/consumer.js +33 -0
  163. package/dist/pipes/context-creator.js +78 -0
  164. package/dist/scanner.js +371 -0
  165. package/dist/services/console.service.js +347 -0
  166. package/dist/services/logger.service.js +276 -0
  167. package/dist/services/reflector.service.js +82 -0
  168. package/dist/storage/handler-metadata.storage.js +42 -0
  169. package/dist/storage/meta-host.storage.js +62 -0
  170. package/package.json +52 -40
  171. package/application/config.d.ts +0 -35
  172. package/application/config.js +0 -85
  173. package/application/context.d.ts +0 -198
  174. package/application/context.js +0 -325
  175. package/application/factory.d.ts +0 -43
  176. package/application/factory.js +0 -147
  177. package/constants.d.ts +0 -44
  178. package/constants.js +0 -51
  179. package/context/context.d.ts +0 -66
  180. package/context/context.js +0 -156
  181. package/context/creator.d.ts +0 -9
  182. package/context/creator.js +0 -32
  183. package/context/execution-host.d.ts +0 -16
  184. package/context/execution-host.js +0 -30
  185. package/context/index.d.ts +0 -4
  186. package/context/index.js +0 -20
  187. package/context/proxy.d.ts +0 -6
  188. package/context/proxy.js +0 -33
  189. package/decorators/apply.decorator.d.ts +0 -10
  190. package/decorators/apply.decorator.js +0 -24
  191. package/decorators/bind.decorator.d.ts +0 -11
  192. package/decorators/bind.decorator.js +0 -20
  193. package/decorators/catch.decorator.d.ts +0 -17
  194. package/decorators/catch.decorator.js +0 -26
  195. package/decorators/create-param.decorator.d.ts +0 -29
  196. package/decorators/create-param.decorator.js +0 -51
  197. package/decorators/dependencies.decorator.d.ts +0 -6
  198. package/decorators/dependencies.decorator.js +0 -17
  199. package/decorators/exception-filters.decorator.d.ts +0 -21
  200. package/decorators/exception-filters.decorator.js +0 -41
  201. package/decorators/global.decorator.d.ts +0 -10
  202. package/decorators/global.decorator.js +0 -19
  203. package/decorators/index.d.ts +0 -15
  204. package/decorators/index.js +0 -31
  205. package/decorators/inject.decorator.d.ts +0 -26
  206. package/decorators/inject.decorator.js +0 -45
  207. package/decorators/injectable.decorator.d.ts +0 -40
  208. package/decorators/injectable.decorator.js +0 -51
  209. package/decorators/module.decorator.d.ts +0 -14
  210. package/decorators/module.decorator.js +0 -38
  211. package/decorators/optional.decorator.d.ts +0 -14
  212. package/decorators/optional.decorator.js +0 -30
  213. package/decorators/set-metadata.decorator.d.ts +0 -18
  214. package/decorators/set-metadata.decorator.js +0 -30
  215. package/decorators/use-guards.decorator.d.ts +0 -21
  216. package/decorators/use-guards.decorator.js +0 -40
  217. package/decorators/use-interceptors.decorator.d.ts +0 -21
  218. package/decorators/use-interceptors.decorator.js +0 -40
  219. package/decorators/use-pipes.decorator.d.ts +0 -21
  220. package/decorators/use-pipes.decorator.js +0 -39
  221. package/discovery/meta-host-collection.d.ts +0 -32
  222. package/discovery/meta-host-collection.js +0 -79
  223. package/discovery/module.d.ts +0 -5
  224. package/discovery/module.js +0 -24
  225. package/discovery/service.d.ts +0 -68
  226. package/discovery/service.js +0 -90
  227. package/errors/exceptions/circular-dependency.exception.d.ts +0 -4
  228. package/errors/exceptions/circular-dependency.exception.js +0 -11
  229. package/errors/exceptions/index.d.ts +0 -8
  230. package/errors/exceptions/index.js +0 -24
  231. package/errors/exceptions/invalid-class-module.exception.d.ts +0 -4
  232. package/errors/exceptions/invalid-class-module.exception.js +0 -11
  233. package/errors/exceptions/invalid-class-scope.exception.d.ts +0 -5
  234. package/errors/exceptions/invalid-class-scope.exception.js +0 -14
  235. package/errors/exceptions/invalid-class.exception.d.ts +0 -4
  236. package/errors/exceptions/invalid-class.exception.js +0 -11
  237. package/errors/exceptions/invalid-exception-filter.exception.d.ts +0 -4
  238. package/errors/exceptions/invalid-exception-filter.exception.js +0 -11
  239. package/errors/exceptions/invalid-module.exception.d.ts +0 -4
  240. package/errors/exceptions/invalid-module.exception.js +0 -11
  241. package/errors/exceptions/runtime.exception.d.ts +0 -4
  242. package/errors/exceptions/runtime.exception.js +0 -12
  243. package/errors/exceptions/undefined-dependency.exception.d.ts +0 -6
  244. package/errors/exceptions/undefined-dependency.exception.js +0 -11
  245. package/errors/exceptions/undefined-forwardref.exception.d.ts +0 -5
  246. package/errors/exceptions/undefined-forwardref.exception.js +0 -11
  247. package/errors/exceptions/undefined-module.exception.d.ts +0 -4
  248. package/errors/exceptions/undefined-module.exception.js +0 -11
  249. package/errors/exceptions/unknown-dependencies.exception.d.ts +0 -16
  250. package/errors/exceptions/unknown-dependencies.exception.js +0 -15
  251. package/errors/exceptions/unknown-element.exception.d.ts +0 -4
  252. package/errors/exceptions/unknown-element.exception.js +0 -12
  253. package/errors/exceptions/unknown-export.exception.d.ts +0 -4
  254. package/errors/exceptions/unknown-export.exception.js +0 -11
  255. package/errors/exceptions/unknown-module.exception.d.ts +0 -4
  256. package/errors/exceptions/unknown-module.exception.js +0 -10
  257. package/errors/messages.d.ts +0 -15
  258. package/errors/messages.js +0 -126
  259. package/exceptions/handler.d.ts +0 -10
  260. package/exceptions/handler.js +0 -34
  261. package/exceptions/index.d.ts +0 -2
  262. package/exceptions/index.js +0 -18
  263. package/exceptions/zone/handler.d.ts +0 -5
  264. package/exceptions/zone/handler.js +0 -15
  265. package/exceptions/zone/index.d.ts +0 -2
  266. package/exceptions/zone/index.js +0 -18
  267. package/exceptions/zone/zone.d.ts +0 -5
  268. package/exceptions/zone/zone.js +0 -32
  269. package/filters/context-creator.d.ts +0 -14
  270. package/filters/context-creator.js +0 -48
  271. package/filters/context.d.ts +0 -12
  272. package/filters/context.js +0 -41
  273. package/filters/filter.d.ts +0 -6
  274. package/filters/filter.js +0 -16
  275. package/filters/index.d.ts +0 -3
  276. package/filters/index.js +0 -19
  277. package/guards/consumer.d.ts +0 -9
  278. package/guards/consumer.js +0 -33
  279. package/guards/context-creator.d.ts +0 -17
  280. package/guards/context-creator.js +0 -69
  281. package/guards/index.d.ts +0 -2
  282. package/guards/index.js +0 -18
  283. package/helpers/color.helper.d.ts +0 -9
  284. package/helpers/color.helper.js +0 -14
  285. package/helpers/context-id-factory.helper.d.ts +0 -2
  286. package/helpers/context-id-factory.helper.js +0 -15
  287. package/helpers/context.helper.d.ts +0 -23
  288. package/helpers/context.helper.js +0 -49
  289. package/helpers/extends-metadata.helper.d.ts +0 -1
  290. package/helpers/extends-metadata.helper.js +0 -9
  291. package/helpers/flatten.helper.d.ts +0 -1
  292. package/helpers/flatten.helper.js +0 -9
  293. package/helpers/messages.helper.d.ts +0 -2
  294. package/helpers/messages.helper.js +0 -7
  295. package/helpers/noop.helper.d.ts +0 -1
  296. package/helpers/noop.helper.js +0 -5
  297. package/helpers/random-string-generator.helper.d.ts +0 -1
  298. package/helpers/random-string-generator.helper.js +0 -6
  299. package/helpers/rethrow.helper.d.ts +0 -1
  300. package/helpers/rethrow.helper.js +0 -7
  301. package/helpers/shared.helper.d.ts +0 -10
  302. package/helpers/shared.helper.js +0 -33
  303. package/helpers/silent.helper.d.ts +0 -10
  304. package/helpers/silent.helper.js +0 -18
  305. package/helpers/transient.helper.d.ts +0 -12
  306. package/helpers/transient.helper.js +0 -26
  307. package/helpers/uuid.helper.d.ts +0 -15
  308. package/helpers/uuid.helper.js +0 -54
  309. package/helpers/validate-each.helper.d.ts +0 -8
  310. package/helpers/validate-each.helper.js +0 -25
  311. package/hooks/before-app-shutdown.hook.d.ts +0 -9
  312. package/hooks/before-app-shutdown.hook.js +0 -45
  313. package/hooks/index.d.ts +0 -5
  314. package/hooks/index.js +0 -21
  315. package/hooks/on-app-bootstrap.hook.d.ts +0 -8
  316. package/hooks/on-app-bootstrap.hook.js +0 -45
  317. package/hooks/on-app-shutdown.hook.d.ts +0 -9
  318. package/hooks/on-app-shutdown.hook.js +0 -46
  319. package/hooks/on-module-destroy.hook.d.ts +0 -8
  320. package/hooks/on-module-destroy.hook.js +0 -45
  321. package/hooks/on-module-init.hook.d.ts +0 -8
  322. package/hooks/on-module-init.hook.js +0 -45
  323. package/index.d.ts +0 -10
  324. package/index.js +0 -32
  325. package/injector/constants.d.ts +0 -2
  326. package/injector/constants.js +0 -7
  327. package/injector/container.d.ts +0 -61
  328. package/injector/container.js +0 -194
  329. package/injector/helpers/class-scope.helper.d.ts +0 -2
  330. package/injector/helpers/class-scope.helper.js +0 -9
  331. package/injector/helpers/classifier.helper.d.ts +0 -4
  332. package/injector/helpers/classifier.helper.js +0 -17
  333. package/injector/helpers/is-durable.helper.d.ts +0 -2
  334. package/injector/helpers/is-durable.helper.js +0 -9
  335. package/injector/index.d.ts +0 -5
  336. package/injector/index.js +0 -20
  337. package/injector/injector.d.ts +0 -87
  338. package/injector/injector.js +0 -452
  339. package/injector/instance/links-host.d.ts +0 -22
  340. package/injector/instance/links-host.js +0 -50
  341. package/injector/instance/loader.d.ts +0 -21
  342. package/injector/instance/loader.js +0 -73
  343. package/injector/instance/resolver.d.ts +0 -16
  344. package/injector/instance/resolver.js +0 -43
  345. package/injector/instance/wrapper.d.ts +0 -90
  346. package/injector/instance/wrapper.js +0 -272
  347. package/injector/internal-core-module/core-providers.d.ts +0 -4
  348. package/injector/internal-core-module/core-providers.js +0 -21
  349. package/injector/internal-core-module/internal-core-module-factory.d.ts +0 -8
  350. package/injector/internal-core-module/internal-core-module-factory.js +0 -47
  351. package/injector/internal-core-module/internal-core-module.d.ts +0 -4
  352. package/injector/internal-core-module/internal-core-module.js +0 -31
  353. package/injector/module/compiler.d.ts +0 -19
  354. package/injector/module/compiler.js +0 -27
  355. package/injector/module/container.d.ts +0 -6
  356. package/injector/module/container.js +0 -24
  357. package/injector/module/lazy/loader.d.ts +0 -21
  358. package/injector/module/lazy/loader.js +0 -49
  359. package/injector/module/lazy/options.d.ts +0 -6
  360. package/injector/module/lazy/options.js +0 -2
  361. package/injector/module/module.d.ts +0 -74
  362. package/injector/module/module.js +0 -383
  363. package/injector/module/ref.d.ts +0 -106
  364. package/injector/module/ref.js +0 -62
  365. package/injector/module/token-factory.d.ts +0 -13
  366. package/injector/module/token-factory.js +0 -71
  367. package/injector/settlement-signal.d.ts +0 -37
  368. package/injector/settlement-signal.js +0 -55
  369. package/inspector/graph-inspector.d.ts +0 -26
  370. package/inspector/graph-inspector.js +0 -163
  371. package/inspector/initialize-on-preview.allowlist.d.ts +0 -6
  372. package/inspector/initialize-on-preview.allowlist.js +0 -13
  373. package/inspector/interfaces/edge.interface.d.ts +0 -28
  374. package/inspector/interfaces/edge.interface.js +0 -2
  375. package/inspector/interfaces/enhancer-metadata-cache-entry.interface.d.ts +0 -12
  376. package/inspector/interfaces/enhancer-metadata-cache-entry.interface.js +0 -2
  377. package/inspector/interfaces/entrypoint.interface.d.ts +0 -10
  378. package/inspector/interfaces/entrypoint.interface.js +0 -2
  379. package/inspector/interfaces/extras.interface.d.ts +0 -18
  380. package/inspector/interfaces/extras.interface.js +0 -2
  381. package/inspector/interfaces/node.interface.d.ts +0 -49
  382. package/inspector/interfaces/node.interface.js +0 -2
  383. package/inspector/interfaces/serialized-graph-json.interface.d.ts +0 -14
  384. package/inspector/interfaces/serialized-graph-json.interface.js +0 -2
  385. package/inspector/interfaces/serialized-graph-metadata.interface.d.ts +0 -10
  386. package/inspector/interfaces/serialized-graph-metadata.interface.js +0 -2
  387. package/inspector/noop-graph-inspector.d.ts +0 -2
  388. package/inspector/noop-graph-inspector.js +0 -8
  389. package/inspector/partial-graph.host.d.ts +0 -7
  390. package/inspector/partial-graph.host.js +0 -15
  391. package/inspector/serialized-graph.d.ts +0 -52
  392. package/inspector/serialized-graph.js +0 -121
  393. package/interceptors/consumer.d.ts +0 -9
  394. package/interceptors/consumer.js +0 -37
  395. package/interceptors/context-creator.d.ts +0 -17
  396. package/interceptors/context-creator.js +0 -67
  397. package/interceptors/index.d.ts +0 -2
  398. package/interceptors/index.js +0 -18
  399. package/interfaces/abstract.interface.d.ts +0 -3
  400. package/interfaces/abstract.interface.js +0 -2
  401. package/interfaces/application/context-options.interface.d.ts +0 -41
  402. package/interfaces/application/context-options.interface.js +0 -9
  403. package/interfaces/application/context.interface.d.ts +0 -162
  404. package/interfaces/application/context.interface.js +0 -2
  405. package/interfaces/application/index.d.ts +0 -1
  406. package/interfaces/application/index.js +0 -17
  407. package/interfaces/context/arguments-host.interface.d.ts +0 -22
  408. package/interfaces/context/arguments-host.interface.js +0 -2
  409. package/interfaces/context/execution.interface.d.ts +0 -18
  410. package/interfaces/context/execution.interface.js +0 -2
  411. package/interfaces/context/index.d.ts +0 -2
  412. package/interfaces/context/index.js +0 -18
  413. package/interfaces/features/exception-filter.interface.d.ts +0 -21
  414. package/interfaces/features/exception-filter.interface.js +0 -2
  415. package/interfaces/features/guards.interface.d.ts +0 -20
  416. package/interfaces/features/guards.interface.js +0 -2
  417. package/interfaces/features/index.d.ts +0 -4
  418. package/interfaces/features/index.js +0 -20
  419. package/interfaces/features/interceptor.interface.d.ts +0 -30
  420. package/interfaces/features/interceptor.interface.js +0 -2
  421. package/interfaces/features/pipes.interface.d.ts +0 -37
  422. package/interfaces/features/pipes.interface.js +0 -2
  423. package/interfaces/helper.interface.d.ts +0 -3
  424. package/interfaces/helper.interface.js +0 -2
  425. package/interfaces/hooks/before-application-shutdown.interface.d.ts +0 -3
  426. package/interfaces/hooks/before-application-shutdown.interface.js +0 -2
  427. package/interfaces/hooks/index.d.ts +0 -5
  428. package/interfaces/hooks/index.js +0 -21
  429. package/interfaces/hooks/on-application-bootstrap.interface.d.ts +0 -9
  430. package/interfaces/hooks/on-application-bootstrap.interface.js +0 -2
  431. package/interfaces/hooks/on-application-shutdown.interface.d.ts +0 -9
  432. package/interfaces/hooks/on-application-shutdown.interface.js +0 -2
  433. package/interfaces/hooks/on-destroy.interface.d.ts +0 -10
  434. package/interfaces/hooks/on-destroy.interface.js +0 -2
  435. package/interfaces/hooks/on-init.interface.d.ts +0 -8
  436. package/interfaces/hooks/on-init.interface.js +0 -2
  437. package/interfaces/index.d.ts +0 -8
  438. package/interfaces/index.js +0 -24
  439. package/interfaces/injectable.interface.d.ts +0 -1
  440. package/interfaces/injectable.interface.js +0 -2
  441. package/interfaces/modules/configurable/async-options.interface.d.ts +0 -42
  442. package/interfaces/modules/configurable/async-options.interface.js +0 -2
  443. package/interfaces/modules/configurable/cls.interface.d.ts +0 -13
  444. package/interfaces/modules/configurable/cls.interface.js +0 -2
  445. package/interfaces/modules/configurable/host.interface.d.ts +0 -62
  446. package/interfaces/modules/configurable/host.interface.js +0 -2
  447. package/interfaces/modules/configurable/index.d.ts +0 -3
  448. package/interfaces/modules/configurable/index.js +0 -19
  449. package/interfaces/modules/definition.interface.d.ts +0 -4
  450. package/interfaces/modules/definition.interface.js +0 -2
  451. package/interfaces/modules/dynamic-module.interface.d.ts +0 -23
  452. package/interfaces/modules/dynamic-module.interface.js +0 -2
  453. package/interfaces/modules/forward-reference.interface.d.ts +0 -3
  454. package/interfaces/modules/forward-reference.interface.js +0 -2
  455. package/interfaces/modules/index.d.ts +0 -9
  456. package/interfaces/modules/index.js +0 -25
  457. package/interfaces/modules/injection-token.interface.d.ts +0 -5
  458. package/interfaces/modules/injection-token.interface.js +0 -2
  459. package/interfaces/modules/introspection-result.interface.d.ts +0 -10
  460. package/interfaces/modules/introspection-result.interface.js +0 -2
  461. package/interfaces/modules/module-metadata.interface.d.ts +0 -24
  462. package/interfaces/modules/module-metadata.interface.js +0 -2
  463. package/interfaces/modules/module.interface.d.ts +0 -2
  464. package/interfaces/modules/module.interface.js +0 -2
  465. package/interfaces/modules/optional-factory-dependency.interface.d.ts +0 -8
  466. package/interfaces/modules/optional-factory-dependency.interface.js +0 -2
  467. package/interfaces/modules/override.interface.d.ts +0 -5
  468. package/interfaces/modules/override.interface.js +0 -2
  469. package/interfaces/modules/provider.interface.d.ts +0 -142
  470. package/interfaces/modules/provider.interface.js +0 -2
  471. package/interfaces/scope.interface.d.ts +0 -35
  472. package/interfaces/scope.interface.js +0 -23
  473. package/interfaces/type.interface.d.ts +0 -3
  474. package/interfaces/type.interface.js +0 -2
  475. package/metadata-scanner.d.ts +0 -4
  476. package/metadata-scanner.js +0 -34
  477. package/module/configurable-module.builder.d.ts +0 -93
  478. package/module/configurable-module.builder.js +0 -204
  479. package/module/constants.d.ts +0 -4
  480. package/module/constants.js +0 -7
  481. package/module/helpers/generate-options-injection-token.helper.d.ts +0 -1
  482. package/module/helpers/generate-options-injection-token.helper.js +0 -9
  483. package/module/helpers/get-injection-providers.helper.d.ts +0 -8
  484. package/module/helpers/get-injection-providers.helper.js +0 -36
  485. package/module/helpers/index.d.ts +0 -2
  486. package/module/helpers/index.js +0 -18
  487. package/module/index.d.ts +0 -2
  488. package/module/index.js +0 -18
  489. package/pipes/consumer.d.ts +0 -9
  490. package/pipes/consumer.js +0 -15
  491. package/pipes/context-creator.d.ts +0 -18
  492. package/pipes/context-creator.js +0 -70
  493. package/pipes/index.d.ts +0 -2
  494. package/pipes/index.js +0 -18
  495. package/scanner.d.ts +0 -81
  496. package/scanner.js +0 -374
  497. package/services/console.service.d.ts +0 -86
  498. package/services/console.service.js +0 -233
  499. package/services/index.d.ts +0 -1
  500. package/services/index.js +0 -17
  501. package/services/logger.service.d.ts +0 -157
  502. package/services/logger.service.js +0 -269
  503. package/services/reflector.service.d.ts +0 -110
  504. package/services/reflector.service.js +0 -87
  505. package/test/context/creator.spec.d.ts +0 -1
  506. package/test/context/creator.spec.js +0 -149
  507. package/test/context/execution-host.spec.d.ts +0 -1
  508. package/test/context/execution-host.spec.js +0 -31
  509. package/test/context/proxy.spec.d.ts +0 -1
  510. package/test/context/proxy.spec.js +0 -46
  511. package/test/exceptions/handler.spec.d.ts +0 -1
  512. package/test/exceptions/handler.spec.js +0 -90
  513. package/test/exceptions/messages.spec.js +0 -201
  514. package/test/exceptions/zona/handler.spec.d.ts +0 -1
  515. package/test/exceptions/zona/handler.spec.js +0 -51
  516. package/test/exceptions/zona/zone.spec.d.ts +0 -1
  517. package/test/exceptions/zona/zone.spec.js +0 -66
  518. package/test/filters/context-creator.spec.d.ts +0 -2
  519. package/test/filters/context-creator.spec.js +0 -91
  520. package/test/guards/consumer.spec.d.ts +0 -1
  521. package/test/guards/consumer.spec.js +0 -47
  522. package/test/guards/context-creator.spec.d.ts +0 -1
  523. package/test/guards/context-creator.spec.js +0 -138
  524. package/test/helpers/context-id-factory.spec.d.ts +0 -1
  525. package/test/helpers/context-id-factory.spec.js +0 -9
  526. package/test/helpers/shared.spec.d.ts +0 -1
  527. package/test/helpers/shared.spec.js +0 -122
  528. package/test/hooks/before-app-shutdown.hook.spec.d.ts +0 -1
  529. package/test/hooks/before-app-shutdown.hook.spec.js +0 -44
  530. package/test/hooks/on-app-bootstrap.hook.spec.d.ts +0 -1
  531. package/test/hooks/on-app-bootstrap.hook.spec.js +0 -43
  532. package/test/hooks/on-app-shutdown.hook.spec.d.ts +0 -1
  533. package/test/hooks/on-app-shutdown.hook.spec.js +0 -43
  534. package/test/hooks/on-module-destroy.hook.spec.d.ts +0 -1
  535. package/test/hooks/on-module-destroy.hook.spec.js +0 -43
  536. package/test/hooks/on-module-init.hook.spec.d.ts +0 -1
  537. package/test/hooks/on-module-init.hook.spec.js +0 -43
  538. package/test/injector/compiler.spec.d.ts +0 -1
  539. package/test/injector/compiler.spec.js +0 -42
  540. package/test/injector/container.spec.d.ts +0 -1
  541. package/test/injector/container.spec.js +0 -203
  542. package/test/injector/helpers/classifier.spec.d.ts +0 -1
  543. package/test/injector/helpers/classifier.spec.js +0 -102
  544. package/test/injector/injector.spec.d.ts +0 -1
  545. package/test/injector/injector.spec.js +0 -678
  546. package/test/injector/instance/loader.spec.d.ts +0 -1
  547. package/test/injector/instance/loader.spec.js +0 -108
  548. package/test/injector/instance/wrapper.spec.d.ts +0 -1
  549. package/test/injector/instance/wrapper.spec.js +0 -772
  550. package/test/injector/internal-core-module/internal-core-module-factory.spec.d.ts +0 -1
  551. package/test/injector/internal-core-module/internal-core-module-factory.spec.js +0 -27
  552. package/test/injector/module/lazy/loader.spec.d.ts +0 -1
  553. package/test/injector/module/lazy/loader.spec.js +0 -71
  554. package/test/injector/module/module.spec.d.ts +0 -1
  555. package/test/injector/module/module.spec.js +0 -410
  556. package/test/injector/module/token-factory.spec.d.ts +0 -1
  557. package/test/injector/module/token-factory.spec.js +0 -84
  558. package/test/interceptors/consumer.spec.d.ts +0 -1
  559. package/test/interceptors/consumer.spec.js +0 -136
  560. package/test/interceptors/context-creator.spec.d.ts +0 -1
  561. package/test/interceptors/context-creator.spec.js +0 -139
  562. package/test/metadata-scanner.spec.d.ts +0 -1
  563. package/test/metadata-scanner.spec.js +0 -41
  564. package/test/module/configurable-module.builder.spec.d.ts +0 -1
  565. package/test/module/configurable-module.builder.spec.js +0 -102
  566. package/test/module/helpers/get-injection-providers.helper.spec.d.ts +0 -1
  567. package/test/module/helpers/get-injection-providers.helper.spec.js +0 -49
  568. package/test/pipes/consumer.spec.d.ts +0 -1
  569. package/test/pipes/consumer.spec.js +0 -42
  570. package/test/pipes/context-creator.spec.d.ts +0 -1
  571. package/test/pipes/context-creator.spec.js +0 -108
  572. package/test/scanner.spec.d.ts +0 -1
  573. package/test/scanner.spec.js +0 -620
  574. package/test/services/logger.service.spec.d.ts +0 -1
  575. package/test/services/logger.service.spec.js +0 -487
  576. package/test/services/reflector.service.spec.d.ts +0 -1
  577. package/test/services/reflector.service.spec.js +0 -105
  578. package/tsconfig.tsbuildinfo +0 -1
  579. /package/{test/exceptions/messages.spec.d.ts → dist/interfaces/abstract.interface.js} +0 -0
@@ -1,46 +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 chai_1 = require("chai");
7
- const sinon_1 = __importDefault(require("sinon"));
8
- const proxy_1 = require("@venok/core/context/proxy");
9
- const handler_1 = require("@venok/core/exceptions/handler");
10
- const exceptions_1 = require("@venok/core/errors/exceptions");
11
- const filter_1 = require("@venok/core/filters/filter");
12
- describe("VenokProxy", () => {
13
- let venokProxy;
14
- let handlerMock;
15
- let handler;
16
- beforeEach(() => {
17
- handler = new handler_1.VenokExceptionsHandler(new filter_1.VenokExceptionFilter());
18
- handlerMock = sinon_1.default.mock(handler);
19
- venokProxy = new proxy_1.VenokProxy();
20
- });
21
- describe("createProxy", () => {
22
- it("should method return thunk", () => {
23
- const proxy = venokProxy.createProxy(() => { }, handler);
24
- (0, chai_1.expect)(typeof proxy === "function").to.be.true;
25
- });
26
- it("should method encapsulate callback passed as argument", () => {
27
- const expectation = handlerMock.expects("next").once();
28
- const proxy = venokProxy.createProxy((req, res, next) => {
29
- throw new exceptions_1.RuntimeException("test");
30
- }, handler);
31
- proxy(null, null, null);
32
- expectation.verify();
33
- });
34
- it("should method encapsulate async callback passed as argument", (done) => {
35
- const expectation = handlerMock.expects("next").once();
36
- const proxy = venokProxy.createProxy(async (req, res, next) => {
37
- throw new exceptions_1.RuntimeException("test");
38
- }, handler);
39
- proxy(null, null, null);
40
- setTimeout(() => {
41
- expectation.verify();
42
- done();
43
- }, 0);
44
- });
45
- });
46
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,90 +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 chai_1 = require("chai");
7
- const rxjs_1 = require("rxjs");
8
- const sinon_1 = __importDefault(require("sinon"));
9
- const handler_1 = require("@venok/core/exceptions/handler");
10
- const filter_1 = require("@venok/core/filters/filter");
11
- describe("VenokExceptionsHandler", () => {
12
- let handler;
13
- beforeEach(() => {
14
- handler = new handler_1.VenokExceptionsHandler(new filter_1.VenokExceptionFilter());
15
- });
16
- describe("next", () => {
17
- // it("should method returns expected stream with message when exception is unknown", () => {
18
- // const error = new Error();
19
- // expect(() => handler.next(error, null as any)).to.throw(error);
20
- // });
21
- describe('when "invokeCustomFilters" returns value', () => {
22
- const observable$ = (0, rxjs_1.of)(true);
23
- beforeEach(() => {
24
- sinon_1.default.stub(handler, "invokeCustomFilters").returns(observable$);
25
- });
26
- it("should return observable", () => {
27
- const result = handler.next(new Error(), null);
28
- (0, chai_1.expect)(result).to.be.eql(observable$);
29
- });
30
- });
31
- });
32
- describe("setCustomFilters", () => {
33
- const filters = ["test", "test2"];
34
- it("should set custom filters", () => {
35
- handler.setCustomFilters(filters);
36
- (0, chai_1.expect)(handler.filters).to.be.eql(filters);
37
- });
38
- it("should throw exception when passed argument is not an array", () => {
39
- (0, chai_1.expect)(() => handler.setCustomFilters(null)).to.throw();
40
- });
41
- });
42
- describe("invokeCustomFilters", () => {
43
- describe("when filters array is empty", () => {
44
- it("should return identity", () => {
45
- (0, chai_1.expect)(handler.invokeCustomFilters(null, null)).to.be.false;
46
- });
47
- });
48
- describe("when filters array is not empty", () => {
49
- let filters, funcSpy;
50
- class TestException {
51
- }
52
- class AnotherTestException {
53
- }
54
- beforeEach(() => {
55
- funcSpy = sinon_1.default.spy();
56
- });
57
- describe("when filter exists in filters array", () => {
58
- beforeEach(() => {
59
- filters = [{ exceptionMetatypes: [TestException], func: funcSpy }];
60
- handler.filters = filters;
61
- });
62
- it("should call funcSpy", () => {
63
- handler.invokeCustomFilters(new TestException(), null);
64
- (0, chai_1.expect)(funcSpy.notCalled).to.be.false;
65
- });
66
- it("should call funcSpy with exception and response passed as an arguments", () => {
67
- const exception = new TestException();
68
- handler.invokeCustomFilters(exception, null);
69
- (0, chai_1.expect)(funcSpy.calledWith(exception)).to.be.true;
70
- });
71
- it("should return stream", () => {
72
- (0, chai_1.expect)(handler.invokeCustomFilters(new TestException(), null)).to.be.not.null;
73
- });
74
- });
75
- describe("when filter does not exists in filters array", () => {
76
- beforeEach(() => {
77
- filters = [{ exceptionMetatypes: [AnotherTestException], func: funcSpy }];
78
- handler.filters = filters;
79
- });
80
- it("should not call funcSpy", () => {
81
- handler.invokeCustomFilters(new TestException(), null);
82
- (0, chai_1.expect)(funcSpy.notCalled).to.be.true;
83
- });
84
- it("should return null", () => {
85
- (0, chai_1.expect)(handler.invokeCustomFilters(new TestException(), null)).to.be.false;
86
- });
87
- });
88
- });
89
- });
90
- });
@@ -1,201 +0,0 @@
1
- "use strict";
2
- // import { expect } from "chai";
3
- // import {UnknownDependenciesException} from "@venok/core/errors/exceptions/unknown-dependencies.exception";
4
- //
5
- // describe("Error Messages", () => {
6
- // const CatsModule = { name: "CatsModule" };
7
- // const AppModule = { name: "AppModule" };
8
- //
9
- // describe("UNKNOWN_DEPENDENCIES_MESSAGE", () => {
10
- // const index = 0;
11
- // it("should display class", () => {
12
- // const expectedResult =
13
- // stringCleaner(`Nest can't resolve dependencies of the CatService (?, CatService). Please make sure that the argument dependency at index [0] is available in the current context.
14
- //
15
- // Potential solutions:
16
- // - If dependency is a provider, is it part of the current Module?
17
- // - If dependency is exported from a separate @Module, is that module imported within Module?
18
- // @Module({
19
- // imports: [ /* the Module containing dependency */ ]
20
- // })
21
- // `);
22
- //
23
- // class CatService {}
24
- //
25
- // const actualMessage = stringCleaner(
26
- // new UnknownDependenciesException("CatService", {
27
- // index,
28
- // dependencies: ["", CatService],
29
- // }).message,
30
- // );
31
- //
32
- // expect(actualMessage).to.equal(expectedResult);
33
- // });
34
- // it("should display the provide token", () => {
35
- // const expectedResult =
36
- // stringCleaner(`Nest can't resolve dependencies of the CatService (?, MY_TOKEN). Please make sure that the argument dependency at index [0] is available in the current context.
37
- //
38
- // Potential solutions:
39
- // - If dependency is a provider, is it part of the current Module?
40
- // - If dependency is exported from a separate @Module, is that module imported within Module?
41
- // @Module({
42
- // imports: [ /* the Module containing dependency */ ]
43
- // })
44
- // `);
45
- //
46
- // const actualMessage = stringCleaner(
47
- // new UnknownDependenciesException("CatService", {
48
- // index,
49
- // dependencies: ["", "MY_TOKEN"],
50
- // }).message,
51
- // );
52
- //
53
- // expect(actualMessage).to.equal(expectedResult);
54
- // });
55
- // it("should display the function name", () => {
56
- // const expectedResult =
57
- // stringCleaner(`Nest can't resolve dependencies of the CatService (?, CatFunction). Please make sure that the argument dependency at index [0] is available in the current context.
58
- //
59
- // Potential solutions:
60
- // - If dependency is a provider, is it part of the current Module?
61
- // - If dependency is exported from a separate @Module, is that module imported within Module?
62
- // @Module({
63
- // imports: [ /* the Module containing dependency */ ]
64
- // })
65
- // `);
66
- //
67
- // function CatFunction() {}
68
- // const actualMessage = stringCleaner(
69
- // new UnknownDependenciesException("CatService", {
70
- // index,
71
- // dependencies: ["", CatFunction],
72
- // }).message,
73
- // );
74
- // expect(actualMessage).to.equal(expectedResult);
75
- // });
76
- // it('should use "+" if unknown dependency name', () => {
77
- // const expectedResult =
78
- // stringCleaner(`Nest can't resolve dependencies of the CatService (?, +). Please make sure that the argument dependency at index [0] is available in the current context.
79
- //
80
- // Potential solutions:
81
- // - If dependency is a provider, is it part of the current Module?
82
- // - If dependency is exported from a separate @Module, is that module imported within Module?
83
- // @Module({
84
- // imports: [ /* the Module containing dependency */ ]
85
- // })
86
- // `);
87
- //
88
- // const actualMessage = stringCleaner(
89
- // new UnknownDependenciesException("CatService", {
90
- // index,
91
- // dependencies: ["", undefined],
92
- // }).message,
93
- // );
94
- //
95
- // expect(actualMessage).to.equal(expectedResult);
96
- // });
97
- // it("should display the module name", () => {
98
- // const expectedResult =
99
- // stringCleaner(`Nest can't resolve dependencies of the CatService (?, MY_TOKEN). Please make sure that the argument dependency at index [0] is available in the TestModule context.
100
- //
101
- // Potential solutions:
102
- // - Is TestModule a valid NestJS module?
103
- // - If dependency is a provider, is it part of the current TestModule?
104
- // - If dependency is exported from a separate @Module, is that module imported within TestModule?
105
- // @Module({
106
- // imports: [ /* the Module containing dependency */ ]
107
- // })
108
- // `);
109
- //
110
- // class MetaType {
111
- // name: string;
112
- // }
113
- // class TestModule {
114
- // metatype: MetaType;
115
- // }
116
- // const myModule = new TestModule();
117
- // const myMetaType = new MetaType();
118
- // myMetaType.name = "TestModule";
119
- // myModule.metatype = myMetaType;
120
- //
121
- // const actualMessage = stringCleaner(
122
- // new UnknownDependenciesException("CatService", { index, dependencies: ["", "MY_TOKEN"] }, myModule as Module)
123
- // .message,
124
- // );
125
- //
126
- // expect(actualMessage).to.equal(expectedResult);
127
- // });
128
- // it("should display the symbol name of the provider", () => {
129
- // const expectedResult =
130
- // stringCleaner(`Nest can't resolve dependencies of the Symbol(CatProvider) (?). Please make sure that the argument dependency at index [0] is available in the current context.
131
- //
132
- // Potential solutions:
133
- // - If dependency is a provider, is it part of the current Module?
134
- // - If dependency is exported from a separate @Module, is that module imported within Module?
135
- // @Module({
136
- // imports: [ /* the Module containing dependency */ ]
137
- // })
138
- // `);
139
- //
140
- // const actualMessage = stringCleaner(
141
- // new UnknownDependenciesException(Symbol("CatProvider"), {
142
- // index,
143
- // dependencies: [""],
144
- // }).message,
145
- // );
146
- //
147
- // expect(actualMessage).to.equal(expectedResult);
148
- // });
149
- // it("should display the symbol dependency of the provider", () => {
150
- // const expectedResult =
151
- // stringCleaner(`Nest can't resolve dependencies of the CatProvider (?, Symbol(DogProvider)). Please make sure that the argument dependency at index [0] is available in the current context.
152
- //
153
- // Potential solutions:
154
- // - If dependency is a provider, is it part of the current Module?
155
- // - If dependency is exported from a separate @Module, is that module imported within Module?
156
- // @Module({
157
- // imports: [ /* the Module containing dependency */ ]
158
- // })
159
- // `);
160
- //
161
- // const actualMessage = stringCleaner(
162
- // new UnknownDependenciesException("CatProvider", {
163
- // index,
164
- // dependencies: ["", Symbol("DogProvider")],
165
- // }).message,
166
- // );
167
- //
168
- // expect(actualMessage).to.equal(expectedResult);
169
- // });
170
- // });
171
- //
172
- // describe("UNDEFINED_MODULE_EXCEPTION", () => {
173
- // it("should display the module name with the undefined index and scope", () => {
174
- // const expectedMessage = stringCleaner(`Nest cannot create the CatsModule instance.
175
- // The module at index [0] of the CatsModule "imports" array is undefined.
176
- //
177
- // Potential causes:
178
- // - A circular dependency between modules. Use forwardRef() to avoid it. Read more: https://docs.nestjs.com/fundamentals/circular-dependency
179
- // - The module at index [0] is of type "undefined". Check your import statements and the type of the module.
180
- //
181
- // Scope [AppModule -> CatsModule]`);
182
- //
183
- // const actualMessage = stringCleaner(UNDEFINED_MODULE_MESSAGE(CatsModule, 0, [AppModule, CatsModule]));
184
- //
185
- // expect(actualMessage).to.be.eq(expectedMessage);
186
- // });
187
- // });
188
- //
189
- // describe("INVALID_MODULE_MESSAGE", () => {
190
- // it("should display the module name with the invalid index and scope", () => {
191
- // const expectedMessage = stringCleaner(`Nest cannot create the CatsModule instance.
192
- // Received an unexpected value at index [0] of the CatsModule "imports" array.
193
- //
194
- // Scope [AppModule -> CatsModule]`);
195
- //
196
- // const actualMessage = stringCleaner(INVALID_MODULE_MESSAGE(CatsModule, 0, [AppModule, CatsModule]));
197
- //
198
- // expect(actualMessage).to.be.eq(expectedMessage);
199
- // });
200
- // });
201
- // });
@@ -1 +0,0 @@
1
- export {};
@@ -1,51 +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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- const sinon = __importStar(require("sinon"));
27
- const chai_1 = require("chai");
28
- const handler_1 = require("@venok/core/exceptions/zone/handler");
29
- const exceptions_1 = require("@venok/core/errors/exceptions");
30
- describe("ExceptionHandler", () => {
31
- let instance;
32
- beforeEach(() => {
33
- instance = new handler_1.ExceptionHandler();
34
- });
35
- describe("handle", () => {
36
- let logger;
37
- let errorSpy;
38
- beforeEach(() => {
39
- logger = {
40
- error: () => { },
41
- };
42
- handler_1.ExceptionHandler.logger = logger;
43
- errorSpy = sinon.spy(logger, "error");
44
- });
45
- it("when exception is instanceof RuntimeException", () => {
46
- const exception = new exceptions_1.RuntimeException("msg");
47
- instance.handle(exception);
48
- (0, chai_1.expect)(errorSpy.calledWith(exception.message, exception.stack)).to.be.true;
49
- });
50
- });
51
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,66 +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 chai_1 = require("chai");
7
- const sinon_1 = __importDefault(require("sinon"));
8
- const zone_1 = require("@venok/core/exceptions/zone/zone");
9
- describe("ExceptionsZone", () => {
10
- const rethrow = (err) => {
11
- throw err;
12
- };
13
- describe("run", () => {
14
- let callback;
15
- beforeEach(() => {
16
- callback = sinon_1.default.spy();
17
- });
18
- it("should call callback", () => {
19
- zone_1.ExceptionsZone.run(callback, rethrow);
20
- (0, chai_1.expect)(callback.called).to.be.true;
21
- });
22
- describe("when callback throws exception", () => {
23
- const exceptionHandler = {
24
- handle: () => { },
25
- };
26
- let handleSpy;
27
- beforeEach(() => {
28
- zone_1.ExceptionsZone.exceptionHandler = exceptionHandler;
29
- handleSpy = sinon_1.default.spy(exceptionHandler, "handle");
30
- });
31
- it('should call "handle" method of exceptionHandler and rethrows', () => {
32
- const throwsCallback = () => {
33
- throw new Error("");
34
- };
35
- (0, chai_1.expect)(() => zone_1.ExceptionsZone.run(throwsCallback, rethrow)).to.throws();
36
- (0, chai_1.expect)(handleSpy.called).to.be.true;
37
- });
38
- });
39
- });
40
- describe("asyncRun", () => {
41
- let callback;
42
- beforeEach(() => {
43
- callback = sinon_1.default.spy();
44
- });
45
- it("should call callback", async () => {
46
- await zone_1.ExceptionsZone.asyncRun(callback, rethrow);
47
- (0, chai_1.expect)(callback.called).to.be.true;
48
- });
49
- describe("when callback throws exception", () => {
50
- const exceptionHandler = {
51
- handle: () => { },
52
- };
53
- let handleSpy;
54
- beforeEach(() => {
55
- zone_1.ExceptionsZone.exceptionHandler = exceptionHandler;
56
- handleSpy = sinon_1.default.spy(exceptionHandler, "handle");
57
- });
58
- it('should call "handle" method of exceptionHandler and rethrows error', async () => {
59
- const throwsCallback = () => {
60
- throw new Error("");
61
- };
62
- (0, chai_1.expect)(zone_1.ExceptionsZone.asyncRun(throwsCallback, rethrow)).to.eventually.be.rejected;
63
- });
64
- });
65
- });
66
- });
@@ -1,2 +0,0 @@
1
- export declare class Filter {
2
- }
@@ -1,91 +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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Filter = void 0;
27
- const chai_1 = require("chai");
28
- const sinon = __importStar(require("sinon"));
29
- const context_creator_1 = require("@venok/core/filters/context-creator");
30
- const container_1 = require("@venok/core/injector/container");
31
- class Filter {
32
- }
33
- exports.Filter = Filter;
34
- describe("ExceptionFilterContextCreator", () => {
35
- let filter;
36
- let container;
37
- beforeEach(() => {
38
- container = new container_1.VenokContainer();
39
- filter = new context_creator_1.ExceptionFilterContextCreator(container);
40
- });
41
- describe("getFilterInstance", () => {
42
- describe("when param is an object", () => {
43
- it("should return instance", () => {
44
- const instance = { catch: () => null };
45
- (0, chai_1.expect)(filter.getFilterInstance(instance)).to.be.eql(instance);
46
- });
47
- });
48
- describe("when param is a constructor", () => {
49
- it("should pick instance from container", () => {
50
- const wrapper = {
51
- instance: "test",
52
- getInstanceByContextId: () => wrapper,
53
- };
54
- sinon.stub(filter, "getInstanceByMetatype").callsFake(() => wrapper);
55
- (0, chai_1.expect)(filter.getFilterInstance(Filter)).to.be.eql(wrapper.instance);
56
- });
57
- it("should return null", () => {
58
- sinon.stub(filter, "getInstanceByMetatype").callsFake(() => null);
59
- (0, chai_1.expect)(filter.getFilterInstance(Filter)).to.be.eql(null);
60
- });
61
- });
62
- });
63
- describe("getInstanceByMetatype", () => {
64
- describe('when "moduleContext" is nil', () => {
65
- it("should return undefined", () => {
66
- filter.moduleContext = undefined;
67
- (0, chai_1.expect)(filter.getInstanceByMetatype(null)).to.be.undefined;
68
- });
69
- });
70
- describe('when "moduleContext" is not nil', () => {
71
- beforeEach(() => {
72
- filter.moduleContext = "test";
73
- });
74
- describe("and when module exists", () => {
75
- it("should return undefined", () => {
76
- sinon.stub(container.getModules(), "get").callsFake(() => undefined);
77
- (0, chai_1.expect)(filter.getInstanceByMetatype(null)).to.be.undefined;
78
- });
79
- });
80
- describe("and when module does not exist", () => {
81
- it("should return instance", () => {
82
- const instance = { test: true };
83
- const module = { injectables: { get: () => instance } };
84
- sinon.stub(container.getModules(), "get").callsFake(() => module);
85
- (0, chai_1.expect)(filter.getInstanceByMetatype(class {
86
- })).to.be.eql(instance);
87
- });
88
- });
89
- });
90
- });
91
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const chai_1 = require("chai");
4
- const rxjs_1 = require("rxjs");
5
- const guards_1 = require("@venok/core/guards");
6
- describe("GuardsConsumer", () => {
7
- let consumer;
8
- let guards;
9
- beforeEach(() => {
10
- consumer = new guards_1.GuardsConsumer();
11
- guards = [{ canActivate: () => true }, { canActivate: () => true }];
12
- });
13
- describe("tryActivate", () => {
14
- describe("when guards array is empty", () => {
15
- it("should return true", async () => {
16
- const canActivate = await consumer.tryActivate([], [], { constructor: null }, null);
17
- (0, chai_1.expect)(canActivate).to.be.true;
18
- });
19
- });
20
- describe("when guards array is not empty", () => {
21
- describe("when at least on guard returns false", () => {
22
- it("should return false", async () => {
23
- const canActivate = await consumer.tryActivate([...guards, { canActivate: () => false }], [], { constructor: null }, null);
24
- (0, chai_1.expect)(canActivate).to.be.false;
25
- });
26
- });
27
- describe("when each guard returns true", () => {
28
- it("should return true", async () => {
29
- const canActivate = await consumer.tryActivate(guards, [], { constructor: null }, null);
30
- (0, chai_1.expect)(canActivate).to.be.true;
31
- });
32
- });
33
- });
34
- });
35
- describe("pickResult", () => {
36
- describe("when result is Observable", () => {
37
- it("should return result", async () => {
38
- (0, chai_1.expect)(await consumer.pickResult((0, rxjs_1.of)(true))).to.be.true;
39
- });
40
- });
41
- describe("when result is Promise", () => {
42
- it("should await promise", async () => {
43
- (0, chai_1.expect)(await consumer.pickResult(Promise.resolve(true))).to.be.true;
44
- });
45
- });
46
- });
47
- });
@@ -1 +0,0 @@
1
- export {};