@twin.org/api-models 0.0.2-next.1 → 0.0.2-next.11

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.
Files changed (42) hide show
  1. package/dist/cjs/index.cjs +9 -0
  2. package/dist/esm/index.mjs +9 -1
  3. package/dist/types/factories/authenticationGeneratorFactory.d.ts +6 -0
  4. package/dist/types/index.d.ts +6 -0
  5. package/dist/types/models/api/IServerFavIconResponse.d.ts +23 -0
  6. package/dist/types/models/api/IServerRootResponse.d.ts +9 -0
  7. package/dist/types/models/client/IAuthenticationGenerator.d.ts +14 -0
  8. package/dist/types/models/config/IBaseRestClientConfig.d.ts +4 -0
  9. package/dist/types/models/protocol/IHttpRequest.d.ts +4 -0
  10. package/dist/types/models/protocol/IHttpRequestContext.d.ts +4 -0
  11. package/dist/types/models/protocol/ISocketRequestContext.d.ts +10 -0
  12. package/dist/types/models/protocol/ISocketServerRequest.d.ts +10 -0
  13. package/dist/types/models/routes/IBaseRoute.d.ts +4 -0
  14. package/dist/types/models/routes/ISocketRoute.d.ts +18 -2
  15. package/dist/types/models/server/IBaseRouteProcessor.d.ts +14 -5
  16. package/dist/types/models/server/IRestRouteProcessor.d.ts +2 -1
  17. package/dist/types/models/server/ISocketRouteProcessor.d.ts +12 -15
  18. package/dist/types/models/services/IInformationComponent.d.ts +10 -0
  19. package/docs/changelog.md +75 -0
  20. package/docs/reference/index.md +6 -0
  21. package/docs/reference/interfaces/IAuthenticationGenerator.md +35 -0
  22. package/docs/reference/interfaces/IBaseRestClientConfig.md +8 -0
  23. package/docs/reference/interfaces/IBaseRoute.md +8 -0
  24. package/docs/reference/interfaces/IBaseRouteProcessor.md +37 -5
  25. package/docs/reference/interfaces/IConflictResponse.md +1 -1
  26. package/docs/reference/interfaces/IHttpRequest.md +8 -0
  27. package/docs/reference/interfaces/IHttpRequestContext.md +12 -0
  28. package/docs/reference/interfaces/IHttpServerRequest.md +16 -0
  29. package/docs/reference/interfaces/IInformationComponent.md +28 -0
  30. package/docs/reference/interfaces/INoContentRequest.md +12 -0
  31. package/docs/reference/interfaces/INotFoundResponse.md +1 -1
  32. package/docs/reference/interfaces/IRestRoute.md +12 -0
  33. package/docs/reference/interfaces/IRestRouteProcessor.md +41 -3
  34. package/docs/reference/interfaces/IServerFavIconResponse.md +33 -0
  35. package/docs/reference/interfaces/IServerRootResponse.md +11 -0
  36. package/docs/reference/interfaces/ISocketRequestContext.md +79 -0
  37. package/docs/reference/interfaces/ISocketRoute.md +55 -3
  38. package/docs/reference/interfaces/ISocketRouteProcessor.md +60 -18
  39. package/docs/reference/interfaces/ISocketServerRequest.md +105 -0
  40. package/docs/reference/variables/AuthenticationGeneratorFactory.md +5 -0
  41. package/docs/reference/variables/HealthStatus.md +1 -1
  42. package/package.json +1 -1
@@ -6,6 +6,10 @@ Context data from the HTTP request.
6
6
 
7
7
  - [`IHttpRequestIdentity`](IHttpRequestIdentity.md)
8
8
 
9
+ ## Extended by
10
+
11
+ - [`ISocketRequestContext`](ISocketRequestContext.md)
12
+
9
13
  ## Properties
10
14
 
11
15
  ### serverRequest
@@ -28,6 +32,14 @@ The state handed through the processors.
28
32
 
29
33
  ***
30
34
 
35
+ ### loggingComponentType?
36
+
37
+ > `optional` **loggingComponentType**: `string`
38
+
39
+ Logging component type for the request.
40
+
41
+ ***
42
+
31
43
  ### nodeIdentity?
32
44
 
33
45
  > `optional` **nodeIdentity**: `string`
@@ -6,6 +6,10 @@ Model for the standard parameters for an http request.
6
6
 
7
7
  - [`IHttpRequest`](IHttpRequest.md)\<`T`\>
8
8
 
9
+ ## Extended by
10
+
11
+ - [`ISocketServerRequest`](ISocketServerRequest.md)
12
+
9
13
  ## Type Parameters
