@twin.org/api-server-fastify 0.0.2-next.1 → 0.0.2-next.2

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.
@@ -288,15 +288,20 @@ class FastifyWebServer {
288
288
  for (const socketRoute of socketRoutes) {
289
289
  const path = core.StringHelper.trimLeadingSlashes(core.StringHelper.trimTrailingSlashes(socketRoute.path));
290
290
  const pathParts = path.split("/");
291
+ const namespace = `/${pathParts[0]}`;
292
+ const topic = pathParts.slice(1).join("/");
291
293
  await this._loggingConnector?.log({
292
294
  level: "info",
293
295
  ts: Date.now(),
294
296
  source: this.CLASS_NAME,
295
297
  message: `${FastifyWebServer._CLASS_NAME_CAMEL_CASE}.socketRouteAdded`,
296
- data: { route: `/${path}` }
298
+ data: {
299
+ handshakePath: this._socketConfig.path,
300
+ namespace,
301
+ eventName: topic
302
+ }
297
303
  });
298
- const socketNamespace = io.of(`/${pathParts[0]}`);
299
- const topic = pathParts.slice(1).join("/");
304
+ const socketNamespace = io.of(namespace);
300
305
  socketNamespace.on("connection", async (socket) => {
301
306
  const httpServerRequest = {
302
307
  method: web.HttpMethod.GET,
@@ -286,15 +286,20 @@ class FastifyWebServer {
286
286
  for (const socketRoute of socketRoutes) {
287
287
  const path = StringHelper.trimLeadingSlashes(StringHelper.trimTrailingSlashes(socketRoute.path));
288
288
  const pathParts = path.split("/");
289
+ const namespace = `/${pathParts[0]}`;
290
+ const topic = pathParts.slice(1).join("/");
289
291
  await this._loggingConnector?.log({
290
292
  level: "info",
291
293
  ts: Date.now(),
292
294
  source: this.CLASS_NAME,
293
295
  message: `${FastifyWebServer._CLASS_NAME_CAMEL_CASE}.socketRouteAdded`,
294
- data: { route: `/${path}` }
296
+ data: {
297
+ handshakePath: this._socketConfig.path,
298
+ namespace,
299
+ eventName: topic
300
+ }
295
301
  });
296
- const socketNamespace = io.of(`/${pathParts[0]}`);
297
- const topic = pathParts.slice(1).join("/");
302
+ const socketNamespace = io.of(namespace);
298
303
  socketNamespace.on("connection", async (socket) => {
299
304
  const httpServerRequest = {
300
305
  method: HttpMethod.GET,
package/docs/changelog.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @twin.org/api-server-fastify - Changelog
2
2
 
3
+ ## [0.0.2-next.2](https://github.com/twinfoundation/api/compare/api-server-fastify-v0.0.2-next.1...api-server-fastify-v0.0.2-next.2) (2025-07-17)
4
+
5
+
6
+ ### Features
7
+
8
+ * improve socket route logging ([b8d9519](https://github.com/twinfoundation/api/commit/b8d95199f838ac6ba9f45c30ef7c4e613201ff53))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/api-core bumped from 0.0.2-next.1 to 0.0.2-next.2
16
+ * @twin.org/api-models bumped from 0.0.2-next.1 to 0.0.2-next.2
17
+ * @twin.org/api-processors bumped from 0.0.2-next.1 to 0.0.2-next.2
18
+
3
19
  ## [0.0.2-next.1](https://github.com/twinfoundation/api/compare/api-server-fastify-v0.0.2-next.0...api-server-fastify-v0.0.2-next.1) (2025-07-08)
4
20
 
5
21
 
package/locales/en.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "stopped": "The Web Server was stopped",
8
8
  "badRequest": "The web server could not handle the request",
9
9
  "restRouteAdded": "Added REST route \"{route}\" \"{method}\"",
10
- "socketRouteAdded": "Added socket route \"{route}\"",
10
+ "socketRouteAdded": "Added socket route: handshake path \"{handshakePath}\", namespace \"{namespace}\", event name \"{eventName}\"",
11
11
  "noRestProcessors": "You must configure at least one REST processor",
12
12
  "noSocketProcessors": "You must configure at least one socket processor",
13
13
  "postProcessorError": "There was a failure after in a post processor for route \"{route}\""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/api-server-fastify",
3
- "version": "0.0.2-next.1",
3
+ "version": "0.0.2-next.2",
4
4
  "description": "Use Fastify as the core web server for APIs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,16 +14,16 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@fastify/compress": "8.0.3",
17
+ "@fastify/compress": "8.1.0",
18
18
  "@fastify/cors": "11.0.1",
19
- "@twin.org/api-core": "0.0.2-next.1",
20
- "@twin.org/api-models": "0.0.2-next.1",
21
- "@twin.org/api-processors": "0.0.2-next.1",
19
+ "@twin.org/api-core": "0.0.2-next.2",
20
+ "@twin.org/api-models": "0.0.2-next.2",
21
+ "@twin.org/api-processors": "0.0.2-next.2",
22
22
  "@twin.org/core": "next",
23
23
  "@twin.org/logging-models": "next",
24
24
  "@twin.org/nameof": "next",
25
25
  "@twin.org/web": "next",
26
- "fastify": "5.3.3",
26
+ "fastify": "5.4.0",
27
27
  "socket.io": "4.8.1"
28
28
  },
29
29
  "main": "./dist/cjs/index.cjs",