@twin.org/api-processors 0.0.1-next.8 → 0.0.1

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 (33) hide show
  1. package/dist/cjs/index.cjs +212 -30
  2. package/dist/esm/index.mjs +211 -31
  3. package/dist/types/data/{routeProcessor.d.ts → restRouteProcessor.d.ts} +8 -8
  4. package/dist/types/data/socketRouteProcessor.d.ts +32 -0
  5. package/dist/types/identity/nodeIdentityProcessor.d.ts +7 -3
  6. package/dist/types/identity/staticUserIdentityProcessor.d.ts +9 -9
  7. package/dist/types/index.d.ts +9 -4
  8. package/dist/types/logging/loggingProcessor.d.ts +11 -13
  9. package/dist/types/mimeType/jwtMimeTypeProcessor.d.ts +25 -0
  10. package/dist/types/models/ILoggingProcessorConfig.d.ts +17 -0
  11. package/dist/types/models/ILoggingProcessorConstructorOptions.d.ts +15 -0
  12. package/dist/types/models/IRestRouteProcessorConstructorOptions.d.ts +10 -0
  13. package/dist/types/models/ISocketRouteProcessorConstructorOptions.d.ts +10 -0
  14. package/dist/types/models/IStaticUserIdentityProcessorConstructorOptions.d.ts +10 -0
  15. package/docs/changelog.md +85 -1
  16. package/docs/reference/classes/JwtMimeTypeProcessor.md +81 -0
  17. package/docs/reference/classes/LoggingProcessor.md +43 -27
  18. package/docs/reference/classes/NodeIdentityProcessor.md +35 -15
  19. package/docs/reference/classes/{RouteProcessor.md → RestRouteProcessor.md} +30 -18
  20. package/docs/reference/classes/SocketRouteProcessor.md +99 -0
  21. package/docs/reference/classes/StaticUserIdentityProcessor.md +29 -17
  22. package/docs/reference/index.md +8 -3
  23. package/docs/reference/interfaces/ILoggingProcessorConfig.md +27 -0
  24. package/docs/reference/interfaces/ILoggingProcessorConstructorOptions.md +23 -0
  25. package/docs/reference/interfaces/IRestRouteProcessorConstructorOptions.md +11 -0
  26. package/docs/reference/interfaces/ISocketRouteProcessorConstructorOptions.md +11 -0
  27. package/docs/reference/interfaces/IStaticUserIdentityProcessorConstructorOptions.md +11 -0
  28. package/locales/en.json +5 -2
  29. package/package.json +10 -10
  30. package/dist/types/models/IRequestLoggingProcessorConfig.d.ts +0 -9
  31. package/dist/types/models/IResponseLoggingProcessorConfig.d.ts +0 -9
  32. package/docs/reference/interfaces/IRequestLoggingProcessorConfig.md +0 -11
  33. package/docs/reference/interfaces/IResponseLoggingProcessorConfig.md +0 -11
package/docs/changelog.md CHANGED
@@ -1,5 +1,89 @@
1
1
  # @twin.org/api-processors - Changelog
2
2
 
