@rapidrest/service-core 1.0.0-rc.7 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (380) hide show
  1. package/LICENSE +382 -23
  2. package/README.md +79 -5
  3. package/dist/lib/ApiErrors.js +10 -0
  4. package/dist/lib/ApiErrors.js.map +1 -1
  5. package/dist/lib/BackgroundService.js +1 -4
  6. package/dist/lib/BackgroundService.js.map +1 -1
  7. package/dist/lib/BackgroundServiceManager.js +47 -6
  8. package/dist/lib/BackgroundServiceManager.js.map +1 -1
  9. package/dist/lib/BulkError.js +4 -0
  10. package/dist/lib/BulkError.js.map +1 -1
  11. package/dist/lib/EventListenerManager.js +53 -18
  12. package/dist/lib/EventListenerManager.js.map +1 -1
  13. package/dist/lib/NetUtils.js +1 -0
  14. package/dist/lib/NetUtils.js.map +1 -1
  15. package/dist/lib/NotificationUtils.js +27 -8
  16. package/dist/lib/NotificationUtils.js.map +1 -1
  17. package/dist/lib/ObjectFactory.js +25 -44
  18. package/dist/lib/ObjectFactory.js.map +1 -1
  19. package/dist/lib/OpenApiSpec.js +31 -11
  20. package/dist/lib/OpenApiSpec.js.map +1 -1
  21. package/dist/lib/Server.js +74 -110
  22. package/dist/lib/Server.js.map +1 -1
  23. package/dist/lib/auth/AuthMiddleware.js +11 -16
  24. package/dist/lib/auth/AuthMiddleware.js.map +1 -1
  25. package/dist/lib/auth/JWTStrategy.js +68 -17
  26. package/dist/lib/auth/JWTStrategy.js.map +1 -1
  27. package/dist/lib/auth/index.js +0 -1
  28. package/dist/lib/auth/index.js.map +1 -1
  29. package/dist/lib/database/ConnectionKinds.js +15 -0
  30. package/dist/lib/database/ConnectionKinds.js.map +1 -1
  31. package/dist/lib/database/ConnectionManager.js +140 -61
  32. package/dist/lib/database/ConnectionManager.js.map +1 -1
  33. package/dist/lib/database/MongoConnection.js +13 -3
  34. package/dist/lib/database/MongoConnection.js.map +1 -1
  35. package/dist/lib/database/MongoRepository.js +61 -15
  36. package/dist/lib/database/MongoRepository.js.map +1 -1
  37. package/dist/lib/database/MongoSchemaSync.js +3 -3
  38. package/dist/lib/database/MongoSchemaSync.js.map +1 -1
  39. package/dist/lib/database/NamingUtils.js +3 -2
  40. package/dist/lib/database/NamingUtils.js.map +1 -1
  41. package/dist/lib/database/RedisCache.js +64 -0
  42. package/dist/lib/database/RedisCache.js.map +1 -0
  43. package/dist/lib/database/TypeOrmSupport.js +53 -13
  44. package/dist/lib/database/TypeOrmSupport.js.map +1 -1
  45. package/dist/lib/database/index.js +1 -0
  46. package/dist/lib/database/index.js.map +1 -1
  47. package/dist/lib/decorators/DatabaseDecorators.js +264 -20
  48. package/dist/lib/decorators/DatabaseDecorators.js.map +1 -1
  49. package/dist/lib/decorators/DocDecorators.js +30 -9
  50. package/dist/lib/decorators/DocDecorators.js.map +1 -1
  51. package/dist/lib/decorators/EventDecorators.js +1 -0
  52. package/dist/lib/decorators/EventDecorators.js.map +1 -1
  53. package/dist/lib/decorators/ModelDecorators.js +39 -23
  54. package/dist/lib/decorators/ModelDecorators.js.map +1 -1
  55. package/dist/lib/decorators/PersistenceDecorators.js +4 -3
  56. package/dist/lib/decorators/PersistenceDecorators.js.map +1 -1
  57. package/dist/lib/decorators/RouteDecorators.js +139 -36
  58. package/dist/lib/decorators/RouteDecorators.js.map +1 -1
  59. package/dist/lib/http/IWebSocketShim.js +2 -0
  60. package/dist/lib/http/IWebSocketShim.js.map +1 -0
  61. package/dist/lib/http/MiddlewareChain.js +167 -0
  62. package/dist/lib/http/MiddlewareChain.js.map +1 -0
  63. package/dist/lib/http/RuntimeDetect.js +9 -0
  64. package/dist/lib/http/RuntimeDetect.js.map +1 -0
  65. package/dist/lib/http/bun/BunAdapters.js +326 -0
  66. package/dist/lib/http/bun/BunAdapters.js.map +1 -0
  67. package/dist/lib/http/bun/BunRouter.js +391 -0
  68. package/dist/lib/http/bun/BunRouter.js.map +1 -0
  69. package/dist/lib/http/bun/BunWebSocket.js +49 -0
  70. package/dist/lib/http/bun/BunWebSocket.js.map +1 -0
  71. package/dist/lib/http/index.js +16 -3
  72. package/dist/lib/http/index.js.map +1 -1
  73. package/dist/lib/http/session/RedisSessionStore.js +30 -0
  74. package/dist/lib/http/session/RedisSessionStore.js.map +1 -0
  75. package/dist/lib/http/session/SessionManager.js +113 -0
  76. package/dist/lib/http/session/SessionManager.js.map +1 -0
  77. package/dist/lib/http/session/SessionStore.js +6 -0
  78. package/dist/lib/http/session/SessionStore.js.map +1 -0
  79. package/dist/lib/http/session/sessionMiddleware.js +42 -0
  80. package/dist/lib/http/session/sessionMiddleware.js.map +1 -0
  81. package/dist/lib/http/types.js +0 -3
  82. package/dist/lib/http/types.js.map +1 -1
  83. package/dist/lib/http/uWS/Adapters.js +421 -0
  84. package/dist/lib/http/uWS/Adapters.js.map +1 -0
  85. package/dist/lib/http/{Router.js → uWS/Router.js} +73 -173
  86. package/dist/lib/http/uWS/Router.js.map +1 -0
  87. package/dist/lib/http/{WebSocket.js → uWS/WebSocket.js} +4 -1
  88. package/dist/lib/http/uWS/WebSocket.js.map +1 -0
  89. package/dist/lib/models/BaseEntity.js +2 -1
  90. package/dist/lib/models/BaseEntity.js.map +1 -1
  91. package/dist/lib/models/BaseMongoEntity.js +2 -2
  92. package/dist/lib/models/BaseMongoEntity.js.map +1 -1
  93. package/dist/lib/models/ModelUtils.js +248 -101
  94. package/dist/lib/models/ModelUtils.js.map +1 -1
  95. package/dist/lib/models/RecoverableBaseEntity.js +6 -1
  96. package/dist/lib/models/RecoverableBaseEntity.js.map +1 -1
  97. package/dist/lib/models/RecoverableBaseMongoEntity.js +1 -0
  98. package/dist/lib/models/RecoverableBaseMongoEntity.js.map +1 -1
  99. package/dist/lib/models/RepoUtils.js +641 -203
  100. package/dist/lib/models/RepoUtils.js.map +1 -1
  101. package/dist/lib/models/SimpleEntity.js +1 -0
  102. package/dist/lib/models/SimpleEntity.js.map +1 -1
  103. package/dist/lib/models/SimpleMongoEntity.js +2 -1
  104. package/dist/lib/models/SimpleMongoEntity.js.map +1 -1
  105. package/dist/lib/models/StatusExtraData.js +4 -0
  106. package/dist/lib/models/StatusExtraData.js.map +1 -1
  107. package/dist/lib/routes/{AdminRoute.js → BaseAdminRoute.js} +98 -80
  108. package/dist/lib/routes/BaseAdminRoute.js.map +1 -0
  109. package/dist/lib/routes/{MetricsRoute.js → BaseMetricsRoute.js} +29 -15
  110. package/dist/lib/routes/BaseMetricsRoute.js.map +1 -0
  111. package/dist/lib/routes/{OpenAPIRoute.js → BaseOpenAPIRoute.js} +32 -32
  112. package/dist/lib/routes/BaseOpenAPIRoute.js.map +1 -0
  113. package/dist/lib/routes/BasePushRoute.js +305 -0
  114. package/dist/lib/routes/BasePushRoute.js.map +1 -0
  115. package/dist/lib/routes/BaseStaticRoute.js +153 -0
  116. package/dist/lib/routes/BaseStaticRoute.js.map +1 -0
  117. package/dist/lib/routes/BaseStatusRoute.js +80 -0
  118. package/dist/lib/routes/BaseStatusRoute.js.map +1 -0
  119. package/dist/lib/routes/CRUDRoute.js +284 -0
  120. package/dist/lib/routes/CRUDRoute.js.map +1 -0
  121. package/dist/lib/routes/ModelRoute.js +84 -57
  122. package/dist/lib/routes/ModelRoute.js.map +1 -1
  123. package/dist/lib/routes/RouteUtils.js +108 -20
  124. package/dist/lib/routes/RouteUtils.js.map +1 -1
  125. package/dist/lib/routes/index.js +7 -4
  126. package/dist/lib/routes/index.js.map +1 -1
  127. package/dist/lib/security/ACLUtils.js +297 -170
  128. package/dist/lib/security/ACLUtils.js.map +1 -1
  129. package/dist/lib/security/AccessControlList.js +18 -10
  130. package/dist/lib/security/AccessControlList.js.map +1 -1
  131. package/dist/lib/security/AccessControlListMongo.js +19 -68
  132. package/dist/lib/security/AccessControlListMongo.js.map +1 -1
  133. package/dist/lib/security/AccessControlListSQL.js +21 -70
  134. package/dist/lib/security/AccessControlListSQL.js.map +1 -1
  135. package/dist/lib/security/BaseACLRoute.js +239 -0
  136. package/dist/lib/security/BaseACLRoute.js.map +1 -0
  137. package/dist/lib/security/index.js +3 -0
  138. package/dist/lib/security/index.js.map +1 -1
  139. package/dist/lib/test/request.js +62 -5
  140. package/dist/lib/test/request.js.map +1 -1
  141. package/dist/lib/test/requestws.js +34 -10
  142. package/dist/lib/test/requestws.js.map +1 -1
  143. package/dist/types/ApiErrors.d.ts +8 -2
  144. package/dist/types/BackgroundService.d.ts +0 -5
  145. package/dist/types/BackgroundServiceManager.d.ts +2 -1
  146. package/dist/types/EventListenerManager.d.ts +7 -6
  147. package/dist/types/NotificationUtils.d.ts +5 -3
  148. package/dist/types/OpenApiSpec.d.ts +2 -2
  149. package/dist/types/Server.d.ts +28 -10
  150. package/dist/types/auth/AuthMiddleware.d.ts +3 -3
  151. package/dist/types/auth/AuthStrategy.d.ts +10 -7
  152. package/dist/types/auth/JWTStrategy.d.ts +6 -4
  153. package/dist/types/auth/index.d.ts +0 -1
  154. package/dist/types/database/ConnectionKinds.d.ts +7 -0
  155. package/dist/types/database/ConnectionManager.d.ts +29 -4
  156. package/dist/types/database/MongoConnection.d.ts +16 -4
  157. package/dist/types/database/MongoRepository.d.ts +32 -11
  158. package/dist/types/database/RedisCache.d.ts +23 -0
  159. package/dist/types/database/TypeOrmSupport.d.ts +4 -4
  160. package/dist/types/database/index.d.ts +1 -0
  161. package/dist/types/decorators/DatabaseDecorators.d.ts +139 -8
  162. package/dist/types/decorators/DocDecorators.d.ts +11 -2
  163. package/dist/types/decorators/ModelDecorators.d.ts +12 -5
  164. package/dist/types/decorators/PersistenceDecorators.d.ts +11 -4
  165. package/dist/types/decorators/RouteDecorators.d.ts +36 -6
  166. package/dist/types/http/IWebSocketShim.d.ts +11 -0
  167. package/dist/types/http/MiddlewareChain.d.ts +47 -0
  168. package/dist/types/http/RuntimeDetect.d.ts +2 -0
  169. package/dist/types/http/bun/BunAdapters.d.ts +139 -0
  170. package/dist/types/http/bun/BunRouter.d.ts +79 -0
  171. package/dist/types/http/bun/BunWebSocket.d.ts +35 -0
  172. package/dist/types/http/index.d.ts +16 -6
  173. package/dist/types/http/session/RedisSessionStore.d.ts +15 -0
  174. package/dist/types/http/session/SessionManager.d.ts +35 -0
  175. package/dist/types/http/session/SessionStore.d.ts +12 -0
  176. package/dist/types/http/session/sessionMiddleware.d.ts +10 -0
  177. package/dist/types/http/types.d.ts +42 -3
  178. package/dist/types/http/uWS/Adapters.d.ts +129 -0
  179. package/dist/types/http/{Router.d.ts → uWS/Router.d.ts} +14 -38
  180. package/dist/types/http/{WebSocket.d.ts → uWS/WebSocket.d.ts} +6 -5
  181. package/dist/types/models/BaseEntity.d.ts +1 -1
  182. package/dist/types/models/ModelUtils.d.ts +47 -14
  183. package/dist/types/models/RecoverableBaseEntity.d.ts +3 -1
  184. package/dist/types/models/RepoUtils.d.ts +84 -14
  185. package/dist/types/routes/BaseAdminRoute.d.ts +65 -0
  186. package/dist/types/routes/BaseMetricsRoute.d.ts +37 -0
  187. package/dist/types/routes/BaseOpenAPIRoute.d.ts +33 -0
  188. package/dist/types/routes/BasePushRoute.d.ts +53 -0
  189. package/dist/types/routes/BaseStaticRoute.d.ts +44 -0
  190. package/dist/types/routes/BaseStatusRoute.d.ts +37 -0
  191. package/dist/types/routes/CRUDRoute.d.ts +57 -0
  192. package/dist/types/routes/ModelRoute.d.ts +39 -36
  193. package/dist/types/routes/RouteUtils.d.ts +19 -0
  194. package/dist/types/routes/index.d.ts +7 -4
  195. package/dist/types/security/ACLUtils.d.ts +94 -18
  196. package/dist/types/security/AccessControlList.d.ts +37 -59
  197. package/dist/types/security/AccessControlListMongo.d.ts +3 -8
  198. package/dist/types/security/AccessControlListSQL.d.ts +3 -8
  199. package/dist/types/security/BaseACLRoute.d.ts +73 -0
  200. package/dist/types/security/index.d.ts +3 -0
  201. package/dist/types/test/request.d.ts +18 -1
  202. package/package.json +135 -129
  203. package/tsconfig.export.json +17 -0
  204. package/dist/lib/auth/BasicStrategy.js +0 -113
  205. package/dist/lib/auth/BasicStrategy.js.map +0 -1
  206. package/dist/lib/http/Adapters.js +0 -241
  207. package/dist/lib/http/Adapters.js.map +0 -1
  208. package/dist/lib/http/Router.js.map +0 -1
  209. package/dist/lib/http/WebSocket.js.map +0 -1
  210. package/dist/lib/routes/AdminRoute.js.map +0 -1
  211. package/dist/lib/routes/MetricsRoute.js.map +0 -1
  212. package/dist/lib/routes/OpenAPIRoute.js.map +0 -1
  213. package/dist/lib/routes/StatusRoute.js +0 -55
  214. package/dist/lib/routes/StatusRoute.js.map +0 -1
  215. package/dist/lib/security/ACLRouteMongo.js +0 -194
  216. package/dist/lib/security/ACLRouteMongo.js.map +0 -1
  217. package/dist/lib/security/ACLRouteSQL.js +0 -193
  218. package/dist/lib/security/ACLRouteSQL.js.map +0 -1
  219. package/dist/types/auth/BasicStrategy.d.ts +0 -37
  220. package/dist/types/http/Adapters.d.ts +0 -68
  221. package/dist/types/routes/AdminRoute.d.ts +0 -47
  222. package/dist/types/routes/MetricsRoute.d.ts +0 -15
  223. package/dist/types/routes/OpenAPIRoute.d.ts +0 -17
  224. package/dist/types/routes/StatusRoute.d.ts +0 -11
  225. package/dist/types/security/ACLRouteMongo.d.ts +0 -19
  226. package/dist/types/security/ACLRouteSQL.d.ts +0 -19
  227. package/docs/Makefile +0 -20
  228. package/docs/conf.py +0 -58
  229. package/docs/index.rst +0 -17
  230. package/docs/make.bat +0 -35
  231. package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/README.md +0 -13
  232. package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/MongoRepository.md +0 -25
  233. package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/RedisConnection.md +0 -25
  234. package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/Repository.md +0 -25
  235. package/docs/reference/@rapidrest/namespaces/DocDecorators/README.md +0 -23
  236. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Default.md +0 -25
  237. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Description.md +0 -25
  238. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Document.md +0 -25
  239. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Example.md +0 -25
  240. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Format.md +0 -25
  241. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Returns.md +0 -28
  242. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Summary.md +0 -25
  243. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Tags.md +0 -25
  244. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/TypeInfo.md +0 -28
  245. package/docs/reference/@rapidrest/namespaces/DocDecorators/interfaces/DocumentsData.md +0 -57
  246. package/docs/reference/@rapidrest/namespaces/EventDecorators/README.md +0 -12
  247. package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/EventListener.md +0 -17
  248. package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/OnEvent.md +0 -26
  249. package/docs/reference/@rapidrest/namespaces/ModelDecorators/README.md +0 -26
  250. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Cache.md +0 -25
  251. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/ChildEntity.md +0 -18
  252. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/DataStore.md +0 -25
  253. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Identifier.md +0 -27
  254. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Protect.md +0 -35
  255. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Reference.md +0 -25
  256. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Shard.md +0 -27
  257. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/TrackChanges.md +0 -26
  258. package/docs/reference/@rapidrest/namespaces/ModelDecorators/interfaces/PendingTypeOrmColumn.md +0 -45
  259. package/docs/reference/@rapidrest/namespaces/ModelDecorators/variables/pendingTypeOrmColumns.md +0 -14
  260. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/README.md +0 -27
  261. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Column.md +0 -25
  262. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Entity.md +0 -25
  263. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Index.md +0 -119
  264. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/PrimaryColumn.md +0 -25
  265. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Unique.md +0 -68
  266. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getColumnMetadata.md +0 -26
  267. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getEntityName.md +0 -26
  268. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getIndexMetadata.md +0 -27
  269. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/CollationOptions.md +0 -79
  270. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnInfo.md +0 -41
  271. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnOptions.md +0 -51
  272. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/EntityOptions.md +0 -32
  273. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexInfo.md +0 -41
  274. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexOptions.md +0 -61
  275. package/docs/reference/@rapidrest/namespaces/RouteDecorators/README.md +0 -36
  276. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/After.md +0 -26
  277. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Auth.md +0 -33
  278. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/AuthResult.md +0 -31
  279. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Before.md +0 -25
  280. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/ContentType.md +0 -25
  281. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Delete.md +0 -25
  282. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Get.md +0 -25
  283. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Head.md +0 -25
  284. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Header.md +0 -25
  285. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Method.md +0 -31
  286. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Model.md +0 -25
  287. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Options.md +0 -25
  288. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Param.md +0 -26
  289. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Patch.md +0 -25
  290. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Post.md +0 -25
  291. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Protect.md +0 -31
  292. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Put.md +0 -25
  293. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Query.md +0 -26
  294. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Request.md +0 -31
  295. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/RequiresRole.md +0 -26
  296. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Response.md +0 -31
  297. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Route.md +0 -25
  298. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Socket.md +0 -33
  299. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/User.md +0 -31
  300. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Validate.md +0 -25
  301. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/WebSocket.md +0 -25
  302. package/docs/reference/README.md +0 -20
  303. package/docs/reference/classes/ACLUtils.md +0 -263
  304. package/docs/reference/classes/AdminRoute.md +0 -51
  305. package/docs/reference/classes/AuthMiddleware.md +0 -173
  306. package/docs/reference/classes/BackgroundService.md +0 -117
  307. package/docs/reference/classes/BackgroundServiceManager.md +0 -172
  308. package/docs/reference/classes/BaseEntity.md +0 -82
  309. package/docs/reference/classes/BaseMongoEntity.md +0 -107
  310. package/docs/reference/classes/BasicStrategy.md +0 -131
  311. package/docs/reference/classes/BasicStrategyOptions.md +0 -115
  312. package/docs/reference/classes/BulkError.md +0 -271
  313. package/docs/reference/classes/ConnectionManager.md +0 -75
  314. package/docs/reference/classes/EventListenerManager.md +0 -88
  315. package/docs/reference/classes/HttpRouter.md +0 -343
  316. package/docs/reference/classes/JWTStrategy.md +0 -100
  317. package/docs/reference/classes/JWTStrategyOptions.md +0 -97
  318. package/docs/reference/classes/MetricsRoute.md +0 -27
  319. package/docs/reference/classes/ModelRoute.md +0 -527
  320. package/docs/reference/classes/ModelUtils.md +0 -446
  321. package/docs/reference/classes/MongoConnection.md +0 -218
  322. package/docs/reference/classes/MongoRepository.md +0 -390
  323. package/docs/reference/classes/MongoSchemaSync.md +0 -97
  324. package/docs/reference/classes/NetUtils.md +0 -90
  325. package/docs/reference/classes/NotificationUtils.md +0 -77
  326. package/docs/reference/classes/ObjectFactory.md +0 -336
  327. package/docs/reference/classes/OpenAPIRoute.md +0 -77
  328. package/docs/reference/classes/OpenApiSpec.md +0 -892
  329. package/docs/reference/classes/RecoverableBaseEntity.md +0 -114
  330. package/docs/reference/classes/RecoverableBaseMongoEntity.md +0 -124
  331. package/docs/reference/classes/RedisTransport.md +0 -2202
  332. package/docs/reference/classes/RepoUtils.md +0 -482
  333. package/docs/reference/classes/RouteUtils.md +0 -191
  334. package/docs/reference/classes/Server.md +0 -408
  335. package/docs/reference/classes/SimpleEntity.md +0 -48
  336. package/docs/reference/classes/SimpleMongoEntity.md +0 -66
  337. package/docs/reference/classes/StatusExtraData.md +0 -57
  338. package/docs/reference/classes/StatusRoute.md +0 -26
  339. package/docs/reference/classes/UWSRequest.md +0 -226
  340. package/docs/reference/classes/UWSResponse.md +0 -257
  341. package/docs/reference/classes/UWSWebSocketShim.md +0 -958
  342. package/docs/reference/enumerations/ACLAction.md +0 -63
  343. package/docs/reference/enumerations/ApiErrorMessages.md +0 -123
  344. package/docs/reference/enumerations/ApiErrors.md +0 -123
  345. package/docs/reference/functions/createWebSocketStream.md +0 -27
  346. package/docs/reference/functions/isSqlDataSource.md +0 -26
  347. package/docs/reference/functions/readBody.md +0 -29
  348. package/docs/reference/functions/resolveCollectionName.md +0 -33
  349. package/docs/reference/functions/runChain.md +0 -40
  350. package/docs/reference/functions/snakeCase.md +0 -28
  351. package/docs/reference/globals.md +0 -106
  352. package/docs/reference/interfaces/ACLRecord.md +0 -96
  353. package/docs/reference/interfaces/AccessControlList.md +0 -76
  354. package/docs/reference/interfaces/AuthResult.md +0 -55
  355. package/docs/reference/interfaces/AuthStrategy.md +0 -95
  356. package/docs/reference/interfaces/CreateRequestOptions.md +0 -121
  357. package/docs/reference/interfaces/DeleteRequestOptions.md +0 -137
  358. package/docs/reference/interfaces/FindRequestOptions.md +0 -133
  359. package/docs/reference/interfaces/HttpRequest.md +0 -147
  360. package/docs/reference/interfaces/HttpResponse.md +0 -164
  361. package/docs/reference/interfaces/JWTAuthResult.md +0 -84
  362. package/docs/reference/interfaces/RepoCreateOptions.md +0 -95
  363. package/docs/reference/interfaces/RepoDeleteOptions.md +0 -105
  364. package/docs/reference/interfaces/RepoFindOptions.md +0 -125
  365. package/docs/reference/interfaces/RepoOperationOptions.md +0 -69
  366. package/docs/reference/interfaces/RepoUpdateOptions.md +0 -101
  367. package/docs/reference/interfaces/RequestOptions.md +0 -112
  368. package/docs/reference/interfaces/RequestWS.md +0 -225
  369. package/docs/reference/interfaces/TruncateRequestOptions.md +0 -161
  370. package/docs/reference/interfaces/UpdateRequestOptions.md +0 -139
  371. package/docs/reference/type-aliases/ErrorHandler.md +0 -35
  372. package/docs/reference/type-aliases/NextFunction.md +0 -23
  373. package/docs/reference/type-aliases/OneOrMany.md +0 -19
  374. package/docs/reference/type-aliases/OneOrNull.md +0 -19
  375. package/docs/reference/type-aliases/PartialBaseEntity.md +0 -17
  376. package/docs/reference/type-aliases/PartialSimpleEntity.md +0 -17
  377. package/docs/reference/type-aliases/RequestHandler.md +0 -31
  378. package/docs/reference/type-aliases/UpdateObject.md +0 -19
  379. package/docs/reference/type-aliases/WsUpgradeAuth.md +0 -27
  380. package/docs/reference/type-aliases/WsUpgradeAuthResult.md +0 -47
