@rapidrest/service-core 1.0.0-rc.9 → 1.1.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 -213
  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
@@ -1,126 +1,14 @@
1
1
  ///////////////////////////////////////////////////////////////////////////////
2
2
  // Copyright (C) 2020-2026 Jean-Philippe Steinmetz. All rights reserved.
3
+ // SPDX-License-Identifier: MPL-2.0
3
4
  ///////////////////////////////////////////////////////////////////////////////
4
5
  import uWS from "uWebSockets.js";
5
- import * as fs from "fs";
6
- import * as path from "path";
7
- import { UWSRequest, UWSResponse, readBody } from "./Adapters.js";
6
+ import { DEFAULT_MAX_BODY_SIZE, UWSRequest, UWSResponse, readBody } from "./Adapters.js";
8
7
  import { UWSWebSocketShim } from "./WebSocket.js";
9
- /** MIME types for static file serving. */
10
- const MIME_TYPES = {
11
- ".html": "text/html",
12
- ".css": "text/css",
13
- ".js": "application/javascript",
14
- ".mjs": "application/javascript",
15
- ".json": "application/json",
16
- ".png": "image/png",
17
- ".jpg": "image/jpeg",
18
- ".jpeg": "image/jpeg",
19
- ".gif": "image/gif",
20
- ".svg": "image/svg+xml",
21
- ".ico": "image/x-icon",
22
- ".woff": "font/woff",
23
- ".woff2": "font/woff2",
24
- ".ttf": "font/ttf",
25
- ".txt": "text/plain",
26
- ".map": "application/json",
27
- };
28
- /**
29
- * Runs an ordered array of middleware handlers sequentially, Express-style.
30
- * Supports both 3-param `(req, res, next)` handlers and 4-param `(err, req, res, next)`
31
- * error handlers. On error, execution skips to the next error handler.
32
- *
33
- * Each handler is awaited via a Promise that resolves when next() is called, not when
34
- * the handler's return value resolves. This correctly handles: (1) sync handlers that
35
- * call next() synchronously, (2) async handlers that return next() or await before
36
- * calling it, and (3) sync handlers that schedule next() via callbacks such as
37
- * setTimeout or socket.once. The chain terminates early when a handler ends the
38
- * response without calling next().
39
- */
40
- export async function runChain(handlers, req, res) {
41
- let currentError = undefined;
42
- for (let i = 0; i < handlers.length; i++) {
43
- const handler = handlers[i];
44
- const isErrorHandler = handler.length === 4;
45
- if (currentError && !isErrorHandler)
46
- continue;
47
- if (!currentError && isErrorHandler)
48
- continue;
49
- const outcome = await new Promise((resolve) => {
50
- let settled = false;
51
- const next = (err) => {
52
- if (!settled) {
53
- settled = true;
54
- resolve({ called: true, err });
55
- }
56
- };
57
- try {
58
- const handlerResult = isErrorHandler
59
- ? handler(currentError, req, res, next)
60
- : handler(req, res, next);
61
- if (handlerResult instanceof Promise) {
62
- // Async handler: wait for the Promise, but next() may have already been
63
- // called (or may be called later inside the Promise chain).
64
- handlerResult
65
- .then(() => {
66
- if (!settled) {
67
- settled = true;
68
- resolve({ called: false });
69
- }
70
- })
71
- .catch((err) => {
72
- if (!settled) {
73
- settled = true;
74
- resolve({ called: true, err });
75
- }
76
- });
77
- }
78
- else {
79
- // Sync handler returned. Three sub-cases:
80
- // a. next() was already called synchronously → already settled.
81
- // b. Response was sent without next() → stop chain.
82
- // c. Handler will call next() from an async callback (e.g. setTimeout)
83
- // → leave the Promise pending; it resolves when next() fires.
84
- if (!settled && res.writableEnded) {
85
- settled = true;
86
- resolve({ called: false });
87
- }
88
- // else: wait for next() to be called asynchronously
89
- }
90
- }
91
- catch (err) {
92
- if (!settled) {
93
- settled = true;
94
- resolve({ called: true, err });
95
- }
96
- }
97
- });
98
- if (!outcome.called)
99
- break; // handler terminated chain (sent response)
100
- if (outcome.err !== undefined) {
101
- currentError = outcome.err;
102
- }
103
- else if (isErrorHandler) {
104
- currentError = undefined; // error was handled
105
- }
106
- }
107
- // End of chain with unhandled error
108
- if (currentError && !res.writableEnded) {
109
- res.status(500).json({
110
- message: currentError?.message || "Internal Server Error",
111
- status: 500,
112
- });
113
- }
114
- }
115
- /** Parses `:param` names out of a uWS route pattern (e.g. `/users/:uid/:version` → `["uid","version"]`). */
116
- function extractParamNames(routePath) {
117
- const names = [];
118
- for (const segment of routePath.split("/")) {
119
- if (segment.startsWith(":"))
120
- names.push(segment.slice(1));
121
- }
122
- return names;
123
- }
8
+ import { extractParamNames, makeWsStubResponse, runChain } from "../MiddlewareChain.js";
9
+ import { ApiError } from "@rapidrest/core";
10
+ import { ApiErrorMessages, ApiErrors } from "../../ApiErrors.js";
11
+ export { runChain, extractParamNames } from "../MiddlewareChain.js";
124
12
  /**
125
13
  * Wraps a uWS route handler to convert uWS request/response objects into `HttpRequest`/`HttpResponse`
126
14
  * adapters, reads the body, and runs the full middleware chain (pre-route global + route-specific + post-route global).
@@ -129,7 +17,7 @@ function extractParamNames(routePath) {
129
17
  * At invocation time we split `globalMiddleware` at that index so that error handlers and metrics registered
130
18
  * AFTER the routes are placed after the route handlers in the chain (matching Express middleware ordering).
131
19
  */
