@twin.org/api-processors 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/dist/cjs/index.cjs +1 -10
- package/dist/esm/index.mjs +1 -10
- package/dist/types/data/restRouteProcessor.d.ts +2 -6
- package/dist/types/data/socketRouteProcessor.d.ts +2 -6
- package/dist/types/identity/staticUserIdentityProcessor.d.ts +2 -6
- package/dist/types/index.d.ts +4 -0
- package/dist/types/logging/loggingProcessor.d.ts +3 -9
- package/dist/types/models/ILoggingProcessorConstructorOptions.d.ts +15 -0
- package/dist/types/models/IRestRouteProcessorConstructorOptions.d.ts +10 -0
- package/dist/types/models/ISocketRouteProcessorConstructorOptions.d.ts +10 -0
- package/dist/types/models/IStaticUserIdentityProcessorConstructorOptions.d.ts +10 -0
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/JwtMimeTypeProcessor.md +3 -1
- package/docs/reference/classes/LoggingProcessor.md +30 -22
- package/docs/reference/classes/NodeIdentityProcessor.md +19 -7
- package/docs/reference/classes/RestRouteProcessor.md +16 -12
- package/docs/reference/classes/SocketRouteProcessor.md +19 -13
- package/docs/reference/classes/StaticUserIdentityProcessor.md +16 -12
- package/docs/reference/index.md +4 -0
- package/docs/reference/interfaces/ILoggingProcessorConstructorOptions.md +23 -0
- package/docs/reference/interfaces/IRestRouteProcessorConstructorOptions.md +11 -0
- package/docs/reference/interfaces/ISocketRouteProcessorConstructorOptions.md +11 -0
- package/docs/reference/interfaces/IStaticUserIdentityProcessorConstructorOptions.md +11 -0
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -27,8 +27,6 @@ class RestRouteProcessor {
|
|
|
27
27
|
/**
|
|
28
28
|
* Create a new instance of RouteProcessor.
|
|
29
29
|
* @param options Options for the processor.
|
|
30
|
-
* @param options.config The configuration for the processor.
|
|
31
|
-
* @returns Promise that resolves when the processor is initialized.
|
|
32
30
|
*/
|
|
33
31
|
constructor(options) {
|
|
34
32
|
this._includeErrorStack = options?.config?.includeErrorStack ?? false;
|
|
@@ -138,8 +136,6 @@ class SocketRouteProcessor {
|
|
|
138
136
|
/**
|
|
139
137
|
* Create a new instance of SocketRouteProcessor.
|
|
140
138
|
* @param options Options for the processor.
|
|
141
|
-
* @param options.config The configuration for the processor.
|
|
142
|
-
* @returns Promise that resolves when the processor is initialized.
|
|
143
139
|
*/
|
|
144
140
|
constructor(options) {
|
|
145
141
|
this._includeErrorStack = options?.config?.includeErrorStack ?? false;
|
|
@@ -254,8 +250,6 @@ class StaticUserIdentityProcessor {
|
|
|
254
250
|
/**
|
|
255
251
|
* Create a new instance of StaticIdentityProcessor.
|
|
256
252
|
* @param options Options for the processor.
|
|
257
|
-
* @param options.config The configuration for the processor.
|
|
258
|
-
* @returns Promise that resolves when the processor is initialized.
|
|
259
253
|
*/
|
|
260
254
|
constructor(options) {
|
|
261
255
|
core.Guards.object(this.CLASS_NAME, "options", options);
|
|
@@ -311,11 +305,8 @@ class LoggingProcessor {
|
|
|
311
305
|
*/
|
|
312
306
|
_obfuscateProperties;
|
|
313
307
|
/**
|
|
314
|
-
* Create a new instance of
|
|
308
|
+
* Create a new instance of LoggingProcessor.
|
|
315
309
|
* @param options Options for the processor.
|
|
316
|
-
* @param options.loggingConnectorType The type for the logging connector, defaults to "logging".
|
|
317
|
-
* @param options.config The configuration for the processor.
|
|
318
|
-
* @returns Promise that resolves when the processor is initialized.
|
|
319
310
|
*/
|
|
320
311
|
constructor(options) {
|
|
321
312
|
this._loggingConnector = loggingModels.LoggingConnectorFactory.get(options?.loggingConnectorType ?? "logging");
|
package/dist/esm/index.mjs
CHANGED
|
@@ -25,8 +25,6 @@ class RestRouteProcessor {
|
|
|
25
25
|
/**
|
|
26
26
|
* Create a new instance of RouteProcessor.
|
|
27
27
|
* @param options Options for the processor.
|
|
28
|
-
* @param options.config The configuration for the processor.
|
|
29
|
-
* @returns Promise that resolves when the processor is initialized.
|
|
30
28
|
*/
|
|
31
29
|
constructor(options) {
|
|
32
30
|
this._includeErrorStack = options?.config?.includeErrorStack ?? false;
|
|
@@ -136,8 +134,6 @@ class SocketRouteProcessor {
|
|
|
136
134
|
/**
|
|
137
135
|
* Create a new instance of SocketRouteProcessor.
|
|
138
136
|
* @param options Options for the processor.
|
|
139
|
-
* @param options.config The configuration for the processor.
|
|
140
|
-
* @returns Promise that resolves when the processor is initialized.
|
|
141
137
|
*/
|
|
142
138
|
constructor(options) {
|
|
143
139
|
this._includeErrorStack = options?.config?.includeErrorStack ?? false;
|
|
@@ -252,8 +248,6 @@ class StaticUserIdentityProcessor {
|
|
|
252
248
|
/**
|
|
253
249
|
* Create a new instance of StaticIdentityProcessor.
|
|
254
250
|
* @param options Options for the processor.
|
|
255
|
-
* @param options.config The configuration for the processor.
|
|
256
|
-
* @returns Promise that resolves when the processor is initialized.
|
|
257
251
|
*/
|
|
258
252
|
constructor(options) {
|
|
259
253
|
Guards.object(this.CLASS_NAME, "options", options);
|
|
@@ -309,11 +303,8 @@ class LoggingProcessor {
|
|
|
309
303
|
*/
|
|
310
304
|
_obfuscateProperties;
|
|
311
305
|
/**
|
|
312
|
-
* Create a new instance of
|
|
306
|
+
* Create a new instance of LoggingProcessor.
|
|
313
307
|
* @param options Options for the processor.
|
|
314
|
-
* @param options.loggingConnectorType The type for the logging connector, defaults to "logging".
|
|
315
|
-
* @param options.config The configuration for the processor.
|
|
316
|
-
* @returns Promise that resolves when the processor is initialized.
|
|
317
308
|
*/
|
|
318
309
|
constructor(options) {
|
|
319
310
|
this._loggingConnector = LoggingConnectorFactory.get(options?.loggingConnectorType ?? "logging");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IHttpRequestIdentity, type IHttpResponse, type IRestRouteProcessor, type IHttpServerRequest, type IRestRoute } from "@twin.org/api-models";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IRestRouteProcessorConstructorOptions } from "../models/IRestRouteProcessorConstructorOptions";
|
|
3
3
|
/**
|
|
4
4
|
* Process the REST request and hands it on to the route handler.
|
|
5
5
|
*/
|
|
@@ -15,12 +15,8 @@ export declare class RestRouteProcessor implements IRestRouteProcessor {
|
|
|
15
15
|
/**
|
|
16
16
|
* Create a new instance of RouteProcessor.
|
|
17
17
|
* @param options Options for the processor.
|
|
18
|
-
* @param options.config The configuration for the processor.
|
|
19
|
-
* @returns Promise that resolves when the processor is initialized.
|
|
20
18
|
*/
|
|
21
|
-
constructor(options?:
|
|
22
|
-
config?: IRouteProcessorConfig;
|
|
23
|
-
});
|
|
19
|
+
constructor(options?: IRestRouteProcessorConstructorOptions);
|
|
24
20
|
/**
|
|
25
21
|
* Process the REST request for the specified route.
|
|
26
22
|
* @param request The incoming request.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IHttpRequestIdentity, type IHttpResponse, type IHttpServerRequest, type ISocketRoute, type ISocketRouteProcessor } from "@twin.org/api-models";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ISocketRouteProcessorConstructorOptions } from "../models/ISocketRouteProcessorConstructorOptions";
|
|
3
3
|
/**
|
|
4
4
|
* Process the socket request and hands it on to the route handler.
|
|
5
5
|
*/
|
|
@@ -15,12 +15,8 @@ export declare class SocketRouteProcessor implements ISocketRouteProcessor {
|
|
|
15
15
|
/**
|
|
16
16
|
* Create a new instance of SocketRouteProcessor.
|
|
17
17
|
* @param options Options for the processor.
|
|
18
|
-
* @param options.config The configuration for the processor.
|
|
19
|
-
* @returns Promise that resolves when the processor is initialized.
|
|
20
18
|
*/
|
|
21
|
-
constructor(options?:
|
|
22
|
-
config?: IRouteProcessorConfig;
|
|
23
|
-
});
|
|
19
|
+
constructor(options?: ISocketRouteProcessorConstructorOptions);
|
|
24
20
|
/**
|
|
25
21
|
* Process the REST request for the specified route.
|
|
26
22
|
* @param request The incoming request.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IBaseRoute, IBaseRouteProcessor, IHttpRequestIdentity, IHttpResponse, IHttpServerRequest } from "@twin.org/api-models";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IStaticUserIdentityProcessorConstructorOptions } from "../models/IStaticUserIdentityProcessorConstructorOptions";
|
|
3
3
|
/**
|
|
4
4
|
* Adds a static user identity to the request context.
|
|
5
5
|
*/
|
|
@@ -15,12 +15,8 @@ export declare class StaticUserIdentityProcessor implements IBaseRouteProcessor
|
|
|
15
15
|
/**
|
|
16
16
|
* Create a new instance of StaticIdentityProcessor.
|
|
17
17
|
* @param options Options for the processor.
|
|
18
|
-
* @param options.config The configuration for the processor.
|
|
19
|
-
* @returns Promise that resolves when the processor is initialized.
|
|
20
18
|
*/
|
|
21
|
-
constructor(options:
|
|
22
|
-
config: IStaticUserIdentityProcessorConfig;
|
|
23
|
-
});
|
|
19
|
+
constructor(options: IStaticUserIdentityProcessorConstructorOptions);
|
|
24
20
|
/**
|
|
25
21
|
* Pre process the REST request for the specified route.
|
|
26
22
|
* @param request The incoming request.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,5 +5,9 @@ export * from "./identity/staticUserIdentityProcessor";
|
|
|
5
5
|
export * from "./logging/loggingProcessor";
|
|
6
6
|
export * from "./mimeType/jwtMimeTypeProcessor";
|
|
7
7
|
export * from "./models/ILoggingProcessorConfig";
|
|
8
|
+
export * from "./models/ILoggingProcessorConstructorOptions";
|
|
9
|
+
export * from "./models/IRestRouteProcessorConstructorOptions";
|
|
8
10
|
export * from "./models/IRouteProcessorConfig";
|
|
11
|
+
export * from "./models/ISocketRouteProcessorConstructorOptions";
|
|
9
12
|
export * from "./models/IStaticUserIdentityProcessorConfig";
|
|
13
|
+
export * from "./models/IStaticUserIdentityProcessorConstructorOptions";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IBaseRoute, IBaseRouteProcessor, IHttpRequestIdentity, IHttpResponse, IHttpServerRequest } from "@twin.org/api-models";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ILoggingProcessorConstructorOptions } from "../models/ILoggingProcessorConstructorOptions";
|
|
3
3
|
/**
|
|
4
4
|
* Process the REST request and log its information.
|
|
5
5
|
*/
|
|
@@ -13,16 +13,10 @@ export declare class LoggingProcessor implements IBaseRouteProcessor {
|
|
|
13
13
|
*/
|
|
14
14
|
readonly CLASS_NAME: string;
|
|
15
15
|
/**
|
|
16
|
-
* Create a new instance of
|
|
16
|
+
* Create a new instance of LoggingProcessor.
|
|
17
17
|
* @param options Options for the processor.
|
|
18
|
-
* @param options.loggingConnectorType The type for the logging connector, defaults to "logging".
|
|
19
|
-
* @param options.config The configuration for the processor.
|
|
20
|
-
* @returns Promise that resolves when the processor is initialized.
|
|
21
18
|
*/
|
|
22
|
-
constructor(options?:
|
|
23
|
-
loggingConnectorType?: string;
|
|
24
|
-
config?: ILoggingProcessorConfig;
|
|
25
|
-
});
|
|
19
|
+
constructor(options?: ILoggingProcessorConstructorOptions);
|
|
26
20
|
/**
|
|
27
21
|
* Pre process the REST request for the specified route.
|
|
28
22
|
* @param request The incoming request.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ILoggingProcessorConfig } from "./ILoggingProcessorConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the LoggingProcessor constructor.
|
|
4
|
+
*/
|
|
5
|
+
export interface ILoggingProcessorConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The type for the logging connector.
|
|
8
|
+
* @default logging
|
|
9
|
+
*/
|
|
10
|
+
loggingConnectorType?: string;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
config?: ILoggingProcessorConfig;
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IRouteProcessorConfig } from "../models/IRouteProcessorConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the RestRouteProcessor constructor.
|
|
4
|
+
*/
|
|
5
|
+
export interface IRestRouteProcessorConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The configuration for the processor.
|
|
8
|
+
*/
|
|
9
|
+
config?: IRouteProcessorConfig;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IRouteProcessorConfig } from "./IRouteProcessorConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the SocketRouteProcessor constructor.
|
|
4
|
+
*/
|
|
5
|
+
export interface ISocketRouteProcessorConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The configuration for the processor.
|
|
8
|
+
*/
|
|
9
|
+
config?: IRouteProcessorConfig;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IStaticUserIdentityProcessorConfig } from "./IStaticUserIdentityProcessorConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the StaticUserIdentityProcessor constructor.
|
|
4
|
+
*/
|
|
5
|
+
export interface IStaticUserIdentityProcessorConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The configuration for the processor.
|
|
8
|
+
*/
|
|
9
|
+
config: IStaticUserIdentityProcessorConfig;
|
|
10
|
+
}
|
package/docs/changelog.md
CHANGED
|
@@ -12,28 +12,20 @@ Process the REST request and log its information.
|
|
|
12
12
|
|
|
13
13
|
> **new LoggingProcessor**(`options`?): [`LoggingProcessor`](LoggingProcessor.md)
|
|
14
14
|
|
|
15
|
-
Create a new instance of
|
|
15
|
+
Create a new instance of LoggingProcessor.
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### options?
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
• **options.loggingConnectorType?**: `string`
|
|
24
|
-
|
|
25
|
-
The type for the logging connector, defaults to "logging".
|
|
26
|
-
|
|
27
|
-
• **options.config?**: [`ILoggingProcessorConfig`](../interfaces/ILoggingProcessorConfig.md)
|
|
21
|
+
[`ILoggingProcessorConstructorOptions`](../interfaces/ILoggingProcessorConstructorOptions.md)
|
|
28
22
|
|
|
29
|
-
|
|
23
|
+
Options for the processor.
|
|
30
24
|
|
|
31
25
|
#### Returns
|
|
32
26
|
|
|
33
27
|
[`LoggingProcessor`](LoggingProcessor.md)
|
|
34
28
|
|
|
35
|
-
Promise that resolves when the processor is initialized.
|
|
36
|
-
|
|
37
29
|
## Properties
|
|
38
30
|
|
|
39
31
|
### NAMESPACE
|
|
@@ -64,23 +56,31 @@ Pre process the REST request for the specified route.
|
|
|
64
56
|
|
|
65
57
|
#### Parameters
|
|
66
58
|
|
|
67
|
-
|
|
59
|
+
##### request
|
|
60
|
+
|
|
61
|
+
`IHttpServerRequest`
|
|
68
62
|
|
|
69
63
|
The incoming request.
|
|
70
64
|
|
|
71
|
-
|
|
65
|
+
##### response
|
|
66
|
+
|
|
67
|
+
`IHttpResponse`
|
|
72
68
|
|
|
73
69
|
The outgoing response.
|
|
74
70
|
|
|
75
|
-
|
|
71
|
+
##### route
|
|
76
72
|
|
|
77
73
|
The route to process.
|
|
78
74
|
|
|
79
|
-
|
|
75
|
+
`undefined` | `IBaseRoute`
|
|
76
|
+
|
|
77
|
+
##### requestIdentity
|
|
78
|
+
|
|
79
|
+
`IHttpRequestIdentity`
|
|
80
80
|
|
|
81
81
|
The identity context for the request.
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
##### processorState
|
|
84
84
|
|
|
85
85
|
The state handed through the processors.
|
|
86
86
|
|
|
@@ -102,23 +102,31 @@ Post process the REST request for the specified route.
|
|
|
102
102
|
|
|
103
103
|
#### Parameters
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
##### request
|
|
106
|
+
|
|
107
|
+
`IHttpServerRequest`
|
|
106
108
|
|
|
107
109
|
The incoming request.
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
##### response
|
|
112
|
+
|
|
113
|
+
`IHttpResponse`
|
|
110
114
|
|
|
111
115
|
The outgoing response.
|
|
112
116
|
|
|
113
|
-
|
|
117
|
+
##### route
|
|
114
118
|
|
|
115
119
|
The route to process.
|
|
116
120
|
|
|
117
|
-
|
|
121
|
+
`undefined` | `IBaseRoute`
|
|
122
|
+
|
|
123
|
+
##### requestIdentity
|
|
124
|
+
|
|
125
|
+
`IHttpRequestIdentity`
|
|
118
126
|
|
|
119
127
|
The identity context for the request.
|
|
120
128
|
|
|
121
|
-
|
|
129
|
+
##### processorState
|
|
122
130
|
|
|
123
131
|
The state handed through the processors.
|
|
124
132
|
|
|
@@ -46,11 +46,15 @@ The service needs to be started when the application is initialized.
|
|
|
46
46
|
|
|
47
47
|
#### Parameters
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
##### nodeIdentity
|
|
50
|
+
|
|
51
|
+
`string`
|
|
50
52
|
|
|
51
53
|
The identity of the node.
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
##### nodeLoggingConnectorType?
|
|
56
|
+
|
|
57
|
+
`string`
|
|
54
58
|
|
|
55
59
|
The node logging connector type, defaults to "node-logging".
|
|
56
60
|
|
|
@@ -74,23 +78,31 @@ Pre process the REST request for the specified route.
|
|
|
74
78
|
|
|
75
79
|
#### Parameters
|
|
76
80
|
|
|
77
|
-
|
|
81
|
+
##### request
|
|
82
|
+
|
|
83
|
+
`IHttpServerRequest`
|
|
78
84
|
|
|
79
85
|
The incoming request.
|
|
80
86
|
|
|
81
|
-
|
|
87
|
+
##### response
|
|
88
|
+
|
|
89
|
+
`IHttpResponse`
|
|
82
90
|
|
|
83
91
|
The outgoing response.
|
|
84
92
|
|
|
85
|
-
|
|
93
|
+
##### route
|
|
86
94
|
|
|
87
95
|
The route to process.
|
|
88
96
|
|
|
89
|
-
|
|
97
|
+
`undefined` | `IBaseRoute`
|
|
98
|
+
|
|
99
|
+
##### requestIdentity
|
|
100
|
+
|
|
101
|
+
`IHttpRequestIdentity`
|
|
90
102
|
|
|
91
103
|
The identity context for the request.
|
|
92
104
|
|
|
93
|
-
|
|
105
|
+
##### processorState
|
|
94
106
|
|
|
95
107
|
The state handed through the processors.
|
|
96
108
|
|
|
@@ -16,20 +16,16 @@ Create a new instance of RouteProcessor.
|
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### options?
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
• **options.config?**: [`IRouteProcessorConfig`](../interfaces/IRouteProcessorConfig.md)
|
|
21
|
+
[`IRestRouteProcessorConstructorOptions`](../interfaces/IRestRouteProcessorConstructorOptions.md)
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
Options for the processor.
|
|
26
24
|
|
|
27
25
|
#### Returns
|
|
28
26
|
|
|
29
27
|
[`RestRouteProcessor`](RestRouteProcessor.md)
|
|
30
28
|
|
|
31
|
-
Promise that resolves when the processor is initialized.
|
|
32
|
-
|
|
33
29
|
## Properties
|
|
34
30
|
|
|
35
31
|
### NAMESPACE
|
|
@@ -60,23 +56,31 @@ Process the REST request for the specified route.
|
|
|
60
56
|
|
|
61
57
|
#### Parameters
|
|
62
58
|
|
|
63
|
-
|
|
59
|
+
##### request
|
|
60
|
+
|
|
61
|
+
`IHttpServerRequest`
|
|
64
62
|
|
|
65
63
|
The incoming request.
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
##### response
|
|
66
|
+
|
|
67
|
+
`IHttpResponse`
|
|
68
68
|
|
|
69
69
|
The outgoing response.
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
##### route
|
|
72
72
|
|
|
73
73
|
The route to process.
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
`undefined` | `IRestRoute`
|
|
76
|
+
|
|
77
|
+
##### requestIdentity
|
|
78
|
+
|
|
79
|
+
`IHttpRequestIdentity`
|
|
76
80
|
|
|
77
81
|
The identity context for the request.
|
|
78
82
|
|
|
79
|
-
|
|
83
|
+
##### processorState
|
|
80
84
|
|
|
81
85
|
The state handed through the processors.
|
|
82
86
|
|
|
@@ -16,20 +16,16 @@ Create a new instance of SocketRouteProcessor.
|
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### options?
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
• **options.config?**: [`IRouteProcessorConfig`](../interfaces/IRouteProcessorConfig.md)
|
|
21
|
+
[`ISocketRouteProcessorConstructorOptions`](../interfaces/ISocketRouteProcessorConstructorOptions.md)
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
Options for the processor.
|
|
26
24
|
|
|
27
25
|
#### Returns
|
|
28
26
|
|
|
29
27
|
[`SocketRouteProcessor`](SocketRouteProcessor.md)
|
|
30
28
|
|
|
31
|
-
Promise that resolves when the processor is initialized.
|
|
32
|
-
|
|
33
29
|
## Properties
|
|
34
30
|
|
|
35
31
|
### NAMESPACE
|
|
@@ -60,27 +56,37 @@ Process the REST request for the specified route.
|
|
|
60
56
|
|
|
61
57
|
#### Parameters
|
|
62
58
|
|
|
63
|
-
|
|
59
|
+
##### request
|
|
60
|
+
|
|
61
|
+
`IHttpServerRequest`
|
|
64
62
|
|
|
65
63
|
The incoming request.
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
##### response
|
|
66
|
+
|
|
67
|
+
`IHttpResponse`
|
|
68
68
|
|
|
69
69
|
The outgoing response.
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
##### route
|
|
72
72
|
|
|
73
73
|
The route to process.
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
`undefined` | `ISocketRoute`
|
|
76
|
+
|
|
77
|
+
##### requestIdentity
|
|
78
|
+
|
|
79
|
+
`IHttpRequestIdentity`
|
|
76
80
|
|
|
77
81
|
The identity context for the request.
|
|
78
82
|
|
|
79
|
-
|
|
83
|
+
##### processorState
|
|
80
84
|
|
|
81
85
|
The state handed through the processors.
|
|
82
86
|
|
|
83
|
-
|
|
87
|
+
##### responseEmitter
|
|
88
|
+
|
|
89
|
+
(`topic`, `response`) => `Promise`\<`void`\>
|
|
84
90
|
|
|
85
91
|
The function to emit a response.
|
|
86
92
|
|
|
@@ -16,20 +16,16 @@ Create a new instance of StaticIdentityProcessor.
|
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### options
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
• **options.config**: [`IStaticUserIdentityProcessorConfig`](../interfaces/IStaticUserIdentityProcessorConfig.md)
|
|
21
|
+
[`IStaticUserIdentityProcessorConstructorOptions`](../interfaces/IStaticUserIdentityProcessorConstructorOptions.md)
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
Options for the processor.
|
|
26
24
|
|
|
27
25
|
#### Returns
|
|
28
26
|
|
|
29
27
|
[`StaticUserIdentityProcessor`](StaticUserIdentityProcessor.md)
|
|
30
28
|
|
|
31
|
-
Promise that resolves when the processor is initialized.
|
|
32
|
-
|
|
33
29
|
## Properties
|
|
34
30
|
|
|
35
31
|
### NAMESPACE
|
|
@@ -60,23 +56,31 @@ Pre process the REST request for the specified route.
|
|
|
60
56
|
|
|
61
57
|
#### Parameters
|
|
62
58
|
|
|
63
|
-
|
|
59
|
+
##### request
|
|
60
|
+
|
|
61
|
+
`IHttpServerRequest`
|
|
64
62
|
|
|
65
63
|
The incoming request.
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
##### response
|
|
66
|
+
|
|
67
|
+
`IHttpResponse`
|
|
68
68
|
|
|
69
69
|
The outgoing response.
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
##### route
|
|
72
72
|
|
|
73
73
|
The route to process.
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
`undefined` | `IBaseRoute`
|
|
76
|
+
|
|
77
|
+
##### requestIdentity
|
|
78
|
+
|
|
79
|
+
`IHttpRequestIdentity`
|
|
76
80
|
|
|
77
81
|
The identity context for the request.
|
|
78
82
|
|
|
79
|
-
|
|
83
|
+
##### processorState
|
|
80
84
|
|
|
81
85
|
The state handed through the processors.
|
|
82
86
|
|
package/docs/reference/index.md
CHANGED
|
@@ -12,5 +12,9 @@
|
|
|
12
12
|
## Interfaces
|
|
13
13
|
|
|
14
14
|
- [ILoggingProcessorConfig](interfaces/ILoggingProcessorConfig.md)
|
|
15
|
+
- [ILoggingProcessorConstructorOptions](interfaces/ILoggingProcessorConstructorOptions.md)
|
|
16
|
+
- [IRestRouteProcessorConstructorOptions](interfaces/IRestRouteProcessorConstructorOptions.md)
|
|
15
17
|
- [IRouteProcessorConfig](interfaces/IRouteProcessorConfig.md)
|
|
18
|
+
- [ISocketRouteProcessorConstructorOptions](interfaces/ISocketRouteProcessorConstructorOptions.md)
|
|
16
19
|
- [IStaticUserIdentityProcessorConfig](interfaces/IStaticUserIdentityProcessorConfig.md)
|
|
20
|
+
- [IStaticUserIdentityProcessorConstructorOptions](interfaces/IStaticUserIdentityProcessorConstructorOptions.md)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Interface: ILoggingProcessorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the LoggingProcessor constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### loggingConnectorType?
|
|
8
|
+
|
|
9
|
+
> `optional` **loggingConnectorType**: `string`
|
|
10
|
+
|
|
11
|
+
The type for the logging connector.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
logging
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### config?
|
|
22
|
+
|
|
23
|
+
> `optional` **config**: [`ILoggingProcessorConfig`](ILoggingProcessorConfig.md)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Interface: IRestRouteProcessorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the RestRouteProcessor constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### config?
|
|
8
|
+
|
|
9
|
+
> `optional` **config**: [`IRouteProcessorConfig`](IRouteProcessorConfig.md)
|
|
10
|
+
|
|
11
|
+
The configuration for the processor.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Interface: ISocketRouteProcessorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the SocketRouteProcessor constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### config?
|
|
8
|
+
|
|
9
|
+
> `optional` **config**: [`IRouteProcessorConfig`](IRouteProcessorConfig.md)
|
|
10
|
+
|
|
11
|
+
The configuration for the processor.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Interface: IStaticUserIdentityProcessorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the StaticUserIdentityProcessor constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### config
|
|
8
|
+
|
|
9
|
+
> **config**: [`IStaticUserIdentityProcessorConfig`](IStaticUserIdentityProcessorConfig.md)
|
|
10
|
+
|
|
11
|
+
The configuration for the processor.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/api-processors",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.26",
|
|
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.1-next.
|
|
17
|
+
"@twin.org/api-models": "0.0.1-next.26",
|
|
18
18
|
"@twin.org/core": "next",
|
|
19
19
|
"@twin.org/entity": "next",
|
|
20
20
|
"@twin.org/entity-storage-models": "next",
|