@@ -0,0 +1,6 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
3
+ // SPDX-License-Identifier: MPL-2.0
4
+ ///////////////////////////////////////////////////////////////////////////////
5
+ export {};
6
+ //# sourceMappingURL=SessionStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionStore.js","sourceRoot":"","sources":["../../../../src/http/session/SessionStore.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,mCAAmC;AACnC,+EAA+E"}
@@ -0,0 +1,42 @@
1
+ /** Builds the `Set-Cookie` header value for a newly-created session ID. */
2
+ function buildSessionCookie(mgr, sessionId) {
3
+ const parts = [
4
+ `${mgr.cookieName}=${mgr.signId(sessionId)}`,
5
+ `Path=${mgr.cookiePath}`,
6
+ `Max-Age=${mgr.ttlSeconds}`,
7
+ `SameSite=${mgr.cookieSameSite}`,
8
+ "HttpOnly",
9
+ ];
10
+ if (mgr.cookieSecure)
11
+ parts.push("Secure");
12
+ return parts.join("; ");
13
+ }
14
+ /**
15
+ * Builds a global, framework-agnostic session middleware backed by the given `SessionManager`.
16
+ * Lazily loads-or-creates `req.session` and persists any mutations back to the store once the
17
+ * response finishes. Cheap for requests that never touch sessions: no store round-trip unless a
18
+ * valid session cookie was actually sent, and no `Set-Cookie`/store write for sessions that end up
19
+ * empty.
20
+ */
21
+ export function createSessionMiddleware(mgr) {
22
+ return async (req, res, next) => {
23
+ const raw = req.cookies?.[mgr.cookieName];
24
+ const verifiedId = raw ? mgr.verifyId(raw) : undefined;
25
+ let sessionId = verifiedId;
26
+ let data = sessionId ? await mgr.load(sessionId) : undefined;
27
+ if (!sessionId || !data) {
28
+ sessionId = mgr.generateId();
29
+ data = {};
30
+ res.appendHeader("Set-Cookie", buildSessionCookie(mgr, sessionId));
31
+ }
32
+ req.session = data;
33
+ const finalSessionId = sessionId;
34
+ res.onFinish(async () => {
35
+ if (req.session && Object.keys(req.session).length > 0) {
36
+ await mgr.save(finalSessionId, req.session);
37
+ }
38
+ });
39
+ next();
40
+ };
41
+ }
42
+ //# sourceMappingURL=sessionMiddleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionMiddleware.js","sourceRoot":"","sources":["../../../../src/http/session/sessionMiddleware.ts"],"names":[],"mappings":"AAOA,2EAA2E;AAC3E,SAAS,kBAAkB,CAAC,GAAmB,EAAE,SAAiB;IAC9D,MAAM,KAAK,GAAG;QACV,GAAG,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC5C,QAAQ,GAAG,CAAC,UAAU,EAAE;QACxB,WAAW,GAAG,CAAC,UAAU,EAAE;QAC3B,YAAY,GAAG,CAAC,cAAc,EAAE;QAChC,UAAU;KACb,CAAC;IACF,IAAI,GAAG,CAAC,YAAY;QAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAmB;IACvD,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC5B,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC1C,MAAM,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEvD,IAAI,SAAS,GAAG,UAAU,CAAC;QAC3B,IAAI,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE7D,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,EAAE,CAAC;YACtB,SAAS,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;YAC7B,IAAI,GAAG,EAAE,CAAC;YACV,GAAG,CAAC,YAAY,CAAC,YAAY,EAAE,kBAAkB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;QACvE,CAAC;QAED,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;QAEnB,MAAM,cAAc,GAAG,SAAS,CAAC;QACjC,GAAG,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE;YACpB,IAAI,GAAG,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrD,MAAM,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YAChD,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,EAAE,CAAC;IACX,CAAC,CAAC;AACN,CAAC"}
@@ -1,5 +1,2 @@
1
- ///////////////////////////////////////////////////////////////////////////////
2
- // Copyright (C) 2020-2026 Jean-Philippe Steinmetz. All rights reserved.
3
- ///////////////////////////////////////////////////////////////////////////////
4
1
  export {};
