@tsed/platform-fastify 8.18.1 → 8.18.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.
@@ -14,6 +14,11 @@ import Fastify from "fastify";
14
14
  import { PlatformFastifyRequest } from "../services/PlatformFastifyRequest.js";
15
15
  import { PlatformFastifyResponse } from "../services/PlatformFastifyResponse.js";
16
16
  import { convertPath } from "../utils/convertPath.js";
17
+ function callNext(next, metadata, $ctx) {
18
+ if (metadata.type !== PlatformHandlerType.RESPONSE_FN) {
19
+ return next && $ctx.error && !$ctx.isDone() ? next($ctx.error) : next();
20
+ }
21
+ }
17
22
  export class PlatformFastify extends PlatformAdapter {
18
23
  constructor() {
19
24
  super(...arguments);
@@ -56,7 +61,6 @@ export class PlatformFastify extends PlatformAdapter {
56
61
  return;
57
62
  case "statics":
58
63
  this.statics(path, layer.opts);
59
- // rawApp.register();
60
64
  return;
61
65
  }
62
66
  try {
@@ -83,10 +87,12 @@ export class PlatformFastify extends PlatformAdapter {
83
87
  }
84
88
  switch (metadata.type) {
85
89
  case PlatformHandlerType.MIDDLEWARE:
86
- return (request, _, done) => {
90
+ return async (request, _, done) => {
87
91
  const { $ctx } = request;
88
92
  $ctx.next = done;
89
- return runInContext($ctx, () => handler($ctx));
93
+ const result = await runInContext($ctx, () => handler($ctx));
94
+ callNext(done, metadata, $ctx);
95
+ return result;
90
96
  };
91
97
  default:
92
98
  return async (request, _, done) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tsed/platform-fastify",
3
3
  "type": "module",
4
- "version": "8.18.1",
4
+ "version": "8.18.2",
5
5
  "description": "Fastify package for Ts.ED framework",
6
6
  "source": "./src/index.ts",
7
7
  "main": "./lib/esm/index.js",
@@ -61,11 +61,11 @@
61
61
  "@fastify/cookie": "11.0.1",
62
62
  "@fastify/formbody": "8.0.1",
63
63
  "@fastify/session": "11.0.1",
64
- "@tsed/barrels": "8.18.1",
65
- "@tsed/core": "8.18.1",
66
- "@tsed/di": "8.18.1",
67
- "@tsed/platform-http": "8.18.1",
68
- "@tsed/platform-test-sdk": "8.18.1",
64
+ "@tsed/barrels": "8.18.2",
65
+ "@tsed/core": "8.18.2",
66
+ "@tsed/di": "8.18.2",
67
+ "@tsed/platform-http": "8.18.2",
68
+ "@tsed/platform-test-sdk": "8.18.2",
69
69
  "@types/content-disposition": "^0.5.4",
70
70
  "cross-env": "7.0.3",
71
71
  "fastify": "5.3.2",