@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.
- package/LICENSE +382 -23
- package/README.md +79 -5
- package/dist/lib/ApiErrors.js +10 -0
- package/dist/lib/ApiErrors.js.map +1 -1
- package/dist/lib/BackgroundService.js +1 -4
- package/dist/lib/BackgroundService.js.map +1 -1
- package/dist/lib/BackgroundServiceManager.js +47 -6
- package/dist/lib/BackgroundServiceManager.js.map +1 -1
- package/dist/lib/BulkError.js +4 -0
- package/dist/lib/BulkError.js.map +1 -1
- package/dist/lib/EventListenerManager.js +53 -18
- package/dist/lib/EventListenerManager.js.map +1 -1
- package/dist/lib/NetUtils.js +1 -0
- package/dist/lib/NetUtils.js.map +1 -1
- package/dist/lib/NotificationUtils.js +27 -8
- package/dist/lib/NotificationUtils.js.map +1 -1
- package/dist/lib/ObjectFactory.js +25 -44
- package/dist/lib/ObjectFactory.js.map +1 -1
- package/dist/lib/OpenApiSpec.js +31 -11
- package/dist/lib/OpenApiSpec.js.map +1 -1
- package/dist/lib/Server.js +74 -110
- package/dist/lib/Server.js.map +1 -1
- package/dist/lib/auth/AuthMiddleware.js +11 -16
- package/dist/lib/auth/AuthMiddleware.js.map +1 -1
- package/dist/lib/auth/JWTStrategy.js +68 -17
- package/dist/lib/auth/JWTStrategy.js.map +1 -1
- package/dist/lib/auth/index.js +0 -1
- package/dist/lib/auth/index.js.map +1 -1
- package/dist/lib/database/ConnectionKinds.js +15 -0
- package/dist/lib/database/ConnectionKinds.js.map +1 -1
- package/dist/lib/database/ConnectionManager.js +140 -61
- package/dist/lib/database/ConnectionManager.js.map +1 -1
- package/dist/lib/database/MongoConnection.js +13 -3
- package/dist/lib/database/MongoConnection.js.map +1 -1
- package/dist/lib/database/MongoRepository.js +61 -15
- package/dist/lib/database/MongoRepository.js.map +1 -1
- package/dist/lib/database/MongoSchemaSync.js +3 -3
- package/dist/lib/database/MongoSchemaSync.js.map +1 -1
- package/dist/lib/database/NamingUtils.js +3 -2
- package/dist/lib/database/NamingUtils.js.map +1 -1
- package/dist/lib/database/RedisCache.js +64 -0
- package/dist/lib/database/RedisCache.js.map +1 -0
- package/dist/lib/database/TypeOrmSupport.js +53 -13
- package/dist/lib/database/TypeOrmSupport.js.map +1 -1
- package/dist/lib/database/index.js +1 -0
- package/dist/lib/database/index.js.map +1 -1
- package/dist/lib/decorators/DatabaseDecorators.js +264 -20
- package/dist/lib/decorators/DatabaseDecorators.js.map +1 -1
- package/dist/lib/decorators/DocDecorators.js +30 -9
- package/dist/lib/decorators/DocDecorators.js.map +1 -1
- package/dist/lib/decorators/EventDecorators.js +1 -0
- package/dist/lib/decorators/EventDecorators.js.map +1 -1
- package/dist/lib/decorators/ModelDecorators.js +39 -23
- package/dist/lib/decorators/ModelDecorators.js.map +1 -1
- package/dist/lib/decorators/PersistenceDecorators.js +4 -3
- package/dist/lib/decorators/PersistenceDecorators.js.map +1 -1
- package/dist/lib/decorators/RouteDecorators.js +139 -36
- package/dist/lib/decorators/RouteDecorators.js.map +1 -1
- package/dist/lib/http/IWebSocketShim.js +2 -0
- package/dist/lib/http/IWebSocketShim.js.map +1 -0
- package/dist/lib/http/MiddlewareChain.js +167 -0
- package/dist/lib/http/MiddlewareChain.js.map +1 -0
- package/dist/lib/http/RuntimeDetect.js +9 -0
- package/dist/lib/http/RuntimeDetect.js.map +1 -0
- package/dist/lib/http/bun/BunAdapters.js +326 -0
- package/dist/lib/http/bun/BunAdapters.js.map +1 -0
- package/dist/lib/http/bun/BunRouter.js +391 -0
- package/dist/lib/http/bun/BunRouter.js.map +1 -0
- package/dist/lib/http/bun/BunWebSocket.js +49 -0
- package/dist/lib/http/bun/BunWebSocket.js.map +1 -0
- package/dist/lib/http/index.js +16 -3
- package/dist/lib/http/index.js.map +1 -1
- package/dist/lib/http/session/RedisSessionStore.js +30 -0
- package/dist/lib/http/session/RedisSessionStore.js.map +1 -0
- package/dist/lib/http/session/SessionManager.js +113 -0
- package/dist/lib/http/session/SessionManager.js.map +1 -0
- package/dist/lib/http/session/SessionStore.js +6 -0
- package/dist/lib/http/session/SessionStore.js.map +1 -0
- package/dist/lib/http/session/sessionMiddleware.js +42 -0
- package/dist/lib/http/session/sessionMiddleware.js.map +1 -0
- package/dist/lib/http/types.js +0 -3
- package/dist/lib/http/types.js.map +1 -1
- package/dist/lib/http/uWS/Adapters.js +421 -0
- package/dist/lib/http/uWS/Adapters.js.map +1 -0
- package/dist/lib/http/{Router.js → uWS/Router.js} +73 -173
- package/dist/lib/http/uWS/Router.js.map +1 -0
- package/dist/lib/http/{WebSocket.js → uWS/WebSocket.js} +4 -1
- package/dist/lib/http/uWS/WebSocket.js.map +1 -0
- package/dist/lib/models/BaseEntity.js +2 -1
- package/dist/lib/models/BaseEntity.js.map +1 -1
- package/dist/lib/models/BaseMongoEntity.js +2 -2
- package/dist/lib/models/BaseMongoEntity.js.map +1 -1
- package/dist/lib/models/ModelUtils.js +248 -101
- package/dist/lib/models/ModelUtils.js.map +1 -1
- package/dist/lib/models/RecoverableBaseEntity.js +6 -1
- package/dist/lib/models/RecoverableBaseEntity.js.map +1 -1
- package/dist/lib/models/RecoverableBaseMongoEntity.js +1 -0
- package/dist/lib/models/RecoverableBaseMongoEntity.js.map +1 -1
- package/dist/lib/models/RepoUtils.js +641 -203
- package/dist/lib/models/RepoUtils.js.map +1 -1
- package/dist/lib/models/SimpleEntity.js +1 -0
- package/dist/lib/models/SimpleEntity.js.map +1 -1
- package/dist/lib/models/SimpleMongoEntity.js +2 -1
- package/dist/lib/models/SimpleMongoEntity.js.map +1 -1
- package/dist/lib/models/StatusExtraData.js +4 -0
- package/dist/lib/models/StatusExtraData.js.map +1 -1
- package/dist/lib/routes/{AdminRoute.js → BaseAdminRoute.js} +98 -80
- package/dist/lib/routes/BaseAdminRoute.js.map +1 -0
- package/dist/lib/routes/{MetricsRoute.js → BaseMetricsRoute.js} +29 -15
- package/dist/lib/routes/BaseMetricsRoute.js.map +1 -0
- package/dist/lib/routes/{OpenAPIRoute.js → BaseOpenAPIRoute.js} +32 -32
- package/dist/lib/routes/BaseOpenAPIRoute.js.map +1 -0
- package/dist/lib/routes/BasePushRoute.js +305 -0
- package/dist/lib/routes/BasePushRoute.js.map +1 -0
- package/dist/lib/routes/BaseStaticRoute.js +153 -0
- package/dist/lib/routes/BaseStaticRoute.js.map +1 -0
- package/dist/lib/routes/BaseStatusRoute.js +80 -0
- package/dist/lib/routes/BaseStatusRoute.js.map +1 -0
- package/dist/lib/routes/CRUDRoute.js +284 -0
- package/dist/lib/routes/CRUDRoute.js.map +1 -0
- package/dist/lib/routes/ModelRoute.js +84 -57
- package/dist/lib/routes/ModelRoute.js.map +1 -1
- package/dist/lib/routes/RouteUtils.js +108 -20
- package/dist/lib/routes/RouteUtils.js.map +1 -1
- package/dist/lib/routes/index.js +7 -4
- package/dist/lib/routes/index.js.map +1 -1
- package/dist/lib/security/ACLUtils.js +297 -170
- package/dist/lib/security/ACLUtils.js.map +1 -1
- package/dist/lib/security/AccessControlList.js +18 -10
- package/dist/lib/security/AccessControlList.js.map +1 -1
- package/dist/lib/security/AccessControlListMongo.js +19 -68
- package/dist/lib/security/AccessControlListMongo.js.map +1 -1
- package/dist/lib/security/AccessControlListSQL.js +21 -70
- package/dist/lib/security/AccessControlListSQL.js.map +1 -1
- package/dist/lib/security/BaseACLRoute.js +239 -0
- package/dist/lib/security/BaseACLRoute.js.map +1 -0
- package/dist/lib/security/index.js +3 -0
- package/dist/lib/security/index.js.map +1 -1
- package/dist/lib/test/request.js +62 -5
- package/dist/lib/test/request.js.map +1 -1
- package/dist/lib/test/requestws.js +34 -10
- package/dist/lib/test/requestws.js.map +1 -1
- package/dist/types/ApiErrors.d.ts +8 -2
- package/dist/types/BackgroundService.d.ts +0 -5
- package/dist/types/BackgroundServiceManager.d.ts +2 -1
- package/dist/types/EventListenerManager.d.ts +7 -6
- package/dist/types/NotificationUtils.d.ts +5 -3
- package/dist/types/OpenApiSpec.d.ts +2 -2
- package/dist/types/Server.d.ts +28 -10
- package/dist/types/auth/AuthMiddleware.d.ts +3 -3
- package/dist/types/auth/AuthStrategy.d.ts +10 -7
- package/dist/types/auth/JWTStrategy.d.ts +6 -4
- package/dist/types/auth/index.d.ts +0 -1
- package/dist/types/database/ConnectionKinds.d.ts +7 -0
- package/dist/types/database/ConnectionManager.d.ts +29 -4
- package/dist/types/database/MongoConnection.d.ts +16 -4
- package/dist/types/database/MongoRepository.d.ts +32 -11
- package/dist/types/database/RedisCache.d.ts +23 -0
- package/dist/types/database/TypeOrmSupport.d.ts +4 -4
- package/dist/types/database/index.d.ts +1 -0
- package/dist/types/decorators/DatabaseDecorators.d.ts +139 -8
- package/dist/types/decorators/DocDecorators.d.ts +11 -2
- package/dist/types/decorators/ModelDecorators.d.ts +12 -5
- package/dist/types/decorators/PersistenceDecorators.d.ts +11 -4
- package/dist/types/decorators/RouteDecorators.d.ts +36 -6
- package/dist/types/http/IWebSocketShim.d.ts +11 -0
- package/dist/types/http/MiddlewareChain.d.ts +47 -0
- package/dist/types/http/RuntimeDetect.d.ts +2 -0
- package/dist/types/http/bun/BunAdapters.d.ts +139 -0
- package/dist/types/http/bun/BunRouter.d.ts +79 -0
- package/dist/types/http/bun/BunWebSocket.d.ts +35 -0
- package/dist/types/http/index.d.ts +16 -6
- package/dist/types/http/session/RedisSessionStore.d.ts +15 -0
- package/dist/types/http/session/SessionManager.d.ts +35 -0
- package/dist/types/http/session/SessionStore.d.ts +12 -0
- package/dist/types/http/session/sessionMiddleware.d.ts +10 -0
- package/dist/types/http/types.d.ts +42 -3
- package/dist/types/http/uWS/Adapters.d.ts +129 -0
- package/dist/types/http/{Router.d.ts → uWS/Router.d.ts} +14 -38
- package/dist/types/http/{WebSocket.d.ts → uWS/WebSocket.d.ts} +6 -5
- package/dist/types/models/BaseEntity.d.ts +1 -1
- package/dist/types/models/ModelUtils.d.ts +47 -14
- package/dist/types/models/RecoverableBaseEntity.d.ts +3 -1
- package/dist/types/models/RepoUtils.d.ts +84 -14
- package/dist/types/routes/BaseAdminRoute.d.ts +65 -0
- package/dist/types/routes/BaseMetricsRoute.d.ts +37 -0
- package/dist/types/routes/BaseOpenAPIRoute.d.ts +33 -0
- package/dist/types/routes/BasePushRoute.d.ts +53 -0
- package/dist/types/routes/BaseStaticRoute.d.ts +44 -0
- package/dist/types/routes/BaseStatusRoute.d.ts +37 -0
- package/dist/types/routes/CRUDRoute.d.ts +57 -0
- package/dist/types/routes/ModelRoute.d.ts +39 -36
- package/dist/types/routes/RouteUtils.d.ts +19 -0
- package/dist/types/routes/index.d.ts +7 -4
- package/dist/types/security/ACLUtils.d.ts +94 -18
- package/dist/types/security/AccessControlList.d.ts +37 -59
- package/dist/types/security/AccessControlListMongo.d.ts +3 -8
- package/dist/types/security/AccessControlListSQL.d.ts +3 -8
- package/dist/types/security/BaseACLRoute.d.ts +73 -0
- package/dist/types/security/index.d.ts +3 -0
- package/dist/types/test/request.d.ts +18 -1
- package/package.json +135 -129
- package/tsconfig.export.json +17 -0
- package/dist/lib/auth/BasicStrategy.js +0 -113
- package/dist/lib/auth/BasicStrategy.js.map +0 -1
- package/dist/lib/http/Adapters.js +0 -241
- package/dist/lib/http/Adapters.js.map +0 -1
- package/dist/lib/http/Router.js.map +0 -1
- package/dist/lib/http/WebSocket.js.map +0 -1
- package/dist/lib/routes/AdminRoute.js.map +0 -1
- package/dist/lib/routes/MetricsRoute.js.map +0 -1
- package/dist/lib/routes/OpenAPIRoute.js.map +0 -1
- package/dist/lib/routes/StatusRoute.js +0 -55
- package/dist/lib/routes/StatusRoute.js.map +0 -1
- package/dist/lib/security/ACLRouteMongo.js +0 -194
- package/dist/lib/security/ACLRouteMongo.js.map +0 -1
- package/dist/lib/security/ACLRouteSQL.js +0 -193
- package/dist/lib/security/ACLRouteSQL.js.map +0 -1
- package/dist/types/auth/BasicStrategy.d.ts +0 -37
- package/dist/types/http/Adapters.d.ts +0 -68
- package/dist/types/routes/AdminRoute.d.ts +0 -47
- package/dist/types/routes/MetricsRoute.d.ts +0 -15
- package/dist/types/routes/OpenAPIRoute.d.ts +0 -17
- package/dist/types/routes/StatusRoute.d.ts +0 -11
- package/dist/types/security/ACLRouteMongo.d.ts +0 -19
- package/dist/types/security/ACLRouteSQL.d.ts +0 -19
- package/docs/Makefile +0 -20
- package/docs/conf.py +0 -58
- package/docs/index.rst +0 -17
- package/docs/make.bat +0 -35
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/README.md +0 -13
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/MongoRepository.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/RedisConnection.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/Repository.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/README.md +0 -23
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Default.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Description.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Document.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Example.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Format.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Returns.md +0 -28
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Summary.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Tags.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/TypeInfo.md +0 -28
- package/docs/reference/@rapidrest/namespaces/DocDecorators/interfaces/DocumentsData.md +0 -57
- package/docs/reference/@rapidrest/namespaces/EventDecorators/README.md +0 -12
- package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/EventListener.md +0 -17
- package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/OnEvent.md +0 -26
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/README.md +0 -26
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Cache.md +0 -25
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/ChildEntity.md +0 -18
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/DataStore.md +0 -25
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Identifier.md +0 -27
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Protect.md +0 -35
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Reference.md +0 -25
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Shard.md +0 -27
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/TrackChanges.md +0 -26
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/interfaces/PendingTypeOrmColumn.md +0 -45
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/variables/pendingTypeOrmColumns.md +0 -14
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/README.md +0 -27
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Column.md +0 -25
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Entity.md +0 -25
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Index.md +0 -119
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/PrimaryColumn.md +0 -25
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Unique.md +0 -68
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getColumnMetadata.md +0 -26
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getEntityName.md +0 -26
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getIndexMetadata.md +0 -27
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/CollationOptions.md +0 -79
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnInfo.md +0 -41
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnOptions.md +0 -51
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/EntityOptions.md +0 -32
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexInfo.md +0 -41
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexOptions.md +0 -61
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/README.md +0 -36
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/After.md +0 -26
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Auth.md +0 -33
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/AuthResult.md +0 -31
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Before.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/ContentType.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Delete.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Get.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Head.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Header.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Method.md +0 -31
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Model.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Options.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Param.md +0 -26
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Patch.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Post.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Protect.md +0 -31
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Put.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Query.md +0 -26
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Request.md +0 -31
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/RequiresRole.md +0 -26
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Response.md +0 -31
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Route.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Socket.md +0 -33
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/User.md +0 -31
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Validate.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/WebSocket.md +0 -25
- package/docs/reference/README.md +0 -20
- package/docs/reference/classes/ACLUtils.md +0 -263
- package/docs/reference/classes/AdminRoute.md +0 -51
- package/docs/reference/classes/AuthMiddleware.md +0 -173
- package/docs/reference/classes/BackgroundService.md +0 -117
- package/docs/reference/classes/BackgroundServiceManager.md +0 -172
- package/docs/reference/classes/BaseEntity.md +0 -82
- package/docs/reference/classes/BaseMongoEntity.md +0 -107
- package/docs/reference/classes/BasicStrategy.md +0 -131
- package/docs/reference/classes/BasicStrategyOptions.md +0 -115
- package/docs/reference/classes/BulkError.md +0 -271
- package/docs/reference/classes/ConnectionManager.md +0 -75
- package/docs/reference/classes/EventListenerManager.md +0 -88
- package/docs/reference/classes/HttpRouter.md +0 -343
- package/docs/reference/classes/JWTStrategy.md +0 -100
- package/docs/reference/classes/JWTStrategyOptions.md +0 -97
- package/docs/reference/classes/MetricsRoute.md +0 -27
- package/docs/reference/classes/ModelRoute.md +0 -527
- package/docs/reference/classes/ModelUtils.md +0 -446
- package/docs/reference/classes/MongoConnection.md +0 -218
- package/docs/reference/classes/MongoRepository.md +0 -390
- package/docs/reference/classes/MongoSchemaSync.md +0 -97
- package/docs/reference/classes/NetUtils.md +0 -90
- package/docs/reference/classes/NotificationUtils.md +0 -77
- package/docs/reference/classes/ObjectFactory.md +0 -336
- package/docs/reference/classes/OpenAPIRoute.md +0 -77
- package/docs/reference/classes/OpenApiSpec.md +0 -892
- package/docs/reference/classes/RecoverableBaseEntity.md +0 -114
- package/docs/reference/classes/RecoverableBaseMongoEntity.md +0 -124
- package/docs/reference/classes/RedisTransport.md +0 -2202
- package/docs/reference/classes/RepoUtils.md +0 -482
- package/docs/reference/classes/RouteUtils.md +0 -191
- package/docs/reference/classes/Server.md +0 -408
- package/docs/reference/classes/SimpleEntity.md +0 -48
- package/docs/reference/classes/SimpleMongoEntity.md +0 -66
- package/docs/reference/classes/StatusExtraData.md +0 -57
- package/docs/reference/classes/StatusRoute.md +0 -26
- package/docs/reference/classes/UWSRequest.md +0 -226
- package/docs/reference/classes/UWSResponse.md +0 -257
- package/docs/reference/classes/UWSWebSocketShim.md +0 -958
- package/docs/reference/enumerations/ACLAction.md +0 -63
- package/docs/reference/enumerations/ApiErrorMessages.md +0 -123
- package/docs/reference/enumerations/ApiErrors.md +0 -123
- package/docs/reference/functions/createWebSocketStream.md +0 -27
- package/docs/reference/functions/isSqlDataSource.md +0 -26
- package/docs/reference/functions/readBody.md +0 -29
- package/docs/reference/functions/resolveCollectionName.md +0 -33
- package/docs/reference/functions/runChain.md +0 -40
- package/docs/reference/functions/snakeCase.md +0 -28
- package/docs/reference/globals.md +0 -106
- package/docs/reference/interfaces/ACLRecord.md +0 -96
- package/docs/reference/interfaces/AccessControlList.md +0 -76
- package/docs/reference/interfaces/AuthResult.md +0 -55
- package/docs/reference/interfaces/AuthStrategy.md +0 -95
- package/docs/reference/interfaces/CreateRequestOptions.md +0 -121
- package/docs/reference/interfaces/DeleteRequestOptions.md +0 -137
- package/docs/reference/interfaces/FindRequestOptions.md +0 -133
- package/docs/reference/interfaces/HttpRequest.md +0 -147
- package/docs/reference/interfaces/HttpResponse.md +0 -164
- package/docs/reference/interfaces/JWTAuthResult.md +0 -84
- package/docs/reference/interfaces/RepoCreateOptions.md +0 -95
- package/docs/reference/interfaces/RepoDeleteOptions.md +0 -105
- package/docs/reference/interfaces/RepoFindOptions.md +0 -125
- package/docs/reference/interfaces/RepoOperationOptions.md +0 -69
- package/docs/reference/interfaces/RepoUpdateOptions.md +0 -101
- package/docs/reference/interfaces/RequestOptions.md +0 -112
- package/docs/reference/interfaces/RequestWS.md +0 -225
- package/docs/reference/interfaces/TruncateRequestOptions.md +0 -161
- package/docs/reference/interfaces/UpdateRequestOptions.md +0 -139
- package/docs/reference/type-aliases/ErrorHandler.md +0 -35
- package/docs/reference/type-aliases/NextFunction.md +0 -23
- package/docs/reference/type-aliases/OneOrMany.md +0 -19
- package/docs/reference/type-aliases/OneOrNull.md +0 -19
- package/docs/reference/type-aliases/PartialBaseEntity.md +0 -17
- package/docs/reference/type-aliases/PartialSimpleEntity.md +0 -17
- package/docs/reference/type-aliases/RequestHandler.md +0 -31
- package/docs/reference/type-aliases/UpdateObject.md +0 -19
- package/docs/reference/type-aliases/WsUpgradeAuth.md +0 -27
- package/docs/reference/type-aliases/WsUpgradeAuthResult.md +0 -47
|
@@ -12,21 +12,40 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
};
|
|
13
13
|
///////////////////////////////////////////////////////////////////////////////
|
|
14
14
|
// Copyright (C) 2020-2026 Jean-Philippe Steinmetz
|
|
15
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
15
16
|
///////////////////////////////////////////////////////////////////////////////
|
|
16
17
|
import * as prom from "prom-client";
|
|
17
18
|
import { ApiError, UserUtils, ObjectDecorators } from "@rapidrest/core";
|
|
18
|
-
import { Get, Param,
|
|
19
|
+
import { Get, Param, ContentType, User } from "../decorators/RouteDecorators.js";
|
|
19
20
|
import { Description, Returns, Summary } from "../decorators/DocDecorators.js";
|
|
20
21
|
import { ApiErrorMessages, ApiErrors } from "../ApiErrors.js";
|
|
21
22
|
const { Config } = ObjectDecorators;
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
24
|
+
* The `BaseMetricsRoute` class provides a base set of endpoints for exposing Prometheus metrics.
|
|
25
|
+
*
|
|
26
|
+
* Exposed endpoints:
|
|
27
|
+
*
|
|
28
|
+
* | Name | HTTP Method | What it does |
|
|
29
|
+
* | --- | --- | --- |
|
|
30
|
+
* | `getMetrics` | `GET /<base_path>` | Returns all Prometheus metrics gathered by the system |
|
|
31
|
+
* | `getSingleMetric` | `GET /<base_path>/:metric` | Returns a single Prometheus metric with the given name |
|
|
25
32
|
*
|
|
26
33
|
* Services that wish to provide metrics to be exposed via this route can register them using the global registry
|
|
27
34
|
* from the provided `prom-client` dependency. See the `prom-client` documentation for more details.
|
|
35
|
+
*
|
|
36
|
+
* !!Note!! that the `BaseMetricsRoute` is not automatically registered with a server by default. You must create
|
|
37
|
+
* your own class that extends `AdminRoute` and apply the desired base path with `@Route()`.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { BaseMetricsRoute, RouteDecorators } from "@rapidrest/service-core";
|
|
42
|
+
* const { Route } = RouteDecorators;
|
|
43
|
+
*
|
|
44
|
+
* @Route("/metrics")
|
|
45
|
+
* export class MetricsRoute extends BaseMetricsRoute {}
|
|
46
|
+
* ```
|
|
28
47
|
*/
|
|
29
|
-
|
|
48
|
+
export class BaseMetricsRoute {
|
|
30
49
|
constructor() {
|
|
31
50
|
this.metricsConfig = {
|
|
32
51
|
authRequired: true,
|
|
@@ -46,15 +65,15 @@ let MetricsRoute = class MetricsRoute {
|
|
|
46
65
|
}
|
|
47
66
|
return await this.registry.getSingleMetricAsString(metric);
|
|
48
67
|
}
|
|
49
|
-
}
|
|
68
|
+
}
|
|
50
69
|
__decorate([
|
|
51
70
|
Config("metrics", { authRequired: true }),
|
|
52
71
|
__metadata("design:type", Object)
|
|
53
|
-
],
|
|
72
|
+
], BaseMetricsRoute.prototype, "metricsConfig", void 0);
|
|
54
73
|
__decorate([
|
|
55
74
|
Config("trusted_roles"),
|
|
56
75
|
__metadata("design:type", Array)
|
|
57
|
-
],
|
|
76
|
+
], BaseMetricsRoute.prototype, "trustedRoles", void 0);
|
|
58
77
|
__decorate([
|
|
59
78
|
Summary("{{serviceName}} all Prometheus metrics"),
|
|
60
79
|
Description("Returns all Prometheus metrics emitted by this service."),
|
|
@@ -65,7 +84,7 @@ __decorate([
|
|
|
65
84
|
__metadata("design:type", Function),
|
|
66
85
|
__metadata("design:paramtypes", [Object]),
|
|
67
86
|
__metadata("design:returntype", Promise)
|
|
68
|
-
],
|
|
87
|
+
], BaseMetricsRoute.prototype, "getMetrics", null);
|
|
69
88
|
__decorate([
|
|
70
89
|
Summary("{{serviceName}} Prometheus metrics by name"),
|
|
71
90
|
Description("Returns the Prometheus metric emitted by this service with the given name."),
|
|
@@ -77,10 +96,5 @@ __decorate([
|
|
|
77
96
|
__metadata("design:type", Function),
|
|
78
97
|
__metadata("design:paramtypes", [Object, Object]),
|
|
79
98
|
__metadata("design:returntype", Promise)
|
|
80
|
-
],
|
|
81
|
-
|
|
82
|
-
Route("/metrics"),
|
|
83
|
-
__metadata("design:paramtypes", [])
|
|
84
|
-
], MetricsRoute);
|
|
85
|
-
export { MetricsRoute };
|
|
86
|
-
//# sourceMappingURL=MetricsRoute.js.map
|
|
99
|
+
], BaseMetricsRoute.prototype, "getSingleMetric", null);
|
|
100
|
+
//# sourceMappingURL=BaseMetricsRoute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseMetricsRoute.js","sourceRoot":"","sources":["../../../src/routes/BaseMetricsRoute.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+EAA+E;AAC/E,kDAAkD;AAClD,mCAAmC;AACnC,+EAA+E;AAC/E,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAgB,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAQ,GAAG,EAAE,KAAK,EAAS,WAAW,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,E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AM,CAAC,eAAe,CAAC;;sDACc;AAWzB;IALZ,OAAO,CAAC,wCAAwC,CAAC;IACjD,WAAW,CAAC,yDAAyD,CAAC;IACtE,GAAG,EAAE;IACL,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;IACtC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;IACO,WAAA,IAAI,CAAA;;;;kDAK5B;AAOY;IALZ,OAAO,CAAC,4CAA4C,CAAC;IACrD,WAAW,CAAC,4EAA4E,CAAC;IACzF,GAAG,CAAC,UAAU,CAAC;IACf,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;IACtC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;IACY,WAAA,KAAK,CAAC,QAAQ,CAAC,CAAA;IAAe,WAAA,IAAI,CAAA;;;;uDAK/D"}
|
|
@@ -9,11 +9,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
///////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
// Copyright (C) 2020-2026 Jean-Philippe Steinmetz
|
|
12
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
12
13
|
///////////////////////////////////////////////////////////////////////////////
|
|
13
14
|
import { ObjectDecorators } from "@rapidrest/core";
|
|
14
15
|
import { OpenApiSpec } from "../OpenApiSpec.js";
|
|
15
16
|
import { Description, Returns, Summary } from "../decorators/DocDecorators.js";
|
|
16
|
-
import { Get,
|
|
17
|
+
import { Get, ContentType } from "../decorators/RouteDecorators.js";
|
|
17
18
|
const { Inject } = ObjectDecorators;
|
|
18
19
|
/** Inline Swagger UI HTML page — loads swagger-ui-dist from CDN so there is no npm dependency. */
|
|
19
20
|
function swaggerHtml(specUrl) {
|
|
@@ -39,15 +40,31 @@ function swaggerHtml(specUrl) {
|
|
|
39
40
|
</html>`;
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
|
-
* The `
|
|
43
|
+
* The `BaseOpenAPIRoute` class provides a base set of endpoints exposing the server's OpenAPI specification.
|
|
43
44
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
45
|
+
* Exposed endpoints:
|
|
46
|
+
*
|
|
47
|
+
* | Name | HTTP Method | What it does |
|
|
48
|
+
* | --- | --- | --- |
|
|
49
|
+
* | `getHTML` | `GET /<base_path>` | Swagger UI HTML (loads swagger-ui-dist from CDN) |
|
|
50
|
+
* | `getJSON` | `GET /<base_path>/json` | raw OpenAPI specification as JSON |
|
|
51
|
+
* | `getYAML` | `GET /<base_path>/yaml` | raw OpenAPI specification as YAML |
|
|
52
|
+
*
|
|
53
|
+
* !!Note!! that the `BaseAdminRoute` is not automatically registered with a server by default. You must create
|
|
54
|
+
* your own class that extends `AdminRoute` and apply the desired base path with `@Route()`.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { BaseOpenAPIRoute, RouteDecorators } from "@rapidrest/service-core";
|
|
59
|
+
* const { Route } = RouteDecorators;
|
|
60
|
+
*
|
|
61
|
+
* @Route("/openapi")
|
|
62
|
+
* export class OpenAPIRoute extends BaseOpenAPIRoute {}
|
|
63
|
+
* ```
|
|
47
64
|
*
|
|
48
65
|
* @author Jean-Philippe Steinmetz
|
|
49
66
|
*/
|
|
50
|
-
|
|
67
|
+
export class BaseOpenAPIRoute {
|
|
51
68
|
constructor() {
|
|
52
69
|
/** The underlying OpenAPI specification. */
|
|
53
70
|
this.apiSpec = new OpenApiSpec();
|
|
@@ -55,61 +72,44 @@ let OpenAPIRoute = class OpenAPIRoute {
|
|
|
55
72
|
getHTML() {
|
|
56
73
|
return swaggerHtml("/openapi.json");
|
|
57
74
|
}
|
|
58
|
-
getAPIDocs() {
|
|
59
|
-
return swaggerHtml("/openapi.json");
|
|
60
|
-
}
|
|
61
75
|
getJSON() {
|
|
62
76
|
return this.apiSpec.getSpec();
|
|
63
77
|
}
|
|
64
78
|
getYAML() {
|
|
65
79
|
return this.apiSpec.getSpecAsYaml();
|
|
66
80
|
}
|
|
67
|
-
}
|
|
81
|
+
}
|
|
68
82
|
__decorate([
|
|
69
83
|
Inject(OpenApiSpec),
|
|
70
84
|
__metadata("design:type", OpenApiSpec)
|
|
71
|
-
],
|
|
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);
|
|
85
|
+
], BaseOpenAPIRoute.prototype, "apiSpec", void 0);
|
|
82
86
|
__decorate([
|
|
83
87
|
Summary("{{serviceName}} API docs"),
|
|
84
88
|
Description("Returns the OpenAPI specification for the service in HTML format."),
|
|
85
|
-
Get(
|
|
89
|
+
Get(),
|
|
86
90
|
ContentType("text/html"),
|
|
87
91
|
Returns([String]),
|
|
88
92
|
__metadata("design:type", Function),
|
|
89
93
|
__metadata("design:paramtypes", []),
|
|
90
94
|
__metadata("design:returntype", String)
|
|
91
|
-
],
|
|
95
|
+
], BaseOpenAPIRoute.prototype, "getHTML", null);
|
|
92
96
|
__decorate([
|
|
93
97
|
Summary("{{serviceName}} OpenAPI, JSON format"),
|
|
94
98
|
Description("Returns the OpenAPI specification for the service in JSON format."),
|
|
95
|
-
Get("
|
|
99
|
+
Get("json"),
|
|
96
100
|
Returns([String]),
|
|
97
101
|
__metadata("design:type", Function),
|
|
98
102
|
__metadata("design:paramtypes", []),
|
|
99
103
|
__metadata("design:returntype", Object)
|
|
100
|
-
],
|
|
104
|
+
], BaseOpenAPIRoute.prototype, "getJSON", null);
|
|
101
105
|
__decorate([
|
|
102
106
|
Summary("{{serviceName}} OpenAPI, YAML format"),
|
|
103
107
|
Description("Returns the OpenAPI specification for the service in YAML format."),
|
|
104
|
-
Get("
|
|
108
|
+
Get("yaml"),
|
|
105
109
|
ContentType("text/yaml"),
|
|
106
110
|
Returns([String]),
|
|
107
111
|
__metadata("design:type", Function),
|
|
108
112
|
__metadata("design:paramtypes", []),
|
|
109
113
|
__metadata("design:returntype", String)
|
|
110
|
-
],
|
|
111
|
-
|
|
112
|
-
Route("/")
|
|
113
|
-
], OpenAPIRoute);
|
|
114
|
-
export { OpenAPIRoute };
|
|
115
|
-
//# sourceMappingURL=OpenAPIRoute.js.map
|
|
114
|
+
], BaseOpenAPIRoute.prototype, "getYAML", null);
|
|
115
|
+
//# sourceMappingURL=BaseOpenAPIRoute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseOpenAPIRoute.js","sourceRoot":"","sources":["../../../src/routes/BaseOpenAPIRoute.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+EAA+E;AAC/E,kDAAkD;AAClD,mCAAmC;AACnC,+EAA+E;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAAC;AAEpC,kGAAkG;AAClG,SAAS,WAAW,CAAC,OAAe;IAChC,OAAO;;;;;;;;;;;;cAYG,OAAO;;;;;;;QAOb,CAAC;AACT,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,OAAO,gBAAgB;IAA7B;QACI,4CAA4C;QAElC,YAAO,GAAgB,IAAI,WAAW,EAAE,CAAC;IA2BvD,CAAC;IApBU,OAAO;QACV,OAAO,WAAW,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;IAMM,OAAO;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IAClC,CAAC;IAOM,OAAO;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACxC,CAAC;CACJ;AA3Ba;IADT,MAAM,CAAC,WAAW,CAAC;8BACD,WAAW;iDAAqB;AAO5C;IALN,OAAO,CAAC,0BAA0B,CAAC;IACnC,WAAW,CAAC,mEAAmE,CAAC;IAChF,GAAG,EAAE;IACL,WAAW,CAAC,WAAW,CAAC;IACxB,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;;;;+CAGjB;AAMM;IAJN,OAAO,CAAC,sCAAsC,CAAC;IAC/C,WAAW,CAAC,mEAAmE,CAAC;IAChF,GAAG,CAAC,MAAM,CAAC;IACX,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;;;;+CAGjB;AAOM;IALN,OAAO,CAAC,sCAAsC,CAAC;IAC/C,WAAW,CAAC,mEAAmE,CAAC;IAChF,GAAG,CAAC,MAAM,CAAC;IACX,WAAW,CAAC,WAAW,CAAC;IACxB,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;;;;+CAGjB"}
|
|
@@ -0,0 +1,305 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
14
|
+
// Copyright (C) 2020-2026 Jean-Philippe Steinmetz. All rights reserved.
|
|
15
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
16
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
17
|
+
import { ApiError, ObjectDecorators } from "@rapidrest/core";
|
|
18
|
+
import { Auth, Param, Post, Socket, User, WebSocket } from "../decorators/RouteDecorators.js";
|
|
19
|
+
import { ACLUtils } from "../security/ACLUtils.js";
|
|
20
|
+
import ws from "ws";
|
|
21
|
+
import { importRedis } from "../database/ConnectionKinds.js";
|
|
22
|
+
import { Description, Summary } from "../decorators/DocDecorators.js";
|
|
23
|
+
import { ACLAction } from "../security/AccessControlList.js";
|
|
24
|
+
import { ApiErrorMessages, ApiErrors } from "../ApiErrors.js";
|
|
25
|
+
const { Config, Init, Inject, Logger } = ObjectDecorators;
|
|
26
|
+
/**
|
|
27
|
+
* The `BasePushRoute` class provides a base set of endpoints for implement client push notifications.
|
|
28
|
+
*
|
|
29
|
+
* Exposed endpoints:
|
|
30
|
+
*
|
|
31
|
+
* | Name | HTTP Method | What it does |
|
|
32
|
+
* | --- | --- | --- |
|
|
33
|
+
* | `connect` | `UPGRADE /<base_path>/connect` | Establishes a connection to the push notification system. |
|
|
34
|
+
* | `send` | `POST /<base_path>/:id` | Sends a push notification message to the channel with the given id |
|
|
35
|
+
*
|
|
36
|
+
* !!Note!! that the `BasePushRoute` is not automatically registered with a server by default. You must create
|
|
37
|
+
* your own class that extends `AdminRoute` and apply the desired base path with `@Route()`.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { BasePushRoute, RouteDecorators } from "@rapidrest/service-core";
|
|
42
|
+
* const { Route } = RouteDecorators;
|
|
43
|
+
*
|
|
44
|
+
* @Route("/push")
|
|
45
|
+
* export class PushRoute extends BasePushRoute {}
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @author Jean-Philippe Steinmetz
|
|
49
|
+
*/
|
|
50
|
+
export class BasePushRoute {
|
|
51
|
+
constructor() {
|
|
52
|
+
/** A map of active socket connections to users. */
|
|
53
|
+
this.activeSocks = new Map();
|
|
54
|
+
/** A map of active subscription uids to users. */
|
|
55
|
+
this.activeSubs = new Map();
|
|
56
|
+
/** Per-user in-process locks (see `runExclusive`) guarding read-modify-write access to `activeSubs`. */
|
|
57
|
+
this.subLocks = new Map();
|
|
58
|
+
/** The maximum number of concurrent sockets a single user may hold open at once. */
|
|
59
|
+
this.maxSocketsPerUser = 10;
|
|
60
|
+
/** The maximum number of channels a single user may be subscribed to at once. */
|
|
61
|
+
this.maxSubscriptionsPerUser = 50;
|
|
62
|
+
}
|
|
63
|
+
async init() {
|
|
64
|
+
if (this.redisConfig) {
|
|
65
|
+
const { createClient } = await importRedis();
|
|
66
|
+
this.redisPub = createClient({ url: this.redisConfig.url });
|
|
67
|
+
await this.redisPub.connect();
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.logger.warn("Could not initialize the push notification publisher. The `events` datasource is not configured.");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Runs `fn` exclusively with respect to any other call currently queued under the same `key` on this
|
|
75
|
+
* instance — a call only starts once every call queued ahead of it under that key has fully settled. Used
|
|
76
|
+
* to serialize SUBSCRIBE/UNSUBSCRIBE handling per user so two messages arriving close together (on the same
|
|
77
|
+
* or different concurrent sockets for that user) can't both read the same stale `activeSubs` snapshot and
|
|
78
|
+
* clobber (or exceed the cap on) each other's committed subscription list.
|
|
79
|
+
*/
|
|
80
|
+
async runExclusive(key, fn) {
|
|
81
|
+
const previous = this.subLocks.get(key) ?? Promise.resolve();
|
|
82
|
+
const run = previous.then(fn);
|
|
83
|
+
const guard = run.then(() => undefined, () => undefined);
|
|
84
|
+
this.subLocks.set(key, guard);
|
|
85
|
+
void guard.finally(() => {
|
|
86
|
+
if (this.subLocks.get(key) === guard) {
|
|
87
|
+
this.subLocks.delete(key);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return run;
|
|
91
|
+
}
|
|
92
|
+
async connect(sock, user) {
|
|
93
|
+
const onMessage = (message, channel) => {
|
|
94
|
+
this.logger.debug(`Forwarding message to ${user.uid}`);
|
|
95
|
+
sock.send(message, (err) => {
|
|
96
|
+
if (err) {
|
|
97
|
+
this.logger.debug(`Failed to forward message to ${user.uid}`);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
// The socket cap check, the subscribe, and the activeSocks/activeSubs bookkeeping below must all happen
|
|
102
|
+
// atomically with respect to any other concurrent connect()/SUBSCRIBE/UNSUBSCRIBE for this same user
|
|
103
|
+
// (e.g. a burst of connections opened milliseconds apart), or two calls could both read the same
|
|
104
|
+
// pre-commit state: bypassing the per-user socket cap, or clobbering each other's committed
|
|
105
|
+
// subscription list the same way the message handlers below already guard against via `runExclusive`.
|
|
106
|
+
const redis = await this.runExclusive(user.uid, async () => {
|
|
107
|
+
// Cap the number of concurrent connections a single user may hold, to prevent an authenticated user
|
|
108
|
+
// from exhausting server resources by opening unbounded sockets.
|
|
109
|
+
if ((this.activeSocks.get(user.uid)?.length ?? 0) >= this.maxSocketsPerUser) {
|
|
110
|
+
this.logger.debug(`User ${user.uid} exceeded the maximum of ${this.maxSocketsPerUser} concurrent push connections.`);
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
// Establish a new redis pub/sub client for this connection
|
|
114
|
+
const { createClient } = await importRedis();
|
|
115
|
+
const conn = createClient({ url: this.redisConfig.url });
|
|
116
|
+
await conn.connect();
|
|
117
|
+
// On a first-ever connection there's nothing stored yet, so just the user's own identity channel
|
|
118
|
+
// (always implicitly permitted, same as the SUBSCRIBE message handler below never ACL-checks it).
|
|
119
|
+
// On a *re*connection, activeSubs may hold channels approved during a previous session — permission
|
|
120
|
+
// can have been revoked since then, so every channel other than the identity one is re-checked here
|
|
121
|
+
// rather than trusted as still-valid.
|
|
122
|
+
const storedSubs = this.activeSubs.get(user.uid) ?? [user.uid];
|
|
123
|
+
const subs = [];
|
|
124
|
+
for (const channel of storedSubs) {
|
|
125
|
+
if (channel === user.uid || (await this.aclUtils?.hasPermission(user, channel, ACLAction.READ))) {
|
|
126
|
+
subs.push(channel);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
await conn.subscribe(subs, onMessage);
|
|
131
|
+
this.logger.info(`User ${user.uid} successfully subscribed to push channels: ${subs}`);
|
|
132
|
+
sock.send(JSON.stringify({ id: 0, type: "SUBSCRIBED", success: true, data: subs }));
|
|
133
|
+
this.activeSubs.set(user.uid, subs);
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
this.logger.error(`Failed to subscribe to push channels: user: ${user.uid}, subs: ${subs}`);
|
|
137
|
+
this.logger.debug(err);
|
|
138
|
+
}
|
|
139
|
+
// Track the socket so it doesn't get automatically cleaned up.
|
|
140
|
+
if (!this.activeSocks.has(user.uid)) {
|
|
141
|
+
this.activeSocks.set(user.uid, []);
|
|
142
|
+
}
|
|
143
|
+
this.activeSocks.get(user.uid).push(sock);
|
|
144
|
+
return conn;
|
|
145
|
+
});
|
|
146
|
+
if (!redis) {
|
|
147
|
+
sock.close(1008, "Too many concurrent connections.");
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
// Set up the incoming message handler from the client
|
|
151
|
+
sock.on("message", async (data, isBinary) => {
|
|
152
|
+
if (!isBinary) {
|
|
153
|
+
try {
|
|
154
|
+
// Decode the incoming message
|
|
155
|
+
const message = JSON.parse(data);
|
|
156
|
+
if (message.type === "SUBSCRIBE") {
|
|
157
|
+
// Serialized per user: reading `activeSubs` and later committing the updated list must
|
|
158
|
+
// be atomic with respect to any other concurrent SUBSCRIBE/UNSUBSCRIBE for this same
|
|
159
|
+
// user (e.g. from a second open socket), or two messages could both compute their
|
|
160
|
+
// approved/remaining-budget delta off the same stale snapshot and the second commit
|
|
161
|
+
// would silently clobber the first's.
|
|
162
|
+
await this.runExclusive(user.uid, async () => {
|
|
163
|
+
const origSubs = this.activeSubs.get(user.uid) ?? [user.uid];
|
|
164
|
+
const requested = Array.isArray(message.data) ? message.data : [message.data];
|
|
165
|
+
// Bound the number of channels actually *checked* to the caller's remaining
|
|
166
|
+
// subscription budget, not just the number of successful grants — otherwise a client
|
|
167
|
+
// naming far more channels than it could ever be granted (each denial doesn't consume
|
|
168
|
+
// budget) forces one sequential ACL lookup (a cache-miss-prone Redis/DB round trip)
|
|
169
|
+
// per attacker-controlled entry, with no upper bound on how many it sends in one frame.
|
|
170
|
+
const remaining = Math.max(0, this.maxSubscriptionsPerUser - origSubs.length);
|
|
171
|
+
const subs = requested.slice(0, remaining);
|
|
172
|
+
const subd = [];
|
|
173
|
+
for (const channel of subs) {
|
|
174
|
+
if (await this.aclUtils?.hasPermission(user, channel, ACLAction.READ)) {
|
|
175
|
+
subd.push(channel);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// Subscribe to all approved channels
|
|
179
|
+
if (subd.length > 0) {
|
|
180
|
+
await redis.subscribe(subd, onMessage);
|
|
181
|
+
}
|
|
182
|
+
this.activeSubs.set(user.uid, origSubs.concat(subd));
|
|
183
|
+
sock.send(JSON.stringify({ id: message.id, type: "SUBSCRIBED", success: true, data: subd }));
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
else if (message.type === "UNSUBSCRIBE") {
|
|
187
|
+
await this.runExclusive(user.uid, async () => {
|
|
188
|
+
const origSubs = this.activeSubs.get(user.uid) ?? [user.uid];
|
|
189
|
+
const subs = Array.isArray(message.data) ? message.data : [message.data];
|
|
190
|
+
// An empty channel list means "unsubscribe from everything" per the Redis protocol,
|
|
191
|
+
// which is not what an empty UNSUBSCRIBE request from the client should do.
|
|
192
|
+
if (subs.length > 0) {
|
|
193
|
+
await redis.unsubscribe(subs);
|
|
194
|
+
}
|
|
195
|
+
for (const channel of subs) {
|
|
196
|
+
const idx = origSubs.indexOf(channel);
|
|
197
|
+
if (idx !== -1) {
|
|
198
|
+
origSubs.splice(idx, 1);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
this.activeSubs.set(user.uid, origSubs);
|
|
202
|
+
sock.send(JSON.stringify({ id: message.id, type: "UNSUBSCRIBED", success: true, data: subs }));
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
this.logger.debug(`Received invalid message from user ${user.uid}.`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
catch (err) {
|
|
210
|
+
this.logger.debug(`Received invalid message from user ${user.uid}.`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
// Set up the close connection handler
|
|
215
|
+
sock.on("close", async (code, reason) => {
|
|
216
|
+
// Serialized per user, same as SUBSCRIBE/UNSUBSCRIBE above: a close racing a concurrent
|
|
217
|
+
// connect()/SUBSCRIBE for the same user (a second open socket) must not interleave its
|
|
218
|
+
// read-modify-write of activeSocks/activeSubs with theirs, or one of the two updates is lost.
|
|
219
|
+
await this.runExclusive(user.uid, async () => {
|
|
220
|
+
// Unsubscribe from all redis pub/sub channels
|
|
221
|
+
const subs = this.activeSubs.get(user.uid);
|
|
222
|
+
if (subs && subs.length > 0) {
|
|
223
|
+
await redis.unsubscribe(subs);
|
|
224
|
+
}
|
|
225
|
+
// Disconnect the redis client
|
|
226
|
+
await redis.disconnect();
|
|
227
|
+
// Remove the socket from our tracked list
|
|
228
|
+
const socks = this.activeSocks.get(user.uid) || [];
|
|
229
|
+
const idx = socks.indexOf(sock);
|
|
230
|
+
if (idx !== -1) {
|
|
231
|
+
socks.splice(idx, 1);
|
|
232
|
+
}
|
|
233
|
+
// Once the user has no other open connections, drop their tracked state entirely rather than
|
|
234
|
+
// leaving a stale (activeSocks) or permanently-growing (activeSubs) entry behind — otherwise
|
|
235
|
+
// every distinct uid that ever connects, even once, leaks a map entry for the life of the process.
|
|
236
|
+
if (socks.length === 0) {
|
|
237
|
+
this.activeSocks.delete(user.uid);
|
|
238
|
+
this.activeSubs.delete(user.uid);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
this.activeSocks.set(user.uid, socks);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
async send(id, msg, user) {
|
|
247
|
+
if (!(await this.aclUtils?.hasPermission(user, id, ACLAction.CREATE))) {
|
|
248
|
+
throw new ApiError(ApiErrors.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
249
|
+
}
|
|
250
|
+
if (!this.redisPub) {
|
|
251
|
+
this.logger.error(`Failed to send push message to channel ${id}. The \`events\` datasource is not configured.`);
|
|
252
|
+
throw new ApiError(ApiErrors.INTERNAL_ERROR, 500, ApiErrorMessages.INTERNAL_ERROR);
|
|
253
|
+
}
|
|
254
|
+
await this.redisPub.publish(id, JSON.stringify({ type: "MESSAGE", channel: id, data: msg }));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
__decorate([
|
|
258
|
+
Inject(ACLUtils),
|
|
259
|
+
__metadata("design:type", ACLUtils)
|
|
260
|
+
], BasePushRoute.prototype, "aclUtils", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
Logger,
|
|
263
|
+
__metadata("design:type", Object)
|
|
264
|
+
], BasePushRoute.prototype, "logger", void 0);
|
|
265
|
+
__decorate([
|
|
266
|
+
Config("datastores:events"),
|
|
267
|
+
__metadata("design:type", Object)
|
|
268
|
+
], BasePushRoute.prototype, "redisConfig", void 0);
|
|
269
|
+
__decorate([
|
|
270
|
+
Config("push:max_sockets_per_user", 10),
|
|
271
|
+
__metadata("design:type", Number)
|
|
272
|
+
], BasePushRoute.prototype, "maxSocketsPerUser", void 0);
|
|
273
|
+
__decorate([
|
|
274
|
+
Config("push:max_subscriptions_per_user", 50),
|
|
275
|
+
__metadata("design:type", Number)
|
|
276
|
+
], BasePushRoute.prototype, "maxSubscriptionsPerUser", void 0);
|
|
277
|
+
__decorate([
|
|
278
|
+
Init,
|
|
279
|
+
__metadata("design:type", Function),
|
|
280
|
+
__metadata("design:paramtypes", []),
|
|
281
|
+
__metadata("design:returntype", Promise)
|
|
282
|
+
], BasePushRoute.prototype, "init", null);
|
|
283
|
+
__decorate([
|
|
284
|
+
Summary("Push connect"),
|
|
285
|
+
Description("Establishes a connection to the push notification system."),
|
|
286
|
+
Auth(["jwt"]),
|
|
287
|
+
WebSocket(),
|
|
288
|
+
__param(0, Socket),
|
|
289
|
+
__param(1, User),
|
|
290
|
+
__metadata("design:type", Function),
|
|
291
|
+
__metadata("design:paramtypes", [ws, Object]),
|
|
292
|
+
__metadata("design:returntype", Promise)
|
|
293
|
+
], BasePushRoute.prototype, "connect", null);
|
|
294
|
+
__decorate([
|
|
295
|
+
Summary("Send push"),
|
|
296
|
+
Description("Sends a push notification message to the channel with the given id."),
|
|
297
|
+
Auth(["jwt"]),
|
|
298
|
+
Post("/:id"),
|
|
299
|
+
__param(0, Param("id")),
|
|
300
|
+
__param(2, User),
|
|
301
|
+
__metadata("design:type", Function),
|
|
302
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
|
303
|
+
__metadata("design:returntype", Promise)
|
|
304
|
+
], BasePushRoute.prototype, "send", null);
|
|
305
|
+
//# sourceMappingURL=BasePushRoute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BasePushRoute.js","sourceRoot":"","sources":["../../../src/routes/BasePushRoute.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+EAA+E;AAC/E,wEAAwE;AACxE,mCAAmC;AACnC,+EAA+E;AAC/E,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAA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