@forklaunch/express 2.2.2 → 2.2.3
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.js +94 -110
- package/lib/index.mjs +14 -26
- package/lib/src/cluster/bun.cluster.d.ts.map +1 -1
- package/lib/src/cluster/node.cluster.d.ts.map +1 -1
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -36,11 +36,11 @@ __export(index_exports, {
|
|
|
36
36
|
port: () => port
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(index_exports);
|
|
39
|
-
var
|
|
39
|
+
var import_http35 = require("@forklaunch/core/http");
|
|
40
40
|
|
|
41
41
|
// src/expressApplication.ts
|
|
42
42
|
var import_common4 = require("@forklaunch/common");
|
|
43
|
-
var
|
|
43
|
+
var import_http5 = require("@forklaunch/core/http");
|
|
44
44
|
var import_environment = require("@forklaunch/core/environment");
|
|
45
45
|
var import_zod = require("@forklaunch/validator/zod");
|
|
46
46
|
var import_express_api_reference = require("@scalar/express-api-reference");
|
|
@@ -51,6 +51,7 @@ var import_path = __toESM(require("path"));
|
|
|
51
51
|
var import_swagger_ui_express = __toESM(require("swagger-ui-express"));
|
|
52
52
|
|
|
53
53
|
// src/cluster/bun.cluster.ts
|
|
54
|
+
var import_http = require("@forklaunch/core/http");
|
|
54
55
|
var import_node_cluster = __toESM(require("cluster"));
|
|
55
56
|
var import_node_os = __toESM(require("os"));
|
|
56
57
|
|
|
@@ -1707,25 +1708,17 @@ function startBunCluster(config) {
|
|
|
1707
1708
|
process.exit(0);
|
|
1708
1709
|
}
|
|
1709
1710
|
});
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
`Uncaught exception on worker ${process.pid}:`,
|
|
1713
|
-
err
|
|
1714
|
-
);
|
|
1715
|
-
process.exit(1);
|
|
1716
|
-
});
|
|
1717
|
-
process.on("unhandledRejection", (reason) => {
|
|
1718
|
-
openTelemetryCollector.error(
|
|
1719
|
-
`Unhandled rejection on worker ${process.pid}:`,
|
|
1720
|
-
reason
|
|
1721
|
-
);
|
|
1722
|
-
process.exit(1);
|
|
1711
|
+
const processErrors = (0, import_http.createProcessErrorHandlers)(openTelemetryCollector, {
|
|
1712
|
+
label: `on worker ${process.pid}`
|
|
1723
1713
|
});
|
|
1714
|
+
process.on("uncaughtException", processErrors.uncaughtException);
|
|
1715
|
+
process.on("unhandledRejection", processErrors.unhandledRejection);
|
|
1724
1716
|
}
|
|
1725
1717
|
}
|
|
1726
1718
|
|
|
1727
1719
|
// src/cluster/node.cluster.ts
|
|
1728
1720
|
var import_common = require("@forklaunch/common");
|
|
1721
|
+
var import_http2 = require("@forklaunch/core/http");
|
|
1729
1722
|
var import_node_cluster2 = __toESM(require("cluster"));
|
|
1730
1723
|
var import_node_fs = __toESM(require("fs"));
|
|
1731
1724
|
var import_node_http = __toESM(require("http"));
|
|
@@ -1889,20 +1882,11 @@ function startNodeCluster(config) {
|
|
|
1889
1882
|
);
|
|
1890
1883
|
}
|
|
1891
1884
|
}, 3e4);
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
`Uncaught exception on worker ${process.pid}:`,
|
|
1895
|
-
err
|
|
1896
|
-
);
|
|
1897
|
-
process.exit(1);
|
|
1898
|
-
});
|
|
1899
|
-
process.on("unhandledRejection", (reason) => {
|
|
1900
|
-
openTelemetryCollector.error(
|
|
1901
|
-
`Unhandled rejection on worker ${process.pid}:`,
|
|
1902
|
-
reason
|
|
1903
|
-
);
|
|
1904
|
-
process.exit(1);
|
|
1885
|
+
const processErrors = (0, import_http2.createProcessErrorHandlers)(openTelemetryCollector, {
|
|
1886
|
+
label: `on worker ${process.pid}`
|
|
1905
1887
|
});
|
|
1888
|
+
process.on("uncaughtException", processErrors.uncaughtException);
|
|
1889
|
+
process.on("unhandledRejection", processErrors.unhandledRejection);
|
|
1906
1890
|
const protocol = SSL_CONFIG ? "https" : "http";
|
|
1907
1891
|
openTelemetryCollector.info(
|
|
1908
1892
|
`[worker ${process.pid}] ready (awaiting sockets from primary) - ${protocol}`
|
|
@@ -1912,7 +1896,7 @@ function startNodeCluster(config) {
|
|
|
1912
1896
|
|
|
1913
1897
|
// src/middleware/content.parse.middleware.ts
|
|
1914
1898
|
var import_common2 = require("@forklaunch/common");
|
|
1915
|
-
var
|
|
1899
|
+
var import_http3 = require("@forklaunch/core/http");
|
|
1916
1900
|
var import_busboy = __toESM(require("busboy"));
|
|
1917
1901
|
var import_express = __toESM(require("express"));
|
|
1918
1902
|
var DEFAULT_CONTENT_TYPES = {
|
|
@@ -1984,7 +1968,7 @@ function contentParse(options2) {
|
|
|
1984
1968
|
} else {
|
|
1985
1969
|
contractBody = coercedRequest.contractDetails.body;
|
|
1986
1970
|
}
|
|
1987
|
-
const discriminatedBody = (0,
|
|
1971
|
+
const discriminatedBody = (0, import_http3.discriminateBody)(
|
|
1988
1972
|
coercedRequest.schemaValidator,
|
|
1989
1973
|
contractBody
|
|
1990
1974
|
);
|
|
@@ -2124,13 +2108,13 @@ async function writeFetchResponse(response, res) {
|
|
|
2124
2108
|
|
|
2125
2109
|
// src/middleware/enrichResponseTransmission.middleware.ts
|
|
2126
2110
|
var import_common3 = require("@forklaunch/common");
|
|
2127
|
-
var
|
|
2111
|
+
var import_http4 = require("@forklaunch/core/http");
|
|
2128
2112
|
function enrichResponseTransmission(req, res, next) {
|
|
2129
2113
|
const originalSend = res.send;
|
|
2130
2114
|
const originalJson = res.json;
|
|
2131
2115
|
const originalSetHeader = res.setHeader;
|
|
2132
2116
|
res.json = function(data) {
|
|
2133
|
-
(0,
|
|
2117
|
+
(0, import_http4.enrichExpressLikeSend)(this, req, res, originalJson, originalSend, data, !res.cors);
|
|
2134
2118
|
return data;
|
|
2135
2119
|
};
|
|
2136
2120
|
res.send = function(data) {
|
|
@@ -2138,7 +2122,7 @@ function enrichResponseTransmission(req, res, next) {
|
|
|
2138
2122
|
originalSend.call(this, data);
|
|
2139
2123
|
return true;
|
|
2140
2124
|
}
|
|
2141
|
-
(0,
|
|
2125
|
+
(0, import_http4.enrichExpressLikeSend)(this, req, res, originalSend, originalSend, data, !res.cors);
|
|
2142
2126
|
res.sent = true;
|
|
2143
2127
|
return true;
|
|
2144
2128
|
};
|
|
@@ -2153,13 +2137,13 @@ function enrichResponseTransmission(req, res, next) {
|
|
|
2153
2137
|
};
|
|
2154
2138
|
res.sseEmitter = async function(emitter) {
|
|
2155
2139
|
const generator = emitter();
|
|
2156
|
-
(0,
|
|
2140
|
+
(0, import_http4.enrichExpressLikeSend)(this, req, res, originalSend, originalSend, generator, !res.cors);
|
|
2157
2141
|
};
|
|
2158
2142
|
next?.();
|
|
2159
2143
|
}
|
|
2160
2144
|
|
|
2161
2145
|
// src/expressApplication.ts
|
|
2162
|
-
var Application = class extends
|
|
2146
|
+
var Application = class extends import_http5.ForklaunchExpressLikeApplication {
|
|
2163
2147
|
docsConfiguration;
|
|
2164
2148
|
mcpConfiguration;
|
|
2165
2149
|
openapiConfiguration;
|
|
@@ -2196,7 +2180,7 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2196
2180
|
}
|
|
2197
2181
|
listen(...args) {
|
|
2198
2182
|
if (process.env.FORKLAUNCH_MODE === "openapi") {
|
|
2199
|
-
const openApiSpec = (0,
|
|
2183
|
+
const openApiSpec = (0, import_http5.generateOpenApiSpecs)(
|
|
2200
2184
|
this.schemaValidator,
|
|
2201
2185
|
[],
|
|
2202
2186
|
[],
|
|
@@ -2218,7 +2202,7 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2218
2202
|
JSON.stringify(
|
|
2219
2203
|
{
|
|
2220
2204
|
...openApiSpec,
|
|
2221
|
-
"": openApiSpec[
|
|
2205
|
+
"": openApiSpec[import_http5.OPENAPI_DEFAULT_VERSION]
|
|
2222
2206
|
},
|
|
2223
2207
|
null,
|
|
2224
2208
|
2
|
|
@@ -2244,7 +2228,7 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2244
2228
|
} = this.mcpConfiguration ?? {};
|
|
2245
2229
|
const zodSchemaValidator = this.schemaValidator;
|
|
2246
2230
|
const finalMcpPort = mcpPort ?? (Number(process.env.MCP_PORT) || port2 + 2e3);
|
|
2247
|
-
const mcpServer = (0,
|
|
2231
|
+
const mcpServer = (0, import_http5.generateMcpServer)(
|
|
2248
2232
|
zodSchemaValidator,
|
|
2249
2233
|
protocol,
|
|
2250
2234
|
host,
|
|
@@ -2260,8 +2244,8 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2260
2244
|
if (additionalTools) {
|
|
2261
2245
|
additionalTools(mcpServer);
|
|
2262
2246
|
}
|
|
2263
|
-
if (!(0,
|
|
2264
|
-
const mcpHandler = (0,
|
|
2247
|
+
if (!(0, import_http5.isSeparateMcpListener)(mcpPort)) {
|
|
2248
|
+
const mcpHandler = (0, import_http5.createMcpHttpHandler)(mcpServer, {
|
|
2265
2249
|
authenticate,
|
|
2266
2250
|
sessions,
|
|
2267
2251
|
sessionIdleTimeoutMs,
|
|
@@ -2291,7 +2275,7 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2291
2275
|
}
|
|
2292
2276
|
});
|
|
2293
2277
|
} else if (this.hostingConfiguration?.workerCount && this.hostingConfiguration.workerCount > 1) {
|
|
2294
|
-
(0,
|
|
2278
|
+
(0, import_http5.isPortBound)(finalMcpPort, host).then((isBound) => {
|
|
2295
2279
|
if (!isBound) {
|
|
2296
2280
|
mcpServer.start({
|
|
2297
2281
|
httpStream: {
|
|
@@ -2321,7 +2305,7 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2321
2305
|
const openApiServerDescriptions = (0, import_common4.getEnvVar)(
|
|
2322
2306
|
"DOCS_SERVER_DESCRIPTIONS"
|
|
2323
2307
|
)?.split(",") ?? ["Main Server"];
|
|
2324
|
-
const openApi = (0,
|
|
2308
|
+
const openApi = (0, import_http5.generateOpenApiSpecs)(
|
|
2325
2309
|
this.schemaValidator,
|
|
2326
2310
|
openApiServerUrls,
|
|
2327
2311
|
openApiServerDescriptions,
|
|
@@ -2335,12 +2319,12 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2335
2319
|
...this.docsConfiguration,
|
|
2336
2320
|
sources: [
|
|
2337
2321
|
{
|
|
2338
|
-
content: openApi[
|
|
2322
|
+
content: openApi[import_http5.OPENAPI_DEFAULT_VERSION],
|
|
2339
2323
|
title: "API Reference"
|
|
2340
2324
|
},
|
|
2341
2325
|
...Object.entries(openApi).map(([version, spec]) => ({
|
|
2342
2326
|
content: typeof this.openapiConfiguration === "boolean" ? spec : this.openapiConfiguration?.discreteVersions === false ? {
|
|
2343
|
-
...openApi[
|
|
2327
|
+
...openApi[import_http5.OPENAPI_DEFAULT_VERSION],
|
|
2344
2328
|
...spec
|
|
2345
2329
|
} : spec,
|
|
2346
2330
|
title: `API Reference - ${version}`
|
|
@@ -2361,12 +2345,12 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2361
2345
|
(_, res) => {
|
|
2362
2346
|
res.type("application/json");
|
|
2363
2347
|
res.json({
|
|
2364
|
-
latest: openApi[
|
|
2348
|
+
latest: openApi[import_http5.OPENAPI_DEFAULT_VERSION],
|
|
2365
2349
|
...Object.fromEntries(
|
|
2366
2350
|
Object.entries(openApi).map(([version, spec]) => [
|
|
2367
2351
|
`v${version}`,
|
|
2368
2352
|
typeof this.openapiConfiguration === "boolean" ? spec : this.openapiConfiguration?.discreteVersions === false ? {
|
|
2369
|
-
...openApi[
|
|
2353
|
+
...openApi[import_http5.OPENAPI_DEFAULT_VERSION],
|
|
2370
2354
|
...spec
|
|
2371
2355
|
} : spec
|
|
2372
2356
|
])
|
|
@@ -2379,7 +2363,7 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2379
2363
|
async (req, res) => {
|
|
2380
2364
|
res.type("application/json");
|
|
2381
2365
|
if (req.params.id === "latest") {
|
|
2382
|
-
res.json(openApi[
|
|
2366
|
+
res.json(openApi[import_http5.OPENAPI_DEFAULT_VERSION]);
|
|
2383
2367
|
} else {
|
|
2384
2368
|
if (openApi[req.params.id] == null) {
|
|
2385
2369
|
res.status(404).send("Not Found");
|
|
@@ -2387,7 +2371,7 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2387
2371
|
}
|
|
2388
2372
|
res.json(
|
|
2389
2373
|
typeof this.openapiConfiguration === "boolean" ? openApi[req.params.id] : this.openapiConfiguration?.discreteVersions === false ? {
|
|
2390
|
-
...openApi[
|
|
2374
|
+
...openApi[import_http5.OPENAPI_DEFAULT_VERSION],
|
|
2391
2375
|
...openApi[req.params.id]
|
|
2392
2376
|
} : openApi[req.params.id]
|
|
2393
2377
|
);
|
|
@@ -2416,12 +2400,12 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2416
2400
|
res.status(statusCode),
|
|
2417
2401
|
`${statusCode >= 500 ? "Internal server error" : "Request could not be processed"}:
|
|
2418
2402
|
|
|
2419
|
-
Correlation id: ${(0,
|
|
2403
|
+
Correlation id: ${(0, import_http5.isForklaunchRequest)(req) ? req.context.correlationId : "No correlation ID"}`
|
|
2420
2404
|
);
|
|
2421
2405
|
this.openTelemetryCollector.error(
|
|
2422
2406
|
err.stack ?? err.message,
|
|
2423
|
-
(0,
|
|
2424
|
-
[
|
|
2407
|
+
(0, import_http5.meta)({
|
|
2408
|
+
[import_http5.ATTR_HTTP_RESPONSE_STATUS_CODE]: statusCode
|
|
2425
2409
|
})
|
|
2426
2410
|
);
|
|
2427
2411
|
};
|
|
@@ -2465,9 +2449,9 @@ Correlation id: ${(0, import_http3.isForklaunchRequest)(req) ? req.context.corre
|
|
|
2465
2449
|
};
|
|
2466
2450
|
|
|
2467
2451
|
// src/expressRouter.ts
|
|
2468
|
-
var
|
|
2452
|
+
var import_http6 = require("@forklaunch/core/http");
|
|
2469
2453
|
var import_express3 = __toESM(require("express"));
|
|
2470
|
-
var Router = class _Router extends
|
|
2454
|
+
var Router = class _Router extends import_http6.ForklaunchExpressLikeRouter {
|
|
2471
2455
|
/**
|
|
2472
2456
|
* Creates an instance of Router.
|
|
2473
2457
|
*
|
|
@@ -2679,171 +2663,171 @@ var Router = class _Router extends import_http4.ForklaunchExpressLikeRouter {
|
|
|
2679
2663
|
};
|
|
2680
2664
|
|
|
2681
2665
|
// src/handlers/checkout.ts
|
|
2682
|
-
var
|
|
2666
|
+
var import_http7 = require("@forklaunch/core/http");
|
|
2683
2667
|
var checkout = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2684
|
-
return (0,
|
|
2668
|
+
return (0, import_http7.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2685
2669
|
};
|
|
2686
2670
|
|
|
2687
2671
|
// src/handlers/copy.ts
|
|
2688
|
-
var
|
|
2672
|
+
var import_http8 = require("@forklaunch/core/http");
|
|
2689
2673
|
var copy = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2690
|
-
return (0,
|
|
2674
|
+
return (0, import_http8.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2691
2675
|
};
|
|
2692
2676
|
|
|
2693
2677
|
// src/handlers/delete.ts
|
|
2694
|
-
var
|
|
2678
|
+
var import_http9 = require("@forklaunch/core/http");
|
|
2695
2679
|
var delete_ = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2696
|
-
return (0,
|
|
2680
|
+
return (0, import_http9.delete_)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2697
2681
|
};
|
|
2698
2682
|
|
|
2699
2683
|
// src/handlers/get.ts
|
|
2700
|
-
var
|
|
2684
|
+
var import_http10 = require("@forklaunch/core/http");
|
|
2701
2685
|
var get = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2702
|
-
return (0,
|
|
2686
|
+
return (0, import_http10.get)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2703
2687
|
};
|
|
2704
2688
|
|
|
2705
2689
|
// src/handlers/head.ts
|
|
2706
|
-
var
|
|
2690
|
+
var import_http11 = require("@forklaunch/core/http");
|
|
2707
2691
|
var head = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2708
|
-
return (0,
|
|
2692
|
+
return (0, import_http11.head)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2709
2693
|
};
|
|
2710
2694
|
|
|
2711
2695
|
// src/handlers/link.ts
|
|
2712
|
-
var
|
|
2696
|
+
var import_http12 = require("@forklaunch/core/http");
|
|
2713
2697
|
var link = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2714
|
-
return (0,
|
|
2698
|
+
return (0, import_http12.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2715
2699
|
};
|
|
2716
2700
|
|
|
2717
2701
|
// src/handlers/lock.ts
|
|
2718
|
-
var
|
|
2702
|
+
var import_http13 = require("@forklaunch/core/http");
|
|
2719
2703
|
var lock = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2720
|
-
return (0,
|
|
2704
|
+
return (0, import_http13.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2721
2705
|
};
|
|
2722
2706
|
|
|
2723
2707
|
// src/handlers/m-search.ts
|
|
2724
|
-
var
|
|
2708
|
+
var import_http14 = require("@forklaunch/core/http");
|
|
2725
2709
|
var mSearch = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2726
|
-
return (0,
|
|
2710
|
+
return (0, import_http14.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2727
2711
|
};
|
|
2728
2712
|
|
|
2729
2713
|
// src/handlers/merge.ts
|
|
2730
|
-
var
|
|
2714
|
+
var import_http15 = require("@forklaunch/core/http");
|
|
2731
2715
|
var merge = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2732
|
-
return (0,
|
|
2716
|
+
return (0, import_http15.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2733
2717
|
};
|
|
2734
2718
|
|
|
2735
2719
|
// src/handlers/middleware.ts
|
|
2736
|
-
var
|
|
2720
|
+
var import_http16 = require("@forklaunch/core/http");
|
|
2737
2721
|
var middleware7 = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2738
|
-
return (0,
|
|
2722
|
+
return (0, import_http16.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2739
2723
|
};
|
|
2740
2724
|
|
|
2741
2725
|
// src/handlers/mkcactivity.ts
|
|
2742
|
-
var
|
|
2726
|
+
var import_http17 = require("@forklaunch/core/http");
|
|
2743
2727
|
var mkcActivity = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2744
|
-
return (0,
|
|
2728
|
+
return (0, import_http17.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2745
2729
|
};
|
|
2746
2730
|
|
|
2747
2731
|
// src/handlers/mkcol.ts
|
|
2748
|
-
var
|
|
2732
|
+
var import_http18 = require("@forklaunch/core/http");
|
|
2749
2733
|
var mkcol = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2750
|
-
return (0,
|
|
2734
|
+
return (0, import_http18.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2751
2735
|
};
|
|
2752
2736
|
|
|
2753
2737
|
// src/handlers/move.ts
|
|
2754
|
-
var
|
|
2738
|
+
var import_http19 = require("@forklaunch/core/http");
|
|
2755
2739
|
var move = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2756
|
-
return (0,
|
|
2740
|
+
return (0, import_http19.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2757
2741
|
};
|
|
2758
2742
|
|
|
2759
2743
|
// src/handlers/notify.ts
|
|
2760
|
-
var
|
|
2744
|
+
var import_http20 = require("@forklaunch/core/http");
|
|
2761
2745
|
var notify = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2762
|
-
return (0,
|
|
2746
|
+
return (0, import_http20.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2763
2747
|
};
|
|
2764
2748
|
|
|
2765
2749
|
// src/handlers/options.ts
|
|
2766
|
-
var
|
|
2750
|
+
var import_http21 = require("@forklaunch/core/http");
|
|
2767
2751
|
var options = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2768
|
-
return (0,
|
|
2752
|
+
return (0, import_http21.options)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2769
2753
|
};
|
|
2770
2754
|
|
|
2771
2755
|
// src/handlers/patch.ts
|
|
2772
|
-
var
|
|
2756
|
+
var import_http22 = require("@forklaunch/core/http");
|
|
2773
2757
|
var patch = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2774
|
-
return (0,
|
|
2758
|
+
return (0, import_http22.patch)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2775
2759
|
};
|
|
2776
2760
|
|
|
2777
2761
|
// src/handlers/post.ts
|
|
2778
|
-
var
|
|
2762
|
+
var import_http23 = require("@forklaunch/core/http");
|
|
2779
2763
|
var post = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2780
|
-
return (0,
|
|
2764
|
+
return (0, import_http23.post)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2781
2765
|
};
|
|
2782
2766
|
|
|
2783
2767
|
// src/handlers/propfind.ts
|
|
2784
|
-
var
|
|
2768
|
+
var import_http24 = require("@forklaunch/core/http");
|
|
2785
2769
|
var propfind = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2786
|
-
return (0,
|
|
2770
|
+
return (0, import_http24.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2787
2771
|
};
|
|
2788
2772
|
|
|
2789
2773
|
// src/handlers/proppatch.ts
|
|
2790
|
-
var
|
|
2774
|
+
var import_http25 = require("@forklaunch/core/http");
|
|
2791
2775
|
var proppatch = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2792
|
-
return (0,
|
|
2776
|
+
return (0, import_http25.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2793
2777
|
};
|
|
2794
2778
|
|
|
2795
2779
|
// src/handlers/purge.ts
|
|
2796
|
-
var
|
|
2780
|
+
var import_http26 = require("@forklaunch/core/http");
|
|
2797
2781
|
var purge = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2798
|
-
return (0,
|
|
2782
|
+
return (0, import_http26.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2799
2783
|
};
|
|
2800
2784
|
|
|
2801
2785
|
// src/handlers/put.ts
|
|
2802
|
-
var
|
|
2786
|
+
var import_http27 = require("@forklaunch/core/http");
|
|
2803
2787
|
var put = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2804
|
-
return (0,
|
|
2788
|
+
return (0, import_http27.put)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2805
2789
|
};
|
|
2806
2790
|
|
|
2807
2791
|
// src/handlers/report.ts
|
|
2808
|
-
var
|
|
2792
|
+
var import_http28 = require("@forklaunch/core/http");
|
|
2809
2793
|
var report = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2810
|
-
return (0,
|
|
2794
|
+
return (0, import_http28.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2811
2795
|
};
|
|
2812
2796
|
|
|
2813
2797
|
// src/handlers/search.ts
|
|
2814
|
-
var
|
|
2798
|
+
var import_http29 = require("@forklaunch/core/http");
|
|
2815
2799
|
var search = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2816
|
-
return (0,
|
|
2800
|
+
return (0, import_http29.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2817
2801
|
};
|
|
2818
2802
|
|
|
2819
2803
|
// src/handlers/subscribe.ts
|
|
2820
|
-
var
|
|
2804
|
+
var import_http30 = require("@forklaunch/core/http");
|
|
2821
2805
|
var subscribe = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2822
|
-
return (0,
|
|
2806
|
+
return (0, import_http30.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2823
2807
|
};
|
|
2824
2808
|
|
|
2825
2809
|
// src/handlers/trace.ts
|
|
2826
|
-
var
|
|
2810
|
+
var import_http31 = require("@forklaunch/core/http");
|
|
2827
2811
|
var trace = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2828
|
-
return (0,
|
|
2812
|
+
return (0, import_http31.trace)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2829
2813
|
};
|
|
2830
2814
|
|
|
2831
2815
|
// src/handlers/unlink.ts
|
|
2832
|
-
var
|
|
2816
|
+
var import_http32 = require("@forklaunch/core/http");
|
|
2833
2817
|
var unlink = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2834
|
-
return (0,
|
|
2818
|
+
return (0, import_http32.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2835
2819
|
};
|
|
2836
2820
|
|
|
2837
2821
|
// src/handlers/unlock.ts
|
|
2838
|
-
var
|
|
2822
|
+
var import_http33 = require("@forklaunch/core/http");
|
|
2839
2823
|
var unlock = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2840
|
-
return (0,
|
|
2824
|
+
return (0, import_http33.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2841
2825
|
};
|
|
2842
2826
|
|
|
2843
2827
|
// src/handlers/unsubscribe.ts
|
|
2844
|
-
var
|
|
2828
|
+
var import_http34 = require("@forklaunch/core/http");
|
|
2845
2829
|
var unsubscribe = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2846
|
-
return (0,
|
|
2830
|
+
return (0, import_http34.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2847
2831
|
};
|
|
2848
2832
|
|
|
2849
2833
|
// index.ts
|
|
@@ -2892,7 +2876,7 @@ var handlers = {
|
|
|
2892
2876
|
unsubscribe
|
|
2893
2877
|
};
|
|
2894
2878
|
var port = (options2, contractDetailsOrMiddlewareOrTypedHandler, ...middlewareOrMiddlewareAndTypedHandler) => {
|
|
2895
|
-
const handlers2 = (0,
|
|
2879
|
+
const handlers2 = (0, import_http35.extractRouteHandlers)({
|
|
2896
2880
|
...options2,
|
|
2897
2881
|
contractDetailsOrMiddlewareOrTypedHandler,
|
|
2898
2882
|
middlewareOrMiddlewareAndTypedHandler
|
package/lib/index.mjs
CHANGED
|
@@ -27,6 +27,9 @@ import path2 from "path";
|
|
|
27
27
|
import swaggerUi from "swagger-ui-express";
|
|
28
28
|
|
|
29
29
|
// src/cluster/bun.cluster.ts
|
|
30
|
+
import {
|
|
31
|
+
createProcessErrorHandlers
|
|
32
|
+
} from "@forklaunch/core/http";
|
|
30
33
|
import cluster from "cluster";
|
|
31
34
|
import os from "os";
|
|
32
35
|
|
|
@@ -1683,25 +1686,19 @@ function startBunCluster(config) {
|
|
|
1683
1686
|
process.exit(0);
|
|
1684
1687
|
}
|
|
1685
1688
|
});
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
`Uncaught exception on worker ${process.pid}:`,
|
|
1689
|
-
err
|
|
1690
|
-
);
|
|
1691
|
-
process.exit(1);
|
|
1692
|
-
});
|
|
1693
|
-
process.on("unhandledRejection", (reason) => {
|
|
1694
|
-
openTelemetryCollector.error(
|
|
1695
|
-
`Unhandled rejection on worker ${process.pid}:`,
|
|
1696
|
-
reason
|
|
1697
|
-
);
|
|
1698
|
-
process.exit(1);
|
|
1689
|
+
const processErrors = createProcessErrorHandlers(openTelemetryCollector, {
|
|
1690
|
+
label: `on worker ${process.pid}`
|
|
1699
1691
|
});
|
|
1692
|
+
process.on("uncaughtException", processErrors.uncaughtException);
|
|
1693
|
+
process.on("unhandledRejection", processErrors.unhandledRejection);
|
|
1700
1694
|
}
|
|
1701
1695
|
}
|
|
1702
1696
|
|
|
1703
1697
|
// src/cluster/node.cluster.ts
|
|
1704
1698
|
import { hashString } from "@forklaunch/common";
|
|
1699
|
+
import {
|
|
1700
|
+
createProcessErrorHandlers as createProcessErrorHandlers2
|
|
1701
|
+
} from "@forklaunch/core/http";
|
|
1705
1702
|
import cluster2 from "cluster";
|
|
1706
1703
|
import fs from "fs";
|
|
1707
1704
|
import http from "http";
|
|
@@ -1865,20 +1862,11 @@ function startNodeCluster(config) {
|
|
|
1865
1862
|
);
|
|
1866
1863
|
}
|
|
1867
1864
|
}, 3e4);
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
`Uncaught exception on worker ${process.pid}:`,
|
|
1871
|
-
err
|
|
1872
|
-
);
|
|
1873
|
-
process.exit(1);
|
|
1874
|
-
});
|
|
1875
|
-
process.on("unhandledRejection", (reason) => {
|
|
1876
|
-
openTelemetryCollector.error(
|
|
1877
|
-
`Unhandled rejection on worker ${process.pid}:`,
|
|
1878
|
-
reason
|
|
1879
|
-
);
|
|
1880
|
-
process.exit(1);
|
|
1865
|
+
const processErrors = createProcessErrorHandlers2(openTelemetryCollector, {
|
|
1866
|
+
label: `on worker ${process.pid}`
|
|
1881
1867
|
});
|
|
1868
|
+
process.on("uncaughtException", processErrors.uncaughtException);
|
|
1869
|
+
process.on("unhandledRejection", processErrors.unhandledRejection);
|
|
1882
1870
|
const protocol = SSL_CONFIG ? "https" : "http";
|
|
1883
1871
|
openTelemetryCollector.info(
|
|
1884
1872
|
`[worker ${process.pid}] ready (awaiting sockets from primary) - ${protocol}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bun.cluster.d.ts","sourceRoot":"","sources":["../../../src/cluster/bun.cluster.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"bun.cluster.d.ts","sourceRoot":"","sources":["../../../src/cluster/bun.cluster.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAKlC,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,QA+H7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.cluster.d.ts","sourceRoot":"","sources":["../../../src/cluster/node.cluster.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"node.cluster.d.ts","sourceRoot":"","sources":["../../../src/cluster/node.cluster.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAG/B,OAAa,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAMlE,wBAAgB,gBAAgB,CAC9B,UAAU,SAAS,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,IAAI,EACtE,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,QAgNlC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/express",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "Forklaunch framework for express.",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@forklaunch/common": "^2.0.0",
|
|
32
|
-
"@forklaunch/core": "^4.
|
|
32
|
+
"@forklaunch/core": "^4.6.0",
|
|
33
33
|
"@forklaunch/validator": "^1.3.1",
|
|
34
34
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
35
|
-
"@scalar/express-api-reference": "^0.10.
|
|
35
|
+
"@scalar/express-api-reference": "^0.10.45",
|
|
36
36
|
"@types/multer": "^2.3.0",
|
|
37
37
|
"body-parser": "^2.4.0",
|
|
38
38
|
"busboy": "^1.6.0",
|
|
39
39
|
"cors": "^2.8.6",
|
|
40
40
|
"express": "^5.3.0",
|
|
41
|
-
"fastmcp": "^4.30.
|
|
41
|
+
"fastmcp": "^4.30.3",
|
|
42
42
|
"multer": "2.5.0",
|
|
43
43
|
"qs": "^6.17.1",
|
|
44
44
|
"range-parser": "^1.3.0",
|