@rapidrest/service-core 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +16 -0
- package/dist/lib/ApiErrors.js +41 -0
- package/dist/lib/ApiErrors.js.map +1 -0
- package/dist/lib/BackgroundService.js +16 -0
- package/dist/lib/BackgroundService.js.map +1 -0
- package/dist/lib/BackgroundServiceManager.js +135 -0
- package/dist/lib/BackgroundServiceManager.js.map +1 -0
- package/dist/lib/BulkError.js +24 -0
- package/dist/lib/BulkError.js.map +1 -0
- package/dist/lib/EventListenerManager.js +161 -0
- package/dist/lib/EventListenerManager.js.map +1 -0
- package/dist/lib/NetUtils.js +103 -0
- package/dist/lib/NetUtils.js.map +1 -0
- package/dist/lib/NotificationUtils.js +34 -0
- package/dist/lib/NotificationUtils.js.map +1 -0
- package/dist/lib/ObjectFactory.js +90 -0
- package/dist/lib/ObjectFactory.js.map +1 -0
- package/dist/lib/OpenApiSpec.js +748 -0
- package/dist/lib/OpenApiSpec.js.map +1 -0
- package/dist/lib/Server.js +549 -0
- package/dist/lib/Server.js.map +1 -0
- package/dist/lib/Types.js +2 -0
- package/dist/lib/Types.js.map +1 -0
- package/dist/lib/auth/AuthMiddleware.js +229 -0
- package/dist/lib/auth/AuthMiddleware.js.map +1 -0
- package/dist/lib/auth/AuthStrategy.js +2 -0
- package/dist/lib/auth/AuthStrategy.js.map +1 -0
- package/dist/lib/auth/BasicStrategy.js +106 -0
- package/dist/lib/auth/BasicStrategy.js.map +1 -0
- package/dist/lib/auth/JWTStrategy.js +161 -0
- package/dist/lib/auth/JWTStrategy.js.map +1 -0
- package/dist/lib/auth/index.js +5 -0
- package/dist/lib/auth/index.js.map +1 -0
- package/dist/lib/database/ConnectionKinds.js +14 -0
- package/dist/lib/database/ConnectionKinds.js.map +1 -0
- package/dist/lib/database/ConnectionManager.js +161 -0
- package/dist/lib/database/ConnectionManager.js.map +1 -0
- package/dist/lib/database/MongoConnection.js +86 -0
- package/dist/lib/database/MongoConnection.js.map +1 -0
- package/dist/lib/database/MongoRepository.js +136 -0
- package/dist/lib/database/MongoRepository.js.map +1 -0
- package/dist/lib/database/MongoSchemaSync.js +136 -0
- package/dist/lib/database/MongoSchemaSync.js.map +1 -0
- package/dist/lib/database/NamingUtils.js +52 -0
- package/dist/lib/database/NamingUtils.js.map +1 -0
- package/dist/lib/database/TypeOrmSupport.js +146 -0
- package/dist/lib/database/TypeOrmSupport.js.map +1 -0
- package/dist/lib/database/index.js +7 -0
- package/dist/lib/database/index.js.map +1 -0
- package/dist/lib/decorators/DatabaseDecorators.js +52 -0
- package/dist/lib/decorators/DatabaseDecorators.js.map +1 -0
- package/dist/lib/decorators/DocDecorators.js +120 -0
- package/dist/lib/decorators/DocDecorators.js.map +1 -0
- package/dist/lib/decorators/EventDecorators.js +24 -0
- package/dist/lib/decorators/EventDecorators.js.map +1 -0
- package/dist/lib/decorators/ModelDecorators.js +173 -0
- package/dist/lib/decorators/ModelDecorators.js.map +1 -0
- package/dist/lib/decorators/PersistenceDecorators.js +177 -0
- package/dist/lib/decorators/PersistenceDecorators.js.map +1 -0
- package/dist/lib/decorators/RouteDecorators.js +324 -0
- package/dist/lib/decorators/RouteDecorators.js.map +1 -0
- package/dist/lib/decorators/index.js +7 -0
- package/dist/lib/decorators/index.js.map +1 -0
- package/dist/lib/http/Adapters.js +230 -0
- package/dist/lib/http/Adapters.js.map +1 -0
- package/dist/lib/http/Router.js +403 -0
- package/dist/lib/http/Router.js.map +1 -0
- package/dist/lib/http/WebSocket.js +82 -0
- package/dist/lib/http/WebSocket.js.map +1 -0
- package/dist/lib/http/index.js +4 -0
- package/dist/lib/http/index.js.map +1 -0
- package/dist/lib/http/types.js +5 -0
- package/dist/lib/http/types.js.map +1 -0
- package/dist/lib/index.js +18 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/models/BaseEntity.js +83 -0
- package/dist/lib/models/BaseEntity.js.map +1 -0
- package/dist/lib/models/BaseMongoEntity.js +40 -0
- package/dist/lib/models/BaseMongoEntity.js.map +1 -0
- package/dist/lib/models/ModelUtils.js +645 -0
- package/dist/lib/models/ModelUtils.js.map +1 -0
- package/dist/lib/models/RecoverableBaseEntity.js +39 -0
- package/dist/lib/models/RecoverableBaseEntity.js.map +1 -0
- package/dist/lib/models/RecoverableBaseMongoEntity.js +40 -0
- package/dist/lib/models/RecoverableBaseMongoEntity.js.map +1 -0
- package/dist/lib/models/RepoUtils.js +717 -0
- package/dist/lib/models/RepoUtils.js.map +1 -0
- package/dist/lib/models/SimpleEntity.js +42 -0
- package/dist/lib/models/SimpleEntity.js.map +1 -0
- package/dist/lib/models/SimpleMongoEntity.js +38 -0
- package/dist/lib/models/SimpleMongoEntity.js.map +1 -0
- package/dist/lib/models/StatusExtraData.js +15 -0
- package/dist/lib/models/StatusExtraData.js.map +1 -0
- package/dist/lib/models/index.js +10 -0
- package/dist/lib/models/index.js.map +1 -0
- package/dist/lib/routes/AdminRoute.js +268 -0
- package/dist/lib/routes/AdminRoute.js.map +1 -0
- package/dist/lib/routes/MetricsRoute.js +86 -0
- package/dist/lib/routes/MetricsRoute.js.map +1 -0
- package/dist/lib/routes/ModelRoute.js +481 -0
- package/dist/lib/routes/ModelRoute.js.map +1 -0
- package/dist/lib/routes/OpenAPIRoute.js +115 -0
- package/dist/lib/routes/OpenAPIRoute.js.map +1 -0
- package/dist/lib/routes/RouteUtils.js +445 -0
- package/dist/lib/routes/RouteUtils.js.map +1 -0
- package/dist/lib/routes/StatusRoute.js +55 -0
- package/dist/lib/routes/StatusRoute.js.map +1 -0
- package/dist/lib/routes/index.js +7 -0
- package/dist/lib/routes/index.js.map +1 -0
- package/dist/lib/security/ACLRouteMongo.js +194 -0
- package/dist/lib/security/ACLRouteMongo.js.map +1 -0
- package/dist/lib/security/ACLRouteSQL.js +193 -0
- package/dist/lib/security/ACLRouteSQL.js.map +1 -0
- package/dist/lib/security/ACLUtils.js +457 -0
- package/dist/lib/security/ACLUtils.js.map +1 -0
- package/dist/lib/security/AccessControlList.js +18 -0
- package/dist/lib/security/AccessControlList.js.map +1 -0
- package/dist/lib/security/AccessControlListMongo.js +155 -0
- package/dist/lib/security/AccessControlListMongo.js.map +1 -0
- package/dist/lib/security/AccessControlListSQL.js +149 -0
- package/dist/lib/security/AccessControlListSQL.js.map +1 -0
- package/dist/lib/security/index.js +3 -0
- package/dist/lib/security/index.js.map +1 -0
- package/dist/lib/test/index.js +3 -0
- package/dist/lib/test/index.js.map +1 -0
- package/dist/lib/test/request.js +99 -0
- package/dist/lib/test/request.js.map +1 -0
- package/dist/lib/test/requestws.js +173 -0
- package/dist/lib/test/requestws.js.map +1 -0
- package/dist/types/ApiErrors.d.ts +38 -0
- package/dist/types/BackgroundService.d.ts +30 -0
- package/dist/types/BackgroundServiceManager.d.ts +66 -0
- package/dist/types/BulkError.d.ts +11 -0
- package/dist/types/EventListenerManager.d.ts +36 -0
- package/dist/types/NetUtils.d.ts +29 -0
- package/dist/types/NotificationUtils.d.ts +25 -0
- package/dist/types/ObjectFactory.d.ts +17 -0
- package/dist/types/OpenApiSpec.d.ts +114 -0
- package/dist/types/Server.d.ts +180 -0
- package/dist/types/Types.d.ts +8 -0
- package/dist/types/auth/AuthMiddleware.d.ts +42 -0
- package/dist/types/auth/AuthStrategy.d.ts +32 -0
- package/dist/types/auth/BasicStrategy.d.ts +33 -0
- package/dist/types/auth/JWTStrategy.d.ts +61 -0
- package/dist/types/auth/index.d.ts +4 -0
- package/dist/types/database/ConnectionKinds.d.ts +7 -0
- package/dist/types/database/ConnectionManager.d.ts +35 -0
- package/dist/types/database/MongoConnection.d.ts +54 -0
- package/dist/types/database/MongoRepository.d.ts +92 -0
- package/dist/types/database/MongoSchemaSync.d.ts +41 -0
- package/dist/types/database/NamingUtils.d.ts +24 -0
- package/dist/types/database/TypeOrmSupport.d.ts +20 -0
- package/dist/types/database/index.d.ts +6 -0
- package/dist/types/decorators/DatabaseDecorators.d.ts +18 -0
- package/dist/types/decorators/DocDecorators.d.ts +69 -0
- package/dist/types/decorators/EventDecorators.d.ts +12 -0
- package/dist/types/decorators/ModelDecorators.d.ts +80 -0
- package/dist/types/decorators/PersistenceDecorators.d.ts +117 -0
- package/dist/types/decorators/RouteDecorators.d.ts +172 -0
- package/dist/types/decorators/index.d.ts +6 -0
- package/dist/types/http/Adapters.d.ts +68 -0
- package/dist/types/http/Router.d.ts +99 -0
- package/dist/types/http/WebSocket.d.ts +56 -0
- package/dist/types/http/index.d.ts +6 -0
- package/dist/types/http/types.d.ts +54 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/models/BaseEntity.d.ts +29 -0
- package/dist/types/models/BaseMongoEntity.d.ts +13 -0
- package/dist/types/models/ModelUtils.d.ts +166 -0
- package/dist/types/models/RecoverableBaseEntity.d.ts +16 -0
- package/dist/types/models/RecoverableBaseMongoEntity.d.ts +16 -0
- package/dist/types/models/RepoUtils.d.ts +154 -0
- package/dist/types/models/SimpleEntity.d.ts +14 -0
- package/dist/types/models/SimpleMongoEntity.d.ts +15 -0
- package/dist/types/models/StatusExtraData.d.ts +6 -0
- package/dist/types/models/index.d.ts +9 -0
- package/dist/types/routes/AdminRoute.d.ts +47 -0
- package/dist/types/routes/MetricsRoute.d.ts +15 -0
- package/dist/types/routes/ModelRoute.d.ts +226 -0
- package/dist/types/routes/OpenAPIRoute.d.ts +17 -0
- package/dist/types/routes/RouteUtils.d.ts +55 -0
- package/dist/types/routes/StatusRoute.d.ts +11 -0
- package/dist/types/routes/index.d.ts +6 -0
- package/dist/types/security/ACLRouteMongo.d.ts +19 -0
- package/dist/types/security/ACLRouteSQL.d.ts +19 -0
- package/dist/types/security/ACLUtils.d.ts +94 -0
- package/dist/types/security/AccessControlList.d.ts +103 -0
- package/dist/types/security/AccessControlListMongo.d.ts +24 -0
- package/dist/types/security/AccessControlListSQL.d.ts +24 -0
- package/dist/types/security/index.d.ts +2 -0
- package/dist/types/test/index.d.ts +2 -0
- package/dist/types/test/request.d.ts +24 -0
- package/dist/types/test/requestws.d.ts +21 -0
- package/docs/Makefile +20 -0
- package/docs/conf.py +58 -0
- package/docs/index.rst +17 -0
- package/docs/make.bat +35 -0
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/README.md +13 -0
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/MongoRepository.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/RedisConnection.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/Repository.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/README.md +23 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Default.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Description.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Document.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Example.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Format.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Returns.md +28 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Summary.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Tags.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/TypeInfo.md +28 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/interfaces/DocumentsData.md +57 -0
- package/docs/reference/@rapidrest/namespaces/EventDecorators/README.md +12 -0
- package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/EventListener.md +17 -0
- package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/OnEvent.md +26 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/README.md +26 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Cache.md +25 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/ChildEntity.md +18 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/DataStore.md +25 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Identifier.md +27 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Protect.md +35 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Reference.md +25 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Shard.md +27 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/TrackChanges.md +26 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/interfaces/PendingTypeOrmColumn.md +45 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/variables/pendingTypeOrmColumns.md +14 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/README.md +25 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Column.md +25 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Entity.md +26 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Index.md +119 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/PrimaryColumn.md +25 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Unique.md +68 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getColumnMetadata.md +26 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getEntityName.md +26 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getIndexMetadata.md +27 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnInfo.md +41 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnOptions.md +51 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexInfo.md +41 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexOptions.md +51 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/README.md +36 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/After.md +26 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Auth.md +33 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/AuthResult.md +31 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Before.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/ContentType.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Delete.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Get.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Head.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Header.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Method.md +31 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Model.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Options.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Param.md +26 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Patch.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Post.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Protect.md +31 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Put.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Query.md +26 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Request.md +31 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/RequiresRole.md +26 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Response.md +31 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Route.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Socket.md +33 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/User.md +31 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Validate.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/WebSocket.md +25 -0
- package/docs/reference/README.md +20 -0
- package/docs/reference/classes/ACLUtils.md +251 -0
- package/docs/reference/classes/AdminRoute.md +51 -0
- package/docs/reference/classes/AuthMiddleware.md +131 -0
- package/docs/reference/classes/BackgroundService.md +117 -0
- package/docs/reference/classes/BackgroundServiceManager.md +172 -0
- package/docs/reference/classes/BaseEntity.md +82 -0
- package/docs/reference/classes/BaseMongoEntity.md +107 -0
- package/docs/reference/classes/BasicStrategy.md +89 -0
- package/docs/reference/classes/BasicStrategyOptions.md +91 -0
- package/docs/reference/classes/BulkError.md +271 -0
- package/docs/reference/classes/ConnectionManager.md +75 -0
- package/docs/reference/classes/EventListenerManager.md +88 -0
- package/docs/reference/classes/JWTStrategy.md +77 -0
- package/docs/reference/classes/JWTStrategyOptions.md +97 -0
- package/docs/reference/classes/MetricsRoute.md +27 -0
- package/docs/reference/classes/ModelRoute.md +527 -0
- package/docs/reference/classes/ModelUtils.md +448 -0
- package/docs/reference/classes/MongoConnection.md +218 -0
- package/docs/reference/classes/MongoRepository.md +354 -0
- package/docs/reference/classes/MongoSchemaSync.md +67 -0
- package/docs/reference/classes/NetUtils.md +90 -0
- package/docs/reference/classes/NotificationUtils.md +77 -0
- package/docs/reference/classes/ObjectFactory.md +336 -0
- package/docs/reference/classes/OpenAPIRoute.md +77 -0
- package/docs/reference/classes/OpenApiSpec.md +892 -0
- package/docs/reference/classes/RecoverableBaseEntity.md +114 -0
- package/docs/reference/classes/RecoverableBaseMongoEntity.md +124 -0
- package/docs/reference/classes/RedisTransport.md +2202 -0
- package/docs/reference/classes/RepoUtils.md +486 -0
- package/docs/reference/classes/RouteUtils.md +191 -0
- package/docs/reference/classes/Server.md +408 -0
- package/docs/reference/classes/SimpleEntity.md +48 -0
- package/docs/reference/classes/SimpleMongoEntity.md +66 -0
- package/docs/reference/classes/StatusExtraData.md +57 -0
- package/docs/reference/classes/StatusRoute.md +26 -0
- package/docs/reference/enumerations/ACLAction.md +63 -0
- package/docs/reference/enumerations/ApiErrorMessages.md +123 -0
- package/docs/reference/enumerations/ApiErrors.md +123 -0
- package/docs/reference/functions/isSqlDataSource.md +26 -0
- package/docs/reference/functions/resolveCollectionName.md +33 -0
- package/docs/reference/functions/snakeCase.md +28 -0
- package/docs/reference/globals.md +91 -0
- package/docs/reference/interfaces/ACLRecord.md +96 -0
- package/docs/reference/interfaces/AccessControlList.md +76 -0
- package/docs/reference/interfaces/AuthResult.md +55 -0
- package/docs/reference/interfaces/AuthStrategy.md +57 -0
- package/docs/reference/interfaces/CreateRequestOptions.md +121 -0
- package/docs/reference/interfaces/DeleteRequestOptions.md +147 -0
- package/docs/reference/interfaces/FindRequestOptions.md +133 -0
- package/docs/reference/interfaces/JWTAuthResult.md +84 -0
- package/docs/reference/interfaces/RepoCreateOptions.md +95 -0
- package/docs/reference/interfaces/RepoDeleteOptions.md +115 -0
- package/docs/reference/interfaces/RepoFindOptions.md +135 -0
- package/docs/reference/interfaces/RepoOperationOptions.md +69 -0
- package/docs/reference/interfaces/RepoUpdateOptions.md +111 -0
- package/docs/reference/interfaces/RequestOptions.md +112 -0
- package/docs/reference/interfaces/TruncateRequestOptions.md +175 -0
- package/docs/reference/interfaces/UpdateRequestOptions.md +149 -0
- package/docs/reference/type-aliases/OneOrMany.md +19 -0
- package/docs/reference/type-aliases/OneOrNull.md +19 -0
- package/docs/reference/type-aliases/PartialBaseEntity.md +17 -0
- package/docs/reference/type-aliases/PartialSimpleEntity.md +17 -0
- package/docs/reference/type-aliases/UpdateObject.md +19 -0
- package/package.json +125 -0
|
@@ -0,0 +1,131 @@
|
|
|
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/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/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/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/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?`): [`AuthResult`](../interfaces/AuthResult.md) \| `Promise`\<[`AuthResult`](../interfaces/AuthResult.md)\> \| `undefined`
|
|
42
|
+
|
|
43
|
+
Defined in: [src/auth/AuthMiddleware.ts:54](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/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`
|
|
58
|
+
|
|
59
|
+
The request containing data to perform authenticate with.
|
|
60
|
+
|
|
61
|
+
##### res?
|
|
62
|
+
|
|
63
|
+
`HttpResponse`
|
|
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
|
+
[`AuthResult`](../interfaces/AuthResult.md) \| `Promise`\<[`AuthResult`](../interfaces/AuthResult.md)\> \| `undefined`
|
|
76
|
+
|
|
77
|
+
***
|
|
78
|
+
|
|
79
|
+
### authWebSocket()
|
|
80
|
+
|
|
81
|
+
> **authWebSocket**(`required`): `RequestHandler`
|
|
82
|
+
|
|
83
|
+
Defined in: [src/auth/AuthMiddleware.ts:95](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/AuthMiddleware.ts#L95)
|
|
84
|
+
|
|
85
|
+
Returns a request handler function that will perform authentication of a websocket connection. Authentication
|
|
86
|
+
can be handled in two ways:
|
|
87
|
+
|
|
88
|
+
1. Authorization header
|
|
89
|
+
2. Negotiation via handshake
|
|
90
|
+
|
|
91
|
+
This middleware function primarily provides the implementation for item 2 above.
|
|
92
|
+
|
|
93
|
+
#### Parameters
|
|
94
|
+
|
|
95
|
+
##### required
|
|
96
|
+
|
|
97
|
+
`boolean`
|
|
98
|
+
|
|
99
|
+
Set to `true` to indicate that auth is required, otherwise `false`.
|
|
100
|
+
|
|
101
|
+
#### Returns
|
|
102
|
+
|
|
103
|
+
`RequestHandler`
|
|
104
|
+
|
|
105
|
+
***
|
|
106
|
+
|
|
107
|
+
### register()
|
|
108
|
+
|
|
109
|
+
> **register**(`name`, `strategy`): `void`
|
|
110
|
+
|
|
111
|
+
Defined in: [src/auth/AuthMiddleware.ts:239](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/AuthMiddleware.ts#L239)
|
|
112
|
+
|
|
113
|
+
Registers the provided authentication strategy to be used
|
|
114
|
+
|
|
115
|
+
#### Parameters
|
|
116
|
+
|
|
117
|
+
##### name
|
|
118
|
+
|
|
119
|
+
`string`
|
|
120
|
+
|
|
121
|
+
The name of the authentication type to associate the given strategy with
|
|
122
|
+
|
|
123
|
+
##### strategy
|
|
124
|
+
|
|
125
|
+
[`AuthStrategy`](../interfaces/AuthStrategy.md)
|
|
126
|
+
|
|
127
|
+
The strategy to register
|
|
128
|
+
|
|
129
|
+
#### Returns
|
|
130
|
+
|
|
131
|
+
`void`
|
|
@@ -0,0 +1,117 @@
|
|
|
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/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/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/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/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/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/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/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/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/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/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/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/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/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/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/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/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`\>
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / BackgroundServiceManager
|
|
6
|
+
|
|
7
|
+
# Class: BackgroundServiceManager
|
|
8
|
+
|
|
9
|
+
Defined in: [src/BackgroundServiceManager.ts:35](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/BackgroundServiceManager.ts#L35)
|
|
10
|
+
|
|
11
|
+
The `BackgroundServiceManager` manages all configured background services in the application. It is responsible for
|
|
12
|
+
initializing the jobs, scheduling them and performing any related shutdown tasks. See the `BackgroundService`
|
|
13
|
+
class for details on how to create a background service class to be used by this manager.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
To use the manager instantiate a new object and provide the required constructor arguments. Then simply call the
|
|
17
|
+
`startAll` function. When shutting your application down you should call the `stopAll` function.
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
import { BackgroundServiceManager } from "@rapidrest/service-core";
|
|
21
|
+
|
|
22
|
+
const manager: BackgroundServiceManager = new BackgroundServiceManager(objectFactory, serviceClasses, config, logger);
|
|
23
|
+
await manager.startAll();
|
|
24
|
+
...
|
|
25
|
+
await manager.stopAll();
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
You may optionally start and stop individual services using the `start` and `stop` functions respectively.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
await manager.start("MyService");
|
|
32
|
+
...
|
|
33
|
+
await manger.stop("MyService");
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Author
|
|
37
|
+
|
|
38
|
+
Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
39
|
+
|
|
40
|
+
## Constructors
|
|
41
|
+
|
|
42
|
+
### Constructor
|
|
43
|
+
|
|
44
|
+
> **new BackgroundServiceManager**(`objectFactory`, `classes`, `config`, `logger`): `BackgroundServiceManager`
|
|
45
|
+
|
|
46
|
+
Defined in: [src/BackgroundServiceManager.ts:43](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/BackgroundServiceManager.ts#L43)
|
|
47
|
+
|
|
48
|
+
#### Parameters
|
|
49
|
+
|
|
50
|
+
##### objectFactory
|
|
51
|
+
|
|
52
|
+
[`ObjectFactory`](ObjectFactory.md)
|
|
53
|
+
|
|
54
|
+
##### classes
|
|
55
|
+
|
|
56
|
+
##### config
|
|
57
|
+
|
|
58
|
+
`any`
|
|
59
|
+
|
|
60
|
+
##### logger
|
|
61
|
+
|
|
62
|
+
`any`
|
|
63
|
+
|
|
64
|
+
#### Returns
|
|
65
|
+
|
|
66
|
+
`BackgroundServiceManager`
|
|
67
|
+
|
|
68
|
+
## Methods
|
|
69
|
+
|
|
70
|
+
### getService()
|
|
71
|
+
|
|
72
|
+
> **getService**(`name`): [`BackgroundService`](BackgroundService.md) \| `undefined`
|
|
73
|
+
|
|
74
|
+
Defined in: [src/BackgroundServiceManager.ts:55](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/BackgroundServiceManager.ts#L55)
|
|
75
|
+
|
|
76
|
+
Returns the service instance with the given name.
|
|
77
|
+
|
|
78
|
+
#### Parameters
|
|
79
|
+
|
|
80
|
+
##### name
|
|
81
|
+
|
|
82
|
+
`string`
|
|
83
|
+
|
|
84
|
+
The name of the background service to retrieve.
|
|
85
|
+
|
|
86
|
+
#### Returns
|
|
87
|
+
|
|
88
|
+
[`BackgroundService`](BackgroundService.md) \| `undefined`
|
|
89
|
+
|
|
90
|
+
***
|
|
91
|
+
|
|
92
|
+
### start()
|
|
93
|
+
|
|
94
|
+
> **start**(`serviceName`, `clazz?`, ...`args`): `Promise`\<`void`\>
|
|
95
|
+
|
|
96
|
+
Defined in: [src/BackgroundServiceManager.ts:81](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/BackgroundServiceManager.ts#L81)
|
|
97
|
+
|
|
98
|
+
Starts the background service with the given name.
|
|
99
|
+
|
|
100
|
+
#### Parameters
|
|
101
|
+
|
|
102
|
+
##### serviceName
|
|
103
|
+
|
|
104
|
+
`string`
|
|
105
|
+
|
|
106
|
+
The name of the background service to start.
|
|
107
|
+
|
|
108
|
+
##### clazz?
|
|
109
|
+
|
|
110
|
+
`any`
|
|
111
|
+
|
|
112
|
+
The class type of the service to start. If not specified the name is used to lookup the class type.
|
|
113
|
+
|
|
114
|
+
##### args
|
|
115
|
+
|
|
116
|
+
...`any`
|
|
117
|
+
|
|
118
|
+
The list of arguments to pass into the service constructor
|
|
119
|
+
|
|
120
|
+
#### Returns
|
|
121
|
+
|
|
122
|
+
`Promise`\<`void`\>
|
|
123
|
+
|
|
124
|
+
***
|
|
125
|
+
|
|
126
|
+
### startAll()
|
|
127
|
+
|
|
128
|
+
> **startAll**(): `Promise`\<`void`\>
|
|
129
|
+
|
|
130
|
+
Defined in: [src/BackgroundServiceManager.ts:62](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/BackgroundServiceManager.ts#L62)
|
|
131
|
+
|
|
132
|
+
Starts all configured background services.
|
|
133
|
+
|
|
134
|
+
#### Returns
|
|
135
|
+
|
|
136
|
+
`Promise`\<`void`\>
|
|
137
|
+
|
|
138
|
+
***
|
|
139
|
+
|
|
140
|
+
### stop()
|
|
141
|
+
|
|
142
|
+
> **stop**(`serviceName`): `Promise`\<`void`\>
|
|
143
|
+
|
|
144
|
+
Defined in: [src/BackgroundServiceManager.ts:139](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/BackgroundServiceManager.ts#L139)
|
|
145
|
+
|
|
146
|
+
Stops the background service with the given name.
|
|
147
|
+
|
|
148
|
+
#### Parameters
|
|
149
|
+
|
|
150
|
+
##### serviceName
|
|
151
|
+
|
|
152
|
+
`string`
|
|
153
|
+
|
|
154
|
+
The name of the background service to stop.
|
|
155
|
+
|
|
156
|
+
#### Returns
|
|
157
|
+
|
|
158
|
+
`Promise`\<`void`\>
|
|
159
|
+
|
|
160
|
+
***
|
|
161
|
+
|
|
162
|
+
### stopAll()
|
|
163
|
+
|
|
164
|
+
> **stopAll**(): `Promise`\<`void`\>
|
|
165
|
+
|
|
166
|
+
Defined in: [src/BackgroundServiceManager.ts:124](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/BackgroundServiceManager.ts#L124)
|
|
167
|
+
|
|
168
|
+
Stops all currently active background services that are owned by the manager.
|
|
169
|
+
|
|
170
|
+
#### Returns
|
|
171
|
+
|
|
172
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / BaseEntity
|
|
6
|
+
|
|
7
|
+
# Abstract Class: BaseEntity
|
|
8
|
+
|
|
9
|
+
Defined in: [src/models/BaseEntity.ts:18](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/models/BaseEntity.ts#L18)
|
|
10
|
+
|
|
11
|
+
Provides a common base class for all entity's that will be persisted to a datastore.
|
|
12
|
+
|
|
13
|
+
Note that the `@CreateDateColumn`, `@UpdateDateColumn`, and `@VersionColumn` decorators from TypeORM are not supported
|
|
14
|
+
because they are not implemented in TypeORM's MongoDB support. They are instead implemented directly by this
|
|
15
|
+
library as part of `ModelRoute`.
|
|
16
|
+
|
|
17
|
+
## Author
|
|
18
|
+
|
|
19
|
+
Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
20
|
+
|
|
21
|
+
## Extended by
|
|
22
|
+
|
|
23
|
+
- [`BaseMongoEntity`](BaseMongoEntity.md)
|
|
24
|
+
- [`RecoverableBaseEntity`](RecoverableBaseEntity.md)
|
|
25
|
+
|
|
26
|
+
## Constructors
|
|
27
|
+
|
|
28
|
+
### Constructor
|
|
29
|
+
|
|
30
|
+
> **new BaseEntity**(`other?`): `BaseEntity`
|
|
31
|
+
|
|
32
|
+
Defined in: [src/models/BaseEntity.ts:52](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/models/BaseEntity.ts#L52)
|
|
33
|
+
|
|
34
|
+
#### Parameters
|
|
35
|
+
|
|
36
|
+
##### other?
|
|
37
|
+
|
|
38
|
+
`Partial`\<`BaseEntity`\>
|
|
39
|
+
|
|
40
|
+
#### Returns
|
|
41
|
+
|
|
42
|
+
`BaseEntity`
|
|
43
|
+
|
|
44
|
+
## Properties
|
|
45
|
+
|
|
46
|
+
### dateCreated
|
|
47
|
+
|
|
48
|
+
> **dateCreated**: `Date`
|
|
49
|
+
|
|
50
|
+
Defined in: [src/models/BaseEntity.ts:35](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/models/BaseEntity.ts#L35)
|
|
51
|
+
|
|
52
|
+
The date and time that the entity was created.
|
|
53
|
+
|
|
54
|
+
***
|
|
55
|
+
|
|
56
|
+
### dateModified
|
|
57
|
+
|
|
58
|
+
> **dateModified**: `Date`
|
|
59
|
+
|
|
60
|
+
Defined in: [src/models/BaseEntity.ts:43](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/models/BaseEntity.ts#L43)
|
|
61
|
+
|
|
62
|
+
The date and time that the entity was last modified.
|
|
63
|
+
|
|
64
|
+
***
|
|
65
|
+
|
|
66
|
+
### uid
|
|
67
|
+
|
|
68
|
+
> **uid**: `string`
|
|
69
|
+
|
|
70
|
+
Defined in: [src/models/BaseEntity.ts:27](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/models/BaseEntity.ts#L27)
|
|
71
|
+
|
|
72
|
+
The universally unique identifier of the entity.
|
|
73
|
+
|
|
74
|
+
***
|
|
75
|
+
|
|
76
|
+
### version
|
|
77
|
+
|
|
78
|
+
> **version**: `number` = `0`
|
|
79
|
+
|
|
80
|
+
Defined in: [src/models/BaseEntity.ts:50](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/models/BaseEntity.ts#L50)
|
|
81
|
+
|
|
82
|
+
The optimistic lock version.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / BaseMongoEntity
|
|
6
|
+
|
|
7
|
+
# Abstract Class: BaseMongoEntity
|
|
8
|
+
|
|
9
|
+
Defined in: [src/models/BaseMongoEntity.ts:15](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/models/BaseMongoEntity.ts#L15)
|
|
10
|
+
|
|
11
|
+
Provides a common base class for all entity's that will be persisted in a MongoDB database.
|
|
12
|
+
|
|
13
|
+
## Author
|
|
14
|
+
|
|
15
|
+
Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
16
|
+
|
|
17
|
+
## Extends
|
|
18
|
+
|
|
19
|
+
- [`BaseEntity`](BaseEntity.md)
|
|
20
|
+
|
|
21
|
+
## Constructors
|
|
22
|
+
|
|
23
|
+
### Constructor
|
|
24
|
+
|
|
25
|
+
> **new BaseMongoEntity**(`other?`): `BaseMongoEntity`
|
|
26
|
+
|
|
27
|
+
Defined in: [src/models/BaseMongoEntity.ts:23](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/models/BaseMongoEntity.ts#L23)
|
|
28
|
+
|
|
29
|
+
#### Parameters
|
|
30
|
+
|
|
31
|
+
##### other?
|
|
32
|
+
|
|
33
|
+
`Partial`\<`BaseMongoEntity`\>
|
|
34
|
+
|
|
35
|
+
#### Returns
|
|
36
|
+
|
|
37
|
+
`BaseMongoEntity`
|
|
38
|
+
|
|
39
|
+
#### Overrides
|
|
40
|
+
|
|
41
|
+
[`BaseEntity`](BaseEntity.md).[`constructor`](BaseEntity.md#constructor)
|
|
42
|
+
|
|
43
|
+
## Properties
|
|
44
|
+
|
|
45
|
+
### \_id?
|
|
46
|
+
|
|
47
|
+
> `optional` **\_id?**: `any`
|
|
48
|
+
|
|
49
|
+
Defined in: [src/models/BaseMongoEntity.ts:21](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/models/BaseMongoEntity.ts#L21)
|
|
50
|
+
|
|
51
|
+
The internal unique identifier used by MongoDB.
|
|
52
|
+
|
|
53
|
+
***
|
|
54
|
+
|
|
55
|
+
### dateCreated
|
|
56
|
+
|
|
57
|
+
> **dateCreated**: `Date`
|
|
58
|
+
|
|
59
|
+
Defined in: [src/models/BaseEntity.ts:35](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/models/BaseEntity.ts#L35)
|
|
60
|
+
|
|
61
|
+
The date and time that the entity was created.
|
|
62
|
+
|
|
63
|
+
#### Inherited from
|
|
64
|
+
|
|
65
|
+
[`BaseEntity`](BaseEntity.md).[`dateCreated`](BaseEntity.md#datecreated)
|
|
66
|
+
|
|
67
|
+
***
|
|
68
|
+
|
|
69
|
+
### dateModified
|
|
70
|
+
|
|
71
|
+
> **dateModified**: `Date`
|
|
72
|
+
|
|
73
|
+
Defined in: [src/models/BaseEntity.ts:43](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/models/BaseEntity.ts#L43)
|
|
74
|
+
|
|
75
|
+
The date and time that the entity was last modified.
|
|
76
|
+
|
|
77
|
+
#### Inherited from
|
|
78
|
+
|
|
79
|
+
[`BaseEntity`](BaseEntity.md).[`dateModified`](BaseEntity.md#datemodified)
|
|
80
|
+
|
|
81
|
+
***
|
|
82
|
+
|
|
83
|
+
### uid
|
|
84
|
+
|
|
85
|
+
> **uid**: `string`
|
|
86
|
+
|
|
87
|
+
Defined in: [src/models/BaseEntity.ts:27](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/models/BaseEntity.ts#L27)
|
|
88
|
+
|
|
89
|
+
The universally unique identifier of the entity.
|
|
90
|
+
|
|
91
|
+
#### Inherited from
|
|
92
|
+
|
|
93
|
+
[`BaseEntity`](BaseEntity.md).[`uid`](BaseEntity.md#uid)
|
|
94
|
+
|
|
95
|
+
***
|
|
96
|
+
|
|
97
|
+
### version
|
|
98
|
+
|
|
99
|
+
> **version**: `number` = `0`
|
|
100
|
+
|
|
101
|
+
Defined in: [src/models/BaseEntity.ts:50](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/models/BaseEntity.ts#L50)
|
|
102
|
+
|
|
103
|
+
The optimistic lock version.
|
|
104
|
+
|
|
105
|
+
#### Inherited from
|
|
106
|
+
|
|
107
|
+
[`BaseEntity`](BaseEntity.md).[`version`](BaseEntity.md#version)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / BasicStrategy
|
|
6
|
+
|
|
7
|
+
# Class: BasicStrategy
|
|
8
|
+
|
|
9
|
+
Defined in: [src/auth/BasicStrategy.ts:36](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/BasicStrategy.ts#L36)
|
|
10
|
+
|
|
11
|
+
## Author
|
|
12
|
+
|
|
13
|
+
Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
14
|
+
|
|
15
|
+
## Implements
|
|
16
|
+
|
|
17
|
+
- [`AuthStrategy`](../interfaces/AuthStrategy.md)
|
|
18
|
+
|
|
19
|
+
## Constructors
|
|
20
|
+
|
|
21
|
+
### Constructor
|
|
22
|
+
|
|
23
|
+
> **new BasicStrategy**(`options?`): `BasicStrategy`
|
|
24
|
+
|
|
25
|
+
Defined in: [src/auth/BasicStrategy.ts:40](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/BasicStrategy.ts#L40)
|
|
26
|
+
|
|
27
|
+
#### Parameters
|
|
28
|
+
|
|
29
|
+
##### options?
|
|
30
|
+
|
|
31
|
+
[`BasicStrategyOptions`](BasicStrategyOptions.md) = `...`
|
|
32
|
+
|
|
33
|
+
#### Returns
|
|
34
|
+
|
|
35
|
+
`BasicStrategy`
|
|
36
|
+
|
|
37
|
+
## Properties
|
|
38
|
+
|
|
39
|
+
### name
|
|
40
|
+
|
|
41
|
+
> `readonly` **name**: `string` = `"basic"`
|
|
42
|
+
|
|
43
|
+
Defined in: [src/auth/BasicStrategy.ts:37](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/BasicStrategy.ts#L37)
|
|
44
|
+
|
|
45
|
+
The unique name of the strategy used to register with the `AuthMiddleware`.
|
|
46
|
+
|
|
47
|
+
#### Implementation of
|
|
48
|
+
|
|
49
|
+
[`AuthStrategy`](../interfaces/AuthStrategy.md).[`name`](../interfaces/AuthStrategy.md#name)
|
|
50
|
+
|
|
51
|
+
## Methods
|
|
52
|
+
|
|
53
|
+
### authenticate()
|
|
54
|
+
|
|
55
|
+
> **authenticate**(`req`, `res`, `required?`): [`AuthResult`](../interfaces/AuthResult.md) \| `Promise`\<[`AuthResult`](../interfaces/AuthResult.md)\> \| `undefined`
|
|
56
|
+
|
|
57
|
+
Defined in: [src/auth/BasicStrategy.ts:44](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/BasicStrategy.ts#L44)
|
|
58
|
+
|
|
59
|
+
Attempts to perform authentication with the given request data. If authentication was successful, returns an
|
|
60
|
+
`AuthResult` containing the authentication details. If authentication fails and `required` is set to `true`
|
|
61
|
+
throws an error, otherwise returns `undefined`.
|
|
62
|
+
|
|
63
|
+
#### Parameters
|
|
64
|
+
|
|
65
|
+
##### req
|
|
66
|
+
|
|
67
|
+
`HttpRequest`
|
|
68
|
+
|
|
69
|
+
The request containing data to attempt authentication with.
|
|
70
|
+
|
|
71
|
+
##### res
|
|
72
|
+
|
|
73
|
+
`HttpResponse`
|
|
74
|
+
|
|
75
|
+
The response to use when writing back directly to the client.
|
|
76
|
+
|
|
77
|
+
##### required?
|
|
78
|
+
|
|
79
|
+
`boolean`
|
|
80
|
+
|
|
81
|
+
Set to `true` to if authentication is required to pass, otherwise set to `false`.
|
|
82
|
+
|
|
83
|
+
#### Returns
|
|
84
|
+
|
|
85
|
+
[`AuthResult`](../interfaces/AuthResult.md) \| `Promise`\<[`AuthResult`](../interfaces/AuthResult.md)\> \| `undefined`
|
|
86
|
+
|
|
87
|
+
#### Implementation of
|
|
88
|
+
|
|
89
|
+
[`AuthStrategy`](../interfaces/AuthStrategy.md).[`authenticate`](../interfaces/AuthStrategy.md#authenticate)
|