5
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/http/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,wEAAwE;AACxE,+EAA+E"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/http/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,421 @@
1
+ import { ApiErrorMessages, ApiErrors } from "../../ApiErrors.js";
2
+ /** Parses a `cookie` header string into a key/value map. */
3
+ export function parseCookies(cookieHeader) {
4
+ const result = {};
5
+ if (!cookieHeader)
6
+ return result;
7
+ for (const part of cookieHeader.split(";")) {
8
+ const idx = part.indexOf("=");
9
+ if (idx < 0)
10
+ continue;
11
+ const key = part.slice(0, idx).trim();
12
+ const val = part.slice(idx + 1).trim();
13
+ try {
14
+ result[key] = decodeURIComponent(val);
15
+ }
16
+ catch {
17
+ // Malformed percent-encoding (e.g. a bare "%") — fall back to the raw value rather than
18
+ // letting the throw escape into the caller, which for the uWS request path happens before
19
+ // any try/catch and would otherwise crash the process (no global unhandledRejection handler
20
+ // is registered anywhere in this package).
21
+ result[key] = val;
22
+ }
23
+ }
24
+ return result;
25
+ }
26
+ /** Parses a URL query string (without leading `?`) into a key/value map. */
27
+ export function parseQueryString(qs) {
28
+ const result = {};
29
+ if (!qs)
30
+ return result;
31
+ for (const part of qs.split("&")) {
32
+ const idx = part.indexOf("=");
33
+ if (idx < 0) {
34
+ let key;
35
+ try {
36
+ key = decodeURIComponent(part);
37
+ }
38
+ catch {
39
+ key = part;
40
+ }
41
+ result[key] = "";
42
+ continue;
43
+ }
44
+ let key;
45
+ let val;
46
+ try {
47
+ key = decodeURIComponent(part.slice(0, idx));
48
+ val = decodeURIComponent(part.slice(idx + 1));
49
+ }
50
+ catch {
51
+ key = part.slice(0, idx);
52
+ val = part.slice(idx + 1);
53
+ }
54
+ if (key in result) {
55
+ const existing = result[key];
56
+ result[key] = Array.isArray(existing) ? [...existing, val] : [existing, val];
57
+ }
58
+ else {
59
+ result[key] = val;
60
+ }
61
+ }
62
+ return result;
63
+ }
64
+ /**
65
+ * Parses a raw request body Buffer according to its content-type header. Shared by both the
66
+ * uWS-backed and Bun-backed HTTP adapters so body-parsing rules stay in one place:
67
+ * `application/json` is parsed (falling back to the raw string on parse failure),
68
+ * `application/x-www-form-urlencoded` is parsed into a plain object, and anything else is
69
+ * returned as the raw Buffer. Returns `undefined` for an empty body.
70
+ */
71
+ export function parseBodyByContentType(raw, contentType) {
72
+ if (raw.length === 0)
73
+ return undefined;
74
+ const ct = contentType.toLowerCase();
75
+ if (ct.includes("application/json")) {
76
+ try {
77
+ return JSON.parse(raw.toString("utf8"));
78
+ }
79
+ catch {
80
+ return raw.toString("utf8");
81
+ }
82
+ }
83
+ else if (ct.includes("application/x-www-form-urlencoded")) {
84
+ return Object.fromEntries(new URLSearchParams(raw.toString("utf8")).entries());
85
+ }
86
+ else {
87
+ return raw;
88
+ }
89
+ }
90
+ /**
91
+ * Adapts a uWS `HttpRequest` to the framework-agnostic `HttpRequest` interface.
92
+ *
93
+ * IMPORTANT: uWS HttpRequest is stack-allocated and only valid during the synchronous portion of
94
+ * the handler. All request data MUST be captured in the constructor before any `await`.
95
+ */
96
+ export class UWSRequest {
97
+ constructor(uwsReq, remoteAddress) {
98
+ this.params = {};
99
+ this.body = undefined;
100
+ this.signedCookies = {};
101
+ // Capture all uWS request data synchronously — req becomes invalid after first await
102
+ this.method = uwsReq.getMethod().toUpperCase();
103
+ const rawUrl = uwsReq.getUrl();
104
+ this.url = rawUrl;
105
+ this.path = rawUrl;
106
+ // Capture all headers
107
+ const headers = {};
108
+ uwsReq.forEach((key, value) => {
109
+ headers[key.toLowerCase()] = value;
110
+ });
111
+ this.headers = headers;
112
+ // Parse cookies from the cookie header
113
+ this.cookies = parseCookies(headers["cookie"] || "");
114
+ // Parse query string
115
+ this.query = parseQueryString(uwsReq.getQuery());
116
+ // Remote address for IP utilities
117
+ this.socket = { remoteAddress };
118
+ }
119
+ }
120
+ /**
121
+ * Adapts a uWS `HttpResponse` to the framework-agnostic `HttpResponse` interface.
122
+ *
123
+ * Buffers headers and status code until the first write. Tracks abort state to safely
124
+ * skip writes on aborted connections. All uWS writes are wrapped in `res.cork()` for
125
+ * optimal performance.
126
+ */
127
+ export class UWSResponse {
128
+ constructor(uwsRes) {
129
+ this._statusCode = 200;
130
+ this._headers = new Map();
131
+ this._headersSent = false;
132
+ this._writableEnded = false;
133
+ this._streaming = false;
134
+ this._aborted = false;
135
+ this._abortHandlers = [];
136
+ this._finished = false;
137
+ this._finishHandlers = [];
138
+ /** Set to true for HEAD requests — body bytes must not be sent. */
139
+ this.isHead = false;
140
+ this.uwsRes = uwsRes;
141
+ // Track connection abort so we don't attempt writes on a closed socket.
142
+ // uWS only allows one onAborted registration per response, so fan out here.
143
+ uwsRes.onAborted(() => {
144
+ this._aborted = true;
145
+ for (const handler of this._abortHandlers)
146
+ handler();
147
+ this._fireFinish();
148
+ });
149
+ }
150
+ get statusCode() {
151
+ return this._statusCode;
152
+ }
153
+ get headersSent() {
154
+ return this._headersSent;
155
+ }
156
+ get writableEnded() {
157
+ return this._writableEnded || this._streaming;
158
+ }
159
+ status(code) {
160
+ this._statusCode = code;
161
+ return this;
162
+ }
163
+ setHeader(key, value) {
164
+ this._headers.set(key.toLowerCase(), Array.isArray(value) ? value.map(String) : String(value));
165
+ return this;
166
+ }
167
+ appendHeader(key, value) {
168
+ const lowerKey = key.toLowerCase();
169
+ const existing = this._headers.get(lowerKey);
170
+ if (existing === undefined) {
171
+ this._headers.set(lowerKey, String(value));
172
+ }
173
+ else if (Array.isArray(existing)) {
174
+ existing.push(String(value));
175
+ }
176
+ else {
177
+ this._headers.set(lowerKey, [existing, String(value)]);
178
+ }
179
+ return this;
180
+ }
181
+ getHeader(key) {
182
+ return this._headers.get(key.toLowerCase());
183
+ }
184
+ json(data) {
185
+ this._headers.set("content-type", "application/json");
186
+ this.end(JSON.stringify(data));
187
+ }
188
+ send(data) {
189
+ if (data === undefined || data === null) {
190
+ this.end();
191
+ }
192
+ else if (typeof data === "object" && !Buffer.isBuffer(data)) {
193
+ this.json(data);
194
+ }
195
+ else {
196
+ this.end(data);
197
+ }
198
+ }
199
+ end(data) {
200
+ if (this._aborted || this._writableEnded)
201
+ return;
202
+ this._writableEnded = true;
203
+ this._fireFinish();
204
+ this.uwsRes.cork(() => {
205
+ // Write status line (uWS expects "200 OK" format)
206
+ if (!this._headersSent) {
207
+ this.uwsRes.writeStatus(this._statusToString(this._statusCode));
208
+ // Write all buffered headers except content-length:
209
+ // uWS auto-adds content-length via end(data) or endWithoutBody(n), so
210
+ // writing it manually would create a duplicate Content-Length header.
211
+ this._writeHeaders();
212
+ this._headersSent = true;
213
+ }
214
+ if (this.isHead) {
215
+ // HEAD: use endWithoutBody so uWS sets Content-Length from the reported size
216
+ // without sending body bytes. Allows doCount/doExists to report a count via
217
+ // content-length without triggering the duplicate-header bug.
218
+ const cl = this._headers.get("content-length");
219
+ this.uwsRes.endWithoutBody(typeof cl === "string" ? parseInt(cl, 10) : undefined);
220
+ }
221
+ else if (data === undefined || data === null) {
222
+ this.uwsRes.end();
223
+ }
224
+ else {
225
+ this.uwsRes.end(data);
226
+ }
227
+ });
228
+ }
229
+ /**
230
+ * Flushes status and headers to the wire immediately without ending the response.
231
+ * Required before streaming data (e.g. SSE). Safe to call multiple times — only
232
+ * acts on the first call.
233
+ */
234
+ flushHeaders() {
235
+ if (this._aborted || this._headersSent)
236
+ return;
237
+ this._streaming = true;
238
+ this.uwsRes.cork(() => {
239
+ this.uwsRes.writeStatus(this._statusToString(this._statusCode));
240
+ this._writeHeaders();
241
+ this._headersSent = true;
242
+ });
243
+ }
244
+ /**
245
+ * Writes all buffered headers to the wire, skipping content-length (uWS sets it
246
+ * automatically via end(data)/endWithoutBody(n)). Headers with multiple values (e.g. one
247
+ * set via `appendHeader`, such as multiple `Set-Cookie` cookies) are written as repeated
248
+ * `writeHeader` calls — uWS emits a separate header line per call rather than overwriting.
249
+ */
250
+ _writeHeaders() {
251
+ for (const [key, value] of this._headers.entries()) {
252
+ if (key === "content-length")
253
+ continue;
254
+ if (Array.isArray(value)) {
255
+ for (const v of value)
256
+ this.uwsRes.writeHeader(key, v);
257
+ }
258
+ else {
259
+ this.uwsRes.writeHeader(key, value);
260
+ }
261
+ }
262
+ }
263
+ /**
264
+ * Writes a chunk to the response without ending it (streaming / SSE).
265
+ * Flushes headers on the first call if they haven't been sent yet.
266
+ */
267
+ write(data) {
268
+ if (this._aborted || this._writableEnded)
269
+ return;
270
+ if (!this._headersSent)
271
+ this.flushHeaders();
272
+ this.uwsRes.write(data);
273
+ }
274
+ /**
275
+ * Registers a callback to run when the client aborts the connection.
276
+ * Safe to call multiple times — all registered callbacks are invoked on abort.
277
+ * Uses the single uWS `onAborted` slot registered in the constructor.
278
+ */
279
+ onAbort(callback) {
280
+ this._abortHandlers.push(callback);
281
+ }
282
+ /**
283
+ * Registers a callback fired exactly once when the response lifecycle ends — either a normal
284
+ * end() or a client abort. Fires immediately if the response has already finished. Handlers run
285
+ * fire-and-forget (via a resolved microtask) so slow/async work (e.g. a Redis write) never
286
+ * delays or blocks the actual response flush.
287
+ */
288
+ onFinish(handler) {
289
+ if (this._finished) {
290
+ void handler();
291
+ }
292
+ else {
293
+ this._finishHandlers.push(handler);
294
+ }
295
+ }
296
+ _fireFinish() {
297
+ if (this._finished)
298
+ return;
299
+ this._finished = true;
300
+ for (const handler of this._finishHandlers) {
301
+ Promise.resolve()
302
+ .then(() => handler())
303
+ .catch(() => {
304
+ // Persistence errors are the middleware's responsibility to log; never let
305
+ // them surface as an unhandled rejection from the adapter.
306
+ });
307
+ }
308
+ }
309
+ /** Converts a numeric status code to the "200 OK" string format uWS expects. */
310
+ _statusToString(code) {
311
+ const messages = {
312
+ 100: "Continue",
313
+ 101: "Switching Protocols",
314
+ 200: "OK",
315
+ 201: "Created",
316
+ 202: "Accepted",
317
+ 204: "No Content",
318
+ 206: "Partial Content",
319
+ 301: "Moved Permanently",
320
+ 302: "Found",
321
+ 304: "Not Modified",
322
+ 400: "Bad Request",
323
+ 401: "Unauthorized",
324
+ 403: "Forbidden",
325
+ 404: "Not Found",
326
+ 405: "Method Not Allowed",
327
+ 409: "Conflict",
328
+ 410: "Gone",
329
+ 422: "Unprocessable Entity",
330
+ 429: "Too Many Requests",
331
+ 500: "Internal Server Error",
332
+ 501: "Not Implemented",
333
+ 502: "Bad Gateway",
334
+ 503: "Service Unavailable",
335
+ };
336
+ return `${code} ${messages[code] || "Unknown"}`;
337
+ }
338
+ }
339
+ /** Default maximum accepted request body size (10 MiB) when no explicit limit is configured. */
340
+ export const DEFAULT_MAX_BODY_SIZE = 10 * 1024 * 1024;
341
+ /**
342
+ * Reads the full request body from a uWS response object as a Buffer.
343
+ * Body parsing (JSON / URL-encoded) is applied based on content-type and the result
344
+ * is cached on `req.body` / `req.rawBody`.
345
+ *
346
+ * If the accumulated body exceeds `maxBodySize`, a `413 Payload Too Large` response is written
347
+ * directly and the connection is ended — the caller must check the resolved value and skip running
348
+ * any further middleware/routing for this request when it's `false`, since a response has already
349
+ * been sent.
350
+ *
351
+ * @returns `true` if the body was read normally (or there was none to read), `false` if the request
352
+ * was rejected for exceeding `maxBodySize`.
353
+ */
354
+ export function readBody(uwsRes, req, maxBodySize = DEFAULT_MAX_BODY_SIZE, res) {
355
+ return new Promise((resolve) => {
356
+ if (req.body !== undefined) {
357
+ resolve(true);
358
+ return;
359
+ }
360
+ let hasChunks = false;
361
+ let totalLength = 0;
362
+ let rejected = false;
363
+ const chunks = [];
364
+ const parseBody = (raw) => {
365
+ req.rawBody = raw;
366
+ req.body = parseBodyByContentType(raw, String(req.headers["content-type"] || ""));
367
+ };
368
+ // If the client disconnects mid-upload, uWS never delivers a final `isLast` chunk to onData()
369
+ // below, which would otherwise leave this promise pending forever — permanently leaking the
370
+ // chunks buffered so far along with the request/response closures awaiting it. There's no
371
+ // response to send to an already-closed connection, so just settle immediately.
372
+ res?.onAbort(() => {
373
+ if (rejected)
374
+ return;
375
+ rejected = true;
376
+ resolve(false);
377
+ });
378
+ uwsRes.onData((chunk, isLast) => {
379
+ // The response has already been ended below (or the connection aborted); ignore any
380
+ // further chunks uWS may deliver.
381
+ if (rejected)
382
+ return;
383
+ totalLength += chunk.byteLength;
384
+ if (totalLength > maxBodySize) {
385
+ rejected = true;
386
+ uwsRes.cork(() => {
387
+ uwsRes.writeStatus("413 Payload Too Large");
388
+ uwsRes.writeHeader("content-type", "application/json");
389
+ uwsRes.end(JSON.stringify({
390
+ code: ApiErrors.PAYLOAD_TOO_LARGE,
391
+ status: 413,
392
+ message: ApiErrorMessages.PAYLOAD_TOO_LARGE,
393
+ }));
394
+ });
395
+ resolve(false);
396
+ return;
397
+ }
398
+ // `chunk` is a raw ArrayBuffer that uWS reuses/detaches once this callback returns, so any
399
+ // reference to it must not outlive this call. `Buffer.from(arrayBuffer)` does NOT copy in that
400
+ // case — given an ArrayBuffer (as opposed to a TypedArray/Buffer), it returns a *view* over that
401
+ // same memory. Retaining that view past this callback (on `req.rawBody`, or in `chunks` for a
402
+ // later `Buffer.concat()`) and reading it afterward throws "Cannot perform
403
+ // %TypedArray%.prototype.set on a detached ArrayBuffer" (or silently returns garbage bytes).
404
+ // `chunk.slice(0)` copies the bytes into a brand new, independently-owned ArrayBuffer first.
405
+ if (isLast && !hasChunks) {
406
+ // Fast path: single-chunk body — skip the chunks array and Buffer.concat entirely.
407
+ parseBody(Buffer.from(chunk.slice(0)));
408
+ resolve(true);
409
+ return;
410
+ }
411
+ // Multi-chunk path: copy each chunk immediately, for the same reason as the fast path above.
412
+ hasChunks = true;
413
+ chunks.push(Buffer.from(chunk.slice(0)));
414
+ if (isLast) {
415
+ parseBody(Buffer.concat(chunks));
416
+ resolve(true);
417
+ }
418
+ });
419
+ });
420
+ }
421
+ //# sourceMappingURL=Adapters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Adapters.js","sourceRoot":"","sources":["../../../../src/http/uWS/Adapters.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEjE,4DAA4D;AAC5D,MAAM,UAAU,YAAY,CAAC,YAAoB;IAC7C,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,IAAI,CAAC,YAAY;QAAE,OAAO,MAAM,CAAC;IACjC,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,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