@forklaunch/core 0.2.3 → 0.2.6

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 (549) hide show
  1. package/LICENSE +21 -0
  2. package/lib/dist/cache/index.d.ts +4 -0
  3. package/lib/dist/cache/index.d.ts.map +1 -0
  4. package/lib/dist/cache/interfaces/ttlCache.interface.d.ts +2 -0
  5. package/lib/dist/cache/interfaces/ttlCache.interface.d.ts.map +1 -0
  6. package/lib/dist/cache/redisTtlCache.d.ts +353 -0
  7. package/lib/dist/cache/redisTtlCache.d.ts.map +1 -0
  8. package/{dist → lib/dist}/cache/redisTtlCache.js +1 -4
  9. package/lib/dist/cache/types/ttlCacheRecord.types.d.ts +2 -0
  10. package/lib/dist/cache/types/ttlCacheRecord.types.d.ts.map +1 -0
  11. package/lib/dist/controllers/index.d.ts +2 -0
  12. package/lib/dist/controllers/index.d.ts.map +1 -0
  13. package/lib/dist/controllers/interfaces/controller.interface.d.ts +2 -0
  14. package/lib/dist/controllers/interfaces/controller.interface.d.ts.map +1 -0
  15. package/lib/dist/database/index.d.ts +2 -0
  16. package/lib/dist/database/index.d.ts.map +1 -0
  17. package/lib/dist/database/mikro/models/entities/base.entity.d.ts +26 -0
  18. package/lib/dist/database/mikro/models/entities/base.entity.d.ts.map +1 -0
  19. package/lib/dist/database/mikro/models/entities/base.entity.js +46 -0
  20. package/lib/dist/entityMapper/index.d.ts +3 -0
  21. package/lib/dist/entityMapper/index.d.ts.map +1 -0
  22. package/lib/dist/entityMapper/interfaces/entityMapper.interface.d.ts +2 -0
  23. package/lib/dist/entityMapper/interfaces/entityMapper.interface.d.ts.map +1 -0
  24. package/lib/dist/entityMapper/models/baseEntityMapper.model.d.ts +63 -0
  25. package/lib/dist/entityMapper/models/baseEntityMapper.model.d.ts.map +1 -0
  26. package/lib/dist/entityMapper/models/requestEntityMapper.model.d.ts +58 -0
  27. package/lib/dist/entityMapper/models/requestEntityMapper.model.d.ts.map +1 -0
  28. package/lib/dist/entityMapper/models/responseEntityMapper.model.d.ts +56 -0
  29. package/lib/dist/entityMapper/models/responseEntityMapper.model.d.ts.map +1 -0
  30. package/lib/dist/entityMapper/types/entityMapper.types.d.ts +2 -0
  31. package/lib/dist/entityMapper/types/entityMapper.types.d.ts.map +1 -0
  32. package/lib/dist/http/guards/isHttpContractDetails.d.ts +5 -0
  33. package/lib/dist/http/guards/isHttpContractDetails.d.ts.map +1 -0
  34. package/lib/dist/http/guards/isHttpContractDetails.js +6 -0
  35. package/lib/dist/http/guards/isResponseShape.d.ts +2 -0
  36. package/lib/dist/http/guards/isResponseShape.d.ts.map +1 -0
  37. package/lib/dist/http/guards/isResponseShape.js +7 -0
  38. package/lib/dist/http/index.d.ts +6 -0
  39. package/lib/dist/http/index.d.ts.map +1 -0
  40. package/{dist → lib/dist}/http/index.js +1 -2
  41. package/lib/dist/http/interfaces/expressLikeApplication.interface.d.ts +12 -0
  42. package/lib/dist/http/interfaces/expressLikeApplication.interface.d.ts.map +1 -0
  43. package/lib/dist/http/interfaces/expressLikeRouter.interface.d.ts +103 -0
  44. package/lib/dist/http/interfaces/expressLikeRouter.interface.d.ts.map +1 -0
  45. package/lib/dist/http/interfaces/expressLikeRouter.interface.js +336 -0
  46. package/lib/dist/http/interfaces/index.d.ts +3 -0
  47. package/lib/dist/http/interfaces/index.d.ts.map +1 -0
  48. package/lib/dist/http/interfaces/index.js +2 -0
  49. package/lib/dist/http/middleware/index.d.ts +3 -0
  50. package/lib/dist/http/middleware/index.d.ts.map +1 -0
  51. package/lib/dist/http/middleware/request.middleware.d.ts +69 -0
  52. package/lib/dist/http/middleware/request.middleware.d.ts.map +1 -0
  53. package/{dist → lib/dist}/http/middleware/request.middleware.js +55 -117
  54. package/lib/dist/http/middleware/response.middleware.d.ts +27 -0
  55. package/lib/dist/http/middleware/response.middleware.d.ts.map +1 -0
  56. package/lib/dist/http/middleware/response.middleware.js +52 -0
  57. package/lib/dist/http/openApiV3Generator/index.d.ts +2 -0
  58. package/lib/dist/http/openApiV3Generator/index.d.ts.map +1 -0
  59. package/lib/dist/http/openApiV3Generator/index.js +1 -0
  60. package/lib/dist/http/openApiV3Generator/openApiV3Generator.d.ts +11 -0
  61. package/lib/dist/http/openApiV3Generator/openApiV3Generator.d.ts.map +1 -0
  62. package/{dist/http → lib/dist/http/openApiV3Generator}/openApiV3Generator.js +2 -24
  63. package/lib/dist/http/types/apiDefinition.types.d.ts +2 -0
  64. package/lib/dist/http/types/apiDefinition.types.d.ts.map +1 -0
  65. package/lib/dist/http/types/contractDetails.types.d.ts +2 -0
  66. package/lib/dist/http/types/contractDetails.types.d.ts.map +1 -0
  67. package/lib/dist/http/types/index.d.ts +4 -0
  68. package/lib/dist/http/types/index.d.ts.map +1 -0
  69. package/lib/dist/http/types/index.js +3 -0
  70. package/lib/dist/http/types/router.types.d.ts +2 -0
  71. package/lib/dist/http/types/router.types.d.ts.map +1 -0
  72. package/lib/dist/http/utils/enrichExpressLikeSend.d.ts +28 -0
  73. package/lib/dist/http/utils/enrichExpressLikeSend.d.ts.map +1 -0
  74. package/lib/dist/http/utils/enrichExpressLikeSend.js +50 -0
  75. package/lib/dist/http/utils/httpStatusCodes.d.ts +986 -0
  76. package/lib/dist/http/utils/httpStatusCodes.d.ts.map +1 -0
  77. package/lib/dist/http/utils/index.d.ts +3 -0
  78. package/lib/dist/http/utils/index.d.ts.map +1 -0
  79. package/lib/dist/http/utils/index.js +2 -0
  80. package/lib/dist/index.d.ts +7 -0
  81. package/lib/dist/index.d.ts.map +1 -0
  82. package/lib/dist/jest.config.d.ts +15 -0
  83. package/lib/dist/jest.config.d.ts.map +1 -0
  84. package/lib/dist/jest.config.js +21 -0
  85. package/lib/dist/lib/index.d.ts +7 -0
  86. package/lib/dist/lib/index.d.ts.map +1 -0
  87. package/lib/dist/lib/index.js +6 -0
  88. package/lib/dist/lib/jest.config.d.ts +15 -0
  89. package/lib/dist/lib/jest.config.d.ts.map +1 -0
  90. package/lib/dist/lib/jest.config.js +21 -0
  91. package/lib/dist/lib/src/cache/index.d.ts +4 -0
  92. package/lib/dist/lib/src/cache/index.d.ts.map +1 -0
  93. package/lib/dist/lib/src/cache/index.js +3 -0
  94. package/lib/dist/lib/src/cache/interfaces/ttlCache.interface.d.ts +2 -0
  95. package/lib/dist/lib/src/cache/interfaces/ttlCache.interface.d.ts.map +1 -0
  96. package/lib/dist/lib/src/cache/redisTtlCache.d.ts +353 -0
  97. package/lib/dist/lib/src/cache/redisTtlCache.d.ts.map +1 -0
  98. package/lib/dist/lib/src/cache/redisTtlCache.js +98 -0
  99. package/lib/dist/lib/src/cache/types/ttlCacheRecord.types.d.ts +2 -0
  100. package/lib/dist/lib/src/cache/types/ttlCacheRecord.types.d.ts.map +1 -0
  101. package/lib/dist/lib/src/cache/types/ttlCacheRecord.types.js +1 -0
  102. package/lib/dist/lib/src/controllers/index.d.ts +2 -0
  103. package/lib/dist/lib/src/controllers/index.d.ts.map +1 -0
  104. package/lib/dist/lib/src/controllers/index.js +1 -0
  105. package/lib/dist/lib/src/controllers/interfaces/controller.interface.d.ts +2 -0
  106. package/lib/dist/lib/src/controllers/interfaces/controller.interface.d.ts.map +1 -0
  107. package/lib/dist/lib/src/controllers/interfaces/controller.interface.js +1 -0
  108. package/lib/dist/lib/src/database/index.d.ts +2 -0
  109. package/lib/dist/lib/src/database/index.d.ts.map +1 -0
  110. package/lib/dist/lib/src/database/index.js +1 -0
  111. package/lib/dist/lib/src/database/mikro/models/entities/base.entity.d.ts +26 -0
  112. package/lib/dist/lib/src/database/mikro/models/entities/base.entity.d.ts.map +1 -0
  113. package/lib/dist/lib/src/database/mikro/models/entities/base.entity.js +46 -0
  114. package/lib/dist/lib/src/domainMapper/index.d.ts +3 -0
  115. package/lib/dist/lib/src/domainMapper/index.d.ts.map +1 -0
  116. package/lib/dist/lib/src/domainMapper/index.js +2 -0
  117. package/lib/dist/lib/src/domainMapper/interfaces/dtoMapper.interface.d.ts +2 -0
  118. package/lib/dist/lib/src/domainMapper/interfaces/dtoMapper.interface.d.ts.map +1 -0
  119. package/lib/dist/lib/src/domainMapper/interfaces/dtoMapper.interface.js +1 -0
  120. package/lib/dist/lib/src/domainMapper/models/baseDtoMapper.model.d.ts +63 -0
  121. package/lib/dist/lib/src/domainMapper/models/baseDtoMapper.model.d.ts.map +1 -0
  122. package/lib/dist/lib/src/domainMapper/models/baseDtoMapper.model.js +75 -0
  123. package/lib/dist/lib/src/domainMapper/models/requestDtoMapper.model.d.ts +58 -0
  124. package/lib/dist/lib/src/domainMapper/models/requestDtoMapper.model.d.ts.map +1 -0
  125. package/lib/dist/lib/src/domainMapper/models/requestDtoMapper.model.js +70 -0
  126. package/lib/dist/lib/src/domainMapper/models/responseDtoMapper.model.d.ts +56 -0
  127. package/lib/dist/lib/src/domainMapper/models/responseDtoMapper.model.d.ts.map +1 -0
  128. package/lib/dist/lib/src/domainMapper/models/responseDtoMapper.model.js +65 -0
  129. package/lib/dist/lib/src/domainMapper/types/dtoMapper.types.d.ts +2 -0
  130. package/lib/dist/lib/src/domainMapper/types/dtoMapper.types.d.ts.map +1 -0
  131. package/lib/dist/lib/src/domainMapper/types/dtoMapper.types.js +1 -0
  132. package/lib/dist/lib/src/dtoMapper/index.d.ts +3 -0
  133. package/lib/dist/lib/src/dtoMapper/index.d.ts.map +1 -0
  134. package/lib/dist/lib/src/dtoMapper/index.js +2 -0
  135. package/lib/dist/lib/src/dtoMapper/interfaces/dtoMapper.interface.d.ts +2 -0
  136. package/lib/dist/lib/src/dtoMapper/interfaces/dtoMapper.interface.d.ts.map +1 -0
  137. package/lib/dist/lib/src/dtoMapper/interfaces/dtoMapper.interface.js +1 -0
  138. package/lib/dist/lib/src/dtoMapper/models/baseDtoMapper.model.d.ts +63 -0
  139. package/lib/dist/lib/src/dtoMapper/models/baseDtoMapper.model.d.ts.map +1 -0
  140. package/lib/dist/lib/src/dtoMapper/models/baseDtoMapper.model.js +75 -0
  141. package/lib/dist/lib/src/dtoMapper/models/requestDtoMapper.model.d.ts +58 -0
  142. package/lib/dist/lib/src/dtoMapper/models/requestDtoMapper.model.d.ts.map +1 -0
  143. package/lib/dist/lib/src/dtoMapper/models/requestDtoMapper.model.js +70 -0
  144. package/lib/dist/lib/src/dtoMapper/models/responseDtoMapper.model.d.ts +56 -0
  145. package/lib/dist/lib/src/dtoMapper/models/responseDtoMapper.model.d.ts.map +1 -0
  146. package/lib/dist/lib/src/dtoMapper/models/responseDtoMapper.model.js +65 -0
  147. package/lib/dist/lib/src/dtoMapper/types/dtoMapper.types.d.ts +2 -0
  148. package/lib/dist/lib/src/dtoMapper/types/dtoMapper.types.d.ts.map +1 -0
  149. package/lib/dist/lib/src/dtoMapper/types/dtoMapper.types.js +1 -0
  150. package/lib/dist/lib/src/http/application/expressLikeApplication.d.ts +18 -0
  151. package/lib/dist/lib/src/http/application/expressLikeApplication.d.ts.map +1 -0
  152. package/lib/dist/lib/src/http/application/expressLikeApplication.js +20 -0
  153. package/lib/dist/lib/src/http/guards/isHttpContractDetails.d.ts +5 -0
  154. package/lib/dist/lib/src/http/guards/isHttpContractDetails.d.ts.map +1 -0
  155. package/lib/dist/lib/src/http/guards/isHttpContractDetails.js +6 -0
  156. package/lib/dist/lib/src/http/guards/isResponseShape.d.ts +2 -0
  157. package/lib/dist/lib/src/http/guards/isResponseShape.d.ts.map +1 -0
  158. package/lib/dist/lib/src/http/guards/isResponseShape.js +7 -0
  159. package/lib/dist/lib/src/http/handler/typedHandler.d.ts +21 -0
  160. package/lib/dist/lib/src/http/handler/typedHandler.d.ts.map +1 -0
  161. package/lib/dist/lib/src/http/handler/typedHandler.js +25 -0
  162. package/lib/dist/lib/src/http/index.d.ts +11 -0
  163. package/lib/dist/lib/src/http/index.d.ts.map +1 -0
  164. package/lib/dist/lib/src/http/index.js +10 -0
  165. package/lib/dist/lib/src/http/interfaces/expressLikeApplication.interface.d.ts +12 -0
  166. package/lib/dist/lib/src/http/interfaces/expressLikeApplication.interface.d.ts.map +1 -0
  167. package/lib/dist/lib/src/http/interfaces/expressLikeApplication.interface.js +14 -0
  168. package/lib/dist/lib/src/http/interfaces/expressLikeRouter.interface.d.ts +2 -0
  169. package/lib/dist/lib/src/http/interfaces/expressLikeRouter.interface.d.ts.map +1 -0
  170. package/lib/dist/lib/src/http/interfaces/expressLikeRouter.interface.js +1 -0
  171. package/lib/dist/lib/src/http/interfaces/index.d.ts +3 -0
  172. package/lib/dist/lib/src/http/interfaces/index.d.ts.map +1 -0
  173. package/lib/dist/lib/src/http/interfaces/index.js +2 -0
  174. package/lib/dist/lib/src/http/middleware/index.d.ts +3 -0
  175. package/lib/dist/lib/src/http/middleware/index.d.ts.map +1 -0
  176. package/lib/dist/lib/src/http/middleware/index.js +2 -0
  177. package/lib/dist/lib/src/http/middleware/request/auth.middleware.d.ts +27 -0
  178. package/lib/dist/lib/src/http/middleware/request/auth.middleware.d.ts.map +1 -0
  179. package/lib/dist/lib/src/http/middleware/request/auth.middleware.js +107 -0
  180. package/lib/dist/lib/src/http/middleware/request/cors.middleware.d.ts +9 -0
  181. package/lib/dist/lib/src/http/middleware/request/cors.middleware.d.ts.map +1 -0
  182. package/lib/dist/lib/src/http/middleware/request/cors.middleware.js +15 -0
  183. package/lib/dist/lib/src/http/middleware/request/createContext.middleware.d.ts +12 -0
  184. package/lib/dist/lib/src/http/middleware/request/createContext.middleware.d.ts.map +1 -0
  185. package/lib/dist/lib/src/http/middleware/request/createContext.middleware.js +26 -0
  186. package/lib/dist/lib/src/http/middleware/request/enrichDetails.middleware.d.ts +12 -0
  187. package/lib/dist/lib/src/http/middleware/request/enrichDetails.middleware.d.ts.map +1 -0
  188. package/lib/dist/lib/src/http/middleware/request/enrichDetails.middleware.js +19 -0
  189. package/lib/dist/lib/src/http/middleware/request/parse.middleware.d.ts +13 -0
  190. package/lib/dist/lib/src/http/middleware/request/parse.middleware.d.ts.map +1 -0
  191. package/lib/dist/lib/src/http/middleware/request/parse.middleware.js +43 -0
  192. package/lib/dist/lib/src/http/middleware/request.middleware.d.ts +69 -0
  193. package/lib/dist/lib/src/http/middleware/request.middleware.d.ts.map +1 -0
  194. package/lib/dist/lib/src/http/middleware/request.middleware.js +210 -0
  195. package/lib/dist/lib/src/http/middleware/response/parse.middleware.d.ts +27 -0
  196. package/lib/dist/lib/src/http/middleware/response/parse.middleware.d.ts.map +1 -0
  197. package/lib/dist/lib/src/http/middleware/response/parse.middleware.js +52 -0
  198. package/lib/dist/lib/src/http/middleware/response.middleware.d.ts +27 -0
  199. package/lib/dist/lib/src/http/middleware/response.middleware.d.ts.map +1 -0
  200. package/lib/dist/lib/src/http/middleware/response.middleware.js +52 -0
  201. package/lib/dist/lib/src/http/openApiV3Generator/index.d.ts +2 -0
  202. package/lib/dist/lib/src/http/openApiV3Generator/index.d.ts.map +1 -0
  203. package/lib/dist/lib/src/http/openApiV3Generator/index.js +1 -0
  204. package/lib/dist/lib/src/http/openApiV3Generator/openApiV3Generator.d.ts +11 -0
  205. package/lib/dist/lib/src/http/openApiV3Generator/openApiV3Generator.d.ts.map +1 -0
  206. package/lib/dist/lib/src/http/openApiV3Generator/openApiV3Generator.js +167 -0
  207. package/lib/dist/lib/src/http/router/expressLikeRouter.d.ts +89 -0
  208. package/lib/dist/lib/src/http/router/expressLikeRouter.d.ts.map +1 -0
  209. package/{dist/http/interfaces/forklaunchExpress.router.interface.js → lib/dist/lib/src/http/router/expressLikeRouter.js} +85 -91
  210. package/lib/dist/lib/src/http/types/apiDefinition.types.d.ts +2 -0
  211. package/lib/dist/lib/src/http/types/apiDefinition.types.d.ts.map +1 -0
  212. package/lib/dist/lib/src/http/types/apiDefinition.types.js +1 -0
  213. package/lib/dist/lib/src/http/types/contractDetails.types.d.ts +2 -0
  214. package/lib/dist/lib/src/http/types/contractDetails.types.d.ts.map +1 -0
  215. package/lib/dist/lib/src/http/types/contractDetails.types.js +1 -0
  216. package/lib/dist/lib/src/http/types/index.d.ts +4 -0
  217. package/lib/dist/lib/src/http/types/index.d.ts.map +1 -0
  218. package/lib/dist/lib/src/http/types/index.js +3 -0
  219. package/lib/dist/lib/src/http/types/router.types.d.ts +2 -0
  220. package/lib/dist/lib/src/http/types/router.types.d.ts.map +1 -0
  221. package/lib/dist/lib/src/http/types/router.types.js +1 -0
  222. package/lib/dist/lib/src/http/utils/enrichExpressLikeSend.d.ts +28 -0
  223. package/lib/dist/lib/src/http/utils/enrichExpressLikeSend.d.ts.map +1 -0
  224. package/lib/dist/lib/src/http/utils/enrichExpressLikeSend.js +50 -0
  225. package/lib/dist/lib/src/http/utils/httpStatusCodes.d.ts +986 -0
  226. package/lib/dist/lib/src/http/utils/httpStatusCodes.d.ts.map +1 -0
  227. package/lib/dist/lib/src/http/utils/httpStatusCodes.js +1039 -0
  228. package/lib/dist/lib/src/http/utils/index.d.ts +3 -0
  229. package/lib/dist/lib/src/http/utils/index.d.ts.map +1 -0
  230. package/lib/dist/lib/src/http/utils/index.js +2 -0
  231. package/lib/dist/lib/src/services/index.d.ts +2 -0
  232. package/lib/dist/lib/src/services/index.d.ts.map +1 -0
  233. package/lib/dist/lib/src/services/interfaces/baseService.d.ts +2 -0
  234. package/lib/dist/lib/src/services/interfaces/baseService.d.ts.map +1 -0
  235. package/lib/dist/lib/src/services/interfaces/baseService.js +1 -0
  236. package/lib/dist/lib/tests/dtoMapper.test.d.ts +2 -0
  237. package/lib/dist/lib/tests/dtoMapper.test.d.ts.map +1 -0
  238. package/lib/dist/lib/tests/dtoMapper.test.js +172 -0
  239. package/lib/dist/lib/tests/entityMapper.test.d.ts.map +1 -0
  240. package/lib/dist/lib/tests/entityMapper.test.js +172 -0
  241. package/lib/dist/lib/tests/expressLikeRouter.test.d.ts +2 -0
  242. package/lib/dist/lib/tests/expressLikeRouter.test.d.ts.map +1 -0
  243. package/lib/dist/lib/tests/expressLikeRouter.test.js +3 -0
  244. package/lib/dist/lib/tests/http.middleware.test.d.ts.map +1 -0
  245. package/lib/dist/lib/tests/http.middleware.test.js +95 -0
  246. package/lib/dist/lib/tests/openApiV3Generator.test.d.ts.map +1 -0
  247. package/lib/dist/lib/tests/openApiV3Generator.test.js +66 -0
  248. package/lib/dist/lib/tests/redisTtlCache.test.d.ts.map +1 -0
  249. package/lib/dist/lib/tests/redisTtlCache.test.js +49 -0
  250. package/lib/dist/lib/tests/typedHandler.test.d.ts +2 -0
  251. package/lib/dist/lib/tests/typedHandler.test.d.ts.map +1 -0
  252. package/lib/dist/lib/tests/typedHandler.test.js +3 -0
  253. package/lib/dist/lib/vitest.config.d.ts +3 -0
  254. package/lib/dist/lib/vitest.config.d.ts.map +1 -0
  255. package/lib/dist/lib/vitest.config.js +7 -0
  256. package/lib/dist/services/index.d.ts +2 -0
  257. package/lib/dist/services/index.d.ts.map +1 -0
  258. package/lib/dist/services/index.js +1 -0
  259. package/lib/dist/services/interfaces/baseService.d.ts +2 -0
  260. package/lib/dist/services/interfaces/baseService.d.ts.map +1 -0
  261. package/lib/dist/services/interfaces/baseService.js +1 -0
  262. package/lib/dist/tests/entityMapper.test.d.ts +2 -0
  263. package/lib/dist/tests/entityMapper.test.d.ts.map +1 -0
  264. package/{dist → lib/dist}/tests/entityMapper.test.js +6 -2
  265. package/lib/dist/tests/http.middleware.test.d.ts +2 -0
  266. package/lib/dist/tests/http.middleware.test.d.ts.map +1 -0
  267. package/{dist → lib/dist}/tests/http.middleware.test.js +39 -21
  268. package/lib/dist/tests/openApiV3Generator.test.d.ts +2 -0
  269. package/lib/dist/tests/openApiV3Generator.test.d.ts.map +1 -0
  270. package/{dist → lib/dist}/tests/openApiV3Generator.test.js +1 -1
  271. package/lib/dist/tests/redisTtlCache.test.d.ts +2 -0
  272. package/lib/dist/tests/redisTtlCache.test.d.ts.map +1 -0
  273. package/lib/eslint.config.mjs +10 -0
  274. package/lib/index.d.ts +7 -0
  275. package/lib/index.d.ts.map +1 -0
  276. package/lib/index.js +7 -0
  277. package/lib/jest.config.d.ts +4 -0
  278. package/lib/jest.config.d.ts.map +1 -0
  279. package/lib/jest.config.js +21 -0
  280. package/lib/src/cache/index.d.ts.map +1 -0
  281. package/lib/src/cache/index.js +3 -0
  282. package/lib/src/cache/interfaces/ttlCache.interface.d.ts.map +1 -0
  283. package/lib/src/cache/interfaces/ttlCache.interface.js +1 -0
  284. package/lib/src/cache/redisTtlCache.d.ts.map +1 -0
  285. package/lib/src/cache/redisTtlCache.js +98 -0
  286. package/lib/src/cache/types/ttlCacheRecord.types.d.ts.map +1 -0
  287. package/lib/src/cache/types/ttlCacheRecord.types.js +1 -0
  288. package/lib/src/controllers/index.d.ts.map +1 -0
  289. package/lib/src/controllers/index.js +1 -0
  290. package/lib/src/controllers/interfaces/controller.interface.d.ts.map +1 -0
  291. package/lib/src/controllers/interfaces/controller.interface.js +1 -0
  292. package/lib/src/database/index.d.ts.map +1 -0
  293. package/lib/src/database/index.js +1 -0
  294. package/lib/src/database/mikro/models/entities/base.entity.d.ts.map +1 -0
  295. package/lib/src/domainMapper/index.d.ts +3 -0
  296. package/lib/src/domainMapper/index.d.ts.map +1 -0
  297. package/lib/src/domainMapper/index.js +2 -0
  298. package/{dist/entityMapper/interfaces/entityMapper.interface.d.ts → lib/src/domainMapper/interfaces/dtoMapper.interface.d.ts} +3 -3
  299. package/lib/src/domainMapper/interfaces/dtoMapper.interface.d.ts.map +1 -0
  300. package/lib/src/domainMapper/interfaces/dtoMapper.interface.js +1 -0
  301. package/{dist/entityMapper/models/baseEntityMapper.model.d.ts → lib/src/domainMapper/models/baseDtoMapper.model.d.ts} +13 -13
  302. package/lib/src/domainMapper/models/baseDtoMapper.model.d.ts.map +1 -0
  303. package/lib/src/domainMapper/models/baseDtoMapper.model.js +75 -0
  304. package/{dist/entityMapper/models/requestEntityMapper.model.d.ts → lib/src/domainMapper/models/requestDtoMapper.model.d.ts} +13 -13
  305. package/lib/src/domainMapper/models/requestDtoMapper.model.d.ts.map +1 -0
  306. package/lib/src/domainMapper/models/requestDtoMapper.model.js +70 -0
  307. package/{dist/entityMapper/models/responseEntityMapper.model.d.ts → lib/src/domainMapper/models/responseDtoMapper.model.d.ts} +12 -12
  308. package/lib/src/domainMapper/models/responseDtoMapper.model.d.ts.map +1 -0
  309. package/lib/src/domainMapper/models/responseDtoMapper.model.js +65 -0
  310. package/lib/src/domainMapper/types/dtoMapper.types.d.ts +9 -0
  311. package/lib/src/domainMapper/types/dtoMapper.types.d.ts.map +1 -0
  312. package/lib/src/domainMapper/types/dtoMapper.types.js +1 -0
  313. package/lib/src/dtoMapper/index.d.ts +3 -0
  314. package/lib/src/dtoMapper/index.d.ts.map +1 -0
  315. package/lib/src/dtoMapper/index.js +2 -0
  316. package/lib/src/dtoMapper/interfaces/dtoMapper.interface.d.ts +18 -0
  317. package/lib/src/dtoMapper/interfaces/dtoMapper.interface.d.ts.map +1 -0
  318. package/lib/src/dtoMapper/interfaces/dtoMapper.interface.js +1 -0
  319. package/lib/src/dtoMapper/models/baseDtoMapper.model.d.ts +72 -0
  320. package/lib/src/dtoMapper/models/baseDtoMapper.model.d.ts.map +1 -0
  321. package/lib/src/dtoMapper/models/baseDtoMapper.model.js +75 -0
  322. package/lib/src/dtoMapper/models/requestDtoMapper.model.d.ts +68 -0
  323. package/lib/src/dtoMapper/models/requestDtoMapper.model.d.ts.map +1 -0
  324. package/lib/src/dtoMapper/models/requestDtoMapper.model.js +70 -0
  325. package/lib/src/dtoMapper/models/responseDtoMapper.model.d.ts +67 -0
  326. package/lib/src/dtoMapper/models/responseDtoMapper.model.d.ts.map +1 -0
  327. package/lib/src/dtoMapper/models/responseDtoMapper.model.js +65 -0
  328. package/lib/src/dtoMapper/types/dtoMapper.types.d.ts +9 -0
  329. package/lib/src/dtoMapper/types/dtoMapper.types.d.ts.map +1 -0
  330. package/lib/src/dtoMapper/types/dtoMapper.types.js +1 -0
  331. package/lib/src/http/application/expressLikeApplication.d.ts +22 -0
  332. package/lib/src/http/application/expressLikeApplication.d.ts.map +1 -0
  333. package/lib/src/http/application/expressLikeApplication.js +20 -0
  334. package/lib/src/http/guards/isExpressLikeSchemaHandler.d.ts +5 -0
  335. package/lib/src/http/guards/isExpressLikeSchemaHandler.d.ts.map +1 -0
  336. package/lib/src/http/guards/isExpressLikeSchemaHandler.js +9 -0
  337. package/lib/src/http/guards/isHttpContractDetails.d.ts +7 -0
  338. package/lib/src/http/guards/isHttpContractDetails.d.ts.map +1 -0
  339. package/lib/src/http/guards/isHttpContractDetails.js +9 -0
  340. package/lib/src/http/guards/isPathParamContractDetails.d.ts +4 -0
  341. package/lib/src/http/guards/isPathParamContractDetails.d.ts.map +1 -0
  342. package/lib/src/http/guards/isPathParamContractDetails.js +10 -0
  343. package/lib/src/http/guards/isResponseShape.d.ts +3 -0
  344. package/lib/src/http/guards/isResponseShape.d.ts.map +1 -0
  345. package/lib/src/http/guards/isResponseShape.js +7 -0
  346. package/lib/src/http/guards/isTypedHandler.d.ts +5 -0
  347. package/lib/src/http/guards/isTypedHandler.d.ts.map +1 -0
  348. package/lib/src/http/guards/isTypedHandler.js +6 -0
  349. package/lib/src/http/handler/typedHandler.d.ts +24 -0
  350. package/lib/src/http/handler/typedHandler.d.ts.map +1 -0
  351. package/lib/src/http/handler/typedHandler.js +25 -0
  352. package/lib/src/http/handlers/typedHandler.d.ts +27 -0
  353. package/lib/src/http/handlers/typedHandler.d.ts.map +1 -0
  354. package/lib/src/http/handlers/typedHandler.js +30 -0
  355. package/lib/src/http/index.d.ts +12 -0
  356. package/lib/src/http/index.d.ts.map +1 -0
  357. package/lib/src/http/index.js +11 -0
  358. package/{dist/http/interfaces/forklaunchExpress.application.interface.d.ts → lib/src/http/interfaces/expressLikeApplication.interface.d.ts} +1 -1
  359. package/lib/src/http/interfaces/expressLikeApplication.interface.d.ts.map +1 -0
  360. package/lib/src/http/interfaces/expressLikeApplication.interface.js +14 -0
  361. package/lib/src/http/interfaces/expressLikeRouter.interface.d.ts +24 -0
  362. package/lib/src/http/interfaces/expressLikeRouter.interface.d.ts.map +1 -0
  363. package/lib/src/http/interfaces/expressLikeRouter.interface.js +1 -0
  364. package/lib/src/http/interfaces/index.d.ts +3 -0
  365. package/lib/src/http/interfaces/index.d.ts.map +1 -0
  366. package/lib/src/http/interfaces/index.js +2 -0
  367. package/lib/src/http/middleware/index.d.ts.map +1 -0
  368. package/lib/src/http/middleware/index.js +2 -0
  369. package/lib/src/http/middleware/request/auth.middleware.d.ts +31 -0
  370. package/lib/src/http/middleware/request/auth.middleware.d.ts.map +1 -0
  371. package/lib/src/http/middleware/request/auth.middleware.js +107 -0
  372. package/lib/src/http/middleware/request/cors.middleware.d.ts +13 -0
  373. package/lib/src/http/middleware/request/cors.middleware.d.ts.map +1 -0
  374. package/lib/src/http/middleware/request/cors.middleware.js +15 -0
  375. package/lib/src/http/middleware/request/createContext.middleware.d.ts +15 -0
  376. package/lib/src/http/middleware/request/createContext.middleware.d.ts.map +1 -0
  377. package/lib/src/http/middleware/request/createContext.middleware.js +26 -0
  378. package/lib/src/http/middleware/request/enrichDetails.middleware.d.ts +15 -0
  379. package/lib/src/http/middleware/request/enrichDetails.middleware.d.ts.map +1 -0
  380. package/lib/src/http/middleware/request/enrichDetails.middleware.js +19 -0
  381. package/lib/src/http/middleware/request/parse.middleware.d.ts +17 -0
  382. package/lib/src/http/middleware/request/parse.middleware.d.ts.map +1 -0
  383. package/lib/src/http/middleware/request/parse.middleware.js +43 -0
  384. package/lib/src/http/middleware/request.middleware.d.ts +73 -0
  385. package/lib/src/http/middleware/request.middleware.d.ts.map +1 -0
  386. package/lib/src/http/middleware/request.middleware.js +210 -0
  387. package/lib/src/http/middleware/response/parse.middleware.d.ts +31 -0
  388. package/lib/src/http/middleware/response/parse.middleware.d.ts.map +1 -0
  389. package/lib/src/http/middleware/response/parse.middleware.js +52 -0
  390. package/lib/src/http/middleware/response.middleware.d.ts +31 -0
  391. package/lib/src/http/middleware/response.middleware.d.ts.map +1 -0
  392. package/lib/src/http/middleware/response.middleware.js +52 -0
  393. package/lib/src/http/openApiV3Generator/index.d.ts +2 -0
  394. package/lib/src/http/openApiV3Generator/index.d.ts.map +1 -0
  395. package/lib/src/http/openApiV3Generator/index.js +1 -0
  396. package/{dist/http → lib/src/http/openApiV3Generator}/openApiV3Generator.d.ts +1 -1
  397. package/lib/src/http/openApiV3Generator/openApiV3Generator.d.ts.map +1 -0
  398. package/lib/src/http/openApiV3Generator/openApiV3Generator.js +169 -0
  399. package/lib/src/http/router/expressLikeRouter.d.ts +135 -0
  400. package/lib/src/http/router/expressLikeRouter.d.ts.map +1 -0
  401. package/lib/src/http/router/expressLikeRouter.js +438 -0
  402. package/{dist/http/types/api.types.d.ts → lib/src/http/types/apiDefinition.types.d.ts} +49 -24
  403. package/lib/src/http/types/apiDefinition.types.d.ts.map +1 -0
  404. package/lib/src/http/types/apiDefinition.types.js +1 -0
  405. package/lib/src/http/types/contractDetails.types.d.ts +169 -0
  406. package/lib/src/http/types/contractDetails.types.d.ts.map +1 -0
  407. package/lib/src/http/types/contractDetails.types.js +1 -0
  408. package/lib/src/http/types/expressLikeRouter.types.d.ts +35 -0
  409. package/lib/src/http/types/expressLikeRouter.types.d.ts.map +1 -0
  410. package/lib/src/http/types/expressLikeRouter.types.js +1 -0
  411. package/lib/src/http/types/index.d.ts +4 -0
  412. package/lib/src/http/types/index.d.ts.map +1 -0
  413. package/lib/src/http/types/index.js +3 -0
  414. package/{dist/http/types/forklaunch.types.d.ts → lib/src/http/types/router.types.d.ts} +3 -3
  415. package/lib/src/http/types/router.types.d.ts.map +1 -0
  416. package/lib/src/http/types/router.types.js +1 -0
  417. package/lib/src/http/utils/enrichExpressLikeSend.d.ts +32 -0
  418. package/lib/src/http/utils/enrichExpressLikeSend.d.ts.map +1 -0
  419. package/lib/src/http/utils/enrichExpressLikeSend.js +50 -0
  420. package/lib/src/http/utils/httpStatusCodes.d.ts.map +1 -0
  421. package/lib/src/http/utils/httpStatusCodes.js +1039 -0
  422. package/lib/src/http/utils/index.d.ts +3 -0
  423. package/lib/src/http/utils/index.d.ts.map +1 -0
  424. package/lib/src/http/utils/index.js +2 -0
  425. package/lib/src/services/index.d.ts.map +1 -0
  426. package/lib/src/services/index.js +1 -0
  427. package/lib/src/services/interfaces/baseService.d.ts.map +1 -0
  428. package/lib/src/services/interfaces/baseService.js +1 -0
  429. package/lib/tests/dtoMapper.test.d.ts +2 -0
  430. package/lib/tests/dtoMapper.test.d.ts.map +1 -0
  431. package/lib/tests/dtoMapper.test.js +168 -0
  432. package/lib/tests/entityMapper.test.d.ts +2 -0
  433. package/lib/tests/entityMapper.test.js +168 -0
  434. package/lib/tests/expressLikeRouter.test.d.ts +2 -0
  435. package/lib/tests/expressLikeRouter.test.d.ts.map +1 -0
  436. package/lib/tests/expressLikeRouter.test.js +3 -0
  437. package/lib/tests/expressLikeRouterInstantiation.test.d.ts +2 -0
  438. package/lib/tests/expressLikeRouterInstantiation.test.d.ts.map +1 -0
  439. package/lib/tests/expressLikeRouterInstantiation.test.js +60 -0
  440. package/lib/tests/http.middleware.test.d.ts +2 -0
  441. package/lib/tests/http.middleware.test.js +102 -0
  442. package/lib/tests/openApiV3Generator.test.d.ts +2 -0
  443. package/lib/tests/openApiV3Generator.test.js +66 -0
  444. package/lib/tests/redisTtlCache.test.d.ts +2 -0
  445. package/lib/tests/redisTtlCache.test.js +49 -0
  446. package/lib/tests/typedHandler.test.d.ts +2 -0
  447. package/lib/tests/typedHandler.test.d.ts.map +1 -0
  448. package/lib/tests/typedHandler.test.js +3 -0
  449. package/lib/tsconfig.tsbuildinfo +1 -0
  450. package/lib/vitest.config.d.ts +3 -0
  451. package/lib/vitest.config.d.ts.map +1 -0
  452. package/lib/vitest.config.js +7 -0
  453. package/package.json +52 -30
  454. package/dist/cache/index.d.ts.map +0 -1
  455. package/dist/cache/interfaces/ttlCache.interface.d.ts.map +0 -1
  456. package/dist/cache/redisTtlCache.d.ts.map +0 -1
  457. package/dist/cache/types/ttlCacheRecord.types.d.ts.map +0 -1
  458. package/dist/controllers/index.d.ts.map +0 -1
  459. package/dist/controllers/interfaces/controller.interface.d.ts.map +0 -1
  460. package/dist/database/index.d.ts.map +0 -1
  461. package/dist/database/mikro/models/entities/base.entity.d.ts.map +0 -1
  462. package/dist/entityMapper/index.d.ts +0 -3
  463. package/dist/entityMapper/index.d.ts.map +0 -1
  464. package/dist/entityMapper/interfaces/entityMapper.interface.d.ts.map +0 -1
  465. package/dist/entityMapper/models/baseEntityMapper.model.d.ts.map +0 -1
  466. package/dist/entityMapper/models/requestEntityMapper.model.d.ts.map +0 -1
  467. package/dist/entityMapper/models/responseEntityMapper.model.d.ts.map +0 -1
  468. package/dist/entityMapper/types/entityMapper.types.d.ts +0 -10
  469. package/dist/entityMapper/types/entityMapper.types.d.ts.map +0 -1
  470. package/dist/eslint.config.mjs +0 -10
  471. package/dist/http/httpStatusCodes.d.ts.map +0 -1
  472. package/dist/http/index.d.ts +0 -7
  473. package/dist/http/index.d.ts.map +0 -1
  474. package/dist/http/interfaces/forklaunchExpress.application.interface.d.ts.map +0 -1
  475. package/dist/http/interfaces/forklaunchExpress.router.interface.d.ts +0 -118
  476. package/dist/http/interfaces/forklaunchExpress.router.interface.d.ts.map +0 -1
  477. package/dist/http/interfaces/index.d.ts +0 -3
  478. package/dist/http/interfaces/index.d.ts.map +0 -1
  479. package/dist/http/interfaces/index.js +0 -2
  480. package/dist/http/middleware/index.d.ts.map +0 -1
  481. package/dist/http/middleware/request.middleware.d.ts +0 -111
  482. package/dist/http/middleware/request.middleware.d.ts.map +0 -1
  483. package/dist/http/middleware/response.middleware.d.ts +0 -17
  484. package/dist/http/middleware/response.middleware.d.ts.map +0 -1
  485. package/dist/http/middleware/response.middleware.js +0 -49
  486. package/dist/http/openApiV3Generator.d.ts.map +0 -1
  487. package/dist/http/regex.d.ts +0 -9
  488. package/dist/http/regex.d.ts.map +0 -1
  489. package/dist/http/regex.js +0 -111
  490. package/dist/http/types/api.types.d.ts.map +0 -1
  491. package/dist/http/types/forklaunch.types.d.ts.map +0 -1
  492. package/dist/http/types/index.d.ts +0 -4
  493. package/dist/http/types/index.d.ts.map +0 -1
  494. package/dist/http/types/index.js +0 -3
  495. package/dist/http/types/primitive.types.d.ts +0 -110
  496. package/dist/http/types/primitive.types.d.ts.map +0 -1
  497. package/dist/index.d.ts +0 -7
  498. package/dist/index.d.ts.map +0 -1
  499. package/dist/jest.config.d.ts +0 -4
  500. package/dist/jest.config.d.ts.map +0 -1
  501. package/dist/jest.config.js +0 -7
  502. package/dist/services/index.d.ts.map +0 -1
  503. package/dist/services/interfaces/baseService.d.ts.map +0 -1
  504. package/dist/tsconfig.tsbuildinfo +0 -1
  505. /package/{dist → lib/dist}/cache/index.js +0 -0
  506. /package/{dist → lib/dist}/cache/interfaces/ttlCache.interface.js +0 -0
  507. /package/{dist → lib/dist}/cache/types/ttlCacheRecord.types.js +0 -0
  508. /package/{dist → lib/dist}/controllers/index.js +0 -0
  509. /package/{dist → lib/dist}/controllers/interfaces/controller.interface.js +0 -0
  510. /package/{dist → lib/dist}/database/index.js +0 -0
  511. /package/{dist → lib/dist}/entityMapper/index.js +0 -0
  512. /package/{dist → lib/dist}/entityMapper/interfaces/entityMapper.interface.js +0 -0
  513. /package/{dist → lib/dist}/entityMapper/models/baseEntityMapper.model.js +0 -0
  514. /package/{dist → lib/dist}/entityMapper/models/requestEntityMapper.model.js +0 -0
  515. /package/{dist → lib/dist}/entityMapper/models/responseEntityMapper.model.js +0 -0
  516. /package/{dist → lib/dist}/entityMapper/types/entityMapper.types.js +0 -0
  517. /package/{dist/http/interfaces/forklaunchExpress.application.interface.js → lib/dist/http/interfaces/expressLikeApplication.interface.js} +0 -0
  518. /package/{dist → lib/dist}/http/middleware/index.js +0 -0
  519. /package/{dist/http/types/api.types.js → lib/dist/http/types/apiDefinition.types.js} +0 -0
  520. /package/{dist/http/types/forklaunch.types.js → lib/dist/http/types/contractDetails.types.js} +0 -0
  521. /package/{dist/http/types/primitive.types.js → lib/dist/http/types/router.types.js} +0 -0
  522. /package/{dist/http → lib/dist/http/utils}/httpStatusCodes.js +0 -0
  523. /package/{dist → lib/dist}/index.js +0 -0
  524. /package/{dist/services/interfaces/baseService.js → lib/dist/lib/src/cache/interfaces/ttlCache.interface.js} +0 -0
  525. /package/{dist → lib/dist/lib/src}/services/index.js +0 -0
  526. /package/{dist → lib/dist/lib}/tests/entityMapper.test.d.ts +0 -0
  527. /package/{dist → lib/dist/lib}/tests/http.middleware.test.d.ts +0 -0
  528. /package/{dist → lib/dist/lib}/tests/openApiV3Generator.test.d.ts +0 -0
  529. /package/{dist → lib/dist/lib}/tests/redisTtlCache.test.d.ts +0 -0
  530. /package/{dist → lib/dist}/tests/redisTtlCache.test.js +0 -0
  531. /package/{dist → lib}/eslint.config.d.mts +0 -0
  532. /package/{dist → lib}/eslint.config.d.mts.map +0 -0
  533. /package/{dist → lib/src}/cache/index.d.ts +0 -0
  534. /package/{dist → lib/src}/cache/interfaces/ttlCache.interface.d.ts +0 -0
  535. /package/{dist → lib/src}/cache/redisTtlCache.d.ts +0 -0
  536. /package/{dist → lib/src}/cache/types/ttlCacheRecord.types.d.ts +0 -0
  537. /package/{dist → lib/src}/controllers/index.d.ts +0 -0
  538. /package/{dist → lib/src}/controllers/interfaces/controller.interface.d.ts +0 -0
  539. /package/{dist → lib/src}/database/index.d.ts +0 -0
  540. /package/{dist → lib/src}/database/mikro/models/entities/base.entity.d.ts +0 -0
  541. /package/{dist → lib/src}/database/mikro/models/entities/base.entity.js +0 -0
  542. /package/{dist → lib/src}/http/middleware/index.d.ts +0 -0
  543. /package/{dist/http → lib/src/http/utils}/httpStatusCodes.d.ts +0 -0
  544. /package/{dist → lib/src}/services/index.d.ts +0 -0
  545. /package/{dist → lib/src}/services/interfaces/baseService.d.ts +0 -0
  546. /package/{dist → lib}/tests/entityMapper.test.d.ts.map +0 -0
  547. /package/{dist → lib}/tests/http.middleware.test.d.ts.map +0 -0
  548. /package/{dist → lib}/tests/openApiV3Generator.test.d.ts.map +0 -0
  549. /package/{dist → lib}/tests/redisTtlCache.test.d.ts.map +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseService.d.ts","sourceRoot":"","sources":["../../../../dist/services/interfaces/baseService.js"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=entityMapper.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entityMapper.test.d.ts","sourceRoot":"","sources":["../../../dist/tests/entityMapper.test.js"],"names":[],"mappings":""}
