@twin.org/api-processors 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.
- package/dist/cjs/index.cjs +25 -28
- package/dist/esm/index.mjs +26 -29
- package/dist/types/data/restRouteProcessor.d.ts +2 -1
- package/dist/types/data/socketRouteProcessor.d.ts +6 -3
- package/dist/types/identity/nodeIdentityProcessor.d.ts +2 -2
- package/dist/types/models/ILoggingProcessorConstructorOptions.d.ts +3 -4
- package/docs/changelog.md +47 -0
- package/docs/reference/classes/NodeIdentityProcessor.md +3 -3
- package/docs/reference/classes/RestRouteProcessor.md +7 -1
- package/docs/reference/classes/SocketRouteProcessor.md +21 -3
- package/docs/reference/interfaces/ILoggingProcessorConstructorOptions.md +5 -9
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var apiModels = require('@twin.org/api-models');
|
|
4
4
|
var core = require('@twin.org/core');
|
|
5
5
|
var web = require('@twin.org/web');
|
|
6
|
-
var loggingModels = require('@twin.org/logging-models');
|
|
7
6
|
|
|
8
7
|
// Copyright 2024 IOTA Stiftung.
|
|
9
8
|
// SPDX-License-Identifier: Apache-2.0.
|
|
@@ -34,8 +33,9 @@ class RestRouteProcessor {
|
|
|
34
33
|
* @param route The route to process.
|
|
35
34
|
* @param requestIdentity The identity context for the request.
|
|
36
35
|
* @param processorState The state handed through the processors.
|
|
36
|
+
* @param loggingComponentType The logging component type for the request.
|
|
37
37
|
*/
|
|
38
|
-
async process(request, response, route, requestIdentity, processorState) {
|
|
38
|
+
async process(request, response, route, requestIdentity, processorState, loggingComponentType) {
|
|
39
39
|
// Don't handle the route if another processor has already set the response
|
|
40
40
|
// status code e.g. from an auth processor
|
|
41
41
|
if (core.Is.empty(response.statusCode)) {
|
|
@@ -58,7 +58,8 @@ class RestRouteProcessor {
|
|
|
58
58
|
const restRouteResponse = await route.handler({
|
|
59
59
|
...requestIdentity,
|
|
60
60
|
serverRequest: request,
|
|
61
|
-
processorState
|
|
61
|
+
processorState,
|
|
62
|
+
loggingComponentType
|
|
62
63
|
}, req);
|
|
63
64
|
let statusCode = restRouteResponse.statusCode ?? response.statusCode ?? web.HttpStatusCode.ok;
|
|
64
65
|
const headers = restRouteResponse?.headers ?? {};
|
|
@@ -136,20 +137,17 @@ class SocketRouteProcessor {
|
|
|
136
137
|
* Process the connected event.
|
|
137
138
|
* @param request The server request object containing the socket id and other parameters.
|
|
138
139
|
* @param route The route being requested, if a matching one was found.
|
|
140
|
+
* @param loggingComponentType The logging component type for the request.
|
|
139
141
|
* @returns Promise that resolves when the request is processed.
|
|
140
142
|
*/
|
|
141
|
-
async connected(request, route) {
|
|
143
|
+
async connected(request, route, loggingComponentType) {
|
|
142
144
|
if (route?.connected) {
|
|
143
145
|
try {
|
|
144
|
-
const req = {
|
|
145
|
-
pathParams: request.pathParams,
|
|
146
|
-
query: request.query,
|
|
147
|
-
body: request.body
|
|
148
|
-
};
|
|
149
146
|
const socketRequestContext = {
|
|
150
147
|
socketId: request.socketId,
|
|
151
|
-
serverRequest:
|
|
152
|
-
processorState: {}
|
|
148
|
+
serverRequest: request,
|
|
149
|
+
processorState: {},
|
|
150
|
+
loggingComponentType
|
|
153
151
|
};
|
|
154
152
|
await route.connected(socketRequestContext);
|
|
155
153
|
}
|
|
@@ -160,20 +158,17 @@ class SocketRouteProcessor {
|
|
|
160
158
|
* Process the disconnected event.
|
|
161
159
|
* @param request The server request object containing the socket id and other parameters.
|
|
162
160
|
* @param route The route being requested, if a matching one was found.
|
|
161
|
+
* @param loggingComponentType The logging component type for the request.
|
|
163
162
|
* @returns Promise that resolves when the request is processed.
|
|
164
163
|
*/
|
|
165
|
-
async disconnected(request, route) {
|
|
164
|
+
async disconnected(request, route, loggingComponentType) {
|
|
166
165
|
if (route?.disconnected) {
|
|
167
166
|
try {
|
|
168
|
-
const req = {
|
|
169
|
-
pathParams: request.pathParams,
|
|
170
|
-
query: request.query,
|
|
171
|
-
body: request.body
|
|
172
|
-
};
|
|
173
167
|
const socketRequestContext = {
|
|
174
168
|
socketId: request.socketId,
|
|
175
|
-
serverRequest:
|
|
176
|
-
processorState: {}
|
|
169
|
+
serverRequest: request,
|
|
170
|
+
processorState: {},
|
|
171
|
+
loggingComponentType
|
|
177
172
|
};
|
|
178
173
|
await route.disconnected(socketRequestContext);
|
|
179
174
|
}
|
|
@@ -188,8 +183,9 @@ class SocketRouteProcessor {
|
|
|
188
183
|
* @param requestIdentity The identity context for the request.
|
|
189
184
|
* @param processorState The state handed through the processors.
|
|
190
185
|
* @param responseEmitter The function to emit a response.
|
|
186
|
+
* @param loggingComponentType The logging component type for the request.
|
|
191
187
|
*/
|
|
192
|
-
async process(request, response, route, requestIdentity, processorState, responseEmitter) {
|
|
188
|
+
async process(request, response, route, requestIdentity, processorState, responseEmitter, loggingComponentType) {
|
|
193
189
|
// Don't handle the route if another processor has already set the response
|
|
194
190
|
// status code e.g. from an auth processor
|
|
195
191
|
if (core.Is.empty(response.statusCode)) {
|
|
@@ -213,7 +209,8 @@ class SocketRouteProcessor {
|
|
|
213
209
|
...requestIdentity,
|
|
214
210
|
socketId: request.socketId,
|
|
215
211
|
serverRequest: request,
|
|
216
|
-
processorState
|
|
212
|
+
processorState,
|
|
213
|
+
loggingComponentType
|
|
217
214
|
};
|
|
218
215
|
await route.handler(socketRequestContext, req, async (topic, restRouteResponse) => {
|
|
219
216
|
response.headers = restRouteResponse?.headers;
|
|
@@ -248,10 +245,10 @@ class NodeIdentityProcessor {
|
|
|
248
245
|
/**
|
|
249
246
|
* The service needs to be started when the application is initialized.
|
|
250
247
|
* @param nodeIdentity The identity of the node.
|
|
251
|
-
* @param
|
|
248
|
+
* @param nodeLoggingComponentType The node logging component type.
|
|
252
249
|
* @returns Nothing.
|
|
253
250
|
*/
|
|
254
|
-
async start(nodeIdentity,
|
|
251
|
+
async start(nodeIdentity, nodeLoggingComponentType) {
|
|
255
252
|
core.Guards.string(this.CLASS_NAME, "nodeIdentity", nodeIdentity);
|
|
256
253
|
this._nodeIdentity = nodeIdentity;
|
|
257
254
|
}
|
|
@@ -315,10 +312,10 @@ class LoggingProcessor {
|
|
|
315
312
|
*/
|
|
316
313
|
CLASS_NAME = "LoggingProcessor";
|
|
317
314
|
/**
|
|
318
|
-
* The
|
|
315
|
+
* The component for logging the information.
|
|
319
316
|
* @internal
|
|
320
317
|
*/
|
|
321
|
-
|
|
318
|
+
_loggingComponent;
|
|
322
319
|
/**
|
|
323
320
|
* Include the body objects when logging the information.
|
|
324
321
|
* @internal
|
|
@@ -339,7 +336,7 @@ class LoggingProcessor {
|
|
|
339
336
|
* @param options Options for the processor.
|
|
340
337
|
*/
|
|
341
338
|
constructor(options) {
|
|
342
|
-
this.
|
|
339
|
+
this._loggingComponent = core.ComponentFactory.get(options?.loggingComponentType ?? "logging");
|
|
343
340
|
this._includeBody = options?.config?.includeBody ?? false;
|
|
344
341
|
this._fullBase64 = options?.config?.fullBase64 ?? false;
|
|
345
342
|
this._obfuscateProperties = options?.config?.obfuscateProperties ?? ["password"];
|
|
@@ -369,7 +366,7 @@ class LoggingProcessor {
|
|
|
369
366
|
requestUrl = request.url;
|
|
370
367
|
}
|
|
371
368
|
}
|
|
372
|
-
await this.
|
|
369
|
+
await this._loggingComponent.log({
|
|
373
370
|
level: "info",
|
|
374
371
|
source: this.CLASS_NAME,
|
|
375
372
|
ts: Date.now(),
|
|
@@ -429,7 +426,7 @@ class LoggingProcessor {
|
|
|
429
426
|
requestUrl = request.url;
|
|
430
427
|
}
|
|
431
428
|
}
|
|
432
|
-
await this.
|
|
429
|
+
await this._loggingComponent.log({
|
|
433
430
|
level: core.Is.number(response.statusCode) && response.statusCode >= web.HttpStatusCode.badRequest
|
|
434
431
|
? "error"
|
|
435
432
|
: "info",
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { HttpErrorHelper } from '@twin.org/api-models';
|
|
2
|
-
import { Is, NotFoundError, Guards, ObjectHelper, Coerce, GeneralError, Converter } from '@twin.org/core';
|
|
2
|
+
import { Is, NotFoundError, Guards, ComponentFactory, ObjectHelper, Coerce, GeneralError, Converter } from '@twin.org/core';
|
|
3
3
|
import { HttpStatusCode, HeaderTypes, MimeTypes } from '@twin.org/web';
|
|
4
|
-
import { LoggingConnectorFactory } from '@twin.org/logging-models';
|
|
5
4
|
|
|
6
5
|
// Copyright 2024 IOTA Stiftung.
|
|
7
6
|
// SPDX-License-Identifier: Apache-2.0.
|
|
@@ -32,8 +31,9 @@ class RestRouteProcessor {
|
|
|
32
31
|
* @param route The route to process.
|
|
33
32
|
* @param requestIdentity The identity context for the request.
|
|
34
33
|
* @param processorState The state handed through the processors.
|
|
34
|
+
* @param loggingComponentType The logging component type for the request.
|
|
35
35
|
*/
|
|
36
|
-
async process(request, response, route, requestIdentity, processorState) {
|
|
36
|
+
async process(request, response, route, requestIdentity, processorState, loggingComponentType) {
|
|
37
37
|
// Don't handle the route if another processor has already set the response
|
|
38
38
|
// status code e.g. from an auth processor
|
|
39
39
|
if (Is.empty(response.statusCode)) {
|
|
@@ -56,7 +56,8 @@ class RestRouteProcessor {
|
|
|
56
56
|
const restRouteResponse = await route.handler({
|
|
57
57
|
...requestIdentity,
|
|
58
58
|
serverRequest: request,
|
|
59
|
-
processorState
|
|
59
|
+
processorState,
|
|
60
|
+
loggingComponentType
|
|
60
61
|
}, req);
|
|
61
62
|
let statusCode = restRouteResponse.statusCode ?? response.statusCode ?? HttpStatusCode.ok;
|
|
62
63
|
const headers = restRouteResponse?.headers ?? {};
|
|
@@ -134,20 +135,17 @@ class SocketRouteProcessor {
|
|
|
134
135
|
* Process the connected event.
|
|
135
136
|
* @param request The server request object containing the socket id and other parameters.
|
|
136
137
|
* @param route The route being requested, if a matching one was found.
|
|
138
|
+
* @param loggingComponentType The logging component type for the request.
|
|
137
139
|
* @returns Promise that resolves when the request is processed.
|
|
138
140
|
*/
|
|
139
|
-
async connected(request, route) {
|
|
141
|
+
async connected(request, route, loggingComponentType) {
|
|
140
142
|
if (route?.connected) {
|
|
141
143
|
try {
|
|
142
|
-
const req = {
|
|
143
|
-
pathParams: request.pathParams,
|
|
144
|
-
query: request.query,
|
|
145
|
-
body: request.body
|
|
146
|
-
};
|
|
147
144
|
const socketRequestContext = {
|
|
148
145
|
socketId: request.socketId,
|
|
149
|
-
serverRequest:
|
|
150
|
-
processorState: {}
|
|
146
|
+
serverRequest: request,
|
|
147
|
+
processorState: {},
|
|
148
|
+
loggingComponentType
|
|
151
149
|
};
|
|
152
150
|
await route.connected(socketRequestContext);
|
|
153
151
|
}
|
|
@@ -158,20 +156,17 @@ class SocketRouteProcessor {
|
|
|
158
156
|
* Process the disconnected event.
|
|
159
157
|
* @param request The server request object containing the socket id and other parameters.
|
|
160
158
|
* @param route The route being requested, if a matching one was found.
|
|
159
|
+
* @param loggingComponentType The logging component type for the request.
|
|
161
160
|
* @returns Promise that resolves when the request is processed.
|
|
162
161
|
*/
|
|
163
|
-
async disconnected(request, route) {
|
|
162
|
+
async disconnected(request, route, loggingComponentType) {
|
|
164
163
|
if (route?.disconnected) {
|
|
165
164
|
try {
|
|
166
|
-
const req = {
|
|
167
|
-
pathParams: request.pathParams,
|
|
168
|
-
query: request.query,
|
|
169
|
-
body: request.body
|
|
170
|
-
};
|
|
171
165
|
const socketRequestContext = {
|
|
172
166
|
socketId: request.socketId,
|
|
173
|
-
serverRequest:
|
|
174
|
-
processorState: {}
|
|
167
|
+
serverRequest: request,
|
|
168
|
+
processorState: {},
|
|
169
|
+
loggingComponentType
|
|
175
170
|
};
|
|
176
171
|
await route.disconnected(socketRequestContext);
|
|
177
172
|
}
|
|
@@ -186,8 +181,9 @@ class SocketRouteProcessor {
|
|
|
186
181
|
* @param requestIdentity The identity context for the request.
|
|
187
182
|
* @param processorState The state handed through the processors.
|
|
188
183
|
* @param responseEmitter The function to emit a response.
|
|
184
|
+
* @param loggingComponentType The logging component type for the request.
|
|
189
185
|
*/
|
|
190
|
-
async process(request, response, route, requestIdentity, processorState, responseEmitter) {
|
|
186
|
+
async process(request, response, route, requestIdentity, processorState, responseEmitter, loggingComponentType) {
|
|
191
187
|
// Don't handle the route if another processor has already set the response
|
|
192
188
|
// status code e.g. from an auth processor
|
|
193
189
|
if (Is.empty(response.statusCode)) {
|
|
@@ -211,7 +207,8 @@ class SocketRouteProcessor {
|
|
|
211
207
|
...requestIdentity,
|
|
212
208
|
socketId: request.socketId,
|
|
213
209
|
serverRequest: request,
|
|
214
|
-
processorState
|
|
210
|
+
processorState,
|
|
211
|
+
loggingComponentType
|
|
215
212
|
};
|
|
216
213
|
await route.handler(socketRequestContext, req, async (topic, restRouteResponse) => {
|
|
217
214
|
response.headers = restRouteResponse?.headers;
|
|
@@ -246,10 +243,10 @@ class NodeIdentityProcessor {
|
|
|
246
243
|
/**
|
|
247
244
|
* The service needs to be started when the application is initialized.
|
|
248
245
|
* @param nodeIdentity The identity of the node.
|
|
249
|
-
* @param
|
|
246
|
+
* @param nodeLoggingComponentType The node logging component type.
|
|
250
247
|
* @returns Nothing.
|
|
251
248
|
*/
|
|
252
|
-
async start(nodeIdentity,
|
|
249
|
+
async start(nodeIdentity, nodeLoggingComponentType) {
|
|
253
250
|
Guards.string(this.CLASS_NAME, "nodeIdentity", nodeIdentity);
|
|
254
251
|
this._nodeIdentity = nodeIdentity;
|
|
255
252
|
}
|
|
@@ -313,10 +310,10 @@ class LoggingProcessor {
|
|
|
313
310
|
*/
|
|
314
311
|
CLASS_NAME = "LoggingProcessor";
|
|
315
312
|
/**
|
|
316
|
-
* The
|
|
313
|
+
* The component for logging the information.
|
|
317
314
|
* @internal
|
|
318
315
|
*/
|
|
319
|
-
|
|
316
|
+
_loggingComponent;
|
|
320
317
|
/**
|
|
321
318
|
* Include the body objects when logging the information.
|
|
322
319
|
* @internal
|
|
@@ -337,7 +334,7 @@ class LoggingProcessor {
|
|
|
337
334
|
* @param options Options for the processor.
|
|
338
335
|
*/
|
|
339
336
|
constructor(options) {
|
|
340
|
-
this.
|
|
337
|
+
this._loggingComponent = ComponentFactory.get(options?.loggingComponentType ?? "logging");
|
|
341
338
|
this._includeBody = options?.config?.includeBody ?? false;
|
|
342
339
|
this._fullBase64 = options?.config?.fullBase64 ?? false;
|
|
343
340
|
this._obfuscateProperties = options?.config?.obfuscateProperties ?? ["password"];
|
|
@@ -367,7 +364,7 @@ class LoggingProcessor {
|
|
|
367
364
|
requestUrl = request.url;
|
|
368
365
|
}
|
|
369
366
|
}
|
|
370
|
-
await this.
|
|
367
|
+
await this._loggingComponent.log({
|
|
371
368
|
level: "info",
|
|
372
369
|
source: this.CLASS_NAME,
|
|
373
370
|
ts: Date.now(),
|
|
@@ -427,7 +424,7 @@ class LoggingProcessor {
|
|
|
427
424
|
requestUrl = request.url;
|
|
428
425
|
}
|
|
429
426
|
}
|
|
430
|
-
await this.
|
|
427
|
+
await this._loggingComponent.log({
|
|
431
428
|
level: Is.number(response.statusCode) && response.statusCode >= HttpStatusCode.badRequest
|
|
432
429
|
? "error"
|
|
433
430
|
: "info",
|
|
@@ -20,8 +20,9 @@ export declare class RestRouteProcessor implements IRestRouteProcessor {
|
|
|
20
20
|
* @param route The route to process.
|
|
21
21
|
* @param requestIdentity The identity context for the request.
|
|
22
22
|
* @param processorState The state handed through the processors.
|
|
23
|
+
* @param loggingComponentType The logging component type for the request.
|
|
23
24
|
*/
|
|
24
25
|
process(request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined, requestIdentity: IHttpRequestIdentity, processorState: {
|
|
25
26
|
[id: string]: unknown;
|
|
26
|
-
}): Promise<void>;
|
|
27
|
+
}, loggingComponentType?: string): Promise<void>;
|
|
27
28
|
}
|
|
@@ -17,16 +17,18 @@ export declare class SocketRouteProcessor implements ISocketRouteProcessor {
|
|
|
17
17
|
* Process the connected event.
|
|
18
18
|
* @param request The server request object containing the socket id and other parameters.
|
|
19
19
|
* @param route The route being requested, if a matching one was found.
|
|
20
|
+
* @param loggingComponentType The logging component type for the request.
|
|
20
21
|
* @returns Promise that resolves when the request is processed.
|
|
21
22
|
*/
|
|
22
|
-
connected(request: ISocketServerRequest, route: ISocketRoute | undefined): Promise<void>;
|
|
23
|
+
connected(request: ISocketServerRequest, route: ISocketRoute | undefined, loggingComponentType?: string): Promise<void>;
|
|
23
24
|
/**
|
|
24
25
|
* Process the disconnected event.
|
|
25
26
|
* @param request The server request object containing the socket id and other parameters.
|
|
26
27
|
* @param route The route being requested, if a matching one was found.
|
|
28
|
+
* @param loggingComponentType The logging component type for the request.
|
|
27
29
|
* @returns Promise that resolves when the request is processed.
|
|
28
30
|
*/
|
|
29
|
-
disconnected(request: ISocketServerRequest, route: ISocketRoute | undefined): Promise<void>;
|
|
31
|
+
disconnected(request: ISocketServerRequest, route: ISocketRoute | undefined, loggingComponentType?: string): Promise<void>;
|
|
30
32
|
/**
|
|
31
33
|
* Process the REST request for the specified route.
|
|
32
34
|
* @param request The incoming request.
|
|
@@ -35,8 +37,9 @@ export declare class SocketRouteProcessor implements ISocketRouteProcessor {
|
|
|
35
37
|
* @param requestIdentity The identity context for the request.
|
|
36
38
|
* @param processorState The state handed through the processors.
|
|
37
39
|
* @param responseEmitter The function to emit a response.
|
|
40
|
+
* @param loggingComponentType The logging component type for the request.
|
|
38
41
|
*/
|
|
39
42
|
process(request: ISocketServerRequest, response: IHttpResponse, route: ISocketRoute | undefined, requestIdentity: IHttpRequestIdentity, processorState: {
|
|
40
43
|
[id: string]: unknown;
|
|
41
|
-
}, responseEmitter: (topic: string, response: IHttpResponse) => Promise<void
|
|
44
|
+
}, responseEmitter: (topic: string, response: IHttpResponse) => Promise<void>, loggingComponentType?: string): Promise<void>;
|
|
42
45
|
}
|
|
@@ -10,10 +10,10 @@ export declare class NodeIdentityProcessor implements IBaseRouteProcessor {
|
|
|
10
10
|
/**
|
|
11
11
|
* The service needs to be started when the application is initialized.
|
|
12
12
|
* @param nodeIdentity The identity of the node.
|
|
13
|
-
* @param
|
|
13
|
+
* @param nodeLoggingComponentType The node logging component type.
|
|
14
14
|
* @returns Nothing.
|
|
15
15
|
*/
|
|
16
|
-
start(nodeIdentity: string,
|
|
16
|
+
start(nodeIdentity: string, nodeLoggingComponentType?: string): Promise<void>;
|
|
17
17
|
/**
|
|
18
18
|
* Pre process the REST request for the specified route.
|
|
19
19
|
* @param request The incoming request.
|
|
@@ -4,12 +4,11 @@ import type { ILoggingProcessorConfig } from "./ILoggingProcessorConfig";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface ILoggingProcessorConstructorOptions {
|
|
6
6
|
/**
|
|
7
|
-
* The type for the logging
|
|
8
|
-
* @default logging
|
|
7
|
+
* The type for the logging component.
|
|
9
8
|
*/
|
|
10
|
-
|
|
9
|
+
loggingComponentType?: string;
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
11
|
+
* The configuration for the logging processor.
|
|
13
12
|
*/
|
|
14
13
|
config?: ILoggingProcessorConfig;
|
|
15
14
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# @twin.org/api-processors - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-next.6](https://github.com/twinfoundation/api/compare/api-processors-v0.0.2-next.5...api-processors-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
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/api-models bumped from 0.0.2-next.5 to 0.0.2-next.6
|
|
16
|
+
|
|
17
|
+
## [0.0.2-next.5](https://github.com/twinfoundation/api/compare/api-processors-v0.0.2-next.4...api-processors-v0.0.2-next.5) (2025-07-25)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add json-ld mime type processor and auth admin component ([8861791](https://github.com/twinfoundation/api/commit/88617916e23bfbca023dbae1976fe421983a02ff))
|
|
23
|
+
* add logging component type to request contexts ([210de1b](https://github.com/twinfoundation/api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
|
|
24
|
+
* add socket id, connect and disconnect ([20b0d0e](https://github.com/twinfoundation/api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
|
|
25
|
+
* remove unused namespace ([08478f2](https://github.com/twinfoundation/api/commit/08478f27efda9beb0271fdb22f6972e918361965))
|
|
26
|
+
* update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
|
|
27
|
+
* use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Dependencies
|
|
31
|
+
|
|
32
|
+
* The following workspace dependencies were updated
|
|
33
|
+
* dependencies
|
|
34
|
+
* @twin.org/api-models bumped from 0.0.2-next.4 to 0.0.2-next.5
|
|
35
|
+
|
|
36
|
+
## [0.0.2-next.4](https://github.com/twinfoundation/api/compare/api-processors-v0.0.2-next.3...api-processors-v0.0.2-next.4) (2025-07-25)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
* add logging component type to request contexts ([210de1b](https://github.com/twinfoundation/api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Dependencies
|
|
45
|
+
|
|
46
|
+
* The following workspace dependencies were updated
|
|
47
|
+
* dependencies
|
|
48
|
+
* @twin.org/api-models bumped from 0.0.2-next.3 to 0.0.2-next.4
|
|
49
|
+
|
|
3
50
|
## [0.0.2-next.3](https://github.com/twinfoundation/api/compare/api-processors-v0.0.2-next.2...api-processors-v0.0.2-next.3) (2025-07-24)
|
|
4
51
|
|
|
5
52
|
|
|
@@ -32,7 +32,7 @@ Runtime name for the class.
|
|
|
32
32
|
|
|
33
33
|
### start()
|
|
34
34
|
|
|
35
|
-
> **start**(`nodeIdentity`, `
|
|
35
|
+
> **start**(`nodeIdentity`, `nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
36
36
|
|
|
37
37
|
The service needs to be started when the application is initialized.
|
|
38
38
|
|
|
@@ -44,11 +44,11 @@ The service needs to be started when the application is initialized.
|
|
|
44
44
|
|
|
45
45
|
The identity of the node.
|
|
46
46
|
|
|
47
|
-
#####
|
|
47
|
+
##### nodeLoggingComponentType?
|
|
48
48
|
|
|
49
49
|
`string`
|
|
50
50
|
|
|
51
|
-
The node logging
|
|
51
|
+
The node logging component type.
|
|
52
52
|
|
|
53
53
|
#### Returns
|
|
54
54
|
|
|
@@ -42,7 +42,7 @@ Runtime name for the class.
|
|
|
42
42
|
|
|
43
43
|
### process()
|
|
44
44
|
|
|
45
|
-
> **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
|
|
45
|
+
> **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
|
|
46
46
|
|
|
47
47
|
Process the REST request for the specified route.
|
|
48
48
|
|
|
@@ -76,6 +76,12 @@ The identity context for the request.
|
|
|
76
76
|
|
|
77
77
|
The state handed through the processors.
|
|
78
78
|
|
|
79
|
+
##### loggingComponentType?
|
|
80
|
+
|
|
81
|
+
`string`
|
|
82
|
+
|
|
83
|
+
The logging component type for the request.
|
|
84
|
+
|
|
79
85
|
#### Returns
|
|
80
86
|
|
|
81
87
|
`Promise`\<`void`\>
|
|
@@ -42,7 +42,7 @@ Runtime name for the class.
|
|
|
42
42
|
|
|
43
43
|
### connected()
|
|
44
44
|
|
|
45
|
-
> **connected**(`request`, `route`): `Promise`\<`void`\>
|
|
45
|
+
> **connected**(`request`, `route`, `loggingComponentType?`): `Promise`\<`void`\>
|
|
46
46
|
|
|
47
47
|
Process the connected event.
|
|
48
48
|
|
|
@@ -60,6 +60,12 @@ The route being requested, if a matching one was found.
|
|
|
60
60
|
|
|
61
61
|
`undefined` | `ISocketRoute`\<`any`, `any`\>
|
|
62
62
|
|
|
63
|
+
##### loggingComponentType?
|
|
64
|
+
|
|
65
|
+
`string`
|
|
66
|
+
|
|
67
|
+
The logging component type for the request.
|
|
68
|
+
|
|
63
69
|
#### Returns
|
|
64
70
|
|
|
65
71
|
`Promise`\<`void`\>
|
|
@@ -74,7 +80,7 @@ Promise that resolves when the request is processed.
|
|
|
74
80
|
|
|
75
81
|
### disconnected()
|
|
76
82
|
|
|
77
|
-
> **disconnected**(`request`, `route`): `Promise`\<`void`\>
|
|
83
|
+
> **disconnected**(`request`, `route`, `loggingComponentType?`): `Promise`\<`void`\>
|
|
78
84
|
|
|
79
85
|
Process the disconnected event.
|
|
80
86
|
|
|
@@ -92,6 +98,12 @@ The route being requested, if a matching one was found.
|
|
|
92
98
|
|
|
93
99
|
`undefined` | `ISocketRoute`\<`any`, `any`\>
|
|
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
|
-
> **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `responseEmitter`): `Promise`\<`void`\>
|
|
121
|
+
> **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `responseEmitter`, `loggingComponentType?`): `Promise`\<`void`\>
|
|
110
122
|
|
|
111
123
|
Process the REST request for the specified route.
|
|
112
124
|
|
|
@@ -146,6 +158,12 @@ The state handed through the processors.
|
|
|
146
158
|
|
|
147
159
|
The function to emit a response.
|
|
148
160
|
|
|
161
|
+
##### loggingComponentType?
|
|
162
|
+
|
|
163
|
+
`string`
|
|
164
|
+
|
|
165
|
+
The logging component type for the request.
|
|
166
|
+
|
|
149
167
|
#### Returns
|
|
150
168
|
|
|
151
169
|
`Promise`\<`void`\>
|
|
@@ -4,20 +4,16 @@ Options for the LoggingProcessor constructor.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### loggingComponentType?
|
|
8
8
|
|
|
9
|
-
> `optional` **
|
|
9
|
+
> `optional` **loggingComponentType**: `string`
|
|
10
10
|
|
|
11
|
-
The type for the logging
|
|
12
|
-
|
|
13
|
-
#### Default
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
logging
|
|
17
|
-
```
|
|
11
|
+
The type for the logging component.
|
|
18
12
|
|
|
19
13
|
***
|
|
20
14
|
|
|
21
15
|
### config?
|
|
22
16
|
|
|
23
17
|
> `optional` **config**: [`ILoggingProcessorConfig`](ILoggingProcessorConfig.md)
|
|
18
|
+
|
|
19
|
+
The configuration for the logging processor.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/api-processors",
|
|
3
|
-
"version": "0.0.2-next.
|
|
3
|
+
"version": "0.0.2-next.6",
|
|
4
4
|
"description": "Route processors for use with API servers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/api-models": "0.0.2-next.
|
|
17
|
+
"@twin.org/api-models": "0.0.2-next.6",
|
|
18
18
|
"@twin.org/core": "next",
|
|
19
19
|
"@twin.org/logging-models": "next",
|
|
20
20
|
"@twin.org/nameof": "next",
|