132
- function makeUWSHandler(globalMiddleware, routeHandlers, preLength, paramNames, isHead = false) {
20
+ function makeUWSHandler(globalMiddleware, routeHandlers, preLength, paramNames, isHead = false, maxBodySize = DEFAULT_MAX_BODY_SIZE) {
133
21
  // Built lazily on the first request and reused thereafter. Safe because all use() calls
134
22
  // complete before listen() is invoked, and requests only arrive after listen().
135
23
  let allHandlers = null;
@@ -144,13 +32,19 @@ function makeUWSHandler(globalMiddleware, routeHandlers, preLength, paramNames,
144
32
  for (let i = 0; i < paramNames.length; i++) {
145
33
  req.params[paramNames[i]] = uwsReq.getParameter(i) || "";
146
34
  }
147
- // Body must be read before any middleware runs
35
+ // Body must be read before any middleware runs. If it exceeds maxBodySize, readBody() has
36
+ // already written a 413 response and ended the connection — stop here without running any
37
+ // middleware/route logic against a truncated/oversized body.
38
+ let bodyOk = true;
148
39
  try {
149
- await readBody(uwsRes, req);
40
+ bodyOk = await readBody(uwsRes, req, maxBodySize, res);
150
41
  }
151
42
  catch {
152
43
  // Non-fatal: body may not exist for GET/HEAD/OPTIONS
153
44
  }
45
+ if (!bodyOk) {
46
+ return;
47
+ }
154
48
  // Build the combined handler chain once; reuse on every subsequent request.
155
49
  if (allHandlers === null) {
156
50
  allHandlers = [
@@ -175,11 +69,10 @@ function makeUWSHandler(globalMiddleware, routeHandlers, preLength, paramNames,
175
69
  *
176
70
  * Also supports:
177
71
  * - `ws(path, handlers)` — native uWS WebSocket routing
178
- * - `static(basePath)` — basic static file serving
179
72
  * - `listen(host, port)` / `close()` — server lifecycle
180
73
  */
181
74
  export class HttpRouter {
182
- constructor(uwsApp) {
75
+ constructor(uwsApp, maxBodySize = DEFAULT_MAX_BODY_SIZE) {
183
76
  this.globalMiddleware = [];
184
77
  this.listenSocket = null;
185
78
  /**
@@ -189,7 +82,14 @@ export class HttpRouter {
189
82
  this.preRouteCount = -1;
190
83
  /** The port the server is currently listening on (set after a successful `listen()` call). */
191
84
  this.listenPort = 0;
85
+ /**
86
+ * HTTP verbs for which the application has already registered its own literal `/*` route
87
+ * (e.g. a `BaseStaticRoute` mounted at the site root via `@Route("/")`). Used by `listen()` to
88
+ * avoid clobbering an app-defined root catch-all with the default JSON 404 fallback.
89
+ */
90
+ this.rootWildcardVerbs = new Set();
192
91
  this.uwsApp = uwsApp;
92
+ this.maxBodySize = maxBodySize;
193
93
  }
194
94
  /** Returns `true` if the server is currently listening. */
195
95
  get isListening() {
@@ -216,38 +116,50 @@ export class HttpRouter {
216
116
  // -------------------------------------------------------------------------
217
117
  get(routePath, ...handlers) {
218
118
  const pre = this.capturePreRouteCount();
219
- this.uwsApp.get(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath)));
119
+ if (routePath === "/*")
120
+ this.rootWildcardVerbs.add("get");
121
+ this.uwsApp.get(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath), false, this.maxBodySize));
220
122
  return this;
221
123
  }
222
124
  post(routePath, ...handlers) {
223
125
  const pre = this.capturePreRouteCount();
224
- this.uwsApp.post(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath)));
126
+ if (routePath === "/*")
127
+ this.rootWildcardVerbs.add("post");
128
+ this.uwsApp.post(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath), false, this.maxBodySize));
225
129
  return this;
226
130
  }
227
131
  put(routePath, ...handlers) {
228
132
  const pre = this.capturePreRouteCount();
229
- this.uwsApp.put(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath)));
133
+ if (routePath === "/*")
134
+ this.rootWildcardVerbs.add("put");
135
+ this.uwsApp.put(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath), false, this.maxBodySize));
230
136
  return this;
