@twin.org/api-models 0.0.2-next.3 → 0.0.2-next.6

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.
@@ -14,4 +14,8 @@ export interface IHttpRequestContext extends IHttpRequestIdentity {
14
14
  processorState: {
15
15
  [id: string]: unknown;
16
16
  };
17
+ /**
18
+ * Logging component type for the request.
19
+ */
20
+ loggingComponentType?: string;
17
21
  }
@@ -14,11 +14,12 @@ export interface IBaseRouteProcessor<T = IBaseRoute, R = IHttpServerRequest> ext
14
14
  * @param route The route being requested, if a matching one was found.
15
15
  * @param requestIdentity The identity context for the request.
16
16
  * @param processorState The state handed through the processors.
17
+ * @param loggingComponentType The logging component type for the request.
17
18
  * @returns Promise that resolves when the request is processed.
18
19
  */
19
20
  pre?(request: R, response: IHttpResponse, route: T | undefined, requestIdentity: IHttpRequestIdentity, processorState: {
20
21
  [id: string]: unknown;
21
- }): Promise<void>;
22
+ }, loggingComponentType?: string): Promise<void>;
22
23
  /**
23
24
  * Post process the REST request for the specified route.
24
25
  * @param request The request to handle.
@@ -26,9 +27,10 @@ export interface IBaseRouteProcessor<T = IBaseRoute, R = IHttpServerRequest> ext
26
27
  * @param route The route being requested, if a matching one was found.
27
28
  * @param requestIdentity The identity context for the request.
28
29
  * @param processorState The state handed through the processors.
30
+ * @param loggingComponentType The logging component type for the request.
29
31
  * @returns Promise that resolves when the request is processed.
30
32
  */
31
33
  post?(request: R, response: IHttpResponse, route: T | undefined, requestIdentity: IHttpRequestIdentity, processorState: {
32
34
  [id: string]: unknown;
33
- }): Promise<void>;
35
+ }, loggingComponentType?: string): Promise<void>;
34
36
  }
@@ -14,9 +14,10 @@ export interface IRestRouteProcessor extends IBaseRouteProcessor<IRestRoute> {
14
14
  * @param route The route being requested, if a matching one was found.
15
15
  * @param requestIdentity The identity context for the request.
16
16
  * @param processorState The state handed through the processors.
17
+ * @param loggingComponentType The logging component type for the request.
17
18
  * @returns Promise that resolves when the request is processed.
18
19
  */
19
20
  process?(request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined, requestIdentity: IHttpRequestIdentity, processorState: {
20
21
  [id: string]: unknown;
21
- }): Promise<void>;
22
+ }, loggingComponentType?: string): Promise<void>;
22
23
  }
@@ -11,16 +11,18 @@ export interface ISocketRouteProcessor extends IBaseRouteProcessor<ISocketRoute,
11
11
  * Process the connected event.
12
12
  * @param request The server request object containing the socket id and other parameters.
13
13
  * @param route The route being requested, if a matching one was found.
14
+ * @param loggingComponentType The logging component type for the request.
14
15
  * @returns Promise that resolves when the request is processed.
15
16
  */
16
- connected?(request: ISocketServerRequest, route: ISocketRoute | undefined): Promise<void>;
17
+ connected?(request: ISocketServerRequest, route: ISocketRoute | undefined, loggingComponentType?: string): Promise<void>;
17
18
  /**
18
19
  * Process the disconnected event.
19
20
  * @param request The server request object containing the socket id and other parameters.
20
21
  * @param route The route being requested, if a matching one was found.
22
+ * @param loggingComponentType The logging component type for the request.
21
23
  * @returns Promise that resolves when the request is processed.
22
24
  */
23
- disconnected?(request: ISocketServerRequest, route: ISocketRoute | undefined): Promise<void>;
25
+ disconnected?(request: ISocketServerRequest, route: ISocketRoute | undefined, loggingComponentType?: string): Promise<void>;
24
26
  /**
25
27
  * Process the REST request for the specified route.
26
28
  * @param request The server request object containing the socket id and other parameters.
@@ -29,9 +31,10 @@ export interface ISocketRouteProcessor extends IBaseRouteProcessor<ISocketRoute,
29
31
  * @param requestIdentity The identity context for the request.
30
32
  * @param processorState The state handed through the processors.
31
33
  * @param responseEmitter The function to emit a response.
34
+ * @param loggingComponentType The logging component type for the request.
32
35
  * @returns Promise that resolves when the request is processed.
33
36
  */
