@rapidrest/service-core 1.0.0-rc.2 → 1.0.0-rc.21
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/dist/lib/BackgroundService.js +0 -4
- package/dist/lib/BackgroundService.js.map +1 -1
- package/dist/lib/BackgroundServiceManager.js +21 -4
- package/dist/lib/BackgroundServiceManager.js.map +1 -1
- package/dist/lib/EventListenerManager.js.map +1 -1
- package/dist/lib/OpenApiSpec.js +3 -2
- package/dist/lib/OpenApiSpec.js.map +1 -1
- package/dist/lib/Server.js +18 -79
- package/dist/lib/Server.js.map +1 -1
- package/dist/lib/database/TypeOrmSupport.js +18 -2
- package/dist/lib/database/TypeOrmSupport.js.map +1 -1
- package/dist/lib/decorators/DocDecorators.js +19 -1
- package/dist/lib/decorators/DocDecorators.js.map +1 -1
- package/dist/lib/decorators/PersistenceDecorators.js.map +1 -1
- package/dist/lib/decorators/RouteDecorators.js +71 -20
- package/dist/lib/decorators/RouteDecorators.js.map +1 -1
- package/dist/lib/http/Adapters.js +45 -2
- package/dist/lib/http/Adapters.js.map +1 -1
- package/dist/lib/http/Router.js +53 -56
- package/dist/lib/http/Router.js.map +1 -1
- package/dist/lib/models/ModelUtils.js +18 -8
- package/dist/lib/models/ModelUtils.js.map +1 -1
- package/dist/lib/models/RepoUtils.js +96 -31
- package/dist/lib/models/RepoUtils.js.map +1 -1
- package/dist/lib/routes/{AdminRoute.js → BaseAdminRoute.js} +51 -36
- package/dist/lib/routes/BaseAdminRoute.js.map +1 -0
- package/dist/lib/routes/{MetricsRoute.js → BaseMetricsRoute.js} +28 -15
- package/dist/lib/routes/BaseMetricsRoute.js.map +1 -0
- package/dist/lib/routes/{OpenAPIRoute.js → BaseOpenAPIRoute.js} +31 -32
- package/dist/lib/routes/BaseOpenAPIRoute.js.map +1 -0
- package/dist/lib/routes/BasePushRoute.js +193 -0
- package/dist/lib/routes/BasePushRoute.js.map +1 -0
- package/dist/lib/routes/BaseStaticRoute.js +152 -0
- package/dist/lib/routes/BaseStaticRoute.js.map +1 -0
- package/dist/lib/routes/BaseStatusRoute.js +79 -0
- package/dist/lib/routes/BaseStatusRoute.js.map +1 -0
- package/dist/lib/routes/CRUDRoute.js +238 -0
- package/dist/lib/routes/CRUDRoute.js.map +1 -0
- package/dist/lib/routes/ModelRoute.js +20 -28
- package/dist/lib/routes/ModelRoute.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 +10 -13
- package/dist/lib/security/ACLUtils.js.map +1 -1
- package/dist/lib/security/AccessControlListMongo.js +5 -1
- package/dist/lib/security/AccessControlListMongo.js.map +1 -1
- package/dist/lib/security/AccessControlListSQL.js +7 -3
- 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 +6 -2
- package/dist/lib/test/request.js.map +1 -1
- package/dist/types/BackgroundService.d.ts +0 -5
- package/dist/types/BackgroundServiceManager.d.ts +1 -1
- package/dist/types/EventListenerManager.d.ts +4 -4
- package/dist/types/Server.d.ts +21 -6
- package/dist/types/decorators/DocDecorators.d.ts +9 -0
- package/dist/types/decorators/PersistenceDecorators.d.ts +7 -0
- package/dist/types/decorators/RouteDecorators.d.ts +14 -5
- package/dist/types/http/Adapters.d.ts +19 -0
- package/dist/types/http/Router.d.ts +6 -6
- package/dist/types/models/ModelUtils.d.ts +2 -1
- package/dist/types/routes/BaseAdminRoute.d.ts +59 -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 +39 -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 +47 -0
- package/dist/types/routes/ModelRoute.d.ts +23 -16
- package/dist/types/routes/index.d.ts +7 -4
- package/dist/types/security/ACLUtils.d.ts +1 -1
- package/dist/types/security/AccessControlList.d.ts +1 -1
- package/dist/types/security/AccessControlListMongo.d.ts +1 -1
- package/dist/types/security/AccessControlListSQL.d.ts +1 -1
- package/dist/types/security/BaseACLRoute.d.ts +73 -0
- package/dist/types/security/index.d.ts +3 -0
- package/package.json +132 -129
- package/tsconfig.export.json +17 -0
- 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/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 -430
- 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,343 +0,0 @@
|
|
|
1
|
-
[**@rapidrest/service-core**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rapidrest/service-core](../globals.md) / HttpRouter
|
|
6
|
-
|
|
7
|
-
# Class: HttpRouter
|
|
8
|
-
|
|
9
|
-
Defined in: [src/http/Router.ts:222](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L222)
|
|
10
|
-
|
|
11
|
-
Thin Express-compatible wrapper over `uWS.TemplatedApp`.
|
|
12
|
-
|
|
13
|
-
Provides the same `app.get()`, `app.post()`, `app.use()`, etc. API that
|
|
14
|
-
`RouteUtils.registerRoute()` uses, so no changes are needed in route registration
|
|
15
|
-
code. Global middleware registered via `use()` is prepended to every route's chain.
|
|
16
|
-
|
|
17
|
-
Also supports:
|
|
18
|
-
- `ws(path, handlers)` — native uWS WebSocket routing
|
|
19
|
-
- `static(basePath)` — basic static file serving
|
|
20
|
-
- `listen(host, port)` / `close()` — server lifecycle
|
|
21
|
-
|
|
22
|
-
## Indexable
|
|
23
|
-
|
|
24
|
-
> \[`key`: `string`\]: `any`
|
|
25
|
-
|
|
26
|
-
## Constructors
|
|
27
|
-
|
|
28
|
-
### Constructor
|
|
29
|
-
|
|
30
|
-
> **new HttpRouter**(`uwsApp`): `HttpRouter`
|
|
31
|
-
|
|
32
|
-
Defined in: [src/http/Router.ts:234](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L234)
|
|
33
|
-
|
|
34
|
-
#### Parameters
|
|
35
|
-
|
|
36
|
-
##### uwsApp
|
|
37
|
-
|
|
38
|
-
`TemplatedApp`
|
|
39
|
-
|
|
40
|
-
#### Returns
|
|
41
|
-
|
|
42
|
-
`HttpRouter`
|
|
43
|
-
|
|
44
|
-
## Properties
|
|
45
|
-
|
|
46
|
-
### listenPort
|
|
47
|
-
|
|
48
|
-
> **listenPort**: `number` = `0`
|
|
49
|
-
|
|
50
|
-
Defined in: [src/http/Router.ts:232](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L232)
|
|
51
|
-
|
|
52
|
-
The port the server is currently listening on (set after a successful `listen()` call).
|
|
53
|
-
|
|
54
|
-
## Accessors
|
|
55
|
-
|
|
56
|
-
### isListening
|
|
57
|
-
|
|
58
|
-
#### Get Signature
|
|
59
|
-
|
|
60
|
-
> **get** **isListening**(): `boolean`
|
|
61
|
-
|
|
62
|
-
Defined in: [src/http/Router.ts:239](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L239)
|
|
63
|
-
|
|
64
|
-
Returns `true` if the server is currently listening.
|
|
65
|
-
|
|
66
|
-
##### Returns
|
|
67
|
-
|
|
68
|
-
`boolean`
|
|
69
|
-
|
|
70
|
-
## Methods
|
|
71
|
-
|
|
72
|
-
### close()
|
|
73
|
-
|
|
74
|
-
> **close**(): `void`
|
|
75
|
-
|
|
76
|
-
Defined in: [src/http/Router.ts:479](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L479)
|
|
77
|
-
|
|
78
|
-
Closes the listen socket, stopping the server from accepting new connections.
|
|
79
|
-
|
|
80
|
-
#### Returns
|
|
81
|
-
|
|
82
|
-
`void`
|
|
83
|
-
|
|
84
|
-
***
|
|
85
|
-
|
|
86
|
-
### delete()
|
|
87
|
-
|
|
88
|
-
> **delete**(`routePath`, ...`handlers`): `this`
|
|
89
|
-
|
|
90
|
-
Defined in: [src/http/Router.ts:283](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L283)
|
|
91
|
-
|
|
92
|
-
#### Parameters
|
|
93
|
-
|
|
94
|
-
##### routePath
|
|
95
|
-
|
|
96
|
-
`string`
|
|
97
|
-
|
|
98
|
-
##### handlers
|
|
99
|
-
|
|
100
|
-
...[`RequestHandler`](../type-aliases/RequestHandler.md)[]
|
|
101
|
-
|
|
102
|
-
#### Returns
|
|
103
|
-
|
|
104
|
-
`this`
|
|
105
|
-
|
|
106
|
-
***
|
|
107
|
-
|
|
108
|
-
### get()
|
|
109
|
-
|
|
110
|
-
> **get**(`routePath`, ...`handlers`): `this`
|
|
111
|
-
|
|
112
|
-
Defined in: [src/http/Router.ts:265](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L265)
|
|
113
|
-
|
|
114
|
-
#### Parameters
|
|
115
|
-
|
|
116
|
-
##### routePath
|
|
117
|
-
|
|
118
|
-
`string`
|
|
119
|
-
|
|
120
|
-
##### handlers
|
|
121
|
-
|
|
122
|
-
...[`RequestHandler`](../type-aliases/RequestHandler.md)[]
|
|
123
|
-
|
|
124
|
-
#### Returns
|
|
125
|
-
|
|
126
|
-
`this`
|
|
127
|
-
|
|
128
|
-
***
|
|
129
|
-
|
|
130
|
-
### head()
|
|
131
|
-
|
|
132
|
-
> **head**(`routePath`, ...`handlers`): `this`
|
|
133
|
-
|
|
134
|
-
Defined in: [src/http/Router.ts:295](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L295)
|
|
135
|
-
|
|
136
|
-
#### Parameters
|
|
137
|
-
|
|
138
|
-
##### routePath
|
|
139
|
-
|
|
140
|
-
`string`
|
|
141
|
-
|
|
142
|
-
##### handlers
|
|
143
|
-
|
|
144
|
-
...[`RequestHandler`](../type-aliases/RequestHandler.md)[]
|
|
145
|
-
|
|
146
|
-
#### Returns
|
|
147
|
-
|
|
148
|
-
`this`
|
|
149
|
-
|
|
150
|
-
***
|
|
151
|
-
|
|
152
|
-
### listen()
|
|
153
|
-
|
|
154
|
-
> **listen**(`host`, `port`): `Promise`\<`void`\>
|
|
155
|
-
|
|
156
|
-
Defined in: [src/http/Router.ts:458](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L458)
|
|
157
|
-
|
|
158
|
-
Starts listening on the given host and port.
|
|
159
|
-
Resolves when the server is ready; rejects if the port cannot be bound.
|
|
160
|
-
|
|
161
|
-
#### Parameters
|
|
162
|
-
|
|
163
|
-
##### host
|
|
164
|
-
|
|
165
|
-
`string`
|
|
166
|
-
|
|
167
|
-
##### port
|
|
168
|
-
|
|
169
|
-
`number`
|
|
170
|
-
|
|
171
|
-
#### Returns
|
|
172
|
-
|
|
173
|
-
`Promise`\<`void`\>
|
|
174
|
-
|
|
175
|
-
***
|
|
176
|
-
|
|
177
|
-
### options()
|
|
178
|
-
|
|
179
|
-
> **options**(`routePath`, ...`handlers`): `this`
|
|
180
|
-
|
|
181
|
-
Defined in: [src/http/Router.ts:302](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L302)
|
|
182
|
-
|
|
183
|
-
#### Parameters
|
|
184
|
-
|
|
185
|
-
##### routePath
|
|
186
|
-
|
|
187
|
-
`string`
|
|
188
|
-
|
|
189
|
-
##### handlers
|
|
190
|
-
|
|
191
|
-
...[`RequestHandler`](../type-aliases/RequestHandler.md)[]
|
|
192
|
-
|
|
193
|
-
#### Returns
|
|
194
|
-
|
|
195
|
-
`this`
|
|
196
|
-
|
|
197
|
-
***
|
|
198
|
-
|
|
199
|
-
### patch()
|
|
200
|
-
|
|
201
|
-
> **patch**(`routePath`, ...`handlers`): `this`
|
|
202
|
-
|
|
203
|
-
Defined in: [src/http/Router.ts:289](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L289)
|
|
204
|
-
|
|
205
|
-
#### Parameters
|
|
206
|
-
|
|
207
|
-
##### routePath
|
|
208
|
-
|
|
209
|
-
`string`
|
|
210
|
-
|
|
211
|
-
##### handlers
|
|
212
|
-
|
|
213
|
-
...[`RequestHandler`](../type-aliases/RequestHandler.md)[]
|
|
214
|
-
|
|
215
|
-
#### Returns
|
|
216
|
-
|
|
217
|
-
`this`
|
|
218
|
-
|
|
219
|
-
***
|
|
220
|
-
|
|
221
|
-
### post()
|
|
222
|
-
|
|
223
|
-
> **post**(`routePath`, ...`handlers`): `this`
|
|
224
|
-
|
|
225
|
-
Defined in: [src/http/Router.ts:271](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L271)
|
|
226
|
-
|
|
227
|
-
#### Parameters
|
|
228
|
-
|
|
229
|
-
##### routePath
|
|
230
|
-
|
|
231
|
-
`string`
|
|
232
|
-
|
|
233
|
-
##### handlers
|
|
234
|
-
|
|
235
|
-
...[`RequestHandler`](../type-aliases/RequestHandler.md)[]
|
|
236
|
-
|
|
237
|
-
#### Returns
|
|
238
|
-
|
|
239
|
-
`this`
|
|
240
|
-
|
|
241
|
-
***
|
|
242
|
-
|
|
243
|
-
### put()
|
|
244
|
-
|
|
245
|
-
> **put**(`routePath`, ...`handlers`): `this`
|
|
246
|
-
|
|
247
|
-
Defined in: [src/http/Router.ts:277](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L277)
|
|
248
|
-
|
|
249
|
-
#### Parameters
|
|
250
|
-
|
|
251
|
-
##### routePath
|
|
252
|
-
|
|
253
|
-
`string`
|
|
254
|
-
|
|
255
|
-
##### handlers
|
|
256
|
-
|
|
257
|
-
...[`RequestHandler`](../type-aliases/RequestHandler.md)[]
|
|
258
|
-
|
|
259
|
-
#### Returns
|
|
260
|
-
|
|
261
|
-
`this`
|
|
262
|
-
|
|
263
|
-
***
|
|
264
|
-
|
|
265
|
-
### static()
|
|
266
|
-
|
|
267
|
-
> **static**(`basePath`): `this`
|
|
268
|
-
|
|
269
|
-
Defined in: [src/http/Router.ts:428](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L428)
|
|
270
|
-
|
|
271
|
-
Serves static files from a directory via a wildcard GET route.
|
|
272
|
-
Files not found on disk return 404.
|
|
273
|
-
|
|
274
|
-
#### Parameters
|
|
275
|
-
|
|
276
|
-
##### basePath
|
|
277
|
-
|
|
278
|
-
`string`
|
|
279
|
-
|
|
280
|
-
#### Returns
|
|
281
|
-
|
|
282
|
-
`this`
|
|
283
|
-
|
|
284
|
-
***
|
|
285
|
-
|
|
286
|
-
### use()
|
|
287
|
-
|
|
288
|
-
> **use**(...`handlers`): `this`
|
|
289
|
-
|
|
290
|
-
Defined in: [src/http/Router.ts:244](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L244)
|
|
291
|
-
|
|
292
|
-
Register global middleware that runs before every route handler.
|
|
293
|
-
|
|
294
|
-
#### Parameters
|
|
295
|
-
|
|
296
|
-
##### handlers
|
|
297
|
-
|
|
298
|
-
...[`RequestHandler`](../type-aliases/RequestHandler.md)[]
|
|
299
|
-
|
|
300
|
-
#### Returns
|
|
301
|
-
|
|
302
|
-
`this`
|
|
303
|
-
|
|
304
|
-
***
|
|
305
|
-
|
|
306
|
-
### ws()
|
|
307
|
-
|
|
308
|
-
> **ws**(`routePath`, `handlers`, `wsOptions?`, `upgradeAuth?`): `this`
|
|
309
|
-
|
|
310
|
-
Defined in: [src/http/Router.ts:320](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/http/Router.ts#L320)
|
|
311
|
-
|
|
312
|
-
Registers a WebSocket route. Handlers follow the same `(req, res, next)` pattern
|
|
313
|
-
as HTTP routes; they receive `req.websocket` containing the uWS WebSocket handle.
|
|
314
|
-
|
|
315
|
-
`upgradeAuth` is an optional pre-upgrade auth function. When provided it runs synchronously
|
|
316
|
-
inside the uWS `upgrade` callback before the handshake. If it returns `{ reject: true }`,
|
|
317
|
-
an HTTP 401 is sent and the upgrade is aborted. If it returns `{ user, ... }`, those
|
|
318
|
-
credentials are attached to the request so downstream middleware sees an authenticated user.
|
|
319
|
-
If it returns `{}`, auth falls through to the post-upgrade message-based LOGIN flow.
|
|
320
|
-
|
|
321
|
-
Both `path` and `path + "/"` are registered to avoid trailing-slash mismatch.
|
|
322
|
-
|
|
323
|
-
#### Parameters
|
|
324
|
-
|
|
325
|
-
##### routePath
|
|
326
|
-
|
|
327
|
-
`string`
|
|
328
|
-
|
|
329
|
-
##### handlers
|
|
330
|
-
|
|
331
|
-
[`RequestHandler`](../type-aliases/RequestHandler.md)[]
|
|
332
|
-
|
|
333
|
-
##### wsOptions?
|
|
334
|
-
|
|
335
|
-
`Partial`\<`WebSocketBehavior`\<`any`\>\>
|
|
336
|
-
|
|
337
|
-
##### upgradeAuth?
|
|
338
|
-
|
|
339
|
-
[`WsUpgradeAuth`](../type-aliases/WsUpgradeAuth.md)
|
|
340
|
-
|
|
341
|
-
#### Returns
|
|
342
|
-
|
|
343
|
-
`this`
|
|
@@ -1,100 +0,0 @@
|
|
|
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:63](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/auth/JWTStrategy.ts#L63)
|
|
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/33d3655fa6883713f33f0fe6f330eb205671fea1/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:67](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/auth/JWTStrategy.ts#L67)
|
|
49
|
-
|
|
50
|
-
## Methods
|
|
51
|
-
|
|
52
|
-
### authenticate()
|
|
53
|
-
|
|
54
|
-
> **authenticate**(`req`, `res`, `required?`): `Promise`\<[`JWTAuthResult`](../interfaces/JWTAuthResult.md) \| `undefined`\>
|
|
55
|
-
|
|
56
|
-
Defined in: [src/auth/JWTStrategy.ts:136](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/auth/JWTStrategy.ts#L136)
|
|
57
|
-
|
|
58
|
-
#### Parameters
|
|
59
|
-
|
|
60
|
-
##### req
|
|
61
|
-
|
|
62
|
-
[`HttpRequest`](../interfaces/HttpRequest.md)
|
|
63
|
-
|
|
64
|
-
##### res
|
|
65
|
-
|
|
66
|
-
[`HttpResponse`](../interfaces/HttpResponse.md)
|
|
67
|
-
|
|
68
|
-
##### required?
|
|
69
|
-
|
|
70
|
-
`boolean`
|
|
71
|
-
|
|
72
|
-
#### Returns
|
|
73
|
-
|
|
74
|
-
`Promise`\<[`JWTAuthResult`](../interfaces/JWTAuthResult.md) \| `undefined`\>
|
|
75
|
-
|
|
76
|
-
***
|
|
77
|
-
|
|
78
|
-
### authenticateSync()
|
|
79
|
-
|
|
80
|
-
> **authenticateSync**(`req`, `res`, `required?`): [`JWTAuthResult`](../interfaces/JWTAuthResult.md) \| `undefined`
|
|
81
|
-
|
|
82
|
-
Defined in: [src/auth/JWTStrategy.ts:171](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/auth/JWTStrategy.ts#L171)
|
|
83
|
-
|
|
84
|
-
#### Parameters
|
|
85
|
-
|
|
86
|
-
##### req
|
|
87
|
-
|
|
88
|
-
[`HttpRequest`](../interfaces/HttpRequest.md)
|
|
89
|
-
|
|
90
|
-
##### res
|
|
91
|
-
|
|
92
|
-
[`HttpResponse`](../interfaces/HttpResponse.md)
|
|
93
|
-
|
|
94
|
-
##### required?
|
|
95
|
-
|
|
96
|
-
`boolean`
|
|
97
|
-
|
|
98
|
-
#### Returns
|
|
99
|
-
|
|
100
|
-
[`JWTAuthResult`](../interfaces/JWTAuthResult.md) \| `undefined`
|
|
@@ -1,97 +0,0 @@
|
|
|
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:19](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/auth/JWTStrategy.ts#L19)
|
|
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:37](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/auth/JWTStrategy.ts#L37)
|
|
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:21](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/auth/JWTStrategy.ts#L21)
|
|
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:27](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/auth/JWTStrategy.ts#L27)
|
|
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:29](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/auth/JWTStrategy.ts#L29)
|
|
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:23](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/auth/JWTStrategy.ts#L23)
|
|
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:25](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/auth/JWTStrategy.ts#L25)
|
|
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:31](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/auth/JWTStrategy.ts#L31)
|
|
96
|
-
|
|
97
|
-
The name of the request query parameter to retrieve the token from when using query based authentication. Default value is `auth_token`.
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
[**@rapidrest/service-core**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rapidrest/service-core](../globals.md) / MetricsRoute
|
|
6
|
-
|
|
7
|
-
# Class: MetricsRoute
|
|
8
|
-
|
|
9
|
-
Defined in: [src/routes/MetricsRoute.ts:19](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/routes/MetricsRoute.ts#L19)
|
|
10
|
-
|
|
11
|
-
Handles all REST API requests for the endpoint `/metrics'. This route handler produces Prometheus compatible metrics
|
|
12
|
-
for use with a Prometheus based server.
|
|
13
|
-
|
|
14
|
-
Services that wish to provide metrics to be exposed via this route can register them using the global registry
|
|
15
|
-
from the provided `prom-client` dependency. See the `prom-client` documentation for more details.
|
|
16
|
-
|
|
17
|
-
## Constructors
|
|
18
|
-
|
|
19
|
-
### Constructor
|
|
20
|
-
|
|
21
|
-
> **new MetricsRoute**(): `MetricsRoute`
|
|
22
|
-
|
|
23
|
-
Defined in: [src/routes/MetricsRoute.ts:30](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/routes/MetricsRoute.ts#L30)
|
|
24
|
-
|
|
25
|
-
#### Returns
|
|
26
|
-
|
|
27
|
-
`MetricsRoute`
|