@rapidrest/service-core 1.0.0-beta.1

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 (332) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +16 -0
  3. package/dist/lib/ApiErrors.js +41 -0
  4. package/dist/lib/ApiErrors.js.map +1 -0
  5. package/dist/lib/BackgroundService.js +16 -0
  6. package/dist/lib/BackgroundService.js.map +1 -0
  7. package/dist/lib/BackgroundServiceManager.js +135 -0
  8. package/dist/lib/BackgroundServiceManager.js.map +1 -0
  9. package/dist/lib/BulkError.js +24 -0
  10. package/dist/lib/BulkError.js.map +1 -0
  11. package/dist/lib/EventListenerManager.js +161 -0
  12. package/dist/lib/EventListenerManager.js.map +1 -0
  13. package/dist/lib/NetUtils.js +103 -0
  14. package/dist/lib/NetUtils.js.map +1 -0
  15. package/dist/lib/NotificationUtils.js +34 -0
  16. package/dist/lib/NotificationUtils.js.map +1 -0
  17. package/dist/lib/ObjectFactory.js +90 -0
  18. package/dist/lib/ObjectFactory.js.map +1 -0
  19. package/dist/lib/OpenApiSpec.js +748 -0
  20. package/dist/lib/OpenApiSpec.js.map +1 -0
  21. package/dist/lib/Server.js +549 -0
  22. package/dist/lib/Server.js.map +1 -0
  23. package/dist/lib/Types.js +2 -0
  24. package/dist/lib/Types.js.map +1 -0
  25. package/dist/lib/auth/AuthMiddleware.js +229 -0
  26. package/dist/lib/auth/AuthMiddleware.js.map +1 -0
  27. package/dist/lib/auth/AuthStrategy.js +2 -0
  28. package/dist/lib/auth/AuthStrategy.js.map +1 -0
  29. package/dist/lib/auth/BasicStrategy.js +106 -0
  30. package/dist/lib/auth/BasicStrategy.js.map +1 -0
  31. package/dist/lib/auth/JWTStrategy.js +161 -0
  32. package/dist/lib/auth/JWTStrategy.js.map +1 -0
  33. package/dist/lib/auth/index.js +5 -0
  34. package/dist/lib/auth/index.js.map +1 -0
  35. package/dist/lib/database/ConnectionKinds.js +14 -0
  36. package/dist/lib/database/ConnectionKinds.js.map +1 -0
  37. package/dist/lib/database/ConnectionManager.js +161 -0
  38. package/dist/lib/database/ConnectionManager.js.map +1 -0
  39. package/dist/lib/database/MongoConnection.js +86 -0
  40. package/dist/lib/database/MongoConnection.js.map +1 -0
  41. package/dist/lib/database/MongoRepository.js +136 -0
  42. package/dist/lib/database/MongoRepository.js.map +1 -0
  43. package/dist/lib/database/MongoSchemaSync.js +136 -0
  44. package/dist/lib/database/MongoSchemaSync.js.map +1 -0
  45. package/dist/lib/database/NamingUtils.js +52 -0
  46. package/dist/lib/database/NamingUtils.js.map +1 -0
  47. package/dist/lib/database/TypeOrmSupport.js +146 -0
  48. package/dist/lib/database/TypeOrmSupport.js.map +1 -0
  49. package/dist/lib/database/index.js +7 -0
  50. package/dist/lib/database/index.js.map +1 -0
  51. package/dist/lib/decorators/DatabaseDecorators.js +52 -0
  52. package/dist/lib/decorators/DatabaseDecorators.js.map +1 -0
  53. package/dist/lib/decorators/DocDecorators.js +120 -0
  54. package/dist/lib/decorators/DocDecorators.js.map +1 -0
  55. package/dist/lib/decorators/EventDecorators.js +24 -0
  56. package/dist/lib/decorators/EventDecorators.js.map +1 -0
  57. package/dist/lib/decorators/ModelDecorators.js +173 -0
  58. package/dist/lib/decorators/ModelDecorators.js.map +1 -0
  59. package/dist/lib/decorators/PersistenceDecorators.js +177 -0
  60. package/dist/lib/decorators/PersistenceDecorators.js.map +1 -0
  61. package/dist/lib/decorators/RouteDecorators.js +324 -0
  62. package/dist/lib/decorators/RouteDecorators.js.map +1 -0
  63. package/dist/lib/decorators/index.js +7 -0
  64. package/dist/lib/decorators/index.js.map +1 -0
  65. package/dist/lib/http/Adapters.js +230 -0
  66. package/dist/lib/http/Adapters.js.map +1 -0
  67. package/dist/lib/http/Router.js +403 -0
  68. package/dist/lib/http/Router.js.map +1 -0
  69. package/dist/lib/http/WebSocket.js +82 -0
  70. package/dist/lib/http/WebSocket.js.map +1 -0
  71. package/dist/lib/http/index.js +4 -0
  72. package/dist/lib/http/index.js.map +1 -0
  73. package/dist/lib/http/types.js +5 -0
  74. package/dist/lib/http/types.js.map +1 -0
  75. package/dist/lib/index.js +18 -0
  76. package/dist/lib/index.js.map +1 -0
  77. package/dist/lib/models/BaseEntity.js +83 -0
  78. package/dist/lib/models/BaseEntity.js.map +1 -0
  79. package/dist/lib/models/BaseMongoEntity.js +40 -0
  80. package/dist/lib/models/BaseMongoEntity.js.map +1 -0
  81. package/dist/lib/models/ModelUtils.js +645 -0
  82. package/dist/lib/models/ModelUtils.js.map +1 -0
  83. package/dist/lib/models/RecoverableBaseEntity.js +39 -0
  84. package/dist/lib/models/RecoverableBaseEntity.js.map +1 -0
  85. package/dist/lib/models/RecoverableBaseMongoEntity.js +40 -0
  86. package/dist/lib/models/RecoverableBaseMongoEntity.js.map +1 -0
  87. package/dist/lib/models/RepoUtils.js +717 -0
  88. package/dist/lib/models/RepoUtils.js.map +1 -0
  89. package/dist/lib/models/SimpleEntity.js +42 -0
  90. package/dist/lib/models/SimpleEntity.js.map +1 -0
  91. package/dist/lib/models/SimpleMongoEntity.js +38 -0
  92. package/dist/lib/models/SimpleMongoEntity.js.map +1 -0
  93. package/dist/lib/models/StatusExtraData.js +15 -0
  94. package/dist/lib/models/StatusExtraData.js.map +1 -0
  95. package/dist/lib/models/index.js +10 -0
  96. package/dist/lib/models/index.js.map +1 -0
  97. package/dist/lib/routes/AdminRoute.js +268 -0
  98. package/dist/lib/routes/AdminRoute.js.map +1 -0
  99. package/dist/lib/routes/MetricsRoute.js +86 -0
  100. package/dist/lib/routes/MetricsRoute.js.map +1 -0
  101. package/dist/lib/routes/ModelRoute.js +481 -0
  102. package/dist/lib/routes/ModelRoute.js.map +1 -0
  103. package/dist/lib/routes/OpenAPIRoute.js +115 -0
  104. package/dist/lib/routes/OpenAPIRoute.js.map +1 -0
  105. package/dist/lib/routes/RouteUtils.js +445 -0
  106. package/dist/lib/routes/RouteUtils.js.map +1 -0
  107. package/dist/lib/routes/StatusRoute.js +55 -0
  108. package/dist/lib/routes/StatusRoute.js.map +1 -0
  109. package/dist/lib/routes/index.js +7 -0
  110. package/dist/lib/routes/index.js.map +1 -0
  111. package/dist/lib/security/ACLRouteMongo.js +194 -0
  112. package/dist/lib/security/ACLRouteMongo.js.map +1 -0
  113. package/dist/lib/security/ACLRouteSQL.js +193 -0
  114. package/dist/lib/security/ACLRouteSQL.js.map +1 -0
  115. package/dist/lib/security/ACLUtils.js +457 -0
  116. package/dist/lib/security/ACLUtils.js.map +1 -0
  117. package/dist/lib/security/AccessControlList.js +18 -0
  118. package/dist/lib/security/AccessControlList.js.map +1 -0
  119. package/dist/lib/security/AccessControlListMongo.js +155 -0
  120. package/dist/lib/security/AccessControlListMongo.js.map +1 -0
  121. package/dist/lib/security/AccessControlListSQL.js +149 -0
  122. package/dist/lib/security/AccessControlListSQL.js.map +1 -0
  123. package/dist/lib/security/index.js +3 -0
  124. package/dist/lib/security/index.js.map +1 -0
  125. package/dist/lib/test/index.js +3 -0
  126. package/dist/lib/test/index.js.map +1 -0
  127. package/dist/lib/test/request.js +99 -0
  128. package/dist/lib/test/request.js.map +1 -0
  129. package/dist/lib/test/requestws.js +173 -0
  130. package/dist/lib/test/requestws.js.map +1 -0
  131. package/dist/types/ApiErrors.d.ts +38 -0
  132. package/dist/types/BackgroundService.d.ts +30 -0
  133. package/dist/types/BackgroundServiceManager.d.ts +66 -0
  134. package/dist/types/BulkError.d.ts +11 -0
  135. package/dist/types/EventListenerManager.d.ts +36 -0
  136. package/dist/types/NetUtils.d.ts +29 -0
  137. package/dist/types/NotificationUtils.d.ts +25 -0
  138. package/dist/types/ObjectFactory.d.ts +17 -0
  139. package/dist/types/OpenApiSpec.d.ts +114 -0
  140. package/dist/types/Server.d.ts +180 -0
  141. package/dist/types/Types.d.ts +8 -0
  142. package/dist/types/auth/AuthMiddleware.d.ts +42 -0
  143. package/dist/types/auth/AuthStrategy.d.ts +32 -0
  144. package/dist/types/auth/BasicStrategy.d.ts +33 -0
  145. package/dist/types/auth/JWTStrategy.d.ts +61 -0
  146. package/dist/types/auth/index.d.ts +4 -0
  147. package/dist/types/database/ConnectionKinds.d.ts +7 -0
  148. package/dist/types/database/ConnectionManager.d.ts +35 -0
  149. package/dist/types/database/MongoConnection.d.ts +54 -0
  150. package/dist/types/database/MongoRepository.d.ts +92 -0
  151. package/dist/types/database/MongoSchemaSync.d.ts +41 -0
  152. package/dist/types/database/NamingUtils.d.ts +24 -0
  153. package/dist/types/database/TypeOrmSupport.d.ts +20 -0
  154. package/dist/types/database/index.d.ts +6 -0
  155. package/dist/types/decorators/DatabaseDecorators.d.ts +18 -0
  156. package/dist/types/decorators/DocDecorators.d.ts +69 -0
  157. package/dist/types/decorators/EventDecorators.d.ts +12 -0
  158. package/dist/types/decorators/ModelDecorators.d.ts +80 -0
  159. package/dist/types/decorators/PersistenceDecorators.d.ts +117 -0
  160. package/dist/types/decorators/RouteDecorators.d.ts +172 -0
  161. package/dist/types/decorators/index.d.ts +6 -0
  162. package/dist/types/http/Adapters.d.ts +68 -0
  163. package/dist/types/http/Router.d.ts +99 -0
  164. package/dist/types/http/WebSocket.d.ts +56 -0
  165. package/dist/types/http/index.d.ts +6 -0
  166. package/dist/types/http/types.d.ts +54 -0
  167. package/dist/types/index.d.ts +17 -0
  168. package/dist/types/models/BaseEntity.d.ts +29 -0
  169. package/dist/types/models/BaseMongoEntity.d.ts +13 -0
  170. package/dist/types/models/ModelUtils.d.ts +166 -0
  171. package/dist/types/models/RecoverableBaseEntity.d.ts +16 -0
  172. package/dist/types/models/RecoverableBaseMongoEntity.d.ts +16 -0
  173. package/dist/types/models/RepoUtils.d.ts +154 -0
  174. package/dist/types/models/SimpleEntity.d.ts +14 -0
  175. package/dist/types/models/SimpleMongoEntity.d.ts +15 -0
  176. package/dist/types/models/StatusExtraData.d.ts +6 -0
  177. package/dist/types/models/index.d.ts +9 -0
  178. package/dist/types/routes/AdminRoute.d.ts +47 -0
  179. package/dist/types/routes/MetricsRoute.d.ts +15 -0
  180. package/dist/types/routes/ModelRoute.d.ts +226 -0
  181. package/dist/types/routes/OpenAPIRoute.d.ts +17 -0
  182. package/dist/types/routes/RouteUtils.d.ts +55 -0
  183. package/dist/types/routes/StatusRoute.d.ts +11 -0
  184. package/dist/types/routes/index.d.ts +6 -0
  185. package/dist/types/security/ACLRouteMongo.d.ts +19 -0
  186. package/dist/types/security/ACLRouteSQL.d.ts +19 -0
  187. package/dist/types/security/ACLUtils.d.ts +94 -0
  188. package/dist/types/security/AccessControlList.d.ts +103 -0
  189. package/dist/types/security/AccessControlListMongo.d.ts +24 -0
  190. package/dist/types/security/AccessControlListSQL.d.ts +24 -0
  191. package/dist/types/security/index.d.ts +2 -0
  192. package/dist/types/test/index.d.ts +2 -0
  193. package/dist/types/test/request.d.ts +24 -0
  194. package/dist/types/test/requestws.d.ts +21 -0
  195. package/docs/Makefile +20 -0
  196. package/docs/conf.py +58 -0
  197. package/docs/index.rst +17 -0
  198. package/docs/make.bat +35 -0
  199. package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/README.md +13 -0
  200. package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/MongoRepository.md +25 -0
  201. package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/RedisConnection.md +25 -0
  202. package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/Repository.md +25 -0
  203. package/docs/reference/@rapidrest/namespaces/DocDecorators/README.md +23 -0
  204. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Default.md +25 -0
  205. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Description.md +25 -0
  206. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Document.md +25 -0
  207. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Example.md +25 -0
  208. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Format.md +25 -0
  209. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Returns.md +28 -0
  210. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Summary.md +25 -0
  211. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Tags.md +25 -0
  212. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/TypeInfo.md +28 -0
  213. package/docs/reference/@rapidrest/namespaces/DocDecorators/interfaces/DocumentsData.md +57 -0
  214. package/docs/reference/@rapidrest/namespaces/EventDecorators/README.md +12 -0
  215. package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/EventListener.md +17 -0
  216. package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/OnEvent.md +26 -0
  217. package/docs/reference/@rapidrest/namespaces/ModelDecorators/README.md +26 -0
  218. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Cache.md +25 -0
  219. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/ChildEntity.md +18 -0
  220. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/DataStore.md +25 -0
  221. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Identifier.md +27 -0
  222. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Protect.md +35 -0
  223. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Reference.md +25 -0
  224. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Shard.md +27 -0
  225. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/TrackChanges.md +26 -0
  226. package/docs/reference/@rapidrest/namespaces/ModelDecorators/interfaces/PendingTypeOrmColumn.md +45 -0
  227. package/docs/reference/@rapidrest/namespaces/ModelDecorators/variables/pendingTypeOrmColumns.md +14 -0
  228. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/README.md +25 -0
  229. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Column.md +25 -0
  230. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Entity.md +26 -0
  231. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Index.md +119 -0
  232. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/PrimaryColumn.md +25 -0
  233. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Unique.md +68 -0
  234. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getColumnMetadata.md +26 -0
  235. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getEntityName.md +26 -0
  236. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getIndexMetadata.md +27 -0
  237. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnInfo.md +41 -0
  238. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnOptions.md +51 -0
  239. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexInfo.md +41 -0
  240. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexOptions.md +51 -0
  241. package/docs/reference/@rapidrest/namespaces/RouteDecorators/README.md +36 -0
  242. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/After.md +26 -0
  243. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Auth.md +33 -0
  244. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/AuthResult.md +31 -0
  245. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Before.md +25 -0
  246. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/ContentType.md +25 -0
  247. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Delete.md +25 -0
  248. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Get.md +25 -0
  249. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Head.md +25 -0
  250. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Header.md +25 -0
  251. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Method.md +31 -0
  252. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Model.md +25 -0
  253. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Options.md +25 -0
  254. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Param.md +26 -0
  255. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Patch.md +25 -0
  256. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Post.md +25 -0
  257. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Protect.md +31 -0
  258. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Put.md +25 -0
  259. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Query.md +26 -0
  260. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Request.md +31 -0
  261. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/RequiresRole.md +26 -0
  262. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Response.md +31 -0
  263. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Route.md +25 -0
  264. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Socket.md +33 -0
  265. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/User.md +31 -0
  266. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Validate.md +25 -0
  267. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/WebSocket.md +25 -0
  268. package/docs/reference/README.md +20 -0
  269. package/docs/reference/classes/ACLUtils.md +251 -0
  270. package/docs/reference/classes/AdminRoute.md +51 -0
  271. package/docs/reference/classes/AuthMiddleware.md +131 -0
  272. package/docs/reference/classes/BackgroundService.md +117 -0
  273. package/docs/reference/classes/BackgroundServiceManager.md +172 -0
  274. package/docs/reference/classes/BaseEntity.md +82 -0
  275. package/docs/reference/classes/BaseMongoEntity.md +107 -0
  276. package/docs/reference/classes/BasicStrategy.md +89 -0
  277. package/docs/reference/classes/BasicStrategyOptions.md +91 -0
  278. package/docs/reference/classes/BulkError.md +271 -0
  279. package/docs/reference/classes/ConnectionManager.md +75 -0
  280. package/docs/reference/classes/EventListenerManager.md +88 -0
  281. package/docs/reference/classes/JWTStrategy.md +77 -0
  282. package/docs/reference/classes/JWTStrategyOptions.md +97 -0
  283. package/docs/reference/classes/MetricsRoute.md +27 -0
  284. package/docs/reference/classes/ModelRoute.md +527 -0
  285. package/docs/reference/classes/ModelUtils.md +448 -0
  286. package/docs/reference/classes/MongoConnection.md +218 -0
  287. package/docs/reference/classes/MongoRepository.md +354 -0
  288. package/docs/reference/classes/MongoSchemaSync.md +67 -0
  289. package/docs/reference/classes/NetUtils.md +90 -0
  290. package/docs/reference/classes/NotificationUtils.md +77 -0
  291. package/docs/reference/classes/ObjectFactory.md +336 -0
  292. package/docs/reference/classes/OpenAPIRoute.md +77 -0
  293. package/docs/reference/classes/OpenApiSpec.md +892 -0
  294. package/docs/reference/classes/RecoverableBaseEntity.md +114 -0
  295. package/docs/reference/classes/RecoverableBaseMongoEntity.md +124 -0
  296. package/docs/reference/classes/RedisTransport.md +2202 -0
  297. package/docs/reference/classes/RepoUtils.md +486 -0
  298. package/docs/reference/classes/RouteUtils.md +191 -0
  299. package/docs/reference/classes/Server.md +408 -0
  300. package/docs/reference/classes/SimpleEntity.md +48 -0
  301. package/docs/reference/classes/SimpleMongoEntity.md +66 -0
  302. package/docs/reference/classes/StatusExtraData.md +57 -0
  303. package/docs/reference/classes/StatusRoute.md +26 -0
  304. package/docs/reference/enumerations/ACLAction.md +63 -0
  305. package/docs/reference/enumerations/ApiErrorMessages.md +123 -0
  306. package/docs/reference/enumerations/ApiErrors.md +123 -0
  307. package/docs/reference/functions/isSqlDataSource.md +26 -0
  308. package/docs/reference/functions/resolveCollectionName.md +33 -0
  309. package/docs/reference/functions/snakeCase.md +28 -0
  310. package/docs/reference/globals.md +91 -0
  311. package/docs/reference/interfaces/ACLRecord.md +96 -0
  312. package/docs/reference/interfaces/AccessControlList.md +76 -0
  313. package/docs/reference/interfaces/AuthResult.md +55 -0
  314. package/docs/reference/interfaces/AuthStrategy.md +57 -0
  315. package/docs/reference/interfaces/CreateRequestOptions.md +121 -0
  316. package/docs/reference/interfaces/DeleteRequestOptions.md +147 -0
  317. package/docs/reference/interfaces/FindRequestOptions.md +133 -0
  318. package/docs/reference/interfaces/JWTAuthResult.md +84 -0
  319. package/docs/reference/interfaces/RepoCreateOptions.md +95 -0
  320. package/docs/reference/interfaces/RepoDeleteOptions.md +115 -0
  321. package/docs/reference/interfaces/RepoFindOptions.md +135 -0
  322. package/docs/reference/interfaces/RepoOperationOptions.md +69 -0
  323. package/docs/reference/interfaces/RepoUpdateOptions.md +111 -0
  324. package/docs/reference/interfaces/RequestOptions.md +112 -0
  325. package/docs/reference/interfaces/TruncateRequestOptions.md +175 -0
  326. package/docs/reference/interfaces/UpdateRequestOptions.md +149 -0
  327. package/docs/reference/type-aliases/OneOrMany.md +19 -0
  328. package/docs/reference/type-aliases/OneOrNull.md +19 -0
  329. package/docs/reference/type-aliases/PartialBaseEntity.md +17 -0
  330. package/docs/reference/type-aliases/PartialSimpleEntity.md +17 -0
  331. package/docs/reference/type-aliases/UpdateObject.md +19 -0
  332. package/package.json +125 -0
