@twin.org/api-processors 0.0.2-next.11 → 0.0.2-next.13

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.
@@ -13,7 +13,7 @@ class RestRouteProcessor {
13
13
  /**
14
14
  * Runtime name for the class.
15
15
  */
16
- CLASS_NAME = "RestRouteProcessor";
16
+ static CLASS_NAME = "RestRouteProcessor";
17
17
  /**
18
18
  * Include the stack with errors.
19
19
  * @internal
@@ -42,7 +42,7 @@ class RestRouteProcessor {
42
42
  if (core.Is.empty(route)) {
43
43
  apiModels.HttpErrorHelper.buildResponse(response, {
44
44
  name: core.NotFoundError.CLASS_NAME,
45
- message: `${this.CLASS_NAME}.routeNotFound`,
45
+ message: `${RestRouteProcessor.CLASS_NAME}.routeNotFound`,
46
46
  properties: {
47
47
  notFoundId: request.url
48
48
  }
@@ -120,7 +120,7 @@ class SocketRouteProcessor {
120
120
  /**
121
121
  * Runtime name for the class.
122
122
  */
123
- CLASS_NAME = "SocketRouteProcessor";
123
+ static CLASS_NAME = "SocketRouteProcessor";
124
124
  /**
125
125
  * Include the stack with errors.
126
126
  * @internal
@@ -192,7 +192,7 @@ class SocketRouteProcessor {
192
192
  if (core.Is.empty(route)) {
193
193
  apiModels.HttpErrorHelper.buildResponse(response, {
194
194
  name: core.NotFoundError.CLASS_NAME,
195
- message: `${this.CLASS_NAME}.routeNotFound`,
195
+ message: `${SocketRouteProcessor.CLASS_NAME}.routeNotFound`,
196
196
  properties: {
197
197
  notFoundId: request.url
198
198
  }
@@ -236,7 +236,7 @@ class NodeIdentityProcessor {
236
236
  /**
237
237
  * Runtime name for the class.
238
238
  */
239
- CLASS_NAME = "NodeIdentityProcessor";
239
+ static CLASS_NAME = "NodeIdentityProcessor";
240
240
  /**
241
241
  * The node identity for request context.
242
242
  * @internal
@@ -249,7 +249,7 @@ class NodeIdentityProcessor {
249
249
  * @returns Nothing.
250
250
  */
251
251
  async start(nodeIdentity, nodeLoggingComponentType) {
252
- core.Guards.string(this.CLASS_NAME, "nodeIdentity", nodeIdentity);
252
+ core.Guards.string(NodeIdentityProcessor.CLASS_NAME, "nodeIdentity", nodeIdentity);
253
253
  this._nodeIdentity = nodeIdentity;
254
254
  }
255
255
  /**
@@ -272,7 +272,7 @@ class StaticUserIdentityProcessor {
272
272
  /**
273
273
  * Runtime name for the class.
274
274
  */
275
- CLASS_NAME = "StaticUserIdentityProcessor";
275
+ static CLASS_NAME = "StaticUserIdentityProcessor";
276
276
  /**
277
277
  * The fixed identity for request context.
278
278
  * @internal
@@ -283,9 +283,9 @@ class StaticUserIdentityProcessor {
283
283
  * @param options Options for the processor.
284
284
  */
285
285
  constructor(options) {
286
- core.Guards.object(this.CLASS_NAME, "options", options);
287
- core.Guards.object(this.CLASS_NAME, "options.config", options.config);
288
- core.Guards.stringValue(this.CLASS_NAME, "options.config.userIdentity", options.config.userIdentity);
286
+ core.Guards.object(StaticUserIdentityProcessor.CLASS_NAME, "options", options);
287
+ core.Guards.object(StaticUserIdentityProcessor.CLASS_NAME, "options.config", options.config);
288
+ core.Guards.stringValue(StaticUserIdentityProcessor.CLASS_NAME, "options.config.userIdentity", options.config.userIdentity);
289
289
  this._userIdentity = options.config.userIdentity;
290
290
  }
291
291
  /**
@@ -310,7 +310,7 @@ class LoggingProcessor {
310
310
  /**
311
311
  * Runtime name for the class.
312
312
  */
313
- CLASS_NAME = "LoggingProcessor";
313
+ static CLASS_NAME = "LoggingProcessor";
314
314
  /**
315
315
  * The component for logging the information.
316
316
  * @internal
@@ -366,7 +366,7 @@ class LoggingProcessor {
366
366
  }
367
367
  await this._logging?.log({
368
368
  level: "info",
369
- source: this.CLASS_NAME,
369
+ source: LoggingProcessor.CLASS_NAME,
370
370
  ts: Date.now(),
371
371
  message: `===> ${request.method} ${requestUrl}`,
372
372
  data: this._includeBody && isJson
@@ -426,7 +426,7 @@ class LoggingProcessor {
426
426
  level: core.Is.number(response.statusCode) && response.statusCode >= web.HttpStatusCode.badRequest
427
427
  ? "error"
428
428
  : "info",
429
- source: this.CLASS_NAME,
429
+ source: LoggingProcessor.CLASS_NAME,
430
430
  ts: Date.now(),
431
431
  message: `<=== ${response.statusCode ?? ""} ${request.method} ${requestUrl} duration: ${elapsedMicroSeconds}µs`,
432
432
  data
@@ -478,7 +478,7 @@ class JsonLdMimeTypeProcessor {
478
478
  /**
479
479
  * Runtime name for the class.
480
480
  */
481
- CLASS_NAME = "JsonLdMimeTypeProcessor";
481
+ static CLASS_NAME = "JsonLdMimeTypeProcessor";
482
482
  /**
483
483
  * Get the MIME types that this handler can handle.
484
484
  * @returns The MIME types that this handler can handle.
@@ -494,7 +494,7 @@ class JsonLdMimeTypeProcessor {
494
494
  async handle(body) {
495
495
  const json = core.ObjectHelper.fromBytes(body);
496
496
  if (core.Is.empty(json) || core.Is.empty(json["@context"])) {
497
- throw new core.GeneralError(this.CLASS_NAME, "invalidJsonLd");
497
+ throw new core.GeneralError(JsonLdMimeTypeProcessor.CLASS_NAME, "invalidJsonLd");
498
498
  }
499
499
  return json;
500
500
  }
@@ -507,7 +507,7 @@ class JwtMimeTypeProcessor {
507
507
  /**
508
508
  * Runtime name for the class.
509
509
  */
510
- CLASS_NAME = "JwtMimeTypeProcessor";
510
+ static CLASS_NAME = "JwtMimeTypeProcessor";
511
511
  /**
512
512
  * Get the MIME types that this handler can handle.
513
513
  * @returns The MIME types that this handler can handle.
@@ -11,7 +11,7 @@ class RestRouteProcessor {
11
11
  /**
12
12
  * Runtime name for the class.
13
13
  */
14
- CLASS_NAME = "RestRouteProcessor";
14
+ static CLASS_NAME = "RestRouteProcessor";
15
15
  /**
16
16
  * Include the stack with errors.
17
17
  * @internal
@@ -40,7 +40,7 @@ class RestRouteProcessor {
40
40
  if (Is.empty(route)) {
41
41
  HttpErrorHelper.buildResponse(response, {
42
42
  name: NotFoundError.CLASS_NAME,
43
- message: `${this.CLASS_NAME}.routeNotFound`,
43
+ message: `${RestRouteProcessor.CLASS_NAME}.routeNotFound`,
44
44
  properties: {
45
45
  notFoundId: request.url
46
46
  }
@@ -118,7 +118,7 @@ class SocketRouteProcessor {
118
118
  /**
119
119
  * Runtime name for the class.
120
120
  */
121
- CLASS_NAME = "SocketRouteProcessor";
121
+ static CLASS_NAME = "SocketRouteProcessor";
122
122
  /**
123
123
  * Include the stack with errors.
124
124
  * @internal
@@ -190,7 +190,7 @@ class SocketRouteProcessor {
190
190
  if (Is.empty(route)) {
191
191
  HttpErrorHelper.buildResponse(response, {
192
192
  name: NotFoundError.CLASS_NAME,
193
- message: `${this.CLASS_NAME}.routeNotFound`,
193
+ message: `${SocketRouteProcessor.CLASS_NAME}.routeNotFound`,
194
194
  properties: {
195
195
  notFoundId: request.url
196
196
  }
@@ -234,7 +234,7 @@ class NodeIdentityProcessor {
234
234
  /**
235
235
  * Runtime name for the class.
236
236
  */
237
- CLASS_NAME = "NodeIdentityProcessor";
237
+ static CLASS_NAME = "NodeIdentityProcessor";
238
238
  /**
239
239
  * The node identity for request context.
240
240
  * @internal
@@ -247,7 +247,7 @@ class NodeIdentityProcessor {
247
247
  * @returns Nothing.
248
248
  */
249
249
  async start(nodeIdentity, nodeLoggingComponentType) {
250
- Guards.string(this.CLASS_NAME, "nodeIdentity", nodeIdentity);
250
+ Guards.string(NodeIdentityProcessor.CLASS_NAME, "nodeIdentity", nodeIdentity);
251
251
  this._nodeIdentity = nodeIdentity;
252
252
  }
253
253
  /**
@@ -270,7 +270,7 @@ class StaticUserIdentityProcessor {
270
270
  /**
271
271
  * Runtime name for the class.
272
272
  */
273
- CLASS_NAME = "StaticUserIdentityProcessor";
273
+ static CLASS_NAME = "StaticUserIdentityProcessor";
274
274
  /**
275
275
  * The fixed identity for request context.
276
276
  * @internal
@@ -281,9 +281,9 @@ class StaticUserIdentityProcessor {
281
281
  * @param options Options for the processor.
282
282
  */
283
283
  constructor(options) {
284
- Guards.object(this.CLASS_NAME, "options", options);
285
- Guards.object(this.CLASS_NAME, "options.config", options.config);
286
- Guards.stringValue(this.CLASS_NAME, "options.config.userIdentity", options.config.userIdentity);
284
+ Guards.object(StaticUserIdentityProcessor.CLASS_NAME, "options", options);
285
+ Guards.object(StaticUserIdentityProcessor.CLASS_NAME, "options.config", options.config);
286
+ Guards.stringValue(StaticUserIdentityProcessor.CLASS_NAME, "options.config.userIdentity", options.config.userIdentity);
287
287
  this._userIdentity = options.config.userIdentity;
288
288
  }
289
289
  /**
@@ -308,7 +308,7 @@ class LoggingProcessor {
308
308
  /**
309
309
  * Runtime name for the class.
310
310
  */
311
- CLASS_NAME = "LoggingProcessor";
311
+ static CLASS_NAME = "LoggingProcessor";
312
312
  /**
313
313
  * The component for logging the information.
314
314
  * @internal
@@ -364,7 +364,7 @@ class LoggingProcessor {
364
364
  }
365
365
  await this._logging?.log({
366
366
  level: "info",
367
- source: this.CLASS_NAME,
367
+ source: LoggingProcessor.CLASS_NAME,
368
368
  ts: Date.now(),
369
369
  message: `===> ${request.method} ${requestUrl}`,
370
370
  data: this._includeBody && isJson
@@ -424,7 +424,7 @@ class LoggingProcessor {
424
424
  level: Is.number(response.statusCode) && response.statusCode >= HttpStatusCode.badRequest
425
425
  ? "error"
426
426
  : "info",
427
- source: this.CLASS_NAME,
427
+ source: LoggingProcessor.CLASS_NAME,
428
428
  ts: Date.now(),
429
429
  message: `<=== ${response.statusCode ?? ""} ${request.method} ${requestUrl} duration: ${elapsedMicroSeconds}µs`,
430
430
  data
@@ -476,7 +476,7 @@ class JsonLdMimeTypeProcessor {
476
476
  /**
477
477
  * Runtime name for the class.
478
478
  */
479
- CLASS_NAME = "JsonLdMimeTypeProcessor";
479
+ static CLASS_NAME = "JsonLdMimeTypeProcessor";
480
480
  /**
481
481
  * Get the MIME types that this handler can handle.
482
482
  * @returns The MIME types that this handler can handle.
@@ -492,7 +492,7 @@ class JsonLdMimeTypeProcessor {
492
492
  async handle(body) {
493
493
  const json = ObjectHelper.fromBytes(body);
494
494
  if (Is.empty(json) || Is.empty(json["@context"])) {
495
- throw new GeneralError(this.CLASS_NAME, "invalidJsonLd");
495
+ throw new GeneralError(JsonLdMimeTypeProcessor.CLASS_NAME, "invalidJsonLd");
496
496
  }
497
497
  return json;
498
498
  }
@@ -505,7 +505,7 @@ class JwtMimeTypeProcessor {
505
505
  /**
506
506
  * Runtime name for the class.
507
507
  */
508
- CLASS_NAME = "JwtMimeTypeProcessor";
508
+ static CLASS_NAME = "JwtMimeTypeProcessor";
509
509
  /**
510
510
  * Get the MIME types that this handler can handle.
511
511
  * @returns The MIME types that this handler can handle.
@@ -7,7 +7,7 @@ export declare class RestRouteProcessor implements IRestRouteProcessor {
7
7
  /**
8
8
  * Runtime name for the class.
9
9
  */
10
- readonly CLASS_NAME: string;
10
+ static readonly CLASS_NAME: string;
11
11
  /**
12
12
  * Create a new instance of RouteProcessor.
13
13
  * @param options Options for the processor.
@@ -7,7 +7,7 @@ export declare class SocketRouteProcessor implements ISocketRouteProcessor {
7
7
  /**
8
8
  * Runtime name for the class.
9
9
  */
10
- readonly CLASS_NAME: string;
10
+ static readonly CLASS_NAME: string;
11
11
  /**
12
12
  * Create a new instance of SocketRouteProcessor.
13
13
  * @param options Options for the processor.
@@ -6,7 +6,7 @@ export declare class NodeIdentityProcessor implements IBaseRouteProcessor {
6
6
  /**
7
7
  * Runtime name for the class.
8
8
  */
9
- readonly CLASS_NAME: string;
9
+ static readonly CLASS_NAME: string;
10
10
  /**
11
11
  * The service needs to be started when the application is initialized.
12
12
  * @param nodeIdentity The identity of the node.
@@ -7,7 +7,7 @@ export declare class StaticUserIdentityProcessor implements IBaseRouteProcessor
7
7
  /**
8
8
  * Runtime name for the class.
9
9
  */
10
- readonly CLASS_NAME: string;
10
+ static readonly CLASS_NAME: string;
11
11
  /**
12
12
  * Create a new instance of StaticIdentityProcessor.
13
13
  * @param options Options for the processor.
@@ -7,7 +7,7 @@ export declare class LoggingProcessor implements IBaseRouteProcessor {
7
7
  /**
8
8
  * Runtime name for the class.
9
9
  */
10
- readonly CLASS_NAME: string;
10
+ static readonly CLASS_NAME: string;
11
11
  /**
12
12
  * Create a new instance of LoggingProcessor.
13
13
  * @param options Options for the processor.
@@ -6,7 +6,7 @@ export declare class JsonLdMimeTypeProcessor implements IMimeTypeProcessor {
6
6
  /**
7
7
  * Runtime name for the class.
8
8
  */
9
- readonly CLASS_NAME: string;
9
+ static readonly CLASS_NAME: string;
10
10
  /**
11
11
  * Get the MIME types that this handler can handle.
12
12
  * @returns The MIME types that this handler can handle.
@@ -6,7 +6,7 @@ export declare class JwtMimeTypeProcessor implements IMimeTypeProcessor {
6
6
  /**
7
7
  * Runtime name for the class.
8
8
  */
9
- readonly CLASS_NAME: string;
9
+ static readonly CLASS_NAME: string;
10
10
  /**
11
11
  * Get the MIME types that this handler can handle.
12
12
  * @returns The MIME types that this handler can handle.
package/docs/changelog.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @twin.org/api-processors - Changelog
2
2
 
3
+ ## [0.0.2-next.13](https://github.com/twinfoundation/api/compare/api-processors-v0.0.2-next.12...api-processors-v0.0.2-next.13) (2025-10-09)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **api-processors:** Synchronize repo versions
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.12 to 0.0.2-next.13
16
+
17
+ ## [0.0.2-next.12](https://github.com/twinfoundation/api/compare/api-processors-v0.0.2-next.11...api-processors-v0.0.2-next.12) (2025-10-09)
18
+
19
+
20
+ ### Features
21
+
22
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/api-models bumped from 0.0.2-next.11 to 0.0.2-next.12
30
+
3
31
  ## [0.0.2-next.11](https://github.com/twinfoundation/api/compare/api-processors-v0.0.2-next.10...api-processors-v0.0.2-next.11) (2025-09-29)
4
32
 
5
33
 
@@ -20,14 +20,10 @@ Process the JSON-LD mime type.
20
20
 
21
21
  ### CLASS\_NAME
22
22
 
23
- > `readonly` **CLASS\_NAME**: `string`
23
+ > `readonly` `static` **CLASS\_NAME**: `string`
24
24
 
25
25
  Runtime name for the class.
26
26
 
27
- #### Implementation of
28
-
29
- `IMimeTypeProcessor.CLASS_NAME`
30
-
31
27
  ## Methods
32
28
 
33
29
  ### getTypes()
@@ -20,14 +20,10 @@ Process the JWT mime type.
20
20
 
21
21
  ### CLASS\_NAME
22
22
 
23
- > `readonly` **CLASS\_NAME**: `string`
23
+ > `readonly` `static` **CLASS\_NAME**: `string`
24
24
 
25
25
  Runtime name for the class.
26
26
 
27
- #### Implementation of
28
-
29
- `IMimeTypeProcessor.CLASS_NAME`
30
-
31
27
  ## Methods
32
28
 
33
29
  ### getTypes()
@@ -30,14 +30,10 @@ Options for the processor.
30
30
 
31
31
  ### CLASS\_NAME
32
32
 
33
- > `readonly` **CLASS\_NAME**: `string`
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
35
35
  Runtime name for the class.
36
36
 
37
- #### Implementation of
38
-
39
- `IBaseRouteProcessor.CLASS_NAME`
40
-
41
37
  ## Methods
42
38
 
43
39
  ### pre()
@@ -20,14 +20,10 @@ Adds a node identity to the request identity.
20
20
 
21
21
  ### CLASS\_NAME
22
22
 
23
- > `readonly` **CLASS\_NAME**: `string`
23
+ > `readonly` `static` **CLASS\_NAME**: `string`
24
24
 
25
25
  Runtime name for the class.
26
26
 
27
- #### Implementation of
28
-
29
- `IBaseRouteProcessor.CLASS_NAME`
30
-
31
27
  ## Methods
32
28
 
33
29
  ### start()
@@ -30,14 +30,10 @@ Options for the processor.
30
30
 
31
31
  ### CLASS\_NAME
32
32
 
33
- > `readonly` **CLASS\_NAME**: `string`
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
35
35
  Runtime name for the class.
36
36
 
37
- #### Implementation of
38
-
39
- `IRestRouteProcessor.CLASS_NAME`
40
-
41
37
  ## Methods
42
38
 
43
39
  ### process()
@@ -30,14 +30,10 @@ Options for the processor.
30
30
 
31
31
  ### CLASS\_NAME
32
32
 
33
- > `readonly` **CLASS\_NAME**: `string`
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
35
35
  Runtime name for the class.
36
36
 
37
- #### Implementation of
38
-
39
- `ISocketRouteProcessor.CLASS_NAME`
40
-
41
37
  ## Methods
42
38
 
43
39
  ### connected()
@@ -30,14 +30,10 @@ Options for the processor.
30
30
 
31
31
  ### CLASS\_NAME
32
32
 
33
- > `readonly` **CLASS\_NAME**: `string`
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
35
35
  Runtime name for the class.
36
36
 
37
- #### Implementation of
38
-
39
- `IBaseRouteProcessor.CLASS_NAME`
40
-
41
37
  ## Methods
42
38
 
43
39
  ### pre()
package/locales/en.json CHANGED
@@ -6,11 +6,6 @@
6
6
  "socketRouteProcessor": {
7
7
  "routeNotFound": "The web server could not find the socket route \"{notFoundId}\""
8
8
  },
9
- "jwtIdentityProcessor": {
10
- "jwtMissing": "The JSON Web token could not be found in the authorization header or a cookie",
11
- "jwtSignatureInvalid": "The JSON Web token signature could not be validated",
12
- "jwtExpired": "The JSON Web token has expired"
13
- },
14
9
  "jsonLdMimeTypeProcessor": {
15
10
  "invalidJsonLd": "The JSON-LD content is invalid or missing '@context'."
16
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/api-processors",
3
- "version": "0.0.2-next.11",
3
+ "version": "0.0.2-next.13",
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.11",
17
+ "@twin.org/api-models": "0.0.2-next.13",
18
18
  "@twin.org/core": "next",
19
19
  "@twin.org/logging-models": "next",
20
20
  "@twin.org/nameof": "next",
@@ -36,5 +36,17 @@
36
36
  "dist/types",
37
37
  "locales",
38
38
  "docs"
39
- ]
39
+ ],
40
+ "keywords": [
41
+ "twin",
42
+ "trade",
43
+ "iota",
44
+ "framework",
45
+ "blockchain",
46
+ "api"
47
+ ],
48
+ "bugs": {
49
+ "url": "git+https://github.com/twinfoundation/api/issues"
50
+ },
51
+ "homepage": "https://twindev.org"
40
52
  }