@twin.org/api-server-fastify 0.0.2-next.5 → 0.0.2-next.7

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.
@@ -55,7 +55,7 @@ class FastifyWebServer {
55
55
  * The logging component.
56
56
  * @internal
57
57
  */
58
- _loggingComponent;
58
+ _logging;
59
59
  /**
60
60
  * The options for the server.
61
61
  * @internal
@@ -92,9 +92,7 @@ class FastifyWebServer {
92
92
  */
93
93
  constructor(options) {
94
94
  this._loggingComponentType = options?.loggingComponentType;
95
- this._loggingComponent = core.Is.stringValue(options?.loggingComponentType)
96
- ? core.ComponentFactory.get(options.loggingComponentType)
97
- : undefined;
95
+ this._logging = core.ComponentFactory.getIfExists(options?.loggingComponentType ?? "logging");
98
96
  this._fastify = Fastify({
99
97
  maxParamLength: 2000,
100
98
  ...options?.config?.web
@@ -134,7 +132,7 @@ class FastifyWebServer {
134
132
  if (core.Is.arrayValue(socketRoutes) && !core.Is.arrayValue(socketRouteProcessors)) {
135
133
  throw new core.GeneralError(this.CLASS_NAME, "noSocketProcessors");
136
134
  }
137
- await this._loggingComponent?.log({
135
+ await this._logging?.log({
138
136
  level: "info",
139
137
  ts: Date.now(),
140
138
  source: this.CLASS_NAME,
@@ -179,7 +177,7 @@ class FastifyWebServer {
179
177
  err = errorAndCode.error;
180
178
  httpStatusCode = errorAndCode.httpStatusCode;
181
179
  }
182
- await this._loggingComponent?.log({
180
+ await this._logging?.log({
183
181
  level: "error",
184
182
  ts: Date.now(),
185
183
  source: this.CLASS_NAME,
@@ -200,7 +198,7 @@ class FastifyWebServer {
200
198
  async start() {
201
199
  const host = this._options?.host ?? FastifyWebServer._DEFAULT_HOST;
202
200
  const port = this._options?.port ?? FastifyWebServer._DEFAULT_PORT;
203
- await this._loggingComponent?.log({
201
+ await this._logging?.log({
204
202
  level: "info",
205
203
  ts: Date.now(),
206
204
  source: this.CLASS_NAME,
@@ -215,7 +213,7 @@ class FastifyWebServer {
215
213
  await this._fastify.listen({ port, host });
216
214
  const addresses = this._fastify.addresses();
217
215
  const protocol = core.Is.object(this._fastify.initialConfig.https) ? "https://" : "http://";
218
- await this._loggingComponent?.log({
216
+ await this._logging?.log({
219
217
  level: "info",
220
218
  ts: Date.now(),
221
219
  source: this.CLASS_NAME,
@@ -229,7 +227,7 @@ class FastifyWebServer {
229
227
  this._started = true;
230
228
  }
231
229
  catch (err) {
232
- await this._loggingComponent?.log({
230
+ await this._logging?.log({
233
231
  level: "error",
234
232
  ts: Date.now(),
235
233
  source: this.CLASS_NAME,
@@ -247,7 +245,7 @@ class FastifyWebServer {
247
245
  if (this._started) {
248
246
  this._started = false;
249
247
  await this._fastify.close();
250
- await this._loggingComponent?.log({
248
+ await this._logging?.log({
251
249
  level: "info",
252
250
  ts: Date.now(),
253
251
  source: this.CLASS_NAME,
@@ -268,7 +266,7 @@ class FastifyWebServer {
268
266
  if (!path.startsWith("/")) {
269
267
  path = `/${path}`;
270
268
  }
271
- await this._loggingComponent?.log({
269
+ await this._logging?.log({
272
270
  level: "info",
273
271
  ts: Date.now(),
274
272
  source: this.CLASS_NAME,
@@ -295,7 +293,7 @@ class FastifyWebServer {
295
293
  const pathParts = path.split("/");
296
294
  const namespace = `/${pathParts[0]}`;
297
295
  const topic = pathParts.slice(1).join("/");
298
- await this._loggingComponent?.log({
296
+ await this._logging?.log({
299
297
  level: "info",
300
298
  ts: Date.now(),
301
299
  source: this.CLASS_NAME,
@@ -465,7 +463,7 @@ class FastifyWebServer {
465
463
  }
466
464
  }
467
465
  catch (err) {
468
- this._loggingComponent?.log({
466
+ this._logging?.log({
469
467
  level: "error",
470
468
  ts: Date.now(),
471
469
  source: this.CLASS_NAME,
@@ -53,7 +53,7 @@ class FastifyWebServer {
53
53
  * The logging component.
54
54
  * @internal
55
55
  */
56
- _loggingComponent;
56
+ _logging;
57
57
  /**
58
58
  * The options for the server.
59
59
  * @internal
@@ -90,9 +90,7 @@ class FastifyWebServer {
90
90
  */
91
91
  constructor(options) {
92
92
  this._loggingComponentType = options?.loggingComponentType;
93
- this._loggingComponent = Is.stringValue(options?.loggingComponentType)
94
- ? ComponentFactory.get(options.loggingComponentType)
95
- : undefined;
93
+ this._logging = ComponentFactory.getIfExists(options?.loggingComponentType ?? "logging");
96
94
  this._fastify = Fastify({
97
95
  maxParamLength: 2000,
98
96
  ...options?.config?.web
@@ -132,7 +130,7 @@ class FastifyWebServer {
132
130
  if (Is.arrayValue(socketRoutes) && !Is.arrayValue(socketRouteProcessors)) {
133
131
  throw new GeneralError(this.CLASS_NAME, "noSocketProcessors");
134
132
  }
135
- await this._loggingComponent?.log({
133
+ await this._logging?.log({
136
134
  level: "info",
137
135
  ts: Date.now(),
138
136
  source: this.CLASS_NAME,
@@ -177,7 +175,7 @@ class FastifyWebServer {
177
175
  err = errorAndCode.error;
178
176
  httpStatusCode = errorAndCode.httpStatusCode;
179
177
  }
180
- await this._loggingComponent?.log({
178
+ await this._logging?.log({
181
179
  level: "error",
182
180
  ts: Date.now(),
183
181
  source: this.CLASS_NAME,
@@ -198,7 +196,7 @@ class FastifyWebServer {
198
196
  async start() {
199
197
  const host = this._options?.host ?? FastifyWebServer._DEFAULT_HOST;
200
198
  const port = this._options?.port ?? FastifyWebServer._DEFAULT_PORT;
201
- await this._loggingComponent?.log({
199
+ await this._logging?.log({
202
200
  level: "info",
203
201
  ts: Date.now(),
204
202
  source: this.CLASS_NAME,
@@ -213,7 +211,7 @@ class FastifyWebServer {
213
211
  await this._fastify.listen({ port, host });
214
212
  const addresses = this._fastify.addresses();
215
213
  const protocol = Is.object(this._fastify.initialConfig.https) ? "https://" : "http://";
216
- await this._loggingComponent?.log({
214
+ await this._logging?.log({
217
215
  level: "info",
218
216
  ts: Date.now(),
219
217
  source: this.CLASS_NAME,
@@ -227,7 +225,7 @@ class FastifyWebServer {
227
225
  this._started = true;
228
226
  }
229
227
  catch (err) {
230
- await this._loggingComponent?.log({
228
+ await this._logging?.log({
231
229
  level: "error",
232
230
  ts: Date.now(),
233
231
  source: this.CLASS_NAME,
@@ -245,7 +243,7 @@ class FastifyWebServer {
245
243
  if (this._started) {
246
244
  this._started = false;
247
245
  await this._fastify.close();
248
- await this._loggingComponent?.log({
246
+ await this._logging?.log({
249
247
  level: "info",
250
248
  ts: Date.now(),
251
249
  source: this.CLASS_NAME,
@@ -266,7 +264,7 @@ class FastifyWebServer {
266
264
  if (!path.startsWith("/")) {
267
265
  path = `/${path}`;
268
266
  }
269
- await this._loggingComponent?.log({
267
+ await this._logging?.log({
270
268
  level: "info",
271
269
  ts: Date.now(),
272
270
  source: this.CLASS_NAME,
@@ -293,7 +291,7 @@ class FastifyWebServer {
293
291
  const pathParts = path.split("/");
294
292
  const namespace = `/${pathParts[0]}`;
295
293
  const topic = pathParts.slice(1).join("/");
296
- await this._loggingComponent?.log({
294
+ await this._logging?.log({
297
295
  level: "info",
298
296
  ts: Date.now(),
299
297
  source: this.CLASS_NAME,
@@ -463,7 +461,7 @@ class FastifyWebServer {
463
461
  }
464
462
  }
465
463
  catch (err) {
466
- this._loggingComponent?.log({
464
+ this._logging?.log({
467
465
  level: "error",
468
466
  ts: Date.now(),
469
467
  source: this.CLASS_NAME,
package/docs/changelog.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @twin.org/api-server-fastify - Changelog
2
2
 
3
+ ## [0.0.2-next.7](https://github.com/twinfoundation/api/compare/api-server-fastify-v0.0.2-next.6...api-server-fastify-v0.0.2-next.7) (2025-08-20)
4
+
5
+
6
+ ### Features
7
+
8
+ * logging naming consistency ([a4a6ef2](https://github.com/twinfoundation/api/commit/a4a6ef2de5049045589eb78b177ff62e744bde9d))
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.6 to 0.0.2-next.7
16
+ * @twin.org/api-models bumped from 0.0.2-next.6 to 0.0.2-next.7
17
+ * @twin.org/api-processors bumped from 0.0.2-next.6 to 0.0.2-next.7
18
+
19
+ ## [0.0.2-next.6](https://github.com/twinfoundation/api/compare/api-server-fastify-v0.0.2-next.5...api-server-fastify-v0.0.2-next.6) (2025-08-19)
20
+
21
+
22
+ ### Features
23
+
24
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
25
+
26
+
27
+ ### Dependencies
28
+
29
+ * The following workspace dependencies were updated
30
+ * dependencies
31
+ * @twin.org/api-core bumped from 0.0.2-next.5 to 0.0.2-next.6
32
+ * @twin.org/api-models bumped from 0.0.2-next.5 to 0.0.2-next.6
33
+ * @twin.org/api-processors bumped from 0.0.2-next.5 to 0.0.2-next.6
34
+
3
35
  ## [0.0.2-next.5](https://github.com/twinfoundation/api/compare/api-server-fastify-v0.0.2-next.4...api-server-fastify-v0.0.2-next.5) (2025-07-25)
4
36
 
5
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/api-server-fastify",
3
- "version": "0.0.2-next.5",
3
+ "version": "0.0.2-next.7",
4
4
  "description": "Use Fastify as the core web server for APIs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,15 +15,15 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@fastify/compress": "8.1.0",
18
- "@fastify/cors": "11.0.1",
19
- "@twin.org/api-core": "0.0.2-next.5",
20
- "@twin.org/api-models": "0.0.2-next.5",
21
- "@twin.org/api-processors": "0.0.2-next.5",
18
+ "@fastify/cors": "11.1.0",
19
+ "@twin.org/api-core": "0.0.2-next.7",
20
+ "@twin.org/api-models": "0.0.2-next.7",
21
+ "@twin.org/api-processors": "0.0.2-next.7",
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.4.0",
26
+ "fastify": "5.5.0",
27
27
  "socket.io": "4.8.1"
28
28
  },
29
29
  "main": "./dist/cjs/index.cjs",