34
37
  process?(request: ISocketServerRequest, response: IHttpResponse, route: ISocketRoute | undefined, requestIdentity: IHttpRequestIdentity, processorState: {
35
38
  [id: string]: unknown;
36
- }, responseEmitter: (topic: string, response: IHttpResponse) => Promise<void>): Promise<void>;
39
+ }, responseEmitter: (topic: string, response: IHttpResponse) => Promise<void>, loggingComponentType?: string): Promise<void>;
37
40
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @twin.org/api-models - Changelog
2
2
 
3
+ ## [0.0.2-next.6](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.5...api-models-v0.0.2-next.6) (2025-08-19)
4
+
5
+
6
+ ### Features
7
+
8
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
9
+
10
+ ## [0.0.2-next.5](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.4...api-models-v0.0.2-next.5) (2025-07-25)
11
+
12
+
13
+ ### Features
14
+
15
+ * add logging component type to request contexts ([210de1b](https://github.com/twinfoundation/api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
16
+ * add socket id, connect and disconnect ([20b0d0e](https://github.com/twinfoundation/api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
17
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
18
+ * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/twinfoundation/api/commit/6452b153af786eee14b21152420f8a2578b70593))
19
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
20
+ * validationError mapped to http status badrequest ([adc5eb1](https://github.com/twinfoundation/api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
21
+
22
+ ## [0.0.2-next.4](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.3...api-models-v0.0.2-next.4) (2025-07-25)
23
+
24
+
25
+ ### Features
26
+
27
+ * add logging component type to request contexts ([210de1b](https://github.com/twinfoundation/api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
28
+
3
29
  ## [0.0.2-next.3](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.2...api-models-v0.0.2-next.3) (2025-07-24)
4
30
 
5
31
 
@@ -25,7 +25,7 @@ The definition for a base processor for handling REST routes.
25
25
 
26
26
  ### pre()?
27
27
 
28
- > `optional` **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
28
+ > `optional` **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
29
29
 
30
30
  Pre process the REST request for the specified route.
31
31
 
@@ -59,6 +59,12 @@ The identity context for the request.
59
59
 
60
60
  The state handed through the processors.
61
61
 
62
+ ##### loggingComponentType?
63
+
64
+ `string`
65
+
66
+ The logging component type for the request.
67
+
62
68
  #### Returns
63
69
 
64
70
  `Promise`\<`void`\>
@@ -69,7 +75,7 @@ Promise that resolves when the request is processed.
69
75
 
70
76
  ### post()?
71
77
 
72
- > `optional` **post**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
78
+ > `optional` **post**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
73
79
 
74
80
  Post process the REST request for the specified route.
75
81
 
@@ -103,6 +109,12 @@ The identity context for the request.
103
109
 
104
110
  The state handed through the processors.
105
111
 
112
+ ##### loggingComponentType?
113
+
114
+ `string`
115
+
116
+ The logging component type for the request.
117
+
106
118
  #### Returns
107
119
 
108
120
  `Promise`\<`void`\>
@@ -32,6 +32,14 @@ The state handed through the processors.
32
32
 
33
33
  ***
34
34
 
35
+ ### loggingComponentType?
36
+
37
+ > `optional` **loggingComponentType**: `string`
38
+
39
+ Logging component type for the request.
40
+
41
+ ***
42
+
35
43
  ### nodeIdentity?
36
44
 
37
45
  > `optional` **nodeIdentity**: `string`
@@ -10,7 +10,7 @@ The definition for a processor for handling REST routes.
10
10
 
11
11
  ### pre()?
12
12
 
13
- > `optional` **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
13
+ > `optional` **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
14
14
 
15
15
  Pre process the REST request for the specified route.
16
16
 
@@ -44,6 +44,12 @@ The identity context for the request.
44
44
 
45
45
  The state handed through the processors.
46
46
 
47
+ ##### loggingComponentType?
48
+
49
+ `string`
50
+
51
+ The logging component type for the request.
52
+
47
53
  #### Returns
48
54
 
49
55
  `Promise`\<`void`\>
@@ -58,7 +64,7 @@ Promise that resolves when the request is processed.
58
64
 
59
65
  ### post()?
60
66
 
61
- > `optional` **post**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
67
+ > `optional` **post**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
62
68
 
63
69
  Post process the REST request for the specified route.
64
70
 
@@ -92,6 +98,12 @@ The identity context for the request.
92
98
 
93
99
  The state handed through the processors.
94
100
 
101
+ ##### loggingComponentType?
102
+
103
+ `string`
104
+
105
+ The logging component type for the request.
106
+
95
107
  #### Returns
96
108
 
97
109
  `Promise`\<`void`\>
@@ -106,7 +118,7 @@ Promise that resolves when the request is processed.
106
118
 
107
119
  ### process()?
108
120
 
109
- > `optional` **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
121
+ > `optional` **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
110
122
 
111
123
  Process the REST request for the specified route.
112
124
 
@@ -140,6 +152,12 @@ The identity context for the request.
140
152
 
141
153
  The state handed through the processors.
142
154
 
155
+ ##### loggingComponentType?
156
+
157
+ `string`
158
+
159
+ The logging component type for the request.
160
+
143
161
  #### Returns
144
162
 
145
163
  `Promise`\<`void`\>
@@ -36,6 +36,18 @@ The state handed through the processors.
36
36
 
37
37
  ***
38
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
+
39
51
  ### nodeIdentity?
40
52
 
41
53
  > `optional` **nodeIdentity**: `string`
@@ -10,7 +10,7 @@ The definition for a processor for handling socket routes.
10
10
 
11
11
  ### pre()?
12
12
 
13
- > `optional` **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
13
+ > `optional` **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
14
14
 
15
15
  Pre process the REST request for the specified route.
16
16
 
@@ -44,6 +44,12 @@ The identity context for the request.
44
44
 
45
45
  The state handed through the processors.
46
46
 
47
+ ##### loggingComponentType?
48
+
49
+ `string`
50
+
51
+ The logging component type for the request.
52
+
47
53
  #### Returns
48
54
 
49
55
  `Promise`\<`void`\>
@@ -58,7 +64,7 @@ Promise that resolves when the request is processed.
58
64
 
59
65
  ### post()?
60
66
 
61
- > `optional` **post**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
67
+ > `optional` **post**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
62
68
 
63
69
  Post process the REST request for the specified route.
64
70
 
@@ -92,6 +98,12 @@ The identity context for the request.
92
98
 
93
99
  The state handed through the processors.
94
100
 
101
+ ##### loggingComponentType?
102
+
103
+ `string`
104
+
105
+ The logging component type for the request.
106
+
95
107
  #### Returns
96
108
 
97
109
  `Promise`\<`void`\>
@@ -106,7 +118,7 @@ Promise that resolves when the request is processed.
106
118
 
107
119
  ### connected()?
108
120
 
109
- > `optional` **connected**(`request`, `route`): `Promise`\<`void`\>
121
+ > `optional` **connected**(`request`, `route`, `loggingComponentType?`): `Promise`\<`void`\>
110
122
 
111
123
  Process the connected event.
112
124
 
@@ -124,6 +136,12 @@ The route being requested, if a matching one was found.
124
136
 
125
137
  `undefined` | [`ISocketRoute`](ISocketRoute.md)\<`any`, `any`\>
126
138
 
139
+ ##### loggingComponentType?
140
+
141
+ `string`
142
+
143
+ The logging component type for the request.
144
+
127
145
  #### Returns
128
146
 
129
147
  `Promise`\<`void`\>
@@ -134,7 +152,7 @@ Promise that resolves when the request is processed.
134
152
 
135
153
  ### disconnected()?
136
154
 
137
- > `optional` **disconnected**(`request`, `route`): `Promise`\<`void`\>
155
+ > `optional` **disconnected**(`request`, `route`, `loggingComponentType?`): `Promise`\<`void`\>
138
156
 
139
157
  Process the disconnected event.
140
158
 
@@ -152,6 +170,12 @@ The route being requested, if a matching one was found.
152
170
 
153
171
  `undefined` | [`ISocketRoute`](ISocketRoute.md)\<`any`, `any`\>
154
172
 
173
+ ##### loggingComponentType?
174
+
175
+ `string`
176
+
177
+ The logging component type for the request.
178
+
155
179
  #### Returns
156
180
 
157
181
  `Promise`\<`void`\>
@@ -162,7 +186,7 @@ Promise that resolves when the request is processed.
162
186
 
163
187
  ### process()?
164
188
 
165
- > `optional` **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `responseEmitter`): `Promise`\<`void`\>
189
+ > `optional` **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `responseEmitter`, `loggingComponentType?`): `Promise`\<`void`\>
166
190
 
167
191
  Process the REST request for the specified route.
168
192
 
@@ -202,6 +226,12 @@ The state handed through the processors.
202
226
 
203
227
  The function to emit a response.
204
228
 
229
+ ##### loggingComponentType?
230
+
231
+ `string`
232
+
233
+ The logging component type for the request.
234
+
205
235
  #### Returns
206
236
 
207
237
  `Promise`\<`void`\>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/api-models",
3
- "version": "0.0.2-next.3",
3
+ "version": "0.0.2-next.6",
4
4
  "description": "Contains models and classes for use with APIs",
5
5
  "repository": {
6
6
  "type": "git",