@twin.org/api-models 0.0.1-next.25 → 0.0.1-next.26
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/docs/changelog.md +1 -1
- package/docs/reference/classes/HttpErrorHelper.md +15 -5
- package/docs/reference/classes/HttpParameterHelper.md +12 -4
- package/docs/reference/interfaces/IBaseRouteEntryPoint.md +6 -2
- package/docs/reference/interfaces/IBaseRouteProcessor.md +26 -10
- package/docs/reference/interfaces/IHealthInfo.md +18 -0
- package/docs/reference/interfaces/IHttpRequestContext.md +2 -2
- package/docs/reference/interfaces/IHttpRequestPathParams.md +1 -1
- package/docs/reference/interfaces/IHttpRequestQuery.md +1 -1
- package/docs/reference/interfaces/IInformationComponent.md +12 -4
- package/docs/reference/interfaces/IMimeTypeProcessor.md +3 -1
- package/docs/reference/interfaces/IRestRoute.md +24 -2
- package/docs/reference/interfaces/IRestRouteProcessor.md +39 -15
- package/docs/reference/interfaces/ISocketRoute.md +9 -3
- package/docs/reference/interfaces/ISocketRouteProcessor.md +56 -22
- package/docs/reference/interfaces/IWebServer.md +15 -5
- package/package.json +1 -1
package/docs/changelog.md
CHANGED
|
@@ -22,11 +22,15 @@ Process the errors from the routes.
|
|
|
22
22
|
|
|
23
23
|
#### Parameters
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
##### err
|
|
26
|
+
|
|
27
|
+
`unknown`
|
|
26
28
|
|
|
27
29
|
The error to process.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
##### includeStack?
|
|
32
|
+
|
|
33
|
+
`boolean`
|
|
30
34
|
|
|
31
35
|
Should the stack be included in the error.
|
|
32
36
|
|
|
@@ -54,15 +58,21 @@ Build an error response.
|
|
|
54
58
|
|
|
55
59
|
#### Parameters
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
##### response
|
|
62
|
+
|
|
63
|
+
[`IHttpResponse`](../interfaces/IHttpResponse.md)
|
|
58
64
|
|
|
59
65
|
The response to build the error into.
|
|
60
66
|
|
|
61
|
-
|
|
67
|
+
##### error
|
|
68
|
+
|
|
69
|
+
`IError`
|
|
62
70
|
|
|
63
71
|
The error to build the response for.
|
|
64
72
|
|
|
65
|
-
|
|
73
|
+
##### statusCode
|
|
74
|
+
|
|
75
|
+
`HttpStatusCode`
|
|
66
76
|
|
|
67
77
|
The status code to use for the error.
|
|
68
78
|
|
|
@@ -26,7 +26,9 @@ Convert list query to array.
|
|
|
26
26
|
|
|
27
27
|
#### Parameters
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
##### values?
|
|
30
|
+
|
|
31
|
+
`string`
|
|
30
32
|
|
|
31
33
|
The values query string.
|
|
32
34
|
|
|
@@ -50,7 +52,9 @@ Convert array of values to query string.
|
|
|
50
52
|
|
|
51
53
|
#### Parameters
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
##### values?
|
|
56
|
+
|
|
57
|
+
`T`[]
|
|
54
58
|
|
|
55
59
|
The values to combine string.
|
|
56
60
|
|
|
@@ -74,7 +78,9 @@ Convert object string to object.
|
|
|
74
78
|
|
|
75
79
|
#### Parameters
|
|
76
80
|
|
|
77
|
-
|
|
81
|
+
##### value?
|
|
82
|
+
|
|
83
|
+
`string`
|
|
78
84
|
|
|
79
85
|
The value query string.
|
|
80
86
|
|
|
@@ -98,7 +104,9 @@ Convert object to query string.
|
|
|
98
104
|
|
|
99
105
|
#### Parameters
|
|
100
106
|
|
|
101
|
-
|
|
107
|
+
##### value?
|
|
108
|
+
|
|
109
|
+
`T`
|
|
102
110
|
|
|
103
111
|
The value to convert to a string.
|
|
104
112
|
|
|
@@ -25,23 +25,31 @@ Pre process the REST request for the specified route.
|
|
|
25
25
|
|
|
26
26
|
#### Parameters
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
##### request
|
|
29
|
+
|
|
30
|
+
[`IHttpServerRequest`](IHttpServerRequest.md)
|
|
29
31
|
|
|
30
32
|
The request to handle.
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
##### response
|
|
35
|
+
|
|
36
|
+
[`IHttpResponse`](IHttpResponse.md)
|
|
33
37
|
|
|
34
38
|
The response data to send if any.
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
##### route
|
|
37
41
|
|
|
38
42
|
The route being requested, if a matching one was found.
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
`undefined` | `T`
|
|
45
|
+
|
|
46
|
+
##### requestIdentity
|
|
47
|
+
|
|
48
|
+
[`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
41
49
|
|
|
42
50
|
The identity context for the request.
|
|
43
51
|
|
|
44
|
-
|
|
52
|
+
##### processorState
|
|
45
53
|
|
|
46
54
|
The state handed through the processors.
|
|
47
55
|
|
|
@@ -61,23 +69,31 @@ Post process the REST request for the specified route.
|
|
|
61
69
|
|
|
62
70
|
#### Parameters
|
|
63
71
|
|
|
64
|
-
|
|
72
|
+
##### request
|
|
73
|
+
|
|
74
|
+
[`IHttpServerRequest`](IHttpServerRequest.md)
|
|
65
75
|
|
|
66
76
|
The request to handle.
|
|
67
77
|
|
|
68
|
-
|
|
78
|
+
##### response
|
|
79
|
+
|
|
80
|
+
[`IHttpResponse`](IHttpResponse.md)
|
|
69
81
|
|
|
70
82
|
The response data to send if any.
|
|
71
83
|
|
|
72
|
-
|
|
84
|
+
##### route
|
|
73
85
|
|
|
74
86
|
The route being requested, if a matching one was found.
|
|
75
87
|
|
|
76
|
-
|
|
88
|
+
`undefined` | `T`
|
|
89
|
+
|
|
90
|
+
##### requestIdentity
|
|
91
|
+
|
|
92
|
+
[`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
77
93
|
|
|
78
94
|
The identity context for the request.
|
|
79
95
|
|
|
80
|
-
|
|
96
|
+
##### processorState
|
|
81
97
|
|
|
82
98
|
The state handed through the processors.
|
|
83
99
|
|
|
@@ -17,3 +17,21 @@ The status.
|
|
|
17
17
|
> `optional` **components**: `object`[]
|
|
18
18
|
|
|
19
19
|
The status of the components.
|
|
20
|
+
|
|
21
|
+
#### name
|
|
22
|
+
|
|
23
|
+
> **name**: `string`
|
|
24
|
+
|
|
25
|
+
The name of the component.
|
|
26
|
+
|
|
27
|
+
#### status
|
|
28
|
+
|
|
29
|
+
> **status**: [`HealthStatus`](../type-aliases/HealthStatus.md)
|
|
30
|
+
|
|
31
|
+
The status of the component.
|
|
32
|
+
|
|
33
|
+
#### details?
|
|
34
|
+
|
|
35
|
+
> `optional` **details**: `string`
|
|
36
|
+
|
|
37
|
+
The details for the status.
|
|
@@ -10,7 +10,7 @@ Context data from the HTTP request.
|
|
|
10
10
|
|
|
11
11
|
### serverRequest
|
|
12
12
|
|
|
13
|
-
> **serverRequest**: [`IHttpServerRequest`](IHttpServerRequest.md)
|
|
13
|
+
> **serverRequest**: [`IHttpServerRequest`](IHttpServerRequest.md)
|
|
14
14
|
|
|
15
15
|
The raw HTTP request.
|
|
16
16
|
|
|
@@ -24,7 +24,7 @@ The state handed through the processors.
|
|
|
24
24
|
|
|
25
25
|
#### Index Signature
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
\[`id`: `string`\]: `unknown`
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
@@ -58,15 +58,21 @@ Set the status of a component.
|
|
|
58
58
|
|
|
59
59
|
#### Parameters
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
##### name
|
|
62
|
+
|
|
63
|
+
`string`
|
|
62
64
|
|
|
63
65
|
The component name.
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
##### status
|
|
68
|
+
|
|
69
|
+
[`HealthStatus`](../type-aliases/HealthStatus.md)
|
|
66
70
|
|
|
67
71
|
The status of the component.
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
##### details?
|
|
74
|
+
|
|
75
|
+
`string`
|
|
70
76
|
|
|
71
77
|
The details for the status.
|
|
72
78
|
|
|
@@ -86,7 +92,9 @@ Remove the status of a component.
|
|
|
86
92
|
|
|
87
93
|
#### Parameters
|
|
88
94
|
|
|
89
|
-
|
|
95
|
+
##### name
|
|
96
|
+
|
|
97
|
+
`string`
|
|
90
98
|
|
|
91
99
|
The component name.
|
|
92
100
|
|
|
@@ -82,11 +82,15 @@ The handler module.
|
|
|
82
82
|
|
|
83
83
|
#### Parameters
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
##### httpRequestContext
|
|
86
|
+
|
|
87
|
+
[`IHttpRequestContext`](IHttpRequestContext.md)
|
|
86
88
|
|
|
87
89
|
The http request context.
|
|
88
90
|
|
|
89
|
-
|
|
91
|
+
##### request
|
|
92
|
+
|
|
93
|
+
`T`
|
|
90
94
|
|
|
91
95
|
The request object, combined query param, path params and body.
|
|
92
96
|
|
|
@@ -128,6 +132,24 @@ Example objects for the request.
|
|
|
128
132
|
|
|
129
133
|
The type of the response object.
|
|
130
134
|
|
|
135
|
+
#### type
|
|
136
|
+
|
|
137
|
+
> **type**: `string`
|
|
138
|
+
|
|
139
|
+
The object type of the response.
|
|
140
|
+
|
|
141
|
+
#### mimeType?
|
|
142
|
+
|
|
143
|
+
> `optional` **mimeType**: `string`
|
|
144
|
+
|
|
145
|
+
The mime type of the response, defaults to "application/json" if there is a body.
|
|
146
|
+
|
|
147
|
+
#### examples?
|
|
148
|
+
|
|
149
|
+
> `optional` **examples**: [`IRestRouteResponseExample`](IRestRouteResponseExample.md)\<`U`\>[]
|
|
150
|
+
|
|
151
|
+
Example objects of the response.
|
|
152
|
+
|
|
131
153
|
***
|
|
132
154
|
|
|
133
155
|
### excludeFromSpec?
|
|
@@ -16,23 +16,31 @@ Pre process the REST request for the specified route.
|
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### request
|
|
20
|
+
|
|
21
|
+
[`IHttpServerRequest`](IHttpServerRequest.md)
|
|
20
22
|
|
|
21
23
|
The request to handle.
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
##### response
|
|
26
|
+
|
|
27
|
+
[`IHttpResponse`](IHttpResponse.md)
|
|
24
28
|
|
|
25
29
|
The response data to send if any.
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
##### route
|
|
28
32
|
|
|
29
33
|
The route being requested, if a matching one was found.
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
`undefined` | [`IRestRoute`](IRestRoute.md)
|
|
36
|
+
|
|
37
|
+
##### requestIdentity
|
|
38
|
+
|
|
39
|
+
[`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
32
40
|
|
|
33
41
|
The identity context for the request.
|
|
34
42
|
|
|
35
|
-
|
|
43
|
+
##### processorState
|
|
36
44
|
|
|
37
45
|
The state handed through the processors.
|
|
38
46
|
|
|
@@ -56,23 +64,31 @@ Post process the REST request for the specified route.
|
|
|
56
64
|
|
|
57
65
|
#### Parameters
|
|
58
66
|
|
|
59
|
-
|
|
67
|
+
##### request
|
|
68
|
+
|
|
69
|
+
[`IHttpServerRequest`](IHttpServerRequest.md)
|
|
60
70
|
|
|
61
71
|
The request to handle.
|
|
62
72
|
|
|
63
|
-
|
|
73
|
+
##### response
|
|
74
|
+
|
|
75
|
+
[`IHttpResponse`](IHttpResponse.md)
|
|
64
76
|
|
|
65
77
|
The response data to send if any.
|
|
66
78
|
|
|
67
|
-
|
|
79
|
+
##### route
|
|
68
80
|
|
|
69
81
|
The route being requested, if a matching one was found.
|
|
70
82
|
|
|
71
|
-
|
|
83
|
+
`undefined` | [`IRestRoute`](IRestRoute.md)
|
|
84
|
+
|
|
85
|
+
##### requestIdentity
|
|
86
|
+
|
|
87
|
+
[`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
72
88
|
|
|
73
89
|
The identity context for the request.
|
|
74
90
|
|
|
75
|
-
|
|
91
|
+
##### processorState
|
|
76
92
|
|
|
77
93
|
The state handed through the processors.
|
|
78
94
|
|
|
@@ -96,23 +112,31 @@ Process the REST request for the specified route.
|
|
|
96
112
|
|
|
97
113
|
#### Parameters
|
|
98
114
|
|
|
99
|
-
|
|
115
|
+
##### request
|
|
116
|
+
|
|
117
|
+
[`IHttpServerRequest`](IHttpServerRequest.md)
|
|
100
118
|
|
|
101
119
|
The request to handle.
|
|
102
120
|
|
|
103
|
-
|
|
121
|
+
##### response
|
|
122
|
+
|
|
123
|
+
[`IHttpResponse`](IHttpResponse.md)
|
|
104
124
|
|
|
105
125
|
The response data to send if any.
|
|
106
126
|
|
|
107
|
-
|
|
127
|
+
##### route
|
|
108
128
|
|
|
109
129
|
The route being requested, if a matching one was found.
|
|
110
130
|
|
|
111
|
-
|
|
131
|
+
`undefined` | [`IRestRoute`](IRestRoute.md)
|
|
132
|
+
|
|
133
|
+
##### requestIdentity
|
|
134
|
+
|
|
135
|
+
[`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
112
136
|
|
|
113
137
|
The identity context for the request.
|
|
114
138
|
|
|
115
|
-
|
|
139
|
+
##### processorState
|
|
116
140
|
|
|
117
141
|
The state handed through the processors.
|
|
118
142
|
|
|
@@ -58,15 +58,21 @@ The handler module.
|
|
|
58
58
|
|
|
59
59
|
#### Parameters
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
##### httpRequestContext
|
|
62
|
+
|
|
63
|
+
[`IHttpRequestContext`](IHttpRequestContext.md)
|
|
62
64
|
|
|
63
65
|
The request context.
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
##### request
|
|
68
|
+
|
|
69
|
+
`T`
|
|
66
70
|
|
|
67
71
|
The request object.
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
##### emit
|
|
74
|
+
|
|
75
|
+
(`event`, `response`) => `Promise`\<`void`\>
|
|
70
76
|
|
|
71
77
|
The function to emit an event.
|
|
72
78
|
|
|
@@ -16,23 +16,31 @@ Pre process the REST request for the specified route.
|
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### request
|
|
20
|
+
|
|
21
|
+
[`IHttpServerRequest`](IHttpServerRequest.md)
|
|
20
22
|
|
|
21
23
|
The request to handle.
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
##### response
|
|
26
|
+
|
|
27
|
+
[`IHttpResponse`](IHttpResponse.md)
|
|
24
28
|
|
|
25
29
|
The response data to send if any.
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
##### route
|
|
28
32
|
|
|
29
33
|
The route being requested, if a matching one was found.
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
`undefined` | [`ISocketRoute`](ISocketRoute.md)
|
|
36
|
+
|
|
37
|
+
##### requestIdentity
|
|
38
|
+
|
|
39
|
+
[`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
32
40
|
|
|
33
41
|
The identity context for the request.
|
|
34
42
|
|
|
35
|
-
|
|
43
|
+
##### processorState
|
|
36
44
|
|
|
37
45
|
The state handed through the processors.
|
|
38
46
|
|
|
@@ -56,23 +64,31 @@ Post process the REST request for the specified route.
|
|
|
56
64
|
|
|
57
65
|
#### Parameters
|
|
58
66
|
|
|
59
|
-
|
|
67
|
+
##### request
|
|
68
|
+
|
|
69
|
+
[`IHttpServerRequest`](IHttpServerRequest.md)
|
|
60
70
|
|
|
61
71
|
The request to handle.
|
|
62
72
|
|
|
63
|
-
|
|
73
|
+
##### response
|
|
74
|
+
|
|
75
|
+
[`IHttpResponse`](IHttpResponse.md)
|
|
64
76
|
|
|
65
77
|
The response data to send if any.
|
|
66
78
|
|
|
67
|
-
|
|
79
|
+
##### route
|
|
68
80
|
|
|
69
81
|
The route being requested, if a matching one was found.
|
|
70
82
|
|
|
71
|
-
|
|
83
|
+
`undefined` | [`ISocketRoute`](ISocketRoute.md)
|
|
84
|
+
|
|
85
|
+
##### requestIdentity
|
|
86
|
+
|
|
87
|
+
[`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
72
88
|
|
|
73
89
|
The identity context for the request.
|
|
74
90
|
|
|
75
|
-
|
|
91
|
+
##### processorState
|
|
76
92
|
|
|
77
93
|
The state handed through the processors.
|
|
78
94
|
|
|
@@ -96,15 +112,19 @@ Process the connected event.
|
|
|
96
112
|
|
|
97
113
|
#### Parameters
|
|
98
114
|
|
|
99
|
-
|
|
115
|
+
##### request
|
|
116
|
+
|
|
117
|
+
[`IHttpServerRequest`](IHttpServerRequest.md)
|
|
100
118
|
|
|
101
119
|
The request to handle.
|
|
102
120
|
|
|
103
|
-
|
|
121
|
+
##### route
|
|
104
122
|
|
|
105
123
|
The route being requested, if a matching one was found.
|
|
106
124
|
|
|
107
|
-
|
|
125
|
+
`undefined` | [`ISocketRoute`](ISocketRoute.md)
|
|
126
|
+
|
|
127
|
+
##### processorState
|
|
108
128
|
|
|
109
129
|
The state handed through the processors.
|
|
110
130
|
|
|
@@ -124,15 +144,19 @@ Process the disconnected event.
|
|
|
124
144
|
|
|
125
145
|
#### Parameters
|
|
126
146
|
|
|
127
|
-
|
|
147
|
+
##### request
|
|
148
|
+
|
|
149
|
+
[`IHttpServerRequest`](IHttpServerRequest.md)
|
|
128
150
|
|
|
129
151
|
The request to handle.
|
|
130
152
|
|
|
131
|
-
|
|
153
|
+
##### route
|
|
132
154
|
|
|
133
155
|
The route being requested, if a matching one was found.
|
|
134
156
|
|
|
135
|
-
|
|
157
|
+
`undefined` | [`ISocketRoute`](ISocketRoute.md)
|
|
158
|
+
|
|
159
|
+
##### processorState
|
|
136
160
|
|
|
137
161
|
The state handed through the processors.
|
|
138
162
|
|
|
@@ -152,27 +176,37 @@ Process the REST request for the specified route.
|
|
|
152
176
|
|
|
153
177
|
#### Parameters
|
|
154
178
|
|
|
155
|
-
|
|
179
|
+
##### request
|
|
180
|
+
|
|
181
|
+
[`IHttpServerRequest`](IHttpServerRequest.md)
|
|
156
182
|
|
|
157
183
|
The request to handle.
|
|
158
184
|
|
|
159
|
-
|
|
185
|
+
##### response
|
|
186
|
+
|
|
187
|
+
[`IHttpResponse`](IHttpResponse.md)
|
|
160
188
|
|
|
161
189
|
The response data to send if any.
|
|
162
190
|
|
|
163
|
-
|
|
191
|
+
##### route
|
|
164
192
|
|
|
165
193
|
The route being requested, if a matching one was found.
|
|
166
194
|
|
|
167
|
-
|
|
195
|
+
`undefined` | [`ISocketRoute`](ISocketRoute.md)
|
|
196
|
+
|
|
197
|
+
##### requestIdentity
|
|
198
|
+
|
|
199
|
+
[`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
168
200
|
|
|
169
201
|
The identity context for the request.
|
|
170
202
|
|
|
171
|
-
|
|
203
|
+
##### processorState
|
|
172
204
|
|
|
173
205
|
The state handed through the processors.
|
|
174
206
|
|
|
175
|
-
|
|
207
|
+
##### responseEmitter
|
|
208
|
+
|
|
209
|
+
(`topic`, `response`) => `Promise`\<`void`\>
|
|
176
210
|
|
|
177
211
|
The function to emit a response.
|
|
178
212
|
|
|
@@ -30,23 +30,33 @@ Build the server.
|
|
|
30
30
|
|
|
31
31
|
#### Parameters
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
##### restRouteProcessors?
|
|
34
|
+
|
|
35
|
+
[`IRestRouteProcessor`](IRestRouteProcessor.md)[]
|
|
34
36
|
|
|
35
37
|
The processors for incoming requests over REST.
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
##### restRoutes?
|
|
40
|
+
|
|
41
|
+
[`IRestRoute`](IRestRoute.md)[]
|
|
38
42
|
|
|
39
43
|
The REST routes.
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
##### socketRouteProcessors?
|
|
46
|
+
|
|
47
|
+
[`ISocketRouteProcessor`](ISocketRouteProcessor.md)[]
|
|
42
48
|
|
|
43
49
|
The processors for incoming requests over Sockets.
|
|
44
50
|
|
|
45
|
-
|
|
51
|
+
##### socketRoutes?
|
|
52
|
+
|
|
53
|
+
[`ISocketRoute`](ISocketRoute.md)[]
|
|
46
54
|
|
|
47
55
|
The socket routes.
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
##### options?
|
|
58
|
+
|
|
59
|
+
[`IWebServerOptions`](IWebServerOptions.md)
|
|
50
60
|
|
|
51
61
|
Options for building the server.
|
|
52
62
|
|