@3sixty/api-processors 0.0.0-stage → 0.20.0-next.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 (74) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +24 -2
  3. package/dist/es/data/restRouteProcessor.js +118 -0
  4. package/dist/es/data/restRouteProcessor.js.map +1 -0
  5. package/dist/es/data/socketRouteProcessor.js +131 -0
  6. package/dist/es/data/socketRouteProcessor.js.map +1 -0
  7. package/dist/es/identity/contextIdProcessor.js +69 -0
  8. package/dist/es/identity/contextIdProcessor.js.map +1 -0
  9. package/dist/es/identity/staticContextIdProcessor.js +60 -0
  10. package/dist/es/identity/staticContextIdProcessor.js.map +1 -0
  11. package/dist/es/index.js +19 -0
  12. package/dist/es/index.js.map +1 -0
  13. package/dist/es/logging/loggingProcessor.js +217 -0
  14. package/dist/es/logging/loggingProcessor.js.map +1 -0
  15. package/dist/es/mimeType/jsonLdMimeTypeProcessor.js +38 -0
  16. package/dist/es/mimeType/jsonLdMimeTypeProcessor.js.map +1 -0
  17. package/dist/es/mimeType/jwtMimeTypeProcessor.js +34 -0
  18. package/dist/es/mimeType/jwtMimeTypeProcessor.js.map +1 -0
  19. package/dist/es/models/IContextIdProcessorConfig.js +4 -0
  20. package/dist/es/models/IContextIdProcessorConfig.js.map +1 -0
  21. package/dist/es/models/IContextIdProcessorConstructorOptions.js +2 -0
  22. package/dist/es/models/IContextIdProcessorConstructorOptions.js.map +1 -0
  23. package/dist/es/models/ILoggingProcessorConfig.js +4 -0
  24. package/dist/es/models/ILoggingProcessorConfig.js.map +1 -0
  25. package/dist/es/models/ILoggingProcessorConstructorOptions.js +2 -0
  26. package/dist/es/models/ILoggingProcessorConstructorOptions.js.map +1 -0
  27. package/dist/es/models/IRestRouteProcessorConstructorOptions.js +2 -0
  28. package/dist/es/models/IRestRouteProcessorConstructorOptions.js.map +1 -0
  29. package/dist/es/models/IRouteProcessorConfig.js +4 -0
  30. package/dist/es/models/IRouteProcessorConfig.js.map +1 -0
  31. package/dist/es/models/ISocketRouteProcessorConstructorOptions.js +2 -0
  32. package/dist/es/models/ISocketRouteProcessorConstructorOptions.js.map +1 -0
  33. package/dist/es/models/IStaticContextIdProcessorConfig.js +4 -0
  34. package/dist/es/models/IStaticContextIdProcessorConfig.js.map +1 -0
  35. package/dist/es/models/IStaticContextIdProcessorConstructorOptions.js +2 -0
  36. package/dist/es/models/IStaticContextIdProcessorConstructorOptions.js.map +1 -0
  37. package/dist/types/data/restRouteProcessor.d.ts +36 -0
  38. package/dist/types/data/socketRouteProcessor.d.ts +50 -0
  39. package/dist/types/identity/contextIdProcessor.d.ts +40 -0
  40. package/dist/types/identity/staticContextIdProcessor.d.ts +34 -0
  41. package/dist/types/index.d.ts +16 -0
  42. package/dist/types/logging/loggingProcessor.d.ts +46 -0
  43. package/dist/types/mimeType/jsonLdMimeTypeProcessor.d.ts +26 -0
  44. package/dist/types/mimeType/jwtMimeTypeProcessor.d.ts +26 -0
  45. package/dist/types/models/IContextIdProcessorConfig.d.ts +13 -0
  46. package/dist/types/models/IContextIdProcessorConstructorOptions.d.ts +10 -0
  47. package/dist/types/models/ILoggingProcessorConfig.d.ts +22 -0
  48. package/dist/types/models/ILoggingProcessorConstructorOptions.d.ts +14 -0
  49. package/dist/types/models/IRestRouteProcessorConstructorOptions.d.ts +10 -0
  50. package/dist/types/models/IRouteProcessorConfig.d.ts +9 -0
  51. package/dist/types/models/ISocketRouteProcessorConstructorOptions.d.ts +10 -0
  52. package/dist/types/models/IStaticContextIdProcessorConfig.d.ts +17 -0
  53. package/dist/types/models/IStaticContextIdProcessorConstructorOptions.d.ts +10 -0
  54. package/docs/changelog.md +16 -0
  55. package/docs/examples.md +189 -0
  56. package/docs/reference/classes/ContextIdProcessor.md +129 -0
  57. package/docs/reference/classes/JsonLdMimeTypeProcessor.md +87 -0
  58. package/docs/reference/classes/JwtMimeTypeProcessor.md +87 -0
  59. package/docs/reference/classes/LoggingProcessor.md +153 -0
  60. package/docs/reference/classes/RestRouteProcessor.md +107 -0
  61. package/docs/reference/classes/SocketRouteProcessor.md +185 -0
  62. package/docs/reference/classes/StaticContextIdProcessor.md +103 -0
  63. package/docs/reference/index.md +23 -0
  64. package/docs/reference/interfaces/IContextIdProcessorConfig.md +19 -0
  65. package/docs/reference/interfaces/IContextIdProcessorConstructorOptions.md +11 -0
  66. package/docs/reference/interfaces/ILoggingProcessorConfig.md +36 -0
  67. package/docs/reference/interfaces/ILoggingProcessorConstructorOptions.md +19 -0
  68. package/docs/reference/interfaces/IRestRouteProcessorConstructorOptions.md +11 -0
  69. package/docs/reference/interfaces/IRouteProcessorConfig.md +11 -0
  70. package/docs/reference/interfaces/ISocketRouteProcessorConstructorOptions.md +11 -0
  71. package/docs/reference/interfaces/IStaticContextIdProcessorConfig.md +27 -0
  72. package/docs/reference/interfaces/IStaticContextIdProcessorConstructorOptions.md +11 -0
  73. package/locales/en.json +22 -0
  74. package/package.json +50 -5
