node-server-engine 1.1.4 → 1.1.5

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 (468) hide show
  1. package/.env.example +193 -193
  2. package/.mocharc.js +13 -13
  3. package/.nycrc +18 -18
  4. package/.prettierrc +7 -7
  5. package/Dockerfile +30 -30
  6. package/README.md +991 -991
  7. package/babel.config.json +34 -35
  8. package/dist/const/DebeziumEvent.js.map +1 -1
  9. package/dist/const/LogSeverity.js.map +1 -1
  10. package/dist/const/index.js.map +1 -1
  11. package/dist/const/metrics.js.map +1 -1
  12. package/dist/const/mime.js.map +1 -1
  13. package/dist/const/tokenIssuer.js.map +1 -1
  14. package/dist/db/migrations/20241030121500-create-sequelize-meta-table.js.map +1 -1
  15. package/dist/db/models/SequelizeMeta.js +1 -0
  16. package/dist/db/models/SequelizeMeta.js.map +1 -1
  17. package/dist/db/models/index.js.map +1 -1
  18. package/dist/entities/ElasticSearch/ElasticSearch.js +7 -7
  19. package/dist/entities/ElasticSearch/ElasticSearch.js.map +1 -1
  20. package/dist/entities/ElasticSearch/ElasticSearch.types.js.map +1 -1
  21. package/dist/entities/ElasticSearch/index.js.map +1 -1
  22. package/dist/entities/Endpoint/Endpoint.js +18 -17
  23. package/dist/entities/Endpoint/Endpoint.js.map +1 -1
  24. package/dist/entities/Endpoint/Endpoint.types.js.map +1 -1
  25. package/dist/entities/Endpoint/index.js.map +1 -1
  26. package/dist/entities/EngineError/EngineError.js +7 -6
  27. package/dist/entities/EngineError/EngineError.js.map +1 -1
  28. package/dist/entities/EngineError/EngineError.types.js.map +1 -1
  29. package/dist/entities/EngineError/index.js.map +1 -1
  30. package/dist/entities/KeySet/KeySet.js +10 -9
  31. package/dist/entities/KeySet/KeySet.js.map +1 -1
  32. package/dist/entities/KeySet/KeySet.types.js.map +1 -1
  33. package/dist/entities/KeySet/index.js.map +1 -1
  34. package/dist/entities/LifecycleController/LifecycleController.js.map +1 -1
  35. package/dist/entities/LifecycleController/LifecycleController.types.js.map +1 -1
  36. package/dist/entities/LifecycleController/index.js.map +1 -1
  37. package/dist/entities/Localizator/Localizator.js +7 -7
  38. package/dist/entities/Localizator/Localizator.js.map +1 -1
  39. package/dist/entities/Localizator/Localizator.types.js.map +1 -1
  40. package/dist/entities/Localizator/guessNamingConvention/guessNamingConvention.js.map +1 -1
  41. package/dist/entities/Localizator/guessNamingConvention/index.js.map +1 -1
  42. package/dist/entities/Localizator/index.js.map +1 -1
  43. package/dist/entities/MessageHandler/MessageHandler.js +7 -6
  44. package/dist/entities/MessageHandler/MessageHandler.js.map +1 -1
  45. package/dist/entities/MessageHandler/MessageHandler.types.js.map +1 -1
  46. package/dist/entities/MessageHandler/index.js.map +1 -1
  47. package/dist/entities/PubSub/PubSub.js +25 -25
  48. package/dist/entities/PubSub/PubSub.js.map +1 -1
  49. package/dist/entities/PubSub/PubSub.types.js.map +1 -1
  50. package/dist/entities/PubSub/handleMessage/handleMessage.js +6 -6
  51. package/dist/entities/PubSub/handleMessage/handleMessage.js.map +1 -1
  52. package/dist/entities/PubSub/handleMessage/index.js.map +1 -1
  53. package/dist/entities/PubSub/index.js.map +1 -1
  54. package/dist/entities/PushNotification/PushNotification.js +4 -4
  55. package/dist/entities/PushNotification/PushNotification.js.map +1 -1
  56. package/dist/entities/PushNotification/PushNotification.types.js.map +1 -1
  57. package/dist/entities/PushNotification/index.js.map +1 -1
  58. package/dist/entities/Redis/Redis.js +8 -8
  59. package/dist/entities/Redis/Redis.js.map +1 -1
  60. package/dist/entities/Redis/Redis.types.js.map +1 -1
  61. package/dist/entities/Redis/Redis.validate.js +2 -2
  62. package/dist/entities/Redis/Redis.validate.js.map +1 -1
  63. package/dist/entities/Redis/index.js.map +1 -1
  64. package/dist/entities/Sequelize/Sequelize.config.js.map +1 -1
  65. package/dist/entities/Sequelize/Sequelize.js +2 -2
  66. package/dist/entities/Sequelize/Sequelize.js.map +1 -1
  67. package/dist/entities/Sequelize/Sequelize.types.js.map +1 -1
  68. package/dist/entities/Sequelize/Sequelize.validate.js +2 -2
  69. package/dist/entities/Sequelize/Sequelize.validate.js.map +1 -1
  70. package/dist/entities/Sequelize/index.js.map +1 -1
  71. package/dist/entities/Server/Server.const.js.map +1 -1
  72. package/dist/entities/Server/Server.js +18 -17
  73. package/dist/entities/Server/Server.js.map +1 -1
  74. package/dist/entities/Server/Server.types.js.map +1 -1
  75. package/dist/entities/Server/index.js.map +1 -1
  76. package/dist/entities/SocketClient/SocketClient.js +33 -32
  77. package/dist/entities/SocketClient/SocketClient.js.map +1 -1
  78. package/dist/entities/SocketClient/SocketClient.types.js.map +1 -1
  79. package/dist/entities/SocketClient/index.js.map +1 -1
  80. package/dist/entities/SocketClient/parseMessage/index.js.map +1 -1
  81. package/dist/entities/SocketClient/parseMessage/parseMessage.js +2 -2
  82. package/dist/entities/SocketClient/parseMessage/parseMessage.js.map +1 -1
  83. package/dist/entities/Storage/Storage.js +20 -20
  84. package/dist/entities/Storage/Storage.js.map +1 -1
  85. package/dist/entities/Storage/Storage.types.js.map +1 -1
  86. package/dist/entities/Storage/index.js.map +1 -1
  87. package/dist/entities/ValidationError/ValidationError.js.map +1 -1
  88. package/dist/entities/ValidationError/index.js.map +1 -1
  89. package/dist/entities/WebError/WebError.js +7 -6
  90. package/dist/entities/WebError/WebError.js.map +1 -1
  91. package/dist/entities/WebError/WebError.types.js.map +1 -1
  92. package/dist/entities/WebError/index.js.map +1 -1
  93. package/dist/entities/index.js.map +1 -1
  94. package/dist/index.js.map +1 -1
  95. package/dist/metrics/debug.js.map +1 -1
  96. package/dist/metrics/index.js.map +1 -1
  97. package/dist/metrics/request.js.map +1 -1
  98. package/dist/middleware/authAdmin/authAdmin.js.map +1 -1
  99. package/dist/middleware/authAdmin/authAdmin.types.js.map +1 -1
  100. package/dist/middleware/authAdmin/index.js.map +1 -1
  101. package/dist/middleware/authHmac/authHmac.js.map +1 -1
  102. package/dist/middleware/authHmac/authHmac.types.js.map +1 -1
  103. package/dist/middleware/authHmac/index.js.map +1 -1
  104. package/dist/middleware/authJwt/authJwt.js.map +1 -1
  105. package/dist/middleware/authJwt/authJwt.types.js.map +1 -1
  106. package/dist/middleware/authJwt/index.js.map +1 -1
  107. package/dist/middleware/authStatic/authStatic.js +3 -3
  108. package/dist/middleware/authStatic/authStatic.js.map +1 -1
  109. package/dist/middleware/authStatic/index.js.map +1 -1
  110. package/dist/middleware/authTls/authTls.js +8 -8
  111. package/dist/middleware/authTls/authTls.js.map +1 -1
  112. package/dist/middleware/authTls/authTls.types.js.map +1 -1
  113. package/dist/middleware/authTls/index.js.map +1 -1
  114. package/dist/middleware/checkPermission/checkPermission.js.map +1 -1
  115. package/dist/middleware/error/error.js.map +1 -1
  116. package/dist/middleware/error/index.js.map +1 -1
  117. package/dist/middleware/fileUploader/compressAvatar/compressAvatar.js +2 -2
  118. package/dist/middleware/fileUploader/compressAvatar/compressAvatar.js.map +1 -1
  119. package/dist/middleware/fileUploader/compressAvatar/compressAvatar.types.js.map +1 -1
  120. package/dist/middleware/fileUploader/compressAvatar/index.js.map +1 -1
  121. package/dist/middleware/fileUploader/fileUploader.js +12 -12
  122. package/dist/middleware/fileUploader/fileUploader.js.map +1 -1
  123. package/dist/middleware/fileUploader/fileUploader.types.js.map +1 -1
  124. package/dist/middleware/fileUploader/index.js.map +1 -1
  125. package/dist/middleware/fileUploader/isMultiPart/index.js.map +1 -1
  126. package/dist/middleware/fileUploader/isMultiPart/isMultipart.js.map +1 -1
  127. package/dist/middleware/fileUploader/validate/index.js.map +1 -1
  128. package/dist/middleware/fileUploader/validate/validate.js.map +1 -1
  129. package/dist/middleware/fourOhFour/fourOhFour.js.map +1 -1
  130. package/dist/middleware/fourOhFour/index.js.map +1 -1
  131. package/dist/middleware/geminiFileUploader/geminiFileUploader.js.map +1 -1
  132. package/dist/middleware/geminiFileUploader/index.js.map +1 -1
  133. package/dist/middleware/healthCheck/healthCheck.js +2 -2
  134. package/dist/middleware/healthCheck/healthCheck.js.map +1 -1
  135. package/dist/middleware/healthCheck/index.js.map +1 -1
  136. package/dist/middleware/index.js.map +1 -1
  137. package/dist/middleware/metrics/index.js.map +1 -1
  138. package/dist/middleware/metrics/metrics.js.map +1 -1
  139. package/dist/middleware/requestMetrics/index.js.map +1 -1
  140. package/dist/middleware/requestMetrics/requestMetrics.js.map +1 -1
  141. package/dist/middleware/swaggerDocs/index.js.map +1 -1
  142. package/dist/middleware/swaggerDocs/swaggerDocs.js +7 -7
  143. package/dist/middleware/swaggerDocs/swaggerDocs.js.map +1 -1
  144. package/dist/middleware/swaggerDocs/swaggerDocs.types.js.map +1 -1
  145. package/dist/middleware/userResolver/index.js.map +1 -1
  146. package/dist/middleware/userResolver/userResolver.js.map +1 -1
  147. package/dist/middleware/validate/index.js.map +1 -1
  148. package/dist/middleware/validate/validate.js.map +1 -1
  149. package/dist/middleware/version/index.js.map +1 -1
  150. package/dist/middleware/version/version.js +3 -3
  151. package/dist/middleware/version/version.js.map +1 -1
  152. package/dist/utils/checkEnvironment/index.js +13 -13
  153. package/dist/utils/checkEnvironment/index.js.map +1 -1
  154. package/dist/utils/createHttpServer/createHttpServer.js.map +1 -1
  155. package/dist/utils/createHttpServer/createHttpServer.validate.js +2 -2
  156. package/dist/utils/createHttpServer/createHttpServer.validate.js.map +1 -1
  157. package/dist/utils/createHttpServer/index.js.map +1 -1
  158. package/dist/utils/createSortedObject/createSortedObject.js.map +1 -1
  159. package/dist/utils/createSortedObject/index.js.map +1 -1
  160. package/dist/utils/dbMigration/dbMigration.js +8 -8
  161. package/dist/utils/dbMigration/dbMigration.js.map +1 -1
  162. package/dist/utils/dbMigration/dbMigration.types.js.map +1 -1
  163. package/dist/utils/dbMigration/index.js.map +1 -1
  164. package/dist/utils/dbMigration/migrateMetadataTable/index.js.map +1 -1
  165. package/dist/utils/dbMigration/migrateMetadataTable/migrateMetadataTable.js +4 -4
  166. package/dist/utils/dbMigration/migrateMetadataTable/migrateMetadataTable.js.map +1 -1
  167. package/dist/utils/envAssert/envAssert.js +6 -6
  168. package/dist/utils/envAssert/envAssert.js.map +1 -1
  169. package/dist/utils/envAssert/index.js.map +1 -1
  170. package/dist/utils/envAssert/validators/hostList.js +2 -2
  171. package/dist/utils/envAssert/validators/hostList.js.map +1 -1
  172. package/dist/utils/envAssert/validators/index.js.map +1 -1
  173. package/dist/utils/envAssert/validators/ipList.js +2 -2
  174. package/dist/utils/envAssert/validators/ipList.js.map +1 -1
  175. package/dist/utils/envAssert/validators/path.js +2 -2
  176. package/dist/utils/envAssert/validators/path.js.map +1 -1
  177. package/dist/utils/envAssert/validators/string.js +2 -2
  178. package/dist/utils/envAssert/validators/string.js.map +1 -1
  179. package/dist/utils/envAssert/validators/stringList.js +3 -3
  180. package/dist/utils/envAssert/validators/stringList.js.map +1 -1
  181. package/dist/utils/filter/filter.js +4 -4
  182. package/dist/utils/filter/filter.js.map +1 -1
  183. package/dist/utils/filter/index.js.map +1 -1
  184. package/dist/utils/getDynamicLink/getDynamicLink.js.map +1 -1
  185. package/dist/utils/getDynamicLink/getDynamicLink.types.js.map +1 -1
  186. package/dist/utils/getDynamicLink/getDynamicLink.validate.js.map +1 -1
  187. package/dist/utils/getDynamicLink/index.js.map +1 -1
  188. package/dist/utils/hmac/checkEnv/checkEnv.js +2 -2
  189. package/dist/utils/hmac/checkEnv/checkEnv.js.map +1 -1
  190. package/dist/utils/hmac/checkEnv/index.js.map +1 -1
  191. package/dist/utils/hmac/createHmac/createHmac.js.map +1 -1
  192. package/dist/utils/hmac/createHmac/index.js.map +1 -1
  193. package/dist/utils/hmac/index.js.map +1 -1
  194. package/dist/utils/hmac/index.types.js.map +1 -1
  195. package/dist/utils/hmac/signPayload/index.js.map +1 -1
  196. package/dist/utils/hmac/signPayload/signPayload.js.map +1 -1
  197. package/dist/utils/hmac/verifySignature/index.js.map +1 -1
  198. package/dist/utils/hmac/verifySignature/verifySignature.js.map +1 -1
  199. package/dist/utils/index.js.map +1 -1
  200. package/dist/utils/jwt/index.js.map +1 -1
  201. package/dist/utils/jwt/jwt.js.map +1 -1
  202. package/dist/utils/jwt/jwt.types.js.map +1 -1
  203. package/dist/utils/report/index.js.map +1 -1
  204. package/dist/utils/report/output.js.map +1 -1
  205. package/dist/utils/report/output.types.js.map +1 -1
  206. package/dist/utils/report/report.js.map +1 -1
  207. package/dist/utils/report/report.types.js.map +1 -1
  208. package/dist/utils/request/index.js.map +1 -1
  209. package/dist/utils/request/request.js.map +1 -1
  210. package/dist/utils/semverCompare/index.js.map +1 -1
  211. package/dist/utils/semverCompare/semverCompare.js +5 -5
  212. package/dist/utils/semverCompare/semverCompare.js.map +1 -1
  213. package/dist/utils/sendEmail/index.js.map +1 -1
  214. package/dist/utils/sendEmail/sendEmail.js +8 -8
  215. package/dist/utils/sendEmail/sendEmail.js.map +1 -1
  216. package/dist/utils/sendEmail/sendEmail.types.js.map +1 -1
  217. package/dist/utils/sendPush/index.js.map +1 -1
  218. package/dist/utils/sendPush/sendPush.js +5 -5
  219. package/dist/utils/sendPush/sendPush.js.map +1 -1
  220. package/dist/utils/sendPush/sendPush.types.js.map +1 -1
  221. package/dist/utils/tlsConfig/index.js.map +1 -1
  222. package/dist/utils/tlsConfig/tlsConfig.js +2 -2
  223. package/dist/utils/tlsConfig/tlsConfig.js.map +1 -1
  224. package/dist/utils/tlsConfig/tlsConfig.types.js.map +1 -1
  225. package/dist/utils/tlsConfig/tlsConfig.validate.js +2 -2
  226. package/dist/utils/tlsConfig/tlsConfig.validate.js.map +1 -1
  227. package/dist/utils/tlsRequest/index.js.map +1 -1
  228. package/dist/utils/tlsRequest/tlsRequest.js.map +1 -1
  229. package/dist/utils/trimPathSlash/index.js.map +1 -1
  230. package/dist/utils/trimPathSlash/trimPathSlash.js +4 -4
  231. package/dist/utils/trimPathSlash/trimPathSlash.js.map +1 -1
  232. package/eslint.config.mjs +11 -11
  233. package/package.json +159 -164
  234. package/src/const/DebeziumEvent.ts +6 -6
  235. package/src/const/LogSeverity.ts +7 -7
  236. package/src/const/index.ts +5 -5
  237. package/src/const/metrics.ts +6 -6
  238. package/src/const/mime.ts +37 -37
  239. package/src/const/tokenIssuer.ts +9 -9
  240. package/src/db/migrations/20241030121500-create-sequelize-meta-table.ts +29 -29
  241. package/src/db/models/SequelizeMeta.ts +16 -16
  242. package/src/db/models/index.ts +2 -2
  243. package/src/entities/ElasticSearch/ElasticSearch.ts +103 -103
  244. package/src/entities/ElasticSearch/ElasticSearch.types.ts +7 -7
  245. package/src/entities/ElasticSearch/index.ts +2 -2
  246. package/src/entities/Endpoint/Endpoint.test.ts +337 -337
  247. package/src/entities/Endpoint/Endpoint.ts +202 -202
  248. package/src/entities/Endpoint/Endpoint.types.ts +205 -205
  249. package/src/entities/Endpoint/index.ts +2 -2
  250. package/src/entities/EngineError/EngineError.ts +28 -28
  251. package/src/entities/EngineError/EngineError.types.ts +15 -15
  252. package/src/entities/EngineError/index.ts +2 -2
  253. package/src/entities/KeySet/KeySet.test.ts +126 -126
  254. package/src/entities/KeySet/KeySet.ts +172 -172
  255. package/src/entities/KeySet/KeySet.types.ts +28 -28
  256. package/src/entities/KeySet/index.ts +2 -2
  257. package/src/entities/LifecycleController/LifecycleController.test.ts +48 -48
  258. package/src/entities/LifecycleController/LifecycleController.ts +24 -24
  259. package/src/entities/LifecycleController/LifecycleController.types.ts +5 -5
  260. package/src/entities/LifecycleController/index.ts +2 -2
  261. package/src/entities/Localizator/Localizator.ts +139 -139
  262. package/src/entities/Localizator/Localizator.types.ts +52 -52
  263. package/src/entities/Localizator/guessNamingConvention/guessNamingConvention.test.ts +165 -165
  264. package/src/entities/Localizator/guessNamingConvention/guessNamingConvention.ts +58 -58
  265. package/src/entities/Localizator/guessNamingConvention/index.ts +1 -1
  266. package/src/entities/Localizator/index.ts +2 -2
  267. package/src/entities/MessageHandler/MessageHandler.test.ts +130 -130
  268. package/src/entities/MessageHandler/MessageHandler.ts +72 -72
  269. package/src/entities/MessageHandler/MessageHandler.types.ts +15 -15
  270. package/src/entities/MessageHandler/index.ts +2 -2
  271. package/src/entities/PubSub/PubSub.test.ts +297 -297
  272. package/src/entities/PubSub/PubSub.ts +202 -202
  273. package/src/entities/PubSub/PubSub.types.ts +76 -76
  274. package/src/entities/PubSub/handleMessage/handleMessage.test.ts +102 -102
  275. package/src/entities/PubSub/handleMessage/handleMessage.ts +65 -65
  276. package/src/entities/PubSub/handleMessage/index.ts +1 -1
  277. package/src/entities/PubSub/index.ts +2 -2
  278. package/src/entities/PushNotification/PushNotification.test.ts +35 -35
  279. package/src/entities/PushNotification/PushNotification.ts +44 -44
  280. package/src/entities/PushNotification/PushNotification.types.ts +25 -25
  281. package/src/entities/PushNotification/index.ts +2 -2
  282. package/src/entities/Redis/Redis.ts +71 -71
  283. package/src/entities/Redis/Redis.types.ts +19 -19
  284. package/src/entities/Redis/Redis.validate.ts +17 -17
  285. package/src/entities/Redis/index.ts +2 -2
  286. package/src/entities/Sequelize/Sequelize.config.ts +59 -59
  287. package/src/entities/Sequelize/Sequelize.test.ts +21 -21
  288. package/src/entities/Sequelize/Sequelize.ts +75 -75
  289. package/src/entities/Sequelize/Sequelize.types.ts +10 -10
  290. package/src/entities/Sequelize/Sequelize.validate.ts +15 -15
  291. package/src/entities/Sequelize/index.ts +2 -2
  292. package/src/entities/Server/Server.const.ts +56 -56
  293. package/src/entities/Server/Server.test.ts +272 -272
  294. package/src/entities/Server/Server.ts +445 -445
  295. package/src/entities/Server/Server.types.ts +88 -88
  296. package/src/entities/Server/index.ts +2 -2
  297. package/src/entities/SocketClient/SocketClient.test.ts +392 -392
  298. package/src/entities/SocketClient/SocketClient.ts +401 -401
  299. package/src/entities/SocketClient/SocketClient.types.ts +62 -62
  300. package/src/entities/SocketClient/index.ts +2 -2
  301. package/src/entities/SocketClient/parseMessage/index.ts +1 -1
  302. package/src/entities/SocketClient/parseMessage/parseMessage.test.ts +20 -20
  303. package/src/entities/SocketClient/parseMessage/parseMessage.ts +26 -26
  304. package/src/entities/Storage/Storage.test.ts +58 -58
  305. package/src/entities/Storage/Storage.ts +219 -219
  306. package/src/entities/Storage/Storage.types.ts +57 -57
  307. package/src/entities/Storage/index.ts +2 -2
  308. package/src/entities/ValidationError/ValidationError.ts +34 -34
  309. package/src/entities/ValidationError/index.ts +1 -1
  310. package/src/entities/WebError/WebError.test.ts +18 -18
  311. package/src/entities/WebError/WebError.ts +23 -23
  312. package/src/entities/WebError/WebError.types.ts +9 -9
  313. package/src/entities/WebError/index.ts +2 -2
  314. package/src/entities/index.ts +16 -16
  315. package/src/index.ts +4 -4
  316. package/src/metrics/debug.ts +10 -10
  317. package/src/metrics/index.ts +2 -2
  318. package/src/metrics/request.ts +17 -17
  319. package/src/middleware/authAdmin/authAdmin.test.ts +199 -199
  320. package/src/middleware/authAdmin/authAdmin.ts +114 -114
  321. package/src/middleware/authAdmin/authAdmin.types.ts +19 -19
  322. package/src/middleware/authAdmin/index.ts +2 -2
  323. package/src/middleware/authHmac/authHmac.test.ts +86 -86
  324. package/src/middleware/authHmac/authHmac.ts +56 -56
  325. package/src/middleware/authHmac/authHmac.types.ts +7 -7
  326. package/src/middleware/authHmac/index.ts +2 -2
  327. package/src/middleware/authJwt/authJwt.test.ts +54 -54
  328. package/src/middleware/authJwt/authJwt.ts +55 -55
  329. package/src/middleware/authJwt/authJwt.types.ts +14 -14
  330. package/src/middleware/authJwt/index.ts +2 -2
  331. package/src/middleware/authStatic/authStatic.test.ts +36 -36
  332. package/src/middleware/authStatic/authStatic.ts +45 -45
  333. package/src/middleware/authStatic/index.ts +1 -1
  334. package/src/middleware/authTls/authTls.test.ts +138 -138
  335. package/src/middleware/authTls/authTls.ts +106 -106
  336. package/src/middleware/authTls/authTls.types.ts +13 -13
  337. package/src/middleware/authTls/index.ts +2 -2
  338. package/src/middleware/checkPermission/checkPermission.ts +32 -32
  339. package/src/middleware/error/error.test.ts +60 -60
  340. package/src/middleware/error/error.ts +25 -25
  341. package/src/middleware/error/index.ts +1 -1
  342. package/src/middleware/fileUploader/compressAvatar/compressAvatar.ts +25 -25
  343. package/src/middleware/fileUploader/compressAvatar/compressAvatar.types.ts +12 -12
  344. package/src/middleware/fileUploader/compressAvatar/index.ts +2 -2
  345. package/src/middleware/fileUploader/fileUploader.test.ts +310 -310
  346. package/src/middleware/fileUploader/fileUploader.ts +303 -303
  347. package/src/middleware/fileUploader/fileUploader.types.ts +52 -52
  348. package/src/middleware/fileUploader/index.ts +2 -2
  349. package/src/middleware/fileUploader/isMultiPart/index.ts +1 -1
  350. package/src/middleware/fileUploader/isMultiPart/isMultipart.ts +9 -9
  351. package/src/middleware/fileUploader/validate/index.ts +1 -1
  352. package/src/middleware/fileUploader/validate/validate.ts +27 -27
  353. package/src/middleware/fourOhFour/fourOhFour.test.ts +14 -14
  354. package/src/middleware/fourOhFour/fourOhFour.ts +13 -13
  355. package/src/middleware/fourOhFour/index.ts +1 -1
  356. package/src/middleware/geminiFileUploader/geminiFileUploader.ts +117 -117
  357. package/src/middleware/geminiFileUploader/index.ts +1 -1
  358. package/src/middleware/healthCheck/healthCheck.test.ts +12 -12
  359. package/src/middleware/healthCheck/healthCheck.ts +14 -14
  360. package/src/middleware/healthCheck/index.ts +1 -1
  361. package/src/middleware/index.ts +17 -17
  362. package/src/middleware/metrics/index.ts +1 -1
  363. package/src/middleware/metrics/metrics.test.ts +46 -46
  364. package/src/middleware/metrics/metrics.ts +24 -24
  365. package/src/middleware/requestMetrics/index.ts +1 -1
  366. package/src/middleware/requestMetrics/requestMetrics.test.ts +77 -77
  367. package/src/middleware/requestMetrics/requestMetrics.ts +20 -20
  368. package/src/middleware/swaggerDocs/index.ts +2 -2
  369. package/src/middleware/swaggerDocs/swaggerDocs.ts +114 -114
  370. package/src/middleware/swaggerDocs/swaggerDocs.types.ts +41 -41
  371. package/src/middleware/userResolver/index.ts +1 -1
  372. package/src/middleware/userResolver/userResolver.test.ts +35 -35
  373. package/src/middleware/userResolver/userResolver.ts +35 -35
  374. package/src/middleware/validate/index.ts +1 -1
  375. package/src/middleware/validate/validate.test.ts +43 -43
  376. package/src/middleware/validate/validate.ts +25 -25
  377. package/src/middleware/version/index.ts +1 -1
  378. package/src/middleware/version/version.test.ts +23 -23
  379. package/src/middleware/version/version.ts +12 -12
  380. package/src/utils/checkEnvironment/index.ts +49 -49
  381. package/src/utils/createHttpServer/createHttpServer.test.ts +24 -24
  382. package/src/utils/createHttpServer/createHttpServer.ts +34 -34
  383. package/src/utils/createHttpServer/createHttpServer.validate.ts +17 -17
  384. package/src/utils/createHttpServer/index.ts +1 -1
  385. package/src/utils/createSortedObject/createSortedObject.ts +20 -20
  386. package/src/utils/createSortedObject/createSortedObjet.test.ts +47 -47
  387. package/src/utils/createSortedObject/index.ts +1 -1
  388. package/src/utils/dbMigration/dbMigration.test.ts +209 -209
  389. package/src/utils/dbMigration/dbMigration.ts +199 -199
  390. package/src/utils/dbMigration/dbMigration.types.ts +11 -11
  391. package/src/utils/dbMigration/index.ts +2 -2
  392. package/src/utils/dbMigration/migrateMetadataTable/index.ts +1 -1
  393. package/src/utils/dbMigration/migrateMetadataTable/migrateMetadataTable.test.ts +59 -59
  394. package/src/utils/dbMigration/migrateMetadataTable/migrateMetadataTable.ts +102 -102
  395. package/src/utils/envAssert/envAssert.ts +31 -31
  396. package/src/utils/envAssert/index.ts +1 -1
  397. package/src/utils/envAssert/validators/hostList.ts +17 -17
  398. package/src/utils/envAssert/validators/index.ts +5 -5
  399. package/src/utils/envAssert/validators/ipList.ts +13 -13
  400. package/src/utils/envAssert/validators/path.ts +13 -13
  401. package/src/utils/envAssert/validators/string.ts +9 -9
  402. package/src/utils/envAssert/validators/stringList.ts +13 -13
  403. package/src/utils/filter/filter.ts +17 -17
  404. package/src/utils/filter/index.ts +1 -1
  405. package/src/utils/getDynamicLink/getDynamicLink.test.ts +51 -51
  406. package/src/utils/getDynamicLink/getDynamicLink.ts +28 -28
  407. package/src/utils/getDynamicLink/getDynamicLink.types.ts +11 -11
  408. package/src/utils/getDynamicLink/getDynamicLink.validate.ts +6 -6
  409. package/src/utils/getDynamicLink/index.ts +2 -2
  410. package/src/utils/hmac/checkEnv/checkEnv.test.ts +18 -18
  411. package/src/utils/hmac/checkEnv/checkEnv.ts +9 -9
  412. package/src/utils/hmac/checkEnv/index.ts +1 -1
  413. package/src/utils/hmac/createHmac/createHmac.ts +33 -33
  414. package/src/utils/hmac/createHmac/index.ts +1 -1
  415. package/src/utils/hmac/index.ts +4 -4
  416. package/src/utils/hmac/index.types.ts +13 -13
  417. package/src/utils/hmac/signPayload/index.ts +1 -1
  418. package/src/utils/hmac/signPayload/signPayload.ts +16 -16
  419. package/src/utils/hmac/verifySignature/index.ts +1 -1
  420. package/src/utils/hmac/verifySignature/verifySignature.ts +24 -24
  421. package/src/utils/index.ts +26 -26
  422. package/src/utils/jwt/index.ts +2 -2
  423. package/src/utils/jwt/jwt.test.ts +41 -41
  424. package/src/utils/jwt/jwt.ts +204 -204
  425. package/src/utils/jwt/jwt.types.ts +21 -21
  426. package/src/utils/report/index.ts +3 -3
  427. package/src/utils/report/output.ts +45 -45
  428. package/src/utils/report/output.types.ts +70 -70
  429. package/src/utils/report/report.test.ts +133 -133
  430. package/src/utils/report/report.ts +134 -134
  431. package/src/utils/report/report.types.ts +13 -13
  432. package/src/utils/request/index.ts +1 -1
  433. package/src/utils/request/request.test.ts +26 -26
  434. package/src/utils/request/request.ts +48 -48
  435. package/src/utils/semverCompare/index.ts +1 -1
  436. package/src/utils/semverCompare/semverCompare.test.ts +49 -49
  437. package/src/utils/semverCompare/semverCompare.ts +60 -60
  438. package/src/utils/sendEmail/index.ts +1 -1
  439. package/src/utils/sendEmail/sendEmail.ts +27 -27
  440. package/src/utils/sendEmail/sendEmail.types.ts +7 -7
  441. package/src/utils/sendPush/index.ts +2 -2
  442. package/src/utils/sendPush/sendPush.ts +20 -20
  443. package/src/utils/sendPush/sendPush.types.ts +25 -25
  444. package/src/utils/tlsConfig/index.ts +2 -2
  445. package/src/utils/tlsConfig/tlsConfig.test.ts +32 -32
  446. package/src/utils/tlsConfig/tlsConfig.ts +47 -47
  447. package/src/utils/tlsConfig/tlsConfig.types.ts +11 -11
  448. package/src/utils/tlsConfig/tlsConfig.validate.ts +25 -25
  449. package/src/utils/tlsRequest/index.ts +1 -1
  450. package/src/utils/tlsRequest/tlsRequest.test.ts +63 -63
  451. package/src/utils/tlsRequest/tlsRequest.ts +12 -12
  452. package/src/utils/trimPathSlash/index.ts +1 -1
  453. package/src/utils/trimPathSlash/trimPathSlash.test.ts +26 -26
  454. package/src/utils/trimPathSlash/trimPathSlash.ts +8 -8
  455. package/test/env.ts +56 -56
  456. package/test/factory/index.ts +8 -8
  457. package/test/factory/sequelizeMeta.ts +12 -12
  458. package/test/hooks.ts +37 -37
  459. package/test/index.ts +3 -3
  460. package/test/stub/index.ts +3 -3
  461. package/test/stub/stubLocales.ts +68 -68
  462. package/test/stub/stubPubSub.ts +7 -7
  463. package/test/stub/stubStorage.ts +77 -77
  464. package/test/stub/stubStorage.types.ts +11 -11
  465. package/test/utils/app.ts +31 -31
  466. package/test/utils/index.ts +1 -1
  467. package/tsconfig.build.json +5 -5
  468. package/tsconfig.json +32 -32
