@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,91 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / BasicStrategyOptions
|
|
6
|
+
|
|
7
|
+
# Class: BasicStrategyOptions
|
|
8
|
+
|
|
9
|
+
Defined in: [src/auth/BasicStrategy.ts:14](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/BasicStrategy.ts#L14)
|
|
10
|
+
|
|
11
|
+
Describes the configuration options that can be used to initialize BasicStrategy.
|
|
12
|
+
|
|
13
|
+
## Author
|
|
14
|
+
|
|
15
|
+
Jean-Philippe Steinmetz
|
|
16
|
+
|
|
17
|
+
## Constructors
|
|
18
|
+
|
|
19
|
+
### Constructor
|
|
20
|
+
|
|
21
|
+
> **new BasicStrategyOptions**(): `BasicStrategyOptions`
|
|
22
|
+
|
|
23
|
+
#### Returns
|
|
24
|
+
|
|
25
|
+
`BasicStrategyOptions`
|
|
26
|
+
|
|
27
|
+
## Properties
|
|
28
|
+
|
|
29
|
+
### allowQueryParam
|
|
30
|
+
|
|
31
|
+
> **allowQueryParam**: `boolean` = `false`
|
|
32
|
+
|
|
33
|
+
Defined in: [src/auth/BasicStrategy.ts:26](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/BasicStrategy.ts#L26)
|
|
34
|
+
|
|
35
|
+
Set to `true` to allow credentials to be supplied via the `queryKey` URL parameter.
|
|
36
|
+
Disabled by default — query parameters appear in server logs, browser history, and
|
|
37
|
+
Referer headers, which permanently exposes credentials outside the application.
|
|
38
|
+
|
|
39
|
+
***
|
|
40
|
+
|
|
41
|
+
### headerKey
|
|
42
|
+
|
|
43
|
+
> **headerKey**: `string` = `"authorization"`
|
|
44
|
+
|
|
45
|
+
Defined in: [src/auth/BasicStrategy.ts:16](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/BasicStrategy.ts#L16)
|
|
46
|
+
|
|
47
|
+
The name of the header to look for when performing header based authentication. Default value is `Authorization`.
|
|
48
|
+
|
|
49
|
+
***
|
|
50
|
+
|
|
51
|
+
### headerScheme
|
|
52
|
+
|
|
53
|
+
> **headerScheme**: `string` = `"basic"`
|
|
54
|
+
|
|
55
|
+
Defined in: [src/auth/BasicStrategy.ts:18](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/BasicStrategy.ts#L18)
|
|
56
|
+
|
|
57
|
+
The authorization scheme type when using header based authentication. Default value is `jwt`.
|
|
58
|
+
|
|
59
|
+
***
|
|
60
|
+
|
|
61
|
+
### queryKey
|
|
62
|
+
|
|
63
|
+
> **queryKey**: `string` = `"auth_basic"`
|
|
64
|
+
|
|
65
|
+
Defined in: [src/auth/BasicStrategy.ts:20](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/BasicStrategy.ts#L20)
|
|
66
|
+
|
|
67
|
+
The name of the request query parameter to retrieve the token from when using query based authentication. Default value is `auth_basic`.
|
|
68
|
+
|
|
69
|
+
## Methods
|
|
70
|
+
|
|
71
|
+
### verify()
|
|
72
|
+
|
|
73
|
+
> **verify**(`uid`, `secret`): `JWTUser` \| `Promise`\<`JWTUser`\> \| `undefined`
|
|
74
|
+
|
|
75
|
+
Defined in: [src/auth/BasicStrategy.ts:28](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/BasicStrategy.ts#L28)
|
|
76
|
+
|
|
77
|
+
You must override this function to perform verification of the login information.
|
|
78
|
+
|
|
79
|
+
#### Parameters
|
|
80
|
+
|
|
81
|
+
##### uid
|
|
82
|
+
|
|
83
|
+
`string`
|
|
84
|
+
|
|
85
|
+
##### secret
|
|
86
|
+
|
|
87
|
+
`string`
|
|
88
|
+
|
|
89
|
+
#### Returns
|
|
90
|
+
|
|
91
|
+
`JWTUser` \| `Promise`\<`JWTUser`\> \| `undefined`
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / BulkError
|
|
6
|
+
|
|
7
|
+
# Class: BulkError
|
|
8
|
+
|
|
9
|
+
Defined in: [src/BulkError.ts:6](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/BulkError.ts#L6)
|
|
10
|
+
|
|
11
|
+
An error take that takes an array of other errors.
|
|
12
|
+
|
|
13
|
+
## Extends
|
|
14
|
+
|
|
15
|
+
- `ApiError`
|
|
16
|
+
|
|
17
|
+
## Constructors
|
|
18
|
+
|
|
19
|
+
### Constructor
|
|
20
|
+
|
|
21
|
+
> **new BulkError**(`errs`, `code`, `defaultStatus`, `message?`): `BulkError`
|
|
22
|
+
|
|
23
|
+
Defined in: [src/BulkError.ts:12](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/BulkError.ts#L12)
|
|
24
|
+
|
|
25
|
+
#### Parameters
|
|
26
|
+
|
|
27
|
+
##### errs
|
|
28
|
+
|
|
29
|
+
(`Error` \| `null`)[]
|
|
30
|
+
|
|
31
|
+
##### code
|
|
32
|
+
|
|
33
|
+
`string`
|
|
34
|
+
|
|
35
|
+
##### defaultStatus
|
|
36
|
+
|
|
37
|
+
`number`
|
|
38
|
+
|
|
39
|
+
##### message?
|
|
40
|
+
|
|
41
|
+
`string`
|
|
42
|
+
|
|
43
|
+
#### Returns
|
|
44
|
+
|
|
45
|
+
`BulkError`
|
|
46
|
+
|
|
47
|
+
#### Overrides
|
|
48
|
+
|
|
49
|
+
`ApiError.constructor`
|
|
50
|
+
|
|
51
|
+
## Properties
|
|
52
|
+
|
|
53
|
+
### code
|
|
54
|
+
|
|
55
|
+
> **code**: `string`
|
|
56
|
+
|
|
57
|
+
Defined in: node\_modules/@rapidrest/core/dist/types/ApiError.d.ts:8
|
|
58
|
+
|
|
59
|
+
The unique code of the error.
|
|
60
|
+
|
|
61
|
+
#### Inherited from
|
|
62
|
+
|
|
63
|
+
`ApiError.code`
|
|
64
|
+
|
|
65
|
+
***
|
|
66
|
+
|
|
67
|
+
### errors
|
|
68
|
+
|
|
69
|
+
> `readonly` **errors**: (`Error` \| `null`)[] = `[]`
|
|
70
|
+
|
|
71
|
+
Defined in: [src/BulkError.ts:10](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/BulkError.ts#L10)
|
|
72
|
+
|
|
73
|
+
The list of errors that have been thrown.
|
|
74
|
+
|
|
75
|
+
***
|
|
76
|
+
|
|
77
|
+
### message
|
|
78
|
+
|
|
79
|
+
> **message**: `string`
|
|
80
|
+
|
|
81
|
+
Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1075
|
|
82
|
+
|
|
83
|
+
#### Inherited from
|
|
84
|
+
|
|
85
|
+
`ApiError.message`
|
|
86
|
+
|
|
87
|
+
***
|
|
88
|
+
|
|
89
|
+
### name
|
|
90
|
+
|
|
91
|
+
> **name**: `string`
|
|
92
|
+
|
|
93
|
+
Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1074
|
|
94
|
+
|
|
95
|
+
#### Inherited from
|
|
96
|
+
|
|
97
|
+
`ApiError.name`
|
|
98
|
+
|
|
99
|
+
***
|
|
100
|
+
|
|
101
|
+
### stack?
|
|
102
|
+
|
|
103
|
+
> `optional` **stack?**: `string`
|
|
104
|
+
|
|
105
|
+
Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1076
|
|
106
|
+
|
|
107
|
+
#### Inherited from
|
|
108
|
+
|
|
109
|
+
`ApiError.stack`
|
|
110
|
+
|
|
111
|
+
***
|
|
112
|
+
|
|
113
|
+
### status
|
|
114
|
+
|
|
115
|
+
> **status**: `number`
|
|
116
|
+
|
|
117
|
+
Defined in: node\_modules/@rapidrest/core/dist/types/ApiError.d.ts:10
|
|
118
|
+
|
|
119
|
+
The HTTP status associated with the error.
|
|
120
|
+
|
|
121
|
+
#### Inherited from
|
|
122
|
+
|
|
123
|
+
`ApiError.status`
|
|
124
|
+
|
|
125
|
+
***
|
|
126
|
+
|
|
127
|
+
### stackTraceLimit
|
|
128
|
+
|
|
129
|
+
> `static` **stackTraceLimit**: `number`
|
|
130
|
+
|
|
131
|
+
Defined in: node\_modules/@types/node/globals.d.ts:67
|
|
132
|
+
|
|
133
|
+
The `Error.stackTraceLimit` property specifies the number of stack frames
|
|
134
|
+
collected by a stack trace (whether generated by `new Error().stack` or
|
|
135
|
+
`Error.captureStackTrace(obj)`).
|
|
136
|
+
|
|
137
|
+
The default value is `10` but may be set to any valid JavaScript number. Changes
|
|
138
|
+
will affect any stack trace captured _after_ the value has been changed.
|
|
139
|
+
|
|
140
|
+
If set to a non-number value, or set to a negative number, stack traces will
|
|
141
|
+
not capture any frames.
|
|
142
|
+
|
|
143
|
+
#### Inherited from
|
|
144
|
+
|
|
145
|
+
`ApiError.stackTraceLimit`
|
|
146
|
+
|
|
147
|
+
## Methods
|
|
148
|
+
|
|
149
|
+
### ApiMessageTemplate()
|
|
150
|
+
|
|
151
|
+
> **ApiMessageTemplate**(`message`, `templateVariables?`): `string`
|
|
152
|
+
|
|
153
|
+
Defined in: node\_modules/@rapidrest/core/dist/types/ApiError.d.ts:11
|
|
154
|
+
|
|
155
|
+
#### Parameters
|
|
156
|
+
|
|
157
|
+
##### message
|
|
158
|
+
|
|
159
|
+
`string` \| `undefined`
|
|
160
|
+
|
|
161
|
+
##### templateVariables?
|
|
162
|
+
|
|
163
|
+
`any`
|
|
164
|
+
|
|
165
|
+
#### Returns
|
|
166
|
+
|
|
167
|
+
`string`
|
|
168
|
+
|
|
169
|
+
#### Inherited from
|
|
170
|
+
|
|
171
|
+
`ApiError.ApiMessageTemplate`
|
|
172
|
+
|
|
173
|
+
***
|
|
174
|
+
|
|
175
|
+
### captureStackTrace()
|
|
176
|
+
|
|
177
|
+
> `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
|
|
178
|
+
|
|
179
|
+
Defined in: node\_modules/@types/node/globals.d.ts:51
|
|
180
|
+
|
|
181
|
+
Creates a `.stack` property on `targetObject`, which when accessed returns
|
|
182
|
+
a string representing the location in the code at which
|
|
183
|
+
`Error.captureStackTrace()` was called.
|
|
184
|
+
|
|
185
|
+
```js
|
|
186
|
+
const myObject = {};
|
|
187
|
+
Error.captureStackTrace(myObject);
|
|
188
|
+
myObject.stack; // Similar to `new Error().stack`
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
The first line of the trace will be prefixed with
|
|
192
|
+
`${myObject.name}: ${myObject.message}`.
|
|
193
|
+
|
|
194
|
+
The optional `constructorOpt` argument accepts a function. If given, all frames
|
|
195
|
+
above `constructorOpt`, including `constructorOpt`, will be omitted from the
|
|
196
|
+
generated stack trace.
|
|
197
|
+
|
|
198
|
+
The `constructorOpt` argument is useful for hiding implementation
|
|
199
|
+
details of error generation from the user. For instance:
|
|
200
|
+
|
|
201
|
+
```js
|
|
202
|
+
function a() {
|
|
203
|
+
b();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function b() {
|
|
207
|
+
c();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function c() {
|
|
211
|
+
// Create an error without stack trace to avoid calculating the stack trace twice.
|
|
212
|
+
const { stackTraceLimit } = Error;
|
|
213
|
+
Error.stackTraceLimit = 0;
|
|
214
|
+
const error = new Error();
|
|
215
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
216
|
+
|
|
217
|
+
// Capture the stack trace above function b
|
|
218
|
+
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
|
|
219
|
+
throw error;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
a();
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### Parameters
|
|
226
|
+
|
|
227
|
+
##### targetObject
|
|
228
|
+
|
|
229
|
+
`object`
|
|
230
|
+
|
|
231
|
+
##### constructorOpt?
|
|
232
|
+
|
|
233
|
+
`Function`
|
|
234
|
+
|
|
235
|
+
#### Returns
|
|
236
|
+
|
|
237
|
+
`void`
|
|
238
|
+
|
|
239
|
+
#### Inherited from
|
|
240
|
+
|
|
241
|
+
`ApiError.captureStackTrace`
|
|
242
|
+
|
|
243
|
+
***
|
|
244
|
+
|
|
245
|
+
### prepareStackTrace()
|
|
246
|
+
|
|
247
|
+
> `static` **prepareStackTrace**(`err`, `stackTraces`): `any`
|
|
248
|
+
|
|
249
|
+
Defined in: node\_modules/@types/node/globals.d.ts:55
|
|
250
|
+
|
|
251
|
+
#### Parameters
|
|
252
|
+
|
|
253
|
+
##### err
|
|
254
|
+
|
|
255
|
+
`Error`
|
|
256
|
+
|
|
257
|
+
##### stackTraces
|
|
258
|
+
|
|
259
|
+
`CallSite`[]
|
|
260
|
+
|
|
261
|
+
#### Returns
|
|
262
|
+
|
|
263
|
+
`any`
|
|
264
|
+
|
|
265
|
+
#### See
|
|
266
|
+
|
|
267
|
+
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
268
|
+
|
|
269
|
+
#### Inherited from
|
|
270
|
+
|
|
271
|
+
`ApiError.prepareStackTrace`
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / ConnectionManager
|
|
6
|
+
|
|
7
|
+
# Class: ConnectionManager
|
|
8
|
+
|
|
9
|
+
Defined in: [src/database/ConnectionManager.ts:17](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/ConnectionManager.ts#L17)
|
|
10
|
+
|
|
11
|
+
Provides database connection management.
|
|
12
|
+
|
|
13
|
+
## Author
|
|
14
|
+
|
|
15
|
+
Jean-Philippe Steinmetz
|
|
16
|
+
|
|
17
|
+
## Constructors
|
|
18
|
+
|
|
19
|
+
### Constructor
|
|
20
|
+
|
|
21
|
+
> **new ConnectionManager**(): `ConnectionManager`
|
|
22
|
+
|
|
23
|
+
#### Returns
|
|
24
|
+
|
|
25
|
+
`ConnectionManager`
|
|
26
|
+
|
|
27
|
+
## Properties
|
|
28
|
+
|
|
29
|
+
### connections
|
|
30
|
+
|
|
31
|
+
> **connections**: `Map`\<`string`, `Redis` \| `DataSource` \| [`MongoConnection`](MongoConnection.md)\>
|
|
32
|
+
|
|
33
|
+
Defined in: [src/database/ConnectionManager.ts:18](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/ConnectionManager.ts#L18)
|
|
34
|
+
|
|
35
|
+
## Methods
|
|
36
|
+
|
|
37
|
+
### connect()
|
|
38
|
+
|
|
39
|
+
> **connect**(`datastores`, `models`): `Promise`\<`void`\>
|
|
40
|
+
|
|
41
|
+
Defined in: [src/database/ConnectionManager.ts:60](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/ConnectionManager.ts#L60)
|
|
42
|
+
|
|
43
|
+
Attempts to initiate all database connections as defined in the config.
|
|
44
|
+
|
|
45
|
+
#### Parameters
|
|
46
|
+
|
|
47
|
+
##### datastores
|
|
48
|
+
|
|
49
|
+
`any`
|
|
50
|
+
|
|
51
|
+
A map of configured datastores to be passed to the underlying engine.
|
|
52
|
+
|
|
53
|
+
##### models
|
|
54
|
+
|
|
55
|
+
`Map`\<`string`, `any`\>
|
|
56
|
+
|
|
57
|
+
A map of model names and associated class definitions to establish database connections for.
|
|
58
|
+
|
|
59
|
+
#### Returns
|
|
60
|
+
|
|
61
|
+
`Promise`\<`void`\>
|
|
62
|
+
|
|
63
|
+
***
|
|
64
|
+
|
|
65
|
+
### disconnect()
|
|
66
|
+
|
|
67
|
+
> **disconnect**(): `Promise`\<`void`\>
|
|
68
|
+
|
|
69
|
+
Defined in: [src/database/ConnectionManager.ts:136](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/ConnectionManager.ts#L136)
|
|
70
|
+
|
|
71
|
+
Attempts to disconnect all active database connections.
|
|
72
|
+
|
|
73
|
+
#### Returns
|
|
74
|
+
|
|
75
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / EventListenerManager
|
|
6
|
+
|
|
7
|
+
# Class: EventListenerManager
|
|
8
|
+
|
|
9
|
+
Defined in: [src/EventListenerManager.ts:18](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/EventListenerManager.ts#L18)
|
|
10
|
+
|
|
11
|
+
The `EventListenerManager` is responsible for managing event handlers and processing of incoming
|
|
12
|
+
events from the configured redis pubsub channels. An event handler is any function that has been
|
|
13
|
+
decorated with the `@OnEvent` decorator and registered with this manager. Once registered, any event
|
|
14
|
+
that is received corresponding to the list of types specified in the decorator arguments will be
|
|
15
|
+
sent to the designated function(s). If no type is specified, the handler function will be called
|
|
16
|
+
for any event that is received.
|
|
17
|
+
|
|
18
|
+
## Author
|
|
19
|
+
|
|
20
|
+
Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
21
|
+
|
|
22
|
+
## Constructors
|
|
23
|
+
|
|
24
|
+
### Constructor
|
|
25
|
+
|
|
26
|
+
> **new EventListenerManager**(`objectFactory`, `redis`): `EventListenerManager`
|
|
27
|
+
|
|
28
|
+
Defined in: [src/EventListenerManager.ts:27](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/EventListenerManager.ts#L27)
|
|
29
|
+
|
|
30
|
+
#### Parameters
|
|
31
|
+
|
|
32
|
+
##### objectFactory
|
|
33
|
+
|
|
34
|
+
[`ObjectFactory`](ObjectFactory.md)
|
|
35
|
+
|
|
36
|
+
##### redis
|
|
37
|
+
|
|
38
|
+
`Redis`
|
|
39
|
+
|
|
40
|
+
#### Returns
|
|
41
|
+
|
|
42
|
+
`EventListenerManager`
|
|
43
|
+
|
|
44
|
+
## Methods
|
|
45
|
+
|
|
46
|
+
### destroy()
|
|
47
|
+
|
|
48
|
+
> **destroy**(): `Promise`\<`void`\>
|
|
49
|
+
|
|
50
|
+
Defined in: [src/EventListenerManager.ts:77](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/EventListenerManager.ts#L77)
|
|
51
|
+
|
|
52
|
+
#### Returns
|
|
53
|
+
|
|
54
|
+
`Promise`\<`void`\>
|
|
55
|
+
|
|
56
|
+
***
|
|
57
|
+
|
|
58
|
+
### init()
|
|
59
|
+
|
|
60
|
+
> **init**(): `Promise`\<`void`\>
|
|
61
|
+
|
|
62
|
+
Defined in: [src/EventListenerManager.ts:33](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/EventListenerManager.ts#L33)
|
|
63
|
+
|
|
64
|
+
#### Returns
|
|
65
|
+
|
|
66
|
+
`Promise`\<`void`\>
|
|
67
|
+
|
|
68
|
+
***
|
|
69
|
+
|
|
70
|
+
### register()
|
|
71
|
+
|
|
72
|
+
> **register**(`obj`): `void`
|
|
73
|
+
|
|
74
|
+
Defined in: [src/EventListenerManager.ts:128](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/EventListenerManager.ts#L128)
|
|
75
|
+
|
|
76
|
+
Registers the given object to be notified of events that arrive.
|
|
77
|
+
|
|
78
|
+
#### Parameters
|
|
79
|
+
|
|
80
|
+
##### obj
|
|
81
|
+
|
|
82
|
+
`any`
|
|
83
|
+
|
|
84
|
+
The object to register for event handling.
|
|
85
|
+
|
|
86
|
+
#### Returns
|
|
87
|
+
|
|
88
|
+
`void`
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / JWTStrategy
|
|
6
|
+
|
|
7
|
+
# Class: JWTStrategy
|
|
8
|
+
|
|
9
|
+
Defined in: [src/auth/JWTStrategy.ts:64](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/JWTStrategy.ts#L64)
|
|
10
|
+
|
|
11
|
+
JWT authentication strategy. Performs JWT verification and searches for a token by one of the
|
|
12
|
+
following methods (in order of precedence):
|
|
13
|
+
* Query Parameter
|
|
14
|
+
* Authorization Header
|
|
15
|
+
* Cookie
|
|
16
|
+
|
|
17
|
+
This class no longer extends `passport-strategy`; it is used directly by route middleware
|
|
18
|
+
and returns a plain result object instead of calling Passport callbacks.
|
|
19
|
+
|
|
20
|
+
## Author
|
|
21
|
+
|
|
22
|
+
Jean-Philippe Steinmetz
|
|
23
|
+
|
|
24
|
+
## Constructors
|
|
25
|
+
|
|
26
|
+
### Constructor
|
|
27
|
+
|
|
28
|
+
> **new JWTStrategy**(`options?`): `JWTStrategy`
|
|
29
|
+
|
|
30
|
+
Defined in: [src/auth/JWTStrategy.ts:72](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/JWTStrategy.ts#L72)
|
|
31
|
+
|
|
32
|
+
#### Parameters
|
|
33
|
+
|
|
34
|
+
##### options?
|
|
35
|
+
|
|
36
|
+
[`JWTStrategyOptions`](JWTStrategyOptions.md) = `...`
|
|
37
|
+
|
|
38
|
+
#### Returns
|
|
39
|
+
|
|
40
|
+
`JWTStrategy`
|
|
41
|
+
|
|
42
|
+
## Properties
|
|
43
|
+
|
|
44
|
+
### name
|
|
45
|
+
|
|
46
|
+
> `readonly` **name**: `string` = `"jwt"`
|
|
47
|
+
|
|
48
|
+
Defined in: [src/auth/JWTStrategy.ts:68](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/JWTStrategy.ts#L68)
|
|
49
|
+
|
|
50
|
+
## Methods
|
|
51
|
+
|
|
52
|
+
### authenticate()
|
|
53
|
+
|
|
54
|
+
> **authenticate**(`req`, `res`, `required?`): [`JWTAuthResult`](../interfaces/JWTAuthResult.md) \| `undefined`
|
|
55
|
+
|
|
56
|
+
Defined in: [src/auth/JWTStrategy.ts:81](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/JWTStrategy.ts#L81)
|
|
57
|
+
|
|
58
|
+
Attempts to authenticate the incoming request by extracting and verifying a JWT token.
|
|
59
|
+
Returns a `JWTAuthResult` describing the outcome.
|
|
60
|
+
|
|
61
|
+
#### Parameters
|
|
62
|
+
|
|
63
|
+
##### req
|
|
64
|
+
|
|
65
|
+
`HttpRequest`
|
|
66
|
+
|
|
67
|
+
##### res
|
|
68
|
+
|
|
69
|
+
`HttpResponse`
|
|
70
|
+
|
|
71
|
+
##### required?
|
|
72
|
+
|
|
73
|
+
`boolean`
|
|
74
|
+
|
|
75
|
+
#### Returns
|
|
76
|
+
|
|
77
|
+
[`JWTAuthResult`](../interfaces/JWTAuthResult.md) \| `undefined`
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / JWTStrategyOptions
|
|
6
|
+
|
|
7
|
+
# Class: JWTStrategyOptions
|
|
8
|
+
|
|
9
|
+
Defined in: [src/auth/JWTStrategy.ts:20](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/JWTStrategy.ts#L20)
|
|
10
|
+
|
|
11
|
+
Describes the configuration options that can be used to initialize JWTStrategy.
|
|
12
|
+
|
|
13
|
+
## Author
|
|
14
|
+
|
|
15
|
+
Jean-Philippe Steinmetz
|
|
16
|
+
|
|
17
|
+
## Constructors
|
|
18
|
+
|
|
19
|
+
### Constructor
|
|
20
|
+
|
|
21
|
+
> **new JWTStrategyOptions**(): `JWTStrategyOptions`
|
|
22
|
+
|
|
23
|
+
#### Returns
|
|
24
|
+
|
|
25
|
+
`JWTStrategyOptions`
|
|
26
|
+
|
|
27
|
+
## Properties
|
|
28
|
+
|
|
29
|
+
### allowQueryParam
|
|
30
|
+
|
|
31
|
+
> **allowQueryParam**: `boolean` = `false`
|
|
32
|
+
|
|
33
|
+
Defined in: [src/auth/JWTStrategy.ts:38](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/JWTStrategy.ts#L38)
|
|
34
|
+
|
|
35
|
+
Set to `true` to allow tokens to be supplied via the `queryKey` URL parameter.
|
|
36
|
+
Disabled by default — query parameters appear in server logs, browser history, and
|
|
37
|
+
Referer headers, which permanently exposes tokens outside the application.
|
|
38
|
+
|
|
39
|
+
***
|
|
40
|
+
|
|
41
|
+
### config?
|
|
42
|
+
|
|
43
|
+
> `optional` **config?**: `JWTUtilsConfig`
|
|
44
|
+
|
|
45
|
+
Defined in: [src/auth/JWTStrategy.ts:22](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/JWTStrategy.ts#L22)
|
|
46
|
+
|
|
47
|
+
The configuration options to pass to the JWTUtils library during token verification.
|
|
48
|
+
|
|
49
|
+
***
|
|
50
|
+
|
|
51
|
+
### cookieName
|
|
52
|
+
|
|
53
|
+
> **cookieName**: `string` = `"jwt"`
|
|
54
|
+
|
|
55
|
+
Defined in: [src/auth/JWTStrategy.ts:28](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/JWTStrategy.ts#L28)
|
|
56
|
+
|
|
57
|
+
The name of the cookie to retrieve the token from when using cookie based authentication. Default value is `jwt`.
|
|
58
|
+
|
|
59
|
+
***
|
|
60
|
+
|
|
61
|
+
### cookieSecure
|
|
62
|
+
|
|
63
|
+
> **cookieSecure**: `boolean` = `false`
|
|
64
|
+
|
|
65
|
+
Defined in: [src/auth/JWTStrategy.ts:30](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/JWTStrategy.ts#L30)
|
|
66
|
+
|
|
67
|
+
The name of the secured cookie to retreive the token from when using cookie based authentication.
|
|
68
|
+
|
|
69
|
+
***
|
|
70
|
+
|
|
71
|
+
### headerKey
|
|
72
|
+
|
|
73
|
+
> **headerKey**: `string` = `"authorization"`
|
|
74
|
+
|
|
75
|
+
Defined in: [src/auth/JWTStrategy.ts:24](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/JWTStrategy.ts#L24)
|
|
76
|
+
|
|
77
|
+
The name of the header to look for when performing header based authentication. Default value is `Authorization`.
|
|
78
|
+
|
|
79
|
+
***
|
|
80
|
+
|
|
81
|
+
### headerScheme
|
|
82
|
+
|
|
83
|
+
> **headerScheme**: `string` = "(jwt\|bearer)"
|
|
84
|
+
|
|
85
|
+
Defined in: [src/auth/JWTStrategy.ts:26](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/JWTStrategy.ts#L26)
|
|
86
|
+
|
|
87
|
+
The authorization scheme type when using header based authentication. Default value is `jwt`.
|
|
88
|
+
|
|
89
|
+
***
|
|
90
|
+
|
|
91
|
+
### queryKey
|
|
92
|
+
|
|
93
|
+
> **queryKey**: `string` = `"auth_token"`
|
|
94
|
+
|
|
95
|
+
Defined in: [src/auth/JWTStrategy.ts:32](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/auth/JWTStrategy.ts#L32)
|
|
96
|
+
|
|
97
|
+
The name of the request query parameter to retrieve the token from when using query based authentication. Default value is `auth_token`.
|