@@ -1,7 +1,11 @@
1
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4
+ r = Reflect.decorate(decorators, target, key, desc);
5
+ else
6
+ for (var i = decorators.length - 1; i >= 0; i--)
7
+ if (d = decorators[i])
8
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
9
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
10
  };
7
11
  import { TypeboxSchemaValidator, number, string } from '@forklaunch/validator/typebox';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=http.middleware.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.middleware.test.d.ts","sourceRoot":"","sources":["../../../dist/tests/http.middleware.test.js"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import { literal, mockSchemaValidator, optional, union } from '@forklaunch/validator/tests/mockSchemaValidator';
2
- import { createRequestContext, enrichRequestDetails, parseReqHeaders, parseRequestBody, parseRequestParams, parseRequestQuery, parseResponse } from '../http';
2
+ import { createRequestContext, enrichRequestDetails, parseResponse } from '../http';
3
3
  describe('Http Middleware Tests', () => {
4
4
  let contractDetails;
5
5
  let req;
@@ -23,23 +23,36 @@ describe('Http Middleware Tests', () => {
23
23
  }
24
24
  };
25
25
  req = {
26
+ method: 'POST',
26
27
  context: {},
27
28
  contractDetails: {},
28
29
  schemaValidator: {},
29
30
  params: testSchema,
30
31
  headers: testSchema,
31
32
  body: testSchema,
32
- query: testSchema
33
+ query: testSchema,
34
+ requestSchema: testSchema
33
35
  };
34
36
  res = {
35
37
  bodyData: {},
36
- statusCode: 400 | 401 | 403 | 500,
37
- corked: false,
38
- getHeaders: jest.fn(),
39
- setHeader: jest.fn(),
40
- status: jest.fn(),
38
+ statusCode: 200,
39
+ getHeaders: () => ({ 'x-correlation-id': '123' }),
40
+ setHeader: () => { },
41
+ status: () => ({
42
+ json: () => true,
43
+ jsonp: () => true,
44
+ send: () => { }
45
+ }),
46
+ end: () => { },
41
47
  headersSent: false,
42
- locals: {}
48
+ locals: {},
49
+ cors: true,
50
+ responseSchemas: {
51
+ headers: testSchema,
52
+ responses: {
53
+ 200: testSchema
54
+ }
55
+ }
43
56
  };
44
57
  });
