@solidxai/core 0.1.13-beta.14 → 0.1.13-beta.15
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/CHANGELOG.md +574 -0
- package/dist/filters/http-exception.filter.d.ts.map +1 -1
- package/dist/filters/http-exception.filter.js +5 -1
- package/dist/filters/http-exception.filter.js.map +1 -1
- package/dist/helpers/bootstrap.helper.d.ts +3 -1
- package/dist/helpers/bootstrap.helper.d.ts.map +1 -1
- package/dist/helpers/bootstrap.helper.js +6 -2
- package/dist/helpers/bootstrap.helper.js.map +1 -1
- package/dist/solid-core.module.d.ts +1 -3
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +0 -39
- package/dist/solid-core.module.js.map +1 -1
- package/package.json +1 -1
- package/src/filters/http-exception.filter.ts +11 -1
- package/src/helpers/bootstrap.helper.ts +22 -3
- package/src/solid-core.module.ts +5 -12
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ClassSerializerInterceptor, ValidationPipe } from '@nestjs/common';
|
|
2
2
|
import { NestFactory, Reflector } from '@nestjs/core';
|
|
3
|
+
import { NestExpressApplication } from '@nestjs/platform-express';
|
|
3
4
|
import { WsAdapter } from '@nestjs/platform-ws';
|
|
4
5
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
5
6
|
import { NextFunction, Request, Response } from 'express';
|
|
@@ -59,6 +60,12 @@ export interface SolidBootstrapOptions {
|
|
|
59
60
|
security?: SolidSecurityOptions;
|
|
60
61
|
/** Show full NestJS init logs during bootstrap (route mapping, module deps, pollers). Defaults to false. */
|
|
61
62
|
verboseBootstrap?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Max request body size for JSON and urlencoded payloads, as a `bytes`-compatible
|
|
65
|
+
* string (e.g. '25mb', '512kb'). Defaults to '25mb'.
|
|
66
|
+
* Note: does not apply to multipart uploads — those are governed by Multer.
|
|
67
|
+
*/
|
|
68
|
+
bodyLimit?: string;
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
/**
|
|
@@ -77,7 +84,7 @@ export interface SolidBootstrapOptions {
|
|
|
77
84
|
export async function bootstrapSolidApp(
|
|
78
85
|
appModuleFactory: () => Promise<any>,
|
|
79
86
|
options: SolidBootstrapOptions = {},
|
|
80
|
-
): Promise<
|
|
87
|
+
): Promise<NestExpressApplication> {
|
|
81
88
|
registerGlobalProcessHandlers();
|
|
82
89
|
|
|
83
90
|
const {
|
|
@@ -86,11 +93,15 @@ export async function bootstrapSolidApp(
|
|
|
86
93
|
permissionsPolicyOverrides = {},
|
|
87
94
|
security = {},
|
|
88
95
|
verboseBootstrap = false,
|
|
96
|
+
bodyLimit = '25mb',
|
|
89
97
|
} = options;
|
|
90
98
|
|
|
91
99
|
const startTime = Date.now();
|
|
92
100
|
const appModule = await appModuleFactory();
|
|
93
|
-
const app = await NestFactory.create(appModule, {
|
|
101
|
+
const app = await NestFactory.create<NestExpressApplication>(appModule, {
|
|
102
|
+
// Nest's default parsers are registered during init() with a 100kb limit, ahead of
|
|
103
|
+
// any module middleware. Disable them so the parsers below own the limit outright.
|
|
104
|
+
bodyParser: false,
|
|
94
105
|
logger: WinstonModule.createLogger({ ...createWinstonLoggerConfig(), level: verboseBootstrap ? 'debug' : 'error' }),
|
|
95
106
|
});
|
|
96
107
|
|
|
@@ -101,7 +112,7 @@ export async function bootstrapSolidApp(
|
|
|
101
112
|
app
|
|
102
113
|
.get(WINSTON_MODULE_NEST_PROVIDER)
|
|
103
114
|
.log('API server disabled via API_ENABLED=false. Skipping HTTP listen.', 'Bootstrap');
|
|
104
|
-
return;
|
|
115
|
+
return app;
|
|
105
116
|
}
|
|
106
117
|
|
|
107
118
|
// Health check at root path
|
|
@@ -150,6 +161,12 @@ export async function bootstrapSolidApp(
|
|
|
150
161
|
next();
|
|
151
162
|
});
|
|
152
163
|
|
|
164
|
+
// Body parsers — replaces Nest's default 100kb parsers (disabled via bodyParser: false).
|
|
165
|
+
// Registered here so the middleware order Nest applied by default is preserved:
|
|
166
|
+
// helmet -> CSP -> Permissions-Policy -> qs -> body parsers -> routes.
|
|
167
|
+
app.useBodyParser('json', { limit: bodyLimit });
|
|
168
|
+
app.useBodyParser('urlencoded', { limit: bodyLimit, extended: true });
|
|
169
|
+
|
|
153
170
|
// Global ValidationPipe
|
|
154
171
|
app.useGlobalPipes(
|
|
155
172
|
new ValidationPipe({
|
|
@@ -209,6 +226,8 @@ export async function bootstrapSolidApp(
|
|
|
209
226
|
|
|
210
227
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
211
228
|
process.stdout.write(`\x1b[32mServer started on port ${port} in ${elapsed}s\x1b[0m\n`);
|
|
229
|
+
|
|
230
|
+
return app;
|
|
212
231
|
}
|
|
213
232
|
|
|
214
233
|
// ---- CLI bootstrap ----
|
package/src/solid-core.module.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "multer";
|
|
2
|
-
import { Global,
|
|
3
|
-
import * as express from "express";
|
|
2
|
+
import { Global, Module } from "@nestjs/common";
|
|
4
3
|
import { ConfigModule, ConfigService } from "@nestjs/config";
|
|
5
4
|
import {
|
|
6
5
|
APP_FILTER,
|
|
@@ -1050,13 +1049,7 @@ import { SwitchNode } from './services/workflow/nodes/switch.node';
|
|
|
1050
1049
|
WorkflowExpressionService,
|
|
1051
1050
|
],
|
|
1052
1051
|
})
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
express.json({ limit: "10mb" }),
|
|
1058
|
-
express.urlencoded({ limit: "10mb", extended: true }),
|
|
1059
|
-
)
|
|
1060
|
-
.forRoutes("*");
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1052
|
+
// Body-size limits live in bootstrapSolidApp (see SolidBootstrapOptions.bodyLimit).
|
|
1053
|
+
// They cannot be applied here: module middleware is registered in registerRouter(),
|
|
1054
|
+
// which runs after Nest's own parser middleware, so anything set here never takes effect.
|
|
1055
|
+
export class SolidCoreModule {}
|