@forklaunch/express 2.2.1 → 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
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,
|
|
@@ -2254,18 +2238,31 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2254
2238
|
this.mcpConfiguration,
|
|
2255
2239
|
options2,
|
|
2256
2240
|
contentTypeMapping,
|
|
2257
|
-
authenticate
|
|
2241
|
+
authenticate,
|
|
2242
|
+
this.openTelemetryCollector
|
|
2258
2243
|
);
|
|
2259
2244
|
if (additionalTools) {
|
|
2260
2245
|
additionalTools(mcpServer);
|
|
2261
2246
|
}
|
|
2262
|
-
if (!(0,
|
|
2263
|
-
const mcpHandler = (0,
|
|
2247
|
+
if (!(0, import_http5.isSeparateMcpListener)(mcpPort)) {
|
|
2248
|
+
const mcpHandler = (0, import_http5.createMcpHttpHandler)(mcpServer, {
|
|
2264
2249
|
authenticate,
|
|
2265
2250
|
sessions,
|
|
2266
2251
|
sessionIdleTimeoutMs,
|
|
2267
2252
|
workerCount: this.hostingConfiguration?.workerCount
|
|
2268
2253
|
});
|
|
2254
|
+
for (const metadataPath of mcpHandler.metadataPaths) {
|
|
2255
|
+
this.internal.get(metadataPath, async (_req, res, next) => {
|
|
2256
|
+
try {
|
|
2257
|
+
await writeFetchResponse(
|
|
2258
|
+
mcpHandler.protectedResourceMetadata(),
|
|
2259
|
+
res
|
|
2260
|
+
);
|
|
2261
|
+
} catch (error) {
|
|
2262
|
+
next(error);
|
|
2263
|
+
}
|
|
2264
|
+
});
|
|
2265
|
+
}
|
|
2269
2266
|
this.internal.all(mcpPath ?? "/mcp", async (req, res, next) => {
|
|
2270
2267
|
try {
|
|
2271
2268
|
const response = await mcpHandler.handle(
|
|
@@ -2278,7 +2275,7 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2278
2275
|
}
|
|
2279
2276
|
});
|
|
2280
2277
|
} else if (this.hostingConfiguration?.workerCount && this.hostingConfiguration.workerCount > 1) {
|
|
2281
|
-
(0,
|
|
2278
|
+
(0, import_http5.isPortBound)(finalMcpPort, host).then((isBound) => {
|
|
2282
2279
|
if (!isBound) {
|
|
2283
2280
|
mcpServer.start({
|
|
2284
2281
|
httpStream: {
|
|
@@ -2308,7 +2305,7 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2308
2305
|
const openApiServerDescriptions = (0, import_common4.getEnvVar)(
|
|
2309
2306
|
"DOCS_SERVER_DESCRIPTIONS"
|
|
2310
2307
|
)?.split(",") ?? ["Main Server"];
|
|
2311
|
-
const openApi = (0,
|
|
2308
|
+
const openApi = (0, import_http5.generateOpenApiSpecs)(
|
|
2312
2309
|
this.schemaValidator,
|
|
2313
2310
|
openApiServerUrls,
|
|
2314
2311
|
openApiServerDescriptions,
|
|
@@ -2322,12 +2319,12 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2322
2319
|
...this.docsConfiguration,
|
|
2323
2320
|
sources: [
|
|
2324
2321
|
{
|
|
2325
|
-
content: openApi[
|
|
2322
|
+
content: openApi[import_http5.OPENAPI_DEFAULT_VERSION],
|
|
2326
2323
|
title: "API Reference"
|
|
2327
2324
|
},
|
|
2328
2325
|
...Object.entries(openApi).map(([version, spec]) => ({
|
|
2329
2326
|
content: typeof this.openapiConfiguration === "boolean" ? spec : this.openapiConfiguration?.discreteVersions === false ? {
|
|
2330
|
-
...openApi[
|
|
2327
|
+
...openApi[import_http5.OPENAPI_DEFAULT_VERSION],
|
|
2331
2328
|
...spec
|
|
2332
2329
|
} : spec,
|
|
2333
2330
|
title: `API Reference - ${version}`
|
|
@@ -2348,12 +2345,12 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2348
2345
|
(_, res) => {
|
|
2349
2346
|
res.type("application/json");
|
|
2350
2347
|
res.json({
|
|
2351
|
-
latest: openApi[
|
|
2348
|
+
latest: openApi[import_http5.OPENAPI_DEFAULT_VERSION],
|
|
2352
2349
|
...Object.fromEntries(
|
|
2353
2350
|
Object.entries(openApi).map(([version, spec]) => [
|
|
2354
2351
|
`v${version}`,
|
|
2355
2352
|
typeof this.openapiConfiguration === "boolean" ? spec : this.openapiConfiguration?.discreteVersions === false ? {
|
|
2356
|
-
...openApi[
|
|
2353
|
+
...openApi[import_http5.OPENAPI_DEFAULT_VERSION],
|
|
2357
2354
|
...spec
|
|
2358
2355
|
} : spec
|
|
2359
2356
|
])
|
|
@@ -2366,7 +2363,7 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2366
2363
|
async (req, res) => {
|
|
2367
2364
|
res.type("application/json");
|
|
2368
2365
|
if (req.params.id === "latest") {
|
|
2369
|
-
res.json(openApi[
|
|
2366
|
+
res.json(openApi[import_http5.OPENAPI_DEFAULT_VERSION]);
|
|
2370
2367
|
} else {
|
|
2371
2368
|
if (openApi[req.params.id] == null) {
|
|
2372
2369
|
res.status(404).send("Not Found");
|
|
@@ -2374,7 +2371,7 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2374
2371
|
}
|
|
2375
2372
|
res.json(
|
|
2376
2373
|
typeof this.openapiConfiguration === "boolean" ? openApi[req.params.id] : this.openapiConfiguration?.discreteVersions === false ? {
|
|
2377
|
-
...openApi[
|
|
2374
|
+
...openApi[import_http5.OPENAPI_DEFAULT_VERSION],
|
|
2378
2375
|
...openApi[req.params.id]
|
|
2379
2376
|
} : openApi[req.params.id]
|
|
2380
2377
|
);
|
|
@@ -2403,12 +2400,12 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
|
|
|
2403
2400
|
res.status(statusCode),
|
|
2404
2401
|
`${statusCode >= 500 ? "Internal server error" : "Request could not be processed"}:
|
|
2405
2402
|
|
|
2406
|
-
Correlation id: ${(0,
|
|
2403
|
+
Correlation id: ${(0, import_http5.isForklaunchRequest)(req) ? req.context.correlationId : "No correlation ID"}`
|
|
2407
2404
|
);
|
|
2408
2405
|
this.openTelemetryCollector.error(
|
|
2409
2406
|
err.stack ?? err.message,
|
|
2410
|
-
(0,
|
|
2411
|
-
[
|
|
2407
|
+
(0, import_http5.meta)({
|
|
2408
|
+
[import_http5.ATTR_HTTP_RESPONSE_STATUS_CODE]: statusCode
|
|
2412
2409
|
})
|
|
2413
2410
|
);
|
|
2414
2411
|
};
|
|
@@ -2452,9 +2449,9 @@ Correlation id: ${(0, import_http3.isForklaunchRequest)(req) ? req.context.corre
|
|
|
2452
2449
|
};
|
|
2453
2450
|
|
|
2454
2451
|
// src/expressRouter.ts
|
|
2455
|
-
var
|
|
2452
|
+
var import_http6 = require("@forklaunch/core/http");
|
|
2456
2453
|
var import_express3 = __toESM(require("express"));
|
|
2457
|
-
var Router = class _Router extends
|
|
2454
|
+
var Router = class _Router extends import_http6.ForklaunchExpressLikeRouter {
|
|
2458
2455
|
/**
|
|
2459
2456
|
* Creates an instance of Router.
|
|
2460
2457
|
*
|
|
@@ -2666,171 +2663,171 @@ var Router = class _Router extends import_http4.ForklaunchExpressLikeRouter {
|
|
|
2666
2663
|
};
|
|
2667
2664
|
|
|
2668
2665
|
// src/handlers/checkout.ts
|
|
2669
|
-
var
|
|
2666
|
+
var import_http7 = require("@forklaunch/core/http");
|
|
2670
2667
|
var checkout = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2671
|
-
return (0,
|
|
2668
|
+
return (0, import_http7.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2672
2669
|
};
|
|
2673
2670
|
|
|
2674
2671
|
// src/handlers/copy.ts
|
|
2675
|
-
var
|
|
2672
|
+
var import_http8 = require("@forklaunch/core/http");
|
|
2676
2673
|
var copy = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2677
|
-
return (0,
|
|
2674
|
+
return (0, import_http8.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2678
2675
|
};
|
|
2679
2676
|
|
|
2680
2677
|
// src/handlers/delete.ts
|
|
2681
|
-
var
|
|
2678
|
+
var import_http9 = require("@forklaunch/core/http");
|
|
2682
2679
|
var delete_ = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2683
|
-
return (0,
|
|
2680
|
+
return (0, import_http9.delete_)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2684
2681
|
};
|
|
2685
2682
|
|
|
2686
2683
|
// src/handlers/get.ts
|
|
2687
|
-
var
|
|
2684
|
+
var import_http10 = require("@forklaunch/core/http");
|
|
2688
2685
|
var get = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2689
|
-
return (0,
|
|
2686
|
+
return (0, import_http10.get)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2690
2687
|
};
|
|
2691
2688
|
|
|
2692
2689
|
// src/handlers/head.ts
|
|
2693
|
-
var
|
|
2690
|
+
var import_http11 = require("@forklaunch/core/http");
|
|
2694
2691
|
var head = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2695
|
-
return (0,
|
|
2692
|
+
return (0, import_http11.head)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2696
2693
|
};
|
|
2697
2694
|
|
|
2698
2695
|
// src/handlers/link.ts
|
|
2699
|
-
var
|
|
2696
|
+
var import_http12 = require("@forklaunch/core/http");
|
|
2700
2697
|
var link = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2701
|
-
return (0,
|
|
2698
|
+
return (0, import_http12.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2702
2699
|
};
|
|
2703
2700
|
|
|
2704
2701
|
// src/handlers/lock.ts
|
|
2705
|
-
var
|
|
2702
|
+
var import_http13 = require("@forklaunch/core/http");
|
|
2706
2703
|
var lock = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2707
|
-
return (0,
|
|
2704
|
+
return (0, import_http13.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2708
2705
|
};
|
|
2709
2706
|
|
|
2710
2707
|
// src/handlers/m-search.ts
|
|
2711
|
-
var
|
|
2708
|
+
var import_http14 = require("@forklaunch/core/http");
|
|
2712
2709
|
var mSearch = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2713
|
-
return (0,
|
|
2710
|
+
return (0, import_http14.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2714
2711
|
};
|
|
2715
2712
|
|
|
2716
2713
|
// src/handlers/merge.ts
|
|
2717
|
-
var
|
|
2714
|
+
var import_http15 = require("@forklaunch/core/http");
|
|
2718
2715
|
var merge = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2719
|
-
return (0,
|
|
2716
|
+
return (0, import_http15.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2720
2717
|
};
|
|
2721
2718
|
|
|
2722
2719
|
// src/handlers/middleware.ts
|
|
2723
|
-
var
|
|
2720
|
+
var import_http16 = require("@forklaunch/core/http");
|
|
2724
2721
|
var middleware7 = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2725
|
-
return (0,
|
|
2722
|
+
return (0, import_http16.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2726
2723
|
};
|
|
2727
2724
|
|
|
2728
2725
|
// src/handlers/mkcactivity.ts
|
|
2729
|
-
var
|
|
2726
|
+
var import_http17 = require("@forklaunch/core/http");
|
|
2730
2727
|
var mkcActivity = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2731
|
-
return (0,
|
|
2728
|
+
return (0, import_http17.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2732
2729
|
};
|
|
2733
2730
|
|
|
2734
2731
|
// src/handlers/mkcol.ts
|
|
2735
|
-
var
|
|
2732
|
+
var import_http18 = require("@forklaunch/core/http");
|
|
2736
2733
|
var mkcol = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2737
|
-
return (0,
|
|
2734
|
+
return (0, import_http18.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2738
2735
|
};
|
|
2739
2736
|
|
|
2740
2737
|
// src/handlers/move.ts
|
|
2741
|
-
var
|
|
2738
|
+
var import_http19 = require("@forklaunch/core/http");
|
|
2742
2739
|
var move = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2743
|
-
return (0,
|
|
2740
|
+
return (0, import_http19.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2744
2741
|
};
|
|
2745
2742
|
|
|
2746
2743
|
// src/handlers/notify.ts
|
|
2747
|
-
var
|
|
2744
|
+
var import_http20 = require("@forklaunch/core/http");
|
|
2748
2745
|
var notify = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2749
|
-
return (0,
|
|
2746
|
+
return (0, import_http20.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2750
2747
|
};
|
|
2751
2748
|
|
|
2752
2749
|
// src/handlers/options.ts
|
|
2753
|
-
var
|
|
2750
|
+
var import_http21 = require("@forklaunch/core/http");
|
|
2754
2751
|
var options = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2755
|
-
return (0,
|
|
2752
|
+
return (0, import_http21.options)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2756
2753
|
};
|
|
2757
2754
|
|
|
2758
2755
|
// src/handlers/patch.ts
|
|
2759
|
-
var
|
|
2756
|
+
var import_http22 = require("@forklaunch/core/http");
|
|
2760
2757
|
var patch = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2761
|
-
return (0,
|
|
2758
|
+
return (0, import_http22.patch)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2762
2759
|
};
|
|
2763
2760
|
|
|
2764
2761
|
// src/handlers/post.ts
|
|
2765
|
-
var
|
|
2762
|
+
var import_http23 = require("@forklaunch/core/http");
|
|
2766
2763
|
var post = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2767
|
-
return (0,
|
|
2764
|
+
return (0, import_http23.post)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2768
2765
|
};
|
|
2769
2766
|
|
|
2770
2767
|
// src/handlers/propfind.ts
|
|
2771
|
-
var
|
|
2768
|
+
var import_http24 = require("@forklaunch/core/http");
|
|
2772
2769
|
var propfind = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2773
|
-
return (0,
|
|
2770
|
+
return (0, import_http24.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2774
2771
|
};
|
|
2775
2772
|
|
|
2776
2773
|
// src/handlers/proppatch.ts
|
|
2777
|
-
var
|
|
2774
|
+
var import_http25 = require("@forklaunch/core/http");
|
|
2778
2775
|
var proppatch = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2779
|
-
return (0,
|
|
2776
|
+
return (0, import_http25.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2780
2777
|
};
|
|
2781
2778
|
|
|
2782
2779
|
// src/handlers/purge.ts
|
|
2783
|
-
var
|
|
2780
|
+
var import_http26 = require("@forklaunch/core/http");
|
|
2784
2781
|
var purge = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2785
|
-
return (0,
|
|
2782
|
+
return (0, import_http26.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2786
2783
|
};
|
|
2787
2784
|
|
|
2788
2785
|
// src/handlers/put.ts
|
|
2789
|
-
var
|
|
2786
|
+
var import_http27 = require("@forklaunch/core/http");
|
|
2790
2787
|
var put = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2791
|
-
return (0,
|
|
2788
|
+
return (0, import_http27.put)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2792
2789
|
};
|
|
2793
2790
|
|
|
2794
2791
|
// src/handlers/report.ts
|
|
2795
|
-
var
|
|
2792
|
+
var import_http28 = require("@forklaunch/core/http");
|
|
2796
2793
|
var report = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2797
|
-
return (0,
|
|
2794
|
+
return (0, import_http28.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2798
2795
|
};
|
|
2799
2796
|
|
|
2800
2797
|
// src/handlers/search.ts
|
|
2801
|
-
var
|
|
2798
|
+
var import_http29 = require("@forklaunch/core/http");
|
|
2802
2799
|
var search = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2803
|
-
return (0,
|
|
2800
|
+
return (0, import_http29.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2804
2801
|
};
|
|
2805
2802
|
|
|
2806
2803
|
// src/handlers/subscribe.ts
|
|
2807
|
-
var
|
|
2804
|
+
var import_http30 = require("@forklaunch/core/http");
|
|
2808
2805
|
var subscribe = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2809
|
-
return (0,
|
|
2806
|
+
return (0, import_http30.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2810
2807
|
};
|
|
2811
2808
|
|
|
2812
2809
|
// src/handlers/trace.ts
|
|
2813
|
-
var
|
|
2810
|
+
var import_http31 = require("@forklaunch/core/http");
|
|
2814
2811
|
var trace = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2815
|
-
return (0,
|
|
2812
|
+
return (0, import_http31.trace)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2816
2813
|
};
|
|
2817
2814
|
|
|
2818
2815
|
// src/handlers/unlink.ts
|
|
2819
|
-
var
|
|
2816
|
+
var import_http32 = require("@forklaunch/core/http");
|
|
2820
2817
|
var unlink = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2821
|
-
return (0,
|
|
2818
|
+
return (0, import_http32.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2822
2819
|
};
|
|
2823
2820
|
|
|
2824
2821
|
// src/handlers/unlock.ts
|
|
2825
|
-
var
|
|
2822
|
+
var import_http33 = require("@forklaunch/core/http");
|
|
2826
2823
|
var unlock = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2827
|
-
return (0,
|
|
2824
|
+
return (0, import_http33.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2828
2825
|
};
|
|
2829
2826
|
|
|
2830
2827
|
// src/handlers/unsubscribe.ts
|
|
2831
|
-
var
|
|
2828
|
+
var import_http34 = require("@forklaunch/core/http");
|
|
2832
2829
|
var unsubscribe = (schemaValidator, path3, contractDetails, ...handlers2) => {
|
|
2833
|
-
return (0,
|
|
2830
|
+
return (0, import_http34.middleware)(schemaValidator, path3, contractDetails, ...handlers2);
|
|
2834
2831
|
};
|
|
2835
2832
|
|
|
2836
2833
|
// index.ts
|
|
@@ -2879,7 +2876,7 @@ var handlers = {
|
|
|
2879
2876
|
unsubscribe
|
|
2880
2877
|
};
|
|
2881
2878
|
var port = (options2, contractDetailsOrMiddlewareOrTypedHandler, ...middlewareOrMiddlewareAndTypedHandler) => {
|
|
2882
|
-
const handlers2 = (0,
|
|
2879
|
+
const handlers2 = (0, import_http35.extractRouteHandlers)({
|
|
2883
2880
|
...options2,
|
|
2884
2881
|
contractDetailsOrMiddlewareOrTypedHandler,
|
|
2885
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}`
|
|
@@ -2232,7 +2220,8 @@ var Application = class extends ForklaunchExpressLikeApplication {
|
|
|
2232
2220
|
this.mcpConfiguration,
|
|
2233
2221
|
options2,
|
|
2234
2222
|
contentTypeMapping,
|
|
2235
|
-
authenticate
|
|
2223
|
+
authenticate,
|
|
2224
|
+
this.openTelemetryCollector
|
|
2236
2225
|
);
|
|
2237
2226
|
if (additionalTools) {
|
|
2238
2227
|
additionalTools(mcpServer);
|
|
@@ -2244,6 +2233,18 @@ var Application = class extends ForklaunchExpressLikeApplication {
|
|
|
2244
2233
|
sessionIdleTimeoutMs,
|
|
2245
2234
|
workerCount: this.hostingConfiguration?.workerCount
|
|
2246
2235
|
});
|
|
2236
|
+
for (const metadataPath of mcpHandler.metadataPaths) {
|
|
2237
|
+
this.internal.get(metadataPath, async (_req, res, next) => {
|
|
2238
|
+
try {
|
|
2239
|
+
await writeFetchResponse(
|
|
2240
|
+
mcpHandler.protectedResourceMetadata(),
|
|
2241
|
+
res
|
|
2242
|
+
);
|
|
2243
|
+
} catch (error) {
|
|
2244
|
+
next(error);
|
|
2245
|
+
}
|
|
2246
|
+
});
|
|
2247
|
+
}
|
|
2247
2248
|
this.internal.all(mcpPath ?? "/mcp", async (req, res, next) => {
|
|
2248
2249
|
try {
|
|
2249
2250
|
const response = await mcpHandler.handle(
|
|
@@ -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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expressApplication.d.ts","sourceRoot":"","sources":["../../src/expressApplication.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,gCAAgC,EAQhC,iBAAiB,EAEjB,sBAAsB,EACtB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAgB,EAEd,OAAO,EACP,YAAY,EACZ,OAAO,EACP,cAAc,EACd,QAAQ,EACT,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAQ9B,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAEzE;;;;;;;;;;GAUG;AACH,qBAAa,WAAW,CACtB,EAAE,SAAS,kBAAkB,EAC7B,aAAa,SAAS,aAAa,CAAC,EAAE,CAAC,CACvC,SAAQ,gCAAgC,CACxC,EAAE,EACF,OAAO,EACP,cAAc,EACd,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,aAAa,CACd;IACC,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,gBAAgB,CAC8C;IACtE,OAAO,CAAC,oBAAoB,CAC8C;IAC1E,OAAO,CAAC,oBAAoB,CAC8C;IAC1E;;;;;;OAMG;IACH,YACE,eAAe,EAAE,EAAE,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
+
"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",
|