@suveren/gateway 0.3.9 → 0.3.11
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/dist/control-plane/index.mjs +2 -2
- package/dist/mcp-server/http.mjs +9 -4
- package/dist/ui/assets/index-Sa6P3FDC.js +105 -0
- package/dist/ui/index.html +1 -1
- package/node_modules/hono/dist/adapter/aws-lambda/handler.js +1 -1
- package/node_modules/hono/dist/adapter/bun/websocket.js +3 -1
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +1 -1
- package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +3 -1
- package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/cjs/utils/body.js +12 -4
- package/node_modules/hono/dist/cjs/utils/buffer.js +2 -1
- package/node_modules/hono/dist/cjs/validator/validator.js +3 -3
- package/node_modules/hono/dist/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +2 -2
- package/node_modules/hono/dist/types/utils/body.d.ts +1 -1
- package/node_modules/hono/dist/utils/body.js +12 -4
- package/node_modules/hono/dist/utils/buffer.js +2 -1
- package/node_modules/hono/dist/validator/validator.js +3 -3
- package/node_modules/hono/package.json +8 -7
- package/package.json +1 -1
- package/dist/ui/assets/index-Y2L3iwZu.js +0 -105
- package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
package/dist/ui/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Suveren</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-Sa6P3FDC.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-DOt3SNnl.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -334,7 +334,7 @@ var isProxyEventALB = (event) => {
|
|
|
334
334
|
return false;
|
|
335
335
|
};
|
|
336
336
|
var isProxyEventV2 = (event) => {
|
|
337
|
-
return Object.hasOwn(event, "rawPath");
|
|
337
|
+
return Object.hasOwn(event, "rawPath") && Object.hasOwn(event.requestContext ?? {}, "http");
|
|
338
338
|
};
|
|
339
339
|
var isLatticeEventV2 = (event) => {
|
|
340
340
|
if (event.requestContext) {
|
|
@@ -24,7 +24,9 @@ var upgradeWebSocket = defineWebSocketHelper((c, events) => {
|
|
|
24
24
|
data: {
|
|
25
25
|
events,
|
|
26
26
|
url: new URL(c.req.url),
|
|
27
|
-
protocol
|
|
27
|
+
// The first requested subprotocol, exposed via WSContext.protocol to
|
|
28
|
+
// match the deno and cloudflare adapters.
|
|
29
|
+
protocol: c.req.header("sec-websocket-protocol")?.split(",")[0]?.trim() ?? ""
|
|
28
30
|
}
|
|
29
31
|
});
|
|
30
32
|
if (upgradeResult) {
|
|
@@ -364,7 +364,7 @@ const isProxyEventALB = (event) => {
|
|
|
364
364
|
return false;
|
|
365
365
|
};
|
|
366
366
|
const isProxyEventV2 = (event) => {
|
|
367
|
-
return Object.hasOwn(event, "rawPath");
|
|
367
|
+
return Object.hasOwn(event, "rawPath") && Object.hasOwn(event.requestContext ?? {}, "http");
|
|
368
368
|
};
|
|
369
369
|
const isLatticeEventV2 = (event) => {
|
|
370
370
|
if (event.requestContext) {
|
|
@@ -48,7 +48,9 @@ const upgradeWebSocket = (0, import_websocket.defineWebSocketHelper)((c, events)
|
|
|
48
48
|
data: {
|
|
49
49
|
events,
|
|
50
50
|
url: new URL(c.req.url),
|
|
51
|
-
protocol
|
|
51
|
+
// The first requested subprotocol, exposed via WSContext.protocol to
|
|
52
|
+
// match the deno and cloudflare adapters.
|
|
53
|
+
protocol: c.req.header("sec-websocket-protocol")?.split(",")[0]?.trim() ?? ""
|
|
52
54
|
}
|
|
53
55
|
});
|
|
54
56
|
if (upgradeResult) {
|
|
@@ -65,7 +65,7 @@ const serveStatic = (options) => {
|
|
|
65
65
|
if (content instanceof Response) {
|
|
66
66
|
return c.newResponse(content.body, content);
|
|
67
67
|
}
|
|
68
|
-
if (content) {
|
|
68
|
+
if (content != null) {
|
|
69
69
|
const mimeType = options.mimes && (0, import_mime.getMimeType)(path, options.mimes) || (0, import_mime.getMimeType)(path);
|
|
70
70
|
c.header("Content-Type", mimeType || "application/octet-stream");
|
|
71
71
|
if (options.precompressed && (!mimeType || import_compress.COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {
|
|
@@ -20,18 +20,26 @@ __export(body_exports, {
|
|
|
20
20
|
parseBody: () => parseBody
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(body_exports);
|
|
23
|
-
var
|
|
23
|
+
var import_buffer = require("./buffer");
|
|
24
|
+
const isRawRequest = (request) => "headers" in request;
|
|
24
25
|
const parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
25
26
|
const { all = false, dot = false } = options;
|
|
26
|
-
const headers = request
|
|
27
|
+
const headers = isRawRequest(request) ? request.headers : request.raw.headers;
|
|
27
28
|
const contentType = headers.get("Content-Type");
|
|
28
|
-
|
|
29
|
+
const mediaType = contentType?.split(";")[0].trim().toLowerCase();
|
|
30
|
+
if (mediaType === "multipart/form-data" || mediaType === "application/x-www-form-urlencoded") {
|
|
29
31
|
return parseFormData(request, { all, dot });
|
|
30
32
|
}
|
|
31
33
|
return {};
|
|
32
34
|
};
|
|
33
35
|
async function parseFormData(request, options) {
|
|
34
|
-
const
|
|
36
|
+
const headers = isRawRequest(request) ? request.headers : request.raw.headers;
|
|
37
|
+
const arrayBuffer = await request.arrayBuffer();
|
|
38
|
+
const formDataPromise = (0, import_buffer.bufferToFormData)(arrayBuffer, headers.get("Content-Type") || "");
|
|
39
|
+
if (!isRawRequest(request)) {
|
|
40
|
+
request.bodyCache.formData = formDataPromise;
|
|
41
|
+
}
|
|
42
|
+
const formData = await formDataPromise;
|
|
35
43
|
if (formData) {
|
|
36
44
|
return convertFormDataToBodyData(formData, options);
|
|
37
45
|
}
|
|
@@ -88,7 +88,8 @@ const bufferToString = (buffer) => {
|
|
|
88
88
|
const bufferToFormData = (arrayBuffer, contentType) => {
|
|
89
89
|
const response = new Response(arrayBuffer, {
|
|
90
90
|
headers: {
|
|
91
|
-
|
|
91
|
+
// Normalize the media type (case-insensitive) while keeping parameters like the boundary
|
|
92
|
+
"Content-Type": contentType.replace(/^[^;]+/, (mediaType) => mediaType.toLowerCase())
|
|
92
93
|
}
|
|
93
94
|
});
|
|
94
95
|
return response.formData();
|
|
@@ -23,9 +23,9 @@ module.exports = __toCommonJS(validator_exports);
|
|
|
23
23
|
var import_cookie = require("../helper/cookie");
|
|
24
24
|
var import_http_exception = require("../http-exception");
|
|
25
25
|
var import_buffer = require("../utils/buffer");
|
|
26
|
-
const jsonRegex = /^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))
|
|
27
|
-
const multipartRegex = /^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)
|
|
28
|
-
const urlencodedRegex = /^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))
|
|
26
|
+
const jsonRegex = /^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i;
|
|
27
|
+
const multipartRegex = /^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/i;
|
|
28
|
+
const urlencodedRegex = /^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i;
|
|
29
29
|
const validator = (target, validationFunc) => {
|
|
30
30
|
return async (c, next) => {
|
|
31
31
|
let value = {};
|
|
@@ -44,7 +44,7 @@ var serveStatic = (options) => {
|
|
|
44
44
|
if (content instanceof Response) {
|
|
45
45
|
return c.newResponse(content.body, content);
|
|
46
46
|
}
|
|
47
|
-
if (content) {
|
|
47
|
+
if (content != null) {
|
|
48
48
|
const mimeType = options.mimes && getMimeType(path, options.mimes) || getMimeType(path);
|
|
49
49
|
c.header("Content-Type", mimeType || "application/octet-stream");
|
|
50
50
|
if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {
|
|
@@ -24,11 +24,11 @@ import type { Env, MiddlewareHandler } from '../../types';
|
|
|
24
24
|
* app.use(contextStorage())
|
|
25
25
|
*
|
|
26
26
|
* app.use(async (c, next) => {
|
|
27
|
-
* c.set('message', 'Hono is hot!!)
|
|
27
|
+
* c.set('message', 'Hono is hot!!')
|
|
28
28
|
* await next()
|
|
29
29
|
* })
|
|
30
30
|
*
|
|
31
|
-
* app.get('/', async (c) =>
|
|
31
|
+
* app.get('/', async (c) => c.text(getMessage()))
|
|
32
32
|
*
|
|
33
33
|
* const getMessage = () => {
|
|
34
34
|
* return getContext<Env>().var.message
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
// src/utils/body.ts
|
|
2
|
-
import {
|
|
2
|
+
import { bufferToFormData } from "./buffer.js";
|
|
3
|
+
var isRawRequest = (request) => "headers" in request;
|
|
3
4
|
var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
4
5
|
const { all = false, dot = false } = options;
|
|
5
|
-
const headers = request
|
|
6
|
+
const headers = isRawRequest(request) ? request.headers : request.raw.headers;
|
|
6
7
|
const contentType = headers.get("Content-Type");
|
|
7
|
-
|
|
8
|
+
const mediaType = contentType?.split(";")[0].trim().toLowerCase();
|
|
9
|
+
if (mediaType === "multipart/form-data" || mediaType === "application/x-www-form-urlencoded") {
|
|
8
10
|
return parseFormData(request, { all, dot });
|
|
9
11
|
}
|
|
10
12
|
return {};
|
|
11
13
|
};
|
|
12
14
|
async function parseFormData(request, options) {
|
|
13
|
-
const
|
|
15
|
+
const headers = isRawRequest(request) ? request.headers : request.raw.headers;
|
|
16
|
+
const arrayBuffer = await request.arrayBuffer();
|
|
17
|
+
const formDataPromise = bufferToFormData(arrayBuffer, headers.get("Content-Type") || "");
|
|
18
|
+
if (!isRawRequest(request)) {
|
|
19
|
+
request.bodyCache.formData = formDataPromise;
|
|
20
|
+
}
|
|
21
|
+
const formData = await formDataPromise;
|
|
14
22
|
if (formData) {
|
|
15
23
|
return convertFormDataToBodyData(formData, options);
|
|
16
24
|
}
|
|
@@ -64,7 +64,8 @@ var bufferToString = (buffer) => {
|
|
|
64
64
|
var bufferToFormData = (arrayBuffer, contentType) => {
|
|
65
65
|
const response = new Response(arrayBuffer, {
|
|
66
66
|
headers: {
|
|
67
|
-
|
|
67
|
+
// Normalize the media type (case-insensitive) while keeping parameters like the boundary
|
|
68
|
+
"Content-Type": contentType.replace(/^[^;]+/, (mediaType) => mediaType.toLowerCase())
|
|
68
69
|
}
|
|
69
70
|
});
|
|
70
71
|
return response.formData();
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { getCookie } from "../helper/cookie/index.js";
|
|
3
3
|
import { HTTPException } from "../http-exception.js";
|
|
4
4
|
import { bufferToFormData } from "../utils/buffer.js";
|
|
5
|
-
var jsonRegex = /^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))
|
|
6
|
-
var multipartRegex = /^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)
|
|
7
|
-
var urlencodedRegex = /^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))
|
|
5
|
+
var jsonRegex = /^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i;
|
|
6
|
+
var multipartRegex = /^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/i;
|
|
7
|
+
var urlencodedRegex = /^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i;
|
|
8
8
|
var validator = (target, validationFunc) => {
|
|
9
9
|
return async (c, next) => {
|
|
10
10
|
let value = {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.28",
|
|
4
4
|
"description": "Web framework built on Web Standards",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist",
|
|
11
|
+
"!dist/**/*.tsbuildinfo"
|
|
11
12
|
],
|
|
12
13
|
"scripts": {
|
|
13
14
|
"test": "tsc --noEmit && vitest --run",
|
|
@@ -678,17 +679,17 @@
|
|
|
678
679
|
"eslint": "^9.39.3",
|
|
679
680
|
"jsdom": "22.1.0",
|
|
680
681
|
"msw": "^2.6.0",
|
|
681
|
-
"np": "
|
|
682
|
+
"np": "11.2.1",
|
|
682
683
|
"oxc-parser": "^0.96.0",
|
|
683
684
|
"pkg-pr-new": "^0.0.53",
|
|
684
685
|
"prettier": "3.7.4",
|
|
685
686
|
"publint": "0.3.15",
|
|
686
687
|
"typescript": "^5.9.2",
|
|
687
|
-
"undici": "^6.
|
|
688
|
+
"undici": "^6.27.0",
|
|
688
689
|
"vite-plugin-fastly-js-compute": "^0.4.2",
|
|
689
|
-
"vitest": "^4.1.
|
|
690
|
-
"wrangler": "4.
|
|
691
|
-
"ws": "^8.
|
|
690
|
+
"vitest": "^4.1.9",
|
|
691
|
+
"wrangler": "4.107.0",
|
|
692
|
+
"ws": "^8.21.0",
|
|
692
693
|
"zod": "^3.23.8"
|
|
693
694
|
},
|
|
694
695
|
"packageManager": "bun@1.2.20",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suveren/gateway",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "Suveren gateway — local agent gateway built in compliance with the Human Agency Protocol (HAP). Runs the UI, control plane, and MCP server in one Node process.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "server.js",
|