@twin.org/api-models 0.0.1-next.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 +201 -0
- package/README.md +21 -0
- package/dist/cjs/index.cjs +90 -0
- package/dist/esm/index.mjs +87 -0
- package/dist/types/helpers/httpErrorHelper.d.ts +25 -0
- package/dist/types/index.d.ts +39 -0
- package/dist/types/models/api/IServerHealthResponse.d.ts +10 -0
- package/dist/types/models/api/IServerInfoResponse.d.ts +10 -0
- package/dist/types/models/api/IServerSpecResponse.d.ts +14 -0
- package/dist/types/models/config/IBaseRestClientConfig.d.ts +26 -0
- package/dist/types/models/config/IBaseSocketClientConfig.d.ts +18 -0
- package/dist/types/models/protocol/IHttpRequest.d.ts +24 -0
- package/dist/types/models/protocol/IHttpRequestContext.d.ts +17 -0
- package/dist/types/models/protocol/IHttpRequestIdentity.d.ts +13 -0
- package/dist/types/models/protocol/IHttpRequestPathParams.d.ts +6 -0
- package/dist/types/models/protocol/IHttpRequestQuery.d.ts +6 -0
- package/dist/types/models/protocol/IHttpResponse.d.ts +18 -0
- package/dist/types/models/protocol/IHttpServerRequest.d.ts +15 -0
- package/dist/types/models/requests/INoContentRequest.d.ts +22 -0
- package/dist/types/models/responses/errors/IBadRequestResponse.d.ts +15 -0
- package/dist/types/models/responses/errors/IConflictResponse.d.ts +20 -0
- package/dist/types/models/responses/errors/IForbiddenResponse.d.ts +15 -0
- package/dist/types/models/responses/errors/IInternalServerErrorResponse.d.ts +15 -0
- package/dist/types/models/responses/errors/INotFoundResponse.d.ts +20 -0
- package/dist/types/models/responses/errors/IUnauthorizedResponse.d.ts +15 -0
- package/dist/types/models/responses/errors/IUnprocessableEntityResponse.d.ts +15 -0
- package/dist/types/models/responses/success/IAcceptedResponse.d.ts +19 -0
- package/dist/types/models/responses/success/ICreatedResponse.d.ts +19 -0
- package/dist/types/models/responses/success/INoContentResponse.d.ts +10 -0
- package/dist/types/models/responses/success/IOkResponse.d.ts +10 -0
- package/dist/types/models/routes/IBaseRoute.d.ts +17 -0
- package/dist/types/models/routes/IRestRoute.d.ts +81 -0
- package/dist/types/models/routes/IRestRouteEntryPoint.d.ts +23 -0
- package/dist/types/models/routes/IRestRouteResponseAttachmentOptions.d.ts +17 -0
- package/dist/types/models/routes/IRestRouteResponseOptions.d.ts +10 -0
- package/dist/types/models/routes/ISocketRoute.d.ts +27 -0
- package/dist/types/models/routes/ITag.d.ts +13 -0
- package/dist/types/models/server/IHttpRestRouteProcessor.d.ts +46 -0
- package/dist/types/models/server/IWebServer.d.ts +31 -0
- package/dist/types/models/server/IWebServerOptions.d.ts +34 -0
- package/dist/types/models/services/IHealthInfo.d.ts +27 -0
- package/dist/types/models/services/IInformationComponent.d.ts +38 -0
- package/dist/types/models/services/IServerInfo.d.ts +13 -0
- package/dist/types/models/services/healthStatus.d.ts +21 -0
- package/docs/changelog.md +5 -0
- package/docs/examples.md +1 -0
- package/docs/reference/classes/HttpErrorHelper.md +71 -0
- package/docs/reference/index.md +53 -0
- package/docs/reference/interfaces/IAcceptedResponse.md +25 -0
- package/docs/reference/interfaces/IBadRequestResponse.md +19 -0
- package/docs/reference/interfaces/IBaseRestClientConfig.md +43 -0
- package/docs/reference/interfaces/IBaseRoute.md +32 -0
- package/docs/reference/interfaces/IBaseSocketClientConfig.md +27 -0
- package/docs/reference/interfaces/IConflictResponse.md +27 -0
- package/docs/reference/interfaces/ICreatedResponse.md +25 -0
- package/docs/reference/interfaces/IForbiddenResponse.md +19 -0
- package/docs/reference/interfaces/IHealthInfo.md +19 -0
- package/docs/reference/interfaces/IHttpRequest.md +44 -0
- package/docs/reference/interfaces/IHttpRequestContext.md +51 -0
- package/docs/reference/interfaces/IHttpRequestIdentity.md +23 -0
- package/docs/reference/interfaces/IHttpRequestPathParams.md +7 -0
- package/docs/reference/interfaces/IHttpRequestQuery.md +7 -0
- package/docs/reference/interfaces/IHttpResponse.md +31 -0
- package/docs/reference/interfaces/IHttpRestRouteProcessor.md +115 -0
- package/docs/reference/interfaces/IHttpServerRequest.md +75 -0
- package/docs/reference/interfaces/IInformationComponent.md +97 -0
- package/docs/reference/interfaces/IInternalServerErrorResponse.md +19 -0
- package/docs/reference/interfaces/INoContentRequest.md +55 -0
- package/docs/reference/interfaces/INoContentResponse.md +11 -0
- package/docs/reference/interfaces/INotFoundResponse.md +27 -0
- package/docs/reference/interfaces/IOkResponse.md +11 -0
- package/docs/reference/interfaces/IRestRoute.md +137 -0
- package/docs/reference/interfaces/IRestRouteEntryPoint.md +45 -0
- package/docs/reference/interfaces/IRestRouteResponseAttachmentOptions.md +27 -0
- package/docs/reference/interfaces/IRestRouteResponseOptions.md +11 -0
- package/docs/reference/interfaces/IServerHealthResponse.md +11 -0
- package/docs/reference/interfaces/IServerInfo.md +19 -0
- package/docs/reference/interfaces/IServerInfoResponse.md +11 -0
- package/docs/reference/interfaces/IServerSpecResponse.md +19 -0
- package/docs/reference/interfaces/ISocketRoute.md +73 -0
- package/docs/reference/interfaces/ITag.md +19 -0
- package/docs/reference/interfaces/IUnauthorizedResponse.md +19 -0
- package/docs/reference/interfaces/IUnprocessableEntityResponse.md +19 -0
- package/docs/reference/interfaces/IWebServer.md +77 -0
- package/docs/reference/interfaces/IWebServerOptions.md +75 -0
- package/docs/reference/type-aliases/HealthStatus.md +5 -0
- package/docs/reference/variables/HealthStatus.md +25 -0
- package/locales/en.json +9 -0
- package/package.json +65 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Class: HttpErrorHelper
|
|
2
|
+
|
|
3
|
+
Class to help with processing http errors.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### new HttpErrorHelper()
|
|
8
|
+
|
|
9
|
+
> **new HttpErrorHelper**(): [`HttpErrorHelper`](HttpErrorHelper.md)
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
[`HttpErrorHelper`](HttpErrorHelper.md)
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### processError()
|
|
18
|
+
|
|
19
|
+
> `static` **processError**(`err`, `includeStack`?): `object`
|
|
20
|
+
|
|
21
|
+
Process the errors from the routes.
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
• **err**: `unknown`
|
|
26
|
+
|
|
27
|
+
The error to process.
|
|
28
|
+
|
|
29
|
+
• **includeStack?**: `boolean`
|
|
30
|
+
|
|
31
|
+
Should the stack be included in the error.
|
|
32
|
+
|
|
33
|
+
#### Returns
|
|
34
|
+
|
|
35
|
+
`object`
|
|
36
|
+
|
|
37
|
+
The status code and additional error data.
|
|
38
|
+
|
|
39
|
+
##### error
|
|
40
|
+
|
|
41
|
+
> **error**: `IError`
|
|
42
|
+
|
|
43
|
+
##### httpStatusCode
|
|
44
|
+
|
|
45
|
+
> **httpStatusCode**: `HttpStatusCode`
|
|
46
|
+
|
|
47
|
+
***
|
|
48
|
+
|
|
49
|
+
### buildResponse()
|
|
50
|
+
|
|
51
|
+
> `static` **buildResponse**(`response`, `error`, `statusCode`): `void`
|
|
52
|
+
|
|
53
|
+
Build an error response.
|
|
54
|
+
|
|
55
|
+
#### Parameters
|
|
56
|
+
|
|
57
|
+
• **response**: [`IHttpResponse`](../interfaces/IHttpResponse.md)\<`any`\>
|
|
58
|
+
|
|
59
|
+
The response to build the error into.
|
|
60
|
+
|
|
61
|
+
• **error**: `IError`
|
|
62
|
+
|
|
63
|
+
The error to build the response for.
|
|
64
|
+
|
|
65
|
+
• **statusCode**: `HttpStatusCode`
|
|
66
|
+
|
|
67
|
+
The status code to use for the error.
|
|
68
|
+
|
|
69
|
+
#### Returns
|
|
70
|
+
|
|
71
|
+
`void`
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @twin.org/api-models
|
|
2
|
+
|
|
3
|
+
## Classes
|
|
4
|
+
|
|
5
|
+
- [HttpErrorHelper](classes/HttpErrorHelper.md)
|
|
6
|
+
|
|
7
|
+
## Interfaces
|
|
8
|
+
|
|
9
|
+
- [IServerHealthResponse](interfaces/IServerHealthResponse.md)
|
|
10
|
+
- [IServerInfoResponse](interfaces/IServerInfoResponse.md)
|
|
11
|
+
- [IServerSpecResponse](interfaces/IServerSpecResponse.md)
|
|
12
|
+
- [IBaseRestClientConfig](interfaces/IBaseRestClientConfig.md)
|
|
13
|
+
- [IBaseSocketClientConfig](interfaces/IBaseSocketClientConfig.md)
|
|
14
|
+
- [IHttpRequest](interfaces/IHttpRequest.md)
|
|
15
|
+
- [IHttpRequestContext](interfaces/IHttpRequestContext.md)
|
|
16
|
+
- [IHttpRequestIdentity](interfaces/IHttpRequestIdentity.md)
|
|
17
|
+
- [IHttpRequestPathParams](interfaces/IHttpRequestPathParams.md)
|
|
18
|
+
- [IHttpRequestQuery](interfaces/IHttpRequestQuery.md)
|
|
19
|
+
- [IHttpResponse](interfaces/IHttpResponse.md)
|
|
20
|
+
- [IHttpServerRequest](interfaces/IHttpServerRequest.md)
|
|
21
|
+
- [INoContentRequest](interfaces/INoContentRequest.md)
|
|
22
|
+
- [IBadRequestResponse](interfaces/IBadRequestResponse.md)
|
|
23
|
+
- [IConflictResponse](interfaces/IConflictResponse.md)
|
|
24
|
+
- [IForbiddenResponse](interfaces/IForbiddenResponse.md)
|
|
25
|
+
- [IInternalServerErrorResponse](interfaces/IInternalServerErrorResponse.md)
|
|
26
|
+
- [INotFoundResponse](interfaces/INotFoundResponse.md)
|
|
27
|
+
- [IUnauthorizedResponse](interfaces/IUnauthorizedResponse.md)
|
|
28
|
+
- [IUnprocessableEntityResponse](interfaces/IUnprocessableEntityResponse.md)
|
|
29
|
+
- [IAcceptedResponse](interfaces/IAcceptedResponse.md)
|
|
30
|
+
- [ICreatedResponse](interfaces/ICreatedResponse.md)
|
|
31
|
+
- [INoContentResponse](interfaces/INoContentResponse.md)
|
|
32
|
+
- [IOkResponse](interfaces/IOkResponse.md)
|
|
33
|
+
- [IBaseRoute](interfaces/IBaseRoute.md)
|
|
34
|
+
- [IRestRoute](interfaces/IRestRoute.md)
|
|
35
|
+
- [IRestRouteEntryPoint](interfaces/IRestRouteEntryPoint.md)
|
|
36
|
+
- [IRestRouteResponseAttachmentOptions](interfaces/IRestRouteResponseAttachmentOptions.md)
|
|
37
|
+
- [IRestRouteResponseOptions](interfaces/IRestRouteResponseOptions.md)
|
|
38
|
+
- [ISocketRoute](interfaces/ISocketRoute.md)
|
|
39
|
+
- [ITag](interfaces/ITag.md)
|
|
40
|
+
- [IHttpRestRouteProcessor](interfaces/IHttpRestRouteProcessor.md)
|
|
41
|
+
- [IWebServer](interfaces/IWebServer.md)
|
|
42
|
+
- [IWebServerOptions](interfaces/IWebServerOptions.md)
|
|
43
|
+
- [IHealthInfo](interfaces/IHealthInfo.md)
|
|
44
|
+
- [IInformationComponent](interfaces/IInformationComponent.md)
|
|
45
|
+
- [IServerInfo](interfaces/IServerInfo.md)
|
|
46
|
+
|
|
47
|
+
## Type Aliases
|
|
48
|
+
|
|
49
|
+
- [HealthStatus](type-aliases/HealthStatus.md)
|
|
50
|
+
|
|
51
|
+
## Variables
|
|
52
|
+
|
|
53
|
+
- [HealthStatus](variables/HealthStatus.md)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Interface: IAcceptedResponse
|
|
2
|
+
|
|
3
|
+
The rest request ended in accepted response.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### statusCode
|
|
8
|
+
|
|
9
|
+
> **statusCode**: `202`
|
|
10
|
+
|
|
11
|
+
Response status code.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### headers
|
|
16
|
+
|
|
17
|
+
> **headers**: `object`
|
|
18
|
+
|
|
19
|
+
Additional response headers.
|
|
20
|
+
|
|
21
|
+
#### location
|
|
22
|
+
|
|
23
|
+
> **location**: `string`
|
|
24
|
+
|
|
25
|
+
The location where the resource was accepted.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Interface: IBadRequestResponse
|
|
2
|
+
|
|
3
|
+
The server cannot process the request, see the content for more details.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### statusCode
|
|
8
|
+
|
|
9
|
+
> **statusCode**: `400`
|
|
10
|
+
|
|
11
|
+
Response status code.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### body
|
|
16
|
+
|
|
17
|
+
> **body**: `IError`
|
|
18
|
+
|
|
19
|
+
The body which contains the error.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Interface: IBaseRestClientConfig
|
|
2
|
+
|
|
3
|
+
Definition for the configuration of a rest client.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### endpoint
|
|
8
|
+
|
|
9
|
+
> **endpoint**: `string`
|
|
10
|
+
|
|
11
|
+
The endpoint where the api is hosted.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### pathPrefix?
|
|
16
|
+
|
|
17
|
+
> `optional` **pathPrefix**: `string`
|
|
18
|
+
|
|
19
|
+
The prefix to the routes.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### headers?
|
|
24
|
+
|
|
25
|
+
> `optional` **headers**: `IHttpHeaders`
|
|
26
|
+
|
|
27
|
+
The headers to include in requests.
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### timeout?
|
|
32
|
+
|
|
33
|
+
> `optional` **timeout**: `number`
|
|
34
|
+
|
|
35
|
+
Timeout for requests in ms.
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### includeCredentials?
|
|
40
|
+
|
|
41
|
+
> `optional` **includeCredentials**: `boolean`
|
|
42
|
+
|
|
43
|
+
Include credentials in the request, defaults to true.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Interface: IBaseRoute
|
|
2
|
+
|
|
3
|
+
Interface which defines a route.
|
|
4
|
+
|
|
5
|
+
## Extended by
|
|
6
|
+
|
|
7
|
+
- [`IRestRoute`](IRestRoute.md)
|
|
8
|
+
- [`ISocketRoute`](ISocketRoute.md)
|
|
9
|
+
|
|
10
|
+
## Properties
|
|
11
|
+
|
|
12
|
+
### operationId
|
|
13
|
+
|
|
14
|
+
> **operationId**: `string`
|
|
15
|
+
|
|
16
|
+
The id of the operation.
|
|
17
|
+
|
|
18
|
+
***
|
|
19
|
+
|
|
20
|
+
### path
|
|
21
|
+
|
|
22
|
+
> **path**: `string`
|
|
23
|
+
|
|
24
|
+
The path to use for routing.
|
|
25
|
+
|
|
26
|
+
***
|
|
27
|
+
|
|
28
|
+
### skipAuth?
|
|
29
|
+
|
|
30
|
+
> `optional` **skipAuth**: `boolean`
|
|
31
|
+
|
|
32
|
+
Skips the authentication for this route.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Interface: IBaseSocketClientConfig
|
|
2
|
+
|
|
3
|
+
Definition for the configuration of a socket service.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### endpoint
|
|
8
|
+
|
|
9
|
+
> **endpoint**: `string`
|
|
10
|
+
|
|
11
|
+
The endpoint where the api is hosted.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### pathPrefix?
|
|
16
|
+
|
|
17
|
+
> `optional` **pathPrefix**: `string`
|
|
18
|
+
|
|
19
|
+
The prefix to the routes.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### headers?
|
|
24
|
+
|
|
25
|
+
> `optional` **headers**: `IHttpHeaders`
|
|
26
|
+
|
|
27
|
+
The headers to include in requests.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Interface: IConflictResponse
|
|
2
|
+
|
|
3
|
+
The request resulted in a conflicting operation, see the content for more details.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### statusCode
|
|
8
|
+
|
|
9
|
+
> **statusCode**: `409`
|
|
10
|
+
|
|
11
|
+
Response status code.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### body
|
|
16
|
+
|
|
17
|
+
> **body**: `IError` & `object`
|
|
18
|
+
|
|
19
|
+
The body which contains the error.
|
|
20
|
+
|
|
21
|
+
#### Type declaration
|
|
22
|
+
|
|
23
|
+
##### conflicts
|
|
24
|
+
|
|
25
|
+
> **conflicts**: `string`[]
|
|
26
|
+
|
|
27
|
+
The conflicting items.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Interface: ICreatedResponse
|
|
2
|
+
|
|
3
|
+
The rest request ended in created response.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### statusCode
|
|
8
|
+
|
|
9
|
+
> **statusCode**: `201`
|
|
10
|
+
|
|
11
|
+
Response status code.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### headers
|
|
16
|
+
|
|
17
|
+
> **headers**: `object`
|
|
18
|
+
|
|
19
|
+
Additional response headers.
|
|
20
|
+
|
|
21
|
+
#### Location
|
|
22
|
+
|
|
23
|
+
> **Location**: `string`
|
|
24
|
+
|
|
25
|
+
The location where the resource was created.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Interface: IForbiddenResponse
|
|
2
|
+
|
|
3
|
+
The operation that you tried to perform is not possible, see the content for more details.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### statusCode
|
|
8
|
+
|
|
9
|
+
> **statusCode**: `403`
|
|
10
|
+
|
|
11
|
+
Response status code.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### body
|
|
16
|
+
|
|
17
|
+
> **body**: `IError`
|
|
18
|
+
|
|
19
|
+
The body which contains the error.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Interface: IHealthInfo
|
|
2
|
+
|
|
3
|
+
The status of the server.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### status
|
|
8
|
+
|
|
9
|
+
> **status**: [`HealthStatus`](../type-aliases/HealthStatus.md)
|
|
10
|
+
|
|
11
|
+
The status.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### components?
|
|
16
|
+
|
|
17
|
+
> `optional` **components**: `object`[]
|
|
18
|
+
|
|
19
|
+
The status of the components.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Interface: IHttpRequest\<T\>
|
|
2
|
+
|
|
3
|
+
Model for the standard parameters for an http request.
|
|
4
|
+
|
|
5
|
+
## Extended by
|
|
6
|
+
|
|
7
|
+
- [`IHttpServerRequest`](IHttpServerRequest.md)
|
|
8
|
+
- [`INoContentRequest`](INoContentRequest.md)
|
|
9
|
+
|
|
10
|
+
## Type Parameters
|
|
11
|
+
|
|
12
|
+
• **T** = `any`
|
|
13
|
+
|
|
14
|
+
## Properties
|
|
15
|
+
|
|
16
|
+
### headers?
|
|
17
|
+
|
|
18
|
+
> `optional` **headers**: `IHttpHeaders`
|
|
19
|
+
|
|
20
|
+
Incoming Http Headers.
|
|
21
|
+
|
|
22
|
+
***
|
|
23
|
+
|
|
24
|
+
### pathParams?
|
|
25
|
+
|
|
26
|
+
> `optional` **pathParams**: [`IHttpRequestPathParams`](IHttpRequestPathParams.md)
|
|
27
|
+
|
|
28
|
+
The path parameters.
|
|
29
|
+
|
|
30
|
+
***
|
|
31
|
+
|
|
32
|
+
### query?
|
|
33
|
+
|
|
34
|
+
> `optional` **query**: [`IHttpRequestQuery`](IHttpRequestQuery.md)
|
|
35
|
+
|
|
36
|
+
The query parameters.
|
|
37
|
+
|
|
38
|
+
***
|
|
39
|
+
|
|
40
|
+
### body?
|
|
41
|
+
|
|
42
|
+
> `optional` **body**: `T`
|
|
43
|
+
|
|
44
|
+
Data to return send as the body.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Interface: IHttpRequestContext
|
|
2
|
+
|
|
3
|
+
Context data from the HTTP request.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- [`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
8
|
+
|
|
9
|
+
## Properties
|
|
10
|
+
|
|
11
|
+
### serverRequest
|
|
12
|
+
|
|
13
|
+
> **serverRequest**: [`IHttpServerRequest`](IHttpServerRequest.md)\<`any`\>
|
|
14
|
+
|
|
15
|
+
The raw HTTP request.
|
|
16
|
+
|
|
17
|
+
***
|
|
18
|
+
|
|
19
|
+
### processorState
|
|
20
|
+
|
|
21
|
+
> **processorState**: `object`
|
|
22
|
+
|
|
23
|
+
The state handed through the processors.
|
|
24
|
+
|
|
25
|
+
#### Index Signature
|
|
26
|
+
|
|
27
|
+
\[`id`: `string`\]: `unknown`
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### nodeIdentity?
|
|
32
|
+
|
|
33
|
+
> `optional` **nodeIdentity**: `string`
|
|
34
|
+
|
|
35
|
+
The identity of the node the request is being performed on.
|
|
36
|
+
|
|
37
|
+
#### Inherited from
|
|
38
|
+
|
|
39
|
+
[`IHttpRequestIdentity`](IHttpRequestIdentity.md).[`nodeIdentity`](IHttpRequestIdentity.md#nodeidentity)
|
|
40
|
+
|
|
41
|
+
***
|
|
42
|
+
|
|
43
|
+
### userIdentity?
|
|
44
|
+
|
|
45
|
+
> `optional` **userIdentity**: `string`
|
|
46
|
+
|
|
47
|
+
The identity of the requestor if there is an authenticated user.
|
|
48
|
+
|
|
49
|
+
#### Inherited from
|
|
50
|
+
|
|
51
|
+
[`IHttpRequestIdentity`](IHttpRequestIdentity.md).[`userIdentity`](IHttpRequestIdentity.md#useridentity)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Interface: IHttpRequestIdentity
|
|
2
|
+
|
|
3
|
+
Context data from the HTTP request identity.
|
|
4
|
+
|
|
5
|
+
## Extended by
|
|
6
|
+
|
|
7
|
+
- [`IHttpRequestContext`](IHttpRequestContext.md)
|
|
8
|
+
|
|
9
|
+
## Properties
|
|
10
|
+
|
|
11
|
+
### nodeIdentity?
|
|
12
|
+
|
|
13
|
+
> `optional` **nodeIdentity**: `string`
|
|
14
|
+
|
|
15
|
+
The identity of the node the request is being performed on.
|
|
16
|
+
|
|
17
|
+
***
|
|
18
|
+
|
|
19
|
+
### userIdentity?
|
|
20
|
+
|
|
21
|
+
> `optional` **userIdentity**: `string`
|
|
22
|
+
|
|
23
|
+
The identity of the requestor if there is an authenticated user.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Interface: IHttpResponse\<T\>
|
|
2
|
+
|
|
3
|
+
Model for the standard parameters for an http response.
|
|
4
|
+
|
|
5
|
+
## Type Parameters
|
|
6
|
+
|
|
7
|
+
• **T** = `any`
|
|
8
|
+
|
|
9
|
+
## Properties
|
|
10
|
+
|
|
11
|
+
### statusCode?
|
|
12
|
+
|
|
13
|
+
> `optional` **statusCode**: `HttpStatusCode`
|
|
14
|
+
|
|
15
|
+
Response status code.
|
|
16
|
+
|
|
17
|
+
***
|
|
18
|
+
|
|
19
|
+
### headers?
|
|
20
|
+
|
|
21
|
+
> `optional` **headers**: `IHttpHeaders`
|
|
22
|
+
|
|
23
|
+
Response headers.
|
|
24
|
+
|
|
25
|
+
***
|
|
26
|
+
|
|
27
|
+
### body?
|
|
28
|
+
|
|
29
|
+
> `optional` **body**: `T`
|
|
30
|
+
|
|
31
|
+
Data to return as the main payload.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Interface: IHttpRestRouteProcessor
|
|
2
|
+
|
|
3
|
+
The definition for a processor for handling REST routes.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `IComponent`
|
|
8
|
+
|
|
9
|
+
## Methods
|
|
10
|
+
|
|
11
|
+
### pre()?
|
|
12
|
+
|
|
13
|
+
> `optional` **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
|
|
14
|
+
|
|
15
|
+
Pre process the REST request for the specified route.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
• **request**: [`IHttpServerRequest`](IHttpServerRequest.md)\<`any`\>
|
|
20
|
+
|
|
21
|
+
The request to handle.
|
|
22
|
+
|
|
23
|
+
• **response**: [`IHttpResponse`](IHttpResponse.md)\<`any`\>
|
|
24
|
+
|
|
25
|
+
The response data to send if any.
|
|
26
|
+
|
|
27
|
+
• **route**: `undefined` \| [`IRestRoute`](IRestRoute.md)\<`any`, `any`\>
|
|
28
|
+
|
|
29
|
+
The route being requested, if a matching one was found.
|
|
30
|
+
|
|
31
|
+
• **requestIdentity**: [`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
32
|
+
|
|
33
|
+
The identity context for the request.
|
|
34
|
+
|
|
35
|
+
• **processorState**
|
|
36
|
+
|
|
37
|
+
The state handed through the processors.
|
|
38
|
+
|
|
39
|
+
#### Returns
|
|
40
|
+
|
|
41
|
+
`Promise`\<`void`\>
|
|
42
|
+
|
|
43
|
+
Promise that resolves when the request is processed.
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
### process()?
|
|
48
|
+
|
|
49
|
+
> `optional` **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
|
|
50
|
+
|
|
51
|
+
Process the REST request for the specified route.
|
|
52
|
+
|
|
53
|
+
#### Parameters
|
|
54
|
+
|
|
55
|
+
• **request**: [`IHttpServerRequest`](IHttpServerRequest.md)\<`any`\>
|
|
56
|
+
|
|
57
|
+
The request to handle.
|
|
58
|
+
|
|
59
|
+
• **response**: [`IHttpResponse`](IHttpResponse.md)\<`any`\>
|
|
60
|
+
|
|
61
|
+
The response data to send if any.
|
|
62
|
+
|
|
63
|
+
• **route**: `undefined` \| [`IRestRoute`](IRestRoute.md)\<`any`, `any`\>
|
|
64
|
+
|
|
65
|
+
The route being requested, if a matching one was found.
|
|
66
|
+
|
|
67
|
+
• **requestIdentity**: [`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
68
|
+
|
|
69
|
+
The identity context for the request.
|
|
70
|
+
|
|
71
|
+
• **processorState**
|
|
72
|
+
|
|
73
|
+
The state handed through the processors.
|
|
74
|
+
|
|
75
|
+
#### Returns
|
|
76
|
+
|
|
77
|
+
`Promise`\<`void`\>
|
|
78
|
+
|
|
79
|
+
Promise that resolves when the request is processed.
|
|
80
|
+
|
|
81
|
+
***
|
|
82
|
+
|
|
83
|
+
### post()?
|
|
84
|
+
|
|
85
|
+
> `optional` **post**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
|
|
86
|
+
|
|
87
|
+
Post process the REST request for the specified route.
|
|
88
|
+
|
|
89
|
+
#### Parameters
|
|
90
|
+
|
|
91
|
+
• **request**: [`IHttpServerRequest`](IHttpServerRequest.md)\<`any`\>
|
|
92
|
+
|
|
93
|
+
The request to handle.
|
|
94
|
+
|
|
95
|
+
• **response**: [`IHttpResponse`](IHttpResponse.md)\<`any`\>
|
|
96
|
+
|
|
97
|
+
The response data to send if any.
|
|
98
|
+
|
|
99
|
+
• **route**: `undefined` \| [`IRestRoute`](IRestRoute.md)\<`any`, `any`\>
|
|
100
|
+
|
|
101
|
+
The route being requested, if a matching one was found.
|
|
102
|
+
|
|
103
|
+
• **requestIdentity**: [`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
104
|
+
|
|
105
|
+
The identity context for the request.
|
|
106
|
+
|
|
107
|
+
• **processorState**
|
|
108
|
+
|
|
109
|
+
The state handed through the processors.
|
|
110
|
+
|
|
111
|
+
#### Returns
|
|
112
|
+
|
|
113
|
+
`Promise`\<`void`\>
|
|
114
|
+
|
|
115
|
+
Promise that resolves when the request is processed.
|