@tsed/platform-fastify 8.11.1 → 8.12.0-rc.1

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.
@@ -267,4 +267,3 @@ adapter(PlatformFastify, [
267
267
  useClass: PlatformFastifyRequest
268
268
  }
269
269
  ]);
270
- //# sourceMappingURL=PlatformFastify.js.map
package/lib/esm/index.js CHANGED
@@ -6,4 +6,3 @@ export * from "./interfaces/interfaces.js";
6
6
  export * from "./interfaces/PlatformFastifySettings.js";
7
7
  export * from "./services/PlatformFastifyRequest.js";
8
8
  export * from "./services/PlatformFastifyResponse.js";
9
- //# sourceMappingURL=index.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=PlatformFastifySettings.js.map
@@ -1,2 +1 @@
1
1
  export * from "./PlatformFastifySettings.js";
2
- //# sourceMappingURL=interfaces.js.map
@@ -31,4 +31,3 @@ export class PlatformFastifyRequest extends PlatformRequest {
31
31
  return (accepts ? accepts : false);
32
32
  }
33
33
  }
34
- //# sourceMappingURL=PlatformFastifyRequest.js.map
@@ -70,4 +70,3 @@ export class PlatformFastifyResponse extends PlatformResponse {
70
70
  return this;
71
71
  }
72
72
  }
73
- //# sourceMappingURL=PlatformFastifyResponse.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tsed/platform-fastify",
3
3
  "type": "module",
4
- "version": "8.11.1",
4
+ "version": "8.12.0-rc.1",
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.11.1",
65
- "@tsed/core": "8.11.1",
66
- "@tsed/di": "8.11.1",
67
- "@tsed/platform-http": "8.11.1",
68
- "@tsed/platform-test-sdk": "8.11.1",
64
+ "@tsed/barrels": "8.12.0-rc.1",
65
+ "@tsed/core": "8.12.0-rc.1",
66
+ "@tsed/di": "8.12.0-rc.1",
67
+ "@tsed/platform-http": "8.12.0-rc.1",
68
+ "@tsed/platform-test-sdk": "8.12.0-rc.1",
69
69
  "@types/content-disposition": "^0.5.4",
70
70
  "cross-env": "7.0.3",
71
71
  "fastify": "5.3.2",
@@ -112,5 +112,8 @@
112
112
  "fastify": {
113
113
  "optional": false
114
114
  }
115
+ },
116
+ "publishConfig": {
117
+ "tag": "rc"
115
118
  }
