@rapidrest/service-core 1.0.0-rc.9 → 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 -213
- 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
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
[**@rapidrest/service-core**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rapidrest/service-core](../globals.md) / ACLUtils
|
|
6
|
-
|
|
7
|
-
# Class: ACLUtils
|
|
8
|
-
|
|
9
|
-
Defined in: [src/security/ACLUtils.ts:22](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/security/ACLUtils.ts#L22)
|
|
10
|
-
|
|
11
|
-
Common utility functions for working with `AccessControlList` objects and validating user permissions.
|
|
12
|
-
|
|
13
|
-
## Constructors
|
|
14
|
-
|
|
15
|
-
### Constructor
|
|
16
|
-
|
|
17
|
-
> **new ACLUtils**(): `ACLUtils`
|
|
18
|
-
|
|
19
|
-
#### Returns
|
|
20
|
-
|
|
21
|
-
`ACLUtils`
|
|
22
|
-
|
|
23
|
-
## Properties
|
|
24
|
-
|
|
25
|
-
### enabled
|
|
26
|
-
|
|
27
|
-
> **enabled**: `boolean` = `true`
|
|
28
|
-
|
|
29
|
-
Defined in: [src/security/ACLUtils.ts:24](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/security/ACLUtils.ts#L24)
|
|
30
|
-
|
|
31
|
-
## Methods
|
|
32
|
-
|
|
33
|
-
### checkRequestPerms()
|
|
34
|
-
|
|
35
|
-
> **checkRequestPerms**(`uid`, `user`, `req`): `Promise`\<`boolean`\>
|
|
36
|
-
|
|
37
|
-
Defined in: [src/security/ACLUtils.ts:90](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/security/ACLUtils.ts#L90)
|
|
38
|
-
|
|
39
|
-
Validates that the user has permission to perform the request operation against the URL path for the
|
|
40
|
-
provided request. If ACLUtils has not been initialized or the `acl` datastore has not been configured
|
|
41
|
-
then always returns `true`.
|
|
42
|
-
|
|
43
|
-
#### Parameters
|
|
44
|
-
|
|
45
|
-
##### uid
|
|
46
|
-
|
|
47
|
-
`string`
|
|
48
|
-
|
|
49
|
-
The uid of the access control list to verify against.
|
|
50
|
-
|
|
51
|
-
##### user
|
|
52
|
-
|
|
53
|
-
`JWTUser` \| `undefined`
|
|
54
|
-
|
|
55
|
-
The user to validate.
|
|
56
|
-
|
|
57
|
-
##### req
|
|
58
|
-
|
|
59
|
-
[`HttpRequest`](../interfaces/HttpRequest.md)
|
|
60
|
-
|
|
61
|
-
The request whose URL path and method will be verified.
|
|
62
|
-
|
|
63
|
-
#### Returns
|
|
64
|
-
|
|
65
|
-
`Promise`\<`boolean`\>
|
|
66
|
-
|
|
67
|
-
***
|
|
68
|
-
|
|
69
|
-
### findACL()
|
|
70
|
-
|
|
71
|
-
> **findACL**(`entityId`, `parentUids?`, `reqCache?`): `Promise`\<[`AccessControlList`](../interfaces/AccessControlList.md) \| `null`\>
|
|
72
|
-
|
|
73
|
-
Defined in: [src/security/ACLUtils.ts:219](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/security/ACLUtils.ts#L219)
|
|
74
|
-
|
|
75
|
-
Retrieves the access control list with the associated identifier and populates the parent(s).
|
|
76
|
-
|
|
77
|
-
#### Parameters
|
|
78
|
-
|
|
79
|
-
##### entityId
|
|
80
|
-
|
|
81
|
-
`string`
|
|
82
|
-
|
|
83
|
-
The unique identifier of the ACL to retrieve.
|
|
84
|
-
|
|
85
|
-
##### parentUids?
|
|
86
|
-
|
|
87
|
-
`string`[] = `[]`
|
|
88
|
-
|
|
89
|
-
The list of already found parent UIDs. This is used to break circular dependencies.
|
|
90
|
-
|
|
91
|
-
##### reqCache?
|
|
92
|
-
|
|
93
|
-
`Map`\<`string`, [`AccessControlList`](../interfaces/AccessControlList.md) \| `null`\>
|
|
94
|
-
|
|
95
|
-
#### Returns
|
|
96
|
-
|
|
97
|
-
`Promise`\<[`AccessControlList`](../interfaces/AccessControlList.md) \| `null`\>
|
|
98
|
-
|
|
99
|
-
***
|
|
100
|
-
|
|
101
|
-
### getRecord()
|
|
102
|
-
|
|
103
|
-
> **getRecord**(`acl`, `user`): [`ACLRecord`](../interfaces/ACLRecord.md) \| `null`
|
|
104
|
-
|
|
105
|
-
Defined in: [src/security/ACLUtils.ts:498](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/security/ACLUtils.ts#L498)
|
|
106
|
-
|
|
107
|
-
Retrieves the first available record in the provided ACL associated with the provided user.
|
|
108
|
-
|
|
109
|
-
#### Parameters
|
|
110
|
-
|
|
111
|
-
##### acl
|
|
112
|
-
|
|
113
|
-
[`AccessControlList`](../interfaces/AccessControlList.md)
|
|
114
|
-
|
|
115
|
-
The access control list that will be searched.
|
|
116
|
-
|
|
117
|
-
##### user
|
|
118
|
-
|
|
119
|
-
`JWTUser` \| `undefined`
|
|
120
|
-
|
|
121
|
-
The user to find a record for.
|
|
122
|
-
|
|
123
|
-
#### Returns
|
|
124
|
-
|
|
125
|
-
[`ACLRecord`](../interfaces/ACLRecord.md) \| `null`
|
|
126
|
-
|
|
127
|
-
The ACL record associated with the given user if found, otherwise `undefined`.
|
|
128
|
-
|
|
129
|
-
***
|
|
130
|
-
|
|
131
|
-
### hasPermission()
|
|
132
|
-
|
|
133
|
-
> **hasPermission**(`user`, `acl`, `action`): `Promise`\<`boolean`\>
|
|
134
|
-
|
|
135
|
-
Defined in: [src/security/ACLUtils.ts:151](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/security/ACLUtils.ts#L151)
|
|
136
|
-
|
|
137
|
-
Validates that the user has permission to perform the provided action using the given access control list.
|
|
138
|
-
|
|
139
|
-
#### Parameters
|
|
140
|
-
|
|
141
|
-
##### user
|
|
142
|
-
|
|
143
|
-
`JWTUser` \| `undefined`
|
|
144
|
-
|
|
145
|
-
The user to validate permissions of.
|
|
146
|
-
|
|
147
|
-
##### acl
|
|
148
|
-
|
|
149
|
-
`string` \| [`AccessControlList`](../interfaces/AccessControlList.md)
|
|
150
|
-
|
|
151
|
-
The ACL or uid of an ACL to validate permissions against.
|
|
152
|
-
|
|
153
|
-
##### action
|
|
154
|
-
|
|
155
|
-
[`ACLAction`](../enumerations/ACLAction.md)
|
|
156
|
-
|
|
157
|
-
The action that the user desires permission for.
|
|
158
|
-
|
|
159
|
-
#### Returns
|
|
160
|
-
|
|
161
|
-
`Promise`\<`boolean`\>
|
|
162
|
-
|
|
163
|
-
`true` if the user has at least one of the permissions granted for the given entity, otherwise `false`.
|
|
164
|
-
|
|
165
|
-
***
|
|
166
|
-
|
|
167
|
-
### populateParent()
|
|
168
|
-
|
|
169
|
-
> **populateParent**(`acl`, `parentUids?`): `Promise`\<`void`\>
|
|
170
|
-
|
|
171
|
-
Defined in: [src/security/ACLUtils.ts:518](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/security/ACLUtils.ts#L518)
|
|
172
|
-
|
|
173
|
-
Attempts to retrieve the parent access control list for the given ACL object.
|
|
174
|
-
|
|
175
|
-
#### Parameters
|
|
176
|
-
|
|
177
|
-
##### acl
|
|
178
|
-
|
|
179
|
-
[`AccessControlList`](../interfaces/AccessControlList.md)
|
|
180
|
-
|
|
181
|
-
The access control list whose parents will be populated.
|
|
182
|
-
|
|
183
|
-
##### parentUids?
|
|
184
|
-
|
|
185
|
-
`string`[] = `[]`
|
|
186
|
-
|
|
187
|
-
The list of already found parent UIDs. This is used to break circular dependencies.
|
|
188
|
-
|
|
189
|
-
#### Returns
|
|
190
|
-
|
|
191
|
-
`Promise`\<`void`\>
|
|
192
|
-
|
|
193
|
-
***
|
|
194
|
-
|
|
195
|
-
### removeACL()
|
|
196
|
-
|
|
197
|
-
> **removeACL**(`uid`): `Promise`\<`void`\>
|
|
198
|
-
|
|
199
|
-
Defined in: [src/security/ACLUtils.ts:284](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/security/ACLUtils.ts#L284)
|
|
200
|
-
|
|
201
|
-
Deletes the ACL with the given identifier from the database.
|
|
202
|
-
|
|
203
|
-
#### Parameters
|
|
204
|
-
|
|
205
|
-
##### uid
|
|
206
|
-
|
|
207
|
-
`string`
|
|
208
|
-
|
|
209
|
-
The unique identifier of the ACL to remove.
|
|
210
|
-
|
|
211
|
-
#### Returns
|
|
212
|
-
|
|
213
|
-
`Promise`\<`void`\>
|
|
214
|
-
|
|
215
|
-
***
|
|
216
|
-
|
|
217
|
-
### saveACL()
|
|
218
|
-
|
|
219
|
-
> **saveACL**(`acl`): `Promise`\<[`AccessControlList`](../interfaces/AccessControlList.md) \| `null`\>
|
|
220
|
-
|
|
221
|
-
Defined in: [src/security/ACLUtils.ts:372](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/security/ACLUtils.ts#L372)
|
|
222
|
-
|
|
223
|
-
Stores the given access control list into the ACL database.
|
|
224
|
-
|
|
225
|
-
#### Parameters
|
|
226
|
-
|
|
227
|
-
##### acl
|
|
228
|
-
|
|
229
|
-
[`AccessControlList`](../interfaces/AccessControlList.md)
|
|
230
|
-
|
|
231
|
-
The ACL to store.
|
|
232
|
-
|
|
233
|
-
#### Returns
|
|
234
|
-
|
|
235
|
-
`Promise`\<[`AccessControlList`](../interfaces/AccessControlList.md) \| `null`\>
|
|
236
|
-
|
|
237
|
-
Returns the ACL that was stored in the database.
|
|
238
|
-
|
|
239
|
-
***
|
|
240
|
-
|
|
241
|
-
### saveDefaultACL()
|
|
242
|
-
|
|
243
|
-
> **saveDefaultACL**(`acl`): `Promise`\<[`AccessControlList`](../interfaces/AccessControlList.md) \| `null`\>
|
|
244
|
-
|
|
245
|
-
Defined in: [src/security/ACLUtils.ts:438](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/security/ACLUtils.ts#L438)
|
|
246
|
-
|
|
247
|
-
Stores the given default access control list into the ACL database. A default ACL is a special type of ACL
|
|
248
|
-
that is primarily defined and maintained within the code but allows for user-specific overrides. To accomplish
|
|
249
|
-
this, the provided ACL is split in two. A new record is automatically created with the `uid` of the form
|
|
250
|
-
`default_<uid>` that stores the exact record as provided by code. Then a second ACL record is created
|
|
251
|
-
with the `uid` being that of what is passed as the argument. This second ACL is used to store user-defined
|
|
252
|
-
overrides. As the `default_<uid>` record is always overwritten with the lastest version of the code, any
|
|
253
|
-
user-defined changes made to it are lost on service restart.
|
|
254
|
-
|
|
255
|
-
#### Parameters
|
|
256
|
-
|
|
257
|
-
##### acl
|
|
258
|
-
|
|
259
|
-
[`AccessControlList`](../interfaces/AccessControlList.md)
|
|
260
|
-
|
|
261
|
-
#### Returns
|
|
262
|
-
|
|
263
|
-
`Promise`\<[`AccessControlList`](../interfaces/AccessControlList.md) \| `null`\>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
[**@rapidrest/service-core**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rapidrest/service-core](../globals.md) / AdminRoute
|
|
6
|
-
|
|
7
|
-
# Class: AdminRoute
|
|
8
|
-
|
|
9
|
-
Defined in: [src/routes/AdminRoute.ts:50](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/routes/AdminRoute.ts#L50)
|
|
10
|
-
|
|
11
|
-
The `AdminRoute` provides a default `/admin` endpoint that gives trusted users the following abilities:
|
|
12
|
-
|
|
13
|
-
* Clear cache via `GET /admin/clear-cache`
|
|
14
|
-
* Live tail the service logs via `GET /admin/logs`
|
|
15
|
-
* Retrieve service dependencies via `GET /admin/dependencies`
|
|
16
|
-
* Retrieve service release notes via `GET /admin/release-notes`
|
|
17
|
-
* Restart the service via `GET /admin/restart`
|
|
18
|
-
|
|
19
|
-
## Author
|
|
20
|
-
|
|
21
|
-
Jean-Philippe Steinmetz
|
|
22
|
-
|
|
23
|
-
## Constructors
|
|
24
|
-
|
|
25
|
-
### Constructor
|
|
26
|
-
|
|
27
|
-
> **new AdminRoute**(`releaseNotes`): `AdminRoute`
|
|
28
|
-
|
|
29
|
-
Defined in: [src/routes/AdminRoute.ts:82](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/routes/AdminRoute.ts#L82)
|
|
30
|
-
|
|
31
|
-
Constructs a new `ReleaseNotesRoute` object with the specified defaults.
|
|
32
|
-
|
|
33
|
-
#### Parameters
|
|
34
|
-
|
|
35
|
-
##### releaseNotes
|
|
36
|
-
|
|
37
|
-
`string`
|
|
38
|
-
|
|
39
|
-
The ReleaseNotes specification object to serve.
|
|
40
|
-
|
|
41
|
-
#### Returns
|
|
42
|
-
|
|
43
|
-
`AdminRoute`
|
|
44
|
-
|
|
45
|
-
## Properties
|
|
46
|
-
|
|
47
|
-
### cacheClient?
|
|
48
|
-
|
|
49
|
-
> `protected` `optional` **cacheClient?**: `Redis`
|
|
50
|
-
|
|
51
|
-
Defined in: [src/routes/AdminRoute.ts:55](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/routes/AdminRoute.ts#L55)
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
[**@rapidrest/service-core**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rapidrest/service-core](../globals.md) / AuthMiddleware
|
|
6
|
-
|
|
7
|
-
# Class: AuthMiddleware
|
|
8
|
-
|
|
9
|
-
Defined in: [src/auth/AuthMiddleware.ts:19](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/auth/AuthMiddleware.ts#L19)
|
|
10
|
-
|
|
11
|
-
A set of common utilities for performing authentication using one or more strategies.
|
|
12
|
-
|
|
13
|
-
## Author
|
|
14
|
-
|
|
15
|
-
Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
16
|
-
|
|
17
|
-
## Constructors
|
|
18
|
-
|
|
19
|
-
### Constructor
|
|
20
|
-
|
|
21
|
-
> **new AuthMiddleware**(): `AuthMiddleware`
|
|
22
|
-
|
|
23
|
-
#### Returns
|
|
24
|
-
|
|
25
|
-
`AuthMiddleware`
|
|
26
|
-
|
|
27
|
-
## Properties
|
|
28
|
-
|
|
29
|
-
### strategies
|
|
30
|
-
|
|
31
|
-
> `readonly` **strategies**: `Map`\<`string`, [`AuthStrategy`](../interfaces/AuthStrategy.md)\>
|
|
32
|
-
|
|
33
|
-
Defined in: [src/auth/AuthMiddleware.ts:30](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/auth/AuthMiddleware.ts#L30)
|
|
34
|
-
|
|
35
|
-
The authentication strategies that have been registered.
|
|
36
|
-
|
|
37
|
-
## Methods
|
|
38
|
-
|
|
39
|
-
### authenticate()
|
|
40
|
-
|
|
41
|
-
> **authenticate**(`strategies`, `req`, `res?`, `required?`): `Promise`\<[`AuthResult`](../interfaces/AuthResult.md) \| `undefined`\>
|
|
42
|
-
|
|
43
|
-
Defined in: [src/auth/AuthMiddleware.ts:54](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/auth/AuthMiddleware.ts#L54)
|
|
44
|
-
|
|
45
|
-
Performs authentication of the given request using one of the provided strategies.
|
|
46
|
-
|
|
47
|
-
#### Parameters
|
|
48
|
-
|
|
49
|
-
##### strategies
|
|
50
|
-
|
|
51
|
-
`string`[]
|
|
52
|
-
|
|
53
|
-
The list of strategy names to attempt authentication with.
|
|
54
|
-
|
|
55
|
-
##### req
|
|
56
|
-
|
|
57
|
-
[`HttpRequest`](../interfaces/HttpRequest.md)
|
|
58
|
-
|
|
59
|
-
The request containing data to perform authenticate with.
|
|
60
|
-
|
|
61
|
-
##### res?
|
|
62
|
-
|
|
63
|
-
[`HttpResponse`](../interfaces/HttpResponse.md)
|
|
64
|
-
|
|
65
|
-
The response to use when writing back directly to the client.
|
|
66
|
-
|
|
67
|
-
##### required?
|
|
68
|
-
|
|
69
|
-
`boolean`
|
|
70
|
-
|
|
71
|
-
Set to `true` to if authentication is required to pass, otherwise set to `false`.
|
|
72
|
-
|
|
73
|
-
#### Returns
|
|
74
|
-
|
|
75
|
-
`Promise`\<[`AuthResult`](../interfaces/AuthResult.md) \| `undefined`\>
|
|
76
|
-
|
|
77
|
-
***
|
|
78
|
-
|
|
79
|
-
### authenticateSync()
|
|
80
|
-
|
|
81
|
-
> **authenticateSync**(`strategies`, `req`, `res?`, `required?`): [`AuthResult`](../interfaces/AuthResult.md) \| `undefined`
|
|
82
|
-
|
|
83
|
-
Defined in: [src/auth/AuthMiddleware.ts:92](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/auth/AuthMiddleware.ts#L92)
|
|
84
|
-
|
|
85
|
-
Performs authentication of the given request using one of the provided strategies.
|
|
86
|
-
|
|
87
|
-
This is the synchronous version of `authenticate` that performs blocking based authentication.
|
|
88
|
-
|
|
89
|
-
#### Parameters
|
|
90
|
-
|
|
91
|
-
##### strategies
|
|
92
|
-
|
|
93
|
-
`string`[]
|
|
94
|
-
|
|
95
|
-
The list of strategy names to attempt authentication with.
|
|
96
|
-
|
|
97
|
-
##### req
|
|
98
|
-
|
|
99
|
-
[`HttpRequest`](../interfaces/HttpRequest.md)
|
|
100
|
-
|
|
101
|
-
The request containing data to perform authenticate with.
|
|
102
|
-
|
|
103
|
-
##### res?
|
|
104
|
-
|
|
105
|
-
[`HttpResponse`](../interfaces/HttpResponse.md)
|
|
106
|
-
|
|
107
|
-
The response to use when writing back directly to the client.
|
|
108
|
-
|
|
109
|
-
##### required?
|
|
110
|
-
|
|
111
|
-
`boolean`
|
|
112
|
-
|
|
113
|
-
Set to `true` to if authentication is required to pass, otherwise set to `false`.
|
|
114
|
-
|
|
115
|
-
#### Returns
|
|
116
|
-
|
|
117
|
-
[`AuthResult`](../interfaces/AuthResult.md) \| `undefined`
|
|
118
|
-
|
|
119
|
-
***
|
|
120
|
-
|
|
121
|
-
### authWebSocket()
|
|
122
|
-
|
|
123
|
-
> **authWebSocket**(`required`): [`RequestHandler`](../type-aliases/RequestHandler.md)
|
|
124
|
-
|
|
125
|
-
Defined in: [src/auth/AuthMiddleware.ts:133](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/auth/AuthMiddleware.ts#L133)
|
|
126
|
-
|
|
127
|
-
Returns a request handler function that will perform authentication of a websocket connection. Authentication
|
|
128
|
-
can be handled in two ways:
|
|
129
|
-
|
|
130
|
-
1. Authorization header
|
|
131
|
-
2. Negotiation via handshake
|
|
132
|
-
|
|
133
|
-
This middleware function primarily provides the implementation for item 2 above.
|
|
134
|
-
|
|
135
|
-
#### Parameters
|
|
136
|
-
|
|
137
|
-
##### required
|
|
138
|
-
|
|
139
|
-
`boolean`
|
|
140
|
-
|
|
141
|
-
Set to `true` to indicate that auth is required, otherwise `false`.
|
|
142
|
-
|
|
143
|
-
#### Returns
|
|
144
|
-
|
|
145
|
-
[`RequestHandler`](../type-aliases/RequestHandler.md)
|
|
146
|
-
|
|
147
|
-
***
|
|
148
|
-
|
|
149
|
-
### register()
|
|
150
|
-
|
|
151
|
-
> **register**(`name`, `strategy`): `void`
|
|
152
|
-
|
|
153
|
-
Defined in: [src/auth/AuthMiddleware.ts:277](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/auth/AuthMiddleware.ts#L277)
|
|
154
|
-
|
|
155
|
-
Registers the provided authentication strategy to be used
|
|
156
|
-
|
|
157
|
-
#### Parameters
|
|
158
|
-
|
|
159
|
-
##### name
|
|
160
|
-
|
|
161
|
-
`string`
|
|
162
|
-
|
|
163
|
-
The name of the authentication type to associate the given strategy with
|
|
164
|
-
|
|
165
|
-
##### strategy
|
|
166
|
-
|
|
167
|
-
[`AuthStrategy`](../interfaces/AuthStrategy.md)
|
|
168
|
-
|
|
169
|
-
The strategy to register
|
|
170
|
-
|
|
171
|
-
#### Returns
|
|
172
|
-
|
|
173
|
-
`void`
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
[**@rapidrest/service-core**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rapidrest/service-core](../globals.md) / BackgroundService
|
|
6
|
-
|
|
7
|
-
# Abstract Class: BackgroundService
|
|
8
|
-
|
|
9
|
-
Defined in: [src/BackgroundService.ts:10](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/BackgroundService.ts#L10)
|
|
10
|
-
|
|
11
|
-
The `BackgroundService` is an abstract base class for defining scheduled background services. A background service
|
|
12
|
-
executes in the background once on startup or on a set schedule (like a cron job) and performs additional processing.
|
|
13
|
-
|
|
14
|
-
## Author
|
|
15
|
-
|
|
16
|
-
Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
17
|
-
|
|
18
|
-
## Constructors
|
|
19
|
-
|
|
20
|
-
### Constructor
|
|
21
|
-
|
|
22
|
-
> **new BackgroundService**(`config`, `logger`): `BackgroundService`
|
|
23
|
-
|
|
24
|
-
Defined in: [src/BackgroundService.ts:16](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/BackgroundService.ts#L16)
|
|
25
|
-
|
|
26
|
-
#### Parameters
|
|
27
|
-
|
|
28
|
-
##### config
|
|
29
|
-
|
|
30
|
-
`any`
|
|
31
|
-
|
|
32
|
-
##### logger
|
|
33
|
-
|
|
34
|
-
`any`
|
|
35
|
-
|
|
36
|
-
#### Returns
|
|
37
|
-
|
|
38
|
-
`BackgroundService`
|
|
39
|
-
|
|
40
|
-
## Properties
|
|
41
|
-
|
|
42
|
-
### config
|
|
43
|
-
|
|
44
|
-
> `protected` **config**: `any`
|
|
45
|
-
|
|
46
|
-
Defined in: [src/BackgroundService.ts:12](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/BackgroundService.ts#L12)
|
|
47
|
-
|
|
48
|
-
The global application configuration that the service can reference.
|
|
49
|
-
|
|
50
|
-
***
|
|
51
|
-
|
|
52
|
-
### logger
|
|
53
|
-
|
|
54
|
-
> `protected` **logger**: `any`
|
|
55
|
-
|
|
56
|
-
Defined in: [src/BackgroundService.ts:14](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/BackgroundService.ts#L14)
|
|
57
|
-
|
|
58
|
-
The logging utility to use.
|
|
59
|
-
|
|
60
|
-
## Accessors
|
|
61
|
-
|
|
62
|
-
### schedule
|
|
63
|
-
|
|
64
|
-
#### Get Signature
|
|
65
|
-
|
|
66
|
-
> **get** `abstract` **schedule**(): `string` \| `undefined`
|
|
67
|
-
|
|
68
|
-
Defined in: [src/BackgroundService.ts:25](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/BackgroundService.ts#L25)
|
|
69
|
-
|
|
70
|
-
Returns the desired execution interval that this service should be scheduled with. If `undefined` is returned
|
|
71
|
-
the service is executed only once.
|
|
72
|
-
|
|
73
|
-
##### Returns
|
|
74
|
-
|
|
75
|
-
`string` \| `undefined`
|
|
76
|
-
|
|
77
|
-
## Methods
|
|
78
|
-
|
|
79
|
-
### run()
|
|
80
|
-
|
|
81
|
-
> `abstract` **run**(): `void` \| `Promise`\<`void`\>
|
|
82
|
-
|
|
83
|
-
Defined in: [src/BackgroundService.ts:30](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/BackgroundService.ts#L30)
|
|
84
|
-
|
|
85
|
-
The processing function to execute at each scheduled interval.
|
|
86
|
-
|
|
87
|
-
#### Returns
|
|
88
|
-
|
|
89
|
-
`void` \| `Promise`\<`void`\>
|
|
90
|
-
|
|
91
|
-
***
|
|
92
|
-
|
|
93
|
-
### start()
|
|
94
|
-
|
|
95
|
-
> `abstract` **start**(): `void` \| `Promise`\<`void`\>
|
|
96
|
-
|
|
97
|
-
Defined in: [src/BackgroundService.ts:35](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/BackgroundService.ts#L35)
|
|
98
|
-
|
|
99
|
-
Initializes the background service with any defaults.
|
|
100
|
-
|
|
101
|
-
#### Returns
|
|
102
|
-
|
|
103
|
-
`void` \| `Promise`\<`void`\>
|
|
104
|
-
|
|
105
|
-
***
|
|
106
|
-
|
|
107
|
-
### stop()
|
|
108
|
-
|
|
109
|
-
> `abstract` **stop**(): `void` \| `Promise`\<`void`\>
|
|
110
|
-
|
|
111
|
-
Defined in: [src/BackgroundService.ts:40](https://github.com/rapidrest/service-core/blob/4c90df5a9a62e99656161ce7b45c7c6781b43869/src/BackgroundService.ts#L40)
|
|
112
|
-
|
|
113
|
-
Shuts down the background allowing the service to complete any outstanding tasks.
|
|
114
|
-
|
|
115
|
-
#### Returns
|
|
116
|
-
|
|
117
|
-
`void` \| `Promise`\<`void`\>
|