3
- ## v0.0.1-next.8
3
+ ## 0.0.1 (2025-07-03)
4
+
5
+
6
+ ### Features
7
+
8
+ * release to production ([70ee2d5](https://github.com/twinfoundation/api/commit/70ee2d56a1dc9537d7c9c154d4cb78a235678a3a))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/api-models bumped from ^0.0.0 to ^0.0.1
16
+
17
+ ## [0.0.1-next.36](https://github.com/twinfoundation/api/compare/api-processors-v0.0.1-next.35...api-processors-v0.0.1-next.36) (2025-06-17)
18
+
19
+
20
+ ### Miscellaneous Chores
21
+
22
+ * **api-processors:** Synchronize repo versions
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/api-models bumped from 0.0.1-next.35 to 0.0.1-next.36
30
+
31
+ ## [0.0.1-next.35](https://github.com/twinfoundation/api/compare/api-processors-v0.0.1-next.34...api-processors-v0.0.1-next.35) (2025-06-11)
32
+
33
+
34
+ ### Features
35
+
36
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
37
+
38
+
39
+ ### Dependencies
40
+
41
+ * The following workspace dependencies were updated
42
+ * dependencies
43
+ * @twin.org/api-models bumped from 0.0.1-next.34 to 0.0.1-next.35
44
+
45
+ ## [0.0.1-next.34](https://github.com/twinfoundation/api/compare/api-processors-v0.0.1-next.33...api-processors-v0.0.1-next.34) (2025-05-27)
46
+
47
+
48
+ ### Miscellaneous Chores
49
+
50
+ * **api-processors:** Synchronize repo versions
51
+
52
+
53
+ ### Dependencies
54
+
55
+ * The following workspace dependencies were updated
56
+ * dependencies
57
+ * @twin.org/api-models bumped from 0.0.1-next.33 to 0.0.1-next.34
58
+
59
+ ## [0.0.1-next.33](https://github.com/twinfoundation/api/compare/api-processors-v0.0.1-next.32...api-processors-v0.0.1-next.33) (2025-04-17)
60
+
61
+
62
+ ### Features
63
+
64
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
65
+
66
+
67
+ ### Dependencies
68
+
69
+ * The following workspace dependencies were updated
70
+ * dependencies
71
+ * @twin.org/api-models bumped from 0.0.1-next.32 to 0.0.1-next.33
72
+
73
+ ## [0.0.1-next.32](https://github.com/twinfoundation/api/compare/api-processors-v0.0.1-next.31...api-processors-v0.0.1-next.32) (2025-03-28)
74
+
75
+
76
+ ### Miscellaneous Chores
77
+
78
+ * **api-processors:** Synchronize repo versions
79
+
80
+
81
+ ### Dependencies
82
+
83
+ * The following workspace dependencies were updated
84
+ * dependencies
85
+ * @twin.org/api-models bumped from 0.0.1-next.31 to 0.0.1-next.32
86
+
87
+ ## v0.0.1-next.31
4
88
 
5
89
  - Initial Release
@@ -0,0 +1,81 @@
1
+ # Class: JwtMimeTypeProcessor
2
+
3
+ Process the JWT mime type.
4
+
5
+ ## Implements
6
+
7
+ - `IMimeTypeProcessor`
8
+
9
+ ## Constructors
10
+
11
+ ### Constructor
12
+
13
+ > **new JwtMimeTypeProcessor**(): `JwtMimeTypeProcessor`
14
+
15
+ #### Returns
16
+
17
+ `JwtMimeTypeProcessor`
18
+
19
+ ## Properties
20
+
21
+ ### NAMESPACE
22
+
23
+ > `readonly` `static` **NAMESPACE**: `string` = `"jwt"`
24
+
25
+ The namespace supported by the processor.
26
+
27
+ ***
28
+
29
+ ### CLASS\_NAME
30
+
31
+ > `readonly` **CLASS\_NAME**: `string`
32
+
33
+ Runtime name for the class.
34
+
35
+ #### Implementation of
36
+
37
+ `IMimeTypeProcessor.CLASS_NAME`
38
+
39
+ ## Methods
40
+
41
+ ### getTypes()
42
+
43
+ > **getTypes**(): `string`[]
44
+
45
+ Get the MIME types that this handler can handle.
46
+
47
+ #### Returns
48
+
49
+ `string`[]
50
+
51
+ The MIME types that this handler can handle.
52
+
53
+ #### Implementation of
54
+
55
+ `IMimeTypeProcessor.getTypes`
56
+
57
+ ***
58
+
59
+ ### handle()
60
+
61
+ > **handle**(`body`): `Promise`\<`unknown`\>
62
+
63
+ Handle content.
64
+
65
+ #### Parameters
66
+
67
+ ##### body
68
+
69
+ `Uint8Array`
70
+
71
+ The body to process.
72
+
73
+ #### Returns
74
+
75
+ `Promise`\<`unknown`\>
76
+
77
+ The processed body.
78
+
79
+ #### Implementation of
80
+
81
+ `IMimeTypeProcessor.handle`
@@ -4,37 +4,37 @@ Process the REST request and log its information.
4
4
 
5
5
  ## Implements
6
6
 
7
- - `IHttpRestRouteProcessor`
7
+ - `IBaseRouteProcessor`
8
8
 
9
9
  ## Constructors
10
10
 
11
- ### new LoggingProcessor()
11
+ ### Constructor
12
12
 
13
- > **new LoggingProcessor**(`options`?): [`LoggingProcessor`](LoggingProcessor.md)
13
+ > **new LoggingProcessor**(`options?`): `LoggingProcessor`
14
14
 
15
- Create a new instance of RequestLoggingProcessor.
15
+ Create a new instance of LoggingProcessor.
16
16
 
17
17
  #### Parameters
18
18
 
19
- **options?**
19
+ ##### options?
20
20
 
21
- Options for the processor.
21
+ [`ILoggingProcessorConstructorOptions`](../interfaces/ILoggingProcessorConstructorOptions.md)
22
22
 
23
- **options.loggingConnectorType?**: `string`
23
+ Options for the processor.
24
24
 
25
- The type for the logging connector, defaults to "logging".
25
+ #### Returns
26
26
 
27
- • **options.config?**: [`IRequestLoggingProcessorConfig`](../interfaces/IRequestLoggingProcessorConfig.md)
27
+ `LoggingProcessor`
28
28
 
29
- The configuration for the processor.
29
+ ## Properties
30
30
 
31
- #### Returns
31
+ ### NAMESPACE
32
32
 
33
- [`LoggingProcessor`](LoggingProcessor.md)
33
+ > `readonly` `static` **NAMESPACE**: `string` = `"logging"`
34
34
 
35
- Promise that resolves when the processor is initialized.
35
+ The namespace supported by the processor.
36
36
 
37
- ## Properties
37
+ ***
38
38
 
39
39
  ### CLASS\_NAME
40
40
 
@@ -44,7 +44,7 @@ Runtime name for the class.
44
44
 
45
45
  #### Implementation of
46
46
 
47
- `IHttpRestRouteProcessor.CLASS_NAME`
47
+ `IBaseRouteProcessor.CLASS_NAME`
48
48
 
49
49
  ## Methods
50
50
 
@@ -56,23 +56,31 @@ Pre process the REST request for the specified route.
56
56
 
57
57
  #### Parameters
58
58
 
59
- **request**: `IHttpServerRequest`\<`any`\>
59
+ ##### request
60
+
61
+ `IHttpServerRequest`
60
62
 
61
63
  The incoming request.
62
64
 
63
- **response**: `IHttpResponse`\<`any`\>
65
+ ##### response
66
+
67
+ `IHttpResponse`
64
68
 
65
69
  The outgoing response.
66
70
 
67
- **route**: `undefined` \| `IRestRoute`\<`any`, `any`\>
71
+ ##### route
68
72
 
69
73
  The route to process.
70
74
 
71
- **requestIdentity**: `IHttpRequestIdentity`
75
+ `undefined` | `IBaseRoute`
76
+
77
+ ##### requestIdentity
78
+
79
+ `IHttpRequestIdentity`
72
80
 
73
81
  The identity context for the request.
74
82
 
75
- **processorState**
83
+ ##### processorState
76
84
 
77
85
  The state handed through the processors.
78
86
 
@@ -82,7 +90,7 @@ The state handed through the processors.
82
90
 
83
91
  #### Implementation of
84
92
 
85
- `IHttpRestRouteProcessor.pre`
93
+ `IBaseRouteProcessor.pre`
86
94
 
87
95
  ***
88
96
 
@@ -94,23 +102,31 @@ Post process the REST request for the specified route.
94
102
 
95
103
  #### Parameters
96
104
 
97
- **request**: `IHttpServerRequest`\<`any`\>
105
+ ##### request
106
+
107
+ `IHttpServerRequest`
98
108
 
99
109
  The incoming request.
100
110
 
101
- **response**: `IHttpResponse`\<`any`\>
111
+ ##### response
112
+
113
+ `IHttpResponse`
102
114
 
103
115
  The outgoing response.
104
116
 
105
- **route**: `undefined` \| `IRestRoute`\<`any`, `any`\>
117
+ ##### route
106
118
 
107
119
  The route to process.
108
120
 
109
- **requestIdentity**: `IHttpRequestIdentity`
121
+ `undefined` | `IBaseRoute`
122
+
123
+ ##### requestIdentity
124
+
125
+ `IHttpRequestIdentity`
110
126
 
111
127
  The identity context for the request.
112
128
 
113
- **processorState**
129
+ ##### processorState
114
130
 
115
131
  The state handed through the processors.
116
132
 
@@ -120,4 +136,4 @@ The state handed through the processors.
120
136
 
121
137
  #### Implementation of
122
138
 
123
- `IHttpRestRouteProcessor.post`
139
+ `IBaseRouteProcessor.post`
@@ -4,20 +4,28 @@ Adds a node identity to the request identity.
4
4
 
5
5
  ## Implements
6
6
 
7
- - `IHttpRestRouteProcessor`
7
+ - `IBaseRouteProcessor`
8
8
 
9
9
  ## Constructors
10
10
 
11
- ### new NodeIdentityProcessor()
11
+ ### Constructor
12
12
 
13
- > **new NodeIdentityProcessor**(): [`NodeIdentityProcessor`](NodeIdentityProcessor.md)
13
+ > **new NodeIdentityProcessor**(): `NodeIdentityProcessor`
14
14
 
15
15
  #### Returns
16
16
 
17
- [`NodeIdentityProcessor`](NodeIdentityProcessor.md)
17
+ `NodeIdentityProcessor`
18
18
 
19
19
  ## Properties
20
20
 
21
+ ### NAMESPACE
22
+
23
+ > `readonly` `static` **NAMESPACE**: `string` = `"node-identity"`
24
+
25
+ The namespace supported by the processor.
26
+
27
+ ***
28
+
21
29
  ### CLASS\_NAME
22
30
 
23
31
  > `readonly` **CLASS\_NAME**: `string`
@@ -26,23 +34,27 @@ Runtime name for the class.
26
34
 
27
35
  #### Implementation of
28
36
 
29
- `IHttpRestRouteProcessor.CLASS_NAME`
37
+ `IBaseRouteProcessor.CLASS_NAME`
30
38
 
31
39
  ## Methods
32
40
 
33
41
  ### start()
34
42
 
35
- > **start**(`nodeIdentity`, `nodeLoggingConnectorType`?): `Promise`\<`void`\>
43
+ > **start**(`nodeIdentity`, `nodeLoggingConnectorType?`): `Promise`\<`void`\>
36
44
 
37
45
  The service needs to be started when the application is initialized.
38
46
 
39
47
  #### Parameters
40
48
 
41
- **nodeIdentity**: `string`
49
+ ##### nodeIdentity
50
+
51
+ `string`
42
52
 
43
53
  The identity of the node.
44
54
 
45
- **nodeLoggingConnectorType?**: `string`
55
+ ##### nodeLoggingConnectorType?
56
+
57
+ `string`
46
58
 
47
59
  The node logging connector type, defaults to "node-logging".
48
60
 
@@ -54,7 +66,7 @@ Nothing.
54
66
 
55
67
  #### Implementation of
56
68
 
57
- `IHttpRestRouteProcessor.start`
69
+ `IBaseRouteProcessor.start`
58
70
 
59
71
  ***
60
72
 
@@ -66,23 +78,31 @@ Pre process the REST request for the specified route.
66
78
 
67
79
  #### Parameters
68
80
 
69
- **request**: `IHttpServerRequest`\<`any`\>
81
+ ##### request
82
+
83
+ `IHttpServerRequest`
70
84
 
71
85
  The incoming request.
72
86
 
73
- **response**: `IHttpResponse`\<`any`\>
87
+ ##### response
88
+
89
+ `IHttpResponse`
74
90
 
75
91
  The outgoing response.
76
92
 
77
- **route**: `undefined` \| `IRestRoute`\<`any`, `any`\>
93
+ ##### route
78
94
 
79
95
  The route to process.
80
96
 
81
- **requestIdentity**: `IHttpRequestIdentity`
97
+ `undefined` | `IBaseRoute`
98
+
99
+ ##### requestIdentity
100
+
101
+ `IHttpRequestIdentity`
82
102
 
83
103
  The identity context for the request.
84
104
 
85
- **processorState**
105
+ ##### processorState
86
106
 
87
107
  The state handed through the processors.
88
108
 
@@ -92,4 +112,4 @@ The state handed through the processors.
92
112
 
93
113
  #### Implementation of
94
114
 
95
- `IHttpRestRouteProcessor.pre`
115
+ `IBaseRouteProcessor.pre`
@@ -1,36 +1,40 @@
1
- # Class: RouteProcessor
1
+ # Class: RestRouteProcessor
2
2
 
3
3
  Process the REST request and hands it on to the route handler.
4
4
 
5
5
  ## Implements
6
6
 
7
- - `IHttpRestRouteProcessor`
7
+ - `IRestRouteProcessor`
8
8
 
9
9
  ## Constructors
10
10
 
11
- ### new RouteProcessor()
11
+ ### Constructor
12
12
 
13
- > **new RouteProcessor**(`options`?): [`RouteProcessor`](RouteProcessor.md)
13
+ > **new RestRouteProcessor**(`options?`): `RestRouteProcessor`
14
14
 
15
15
  Create a new instance of RouteProcessor.
16
16
 
17
17
  #### Parameters
18
18
 
19
- **options?**
19
+ ##### options?
20
+
21
+ [`IRestRouteProcessorConstructorOptions`](../interfaces/IRestRouteProcessorConstructorOptions.md)
20
22
 
21
23
  Options for the processor.
22
24
 
23
- **options.config?**: [`IRouteProcessorConfig`](../interfaces/IRouteProcessorConfig.md)
25
+ #### Returns
24
26
 
25
- The configuration for the processor.
27
+ `RestRouteProcessor`
26
28
 
27
- #### Returns
29
+ ## Properties
28
30
 
29
- [`RouteProcessor`](RouteProcessor.md)
31
+ ### NAMESPACE
30
32
 
31
- Promise that resolves when the processor is initialized.
33
+ > `readonly` `static` **NAMESPACE**: `string` = `"rest-route"`
32
34
 
33
- ## Properties
35
+ The namespace supported by the processor.
36
+
37
+ ***
34
38
 
35
39
  ### CLASS\_NAME
36
40
 
@@ -40,7 +44,7 @@ Runtime name for the class.
40
44
 
41
45
  #### Implementation of
42
46
 
43
- `IHttpRestRouteProcessor.CLASS_NAME`
47
+ `IRestRouteProcessor.CLASS_NAME`
44
48
 
45
49
  ## Methods
46
50
 
@@ -52,23 +56,31 @@ Process the REST request for the specified route.
52
56
 
53
57
  #### Parameters
54
58
 
55
- **request**: `IHttpServerRequest`\<`any`\>
59
+ ##### request
60
+
61
+ `IHttpServerRequest`
56
62
 
57
63
  The incoming request.
58
64
 
59
- **response**: `IHttpResponse`\<`any`\>
65
+ ##### response
66
+
67
+ `IHttpResponse`
60
68
 
61
69
  The outgoing response.
62
70
 
63
- **route**: `undefined` \| `IRestRoute`\<`any`, `any`\>
71
+ ##### route
64
72
 
65
73
  The route to process.
66
74
 
67
- **requestIdentity**: `IHttpRequestIdentity`
75
+ `undefined` | `IRestRoute`\<`any`, `any`\>
76
+
77
+ ##### requestIdentity
78
+
79
+ `IHttpRequestIdentity`
68
80
 
69
81
  The identity context for the request.
70
82
 
71
- **processorState**
83
+ ##### processorState
72
84
 
73
85
  The state handed through the processors.
74
86
 
@@ -78,4 +90,4 @@ The state handed through the processors.
78
90
 
79
91
  #### Implementation of
80
92
 
81
- `IHttpRestRouteProcessor.process`
93
+ `IRestRouteProcessor.process`
@@ -0,0 +1,99 @@
1
+ # Class: SocketRouteProcessor
2
+
3
+ Process the socket request and hands it on to the route handler.
4
+
5
+ ## Implements
6
+
7
+ - `ISocketRouteProcessor`
8
+
9
+ ## Constructors
10
+
11
+ ### Constructor
12
+
13
+ > **new SocketRouteProcessor**(`options?`): `SocketRouteProcessor`
14
+
15
+ Create a new instance of SocketRouteProcessor.
16
+
17
+ #### Parameters
18
+
19
+ ##### options?
20
+
21
+ [`ISocketRouteProcessorConstructorOptions`](../interfaces/ISocketRouteProcessorConstructorOptions.md)
22
+
23
+ Options for the processor.
24
+
25
+ #### Returns
26
+
27
+ `SocketRouteProcessor`
28
+
29
+ ## Properties
30
+
31
+ ### NAMESPACE
32
+
33
+ > `readonly` `static` **NAMESPACE**: `string` = `"socket-route"`
34
+
35
+ The namespace supported by the processor.
36
+
37
+ ***
38
+
39
+ ### CLASS\_NAME
40
+
41
+ > `readonly` **CLASS\_NAME**: `string`
42
+
43
+ Runtime name for the class.
44
+
45
+ #### Implementation of
46
+
47
+ `ISocketRouteProcessor.CLASS_NAME`
48
+
49
+ ## Methods
50
+
51
+ ### process()
52
+
53
+ > **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`, `responseEmitter`): `Promise`\<`void`\>
54
+
55
+ Process the REST request for the specified route.
56
+
57
+ #### Parameters
58
+
59
+ ##### request
60
+
61
+ `IHttpServerRequest`
62
+
63
+ The incoming request.
64
+
65
+ ##### response
66
+
67
+ `IHttpResponse`
68
+
69
+ The outgoing response.
70
+
71
+ ##### route
72
+
73
+ The route to process.
74
+
75
+ `undefined` | `ISocketRoute`\<`any`, `any`\>
76
+
77
+ ##### requestIdentity
78
+
79
+ `IHttpRequestIdentity`
80
+
81
+ The identity context for the request.
82
+
83
+ ##### processorState
84
+
85
+ The state handed through the processors.
86
+
87
+ ##### responseEmitter
88
+
89
+ (`topic`, `response`) => `Promise`\<`void`\>
90
+
91
+ The function to emit a response.
92
+
93
+ #### Returns
94
+
95
+ `Promise`\<`void`\>
96
+
97
+ #### Implementation of
98
+
99
+ `ISocketRouteProcessor.process`