10
14
 
11
15
  ### T
@@ -62,6 +66,18 @@ Data to return send as the body.
62
66
 
63
67
  ***
64
68
 
69
+ ### authentication?
70
+
71
+ > `optional` **authentication**: `unknown`
72
+
73
+ Used to authenticate and will be passed to the configured authentication provider for the request.
74
+
75
+ #### Inherited from
76
+
77
+ [`IHttpRequest`](IHttpRequest.md).[`authentication`](IHttpRequest.md#authentication)
78
+
79
+ ***
80
+
65
81
  ### method?
66
82
 
67
83
  > `optional` **method**: `HttpMethod`
@@ -8,6 +8,20 @@ The information component for the server.
8
8
 
9
9
  ## Methods
10
10
 
11
+ ### root()
12
+
13
+ > **root**(): `Promise`\<`string`\>
14
+
15
+ Get the root information.
16
+
17
+ #### Returns
18
+
19
+ `Promise`\<`string`\>
20
+
21
+ The root information.
22
+
23
+ ***
24
+
11
25
  ### info()
12
26
 
13
27
  > **info**(): `Promise`\<[`IServerInfo`](IServerInfo.md)\>
@@ -22,6 +36,20 @@ The service information.
22
36
 
23
37
  ***
24
38
 
39
+ ### favicon()
40
+
41
+ > **favicon**(): `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\>
42
+
43
+ Get the favicon.
44
+
45
+ #### Returns
46
+
47
+ `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\>
48
+
49
+ The favicon.
50
+
51
+ ***
52
+
25
53
  ### spec()
26
54
 
27
55
  > **spec**(): `Promise`\<`unknown`\>
@@ -8,6 +8,18 @@ A REST request with no input parameters.
8
8
 
9
9
  ## Properties
10
10
 
11
+ ### authentication?
12
+
13
+ > `optional` **authentication**: `unknown`
14
+
15
+ Used to authenticate and will be passed to the configured authentication provider for the request.
16
+
17
+ #### Inherited from
18
+
19
+ [`IHttpRequest`](IHttpRequest.md).[`authentication`](IHttpRequest.md#authentication)
20
+
21
+ ***
22
+
11
23
  ### headers?
12
24
 
13
25
  > `optional` **headers**: `undefined`
@@ -18,7 +18,7 @@ Response status code.
18
18
 
19
19
  The body which contains the error.
20
20
 
21
- #### Type declaration
21
+ #### Type Declaration
22
22
 
23
23
  ##### notFoundId?
24
24
 
@@ -54,6 +54,18 @@ Skips the authentication for this route.
54
54
 
55
55
  ***
56
56
 
57
+ ### processorFeatures?
58
+
59
+ > `optional` **processorFeatures**: `string`[]
60
+
61
+ The features supported by additional processors to run for this route.
62
+
63
+ #### Inherited from
64
+
65
+ [`IBaseRoute`](IBaseRoute.md).[`processorFeatures`](IBaseRoute.md#processorfeatures)
66
+
67
+ ***
68
+
57
69
  ### summary
58
70
 
59
71
  > **summary**: `string`
@@ -8,9 +8,29 @@ The definition for a processor for handling REST routes.
8
8
 
9
9
  ## Methods
10
10
 
11
+ ### features()?
12
+
13
+ > `optional` **features**(): `string`[]
14
+
15
+ Features supported by this processor.
16
+ If a route has any of these features listed, this processor will be run for that route.
17
+ If this is not implemented, the processor will run for all routes.
18
+
19
+ #### Returns
20
+
21
+ `string`[]
22
+
23
+ The features supported by this processor.
24
+
25
+ #### Inherited from
26
+
27
+ [`IBaseRouteProcessor`](IBaseRouteProcessor.md).[`features`](IBaseRouteProcessor.md#features)
28
+
29
+ ***
30
+
11
31
  ### pre()?
12
32
 
13
- > `optional` **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
33
+ > `optional` **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
14
34
 
15
35
  Pre process the REST request for the specified route.
16
36
 
@@ -44,6 +64,12 @@ The identity context for the request.
44
64
 
45
65
  The state handed through the processors.
46
66
 
67
+ ##### loggingComponentType?
68
+
69
+ `string`
70
+
71
+ The logging component type for the request.
72
+
47
73
  #### Returns
48
74
 
49
75
  `Promise`\<`void`\>
@@ -58,7 +84,7 @@ Promise that resolves when the request is processed.
58
84
 
59
85
  ### post()?
60
86
 
61
- > `optional` **post**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
87
+ > `optional` **post**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
62
88
 
63
89
  Post process the REST request for the specified route.
64
90
 
@@ -92,6 +118,12 @@ The identity context for the request.
92
118
 
93
119
  The state handed through the processors.
94
120
 
121
+ ##### loggingComponentType?
122
+
123
+ `string`
124
+
125
+ The logging component type for the request.
126
+
95
127
  #### Returns
96
128
 
97
129
  `Promise`\<`void`\>
@@ -106,7 +138,7 @@ Promise that resolves when the request is processed.
106
138
 
107
139
  ### process()?
108
140
 
109
- > `optional` **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
141
+ > `optional` **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
110
142
 
111
143
  Process the REST request for the specified route.
112
144
 
@@ -140,6 +172,12 @@ The identity context for the request.
140
172
 
141
173
  The state handed through the processors.
142
174
 
175
+ ##### loggingComponentType?
176
+
177
+ `string`
178
+
179
+ The logging component type for the request.
180
+
143
181
  #### Returns
144
182
 
145
183
  `Promise`\<`void`\>
@@ -0,0 +1,33 @@
1
+ # Interface: IServerFavIconResponse
2
+
3
+ The favicon for the server.
4
+
5
+ ## Properties
6
+
7
+ ### headers?
8
+
9
+ > `optional` **headers**: `object`
10
+
11
+ Additional response headers.
12
+
13
+ #### content-type?
14
+
15
+ > `optional` **content-type**: `string`
16
+
17
+ The content type for the response.
18
+
19
+ ***
20
+
21
+ ### statusCode?
22
+
23
+ > `optional` **statusCode**: `HttpStatusCode`
24
+
25
+ Response status code.
26
+
27
+ ***
28
+
29
+ ### body?
30
+
31
+ > `optional` **body**: `Uint8Array`\<`ArrayBufferLike`\>
32
+
33
+ The favicon for the server.
@@ -0,0 +1,11 @@
1
+ # Interface: IServerRootResponse
2
+
3
+ The root text for the server.
4
+
5
+ ## Properties
6
+
7
+ ### body
8
+
9
+ > **body**: `string`
10
+
11
+ The root text for the server.
@@ -0,0 +1,79 @@
1
+ # Interface: ISocketRequestContext
2
+
3
+ Context data from the socket request.
4
+
5
+ ## Extends
6
+
7
+ - [`IHttpRequestContext`](IHttpRequestContext.md)
8
+
9
+ ## Properties
10
+
11
+ ### serverRequest
12
+
13
+ > **serverRequest**: [`IHttpServerRequest`](IHttpServerRequest.md)
14
+
15
+ The raw HTTP request.
16
+
17
+ #### Inherited from
18
+
19
+ [`IHttpRequestContext`](IHttpRequestContext.md).[`serverRequest`](IHttpRequestContext.md#serverrequest)
20
+
21
+ ***
22
+
23
+ ### processorState
24
+
25
+ > **processorState**: `object`
26
+
27
+ The state handed through the processors.
28
+
29
+ #### Index Signature
30
+
31
+ \[`id`: `string`\]: `unknown`
32
+
33
+ #### Inherited from
34
+
35
+ [`IHttpRequestContext`](IHttpRequestContext.md).[`processorState`](IHttpRequestContext.md#processorstate)
36
+
37
+ ***
38
+
39
+ ### loggingComponentType?
40
+
41
+ > `optional` **loggingComponentType**: `string`
42
+
43
+ Logging component type for the request.
44
+
45
+ #### Inherited from
46
+
47
+ [`IHttpRequestContext`](IHttpRequestContext.md).[`loggingComponentType`](IHttpRequestContext.md#loggingcomponenttype)
48
+
49
+ ***
50
+
51
+ ### nodeIdentity?
52
+
53
+ > `optional` **nodeIdentity**: `string`
54
+
55
+ The identity of the node the request is being performed on.
56
+
57
+ #### Inherited from
58
+
59
+ [`IHttpRequestContext`](IHttpRequestContext.md).[`nodeIdentity`](IHttpRequestContext.md#nodeidentity)
60
+
61
+ ***
62
+
63
+ ### userIdentity?
64
+
65
+ > `optional` **userIdentity**: `string`
66
+
67
+ The identity of the requestor if there is an authenticated user.
68
+
69
+ #### Inherited from
70
+
71
+ [`IHttpRequestContext`](IHttpRequestContext.md).[`userIdentity`](IHttpRequestContext.md#useridentity)
72
+
73
+ ***
74
+
75
+ ### socketId
76
+
77
+ > **socketId**: `string`
78
+
79
+ The id of the socket.
@@ -54,17 +54,29 @@ Skips the authentication for this route.
54
54
 
55
55
  ***
56
56
 
57
+ ### processorFeatures?
58
+
59
+ > `optional` **processorFeatures**: `string`[]
60
+
61
+ The features supported by additional processors to run for this route.
62
+
63
+ #### Inherited from
64
+
65
+ [`IBaseRoute`](IBaseRoute.md).[`processorFeatures`](IBaseRoute.md#processorfeatures)
66
+
67
+ ***
68
+
57
69
  ### handler()
58
70
 
59
- > **handler**: (`httpRequestContext`, `request`, `emit`) => `void`
71
+ > **handler**: (`socketRequestContext`, `request`, `emit`) => `void`
60
72
 
61
73
  The handler module.
62
74
 
63
75
  #### Parameters
64
76
 
65
- ##### httpRequestContext
77
+ ##### socketRequestContext
66
78
 
67
- [`IHttpRequestContext`](IHttpRequestContext.md)
79
+ [`ISocketRequestContext`](ISocketRequestContext.md)
68
80
 
69
81
  The request context.
70
82
 
@@ -83,3 +95,43 @@ The function to emit an event.
83
95
  #### Returns
84
96
 
85
97
  `void`
98
+
99
+ ***
100
+
101
+ ### connected()?
102
+
103
+ > `optional` **connected**: (`socketRequestContext`) => `void`
104
+
105
+ The connected handler.
106
+
107
+ #### Parameters
108
+
109
+ ##### socketRequestContext
110
+
111
+ [`ISocketRequestContext`](ISocketRequestContext.md)
112
+
113
+ The request context.
114
+
115
+ #### Returns
116
+
117
+ `void`
118
+
119
+ ***
120
+
121
+ ### disconnected()?
122
+
123
+ > `optional` **disconnected**: (`socketRequestContext`) => `void`
124
+
125
+ The disconnected handler.
126
+
127
+ #### Parameters
128
+
129
+ ##### socketRequestContext
130
+
131
+ [`ISocketRequestContext`](ISocketRequestContext.md)
132
+
133
+ The request context.
134
+
135
+ #### Returns
136
+
137
+ `void`
@@ -4,13 +4,33 @@ The definition for a processor for handling socket routes.
4
4
 
5
5
  ## Extends
6
6
 
7
- - [`IBaseRouteProcessor`](IBaseRouteProcessor.md)\<[`ISocketRoute`](ISocketRoute.md)\>
7
+ - [`IBaseRouteProcessor`](IBaseRouteProcessor.md)\<[`ISocketRoute`](ISocketRoute.md), [`ISocketServerRequest`](ISocketServerRequest.md)\>
8
8
 
9
9
  ## Methods
10
10
 
11
+ ### features()?
12
+
13
+ > `optional` **features**(): `string`[]
14
+
15
+ Features supported by this processor.
16
+ If a route has any of these features listed, this processor will be run for that route.
17
+ If this is not implemented, the processor will run for all routes.
18
+
19
+ #### Returns
20
+
21
+ `string`[]
22
+
23
+ The features supported by this processor.
24
+
25
+ #### Inherited from
26
+
27
+ [`IBaseRouteProcessor`](IBaseRouteProcessor.md).[`features`](IBaseRouteProcessor.md#features)
28
+
29
+ ***
30
+
11
31
  ### pre()?
12
32
 
13
- > `optional` **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
33
+ > `optional` **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
14
34
 
15
35
  Pre process the REST request for the specified route.
16
36
 
@@ -18,7 +38,7 @@ Pre process the REST request for the specified route.
18
38
 
19
39
  ##### request
20
40
 
21
- [`IHttpServerRequest`](IHttpServerRequest.md)
41
+ [`ISocketServerRequest`](ISocketServerRequest.md)
22
42
 
23
43
  The request to handle.
24
44
 
@@ -44,6 +64,12 @@ The identity context for the request.
44
64
 
45
65
  The state handed through the processors.
46
66
 
67
+ ##### loggingComponentType?
68
+
69
+ `string`
70
+
71
+ The logging component type for the request.
72
+
47
73
  #### Returns
48
74
 
49
75
  `Promise`\<`void`\>
@@ -58,7 +84,7 @@ Promise that resolves when the request is processed.
58
84
 
59
85
  ### post()?
60
86
 
61
- > `optional` **post**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
87
+ > `optional` **post**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
62
88
 
63
89
  Post process the REST request for the specified route.
64
90
 
@@ -66,7 +92,7 @@ Post process the REST request for the specified route.
66
92
 
67
93
  ##### request
68
94
 
69
- [`IHttpServerRequest`](IHttpServerRequest.md)
95
+ [`ISocketServerRequest`](ISocketServerRequest.md)
70
96
 
71
97
  The request to handle.
72
98
 
@@ -92,6 +118,12 @@ The identity context for the request.
92
118
 
93
119
  The state handed through the processors.
94
120
 
121
+ ##### loggingComponentType?
122
+
123
+ `string`
124
+
125
+ The logging component type for the request.
126
+
95
127
  #### Returns
96
128
 
97
129
  `Promise`\<`void`\>
@@ -106,7 +138,7 @@ Promise that resolves when the request is processed.
106
138
 
107
139
  ### connected()?
108
140
 
109
- > `optional` **connected**(`request`, `route`, `processorState`): `Promise`\<`void`\>
141
+ > `optional` **connected**(`request`, `route`, `loggingComponentType?`): `Promise`\<`void`\>
110
142
 
111
143
  Process the connected event.
112
144
 
@@ -114,9 +146,9 @@ Process the connected event.
114
146
 
115
147
  ##### request
116
148
 
117
- [`IHttpServerRequest`](IHttpServerRequest.md)
149
+ [`ISocketServerRequest`](ISocketServerRequest.md)
118
150
 
119
- The request to handle.
151
+ The server request object containing the socket id and other parameters.
120
152
 
121
153
  ##### route
122
154
 
@@ -124,9 +156,11 @@ The route being requested, if a matching one was found.
124
156
 
125
157
  `undefined` | [`ISocketRoute`](ISocketRoute.md)\<`any`, `any`\>
126
158
 
127
- ##### processorState
159
+ ##### loggingComponentType?
128
160
 
129
- The state handed through the processors.
161
+ `string`
162
+
163
+ The logging component type for the request.
130
164
 
131
165
  #### Returns
132
166
 
@@ -138,7 +172,7 @@ Promise that resolves when the request is processed.
138
172
 
139
173
  ### disconnected()?
140
174
 
141
- > `optional` **disconnected**(`request`, `route`, `processorState`): `Promise`\<`void`\>
175
+ > `optional` **disconnected**(`request`, `route`, `loggingComponentType?`): `Promise`\<`void`\>
142
176
 
143
177
  Process the disconnected event.
144
178
 
@@ -146,9 +180,9 @@ Process the disconnected event.
146
180
 
147
181
  ##### request
148
182
 
149
- [`IHttpServerRequest`](IHttpServerRequest.md)
183
+ [`ISocketServerRequest`](ISocketServerRequest.md)
150
184
 
151
- The request to handle.
185
+ The server request object containing the socket id and other parameters.
152
186
 
153
187
  ##### route
154
188
 
@@ -156,9 +190,11 @@ The route being requested, if a matching one was found.
156
190
 
157
191
  `undefined` | [`ISocketRoute`](ISocketRoute.md)\<`any`, `any`\>
158
192
 
159
- ##### processorState
193
+ ##### loggingComponentType?
160
194
 
161
- The state handed through the processors.
195
+ `string`
196
+
197
+ The logging component type for the request.
162
198
 
163
199
  #### Returns
164
200
 
@@ -170,7 +206,7 @@ Promise that resolves when the request is processed.
170
206
 
171
207
  ### process()?
172
208
 
173
- > `optional` **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `responseEmitter`): `Promise`\<`void`\>
209
+ > `optional` **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `responseEmitter`, `loggingComponentType?`): `Promise`\<`void`\>
174
210
 
175
211
  Process the REST request for the specified route.
176
212
 
@@ -178,9 +214,9 @@ Process the REST request for the specified route.
178
214
 
179
215
  ##### request
180
216
 
181
- [`IHttpServerRequest`](IHttpServerRequest.md)
217
+ [`ISocketServerRequest`](ISocketServerRequest.md)
182
218
 
183
- The request to handle.
219
+ The server request object containing the socket id and other parameters.
184
220
 
185
221
  ##### response
186
222
 
@@ -210,6 +246,12 @@ The state handed through the processors.
210
246
 
211
247
  The function to emit a response.
212
248
 
249
+ ##### loggingComponentType?
250
+
251
+ `string`
252
+
253
+ The logging component type for the request.
254
+
213
255
  #### Returns
214
256
 
215
257
  `Promise`\<`void`\>