@forklaunch/express 0.4.10 → 0.5.0

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/lib/index.d.mts CHANGED
@@ -1,6 +1,8 @@
1
1
  import * as _forklaunch_core_http from '@forklaunch/core/http';
2
2
  import { ForklaunchExpressLikeApplication, OpenTelemetryCollector, MetricsDefinition, DocsConfiguration, ForklaunchExpressLikeRouter, TypedMiddlewareDefinition, ParamsObject, ResponsesObject, Body, QueryObject, HeadersObject, ContractDetails, ExpressLikeSchemaHandler } from '@forklaunch/core/http';
3
3
  import { AnySchemaValidator, LiteralSchema, IdiomaticSchema, SchemaResolve } from '@forklaunch/validator';
4
+ import { OptionsText, OptionsJson, OptionsUrlencoded } from 'body-parser';
5
+ import { BusboyConfig } from 'busboy';
4
6
  import { Express, RequestHandler, Request, Response, NextFunction, Router as Router$1 } from 'express';
5
7
  export { NextFunction, Request, Response } from 'express';
6
8
  import { Server } from 'http';
@@ -28,7 +30,12 @@ declare class Application<SV extends AnySchemaValidator> extends ForklaunchExpre
28
30
  * @param {OpenTelemetryCollector<MetricsDefinition>} openTelemetryCollector - Collector for OpenTelemetry metrics.
29
31
  * @param {DocsConfiguration} [docsConfiguration] - Optional configuration for API documentation (Swagger/Scalar).
30
32
  */
31
- constructor(schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, docsConfiguration?: DocsConfiguration | undefined);
33
+ constructor(schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, docsConfiguration?: DocsConfiguration | undefined, options?: {
34
+ busboy?: BusboyConfig;
35
+ text?: OptionsText;
36
+ json?: OptionsJson;
37
+ urlencoded?: OptionsUrlencoded;
38
+ });
32
39
  /**
33
40
  * Starts the Express server and sets up API documentation (Swagger/Scalar).
34
41
  * This method is overloaded to support various ways of starting the server.
@@ -73,7 +80,12 @@ declare class Router<SV extends AnySchemaValidator, BasePath extends `/${string}
73
80
  * @param {string} basePath - The base path for the router.
74
81
  * @param {SV} schemaValidator - The schema validator.
75
82
  */
76
- constructor(basePath: BasePath, schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>);
83
+ constructor(basePath: BasePath, schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, options?: {
84
+ busboy?: BusboyConfig;
85
+ text?: OptionsText;
86
+ json?: OptionsJson;
87
+ urlencoded?: OptionsUrlencoded;
88
+ });
77
89
  route(path: string): this;
