@venok/core 1.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 (400) hide show
  1. package/application/config.d.ts +35 -0
  2. package/application/config.js +85 -0
  3. package/application/context.d.ts +198 -0
  4. package/application/context.js +325 -0
  5. package/application/factory.d.ts +43 -0
  6. package/application/factory.js +147 -0
  7. package/constants.d.ts +46 -0
  8. package/constants.js +53 -0
  9. package/context/creator.d.ts +9 -0
  10. package/context/creator.js +32 -0
  11. package/context/execution-host.d.ts +16 -0
  12. package/context/execution-host.js +30 -0
  13. package/context/external/creator.d.ts +63 -0
  14. package/context/external/creator.js +159 -0
  15. package/context/external/proxy.d.ts +5 -0
  16. package/context/external/proxy.js +19 -0
  17. package/decorators/apply.decorator.d.ts +10 -0
  18. package/decorators/apply.decorator.js +24 -0
  19. package/decorators/bind.decorator.d.ts +11 -0
  20. package/decorators/bind.decorator.js +20 -0
  21. package/decorators/catch.decorator.d.ts +17 -0
  22. package/decorators/catch.decorator.js +26 -0
  23. package/decorators/create-param.decorator.d.ts +29 -0
  24. package/decorators/create-param.decorator.js +51 -0
  25. package/decorators/dependencies.decorator.d.ts +6 -0
  26. package/decorators/dependencies.decorator.js +17 -0
  27. package/decorators/exception-filters.decorator.d.ts +21 -0
  28. package/decorators/exception-filters.decorator.js +41 -0
  29. package/decorators/global.decorator.d.ts +10 -0
  30. package/decorators/global.decorator.js +19 -0
  31. package/decorators/index.d.ts +15 -0
  32. package/decorators/index.js +31 -0
  33. package/decorators/inject.decorator.d.ts +26 -0
  34. package/decorators/inject.decorator.js +45 -0
  35. package/decorators/injectable.decorator.d.ts +40 -0
  36. package/decorators/injectable.decorator.js +51 -0
  37. package/decorators/module.decorator.d.ts +14 -0
  38. package/decorators/module.decorator.js +38 -0
  39. package/decorators/optional.decorator.d.ts +14 -0
  40. package/decorators/optional.decorator.js +30 -0
  41. package/decorators/set-metadata.decorator.d.ts +18 -0
  42. package/decorators/set-metadata.decorator.js +30 -0
  43. package/decorators/use-guards.decorator.d.ts +21 -0
  44. package/decorators/use-guards.decorator.js +40 -0
  45. package/decorators/use-interceptors.decorator.d.ts +21 -0
  46. package/decorators/use-interceptors.decorator.js +40 -0
  47. package/decorators/use-pipes.decorator.d.ts +21 -0
  48. package/decorators/use-pipes.decorator.js +39 -0
  49. package/discovery/meta-host-collection.d.ts +32 -0
  50. package/discovery/meta-host-collection.js +79 -0
  51. package/discovery/module.d.ts +5 -0
  52. package/discovery/module.js +24 -0
  53. package/discovery/service.d.ts +68 -0
  54. package/discovery/service.js +90 -0
  55. package/errors/exceptions/circular-dependency.exception.d.ts +4 -0
  56. package/errors/exceptions/circular-dependency.exception.js +11 -0
  57. package/errors/exceptions/index.d.ts +8 -0
  58. package/errors/exceptions/index.js +24 -0
  59. package/errors/exceptions/invalid-class-module.exception.d.ts +4 -0
  60. package/errors/exceptions/invalid-class-module.exception.js +11 -0
  61. package/errors/exceptions/invalid-class-scope.exception.d.ts +5 -0
  62. package/errors/exceptions/invalid-class-scope.exception.js +14 -0
  63. package/errors/exceptions/invalid-class.exception.d.ts +4 -0
  64. package/errors/exceptions/invalid-class.exception.js +11 -0
  65. package/errors/exceptions/invalid-exception-filter.exception.d.ts +4 -0
  66. package/errors/exceptions/invalid-exception-filter.exception.js +11 -0
  67. package/errors/exceptions/invalid-module.exception.d.ts +4 -0
  68. package/errors/exceptions/invalid-module.exception.js +11 -0
  69. package/errors/exceptions/runtime.exception.d.ts +4 -0
  70. package/errors/exceptions/runtime.exception.js +12 -0
  71. package/errors/exceptions/undefined-dependency.exception.d.ts +6 -0
  72. package/errors/exceptions/undefined-dependency.exception.js +11 -0
  73. package/errors/exceptions/undefined-forwardref.exception.d.ts +5 -0
  74. package/errors/exceptions/undefined-forwardref.exception.js +11 -0
  75. package/errors/exceptions/undefined-module.exception.d.ts +4 -0
  76. package/errors/exceptions/undefined-module.exception.js +11 -0
  77. package/errors/exceptions/unknown-dependencies.exception.d.ts +16 -0
  78. package/errors/exceptions/unknown-dependencies.exception.js +15 -0
  79. package/errors/exceptions/unknown-element.exception.d.ts +4 -0
  80. package/errors/exceptions/unknown-element.exception.js +12 -0
  81. package/errors/exceptions/unknown-export.exception.d.ts +4 -0
  82. package/errors/exceptions/unknown-export.exception.js +11 -0
  83. package/errors/exceptions/unknown-module.exception.d.ts +4 -0
  84. package/errors/exceptions/unknown-module.exception.js +10 -0
  85. package/errors/messages.d.ts +15 -0
  86. package/errors/messages.js +126 -0
  87. package/exceptions/external/filter-context.d.ts +10 -0
  88. package/exceptions/external/filter-context.js +37 -0
  89. package/exceptions/external/filter.d.ts +5 -0
  90. package/exceptions/external/filter.js +16 -0
  91. package/exceptions/external/handler.d.ts +9 -0
  92. package/exceptions/external/handler.js +31 -0
  93. package/exceptions/filter-context.d.ts +14 -0
  94. package/exceptions/filter-context.js +55 -0
  95. package/exceptions/select-exception-filter-metadata.d.ts +2 -0
  96. package/exceptions/select-exception-filter-metadata.js +6 -0
  97. package/exceptions/zone/handler.d.ts +5 -0
  98. package/exceptions/zone/handler.js +15 -0
  99. package/exceptions/zone/zone.d.ts +5 -0
  100. package/exceptions/zone/zone.js +32 -0
  101. package/guards/consumer.d.ts +9 -0
  102. package/guards/consumer.js +33 -0
  103. package/guards/context-creator.d.ts +17 -0
  104. package/guards/context-creator.js +69 -0
  105. package/guards/index.d.ts +2 -0
  106. package/guards/index.js +18 -0
  107. package/helpers/color.helper.d.ts +9 -0
  108. package/helpers/color.helper.js +14 -0
  109. package/helpers/context-id-factory.helper.d.ts +2 -0
  110. package/helpers/context-id-factory.helper.js +15 -0
  111. package/helpers/context.helper.d.ts +23 -0
  112. package/helpers/context.helper.js +49 -0
  113. package/helpers/extends-metadata.helper.d.ts +1 -0
  114. package/helpers/extends-metadata.helper.js +9 -0
  115. package/helpers/flatten.helper.d.ts +1 -0
  116. package/helpers/flatten.helper.js +9 -0
  117. package/helpers/messages.helper.d.ts +2 -0
  118. package/helpers/messages.helper.js +7 -0
  119. package/helpers/noop.helper.d.ts +1 -0
  120. package/helpers/noop.helper.js +5 -0
  121. package/helpers/random-string-generator.helper.d.ts +1 -0
  122. package/helpers/random-string-generator.helper.js +6 -0
  123. package/helpers/rethrow.helper.d.ts +1 -0
  124. package/helpers/rethrow.helper.js +7 -0
  125. package/helpers/shared.helper.d.ts +10 -0
  126. package/helpers/shared.helper.js +33 -0
  127. package/helpers/silent.helper.d.ts +10 -0
  128. package/helpers/silent.helper.js +18 -0
  129. package/helpers/transient.helper.d.ts +12 -0
  130. package/helpers/transient.helper.js +26 -0
  131. package/helpers/uuid.helper.d.ts +15 -0
  132. package/helpers/uuid.helper.js +54 -0
  133. package/helpers/validate-each.helper.d.ts +8 -0
  134. package/helpers/validate-each.helper.js +25 -0
  135. package/hooks/before-app-shutdown.hook.d.ts +9 -0
  136. package/hooks/before-app-shutdown.hook.js +45 -0
  137. package/hooks/index.d.ts +5 -0
  138. package/hooks/index.js +21 -0
  139. package/hooks/on-app-bootstrap.hook.d.ts +8 -0
  140. package/hooks/on-app-bootstrap.hook.js +45 -0
  141. package/hooks/on-app-shutdown.hook.d.ts +9 -0
  142. package/hooks/on-app-shutdown.hook.js +46 -0
  143. package/hooks/on-module-destroy.hook.d.ts +8 -0
  144. package/hooks/on-module-destroy.hook.js +45 -0
  145. package/hooks/on-module-init.hook.d.ts +8 -0
  146. package/hooks/on-module-init.hook.js +45 -0
  147. package/index.d.ts +10 -0
  148. package/index.js +32 -0
  149. package/injector/constants.d.ts +2 -0
  150. package/injector/constants.js +7 -0
  151. package/injector/container.d.ts +61 -0
  152. package/injector/container.js +194 -0
  153. package/injector/helpers/class-scope.helper.d.ts +2 -0
  154. package/injector/helpers/class-scope.helper.js +9 -0
  155. package/injector/helpers/classifier.helper.d.ts +4 -0
  156. package/injector/helpers/classifier.helper.js +17 -0
  157. package/injector/helpers/is-durable.helper.d.ts +2 -0
  158. package/injector/helpers/is-durable.helper.js +9 -0
  159. package/injector/index.d.ts +5 -0
  160. package/injector/index.js +20 -0
  161. package/injector/injector.d.ts +87 -0
  162. package/injector/injector.js +452 -0
  163. package/injector/instance/links-host.d.ts +22 -0
  164. package/injector/instance/links-host.js +50 -0
  165. package/injector/instance/loader.d.ts +21 -0
  166. package/injector/instance/loader.js +73 -0
  167. package/injector/instance/resolver.d.ts +16 -0
  168. package/injector/instance/resolver.js +43 -0
  169. package/injector/instance/wrapper.d.ts +90 -0
  170. package/injector/instance/wrapper.js +272 -0
  171. package/injector/internal-core-module/core-providers.d.ts +4 -0
  172. package/injector/internal-core-module/core-providers.js +21 -0
  173. package/injector/internal-core-module/internal-core-module-factory.d.ts +8 -0
  174. package/injector/internal-core-module/internal-core-module-factory.js +42 -0
  175. package/injector/internal-core-module/internal-core-module.d.ts +4 -0
  176. package/injector/internal-core-module/internal-core-module.js +31 -0
  177. package/injector/module/compiler.d.ts +19 -0
  178. package/injector/module/compiler.js +27 -0
  179. package/injector/module/container.d.ts +6 -0
  180. package/injector/module/container.js +24 -0
  181. package/injector/module/lazy/loader.d.ts +21 -0
  182. package/injector/module/lazy/loader.js +49 -0
  183. package/injector/module/lazy/options.d.ts +6 -0
  184. package/injector/module/lazy/options.js +2 -0
  185. package/injector/module/module.d.ts +74 -0
  186. package/injector/module/module.js +383 -0
  187. package/injector/module/ref.d.ts +106 -0
  188. package/injector/module/ref.js +62 -0
  189. package/injector/module/token-factory.d.ts +13 -0
  190. package/injector/module/token-factory.js +71 -0
  191. package/injector/settlement-signal.d.ts +37 -0
  192. package/injector/settlement-signal.js +55 -0
  193. package/inspector/graph-inspector.d.ts +26 -0
  194. package/inspector/graph-inspector.js +163 -0
  195. package/inspector/initialize-on-preview.allowlist.d.ts +6 -0
  196. package/inspector/initialize-on-preview.allowlist.js +13 -0
  197. package/inspector/interfaces/edge.interface.d.ts +28 -0
  198. package/inspector/interfaces/edge.interface.js +2 -0
  199. package/inspector/interfaces/enhancer-metadata-cache-entry.interface.d.ts +12 -0
  200. package/inspector/interfaces/enhancer-metadata-cache-entry.interface.js +2 -0
  201. package/inspector/interfaces/entrypoint.interface.d.ts +10 -0
  202. package/inspector/interfaces/entrypoint.interface.js +2 -0
  203. package/inspector/interfaces/extras.interface.d.ts +18 -0
  204. package/inspector/interfaces/extras.interface.js +2 -0
  205. package/inspector/interfaces/node.interface.d.ts +49 -0
  206. package/inspector/interfaces/node.interface.js +2 -0
  207. package/inspector/interfaces/serialized-graph-json.interface.d.ts +14 -0
  208. package/inspector/interfaces/serialized-graph-json.interface.js +2 -0
  209. package/inspector/interfaces/serialized-graph-metadata.interface.d.ts +10 -0
  210. package/inspector/interfaces/serialized-graph-metadata.interface.js +2 -0
  211. package/inspector/noop-graph-inspector.d.ts +2 -0
  212. package/inspector/noop-graph-inspector.js +8 -0
  213. package/inspector/partial-graph.host.d.ts +7 -0
  214. package/inspector/partial-graph.host.js +15 -0
  215. package/inspector/serialized-graph.d.ts +52 -0
  216. package/inspector/serialized-graph.js +121 -0
  217. package/interceptors/consumer.d.ts +9 -0
  218. package/interceptors/consumer.js +37 -0
  219. package/interceptors/context-creator.d.ts +17 -0
  220. package/interceptors/context-creator.js +67 -0
  221. package/interceptors/index.d.ts +2 -0
  222. package/interceptors/index.js +18 -0
  223. package/interfaces/abstract.interface.d.ts +3 -0
  224. package/interfaces/abstract.interface.js +2 -0
  225. package/interfaces/application/context-options.interface.d.ts +41 -0
  226. package/interfaces/application/context-options.interface.js +9 -0
  227. package/interfaces/application/context.interface.d.ts +162 -0
  228. package/interfaces/application/context.interface.js +2 -0
  229. package/interfaces/application/index.d.ts +1 -0
  230. package/interfaces/application/index.js +17 -0
  231. package/interfaces/context/arguments-host.interface.d.ts +22 -0
  232. package/interfaces/context/arguments-host.interface.js +2 -0
  233. package/interfaces/context/execution.interface.d.ts +18 -0
  234. package/interfaces/context/execution.interface.js +2 -0
  235. package/interfaces/features/exception-filter.interface.d.ts +21 -0
  236. package/interfaces/features/exception-filter.interface.js +2 -0
  237. package/interfaces/features/guards.interface.d.ts +20 -0
  238. package/interfaces/features/guards.interface.js +2 -0
  239. package/interfaces/features/interceptor.interface.d.ts +30 -0
  240. package/interfaces/features/interceptor.interface.js +2 -0
  241. package/interfaces/features/pipes.interface.d.ts +37 -0
  242. package/interfaces/features/pipes.interface.js +2 -0
  243. package/interfaces/helper.interface.d.ts +3 -0
  244. package/interfaces/helper.interface.js +2 -0
  245. package/interfaces/hooks/before-application-shutdown.interface.d.ts +3 -0
  246. package/interfaces/hooks/before-application-shutdown.interface.js +2 -0
  247. package/interfaces/hooks/index.d.ts +5 -0
  248. package/interfaces/hooks/index.js +21 -0
  249. package/interfaces/hooks/on-application-bootstrap.interface.d.ts +9 -0
  250. package/interfaces/hooks/on-application-bootstrap.interface.js +2 -0
  251. package/interfaces/hooks/on-application-shutdown.interface.d.ts +9 -0
  252. package/interfaces/hooks/on-application-shutdown.interface.js +2 -0
  253. package/interfaces/hooks/on-destroy.interface.d.ts +10 -0
  254. package/interfaces/hooks/on-destroy.interface.js +2 -0
  255. package/interfaces/hooks/on-init.interface.d.ts +8 -0
  256. package/interfaces/hooks/on-init.interface.js +2 -0
  257. package/interfaces/index.d.ts +6 -0
  258. package/interfaces/index.js +22 -0
  259. package/interfaces/injectable.interface.d.ts +1 -0
  260. package/interfaces/injectable.interface.js +2 -0
  261. package/interfaces/modules/configurable/async-options.interface.d.ts +42 -0
  262. package/interfaces/modules/configurable/async-options.interface.js +2 -0
  263. package/interfaces/modules/configurable/cls.interface.d.ts +13 -0
  264. package/interfaces/modules/configurable/cls.interface.js +2 -0
  265. package/interfaces/modules/configurable/host.interface.d.ts +62 -0
  266. package/interfaces/modules/configurable/host.interface.js +2 -0
  267. package/interfaces/modules/configurable/index.d.ts +3 -0
  268. package/interfaces/modules/configurable/index.js +19 -0
  269. package/interfaces/modules/definition.interface.d.ts +4 -0
  270. package/interfaces/modules/definition.interface.js +2 -0
  271. package/interfaces/modules/dynamic-module.interface.d.ts +23 -0
  272. package/interfaces/modules/dynamic-module.interface.js +2 -0
  273. package/interfaces/modules/forward-reference.interface.d.ts +3 -0
  274. package/interfaces/modules/forward-reference.interface.js +2 -0
  275. package/interfaces/modules/index.d.ts +9 -0
  276. package/interfaces/modules/index.js +25 -0
  277. package/interfaces/modules/injection-token.interface.d.ts +5 -0
  278. package/interfaces/modules/injection-token.interface.js +2 -0
  279. package/interfaces/modules/introspection-result.interface.d.ts +10 -0
  280. package/interfaces/modules/introspection-result.interface.js +2 -0
  281. package/interfaces/modules/module-metadata.interface.d.ts +24 -0
  282. package/interfaces/modules/module-metadata.interface.js +2 -0
  283. package/interfaces/modules/module.interface.d.ts +2 -0
  284. package/interfaces/modules/module.interface.js +2 -0
  285. package/interfaces/modules/optional-factory-dependency.interface.d.ts +8 -0
  286. package/interfaces/modules/optional-factory-dependency.interface.js +2 -0
  287. package/interfaces/modules/override.interface.d.ts +5 -0
  288. package/interfaces/modules/override.interface.js +2 -0
  289. package/interfaces/modules/provider.interface.d.ts +142 -0
  290. package/interfaces/modules/provider.interface.js +2 -0
  291. package/interfaces/scope.interface.d.ts +35 -0
  292. package/interfaces/scope.interface.js +23 -0
  293. package/interfaces/type.interface.d.ts +3 -0
  294. package/interfaces/type.interface.js +2 -0
  295. package/metadata-scanner.d.ts +4 -0
  296. package/metadata-scanner.js +34 -0
  297. package/module/configurable-module.builder.d.ts +93 -0
  298. package/module/configurable-module.builder.js +204 -0
  299. package/module/constants.d.ts +4 -0
  300. package/module/constants.js +7 -0
  301. package/module/helpers/generate-options-injection-token.helper.d.ts +1 -0
  302. package/module/helpers/generate-options-injection-token.helper.js +9 -0
  303. package/module/helpers/get-injection-providers.helper.d.ts +8 -0
  304. package/module/helpers/get-injection-providers.helper.js +36 -0
  305. package/module/helpers/index.d.ts +2 -0
  306. package/module/helpers/index.js +18 -0
  307. package/module/index.d.ts +2 -0
  308. package/module/index.js +18 -0
  309. package/package.json +35 -0
  310. package/pipes/consumer.d.ts +9 -0
  311. package/pipes/consumer.js +15 -0
  312. package/pipes/context-creator.d.ts +18 -0
  313. package/pipes/context-creator.js +70 -0
  314. package/pipes/index.d.ts +2 -0
  315. package/pipes/index.js +18 -0
  316. package/scanner.d.ts +81 -0
  317. package/scanner.js +374 -0
  318. package/services/console.service.d.ts +86 -0
  319. package/services/console.service.js +233 -0
  320. package/services/index.d.ts +1 -0
  321. package/services/index.js +17 -0
  322. package/services/logger.service.d.ts +157 -0
  323. package/services/logger.service.js +269 -0
  324. package/services/reflector.service.d.ts +110 -0
  325. package/services/reflector.service.js +87 -0
  326. package/test/context/execution-host.spec.d.ts +1 -0
  327. package/test/context/execution-host.spec.js +31 -0
  328. package/test/context/external/creator.spec.d.ts +1 -0
  329. package/test/context/external/creator.spec.js +149 -0
  330. package/test/context/external/proxy.spec.d.ts +1 -0
  331. package/test/context/external/proxy.spec.js +45 -0
  332. package/test/exceptions/external/handler.spec.d.ts +1 -0
  333. package/test/exceptions/external/handler.spec.js +89 -0
  334. package/test/exceptions/filter-context.spec.d.ts +2 -0
  335. package/test/exceptions/filter-context.spec.js +91 -0
  336. package/test/exceptions/messages.spec.d.ts +0 -0
  337. package/test/exceptions/messages.spec.js +201 -0
  338. package/test/exceptions/zona/handler.spec.d.ts +1 -0
  339. package/test/exceptions/zona/handler.spec.js +51 -0
  340. package/test/exceptions/zona/zone.spec.d.ts +1 -0
  341. package/test/exceptions/zona/zone.spec.js +66 -0
  342. package/test/guards/consumer.spec.d.ts +1 -0
  343. package/test/guards/consumer.spec.js +47 -0
  344. package/test/guards/context-creator.spec.d.ts +1 -0
  345. package/test/guards/context-creator.spec.js +138 -0
  346. package/test/helpers/context-id-factory.spec.d.ts +1 -0
  347. package/test/helpers/context-id-factory.spec.js +9 -0
  348. package/test/helpers/shared.spec.d.ts +1 -0
  349. package/test/helpers/shared.spec.js +122 -0
  350. package/test/hooks/before-app-shutdown.hook.spec.d.ts +1 -0
  351. package/test/hooks/before-app-shutdown.hook.spec.js +44 -0
  352. package/test/hooks/on-app-bootstrap.hook.spec.d.ts +1 -0
  353. package/test/hooks/on-app-bootstrap.hook.spec.js +43 -0
  354. package/test/hooks/on-app-shutdown.hook.spec.d.ts +1 -0
  355. package/test/hooks/on-app-shutdown.hook.spec.js +43 -0
  356. package/test/hooks/on-module-destroy.hook.spec.d.ts +1 -0
  357. package/test/hooks/on-module-destroy.hook.spec.js +43 -0
  358. package/test/hooks/on-module-init.hook.spec.d.ts +1 -0
  359. package/test/hooks/on-module-init.hook.spec.js +43 -0
  360. package/test/injector/compiler.spec.d.ts +1 -0
  361. package/test/injector/compiler.spec.js +42 -0
  362. package/test/injector/container.spec.d.ts +1 -0
  363. package/test/injector/container.spec.js +203 -0
  364. package/test/injector/helpers/classifier.spec.d.ts +1 -0
  365. package/test/injector/helpers/classifier.spec.js +102 -0
  366. package/test/injector/injector.spec.d.ts +1 -0
  367. package/test/injector/injector.spec.js +678 -0
  368. package/test/injector/instance/loader.spec.d.ts +1 -0
  369. package/test/injector/instance/loader.spec.js +108 -0
  370. package/test/injector/instance/wrapper.spec.d.ts +1 -0
  371. package/test/injector/instance/wrapper.spec.js +772 -0
  372. package/test/injector/internal-core-module/internal-core-module-factory.spec.d.ts +1 -0
  373. package/test/injector/internal-core-module/internal-core-module-factory.spec.js +27 -0
  374. package/test/injector/module/lazy/loader.spec.d.ts +1 -0
  375. package/test/injector/module/lazy/loader.spec.js +71 -0
  376. package/test/injector/module/module.spec.d.ts +1 -0
  377. package/test/injector/module/module.spec.js +410 -0
  378. package/test/injector/module/token-factory.spec.d.ts +1 -0
  379. package/test/injector/module/token-factory.spec.js +84 -0
  380. package/test/interceptors/consumer.spec.d.ts +1 -0
  381. package/test/interceptors/consumer.spec.js +136 -0
  382. package/test/interceptors/context-creator.spec.d.ts +1 -0
  383. package/test/interceptors/context-creator.spec.js +139 -0
  384. package/test/metadata-scanner.spec.d.ts +1 -0
  385. package/test/metadata-scanner.spec.js +41 -0
  386. package/test/module/configurable-module.builder.spec.d.ts +1 -0
  387. package/test/module/configurable-module.builder.spec.js +102 -0
  388. package/test/module/helpers/get-injection-providers.helper.spec.d.ts +1 -0
  389. package/test/module/helpers/get-injection-providers.helper.spec.js +49 -0
  390. package/test/pipes/consumer.spec.d.ts +1 -0
  391. package/test/pipes/consumer.spec.js +42 -0
  392. package/test/pipes/context-creator.spec.d.ts +1 -0
  393. package/test/pipes/context-creator.spec.js +108 -0
  394. package/test/scanner.spec.d.ts +1 -0
  395. package/test/scanner.spec.js +620 -0
  396. package/test/services/logger.service.spec.d.ts +1 -0
  397. package/test/services/logger.service.spec.js +487 -0
  398. package/test/services/reflector.service.spec.d.ts +1 -0
  399. package/test/services/reflector.service.spec.js +105 -0
  400. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,17 @@
