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
package/babel.config.json CHANGED
@@ -1,35 +1,34 @@
1
- {
2
- "presets": [
3
- "@babel/preset-typescript",
4
- [
5
- "@babel/preset-env",
6
- {
7
- "targets": { "node": 20 },
8
- "useBuiltIns": "entry",
9
- "corejs": 3
10
- }
11
- ]
12
- ],
13
- "plugins": [
14
- [
15
- "module-resolver",
16
- {
17
- "root": "src",
18
- "alias": {
19
- "test": "test"
20
- },
21
- "extensions": [".js", ".ts"]
22
- }
23
- ],
24
- ["@babel/plugin-proposal-decorators", { "legacy": true }],
25
- ["@babel/plugin-proposal-class-properties", { "loose": true }],
26
- "@babel/plugin-transform-class-properties",
27
- "@babel/plugin-transform-classes",
28
- "@babel/plugin-transform-runtime"
29
- ],
30
- "env": {
31
- "test": {
32
- "plugins": ["istanbul"]
33
- }
34
- }
35
- }
1
+ {
2
+ "presets": [
3
+ "@babel/preset-typescript",
4
+ [
5
+ "@babel/preset-env",
6
+ {
7
+ "targets": { "node": 20 },
8
+ "useBuiltIns": "entry",
9
+ "corejs": 3
10
+ }
11
+ ]
12
+ ],
13
+ "plugins": [
14
+ [
15
+ "module-resolver",
16
+ {
17
+ "root": "src",
18
+ "alias": {
19
+ "test": "test"
20
+ },
21
+ "extensions": [".js", ".ts"]
22
+ }
23
+ ],
24
+ ["@babel/plugin-proposal-decorators", { "legacy": true }],
25
+ "@babel/plugin-transform-class-properties",
26
+ "@babel/plugin-transform-classes",
27
+ "@babel/plugin-transform-runtime"
28
+ ],
29
+ "env": {
30
+ "test": {
31
+ "plugins": ["istanbul"]
32
+ }
33
+ }
34
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"DebeziumEvent.js","names":["DebeziumEvent","exports"],"sources":["../../src/const/DebeziumEvent.ts"],"sourcesContent":["/** Debezium event types */\r\nexport enum DebeziumEvent {\r\n Create = 'c',\r\n Update = 'u',\r\n Delete = 'd'\r\n}\r\n"],"mappings":";;;;;;AAAA;AAAA,IACYA,aAAa,GAAAC,OAAA,CAAAD,aAAA,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"DebeziumEvent.js","names":["DebeziumEvent","exports"],"sources":["../../src/const/DebeziumEvent.ts"],"sourcesContent":["/** Debezium event types */\nexport enum DebeziumEvent {\n Create = 'c',\n Update = 'u',\n Delete = 'd'\n}\n"],"mappings":";;;;;;AAAA;AAAA,IACYA,aAAa,GAAAC,OAAA,CAAAD,aAAA,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"LogSeverity.js","names":["LogSeverity","exports"],"sources":["../../src/const/LogSeverity.ts"],"sourcesContent":["export enum LogSeverity {\r\n DEBUG = 'DEBUG',\r\n INFO = 'INFO',\r\n WARNING = 'WARNING',\r\n ERROR = 'ERROR',\r\n CRITICAL = 'CRITICAL'\r\n}\r\n"],"mappings":";;;;;;IAAYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"LogSeverity.js","names":["LogSeverity","exports"],"sources":["../../src/const/LogSeverity.ts"],"sourcesContent":["export enum LogSeverity {\n DEBUG = 'DEBUG',\n INFO = 'INFO',\n WARNING = 'WARNING',\n ERROR = 'ERROR',\n CRITICAL = 'CRITICAL'\n}\n"],"mappings":";;;;;;IAAYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_mime","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_metrics","_DebeziumEvent","_LogSeverity","_tokenIssuer"],"sources":["../../src/const/index.ts"],"sourcesContent":["export * from './mime';\r\nexport * from './metrics';\r\nexport * from './DebeziumEvent';\r\nexport * from './LogSeverity';\r\nexport * from './tokenIssuer';\r\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,QAAA,GAAAT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AA,CAAAD,GAAA,MAAAQ,YAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,YAAA,CAAAR,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_mime","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_metrics","_DebeziumEvent","_LogSeverity","_tokenIssuer"],"sources":["../../src/const/index.ts"],"sourcesContent":["export * from './mime';\nexport * from './metrics';\nexport * from './DebeziumEvent';\nexport * from './LogSeverity';\nexport * from './tokenIssuer';\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,QAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,QAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,QAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,QAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,cAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,cAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,cAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,cAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,YAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,YAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,YAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,YAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,YAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,YAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,YAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,YAAA,CAAAR,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.js","names":["_promClient","require","instanceRegistry","exports","Registry","serviceRegistry"],"sources":["../../src/const/metrics.ts"],"sourcesContent":["import { Registry } from 'prom-client';\r\n\r\n// Registry for metrics that apply to this specific instance of the service\r\nexport const instanceRegistry = new Registry();\r\n// Registry for metrics that apply to the service as a whole\r\nexport const serviceRegistry = new Registry();\r\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA;AACO,MAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,IAAIE,oBAAQ,CAAC,CAAC;AAC9C;AACO,MAAMC,eAAe,GAAAF,OAAA,CAAAE,eAAA,GAAG,IAAID,oBAAQ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"metrics.js","names":["_promClient","require","instanceRegistry","exports","Registry","serviceRegistry"],"sources":["../../src/const/metrics.ts"],"sourcesContent":["import { Registry } from 'prom-client';\n\n// Registry for metrics that apply to this specific instance of the service\nexport const instanceRegistry = new Registry();\n// Registry for metrics that apply to the service as a whole\nexport const serviceRegistry = new Registry();\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA;AACO,MAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,IAAIE,oBAAQ,CAAC,CAAC;AAC9C;AACO,MAAMC,eAAe,GAAAF,OAAA,CAAAE,eAAA,GAAG,IAAID,oBAAQ,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"mime.js","names":["IMAGE_BASIC_MIME","exports","IMAGE_MIME","AUDIO_MIME","VIDEO_MIME","PDF_MIME","WORD_MIME","EXCEL_MIME","POWERPOINT_MIME","OFFICE_MIME"],"sources":["../../src/const/mime.ts"],"sourcesContent":["export const IMAGE_BASIC_MIME = ['image/jpeg', 'image/png'];\r\n\r\nexport const IMAGE_MIME = [...IMAGE_BASIC_MIME, 'image/gif', 'image/bmp'];\r\n\r\nexport const AUDIO_MIME = [\r\n 'audio/aac',\r\n 'audio/mpeg',\r\n 'audio/wave',\r\n 'audio/wav'\r\n];\r\n\r\nexport const VIDEO_MIME = [\r\n 'video/mpeg',\r\n 'video/mp4',\r\n 'video/3gpp',\r\n 'video/3gp2'\r\n];\r\n\r\nexport const PDF_MIME = ['application/pdf'];\r\n\r\nexport const WORD_MIME = [\r\n 'application/msword',\r\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'\r\n];\r\n\r\nexport const EXCEL_MIME = [\r\n 'application/vnd.ms-excel',\r\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\r\n];\r\n\r\nexport const POWERPOINT_MIME = [\r\n 'application/vnd.ms-powerpoint',\r\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\r\n 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'\r\n];\r\n\r\nexport const OFFICE_MIME = [...WORD_MIME, ...EXCEL_MIME, ...POWERPOINT_MIME];\r\n"],"mappings":";;;;;;AAAO,MAAMA,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC;AAEpD,MAAME,UAAU,GAAAD,OAAA,CAAAC,UAAA,GAAG,CAAC,GAAGF,gBAAgB,EAAE,WAAW,EAAE,WAAW,CAAC;AAElE,MAAMG,UAAU,GAAAF,OAAA,CAAAE,UAAA,GAAG,CACxB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,CACZ;AAEM,MAAMC,UAAU,GAAAH,OAAA,CAAAG,UAAA,GAAG,CACxB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,CACb;AAEM,MAAMC,QAAQ,GAAAJ,OAAA,CAAAI,QAAA,GAAG,CAAC,iBAAiB,CAAC;AAEpC,MAAMC,SAAS,GAAAL,OAAA,CAAAK,SAAA,GAAG,CACvB,oBAAoB,EACpB,yEAAyE,CAC1E;AAEM,MAAMC,UAAU,GAAAN,OAAA,CAAAM,UAAA,GAAG,CACxB,0BAA0B,EAC1B,mEAAmE,CACpE;AAEM,MAAMC,eAAe,GAAAP,OAAA,CAAAO,eAAA,GAAG,CAC7B,+BAA+B,EAC/B,2EAA2E,EAC3E,wEAAwE,CACzE;AAEM,MAAMC,WAAW,GAAAR,OAAA,CAAAQ,WAAA,GAAG,CAAC,GAAGH,SAAS,EAAE,GAAGC,UAAU,EAAE,GAAGC,eAAe,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"mime.js","names":["IMAGE_BASIC_MIME","exports","IMAGE_MIME","AUDIO_MIME","VIDEO_MIME","PDF_MIME","WORD_MIME","EXCEL_MIME","POWERPOINT_MIME","OFFICE_MIME"],"sources":["../../src/const/mime.ts"],"sourcesContent":["export const IMAGE_BASIC_MIME = ['image/jpeg', 'image/png'];\n\nexport const IMAGE_MIME = [...IMAGE_BASIC_MIME, 'image/gif', 'image/bmp'];\n\nexport const AUDIO_MIME = [\n 'audio/aac',\n 'audio/mpeg',\n 'audio/wave',\n 'audio/wav'\n];\n\nexport const VIDEO_MIME = [\n 'video/mpeg',\n 'video/mp4',\n 'video/3gpp',\n 'video/3gp2'\n];\n\nexport const PDF_MIME = ['application/pdf'];\n\nexport const WORD_MIME = [\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'\n];\n\nexport const EXCEL_MIME = [\n 'application/vnd.ms-excel',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n];\n\nexport const POWERPOINT_MIME = [\n 'application/vnd.ms-powerpoint',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'\n];\n\nexport const OFFICE_MIME = [...WORD_MIME, ...EXCEL_MIME, ...POWERPOINT_MIME];\n"],"mappings":";;;;;;AAAO,MAAMA,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC;AAEpD,MAAME,UAAU,GAAAD,OAAA,CAAAC,UAAA,GAAG,CAAC,GAAGF,gBAAgB,EAAE,WAAW,EAAE,WAAW,CAAC;AAElE,MAAMG,UAAU,GAAAF,OAAA,CAAAE,UAAA,GAAG,CACxB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,CACZ;AAEM,MAAMC,UAAU,GAAAH,OAAA,CAAAG,UAAA,GAAG,CACxB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,CACb;AAEM,MAAMC,QAAQ,GAAAJ,OAAA,CAAAI,QAAA,GAAG,CAAC,iBAAiB,CAAC;AAEpC,MAAMC,SAAS,GAAAL,OAAA,CAAAK,SAAA,GAAG,CACvB,oBAAoB,EACpB,yEAAyE,CAC1E;AAEM,MAAMC,UAAU,GAAAN,OAAA,CAAAM,UAAA,GAAG,CACxB,0BAA0B,EAC1B,mEAAmE,CACpE;AAEM,MAAMC,eAAe,GAAAP,OAAA,CAAAO,eAAA,GAAG,CAC7B,+BAA+B,EAC/B,2EAA2E,EAC3E,wEAAwE,CACzE;AAEM,MAAMC,WAAW,GAAAR,OAAA,CAAAQ,WAAA,GAAG,CAAC,GAAGH,SAAS,EAAE,GAAGC,UAAU,EAAE,GAAGC,eAAe,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"tokenIssuer.js","names":["TokenIssuer","exports","TOKEN_ISSUERS","Object","values"],"sources":["../../src/const/tokenIssuer.ts"],"sourcesContent":["/** Enum to identify access tokens JWT issuers */\r\nexport enum TokenIssuer {\r\n /** For tokens issued by the auth service */\r\n AUTH_SERVICE,\r\n /** For tokens issued by the admin API */\r\n ADMIN_API\r\n}\r\n\r\nexport const TOKEN_ISSUERS = Object.values(TokenIssuer);\r\n"],"mappings":";;;;;;AAAA;AAAA,IACYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAOhB,MAAME,aAAa,GAAAD,OAAA,CAAAC,aAAA,GAAGC,MAAM,CAACC,MAAM,CAACJ,WAAW,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"tokenIssuer.js","names":["TokenIssuer","exports","TOKEN_ISSUERS","Object","values"],"sources":["../../src/const/tokenIssuer.ts"],"sourcesContent":["/** Enum to identify access tokens JWT issuers */\nexport enum TokenIssuer {\n /** For tokens issued by the auth service */\n AUTH_SERVICE,\n /** For tokens issued by the admin API */\n ADMIN_API\n}\n\nexport const TOKEN_ISSUERS = Object.values(TokenIssuer);\n"],"mappings":";;;;;;AAAA;AAAA,IACYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAOhB,MAAME,aAAa,GAAAD,OAAA,CAAAC,aAAA,GAAGC,MAAM,CAACC,MAAM,CAACJ,WAAW,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"20241030121500-create-sequelize-meta-table.js","names":["_sequelize","require","up","queryInterface","createTable","id","type","DataTypes","INTEGER","autoIncrement","primaryKey","name","STRING","allowNull","version","charset","collate","down","dropTable"],"sources":["../../../src/db/migrations/20241030121500-create-sequelize-meta-table.ts"],"sourcesContent":["import { QueryInterface, DataTypes } from 'sequelize';\r\n\r\nexport async function up(queryInterface: QueryInterface): Promise<void> {\r\n await queryInterface.createTable(\r\n 'SequelizeMeta',\r\n {\r\n id: {\r\n type: DataTypes.INTEGER,\r\n autoIncrement: true,\r\n primaryKey: true\r\n },\r\n name: {\r\n type: DataTypes.STRING,\r\n allowNull: false\r\n },\r\n version: {\r\n type: DataTypes.STRING,\r\n allowNull: false\r\n }\r\n },\r\n {\r\n charset: 'utf8mb4',\r\n collate: 'utf8mb4_unicode_ci' // Change this to a valid collation\r\n }\r\n );\r\n}\r\nexport async function down(queryInterface: QueryInterface): Promise<void> {\r\n await queryInterface.dropTable('SequelizeMeta');\r\n}\r\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEO,eAAeC,EAAEA,CAACC,cAA8B,EAAiB;EACtE,MAAMA,cAAc,CAACC,WAAW,CAC9B,eAAe,EACf;IACEC,EAAE,EAAE;MACFC,IAAI,EAAEC,oBAAS,CAACC,OAAO;MACvBC,aAAa,EAAE,IAAI;MACnBC,UAAU,EAAE;IACd,CAAC;IACDC,IAAI,EAAE;MACJL,IAAI,EAAEC,oBAAS,CAACK,MAAM;MACtBC,SAAS,EAAE;IACb,CAAC;IACDC,OAAO,EAAE;MACPR,IAAI,EAAEC,oBAAS,CAACK,MAAM;MACtBC,SAAS,EAAE;IACb;EACF,CAAC,EACD;IACEE,OAAO,EAAE,SAAS;IAClBC,OAAO,EAAE,oBAAoB,CAAC;EAChC,CACF,CAAC;AACH;AACO,eAAeC,IAAIA,CAACd,cAA8B,EAAiB;EACxE,MAAMA,cAAc,CAACe,SAAS,CAAC,eAAe,CAAC;AACjD","ignoreList":[]}
1
+ {"version":3,"file":"20241030121500-create-sequelize-meta-table.js","names":["_sequelize","require","up","queryInterface","createTable","id","type","DataTypes","INTEGER","autoIncrement","primaryKey","name","STRING","allowNull","version","charset","collate","down","dropTable"],"sources":["../../../src/db/migrations/20241030121500-create-sequelize-meta-table.ts"],"sourcesContent":["import { QueryInterface, DataTypes } from 'sequelize';\n\nexport async function up(queryInterface: QueryInterface): Promise<void> {\n await queryInterface.createTable(\n 'SequelizeMeta',\n {\n id: {\n type: DataTypes.INTEGER,\n autoIncrement: true,\n primaryKey: true\n },\n name: {\n type: DataTypes.STRING,\n allowNull: false\n },\n version: {\n type: DataTypes.STRING,\n allowNull: false\n }\n },\n {\n charset: 'utf8mb4',\n collate: 'utf8mb4_unicode_ci' // Change this to a valid collation\n }\n );\n}\nexport async function down(queryInterface: QueryInterface): Promise<void> {\n await queryInterface.dropTable('SequelizeMeta');\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEO,eAAeC,EAAEA,CAACC,cAA8B,EAAiB;EACtE,MAAMA,cAAc,CAACC,WAAW,CAC9B,eAAe,EACf;IACEC,EAAE,EAAE;MACFC,IAAI,EAAEC,oBAAS,CAACC,OAAO;MACvBC,aAAa,EAAE,IAAI;MACnBC,UAAU,EAAE;IACd,CAAC;IACDC,IAAI,EAAE;MACJL,IAAI,EAAEC,oBAAS,CAACK,MAAM;MACtBC,SAAS,EAAE;IACb,CAAC;IACDC,OAAO,EAAE;MACPR,IAAI,EAAEC,oBAAS,CAACK,MAAM;MACtBC,SAAS,EAAE;IACb;EACF,CAAC,EACD;IACEE,OAAO,EAAE,SAAS;IAClBC,OAAO,EAAE,oBAAoB,CAAC;EAChC,CACF,CAAC;AACH;AACO,eAAeC,IAAIA,CAACd,cAA8B,EAAiB;EACxE,MAAMA,cAAc,CAACe,SAAS,CAAC,eAAe,CAAC;AACjD","ignoreList":[]}
@@ -11,6 +11,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
11
11
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
12
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
13
13
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
15
  var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
15
16
  var _initializerWarningHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerWarningHelper"));
16
17
  var _sequelizeTypescript = require("sequelize-typescript");
@@ -1 +1 @@
1
- {"version":3,"file":"SequelizeMeta.js","names":["_sequelizeTypescript","require","_dec","_dec2","_class","_class2","_descriptor","_descriptor2","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","SequelizeMeta","exports","Column","type","DataType","STRING","allowNull","Table","_Model","args","_this","_classCallCheck2","_initializerDefineProperty2","_inherits2","_createClass2","Model","_applyDecoratedDescriptor2","configurable","enumerable","writable","initializer"],"sources":["../../../src/db/models/SequelizeMeta.ts"],"sourcesContent":["import { Table, Column, Model, DataType } from 'sequelize-typescript';\r\n\r\n@Table\r\nexport class SequelizeMeta extends Model {\r\n @Column({\r\n type: DataType.STRING,\r\n allowNull: false\r\n })\r\n name!: string;\r\n\r\n @Column({\r\n type: DataType.STRING,\r\n allowNull: false\r\n })\r\n version!: string;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAAsE,IAAAC,IAAA,EAAAC,KAAA,EAAAC,MAAA,EAAAC,OAAA,EAAAC,WAAA,EAAAC,YAAA;AAAA,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,OAAA,CAAAC,SAAA,CAAAP,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAS,WAAA,IAAAR,CAAA,CAAAS,KAAA,CAAAV,CAAA,EAAAE,CAAA;AAAA,SAAAI,0BAAA,cAAAN,CAAA,IAAAW,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAP,OAAA,CAAAC,SAAA,CAAAG,OAAA,iCAAAX,CAAA,aAAAM,yBAAA,YAAAA,CAAA,aAAAN,CAAA;AAAA,IAGzDe,aAAa,GAAAC,OAAA,CAAAD,aAAA,IAAAtB,IAAA,GACvB,IAAAwB,2BAAM,EAAC;EACNC,IAAI,EAAEC,6BAAQ,CAACC,MAAM;EACrBC,SAAS,EAAE;AACb,CAAC,CAAC,EAAA3B,KAAA,GAGD,IAAAuB,2BAAM,EAAC;EACNC,IAAI,EAAEC,6BAAQ,CAACC,MAAM;EACrBC,SAAS,EAAE;AACb,CAAC,CAAC,MAXHC,0BAAK,EAAA3B,MAAA,IAAAC,OAAA,0BAAA2B,MAAA;EAAA,SAAAR,cAAA,GAAAS,IAAA;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAtB,OAAA,QAAAW,aAAA;IAAAU,KAAA,GAAA1B,UAAA,OAAAgB,aAAA,MAAAS,IAAA;IAAA,IAAAG,2BAAA,CAAAvB,OAAA,EAAAqB,KAAA,UAAA5B,WAAA,EAAA4B,KAAA;IAAA,IAAAE,2BAAA,CAAAvB,OAAA,EAAAqB,KAAA,aAAA3B,YAAA,EAAA2B,KAAA;IAAA,OAAAA,KAAA;EAAA;EAAA,IAAAG,UAAA,CAAAxB,OAAA,EAAAW,aAAA,EAAAQ,MAAA;EAAA,WAAAM,aAAA,CAAAzB,OAAA,EAAAW,aAAA;AAAA,EAC6Be,0BAAK,GAAAjC,WAAA,OAAAkC,0BAAA,CAAA3B,OAAA,EAAAR,OAAA,CAAAgB,SAAA,WAAAnB,IAAA;EAAAuC,YAAA;EAAAC,UAAA;EAAAC,QAAA;EAAAC,WAAA;AAAA,IAAArC,YAAA,OAAAiC,0BAAA,CAAA3B,OAAA,EAAAR,OAAA,CAAAgB,SAAA,cAAAlB,KAAA;EAAAsC,YAAA;EAAAC,UAAA;EAAAC,QAAA;EAAAC,WAAA;AAAA,IAAAvC,OAAA,MAAAD,MAAA","ignoreList":[]}
1
+ {"version":3,"file":"SequelizeMeta.js","names":["_sequelizeTypescript","require","_dec","_dec2","_class","_class2","_descriptor","_descriptor2","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","SequelizeMeta","exports","Column","type","DataType","STRING","allowNull","Table","_Model","args","_this","_classCallCheck2","_initializerDefineProperty2","_inherits2","_createClass2","Model","_applyDecoratedDescriptor2","configurable","enumerable","writable","initializer"],"sources":["../../../src/db/models/SequelizeMeta.ts"],"sourcesContent":["import { Table, Column, Model, DataType } from 'sequelize-typescript';\n\n@Table\nexport class SequelizeMeta extends Model {\n @Column({\n type: DataType.STRING,\n allowNull: false\n })\n name!: string;\n\n @Column({\n type: DataType.STRING,\n allowNull: false\n })\n version!: string;\n}\n"],"mappings":";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2BAAA,CAAAvB,OAAA,EAAAqB,KAAA,aAAA3B,YAAA,EAAA2B,KAAA;IAAA,OAAAA,KAAA;EAAA;EAAA,IAAAG,UAAA,CAAAxB,OAAA,EAAAW,aAAA,EAAAQ,MAAA;EAAA,WAAAM,aAAA,CAAAzB,OAAA,EAAAW,aAAA;AAAA,EAC6Be,0BAAK,GAAAjC,WAAA,OAAAkC,0BAAA,CAAA3B,OAAA,EAAAR,OAAA,CAAAgB,SAAA,WAAAnB,IAAA;EAAAuC,YAAA;EAAAC,UAAA;EAAAC,QAAA;EAAAC,WAAA;AAAA,IAAArC,YAAA,OAAAiC,0BAAA,CAAA3B,OAAA,EAAAR,OAAA,CAAAgB,SAAA,cAAAlB,KAAA;EAAAsC,YAAA;EAAAC,UAAA;EAAAC,QAAA;EAAAC,WAAA;AAAA,IAAAvC,OAAA,MAAAD,MAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_SequelizeMeta","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/db/models/index.ts"],"sourcesContent":["export * from './SequelizeMeta';\r\n\r\n"],"mappings":";;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,cAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,cAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,cAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_SequelizeMeta","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/db/models/index.ts"],"sourcesContent":["export * from './SequelizeMeta';\n\n"],"mappings":";;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,cAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,cAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,cAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -17,8 +17,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
17
17
  /** Elastic search client */
18
18
  let client;
19
19
  const ElasticSearch = exports.ElasticSearch = {
20
- /**
21
- * Init function that should be called on server startup to establish the connection
20
+ /**
21
+ * Init function that should be called on server startup to establish the connection
22
22
  */
23
23
  async init() {
24
24
  (0, _checkEnvironment.checkEnvironment)({
@@ -44,9 +44,9 @@ const ElasticSearch = exports.ElasticSearch = {
44
44
  await this.migrate();
45
45
  _LifecycleController.LifecycleController.register(this);
46
46
  },
47
- /**
48
- * Migration function called during the init process
49
- * Manages the database structure
47
+ /**
48
+ * Migration function called during the init process
49
+ * Manages the database structure
50
50
  */
51
51
  async migrate() {
52
52
  if (!client) throw new _EngineError.EngineError('ElasticSearch was not initialized');
@@ -104,8 +104,8 @@ const ElasticSearch = exports.ElasticSearch = {
104
104
  }
105
105
  });
106
106
  },
107
- /**
108
- * Shutdown function that should be called on server stop to close the connection
107
+ /**
108
+ * Shutdown function that should be called on server stop to close the connection
109
109
  */
110
110
  async shutdown() {
111
111
  if (client) await client.close();
@@ -1 +1 @@
1
- {"version":3,"file":"ElasticSearch.js","names":["_fs","require","_path","_interopRequireDefault","_elasticsearch","_EngineError","_LifecycleController","_utils","_checkEnvironment","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","client","ElasticSearch","exports","init","checkEnvironment","ELASTIC_SEARCH_HOST","envAssert","isString","ELASTIC_SEARCH_USERNAME","ELASTIC_SEARCH_PASSWORD","ELASTIC_SEARCH_MIGRATION_PATH","process","env","EngineError","message","Client","node","auth","username","password","NODE_ENV","indices","delete","index","migrate","LifecycleController","register","migrationPath","path","resolve","files","readdirSync","indexExists","exists","ran","file","hits","total","search","body","query","match","tot","value","push","migration","specifier","Promise","then","s","error","reportError","exit","create","id","ranAt","Date","reportInfo","length","data","shutdown","close"],"sources":["../../../src/entities/ElasticSearch/ElasticSearch.ts"],"sourcesContent":["import { readdirSync } from 'fs';\r\nimport path from 'path';\r\nimport { Client } from '@elastic/elasticsearch';\r\nimport { ElasticSearchMigration } from './ElasticSearch.types';\r\nimport { EngineError } from 'entities/EngineError';\r\nimport { LifecycleController } from 'entities/LifecycleController';\r\nimport { envAssert, reportError, reportInfo } from 'utils';\r\nimport { checkEnvironment } from 'utils/checkEnvironment';\r\n\r\n/** Elastic search client */\r\nlet client: undefined | Client;\r\n\r\nexport const ElasticSearch = {\r\n /**\r\n * Init function that should be called on server startup to establish the connection\r\n */\r\n async init(): Promise<void> {\r\n checkEnvironment({\r\n ELASTIC_SEARCH_HOST: envAssert.isString(),\r\n ELASTIC_SEARCH_USERNAME: envAssert.isString(),\r\n ELASTIC_SEARCH_PASSWORD: envAssert.isString(),\r\n ELASTIC_SEARCH_MIGRATION_PATH: envAssert.isString()\r\n });\r\n\r\n if (!process.env.ELASTIC_SEARCH_HOST)\r\n throw new EngineError({\r\n message: 'ElasticSearch Hosts not set in environment'\r\n });\r\n\r\n client = new Client({\r\n node: process.env.ELASTIC_SEARCH_HOST,\r\n auth: {\r\n username: process.env.ELASTIC_SEARCH_USERNAME as string,\r\n password: process.env.ELASTIC_SEARCH_PASSWORD as string\r\n }\r\n });\r\n // In test environment flush the database before running migrations\r\n if (process.env.NODE_ENV === 'test')\r\n await client.indices.delete({ index: '*' });\r\n await this.migrate();\r\n LifecycleController.register(this);\r\n },\r\n\r\n /**\r\n * Migration function called during the init process\r\n * Manages the database structure\r\n */\r\n async migrate(): Promise<void> {\r\n if (!client) throw new EngineError('ElasticSearch was not initialized');\r\n const migrationPath = path.resolve(\r\n process.env.ELASTIC_SEARCH_MIGRATION_PATH as string\r\n );\r\n const files = readdirSync(`${migrationPath}`);\r\n const indexExists = await client.indices.exists({\r\n index: 'migrations'\r\n });\r\n const ran = [];\r\n for (const file of files) {\r\n if (indexExists) {\r\n const {\r\n hits: { total }\r\n } = await client.search({\r\n index: 'migrations',\r\n body: { query: { match: { file } } }\r\n });\r\n let tot = 0;\r\n if (typeof total === 'number') {\r\n tot = total;\r\n } else {\r\n tot = total?.value ?? 0;\r\n }\r\n if (tot > 0) continue;\r\n }\r\n ran.push(file);\r\n const migration = (await import(\r\n `${migrationPath}/${file}`\r\n )) as ElasticSearchMigration;\r\n try {\r\n await migration.migrate(client);\r\n } catch (error) {\r\n reportError(error);\r\n process.exit(1);\r\n }\r\n\r\n await client.create({\r\n index: 'migrations',\r\n id: file,\r\n body: { file, ranAt: new Date() }\r\n });\r\n }\r\n reportInfo({\r\n message: `ElasticSearch: ran ${ran.length} migrations`,\r\n data: { files: ran }\r\n });\r\n },\r\n\r\n /**\r\n * Shutdown function that should be called on server stop to close the connection\r\n */\r\n async shutdown(): Promise<void> {\r\n if (client) await client.close();\r\n }\r\n};\r\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AAEA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAP,OAAA;AAA0D,SAAAQ,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAA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AI;IACrB,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;EACE,MAAM0B,QAAQA,CAAA,EAAkB;IAC9B,IAAI5D,MAAM,EAAE,MAAMA,MAAM,CAAC6D,KAAK,CAAC,CAAC;EAClC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ElasticSearch.js","names":["_fs","require","_path","_interopRequireDefault","_elasticsearch","_EngineError","_LifecycleController","_utils","_checkEnvironment","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","client","ElasticSearch","exports","init","checkEnvironment","ELASTIC_SEARCH_HOST","envAssert","isString","ELASTIC_SEARCH_USERNAME","ELASTIC_SEARCH_PASSWORD","ELASTIC_SEARCH_MIGRATION_PATH","process","env","EngineError","message","Client","node","auth","username","password","NODE_ENV","indices","delete","index","migrate","LifecycleController","register","migrationPath","path","resolve","files","readdirSync","indexExists","exists","ran","file","hits","total","search","body","query","match","tot","value","push","migration","specifier","Promise","then","s","error","reportError","exit","create","id","ranAt","Date","reportInfo","length","data","shutdown","close"],"sources":["../../../src/entities/ElasticSearch/ElasticSearch.ts"],"sourcesContent":["import { readdirSync } from 'fs';\nimport path from 'path';\nimport { Client } from '@elastic/elasticsearch';\nimport { ElasticSearchMigration } from './ElasticSearch.types';\nimport { EngineError } from 'entities/EngineError';\nimport { LifecycleController } from 'entities/LifecycleController';\nimport { envAssert, reportError, reportInfo } from 'utils';\nimport { checkEnvironment } from 'utils/checkEnvironment';\n\n/** Elastic search client */\nlet client: undefined | Client;\n\nexport const ElasticSearch = {\n /**\n * Init function that should be called on server startup to establish the connection\n */\n async init(): Promise<void> {\n checkEnvironment({\n ELASTIC_SEARCH_HOST: envAssert.isString(),\n ELASTIC_SEARCH_USERNAME: envAssert.isString(),\n ELASTIC_SEARCH_PASSWORD: envAssert.isString(),\n ELASTIC_SEARCH_MIGRATION_PATH: envAssert.isString()\n });\n\n if (!process.env.ELASTIC_SEARCH_HOST)\n throw new EngineError({\n message: 'ElasticSearch Hosts not set in environment'\n });\n\n client = new Client({\n node: process.env.ELASTIC_SEARCH_HOST,\n auth: {\n username: process.env.ELASTIC_SEARCH_USERNAME as string,\n password: process.env.ELASTIC_SEARCH_PASSWORD as string\n }\n });\n // In test environment flush the database before running migrations\n if (process.env.NODE_ENV === 'test')\n await client.indices.delete({ index: '*' });\n await this.migrate();\n LifecycleController.register(this);\n },\n\n /**\n * Migration function called during the init process\n * Manages the database structure\n */\n async migrate(): Promise<void> {\n if (!client) throw new EngineError('ElasticSearch was not initialized');\n const migrationPath = path.resolve(\n process.env.ELASTIC_SEARCH_MIGRATION_PATH as string\n );\n const files = readdirSync(`${migrationPath}`);\n const indexExists = await client.indices.exists({\n index: 'migrations'\n });\n const ran = [];\n for (const file of files) {\n if (indexExists) {\n const {\n hits: { total }\n } = await client.search({\n index: 'migrations',\n body: { query: { match: { file } } }\n });\n let tot = 0;\n if (typeof total === 'number') {\n tot = total;\n } else {\n tot = total?.value ?? 0;\n }\n if (tot > 0) continue;\n }\n ran.push(file);\n const migration = (await import(\n `${migrationPath}/${file}`\n )) as ElasticSearchMigration;\n try {\n await migration.migrate(client);\n } catch (error) {\n reportError(error);\n process.exit(1);\n }\n\n await client.create({\n index: 'migrations',\n id: file,\n body: { file, ranAt: new Date() }\n });\n }\n reportInfo({\n message: `ElasticSearch: ran ${ran.length} migrations`,\n data: { files: ran }\n });\n },\n\n /**\n * Shutdown function that should be called on server stop to close the connection\n */\n async shutdown(): Promise<void> {\n if (client) await client.close();\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AAEA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAA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C,OAAO,EAAE,sBAAsBoB,GAAG,CAACwB,MAAM,aAAa;MACtDC,IAAI,EAAE;QAAE7B,KAAK,EAAEI;MAAI;IACrB,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;EACE,MAAM0B,QAAQA,CAAA,EAAkB;IAC9B,IAAI5D,MAAM,EAAE,MAAMA,MAAM,CAAC6D,KAAK,CAAC,CAAC;EAClC;AACF,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ElasticSearch.types.js","names":[],"sources":["../../../src/entities/ElasticSearch/ElasticSearch.types.ts"],"sourcesContent":["import { Client } from '@elastic/elasticsearch';\r\n\r\n/** Represents a migration that should be executed on ElasticSearch */\r\nexport interface ElasticSearchMigration {\r\n /** Migration function */\r\n migrate: (client: Client) => Promise<void>;\r\n}\r\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ElasticSearch.types.js","names":[],"sources":["../../../src/entities/ElasticSearch/ElasticSearch.types.ts"],"sourcesContent":["import { Client } from '@elastic/elasticsearch';\n\n/** Represents a migration that should be executed on ElasticSearch */\nexport interface ElasticSearchMigration {\n /** Migration function */\n migrate: (client: Client) => Promise<void>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_ElasticSearch","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_ElasticSearch2"],"sources":["../../../src/entities/ElasticSearch/index.ts"],"sourcesContent":["export * from './ElasticSearch';\r\nexport * from './ElasticSearch.types';\r\n"],"mappings":";;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,cAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,cAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,cAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,eAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,eAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,eAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,eAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_ElasticSearch","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_ElasticSearch2"],"sources":["../../../src/entities/ElasticSearch/index.ts"],"sourcesContent":["export * from './ElasticSearch';\nexport * from './ElasticSearch.types';\n"],"mappings":";;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,cAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,cAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,cAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,eAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,eAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,eAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,eAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.Endpoint = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
11
  var _EngineError = require("../EngineError");
11
12
  var _Endpoint2 = require("./Endpoint.types");
12
13
  var _const = require("../../const");
@@ -14,31 +15,31 @@ var _middleware = require("../../middleware");
14
15
  var _report = require("../../utils/report");
15
16
  const namespace = 'engine:Endpoint';
16
17
 
17
- /**
18
- * Object representing a REST endpoint served by server
18
+ /**
19
+ * Object representing a REST endpoint served by server
19
20
  */
20
21
  let Endpoint = exports.Endpoint = /*#__PURE__*/function () {
21
22
  /** Create a REST endpoint */
22
23
  function Endpoint(config) {
23
24
  (0, _classCallCheck2.default)(this, Endpoint);
24
25
  /** Path at which the endpoint is reachable */
25
- this.path = void 0;
26
+ (0, _defineProperty2.default)(this, "path", void 0);
26
27
  /** HTTP method of the endpoint */
27
- this.method = void 0;
28
+ (0, _defineProperty2.default)(this, "method", void 0);
28
29
  /** Authentication system required by this endpoint */
29
- this.authType = void 0;
30
+ (0, _defineProperty2.default)(this, "authType", void 0);
30
31
  /** Function handling the endpoint's business logic */
31
- this.handler = void 0;
32
+ (0, _defineProperty2.default)(this, "handler", void 0);
32
33
  /** Validation schema that the request must pass before reaching the handler */
33
- this.validator = void 0;
34
+ (0, _defineProperty2.default)(this, "validator", void 0);
34
35
  /** Authentication related options for this endpoint */
35
- this.authParams = void 0;
36
+ (0, _defineProperty2.default)(this, "authParams", void 0);
36
37
  /** Settings to upload files through this endpoint (this will automatically switch the expected request to be a multipart) */
37
- this.files = void 0;
38
+ (0, _defineProperty2.default)(this, "files", void 0);
38
39
  /** Express request handlers that should run on this endpoint before the business logic, they will run after the global middleware */
39
- this.middleware = void 0;
40
+ (0, _defineProperty2.default)(this, "middleware", void 0);
40
41
  /** Express error handlers that should be registered for this endpoint. they will run before the global error handler */
41
- this.errorMiddleware = void 0;
42
+ (0, _defineProperty2.default)(this, "errorMiddleware", void 0);
42
43
  (0, _report.reportDebug)({
43
44
  namespace,
44
45
  message: `Creating Endpoint [${config.method} - ${config.path}]`,
@@ -77,8 +78,8 @@ let Endpoint = exports.Endpoint = /*#__PURE__*/function () {
77
78
  if (config.errorMiddleware instanceof Array) this.errorMiddleware = config.errorMiddleware;
78
79
  }
79
80
 
80
- /**
81
- * Register the endpoint to a react app
81
+ /**
82
+ * Register the endpoint to a react app
82
83
  */
83
84
  return (0, _createClass2.default)(Endpoint, [{
84
85
  key: "register",
@@ -110,8 +111,8 @@ let Endpoint = exports.Endpoint = /*#__PURE__*/function () {
110
111
  app[this.method](this.path, ...safeMiddlewareChain.flat());
111
112
  }
112
113
 
113
- /**
114
- * Catch exceptions thrown inside of middleware and pass them properly to express
114
+ /**
115
+ * Catch exceptions thrown inside of middleware and pass them properly to express
115
116
  */
116
117
  }, {
117
118
  key: "catchExceptionForExpress",
@@ -142,8 +143,8 @@ let Endpoint = exports.Endpoint = /*#__PURE__*/function () {
142
143
  });
143
144
  }
144
145
 
145
- /**
146
- * Get the authentication middleware for a given type of authentication
146
+ /**
147
+ * Get the authentication middleware for a given type of authentication
147
148
  */
148
149
  }, {
149
150
  key: "getAuthMiddleware",
@@ -1 +1 @@
1
- {"version":3,"file":"Endpoint.js","names":["_EngineError","require","_Endpoint2","_const","_middleware","_report","namespace","Endpoint","exports","config","_classCallCheck2","default","path","method","authType","handler","validator","authParams","files","middleware","errorMiddleware","reportDebug","message","data","file","EngineError","EndpointMethods","includes","EndpointAuthTypes","Array","_createClass2","key","value","register","app","middlewareChain","requestMetrics","push","getAuthMiddleware","fileUploader","validate","safeMiddlewareChain","catchExceptionForExpress","flat","map","req","res","next","err","catch","error","reportError","type","EndpointAuthHandlers","reportInfo","severity","LogSeverity","WARNING","request","response","acceptInvalid"],"sources":["../../../src/entities/Endpoint/Endpoint.ts"],"sourcesContent":["import {\r\n RequestHandler,\r\n ErrorRequestHandler,\r\n Application,\r\n Request,\r\n Response,\r\n NextFunction\r\n} from 'express';\r\nimport { Schema } from 'express-validator';\r\nimport { EngineError } from '../EngineError';\r\nimport {\r\n EndpointOptions,\r\n EndpointAuthType,\r\n EndpointAuthTypes,\r\n EndpointMethod,\r\n EndpointMethods,\r\n EndpointAuthParams,\r\n Middleware,\r\n MiddlewareChainElement,\r\n SafeMiddleWareChain,\r\n EndpointAuthHandlers,\r\n EndpointAuthHandler,\r\n EndpointRequestType,\r\n EndpointHandler\r\n} from './Endpoint.types';\r\nimport { LogSeverity } from 'const';\r\nimport { validate, fileUploader, requestMetrics } from 'middleware';\r\nimport { FileUploaderConfig } from 'middleware/fileUploader';\r\nimport { reportDebug, reportError, reportInfo } from 'utils/report';\r\n\r\nconst namespace = 'engine:Endpoint';\r\n\r\n/**\r\n * Object representing a REST endpoint served by server\r\n */\r\nexport class Endpoint<T extends EndpointAuthType> {\r\n /** Path at which the endpoint is reachable */\r\n public readonly path: string;\r\n /** HTTP method of the endpoint */\r\n public readonly method: EndpointMethod;\r\n /** Authentication system required by this endpoint */\r\n public readonly authType: T;\r\n /** Function handling the endpoint's business logic */\r\n private handler: EndpointHandler<T>;\r\n /** Validation schema that the request must pass before reaching the handler */\r\n private validator: Schema;\r\n /** Authentication related options for this endpoint */\r\n private authParams?: EndpointAuthParams<T>;\r\n /** Settings to upload files through this endpoint (this will automatically switch the expected request to be a multipart) */\r\n private files?: Array<FileUploaderConfig>;\r\n /** Express request handlers that should run on this endpoint before the business logic, they will run after the global middleware */\r\n private middleware?: Array<Middleware<T>>;\r\n /** Express error handlers that should be registered for this endpoint. they will run before the global error handler */\r\n private errorMiddleware?: Array<ErrorRequestHandler>;\r\n\r\n /** Create a REST endpoint */\r\n public constructor(config: EndpointOptions<T>) {\r\n reportDebug({\r\n namespace,\r\n message: `Creating Endpoint [${config.method} - ${config.path}]`,\r\n data: {\r\n method: config.method,\r\n path: config.path,\r\n authType: config.authType,\r\n authParams: config.authParams,\r\n file: config.file\r\n }\r\n });\r\n\r\n if (typeof config.path !== 'string')\r\n throw new EngineError({\r\n message: 'Endpoint path was not declared as a string'\r\n });\r\n this.path = config.path;\r\n\r\n if (!EndpointMethods.includes(config.method))\r\n throw new EngineError({\r\n message: 'Endpoint method is not a valid HTTP method'\r\n });\r\n this.method = config.method;\r\n\r\n if (typeof config.handler !== 'function')\r\n throw new EngineError({ message: 'Endpoint handler is not a function' });\r\n this.handler = config.handler;\r\n\r\n if (!EndpointAuthTypes.includes(config.authType))\r\n throw new EngineError({ message: 'Endpoint auth type is not valid' });\r\n this.authType = config.authType;\r\n\r\n this.validator = config.validator;\r\n this.authParams = config.authParams;\r\n this.files = config.file ? [config.file] : config.files;\r\n\r\n // Middleware can both be function or arrays\r\n if (typeof config.middleware === 'function')\r\n this.middleware = [config.middleware];\r\n if (config.middleware instanceof Array) this.middleware = config.middleware;\r\n if (typeof config.errorMiddleware === 'function')\r\n this.errorMiddleware = [config.errorMiddleware];\r\n if (config.errorMiddleware instanceof Array)\r\n this.errorMiddleware = config.errorMiddleware;\r\n }\r\n\r\n /**\r\n * Register the endpoint to a react app\r\n */\r\n public register(app: Application): void {\r\n // First initialize the handling calculation\r\n const middlewareChain: Array<MiddlewareChainElement<T>> = [requestMetrics];\r\n // Register auth middleware\r\n middlewareChain.push(...this.getAuthMiddleware(this.authType));\r\n if (this.files) {\r\n // Register file upload\r\n // Validation is included in the file upload process as this uses multipart/form-data\r\n middlewareChain.push(fileUploader(this.files, this.validator));\r\n } else {\r\n // Register validator for regular cases\r\n middlewareChain.push(validate(this.validator));\r\n }\r\n // Register additional middleware\r\n if (this.middleware) {\r\n middlewareChain.push(...this.middleware);\r\n }\r\n // Register handler\r\n middlewareChain.push(this.handler);\r\n // Wrap middleware to await any async execution and catch any errors thrown\r\n const safeMiddlewareChain: SafeMiddleWareChain =\r\n this.catchExceptionForExpress(middlewareChain);\r\n // Register error middleware\r\n if (this.errorMiddleware) {\r\n safeMiddlewareChain.push(...this.errorMiddleware);\r\n }\r\n app[this.method](\r\n this.path,\r\n ...(safeMiddlewareChain.flat() as Array<\r\n RequestHandler | ErrorRequestHandler\r\n >)\r\n );\r\n }\r\n\r\n /**\r\n * Catch exceptions thrown inside of middleware and pass them properly to express\r\n */\r\n private catchExceptionForExpress(\r\n middlewareChain: Array<MiddlewareChainElement<T>>\r\n ): SafeMiddleWareChain {\r\n return middlewareChain.map((middleware) => {\r\n if (middleware instanceof Array) {\r\n return this.catchExceptionForExpress(middleware);\r\n }\r\n if (typeof middleware === 'function') {\r\n return (req: Request, res: Response, next: NextFunction) => {\r\n (async (): Promise<void> => {\r\n try {\r\n await middleware(req as EndpointRequestType[T], res, next);\r\n } catch (err) {\r\n next(err);\r\n }\r\n })().catch((error) => {\r\n reportError(error);\r\n });\r\n };\r\n }\r\n throw new EngineError({\r\n message: 'Middleware is not a function nor an array',\r\n data: { type: typeof middleware }\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Get the authentication middleware for a given type of authentication\r\n */\r\n private getAuthMiddleware(authType: EndpointAuthType): Array<RequestHandler> {\r\n const middlewareChain: Array<RequestHandler> = [];\r\n\r\n const handler = EndpointAuthHandlers[authType] as EndpointAuthHandler<T>;\r\n if (!handler) {\r\n reportInfo({\r\n severity: LogSeverity.WARNING,\r\n message: `Endpoint \"${this.method} - ${this.path}\" was declared with no authentication method`\r\n });\r\n return [];\r\n }\r\n\r\n const middleware = handler(this.authParams);\r\n\r\n middlewareChain.push(\r\n async (request: Request, response: Response, next: NextFunction) => {\r\n try {\r\n await middleware(request, response, next);\r\n } catch (error) {\r\n if (!this.authParams?.acceptInvalid) throw error;\r\n reportError(error);\r\n next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V,KAAK;UAChD,IAAAC,mBAAW,EAACD,KAAK,CAAC;UAClBH,IAAI,CAAC,CAAC;QACR;MACF,CACF,CAAC;MAED,OAAOZ,eAAe;IACxB;EAAC;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"Endpoint.js","names":["_EngineError","require","_Endpoint2","_const","_middleware","_report","namespace","Endpoint","exports","config","_classCallCheck2","default","_defineProperty2","reportDebug","message","method","path","data","authType","authParams","file","EngineError","EndpointMethods","includes","handler","EndpointAuthTypes","validator","files","middleware","Array","errorMiddleware","_createClass2","key","value","register","app","middlewareChain","requestMetrics","push","getAuthMiddleware","fileUploader","validate","safeMiddlewareChain","catchExceptionForExpress","flat","map","req","res","next","err","catch","error","reportError","type","EndpointAuthHandlers","reportInfo","severity","LogSeverity","WARNING","request","response","acceptInvalid"],"sources":["../../../src/entities/Endpoint/Endpoint.ts"],"sourcesContent":["import {\n RequestHandler,\n ErrorRequestHandler,\n Application,\n Request,\n Response,\n NextFunction\n} from 'express';\nimport { Schema } from 'express-validator';\nimport { EngineError } from '../EngineError';\nimport {\n EndpointOptions,\n EndpointAuthType,\n EndpointAuthTypes,\n EndpointMethod,\n EndpointMethods,\n EndpointAuthParams,\n Middleware,\n MiddlewareChainElement,\n SafeMiddleWareChain,\n EndpointAuthHandlers,\n EndpointAuthHandler,\n EndpointRequestType,\n EndpointHandler\n} from './Endpoint.types';\nimport { LogSeverity } from 'const';\nimport { validate, fileUploader, requestMetrics } from 'middleware';\nimport { FileUploaderConfig } from 'middleware/fileUploader';\nimport { reportDebug, reportError, reportInfo } from 'utils/report';\n\nconst namespace = 'engine:Endpoint';\n\n/**\n * Object representing a REST endpoint served by server\n */\nexport class Endpoint<T extends EndpointAuthType> {\n /** Path at which the endpoint is reachable */\n public readonly path: string;\n /** HTTP method of the endpoint */\n public readonly method: EndpointMethod;\n /** Authentication system required by this endpoint */\n public readonly authType: T;\n /** Function handling the endpoint's business logic */\n private handler: EndpointHandler<T>;\n /** Validation schema that the request must pass before reaching the handler */\n private validator: Schema;\n /** Authentication related options for this endpoint */\n private authParams?: EndpointAuthParams<T>;\n /** Settings to upload files through this endpoint (this will automatically switch the expected request to be a multipart) */\n private files?: Array<FileUploaderConfig>;\n /** Express request handlers that should run on this endpoint before the business logic, they will run after the global middleware */\n private middleware?: Array<Middleware<T>>;\n /** Express error handlers that should be registered for this endpoint. they will run before the global error handler */\n private errorMiddleware?: Array<ErrorRequestHandler>;\n\n /** Create a REST endpoint */\n public constructor(config: EndpointOptions<T>) {\n reportDebug({\n namespace,\n message: `Creating Endpoint [${config.method} - ${config.path}]`,\n data: {\n method: config.method,\n path: config.path,\n authType: config.authType,\n authParams: config.authParams,\n file: config.file\n }\n });\n\n if (typeof config.path !== 'string')\n throw new EngineError({\n message: 'Endpoint path was not declared as a string'\n });\n this.path = config.path;\n\n if (!EndpointMethods.includes(config.method))\n throw new EngineError({\n message: 'Endpoint method is not a valid HTTP method'\n });\n this.method = config.method;\n\n if (typeof config.handler !== 'function')\n throw new EngineError({ message: 'Endpoint handler is not a function' });\n this.handler = config.handler;\n\n if (!EndpointAuthTypes.includes(config.authType))\n throw new EngineError({ message: 'Endpoint auth type is not valid' });\n this.authType = config.authType;\n\n this.validator = config.validator;\n this.authParams = config.authParams;\n this.files = config.file ? [config.file] : config.files;\n\n // Middleware can both be function or arrays\n if (typeof config.middleware === 'function')\n this.middleware = [config.middleware];\n if (config.middleware instanceof Array) this.middleware = config.middleware;\n if (typeof config.errorMiddleware === 'function')\n this.errorMiddleware = [config.errorMiddleware];\n if (config.errorMiddleware instanceof Array)\n this.errorMiddleware = config.errorMiddleware;\n }\n\n /**\n * Register the endpoint to a react app\n */\n public register(app: Application): void {\n // First initialize the handling calculation\n const middlewareChain: Array<MiddlewareChainElement<T>> = [requestMetrics];\n // Register auth middleware\n middlewareChain.push(...this.getAuthMiddleware(this.authType));\n if (this.files) {\n // Register file upload\n // Validation is included in the file upload process as this uses multipart/form-data\n middlewareChain.push(fileUploader(this.files, this.validator));\n } else {\n // Register validator for regular cases\n middlewareChain.push(validate(this.validator));\n }\n // Register additional middleware\n if (this.middleware) {\n middlewareChain.push(...this.middleware);\n }\n // Register handler\n middlewareChain.push(this.handler);\n // Wrap middleware to await any async execution and catch any errors thrown\n const safeMiddlewareChain: SafeMiddleWareChain =\n this.catchExceptionForExpress(middlewareChain);\n // Register error middleware\n if (this.errorMiddleware) {\n safeMiddlewareChain.push(...this.errorMiddleware);\n }\n app[this.method](\n this.path,\n ...(safeMiddlewareChain.flat() as Array<\n RequestHandler | ErrorRequestHandler\n >)\n );\n }\n\n /**\n * Catch exceptions thrown inside of middleware and pass them properly to express\n */\n private catchExceptionForExpress(\n middlewareChain: Array<MiddlewareChainElement<T>>\n ): SafeMiddleWareChain {\n return middlewareChain.map((middleware) => {\n if (middleware instanceof Array) {\n return this.catchExceptionForExpress(middleware);\n }\n if (typeof middleware === 'function') {\n return (req: Request, res: Response, next: NextFunction) => {\n (async (): Promise<void> => {\n try {\n await middleware(req as EndpointRequestType[T], res, next);\n } catch (err) {\n next(err);\n }\n })().catch((error) => {\n reportError(error);\n });\n };\n }\n throw new EngineError({\n message: 'Middleware is not a function nor an array',\n data: { type: typeof middleware }\n });\n });\n }\n\n /**\n * Get the authentication middleware for a given type of authentication\n */\n private getAuthMiddleware(authType: EndpointAuthType): Array<RequestHandler> {\n const middlewareChain: Array<RequestHandler> = [];\n\n const handler = EndpointAuthHandlers[authType] as EndpointAuthHandler<T>;\n if (!handler) {\n reportInfo({\n severity: LogSeverity.WARNING,\n message: `Endpoint \"${this.method} - ${this.path}\" was declared with no authentication method`\n });\n return [];\n }\n\n const middleware = handler(this.authParams);\n\n middlewareChain.push(\n async (request: Request, response: Response, next: NextFunction) => {\n try {\n await middleware(request, response, next);\n } catch (error) {\n if (!this.authParams?.acceptInvalid) throw error;\n reportError(error);\n next();\n }\n }\n );\n\n return middlewareChain;\n }\n}\n"],"mappings":";;;;;;;;;;AASA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAA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AAE0C,aAAa,EAAE,MAAMV,KAAK;UAChD,IAAAC,mBAAW,EAACD,KAAK,CAAC;UAClBH,IAAI,CAAC,CAAC;QACR;MACF,CACF,CAAC;MAED,OAAOZ,eAAe;IACxB;EAAC;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Endpoint.types.js","names":["_middleware","require","EndpointMethod","exports","EndpointMethods","Object","values","EndpointAuthType","EndpointAuthTypes","EndpointAuthHandlers","NONE","undefined","JWT","authJwt","TLS","authTls","HMAC","authHmac","STATIC","authStatic","ADMIN","authAdmin"],"sources":["../../../src/entities/Endpoint/Endpoint.types.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport {\r\n ErrorRequestHandler,\r\n Request,\r\n Response,\r\n NextFunction,\r\n RequestHandler\r\n} from 'express';\r\nimport { ParamsDictionary } from 'express-serve-static-core';\r\nimport { Schema } from 'express-validator';\r\nimport { ParsedQs } from 'qs';\r\n\r\nimport {\r\n authJwt,\r\n authHmac,\r\n authTls,\r\n authStatic,\r\n authAdmin,\r\n FileUploaderConfig,\r\n RequestAdminProps\r\n} from 'middleware';\r\n\r\nexport enum EndpointMethod {\r\n GET = 'get',\r\n POST = 'post',\r\n PUT = 'put',\r\n PATCH = 'patch',\r\n DELETE = 'delete',\r\n HEAD = 'head',\r\n ALL = 'all'\r\n}\r\n\r\nexport const EndpointMethods = Object.values(EndpointMethod);\r\n\r\nexport enum EndpointAuthType {\r\n NONE = 'none',\r\n JWT = 'jwt',\r\n TLS = 'tls',\r\n HMAC = 'hmac',\r\n STATIC = 'static',\r\n ADMIN = 'admin'\r\n}\r\n\r\nexport const EndpointAuthTypes = Object.values(EndpointAuthType);\r\n\r\nexport type Middleware<T extends EndpointAuthType> = (\r\n request: EndpointRequestType[T],\r\n response: Response,\r\n next: NextFunction\r\n) => unknown | Promise<unknown>;\r\n\r\nexport type MiddlewareChainElement<T extends EndpointAuthType> =\r\n | Array<Middleware<T>>\r\n | Middleware<T>\r\n | any;\r\n\r\n/** Auth related parameters used with Admin authentication */\r\ninterface EndpointAuthAdminParams {\r\n /** [Admin] User permission required to use this endpoint */\r\n permission: string;\r\n}\r\n\r\n/** Auth related parameters used with HMAC authentication */\r\ninterface EndpointAuthHmacParams {\r\n /** [HMAC] Secret used for signature */\r\n secret?: string;\r\n /** [HMAC] For Github webhook, the standard differs slightly, so this option must be selected */\r\n isGithub?: boolean;\r\n}\r\n\r\n/** Auth related parameters used with mTLS authentication */\r\ninterface EndpointAuthTlsParams {\r\n /** [TLS] List oh hosts that are allowed to use the endpoint, this is compared to the claims in the certificate */\r\n whitelist?: Array<string>;\r\n}\r\n\r\n/** Mapping used to get auth specific parameters depending on the auth type used */\r\ninterface EndpointAuthSpecificParams {\r\n /** Auth parameters for no authentication */\r\n [EndpointAuthType.NONE]: any;\r\n /** Auth parameters for JWT authentication */\r\n [EndpointAuthType.JWT]: any;\r\n /** Auth parameters for mTLS authentication */\r\n [EndpointAuthType.TLS]: EndpointAuthTlsParams;\r\n /** Auth parameters for HMAC authentication */\r\n [EndpointAuthType.HMAC]: EndpointAuthHmacParams;\r\n /** Auth parameters for static authentication */\r\n [EndpointAuthType.STATIC]: any;\r\n /** Auth parameters for admin token authentication */\r\n [EndpointAuthType.ADMIN]: EndpointAuthAdminParams;\r\n}\r\n\r\nexport type EndpointAuthParams<T extends EndpointAuthType> =\r\n EndpointAuthSpecificParams[T] & {\r\n /** This will allow the business logic to run event if the authentication fails */\r\n acceptInvalid?: boolean;\r\n };\r\n\r\nexport type EndpointAuthHandler<T extends EndpointAuthType> = (\r\n options?: EndpointAuthParams<T>\r\n) => (\r\n request: Request,\r\n response: Response,\r\n next: NextFunction\r\n) => void | Promise<void>;\r\n\r\nexport const EndpointAuthHandlers = {\r\n /** Auth handler for no authentication */\r\n [EndpointAuthType.NONE]: undefined,\r\n /** Auth handler for JWT authentication */\r\n [EndpointAuthType.JWT]: authJwt,\r\n /** Auth handler for mTLS authentication */\r\n [EndpointAuthType.TLS]: authTls,\r\n /** Auth handler for HMAC authentication */\r\n [EndpointAuthType.HMAC]: authHmac,\r\n /** Auth handler for static authentication */\r\n [EndpointAuthType.STATIC]: authStatic,\r\n /** Auth handler for admin token authentication */\r\n [EndpointAuthType.ADMIN]: authAdmin\r\n};\r\n\r\nexport type EndpointHandler<T extends EndpointAuthType> = (\r\n request: EndpointRequestType[T],\r\n response: Response\r\n) => void | Promise<void>;\r\n\r\n/** Endpoint initialization options */\r\nexport interface EndpointOptions<T extends EndpointAuthType> {\r\n /** Path at which the endpoint is reachable */\r\n path: string;\r\n /** HTTP method of the endpoint */\r\n method: EndpointMethod;\r\n /** Function handling the endpoint's business logic */\r\n handler: EndpointHandler<T>;\r\n /** Validation schema that the request must pass before reaching the handler */\r\n validator: Schema;\r\n /** Authentication system required by this endpoint */\r\n authType: T;\r\n /** Authentication related options for this endpoint */\r\n authParams?: EndpointAuthParams<T>;\r\n /** @deprecated Setting to upload a file through this endpoint */\r\n file?: FileUploaderConfig;\r\n /** Settings to upload files through this endpoint (this will automatically switch the expected request to be a multipart) */\r\n files?: Array<FileUploaderConfig>;\r\n /** Express request handlers that should run on this endpoint before the business logic, they will run after the global middleware */\r\n middleware?: MiddlewareChainElement<T>;\r\n /** Express error handlers that should be registered for this endpoint. they will run before the global error handler */\r\n errorMiddleware?: ErrorRequestHandler | Array<ErrorRequestHandler>;\r\n}\r\n\r\n/** Request type when using JWT authentication */\r\nexport interface JwtRequest<\r\n P = ParamsDictionary,\r\n ResBody = any,\r\n ReqBody = any,\r\n ReqQuery = ParsedQs,\r\n Locals extends Record<string, any> = Record<string, any>\r\n> extends Request<P, ResBody, ReqBody, ReqQuery, Locals> {\r\n /** User that identified using a JWT */\r\n user: Record<string, any> | any;\r\n}\r\n\r\n/** Request type when using mTLS authentication */\r\nexport interface TlsRequest<\r\n P = ParamsDictionary,\r\n ResBody = any,\r\n ReqBody = any,\r\n ReqQuery = ParsedQs,\r\n Locals extends Record<string, any> = Record<string, any>\r\n> extends Request<P, ResBody, ReqBody, ReqQuery, Locals> {\r\n /** Host names provided by the mTLS authenticated client */\r\n hosts: Array<string>;\r\n}\r\n\r\n/** Request type when using HMAC authentication */\r\nexport interface AdminRequest<\r\n P = ParamsDictionary,\r\n ResBody = any,\r\n ReqBody = any,\r\n ReqQuery = ParsedQs,\r\n Locals extends Record<string, any> = Record<string, any>\r\n> extends Request<P, ResBody, ReqBody, ReqQuery, Locals> {\r\n /** User that identified using a JWT */\r\n admin: RequestAdminProps;\r\n}\r\n\r\n/** Mapping of request types in endpoints based on auth type used */\r\nexport interface EndpointRequestType {\r\n /** Request type for no authentication */\r\n [EndpointAuthType.NONE]: Request;\r\n /** Request type when using JWT authentication */\r\n [EndpointAuthType.JWT]: JwtRequest;\r\n /** Request type when using mTLS authentication */\r\n [EndpointAuthType.TLS]: TlsRequest;\r\n /** Request type when using HMAC authentication */\r\n [EndpointAuthType.HMAC]: Request;\r\n /** Auth handler for static authentication */\r\n [EndpointAuthType.STATIC]: Request;\r\n /** Auth handler for admin token authentication */\r\n [EndpointAuthType.ADMIN]: AdminRequest;\r\n}\r\n\r\nexport type SafeMiddleWareChain = Array<\r\n RequestHandler | ErrorRequestHandler | SafeMiddleWareChain\r\n>;\r\n"],"mappings":";;;;;;AAYA,IAAAA,WAAA,GAAAC,OAAA;AAZA;AAAA,IAsBYC,cAAc,GAAAC,OAAA,CAAAD,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAUnB,MAAME,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAGC,MAAM,CAACC,MAAM,CAACJ,cAAc,CAAC;AAAC,IAEjDK,gBAAgB,GAAAJ,OAAA,CAAAI,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AASrB,MAAMC,iBAAiB,GAAAL,OAAA,CAAAK,iBAAA,GAAGH,MAAM,CAACC,MAAM,CAACC,gBAAgB,CAAC;;AAahE;;AAMA;;AAQA;;AAMA;;AA8BO,MAAME,oBAAoB,GAAAN,OAAA,CAAAM,oBAAA,GAAG;EAClC;EACA,CAACF,gBAAgB,CAACG,IAAI,GAAGC,SAAS;EAClC;EACA,CAACJ,gBAAgB,CAACK,GAAG,GAAGC,mBAAO;EAC/B;EACA,CAACN,gBAAgB,CAACO,GAAG,GAAGC,mBAAO;EAC/B;EACA,CAACR,gBAAgB,CAACS,IAAI,GAAGC,oBAAQ;EACjC;EACA,CAACV,gBAAgB,CAACW,MAAM,GAAGC,sBAAU;EACrC;EACA,CAACZ,gBAAgB,CAACa,KAAK,GAAGC;AAC5B,CAAC;;AAOD;;AAwBA;;AAYA;;AAYA;;AAYA","ignoreList":[]}
1
+ {"version":3,"file":"Endpoint.types.js","names":["_middleware","require","EndpointMethod","exports","EndpointMethods","Object","values","EndpointAuthType","EndpointAuthTypes","EndpointAuthHandlers","NONE","undefined","JWT","authJwt","TLS","authTls","HMAC","authHmac","STATIC","authStatic","ADMIN","authAdmin"],"sources":["../../../src/entities/Endpoint/Endpoint.types.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n ErrorRequestHandler,\n Request,\n Response,\n NextFunction,\n RequestHandler\n} from 'express';\nimport { ParamsDictionary } from 'express-serve-static-core';\nimport { Schema } from 'express-validator';\nimport { ParsedQs } from 'qs';\n\nimport {\n authJwt,\n authHmac,\n authTls,\n authStatic,\n authAdmin,\n FileUploaderConfig,\n RequestAdminProps\n} from 'middleware';\n\nexport enum EndpointMethod {\n GET = 'get',\n POST = 'post',\n PUT = 'put',\n PATCH = 'patch',\n DELETE = 'delete',\n HEAD = 'head',\n ALL = 'all'\n}\n\nexport const EndpointMethods = Object.values(EndpointMethod);\n\nexport enum EndpointAuthType {\n NONE = 'none',\n JWT = 'jwt',\n TLS = 'tls',\n HMAC = 'hmac',\n STATIC = 'static',\n ADMIN = 'admin'\n}\n\nexport const EndpointAuthTypes = Object.values(EndpointAuthType);\n\nexport type Middleware<T extends EndpointAuthType> = (\n request: EndpointRequestType[T],\n response: Response,\n next: NextFunction\n) => unknown | Promise<unknown>;\n\nexport type MiddlewareChainElement<T extends EndpointAuthType> =\n | Array<Middleware<T>>\n | Middleware<T>\n | any;\n\n/** Auth related parameters used with Admin authentication */\ninterface EndpointAuthAdminParams {\n /** [Admin] User permission required to use this endpoint */\n permission: string;\n}\n\n/** Auth related parameters used with HMAC authentication */\ninterface EndpointAuthHmacParams {\n /** [HMAC] Secret used for signature */\n secret?: string;\n /** [HMAC] For Github webhook, the standard differs slightly, so this option must be selected */\n isGithub?: boolean;\n}\n\n/** Auth related parameters used with mTLS authentication */\ninterface EndpointAuthTlsParams {\n /** [TLS] List oh hosts that are allowed to use the endpoint, this is compared to the claims in the certificate */\n whitelist?: Array<string>;\n}\n\n/** Mapping used to get auth specific parameters depending on the auth type used */\ninterface EndpointAuthSpecificParams {\n /** Auth parameters for no authentication */\n [EndpointAuthType.NONE]: any;\n /** Auth parameters for JWT authentication */\n [EndpointAuthType.JWT]: any;\n /** Auth parameters for mTLS authentication */\n [EndpointAuthType.TLS]: EndpointAuthTlsParams;\n /** Auth parameters for HMAC authentication */\n [EndpointAuthType.HMAC]: EndpointAuthHmacParams;\n /** Auth parameters for static authentication */\n [EndpointAuthType.STATIC]: any;\n /** Auth parameters for admin token authentication */\n [EndpointAuthType.ADMIN]: EndpointAuthAdminParams;\n}\n\nexport type EndpointAuthParams<T extends EndpointAuthType> =\n EndpointAuthSpecificParams[T] & {\n /** This will allow the business logic to run event if the authentication fails */\n acceptInvalid?: boolean;\n };\n\nexport type EndpointAuthHandler<T extends EndpointAuthType> = (\n options?: EndpointAuthParams<T>\n) => (\n request: Request,\n response: Response,\n next: NextFunction\n) => void | Promise<void>;\n\nexport const EndpointAuthHandlers = {\n /** Auth handler for no authentication */\n [EndpointAuthType.NONE]: undefined,\n /** Auth handler for JWT authentication */\n [EndpointAuthType.JWT]: authJwt,\n /** Auth handler for mTLS authentication */\n [EndpointAuthType.TLS]: authTls,\n /** Auth handler for HMAC authentication */\n [EndpointAuthType.HMAC]: authHmac,\n /** Auth handler for static authentication */\n [EndpointAuthType.STATIC]: authStatic,\n /** Auth handler for admin token authentication */\n [EndpointAuthType.ADMIN]: authAdmin\n};\n\nexport type EndpointHandler<T extends EndpointAuthType> = (\n request: EndpointRequestType[T],\n response: Response\n) => void | Promise<void>;\n\n/** Endpoint initialization options */\nexport interface EndpointOptions<T extends EndpointAuthType> {\n /** Path at which the endpoint is reachable */\n path: string;\n /** HTTP method of the endpoint */\n method: EndpointMethod;\n /** Function handling the endpoint's business logic */\n handler: EndpointHandler<T>;\n /** Validation schema that the request must pass before reaching the handler */\n validator: Schema;\n /** Authentication system required by this endpoint */\n authType: T;\n /** Authentication related options for this endpoint */\n authParams?: EndpointAuthParams<T>;\n /** @deprecated Setting to upload a file through this endpoint */\n file?: FileUploaderConfig;\n /** Settings to upload files through this endpoint (this will automatically switch the expected request to be a multipart) */\n files?: Array<FileUploaderConfig>;\n /** Express request handlers that should run on this endpoint before the business logic, they will run after the global middleware */\n middleware?: MiddlewareChainElement<T>;\n /** Express error handlers that should be registered for this endpoint. they will run before the global error handler */\n errorMiddleware?: ErrorRequestHandler | Array<ErrorRequestHandler>;\n}\n\n/** Request type when using JWT authentication */\nexport interface JwtRequest<\n P = ParamsDictionary,\n ResBody = any,\n ReqBody = any,\n ReqQuery = ParsedQs,\n Locals extends Record<string, any> = Record<string, any>\n> extends Request<P, ResBody, ReqBody, ReqQuery, Locals> {\n /** User that identified using a JWT */\n user: Record<string, any> | any;\n}\n\n/** Request type when using mTLS authentication */\nexport interface TlsRequest<\n P = ParamsDictionary,\n ResBody = any,\n ReqBody = any,\n ReqQuery = ParsedQs,\n Locals extends Record<string, any> = Record<string, any>\n> extends Request<P, ResBody, ReqBody, ReqQuery, Locals> {\n /** Host names provided by the mTLS authenticated client */\n hosts: Array<string>;\n}\n\n/** Request type when using HMAC authentication */\nexport interface AdminRequest<\n P = ParamsDictionary,\n ResBody = any,\n ReqBody = any,\n ReqQuery = ParsedQs,\n Locals extends Record<string, any> = Record<string, any>\n> extends Request<P, ResBody, ReqBody, ReqQuery, Locals> {\n /** User that identified using a JWT */\n admin: RequestAdminProps;\n}\n\n/** Mapping of request types in endpoints based on auth type used */\nexport interface EndpointRequestType {\n /** Request type for no authentication */\n [EndpointAuthType.NONE]: Request;\n /** Request type when using JWT authentication */\n [EndpointAuthType.JWT]: JwtRequest;\n /** Request type when using mTLS authentication */\n [EndpointAuthType.TLS]: TlsRequest;\n /** Request type when using HMAC authentication */\n [EndpointAuthType.HMAC]: Request;\n /** Auth handler for static authentication */\n [EndpointAuthType.STATIC]: Request;\n /** Auth handler for admin token authentication */\n [EndpointAuthType.ADMIN]: AdminRequest;\n}\n\nexport type SafeMiddleWareChain = Array<\n RequestHandler | ErrorRequestHandler | SafeMiddleWareChain\n>;\n"],"mappings":";;;;;;AAYA,IAAAA,WAAA,GAAAC,OAAA;AAZA;AAAA,IAsBYC,cAAc,GAAAC,OAAA,CAAAD,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAUnB,MAAME,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAGC,MAAM,CAACC,MAAM,CAACJ,cAAc,CAAC;AAAC,IAEjDK,gBAAgB,GAAAJ,OAAA,CAAAI,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AASrB,MAAMC,iBAAiB,GAAAL,OAAA,CAAAK,iBAAA,GAAGH,MAAM,CAACC,MAAM,CAACC,gBAAgB,CAAC;;AAahE;;AAMA;;AAQA;;AAMA;;AA8BO,MAAME,oBAAoB,GAAAN,OAAA,CAAAM,oBAAA,GAAG;EAClC;EACA,CAACF,gBAAgB,CAACG,IAAI,GAAGC,SAAS;EAClC;EACA,CAACJ,gBAAgB,CAACK,GAAG,GAAGC,mBAAO;EAC/B;EACA,CAACN,gBAAgB,CAACO,GAAG,GAAGC,mBAAO;EAC/B;EACA,CAACR,gBAAgB,CAACS,IAAI,GAAGC,oBAAQ;EACjC;EACA,CAACV,gBAAgB,CAACW,MAAM,GAAGC,sBAAU;EACrC;EACA,CAACZ,gBAAgB,CAACa,KAAK,GAAGC;AAC5B,CAAC;;AAOD;;AAwBA;;AAYA;;AAYA;;AAYA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_Endpoint","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_Endpoint2"],"sources":["../../../src/entities/Endpoint/index.ts"],"sourcesContent":["export * from './Endpoint';\r\nexport * from './Endpoint.types';\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;AACA,IAAAK,UAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,UAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,UAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_Endpoint","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_Endpoint2"],"sources":["../../../src/entities/Endpoint/index.ts"],"sourcesContent":["export * from './Endpoint';\nexport * from './Endpoint.types';\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;AACA,IAAAK,UAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,UAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,UAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -11,11 +11,12 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
11
11
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
13
  var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
15
  var _const = require("../../const");
15
16
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
16
17
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
17
- /**
18
- * Base error type for engine related errors
18
+ /**
19
+ * Base error type for engine related errors
19
20
  */
20
21
  let EngineError = exports.EngineError = /*#__PURE__*/function (_Error) {
21
22
  /** Create an EngineError, these errors represent errors in the engine itself */
@@ -27,13 +28,13 @@ let EngineError = exports.EngineError = /*#__PURE__*/function (_Error) {
27
28
  } : config;
28
29
  _this = _callSuper(this, EngineError, [options.message]);
29
30
  /** Severity of the log entry */
30
- _this.severity = void 0;
31
+ (0, _defineProperty2.default)(_this, "severity", void 0);
31
32
  /** If this error is wrapping another one, this will contain the original error */
32
- _this.error = void 0;
33
+ (0, _defineProperty2.default)(_this, "error", void 0);
33
34
  /** Additional contextual data for debugging */
34
- _this.data = void 0;
35
+ (0, _defineProperty2.default)(_this, "data", void 0);
35
36
  /** Human readable error message sent to the client */
36
- _this.hint = void 0;
37
+ (0, _defineProperty2.default)(_this, "hint", void 0);
37
38
  _this.severity = options.severity ?? _const.LogSeverity.CRITICAL;
38
39
  _this.data = options.data;
39
40
  _this.error = options.error;
@@ -1 +1 @@
1
- {"version":3,"file":"EngineError.js","names":["_const","require","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","EngineError","exports","_Error","config","_this","_classCallCheck2","options","message","severity","error","data","hint","LogSeverity","CRITICAL","_inherits2","_createClass2","_wrapNativeSuper2","Error"],"sources":["../../../src/entities/EngineError/EngineError.ts"],"sourcesContent":["import { EngineErrorOptions } from './EngineError.types';\r\nimport { LogSeverity } from 'const';\r\n\r\n/**\r\n * Base error type for engine related errors\r\n */\r\nexport class EngineError extends Error {\r\n /** Severity of the log entry */\r\n public severity: LogSeverity;\r\n /** If this error is wrapping another one, this will contain the original error */\r\n public error?: Error;\r\n /** Additional contextual data for debugging */\r\n public data?: unknown;\r\n /** Human readable error message sent to the client */\r\n public hint?: unknown;\r\n\r\n /** Create an EngineError, these errors represent errors in the engine itself */\r\n public constructor(config: EngineErrorOptions | string) {\r\n const options: EngineErrorOptions =\r\n typeof config === 'string' ? { message: config } : config;\r\n super(options.message);\r\n\r\n this.severity = options.severity ?? LogSeverity.CRITICAL;\r\n this.data = options.data;\r\n this.error = options.error;\r\n this.hint = options.hint;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAAoC,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,OAAA,CAAAC,SAAA,CAAAP,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAS,WAAA,IAAAR,CAAA,CAAAS,KAAA,CAAAV,CAAA,EAAAE,CAAA;AAAA,SAAAI,0BAAA,cAAAN,CAAA,IAAAW,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAP,OAAA,CAAAC,SAAA,CAAAG,OAAA,iCAAAX,CAAA,aAAAM,yBAAA,YAAAA,CAAA,aAAAN,CAAA;AAEpC;AACA;AACA;AAFA,IAGae,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAAE,MAAA;EAUtB;EACA,SAAAF,YAAmBG,MAAmC,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAhB,OAAA,QAAAW,WAAA;IACtD,MAAMM,OAA2B,GAC/B,OAAOH,MAAM,KAAK,QAAQ,GAAG;MAAEI,OAAO,EAAEJ;IAAO,CAAC,GAAGA,MAAM;IAC3DC,KAAA,GAAApB,UAAA,OAAAgB,WAAA,GAAMM,OAAO,CAACC,OAAO;IAbvB;IAAAH,KAAA,CACOI,QAAQ;IACf;IAAAJ,KAAA,CACOK,KAAK;IACZ;IAAAL,KAAA,CACOM,IAAI;IACX;IAAAN,KAAA,CACOO,IAAI;IAQTP,KAAA,CAAKI,QAAQ,GAAGF,OAAO,CAACE,QAAQ,IAAII,kBAAW,CAACC,QAAQ;IACxDT,KAAA,CAAKM,IAAI,GAAGJ,OAAO,CAACI,IAAI;IACxBN,KAAA,CAAKK,KAAK,GAAGH,OAAO,CAACG,KAAK;IAC1BL,KAAA,CAAKO,IAAI,GAAGL,OAAO,CAACK,IAAI;IAAC,OAAAP,KAAA;EAC3B;EAAC,IAAAU,UAAA,CAAAzB,OAAA,EAAAW,WAAA,EAAAE,MAAA;EAAA,WAAAa,aAAA,CAAA1B,OAAA,EAAAW,WAAA;AAAA,mBAAAgB,iBAAA,CAAA3B,OAAA,EApB8B4B,KAAK","ignoreList":[]}
1
+ {"version":3,"file":"EngineError.js","names":["_const","require","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","EngineError","exports","_Error","config","_this","_classCallCheck2","options","message","_defineProperty2","severity","LogSeverity","CRITICAL","data","error","hint","_inherits2","_createClass2","_wrapNativeSuper2","Error"],"sources":["../../../src/entities/EngineError/EngineError.ts"],"sourcesContent":["import { EngineErrorOptions } from './EngineError.types';\nimport { LogSeverity } from 'const';\n\n/**\n * Base error type for engine related errors\n */\nexport class EngineError extends Error {\n /** Severity of the log entry */\n public severity: LogSeverity;\n /** If this error is wrapping another one, this will contain the original error */\n public error?: Error;\n /** Additional contextual data for debugging */\n public data?: unknown;\n /** Human readable error message sent to the client */\n public hint?: unknown;\n\n /** Create an EngineError, these errors represent errors in the engine itself */\n public constructor(config: EngineErrorOptions | string) {\n const options: EngineErrorOptions =\n typeof config === 'string' ? { message: config } : config;\n super(options.message);\n\n this.severity = options.severity ?? LogSeverity.CRITICAL;\n this.data = options.data;\n this.error = options.error;\n this.hint = options.hint;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAAoC,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,OAAA,CAAAC,SAAA,CAAAP,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAS,WAAA,IAAAR,CAAA,CAAAS,KAAA,CAAAV,CAAA,EAAAE,CAAA;AAAA,SAAAI,0BAAA,cAAAN,CAAA,IAAAW,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAP,OAAA,CAAAC,SAAA,CAAAG,OAAA,iCAAAX,CAAA,aAAAM,yBAAA,YAAAA,CAAA,aAAAN,CAAA;AAEpC;AACA;AACA;AAFA,IAGae,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAAE,MAAA;EAUtB;EACA,SAAAF,YAAmBG,MAAmC,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAhB,OAAA,QAAAW,WAAA;IACtD,MAAMM,OAA2B,GAC/B,OAAOH,MAAM,KAAK,QAAQ,GAAG;MAAEI,OAAO,EAAEJ;IAAO,CAAC,GAAGA,MAAM;IAC3DC,KAAA,GAAApB,UAAA,OAAAgB,WAAA,GAAMM,OAAO,CAACC,OAAO;IAbvB;IAAA,IAAAC,gBAAA,CAAAnB,OAAA,EAAAe,KAAA;IAEA;IAAA,IAAAI,gBAAA,CAAAnB,OAAA,EAAAe,KAAA;IAEA;IAAA,IAAAI,gBAAA,CAAAnB,OAAA,EAAAe,KAAA;IAEA;IAAA,IAAAI,gBAAA,CAAAnB,OAAA,EAAAe,KAAA;IASEA,KAAA,CAAKK,QAAQ,GAAGH,OAAO,CAACG,QAAQ,IAAIC,kBAAW,CAACC,QAAQ;IACxDP,KAAA,CAAKQ,IAAI,GAAGN,OAAO,CAACM,IAAI;IACxBR,KAAA,CAAKS,KAAK,GAAGP,OAAO,CAACO,KAAK;IAC1BT,KAAA,CAAKU,IAAI,GAAGR,OAAO,CAACQ,IAAI;IAAC,OAAAV,KAAA;EAC3B;EAAC,IAAAW,UAAA,CAAA1B,OAAA,EAAAW,WAAA,EAAAE,MAAA;EAAA,WAAAc,aAAA,CAAA3B,OAAA,EAAAW,WAAA;AAAA,mBAAAiB,iBAAA,CAAA5B,OAAA,EApB8B6B,KAAK","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"EngineError.types.js","names":[],"sources":["../../../src/entities/EngineError/EngineError.types.ts"],"sourcesContent":["import { LogSeverity } from 'const';\r\n\r\n/** EngineError initialization options */\r\nexport interface EngineErrorOptions {\r\n /** Main logged message */\r\n message: string;\r\n /** Severity of the log entry */\r\n severity?: LogSeverity;\r\n /** If this error is wrapping another one, this will contain the original error */\r\n error?: Error;\r\n /** Additional contextual data for debugging */\r\n data?: unknown;\r\n /** Human readable error message sent to the client */\r\n hint?: unknown;\r\n}\r\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"EngineError.types.js","names":[],"sources":["../../../src/entities/EngineError/EngineError.types.ts"],"sourcesContent":["import { LogSeverity } from 'const';\n\n/** EngineError initialization options */\nexport interface EngineErrorOptions {\n /** Main logged message */\n message: string;\n /** Severity of the log entry */\n severity?: LogSeverity;\n /** If this error is wrapping another one, this will contain the original error */\n error?: Error;\n /** Additional contextual data for debugging */\n data?: unknown;\n /** Human readable error message sent to the client */\n hint?: unknown;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_EngineError","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_EngineError2"],"sources":["../../../src/entities/EngineError/index.ts"],"sourcesContent":["export * from './EngineError';\r\nexport * from './EngineError.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":["_EngineError","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_EngineError2"],"sources":["../../../src/entities/EngineError/index.ts"],"sourcesContent":["export * from './EngineError';\nexport * from './EngineError.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":[]}