@rsdk/http.server.fastify 6.0.0-next.5 → 6.0.0-next.50
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.
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { INestApplication } from '@nestjs/common/interfaces';
|
|
1
2
|
import type { AbstractHttpAdapter } from '@nestjs/core';
|
|
2
3
|
import type { LogFormatter } from '@rsdk/core';
|
|
4
|
+
import type { HttpConfig, StaticMount } from '@rsdk/http.server';
|
|
3
5
|
import { AbstractHttpTransport } from '@rsdk/http.server';
|
|
4
|
-
import type { HttpConfig } from '@rsdk/http.server/dist/http.config';
|
|
5
6
|
export declare class FastifyHttpTransport extends AbstractHttpTransport {
|
|
6
7
|
createHttpAdapter(config: HttpConfig): AbstractHttpAdapter;
|
|
7
8
|
logFormatter(): LogFormatter;
|
|
9
|
+
protected configureStaticMount(app: INestApplication, mount: StaticMount): Promise<void>;
|
|
8
10
|
}
|
|
@@ -17,11 +17,11 @@ class FastifyHttpTransport extends http_server_1.AbstractHttpTransport {
|
|
|
17
17
|
cookie: false,
|
|
18
18
|
}, parsers);
|
|
19
19
|
if (body.urlencoded) {
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
21
21
|
fastifyAdapter.register(require('@fastify/formbody'));
|
|
22
22
|
}
|
|
23
23
|
if (cookie) {
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
25
25
|
fastifyAdapter.register(require('@fastify/cookie'));
|
|
26
26
|
}
|
|
27
27
|
return fastifyAdapter;
|
|
@@ -29,6 +29,13 @@ class FastifyHttpTransport extends http_server_1.AbstractHttpTransport {
|
|
|
29
29
|
logFormatter() {
|
|
30
30
|
return new fastify_http_log_formatter_1.FastifyHttpLogFormatter();
|
|
31
31
|
}
|
|
32
|
+
async configureStaticMount(app, mount) {
|
|
33
|
+
await app.getHttpAdapter().useStaticAssets?.({
|
|
34
|
+
root: mount.root,
|
|
35
|
+
prefix: mount.prefix,
|
|
36
|
+
decorateReply: false,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
32
39
|
}
|
|
33
40
|
exports.FastifyHttpTransport = FastifyHttpTransport;
|
|
34
41
|
//# sourceMappingURL=fastify-http-transport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastify-http-transport.js","sourceRoot":"","sources":["../src/fastify-http-transport.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"fastify-http-transport.js","sourceRoot":"","sources":["../src/fastify-http-transport.ts"],"names":[],"mappings":";;;AAEA,+DAA0D;AAG1D,mDAA0D;AAE1D,6EAAuE;AAEvE,MAAa,oBAAqB,SAAQ,mCAAqB;IAC7D,iBAAiB,CAAC,MAAkB;QAClC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QACvC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAC7B,MAAM,cAAc,GAAG,IAAI,iCAAc,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAE5E,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAkB,MAAM,CAAC,MAAM,CACnD;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI;gBACV,UAAU,EAAE,KAAK;aAClB;YACD,MAAM,EAAE,KAAK;SACd,EACD,OAAO,CACR,CAAC;QAEF,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,8DAA8D;YAC9D,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,MAAM,EAAE,CAAC;YACX,8DAA8D;YAC9D,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,YAAY;QACV,OAAO,IAAI,oDAAuB,EAAE,CAAC;IACvC,CAAC;IAEkB,KAAK,CAAC,oBAAoB,CAC3C,GAAqB,EACrB,KAAkB;QAElB,MAAM,GAAG,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC;YAC3C,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,aAAa,EAAE,KAAK;SACrB,CAAC,CAAC;IACL,CAAC;CACF;AA1CD,oDA0CC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/http.server.fastify",
|
|
3
|
-
"
|
|
3
|
+
"role": "library",
|
|
4
|
+
"version": "6.0.0-next.50",
|
|
4
5
|
"description": "Adapter for @rsdk/http.server",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"repository": {
|
|
@@ -17,24 +18,23 @@
|
|
|
17
18
|
],
|
|
18
19
|
"license": "Apache License 2.0",
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"@nestjs/platform-fastify": "^10.0.0"
|
|
21
|
-
},
|
|
22
|
-
"peerDependencies": {
|
|
23
21
|
"@fastify/cookie": "^9.0.4",
|
|
24
22
|
"@fastify/formbody": "^7.4.0",
|
|
25
|
-
"@
|
|
26
|
-
"@
|
|
27
|
-
"@rsdk/http.server": "
|
|
28
|
-
"reflect-metadata": "^0.1.12 || ^0.2.0",
|
|
29
|
-
"rxjs": "^7.8.1"
|
|
23
|
+
"@fastify/static": "^6.12.0",
|
|
24
|
+
"@rsdk/core": "6.0.0-next.50",
|
|
25
|
+
"@rsdk/http.server": "6.0.0-next.50"
|
|
30
26
|
},
|
|
31
|
-
"
|
|
32
|
-
"@
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"@fastify
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@nestjs/common": "<=10.4.8",
|
|
29
|
+
"@nestjs/core": "<=10.4.8",
|
|
30
|
+
"@nestjs/microservices": "<=10.4.8",
|
|
31
|
+
"@nestjs/platform-fastify": "<=10.4.8",
|
|
32
|
+
"@nestjs/swagger": "^7.0.0 || ^8.0.0",
|
|
33
|
+
"@sinclair/typebox": "^0.34.9",
|
|
34
|
+
"lodash": "^4.17.21",
|
|
35
|
+
"reflect-metadata": "^0.1.12 || ^0.2.0",
|
|
36
|
+
"rxjs": "^7.8.1",
|
|
37
|
+
"type-fest": "^4.29.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "2ff7c8c9a35e27945fc4fe8ff210b94b2248b27e"
|
|
40
40
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { INestApplication } from '@nestjs/common/interfaces';
|
|
1
2
|
import type { AbstractHttpAdapter } from '@nestjs/core';
|
|
2
3
|
import { FastifyAdapter } from '@nestjs/platform-fastify';
|
|
3
4
|
import type { LogFormatter } from '@rsdk/core';
|
|
4
|
-
import type { ParsersConfig } from '@rsdk/http.server';
|
|
5
|
+
import type { HttpConfig, ParsersConfig, StaticMount } from '@rsdk/http.server';
|
|
5
6
|
import { AbstractHttpTransport } from '@rsdk/http.server';
|
|
6
|
-
import type { HttpConfig } from '@rsdk/http.server/dist/http.config';
|
|
7
7
|
|
|
8
8
|
import { FastifyHttpLogFormatter } from './fastify-http.log-formatter';
|
|
9
9
|
|
|
@@ -25,11 +25,11 @@ export class FastifyHttpTransport extends AbstractHttpTransport {
|
|
|
25
25
|
);
|
|
26
26
|
|
|
27
27
|
if (body.urlencoded) {
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
29
29
|
fastifyAdapter.register(require('@fastify/formbody'));
|
|
30
30
|
}
|
|
31
31
|
if (cookie) {
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
33
33
|
fastifyAdapter.register(require('@fastify/cookie'));
|
|
34
34
|
}
|
|
35
35
|
return fastifyAdapter;
|
|
@@ -38,4 +38,15 @@ export class FastifyHttpTransport extends AbstractHttpTransport {
|
|
|
38
38
|
logFormatter(): LogFormatter {
|
|
39
39
|
return new FastifyHttpLogFormatter();
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
protected override async configureStaticMount(
|
|
43
|
+
app: INestApplication,
|
|
44
|
+
mount: StaticMount,
|
|
45
|
+
): Promise<void> {
|
|
46
|
+
await app.getHttpAdapter().useStaticAssets?.({
|
|
47
|
+
root: mount.root,
|
|
48
|
+
prefix: mount.prefix,
|
|
49
|
+
decorateReply: false,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
41
52
|
}
|