@twin.org/api-server-fastify 0.0.2-next.10 → 0.0.2-next.11
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.
- package/dist/cjs/index.cjs +9 -14
- package/dist/esm/index.mjs +10 -15
- package/docs/changelog.md +16 -0
- package/package.json +5 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -27,11 +27,6 @@ const fastifySocketIO = fp(async (fastify, opts) => {
|
|
|
27
27
|
* Implementation of the web server using Fastify.
|
|
28
28
|
*/
|
|
29
29
|
class FastifyWebServer {
|
|
30
|
-
/**
|
|
31
|
-
* Runtime name for the class in camel case.
|
|
32
|
-
* @internal
|
|
33
|
-
*/
|
|
34
|
-
static _CLASS_NAME_CAMEL_CASE = core.StringHelper.camelCase("FastifyWebServer");
|
|
35
30
|
/**
|
|
36
31
|
* Default port for running the server.
|
|
37
32
|
* @internal
|
|
@@ -140,7 +135,7 @@ class FastifyWebServer {
|
|
|
140
135
|
level: "info",
|
|
141
136
|
ts: Date.now(),
|
|
142
137
|
source: this.CLASS_NAME,
|
|
143
|
-
message: `${
|
|
138
|
+
message: `${"fastifyWebServer"}.building`
|
|
144
139
|
});
|
|
145
140
|
this._options = options;
|
|
146
141
|
await this._fastify.register(FastifyCompress);
|
|
@@ -185,7 +180,7 @@ class FastifyWebServer {
|
|
|
185
180
|
level: "error",
|
|
186
181
|
ts: Date.now(),
|
|
187
182
|
source: this.CLASS_NAME,
|
|
188
|
-
message: `${
|
|
183
|
+
message: `${"fastifyWebServer"}.badRequest`,
|
|
189
184
|
error: err
|
|
190
185
|
});
|
|
191
186
|
return reply.status(httpStatusCode).send({
|
|
@@ -206,7 +201,7 @@ class FastifyWebServer {
|
|
|
206
201
|
level: "info",
|
|
207
202
|
ts: Date.now(),
|
|
208
203
|
source: this.CLASS_NAME,
|
|
209
|
-
message: `${
|
|
204
|
+
message: `${"fastifyWebServer"}.starting`,
|
|
210
205
|
data: {
|
|
211
206
|
host,
|
|
212
207
|
port
|
|
@@ -221,7 +216,7 @@ class FastifyWebServer {
|
|
|
221
216
|
level: "info",
|
|
222
217
|
ts: Date.now(),
|
|
223
218
|
source: this.CLASS_NAME,
|
|
224
|
-
message: `${
|
|
219
|
+
message: `${"fastifyWebServer"}.started`,
|
|
225
220
|
data: {
|
|
226
221
|
addresses: addresses
|
|
227
222
|
.map(a => `${protocol}${a.family === "IPv6" ? "[" : ""}${a.address}${a.family === "IPv6" ? "]" : ""}:${a.port}`)
|
|
@@ -235,7 +230,7 @@ class FastifyWebServer {
|
|
|
235
230
|
level: "error",
|
|
236
231
|
ts: Date.now(),
|
|
237
232
|
source: this.CLASS_NAME,
|
|
238
|
-
message: `${
|
|
233
|
+
message: `${"fastifyWebServer"}.startFailed`,
|
|
239
234
|
error: core.BaseError.fromError(err)
|
|
240
235
|
});
|
|
241
236
|
}
|
|
@@ -253,7 +248,7 @@ class FastifyWebServer {
|
|
|
253
248
|
level: "info",
|
|
254
249
|
ts: Date.now(),
|
|
255
250
|
source: this.CLASS_NAME,
|
|
256
|
-
message: `${
|
|
251
|
+
message: `${"fastifyWebServer"}.stopped`
|
|
257
252
|
});
|
|
258
253
|
}
|
|
259
254
|
}
|
|
@@ -274,7 +269,7 @@ class FastifyWebServer {
|
|
|
274
269
|
level: "info",
|
|
275
270
|
ts: Date.now(),
|
|
276
271
|
source: this.CLASS_NAME,
|
|
277
|
-
message: `${
|
|
272
|
+
message: `${"fastifyWebServer"}.restRouteAdded`,
|
|
278
273
|
data: { route: path, method: restRoute.method }
|
|
279
274
|
});
|
|
280
275
|
const method = restRoute.method.toLowerCase();
|
|
@@ -301,7 +296,7 @@ class FastifyWebServer {
|
|
|
301
296
|
level: "info",
|
|
302
297
|
ts: Date.now(),
|
|
303
298
|
source: this.CLASS_NAME,
|
|
304
|
-
message: `${
|
|
299
|
+
message: `${"fastifyWebServer"}.socketRouteAdded`,
|
|
305
300
|
data: {
|
|
306
301
|
handshakePath: this._socketConfig.path,
|
|
307
302
|
namespace,
|
|
@@ -500,7 +495,7 @@ class FastifyWebServer {
|
|
|
500
495
|
level: "error",
|
|
501
496
|
ts: Date.now(),
|
|
502
497
|
source: this.CLASS_NAME,
|
|
503
|
-
message: `${
|
|
498
|
+
message: `${"fastifyWebServer"}.postProcessorError`,
|
|
504
499
|
error: core.BaseError.fromError(err),
|
|
505
500
|
data: {
|
|
506
501
|
route: socketRoute.path
|
package/dist/esm/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import FastifyCompress from '@fastify/compress';
|
|
|
2
2
|
import FastifyCors from '@fastify/cors';
|
|
3
3
|
import { HttpErrorHelper } from '@twin.org/api-models';
|
|
4
4
|
import { JsonLdMimeTypeProcessor } from '@twin.org/api-processors';
|
|
5
|
-
import {
|
|
5
|
+
import { ComponentFactory, Is, GeneralError, BaseError, StringHelper } from '@twin.org/core';
|
|
6
6
|
import { HttpStatusCode, HttpMethod, HeaderTypes } from '@twin.org/web';
|
|
7
7
|
import Fastify from 'fastify';
|
|
8
8
|
import fp from 'fastify-plugin';
|
|
@@ -25,11 +25,6 @@ const fastifySocketIO = fp(async (fastify, opts) => {
|
|
|
25
25
|
* Implementation of the web server using Fastify.
|
|
26
26
|
*/
|
|
27
27
|
class FastifyWebServer {
|
|
28
|
-
/**
|
|
29
|
-
* Runtime name for the class in camel case.
|
|
30
|
-
* @internal
|
|
31
|
-
*/
|
|
32
|
-
static _CLASS_NAME_CAMEL_CASE = StringHelper.camelCase("FastifyWebServer");
|
|
33
28
|
/**
|
|
34
29
|
* Default port for running the server.
|
|
35
30
|
* @internal
|
|
@@ -138,7 +133,7 @@ class FastifyWebServer {
|
|
|
138
133
|
level: "info",
|
|
139
134
|
ts: Date.now(),
|
|
140
135
|
source: this.CLASS_NAME,
|
|
141
|
-
message: `${
|
|
136
|
+
message: `${"fastifyWebServer"}.building`
|
|
142
137
|
});
|
|
143
138
|
this._options = options;
|
|
144
139
|
await this._fastify.register(FastifyCompress);
|
|
@@ -183,7 +178,7 @@ class FastifyWebServer {
|
|
|
183
178
|
level: "error",
|
|
184
179
|
ts: Date.now(),
|
|
185
180
|
source: this.CLASS_NAME,
|
|
186
|
-
message: `${
|
|
181
|
+
message: `${"fastifyWebServer"}.badRequest`,
|
|
187
182
|
error: err
|
|
188
183
|
});
|
|
189
184
|
return reply.status(httpStatusCode).send({
|
|
@@ -204,7 +199,7 @@ class FastifyWebServer {
|
|
|
204
199
|
level: "info",
|
|
205
200
|
ts: Date.now(),
|
|
206
201
|
source: this.CLASS_NAME,
|
|
207
|
-
message: `${
|
|
202
|
+
message: `${"fastifyWebServer"}.starting`,
|
|
208
203
|
data: {
|
|
209
204
|
host,
|
|
210
205
|
port
|
|
@@ -219,7 +214,7 @@ class FastifyWebServer {
|
|
|
219
214
|
level: "info",
|
|
220
215
|
ts: Date.now(),
|
|
221
216
|
source: this.CLASS_NAME,
|
|
222
|
-
message: `${
|
|
217
|
+
message: `${"fastifyWebServer"}.started`,
|
|
223
218
|
data: {
|
|
224
219
|
addresses: addresses
|
|
225
220
|
.map(a => `${protocol}${a.family === "IPv6" ? "[" : ""}${a.address}${a.family === "IPv6" ? "]" : ""}:${a.port}`)
|
|
@@ -233,7 +228,7 @@ class FastifyWebServer {
|
|
|
233
228
|
level: "error",
|
|
234
229
|
ts: Date.now(),
|
|
235
230
|
source: this.CLASS_NAME,
|
|
236
|
-
message: `${
|
|
231
|
+
message: `${"fastifyWebServer"}.startFailed`,
|
|
237
232
|
error: BaseError.fromError(err)
|
|
238
233
|
});
|
|
239
234
|
}
|
|
@@ -251,7 +246,7 @@ class FastifyWebServer {
|
|
|
251
246
|
level: "info",
|
|
252
247
|
ts: Date.now(),
|
|
253
248
|
source: this.CLASS_NAME,
|
|
254
|
-
message: `${
|
|
249
|
+
message: `${"fastifyWebServer"}.stopped`
|
|
255
250
|
});
|
|
256
251
|
}
|
|
257
252
|
}
|
|
@@ -272,7 +267,7 @@ class FastifyWebServer {
|
|
|
272
267
|
level: "info",
|
|
273
268
|
ts: Date.now(),
|
|
274
269
|
source: this.CLASS_NAME,
|
|
275
|
-
message: `${
|
|
270
|
+
message: `${"fastifyWebServer"}.restRouteAdded`,
|
|
276
271
|
data: { route: path, method: restRoute.method }
|
|
277
272
|
});
|
|
278
273
|
const method = restRoute.method.toLowerCase();
|
|
@@ -299,7 +294,7 @@ class FastifyWebServer {
|
|
|
299
294
|
level: "info",
|
|
300
295
|
ts: Date.now(),
|
|
301
296
|
source: this.CLASS_NAME,
|
|
302
|
-
message: `${
|
|
297
|
+
message: `${"fastifyWebServer"}.socketRouteAdded`,
|
|
303
298
|
data: {
|
|
304
299
|
handshakePath: this._socketConfig.path,
|
|
305
300
|
namespace,
|
|
@@ -498,7 +493,7 @@ class FastifyWebServer {
|
|
|
498
493
|
level: "error",
|
|
499
494
|
ts: Date.now(),
|
|
500
495
|
source: this.CLASS_NAME,
|
|
501
|
-
message: `${
|
|
496
|
+
message: `${"fastifyWebServer"}.postProcessorError`,
|
|
502
497
|
error: BaseError.fromError(err),
|
|
503
498
|
data: {
|
|
504
499
|
route: socketRoute.path
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @twin.org/api-server-fastify - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-next.11](https://github.com/twinfoundation/api/compare/api-server-fastify-v0.0.2-next.10...api-server-fastify-v0.0.2-next.11) (2025-09-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
|
|
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.10 to 0.0.2-next.11
|
|
16
|
+
* @twin.org/api-models bumped from 0.0.2-next.10 to 0.0.2-next.11
|
|
17
|
+
* @twin.org/api-processors bumped from 0.0.2-next.10 to 0.0.2-next.11
|
|
18
|
+
|
|
3
19
|
## [0.0.2-next.10](https://github.com/twinfoundation/api/compare/api-server-fastify-v0.0.2-next.9...api-server-fastify-v0.0.2-next.10) (2025-09-23)
|
|
4
20
|
|
|
5
21
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/api-server-fastify",
|
|
3
|
-
"version": "0.0.2-next.
|
|
3
|
+
"version": "0.0.2-next.11",
|
|
4
4
|
"description": "Use Fastify as the core web server for APIs",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@fastify/compress": "8.1.0",
|
|
18
18
|
"@fastify/cors": "11.1.0",
|
|
19
|
-
"@twin.org/api-core": "0.0.2-next.
|
|
20
|
-
"@twin.org/api-models": "0.0.2-next.
|
|
21
|
-
"@twin.org/api-processors": "0.0.2-next.
|
|
19
|
+
"@twin.org/api-core": "0.0.2-next.11",
|
|
20
|
+
"@twin.org/api-models": "0.0.2-next.11",
|
|
21
|
+
"@twin.org/api-processors": "0.0.2-next.11",
|
|
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.
|
|
26
|
+
"fastify": "5.6.1",
|
|
27
27
|
"socket.io": "4.8.1"
|
|
28
28
|
},
|
|
29
29
|
"main": "./dist/cjs/index.cjs",
|