1
+ import { Abstract, Type } from "@venok/core/interfaces";
2
+ /**
3
+ * Decorator that marks a class as a Venok exception filter. An exception filter
4
+ * handles exceptions thrown by or not handled by your application code.
5
+ *
6
+ * The decorated class must implement the `ExceptionFilter` interface.
7
+ *
8
+ * @param exceptions one or more exception *types* specifying
9
+ * the exceptions to be caught and handled by this filter.
10
+ *
11
+ * @usageNotes
12
+ * Exception filters are applied using the `@UseFilters()` decorator, or (globally)
13
+ * with `app.useGlobalFilters()`.
14
+ *
15
+ * @publicApi
16
+ */
17
+ export declare function Catch(...exceptions: Array<Type<any> | Abstract<any>>): ClassDecorator;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Catch = void 0;
4
+ const constants_1 = require("@venok/core/constants");
5
+ /**
6
+ * Decorator that marks a class as a Venok exception filter. An exception filter
7
+ * handles exceptions thrown by or not handled by your application code.
8
+ *
9
+ * The decorated class must implement the `ExceptionFilter` interface.
10
+ *
11
+ * @param exceptions one or more exception *types* specifying
12
+ * the exceptions to be caught and handled by this filter.
13
+ *
14
+ * @usageNotes
15
+ * Exception filters are applied using the `@UseFilters()` decorator, or (globally)
16
+ * with `app.useGlobalFilters()`.
17
+ *
18
+ * @publicApi
19
+ */
20
+ function Catch(...exceptions) {
21
+ return (target) => {
22
+ Reflect.defineMetadata(constants_1.CATCH_WATERMARK, true, target);
23
+ Reflect.defineMetadata(constants_1.FILTER_CATCH_EXCEPTIONS, exceptions, target);
24
+ };
25
+ }
26
+ exports.Catch = Catch;
@@ -0,0 +1,29 @@
1
+ import { Type } from "@venok/core/interfaces";
2
+ import { PipeTransform } from "@venok/core/interfaces/features/pipes.interface";
3
+ export type ParamDecoratorEnhancer = ParameterDecorator;
4
+ /**
5
+ * @publicApi
6
+ */
7
+ export type CustomParamFactory<TData = any, TInput = any, TOutput = any> = (data: TData, input: TInput) => TOutput;
8
+ export type ParamData = object | string | number;
9
+ export interface RouteParamMetadata {
10
+ index: number;
11
+ data?: ParamData;
12
+ }
13
+ export declare function assignMetadata<TParamtype = any, TArgs = any>(args: TArgs, paramtype: TParamtype, index: number, data?: ParamData, ...pipes: (Type<PipeTransform> | PipeTransform)[]): TArgs & {
14
+ [x: string]: {
15
+ index: number;
16
+ data: ParamData | undefined;
17
+ pipes: (PipeTransform<any, any> | Type<PipeTransform<any, any>>)[];
18
+ };
19
+ };
20
+ export declare function assignCustomParameterMetadata(args: Record<number, any>, paramtype: number | string, index: number, factory: CustomParamFactory, data?: ParamData, ...pipes: (Type<PipeTransform> | PipeTransform)[]): {};
21
+ /**
22
+ * Defines HTTP route param decorator
23
+ *
24
+ * @param factory
25
+ *
26
+ * @param enhancers
27
+ * @publicApi
28
+ */
29
+ export declare function createParamDecorator<FactoryData = any, FactoryInput = any, FactoryOutput = any>(factory: CustomParamFactory<FactoryData, FactoryInput, FactoryOutput>, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | FactoryData)[]) => ParameterDecorator;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createParamDecorator = exports.assignCustomParameterMetadata = exports.assignMetadata = void 0;
4
+ const uid_1 = require("uid");
5
+ const constants_1 = require("@venok/core/constants");
6
+ const shared_helper_1 = require("@venok/core/helpers/shared.helper");
7
+ function assignMetadata(args, paramtype, index, data, ...pipes) {
8
+ return {
9
+ ...args,
10
+ [`${paramtype}:${index}`]: {
11
+ index,
12
+ data,
13
+ pipes,
14
+ },
15
+ };
16
+ }
17
+ exports.assignMetadata = assignMetadata;
18
+ function assignCustomParameterMetadata(args, paramtype, index, factory, data, ...pipes) {
19
+ return {
20
+ ...args,
21
+ [`${paramtype}${constants_1.CUSTOM_ROUTE_ARGS_METADATA}:${index}`]: {
22
+ index,
23
+ factory,
24
+ data,
25
+ pipes,
26
+ },
27
+ };
28
+ }
29
+ exports.assignCustomParameterMetadata = assignCustomParameterMetadata;
30
+ /**
31
+ * Defines HTTP route param decorator
32
+ *
33
+ * @param factory
34
+ *
35
+ * @param enhancers
36
+ * @publicApi
37
+ */
38
+ function createParamDecorator(factory, enhancers = []) {
39
+ const paramtype = (0, uid_1.uid)(21);
40
+ return (data, ...pipes) => (target, key, index) => {
41
+ const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
42
+ const isPipe = (pipe) => pipe &&
43
+ (((0, shared_helper_1.isFunction)(pipe) && pipe.prototype && (0, shared_helper_1.isFunction)(pipe.prototype.transform)) || (0, shared_helper_1.isFunction)(pipe.transform));
44
+ const hasParamData = (0, shared_helper_1.isNull)(data) || !isPipe(data);
45
+ const paramData = hasParamData ? data : undefined;
46
+ const paramPipes = hasParamData ? pipes : [data, ...pipes];
47
+ Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignCustomParameterMetadata(args, paramtype, index, factory, paramData, ...paramPipes), target.constructor, key);
48
+ enhancers.forEach((fn) => fn(target, key, index));
49
+ };
50
+ }
51
+ exports.createParamDecorator = createParamDecorator;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Decorator that sets required dependencies (required with a vanilla JavaScript objects)
3
+ *
4
+ * @publicApi
5
+ */
6
+ export declare const Dependencies: (...dependencies: Array<unknown>) => ClassDecorator;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Dependencies = void 0;
4
+ const constants_1 = require("@venok/core/constants");
5
+ const flatten_helper_1 = require("@venok/core/helpers/flatten.helper");
6
+ /**
7
+ * Decorator that sets required dependencies (required with a vanilla JavaScript objects)
8
+ *
9
+ * @publicApi
10
+ */
11
+ const Dependencies = (...dependencies) => {
12
+ const flattenDeps = (0, flatten_helper_1.flatten)(dependencies);
13
+ return (target) => {
14
+ Reflect.defineMetadata(constants_1.PARAMTYPES_METADATA, flattenDeps, target);
15
+ };
16
+ };
17
+ exports.Dependencies = Dependencies;
@@ -0,0 +1,21 @@
1
+ import { ExceptionFilter } from "@venok/core/interfaces/features/exception-filter.interface";
2
+ /**
3
+ * Decorator that binds exception filters to the scope of the controller or
4
+ * method, depending on its context.
5
+ *
6
+ * When `@UseFilters` is used at the provider level, the filter will be
7
+ * applied to every handler (method) in the provider.
8
+ *
9
+ * When `@UseFilters` is used at the individual handler level, the filter
10
+ * will apply only to that specific method.
11
+ *
12
+ * @param filters exception filter instance or class, or a list of exception
13
+ * filter instances or classes.
14
+ *
15
+ * @usageNotes
16
+ * Exception filters can also be set up globally for all controllers and routes
17
+ * using `app.useGlobalFilters()`.
18
+ *
19
+ * @publicApi
20
+ */
21
+ export declare const UseFilters: (...filters: (ExceptionFilter | Function)[]) => MethodDecorator & ClassDecorator;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UseFilters = void 0;
4
+ const shared_helper_1 = require("@venok/core/helpers/shared.helper");
5
+ const constants_1 = require("@venok/core/constants");
6
+ const validate_each_helper_1 = require("@venok/core/helpers/validate-each.helper");
7
+ const extends_metadata_helper_1 = require("@venok/core/helpers/extends-metadata.helper");
8
+ /**
9
+ * Decorator that binds exception filters to the scope of the controller or
10
+ * method, depending on its context.
11
+ *
12
+ * When `@UseFilters` is used at the provider level, the filter will be
13
+ * applied to every handler (method) in the provider.
14
+ *
15
+ * When `@UseFilters` is used at the individual handler level, the filter
16
+ * will apply only to that specific method.
17
+ *
18
+ * @param filters exception filter instance or class, or a list of exception
19
+ * filter instances or classes.
20
+ *
21
+ * @usageNotes
22
+ * Exception filters can also be set up globally for all controllers and routes
23
+ * using `app.useGlobalFilters()`.
24
+ *
25
+ * @publicApi
26
+ */
27
+ const UseFilters = (...filters) => addExceptionFiltersMetadata(...filters);
28
+ exports.UseFilters = UseFilters;
29
+ function addExceptionFiltersMetadata(...filters) {
30
+ return (target, key, descriptor) => {
31
+ const isFilterValid = (filter) => filter && ((0, shared_helper_1.isFunction)(filter) || (0, shared_helper_1.isFunction)(filter.catch));
32
+ if (descriptor) {
33
+ (0, validate_each_helper_1.validateEach)(target.constructor, filters, isFilterValid, "@UseFilters", "filter");
34
+ (0, extends_metadata_helper_1.extendArrayMetadata)(constants_1.EXCEPTION_FILTERS_METADATA, filters, descriptor.value);
35
+ return descriptor;
36
+ }
37
+ (0, validate_each_helper_1.validateEach)(target, filters, isFilterValid, "@UseFilters", "filter");
38
+ (0, extends_metadata_helper_1.extendArrayMetadata)(constants_1.EXCEPTION_FILTERS_METADATA, filters, target);
39
+ return target;
40
+ };
41
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Decorator that makes a module global-scoped.
3
+ *
4
+ * Once imported into any module, a global-scoped module will be visible
5
+ * in all modules. Thereafter, modules that wish to inject a service exported
6
+ * from a global module do not need to import the provider module.
7
+ *
8
+ * @publicApi
9
+ */
10
+ export declare function Global(): ClassDecorator;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Global = void 0;
4
+ const constants_1 = require("@venok/core/constants");
5
+ /**
6
+ * Decorator that makes a module global-scoped.
7
+ *
8
+ * Once imported into any module, a global-scoped module will be visible
9
+ * in all modules. Thereafter, modules that wish to inject a service exported
10
+ * from a global module do not need to import the provider module.
11
+ *
12
+ * @publicApi
13
+ */
14
+ function Global() {
15
+ return (target) => {
16
+ Reflect.defineMetadata(constants_1.GLOBAL_MODULE_METADATA, true, target);
17
+ };
18
+ }
19
+ exports.Global = Global;
@@ -0,0 +1,15 @@
1
+ export * from "./apply.decorator";
2
+ export * from "./bind.decorator";
3
+ export * from "./catch.decorator";
4
+ export * from "./create-param.decorator";
5
+ export * from "./dependencies.decorator";
6
+ export * from "./exception-filters.decorator";
7
+ export * from "./global.decorator";
8
+ export * from "./inject.decorator";
9
+ export * from "./injectable.decorator";
10
+ export * from "./module.decorator";
11
+ export * from "./optional.decorator";
12
+ export * from "./set-metadata.decorator";
13
+ export * from "./use-guards.decorator";
14
+ export * from "./use-pipes.decorator";
15
+ export * from "./use-interceptors.decorator";
@@ -0,0 +1,31 @@
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("./apply.decorator"), exports);
18
+ __exportStar(require("./bind.decorator"), exports);
19
+ __exportStar(require("./catch.decorator"), exports);
20
+ __exportStar(require("./create-param.decorator"), exports);
21
+ __exportStar(require("./dependencies.decorator"), exports);
22
+ __exportStar(require("./exception-filters.decorator"), exports);
23
+ __exportStar(require("./global.decorator"), exports);
24
+ __exportStar(require("./inject.decorator"), exports);
25
+ __exportStar(require("./injectable.decorator"), exports);
26
+ __exportStar(require("./module.decorator"), exports);
27
+ __exportStar(require("./optional.decorator"), exports);
28
+ __exportStar(require("./set-metadata.decorator"), exports);
29
+ __exportStar(require("./use-guards.decorator"), exports);
30
+ __exportStar(require("./use-pipes.decorator"), exports);
31
+ __exportStar(require("./use-interceptors.decorator"), exports);
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Decorator that marks a constructor parameter as a target for
3
+ * Dependency Injection (DI).
4
+ *
5
+ * Any injected provider must be visible within the module scope (loosely
6
+ * speaking, the containing module) of the class it is being injected into. This
7
+ * can be done by:
8
+ *
9
+ * - defining the provider in the same module scope
10
+ * - exporting the provider from one module scope and importing that module into the
11
+ * module scope of the class being injected into
12
+ * - exporting the provider from a module that is marked as global using the
13
+ * `@Global()` decorator
14
+ *
15
+ * #### Injection tokens
16
+ * Can be *types* (class names), *strings* or *symbols*. This depends on how the
17
+ * provider with which it is associated was defined. Providers defined with the
18
+ * `@Injectable()` decorator use the class name. Custom Providers may use strings
19
+ * or symbols as the injection token.
20
+ *
21
+ * @param token lookup key for the provider to be injected (assigned to the constructor
22
+ * parameter).
23
+ *
24
+ * @publicApi
25
+ */
26
+ export declare function Inject<T = any>(token?: T): PropertyDecorator & ParameterDecorator;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Inject = void 0;
4
+ const shared_helper_1 = require("@venok/core/helpers/shared.helper");
5
+ const constants_1 = require("@venok/core/constants");
6
+ /**
7
+ * Decorator that marks a constructor parameter as a target for
8
+ * Dependency Injection (DI).
9
+ *
10
+ * Any injected provider must be visible within the module scope (loosely
11
+ * speaking, the containing module) of the class it is being injected into. This
12
+ * can be done by:
13
+ *
14
+ * - defining the provider in the same module scope
15
+ * - exporting the provider from one module scope and importing that module into the
16
+ * module scope of the class being injected into
17
+ * - exporting the provider from a module that is marked as global using the
18
+ * `@Global()` decorator
19
+ *
20
+ * #### Injection tokens
21
+ * Can be *types* (class names), *strings* or *symbols*. This depends on how the
22
+ * provider with which it is associated was defined. Providers defined with the
23
+ * `@Injectable()` decorator use the class name. Custom Providers may use strings
24
+ * or symbols as the injection token.
25
+ *
26
+ * @param token lookup key for the provider to be injected (assigned to the constructor
27
+ * parameter).
28
+ *
29
+ * @publicApi
30
+ */
31
+ function Inject(token) {
32
+ return (target, key, index) => {
33
+ const type = token || Reflect.getMetadata("design:type", target, key);
34
+ if (!(0, shared_helper_1.isUndefined)(index)) {
35
+ let dependencies = Reflect.getMetadata(constants_1.SELF_DECLARED_DEPS_METADATA, target) || [];
36
+ dependencies = [...dependencies, { index, param: type }];
37
+ Reflect.defineMetadata(constants_1.SELF_DECLARED_DEPS_METADATA, dependencies, target);
38
+ return;
39
+ }
40
+ let properties = Reflect.getMetadata(constants_1.PROPERTY_DEPS_METADATA, target.constructor) || [];
41
+ properties = [...properties, { key, type }];
42
+ Reflect.defineMetadata(constants_1.PROPERTY_DEPS_METADATA, properties, target.constructor);
43
+ };
44
+ }
45
+ exports.Inject = Inject;
@@ -0,0 +1,40 @@
1
+ import { ScopeOptions, Type } from "@venok/core/interfaces";
2
+ /**
3
+ * Defines the injection scope.
4
+ *
5
+ * @publicApi
6
+ */
7
+ export type InjectableOptions = ScopeOptions;
8
+ /**
9
+ * Decorator that marks a class as a provider(https://venok.com/providers).
10
+ * Providers can be injected into other classes via constructor parameter injection
11
+ * using Venok built-in [Dependency Injection (DI)](https://venok.com/providers#dependency-injection)
12
+ * system.
13
+ *
14
+ * When injecting a provider, it must be visible within the module scope (loosely
15
+ * speaking, the containing module) of the class it is being injected into. This
16
+ * can be done by:
17
+ *
18
+ * - defining the provider in the same module scope
19
+ * - exporting the provider from one module scope and importing that module into the
20
+ * module scope of the class being injected into
21
+ * - exporting the provider from a module that is marked as global using the
22
+ * `@Global()` decorator
23
+ *
24
+ * Providers can also be defined in a more explicit and imperative form using
25
+ * various [custom provider](https://venok.com/fundamentals/custom-providers) techniques that expose
26
+ * more capabilities of the DI system.
27
+ *
28
+ * @param options options specifying scope of injectable
29
+ *
30
+ * @see [Providers](https://venok.com/providers)
31
+ * @see [Custom Providers](https://venok.com/fundamentals/custom-providers)
32
+ * @see [Injection Scopes](https://venok.com/fundamentals/injection-scopes)
33
+ *
34
+ * @publicApi
35
+ */
36
+ export declare function Injectable(options?: InjectableOptions): ClassDecorator;
37
+ /**
38
+ * @publicApi
39
+ */
40
+ export declare function mixin<T>(mixinClass: Type<T>): Type<T>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mixin = exports.Injectable = void 0;
4
+ const uid_1 = require("uid");
5
+ const constants_1 = require("@venok/core/constants");
6
+ /**
7
+ * Decorator that marks a class as a provider(https://venok.com/providers).
8
+ * Providers can be injected into other classes via constructor parameter injection
9
+ * using Venok built-in [Dependency Injection (DI)](https://venok.com/providers#dependency-injection)
10
+ * system.
11
+ *
12
+ * When injecting a provider, it must be visible within the module scope (loosely
13
+ * speaking, the containing module) of the class it is being injected into. This
14
+ * can be done by:
15
+ *
16
+ * - defining the provider in the same module scope
17
+ * - exporting the provider from one module scope and importing that module into the
18
+ * module scope of the class being injected into
19
+ * - exporting the provider from a module that is marked as global using the
20
+ * `@Global()` decorator
21
+ *
22
+ * Providers can also be defined in a more explicit and imperative form using
23
+ * various [custom provider](https://venok.com/fundamentals/custom-providers) techniques that expose
24
+ * more capabilities of the DI system.
25
+ *
26
+ * @param options options specifying scope of injectable
27
+ *
28
+ * @see [Providers](https://venok.com/providers)
29
+ * @see [Custom Providers](https://venok.com/fundamentals/custom-providers)
30
+ * @see [Injection Scopes](https://venok.com/fundamentals/injection-scopes)
31
+ *
32
+ * @publicApi
33
+ */
34
+ function Injectable(options) {
35
+ return (target) => {
36
+ Reflect.defineMetadata(constants_1.INJECTABLE_WATERMARK, true, target);
37
+ Reflect.defineMetadata(constants_1.SCOPE_OPTIONS_METADATA, options, target);
38
+ };
39
+ }
40
+ exports.Injectable = Injectable;
41
+ /**
42
+ * @publicApi
43
+ */
44
+ function mixin(mixinClass) {
45
+ Object.defineProperty(mixinClass, "name", {
46
+ value: (0, uid_1.uid)(21),
47
+ });
48
+ Injectable()(mixinClass);
49
+ return mixinClass;
50
+ }
51
+ exports.mixin = mixin;
@@ -0,0 +1,14 @@
1
+ import { ModuleMetadata } from "@venok/core/interfaces/modules";
2
+ export declare const INVALID_MODULE_CONFIG_MESSAGE: (text: TemplateStringsArray, property: string) => string;
3
+ /**
4
+ * Decorator that marks a class as a module.
5
+ *
6
+ * Modules are used by Venok to organize the application structure into scopes.
7
+ * Providers are scoped by the module they are declared in. Modules and their
8
+ * classes (Providers) form a graph that determines how Venok
9
+ *
10
+ * @param metadata module configuration metadata
11
+ *
12
+ * @publicApi
13
+ */
14
+ export declare function Module(metadata: ModuleMetadata): ClassDecorator;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Module = exports.INVALID_MODULE_CONFIG_MESSAGE = void 0;
4
+ const constants_1 = require("../constants");
5
+ const INVALID_MODULE_CONFIG_MESSAGE = (text, property) => `Invalid property '${property}' passed into the @Module() decorator.`;
6
+ exports.INVALID_MODULE_CONFIG_MESSAGE = INVALID_MODULE_CONFIG_MESSAGE;
7
+ const metadataKeys = [constants_1.MODULE_METADATA.IMPORTS, constants_1.MODULE_METADATA.EXPORTS, constants_1.MODULE_METADATA.PROVIDERS];
8
+ function validateModuleKeys(keys) {
9
+ const validateKey = (key) => {
10
+ if (metadataKeys.includes(key))
11
+ return;
12
+ throw new Error((0, exports.INVALID_MODULE_CONFIG_MESSAGE) `${key}`);
13
+ };
14
+ keys.forEach(validateKey);
15
+ }
16
+ /**
17
+ * Decorator that marks a class as a module.
18
+ *
19
+ * Modules are used by Venok to organize the application structure into scopes.
20
+ * Providers are scoped by the module they are declared in. Modules and their
21
+ * classes (Providers) form a graph that determines how Venok
22
+ *
23
+ * @param metadata module configuration metadata
24
+ *
25
+ * @publicApi
26
+ */
27
+ function Module(metadata) {
28
+ const propsKeys = Object.keys(metadata);
29
+ validateModuleKeys(propsKeys);
30
+ return (target) => {
31
+ for (const property in metadata) {
32
+ if (metadata.hasOwnProperty(property)) {
33
+ Reflect.defineMetadata(property, metadata[property], target);
34
+ }
35
+ }
36
+ };
37
+ }
38
+ exports.Module = Module;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Parameter decorator for an injected dependency marking the
3
+ * dependency as optional.
4
+ *
5
+ * For example:
6
+ * ```typescript
7
+ * constructor(@Optional() @Inject('HTTP_OPTIONS')private readonly httpClient: T) {}
8
+ * ```
9
+ *
10
+ * @see [Optional providers](https://venok.com/providers#optional-providers)
11
+ *
12
+ * @publicApi
13
+ */
14
+ export declare function Optional(): PropertyDecorator & ParameterDecorator;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Optional = void 0;
4
+ const constants_1 = require("@venok/core/constants");
5
+ const shared_helper_1 = require("@venok/core/helpers/shared.helper");
6
+ /**
7
+ * Parameter decorator for an injected dependency marking the
8
+ * dependency as optional.
9
+ *
10
+ * For example:
11
+ * ```typescript
12
+ * constructor(@Optional() @Inject('HTTP_OPTIONS')private readonly httpClient: T) {}
13
+ * ```
14
+ *
15
+ * @see [Optional providers](https://venok.com/providers#optional-providers)
16
+ *
17
+ * @publicApi
18
+ */
19
+ function Optional() {
20
+ return (target, key, index) => {
21
+ if (!(0, shared_helper_1.isUndefined)(index)) {
22
+ const args = Reflect.getMetadata(constants_1.OPTIONAL_DEPS_METADATA, target) || [];
23
+ Reflect.defineMetadata(constants_1.OPTIONAL_DEPS_METADATA, [...args, index], target);
24
+ return;
25
+ }
26
+ const properties = Reflect.getMetadata(constants_1.OPTIONAL_PROPERTY_DEPS_METADATA, target.constructor) || [];
27
+ Reflect.defineMetadata(constants_1.OPTIONAL_PROPERTY_DEPS_METADATA, [...properties, key], target.constructor);
28
+ };
29
+ }
30
+ exports.Optional = Optional;
@@ -0,0 +1,18 @@
1
+ export type CustomDecorator<TKey = string> = MethodDecorator & ClassDecorator & {
2
+ KEY: TKey;
3
+ };
4
+ /**
5
+ * Decorator that assigns metadata to the class/function using the
6
+ * specified `key`.
7
+ *
8
+ * Requires two parameters:
9
+ * - `key` - a value defining the key under which the metadata is stored
10
+ * - `value` - metadata to be associated with `key`
11
+ *
12
+ * This metadata can be reflected using the `Reflector` class.
13
+ *
14
+ * Example: `@SetMetadata('roles', ['admin'])`
15
+ *
16
+ * @publicApi
17
+ */
18
+ export declare const SetMetadata: <K = string, V = any>(metadataKey: K, metadataValue: V) => CustomDecorator<K>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetMetadata = void 0;
4
+ /**
5
+ * Decorator that assigns metadata to the class/function using the
6
+ * specified `key`.
7
+ *
8
+ * Requires two parameters:
9
+ * - `key` - a value defining the key under which the metadata is stored
10
+ * - `value` - metadata to be associated with `key`
11
+ *
12
+ * This metadata can be reflected using the `Reflector` class.
13
+ *
14
+ * Example: `@SetMetadata('roles', ['admin'])`
15
+ *
16
+ * @publicApi
17
+ */
18
+ const SetMetadata = (metadataKey, metadataValue) => {
19
+ const decoratorFactory = (target, key, descriptor) => {
20
+ if (descriptor) {
21
+ Reflect.defineMetadata(metadataKey, metadataValue, descriptor.value);
22
+ return descriptor;
23
+ }
24
+ Reflect.defineMetadata(metadataKey, metadataValue, target);
25
+ return target;
26
+ };
27
+ decoratorFactory.KEY = metadataKey;
28
+ return decoratorFactory;
29
+ };
30
+ exports.SetMetadata = SetMetadata;
@@ -0,0 +1,21 @@
1
+ import { CanActivate } from "@venok/core/interfaces/features/guards.interface";
2
+ /**
3
+ * Decorator that binds guards to the scope of the provider or method,
4
+ * depending on its context.
5
+ *
6
+ * When `@UseGuards` is used at the controller level, the guard will be
7
+ * applied to every handler (method) in the provider.
8
+ *
9
+ * When `@UseGuards` is used at the individual handler level, the guard
10
+ * will apply only to that specific method.
11
+ *
12
+ * @param guards a single guard instance or class, or a list of guard instances
13
+ * or classes.
14
+ *
15
+ * @usageNotes
16
+ * Guards can also be set up globally for all controllers and routes
17
+ * using `app.useGlobalGuards()`.
18
+ *
19
+ * @publicApi
20
+ */
21
+ export declare function UseGuards(...guards: (CanActivate | Function)[]): MethodDecorator & ClassDecorator;