45
58
  test('Create Request Context', async () => {
@@ -51,21 +64,26 @@ describe('Http Middleware Tests', () => {
51
64
  });
52
65
  test('Enrich Request Details', async () => {
53
66
  req.contractDetails = {};
54
- enrichRequestDetails(contractDetails)(req, res, nextFunction);
67
+ enrichRequestDetails(contractDetails, testSchema, {
68
+ headers: testSchema,
69
+ responses: {
70
+ 200: testSchema
71
+ }
72
+ })(req, res, nextFunction);
55
73
  expect(req.contractDetails).toEqual(contractDetails);
56
74
  });
57
- test('Validate Request Params', async () => {
58
- parseRequestParams(req, res, nextFunction);
59
- });
60
- test('Validate Request Headers', async () => {
61
- parseReqHeaders(req, res, nextFunction);
62
- });
63
- test('Validate Request Body', async () => {
64
- parseRequestBody(req, res, nextFunction);
65
- });
66
- test('Validate Request Query Params', async () => {
67
- parseRequestQuery(req, res, nextFunction);
68
- });
75
+ // test('Validate Request Params', async () => {
76
+ // parseRequestParams(req, res, nextFunction);
77
+ // });
78
+ // test('Validate Request Headers', async () => {
79
+ // parseReqHeaders(req, res, nextFunction);
80
+ // });
81
+ // test('Validate Request Body', async () => {
82
+ // parseRequestBody(req, res, nextFunction);
83
+ // });
84
+ // test('Validate Request Query Params', async () => {
85
+ // parseRequestQuery(req, res, nextFunction);
86
+ // });
69
87
  test('Validate Response', async () => {
70
88
  parseResponse(req, res, nextFunction);
71
89
  });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=openApiV3Generator.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openApiV3Generator.test.d.ts","sourceRoot":"","sources":["../../../dist/tests/openApiV3Generator.test.js"],"names":[],"mappings":""}
@@ -12,7 +12,7 @@ describe('OpenApiV3Generator Tests', () => {
12
12
  {
13
13
  basePath: '/test',
14
14
  path: '/',
15
- method: 'GET',
15
+ method: 'get',
16
16
  contractDetails: {
17
17
  name: 'Test Contract',
18
18
  summary: 'Test Contract Summary',
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=redisTtlCache.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redisTtlCache.test.d.ts","sourceRoot":"","sources":["../../../dist/tests/redisTtlCache.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import pluginJs from '@eslint/js';
2
+ import globals from 'globals';
3
+ import tseslint from 'typescript-eslint';
4
+ export default [
5
+ { files: ['**/*.{ts}'] },
6
+ { ignores: ['tests/**/*', 'dist/**/*', 'node_modules/**/*'] },
7
+ { languageOptions: { globals: globals.browser } },
8
+ pluginJs.configs.recommended,
9
+ ...tseslint.configs.recommended
10
+ ];
package/lib/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export * from './src/cache';
2
+ export * from './src/controllers';
3
+ export * from './src/database';
4
+ export * from './src/domainMapper';
5
+ export * from './src/http';
6
+ export * from './src/services';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export * from './src/cache';
2
+ export * from './src/controllers';
3
+ export * from './src/database';
4
+ export * from './src/dtoMapper';
5
+ export * from './src/http';
6
+ export * from './src/services';
7
+
@@ -0,0 +1,4 @@
1
+ import type { JestConfigWithTsJest } from 'ts-jest';
2
+ declare const jestConfig: JestConfigWithTsJest;
3
+ export default jestConfig;
4
+ //# sourceMappingURL=jest.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,QAAA,MAAM,UAAU,EAAE,oBAkBjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,21 @@
1
+ // import type { Config } from 'jest';
2
+ const jestConfig = {
3
+ // [...]
4
+ preset: 'ts-jest/presets/default-esm', // or other ESM presets
5
+ moduleNameMapper: {
6
+ '^(\\.{1,2}/.*)\\.js$': '$1'
7
+ },
8
+ transform: {
9
+ // '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
10
+ // '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
11
+ '^.+\\.[tj]sx?$': [
12
+ 'ts-jest',
13
+ {
14
+ useESM: true
15
+ }
16
+ ],
17
+ '^.+\\.js$': 'babel-jest'
18
+ },
19
+ testPathIgnorePatterns: ['.*dist/', '.*node_modules/']
20
+ };
21
+ export default jestConfig;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cache/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './interfaces/ttlCache.interface';
2
+ export * from './redisTtlCache';
3
+ export * from './types/ttlCacheRecord.types';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ttlCache.interface.d.ts","sourceRoot":"","sources":["../../../../src/cache/interfaces/ttlCache.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;;;;OAKG;IACH,SAAS,CAAC,WAAW,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;OAKG;IACH,YAAY,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpD;;;;;OAKG;IACH,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE5D;;;;;OAKG;IACH,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAErD;;;;OAIG;IACH,kBAAkB,IAAI,MAAM,CAAC;IAE7B;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CACrD"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redisTtlCache.d.ts","sourceRoot":"","sources":["../../../src/cache/redisTtlCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAgB,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D;;;GAGG;AACH,qBAAa,aAAc,YAAW,QAAQ;IAU1C,OAAO,CAAC,eAAe;IATzB,OAAO,CAAC,MAAM,CAAC;IAEf;;;;;OAKG;gBAEO,eAAe,EAAE,MAAM,EAC/B,cAAc,CAAC,EAAE,kBAAkB;IASrC;;;;;OAKG;IACG,SAAS,CAAC,EACd,GAAG,EACH,KAAK,EACL,eAAsC,EACvC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAMjC;;;;;OAKG;IACG,YAAY,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzD;;;;;;OAMG;IACG,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAajE;;;;;OAKG;IACG,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAKzD;;;;;OAKG;IACG,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK1D;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC;;;;OAIG;IACH,kBAAkB,IAAI,MAAM;CAG7B"}
@@ -0,0 +1,98 @@
1
+ import { createClient } from 'redis';
2
+ /**
3
+ * Class representing a Redis-based TTL (Time-To-Live) cache.
4
+ * Implements the TtlCache interface.
5
+ */
6
+ export class RedisTtlCache {
7
+ ttlMilliseconds;
8
+ client;
9
+ /**
10
+ * Creates an instance of RedisTtlCache.
11
+ *
12
+ * @param {number} ttlMilliseconds - The default TTL in milliseconds.
13
+ * @param {RedisClientOptions} [hostingOptions] - The Redis client options.
14
+ */
15
+ constructor(ttlMilliseconds, hostingOptions) {
16
+ this.ttlMilliseconds = ttlMilliseconds;
17
+ // Connects to localhost:6379 by default
18
+ // url usage: redis[s]://[[username][:password]@][host][:port][/db-number]
19
+ this.client = createClient(hostingOptions);
20
+ this.client.on('error', (err) => console.error('Redis Client Error', err));
21
+ this.client.connect().catch(console.error);
22
+ }
23
+ /**
24
+ * Puts a record into the Redis cache.
25
+ *
26
+ * @param {TtlCacheRecord} param0 - The cache record to put into the cache.
27
+ * @returns {Promise<void>} - A promise that resolves when the record is put into the cache.
28
+ */
29
+ async putRecord({ key, value, ttlMilliseconds = this.ttlMilliseconds }) {
30
+ await this.client.set(key, JSON.stringify(value), {
31
+ PX: ttlMilliseconds
32
+ });
33
+ }
34
+ /**
35
+ * Deletes a record from the Redis cache.
36
+ *
37
+ * @param {string} cacheRecordKey - The key of the cache record to delete.
38
+ * @returns {Promise<void>} - A promise that resolves when the record is deleted from the cache.
39
+ */
40
+ async deleteRecord(cacheRecordKey) {
41
+ await this.client.del(cacheRecordKey);
42
+ }
43
+ /**
44
+ * Reads a record from the Redis cache.
45
+ *
46
+ * @param {string} cacheRecordKey - The key of the cache record to read.
47
+ * @returns {Promise<TtlCacheRecord>} - A promise that resolves with the cache record.
48
+ * @throws {Error} - Throws an error if the record is not found.
49
+ */
50
+ async readRecord(cacheRecordKey) {
51
+ const value = await this.client.get(cacheRecordKey);
52
+ if (value === null) {
53
+ throw new Error(`Record not found for key: ${cacheRecordKey}`);
54
+ }
55
+ const ttl = await this.client.ttl(cacheRecordKey); // Fetch TTL from Redis
56
+ return {
57
+ key: cacheRecordKey,
58
+ value: JSON.parse(value),
59
+ ttlMilliseconds: ttl * 1000
60
+ };
61
+ }
62
+ /**
63
+ * Lists the keys in the Redis cache that match a pattern prefix.
64
+ *
65
+ * @param {string} pattern_prefix - The pattern prefix to match.
66
+ * @returns {Promise<string[]>} - A promise that resolves with an array of keys matching the pattern prefix.
67
+ */
68
+ async listKeys(pattern_prefix) {
69
+ const keys = await this.client.keys(pattern_prefix + '*');
70
+ return keys;
71
+ }
72
+ /**
73
+ * Peeks at a record in the Redis cache to check if it exists.
74
+ *
75
+ * @param {string} cacheRecordKey - The key of the cache record to peek at.
76
+ * @returns {Promise<boolean>} - A promise that resolves with a boolean indicating if the record exists.
77
+ */
78
+ async peekRecord(cacheRecordKey) {
79
+ const result = await this.client.exists(cacheRecordKey);
80
+ return result === 1;
81
+ }
82
+ /**
83
+ * Disconnects the Redis client.
84
+ *
85
+ * @returns {Promise<void>} - A promise that resolves when the client is disconnected.
86
+ */
87
+ async disconnect() {
88
+ await this.client.quit();
89
+ }
90
+ /**
91
+ * Gets the default TTL (Time-To-Live) in milliseconds.
92
+ *
93
+ * @returns {number} - The TTL in milliseconds.
94
+ */
95
+ getTtlMilliseconds() {
96
+ return this.ttlMilliseconds;
97
+ }
98
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ttlCacheRecord.types.d.ts","sourceRoot":"","sources":["../../../../src/cache/types/ttlCacheRecord.types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controllers/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './interfaces/controller.interface';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.interface.d.ts","sourceRoot":"","sources":["../../../../src/controllers/interfaces/controller.interface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,UAAU,UAAU;IAClB;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/database/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './mikro/models/entities/base.entity';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.entity.d.ts","sourceRoot":"","sources":["../../../../../../src/database/mikro/models/entities/base.entity.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,8BAAsB,UAAU;IAC9B;;;;;OAKG;IAEH,EAAE,EAAE,MAAM,CAAQ;IAElB;;;;OAIG;IAEH,SAAS,EAAE,IAAI,CAAc;IAE7B;;;;;OAKG;IAEH,SAAS,EAAE,IAAI,CAAc;CAC9B"}
@@ -0,0 +1,3 @@
1
+ export * from './models/requestDtoMapper.model';
2
+ export * from './models/responseDtoMapper.model';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domainMapper/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './models/requestDtoMapper.model';
2
+ export * from './models/responseDtoMapper.model';
@@ -4,9 +4,9 @@ import { AnySchemaValidator } from '@forklaunch/validator';
4
4
  *
5
5
  * @template T - The type of the entity mapper.
6
6
  * @template SV - The type of the schema validator.
7
- * @interface EntityMapperConstructor
7
+ * @interface DtoMapperConstructor
8
8
  */
9
- export interface EntityMapperConstructor<T, SV extends AnySchemaValidator> {
9
+ export interface DtoMapperConstructor<T, SV extends AnySchemaValidator> {
10
10
  /**
11
11
  * Creates a new instance of the entity mapper.
12
12
  *
@@ -15,4 +15,4 @@ export interface EntityMapperConstructor<T, SV extends AnySchemaValidator> {
15
15
  */
16
16
  new (schemaValidator: SV): T;
17
17
  }
18
- //# sourceMappingURL=entityMapper.interface.d.ts.map
18
+ //# sourceMappingURL=dtoMapper.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dtoMapper.interface.d.ts","sourceRoot":"","sources":["../../../../src/domainMapper/interfaces/dtoMapper.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,EAAE,EAAE,SAAS,kBAAkB;IACpE;;;;;OAKG;IACH,KAAK,eAAe,EAAE,EAAE,GAAG,CAAC,CAAC;CAC9B"}
@@ -1,22 +1,22 @@
1
1
  import { AnySchemaValidator, Schema, SchemaValidator } from '@forklaunch/validator';
2
- import { EntityMapperConstructor } from '../interfaces/entityMapper.interface';
3
- import { EntityMapperSchemaValidatorObject } from '../types/entityMapper.types';
2
+ import { DtoMapperConstructor } from '../interfaces/dtoMapper.interface';
3
+ import { DtoMapperSchemaValidatorObject } from '../types/dtoMapper.types';
4
4
  /**
5
5
  * Constructs an instance of a T.
6
6
  *
7
- * @template T - A type that extends BaseEntityMapper.
7
+ * @template T - A type that extends BaseDtoMapper.
8
8
  * @template SV - A type that extends AnySchemaValidator.
9
- * @param {EntityMapperConstructor<T, SV>} self - The constructor of the T.
9
+ * @param {DtoMapperConstructor<T, SV>} self - The constructor of the T.
10
10
  * @param {SV} [schemaValidator] - The optional schema validator.
11
11
  * @returns {T} - An instance of the T.
12
12
  */
13
- export declare function construct<T, SV extends AnySchemaValidator>(self: EntityMapperConstructor<T, SV>, schemaValidator?: SV): T;
13
+ export declare function construct<T, SV extends AnySchemaValidator>(self: DtoMapperConstructor<T, SV>, schemaValidator?: SV): T;
14
14
  /**
15
15
  * Abstract class representing a base entity mapper.
16
16
  *
17
17
  * @template SV - A type that extends AnySchemaValidator.
18
18
  */
19
- export declare abstract class BaseEntityMapper<SV extends AnySchemaValidator> {
19
+ export declare abstract class BaseDtoMapper<SV extends AnySchemaValidator> {
20
20
  /**
21
21
  * The schema validator exact type.
22
22
  * @type {SV}
@@ -31,17 +31,17 @@ export declare abstract class BaseEntityMapper<SV extends AnySchemaValidator> {
31
31
  protected schemaValidator: SchemaValidator;
32
32
  /**
33
33
  * The schema definition.
34
- * @type {EntityMapperSchemaValidatorObject<SV>}
34
+ * @type {DtoMapperSchemaValidatorObject<SV>}
35
35
  * @abstract
36
36
  */
37
- abstract schema: EntityMapperSchemaValidatorObject<SV>;
37
+ abstract schema: DtoMapperSchemaValidatorObject<SV>;
38
38
  /**
39
39
  * The Data Transfer Object (DTO).
40
40
  * @type {Schema<this['schema'], SV>}
41
41
  */
42
42
  _dto: Schema<this['schema'], SV>;
43
43
  /**
44
- * Creates an instance of BaseEntityMapper.
44
+ * Creates an instance of BaseDtoMapper.
45
45
  *
46
46
  * @param {SV} schemaValidator - The schema provider.
47
47
  */
@@ -62,11 +62,11 @@ export declare abstract class BaseEntityMapper<SV extends AnySchemaValidator> {
62
62
  /**
63
63
  * Gets the schema of a T.
64
64
  *
65
- * @template T - A type that extends BaseEntityMapper.
65
+ * @template T - A type that extends BaseDtoMapper.
66
66
  * @template SV - A type that extends AnySchemaValidator.
67
- * @param {EntityMapperConstructor<T, SV>} this - The constructor of the T.
67
+ * @param {DtoMapperConstructor<T, SV>} this - The constructor of the T.
68
68
  * @returns {T['schema']} - The schema of the T.
69
69
  */
70
- static schema<T extends BaseEntityMapper<SV>, SV extends AnySchemaValidator>(this: EntityMapperConstructor<T, SV>): T['schema'];
70
+ static schema<T extends BaseDtoMapper<SV>, SV extends AnySchemaValidator>(this: DtoMapperConstructor<T, SV>): T['schema'];
71
71
  }
72
- //# sourceMappingURL=baseEntityMapper.model.d.ts.map
72
+ //# sourceMappingURL=baseDtoMapper.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseDtoMapper.model.d.ts","sourceRoot":"","sources":["../../../../src/domainMapper/models/baseDtoMapper.model.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE1E;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,EAAE,SAAS,kBAAkB,EACxD,IAAI,EAAE,oBAAoB,CAAC,CAAC,EAAE,EAAE,CAAC,EACjC,eAAe,CAAC,EAAE,EAAE,GACnB,CAAC,CAEH;AAED;;;;GAIG;AACH,8BAAsB,aAAa,CAAC,EAAE,SAAS,kBAAkB;IAC/D;;;;OAIG;IACH,GAAG,EAAG,EAAE,CAAC;IAET;;;;OAIG;IACH,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAE3C;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,8BAA8B,CAAC,EAAE,CAAC,CAAC;IAEpD;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAG9B;IAEF;;;;OAIG;gBACS,eAAe,EAAE,EAAE;IAI/B;;;;;OAKG;IACH,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAUzB;IAED;;;;OAIG;IACH,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,CAEtB;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,kBAAkB,EACtE,IAAI,EAAE,oBAAoB,CAAC,CAAC,EAAE,EAAE,CAAC,GAChC,CAAC,CAAC,QAAQ,CAAC;CAGf"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Constructs an instance of a T.
3
+ *
4
+ * @template T - A type that extends BaseDtoMapper.
5
+ * @template SV - A type that extends AnySchemaValidator.
6
+ * @param {DtoMapperConstructor<T, SV>} self - The constructor of the T.
7
+ * @param {SV} [schemaValidator] - The optional schema validator.
8
+ * @returns {T} - An instance of the T.
9
+ */
10
+ export function construct(self, schemaValidator) {
11
+ return new self(schemaValidator || {});
12
+ }
13
+ /**
14
+ * Abstract class representing a base entity mapper.
15
+ *
16
+ * @template SV - A type that extends AnySchemaValidator.
17
+ */
18
+ export class BaseDtoMapper {
19
+ /**
20
+ * The schema validator exact type.
21
+ * @type {SV}
22
+ * @protected
23
+ */
24
+ _SV;
25
+ /**
26
+ * The schema validator as a general type.
27
+ * @type {SchemaValidator}
28
+ * @protected
29
+ */
30
+ schemaValidator;
31
+ /**
32
+ * The Data Transfer Object (DTO).
33
+ * @type {Schema<this['schema'], SV>}
34
+ */
35
+ _dto = {};
36
+ /**
37
+ * Creates an instance of BaseDtoMapper.
38
+ *
39
+ * @param {SV} schemaValidator - The schema provider.
40
+ */
41
+ constructor(schemaValidator) {
42
+ this.schemaValidator = schemaValidator;
43
+ }
44
+ /**
45
+ * Validates and sets the Data Transfer Object (DTO).
46
+ *
47
+ * @param {this['_dto']} dto - The Data Transfer Object (DTO).
48
+ * @throws {Error} - Throws an error if the DTO is invalid.
49
+ */
50
+ set dto(_dto) {
51
+ if (!this.schemaValidator.validate(this.schemaValidator.schemify(this.schema), _dto)) {
52
+ throw new Error('Invalid DTO');
53
+ }
54
+ this._dto = _dto;
55
+ }
56
+ /**
57
+ * Validates and gets the Data Transfer Object (DTO).
58
+ *
59
+ * @returns {this['_dto']} - The Data Transfer Object (DTO).
60
+ */
61
+ get dto() {
62
+ return this._dto;
63
+ }
64
+ /**
65
+ * Gets the schema of a T.
66
+ *
67
+ * @template T - A type that extends BaseDtoMapper.
68
+ * @template SV - A type that extends AnySchemaValidator.
69
+ * @param {DtoMapperConstructor<T, SV>} this - The constructor of the T.
70
+ * @returns {T['schema']} - The schema of the T.
71
+ */
72
+ static schema() {
73
+ return construct(this).schema;
74
+ }
75
+ }
@@ -1,15 +1,15 @@
1
1
  import { AnySchemaValidator } from '@forklaunch/validator';
2
2
  import { BaseEntity } from '../../database/mikro/models/entities/base.entity';
3
- import { EntityMapperConstructor } from '../interfaces/entityMapper.interface';
4
- import { BaseEntityMapper } from './baseEntityMapper.model';
3
+ import { DtoMapperConstructor } from '../interfaces/dtoMapper.interface';
4
+ import { BaseDtoMapper } from './baseDtoMapper.model';
5
5
  /**
6
6
  * Abstract class representing a request entity mapper.
7
7
  *
8
8
  * @template Entity - A type that extends BaseEntity.
9
9
  * @template SV - A type that extends AnySchemaValidator.
10
- * @extends {BaseEntityMapper<SV>}
10
+ * @extends {BaseDtoMapper<SV>}
11
11
  */
12
- export declare abstract class RequestEntityMapper<Entity extends BaseEntity, SV extends AnySchemaValidator> extends BaseEntityMapper<SV> {
12
+ export declare abstract class RequestDtoMapper<Entity extends BaseEntity, SV extends AnySchemaValidator> extends BaseDtoMapper<SV> {
13
13
  /**
14
14
  * The entity type.
15
15
  * @type {Entity}
@@ -28,7 +28,7 @@ export declare abstract class RequestEntityMapper<Entity extends BaseEntity, SV
28
28
  * Populates the DTO with data from a JSON object.
29
29
  *
30
30
  * @param {this['_dto']} json - The JSON object.
31
- * @returns {this} - The instance of the RequestEntityMapper.
31
+ * @returns {this} - The instance of the RequestDtoMapper.
32
32
  */
33
33
  fromJson(json: this['_dto']): this;
34
34
  /**
@@ -40,29 +40,29 @@ export declare abstract class RequestEntityMapper<Entity extends BaseEntity, SV
40
40
  */
41
41
  deserializeJsonToEntity(json: this['_dto'], ...additionalArgs: unknown[]): Entity;
42
42
  /**
43
- * Creates an instance of a RequestEntityMapper from a JSON object.
43
+ * Creates an instance of a RequestDtoMapper from a JSON object.
44
44
  *
45
- * @template T - A type that extends RequestEntityMapper.
45
+ * @template T - A type that extends RequestDtoMapper.
46
46
  * @template SV - A type that extends AnySchemaValidator.
47
47
  * @template JsonType - The type of the JSON object.
48
- * @param {EntityMapperConstructor<T, SV>} this - The constructor of the T.
48
+ * @param {DtoMapperConstructor<T, SV>} this - The constructor of the T.
49
49
  * @param {SV} schemaValidator - The schema provider.
50
50
  * @param {JsonType} json - The JSON object.
51
51
  * @returns {T} - An instance of the T.
52
52
  */
53
- static fromJson<T extends RequestEntityMapper<BaseEntity, SV>, SV extends AnySchemaValidator, JsonType extends T['_dto']>(this: EntityMapperConstructor<T, SV>, schemaValidator: SV, json: JsonType): T;
53
+ static fromJson<T extends RequestDtoMapper<BaseEntity, SV>, SV extends AnySchemaValidator, JsonType extends T['_dto']>(this: DtoMapperConstructor<T, SV>, schemaValidator: SV, json: JsonType): T;
54
54
  /**
55
55
  * Deserializes a JSON object to an entity.
56
56
  *
57
- * @template T - A type that extends RequestEntityMapper.
57
+ * @template T - A type that extends RequestDtoMapper.
58
58
  * @template SV - A type that extends AnySchemaValidator.
59
59
  * @template JsonType - The type of the JSON object.
60
- * @param {EntityMapperConstructor<T, SV>} this - The constructor of the T.
60
+ * @param {DtoMapperConstructor<T, SV>} this - The constructor of the T.
61
61
  * @param {SV} schemaValidator - The schema provider.
62
62
  * @param {JsonType} json - The JSON object.
63
63
  * @param {...unknown[]} additionalArgs - Additional arguments.
64
64
  * @returns {T['_Entity']} - The entity.
65
65
  */
66
- static deserializeJsonToEntity<T extends RequestEntityMapper<BaseEntity, SV>, SV extends AnySchemaValidator, JsonType extends T['_dto']>(this: EntityMapperConstructor<T, SV>, schemaValidator: SV, json: JsonType, ...additionalArgs: unknown[]): T['_Entity'];
66
+ static deserializeJsonToEntity<T extends RequestDtoMapper<BaseEntity, SV>, SV extends AnySchemaValidator, JsonType extends T['_dto']>(this: DtoMapperConstructor<T, SV>, schemaValidator: SV, json: JsonType, ...additionalArgs: unknown[]): T['_Entity'];
67
67
  }
68
- //# sourceMappingURL=requestEntityMapper.model.d.ts.map
68
+ //# sourceMappingURL=requestDtoMapper.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestDtoMapper.model.d.ts","sourceRoot":"","sources":["../../../../src/domainMapper/models/requestDtoMapper.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,kDAAkD,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAa,MAAM,uBAAuB,CAAC;AAEjE;;;;;;GAMG;AACH,8BAAsB,gBAAgB,CACpC,MAAM,SAAS,UAAU,EACzB,EAAE,SAAS,kBAAkB,CAC7B,SAAQ,aAAa,CAAC,EAAE,CAAC;IACzB;;;;OAIG;IACH,OAAO,EAAG,MAAM,CAAC;IAEjB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,GAAG,cAAc,EAAE,OAAO,EAAE,GAAG,MAAM;IAEvD;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI;IAalC;;;;;;OAMG;IACH,uBAAuB,CACrB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAClB,GAAG,cAAc,EAAE,OAAO,EAAE,GAC3B,MAAM;IAIT;;;;;;;;;;OAUG;IACH,MAAM,CAAC,QAAQ,CACb,CAAC,SAAS,gBAAgB,CAAC,UAAU,EAAE,EAAE,CAAC,EAC1C,EAAE,SAAS,kBAAkB,EAC7B,QAAQ,SAAS,CAAC,CAAC,MAAM,CAAC,EAE1B,IAAI,EAAE,oBAAoB,CAAC,CAAC,EAAE,EAAE,CAAC,EACjC,eAAe,EAAE,EAAE,EACnB,IAAI,EAAE,QAAQ,GACb,CAAC;IAIJ;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,uBAAuB,CAC5B,CAAC,SAAS,gBAAgB,CAAC,UAAU,EAAE,EAAE,CAAC,EAC1C,EAAE,SAAS,kBAAkB,EAC7B,QAAQ,SAAS,CAAC,CAAC,MAAM,CAAC,EAE1B,IAAI,EAAE,oBAAoB,CAAC,CAAC,EAAE,EAAE,CAAC,EACjC,eAAe,EAAE,EAAE,EACnB,IAAI,EAAE,QAAQ,EACd,GAAG,cAAc,EAAE,OAAO,EAAE,GAC3B,CAAC,CAAC,SAAS,CAAC;CAKhB"}