231
137
  }
232
138
  delete(routePath, ...handlers) {
233
139
  const pre = this.capturePreRouteCount();
234
- this.uwsApp.del(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath)));
140
+ if (routePath === "/*")
141
+ this.rootWildcardVerbs.add("delete");
142
+ this.uwsApp.del(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath), false, this.maxBodySize));
235
143
  return this;
236
144
  }
237
145
  patch(routePath, ...handlers) {
238
146
  const pre = this.capturePreRouteCount();
239
- this.uwsApp.patch(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath)));
147
+ if (routePath === "/*")
148
+ this.rootWildcardVerbs.add("patch");
149
+ this.uwsApp.patch(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath), false, this.maxBodySize));
240
150
  return this;
241
151
  }
242
152
  head(routePath, ...handlers) {
243
153
  const pre = this.capturePreRouteCount();
154
+ if (routePath === "/*")
155
+ this.rootWildcardVerbs.add("head");
244
156
  // uWS explicitly-registered HEAD routes do send body bytes — suppress them via isHead flag
245
- this.uwsApp.head(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath), true));
157
+ this.uwsApp.head(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath), true, this.maxBodySize));
246
158
  return this;
247
159
  }
248
160
  options(routePath, ...handlers) {
249
161
  const pre = this.capturePreRouteCount();
250
- this.uwsApp.options(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath)));
162
+ this.uwsApp.options(routePath, makeUWSHandler(this.globalMiddleware, handlers, pre, extractParamNames(routePath), false, this.maxBodySize));
251
163
  return this;
252
164
  }