116
119
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformFastify.js","sourceRoot":"","sources":["../../../src/components/PlatformFastify.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAC;AAEvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAEpC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAW,UAAU,EAAE,QAAQ,EAA+B,MAAM,YAAY,CAAC;AACxF,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAChE,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAEjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA0B,mBAAmB,EAAgB,MAAM,uBAAuB,CAAC;AAClG,OAAO,OAAwD,MAAM,SAAS,CAAC;AAI/E,OAAO,EAAC,sBAAsB,EAAC,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAC,uBAAuB,EAAC,MAAM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AC;IACJ,CAAC;CACF;AAED,OAAO,CAAC,eAAe,EAAE;IACvB;QACE,KAAK,EAAE,gBAAgB;QACvB,QAAQ,EAAE,uBAAuB;KAClC;IACD;QACE,KAAK,EAAE,eAAe;QACtB,QAAQ,EAAE,sBAAsB;KACjC;CACF,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformFastifySettings.js","sourceRoot":"","sources":["../../../src/interfaces/PlatformFastifySettings.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/interfaces.ts"],"names":[],"mappings":"AAKA,cAAc,8BAA8B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformFastifyRequest.js","sourceRoot":"","sources":["../../../src/services/PlatformFastifyRequest.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAI1B,OAAO,EAAuB,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAqB1E;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,eAA+B;IACzE,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC;IACnC,CAAC;IAED;;;;;;;;OAQG;IACH,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAA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,SAAS,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,GAAW,EAAE,IAAS;QAC9B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;QAEnD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,IAAS;QACd,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,IAAS;QACZ,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEpB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -1,34 +0,0 @@
1
- import {PlatformBuilder} from "@tsed/platform-http";
2
-
3
- import {PlatformFastify} from "./PlatformFastify.js";
4
-
5
- class Server {}
6
-
7
- describe("PlatformFastify", () => {
8
- describe("create()", () => {
9
- beforeEach(() => {
10
- vi.spyOn(PlatformBuilder, "create").mockReturnValue({} as never);
11
- });
12
- afterEach(() => vi.resetAllMocks());
13
- it("should create platform", () => {
14
- PlatformFastify.create(Server, {});
15
-
16
- expect(PlatformBuilder.create).toHaveBeenCalledWith(Server, {
17
- adapter: PlatformFastify
18
- });
19
- });
20
- });
21
- describe("bootstrap()", () => {
22
- beforeEach(() => {
23
- vi.spyOn(PlatformBuilder, "bootstrap").mockReturnValue({} as never);
24
- });
25
- afterEach(() => vi.resetAllMocks());
26
- it("should create platform", async () => {
27
- await PlatformFastify.bootstrap(Server, {});
28
-
29
- expect(PlatformBuilder.bootstrap).toHaveBeenCalledWith(Server, {
30
- adapter: PlatformFastify
31
- });
32
- });
33
- });
34
- });
@@ -1,346 +0,0 @@
1
- import "@tsed/platform-multer/fastify";
2
-
3
- import * as Http from "node:http";
4
- import {IncomingMessage, ServerResponse} from "node:http";
5
- import * as Https from "node:https";
6
-
7
- import fastifyMiddie from "@fastify/middie";
8
- import fastifyStatics from "@fastify/static";
9
- import {type Env, isFunction, isString, ReturnHostInfoFromPort, Type} from "@tsed/core";
10
- import {constant, inject, logger, runInContext} from "@tsed/di";
11
- import {NotFound} from "@tsed/exceptions";
12
- import {$alter} from "@tsed/hooks";
13
- import {PlatformExceptions} from "@tsed/platform-exceptions";
14
- import {
15
- adapter,
16
- createContext,
17
- createServer,
18
- PlatformAdapter,
19
- PlatformBuilder,
20
- PlatformRequest,
21
- PlatformResponse,
22
- PlatformStaticsOptions
23
- } from "@tsed/platform-http";
24
- import {PlatformHandlerMetadata, PlatformHandlerType, PlatformLayer} from "@tsed/platform-router";
25
- import Fastify, {FastifyInstance, FastifyReply, FastifyRequest} from "fastify";
26
-
27
- import type {PlatformFastifyPluginLoadingOptions, PlatformFastifyPluginSettings} from "../interfaces/interfaces.js";
28
- import type {PlatformFastifySettings} from "../interfaces/PlatformFastifySettings.js";
29
- import {PlatformFastifyRequest} from "../services/PlatformFastifyRequest.js";
30
- import {PlatformFastifyResponse} from "../services/PlatformFastifyResponse.js";
31
-
32
- declare global {
33
- namespace TsED {
34
- export interface Application extends FastifyInstance {}
35
- }
36
-
37
- namespace TsED {}
38
- }
39
-
40
- export class PlatformFastify extends PlatformAdapter<FastifyInstance> {
41
- readonly NAME = "fastify";
42
- private staticsDecorated = false;
43
-
44
- /**
45
- * Create new serverless application. In this mode, the component scan are disabled.
46
- * @param module
47
- * @param settings
48
- */
49
- static create(module: Type<any>, settings: Partial<TsED.Configuration> = {}) {
50
- return PlatformBuilder.create<FastifyInstance>(module, {
51
- ...settings,
52
- adapter: PlatformFastify
53
- });
54
- }
55
-
56
- /**
57
- * Bootstrap a server application
58
- * @param module
59
- * @param settings
60
- */
61
- static bootstrap(module: Type<any>, settings: Partial<TsED.Configuration> = {}) {
62
- return PlatformBuilder.bootstrap<FastifyInstance>(module, {
63
- ...settings,
64
- adapter: PlatformFastify
65
- });
66
- }
67
-
68
- mapLayers(layers: PlatformLayer[]) {
69
- const {app} = this;
70
- const rawApp: FastifyInstance = app.getApp();
71
-
72
- layers.forEach((layer) => {
73
- switch (layer.method) {
74
- case "use":
75
- if ((rawApp as any).use) {
76
- (rawApp as any).use(...layer.getArgs());
77
- }
78
- return;
79
- case "statics":
80
- this.statics(layer.path as string, layer.opts as any);
81
-
82
- // rawApp.register();
83
- return;
84
- }
85
- try {
86
- rawApp.route({
87
- method: layer.method.toUpperCase() as any,
88
- url: layer.path as any,
89
- handler: this.compose(layer),
90
- config: {
91
- rawBody: layer.handlers.some((handler) => handler.opts?.paramsTypes?.RAW_BODY)
92
- }
93
- });
94
- } catch (er) {
95
- logger().warn({
96
- error_name: er.code,
97
- error_message: er.message
98
- });
99
- }
100
- });
101
- }
102
-
103
- mapHandler(handler: (...args: any[]) => any, metadata: PlatformHandlerMetadata) {
104
- if (metadata.isRawMiddleware()) {
105
- return handler;
106
- }
107
-
108
- switch (metadata.type) {
109
- case PlatformHandlerType.MIDDLEWARE:
110
- return (request: IncomingMessage, _: ServerResponse, done: (err?: any) => void) => {
111
- const {$ctx} = request;
112
-
113
- $ctx.next = done;
114
-
115
- return runInContext($ctx, () => handler($ctx));
116
- };
117
-
118
- default:
119
- return async (request: FastifyRequest, _: FastifyReply, done: (err?: any) => void) => {
120
- const {$ctx} = request;
121
-
122
- $ctx.next = done;
123
-
124
- await runInContext($ctx, () => handler($ctx));
125
-
126
- if (metadata.type === PlatformHandlerType.CTX_FN) {
127
- done();
128
- }
129
- };
130
- }
131
- }
132
-
133
- async useContext() {
134
- const {app} = this;
135
- const invoke = createContext();
136
- const rawApp: FastifyInstance = app.getApp();
137
-
138
- rawApp.addHook("onRequest", async (request, reply) => {
139
- const $ctx = invoke({
140
- request: request as any,
141
- response: reply as any
142
- });
143
-
144
- ($ctx.request.getReq() as any).$ctx = $ctx;
145
-
146
- await $ctx.start();
147
- });
148
-
149
- rawApp.addHook("onResponse", async (request, reply) => {
150
- const {$ctx} = request;
151
- ($ctx.request.getReq() as any).$ctx = undefined;
152
- await $ctx.finish();
153
- });
154
-
155
- await rawApp.register(fastifyMiddie, {
156
- hook: "onRequest"
157
- });
158
-
159
- const plugins = await this.resolvePlugins();
160
-
161
- for (const plugin of plugins) {
162
- await rawApp.register(plugin.use as any, plugin.options!);
163
- }
164
- }
165
-
166
- createApp() {
167
- const {app, ...props} = constant<PlatformFastifySettings>("fastify") || {};
168
- const httpPort = constant<number | false>("httpPort");
169
- const httpOptions = constant<Http.ServerOptions>("httpOptions");
170
- const httpsPort = constant<number | false>("httpsPort");
171
- const httpsOptions = constant<Https.ServerOptions>("httpsOptions");
172
- const opts = {
173
- ...props,
174
- ignoreTrailingSlash: true,
175
- http:
176
- httpPort !== false
177
- ? {
178
- ...httpOptions
179
- }
180
- : null,
181
- https:
182
- httpsPort !== false
183
- ? {
184
- ...httpsOptions
185
- }
186
- : null
187
- };
188
-
189
- const instance: FastifyInstance = app || Fastify(opts);
190
-
191
- instance.decorateRequest("$ctx", null as never);
192
- instance.decorateReply("locals", null);
193
-
194
- return {
195
- app: instance,
196
- callback: () => {
197
- return async (request: IncomingMessage, response: ServerResponse) => {
198
- await instance.ready();
199
- instance.server.emit("request", request, response);
200
- };
201
- }
202
- };
203
- }
204
-
205
- afterLoadRoutes() {
206
- const rawApp: FastifyInstance = this.app.getApp();
207
-
208
- rawApp.setErrorHandler((error, request, reply) => {
209
- const {$ctx} = request;
210
- $ctx.error = $ctx.error || error;
211
-
212
- return inject<PlatformExceptions>(PlatformExceptions)?.catch(error, $ctx);
213
- });
214
-
215
- rawApp.setNotFoundHandler((request, reply) => {
216
- const {$ctx} = request;
217
-
218
- return inject<PlatformExceptions>(PlatformExceptions)?.catch(new NotFound(`Resource "${request.originalUrl}" not found`), $ctx);
219
- });
220
-
221
- return Promise.resolve();
222
- }
223
-
224
- getServers(): any[] {
225
- const httpsPort = constant<string | false>("httpsPort");
226
- const httpPort = constant<string | false>("httpPort");
227
-
228
- const listen = (hostinfo: ReturnHostInfoFromPort) =>
229
- this.app.getApp().listen({
230
- host: hostinfo.address,
231
- port: hostinfo.port
232
- });
233
-
234
- const server = () => this.app.getApp().server;
235
-
236
- return [
237
- createServer({
238
- port: httpsPort,
239
- type: "https",
240
- token: Https.Server,
241
- server,
242
- listen
243
- }),
244
- createServer({
245
- port: httpPort,
246
- type: "http",
247
- token: Http.Server,
248
- server,
249
- listen
250
- })
251
- ];
252
- }
253
-
254
- bodyParser(type: string, opts: Record<string, any> | undefined): any {
255
- return null;
256
- }
257
-
258
- statics(endpoint: string, options: PlatformStaticsOptions): any {
259
- this.app.getApp().register(fastifyStatics, {
260
- root: options.root,
261
- prefix: endpoint,
262
- decorateReply: !this.staticsDecorated
263
- });
264
- this.staticsDecorated = true;
265
-
266
- return null;
267
- }
268
-
269
- protected compose(layer: PlatformLayer) {
270
- return (req: FastifyRequest, reply: FastifyReply) => {
271
- return runInContext(req.$ctx, async () => {
272
- const $ctx = req.$ctx;
273
- $ctx.next = null;
274
-
275
- for (const metadata of layer.handlers) {
276
- try {
277
- if (!req.$ctx.isDone()) {
278
- if (
279
- ($ctx.error && metadata.type === PlatformHandlerType.ERR_MIDDLEWARE) ||
280
- (!$ctx.error && metadata.type !== PlatformHandlerType.ERR_MIDDLEWARE)
281
- ) {
282
- await metadata.compiledHandler($ctx);
283
- }
284
- }
285
- } catch (er) {
286
- $ctx.error = er;
287
- }
288
- }
289
-
290
- if (req.$ctx.error) {
291
- // TODO maybe we can use platform exception here?
292
- throw req.$ctx.error;
293
- }
294
- });
295
- };
296
- }
297
-
298
- protected async resolvePlugins(): Promise<PlatformFastifyPluginLoadingOptions[]> {
299
- let plugins = constant<PlatformFastifyPluginSettings[]>("plugins", []);
300
- const env = constant<Env>("env");
301
-
302
- const promises = plugins.map(async (plugin: PlatformFastifyPluginSettings): Promise<PlatformFastifyPluginLoadingOptions> => {
303
- if (isFunction(plugin)) {
304
- return {
305
- env,
306
- use: plugin
307
- };
308
- }
309
-
310
- if (isString(plugin)) {
311
- plugin = {env, use: plugin};
312
- }
313
-
314
- let {use} = plugin;
315
-
316
- if (isString(use)) {
317
- const mod = await import(use);
318
- use = mod.default || mod;
319
- }
320
-
321
- return {
322
- env,
323
- ...plugin,
324
- use
325
- };
326
- });
327
-
328
- plugins = await Promise.all(promises);
329
-
330
- return $alter(
331
- "$afterPlugins",
332
- plugins.filter((plugin) => plugin.use).filter((plugin) => plugin.env === env)
333
- );
334
- }
335
- }
336
-
337
- adapter(PlatformFastify, [
338
- {
339
- token: PlatformResponse,
340
- useClass: PlatformFastifyResponse
341
- },
342
- {
343
- token: PlatformRequest,
344
- useClass: PlatformFastifyRequest
345
- }
346
- ]);
package/src/index.ts DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * @file Automatically generated by @tsed/barrels.
3
- */
4
- export * from "./components/PlatformFastify.js";
5
- export * from "./interfaces/interfaces.js";
6
- export * from "./interfaces/PlatformFastifySettings.js";
7
- export * from "./services/PlatformFastifyRequest.js";
8
- export * from "./services/PlatformFastifyResponse.js";
@@ -1,5 +0,0 @@
1
- import type {FastifyInstance} from "fastify";
2
-
3
- export interface PlatformFastifySettings {
4
- app?: FastifyInstance;
5
- }
@@ -1,26 +0,0 @@
1
- import type {Env} from "@tsed/core";
2
- import type {FastifyPluginOptions, FastifyRegisterOptions} from "fastify";
3
-
4
- import type {PlatformFastifySettings} from "./PlatformFastifySettings.js";
5
-
6
- export * from "./PlatformFastifySettings.js";
7
-
8
- export type PlatformFastifyPluginTypes = ((opts?: any) => any) | /*Type<any> |*/ string;
9
- export type PlatformFastifyPluginLoadingOptions = {
10
- env?: Env;
11
- use: PlatformFastifyPluginTypes;
12
- options?: FastifyRegisterOptions<FastifyPluginOptions>;
13
- };
14
- export type PlatformFastifyPluginSettings = PlatformFastifyPluginTypes | PlatformFastifyPluginLoadingOptions | any;
15
-
16
- declare global {
17
- namespace TsED {
18
- export interface Configuration {
19
- /**
20
- * Configuration related to Fastify platform application.
21
- */
22
- fastify: PlatformFastifySettings;
23
- plugins: PlatformFastifyPluginSettings[];
24
- }
25
- }
26
- }
@@ -1,54 +0,0 @@
1
- import {PlatformTest} from "@tsed/platform-http/testing";
2
-
3
- import {PlatformFastifyRequest} from "./PlatformFastifyRequest.js";
4
-
5
- function createRequest() {
6
- const request = PlatformTest.createRequest();
7
- const ctx = PlatformTest.createRequestContext({
8
- event: {
9
- request
10
- },
11
- RequestKlass: PlatformFastifyRequest
12
- });
13
-
14
- return {req: request, request: ctx.request};
15
- }
16
-
17
- describe("PlatformFastifyRequest", () => {
18
- beforeEach(() => PlatformTest.create());
19
- afterEach(() => PlatformTest.reset());
20
-
21
- it("should create a PlatformRequest instance", () => {
22
- const {req, request} = createRequest();
23
-
24
- expect(request.raw).toEqual(req);
25
- });
26
-
27
- describe("secure", () => {
28
- it("should get secure info", () => {
29
- const {req, request} = createRequest();
30
- req.protocol = "https";
31
-
32
- expect(request.secure).toEqual(true);
33
- });
34
- });
35
-
36
- describe("host()", () => {
37
- it("should return the host", () => {
38
- const {req, request} = createRequest();
39
-
40
- req.hostname = "host";
41
-
42
- expect(request.host).toEqual("host");
43
- });
44
- });
45
-
46
- describe("getReq()", () => {
47
- it("should return nodejs request", () => {
48
- const {req, request} = createRequest();
49
- req.raw = {};
50
-
51
- expect(request.getReq()).toEqual({});
52
- });
53
- });
54
- });
@@ -1,61 +0,0 @@
1
- import "@fastify/accepts";
2
-
3
- import type {IncomingMessage} from "node:http";
4
-
5
- import {type PlatformContext, PlatformRequest} from "@tsed/platform-http";
6
- import type {FastifyRequest} from "fastify";
7
-
8
- declare module "fastify" {
9
- export interface FastifyRequest {
10
- $ctx: PlatformContext;
11
- }
12
- }
13
-
14
- declare module "http" {
15
- export interface IncomingMessage {
16
- $ctx: PlatformContext;
17
- }
18
- }
19
-
20
- declare global {
21
- namespace TsED {
22
- export interface Request extends FastifyRequest {}
23
- }
24
- }
25
-
26
- /**
27
- * @platform
28
- * @fastify
29
- */
30
- export class PlatformFastifyRequest extends PlatformRequest<FastifyRequest> {
31
- get host(): string {
32
- return this.raw.hostname;
33
- }
34
-
35
- get secure(): boolean {
36
- return this.protocol === "https";
37
- }
38
-
39
- /**
40
- * Returns the HTTP request header specified by field. The match is case-insensitive.
41
- *
42
- * ```typescript
43
- * request.get('Content-Type') // => "text/plain"
44
- * ```
45
- *
46
- * @param name
47
- */
48
- get(name: string) {
49
- return this.raw.raw.headers[name.toLowerCase()];
50
- }
51
-
52
- getReq(): IncomingMessage {
53
- return this.raw.raw;
54
- }
55
-
56
- accepts(mime?: string | string[]) {
57
- const accepts = this.raw.accepts().type([].concat(mime as any));
58
-
59
- return (accepts ? accepts : false) as any;
60
- }
61
- }
@@ -1,114 +0,0 @@
1
- import {PlatformTest} from "@tsed/platform-http/testing";
2
-
3
- import {PlatformFastifyResponse} from "./PlatformFastifyResponse.js";
4
-
5
- function createResponse() {
6
- const response = PlatformTest.createResponse();
7
- response.code = response.status;
8
- response.type = response.contentType;
9
- response.header = response.set;
10
-
11
- const ctx = PlatformTest.createRequestContext({
12
- event: {
13
- response
14
- },
15
- ResponseKlass: PlatformFastifyResponse
16
- });
17
-
18
- return {res: response, response: ctx.response};
19
- }
20
-
21
- describe("PlatformFastifyResponse", () => {
22
- beforeEach(() => PlatformTest.create());
23
- afterEach(() => PlatformTest.reset());
24
-
25
- it("should create a PlatformResponse instance", () => {
26
- const {res, response} = createResponse();
27
-
28
- expect(response.raw).toEqual(res);
29
- });
30
-
31
- describe("getRes()", () => {
32
- it("return res", async () => {
33
- const {res, response} = createResponse();
34
- res.raw = {};
35
-
36
- const result = await response.getRes();
37
-
38
- expect(result).toEqual(res.raw);
39
- });
40
- });
41
- describe("statusCode", () => {
42
- it("return statusCode", () => {
43
- const {response} = createResponse();
44
-
45
- response.status(302);
46
-
47
- expect(response.statusCode).toEqual(302);
48
- });
49
- });
50
- describe("contentType()", () => {
51
- it("should set contentType", () => {
52
- const {res, response} = createResponse();
53
-
54
- response.contentType("text/html");
55
-
56
- expect(res.headers).toEqual({"content-type": "text/html", "x-request-id": "id"});
57
- });
58
- });
59
- describe("body()", () => {
60
- it("should set body", () => {
61
- const {res, response} = createResponse();
62
-
63
- response.body("body");
64
-
65
- expect(res.data).toEqual("body");
66
- });
67
- });
68
-
69
- describe("stream()", () => {
70
- it("should set body", () => {
71
- const {res, response} = createResponse();
72
-
73
- response.stream("body");
74
-
75
- expect(res.data).toEqual("body");
76
- });
77
- });
78
- describe("location", () => {
79
- it("should set header location", () => {
80
- const {res, response} = createResponse();
81
-
82
- response.location("https://location");
83
-
84
- expect(res.headers).toEqual({
85
- location: "https://location",
86
- "x-request-id": "id"
87
- });
88
- });
89
-
90
- it("should go back based on Referrer", async () => {
91
- const {res, response} = createResponse();
92
-
93
- response.request.raw.headers["referrer"] = "https://location/back";
94
-
95
- await response.location("back");
96
-
97
- expect(res.headers).toEqual({
98
- location: "https://location/back",
99
- "x-request-id": "id"
100
- });
101
- });
102
-
103
- it("should go back based on default path", async () => {
104
- const {res, response} = createResponse();
105
-
106
- await response.location("back");
107
-
108
- expect(res.headers).toEqual({
109
- location: "/",
110
- "x-request-id": "id"
111
- });
112
- });
113
- });
114
- });
@@ -1,96 +0,0 @@
1
- import type {ServerResponse} from "node:http";
2
-
3
- import {type PlatformContext, PlatformResponse} from "@tsed/platform-http";
4
- import contentDisposition from "content-disposition";
5
- import type {FastifyReply} from "fastify";
6
-
7
- declare global {
8
- namespace TsED {
9
- export interface Response extends FastifyReply {
10
- locals: Record<string, unknown>;
11
- }
12
- }
13
- }
14
-
15
- /**
16
- * @platform
17
- * @fastify
18
- */
19
- export class PlatformFastifyResponse extends PlatformResponse<TsED.Response> {
20
- constructor(readonly $ctx: PlatformContext) {
21
- super($ctx);
22
- this.raw.locals = {};
23
- }
24
-
25
- /**
26
- * Return the Node.js response object
27
- */
28
- getRes(): ServerResponse {
29
- return this.raw.raw;
30
- }
31
-
32
- /**
33
- * Sets the HTTP status for the response.
34
- *
35
- * @param status
36
- */
37
- status(status: number) {
38
- this.raw.code(status);
39
-
40
- return this;
41
- }
42
-
43
- /**
44
- * Set `Content-Type` response header with `type` through `mime.lookup()`
45
- * when it does not contain "/", or set the Content-Type to `type` otherwise.
46
- *
47
- * Examples:
48
- *
49
- * res.type('.html');
50
- * res.type('html');
51
- * res.type('json');
52
- * res.type('application/json');
53
- * res.type('png');
54
- */
55
- contentType(contentType: string) {
56
- this.raw.type(contentType);
57
-
58
- return this;
59
- }
60
-
61
- /**
62
- * Returns the HTTP response header specified by field. The match is case-insensitive.
63
- *
64
- * ```typescript
65
- * response.get('Content-Type') // => "text/plain"
66
- * ```
67
- *
68
- * @param name
69
- */
70
- get(name: string) {
71
- return this.raw.getHeader(name);
72
- }
73
-
74
- attachment(filename: string) {
75
- this.setHeader("Content-Disposition", contentDisposition(filename));
76
- return this;
77
- }
78
-
79
- setHeader(key: string, item: any) {
80
- this.raw.header(key, this.formatHeader(key, item));
81
-
82
- return this;
83
- }
84
-
85
- stream(data: any) {
86
- this.raw.send(data);
87
-
88
- return this;
89
- }
90
-
91
- json(data: any) {
92
- this.raw.send(data);
93
-
94
- return this;
95
- }
96
- }
package/vitest.config.mts DELETED
@@ -1,21 +0,0 @@
1
- // @ts-ignore
2
- import {presets} from "@tsed/vitest/presets";
3
- import {defineConfig} from "vitest/config";
4
-
5
- export default defineConfig(
6
- {
7
- ...presets,
8
- test: {
9
- ...presets.test,
10
- coverage: {
11
- ...presets.test.coverage,
12
- thresholds: {
13
- statements: 93,
14
- branches: 91,
15
- functions: 89,
16
- lines: 93
17
- }
18
- }
19
- }
20
- }
21
- );