@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
@@ -1,15 +1,40 @@
1
1
  ///////////////////////////////////////////////////////////////////////////////
2
2
  // Copyright (C) 2020-2026 Jean-Philippe Steinmetz
3
+ // SPDX-License-Identifier: MPL-2.0
3
4
  ///////////////////////////////////////////////////////////////////////////////
5
+ import { AsyncLocalStorage } from "node:async_hooks";
6
+ import { ConnectionManager } from "../database/ConnectionManager.js";
7
+ import { isSqlDataSource } from "../database/ConnectionKinds.js";
8
+ import { MongoConnection } from "../database/MongoConnection.js";
4
9
  /**
5
- * Apply this to a property to have the TypeORM `MongoRepository` for the given entity type injected at instantiation.
10
+ * Carries the transactional context established by `@Transactional` through the async call chain of the
11
+ * decorated method, keyed to that specific invocation rather than to the object instance the method runs on.
12
+ */
13
+ export const transactionContext = new AsyncLocalStorage();
14
+ /**
15
+ * Registers a best-effort compensating action to run if the currently active transaction (the one owning the
16
+ * ambient `transactionContext`) ultimately fails. Intended for code that just committed a write on a *different*
17
+ * connection than the active transaction's own (e.g. one that can't be rolled back by that transaction's own
18
+ * abort) and needs its own explicit cleanup to avoid an orphaned write if the active transaction later fails.
19
+ * A no-op if there's no active transaction to register against.
6
20
  *
7
- * @param {any} type The entity type whose repository will be injected.
21
+ * The hook is responsible for catching and logging its own errors; if it throws anyway, that's swallowed (via
22
+ * `Promise.allSettled`) rather than masking the original failure that triggered the rollback.
23
+ *
24
+ * @param hook The compensating action to run.
25
+ */
26
+ export function registerRollbackHook(hook) {
27
+ transactionContext.getStore()?.onRollback?.push(hook);
28
+ }
29
+ /**
30
+ * Apply this to a property to have the datasource connection with the given name injected at instantiation.
31
+ *
32
+ * @param name The name of the datasource or class type.
33
+ * @param required Set to `true` to indicate this injection must resolve, otherwise set to `false`. Default is `true`.
8
34
  */