253
165
  /**
@@ -302,28 +214,29 @@ export class HttpRouter {
302
214
  const req = userData.req;
303
215
  req.websocket = shim;
304
216
  req.wsHandled = false;
305
- // Create a stub response (WebSocket responses don't use HTTP res)
306
- const stubRes = {
307
- statusCode: 101,
308
- headersSent: true,
309
- writableEnded: false,
310
- status() { return this; },
311
- setHeader() { return this; },
312
- getHeader() { return undefined; },
313
- json() { return; },
314
- send() { return; },
315
- end() { this.writableEnded = true; },
316
- };
217
+ // Create a stub response (WebSocket responses don't use HTTP res). A middleware that
218
+ // rejects (e.g. checkRequiredRoles/checkElevation/checkRequiredPerms) with no downstream
219
+ // handler to translate that into a close has nowhere else to signal it — mirror the
220
+ // convention route handlers use themselves: close with 1002 and the error's short code.
221
+ const stubRes = makeWsStubResponse((status, payload) => {
222
+ req.wsHandled = true;
223
+ shim.close(1002, payload?.code || payload?.message || "Internal Server Error");
224
+ });
317
225
  await runChain(handlers, req, stubRes);
318
226
  // If no handler marked wsHandled, close the connection.
319
227
  // Guard against the client disconnecting while runChain was awaiting
320
228
  // (e.g. authWebSocket waiting for a LOGIN frame): the uWS handle is
321
- // invalid once the close callback fires, so calling ws.close() would
229
+ // invalid once the close callback fires, so calling ws.end() would
322
230
  // throw "Invalid access of closed uWS.WebSocket" as an unhandled
323
231
  // rejection from this async open handler.
232
+ //
233
+ // Uses `ws.end()`, not `ws.close()` — uWS's `close()` is an abrupt disconnect with no
234
+ // close handshake (surfaces to clients as a connection reset), while `end()` performs a
235
+ // proper WebSocket close. `shim.close()` already calls `end()` internally; called directly
236
+ // here (rather than through the shim) since no code/reason applies to this bare fallback.
324
237
  if (!req.wsHandled && shim.readyState !== 3) {
325
238
  try {
326
- ws.close();
239
+ ws.end();
327
240
  }
328
241
  catch {
329
242
  // Client already disconnected — nothing to do
@@ -348,34 +261,6 @@ export class HttpRouter {
348
261
  }
349
262
  return this;
350
263
  }
351
- /**
352
- * Serves static files from a directory via a wildcard GET route.
353
- * Files not found on disk return 404.
354
- */
355
- static(basePath) {
356
- this.uwsApp.get("/*", async (uwsRes, uwsReq) => {
357
- const remoteAddress = Buffer.from(uwsRes.getRemoteAddressAsText()).toString();
358
- const req = new UWSRequest(uwsReq, remoteAddress);
359
- const res = new UWSResponse(uwsRes);
360
- const safeBase = path.resolve(basePath);
361
- const requestedPath = req.path === "/" ? "index.html" : req.path.replace(/^\/+/, "");
362
- const filePath = path.resolve(safeBase, requestedPath);
363
- if (!filePath.startsWith(safeBase + path.sep) && filePath !== safeBase) {
364
- res.status(403).end();
365
- return;
366
- }
367
- const ext = path.extname(filePath);
368
- try {
369
- const data = await fs.promises.readFile(filePath);
370
- res.setHeader("content-type", MIME_TYPES[ext] || "application/octet-stream");
371
- res.end(data);
372
- }
373
- catch {
374
- res.status(404).end();
375
- }
376
- });
377
- return this;
378
- }
379
264
  /**
380
265
  * Starts listening on the given host and port.
381
266
  * Resolves when the server is ready; rejects if the port cannot be bound.
@@ -385,7 +270,22 @@ export class HttpRouter {
385
270
  // This must happen before the uWS listen call so it is ready when the first request arrives.
386
271
  // preLength=0 places all globalMiddleware as "post-route" so they all execute sequentially;
387
272
  // the CORS middleware terminates the chain early for OPTIONS (sends 204 without calling next).
388
- this.uwsApp.options("/*", makeUWSHandler(this.globalMiddleware, [], 0, []));
273
+ this.uwsApp.options("/*", makeUWSHandler(this.globalMiddleware, [], 0, [], false, this.maxBodySize));
274
+ // Register a JSON 404 fallback for any request that doesn't match a registered route, so
275
+ // clients get the framework's normal ApiError response shape instead of uWS's built-in HTML
276
+ // "File Not Found" page. Routed through `next()` so it flows through the same error-handling
277
+ // and metrics middleware as any other error. uWS matches by specificity, not registration
278
+ // order, so this never shadows a real route — except an app-defined literal `/*` route (e.g. a
279
+ // `BaseStaticRoute` mounted at the site root), which is deliberately left alone via
280
+ // `rootWildcardVerbs`.
281
+ const notFoundHandler = (_req, _res, next) => {
282
+ next(new ApiError(ApiErrors.NOT_FOUND, 404, ApiErrorMessages.NOT_FOUND));
283
+ };
284
+ for (const verb of ["get", "post", "put", "delete", "patch", "head"]) {
285
+ if (!this.rootWildcardVerbs.has(verb)) {
286
+ this[verb]("/*", notFoundHandler);
287
+ }
288
+ }
389
289
  return new Promise((resolve, reject) => {
390
290
  this.uwsApp.listen(host, port, (socket) => {
391
291
  if (socket) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Router.js","sourceRoot":"","sources":["../../../../src/http/uWS/Router.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,wEAAwE;AACxE,mCAAmC;AACnC,+EAA+E;AAC/E,OAAO,GAAG,MAAM,gBAAgB,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzF,OAAO,EAAE,gBAAgB,EAAkB,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,QAAQ,EAAsB,MAAM,uBAAuB,CAAC;AAC5G,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAGpE;;;;;;;GAOG;AACH,SAAS,cAAc,CACnB,gBAAkC,EAClC,aAA+B,EAC/B,SAAiB,EACjB,UAAoB,EACpB,SAAkB,KAAK,EACvB,cAAsB,qBAAqB;IAE3C,wFAAwF;IACxF,gFAAgF;IAChF,IAAI,WAAW,GAA4B,IAAI,CAAC;IAEhD,OAAO,KAAK,EAAE,MAAwB,EAAE,MAAuB,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AAC;QAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE;gBACtC,IAAI,MAAM,EAAE,CAAC;oBACT,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;oBAC3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;oBACvB,OAAO,EAAE,CAAC;gBACd,CAAC;qBAAM,CAAC;oBACJ,MAAM,CAAC,IAAI,KAAK,CAAC,uBAAuB,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;gBAC7D,CAAC;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAED,oFAAoF;IAC7E,KAAK;QACR,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,GAAG,CAAC,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC9C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC7B,CAAC;IACL,CAAC;CAKJ"}
@@ -1,5 +1,6 @@
1
1
  ///////////////////////////////////////////////////////////////////////////////
2
2
  // Copyright (C) 2020-2026 Jean-Philippe Steinmetz. All rights reserved.
3
+ // SPDX-License-Identifier: MPL-2.0
3
4
  ///////////////////////////////////////////////////////////////////////////////
4
5
  import { EventEmitter } from "events";
5
6
  import { Duplex } from "stream";
@@ -58,7 +59,9 @@ export class UWSWebSocketShim extends EventEmitter {
58
59
  */