@@ -1 +1 @@
1
- {"version":3,"file":"fileUploader.js","names":["_busboy","_interopRequireDefault","require","_compressAvatar","_isMultiPart","_validate","_Storage","_WebError","_report","namespace","fileUploader","options","validator","request","response","next","fileUploaderMiddleware","filesOptions","reportDebug","message","data","isMultipart","WebError","statusCode","errorCode","contentType","get","length","busboy","Busboy","headers","hasError","triggerError","error","pendingWrites","unpipe","on","read","bind","removeAllListeners","files","Object","values","forEach","file","Storage","delete","bucket","name","catch","reportError","readFinished","fieldsValidated","done","uploadedFiles","keys","some","required","includes","key","connection","writableEnded","Error","validateFields","validate","field","fileName","encoding","mimeType","destroy","find","fileOption","hint","mimeTypes","expected","fileToUpload","image","compressAvatar","uploadedFile","upload","directory","path","mime","noExtension","metadata","maxSize","push","originalFileName","fieldName","value","body","pipe"],"sources":["../../../src/middleware/fileUploader/fileUploader.ts"],"sourcesContent":["import Busboy from 'busboy';\r\nimport { Request, Response, NextFunction } from 'express';\r\nimport { Schema } from 'express-validator';\r\nimport { compressAvatar } from './compressAvatar';\r\nimport { FileUploaderConfig } from './fileUploader.types';\r\nimport { isMultipart } from './isMultiPart';\r\nimport { validate } from './validate';\r\nimport { Storage } from 'entities/Storage';\r\nimport { WebError } from 'entities/WebError';\r\nimport { reportError, reportDebug } from 'utils/report';\r\nimport { Readable } from 'stream';\r\n\r\nconst namespace = 'engine:middleware:fileUploader';\r\n\r\n/**\r\n * Generate a custom fileUploader middleware\r\n */\r\nexport function fileUploader(\r\n options: Array<FileUploaderConfig>,\r\n validator: Schema\r\n) {\r\n return (\r\n request: Request,\r\n response: Response,\r\n next: NextFunction\r\n ): Busboy.Busboy =>\r\n fileUploaderMiddleware(request, response, next, options, validator);\r\n}\r\n\r\n/** Handle file upload and generic multi-part parsing */\r\nexport function fileUploaderMiddleware(\r\n request: Request,\r\n response: Response,\r\n next: NextFunction,\r\n filesOptions: Array<FileUploaderConfig>,\r\n validator: Schema\r\n): Busboy.Busboy {\r\n reportDebug({\r\n namespace,\r\n message: 'Received request to upload file',\r\n data: { filesOptions, validator }\r\n });\r\n // Check that the request is a proper multipart request\r\n if (!isMultipart(request))\r\n throw new WebError({\r\n statusCode: 415,\r\n errorCode: 'invalid-content-type',\r\n message: 'Request is not of type multipart/form-data',\r\n data: { contentType: request.get('Content-Type') }\r\n });\r\n // If no files to handle ignore\r\n if (!filesOptions.length) next();\r\n // Parse multipart data with Busboy\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const busboy = new (Busboy as any)({\r\n headers: {\r\n ...request.headers,\r\n 'content-type': request.headers['content-type'] ?? ''\r\n }\r\n });\r\n\r\n let hasError = false;\r\n\r\n /**\r\n * Function called when an error happened in the process\r\n * It immediately stops and drains all connection and deletes all files that have already been uploaded\r\n */\r\n function triggerError(error: unknown): void {\r\n pendingWrites--;\r\n if (hasError) return;\r\n hasError = true;\r\n request.unpipe(busboy);\r\n request.on('readable', request.read.bind(request));\r\n busboy.removeAllListeners();\r\n next(error);\r\n if (request.files) {\r\n Object.values(request.files).forEach((files) => {\r\n files.forEach((file) => {\r\n Storage.delete(file.bucket, file.name).catch((error) => {\r\n reportError(error);\r\n });\r\n });\r\n });\r\n }\r\n }\r\n\r\n let readFinished = false;\r\n let fieldsValidated = false;\r\n let pendingWrites = 0;\r\n\r\n /** Function called when all the body has been parsed */\r\n function done(): void {\r\n if (readFinished && pendingWrites === 0 && fieldsValidated && !hasError) {\r\n const uploadedFiles = Object.keys(request.files ?? {});\r\n if (\r\n filesOptions.some(\r\n (options) => options.required && !uploadedFiles.includes(options.key)\r\n )\r\n ) {\r\n triggerError(\r\n new WebError({\r\n statusCode: 400,\r\n errorCode: 'missing-field',\r\n message: 'Some required files have not been uploaded',\r\n data: { filesOptions, validator, uploadedFiles }\r\n })\r\n );\r\n return;\r\n }\r\n next();\r\n }\r\n }\r\n\r\n /*\r\n * On cancel request, while processing\r\n */\r\n request.connection.on('close', function () {\r\n if (!response.writableEnded) triggerError(new Error('Request cancelled'));\r\n });\r\n\r\n /**\r\n * Once all the fields have been read they are checked against the validation schema\r\n */\r\n async function validateFields(): Promise<void> {\r\n try {\r\n await validate(request, validator);\r\n } catch (error) {\r\n triggerError(error);\r\n }\r\n reportDebug({\r\n namespace,\r\n message: 'Validation processed',\r\n data: { hasError, filesOptions, validator }\r\n });\r\n fieldsValidated = true;\r\n done();\r\n }\r\n\r\n busboy.on(\r\n 'file',\r\n (\r\n field: string,\r\n file: Readable,\r\n fileName: string,\r\n encoding: unknown,\r\n mimeType: string\r\n ) => {\r\n (async (): Promise<void> => {\r\n reportDebug({\r\n namespace,\r\n message: 'Found file in request',\r\n data: { hasError, field, fileName, encoding, mimeType, pendingWrites }\r\n });\r\n // Do not handle the stream if there has been an error previously\r\n if (hasError) file.destroy();\r\n pendingWrites++;\r\n // Find related file options based on the field name\r\n const options = filesOptions.find(\r\n (fileOption) => fileOption.key === field\r\n );\r\n // Make sure that the field is in the config\r\n if (!options) {\r\n triggerError(\r\n new WebError({\r\n statusCode: 400,\r\n errorCode: 'invalid-file-field',\r\n message: 'Request contains a file at an invalid field',\r\n hint: { field },\r\n data: { field }\r\n })\r\n );\r\n return;\r\n }\r\n reportDebug({\r\n namespace,\r\n message: 'Found options for file',\r\n data: {\r\n hasError,\r\n field,\r\n fileName,\r\n encoding,\r\n mimeType,\r\n pendingWrites,\r\n options\r\n }\r\n });\r\n // If a specific MIME type is required check it\r\n if (options.mimeTypes && !options.mimeTypes.includes(mimeType)) {\r\n triggerError(\r\n new WebError({\r\n statusCode: 415,\r\n errorCode: 'invalid-mime-type',\r\n message: 'Request contains a file with an invalid MIME type',\r\n hint: { field },\r\n data: { field, mimeType, expected: options.mimeTypes }\r\n })\r\n );\r\n return;\r\n }\r\n // Generate the destination path of the file and upload\r\n reportDebug({\r\n namespace,\r\n message: 'Starting file upload',\r\n data: {\r\n hasError,\r\n field,\r\n fileName,\r\n encoding,\r\n mimeType,\r\n pendingWrites,\r\n options\r\n }\r\n });\r\n try {\r\n const fileToUpload = options.image\r\n ? compressAvatar(file, options.image)\r\n : file;\r\n\r\n const uploadedFile = await Storage.upload(\r\n fileToUpload,\r\n options.bucket,\r\n {\r\n directory: options.path,\r\n mime: mimeType,\r\n noExtension: options.noExtension\r\n },\r\n {\r\n metadata: { contentType: mimeType }\r\n },\r\n { maxSize: options.maxSize }\r\n );\r\n\r\n reportDebug({\r\n namespace,\r\n message: 'File uploaded',\r\n data: {\r\n hasError,\r\n field,\r\n fileName,\r\n encoding,\r\n mimeType,\r\n pendingWrites,\r\n options,\r\n uploadedFile\r\n }\r\n });\r\n if (hasError) {\r\n // If some other failed before this one terminated\r\n // Delete file\r\n await Storage.delete(uploadedFile.bucket, uploadedFile.name);\r\n } else {\r\n // Handle successful upload\r\n // Add the file's data to the request\r\n pendingWrites--;\r\n if (!request.files) request.files = {};\r\n if (!request.files[field]) request.files[field] = [];\r\n request.files[field].push({\r\n ...uploadedFile,\r\n originalFileName: fileName\r\n });\r\n done();\r\n }\r\n } catch (error) {\r\n triggerError(error);\r\n }\r\n })().catch((error) => {\r\n triggerError(error);\r\n });\r\n }\r\n );\r\n\r\n /**\r\n * Handle non file fields\r\n * These fields will be pushed to the body as array of strings\r\n */\r\n busboy.on('field', (fieldName: string, value: unknown) => {\r\n if (!request.body) request.body = {};\r\n\r\n if (request.body[fieldName]) {\r\n request.body[fieldName].push(value);\r\n } else {\r\n request.body[fieldName] = [value];\r\n }\r\n });\r\n busboy.on('error', function (error: unknown) {\r\n triggerError(error);\r\n });\r\n busboy.on('finish', () => {\r\n (async (): Promise<void> => {\r\n reportDebug({\r\n namespace,\r\n message: 'Busboy finished reading',\r\n data: { hasError, filesOptions, validator, pendingWrites }\r\n });\r\n readFinished = true;\r\n await validateFields();\r\n done();\r\n })().catch((error) => {\r\n triggerError(error);\r\n });\r\n });\r\n return request.pipe(busboy);\r\n}\r\n"],"mappings":";;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAGA,MAAMO,SAAS,GAAG,gCAAgC;;AAElD;AACA;AACA;AACO,SAASC,YAAYA,CAC1BC,OAAkC,EAClCC,SAAiB,EACjB;EACA,OAAO,CACLC,OAAgB,EAChBC,QAAkB,EAClBC,IAAkB,KAElBC,sBAAsB,CAACH,OAAO,EAAEC,QAAQ,EAAEC,IAAI,EAAEJ,OAAO,EAAEC,SAAS,CAAC;AACvE;;AAEA;AACO,SAASI,sBAAsBA,CACpCH,OAAgB,EAChBC,QAAkB,EAClBC,IAAkB,EAClBE,YAAuC,EACvCL,SAAiB,EACF;EACf,IAAAM,mBAAW,EAAC;IACVT,SAAS;IACTU,OAAO,E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AAUH,KAAc,EAAE;IAC3CD,YAAY,CAACC,KAAK,CAAC;EACrB,CAAC,CAAC;EACFL,MAAM,CAACQ,EAAE,CAAC,QAAQ,EAAE,MAAM;IACxB,CAAC,YAA2B;MAC1B,IAAAlB,mBAAW,EAAC;QACVT,SAAS;QACTU,OAAO,EAAE,yBAAyB;QAClCC,IAAI,EAAE;UAAEW,QAAQ;UAAEd,YAAY;UAAEL,SAAS;UAAEsB;QAAc;MAC3D,CAAC,CAAC;MACFiB,YAAY,GAAG,IAAI;MACnB,MAAMY,cAAc,CAAC,CAAC;MACtBV,IAAI,CAAC,CAAC;IACR,CAAC,EAAE,CAAC,CAACJ,KAAK,CAAEhB,KAAK,IAAK;MACpBD,YAAY,CAACC,KAAK,CAAC;IACrB,CAAC,CAAC;EACJ,CAAC,CAAC;EACF,OAAOpB,OAAO,CAAC8E,IAAI,CAAC/D,MAAM,CAAC;AAC7B","ignoreList":[]}
1
+ {"version":3,"file":"fileUploader.js","names":["_busboy","_interopRequireDefault","require","_compressAvatar","_isMultiPart","_validate","_Storage","_WebError","_report","namespace","fileUploader","options","validator","request","response","next","fileUploaderMiddleware","filesOptions","reportDebug","message","data","isMultipart","WebError","statusCode","errorCode","contentType","get","length","busboy","Busboy","headers","hasError","triggerError","error","pendingWrites","unpipe","on","read","bind","removeAllListeners","files","Object","values","forEach","file","Storage","delete","bucket","name","catch","reportError","readFinished","fieldsValidated","done","uploadedFiles","keys","some","required","includes","key","connection","writableEnded","Error","validateFields","validate","field","fileName","encoding","mimeType","destroy","find","fileOption","hint","mimeTypes","expected","fileToUpload","image","compressAvatar","uploadedFile","upload","directory","path","mime","noExtension","metadata","maxSize","push","originalFileName","fieldName","value","body","pipe"],"sources":["../../../src/middleware/fileUploader/fileUploader.ts"],"sourcesContent":["import Busboy from 'busboy';\nimport { Request, Response, NextFunction } from 'express';\nimport { Schema } from 'express-validator';\nimport { compressAvatar } from './compressAvatar';\nimport { FileUploaderConfig } from './fileUploader.types';\nimport { isMultipart } from './isMultiPart';\nimport { validate } from './validate';\nimport { Storage } from 'entities/Storage';\nimport { WebError } from 'entities/WebError';\nimport { reportError, reportDebug } from 'utils/report';\nimport { Readable } from 'stream';\n\nconst namespace = 'engine:middleware:fileUploader';\n\n/**\n * Generate a custom fileUploader middleware\n */\nexport function fileUploader(\n options: Array<FileUploaderConfig>,\n validator: Schema\n) {\n return (\n request: Request,\n response: Response,\n next: NextFunction\n ): Busboy.Busboy =>\n fileUploaderMiddleware(request, response, next, options, validator);\n}\n\n/** Handle file upload and generic multi-part parsing */\nexport function fileUploaderMiddleware(\n request: Request,\n response: Response,\n next: NextFunction,\n filesOptions: Array<FileUploaderConfig>,\n validator: Schema\n): Busboy.Busboy {\n reportDebug({\n namespace,\n message: 'Received request to upload file',\n data: { filesOptions, validator }\n });\n // Check that the request is a proper multipart request\n if (!isMultipart(request))\n throw new WebError({\n statusCode: 415,\n errorCode: 'invalid-content-type',\n message: 'Request is not of type multipart/form-data',\n data: { contentType: request.get('Content-Type') }\n });\n // If no files to handle ignore\n if (!filesOptions.length) next();\n // Parse multipart data with Busboy\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const busboy = new (Busboy as any)({\n headers: {\n ...request.headers,\n 'content-type': request.headers['content-type'] ?? ''\n }\n });\n\n let hasError = false;\n\n /**\n * Function called when an error happened in the process\n * It immediately stops and drains all connection and deletes all files that have already been uploaded\n */\n function triggerError(error: unknown): void {\n pendingWrites--;\n if (hasError) return;\n hasError = true;\n request.unpipe(busboy);\n request.on('readable', request.read.bind(request));\n busboy.removeAllListeners();\n next(error);\n if (request.files) {\n Object.values(request.files).forEach((files) => {\n files.forEach((file) => {\n Storage.delete(file.bucket, file.name).catch((error) => {\n reportError(error);\n });\n });\n });\n }\n }\n\n let readFinished = false;\n let fieldsValidated = false;\n let pendingWrites = 0;\n\n /** Function called when all the body has been parsed */\n function done(): void {\n if (readFinished && pendingWrites === 0 && fieldsValidated && !hasError) {\n const uploadedFiles = Object.keys(request.files ?? {});\n if (\n filesOptions.some(\n (options) => options.required && !uploadedFiles.includes(options.key)\n )\n ) {\n triggerError(\n new WebError({\n statusCode: 400,\n errorCode: 'missing-field',\n message: 'Some required files have not been uploaded',\n data: { filesOptions, validator, uploadedFiles }\n })\n );\n return;\n }\n next();\n }\n }\n\n /*\n * On cancel request, while processing\n */\n request.connection.on('close', function () {\n if (!response.writableEnded) triggerError(new Error('Request cancelled'));\n });\n\n /**\n * Once all the fields have been read they are checked against the validation schema\n */\n async function validateFields(): Promise<void> {\n try {\n await validate(request, validator);\n } catch (error) {\n triggerError(error);\n }\n reportDebug({\n namespace,\n message: 'Validation processed',\n data: { hasError, filesOptions, validator }\n });\n fieldsValidated = true;\n done();\n }\n\n busboy.on(\n 'file',\n (\n field: string,\n file: Readable,\n fileName: string,\n encoding: unknown,\n mimeType: string\n ) => {\n (async (): Promise<void> => {\n reportDebug({\n namespace,\n message: 'Found file in request',\n data: { hasError, field, fileName, encoding, mimeType, pendingWrites }\n });\n // Do not handle the stream if there has been an error previously\n if (hasError) file.destroy();\n pendingWrites++;\n // Find related file options based on the field name\n const options = filesOptions.find(\n (fileOption) => fileOption.key === field\n );\n // Make sure that the field is in the config\n if (!options) {\n triggerError(\n new WebError({\n statusCode: 400,\n errorCode: 'invalid-file-field',\n message: 'Request contains a file at an invalid field',\n hint: { field },\n data: { field }\n })\n );\n return;\n }\n reportDebug({\n namespace,\n message: 'Found options for file',\n data: {\n hasError,\n field,\n fileName,\n encoding,\n mimeType,\n pendingWrites,\n options\n }\n });\n // If a specific MIME type is required check it\n if (options.mimeTypes && !options.mimeTypes.includes(mimeType)) {\n triggerError(\n new WebError({\n statusCode: 415,\n errorCode: 'invalid-mime-type',\n message: 'Request contains a file with an invalid MIME type',\n hint: { field },\n data: { field, mimeType, expected: options.mimeTypes }\n })\n );\n return;\n }\n // Generate the destination path of the file and upload\n reportDebug({\n namespace,\n message: 'Starting file upload',\n data: {\n hasError,\n field,\n fileName,\n encoding,\n mimeType,\n pendingWrites,\n options\n }\n });\n try {\n const fileToUpload = options.image\n ? compressAvatar(file, options.image)\n : file;\n\n const uploadedFile = await Storage.upload(\n fileToUpload,\n options.bucket,\n {\n directory: options.path,\n mime: mimeType,\n noExtension: options.noExtension\n },\n {\n metadata: { contentType: mimeType }\n },\n { maxSize: options.maxSize }\n );\n\n reportDebug({\n namespace,\n message: 'File uploaded',\n data: {\n hasError,\n field,\n fileName,\n encoding,\n mimeType,\n pendingWrites,\n options,\n uploadedFile\n }\n });\n if (hasError) {\n // If some other failed before this one terminated\n // Delete file\n await Storage.delete(uploadedFile.bucket, uploadedFile.name);\n } else {\n // Handle successful upload\n // Add the file's data to the request\n pendingWrites--;\n if (!request.files) request.files = {};\n if (!request.files[field]) request.files[field] = [];\n request.files[field].push({\n ...uploadedFile,\n originalFileName: fileName\n });\n done();\n }\n } catch (error) {\n triggerError(error);\n }\n })().catch((error) => {\n triggerError(error);\n });\n }\n );\n\n /**\n * Handle non file fields\n * These fields will be pushed to the body as array of strings\n */\n busboy.on('field', (fieldName: string, value: unknown) => {\n if (!request.body) request.body = {};\n\n if (request.body[fieldName]) {\n request.body[fieldName].push(value);\n } else {\n request.body[fieldName] = [value];\n }\n });\n busboy.on('error', function (error: unknown) {\n triggerError(error);\n });\n busboy.on('finish', () => {\n (async (): Promise<void> => {\n reportDebug({\n namespace,\n message: 'Busboy finished reading',\n data: { hasError, filesOptions, validator, pendingWrites }\n });\n readFinished = true;\n await validateFields();\n done();\n })().catch((error) => {\n triggerError(error);\n });\n });\n return request.pipe(busboy);\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAGA,MAAMO,S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AAc,KAAK;IACxD,IAAI,CAAC5E,OAAO,CAAC6E,IAAI,EAAE7E,OAAO,CAAC6E,IAAI,GAAG,CAAC,CAAC;IAEpC,IAAI7E,OAAO,CAAC6E,IAAI,CAACF,SAAS,CAAC,EAAE;MAC3B3E,OAAO,CAAC6E,IAAI,CAACF,SAAS,CAAC,CAACF,IAAI,CAACG,KAAK,CAAC;IACrC,CAAC,MAAM;MACL5E,OAAO,CAAC6E,IAAI,CAACF,SAAS,CAAC,GAAG,CAACC,KAAK,CAAC;IACnC;EACF,CAAC,CAAC;EACF7D,MAAM,CAACQ,EAAE,CAAC,OAAO,EAAE,UAAUH,KAAc,EAAE;IAC3CD,YAAY,CAACC,KAAK,CAAC;EACrB,CAAC,CAAC;EACFL,MAAM,CAACQ,EAAE,CAAC,QAAQ,EAAE,MAAM;IACxB,CAAC,YAA2B;MAC1B,IAAAlB,mBAAW,EAAC;QACVT,SAAS;QACTU,OAAO,EAAE,yBAAyB;QAClCC,IAAI,EAAE;UAAEW,QAAQ;UAAEd,YAAY;UAAEL,SAAS;UAAEsB;QAAc;MAC3D,CAAC,CAAC;MACFiB,YAAY,GAAG,IAAI;MACnB,MAAMY,cAAc,CAAC,CAAC;MACtBV,IAAI,CAAC,CAAC;IACR,CAAC,EAAE,CAAC,CAACJ,KAAK,CAAEhB,KAAK,IAAK;MACpBD,YAAY,CAACC,KAAK,CAAC;IACrB,CAAC,CAAC;EACJ,CAAC,CAAC;EACF,OAAOpB,OAAO,CAAC8E,IAAI,CAAC/D,MAAM,CAAC;AAC7B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"fileUploader.types.js","names":[],"sources":["../../../src/middleware/fileUploader/fileUploader.types.ts"],"sourcesContent":["import { CompressionOptions } from './compressAvatar';\r\nimport { StorageUploadedFile } from 'entities/Storage';\r\n\r\n// Override the Express request object to add the files\r\ndeclare global {\r\n // eslint-disable-next-line @typescript-eslint/no-namespace\r\n namespace Express {\r\n /** Express request object */\r\n interface Request {\r\n /** Configuration for files that are uploaded with the request */\r\n files?: { [key: string]: Array<UploadedFile> };\r\n }\r\n }\r\n}\r\n\r\n/** Custom uploaded file metadata */\r\nexport interface UploadedFile extends StorageUploadedFile {\r\n /** File name that was given to the file by the client */\r\n originalFileName: string;\r\n}\r\n\r\n/** Outputs setting for the file upload. Defines where a file should be stored and how it should be processed. */\r\ninterface FileUploaderOutputs {\r\n /** Name of the output */\r\n name: string;\r\n /** Path to which this specific output is stored (defaults to default path if not set) */\r\n path?: string;\r\n /** Bucket to which this specific output is stored (defaults to default bucket if not set) */\r\n bucket?: string;\r\n}\r\n\r\n/** Configuration for a file upload */\r\nexport interface FileUploaderConfig {\r\n /** Field key for which this configuration applies */\r\n key: string;\r\n /** A list of supported MIME Types for the file */\r\n mimeTypes?: Array<string>;\r\n /** Base path where the file should be stored (default used when no output config is set, will be used as temporary storage when outputs are set) */\r\n path?: string;\r\n /** Bucket in which the file should be stored (will be used as temporary storage when outputs are set) */\r\n bucket: string;\r\n /** Maximum size of the file (ex: 2MB) */\r\n maxSize?: string;\r\n /** Indicates that the file must be present */\r\n required?: boolean;\r\n /** Do not store with an extension (will simply be a uuid) */\r\n noExtension?: boolean;\r\n /** Specify multiple outputs with processing */\r\n outputs?: Array<FileUploaderOutputs>;\r\n /** @deprecated compression of images */\r\n image?: CompressionOptions;\r\n}\r\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"fileUploader.types.js","names":[],"sources":["../../../src/middleware/fileUploader/fileUploader.types.ts"],"sourcesContent":["import { CompressionOptions } from './compressAvatar';\nimport { StorageUploadedFile } from 'entities/Storage';\n\n// Override the Express request object to add the files\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace Express {\n /** Express request object */\n interface Request {\n /** Configuration for files that are uploaded with the request */\n files?: { [key: string]: Array<UploadedFile> };\n }\n }\n}\n\n/** Custom uploaded file metadata */\nexport interface UploadedFile extends StorageUploadedFile {\n /** File name that was given to the file by the client */\n originalFileName: string;\n}\n\n/** Outputs setting for the file upload. Defines where a file should be stored and how it should be processed. */\ninterface FileUploaderOutputs {\n /** Name of the output */\n name: string;\n /** Path to which this specific output is stored (defaults to default path if not set) */\n path?: string;\n /** Bucket to which this specific output is stored (defaults to default bucket if not set) */\n bucket?: string;\n}\n\n/** Configuration for a file upload */\nexport interface FileUploaderConfig {\n /** Field key for which this configuration applies */\n key: string;\n /** A list of supported MIME Types for the file */\n mimeTypes?: Array<string>;\n /** Base path where the file should be stored (default used when no output config is set, will be used as temporary storage when outputs are set) */\n path?: string;\n /** Bucket in which the file should be stored (will be used as temporary storage when outputs are set) */\n bucket: string;\n /** Maximum size of the file (ex: 2MB) */\n maxSize?: string;\n /** Indicates that the file must be present */\n required?: boolean;\n /** Do not store with an extension (will simply be a uuid) */\n noExtension?: boolean;\n /** Specify multiple outputs with processing */\n outputs?: Array<FileUploaderOutputs>;\n /** @deprecated compression of images */\n image?: CompressionOptions;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_fileUploader","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_fileUploader2"],"sources":["../../../src/middleware/fileUploader/index.ts"],"sourcesContent":["export * from './fileUploader';\r\nexport * from './fileUploader.types';\r\n"],"mappings":";;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,aAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,aAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,aAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,cAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,cAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,cAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,cAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_fileUploader","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_fileUploader2"],"sources":["../../../src/middleware/fileUploader/index.ts"],"sourcesContent":["export * from './fileUploader';\nexport * from './fileUploader.types';\n"],"mappings":";;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,aAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,aAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,aAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,cAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,cAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,cAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,cAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_isMultipart","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../src/middleware/fileUploader/isMultiPart/index.ts"],"sourcesContent":["export * from './isMultipart';\r\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_isMultipart","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../src/middleware/fileUploader/isMultiPart/index.ts"],"sourcesContent":["export * from './isMultipart';\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"isMultipart.js","names":["multipartRegex","isMultipart","request","type","get","test","toLowerCase"],"sources":["../../../../src/middleware/fileUploader/isMultiPart/isMultipart.ts"],"sourcesContent":["import { Request } from 'express';\r\n\r\nconst multipartRegex = /^multipart\\/form-data.+$/;\r\n\r\n/** Determines if the content type of a request is multipart/form-data */\r\nexport function isMultipart(request: Request): boolean {\r\n const type = request.get('Content-Type');\r\n return !!type && multipartRegex.test(type.toLowerCase());\r\n}\r\n"],"mappings":";;;;;;AAEA,MAAMA,cAAc,GAAG,0BAA0B;;AAEjD;AACO,SAASC,WAAWA,CAACC,OAAgB,EAAW;EACrD,MAAMC,IAAI,GAAGD,OAAO,CAACE,GAAG,CAAC,cAAc,CAAC;EACxC,OAAO,CAAC,CAACD,IAAI,IAAIH,cAAc,CAACK,IAAI,CAACF,IAAI,CAACG,WAAW,CAAC,CAAC,CAAC;AAC1D","ignoreList":[]}
1
+ {"version":3,"file":"isMultipart.js","names":["multipartRegex","isMultipart","request","type","get","test","toLowerCase"],"sources":["../../../../src/middleware/fileUploader/isMultiPart/isMultipart.ts"],"sourcesContent":["import { Request } from 'express';\n\nconst multipartRegex = /^multipart\\/form-data.+$/;\n\n/** Determines if the content type of a request is multipart/form-data */\nexport function isMultipart(request: Request): boolean {\n const type = request.get('Content-Type');\n return !!type && multipartRegex.test(type.toLowerCase());\n}\n"],"mappings":";;;;;;AAEA,MAAMA,cAAc,GAAG,0BAA0B;;AAEjD;AACO,SAASC,WAAWA,CAACC,OAAgB,EAAW;EACrD,MAAMC,IAAI,GAAGD,OAAO,CAACE,GAAG,CAAC,cAAc,CAAC;EACxC,OAAO,CAAC,CAACD,IAAI,IAAIH,cAAc,CAACK,IAAI,CAACF,IAAI,CAACG,WAAW,CAAC,CAAC,CAAC;AAC1D","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_validate","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../src/middleware/fileUploader/validate/index.ts"],"sourcesContent":["export * from './validate';\r\n"],"mappings":";;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,SAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_validate","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../src/middleware/fileUploader/validate/index.ts"],"sourcesContent":["export * from './validate';\n"],"mappings":";;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,SAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","names":["_validate","require","validate","request","schema","Promise","resolve","reject","validationChain","validateMiddleware","flat","length","position","next","error","undefined"],"sources":["../../../../src/middleware/fileUploader/validate/validate.ts"],"sourcesContent":["import { Request } from 'express';\r\nimport { Schema } from 'express-validator';\r\nimport { validate as validateMiddleware } from 'middleware/validate';\r\n\r\n/** Validate a schema against a request using our validation middleware */\r\nexport async function validate(\r\n request: Request,\r\n schema: Schema\r\n): Promise<void> {\r\n return new Promise((resolve, reject) => {\r\n // Generate a validation chain using our middleware\r\n const validationChain = validateMiddleware(schema).flat();\r\n if (!validationChain.length) resolve();\r\n // Recursively go through each middleware by imitating the next function from express\r\n let position = -1;\r\n const next = (error?: unknown): void => {\r\n if (error) reject(error);\r\n position++;\r\n if (position === validationChain.length) {\r\n resolve();\r\n return;\r\n }\r\n validationChain[position](request, undefined, next);\r\n };\r\n next();\r\n });\r\n}\r\n"],"mappings":";;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAEA;AACO,eAAeC,QAAQA,CAC5BC,OAAgB,EAChBC,MAAc,EACC;EACf,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtC;IACA,MAAMC,eAAe,GAAG,IAAAC,kBAAkB,EAACL,MAAM,CAAC,CAACM,IAAI,CAAC,CAAC;IACzD,IAAI,CAACF,eAAe,CAACG,MAAM,EAAEL,OAAO,CAAC,CAAC;IACtC;IACA,IAAIM,QAAQ,GAAG,CAAC,CAAC;IACjB,MAAMC,IAAI,GAAIC,KAAe,IAAW;MACtC,IAAIA,KAAK,EAAEP,MAAM,CAACO,KAAK,CAAC;MACxBF,QAAQ,EAAE;MACV,IAAIA,QAAQ,KAAKJ,eAAe,CAACG,MAAM,EAAE;QACvCL,OAAO,CAAC,CAAC;QACT;MACF;MACAE,eAAe,CAACI,QAAQ,CAAC,CAACT,OAAO,EAAEY,SAAS,EAAEF,IAAI,CAAC;IACrD,CAAC;IACDA,IAAI,CAAC,CAAC;EACR,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"validate.js","names":["_validate","require","validate","request","schema","Promise","resolve","reject","validationChain","validateMiddleware","flat","length","position","next","error","undefined"],"sources":["../../../../src/middleware/fileUploader/validate/validate.ts"],"sourcesContent":["import { Request } from 'express';\nimport { Schema } from 'express-validator';\nimport { validate as validateMiddleware } from 'middleware/validate';\n\n/** Validate a schema against a request using our validation middleware */\nexport async function validate(\n request: Request,\n schema: Schema\n): Promise<void> {\n return new Promise((resolve, reject) => {\n // Generate a validation chain using our middleware\n const validationChain = validateMiddleware(schema).flat();\n if (!validationChain.length) resolve();\n // Recursively go through each middleware by imitating the next function from express\n let position = -1;\n const next = (error?: unknown): void => {\n if (error) reject(error);\n position++;\n if (position === validationChain.length) {\n resolve();\n return;\n }\n validationChain[position](request, undefined, next);\n };\n next();\n });\n}\n"],"mappings":";;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAEA;AACO,eAAeC,QAAQA,CAC5BC,OAAgB,EAChBC,MAAc,EACC;EACf,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtC;IACA,MAAMC,eAAe,GAAG,IAAAC,kBAAkB,EAACL,MAAM,CAAC,CAACM,IAAI,CAAC,CAAC;IACzD,IAAI,CAACF,eAAe,CAACG,MAAM,EAAEL,OAAO,CAAC,CAAC;IACtC;IACA,IAAIM,QAAQ,GAAG,CAAC,CAAC;IACjB,MAAMC,IAAI,GAAIC,KAAe,IAAW;MACtC,IAAIA,KAAK,EAAEP,MAAM,CAACO,KAAK,CAAC;MACxBF,QAAQ,EAAE;MACV,IAAIA,QAAQ,KAAKJ,eAAe,CAACG,MAAM,EAAE;QACvCL,OAAO,CAAC,CAAC;QACT;MACF;MACAE,eAAe,CAACI,QAAQ,CAAC,CAACT,OAAO,EAAEY,SAAS,EAAEF,IAAI,CAAC;IACrD,CAAC;IACDA,IAAI,CAAC,CAAC;EACR,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"fourOhFour.js","names":["_utils","require","namespace","fourOhFour","request","response","reportDebug","message","method","path","sendStatus"],"sources":["../../../src/middleware/fourOhFour/fourOhFour.ts"],"sourcesContent":["import { Request, Response } from 'express';\r\nimport { reportDebug } from 'utils';\r\n\r\nconst namespace = 'engine:middleware:fourOhFour';\r\n\r\n/** Unhandled path middleware */\r\nexport function fourOhFour(request: Request, response: Response): void {\r\n reportDebug({\r\n namespace,\r\n message: `No route found [${request.method} - ${request.path}]`\r\n });\r\n response.sendStatus(404);\r\n}\r\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,MAAMC,SAAS,GAAG,8BAA8B;;AAEhD;AACO,SAASC,UAAUA,CAACC,OAAgB,EAAEC,QAAkB,EAAQ;EACrE,IAAAC,kBAAW,EAAC;IACVJ,SAAS;IACTK,OAAO,EAAE,mBAAmBH,OAAO,CAACI,MAAM,MAAMJ,OAAO,CAACK,IAAI;EAC9D,CAAC,CAAC;EACFJ,QAAQ,CAACK,UAAU,CAAC,GAAG,CAAC;AAC1B","ignoreList":[]}
1
+ {"version":3,"file":"fourOhFour.js","names":["_utils","require","namespace","fourOhFour","request","response","reportDebug","message","method","path","sendStatus"],"sources":["../../../src/middleware/fourOhFour/fourOhFour.ts"],"sourcesContent":["import { Request, Response } from 'express';\nimport { reportDebug } from 'utils';\n\nconst namespace = 'engine:middleware:fourOhFour';\n\n/** Unhandled path middleware */\nexport function fourOhFour(request: Request, response: Response): void {\n reportDebug({\n namespace,\n message: `No route found [${request.method} - ${request.path}]`\n });\n response.sendStatus(404);\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,MAAMC,SAAS,GAAG,8BAA8B;;AAEhD;AACO,SAASC,UAAUA,CAACC,OAAgB,EAAEC,QAAkB,EAAQ;EACrE,IAAAC,kBAAW,EAAC;IACVJ,SAAS;IACTK,OAAO,EAAE,mBAAmBH,OAAO,CAACI,MAAM,MAAMJ,OAAO,CAACK,IAAI;EAC9D,CAAC,CAAC;EACFJ,QAAQ,CAACK,UAAU,CAAC,GAAG,CAAC;AAC1B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_fourOhFour","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/fourOhFour/index.ts"],"sourcesContent":["export * from './fourOhFour';\r\n"],"mappings":";;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_fourOhFour","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/fourOhFour/index.ts"],"sourcesContent":["export * from './fourOhFour';\n"],"mappings":";;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"geminiFileUploader.js","names":["_multer","_interopRequireDefault","require","_server","_fs","_path","_tmp","_report","_checkEnvironment","_envAssert","namespace","apiKey","process","env","GOOGLE_AI_KEY","fileManager","GoogleAIFileManager","storage","multer","memoryStorage","uploadToGemini","buffer","mimeType","originalName","tempFile","tmp","fileSync","postfix","path","extname","fs","writeFileSync","name","uploadResult","uploadFile","displayName","removeCallback","file","reportDebug","message","data","uri","waitForFilesActive","files","getFile","state","stdout","write","Promise","resolve","setTimeout","reportError","geminiFileUploader","req","res","next","checkEnvironment","envAssert","isString","uploadSingle","single","err","mimetype","uploadedFile","originalname","body","fileUri","error","console"],"sources":["../../../src/middleware/geminiFileUploader/geminiFileUploader.ts"],"sourcesContent":["import express from 'express';\r\nimport multer from 'multer';\r\nimport { GoogleAIFileManager } from '@google/generative-ai/server';\r\nimport fs from 'fs';\r\nimport path from 'path';\r\nimport tmp from 'tmp';\r\nimport { reportError, reportDebug } from 'utils/report';\r\nimport { checkEnvironment } from 'utils/checkEnvironment';\r\nimport { envAssert } from 'utils/envAssert';\r\n\r\nconst namespace = 'engine:middleware:geminiFileUploader';\r\n\r\nconst apiKey = process.env.GOOGLE_AI_KEY ?? '';\r\nconst fileManager = new GoogleAIFileManager(apiKey);\r\n\r\nconst storage = multer.memoryStorage();\r\n\r\nasync function uploadToGemini(\r\n buffer: Buffer,\r\n mimeType: string,\r\n originalName: string\r\n): Promise<{ name: string; uri: string; mimeType: string }> {\r\n // Add 'name' to the return type\r\n const tempFile = tmp.fileSync({ postfix: path.extname(originalName) });\r\n\r\n fs.writeFileSync(tempFile.name, buffer);\r\n\r\n const uploadResult = await fileManager.uploadFile(tempFile.name, {\r\n mimeType,\r\n displayName: originalName\r\n });\r\n\r\n tempFile.removeCallback();\r\n\r\n const file = uploadResult.file;\r\n reportDebug({\r\n namespace,\r\n message: 'Uploaded file',\r\n data: { displayName: file.displayName, name: file.name }\r\n });\r\n return { name: file.name, uri: file.uri, mimeType: file.mimeType }; // Include 'name' in the return object\r\n}\r\n\r\nasync function waitForFilesActive(\r\n files: { name: string; uri: string; mimeType: string }[]\r\n): Promise<void> {\r\n reportDebug({\r\n namespace,\r\n message: 'Waiting for file processing...'\r\n });\r\n for (const { name } of files) {\r\n let file = await fileManager.getFile(name);\r\n while (file.state === 'PROCESSING') {\r\n process.stdout.write('.');\r\n await new Promise((resolve) => setTimeout(resolve, 10_000));\r\n file = await fileManager.getFile(name);\r\n }\r\n if (file.state !== 'ACTIVE') {\r\n reportError(`File ${file.name} failed to process`);\r\n }\r\n }\r\n reportDebug({\r\n namespace,\r\n message: 'all files ready...\\n'\r\n });\r\n}\r\n\r\nexport async function geminiFileUploader(\r\n req: express.Request,\r\n res: express.Response,\r\n next: express.NextFunction\r\n): Promise<void> {\r\n try {\r\n checkEnvironment({\r\n GOOGLE_AI_KEY: envAssert.isString()\r\n });\r\n // Use multer.single() inside the middleware\r\n const uploadSingle = multer({ storage }).single('file');\r\n\r\n uploadSingle(req, res, async (err) => {\r\n if (err) {\r\n reportError(`Error uploading file`);\r\n next(err);\r\n return;\r\n }\r\n\r\n const file = req.file;\r\n if (!file) {\r\n reportError(`No file uploaded`);\r\n next(`No file uploaded`);\r\n return;\r\n }\r\n const mimeType = file.mimetype;\r\n\r\n const uploadedFile = await uploadToGemini(\r\n file.buffer,\r\n mimeType,\r\n file.originalname\r\n );\r\n\r\n await waitForFilesActive([uploadedFile]);\r\n\r\n // Set the fileUri and mimeType in the request object for the next middleware/route handler\r\n req.body.file = {\r\n fileUri: uploadedFile.uri,\r\n mimeType: uploadedFile.mimeType,\r\n originalname: file.originalname\r\n };\r\n\r\n next(); // Proceed to the next middleware or route handler\r\n });\r\n } catch (error) {\r\n console.error(error);\r\n reportError(`Failed to upload or process file`);\r\n next(error);\r\n }\r\n}\r\n"],"mappings":";;;;;;;AACA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,GAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,IAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAEA,MAAMQ,SAAS,GAAG,sCAAsC;AAExD,MAAMC,MAAM,GAAGC,OAAO,CAACC,GAAG,CAACC,aAAa,IAAI,EAAE;AAC9C,MAAMC,WAAW,GAAG,IAAIC,2BAAmB,CAACL,MAAM,CAAC;AAEnD,MAAMM,OAAO,GAAGC,eAAM,CAACC,aAAa,CAAC,CAAC;AAEtC,eAAeC,cAAcA,CAC3BC,MAAc,EACdC,QAAgB,EAChBC,YAAoB,EACsC;EAC1D;E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AAE3B,IAAI,CAAC2B;MACrB,CAAC;MAEDT,IAAI,CAAC,CAAC,CAAC,CAAC;IACV,CAAC,CAAC;EACJ,CAAC,CAAC,OAAOY,KAAK,EAAE;IACdC,OAAO,CAACD,KAAK,CAACA,KAAK,CAAC;IACpB,IAAAhB,mBAAW,EAAC,kCAAkC,CAAC;IAC/CI,IAAI,CAACY,KAAK,CAAC;EACb;AACF","ignoreList":[]}
1
+ {"version":3,"file":"geminiFileUploader.js","names":["_multer","_interopRequireDefault","require","_server","_fs","_path","_tmp","_report","_checkEnvironment","_envAssert","namespace","apiKey","process","env","GOOGLE_AI_KEY","fileManager","GoogleAIFileManager","storage","multer","memoryStorage","uploadToGemini","buffer","mimeType","originalName","tempFile","tmp","fileSync","postfix","path","extname","fs","writeFileSync","name","uploadResult","uploadFile","displayName","removeCallback","file","reportDebug","message","data","uri","waitForFilesActive","files","getFile","state","stdout","write","Promise","resolve","setTimeout","reportError","geminiFileUploader","req","res","next","checkEnvironment","envAssert","isString","uploadSingle","single","err","mimetype","uploadedFile","originalname","body","fileUri","error","console"],"sources":["../../../src/middleware/geminiFileUploader/geminiFileUploader.ts"],"sourcesContent":["import express from 'express';\nimport multer from 'multer';\nimport { GoogleAIFileManager } from '@google/generative-ai/server';\nimport fs from 'fs';\nimport path from 'path';\nimport tmp from 'tmp';\nimport { reportError, reportDebug } from 'utils/report';\nimport { checkEnvironment } from 'utils/checkEnvironment';\nimport { envAssert } from 'utils/envAssert';\n\nconst namespace = 'engine:middleware:geminiFileUploader';\n\nconst apiKey = process.env.GOOGLE_AI_KEY ?? '';\nconst fileManager = new GoogleAIFileManager(apiKey);\n\nconst storage = multer.memoryStorage();\n\nasync function uploadToGemini(\n buffer: Buffer,\n mimeType: string,\n originalName: string\n): Promise<{ name: string; uri: string; mimeType: string }> {\n // Add 'name' to the return type\n const tempFile = tmp.fileSync({ postfix: path.extname(originalName) });\n\n fs.writeFileSync(tempFile.name, buffer);\n\n const uploadResult = await fileManager.uploadFile(tempFile.name, {\n mimeType,\n displayName: originalName\n });\n\n tempFile.removeCallback();\n\n const file = uploadResult.file;\n reportDebug({\n namespace,\n message: 'Uploaded file',\n data: { displayName: file.displayName, name: file.name }\n });\n return { name: file.name, uri: file.uri, mimeType: file.mimeType }; // Include 'name' in the return object\n}\n\nasync function waitForFilesActive(\n files: { name: string; uri: string; mimeType: string }[]\n): Promise<void> {\n reportDebug({\n namespace,\n message: 'Waiting for file processing...'\n });\n for (const { name } of files) {\n let file = await fileManager.getFile(name);\n while (file.state === 'PROCESSING') {\n process.stdout.write('.');\n await new Promise((resolve) => setTimeout(resolve, 10_000));\n file = await fileManager.getFile(name);\n }\n if (file.state !== 'ACTIVE') {\n reportError(`File ${file.name} failed to process`);\n }\n }\n reportDebug({\n namespace,\n message: 'all files ready...\\n'\n });\n}\n\nexport async function geminiFileUploader(\n req: express.Request,\n res: express.Response,\n next: express.NextFunction\n): Promise<void> {\n try {\n checkEnvironment({\n GOOGLE_AI_KEY: envAssert.isString()\n });\n // Use multer.single() inside the middleware\n const uploadSingle = multer({ storage }).single('file');\n\n uploadSingle(req, res, async (err) => {\n if (err) {\n reportError(`Error uploading file`);\n next(err);\n return;\n }\n\n const file = req.file;\n if (!file) {\n reportError(`No file uploaded`);\n next(`No file uploaded`);\n return;\n }\n const mimeType = file.mimetype;\n\n const uploadedFile = await uploadToGemini(\n file.buffer,\n mimeType,\n file.originalname\n );\n\n await waitForFilesActive([uploadedFile]);\n\n // Set the fileUri and mimeType in the request object for the next middleware/route handler\n req.body.file = {\n fileUri: uploadedFile.uri,\n mimeType: uploadedFile.mimeType,\n originalname: file.originalname\n };\n\n next(); // Proceed to the next middleware or route handler\n });\n } catch (error) {\n console.error(error);\n reportError(`Failed to upload or process file`);\n next(error);\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,GAAA,GAAAH,sBAAA,CAAAC,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AChB,IAAI;MACrB,IAAI,CAACA,IAAI,EAAE;QACT,IAAAc,mBAAW,EAAC,kBAAkB,CAAC;QAC/BI,IAAI,CAAC,kBAAkB,CAAC;QACxB;MACF;MACA,MAAMjC,QAAQ,GAAGe,IAAI,CAACyB,QAAQ;MAE9B,MAAMC,YAAY,GAAG,MAAM3C,cAAc,CACvCiB,IAAI,CAAChB,MAAM,EACXC,QAAQ,EACRe,IAAI,CAAC2B,YACP,CAAC;MAED,MAAMtB,kBAAkB,CAAC,CAACqB,YAAY,CAAC,CAAC;;MAExC;MACAV,GAAG,CAACY,IAAI,CAAC5B,IAAI,GAAG;QACd6B,OAAO,EAAEH,YAAY,CAACtB,GAAG;QACzBnB,QAAQ,EAAEyC,YAAY,CAACzC,QAAQ;QAC/B0C,YAAY,EAAE3B,IAAI,CAAC2B;MACrB,CAAC;MAEDT,IAAI,CAAC,CAAC,CAAC,CAAC;IACV,CAAC,CAAC;EACJ,CAAC,CAAC,OAAOY,KAAK,EAAE;IACdC,OAAO,CAACD,KAAK,CAACA,KAAK,CAAC;IACpB,IAAAhB,mBAAW,EAAC,kCAAkC,CAAC;IAC/CI,IAAI,CAACY,KAAK,CAAC;EACb;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_geminiFileUploader","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/geminiFileUploader/index.ts"],"sourcesContent":["export * from './geminiFileUploader';\r\n"],"mappings":";;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,mBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,mBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,mBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_geminiFileUploader","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/geminiFileUploader/index.ts"],"sourcesContent":["export * from './geminiFileUploader';\n"],"mappings":";;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,mBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,mBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,mBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.healthCheck = healthCheck;
7
7
  var _express = require("express");
8
- /**
9
- * respond to Kubernetes health-checks with 200
8
+ /**
9
+ * respond to Kubernetes health-checks with 200
10
10
  */
11
11
  function healthCheck(path = '/heartbeat') {
12
12
  return (0, _express.Router)().get('/', (req, res) => {
@@ -1 +1 @@
1
- {"version":3,"file":"healthCheck.js","names":["_express","require","healthCheck","path","Router","get","req","res","sendStatus"],"sources":["../../../src/middleware/healthCheck/healthCheck.ts"],"sourcesContent":["import { Router, Request, Response } from 'express';\r\n\r\n/**\r\n * respond to Kubernetes health-checks with 200\r\n */\r\nexport function healthCheck(path = '/heartbeat'): Router {\r\n return Router()\r\n .get('/', (req: Request, res: Response) => {\r\n res.sendStatus(200);\r\n })\r\n .get(path, (req: Request, res: Response) => {\r\n res.sendStatus(200);\r\n });\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACO,SAASC,WAAWA,CAACC,IAAI,GAAG,YAAY,EAAU;EACvD,OAAO,IAAAC,eAAM,EAAC,CAAC,CACZC,GAAG,CAAC,GAAG,EAAE,CAACC,GAAY,EAAEC,GAAa,KAAK;IACzCA,GAAG,CAACC,UAAU,CAAC,GAAG,CAAC;EACrB,CAAC,CAAC,CACDH,GAAG,CAACF,IAAI,EAAE,CAACG,GAAY,EAAEC,GAAa,KAAK;IAC1CA,GAAG,CAACC,UAAU,CAAC,GAAG,CAAC;EACrB,CAAC,CAAC;AACN","ignoreList":[]}
1
+ {"version":3,"file":"healthCheck.js","names":["_express","require","healthCheck","path","Router","get","req","res","sendStatus"],"sources":["../../../src/middleware/healthCheck/healthCheck.ts"],"sourcesContent":["import { Router, Request, Response } from 'express';\n\n/**\n * respond to Kubernetes health-checks with 200\n */\nexport function healthCheck(path = '/heartbeat'): Router {\n return Router()\n .get('/', (req: Request, res: Response) => {\n res.sendStatus(200);\n })\n .get(path, (req: Request, res: Response) => {\n res.sendStatus(200);\n });\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACO,SAASC,WAAWA,CAACC,IAAI,GAAG,YAAY,EAAU;EACvD,OAAO,IAAAC,eAAM,EAAC,CAAC,CACZC,GAAG,CAAC,GAAG,EAAE,CAACC,GAAY,EAAEC,GAAa,KAAK;IACzCA,GAAG,CAACC,UAAU,CAAC,GAAG,CAAC;EACrB,CAAC,CAAC,CACDH,GAAG,CAACF,IAAI,EAAE,CAACG,GAAY,EAAEC,GAAa,KAAK;IAC1CA,GAAG,CAACC,UAAU,CAAC,GAAG,CAAC;EACrB,CAAC,CAAC;AACN","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_healthCheck","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/healthCheck/index.ts"],"sourcesContent":["export * from './healthCheck';\r\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_healthCheck","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/healthCheck/index.ts"],"sourcesContent":["export * from './healthCheck';\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_error","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_healthCheck","_validate","_fourOhFour","_authJwt","_authHmac","_authStatic","_swaggerDocs","_authTls","_userResolver","_fileUploader","_metrics","_requestMetrics","_version","_authAdmin","_geminiFileUploader","_checkPermission"],"sources":["../../src/middleware/index.ts"],"sourcesContent":["export * from './error';\r\nexport * from './healthCheck';\r\nexport * from './validate';\r\nexport * from './fourOhFour';\r\nexport * from './authJwt';\r\nexport * from './authHmac';\r\nexport * from './authStatic';\r\nexport * from './swaggerDocs';\r\nexport * from './authTls';\r\nexport * from './userResolver';\r\nexport * from './fileUploader';\r\nexport * from './metrics';\r\nexport * from './requestMetrics';\r\nexport * from './version';\r\nexport * from './authAdmin';\r\nexport * from './geminiFileUploader';\r\nexport * from './checkPermission';\r\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,YAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,YAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,SAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,SAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,SAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,SAA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AA,IAAAA,OAAA,CAAAD,GAAA,MAAAoB,gBAAA,CAAApB,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAgB,gBAAA,CAAApB,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_error","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_healthCheck","_validate","_fourOhFour","_authJwt","_authHmac","_authStatic","_swaggerDocs","_authTls","_userResolver","_fileUploader","_metrics","_requestMetrics","_version","_authAdmin","_geminiFileUploader","_checkPermission"],"sources":["../../src/middleware/index.ts"],"sourcesContent":["export * from './error';\nexport * from './healthCheck';\nexport * from './validate';\nexport * from './fourOhFour';\nexport * from './authJwt';\nexport * from './authHmac';\nexport * from './authStatic';\nexport * from './swaggerDocs';\nexport * from './authTls';\nexport * from './userResolver';\nexport * from './fileUploader';\nexport * from './metrics';\nexport * from './requestMetrics';\nexport * from './version';\nexport * from './authAdmin';\nexport * from './geminiFileUploader';\nexport * from './checkPermission';\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,I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AAA,GAAAvB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAqB,mBAAA,EAAApB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAmB,mBAAA,CAAAnB,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAe,mBAAA,CAAAnB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAoB,gBAAA,GAAAxB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAsB,gBAAA,EAAArB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAoB,gBAAA,CAAApB,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAgB,gBAAA,CAAApB,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_metrics","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/metrics/index.ts"],"sourcesContent":["export * from './metrics';\r\n"],"mappings":";;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,QAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,QAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_metrics","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/metrics/index.ts"],"sourcesContent":["export * from './metrics';\n"],"mappings":";;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,QAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,QAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.js","names":["_express","require","_metrics","_report","metrics","Router","use","req","res","set","instanceRegistry","contentType","end","catch","error","reportError","serviceRegistry"],"sources":["../../../src/middleware/metrics/metrics.ts"],"sourcesContent":["import { Router, Request, Response } from 'express';\r\nimport { instanceRegistry, serviceRegistry } from 'const/metrics';\r\nimport { reportError } from 'utils/report';\r\n\r\n/** Middleware that calculates request time, and exposes metrics related to requests processed by this service */\r\nexport function metrics(): Router {\r\n return Router()\r\n .use('/metrics/instance', (req: Request, res: Response) => {\r\n (async (): Promise<void> => {\r\n res.set('Content-Type', instanceRegistry.contentType);\r\n res.end(await instanceRegistry.metrics());\r\n })().catch((error: Error) => {\r\n reportError(error);\r\n });\r\n })\r\n .use('/metrics/service', (req: Request, res: Response) => {\r\n (async (): Promise<void> => {\r\n res.set('Content-Type', serviceRegistry.contentType);\r\n res.end(await serviceRegistry.metrics());\r\n })().catch((error: Error) => {\r\n reportError(error);\r\n });\r\n });\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA;AACO,SAASG,OAAOA,CAAA,EAAW;EAChC,OAAO,IAAAC,eAAM,EAAC,CAAC,CACZC,GAAG,CAAC,mBAAmB,EAAE,CAACC,GAAY,EAAEC,GAAa,KAAK;IACzD,CAAC,YAA2B;MAC1BA,GAAG,CAACC,GAAG,CAAC,cAAc,EAAEC,yBAAgB,CAACC,WAAW,CAAC;MACrDH,GAAG,CAACI,GAAG,CAAC,MAAMF,yBAAgB,CAACN,OAAO,CAAC,CAAC,CAAC;IAC3C,CAAC,EAAE,CAAC,CAACS,KAAK,CAAEC,KAAY,IAAK;MAC3B,IAAAC,mBAAW,EAACD,KAAK,CAAC;IACpB,CAAC,CAAC;EACJ,CAAC,CAAC,CACDR,GAAG,CAAC,kBAAkB,EAAE,CAACC,GAAY,EAAEC,GAAa,KAAK;IACxD,CAAC,YAA2B;MAC1BA,GAAG,CAACC,GAAG,CAAC,cAAc,EAAEO,wBAAe,CAACL,WAAW,CAAC;MACpDH,GAAG,CAACI,GAAG,CAAC,MAAMI,wBAAe,CAACZ,OAAO,CAAC,CAAC,CAAC;IAC1C,CAAC,EAAE,CAAC,CAACS,KAAK,CAAEC,KAAY,IAAK;MAC3B,IAAAC,mBAAW,EAACD,KAAK,CAAC;IACpB,CAAC,CAAC;EACJ,CAAC,CAAC;AACN","ignoreList":[]}
1
+ {"version":3,"file":"metrics.js","names":["_express","require","_metrics","_report","metrics","Router","use","req","res","set","instanceRegistry","contentType","end","catch","error","reportError","serviceRegistry"],"sources":["../../../src/middleware/metrics/metrics.ts"],"sourcesContent":["import { Router, Request, Response } from 'express';\nimport { instanceRegistry, serviceRegistry } from 'const/metrics';\nimport { reportError } from 'utils/report';\n\n/** Middleware that calculates request time, and exposes metrics related to requests processed by this service */\nexport function metrics(): Router {\n return Router()\n .use('/metrics/instance', (req: Request, res: Response) => {\n (async (): Promise<void> => {\n res.set('Content-Type', instanceRegistry.contentType);\n res.end(await instanceRegistry.metrics());\n })().catch((error: Error) => {\n reportError(error);\n });\n })\n .use('/metrics/service', (req: Request, res: Response) => {\n (async (): Promise<void> => {\n res.set('Content-Type', serviceRegistry.contentType);\n res.end(await serviceRegistry.metrics());\n })().catch((error: Error) => {\n reportError(error);\n });\n });\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA;AACO,SAASG,OAAOA,CAAA,EAAW;EAChC,OAAO,IAAAC,eAAM,EAAC,CAAC,CACZC,GAAG,CAAC,mBAAmB,EAAE,CAACC,GAAY,EAAEC,GAAa,KAAK;IACzD,CAAC,YAA2B;MAC1BA,GAAG,CAACC,GAAG,CAAC,cAAc,EAAEC,yBAAgB,CAACC,WAAW,CAAC;MACrDH,GAAG,CAACI,GAAG,CAAC,MAAMF,yBAAgB,CAACN,OAAO,CAAC,CAAC,CAAC;IAC3C,CAAC,EAAE,CAAC,CAACS,KAAK,CAAEC,KAAY,IAAK;MAC3B,IAAAC,mBAAW,EAACD,KAAK,CAAC;IACpB,CAAC,CAAC;EACJ,CAAC,CAAC,CACDR,GAAG,CAAC,kBAAkB,EAAE,CAACC,GAAY,EAAEC,GAAa,KAAK;IACxD,CAAC,YAA2B;MAC1BA,GAAG,CAACC,GAAG,CAAC,cAAc,EAAEO,wBAAe,CAACL,WAAW,CAAC;MACpDH,GAAG,CAACI,GAAG,CAAC,MAAMI,wBAAe,CAACZ,OAAO,CAAC,CAAC,CAAC;IAC1C,CAAC,EAAE,CAAC,CAACS,KAAK,CAAEC,KAAY,IAAK;MAC3B,IAAAC,mBAAW,EAACD,KAAK,CAAC;IACpB,CAAC,CAAC;EACJ,CAAC,CAAC;AACN","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_requestMetrics","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/requestMetrics/index.ts"],"sourcesContent":["export * from './requestMetrics';\r\n"],"mappings":";;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,eAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,eAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,eAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_requestMetrics","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/requestMetrics/index.ts"],"sourcesContent":["export * from './requestMetrics';\n"],"mappings":";;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,eAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,eAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,eAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"requestMetrics.js","names":["_responseTime","_interopRequireDefault","require","_metrics","requestMetrics","exports","responseTime","request","response","time","labels","path","route","method","status","statusCode","toString","substring","service","process","env","CHART","httpRequestCount","inc","httpRequestDuration","observe"],"sources":["../../../src/middleware/requestMetrics/requestMetrics.ts"],"sourcesContent":["import { Request, Response } from 'express';\r\nimport responseTime from 'response-time';\r\nimport { httpRequestCount, httpRequestDuration } from 'metrics';\r\n\r\n/** Middleware that gets metrics on each request */\r\nexport const requestMetrics = responseTime(\r\n (request: Request, response: Response, time: number) => {\r\n const labels = {\r\n path: (request.route?.path ?? request.path) as string,\r\n method: request.method,\r\n status: response.statusCode\r\n ? `${response.statusCode.toString().substring(0, 1)}XX`\r\n : '',\r\n service: process.env.CHART\r\n };\r\n\r\n httpRequestCount.inc(labels);\r\n httpRequestDuration.observe(labels, time / 1000);\r\n }\r\n);\r\n"],"mappings":";;;;;;;AACA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA;AACO,MAAME,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,IAAAE,qBAAY,EACxC,CAACC,OAAgB,EAAEC,QAAkB,EAAEC,IAAY,KAAK;EACtD,MAAMC,MAAM,GAAG;IACbC,IAAI,EAAGJ,OAAO,CAACK,KAAK,EAAED,IAAI,IAAIJ,OAAO,CAACI,IAAe;IACrDE,MAAM,EAAEN,OAAO,CAACM,MAAM;IACtBC,MAAM,EAAEN,QAAQ,CAACO,UAAU,GACvB,GAAGP,QAAQ,CAACO,UAAU,CAACC,QAAQ,CAAC,CAAC,CAACC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GACrD,EAAE;IACNC,OAAO,EAAEC,OAAO,CAACC,GAAG,CAACC;EACvB,CAAC;EAEDC,yBAAgB,CAACC,GAAG,CAACb,MAAM,CAAC;EAC5Bc,4BAAmB,CAACC,OAAO,CAACf,MAAM,EAAED,IAAI,GAAG,IAAI,CAAC;AAClD,CACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"requestMetrics.js","names":["_responseTime","_interopRequireDefault","require","_metrics","requestMetrics","exports","responseTime","request","response","time","labels","path","route","method","status","statusCode","toString","substring","service","process","env","CHART","httpRequestCount","inc","httpRequestDuration","observe"],"sources":["../../../src/middleware/requestMetrics/requestMetrics.ts"],"sourcesContent":["import { Request, Response } from 'express';\nimport responseTime from 'response-time';\nimport { httpRequestCount, httpRequestDuration } from 'metrics';\n\n/** Middleware that gets metrics on each request */\nexport const requestMetrics = responseTime(\n (request: Request, response: Response, time: number) => {\n const labels = {\n path: (request.route?.path ?? request.path) as string,\n method: request.method,\n status: response.statusCode\n ? `${response.statusCode.toString().substring(0, 1)}XX`\n : '',\n service: process.env.CHART\n };\n\n httpRequestCount.inc(labels);\n httpRequestDuration.observe(labels, time / 1000);\n }\n);\n"],"mappings":";;;;;;;AACA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA;AACO,MAAME,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,IAAAE,qBAAY,EACxC,CAACC,OAAgB,EAAEC,QAAkB,EAAEC,IAAY,KAAK;EACtD,MAAMC,MAAM,GAAG;IACbC,IAAI,EAAGJ,OAAO,CAACK,KAAK,EAAED,IAAI,IAAIJ,OAAO,CAACI,IAAe;IACrDE,MAAM,EAAEN,OAAO,CAACM,MAAM;IACtBC,MAAM,EAAEN,QAAQ,CAACO,UAAU,GACvB,GAAGP,QAAQ,CAACO,UAAU,CAACC,QAAQ,CAAC,CAAC,CAACC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GACrD,EAAE;IACNC,OAAO,EAAEC,OAAO,CAACC,GAAG,CAACC;EACvB,CAAC;EAEDC,yBAAgB,CAACC,GAAG,CAACb,MAAM,CAAC;EAC5Bc,4BAAmB,CAACC,OAAO,CAACf,MAAM,EAAED,IAAI,GAAG,IAAI,CAAC;AAClD,CACF,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_swaggerDocs","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_swaggerDocs2"],"sources":["../../../src/middleware/swaggerDocs/index.ts"],"sourcesContent":["export * from './swaggerDocs';\r\nexport * from './swaggerDocs.types';\r\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,aAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,aAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,aAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,aAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_swaggerDocs","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_swaggerDocs2"],"sources":["../../../src/middleware/swaggerDocs/index.ts"],"sourcesContent":["export * from './swaggerDocs';\nexport * from './swaggerDocs.types';\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,aAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,aAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,aAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,aAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -25,10 +25,10 @@ function getResponsePaths() {
25
25
  return [..._glob.glob.sync(`${process.cwd()}/src/docs/responses/*.yaml`), ..._glob.glob.sync(`${process.cwd()}/dist/docs/responses/*.yaml`)];
26
26
  }
27
27
 
28
- /**
29
- * Load all data files and merge them in a single object
30
- * @param files
31
- * @return {Object}
28
+ /**
29
+ * Load all data files and merge them in a single object
30
+ * @param files
31
+ * @return {Object}
32
32
  */
33
33
  function loadAndMergeData(files) {
34
34
  return files.map(file => _yamljs.default.load(file)).reduce((result, endpoint) => {
@@ -88,9 +88,9 @@ function loadConfig() {
88
88
  };
89
89
  }
90
90
 
91
- /**
92
- * Get a middleware that serves the documentation
93
- * @return {Router}
91
+ /**
92
+ * Get a middleware that serves the documentation
93
+ * @return {Router}
94
94
  */
95
95
  function swaggerDocs() {
96
96
  // Stringify the result and replace any environment variable, then turn it again to an object
@@ -1 +1 @@
1
- {"version":3,"file":"swaggerDocs.js","names":["_fs","_interopRequireDefault","require","_express","_glob","_yamljs","_swaggerUiExpress","getEndpointDocPaths","glob","sync","process","cwd","getSchemaPaths","getResponsePaths","loadAndMergeData","files","map","file","YAML","load","reduce","result","endpoint","path","Object","keys","loadEndpoints","paths","endpoints","loadSchemas","schemas","loadResponses","responses","loadConfig","indexPath","config","fs","existsSync","schemaConfig","responseConfig","endpointConfig","components","swaggerDocs","stringifiedDocumentation","JSON","stringify","placeholderRegex","overwrittenDocumentation","replace","match","p1","env","parse","Router","use","swaggerUi","serve","setup"],"sources":["../../../src/middleware/swaggerDocs/swaggerDocs.ts"],"sourcesContent":["import fs from 'fs';\r\nimport { Router } from 'express';\r\nimport { glob } from 'glob';\r\nimport YAML from 'yamljs';\r\nimport swaggerUi from 'swagger-ui-express';\r\nimport {\r\n EndpointDocumentation,\r\n IndexDocumentation,\r\n ResponsesConfig,\r\n EndpointConfig,\r\n SchemasConfig,\r\n SwaggerConfig\r\n} from './swaggerDocs.types';\r\n\r\n/** Get the paths of all the endpoint documentation files */\r\nfunction getEndpointDocPaths(): Array<string> {\r\n return [\r\n ...glob.sync(`${process.cwd()}/src/**/*.docs.yaml`),\r\n ...glob.sync(`${process.cwd()}/dist/**/*.docs.yaml`)\r\n ];\r\n}\r\n\r\n/** Get the paths of all the schema files */\r\nfunction getSchemaPaths(): Array<string> {\r\n return [\r\n ...glob.sync(`${process.cwd()}/src/docs/schemas/*.yaml`),\r\n ...glob.sync(`${process.cwd()}/dist/docs/schemas/*.yaml`)\r\n ];\r\n}\r\n\r\n/** Get the paths of all the response files */\r\nfunction getResponsePaths(): Array<string> {\r\n return [\r\n ...glob.sync(`${process.cwd()}/src/docs/responses/*.yaml`),\r\n ...glob.sync(`${process.cwd()}/dist/docs/responses/*.yaml`)\r\n ];\r\n}\r\n\r\n/**\r\n * Load all data files and merge them in a single object\r\n * @param files\r\n * @return {Object}\r\n */\r\nfunction loadAndMergeData(files: Array<string>): EndpointDocumentation {\r\n return files\r\n .map((file) => YAML.load(file) as EndpointDocumentation)\r\n .reduce((result, endpoint) => {\r\n for (const path of Object.keys(endpoint)) {\r\n if (!(path in result)) result[path] = {};\r\n result[path] = { ...result[path], ...endpoint[path] };\r\n }\r\n return result;\r\n }, {});\r\n}\r\n\r\n/** Load documentation files of all the endpoints */\r\nfunction loadEndpoints(): EndpointConfig {\r\n const paths = getEndpointDocPaths();\r\n const endpoints = loadAndMergeData(paths);\r\n return {\r\n paths: endpoints\r\n };\r\n}\r\n\r\n/** Load documentation files of all the schemas */\r\nfunction loadSchemas(): SchemasConfig {\r\n const paths = getSchemaPaths();\r\n const schemas = loadAndMergeData(paths);\r\n return { schemas };\r\n}\r\n\r\n/** Load documentation files of all the responses */\r\nfunction loadResponses(): ResponsesConfig {\r\n const paths = getResponsePaths();\r\n const responses = loadAndMergeData(paths);\r\n return { responses };\r\n}\r\n\r\n/** Load the whole Swagger config */\r\nfunction loadConfig(): SwaggerConfig {\r\n const indexPath = `${process.cwd()}/src/docs/index.yaml`;\r\n const config = (\r\n fs.existsSync(indexPath) ? YAML.load(indexPath) : {}\r\n ) as IndexDocumentation;\r\n const schemaConfig = loadSchemas();\r\n const responseConfig = loadResponses();\r\n const endpointConfig = loadEndpoints();\r\n return {\r\n ...config,\r\n ...endpointConfig,\r\n components: {\r\n ...config.components,\r\n ...schemaConfig,\r\n ...responseConfig\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Get a middleware that serves the documentation\r\n * @return {Router}\r\n */\r\nexport function swaggerDocs(): Router {\r\n // Stringify the result and replace any environment variable, then turn it again to an object\r\n const stringifiedDocumentation = JSON.stringify(loadConfig());\r\n const placeholderRegex = /##(.+?)##/g;\r\n const overwrittenDocumentation = stringifiedDocumentation.replace(\r\n placeholderRegex,\r\n (match: string, p1: string): string => process.env[p1] ?? ''\r\n );\r\n const config = JSON.parse(overwrittenDocumentation) as EndpointDocumentation;\r\n \r\n return Router().use('/docs', swaggerUi.serve, swaggerUi.setup(config));\r\n}\r\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,iBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAUA;AACA,SAASK,mBAAmBA,CAAA,EAAkB;EAC5C,OAAO,CACL,GAAGC,UAAI,CAACC,IAA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wB,GAAGJ,wBAAwB,CAACK,OAAO,CAC/DF,gBAAgB,EAChB,CAACG,KAAa,EAAEC,EAAU,KAAaxC,OAAO,CAACyC,GAAG,CAACD,EAAE,CAAC,IAAI,EAC5D,CAAC;EACD,MAAMf,MAAM,GAAGS,IAAI,CAACQ,KAAK,CAACL,wBAAwB,CAA0B;EAE5E,OAAO,IAAAM,eAAM,EAAC,CAAC,CAACC,GAAG,CAAC,OAAO,EAAEC,yBAAS,CAACC,KAAK,EAAED,yBAAS,CAACE,KAAK,CAACtB,MAAM,CAAC,CAAC;AACxE","ignoreList":[]}
1
+ {"version":3,"file":"swaggerDocs.js","names":["_fs","_interopRequireDefault","require","_express","_glob","_yamljs","_swaggerUiExpress","getEndpointDocPaths","glob","sync","process","cwd","getSchemaPaths","getResponsePaths","loadAndMergeData","files","map","file","YAML","load","reduce","result","endpoint","path","Object","keys","loadEndpoints","paths","endpoints","loadSchemas","schemas","loadResponses","responses","loadConfig","indexPath","config","fs","existsSync","schemaConfig","responseConfig","endpointConfig","components","swaggerDocs","stringifiedDocumentation","JSON","stringify","placeholderRegex","overwrittenDocumentation","replace","match","p1","env","parse","Router","use","swaggerUi","serve","setup"],"sources":["../../../src/middleware/swaggerDocs/swaggerDocs.ts"],"sourcesContent":["import fs from 'fs';\nimport { Router } from 'express';\nimport { glob } from 'glob';\nimport YAML from 'yamljs';\nimport swaggerUi from 'swagger-ui-express';\nimport {\n EndpointDocumentation,\n IndexDocumentation,\n ResponsesConfig,\n EndpointConfig,\n SchemasConfig,\n SwaggerConfig\n} from './swaggerDocs.types';\n\n/** Get the paths of all the endpoint documentation files */\nfunction getEndpointDocPaths(): Array<string> {\n return [\n ...glob.sync(`${process.cwd()}/src/**/*.docs.yaml`),\n ...glob.sync(`${process.cwd()}/dist/**/*.docs.yaml`)\n ];\n}\n\n/** Get the paths of all the schema files */\nfunction getSchemaPaths(): Array<string> {\n return [\n ...glob.sync(`${process.cwd()}/src/docs/schemas/*.yaml`),\n ...glob.sync(`${process.cwd()}/dist/docs/schemas/*.yaml`)\n ];\n}\n\n/** Get the paths of all the response files */\nfunction getResponsePaths(): Array<string> {\n return [\n ...glob.sync(`${process.cwd()}/src/docs/responses/*.yaml`),\n ...glob.sync(`${process.cwd()}/dist/docs/responses/*.yaml`)\n ];\n}\n\n/**\n * Load all data files and merge them in a single object\n * @param files\n * @return {Object}\n */\nfunction loadAndMergeData(files: Array<string>): EndpointDocumentation {\n return files\n .map((file) => YAML.load(file) as EndpointDocumentation)\n .reduce((result, endpoint) => {\n for (const path of Object.keys(endpoint)) {\n if (!(path in result)) result[path] = {};\n result[path] = { ...result[path], ...endpoint[path] };\n }\n return result;\n }, {});\n}\n\n/** Load documentation files of all the endpoints */\nfunction loadEndpoints(): EndpointConfig {\n const paths = getEndpointDocPaths();\n const endpoints = loadAndMergeData(paths);\n return {\n paths: endpoints\n };\n}\n\n/** Load documentation files of all the schemas */\nfunction loadSchemas(): SchemasConfig {\n const paths = getSchemaPaths();\n const schemas = loadAndMergeData(paths);\n return { schemas };\n}\n\n/** Load documentation files of all the responses */\nfunction loadResponses(): ResponsesConfig {\n const paths = getResponsePaths();\n const responses = loadAndMergeData(paths);\n return { responses };\n}\n\n/** Load the whole Swagger config */\nfunction loadConfig(): SwaggerConfig {\n const indexPath = `${process.cwd()}/src/docs/index.yaml`;\n const config = (\n fs.existsSync(indexPath) ? YAML.load(indexPath) : {}\n ) as IndexDocumentation;\n const schemaConfig = loadSchemas();\n const responseConfig = loadResponses();\n const endpointConfig = loadEndpoints();\n return {\n ...config,\n ...endpointConfig,\n components: {\n ...config.components,\n ...schemaConfig,\n ...responseConfig\n }\n };\n}\n\n/**\n * Get a middleware that serves the documentation\n * @return {Router}\n */\nexport function swaggerDocs(): Router {\n // Stringify the result and replace any environment variable, then turn it again to an object\n const stringifiedDocumentation = JSON.stringify(loadConfig());\n const placeholderRegex = /##(.+?)##/g;\n const overwrittenDocumentation = stringifiedDocumentation.replace(\n placeholderRegex,\n (match: string, p1: string): string => process.env[p1] ?? ''\n );\n const config = JSON.parse(overwrittenDocumentation) as EndpointDocumentation;\n \n return Router().use('/docs', swaggerUi.serve, swaggerUi.setup(config));\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,iBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAUA;AACA,SAASK,mBAAmBA,CAAA,EAAkB;EAC5C,OAAO,CACL,GAAGC,UAAI,CAACC,IAAI,CAAC,GAAGC,OAAO,CAACC,GAAG,CAAC,CAAC,qBAAqB,CAAC,EACnD,GAAGH,UAAI,CAACC,IAAI,CAAC,GAAGC,OAAO,CAACC,GAAG,CAAC,CAAC,sBAAsB,CAAC,CACrD;AACH;;AAEA;AACA,SAASC,cAAcA,CAAA,EAAkB;EACvC,OAAO,CACL,GAAGJ,UAAI,CAACC,IAAI,CAAC,GAAGC,OAAO,CAACC,GAAG,CAAC,CAAC,0BAA0B,CAAC,EACxD,GAAGH,UAAI,CAACC,IAAI,CAAC,GAAGC,OAAO,CAACC,GAAG,CAAC,CAAC,2BAA2B,CAAC,CAC1D;AACH;;AAEA;AACA,SAASE,gBAAgBA,CAAA,EAAkB;EACzC,OAAO,CACL,GAAGL,UAAI,CAACC,IAAI,CAAC,GAAGC,OAAO,CAACC,GAAG,CAAC,CAAC,4BAA4B,CAAC,EAC1D,GAAGH,UAAI,CAACC,IAAI,CAAC,GAAGC,OAAO,CAACC,GAAG,CAAC,CAAC,6BAA6B,CAAC,CAC5D;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASG,gBAAgBA,CAACC,KAAoB,EAAyB;EACrE,OAAOA,KAAK,CACTC,GAAG,CAAEC,IAAI,IAAKC,eAAI,CAACC,IAAI,CAACF,IAAI,CAA0B,CAAC,CACvDG,MAAM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,cAAc,GAAGR,aAAa,CAAC,CAAC;EACtC,MAAMS,cAAc,GAAGd,aAAa,CAAC,CAAC;EACtC,OAAO;IACL,GAAGS,MAAM;IACT,GAAGK,cAAc;IACjBC,UAAU,EAAE;MACV,GAAGN,MAAM,CAACM,UAAU;MACpB,GAAGH,YAAY;MACf,GAAGC;IACL;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACO,SAASG,WAAWA,CAAA,EAAW;EACpC;EACA,MAAMC,wBAAwB,GAAGC,IAAI,CAACC,SAAS,CAACZ,UAAU,CAAC,CAAC,CAAC;EAC7D,MAAMa,gBAAgB,GAAG,YAAY;EACrC,MAAMC,wBAAwB,GAAGJ,wBAAwB,CAACK,OAAO,CAC/DF,gBAAgB,EAChB,CAACG,KAAa,EAAEC,EAAU,KAAaxC,OAAO,CAACyC,GAAG,CAACD,EAAE,CAAC,IAAI,EAC5D,CAAC;EACD,MAAMf,MAAM,GAAGS,IAAI,CAACQ,KAAK,CAACL,wBAAwB,CAA0B;EAE5E,OAAO,IAAAM,eAAM,EAAC,CAAC,CAACC,GAAG,CAAC,OAAO,EAAEC,yBAAS,CAACC,KAAK,EAAED,yBAAS,CAACE,KAAK,CAACtB,MAAM,CAAC,CAAC;AACxE","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"swaggerDocs.types.js","names":[],"sources":["../../../src/middleware/swaggerDocs/swaggerDocs.types.ts"],"sourcesContent":["/** Documentation content */\r\nexport interface EndpointDocumentation {\r\n [path: string]: { [key: string]: unknown };\r\n}\r\n\r\n/** Documentation content */\r\ninterface ComponentDocumentation {\r\n [name: string]: { [key: string]: unknown };\r\n}\r\n\r\n/** root documentation config */\r\nexport interface IndexDocumentation extends EndpointDocumentation {\r\n /** Global components to be documented */\r\n components: ComponentDocumentation;\r\n}\r\n\r\n/** Documentation config for endpoints */\r\nexport interface EndpointConfig {\r\n /** Documentation content */\r\n paths: EndpointDocumentation;\r\n}\r\n\r\n/** Documentation config for responses */\r\nexport interface ResponsesConfig {\r\n /** Documentation content */\r\n responses: ComponentDocumentation;\r\n}\r\n\r\n/** Documentation config for schemas */\r\nexport interface SchemasConfig {\r\n /** Documentation content */\r\n schemas: ComponentDocumentation;\r\n}\r\n\r\nexport type SwaggerConfig = IndexDocumentation &\r\n EndpointConfig & {\r\n /** Shared components documentation */\r\n components: IndexDocumentation['components'] &\r\n ResponsesConfig &\r\n SchemasConfig;\r\n };\r\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"swaggerDocs.types.js","names":[],"sources":["../../../src/middleware/swaggerDocs/swaggerDocs.types.ts"],"sourcesContent":["/** Documentation content */\nexport interface EndpointDocumentation {\n [path: string]: { [key: string]: unknown };\n}\n\n/** Documentation content */\ninterface ComponentDocumentation {\n [name: string]: { [key: string]: unknown };\n}\n\n/** root documentation config */\nexport interface IndexDocumentation extends EndpointDocumentation {\n /** Global components to be documented */\n components: ComponentDocumentation;\n}\n\n/** Documentation config for endpoints */\nexport interface EndpointConfig {\n /** Documentation content */\n paths: EndpointDocumentation;\n}\n\n/** Documentation config for responses */\nexport interface ResponsesConfig {\n /** Documentation content */\n responses: ComponentDocumentation;\n}\n\n/** Documentation config for schemas */\nexport interface SchemasConfig {\n /** Documentation content */\n schemas: ComponentDocumentation;\n}\n\nexport type SwaggerConfig = IndexDocumentation &\n EndpointConfig & {\n /** Shared components documentation */\n components: IndexDocumentation['components'] &\n ResponsesConfig &\n SchemasConfig;\n };\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_userResolver","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/userResolver/index.ts"],"sourcesContent":["export * from './userResolver';\r\n"],"mappings":";;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,aAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,aAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,aAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_userResolver","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/userResolver/index.ts"],"sourcesContent":["export * from './userResolver';\n"],"mappings":";;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,aAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,aAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,aAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"userResolver.js","names":["_EngineError","require","_utils","namespace","userResolver","request","response","next","id","user","EngineError","message","data","reportDebug"],"sources":["../../../src/middleware/userResolver/userResolver.ts"],"sourcesContent":["import { Request, Response, NextFunction } from 'express';\r\nimport { EngineError } from 'entities/EngineError';\r\nimport { reportDebug } from 'utils';\r\n\r\nconst namespace = 'engine:middleware:userResolver';\r\n\r\n/** Fetch the user previously identified by a JWT and adds his data to the request.user object */\r\nexport async function userResolver(\r\n request: Request,\r\n response: Response,\r\n next: NextFunction\r\n): Promise<void> {\r\n const id = request.user?.id;\r\n if (!id)\r\n throw new EngineError({\r\n message: 'Could not resolve user as the request is missing his ID'\r\n });\r\n const user = { user: 'ram', id };\r\n if (!user)\r\n throw new EngineError({\r\n message: 'Could not resolve user as it could not be fetched',\r\n data: { id }\r\n });\r\n reportDebug({\r\n namespace,\r\n message: 'Resolved user based on his token',\r\n data: { user, request: request.user }\r\n });\r\n request.user = {\r\n ...request?.user,\r\n ...user\r\n };\r\n\r\n next();\r\n}\r\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,SAAS,GAAG,gCAAgC;;AAElD;AACO,eAAeC,YAAYA,CAChCC,OAAgB,EAChBC,QAAkB,EAClBC,IAAkB,EACH;EACf,MAAMC,EAAE,GAAGH,OAAO,CAACI,IAAI,EAAED,EAAE;EAC3B,IAAI,CAACA,EAAE,EACL,MAAM,IAAIE,wBAAW,CAAC;IACpBC,OAAO,EAAE;EACX,CAAC,CAAC;EACJ,MAAMF,IAAI,GAAG;IAAEA,IAAI,EAAE,KAAK;IAAED;EAAG,CAAC;EAChC,IAAI,CAACC,IAAI,EACP,MAAM,IAAIC,wBAAW,CAAC;IACpBC,OAAO,EAAE,mDAAmD;IAC5DC,IAAI,EAAE;MAAEJ;IAAG;EACb,CAAC,CAAC;EACJ,IAAAK,kBAAW,EAAC;IACVV,SAAS;IACTQ,OAAO,EAAE,kCAAkC;IAC3CC,IAAI,EAAE;MAAEH,IAAI;MAAEJ,OAAO,EAAEA,OAAO,CAACI;IAAK;EACtC,CAAC,CAAC;EACFJ,OAAO,CAACI,IAAI,GAAG;IACb,GAAGJ,OAAO,EAAEI,IAAI;IAChB,GAAGA;EACL,CAAC;EAEDF,IAAI,CAAC,CAAC;AACR","ignoreList":[]}
1
+ {"version":3,"file":"userResolver.js","names":["_EngineError","require","_utils","namespace","userResolver","request","response","next","id","user","EngineError","message","data","reportDebug"],"sources":["../../../src/middleware/userResolver/userResolver.ts"],"sourcesContent":["import { Request, Response, NextFunction } from 'express';\nimport { EngineError } from 'entities/EngineError';\nimport { reportDebug } from 'utils';\n\nconst namespace = 'engine:middleware:userResolver';\n\n/** Fetch the user previously identified by a JWT and adds his data to the request.user object */\nexport async function userResolver(\n request: Request,\n response: Response,\n next: NextFunction\n): Promise<void> {\n const id = request.user?.id;\n if (!id)\n throw new EngineError({\n message: 'Could not resolve user as the request is missing his ID'\n });\n const user = { user: 'ram', id };\n if (!user)\n throw new EngineError({\n message: 'Could not resolve user as it could not be fetched',\n data: { id }\n });\n reportDebug({\n namespace,\n message: 'Resolved user based on his token',\n data: { user, request: request.user }\n });\n request.user = {\n ...request?.user,\n ...user\n };\n\n next();\n}\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,SAAS,GAAG,gCAAgC;;AAElD;AACO,eAAeC,YAAYA,CAChCC,OAAgB,EAChBC,QAAkB,EAClBC,IAAkB,EACH;EACf,MAAMC,EAAE,GAAGH,OAAO,CAACI,IAAI,EAAED,EAAE;EAC3B,IAAI,CAACA,EAAE,EACL,MAAM,IAAIE,wBAAW,CAAC;IACpBC,OAAO,EAAE;EACX,CAAC,CAAC;EACJ,MAAMF,IAAI,GAAG;IAAEA,IAAI,EAAE,KAAK;IAAED;EAAG,CAAC;EAChC,IAAI,CAACC,IAAI,EACP,MAAM,IAAIC,wBAAW,CAAC;IACpBC,OAAO,EAAE,mDAAmD;IAC5DC,IAAI,EAAE;MAAEJ;IAAG;EACb,CAAC,CAAC;EACJ,IAAAK,kBAAW,EAAC;IACVV,SAAS;IACTQ,OAAO,EAAE,kCAAkC;IAC3CC,IAAI,EAAE;MAAEH,IAAI;MAAEJ,OAAO,EAAEA,OAAO,CAACI;IAAK;EACtC,CAAC,CAAC;EACFJ,OAAO,CAACI,IAAI,GAAG;IACb,GAAGJ,OAAO,EAAEI,IAAI;IAChB,GAAGA;EACL,CAAC;EAEDF,IAAI,CAAC,CAAC;AACR","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_validate","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/validate/index.ts"],"sourcesContent":["export * from './validate';\r\n"],"mappings":";;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,SAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_validate","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/validate/index.ts"],"sourcesContent":["export * from './validate';\n"],"mappings":";;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,SAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","names":["_expressValidator","require","_ValidationError","validate","config","checkSchema","req","res","next","result","validationResult","isEmpty","ValidationError","exports"],"sources":["../../../src/middleware/validate/validate.ts"],"sourcesContent":["import { Request, Response, NextFunction } from 'express';\r\nimport {\r\n checkSchema,\r\n validationResult,\r\n Schema,\r\n ValidationChain\r\n} from 'express-validator';\r\nimport { ValidationError } from 'entities/ValidationError';\r\n\r\n/** Validate the express-validator results */\r\nexport const validate = (\r\n config: Schema\r\n): Array<\r\n ValidationChain | ((req: Request, res: Response, next: NextFunction) => void)\r\n> => [\r\n ...checkSchema(config),\r\n (req: Request, res: Response, next: NextFunction): void => {\r\n const result = validationResult(req);\r\n if (result.isEmpty()) {\r\n next();\r\n return;\r\n }\r\n next(new ValidationError(result));\r\n }\r\n];\r\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAMA,IAAAC,gBAAA,GAAAD,OAAA;AAEA;AACO,MAAME,QAAQ,GACnBC,MAAc,IAGX,CACH,GAAG,IAAAC,6BAAW,EAACD,MAAM,CAAC,EACtB,CAACE,GAAY,EAAEC,GAAa,EAAEC,IAAkB,KAAW;EACzD,MAAMC,MAAM,GAAG,IAAAC,kCAAgB,EAACJ,GAAG,CAAC;EACpC,IAAIG,MAAM,CAACE,OAAO,CAAC,CAAC,EAAE;IACpBH,IAAI,CAAC,CAAC;IACN;EACF;EACAA,IAAI,CAAC,IAAII,gCAAe,CAACH,MAAM,CAAC,CAAC;AACnC,CAAC,CACF;AAACI,OAAA,CAAAV,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"file":"validate.js","names":["_expressValidator","require","_ValidationError","validate","config","checkSchema","req","res","next","result","validationResult","isEmpty","ValidationError","exports"],"sources":["../../../src/middleware/validate/validate.ts"],"sourcesContent":["import { Request, Response, NextFunction } from 'express';\nimport {\n checkSchema,\n validationResult,\n Schema,\n ValidationChain\n} from 'express-validator';\nimport { ValidationError } from 'entities/ValidationError';\n\n/** Validate the express-validator results */\nexport const validate = (\n config: Schema\n): Array<\n ValidationChain | ((req: Request, res: Response, next: NextFunction) => void)\n> => [\n ...checkSchema(config),\n (req: Request, res: Response, next: NextFunction): void => {\n const result = validationResult(req);\n if (result.isEmpty()) {\n next();\n return;\n }\n next(new ValidationError(result));\n }\n];\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAMA,IAAAC,gBAAA,GAAAD,OAAA;AAEA;AACO,MAAME,QAAQ,GACnBC,MAAc,IAGX,CACH,GAAG,IAAAC,6BAAW,EAACD,MAAM,CAAC,EACtB,CAACE,GAAY,EAAEC,GAAa,EAAEC,IAAkB,KAAW;EACzD,MAAMC,MAAM,GAAG,IAAAC,kCAAgB,EAACJ,GAAG,CAAC;EACpC,IAAIG,MAAM,CAACE,OAAO,CAAC,CAAC,EAAE;IACpBH,IAAI,CAAC,CAAC;IACN;EACF;EACAA,IAAI,CAAC,IAAII,gCAAe,CAACH,MAAM,CAAC,CAAC;AACnC,CAAC,CACF;AAACI,OAAA,CAAAV,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_version","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/version/index.ts"],"sourcesContent":["export * from './version';\r\n"],"mappings":";;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,QAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,QAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_version","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/middleware/version/index.ts"],"sourcesContent":["export * from './version';\n"],"mappings":";;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,QAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,QAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = version;
7
7
  var _express = require("express");
8
8
  var _package = require("../../../package.json");
9
- /**
10
- * Path returning the version of the service
11
- * @return {Router}
9
+ /**
10
+ * Path returning the version of the service
11
+ * @return {Router}
12
12
  */
13
13
  function version() {
14
14
  return (0, _express.Router)().use('/version', (req, res) => {
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":["_express","require","_package","version","Router","use","req","res","json","process","env","BUILD_ID","engineVersion"],"sources":["../../../src/middleware/version/version.ts"],"sourcesContent":["import { Router, Request, Response } from 'express';\r\nimport { version as engineVersion } from '../../../package.json';\r\n\r\n/**\r\n * Path returning the version of the service\r\n * @return {Router}\r\n */\r\nexport function version(): Router {\r\n return Router().use('/version', (req: Request, res: Response) => {\r\n res.json({ version: process.env.BUILD_ID, engineVersion });\r\n });\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACO,SAASE,OAAOA,CAAA,EAAW;EAChC,OAAO,IAAAC,eAAM,EAAC,CAAC,CAACC,GAAG,CAAC,UAAU,EAAE,CAACC,GAAY,EAAEC,GAAa,KAAK;IAC/DA,GAAG,CAACC,IAAI,CAAC;MAAEL,OAAO,EAAEM,OAAO,CAACC,GAAG,CAACC,QAAQ;MAAEC,aAAa,EAAbA;IAAc,CAAC,CAAC;EAC5D,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"version.js","names":["_express","require","_package","version","Router","use","req","res","json","process","env","BUILD_ID","engineVersion"],"sources":["../../../src/middleware/version/version.ts"],"sourcesContent":["import { Router, Request, Response } from 'express';\nimport { version as engineVersion } from '../../../package.json';\n\n/**\n * Path returning the version of the service\n * @return {Router}\n */\nexport function version(): Router {\n return Router().use('/version', (req: Request, res: Response) => {\n res.json({ version: process.env.BUILD_ID, engineVersion });\n });\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACO,SAASE,OAAOA,CAAA,EAAW;EAChC,OAAO,IAAAC,eAAM,EAAC,CAAC,CAACC,GAAG,CAAC,UAAU,EAAE,CAACC,GAAY,EAAEC,GAAa,KAAK;IAC/DA,GAAG,CAACC,IAAI,CAAC;MAAEL,OAAO,EAAEM,OAAO,CAACC,GAAG,CAACC,QAAQ;MAAEC,aAAa,EAAbA;IAAc,CAAC,CAAC;EAC5D,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -8,10 +8,10 @@ exports.checkEnvironment = checkEnvironment;
8
8
  var _envalid = require("envalid");
9
9
  var _EngineError = require("../../entities/EngineError");
10
10
  var _report = require("../report");
11
- /**
12
- * Create an Envalid reporter
13
- * @param shouldExit - should the reporter exit the process on fail
14
- * @return Envalid reporter function
11
+ /**
12
+ * Create an Envalid reporter
13
+ * @param shouldExit - should the reporter exit the process on fail
14
+ * @return Envalid reporter function
15
15
  */
16
16
  function createReporter(shouldExit) {
17
17
  return reporter => {
@@ -35,11 +35,11 @@ function createReporter(shouldExit) {
35
35
  };
36
36
  }
37
37
 
38
- /**
39
- * Ensure the process.env is valid using Envalid.
40
- * if the validation fails it will log a helpful EngineError.emergency()
41
- * and exit the process with status-code 1.
42
- * @param validators - Envalid validators
38
+ /**
39
+ * Ensure the process.env is valid using Envalid.
40
+ * if the validation fails it will log a helpful EngineError.emergency()
41
+ * and exit the process with status-code 1.
42
+ * @param validators - Envalid validators
43
43
  */
44
44
  function checkEnvironment(validators = {}) {
45
45
  (0, _envalid.cleanEnv)(process.env, validators, {
@@ -47,10 +47,10 @@ function checkEnvironment(validators = {}) {
47
47
  });
48
48
  }
49
49
 
50
- /**
51
- * Ensure the process.env is valid using Envalid.
52
- * if the validation fails it will throw a EngineError.emergency()
53
- * @param validators - Envalid validators
50
+ /**
51
+ * Ensure the process.env is valid using Envalid.
52
+ * if the validation fails it will throw a EngineError.emergency()
53
+ * @param validators - Envalid validators
54
54
  */
55
55
  function assertEnvironment(validators = {}) {
56
56
  (0, _envalid.cleanEnv)({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_envalid","require","_EngineError","_report","createReporter","shouldExit","reporter","errors","failedChecks","Object","keys","message","join","length","reportError","EngineError","data","process","exit","checkEnvironment","validators","cleanEnv","env","assertEnvironment"],"sources":["../../../src/utils/checkEnvironment/index.ts"],"sourcesContent":["import { cleanEnv, ReporterOptions } from 'envalid';\r\nimport { EngineError } from 'entities/EngineError';\r\nimport { reportError } from 'utils/report';\r\n\r\n/**\r\n * Create an Envalid reporter\r\n * @param shouldExit - should the reporter exit the process on fail\r\n * @return Envalid reporter function\r\n */\r\nfunction createReporter(shouldExit: boolean) {\r\n return (reporter: ReporterOptions<unknown>): void => {\r\n const { errors } = reporter;\r\n const failedChecks = Object.keys(errors);\r\n const message = failedChecks.join(', ');\r\n if (failedChecks.length == 0) return;\r\n if (shouldExit) {\r\n reportError(\r\n new EngineError({\r\n message: `Check Environment Failed: ${message}`,\r\n data: failedChecks\r\n })\r\n );\r\n process.exit(1);\r\n }\r\n throw new EngineError({\r\n message: `Check Environment Failed: ${message}`,\r\n data: failedChecks\r\n });\r\n };\r\n}\r\n\r\n/**\r\n * Ensure the process.env is valid using Envalid.\r\n * if the validation fails it will log a helpful EngineError.emergency()\r\n * and exit the process with status-code 1.\r\n * @param validators - Envalid validators\r\n */\r\nexport function checkEnvironment(validators = {}): void {\r\n cleanEnv(process.env, validators, { reporter: createReporter(true) });\r\n}\r\n\r\n/**\r\n * Ensure the process.env is valid using Envalid.\r\n * if the validation fails it will throw a EngineError.emergency()\r\n * @param validators - Envalid validators\r\n */\r\nexport function assertEnvironment(validators = {}): void {\r\n cleanEnv({ ...process.env }, validators, { reporter: createReporter(false) });\r\n}\r\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA,SAASG,cAAcA,CAACC,UAAmB,EAAE;EAC3C,OAAQC,QAAkC,IAAW;IACnD,MAAM;MAAEC;IAAO,CAAC,GAAGD,QAAQ;IAC3B,MAAME,YAAY,GAAGC,MAAM,CAACC,IAAI,CAACH,MAAM,CAAC;IACxC,MAAMI,OAAO,GAAGH,YAAY,CAACI,IAAI,CAAC,IAAI,CAAC;IACvC,IAAIJ,YAAY,CAACK,MAAM,IAAI,CAAC,EAAE;IAC9B,IAAIR,UAAU,EAAE;MACd,IAAAS,mBAAW,EACT,IAAIC,wBAAW,CAAC;QACdJ,OAAO,EAAE,8BAA8BA,OAAO,EAAE;QAChDK,IAAI,EAAER;MACR,CAAC,CACH,CAAC;MACDS,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;IACjB;IACA,MAAM,IAAIH,wBAAW,CAAC;MACpBJ,OAAO,EAAE,8BAA8BA,OAAO,EAAE;MAChDK,IAAI,EAAER;IACR,CAAC,CAAC;EACJ,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,gBAAgBA,CAACC,UAAU,GAAG,CAAC,CAAC,EAAQ;EACtD,IAAAC,iBAAQ,EAACJ,OAAO,CAACK,GAAG,EAAEF,UAAU,EAAE;IAAEd,QAAQ,EAAEF,cAAc,CAAC,IAAI;EAAE,CAAC,CAAC;AACvE;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASmB,iBAAiBA,CAACH,UAAU,GAAG,CAAC,CAAC,EAAQ;EACvD,IAAAC,iBAAQ,EAAC;IAAE,GAAGJ,OAAO,CAACK;EAAI,CAAC,EAAEF,UAAU,EAAE;IAAEd,QAAQ,EAAEF,cAAc,CAAC,KAAK;EAAE,CAAC,CAAC;AAC/E","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_envalid","require","_EngineError","_report","createReporter","shouldExit","reporter","errors","failedChecks","Object","keys","message","join","length","reportError","EngineError","data","process","exit","checkEnvironment","validators","cleanEnv","env","assertEnvironment"],"sources":["../../../src/utils/checkEnvironment/index.ts"],"sourcesContent":["import { cleanEnv, ReporterOptions } from 'envalid';\nimport { EngineError } from 'entities/EngineError';\nimport { reportError } from 'utils/report';\n\n/**\n * Create an Envalid reporter\n * @param shouldExit - should the reporter exit the process on fail\n * @return Envalid reporter function\n */\nfunction createReporter(shouldExit: boolean) {\n return (reporter: ReporterOptions<unknown>): void => {\n const { errors } = reporter;\n const failedChecks = Object.keys(errors);\n const message = failedChecks.join(', ');\n if (failedChecks.length == 0) return;\n if (shouldExit) {\n reportError(\n new EngineError({\n message: `Check Environment Failed: ${message}`,\n data: failedChecks\n })\n );\n process.exit(1);\n }\n throw new EngineError({\n message: `Check Environment Failed: ${message}`,\n data: failedChecks\n });\n };\n}\n\n/**\n * Ensure the process.env is valid using Envalid.\n * if the validation fails it will log a helpful EngineError.emergency()\n * and exit the process with status-code 1.\n * @param validators - Envalid validators\n */\nexport function checkEnvironment(validators = {}): void {\n cleanEnv(process.env, validators, { reporter: createReporter(true) });\n}\n\n/**\n * Ensure the process.env is valid using Envalid.\n * if the validation fails it will throw a EngineError.emergency()\n * @param validators - Envalid validators\n */\nexport function assertEnvironment(validators = {}): void {\n cleanEnv({ ...process.env }, validators, { reporter: createReporter(false) });\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA,SAASG,cAAcA,CAACC,UAAmB,EAAE;EAC3C,OAAQC,QAAkC,IAAW;IACnD,MAAM;MAAEC;IAAO,CAAC,GAAGD,QAAQ;IAC3B,MAAME,YAAY,GAAGC,MAAM,CAACC,IAAI,CAACH,MAAM,CAAC;IACxC,MAAMI,OAAO,GAAGH,YAAY,CAACI,IAAI,CAAC,IAAI,CAAC;IACvC,IAAIJ,YAAY,CAACK,MAAM,IAAI,CAAC,EAAE;IAC9B,IAAIR,UAAU,EAAE;MACd,IAAAS,mBAAW,EACT,IAAIC,wBAAW,CAAC;QACdJ,OAAO,EAAE,8BAA8BA,OAAO,EAAE;QAChDK,IAAI,EAAER;MACR,CAAC,CACH,CAAC;MACDS,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;IACjB;IACA,MAAM,IAAIH,wBAAW,CAAC;MACpBJ,OAAO,EAAE,8BAA8BA,OAAO,EAAE;MAChDK,IAAI,EAAER;IACR,CAAC,CAAC;EACJ,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,gBAAgBA,CAACC,UAAU,GAAG,CAAC,CAAC,EAAQ;EACtD,IAAAC,iBAAQ,EAACJ,OAAO,CAACK,GAAG,EAAEF,UAAU,EAAE;IAAEd,QAAQ,EAAEF,cAAc,CAAC,IAAI;EAAE,CAAC,CAAC;AACvE;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASmB,iBAAiBA,CAACH,UAAU,GAAG,CAAC,CAAC,EAAQ;EACvD,IAAAC,iBAAQ,EAAC;IAAE,GAAGJ,OAAO,CAACK;EAAI,CAAC,EAAEF,UAAU,EAAE;IAAEd,QAAQ,EAAEF,cAAc,CAAC,KAAK;EAAE,CAAC,CAAC;AAC/E","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"createHttpServer.js","names":["_fs","_interopRequireDefault","require","_http","_https","_createHttpServer","createHttpServer","handler","validateHttpEnvironment","process","env","TLS_SERVER_KEY","TLS_SERVER_CERT","createSecureServer","key","fs","readFileSync","passphrase","TLS_SERVER_KEY_PASSPHRASE","cert","ca","TLS_CA","undefined","requestCert","rejectUnauthorized","createServer"],"sources":["../../../src/utils/createHttpServer/createHttpServer.ts"],"sourcesContent":["import fs from 'fs';\r\nimport { createServer, RequestListener, Server } from 'http';\r\nimport {\r\n createServer as createSecureServer,\r\n Server as SecureServer\r\n} from 'https';\r\nimport { Application } from 'express';\r\nimport { validateHttpEnvironment } from './createHttpServer.validate';\r\n\r\n/** Create and configure an http/https server */\r\nexport function createHttpServer(\r\n handler?: Application | RequestListener\r\n): Server | SecureServer {\r\n // Validate the environment variables\r\n validateHttpEnvironment();\r\n // Create a https server if env var are specified\r\n if (process.env.TLS_SERVER_KEY && process.env.TLS_SERVER_CERT) {\r\n return createSecureServer(\r\n {\r\n key: fs.readFileSync(process.env.TLS_SERVER_KEY),\r\n passphrase: process.env.TLS_SERVER_KEY_PASSPHRASE,\r\n cert: fs.readFileSync(process.env.TLS_SERVER_CERT),\r\n ca: process.env.TLS_CA\r\n ? fs.readFileSync(process.env.TLS_CA)\r\n : undefined,\r\n requestCert: true,\r\n rejectUnauthorized: false\r\n },\r\n handler\r\n );\r\n } else {\r\n return createServer(handler);\r\n }\r\n}\r\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,iBAAA,GAAAH,OAAA;AAEA;AACO,SAASI,gBAAgBA,CAC9BC,OAAuC,EAChB;EACvB;EACA,IAAAC,yCAAuB,EAAC,CAAC;EACzB;EACA,IAAIC,OAAO,CAACC,GAAG,CAACC,cAAc,IAAIF,OAAO,CAACC,GAAG,CAACE,eAAe,EAAE;IAC7D,OAAO,IAAAC,mBAAkB,EACvB;MACEC,GAAG,EAAEC,WAAE,CAACC,YAAY,CAACP,OAAO,CAACC,GAAG,CAACC,cAAc,CAAC;MAChDM,UAAU,EAAER,OAAO,CAACC,GAAG,CAACQ,yBAAyB;MACjDC,IAAI,EAAEJ,WAAE,CAACC,YAAY,CAACP,OAAO,CAACC,GAAG,CAACE,eAAe,CAAC;MAClDQ,EAAE,EAAEX,OAAO,CAACC,GAAG,CAACW,MAAM,GAClBN,WAAE,CAACC,YAAY,CAACP,OAAO,CAACC,GAAG,CAACW,MAAM,CAAC,GACnCC,SAAS;MACbC,WAAW,EAAE,IAAI;MACjBC,kBAAkB,EAAE;IACtB,CAAC,EACDjB,OACF,CAAC;EACH,CAAC,MAAM;IACL,OAAO,IAAAkB,kBAAY,EAAClB,OAAO,CAAC;EAC9B;AACF","ignoreList":[]}
1
+ {"version":3,"file":"createHttpServer.js","names":["_fs","_interopRequireDefault","require","_http","_https","_createHttpServer","createHttpServer","handler","validateHttpEnvironment","process","env","TLS_SERVER_KEY","TLS_SERVER_CERT","createSecureServer","key","fs","readFileSync","passphrase","TLS_SERVER_KEY_PASSPHRASE","cert","ca","TLS_CA","undefined","requestCert","rejectUnauthorized","createServer"],"sources":["../../../src/utils/createHttpServer/createHttpServer.ts"],"sourcesContent":["import fs from 'fs';\nimport { createServer, RequestListener, Server } from 'http';\nimport {\n createServer as createSecureServer,\n Server as SecureServer\n} from 'https';\nimport { Application } from 'express';\nimport { validateHttpEnvironment } from './createHttpServer.validate';\n\n/** Create and configure an http/https server */\nexport function createHttpServer(\n handler?: Application | RequestListener\n): Server | SecureServer {\n // Validate the environment variables\n validateHttpEnvironment();\n // Create a https server if env var are specified\n if (process.env.TLS_SERVER_KEY && process.env.TLS_SERVER_CERT) {\n return createSecureServer(\n {\n key: fs.readFileSync(process.env.TLS_SERVER_KEY),\n passphrase: process.env.TLS_SERVER_KEY_PASSPHRASE,\n cert: fs.readFileSync(process.env.TLS_SERVER_CERT),\n ca: process.env.TLS_CA\n ? fs.readFileSync(process.env.TLS_CA)\n : undefined,\n requestCert: true,\n rejectUnauthorized: false\n },\n handler\n );\n } else {\n return createServer(handler);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,iBAAA,GAAAH,OAAA;AAEA;AACO,SAASI,gBAAgBA,CAC9BC,OAAuC,EAChB;EACvB;EACA,IAAAC,yCAAuB,EAAC,CAAC;EACzB;EACA,IAAIC,OAAO,CAACC,GAAG,CAACC,cAAc,IAAIF,OAAO,CAACC,GAAG,CAACE,eAAe,EAAE;IAC7D,OAAO,IAAAC,mBAAkB,EACvB;MACEC,GAAG,EAAEC,WAAE,CAACC,YAAY,CAACP,OAAO,CAACC,GAAG,CAACC,cAAc,CAAC;MAChDM,UAAU,EAAER,OAAO,CAACC,GAAG,CAACQ,yBAAyB;MACjDC,IAAI,EAAEJ,WAAE,CAACC,YAAY,CAACP,OAAO,CAACC,GAAG,CAACE,eAAe,CAAC;MAClDQ,EAAE,EAAEX,OAAO,CAACC,GAAG,CAACW,MAAM,GAClBN,WAAE,CAACC,YAAY,CAACP,OAAO,CAACC,GAAG,CAACW,MAAM,CAAC,GACnCC,SAAS;MACbC,WAAW,EAAE,IAAI;MACjBC,kBAAkB,EAAE;IACtB,CAAC,EACDjB,OACF,CAAC;EACH,CAAC,MAAM;IACL,OAAO,IAAAkB,kBAAY,EAAClB,OAAO,CAAC;EAC9B;AACF","ignoreList":[]}