@@ -0,0 +1,23 @@
1
+ # @3sixty/api-processors
2
+
3
+ ## Classes
4
+
5
+ - [RestRouteProcessor](classes/RestRouteProcessor.md)
6
+ - [SocketRouteProcessor](classes/SocketRouteProcessor.md)
7
+ - [ContextIdProcessor](classes/ContextIdProcessor.md)
8
+ - [StaticContextIdProcessor](classes/StaticContextIdProcessor.md)
9
+ - [LoggingProcessor](classes/LoggingProcessor.md)
10
+ - [JsonLdMimeTypeProcessor](classes/JsonLdMimeTypeProcessor.md)
11
+ - [JwtMimeTypeProcessor](classes/JwtMimeTypeProcessor.md)
12
+
13
+ ## Interfaces
14
+
15
+ - [IContextIdProcessorConfig](interfaces/IContextIdProcessorConfig.md)
16
+ - [IContextIdProcessorConstructorOptions](interfaces/IContextIdProcessorConstructorOptions.md)
17
+ - [ILoggingProcessorConfig](interfaces/ILoggingProcessorConfig.md)
18
+ - [ILoggingProcessorConstructorOptions](interfaces/ILoggingProcessorConstructorOptions.md)
19
+ - [IRestRouteProcessorConstructorOptions](interfaces/IRestRouteProcessorConstructorOptions.md)
20
+ - [IRouteProcessorConfig](interfaces/IRouteProcessorConfig.md)
21
+ - [ISocketRouteProcessorConstructorOptions](interfaces/ISocketRouteProcessorConstructorOptions.md)
22
+ - [IStaticContextIdProcessorConfig](interfaces/IStaticContextIdProcessorConfig.md)
23
+ - [IStaticContextIdProcessorConstructorOptions](interfaces/IStaticContextIdProcessorConstructorOptions.md)
@@ -0,0 +1,19 @@
1
+ # Interface: IContextIdProcessorConfig
2
+
3
+ Configuration for the context id processor.
4
+
5
+ ## Properties
6
+
7
+ ### key {#key}
8
+
9
+ > **key**: `string`
10
+
11
+ The fixed identity key for request context.
12
+
13
+ ***
14
+
15
+ ### authOnly? {#authonly}
16
+
17
+ > `optional` **authOnly?**: `boolean`
18
+
19
+ Only add the identity if the request is authenticated.
@@ -0,0 +1,11 @@
1
+ # Interface: IContextIdProcessorConstructorOptions
2
+
3
+ Options for the ContextIdProcessor constructor.
4
+
5
+ ## Properties
6
+
7
+ ### config {#config}
8
+
9
+ > **config**: [`IContextIdProcessorConfig`](IContextIdProcessorConfig.md)
10
+
11
+ The configuration for the processor.
@@ -0,0 +1,36 @@
1
+ # Interface: ILoggingProcessorConfig
2
+
3
+ Configuration for the request logging processor.
4
+
5
+ ## Properties
6
+
7
+ ### includeBody? {#includebody}
8
+
9
+ > `optional` **includeBody?**: `boolean`
10
+
11
+ Include the body objects when logging the information.
12
+
13
+ ***
14
+
15
+ ### fullBase64? {#fullbase64}
16
+
17
+ > `optional` **fullBase64?**: `boolean`
18
+
19
+ Show the full base64 content for data, default to abbreviate.
20
+
21
+ ***
22
+
23
+ ### obfuscateProperties? {#obfuscateproperties}
24
+
25
+ > `optional` **obfuscateProperties?**: `string`[]
26
+
27
+ List of property names to obfuscate, can be regex, defaults to "password".
28
+
29
+ ***
30
+
31
+ ### excludePaths? {#excludepaths}
32
+
33
+ > `optional` **excludePaths?**: `string`[]
34
+
35
+ Request URL path prefixes to exclude from logging, defaults to ["/logging"].
36
+ Use this to prevent the logging endpoint itself from appearing in its own output.
@@ -0,0 +1,19 @@
1
+ # Interface: ILoggingProcessorConstructorOptions
2
+
3
+ Options for the LoggingProcessor constructor.
4
+
5
+ ## Properties
6
+
7
+ ### loggingComponentType? {#loggingcomponenttype}
8
+
9
+ > `optional` **loggingComponentType?**: `string`
10
+
11
+ The type for the logging component.
12
+
13
+ ***
14
+
15
+ ### config? {#config}
16
+
17
+ > `optional` **config?**: [`ILoggingProcessorConfig`](ILoggingProcessorConfig.md)
18
+
19
+ The configuration for the logging processor.
@@ -0,0 +1,11 @@
1
+ # Interface: IRestRouteProcessorConstructorOptions
2
+
3
+ Options for the RestRouteProcessor constructor.
4
+
5
+ ## Properties
6
+
7
+ ### config? {#config}
8
+
9
+ > `optional` **config?**: [`IRouteProcessorConfig`](IRouteProcessorConfig.md)
10
+
11
+ The configuration for the processor.
@@ -0,0 +1,11 @@
1
+ # Interface: IRouteProcessorConfig
2
+
3
+ Configuration for the route processor.
4
+
5
+ ## Properties
6
+
7
+ ### includeErrorStack? {#includeerrorstack}
8
+
9
+ > `optional` **includeErrorStack?**: `boolean`
10
+
11
+ Include the stack with errors.
@@ -0,0 +1,11 @@
1
+ # Interface: ISocketRouteProcessorConstructorOptions
2
+
3
+ Options for the SocketRouteProcessor constructor.
4
+
5
+ ## Properties
6
+
7
+ ### config? {#config}
8
+
9
+ > `optional` **config?**: [`IRouteProcessorConfig`](IRouteProcessorConfig.md)
10
+
11
+ The configuration for the processor.
@@ -0,0 +1,27 @@
1
+ # Interface: IStaticContextIdProcessorConfig
2
+
3
+ Configuration for the static id processor.
4
+
5
+ ## Properties
6
+
7
+ ### key {#key}
8
+
9
+ > **key**: `string`
10
+
11
+ The fixed identity key for request context.
12
+
13
+ ***
14
+
15
+ ### value {#value}
16
+
17
+ > **value**: `string`
18
+
19
+ The fixed identity value for request context.
20
+
21
+ ***
22
+
23
+ ### authOnly? {#authonly}
24
+
25
+ > `optional` **authOnly?**: `boolean`
26
+
27
+ Only add the identity if the request is authenticated.
@@ -0,0 +1,11 @@
1
+ # Interface: IStaticContextIdProcessorConstructorOptions
2
+
3
+ Options for the StaticContextIdProcessor constructor.
4
+
5
+ ## Properties
6
+
7
+ ### config {#config}
8
+
9
+ > **config**: [`IStaticContextIdProcessorConfig`](IStaticContextIdProcessorConfig.md)
10
+
11
+ The configuration for the processor.
@@ -0,0 +1,22 @@
1
+ {
2
+ "error": {
3
+ "restRouteProcessor": {
4
+ "routeNotFound": "The web server could not find the REST route \"{notFoundId}\""
5
+ },
6
+ "socketRouteProcessor": {
7
+ "routeNotFound": "The web server could not find the socket route \"{notFoundId}\""
8
+ },
9
+ "jsonLdMimeTypeProcessor": {
10
+ "invalidJsonLd": "The JSON-LD content is invalid or missing '@context'."
11
+ },
12
+ "loggingProcessor": {
13
+ "responseMessage": "<=== {statusCode} {method} {requestUrl} duration: {elapsedMicroSeconds}µs"
14
+ }
15
+ },
16
+ "info": {
17
+ "loggingProcessor": {
18
+ "requestMessage": "===> {method} {requestUrl}",
19
+ "responseMessage": "<=== {statusCode} {method} {requestUrl} duration: {elapsedMicroSeconds}µs"
20
+ }
21
+ }
22
+ }
package/package.json CHANGED
@@ -1,6 +1,51 @@
1
1
  {
2
- "name": "@3sixty/api-processors",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@3sixty/api-processors",
3
+ "version": "0.20.0-next.1",
4
+ "description": "Reusable request and route processors for logging, context handling, and content negotiation.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/3sixtyglobal/api.git",
8
+ "directory": "packages/api-processors"
9
+ },
10
+ "author": "martyn.janes@iota.org",
11
+ "license": "Apache-2.0",
12
+ "type": "module",
13
+ "engines": {
14
+ "node": ">=24.0.0"
15
+ },
16
+ "dependencies": {
17
+ "@3sixty/api-models": "0.20.0-next.1",
18
+ "@3sixty/context": "next",
19
+ "@3sixty/core": "next",
20
+ "@3sixty/logging-models": "next",
21
+ "@3sixty/nameof": "next",
22
+ "@3sixty/web": "next"
23
+ },
24
+ "main": "./dist/es/index.js",
25
+ "types": "./dist/types/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/types/index.d.ts",
29
+ "import": "./dist/es/index.js",
30
+ "default": "./dist/es/index.js"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist/es",
35
+ "dist/types",
36
+ "locales",
37
+ "docs"
38
+ ],
39
+ "keywords": [
40
+ "twin",
41
+ "trade",
42
+ "iota",
43
+ "framework",
44
+ "blockchain",
45
+ "api"
46
+ ],
47
+ "bugs": {
48
+ "url": "git+https://github.com/3sixtyglobal/api/issues"
49
+ },
50
+ "homepage": "https://3sixty.global"
51
+ }