@suveren/gateway 0.3.17 → 0.4.1
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/bin/suveren-gateway.js +419 -28
- package/content/integrations/calendar.json +20 -8
- package/content/integrations/crm.json +97 -23
- package/content/integrations/gmail.json +166 -29
- package/content/integrations/linkedin.json +15 -3
- package/content/integrations/mollie.json +2 -2
- package/dist/control-plane/index.mjs +341 -42
- package/dist/mcp-server/http.mjs +880 -210
- package/dist/ui/assets/index-Cog54HOo.js +105 -0
- package/dist/ui/assets/{index-DOt3SNnl.css → index-JHaCddDE.css} +1 -1
- package/dist/ui/index.html +2 -2
- package/lib/autostart-templates.d.mts +37 -0
- package/lib/autostart-templates.mjs +208 -0
- package/node_modules/@hap/core/dist/index.d.mts +27 -0
- package/node_modules/@hap/core/dist/index.d.ts +27 -0
- package/node_modules/@hap/core/dist/index.js +13 -1
- package/node_modules/@hap/core/dist/index.mjs +13 -1
- package/node_modules/@hap/core/package.json +1 -1
- package/node_modules/@hap/core/src/gatekeeper.ts +47 -1
- package/node_modules/@hap/core/src/types.ts +27 -0
- package/node_modules/@hono/node-server/README.md +58 -25
- package/node_modules/@hono/node-server/dist/conninfo.cjs +22 -0
- package/node_modules/@hono/node-server/dist/{conninfo.d.ts → conninfo.d.cts} +4 -3
- package/node_modules/@hono/node-server/dist/conninfo.d.mts +4 -3
- package/node_modules/@hono/node-server/dist/conninfo.mjs +19 -16
- package/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs +5 -0
- package/node_modules/@hono/node-server/dist/constants-BXAKTxRC.cjs +11 -0
- package/node_modules/@hono/node-server/dist/index.cjs +1173 -0
- package/node_modules/@hono/node-server/dist/index.d.cts +101 -0
- package/node_modules/@hono/node-server/dist/index.d.mts +101 -8
- package/node_modules/@hono/node-server/dist/index.mjs +1143 -637
- package/node_modules/@hono/node-server/dist/serve-static.cjs +151 -0
- package/node_modules/@hono/node-server/dist/serve-static.d.cts +18 -0
- package/node_modules/@hono/node-server/dist/serve-static.d.mts +14 -13
- package/node_modules/@hono/node-server/dist/serve-static.mjs +143 -145
- package/node_modules/@hono/node-server/dist/utils/response.cjs +8 -0
- package/node_modules/@hono/node-server/dist/utils/response.d.cts +4 -0
- package/node_modules/@hono/node-server/dist/utils/response.d.mts +3 -2
- package/node_modules/@hono/node-server/dist/utils/response.mjs +6 -9
- package/node_modules/@hono/node-server/dist/utils/stream.cjs +65 -0
- package/node_modules/@hono/node-server/dist/utils/stream.d.cts +6 -0
- package/node_modules/@hono/node-server/dist/utils/stream.d.mts +6 -0
- package/node_modules/@hono/node-server/dist/utils/stream.mjs +64 -0
- package/node_modules/@hono/node-server/package.json +65 -54
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.js +1 -12
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.d.ts +7 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.js +9 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js +5 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js +1 -12
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.d.ts +5 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.js +17 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts +9 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js +10 -4
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts +21 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js +239 -41
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js +25 -6
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.d.ts +32 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.js +64 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts +5 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.js +10 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js +2 -13
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.d.ts +7 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js +9 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js +5 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +2 -13
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts +5 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js +13 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts +9 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js +10 -4
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts +21 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js +239 -41
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +25 -6
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts +32 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js +57 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts +5 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js +9 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/media-typer/README.md +15 -14
- package/node_modules/@modelcontextprotocol/sdk/node_modules/media-typer/index.js +0 -8
- package/node_modules/@modelcontextprotocol/sdk/node_modules/media-typer/package.json +16 -12
- package/node_modules/@modelcontextprotocol/sdk/package.json +4 -3
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/crypto.d.ts +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/body-parser/HISTORY.md +7 -1
- package/node_modules/body-parser/lib/types/json.js +7 -3
- package/node_modules/body-parser/lib/types/raw.js +7 -3
- package/node_modules/body-parser/lib/types/text.js +7 -3
- package/node_modules/body-parser/lib/types/urlencoded.js +7 -3
- package/node_modules/body-parser/package.json +1 -1
- package/node_modules/express-rate-limit/dist/index.cjs +69 -5
- package/node_modules/express-rate-limit/dist/index.d.cts +16 -0
- package/node_modules/express-rate-limit/dist/index.d.mts +16 -0
- package/node_modules/express-rate-limit/dist/index.d.ts +16 -0
- package/node_modules/express-rate-limit/dist/index.mjs +55 -5
- package/node_modules/express-rate-limit/node_modules/debug/LICENSE +20 -0
- package/node_modules/express-rate-limit/node_modules/debug/README.md +481 -0
- package/node_modules/express-rate-limit/node_modules/debug/package.json +64 -0
- package/node_modules/express-rate-limit/node_modules/debug/src/browser.js +272 -0
- package/node_modules/express-rate-limit/node_modules/debug/src/common.js +292 -0
- package/node_modules/express-rate-limit/node_modules/debug/src/index.js +10 -0
- package/node_modules/express-rate-limit/node_modules/debug/src/node.js +263 -0
- package/node_modules/express-rate-limit/node_modules/ms/index.js +162 -0
- package/node_modules/express-rate-limit/node_modules/ms/license.md +21 -0
- package/node_modules/express-rate-limit/node_modules/ms/package.json +38 -0
- package/node_modules/express-rate-limit/node_modules/ms/readme.md +59 -0
- package/node_modules/express-rate-limit/package.json +12 -9
- package/node_modules/fast-uri/index.js +17 -0
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/security.test.js +62 -0
- package/node_modules/hono/dist/adapter/aws-lambda/handler.js +1 -4
- package/node_modules/hono/dist/adapter/lambda-edge/handler.js +12 -2
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +1 -4
- package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +12 -2
- package/node_modules/hono/dist/cjs/client/client.js +10 -1
- package/node_modules/hono/dist/cjs/client/utils.js +1 -1
- package/node_modules/hono/dist/cjs/helper/streaming/sse.js +5 -4
- package/node_modules/hono/dist/cjs/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/compress/index.js +2 -1
- package/node_modules/hono/dist/cjs/middleware/etag/index.js +2 -1
- package/node_modules/hono/dist/cjs/middleware/method-override/index.js +5 -3
- package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +10 -4
- package/node_modules/hono/dist/cjs/request.js +8 -3
- package/node_modules/hono/dist/cjs/router/trie-router/node.js +9 -0
- package/node_modules/hono/dist/cjs/utils/accept.js +1 -1
- package/node_modules/hono/dist/cjs/utils/body.js +6 -0
- package/node_modules/hono/dist/cjs/utils/url.js +1 -1
- package/node_modules/hono/dist/client/client.js +10 -1
- package/node_modules/hono/dist/client/utils.js +1 -1
- package/node_modules/hono/dist/helper/streaming/sse.js +5 -4
- package/node_modules/hono/dist/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/middleware/compress/index.js +2 -1
- package/node_modules/hono/dist/middleware/etag/index.js +2 -1
- package/node_modules/hono/dist/middleware/method-override/index.js +5 -3
- package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +10 -4
- package/node_modules/hono/dist/request.js +8 -3
- package/node_modules/hono/dist/router/trie-router/node.js +9 -0
- package/node_modules/hono/dist/types/adapter/aws-lambda/types.d.ts +9 -0
- package/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +1 -1
- package/node_modules/hono/dist/types/helper/websocket/index.d.ts +1 -1
- package/node_modules/hono/dist/types/middleware/combine/index.d.ts +1 -1
- package/node_modules/hono/dist/types/middleware/language/language.d.ts +18 -0
- package/node_modules/hono/dist/types/utils/types.d.ts +1 -1
- package/node_modules/hono/dist/utils/accept.js +1 -1
- package/node_modules/hono/dist/utils/body.js +6 -0
- package/node_modules/hono/dist/utils/url.js +1 -1
- package/node_modules/hono/package.json +4 -4
- package/node_modules/ip-address/README.md +102 -96
- package/node_modules/ip-address/dist/common.d.ts +23 -0
- package/node_modules/ip-address/dist/common.js +27 -4
- package/node_modules/ip-address/dist/common.js.map +1 -1
- package/node_modules/ip-address/dist/ipv4.d.ts +8 -1
- package/node_modules/ip-address/dist/ipv4.js +21 -8
- package/node_modules/ip-address/dist/ipv4.js.map +1 -1
- package/node_modules/ip-address/dist/ipv6.d.ts +59 -1
- package/node_modules/ip-address/dist/ipv6.js +149 -41
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/dist/v4/constants.js +5 -1
- package/node_modules/ip-address/dist/v4/constants.js.map +1 -1
- package/node_modules/ip-address/dist/v6/constants.js +3 -2
- package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
- package/node_modules/ip-address/package.json +2 -2
- package/node_modules/jose/README.md +1 -4
- package/node_modules/jose/dist/types/jwks/remote.d.ts +3 -3
- package/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
- package/node_modules/jose/dist/webapi/lib/key_to_jwk.js +4 -1
- package/node_modules/jose/package.json +1 -1
- package/package.json +3 -2
- package/profiles/customers/0.4.profile.json +7 -4
- package/profiles/customers/0.5.profile.json +131 -0
- package/profiles/customers/0.6.profile.json +153 -0
- package/profiles/email/0.4.profile.json +8 -4
- package/profiles/index.json +2 -0
- package/server.js +10 -0
- package/dist/ui/assets/index-CTmWS7W4.js +0 -105
- package/node_modules/@hono/node-server/dist/conninfo.js +0 -42
- package/node_modules/@hono/node-server/dist/globals.d.mts +0 -2
- package/node_modules/@hono/node-server/dist/globals.d.ts +0 -2
- package/node_modules/@hono/node-server/dist/globals.js +0 -29
- package/node_modules/@hono/node-server/dist/globals.mjs +0 -5
- package/node_modules/@hono/node-server/dist/index.d.ts +0 -8
- package/node_modules/@hono/node-server/dist/index.js +0 -702
- package/node_modules/@hono/node-server/dist/listener.d.mts +0 -13
- package/node_modules/@hono/node-server/dist/listener.d.ts +0 -13
- package/node_modules/@hono/node-server/dist/listener.js +0 -670
- package/node_modules/@hono/node-server/dist/listener.mjs +0 -635
- package/node_modules/@hono/node-server/dist/request.d.mts +0 -25
- package/node_modules/@hono/node-server/dist/request.d.ts +0 -25
- package/node_modules/@hono/node-server/dist/request.js +0 -238
- package/node_modules/@hono/node-server/dist/request.mjs +0 -206
- package/node_modules/@hono/node-server/dist/response.d.mts +0 -26
- package/node_modules/@hono/node-server/dist/response.d.ts +0 -26
- package/node_modules/@hono/node-server/dist/response.js +0 -112
- package/node_modules/@hono/node-server/dist/response.mjs +0 -85
- package/node_modules/@hono/node-server/dist/serve-static.d.ts +0 -17
- package/node_modules/@hono/node-server/dist/serve-static.js +0 -177
- package/node_modules/@hono/node-server/dist/server.d.mts +0 -10
- package/node_modules/@hono/node-server/dist/server.d.ts +0 -10
- package/node_modules/@hono/node-server/dist/server.js +0 -696
- package/node_modules/@hono/node-server/dist/server.mjs +0 -660
- package/node_modules/@hono/node-server/dist/types.d.mts +0 -44
- package/node_modules/@hono/node-server/dist/types.d.ts +0 -44
- package/node_modules/@hono/node-server/dist/types.js +0 -18
- package/node_modules/@hono/node-server/dist/types.mjs +0 -0
- package/node_modules/@hono/node-server/dist/utils/response/constants.d.mts +0 -3
- package/node_modules/@hono/node-server/dist/utils/response/constants.d.ts +0 -3
- package/node_modules/@hono/node-server/dist/utils/response/constants.js +0 -30
- package/node_modules/@hono/node-server/dist/utils/response/constants.mjs +0 -5
- package/node_modules/@hono/node-server/dist/utils/response.d.ts +0 -3
- package/node_modules/@hono/node-server/dist/utils/response.js +0 -37
- package/node_modules/@hono/node-server/dist/utils.d.mts +0 -9
- package/node_modules/@hono/node-server/dist/utils.d.ts +0 -9
- package/node_modules/@hono/node-server/dist/utils.js +0 -99
- package/node_modules/@hono/node-server/dist/utils.mjs +0 -71
- package/node_modules/@hono/node-server/dist/vercel.d.mts +0 -7
- package/node_modules/@hono/node-server/dist/vercel.d.ts +0 -7
- package/node_modules/@hono/node-server/dist/vercel.js +0 -677
- package/node_modules/@hono/node-server/dist/vercel.mjs +0 -640
|
@@ -119,6 +119,20 @@ export function normalizeObjectSchema(schema) {
|
|
|
119
119
|
}
|
|
120
120
|
return undefined;
|
|
121
121
|
}
|
|
122
|
+
function getDotPath(path) {
|
|
123
|
+
if (path.length === 0) {
|
|
124
|
+
return 'object root';
|
|
125
|
+
}
|
|
126
|
+
return path.reduce((acc, seg, index) => {
|
|
127
|
+
if (index === 0) {
|
|
128
|
+
return String(seg);
|
|
129
|
+
}
|
|
130
|
+
if (typeof seg === 'number') {
|
|
131
|
+
return `${acc}[${seg}]`;
|
|
132
|
+
}
|
|
133
|
+
return `${acc}.${seg}`;
|
|
134
|
+
}, '');
|
|
135
|
+
}
|
|
122
136
|
// --- Error message extraction ---
|
|
123
137
|
/**
|
|
124
138
|
* Safely extracts an error message from a parse result error.
|
|
@@ -126,16 +140,21 @@ export function normalizeObjectSchema(schema) {
|
|
|
126
140
|
*/
|
|
127
141
|
export function getParseErrorMessage(error) {
|
|
128
142
|
if (error && typeof error === 'object') {
|
|
143
|
+
// When present, prioritize zod issues and format as a message and path
|
|
144
|
+
if ('issues' in error && Array.isArray(error.issues) && error.issues.length > 0) {
|
|
145
|
+
return error.issues
|
|
146
|
+
.map((i) => {
|
|
147
|
+
if (!i.path?.length) {
|
|
148
|
+
return i.message;
|
|
149
|
+
}
|
|
150
|
+
return `${i.message} at ${getDotPath(i.path)}`;
|
|
151
|
+
})
|
|
152
|
+
.join('\n');
|
|
153
|
+
}
|
|
129
154
|
// Try common error structures
|
|
130
155
|
if ('message' in error && typeof error.message === 'string') {
|
|
131
156
|
return error.message;
|
|
132
157
|
}
|
|
133
|
-
if ('issues' in error && Array.isArray(error.issues) && error.issues.length > 0) {
|
|
134
|
-
const firstIssue = error.issues[0];
|
|
135
|
-
if (firstIssue && typeof firstIssue === 'object' && 'message' in firstIssue) {
|
|
136
|
-
return String(firstIssue.message);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
158
|
// Fallback: try to stringify the error
|
|
140
159
|
try {
|
|
141
160
|
return JSON.stringify(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-compat.js","sourceRoot":"","sources":["../../../src/server/zod-compat.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,uDAAuD;AACvD,yDAAyD;AACzD,uDAAuD;AAKvD,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,O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,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;QAC/B,IAAI,GAAG,EAAE,CAAC;YACN,4CAA4C;YAC5C,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS;gBAAE,OAAO,GAAG,CAAC,KAAK,CAAC;YAC9C,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrD,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACzB,CAAC;QACL,CAAC;IACL,CAAC;IACD,MAAM,QAAQ,GAAG,MAAkC,CAAC;IACpD,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC;IAC1B,IAAI,GAAG,EAAE,CAAC;QACN,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS;YAAE,OAAO,GAAG,CAAC,KAAK,CAAC;QAC9C,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrD,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;IACD,gEAAgE;IAChE,MAAM,WAAW,GAAI,MAA8B,CAAC,KAAK,CAAC;IAC1D,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,WAAW,CAAC;IAClD,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts the media type (the lowercased `type/subtype` pair, without
|
|
3
|
+
* parameters) from a raw `Content-Type` header value, or `undefined` when the
|
|
4
|
+
* header is missing or empty.
|
|
5
|
+
*
|
|
6
|
+
* Content-Type comparisons must use the parsed media type, never a substring
|
|
7
|
+
* search of the raw header: a value like `text/plain; a=application/json`
|
|
8
|
+
* contains the substring `application/json` but its media type is
|
|
9
|
+
* `text/plain`, and case variants or parameters make naive string comparison
|
|
10
|
+
* wrong in both directions.
|
|
11
|
+
*
|
|
12
|
+
* "Essence" is the WHATWG MIME Sniffing standard's term for the bare
|
|
13
|
+
* `type/subtype` pair (https://mimesniff.spec.whatwg.org/#mime-type-essence);
|
|
14
|
+
* the Fetch standard's request classification is defined against it
|
|
15
|
+
* (https://fetch.spec.whatwg.org/#cors-safelisted-request-header).
|
|
16
|
+
*
|
|
17
|
+
* Parsing is RFC 9110 (`content-type` package) first. When the parameter
|
|
18
|
+
* section is malformed (`application/json;`, `application/json; charset=`),
|
|
19
|
+
* browsers and most HTTP stacks still derive the media type from the segment
|
|
20
|
+
* before the first `;` — the fallback matches that widely-implemented
|
|
21
|
+
* behavior, so a header whose media type is unambiguous is not rejected for
|
|
22
|
+
* a sloppy parameter section.
|
|
23
|
+
*/
|
|
24
|
+
export declare function mediaTypeEssence(header: string | null | undefined): string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Whether a raw `Content-Type` header value denotes `application/json`.
|
|
27
|
+
* Parameters (for example `charset=utf-8`) are allowed and ignored; malformed
|
|
28
|
+
* parameter sections do not reject a header whose media type is unambiguously
|
|
29
|
+
* `application/json` (see `mediaTypeEssence` for the exact grammar).
|
|
30
|
+
*/
|
|
31
|
+
export declare function isJsonContentType(header: string | null | undefined): boolean;
|
|
32
|
+
//# sourceMappingURL=mediaType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediaType.d.ts","sourceRoot":"","sources":["../../../src/shared/mediaType.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAiBtF;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAM5E"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import contentType from 'content-type';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the media type (the lowercased `type/subtype` pair, without
|
|
4
|
+
* parameters) from a raw `Content-Type` header value, or `undefined` when the
|
|
5
|
+
* header is missing or empty.
|
|
6
|
+
*
|
|
7
|
+
* Content-Type comparisons must use the parsed media type, never a substring
|
|
8
|
+
* search of the raw header: a value like `text/plain; a=application/json`
|
|
9
|
+
* contains the substring `application/json` but its media type is
|
|
10
|
+
* `text/plain`, and case variants or parameters make naive string comparison
|
|
11
|
+
* wrong in both directions.
|
|
12
|
+
*
|
|
13
|
+
* "Essence" is the WHATWG MIME Sniffing standard's term for the bare
|
|
14
|
+
* `type/subtype` pair (https://mimesniff.spec.whatwg.org/#mime-type-essence);
|
|
15
|
+
* the Fetch standard's request classification is defined against it
|
|
16
|
+
* (https://fetch.spec.whatwg.org/#cors-safelisted-request-header).
|
|
17
|
+
*
|
|
18
|
+
* Parsing is RFC 9110 (`content-type` package) first. When the parameter
|
|
19
|
+
* section is malformed (`application/json;`, `application/json; charset=`),
|
|
20
|
+
* browsers and most HTTP stacks still derive the media type from the segment
|
|
21
|
+
* before the first `;` — the fallback matches that widely-implemented
|
|
22
|
+
* behavior, so a header whose media type is unambiguous is not rejected for
|
|
23
|
+
* a sloppy parameter section.
|
|
24
|
+
*/
|
|
25
|
+
export function mediaTypeEssence(header) {
|
|
26
|
+
if (!header) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
return contentType.parse(header).type;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
const essence = (header.split(';', 1)[0] ?? '').trim().toLowerCase();
|
|
34
|
+
// A comma in the parameter tail of an unparseable value indicates
|
|
35
|
+
// joined duplicate headers — ambiguous, so no essence at all (keeps
|
|
36
|
+
// duplicate-header handling uniform whether or not the first copy
|
|
37
|
+
// carries parameters).
|
|
38
|
+
if (essence === '' || header.slice(essence.length).includes(',')) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return essence;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Whether a raw `Content-Type` header value denotes `application/json`.
|
|
46
|
+
* Parameters (for example `charset=utf-8`) are allowed and ignored; malformed
|
|
47
|
+
* parameter sections do not reject a header whose media type is unambiguously
|
|
48
|
+
* `application/json` (see `mediaTypeEssence` for the exact grammar).
|
|
49
|
+
*/
|
|
50
|
+
export function isJsonContentType(header) {
|
|
51
|
+
// Fast path: the exact literal is what SDK clients send on every POST.
|
|
52
|
+
if (header === 'application/json') {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return mediaTypeEssence(header) === 'application/json';
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=mediaType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediaType.js","sourceRoot":"","sources":["../../../src/shared/mediaType.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAiC;IAC9D,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,IAAI,CAAC;QACD,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACL,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACrE,kEAAkE;QAClE,oEAAoE;QACpE,kEAAkE;QAClE,uBAAuB;QACvB,IAAI,OAAO,KAAK,EAAE,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/D,OAAO,SAAS,CAAC;QACrB,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAiC;IAC/D,uEAAuE;IACvE,IAAI,MAAM,KAAK,kBAAkB,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,gBAAgB,CAAC,MAAM,CAAC,KAAK,kBAAkB,CAAC;AAC3D,CAAC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { JSONRPCMessage } from '../types.js';
|
|
2
|
+
export declare const STDIO_DEFAULT_MAX_BUFFER_SIZE: number;
|
|
2
3
|
/**
|
|
3
4
|
* Buffers a continuous stdio stream into discrete JSON-RPC messages.
|
|
4
5
|
*/
|
|
5
6
|
export declare class ReadBuffer {
|
|
6
7
|
private _buffer?;
|
|
8
|
+
private _maxBufferSize;
|
|
9
|
+
constructor(options?: {
|
|
10
|
+
maxBufferSize?: number;
|
|
11
|
+
});
|
|
7
12
|
append(chunk: Buffer): void;
|
|
8
13
|
readMessage(): JSONRPCMessage | null;
|
|
9
14
|
clear(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../../src/shared/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAC;AAEnE;;GAEG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,OAAO,CAAC,CAAS;
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../../src/shared/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAC;AAEnE,eAAO,MAAM,6BAA6B,QAAmB,CAAC;AAE9D;;GAEG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,cAAc,CAAS;gBAEnB,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE;IAIhD,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAS3B,WAAW,IAAI,cAAc,GAAG,IAAI;IAepC,KAAK,IAAI,IAAI;CAGhB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAE/D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAEhE"}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { JSONRPCMessageSchema } from '../types.js';
|
|
2
|
+
export const STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
|
|
2
3
|
/**
|
|
3
4
|
* Buffers a continuous stdio stream into discrete JSON-RPC messages.
|
|
4
5
|
*/
|
|
5
6
|
export class ReadBuffer {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
9
|
+
}
|
|
6
10
|
append(chunk) {
|
|
11
|
+
const newSize = (this._buffer?.length ?? 0) + chunk.length;
|
|
12
|
+
if (newSize > this._maxBufferSize) {
|
|
13
|
+
this.clear();
|
|
14
|
+
throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
|
|
15
|
+
}
|
|
7
16
|
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
|
|
8
17
|
}
|
|
9
18
|
readMessage() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../../src/shared/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnE;;GAEG;AACH,MAAM,OAAO,UAAU;
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../../src/shared/stdio.ts"],"names":[],"mappings":"AAAA,OA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AAC,CAAC;QAChD,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,KAAK;QACD,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;IAC7B,CAAC;CACJ;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC3C,OAAO,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAuB;IACpD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;AAC1C,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# media-typer
|
|
2
2
|
|
|
3
|
-
[![NPM Version][npm-
|
|
4
|
-
[![NPM Downloads][
|
|
3
|
+
[![NPM Version][npm-image]][npm-url]
|
|
4
|
+
[![NPM Downloads][downloads-image]][downloads-url]
|
|
5
5
|
[![Node.js Version][node-version-image]][node-version-url]
|
|
6
|
-
[![Build Status][
|
|
6
|
+
[![Build Status][ci-image]][ci-url]
|
|
7
7
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
8
8
|
|
|
9
9
|
Simple RFC 6838 media type parser.
|
|
10
10
|
|
|
11
|
-
This module will parse a given media type into
|
|
11
|
+
This module will parse a given media type into its component parts, like type,
|
|
12
12
|
subtype, and suffix. A formatter is also provided to put them back together and
|
|
13
13
|
the two can be combined to normalize media types into a canonical form.
|
|
14
14
|
|
|
15
|
-
If you are looking to parse the string that represents a media type and
|
|
15
|
+
If you are looking to parse the string that represents a media type and its
|
|
16
16
|
parameters in HTTP (for example, the `Content-Type` header), use the
|
|
17
17
|
[content-type module](https://www.npmjs.com/package/content-type).
|
|
18
18
|
|
|
@@ -75,19 +75,20 @@ If any of the given object values are invalid, then a `TypeError` is thrown.
|
|
|
75
75
|
var valid = typer.test('image/svg+xml')
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
Validate a media type string. This will return `true`
|
|
78
|
+
Validate a media type string. This will return `true` if the string is a well-
|
|
79
79
|
formatted media type, or `false` otherwise.
|
|
80
80
|
|
|
81
81
|
## License
|
|
82
82
|
|
|
83
83
|
[MIT](LICENSE)
|
|
84
84
|
|
|
85
|
-
[
|
|
86
|
-
[
|
|
87
|
-
[
|
|
88
|
-
[node-version-url]: https://nodejs.org/en/download
|
|
89
|
-
[npm-downloads-image]: https://badgen.net/npm/dm/media-typer
|
|
85
|
+
[ci-image]: https://img.shields.io/github/workflow/status/jshttp/media-typer/ci/master?label=ci
|
|
86
|
+
[ci-url]: https://github.com/jshttp/media-typer/actions/workflows/ci.yml
|
|
87
|
+
[npm-image]: https://img.shields.io/npm/v/media-typer.svg
|
|
90
88
|
[npm-url]: https://npmjs.org/package/media-typer
|
|
91
|
-
[
|
|
92
|
-
[
|
|
93
|
-
[
|
|
89
|
+
[node-version-image]: https://img.shields.io/node/v/media-typer.svg
|
|
90
|
+
[node-version-url]: https://nodejs.org/en/
|
|
91
|
+
[coveralls-image]: https://img.shields.io/coveralls/jshttp/media-typer/master.svg
|
|
92
|
+
[coveralls-url]: https://coveralls.io/r/jshttp/media-typer?branch=master
|
|
93
|
+
[downloads-image]: https://img.shields.io/npm/dm/media-typer.svg
|
|
94
|
+
[downloads-url]: https://npmjs.org/package/media-typer
|
|
@@ -83,10 +83,6 @@ function format (obj) {
|
|
|
83
83
|
*/
|
|
84
84
|
|
|
85
85
|
function test (string) {
|
|
86
|
-
if (!string) {
|
|
87
|
-
throw new TypeError('argument string is required')
|
|
88
|
-
}
|
|
89
|
-
|
|
90
86
|
if (typeof string !== 'string') {
|
|
91
87
|
throw new TypeError('argument string is required to be a string')
|
|
92
88
|
}
|
|
@@ -103,10 +99,6 @@ function test (string) {
|
|
|
103
99
|
*/
|
|
104
100
|
|
|
105
101
|
function parse (string) {
|
|
106
|
-
if (!string) {
|
|
107
|
-
throw new TypeError('argument string is required')
|
|
108
|
-
}
|
|
109
|
-
|
|
110
102
|
if (typeof string !== 'string') {
|
|
111
103
|
throw new TypeError('argument string is required to be a string')
|
|
112
104
|
}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "media-typer",
|
|
3
3
|
"description": "Simple RFC 6838 media type parser and formatter",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "jshttp/media-typer",
|
|
8
|
+
"funding": {
|
|
9
|
+
"type": "opencollective",
|
|
10
|
+
"url": "https://opencollective.com/express"
|
|
11
|
+
},
|
|
8
12
|
"devDependencies": {
|
|
9
|
-
"eslint": "
|
|
10
|
-
"eslint-config-standard": "
|
|
11
|
-
"eslint-plugin-import": "2.
|
|
12
|
-
"eslint-plugin-markdown": "1.0.
|
|
13
|
-
"eslint-plugin-node": "
|
|
14
|
-
"eslint-plugin-promise": "4.
|
|
15
|
-
"eslint-plugin-standard": "4.
|
|
16
|
-
"mocha": "
|
|
17
|
-
"nyc": "
|
|
13
|
+
"eslint": "7.23.0",
|
|
14
|
+
"eslint-config-standard": "14.1.1",
|
|
15
|
+
"eslint-plugin-import": "2.22.1",
|
|
16
|
+
"eslint-plugin-markdown": "1.0.2",
|
|
17
|
+
"eslint-plugin-node": "11.1.0",
|
|
18
|
+
"eslint-plugin-promise": "4.3.1",
|
|
19
|
+
"eslint-plugin-standard": "4.1.0",
|
|
20
|
+
"mocha": "9.2.0",
|
|
21
|
+
"nyc": "15.1.0"
|
|
18
22
|
},
|
|
19
23
|
"files": [
|
|
20
24
|
"LICENSE",
|
|
@@ -27,7 +31,7 @@
|
|
|
27
31
|
"scripts": {
|
|
28
32
|
"lint": "eslint --plugin markdown --ext js,md .",
|
|
29
33
|
"test": "mocha --reporter spec --check-leaks --bail test/",
|
|
30
|
-
"test-
|
|
31
|
-
"test-
|
|
34
|
+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
|
35
|
+
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
|
32
36
|
}
|
|
33
37
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modelcontextprotocol/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"description": "Model Context Protocol implementation for TypeScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Anthropic, PBC (https://anthropic.com)",
|
|
@@ -88,7 +88,8 @@
|
|
|
88
88
|
"lint": "eslint src/ && prettier --check .",
|
|
89
89
|
"lint:fix": "eslint src/ --fix && prettier --write .",
|
|
90
90
|
"check": "npm run typecheck && npm run lint",
|
|
91
|
-
"test": "vitest run",
|
|
91
|
+
"test": "vitest run --exclude \"test/e2e/**\"",
|
|
92
|
+
"test:e2e": "vitest run test/e2e",
|
|
92
93
|
"test:watch": "vitest",
|
|
93
94
|
"start": "npm run server",
|
|
94
95
|
"server": "tsx watch --clear-screen=false scripts/cli.ts server",
|
|
@@ -100,7 +101,7 @@
|
|
|
100
101
|
"test:conformance:client:all": "npx @modelcontextprotocol/conformance client --command 'npx tsx test/conformance/src/everythingClient.ts' --suite all --expected-failures test/conformance/conformance-baseline.yml"
|
|
101
102
|
},
|
|
102
103
|
"dependencies": {
|
|
103
|
-
"@hono/node-server": "^1.19.9",
|
|
104
|
+
"@hono/node-server": "^1.19.9 || ^2.0.5",
|
|
104
105
|
"ajv": "^8.17.1",
|
|
105
106
|
"ajv-formats": "^3.0.1",
|
|
106
107
|
"content-type": "^1.0.5",
|
|
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Mon, 27 Jul 2026 17:32:10 GMT
|
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
13
|
|
|
14
14
|
# Credits
|
|
@@ -1185,7 +1185,7 @@ declare module "node:crypto" {
|
|
|
1185
1185
|
* and it will be impossible to extract the private key from the returned object.
|
|
1186
1186
|
* @since v11.6.0
|
|
1187
1187
|
*/
|
|
1188
|
-
function createPublicKey(key: PublicKeyInput | RawPublicKeyInput | JsonWebKeyInput |
|
|
1188
|
+
function createPublicKey(key: PublicKeyInput | RawPublicKeyInput | JsonWebKeyInput | KeyLike): KeyObject;
|
|
1189
1189
|
/**
|
|
1190
1190
|
* Creates and returns a new key object containing a secret key for symmetric
|
|
1191
1191
|
* encryption or `Hmac`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "26.1.
|
|
3
|
+
"version": "26.1.2",
|
|
4
4
|
"description": "TypeScript definitions for node",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -150,6 +150,6 @@
|
|
|
150
150
|
"undici-types": "~8.3.0"
|
|
151
151
|
},
|
|
152
152
|
"peerDependencies": {},
|
|
153
|
-
"typesPublisherContentHash": "
|
|
153
|
+
"typesPublisherContentHash": "359a01a58cecf5a30fb7b7a7b10c4f5c332339421ef5cbc9932fc492f472a5b4",
|
|
154
154
|
"typeScriptVersion": "5.6"
|
|
155
155
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
1.20.6 / 2026-07-09
|
|
2
|
+
===================
|
|
3
|
+
* fix: improve `limit` option validation (#698)
|
|
4
|
+
* Invalid `limit` values (e.g. unparseable strings or `NaN`) now throw instead of being silently ignored, which previously disabled size limit enforcement
|
|
5
|
+
* `null` and `undefined` fall back to the default 100kb limit
|
|
6
|
+
|
|
1
7
|
1.20.5 / 2026-04-24
|
|
2
8
|
===================
|
|
3
|
-
* refactor(json): simplify strict mode error string construction
|
|
9
|
+
* refactor(json): simplify strict mode error string construction
|
|
4
10
|
* fix: extended urlencoded parsing of arrays with >100 elements (#716)
|
|
5
11
|
* deps: qs@~6.15.1
|
|
6
12
|
|
|
@@ -53,15 +53,19 @@ var JSON_SYNTAX_REGEXP = /#+/g
|
|
|
53
53
|
function json (options) {
|
|
54
54
|
var opts = options || {}
|
|
55
55
|
|
|
56
|
-
var limit = typeof opts.limit
|
|
57
|
-
?
|
|
58
|
-
: opts.limit
|
|
56
|
+
var limit = typeof opts.limit === 'undefined' || opts.limit === null
|
|
57
|
+
? 102400 // 100kb default
|
|
58
|
+
: bytes.parse(opts.limit)
|
|
59
59
|
var inflate = opts.inflate !== false
|
|
60
60
|
var reviver = opts.reviver
|
|
61
61
|
var strict = opts.strict !== false
|
|
62
62
|
var type = opts.type || 'application/json'
|
|
63
63
|
var verify = opts.verify || false
|
|
64
64
|
|
|
65
|
+
if (limit === null) {
|
|
66
|
+
throw new TypeError('option limit "' + String(opts.limit) + '" is invalid')
|
|
67
|
+
}
|
|
68
|
+
|
|
65
69
|
if (verify !== false && typeof verify !== 'function') {
|
|
66
70
|
throw new TypeError('option verify must be function')
|
|
67
71
|
}
|
|
@@ -33,12 +33,16 @@ function raw (options) {
|
|
|
33
33
|
var opts = options || {}
|
|
34
34
|
|
|
35
35
|
var inflate = opts.inflate !== false
|
|
36
|
-
var limit = typeof opts.limit
|
|
37
|
-
?
|
|
38
|
-
: opts.limit
|
|
36
|
+
var limit = typeof opts.limit === 'undefined' || opts.limit === null
|
|
37
|
+
? 102400 // 100kb default
|
|
38
|
+
: bytes.parse(opts.limit)
|
|
39
39
|
var type = opts.type || 'application/octet-stream'
|
|
40
40
|
var verify = opts.verify || false
|
|
41
41
|
|
|
42
|
+
if (limit === null) {
|
|
43
|
+
throw new TypeError('option limit "' + String(opts.limit) + '" is invalid')
|
|
44
|
+
}
|
|
45
|
+
|
|
42
46
|
if (verify !== false && typeof verify !== 'function') {
|
|
43
47
|
throw new TypeError('option verify must be function')
|
|
44
48
|
}
|
|
@@ -35,12 +35,16 @@ function text (options) {
|
|
|
35
35
|
|
|
36
36
|
var defaultCharset = opts.defaultCharset || 'utf-8'
|
|
37
37
|
var inflate = opts.inflate !== false
|
|
38
|
-
var limit = typeof opts.limit
|
|
39
|
-
?
|
|
40
|
-
: opts.limit
|
|
38
|
+
var limit = typeof opts.limit === 'undefined' || opts.limit === null
|
|
39
|
+
? 102400 // 100kb default
|
|
40
|
+
: bytes.parse(opts.limit)
|
|
41
41
|
var type = opts.type || 'text/plain'
|
|
42
42
|
var verify = opts.verify || false
|
|
43
43
|
|
|
44
|
+
if (limit === null) {
|
|
45
|
+
throw new TypeError('option limit "' + String(opts.limit) + '" is invalid')
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
if (verify !== false && typeof verify !== 'function') {
|
|
45
49
|
throw new TypeError('option verify must be function')
|
|
46
50
|
}
|
|
@@ -50,12 +50,16 @@ function urlencoded (options) {
|
|
|
50
50
|
|
|
51
51
|
var extended = opts.extended !== false
|
|
52
52
|
var inflate = opts.inflate !== false
|
|
53
|
-
var limit = typeof opts.limit
|
|
54
|
-
?
|
|
55
|
-
: opts.limit
|
|
53
|
+
var limit = typeof opts.limit === 'undefined' || opts.limit === null
|
|
54
|
+
? 102400 // 100kb default
|
|
55
|
+
: bytes.parse(opts.limit)
|
|
56
56
|
var type = opts.type || 'application/x-www-form-urlencoded'
|
|
57
57
|
var verify = opts.verify || false
|
|
58
58
|
|
|
59
|
+
if (limit === null) {
|
|
60
|
+
throw new TypeError('option limit "' + String(opts.limit) + '" is invalid')
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
if (verify !== false && typeof verify !== 'function') {
|
|
60
64
|
throw new TypeError('option verify must be function')
|
|
61
65
|
}
|