59
60
  export function createWebSocketStream(shim) {
60
61
  const duplex = new Duplex({
61
- read() { return; },
62
+ read() {
63
+ return;
64
+ },
62
65
  write(chunk, _encoding, callback) {
63
66
  shim.send(chunk, (err) => callback(err));
64
67
  },
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSocket.js","sourceRoot":"","sources":["../../../../src/http/uWS/WebSocket.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,wEAAwE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AE,SAAS,EAAE,QAAQ;YAC5B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7C,CAAC;QACD,KAAK,CAAC,QAAQ;YACV,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACjB,QAAQ,EAAE,CAAC;QACf,CAAC;KACJ,CAAC,CAAC;IAEH,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,IAAS,EAAE,EAAE;QAC7B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QAClB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,MAAM,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACpB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -9,13 +9,14 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  };
10
10
  ///////////////////////////////////////////////////////////////////////////////
11
11
  // Copyright (C) 2020-2026 Jean-Philippe Steinmetz. All rights reserved.
12
+ // SPDX-License-Identifier: MPL-2.0
12
13
  ///////////////////////////////////////////////////////////////////////////////
13
14
  import { Default, Description } from "../decorators/DocDecorators.js";
14
15
  import { Identifier } from "../decorators/ModelDecorators.js";
15
16
  import { Column, Index, PrimaryColumn } from "../decorators/PersistenceDecorators.js";
16
17
  import * as uuid from "uuid";
17
18
  /**
18
- * Provides a common base class for all entity's that will be persisted to a datastore.
19
+ * Provides a common base class for all entity's that will be persisted to a datasource.
19
20
  *
20
21
  * Note that the `@CreateDateColumn`, `@UpdateDateColumn`, and `@VersionColumn` decorators from TypeORM are not supported
21
22
  * because they are not implemented in TypeORM's MongoDB support. They are instead implemented directly by this
@@ -1 +1 @@
1
- {"version":3,"file":"BaseEntity.js","sourceRoot":"","sources":["../../../src/models/BaseEntity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+EAA+E;AAC/E,wEAAwE;AACxE,+EAA+E;AAC/E,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;;;;;;;GAQG;AACH,MAAM,OAAgB,UAAU;IAkC5B,YAAY,KAA2B;QAjCvC;;WAEG;QAMI,QAAG,GAAW,IAAI,CAAC,EAAE,EAAE,CAAC;QAE/B;;WAEG;QAII,gBAAW,GAAS,IAAI,IAAI,EAAE,CAAC;QAEtC;;WAEG;QAII,iBAAY,GAAS,IAAI,IAAI,EAAE,CAAC;QAEvC;;WAEG;QAGI,YAAO,GAAW,CAAC,CAAC;QAGvB,IAAI,KAAK,EAAE,CAAC;YACR,IAAI,CAAC,GAAG,GAAG,KAAK,IAAI,KAAK,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAC5E,IAAI,CAAC,WAAW;gBACZ,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ;oBACjC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;oBAC7B,CAAC,CAAC,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC;YAChD,IAAI,CAAC,YAAY;gBACb,OAAO,KAAK,CAAC,YAAY,KAAK,QAAQ;oBAClC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,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Ac;AAQ/B;IAHN,WAAW,CAAC,sDAAsD,CAAC;IACnE,OAAO,CAAC,YAAY,CAAC;IACrB,MAAM,EAAE;8BACY,IAAI;gDAAc;AAOhC;IAFN,WAAW,CAAC,8BAA8B,CAAC;IAC3C,MAAM,EAAE;;2CACkB"}
@@ -9,6 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  };
10
10
  ///////////////////////////////////////////////////////////////////////////////
11
11
  // Copyright (C) 2020-2026 Jean-Philippe Steinmetz. All rights reserved.
12
+ // SPDX-License-Identifier: MPL-2.0
12
13
  ///////////////////////////////////////////////////////////////////////////////
13
14
  import { Column, Index } from "../decorators/PersistenceDecorators.js";
14
15
  import { BaseEntity } from "./BaseEntity.js";
@@ -20,8 +21,6 @@ const { Nullable } = ObjectDecorators;
20
21
  *
21
22
  * @author Jean-Philippe Steinmetz <rapidrests@gmail.com>
22
23
  */
23
- // Shadow BaseEntity's unique uid index — MongoDB entities store version history (multiple docs per uid),
24
- // so uniqueness is enforced at the application layer (optimistic locking) rather than via a unique index.
25
24
  let BaseMongoEntity = class BaseMongoEntity extends BaseEntity {
26
25
  constructor(other) {
27
26
  super(other);
@@ -40,6 +39,7 @@ __decorate([
40
39
  __metadata("design:type", Object)
41
40
  ], BaseMongoEntity.prototype, "_id", void 0);
42
41
  BaseMongoEntity = __decorate([
42
+ Index("uid_version", ["uid", "version"], { unique: true }),
43
43
  Index("uid", ["uid"]),
44
44
  __metadata("design:paramtypes", [Object])
45
45
  ], BaseMongoEntity);
@@ -1 +1 @@
1
- {"version":3,"file":"BaseMongoEntity.js","sourceRoot":"","sources":["../../../src/models/BaseMongoEntity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+EAA+E;AAC/E,wEAAwE;AACxE,+EAA+E;AAC/E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAA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