78
90
  param<ParamName extends string, Types extends {
79
91
  req?: LiteralSchema | SV['_SchemaCatchall'];
@@ -1964,7 +1976,12 @@ declare const unsubscribe: <SV extends AnySchemaValidator, Path extends `/${stri
1964
1976
  * @param {SV} schemaValidator - The schema validator.
1965
1977
  * @returns {Application<SV>} - The new application instance.
1966
1978
  */
1967
- declare function forklaunchExpress<SV extends AnySchemaValidator>(schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, docsConfiguration?: DocsConfiguration): Application<SV>;
1979
+ declare function forklaunchExpress<SV extends AnySchemaValidator>(schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, docsConfiguration?: DocsConfiguration, options?: {
1980
+ busboy?: BusboyConfig;
1981
+ text?: OptionsText;
1982
+ json?: OptionsJson;
1983
+ urlencoded?: OptionsUrlencoded;
1984
+ }): Application<SV>;
1968
1985
  /**
1969
1986
  * Creates a new instance of Router with the given base path and schema validator.
1970
1987
  *
@@ -1973,7 +1990,12 @@ declare function forklaunchExpress<SV extends AnySchemaValidator>(schemaValidato
1973
1990
  * @param {SV} schemaValidator - The schema validator.
1974
1991
  * @returns {Router<SV>} - The new router instance.
1975
1992
  */
1976
- declare function forklaunchRouter<SV extends AnySchemaValidator, BasePath extends `/${string}`>(basePath: BasePath, schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>): Router<SV, BasePath>;
1993
+ declare function forklaunchRouter<SV extends AnySchemaValidator, BasePath extends `/${string}`>(basePath: BasePath, schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, options?: {
1994
+ busboy?: BusboyConfig;
1995
+ text?: OptionsText;
1996
+ json?: OptionsJson;
1997
+ urlencoded?: OptionsUrlencoded;
1998
+ }): Router<SV, BasePath>;
1977
1999
 
1978
2000
  declare const handlers: {
1979
2001
  checkout: typeof checkout;
package/lib/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import * as _forklaunch_core_http from '@forklaunch/core/http';
2
2
  import { ForklaunchExpressLikeApplication, OpenTelemetryCollector, MetricsDefinition, DocsConfiguration, ForklaunchExpressLikeRouter, TypedMiddlewareDefinition, ParamsObject, ResponsesObject, Body, QueryObject, HeadersObject, ContractDetails, ExpressLikeSchemaHandler } from '@forklaunch/core/http';
3
3
  import { AnySchemaValidator, LiteralSchema, IdiomaticSchema, SchemaResolve } from '@forklaunch/validator';
4
+ import { OptionsText, OptionsJson, OptionsUrlencoded } from 'body-parser';
5
+ import { BusboyConfig } from 'busboy';
4
6
  import { Express, RequestHandler, Request, Response, NextFunction, Router as Router$1 } from 'express';
5
7
  export { NextFunction, Request, Response } from 'express';
6
8
  import { Server } from 'http';
@@ -28,7 +30,12 @@ declare class Application<SV extends AnySchemaValidator> extends ForklaunchExpre
28
30
  * @param {OpenTelemetryCollector<MetricsDefinition>} openTelemetryCollector - Collector for OpenTelemetry metrics.
29
31
  * @param {DocsConfiguration} [docsConfiguration] - Optional configuration for API documentation (Swagger/Scalar).
30
32
  */
31
- constructor(schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, docsConfiguration?: DocsConfiguration | undefined);
33
+ constructor(schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, docsConfiguration?: DocsConfiguration | undefined, options?: {
34
+ busboy?: BusboyConfig;
35
+ text?: OptionsText;
36
+ json?: OptionsJson;
37
+ urlencoded?: OptionsUrlencoded;
38
+ });
32
39
  /**
33
40
  * Starts the Express server and sets up API documentation (Swagger/Scalar).
34
41
  * This method is overloaded to support various ways of starting the server.
@@ -73,7 +80,12 @@ declare class Router<SV extends AnySchemaValidator, BasePath extends `/${string}
73
80
  * @param {string} basePath - The base path for the router.
74
81
  * @param {SV} schemaValidator - The schema validator.
75
82
  */
76
- constructor(basePath: BasePath, schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>);
83
+ constructor(basePath: BasePath, schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, options?: {
84
+ busboy?: BusboyConfig;
85
+ text?: OptionsText;
86
+ json?: OptionsJson;
87
+ urlencoded?: OptionsUrlencoded;
88
+ });
77
89
  route(path: string): this;
78
90
  param<ParamName extends string, Types extends {
79
91
  req?: LiteralSchema | SV['_SchemaCatchall'];
@@ -1964,7 +1976,12 @@ declare const unsubscribe: <SV extends AnySchemaValidator, Path extends `/${stri
1964
1976
  * @param {SV} schemaValidator - The schema validator.
1965
1977
  * @returns {Application<SV>} - The new application instance.
1966
1978
  */
1967
- declare function forklaunchExpress<SV extends AnySchemaValidator>(schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, docsConfiguration?: DocsConfiguration): Application<SV>;
1979
+ declare function forklaunchExpress<SV extends AnySchemaValidator>(schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, docsConfiguration?: DocsConfiguration, options?: {
1980
+ busboy?: BusboyConfig;
1981
+ text?: OptionsText;
1982
+ json?: OptionsJson;
1983
+ urlencoded?: OptionsUrlencoded;
1984
+ }): Application<SV>;
1968
1985
  /**
1969
1986
  * Creates a new instance of Router with the given base path and schema validator.
1970
1987
  *
@@ -1973,7 +1990,12 @@ declare function forklaunchExpress<SV extends AnySchemaValidator>(schemaValidato
1973
1990
  * @param {SV} schemaValidator - The schema validator.
1974
1991
  * @returns {Router<SV>} - The new router instance.
1975
1992
  */
1976
- declare function forklaunchRouter<SV extends AnySchemaValidator, BasePath extends `/${string}`>(basePath: BasePath, schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>): Router<SV, BasePath>;
1993
+ declare function forklaunchRouter<SV extends AnySchemaValidator, BasePath extends `/${string}`>(basePath: BasePath, schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, options?: {
1994
+ busboy?: BusboyConfig;
1995
+ text?: OptionsText;
1996
+ json?: OptionsJson;
1997
+ urlencoded?: OptionsUrlencoded;
1998
+ }): Router<SV, BasePath>;
1977
1999
 
1978
2000
  declare const handlers: {
1979
2001
  checkout: typeof checkout;
package/lib/index.js CHANGED
@@ -37,11 +37,121 @@ __export(index_exports, {
37
37
  module.exports = __toCommonJS(index_exports);
38
38
 
39
39
  // src/expressApplication.ts
40
- var import_http = require("@forklaunch/core/http");
40
+ var import_common3 = require("@forklaunch/common");
41
+ var import_http3 = require("@forklaunch/core/http");
41
42
  var import_express_api_reference = require("@scalar/express-api-reference");
42
- var import_express = __toESM(require("express"));
43
+ var import_crypto = __toESM(require("crypto"));
44
+ var import_express2 = __toESM(require("express"));
43
45
  var import_swagger_ui_express = __toESM(require("swagger-ui-express"));
44
- var Application = class extends import_http.ForklaunchExpressLikeApplication {
46
+
47
+ // src/middleware/content.parse.middleware.ts
48
+ var import_common = require("@forklaunch/common");
49
+ var import_http = require("@forklaunch/core/http");
50
+ var import_busboy = __toESM(require("busboy"));
51
+ var import_express = __toESM(require("express"));
52
+ function contentParse(options2) {
53
+ const jsonParser = import_express.default.json(options2?.json);
54
+ const urlencodedParser = import_express.default.urlencoded({
55
+ extended: true,
56
+ ...options2?.urlencoded
57
+ });
58
+ const textParser = import_express.default.text(options2?.text);
59
+ const rawParser = import_express.default.raw(options2?.raw);
60
+ return async (req, res, next) => {
61
+ try {
62
+ const coercedRequest = req;
63
+ const discriminatedBody = (0, import_http.discriminateBody)(
64
+ coercedRequest.schemaValidator,
65
+ coercedRequest.contractDetails.body
66
+ );
67
+ if (!discriminatedBody) {
68
+ return next();
69
+ }
70
+ switch (discriminatedBody.parserType) {
71
+ case "json":
72
+ return jsonParser(req, res, next);
73
+ case "urlEncoded":
74
+ return urlencodedParser(req, res, next);
75
+ case "text":
76
+ return textParser(req, res, next);
77
+ case "file":
78
+ return rawParser(req, res, next);
79
+ case "multipart": {
80
+ const bb = (0, import_busboy.default)({
81
+ headers: req.headers,
82
+ ...options2?.busboy
83
+ });
84
+ const body = {};
85
+ bb.on("file", (fieldname, file) => {
86
+ const chunks = [];
87
+ file.on("data", (chunk) => {
88
+ chunks.push(chunk);
89
+ });
90
+ file.on("end", () => {
91
+ const fileBuffer = Buffer.concat(chunks);
92
+ body[fieldname] = fileBuffer.toString();
93
+ });
94
+ });
95
+ bb.on("field", (fieldname, value) => {
96
+ body[fieldname] = value;
97
+ });
98
+ bb.on("finish", () => {
99
+ req.body = body;
100
+ next();
101
+ });
102
+ bb.on("error", (err) => {
103
+ next(err);
104
+ });
105
+ req.pipe(bb);
106
+ break;
107
+ }
108
+ default:
109
+ (0, import_common.isNever)(discriminatedBody.parserType);
110
+ }
111
+ } catch (error) {
112
+ next(error);
113
+ }
114
+ };
115
+ }
116
+
117
+ // src/middleware/enrichResponseTransmission.middleware.ts
118
+ var import_common2 = require("@forklaunch/common");
119
+ var import_http2 = require("@forklaunch/core/http");
120
+ function enrichResponseTransmission(req, res, next) {
121
+ const originalSend = res.send;
122
+ const originalJson = res.json;
123
+ const originalSetHeader = res.setHeader;
124
+ res.json = function(data) {
125
+ (0, import_http2.enrichExpressLikeSend)(this, req, res, originalJson, originalSend, data, !res.cors);
126
+ return data;
127
+ };
128
+ res.send = function(data) {
129
+ if (res.sent) {
130
+ originalSend.call(this, data);
131
+ return true;
132
+ }
133
+ (0, import_http2.enrichExpressLikeSend)(this, req, res, originalSend, originalSend, data, !res.cors);
134
+ res.sent = true;
135
+ return true;
136
+ };
137
+ res.setHeader = function(name, value) {
138
+ let stringifiedValue;
139
+ if (Array.isArray(value)) {
140
+ stringifiedValue = value.map((v) => (0, import_common2.safeStringify)(v)).join("\n");
141
+ } else {
142
+ stringifiedValue = (0, import_common2.safeStringify)(value);
143
+ }
144
+ return originalSetHeader.call(this, name, stringifiedValue);
145
+ };
146
+ res.sseEmitter = async function(emitter) {
147
+ const generator = emitter();
148
+ (0, import_http2.enrichExpressLikeSend)(this, req, res, originalSend, originalSend, generator, !res.cors);
149
+ };
150
+ next?.();
151
+ }
152
+
153
+ // src/expressApplication.ts
154
+ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
45
155
  /**
46
156
  * Creates an instance of Application.
47
157
  *
@@ -49,21 +159,30 @@ var Application = class extends import_http.ForklaunchExpressLikeApplication {
49
159
  * @param {OpenTelemetryCollector<MetricsDefinition>} openTelemetryCollector - Collector for OpenTelemetry metrics.
50
160
  * @param {DocsConfiguration} [docsConfiguration] - Optional configuration for API documentation (Swagger/Scalar).
51
161
  */
52
- constructor(schemaValidator, openTelemetryCollector, docsConfiguration) {
53
- super(schemaValidator, (0, import_express.default)(), openTelemetryCollector);
162
+ constructor(schemaValidator, openTelemetryCollector, docsConfiguration, options2) {
163
+ super(
164
+ schemaValidator,
165
+ (0, import_express2.default)(),
166
+ [
167
+ contentParse(options2),
168
+ enrichResponseTransmission
169
+ ],
170
+ openTelemetryCollector
171
+ );
54
172
  this.docsConfiguration = docsConfiguration;
55
173
  }
56
174
  listen(...args) {
57
175
  const port = typeof args[0] === "number" ? args[0] : Number(process.env.PORT);
176
+ const openApi = (0, import_http3.generateSwaggerDocument)(
177
+ this.schemaValidator,
178
+ port,
179
+ this.routers
180
+ );
58
181
  if (this.docsConfiguration == null || this.docsConfiguration.type === "scalar") {
59
182
  this.internal.use(
60
183
  `/api/${process.env.VERSION ?? "v1"}${process.env.DOCS_PATH ?? "/docs"}`,
61
184
  (0, import_express_api_reference.apiReference)({
62
- content: (0, import_http.generateSwaggerDocument)(
63
- this.schemaValidator,
64
- port,
65
- this.routers
66
- ),
185
+ content: openApi,
67
186
  ...this.docsConfiguration
68
187
  })
69
188
  );
@@ -71,23 +190,37 @@ var Application = class extends import_http.ForklaunchExpressLikeApplication {
71
190
  this.internal.use(
72
191
  `/api/${process.env.VERSION ?? "v1"}${process.env.DOCS_PATH ?? "/docs"}`,
73
192
  import_swagger_ui_express.default.serve,
74
- import_swagger_ui_express.default.setup(
75
- (0, import_http.generateSwaggerDocument)(this.schemaValidator, port, this.routers)
76
- )
193
+ import_swagger_ui_express.default.setup(openApi)
77
194
  );
78
195
  }
196
+ this.internal.get(
197
+ `/api/${process.env.VERSION ?? "v1"}/openapi`,
198
+ (_, res) => {
199
+ res.type("application/json");
200
+ res.json(openApi);
201
+ }
202
+ );
203
+ this.internal.get(
204
+ `/api/${process.env.VERSION ?? "v1"}/openapi-hash`,
205
+ async (_, res) => {
206
+ const hash = await import_crypto.default.createHash("sha256").update((0, import_common3.safeStringify)(openApi)).digest("hex");
207
+ res.send(hash);
208
+ }
209
+ );
79
210
  const errorHandler = (err, req, res, _next) => {
211
+ const statusCode = Number(res.statusCode);
80
212
  res.locals.errorMessage = err.message;
213
+ console.log(err);
81
214
  res.type("text/plain");
82
- res.status(res.statusCode && res.statusCode >= 400 ? res.statusCode : 500).send(
215
+ res.status(statusCode >= 400 ? statusCode : 500).send(
83
216
  `Internal server error:
84
217
 
85
- Correlation id: ${(0, import_http.isForklaunchRequest)(req) ? req.context.correlationId : "No correlation ID"}`
218
+ Correlation id: ${(0, import_http3.isForklaunchRequest)(req) ? req.context.correlationId : "No correlation ID"}`
86
219
  );
87
- (0, import_http.logger)("error").error(
220
+ (0, import_http3.logger)("error").error(
88
221
  err.stack ?? err.message,
89
- (0, import_http.meta)({
90
- [import_http.ATTR_HTTP_RESPONSE_STATUS_CODE]: res.statusCode ?? 500
222
+ (0, import_http3.meta)({
223
+ [import_http3.ATTR_HTTP_RESPONSE_STATUS_CODE]: statusCode
91
224
  })
92
225
  );
93
226
  };
@@ -97,42 +230,9 @@ Correlation id: ${(0, import_http.isForklaunchRequest)(req) ? req.context.correl
97
230
  };
98
231
 
99
232
  // src/expressRouter.ts
100
- var import_http3 = require("@forklaunch/core/http");
101
- var import_express2 = __toESM(require("express"));
102
-
103
- // src/middleware/response.middleware.ts
104
- var import_http2 = require("@forklaunch/core/http");
105
- function enrichResponseTransmission(req, res, next) {
106
- const originalSend = res.send;
107
- const originalJson = res.json;
108
- const originalSetHeader = res.setHeader;
109
- res.json = function(data) {
110
- res.bodyData = data;
111
- (0, import_http2.enrichExpressLikeSend)(this, req, res, originalJson, data, !res.cors);
112
- return data;
113
- };
114
- res.send = function(data) {
115
- if (!res.bodyData) {
116
- res.bodyData = data;
117
- }
118
- return (0, import_http2.enrichExpressLikeSend)(this, req, res, originalSend, data, !res.cors);
119
- };
120
- res.setHeader = function(name, value) {
121
- let stringifiedValue;
122
- if (Array.isArray(value)) {
123
- stringifiedValue = value.map(
124
- (v) => typeof v !== "string" ? JSON.stringify(v) : v
125
- );
126
- } else {
127
- stringifiedValue = typeof value !== "string" ? JSON.stringify(value) : value;
128
- }
129
- return originalSetHeader.call(this, name, stringifiedValue);
130
- };
131
- next?.();
132
- }
133
-
134
- // src/expressRouter.ts
135
- var Router = class extends import_http3.ForklaunchExpressLikeRouter {
233
+ var import_http4 = require("@forklaunch/core/http");
234
+ var import_express3 = __toESM(require("express"));
235
+ var Router = class extends import_http4.ForklaunchExpressLikeRouter {
136
236
  // implements ForklaunchRouter<SV>
137
237
  /**
138
238
  * Creates an instance of Router.
@@ -140,11 +240,18 @@ var Router = class extends import_http3.ForklaunchExpressLikeRouter {
140
240
  * @param {string} basePath - The base path for the router.
141
241
  * @param {SV} schemaValidator - The schema validator.
142
242
  */
143
- constructor(basePath, schemaValidator, openTelemetryCollector) {
144
- super(basePath, schemaValidator, import_express2.default.Router(), openTelemetryCollector);
243
+ constructor(basePath, schemaValidator, openTelemetryCollector, options2) {
244
+ super(
245
+ basePath,
246
+ schemaValidator,
247
+ import_express3.default.Router(),
248
+ [
249
+ contentParse(options2),
250
+ enrichResponseTransmission
251
+ ],
252
+ openTelemetryCollector
253
+ );
145
254
  this.basePath = basePath;
146
- this.internal.use(import_express2.default.json());
147
- this.internal.use(enrichResponseTransmission);
148
255
  }
149
256
  route(path) {
150
257
  this.internal.route(path);
@@ -317,183 +424,189 @@ var Router = class extends import_http3.ForklaunchExpressLikeRouter {
317
424
  };
318
425
 
319
426
  // src/handlers/checkout.ts
320
- var import_http4 = require("@forklaunch/core/http");
427
+ var import_http5 = require("@forklaunch/core/http");
321
428
  var checkout = (schemaValidator, path, contractDetails, ...handlers2) => {
322
- return (0, import_http4.middleware)(schemaValidator, path, contractDetails, ...handlers2);
429
+ return (0, import_http5.middleware)(schemaValidator, path, contractDetails, ...handlers2);
323
430
  };
324
431
 
325
432
  // src/handlers/copy.ts
326
- var import_http5 = require("@forklaunch/core/http");
433
+ var import_http6 = require("@forklaunch/core/http");
327
434
  var copy = (schemaValidator, path, contractDetails, ...handlers2) => {
328
- return (0, import_http5.middleware)(schemaValidator, path, contractDetails, ...handlers2);
435
+ return (0, import_http6.middleware)(schemaValidator, path, contractDetails, ...handlers2);
329
436
  };
330
437
 
331
438
  // src/handlers/delete.ts
332
- var import_http6 = require("@forklaunch/core/http");
439
+ var import_http7 = require("@forklaunch/core/http");
333
440
  var delete_ = (schemaValidator, path, contractDetails, ...handlers2) => {
334
- return (0, import_http6.delete_)(schemaValidator, path, contractDetails, ...handlers2);
441
+ return (0, import_http7.delete_)(schemaValidator, path, contractDetails, ...handlers2);
335
442
  };
336
443
 
337
444
  // src/handlers/get.ts
338
- var import_http7 = require("@forklaunch/core/http");
445
+ var import_http8 = require("@forklaunch/core/http");
339
446
  var get = (schemaValidator, path, contractDetails, ...handlers2) => {
340
- return (0, import_http7.get)(schemaValidator, path, contractDetails, ...handlers2);
447
+ return (0, import_http8.get)(schemaValidator, path, contractDetails, ...handlers2);
341
448
  };
342
449
 
343
450
  // src/handlers/head.ts
344
- var import_http8 = require("@forklaunch/core/http");
451
+ var import_http9 = require("@forklaunch/core/http");
345
452
  var head = (schemaValidator, path, contractDetails, ...handlers2) => {
346
- return (0, import_http8.head)(schemaValidator, path, contractDetails, ...handlers2);
453
+ return (0, import_http9.head)(schemaValidator, path, contractDetails, ...handlers2);
347
454
  };
348
455
 
349
456
  // src/handlers/link.ts
350
- var import_http9 = require("@forklaunch/core/http");
457
+ var import_http10 = require("@forklaunch/core/http");
351
458
  var link = (schemaValidator, path, contractDetails, ...handlers2) => {
352
- return (0, import_http9.middleware)(schemaValidator, path, contractDetails, ...handlers2);
459
+ return (0, import_http10.middleware)(schemaValidator, path, contractDetails, ...handlers2);
353
460
  };
354
461
 
355
462
  // src/handlers/lock.ts
356
- var import_http10 = require("@forklaunch/core/http");
463
+ var import_http11 = require("@forklaunch/core/http");
357
464
  var lock = (schemaValidator, path, contractDetails, ...handlers2) => {
358
- return (0, import_http10.middleware)(schemaValidator, path, contractDetails, ...handlers2);
465
+ return (0, import_http11.middleware)(schemaValidator, path, contractDetails, ...handlers2);
359
466
  };
360
467
 
361
468
  // src/handlers/m-search.ts
362
- var import_http11 = require("@forklaunch/core/http");
469
+ var import_http12 = require("@forklaunch/core/http");
363
470
  var mSearch = (schemaValidator, path, contractDetails, ...handlers2) => {
364
- return (0, import_http11.middleware)(schemaValidator, path, contractDetails, ...handlers2);
471
+ return (0, import_http12.middleware)(schemaValidator, path, contractDetails, ...handlers2);
365
472
  };
366
473
 
367
474
  // src/handlers/merge.ts
368
- var import_http12 = require("@forklaunch/core/http");
475
+ var import_http13 = require("@forklaunch/core/http");
369
476
  var merge = (schemaValidator, path, contractDetails, ...handlers2) => {
370
- return (0, import_http12.middleware)(schemaValidator, path, contractDetails, ...handlers2);
477
+ return (0, import_http13.middleware)(schemaValidator, path, contractDetails, ...handlers2);
371
478
  };
372
479
 
373
480
  // src/handlers/middleware.ts
374
- var import_http13 = require("@forklaunch/core/http");
481
+ var import_http14 = require("@forklaunch/core/http");
375
482
  var middleware7 = (schemaValidator, path, contractDetails, ...handlers2) => {
376
- return (0, import_http13.middleware)(schemaValidator, path, contractDetails, ...handlers2);
483
+ return (0, import_http14.middleware)(schemaValidator, path, contractDetails, ...handlers2);
377
484
  };
378
485
 
379
486
  // src/handlers/mkcactivity.ts
380
- var import_http14 = require("@forklaunch/core/http");
487
+ var import_http15 = require("@forklaunch/core/http");
381
488
  var mkcActivity = (schemaValidator, path, contractDetails, ...handlers2) => {
382
- return (0, import_http14.middleware)(schemaValidator, path, contractDetails, ...handlers2);
489
+ return (0, import_http15.middleware)(schemaValidator, path, contractDetails, ...handlers2);
383
490
  };
384
491
 
385
492
  // src/handlers/mkcol.ts
386
- var import_http15 = require("@forklaunch/core/http");
493
+ var import_http16 = require("@forklaunch/core/http");
387
494
  var mkcol = (schemaValidator, path, contractDetails, ...handlers2) => {
388
- return (0, import_http15.middleware)(schemaValidator, path, contractDetails, ...handlers2);
495
+ return (0, import_http16.middleware)(schemaValidator, path, contractDetails, ...handlers2);
389
496
  };
390
497
 
391
498
  // src/handlers/move.ts
392
- var import_http16 = require("@forklaunch/core/http");
499
+ var import_http17 = require("@forklaunch/core/http");
393
500
  var move = (schemaValidator, path, contractDetails, ...handlers2) => {
394
- return (0, import_http16.middleware)(schemaValidator, path, contractDetails, ...handlers2);
501
+ return (0, import_http17.middleware)(schemaValidator, path, contractDetails, ...handlers2);
395
502
  };
396
503
 
397
504
  // src/handlers/notify.ts
398
- var import_http17 = require("@forklaunch/core/http");
505
+ var import_http18 = require("@forklaunch/core/http");
399
506
  var notify = (schemaValidator, path, contractDetails, ...handlers2) => {
400
- return (0, import_http17.middleware)(schemaValidator, path, contractDetails, ...handlers2);
507
+ return (0, import_http18.middleware)(schemaValidator, path, contractDetails, ...handlers2);
401
508
  };
402
509
 
403
510
  // src/handlers/options.ts
404
- var import_http18 = require("@forklaunch/core/http");
511
+ var import_http19 = require("@forklaunch/core/http");
405
512
  var options = (schemaValidator, path, contractDetails, ...handlers2) => {
406
- return (0, import_http18.options)(schemaValidator, path, contractDetails, ...handlers2);
513
+ return (0, import_http19.options)(schemaValidator, path, contractDetails, ...handlers2);
407
514
  };
408
515
 
409
516
  // src/handlers/patch.ts
410
- var import_http19 = require("@forklaunch/core/http");
517
+ var import_http20 = require("@forklaunch/core/http");
411
518
  var patch = (schemaValidator, path, contractDetails, ...handlers2) => {
412
- return (0, import_http19.patch)(schemaValidator, path, contractDetails, ...handlers2);
519
+ return (0, import_http20.patch)(schemaValidator, path, contractDetails, ...handlers2);
413
520
  };
414
521
 
415
522
  // src/handlers/post.ts
416
- var import_http20 = require("@forklaunch/core/http");
523
+ var import_http21 = require("@forklaunch/core/http");
417
524
  var post = (schemaValidator, path, contractDetails, ...handlers2) => {
418
- return (0, import_http20.post)(schemaValidator, path, contractDetails, ...handlers2);
525
+ return (0, import_http21.post)(schemaValidator, path, contractDetails, ...handlers2);
419
526
  };
420
527
 
421
528
  // src/handlers/propfind.ts
422
- var import_http21 = require("@forklaunch/core/http");
529
+ var import_http22 = require("@forklaunch/core/http");
423
530
  var propfind = (schemaValidator, path, contractDetails, ...handlers2) => {
424
- return (0, import_http21.middleware)(schemaValidator, path, contractDetails, ...handlers2);
531
+ return (0, import_http22.middleware)(schemaValidator, path, contractDetails, ...handlers2);
425
532
  };
426
533
 
427
534
  // src/handlers/proppatch.ts
428
- var import_http22 = require("@forklaunch/core/http");
535
+ var import_http23 = require("@forklaunch/core/http");
429
536
  var proppatch = (schemaValidator, path, contractDetails, ...handlers2) => {
430
- return (0, import_http22.middleware)(schemaValidator, path, contractDetails, ...handlers2);
537
+ return (0, import_http23.middleware)(schemaValidator, path, contractDetails, ...handlers2);
431
538
  };
432
539
 
433
540
  // src/handlers/purge.ts
434
- var import_http23 = require("@forklaunch/core/http");
541
+ var import_http24 = require("@forklaunch/core/http");
435
542
  var purge = (schemaValidator, path, contractDetails, ...handlers2) => {
436
- return (0, import_http23.middleware)(schemaValidator, path, contractDetails, ...handlers2);
543
+ return (0, import_http24.middleware)(schemaValidator, path, contractDetails, ...handlers2);
437
544
  };
438
545
 
439
546
  // src/handlers/put.ts
440
- var import_http24 = require("@forklaunch/core/http");
547
+ var import_http25 = require("@forklaunch/core/http");
441
548
  var put = (schemaValidator, path, contractDetails, ...handlers2) => {
442
- return (0, import_http24.put)(schemaValidator, path, contractDetails, ...handlers2);
549
+ return (0, import_http25.put)(schemaValidator, path, contractDetails, ...handlers2);
443
550
  };
444
551
 
445
552
  // src/handlers/report.ts
446
- var import_http25 = require("@forklaunch/core/http");
553
+ var import_http26 = require("@forklaunch/core/http");
447
554
  var report = (schemaValidator, path, contractDetails, ...handlers2) => {
448
- return (0, import_http25.middleware)(schemaValidator, path, contractDetails, ...handlers2);
555
+ return (0, import_http26.middleware)(schemaValidator, path, contractDetails, ...handlers2);
449
556
  };
450
557
 
451
558
  // src/handlers/search.ts
452
- var import_http26 = require("@forklaunch/core/http");
559
+ var import_http27 = require("@forklaunch/core/http");
453
560
  var search = (schemaValidator, path, contractDetails, ...handlers2) => {
454
- return (0, import_http26.middleware)(schemaValidator, path, contractDetails, ...handlers2);
561
+ return (0, import_http27.middleware)(schemaValidator, path, contractDetails, ...handlers2);
455
562
  };
456
563
 
457
564
  // src/handlers/subscribe.ts
458
- var import_http27 = require("@forklaunch/core/http");
565
+ var import_http28 = require("@forklaunch/core/http");
459
566
  var subscribe = (schemaValidator, path, contractDetails, ...handlers2) => {
460
- return (0, import_http27.middleware)(schemaValidator, path, contractDetails, ...handlers2);
567
+ return (0, import_http28.middleware)(schemaValidator, path, contractDetails, ...handlers2);
461
568
  };
462
569
 
463
570
  // src/handlers/trace.ts
464
- var import_http28 = require("@forklaunch/core/http");
571
+ var import_http29 = require("@forklaunch/core/http");
465
572
  var trace = (schemaValidator, path, contractDetails, ...handlers2) => {
466
- return (0, import_http28.trace)(schemaValidator, path, contractDetails, ...handlers2);
573
+ return (0, import_http29.trace)(schemaValidator, path, contractDetails, ...handlers2);
467
574
  };
468
575
 
469
576
  // src/handlers/unlink.ts
470
- var import_http29 = require("@forklaunch/core/http");
577
+ var import_http30 = require("@forklaunch/core/http");
471
578
  var unlink = (schemaValidator, path, contractDetails, ...handlers2) => {
472
- return (0, import_http29.middleware)(schemaValidator, path, contractDetails, ...handlers2);
579
+ return (0, import_http30.middleware)(schemaValidator, path, contractDetails, ...handlers2);
473
580
  };
474
581
 
475
582
  // src/handlers/unlock.ts
476
- var import_http30 = require("@forklaunch/core/http");
583
+ var import_http31 = require("@forklaunch/core/http");
477
584
  var unlock = (schemaValidator, path, contractDetails, ...handlers2) => {
478
- return (0, import_http30.middleware)(schemaValidator, path, contractDetails, ...handlers2);
585
+ return (0, import_http31.middleware)(schemaValidator, path, contractDetails, ...handlers2);
479
586
  };
480
587
 
481
588
  // src/handlers/unsubscribe.ts
482
- var import_http31 = require("@forklaunch/core/http");
589
+ var import_http32 = require("@forklaunch/core/http");
483
590
  var unsubscribe = (schemaValidator, path, contractDetails, ...handlers2) => {
484
- return (0, import_http31.middleware)(schemaValidator, path, contractDetails, ...handlers2);
591
+ return (0, import_http32.middleware)(schemaValidator, path, contractDetails, ...handlers2);
485
592
  };
486
593
 
487
594
  // index.ts
488
- function forklaunchExpress(schemaValidator, openTelemetryCollector, docsConfiguration) {
595
+ function forklaunchExpress(schemaValidator, openTelemetryCollector, docsConfiguration, options2) {
489
596
  return new Application(
490
597
  schemaValidator,
491
598
  openTelemetryCollector,
492
- docsConfiguration
599
+ docsConfiguration,
600
+ options2
493
601
  );
494
602
  }
495
- function forklaunchRouter(basePath, schemaValidator, openTelemetryCollector) {
496
- const router = new Router(basePath, schemaValidator, openTelemetryCollector);
603
+ function forklaunchRouter(basePath, schemaValidator, openTelemetryCollector, options2) {
604
+ const router = new Router(
605
+ basePath,
606
+ schemaValidator,
607
+ openTelemetryCollector,
608
+ options2
609
+ );
497
610
  return router;
498
611
  }
499
612
  var handlers = {
package/lib/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  // src/expressApplication.ts
2
+ import { safeStringify as safeStringify2 } from "@forklaunch/common";
2
3
  import {
3
4
  ATTR_HTTP_RESPONSE_STATUS_CODE,
4
5
  ForklaunchExpressLikeApplication,
@@ -8,8 +9,119 @@ import {
8
9
  meta
9
10
  } from "@forklaunch/core/http";
10
11
  import { apiReference } from "@scalar/express-api-reference";
11
- import express from "express";
12
+ import crypto from "crypto";
13
+ import express2 from "express";
12
14
  import swaggerUi from "swagger-ui-express";
15
+
16
+ // src/middleware/content.parse.middleware.ts
17
+ import { isNever } from "@forklaunch/common";
18
+ import { discriminateBody } from "@forklaunch/core/http";
19
+ import Busboy from "busboy";
20
+ import express from "express";
21
+ function contentParse(options2) {
22
+ const jsonParser = express.json(options2?.json);
23
+ const urlencodedParser = express.urlencoded({
24
+ extended: true,
25
+ ...options2?.urlencoded
26
+ });
27
+ const textParser = express.text(options2?.text);
28
+ const rawParser = express.raw(options2?.raw);
29
+ return async (req, res, next) => {
30
+ try {
31
+ const coercedRequest = req;
32
+ const discriminatedBody = discriminateBody(
33
+ coercedRequest.schemaValidator,
34
+ coercedRequest.contractDetails.body
35
+ );
36
+ if (!discriminatedBody) {
37
+ return next();
38
+ }
39
+ switch (discriminatedBody.parserType) {
40
+ case "json":
41
+ return jsonParser(req, res, next);
42
+ case "urlEncoded":
43
+ return urlencodedParser(req, res, next);
44
+ case "text":
45
+ return textParser(req, res, next);
46
+ case "file":
47
+ return rawParser(req, res, next);
48
+ case "multipart": {
49
+ const bb = Busboy({
50
+ headers: req.headers,
51
+ ...options2?.busboy
52
+ });
53
+ const body = {};
54
+ bb.on("file", (fieldname, file) => {
55
+ const chunks = [];
56
+ file.on("data", (chunk) => {
57
+ chunks.push(chunk);
58
+ });
59
+ file.on("end", () => {
60
+ const fileBuffer = Buffer.concat(chunks);
61
+ body[fieldname] = fileBuffer.toString();
62
+ });
63
+ });
64
+ bb.on("field", (fieldname, value) => {
65
+ body[fieldname] = value;
66
+ });
67
+ bb.on("finish", () => {
68
+ req.body = body;
69
+ next();
70
+ });
71
+ bb.on("error", (err) => {
72
+ next(err);
73
+ });
74
+ req.pipe(bb);
75
+ break;
76
+ }
77
+ default:
78
+ isNever(discriminatedBody.parserType);
79
+ }
80
+ } catch (error) {
81
+ next(error);
82
+ }
83
+ };
84
+ }
85
+
86
+ // src/middleware/enrichResponseTransmission.middleware.ts
87
+ import { safeStringify } from "@forklaunch/common";
88
+ import {
89
+ enrichExpressLikeSend
90
+ } from "@forklaunch/core/http";
91
+ function enrichResponseTransmission(req, res, next) {
92
+ const originalSend = res.send;
93
+ const originalJson = res.json;
94
+ const originalSetHeader = res.setHeader;
95
+ res.json = function(data) {
96
+ enrichExpressLikeSend(this, req, res, originalJson, originalSend, data, !res.cors);
97
+ return data;
98
+ };
99
+ res.send = function(data) {
100
+ if (res.sent) {
101
+ originalSend.call(this, data);
102
+ return true;
103
+ }
104
+ enrichExpressLikeSend(this, req, res, originalSend, originalSend, data, !res.cors);
105
+ res.sent = true;
106
+ return true;
107
+ };
108
+ res.setHeader = function(name, value) {
109
+ let stringifiedValue;
110
+ if (Array.isArray(value)) {
111
+ stringifiedValue = value.map((v) => safeStringify(v)).join("\n");
112
+ } else {
113
+ stringifiedValue = safeStringify(value);
114
+ }
115
+ return originalSetHeader.call(this, name, stringifiedValue);
116
+ };
117
+ res.sseEmitter = async function(emitter) {
118
+ const generator = emitter();
119
+ enrichExpressLikeSend(this, req, res, originalSend, originalSend, generator, !res.cors);
120
+ };
121
+ next?.();
122
+ }
123
+
124
+ // src/expressApplication.ts
13
125
  var Application = class extends ForklaunchExpressLikeApplication {
14
126
  /**
15
127
  * Creates an instance of Application.
@@ -18,21 +130,30 @@ var Application = class extends ForklaunchExpressLikeApplication {
18
130
  * @param {OpenTelemetryCollector<MetricsDefinition>} openTelemetryCollector - Collector for OpenTelemetry metrics.
19
131
  * @param {DocsConfiguration} [docsConfiguration] - Optional configuration for API documentation (Swagger/Scalar).
20
132
  */
21
- constructor(schemaValidator, openTelemetryCollector, docsConfiguration) {
22
- super(schemaValidator, express(), openTelemetryCollector);
133
+ constructor(schemaValidator, openTelemetryCollector, docsConfiguration, options2) {
134
+ super(
135
+ schemaValidator,
136
+ express2(),
137
+ [
138
+ contentParse(options2),
139
+ enrichResponseTransmission
140
+ ],
141
+ openTelemetryCollector
142
+ );
23
143
  this.docsConfiguration = docsConfiguration;
24
144
  }
25
145
  listen(...args) {
26
146
  const port = typeof args[0] === "number" ? args[0] : Number(process.env.PORT);
147
+ const openApi = generateSwaggerDocument(
148
+ this.schemaValidator,
149
+ port,
150
+ this.routers
151
+ );
27
152
  if (this.docsConfiguration == null || this.docsConfiguration.type === "scalar") {
28
153
  this.internal.use(
29
154
  `/api/${process.env.VERSION ?? "v1"}${process.env.DOCS_PATH ?? "/docs"}`,
30
155
  apiReference({
31
- content: generateSwaggerDocument(
32
- this.schemaValidator,
33
- port,
34
- this.routers
35
- ),
156
+ content: openApi,
36
157
  ...this.docsConfiguration
37
158
  })
38
159
  );
@@ -40,15 +161,29 @@ var Application = class extends ForklaunchExpressLikeApplication {
40
161
  this.internal.use(
41
162
  `/api/${process.env.VERSION ?? "v1"}${process.env.DOCS_PATH ?? "/docs"}`,
42
163
  swaggerUi.serve,
43
- swaggerUi.setup(
44
- generateSwaggerDocument(this.schemaValidator, port, this.routers)
45
- )
164
+ swaggerUi.setup(openApi)
46
165
  );
47
166
  }
167
+ this.internal.get(
168
+ `/api/${process.env.VERSION ?? "v1"}/openapi`,
169
+ (_, res) => {
170
+ res.type("application/json");
171
+ res.json(openApi);
172
+ }
173
+ );
174
+ this.internal.get(
175
+ `/api/${process.env.VERSION ?? "v1"}/openapi-hash`,
176
+ async (_, res) => {
177
+ const hash = await crypto.createHash("sha256").update(safeStringify2(openApi)).digest("hex");
178
+ res.send(hash);
179
+ }
180
+ );
48
181
  const errorHandler = (err, req, res, _next) => {
182
+ const statusCode = Number(res.statusCode);
49
183
  res.locals.errorMessage = err.message;
184
+ console.log(err);
50
185
  res.type("text/plain");
51
- res.status(res.statusCode && res.statusCode >= 400 ? res.statusCode : 500).send(
186
+ res.status(statusCode >= 400 ? statusCode : 500).send(
52
187
  `Internal server error:
53
188
 
54
189
  Correlation id: ${isForklaunchRequest(req) ? req.context.correlationId : "No correlation ID"}`
@@ -56,7 +191,7 @@ Correlation id: ${isForklaunchRequest(req) ? req.context.correlationId : "No cor
56
191
  logger("error").error(
57
192
  err.stack ?? err.message,
58
193
  meta({
59
- [ATTR_HTTP_RESPONSE_STATUS_CODE]: res.statusCode ?? 500
194
+ [ATTR_HTTP_RESPONSE_STATUS_CODE]: statusCode
60
195
  })
61
196
  );
62
197
  };
@@ -69,40 +204,7 @@ Correlation id: ${isForklaunchRequest(req) ? req.context.correlationId : "No cor
69
204
  import {
70
205
  ForklaunchExpressLikeRouter
71
206
  } from "@forklaunch/core/http";
72
- import express2 from "express";
73
-
74
- // src/middleware/response.middleware.ts
75
- import { enrichExpressLikeSend } from "@forklaunch/core/http";
76
- function enrichResponseTransmission(req, res, next) {
77
- const originalSend = res.send;
78
- const originalJson = res.json;
79
- const originalSetHeader = res.setHeader;
80
- res.json = function(data) {
81
- res.bodyData = data;
82
- enrichExpressLikeSend(this, req, res, originalJson, data, !res.cors);
83
- return data;
84
- };
85
- res.send = function(data) {
86
- if (!res.bodyData) {
87
- res.bodyData = data;
88
- }
89
- return enrichExpressLikeSend(this, req, res, originalSend, data, !res.cors);
90
- };
91
- res.setHeader = function(name, value) {
92
- let stringifiedValue;
93
- if (Array.isArray(value)) {
94
- stringifiedValue = value.map(
95
- (v) => typeof v !== "string" ? JSON.stringify(v) : v
96
- );
97
- } else {
98
- stringifiedValue = typeof value !== "string" ? JSON.stringify(value) : value;
99
- }
100
- return originalSetHeader.call(this, name, stringifiedValue);
101
- };
102
- next?.();
103
- }
104
-
105
- // src/expressRouter.ts
207
+ import express3 from "express";
106
208
  var Router = class extends ForklaunchExpressLikeRouter {
107
209
  // implements ForklaunchRouter<SV>
108
210
  /**
@@ -111,11 +213,18 @@ var Router = class extends ForklaunchExpressLikeRouter {
111
213
  * @param {string} basePath - The base path for the router.
112
214
  * @param {SV} schemaValidator - The schema validator.
113
215
  */
114
- constructor(basePath, schemaValidator, openTelemetryCollector) {
115
- super(basePath, schemaValidator, express2.Router(), openTelemetryCollector);
216
+ constructor(basePath, schemaValidator, openTelemetryCollector, options2) {
217
+ super(
218
+ basePath,
219
+ schemaValidator,
220
+ express3.Router(),
221
+ [
222
+ contentParse(options2),
223
+ enrichResponseTransmission
224
+ ],
225
+ openTelemetryCollector
226
+ );
116
227
  this.basePath = basePath;
117
- this.internal.use(express2.json());
118
- this.internal.use(enrichResponseTransmission);
119
228
  }
120
229
  route(path) {
121
230
  this.internal.route(path);
@@ -512,15 +621,21 @@ var unsubscribe = (schemaValidator, path, contractDetails, ...handlers2) => {
512
621
  };
513
622
 
514
623
  // index.ts
515
- function forklaunchExpress(schemaValidator, openTelemetryCollector, docsConfiguration) {
624
+ function forklaunchExpress(schemaValidator, openTelemetryCollector, docsConfiguration, options2) {
516
625
  return new Application(
517
626
  schemaValidator,
518
627
  openTelemetryCollector,
519
- docsConfiguration
628
+ docsConfiguration,
629
+ options2
520
630
  );
521
631
  }
522
- function forklaunchRouter(basePath, schemaValidator, openTelemetryCollector) {
523
- const router = new Router(basePath, schemaValidator, openTelemetryCollector);
632
+ function forklaunchRouter(basePath, schemaValidator, openTelemetryCollector, options2) {
633
+ const router = new Router(
634
+ basePath,
635
+ schemaValidator,
636
+ openTelemetryCollector,
637
+ options2
638
+ );
524
639
  return router;
525
640
  }
526
641
  var handlers = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/express",
3
- "version": "0.4.10",
3
+ "version": "0.5.0",
4
4
  "description": "Forklaunch framework for express.",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -25,32 +25,38 @@
25
25
  "lib/**"
26
26
  ],
27
27
  "dependencies": {
28
- "@scalar/express-api-reference": "^0.6.8",
28
+ "@scalar/express-api-reference": "^0.8.1",
29
+ "@types/multer": "^1.4.12",
30
+ "body-parser": "^2.2.0",
31
+ "busboy": "^1.6.0",
29
32
  "cors": "^2.8.5",
30
33
  "express": "^5.1.0",
34
+ "multer": "2.0.0",
31
35
  "qs": "^6.14.0",
32
36
  "swagger-ui-express": "^5.0.1",
33
- "@forklaunch/common": "0.2.10",
34
- "@forklaunch/core": "0.7.3",
35
- "@forklaunch/validator": "0.5.3"
37
+ "@forklaunch/common": "0.3.0",
38
+ "@forklaunch/core": "0.8.0",
39
+ "@forklaunch/validator": "0.6.0"
36
40
  },
37
41
  "devDependencies": {
38
- "@eslint/js": "^9.24.0",
39
- "@types/cors": "^2.8.17",
40
- "@types/express": "^5.0.1",
42
+ "@eslint/js": "^9.27.0",
43
+ "@types/body-parser": "^1.19.5",
44
+ "@types/busboy": "^1.5.4",
45
+ "@types/cors": "^2.8.18",
46
+ "@types/express": "^5.0.2",
41
47
  "@types/express-serve-static-core": "^5.0.6",
42
48
  "@types/jest": "^29.5.14",
43
- "@types/qs": "^6.9.18",
49
+ "@types/qs": "^6.14.0",
44
50
  "@types/swagger-ui-express": "^4.1.8",
45
51
  "jest": "^29.7.0",
46
52
  "kill-port-process": "^3.2.1",
47
53
  "prettier": "^3.5.3",
48
- "ts-jest": "^29.3.2",
54
+ "ts-jest": "^29.3.4",
49
55
  "ts-node": "^10.9.2",
50
- "tsup": "^8.4.0",
51
- "typedoc": "^0.28.2",
56
+ "tsup": "^8.5.0",
57
+ "typedoc": "^0.28.4",
52
58
  "typescript": "^5.8.3",
53
- "typescript-eslint": "^8.30.1"
59
+ "typescript-eslint": "^8.32.1"
54
60
  },
55
61
  "scripts": {
56
62
  "build": "tsc --noEmit && tsup index.ts --format cjs,esm --no-splitting --tsconfig tsconfig.json --outDir lib --dts --clean",