9
- export function MongoRepository(type) {
35
+ export function DataSource(name, required = true) {
10
36
  return function (target, propertyKey) {
11
- Reflect.defineMetadata("rrst:injectMongoRepo", type, target, propertyKey);
12
- const key = `__${String(propertyKey)}`;
37
+ Reflect.defineMetadata("rrst:injectDataSource", { name, required }, target, propertyKey);
13
38
  Object.defineProperty(target, propertyKey, {
14
39
  enumerable: true,
15
40
  writable: true,
@@ -18,14 +43,41 @@ export function MongoRepository(type) {
18
43
  };
19
44
  }
20
45
  /**
21
- * Apply this to a property to have the TypeORM `Repository` for the given entity type injected at instantiation.
46
+ * Injects the entity manager as the value of the decorated argument.
47
+ *
48
+ * @param name The name of the datasource or class type.
49
+ */
50
+ export function EntityManager(nameOrType) {
51
+ return function (target, propertyKey, index) {
52
+ const datasource = typeof nameOrType === "string" ? nameOrType : nameOrType?.datasource;
53
+ // Falls back to a fresh object rather than assuming some other parameter decorator (e.g. `@Param`)
54
+ // already initialized this metadata — a `@Transactional` method using only `@EntityManager` has no
55
+ // such decorator, and indexing into `undefined` here would throw at class-definition time.
56
+ const args = Reflect.getMetadata("rrst:args", target, propertyKey) ?? {};
57
+ args[index] = ["entityManager", datasource];
58
+ Reflect.defineMetadata("rrst:args", args, target, propertyKey);
59
+ };
60
+ }
61
+ /**
62
+ * Injects the MongoDB session (used by @Transactional) as the value of the decorated argument.
63
+ */
64
+ export function MongoSession(nameOrType) {
65
+ return function (target, propertyKey, index) {
66
+ const datasource = typeof nameOrType === "string" ? nameOrType : nameOrType?.datasource;
67
+ const args = Reflect.getMetadata("rrst:args", target, propertyKey) ?? {};
68
+ args[index] = ["mongoSession", datasource];
69
+ Reflect.defineMetadata("rrst:args", args, target, propertyKey);
70
+ };
71
+ }
72
+ /**
73
+ * Apply this to a property to have the datasource repository for the given entity type injected at instantiation.
22
74
  *
23
75
  * @param {any} type The entity type whose repository will be injected.
76
+ * @param required Set to `true` to indicate this injection must resolve, otherwise set to `false`. Default is `true`.
24
77
  */
25
- export function Repository(type) {
78
+ export function Repository(type, required = true) {
26
79
  return function (target, propertyKey) {
27
- Reflect.defineMetadata("rrst:injectRepo", type, target, propertyKey);
28
- const key = `__${String(propertyKey)}`;
80
+ Reflect.defineMetadata("rrst:injectRepository", { type, required }, target, propertyKey);
29
81
  Object.defineProperty(target, propertyKey, {
30
82
  enumerable: true,
31
83
  writable: true,
@@ -34,19 +86,211 @@ export function Repository(type) {
34
86
  };
35
87
  }
36
88
  /**
37
- * Apply this to a property to have the `Redis` connection injected at instantiation.
89
+ * Apply this to a property to have the `Redis` connection with the given name injected at instantiation.
38
90
  *
39
- * @param {string} name The name of the database connection to inject.
91
+ * @param {string} name The name of the datasource connection to inject.
92
+ * @param required Set to `true` to indicate this injection must resolve, otherwise set to `false`. Default is `true`.
40
93
  */
41
- export function RedisConnection(name) {
42
- return function (target, propertyKey) {
43
- Reflect.defineMetadata("rrst:injectRedisRepo", name, target, propertyKey);
44
- const key = `__${String(propertyKey)}`;
45
- Object.defineProperty(target, propertyKey, {
46
- enumerable: true,
47
- writable: true,
48
- value: undefined,
49
- });
94
+ export function Redis(name = "redis", required = true) {
95
+ return DataSource(name, required);
96
+ }
97
+ /**
98
+ * Describes the opertaing mode for transaction support and how existing context should be
99
+ * reconciled. When @Transactional is used multiple times in a single callstack, the
100
+ * context can either be merged in a single transaction and nested.
101
+ */
102
+ export var TransactionalMode;
103
+ (function (TransactionalMode) {
104
+ /** Always creates a new transactional context for the current function. */
105
+ TransactionalMode[TransactionalMode["CREATE"] = 0] = "CREATE";
106
+ /** Merges existing transactional context instead of creating a new one. */
107
+ TransactionalMode[TransactionalMode["MERGE"] = 1] = "MERGE";
108
+ })(TransactionalMode || (TransactionalMode = {}));
109
+ /**
110
+ * Apply this to perform all operations in a single transaction. The specified `source` can
111
+ * be the name of a connection or the class type of a persistent data model. If no `source` is specified it is inferred
112
+ * by lookup via `this.modelClass` which is injected when `@Model` is added to a class.
113
+ *
114
+ * For MongoDB, this has the effect of creating a new session and wrapping the function call in
115
+ * `session.withTransaction()`. Note that you must pass in the `session` to each `MongoRepository` function you wish
116
+ * to use the transaction. The `session` is automatically made available for the duration of the call via
117
+ * `transactionContext` (an `AsyncLocalStorage` that is scoped to this call). Optionally, it can also be injected to a
118
+ * function argument that is decorated with `@MongoSession`.
119
+ *
120
+ * For TypeORM, this has the effect of creating a new transaction and wrapping the function call in
121
+ * `datasource.transaction()`. Note that you must use the provided `EntityManager` for all database actions. The
122
+ * `entityManager` is automatically made available for the duration of the call via `transactionContext`. Optionally,
123
+ * it can be injected to a function argument that is decorated with `@EntityManager`.
124
+ *
125
+ * If `@Transactional` was already in effect earlier in the current call stack (e.g. a `RepoUtils` method called
126
+ * from a `ModelRoute` method that's also `@Transactional`), the existing transaction is reused by default rather
127
+ * than opening a second, nested one. See `TransactionalOptions.mode`.
128
+ *
129
+ * Note: A `@Transactional` method *MUST* always return a promise (e.g. is async).
130
+ *
131
+ * @example
132
+ * ```ts
133
+ * @Model(MongoModel)
134
+ * class MyClass {
135
+ * @Repository(MongoModel)
136
+ * private myRepo: MongoRepository<MongoModel>;
137
+ *
138
+ * @Transactional()
139
+ * public myFunc(obj: MongoModel, @MongoSession() session) {
140
+ * await this.myRepo.save(obj, { session });
141
+ * }
142
+ * }
143
+ * ```
144
+ * @example
145
+ * ```ts
146
+ * class MyClass {
147
+ * @Repository(MongoModel)
148
+ * private myRepo: MongoRepository<MongoModel>;
149
+ *
150
+ * @Repository(MongoModel2)
151
+ * private myRepo2: MongoRepository<MongoModel2>;
152
+ *
153
+ * @Transactional(MongoModel)
154
+ * public myFunc(obj: MongoModel, @MongoSession() session) {
155
+ * await this.myRepo.save(obj, { session });
156
+ * }
157
+ * }
158
+ * ```
159
+ * @example
160
+ * ```ts
161
+ * class MyClass {
162
+ * @Repository(SQLModel)
163
+ * private myRepo: Repository<SQLModel>;
164
+ *
165
+ * @Transactional(SQLModel)
166
+ * public myFunc(obj: SQLModel, @EntityManager() em) {
167
+ * await em.save(obj);
168
+ * }
169
+ * }
170
+ * ```
171
+ * @param source The name of the datasource or the class type that a transaction will be created for. If none specified,
172
+ * the source is inferred using `this.modelClass`.
173
+ * @param options The transcation options to pass to the underlying datasource connection.
174
+ */
175
+ export function Transactional(source, options) {
176
+ return function (target, propertyKey, descriptor) {
177
+ const original = descriptor.value;
178
+ const argMetadata = Reflect.getMetadata("rrst:args", target, propertyKey);
179
+ descriptor.value = async function (...args) {
180
+ // Resolved into a local rather than reassigning the closed-over `source` param, which is shared by
181
+ // every invocation of this decorated method across every instance it's ever called on.
182
+ const resolvedSource = source ?? this.modelClass;
183
+ const datasource = typeof resolvedSource === "string" ? resolvedSource : resolvedSource?.datasource;
184
+ // Resolve the datasource directly from the ConnectionManager using `this._objectFactory`
185
+ // which ObjectFactory always injects into every object it manages.
186
+ const connectionManager = this._objectFactory?.getInstance(ConnectionManager);
187
+ const conn = datasource ? connectionManager?.connections.get(datasource) : undefined;
188
+ // Check if the connection supports transactions. If it doesn't we will fallback to the default
189
+ // (non-transactional) behavior. A log message warns the developer at startup about the missing
190
+ // transaction support.
191
+ const canUseMongoTransaction = conn instanceof MongoConnection && conn.supportsTransactions;
192
+ const canUseSqlTransaction = isSqlDataSource(conn) && typeof conn.transaction === "function";
193
+ if (!canUseMongoTransaction && !canUseSqlTransaction) {
194
+ // A connection WAS resolved for this call's own datasource but it doesn't support
195
+ // transactions. If an ambient context from an *different* datasource is active (e.g. this call
196
+ // is `acl`, nested inside an outer `mongodb` transaction), that context's session/entityManager
197
+ // belongs to a different connection and must not leak into this call.
198
+ const existingContext = transactionContext.getStore();
199
+ if (conn !== undefined && existingContext !== undefined && existingContext.datasource !== datasource) {
200
+ return await transactionContext.run({ datasource }, () => original.apply(this, args));
201
+ }
202
+ return await original.apply(this, args);
203
+ }
204
+ // Injects the active session/entityManager into any @MongoSession/@EntityManager-decorated argument
205
+ // whose named datasource (if any) matches the one this call resolved above.
206
+ const injectContextArgs = (ctx) => {
207
+ for (const key in argMetadata) {
208
+ const i = Number(key);
209
+ const [kind, argDatasource] = argMetadata[i];
210
+ if (argDatasource && argDatasource !== datasource) {
211
+ continue;
212
+ }
213
+ if (kind === "mongoSession" && ctx.session !== undefined) {
214
+ args[i] = ctx.session;
215
+ }
216
+ else if (kind === "entityManager" && ctx.entityManager !== undefined) {
217
+ args[i] = ctx.entityManager;
218
+ }
219
+ }
220
+ };
221
+ // Also check if @Transactional was already used earlier in the call stack. By default (i.e. when
222
+ // `options.mode` is omitted, or explicitly TransactionalMode.MERGE) that existing context is reused
223
+ // instead of opening a second, nested transaction of its own. Pass `{ mode: TransactionalMode.CREATE }`
224
+ // to always start a fresh transaction regardless of any outer one.
225
+ //
226
+ // Only merge when the existing context actually belongs to *this* call's resolved datasource — an
227
+ // outer @Transactional("datasourceA") whose context is still active when an inner call resolves
228
+ // "datasourceB" must not merge into it (that would silently run the inner call's writes against the
229
+ // wrong connection, or leave it non-transactional if the shapes don't line up). In that case fall
230
+ // through below and open a genuinely independent transaction for this call's own datasource instead.
231
+ const existingContext = transactionContext.getStore();
232
+ if (existingContext !== undefined &&
233
+ existingContext.datasource === datasource &&
234
+ options?.mode !== TransactionalMode.CREATE) {
235
+ injectContextArgs(existingContext);
236
+ return await original.apply(this, args);
237
+ }
238
+ let result = undefined;
239
+ if (canUseMongoTransaction) {
240
+ // Implement transactions according to the MongoDB docs:
241
+ // https://www.mongodb.com/docs/manual/core/transactions/?language-no-dependencies=nodejs
242
+ const session = conn.startSession(options?.driverOptions);
243
+ const onRollback = [];
244
+ try {
245
+ // `withTransaction()` already aborts the transaction automatically if the callback throws
246
+ // or its returned promise rejects, so no explicit `abortTransaction()` call is needed here
247
+ // — and the error must be allowed to propagate to the caller rather than being swallowed.
248
+ await session.withTransaction(async () => {
249
+ injectContextArgs({ session });
250
+ // Scope the session to this call's async context (see `transactionContext`) rather than
251
+ // stashing it on `this`, which may be a singleton shared with concurrent, unrelated calls.
252
+ result = await transactionContext.run({ session, datasource, onRollback }, () => original.apply(this, args));
253
+ });
254
+ }
255
+ catch (err) {
256
+ // Best-effort: undo whatever independently-committed side effects nested code registered
257
+ // against this transaction (see `registerRollbackHook`) before propagating the failure.
258
+ await Promise.allSettled(onRollback.map((hook) => hook()));
259
+ throw err;
260
+ }
261
+ finally {
262
+ await session.endSession();
263
+ }
264
+ }
265
+ else {
266
+ // Implement transaction according to the TypeORM docs:
267
+ // https://typeorm.io/docs/transactions/
268
+ // TODO Use QueryRunner instead
269
+ const onRollback = [];
270
+ try {
271
+ await conn.transaction(async (entityManager) => {
272
+ injectContextArgs({ entityManager });
273
+ // Scope the entityManager to this call's async context (see `transactionContext`) rather
274
+ // than stashing it on `this`, which may be a singleton shared with concurrent, unrelated
275
+ // calls.
276
+ result = await transactionContext.run({ entityManager, datasource, onRollback }, () => original.apply(this, args));
277
+ });
278
+ }
279
+ catch (err) {
280
+ await Promise.allSettled(onRollback.map((hook) => hook()));
281
+ throw err;
282
+ }
283
+ }
284
+ return result;
285
+ };
286
+ // A plain `descriptor.value = async function (...) {}` assignment doesn't trigger JS's function-name
287
+ // inference (that only applies to identifier/object-literal-property assignment, not this kind of
288
+ // member expression), so the wrapper would otherwise have `.name === ""`. That breaks
289
+ // `RouteUtils.wrapMiddleware`, which looks up @Param/@Query/@User/etc. argument metadata via
290
+ // `Reflect.getMetadata("rrst:args", proto, func.name)` — losing the name silently drops every HTTP
291
+ // route handler's arguments the moment it's also decorated with `@Transactional`.
292
+ Object.defineProperty(descriptor.value, "name", { value: propertyKey, configurable: true });
293
+ return descriptor;
50
294
  };
51
295
  }
52
296
  //# sourceMappingURL=DatabaseDecorators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseDecorators.js","sourceRoot":"","sources":["../../../src/decorators/DatabaseDecorators.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,kDAAkD;AAClD,+EAA+E;AAE/E;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAS;IACrC,OAAO,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,CAAC,CAAC;AACN,CAAC"}
@@ -1,5 +1,6 @@
1
1
  ///////////////////////////////////////////////////////////////////////////////
2
2
  // Copyright (C) 2020-2026 Jean-Philippe Steinmetz
3
+ // SPDX-License-Identifier: MPL-2.0
3
4
  ///////////////////////////////////////////////////////////////////////////////
4
5
  import "reflect-metadata";
5
6
  /**
@@ -10,8 +11,10 @@ import "reflect-metadata";
10
11
  export function Document(value) {
11
12
  return function (target, propertyKey) {
12
13
  const docs = {
13
- ...(propertyKey ? Reflect.getMetadata("rrst:docs", target, propertyKey) : Reflect.getMetadata("rrst:docs", target)),
14
- ...value
14
+ ...(propertyKey
15
+ ? Reflect.getMetadata("rrst:docs", target, propertyKey)
16
+ : Reflect.getMetadata("rrst:docs", target)),
17
+ ...value,
15
18
  };
16
19
  if (propertyKey) {
17
20
  Reflect.defineMetadata("rrst:docs", docs, target, propertyKey);
@@ -28,7 +31,7 @@ export function Document(value) {
28
31
  */
29
32
  export function Default(value) {
30
33
  return Document({
31
- default: value
34
+ default: value,
32
35
  });
33
36
  }
34
37
  /**
@@ -38,7 +41,7 @@ export function Default(value) {
38
41
  */
39
42
  export function Description(value) {
40
43
  return Document({
41
- description: value
44
+ description: value,
42
45
  });
43
46
  }
44
47
  /**
@@ -48,7 +51,7 @@ export function Description(value) {
48
51
  */
49
52
  export function Example(value) {
50
53
  return Document({
51
- example: value
54
+ example: value,
52
55
  });
53
56
  }
54
57
  /**
@@ -58,7 +61,7 @@ export function Example(value) {
58
61
  */
59
62
  export function Format(value) {
60
63
  return Document({
61
- format: value
64
+ format: value,
62
65
  });
63
66
  }
64
67
  /**
@@ -68,7 +71,7 @@ export function Format(value) {
68
71
  */
69
72
  export function Summary(value) {
70
73
  return Document({
71
- summary: value
74
+ summary: value,
72
75
  });
73
76
  }
74
77
  /**
@@ -78,7 +81,7 @@ export function Summary(value) {
78
81
  */
79
82
  export function Tags(value) {
80
83
  return Document({
81
- tags: value
84
+ tags: value,
82
85
  });
83
86
  }
84
87
  /**
@@ -99,6 +102,12 @@ export function Returns(types) {
99
102
  Reflect.defineMetadata("design:returntype", types !== undefined ? types : [designInfo], target, propertyKey);
100
103
  };
101
104
  }
105
+ /**
106
+ * The metadata key that `@TypeInfo` stores its type information under. Kept distinct from `design:type` (the
107
+ * metadata TypeScript itself emits) so that other consumers of `design:type` — such as the `@Column` decorator's
108
+ * SQL type inference — are never affected by the richer, API-facing type description `@TypeInfo` provides.
109
+ */
110
+ const TYPE_INFO_KEY = "rrst:typeInfo";
102
111
  /**
103
112
  * Stores runtime metadata about the typing information of a class property.
104
113
  *
@@ -114,7 +123,19 @@ export function TypeInfo(types) {
114
123
  // Make sure we always store an array
115
124
  types = Array.isArray(types) ? types : [types];
116
125
  }
117
- Reflect.defineMetadata("design:type", types !== undefined ? types : [designInfo], target, propertyKey);
126
+ Reflect.defineMetadata(TYPE_INFO_KEY, types !== undefined ? types : [designInfo], target, propertyKey);
118
127
  };
119
128
  }
129
+ /**
130
+ * Retrieves the typing information of a class property or function, preferring the richer description provided by
131
+ * `@TypeInfo` and falling back to TypeScript's own `design:type` reflection metadata when `@TypeInfo` was not
132
+ * applied.
133
+ *
134
+ * @param target The class prototype (or class, for static members) to retrieve type information for.
135
+ * @param propertyKey The name of the property or function to retrieve type information for.
136
+ */
137
+ export function getTypeInfo(target, propertyKey) {
138
+ const typeInfo = Reflect.getMetadata(TYPE_INFO_KEY, target, propertyKey);
139
+ return typeInfo !== undefined ? typeInfo : Reflect.getMetadata("design:type", target, propertyKey);
140
+ }
120
141
  //# sourceMappingURL=DocDecorators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocDecorators.js","sourceRoot":"","sources":["../../../src/decorators/DocDecorators.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,kDAAkD;AAClD,+EAA+E;AAC/E,OAAO,kBAAkB,CAAC;AAW1B;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAoB;IACzC,OAAO,UAAU,MAAW,EAAE,WAAoB;QAC9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M,EAAE,WAAW,CAAC,CAAC;IAC3G,CAAC,CAAC;AACN,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,MAAW,EAAE,WAAmB;IACxD,MAAM,QAAQ,GAAQ,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IAC9E,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AACvG,CAAC"}
@@ -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 "reflect-metadata";
5
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"EventDecorators.js","sourceRoot":"","sources":["../../../src/decorators/EventDecorators.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,wEAAwE;AACxE,+EAA+E;AAC/E,OAAO,kBAAkB,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,IAAwB;IAC5C,OAAO,UAAU,MAAW,EAAE,WAAmB,EAAE,UAA8B;QAC7E,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IACnF,CAAC,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IACzB,OAAO,UAAU,MAAW;QACxB,OAAO,CAAC,cAAc,CAAC,qBAAqB,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"EventDecorators.js","sourceRoot":"","sources":["../../../src/decorators/EventDecorators.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,wEAAwE;AACxE,mCAAmC;AACnC,+EAA+E;AAC/E,OAAO,kBAAkB,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,IAAwB;IAC5C,OAAO,UAAU,MAAW,EAAE,WAAmB,EAAE,UAA8B;QAC7E,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IACnF,CAAC,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IACzB,OAAO,UAAU,MAAW;QACxB,OAAO,CAAC,cAAc,CAAC,qBAAqB,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC,CAAC;AACN,CAAC"}
@@ -1,7 +1,9 @@
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 "reflect-metadata";
6
+ import { ACLAction } from "../security/AccessControlList.js";
5
7
  /**
6
8
  * The list of column registrations waiting to be bridged into TypeORM's metadata storage. This list is drained by
7
9
  * the TypeORM support module when a SQL connection is created.
@@ -23,7 +25,7 @@ export function Cache(ttl = 30) {
23
25
  };
24
26
  }
25
27
  /**
26
- * Indicates that a class is a child entity to some parent. Child entities will inherit all datastore configuration
28
+ * Indicates that a class is a child entity to some parent. Child entities will inherit all datasource configuration
27
29
  * of the parent, including cache settings.
28
30
  */
29
31
  export function ChildEntity() {
@@ -50,17 +52,17 @@ export function ChildEntity() {
50
52
  };
51
53
  }
52
54
  /**
53
- * Indicates that the class describes an entity that will be persisted in the datastore with the given name.
55
+ * Indicates that the class describes an entity that will be persisted in the datasource with the given name.
54
56
  *
55
- * @param datastore The name of the datastore to store records of the decorated class.
57
+ * @param datasource The name of the datasource to store records of the decorated class.
56
58
  */
57
- export function DataStore(datastore) {
59
+ export function DataStore(datasource) {
58
60
  return function (target) {
59
- Reflect.defineMetadata("rrst:datastore", datastore, target);
60
- Object.defineProperty(target, "datastore", {
61
+ Reflect.defineMetadata("rrst:datasource", datasource, target);
62
+ Object.defineProperty(target, "datasource", {
61
63
  enumerable: true,
62
64
  writable: true,
63
- value: datastore,
65
+ value: datasource,
64
66
  });
65
67
  };
66
68
  }
@@ -76,6 +78,23 @@ export function Identifier(target, propertyKey) {
76
78
  value: undefined,
77
79
  });
78
80
  }
81
+ /**
82
+ * Apply this to a property that must never be settable by a client. `RepoUtils.create()`/`update()` strip any
83
+ * client-supplied value for a `@ReadOnly` property before persisting — the property's existing/declared-default
84
+ * value is kept instead, regardless of what the request body contains. Use this for fields that should only ever
85
+ * be changed by application/business logic (e.g. `roles`, ownership fields, computed/derived state).
86
+ */
87
+ export function ReadOnly(target, propertyKey) {
88
+ Reflect.defineMetadata("rrst:readOnly", true, target, propertyKey);
89
+ // Class field initializers are compiled as own-instance assignments, so the property never otherwise
90
+ // appears on the prototype — forcing a placeholder onto the prototype (same technique @Identifier uses)
91
+ // is what makes it discoverable via Object.getOwnPropertyNames() in ModelUtils.getReadOnlyPropertyNames().
92
+ Object.defineProperty(target, propertyKey, {
93
+ enumerable: true,
94
+ writable: true,
95
+ value: undefined,
96
+ });
97
+ }
79
98
  /**
80
99
  * Apply this to a model class to indicate that it should be protected by the AccessControlList security system.
81
100
  * The `classACL` parameter specifies the default ACL governing access to general operations against the model class
@@ -91,33 +110,30 @@ export function Protect(classACL = {
91
110
  records: [
92
111
  {
93
112
  userOrRoleId: "anonymous",
94
- create: false,
95
- read: true,
96
- update: false,
97
- delete: false,
98
- special: false,
99
- full: false,
113
+ actions: [ACLAction.COUNT, ACLAction.EXISTS, ACLAction.LIST, ACLAction.READ],
100
114
  },
101
115
  {
102
116
  userOrRoleId: ".*",
103
- create: false,
104
- read: true,
105
- update: false,
106
- delete: false,
107
- special: false,
108
- full: false,
117
+ actions: [ACLAction.COUNT, ACLAction.EXISTS, ACLAction.LIST, ACLAction.READ],
109
118
  },
110
119
  ],
111
120
  }, recordACL = false) {
112
121
  return function (target) {
113
- if (!classACL.uid || classACL.uid === "<ClassName>") {
114
- classACL.uid = target.name;
122
+ // Clone rather than mutate the caller-supplied ACL: applying @Protect(sharedAcl) to more than one class
123
+ // without an explicit `uid` must not let a later class's default uid overwrite an earlier class's `uid`
124
+ // on the very same shared object (classACL is stored by reference on each decorated class).
125
+ const resolvedACL = {
126
+ ...classACL,
127
+ records: classACL.records.map((record) => ({ ...record, actions: [...record.actions] })),
128
+ };
129
+ if (!resolvedACL.uid || resolvedACL.uid === "<ClassName>") {
130
+ resolvedACL.uid = target.name;
115
131
  }
116
- Reflect.defineMetadata("rrst:classACL", classACL, target);
132
+ Reflect.defineMetadata("rrst:classACL", resolvedACL, target);
117
133
  Object.defineProperty(target, "classACL", {
118
134
  enumerable: true,
119
135
  writable: false,
120
- value: classACL,
136
+ value: resolvedACL,
121
137
  });
122
138
  Reflect.defineMetadata("rrst:recordACL", recordACL, target);
123
139
  Object.defineProperty(target, "recordACL", {
@@ -1 +1 @@
1
- {"version":3,"file":"ModelDecorators.js","sourceRoot":"","sources":["../../../src/decorators/ModelDecorators.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,wEAAwE;AACxE,+EAA+E;AAC/E,OAAO,kBAAkB,CAAC;AAe1B;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA2B,EAAE,CAAC;AAEhE;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,MAAc,EAAE;IAClC,OAAO,UAAU,MAAW;QACxB,OAAO,CAAC,cAAc,CAAC,eAAe,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QACrD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE;YACtC,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,IAAI;YACd,KAAK,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MAAW;QACxB,OAAO,CAAC,cAAc,CAAC,kBAAkB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3D,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE;YACzC,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,MAAM;SAChB,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,WAAmB,CAAC,CAAC;IAC9C,OAAO,UAAU,MAAW;QACxB,OAAO,CAAC,cAAc,CAAC,mBAAmB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9D,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE;YAC1C,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,QAAQ;SAClB,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC"}
@@ -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 "reflect-metadata";
5
6
  import { snakeCase } from "../database/NamingUtils.js";
@@ -32,7 +33,7 @@ function collectOwnMetadata(key, target) {
32
33
  return results;
33
34
  }
34
35
  /**
35
- * Indicates that the decorated property will be persisted as a column/property in the datastore.
36
+ * Indicates that the decorated property will be persisted as a column/property in the datasource.
36
37
  *
37
38
  * @param options The options describing the column.
38
39
  */
@@ -47,7 +48,7 @@ export function Column(options = {}) {
47
48
  };
48
49
  }
49
50
  /**
50
- * Indicates that the decorated property is a primary key column in the datastore.
51
+ * Indicates that the decorated property is a primary key column in the datasource.
51
52
  *
52
53
  * @param options The options describing the column.
53
54
  */
@@ -100,7 +101,7 @@ export function Unique(nameOrFields, maybeFields) {
100
101
  }
101
102
  /* eslint-enable no-redeclare */
102
103
  /**
103
- * Indicates that the class describes an entity that is persisted to a datastore.
104
+ * Indicates that the class describes an entity that is persisted to a datasource.
104
105
  *
105
106
  * @param options The options to set.
106
107
  */