@@ -0,0 +1,481 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ ///////////////////////////////////////////////////////////////////////////////
11
+ // Copyright (C) 2020-2026 Jean-Philippe Steinmetz. All rights reserved.
12
+ ///////////////////////////////////////////////////////////////////////////////
13
+ import { ModelUtils } from "../models/ModelUtils.js";
14
+ import { RepoUtils } from "../models/RepoUtils.js";
15
+ import { Redis } from "ioredis";
16
+ import { RedisConnection } from "../decorators/DatabaseDecorators.js";
17
+ import { BulkError } from "../BulkError.js";
18
+ import { ApiErrorMessages, ApiErrors } from "../ApiErrors.js";
19
+ import { ApiError, Event, EventUtils, ObjectDecorators } from "@rapidrest/core";
20
+ import { ACLAction } from "../security/AccessControlList.js";
21
+ import { ACLUtils } from "../security/ACLUtils.js";
22
+ import { NotificationUtils } from "../NotificationUtils.js";
23
+ import { NetUtils } from "../NetUtils.js";
24
+ import { ObjectFactory } from "../ObjectFactory.js";
25
+ const { Config, Init, Inject, Logger } = ObjectDecorators;
26
+ /**
27
+ * The `ModelRoute` is an abstract base class that provides a set of built-in route behavior functions for handling
28
+ * requests for a given data model that is managed by a persistent datastore.
29
+ *
30
+ * Provided behaviors:
31
+ * * `count` - Counts the number of objects matching the provided set of criteria in the request's query parameters.
32
+ * * `create` - Adds a new object to the datastore.
33
+ * * `delete` - Removes an existing object from the datastore.
34
+ * * `find` - Finds all objects matching the provided set of criteria in the request's query parameters.
35
+ * * `findById` - Finds a single object with a specified unique identifier.
36
+ * * `truncate` - Removes all objects from the datastore.
37
+ * * `update` - Modifies an existing object in the datastore.
38
+ *
39
+ * @author Jean-Philippe Steinmetz
40
+ */
41
+ export class ModelRoute {
42
+ constructor() {
43
+ /** The unique identifier of the default ACL for the model type. */
44
+ this.defaultACLUid = "";
45
+ /**
46
+ * The number of previous document versions to store in the database. A negative value indicates storing all
47
+ * versions, a value of `0` stores no versions.
48
+ */
49
+ this.trackChanges = 0;
50
+ this.trustedRoles = ["admin"];
51
+ }
52
+ /**
53
+ * The class type of the model this route is associated with.
54
+ */
55
+ get modelClass() {
56
+ const clazz = Object.getPrototypeOf(this).constructor;
57
+ return clazz.modelClass;
58
+ }
59
+ /**
60
+ * Called on server startup to initialize the route with any defaults.
61
+ */
62
+ async superInitialize() {
63
+ if (!this.objectFactory) {
64
+ throw new Error("objectFactory is not set!");
65
+ }
66
+ this.repoUtils = await this.objectFactory.newInstance(this.repoUtilsClass || RepoUtils, {
67
+ name: this.modelClass.name,
68
+ initialize: true,
69
+ args: [this.modelClass],
70
+ });
71
+ let defaultAcl = this.repoUtils.getDefaultACL();
72
+ if (defaultAcl) {
73
+ this.defaultACLUid = defaultAcl.uid;
74
+ }
75
+ }
76
+ /**
77
+ * Attempts to retrieve the number of data model objects matching the given set of criteria as specified in the
78
+ * request `query`. Any results that have been found are set to the `content-length` header of the `res` argument.
79
+ *
80
+ * @param options The options to process the request using.
81
+ */
82
+ async doCount(options) {
83
+ if (!this.repoUtils) {
84
+ throw new ApiError(ApiErrors.INTERNAL_ERROR, 500, ApiErrorMessages.INTERNAL_ERROR);
85
+ }
86
+ if (!options.res) {
87
+ throw new ApiError(ApiErrors.INTERNAL_ERROR, 500, ApiErrorMessages.INTERNAL_ERROR);
88
+ }
89
+ const searchQuery = ModelUtils.buildSearchQuery(this.modelClass, this.repoUtils.repo, options.params, options.query, true, options.user);
90
+ const result = await this.repoUtils.count(searchQuery, {
91
+ limit: options.query?.limit,
92
+ page: options.query?.page,
93
+ productUid: options.params?.productUid || options.query?.productUid,
94
+ version: options.params?.version || options.query?.version,
95
+ user: options.user,
96
+ });
97
+ options.res.setHeader("content-length", result);
98
+ return options.res.status(200);
99
+ }
100
+ /**
101
+ * Attempts to store an object provided in `options.req.body` into the datastore. Upon success, sets the newly persisted
102
+ * object(s) to the `result` property of the `options.res` argument, otherwise sends a `400 BAD REQUEST` response to the
103
+ * client.
104
+ *
105
+ * @param obj The object to store in the database.
106
+ * @param options The options to process the request using.
107
+ */
108
+ async doCreateObject(obj, options) {
109
+ if (!this.repoUtils) {
110
+ throw new Error("repoUtils not set!");
111
+ }
112
+ // Make sure the provided object has the correct typing
113
+ let result = this.repoUtils.instantiateObject(obj);
114
+ result = await this.repoUtils.create(result, options);
115
+ if (options.recordEvent) {
116
+ const evt = {
117
+ type: `Create${this.modelClass.name}`,
118
+ objectUid: result.uid,
119
+ userUid: options.user ? options.user.uid : undefined,
120
+ ip: options.req ? NetUtils.getIPAddress(options.req, this.config?.get("trusted_proxies")) : undefined,
121
+ };
122
+ void EventUtils.record(new Event(this.config, options.user ? options.user.uid : "anonymous", evt));
123
+ }
124
+ return result;
125
+ }
126
+ /**
127
+ * Attempts to store a collection of objects provided in `options.req.body` into the datastore. Upon success, sets the newly persisted
128
+ * object(s) to the `result` property of the `options.res` argument, otherwise sends a `400 BAD REQUEST` response to the
129
+ * client.
130
+ *
131
+ * @param objs The object(s) to store in the database.
132
+ * @param options The options to process the request using.
133
+ */
134
+ async doBulkCreate(objs, options) {
135
+ let thrownError = false;
136
+ const errors = [];
137
+ const results = [];
138
+ for (const obj of objs) {
139
+ try {
140
+ results.push(await this.doCreateObject(obj, options));
141
+ errors.push(null);
142
+ }
143
+ catch (err) {
144
+ errors.push(err);
145
+ thrownError = true;
146
+ }
147
+ }
148
+ if (thrownError) {
149
+ throw new BulkError(errors, ApiErrors.BULK_CREATE_FAILURE, 400, ApiErrorMessages.BULK_CREATE_FAILURE);
150
+ }
151
+ return results;
152
+ }
153
+ /**
154
+ * Attempts to store one or more objects provided in `options.req.body` into the datastore. Upon success, sets the newly persisted
155
+ * object(s) to the `result` property of the `options.res` argument, otherwise sends a `400 BAD REQUEST` response to the
156
+ * client.
157
+ *
158
+ * @param obj The object(s) to store in the database.
159
+ * @param options The options to process the request using.
160
+ */
161
+ async doCreate(obj, options) {
162
+ if (!(await this.aclUtils?.hasPermission(options.user, this.defaultACLUid, ACLAction.CREATE))) {
163
+ throw new ApiError(ApiErrors.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
164
+ }
165
+ if (Array.isArray(obj)) {
166
+ return await this.doBulkCreate(obj, {
167
+ ...options,
168
+ ignoreACL: true,
169
+ });
170
+ }
171
+ else {
172
+ return await this.doCreateObject(obj, {
173
+ ...options,
174
+ ignoreACL: true,
175
+ });
176
+ }
177
+ }
178
+ /**
179
+ * Attempts to delete an existing data model object with a given unique identifier encoded by the URI parameter
180
+ * `id`.
181
+ *
182
+ * @param id The unique identifier of the object to delete.
183
+ * @param options The options to process the request using.
184
+ */
185
+ async doDelete(id, options) {
186
+ if (!this.repoUtils || !this.repoUtils.repo) {
187
+ throw new ApiError(ApiErrors.INTERNAL_ERROR, 500, ApiErrorMessages.INTERNAL_ERROR);
188
+ }
189
+ // When id === `me` this is a special keyword meaning the authenticated user
190
+ if (id.toLowerCase() === "me") {
191
+ if (options.user) {
192
+ id = options.user.uid;
193
+ }
194
+ else {
195
+ throw new ApiError(ApiErrors.SEARCH_INVALID_ME_REFERENCE, 403, ApiErrorMessages.SEARCH_INVALID_ME_REFERENCE);
196
+ }
197
+ }
198
+ const existing = await this.repoUtils.findOne(id, {
199
+ productUid: options.productUid,
200
+ version: options.version,
201
+ });
202
+ if (!existing) {
203
+ throw new ApiError(ApiErrors.NOT_FOUND, 404, ApiErrorMessages.NOT_FOUND);
204
+ }
205
+ await this.repoUtils.delete(existing.uid, options);
206
+ if (options.recordEvent) {
207
+ const count = await this.repoUtils.repo.count({ uid: existing.uid });
208
+ const evt = {
209
+ type: `Delete${this.modelClass.name}`,
210
+ objectUid: existing.uid,
211
+ userUid: options.user ? options.user.uid : "anonymous",
212
+ ip: options.req ? NetUtils.getIPAddress(options.req, this.config?.get("trusted_proxies")) : undefined,
213
+ purged: count === 0,
214
+ };
215
+ void EventUtils.record(new Event(this.config, options.user ? options.user.uid : "anonymous", evt));
216
+ }
217
+ }
218
+ /**
219
+ * Attempts to determine if an existing object with the given unique identifier exists.
220
+ *
221
+ * @param id The unique identifier of the object to verify exists.
222
+ * @param options The options to process the request using.
223
+ */
224
+ async doExists(id, options) {
225
+ if (!this.repoUtils || !options.res) {
226
+ throw new ApiError(ApiErrors.INTERNAL_ERROR, 500, ApiErrorMessages.INTERNAL_ERROR);
227
+ }
228
+ // When id === `me` this is a special keyword meaning the authenticated user
229
+ if (id.toLowerCase() === "me") {
230
+ if (options.user) {
231
+ id = options.user.uid;
232
+ }
233
+ else {
234
+ throw new ApiError(ApiErrors.SEARCH_INVALID_ME_REFERENCE, 403, ApiErrorMessages.SEARCH_INVALID_ME_REFERENCE);
235
+ }
236
+ }
237
+ // Check user permissions
238
+ if (this.aclUtils && !options.ignoreACL) {
239
+ if (!(await this.aclUtils.hasPermission(options.user, this.defaultACLUid, ACLAction.READ))) {
240
+ throw new ApiError(ApiErrors.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
241
+ }
242
+ }
243
+ const query = this.repoUtils.searchIdQuery(id, options.query.version);
244
+ const result = await this.repoUtils.count(query);
245
+ if (result > 0) {
246
+ return options.res.status(200).setHeader("content-length", result);
247
+ }
248
+ else {
249
+ return options.res.status(404);
250
+ }
251
+ }
252
+ /**
253
+ * Attempts to retrieve all data model objects matching the given set of criteria as specified in the request
254
+ * `query`. Any results that have been found are set to the `result` property of the `res` argument. `result` is
255
+ * never null.
256
+ *
257
+ * @param options The options to process the request using.
258
+ */
259
+ async doFindAll(options) {
260
+ if (!this.repoUtils) {
261
+ throw new ApiError(ApiErrors.INTERNAL_ERROR, 500, ApiErrorMessages.INTERNAL_ERROR);
262
+ }
263
+ // Check user permissions
264
+ if (this.aclUtils && !options.ignoreACL) {
265
+ if (!(await this.aclUtils.hasPermission(options.user, this.defaultACLUid, ACLAction.READ))) {
266
+ throw new ApiError(ApiErrors.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
267
+ }
268
+ }
269
+ const searchQuery = ModelUtils.buildSearchQuery(this.modelClass, this.repoUtils.repo, options.params, options.query, true, options.user);
270
+ return await this.repoUtils.find(searchQuery, {
271
+ limit: options.query?.limit,
272
+ page: options.query?.page,
273
+ productUid: options.params?.productUid || options.query?.productUid,
274
+ version: options.params?.version || options.query?.version,
275
+ user: options.user,
276
+ });
277
+ }
278
+ /**
279
+ * Attempts to retrieve a single data model object as identified by the `id` parameter in the URI.
280
+ *
281
+ * @param options The options to process the request using.
282
+ */
283
+ async doFindById(id, options) {
284
+ if (!this.repoUtils) {
285
+ throw new ApiError(ApiErrors.INTERNAL_ERROR, 500, ApiErrorMessages.INTERNAL_ERROR);
286
+ }
287
+ // When id === `me` this is a special keyword meaning the authenticated user
288
+ if (id.toLowerCase() === "me") {
289
+ if (options.user) {
290
+ id = options.user.uid;
291
+ }
292
+ else {
293
+ throw new ApiError(ApiErrors.SEARCH_INVALID_ME_REFERENCE, 403, ApiErrorMessages.SEARCH_INVALID_ME_REFERENCE);
294
+ }
295
+ }
296
+ const result = await this.repoUtils.findOne(id, {
297
+ productUid: options.params?.productUid || options.query?.productUid,
298
+ version: options.params?.version || options.query?.version,
299
+ });
300
+ if (!result) {
301
+ throw new ApiError(ApiErrors.NOT_FOUND, 404, ApiErrorMessages.NOT_FOUND);
302
+ }
303
+ if (this.aclUtils && !options.ignoreACL) {
304
+ const acl = await this.aclUtils.findACL(result.uid);
305
+ if (!(await this.aclUtils.hasPermission(options.user, acl ? acl : this.defaultACLUid, ACLAction.READ))) {
306
+ throw new ApiError(ApiErrors.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
307
+ }
308
+ }
309
+ return result;
310
+ }
311
+ /**
312
+ * Attempts to remove all entries of the data model type from the datastore matching the given
313
+ * parameters and query.
314
+ *
315
+ * @param options The options to process the request using.
316
+ */
317
+ async doTruncate(options) {
318
+ if (!this.repoUtils) {
319
+ throw new ApiError(ApiErrors.INTERNAL_ERROR, 500, ApiErrorMessages.INTERNAL_ERROR);
320
+ }
321
+ const searchQuery = ModelUtils.buildSearchQuery(this.modelClass, this.repoUtils.repo, options.params, options.query, true, options.user);
322
+ await this.repoUtils?.truncate(searchQuery, {
323
+ limit: options.query?.limit,
324
+ page: options.query?.page,
325
+ productUid: options.params?.productUid || options.query?.productUid,
326
+ pushChannels: options.pushChannels,
327
+ skipPush: options.skipPush,
328
+ version: options.params?.version || options.query?.version,
329
+ user: options.user,
330
+ });
331
+ if (options.recordEvent) {
332
+ const evt = {
333
+ type: `Truncate${this.modelClass.name}`,
334
+ userUid: options.user ? options.user.uid : "anonymous",
335
+ ip: options.req ? NetUtils.getIPAddress(options.req, this.config?.get("trusted_proxies")) : undefined,
336
+ };
337
+ void EventUtils.record(new Event(this.config, options.user ? options.user.uid : "anonymous", evt));
338
+ }
339
+ }
340
+ /**
341
+ * Attempts to modify a collection of existing data model objects.
342
+ *
343
+ * @param objs The object(s) to bulk update in the database.
344
+ * @param options The options to process the request using.
345
+ */
346
+ async doBulkUpdate(objs, options) {
347
+ let thrownError = false;
348
+ const errors = [];
349
+ const result = [];
350
+ for (const obj of objs) {
351
+ try {
352
+ result.push(await this.doUpdate(obj.uid, obj, options));
353
+ errors.push(null);
354
+ }
355
+ catch (err) {
356
+ errors.push(err);
357
+ thrownError = true;
358
+ }
359
+ }
360
+ if (thrownError) {
361
+ throw new BulkError(errors, ApiErrors.BULK_UPDATE_FAILURE, 400, ApiErrorMessages.BULK_UPDATE_FAILURE);
362
+ }
363
+ return result;
364
+ }
365
+ /**
366
+ * Attempts to modify an existing data model object as identified by the `id` parameter in the URI.
367
+ *
368
+ * @param obj The object to update in the database
369
+ * @param options The options to process the request using.
370
+ */
371
+ async doUpdate(id, obj, options) {
372
+ if (!this.repoUtils) {
373
+ throw new ApiError(ApiErrors.INTERNAL_ERROR, 500, ApiErrorMessages.INTERNAL_ERROR);
374
+ }
375
+ // When id === `me` this is a special keyword meaning the authenticated user
376
+ if (id.toLowerCase() === "me") {
377
+ if (options.user) {
378
+ id = options.user.uid;
379
+ }
380
+ else {
381
+ throw new ApiError(ApiErrors.SEARCH_INVALID_ME_REFERENCE, 403, ApiErrorMessages.SEARCH_INVALID_ME_REFERENCE);
382
+ }
383
+ }
384
+ const existing = await this.repoUtils.findOne(id, {
385
+ productUid: options.productUid || obj.productUid,
386
+ skipCache: true,
387
+ });
388
+ if (!existing) {
389
+ throw new ApiError(ApiErrors.NOT_FOUND, 404, ApiErrorMessages.NOT_FOUND);
390
+ }
391
+ const result = await this.repoUtils.update(obj, existing, options);
392
+ if (options.recordEvent) {
393
+ const evt = {
394
+ type: `Update${this.modelClass.name}`,
395
+ objectUid: obj.uid,
396
+ userUid: options.user ? options.user.uid : "anonymous",
397
+ ip: options.req ? NetUtils.getIPAddress(options.req, this.config?.get("trusted_proxies")) : undefined,
398
+ };
399
+ void EventUtils.record(new Event(this.config, options.user ? options.user.uid : "anonymous", evt));
400
+ }
401
+ return result;
402
+ }
403
+ /**
404
+ * Attempts to modify a single property of an existing data model object as identified by the `id` parameter in the URI.
405
+ *
406
+ * Note that this effectively bypasses optimistic locking and can cause unexpected data overwrites. Use with care.
407
+ *
408
+ * @param id The unique identifier of the object to update.
409
+ * @param propertyName The name of the property to update.
410
+ * @param value The value of the property to set.
411
+ * @param options The options to process the request using.
412
+ */
413
+ async doUpdateProperty(id, propertyName, value, options) {
414
+ // When id === `me` this is a special keyword meaning the authenticated user
415
+ if (id.toLowerCase() === "me") {
416
+ if (options.user) {
417
+ id = options.user.uid;
418
+ }
419
+ else {
420
+ throw new ApiError(ApiErrors.SEARCH_INVALID_ME_REFERENCE, 403, ApiErrorMessages.SEARCH_INVALID_ME_REFERENCE);
421
+ }
422
+ }
423
+ const existing = options.existing ||
424
+ (await this.repoUtils?.findOne(id, {
425
+ productUid: options.productUid,
426
+ }));
427
+ if (!existing) {
428
+ throw new ApiError(ApiErrors.NOT_FOUND, 404, ApiErrorMessages.NOT_FOUND);
429
+ }
430
+ return await this.doUpdate(id, {
431
+ uid: existing.uid,
432
+ productUid: options.productUid || "productUid" in existing ? existing.productUid : undefined,
433
+ version: options.version || "version" in existing ? existing.version : undefined,
434
+ [propertyName]: value,
435
+ }, {
436
+ ...options,
437
+ existing,
438
+ });
439
+ }
440
+ /**
441
+ * Calls `repoUtils.validate()` to validate the object(s) provided.
442
+ */
443
+ async doValidate(objs, options) {
444
+ await this.repoUtils?.validate(objs, options);
445
+ }
446
+ }
447
+ __decorate([
448
+ Inject(ACLUtils),
449
+ __metadata("design:type", ACLUtils)
450
+ ], ModelRoute.prototype, "aclUtils", void 0);
451
+ __decorate([
452
+ RedisConnection("cache"),
453
+ __metadata("design:type", Redis)
454
+ ], ModelRoute.prototype, "cacheClient", void 0);
455
+ __decorate([
456
+ Config(),
457
+ __metadata("design:type", Object)
458
+ ], ModelRoute.prototype, "config", void 0);
459
+ __decorate([
460
+ Logger,
461
+ __metadata("design:type", Object)
462
+ ], ModelRoute.prototype, "logger", void 0);
463
+ __decorate([
464
+ Inject(NotificationUtils),
465
+ __metadata("design:type", NotificationUtils)
466
+ ], ModelRoute.prototype, "notificationUtils", void 0);
467
+ __decorate([
468
+ Inject(ObjectFactory),
469
+ __metadata("design:type", ObjectFactory)
470
+ ], ModelRoute.prototype, "objectFactory", void 0);
471
+ __decorate([
472
+ Config("trusted_roles", ["admin"]),
473
+ __metadata("design:type", Array)
474
+ ], ModelRoute.prototype, "trustedRoles", void 0);
475
+ __decorate([
476
+ Init,
477
+ __metadata("design:type", Function),
478
+ __metadata("design:paramtypes", []),
479
+ __metadata("design:returntype", Promise)
480
+ ], ModelRoute.prototype, "superInitialize", null);
481
+ //# sourceMappingURL=ModelRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelRoute.js","sourceRoot":"","sources":["../../../src/routes/ModelRoute.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+EAA+E;AAC/E,wEAAwE;AACxE,+EAA+E;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAwB,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEzE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAGtE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE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,CAAC,EAAE,KAAK;SACjB,EACR;YACI,GAAG,OAAO;YACV,QAAQ;SACX,CACJ,CAAC;IACN,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,UAAU,CAAC,IAA+B,EAAE,OAAwD;QAChH,MAAM,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;CACJ;AA9gBa;IADT,MAAM,CAAC,QAAQ,CAAC;8BACI,QAAQ;4CAAC;AAIpB;IADT,eAAe,CAAC,OAAO,CAAC;8BACD,KAAK;+CAAC;AAIpB;IADT,MAAM,EAAE;;0CACc;AAMb;IADT,MAAM;;0CACe;AAGZ;IADT,MAAM,CAAC,iBAAiB,CAAC;8BACI,iBAAiB;qDAAC;AAGtC;IADT,MAAM,CAAC,aAAa,CAAC;8BACI,aAAa;iDAAC;AAe9B;IADT,MAAM,CAAC,eAAe,EAAE,CAAC,OAAO,CAAC,CAAC;;gDACU;AAc/B;IADb,IAAI;;;;iDAgBJ"}
@@ -0,0 +1,115 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ ///////////////////////////////////////////////////////////////////////////////
11
+ // Copyright (C) 2020-2026 Jean-Philippe Steinmetz
12
+ ///////////////////////////////////////////////////////////////////////////////
13
+ import { ObjectDecorators } from "@rapidrest/core";
14
+ import { OpenApiSpec } from "../OpenApiSpec.js";
15
+ import { Description, Returns, Summary } from "../decorators/DocDecorators.js";
16
+ import { Get, Route, ContentType } from "../decorators/RouteDecorators.js";
17
+ const { Inject } = ObjectDecorators;
18
+ /** Inline Swagger UI HTML page — loads swagger-ui-dist from CDN so there is no npm dependency. */
19
+ function swaggerHtml(specUrl) {
20
+ return `<!DOCTYPE html>
21
+ <html lang="en">
22
+ <head>
23
+ <meta charset="UTF-8">
24
+ <title>API Documentation</title>
25
+ <link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist/swagger-ui.css">
26
+ </head>
27
+ <body>
28
+ <div id="swagger-ui"></div>
29
+ <script src="https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js"></script>
30
+ <script>
31
+ SwaggerUIBundle({
32
+ url: "${specUrl}",
33
+ dom_id: "#swagger-ui",
34
+ presets: [SwaggerUIBundle.presets.apis, SwaggerUIBundle.SwaggerUIStandalonePreset],
35
+ layout: "BaseLayout"
36
+ });
37
+ </script>
38
+ </body>
39
+ </html>`;
40
+ }
41
+ /**
42
+ * The `OpenAPIRoute` provides default routes to expose the service's OpenAPI specification.
43
+ *
44
+ * - `GET /` — Swagger UI HTML (loads swagger-ui-dist from CDN)
45
+ * - `GET /openapi.json` — raw OpenAPI specification as JSON
46
+ * - `GET /openapi.yaml` — raw OpenAPI specification as YAML
47
+ *
48
+ * @author Jean-Philippe Steinmetz
49
+ */
50
+ let OpenAPIRoute = class OpenAPIRoute {
51
+ constructor() {
52
+ /** The underlying OpenAPI specification. */
53
+ this.apiSpec = new OpenApiSpec();
54
+ }
55
+ getHTML() {
56
+ return swaggerHtml("/openapi.json");
57
+ }
58
+ getAPIDocs() {
59
+ return swaggerHtml("/openapi.json");
60
+ }
61
+ getJSON() {
62
+ return this.apiSpec.getSpec();
63
+ }
64
+ getYAML() {
65
+ return this.apiSpec.getSpecAsYaml();
66
+ }
67
+ };
68
+ __decorate([
69
+ Inject(OpenApiSpec),
70
+ __metadata("design:type", OpenApiSpec)
71
+ ], OpenAPIRoute.prototype, "apiSpec", void 0);
72
+ __decorate([
73
+ Summary("{{serviceName}} OpenAPI, HTLM format"),
74
+ Description("Returns the OpenAPI specification for the service in HTML format."),
75
+ Get(),
76
+ ContentType("text/html"),
77
+ Returns([String]),
78
+ __metadata("design:type", Function),
79
+ __metadata("design:paramtypes", []),
80
+ __metadata("design:returntype", String)
81
+ ], OpenAPIRoute.prototype, "getHTML", null);
82
+ __decorate([
83
+ Summary("{{serviceName}} API docs"),
84
+ Description("Returns the OpenAPI specification for the service in HTML format."),
85
+ Get("api-docs"),
86
+ ContentType("text/html"),
87
+ Returns([String]),
88
+ __metadata("design:type", Function),
89
+ __metadata("design:paramtypes", []),
90
+ __metadata("design:returntype", String)
91
+ ], OpenAPIRoute.prototype, "getAPIDocs", null);
92
+ __decorate([
93
+ Summary("{{serviceName}} OpenAPI, JSON format"),
94
+ Description("Returns the OpenAPI specification for the service in JSON format."),
95
+ Get("openapi.json"),
96
+ Returns([String]),
97
+ __metadata("design:type", Function),
98
+ __metadata("design:paramtypes", []),
99
+ __metadata("design:returntype", Object)
100
+ ], OpenAPIRoute.prototype, "getJSON", null);
101
+ __decorate([
102
+ Summary("{{serviceName}} OpenAPI, YAML format"),
103
+ Description("Returns the OpenAPI specification for the service in YAML format."),
104
+ Get("openapi.yaml"),
105
+ ContentType("text/yaml"),
106
+ Returns([String]),
107
+ __metadata("design:type", Function),
108
+ __metadata("design:paramtypes", []),
109
+ __metadata("design:returntype", String)
110
+ ], OpenAPIRoute.prototype, "getYAML", null);
111
+ OpenAPIRoute = __decorate([
112
+ Route("/")
113
+ ], OpenAPIRoute);
114
+ export { OpenAPIRoute };
115
+ //# sourceMappingURL=OpenAPIRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenAPIRoute.js","sourceRoot":"","sources":["../../../src/routes/OpenAPIRoute.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+EAA+E;AAC/E,kDAAkD;AAClD,+EAA+E;AAC/E,OA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