@zuplo/cli 7.15.14 → 7.15.17
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/node_modules/@posthog/core/dist/featureFlagUtils.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/featureFlagUtils.js +10 -3
- package/node_modules/@posthog/core/dist/featureFlagUtils.mjs +10 -3
- package/node_modules/@posthog/core/dist/posthog-core.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core.js +7 -4
- package/node_modules/@posthog/core/dist/posthog-core.mjs +7 -4
- package/node_modules/@posthog/core/dist/types.d.ts +2 -0
- package/node_modules/@posthog/core/dist/types.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/types.js +1 -0
- package/node_modules/@posthog/core/dist/types.mjs +1 -0
- package/node_modules/@posthog/core/package.json +2 -2
- package/node_modules/@posthog/core/src/featureFlagUtils.ts +17 -12
- package/node_modules/@posthog/core/src/posthog-core.ts +19 -4
- package/node_modules/@posthog/core/src/types.ts +2 -0
- package/node_modules/@zuplo/core/customer.cli.minified.js +305 -305
- package/node_modules/@zuplo/core/index.minified.js +312 -312
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/out/esm/{chunk-6YAK7LGJ.js → chunk-BJ3PRHGL.js} +2 -2
- package/node_modules/@zuplo/otel/out/esm/chunk-BJ3PRHGL.js.map +1 -0
- package/node_modules/@zuplo/otel/out/esm/index.js +1 -1
- package/node_modules/@zuplo/otel/out/types/index.d.ts +10 -0
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-AJ3MMWJS.js → chunk-5XXEIH5B.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/chunk-6KHAYHSW.js +274 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-6KHAYHSW.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-T2WKOG7J.js → chunk-APWLPHXH.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/chunk-I65Y62VQ.js +24 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-G42UYZ6V.js.map → chunk-I65Y62VQ.js.map} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-KZBZ5KM5.js +188 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-KZBZ5KM5.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-TOJD4RET.js → chunk-MWNVPFFM.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp/messages/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +32 -0
- package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +220 -0
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/node_modules/hono/dist/adapter/bun/websocket.js +19 -4
- package/node_modules/hono/dist/adapter/lambda-edge/handler.js +4 -0
- package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +19 -4
- package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +4 -0
- package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +5 -0
- package/node_modules/hono/dist/cjs/helper/proxy/index.js +2 -0
- package/node_modules/hono/dist/cjs/jsx/dom/components.js +1 -1
- package/node_modules/hono/dist/cjs/jsx/dom/hooks/index.js +5 -2
- package/node_modules/hono/dist/cjs/jsx/dom/intrinsic-element/components.js +8 -5
- package/node_modules/hono/dist/cjs/jsx/dom/render.js +9 -3
- package/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +1 -0
- package/node_modules/hono/dist/cjs/middleware/combine/index.js +4 -0
- package/node_modules/hono/dist/cjs/middleware/language/language.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/method-override/index.js +35 -12
- package/node_modules/hono/dist/cjs/middleware/request-id/request-id.js +3 -3
- package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +6 -3
- package/node_modules/hono/dist/cjs/utils/body.js +1 -0
- package/node_modules/hono/dist/cjs/utils/html.js +5 -0
- package/node_modules/hono/dist/cjs/utils/jwt/jwt.js +7 -5
- package/node_modules/hono/dist/helper/accepts/accepts.js +5 -0
- package/node_modules/hono/dist/helper/proxy/index.js +2 -0
- package/node_modules/hono/dist/jsx/dom/components.js +2 -2
- package/node_modules/hono/dist/jsx/dom/hooks/index.js +5 -2
- package/node_modules/hono/dist/jsx/dom/intrinsic-element/components.js +8 -5
- package/node_modules/hono/dist/jsx/dom/render.js +9 -3
- package/node_modules/hono/dist/middleware/basic-auth/index.js +1 -0
- package/node_modules/hono/dist/middleware/combine/index.js +4 -0
- package/node_modules/hono/dist/middleware/language/language.js +1 -1
- package/node_modules/hono/dist/middleware/method-override/index.js +35 -12
- package/node_modules/hono/dist/middleware/request-id/request-id.js +3 -3
- package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +6 -3
- package/node_modules/hono/dist/types/helper/accepts/accepts.d.ts +5 -0
- package/node_modules/hono/dist/types/jsx/base.d.ts +2 -1
- package/node_modules/hono/dist/types/middleware/basic-auth/index.d.ts +1 -0
- package/node_modules/hono/dist/types/middleware/request-id/request-id.d.ts +3 -3
- package/node_modules/hono/dist/types/middleware/secure-headers/secure-headers.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/jwt/jwt.d.ts +4 -2
- package/node_modules/hono/dist/types/utils/types.d.ts +12 -2
- package/node_modules/hono/dist/utils/body.js +1 -0
- package/node_modules/hono/dist/utils/html.js +5 -0
- package/node_modules/hono/dist/utils/jwt/jwt.js +7 -5
- package/node_modules/hono/package.json +1 -1
- package/node_modules/strip-json-comments/index.d.ts +3 -1
- package/node_modules/strip-json-comments/index.js +9 -22
- package/node_modules/strip-json-comments/package.json +23 -19
- package/package.json +11 -11
- package/node_modules/@zuplo/otel/out/esm/chunk-6YAK7LGJ.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-24DRL32G.js +0 -431
- package/node_modules/@zuplo/runtime/out/esm/chunk-24DRL32G.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-BH4DKEES.js +0 -13
- package/node_modules/@zuplo/runtime/out/esm/chunk-BH4DKEES.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-G42UYZ6V.js +0 -24
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-AJ3MMWJS.js.map → chunk-5XXEIH5B.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-24DRL32G.js.LEGAL.txt → chunk-6KHAYHSW.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-T2WKOG7J.js.map → chunk-APWLPHXH.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-G42UYZ6V.js.LEGAL.txt → chunk-I65Y62VQ.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-TOJD4RET.js.map → chunk-MWNVPFFM.js.map} +0 -0
|
@@ -2,6 +2,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_utils_body = require("../../utils/body.js");
|
|
3
3
|
//#region src/middleware/method-override/index.ts
|
|
4
4
|
const DEFAULT_METHOD_FORM_NAME = "_method";
|
|
5
|
+
const isBodylessMethod = (method) => /^(?:GET|HEAD)$/i.test(method);
|
|
6
|
+
const withoutBodyHeaders = (headers) => {
|
|
7
|
+
const newHeaders = new Headers(headers);
|
|
8
|
+
newHeaders.delete("content-type");
|
|
9
|
+
newHeaders.delete("content-length");
|
|
10
|
+
return newHeaders;
|
|
11
|
+
};
|
|
5
12
|
/**
|
|
6
13
|
* Method Override Middleware for Hono.
|
|
7
14
|
*
|
|
@@ -38,16 +45,21 @@ const methodOverride = (options) => async function methodOverride(c, next) {
|
|
|
38
45
|
if (contentType?.startsWith("multipart/form-data")) {
|
|
39
46
|
const method = (await clonedRequest.formData()).get(methodFormName);
|
|
40
47
|
if (method) {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
newHeaders.delete("content-type");
|
|
45
|
-
newHeaders.delete("content-length");
|
|
46
|
-
const request = new Request(c.req.url, {
|
|
47
|
-
body: newForm,
|
|
48
|
+
const newHeaders = withoutBodyHeaders(clonedRequest.headers);
|
|
49
|
+
let request;
|
|
50
|
+
if (isBodylessMethod(method)) request = new Request(c.req.url, {
|
|
48
51
|
headers: newHeaders,
|
|
49
52
|
method
|
|
50
53
|
});
|
|
54
|
+
else {
|
|
55
|
+
const newForm = await newRequest.formData();
|
|
56
|
+
newForm.delete(methodFormName);
|
|
57
|
+
request = new Request(c.req.url, {
|
|
58
|
+
body: newForm,
|
|
59
|
+
headers: newHeaders,
|
|
60
|
+
method
|
|
61
|
+
});
|
|
62
|
+
}
|
|
51
63
|
return app.fetch(request, c.env, getExecutionCtx(c));
|
|
52
64
|
}
|
|
53
65
|
}
|
|
@@ -56,9 +68,14 @@ const methodOverride = (options) => async function methodOverride(c, next) {
|
|
|
56
68
|
const method = params[methodFormName];
|
|
57
69
|
if (method) {
|
|
58
70
|
delete params[methodFormName];
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
71
|
+
const newHeaders = new Headers(newRequest.headers);
|
|
72
|
+
newHeaders.delete("content-length");
|
|
73
|
+
const request = isBodylessMethod(method) ? new Request(c.req.url, {
|
|
74
|
+
headers: withoutBodyHeaders(newHeaders),
|
|
75
|
+
method
|
|
76
|
+
}) : new Request(newRequest, {
|
|
77
|
+
body: new URLSearchParams(params),
|
|
78
|
+
headers: newHeaders,
|
|
62
79
|
method
|
|
63
80
|
});
|
|
64
81
|
return app.fetch(request, c.env, getExecutionCtx(c));
|
|
@@ -70,7 +87,10 @@ const methodOverride = (options) => async function methodOverride(c, next) {
|
|
|
70
87
|
if (method) {
|
|
71
88
|
const newHeaders = new Headers(c.req.raw.headers);
|
|
72
89
|
newHeaders.delete(headerName);
|
|
73
|
-
const request = new Request(c.req.
|
|
90
|
+
const request = isBodylessMethod(method) ? new Request(c.req.url, {
|
|
91
|
+
headers: withoutBodyHeaders(newHeaders),
|
|
92
|
+
method
|
|
93
|
+
}) : new Request(c.req.raw, {
|
|
74
94
|
headers: newHeaders,
|
|
75
95
|
method
|
|
76
96
|
});
|
|
@@ -82,7 +102,10 @@ const methodOverride = (options) => async function methodOverride(c, next) {
|
|
|
82
102
|
if (method) {
|
|
83
103
|
const url = new URL(c.req.url);
|
|
84
104
|
url.searchParams.delete(queryName);
|
|
85
|
-
const requestInit = {
|
|
105
|
+
const requestInit = isBodylessMethod(method) ? {
|
|
106
|
+
headers: withoutBodyHeaders(c.req.raw.headers),
|
|
107
|
+
method
|
|
108
|
+
} : {
|
|
86
109
|
body: c.req.raw.body,
|
|
87
110
|
headers: c.req.raw.headers,
|
|
88
111
|
method,
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
/**
|
|
4
4
|
* Request ID Middleware for Hono.
|
|
5
5
|
*
|
|
6
|
-
* @param {
|
|
6
|
+
* @param {RequestIdOptions} [options] - Options for Request ID middleware.
|
|
7
7
|
* @param {number} [options.limitLength=255] - The maximum length of request id.
|
|
8
|
-
* @param {string} [options.headerName=X-Request-Id] - The header name used in request id.
|
|
9
|
-
* @param {
|
|
8
|
+
* @param {string} [options.headerName='X-Request-Id'] - The header name used in request id.
|
|
9
|
+
* @param {(c: Context) => string} [options.generator=() => crypto.randomUUID()] - The request id generation function.
|
|
10
10
|
*
|
|
11
11
|
* @returns {MiddlewareHandler} The middleware handler function.
|
|
12
12
|
*
|
|
@@ -29,7 +29,8 @@ const DEFAULT_OPTIONS = {
|
|
|
29
29
|
xPermittedCrossDomainPolicies: true,
|
|
30
30
|
xXssProtection: true,
|
|
31
31
|
removePoweredBy: true,
|
|
32
|
-
permissionsPolicy: {}
|
|
32
|
+
permissionsPolicy: {},
|
|
33
|
+
overwrite: true
|
|
33
34
|
};
|
|
34
35
|
const generateNonce = () => {
|
|
35
36
|
const arrayBuffer = /* @__PURE__ */ new Uint8Array(16);
|
|
@@ -67,6 +68,7 @@ const NONCE = (ctx) => {
|
|
|
67
68
|
* @param {overridableHeader} [customOptions.xXssProtection=true] - Settings for the X-XSS-Protection header.
|
|
68
69
|
* @param {boolean} [customOptions.removePoweredBy=true] - Settings for remove X-Powered-By header.
|
|
69
70
|
* @param {PermissionsPolicyOptions} [customOptions.permissionsPolicy] - Settings for the Permissions-Policy header.
|
|
71
|
+
* @param {boolean} [customOptions.overwrite=true] - Whether to replace a header that the response already has. Set `false` to keep a header that a handler set itself.
|
|
70
72
|
* @returns {MiddlewareHandler} The middleware handler function.
|
|
71
73
|
*
|
|
72
74
|
* @example
|
|
@@ -98,7 +100,7 @@ const secureHeaders = (customOptions) => {
|
|
|
98
100
|
return async function secureHeaders(ctx, next) {
|
|
99
101
|
const headersToSetForReq = callbacks.length === 0 ? headersToSet : callbacks.reduce((acc, cb) => cb(ctx, acc), headersToSet);
|
|
100
102
|
await next();
|
|
101
|
-
setHeaders(ctx, headersToSetForReq);
|
|
103
|
+
setHeaders(ctx, headersToSetForReq, options.overwrite !== false);
|
|
102
104
|
if (options?.removePoweredBy) ctx.res.headers.delete("X-Powered-By");
|
|
103
105
|
};
|
|
104
106
|
};
|
|
@@ -156,8 +158,9 @@ function getReportingEndpoints(reportingEndpoints = []) {
|
|
|
156
158
|
function getReportToOptions(reportTo = []) {
|
|
157
159
|
return reportTo.map((option) => JSON.stringify(option)).join(", ");
|
|
158
160
|
}
|
|
159
|
-
function setHeaders(ctx, headersToSet) {
|
|
161
|
+
function setHeaders(ctx, headersToSet, overwrite) {
|
|
160
162
|
headersToSet.forEach(([header, value]) => {
|
|
163
|
+
if (!overwrite && ctx.res.headers.has(header)) return;
|
|
161
164
|
ctx.res.headers.set(header, value);
|
|
162
165
|
});
|
|
163
166
|
}
|
|
@@ -73,6 +73,7 @@ const handleParsingAllValues = (form, key, value) => {
|
|
|
73
73
|
* @param {BodyData} form - The form data object.
|
|
74
74
|
* @param {string} key - The dot notation key.
|
|
75
75
|
* @param {BodyDataValue} value - The value to assign.
|
|
76
|
+
* @param {{ count: number }} state - The state object tracking nesting depth.
|
|
76
77
|
*/
|
|
77
78
|
const handleParsingNestedValues = (form, key, value, state) => {
|
|
78
79
|
if (/(?:^|\.)__proto__\./.test(key)) return;
|
|
@@ -25,6 +25,11 @@ const stringBufferToString = async (buffer, callbacks) => {
|
|
|
25
25
|
i--;
|
|
26
26
|
if (i < 0) break;
|
|
27
27
|
let r = resolvedBuffer[i];
|
|
28
|
+
if (r == null || typeof r === "boolean") continue;
|
|
29
|
+
if (typeof r === "number") {
|
|
30
|
+
str += r;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
28
33
|
if (typeof r === "object") callbacks.push(...r.callbacks || []);
|
|
29
34
|
const isEscaped = r.isEscaped;
|
|
30
35
|
r = await (typeof r === "object" ? r.toString() : r);
|
|
@@ -13,10 +13,12 @@ const require_utils_jwt_jws = require("./jws.js");
|
|
|
13
13
|
const encodeJwtPart = (part) => require_utils_encode.encodeBase64Url(require_utils_jwt_utf8.utf8Encoder.encode(JSON.stringify(part)).buffer).replace(/=/g, "");
|
|
14
14
|
const encodeSignaturePart = (buf) => require_utils_encode.encodeBase64Url(buf).replace(/=/g, "");
|
|
15
15
|
const decodeJwtPart = (part) => JSON.parse(require_utils_jwt_utf8.utf8Decoder.decode(require_utils_encode.decodeBase64Url(part)));
|
|
16
|
-
|
|
16
|
+
const normalizeTyp = (typ) => typ.toLowerCase().replace(/^application\//, "");
|
|
17
|
+
const isTyp = (value, expected) => typeof value === "string" && [expected].flat().some((typ) => normalizeTyp(typ) === normalizeTyp(value));
|
|
18
|
+
function isTokenHeader(obj, typ) {
|
|
17
19
|
if (typeof obj === "object" && obj !== null) {
|
|
18
20
|
const objWithAlg = obj;
|
|
19
|
-
return "alg" in objWithAlg && Object.values(require_utils_jwt_jwa.AlgorithmTypes).includes(objWithAlg.alg) && (!("typ" in objWithAlg) || objWithAlg.typ
|
|
21
|
+
return "alg" in objWithAlg && Object.values(require_utils_jwt_jwa.AlgorithmTypes).includes(objWithAlg.alg) && (typ === void 0 ? !("typ" in objWithAlg) || isTyp(objWithAlg.typ, "JWT") : isTyp(objWithAlg.typ, typ)) && !("crit" in objWithAlg);
|
|
20
22
|
}
|
|
21
23
|
return false;
|
|
22
24
|
}
|
|
@@ -40,12 +42,12 @@ const sign = async (payload, privateKey, alg = "HS256") => {
|
|
|
40
42
|
};
|
|
41
43
|
const verify = async (token, publicKey, algOrOptions) => {
|
|
42
44
|
if (!algOrOptions) throw new require_utils_jwt_types.JwtAlgorithmRequired();
|
|
43
|
-
const { alg, iss, nbf = true, exp = true, iat = true, aud } = typeof algOrOptions === "string" ? { alg: algOrOptions } : algOrOptions;
|
|
45
|
+
const { alg, iss, nbf = true, exp = true, iat = true, aud, typ } = typeof algOrOptions === "string" ? { alg: algOrOptions } : algOrOptions;
|
|
44
46
|
if (!alg) throw new require_utils_jwt_types.JwtAlgorithmRequired();
|
|
45
47
|
const tokenParts = token.split(".");
|
|
46
48
|
if (tokenParts.length !== 3) throw new require_utils_jwt_types.JwtTokenInvalid(token);
|
|
47
49
|
const { header, payload } = decode(token);
|
|
48
|
-
if (!isTokenHeader(header)) throw new require_utils_jwt_types.JwtHeaderInvalid(header);
|
|
50
|
+
if (!isTokenHeader(header, typ)) throw new require_utils_jwt_types.JwtHeaderInvalid(header);
|
|
49
51
|
if (header.alg !== alg) throw new require_utils_jwt_types.JwtAlgorithmMismatch(alg, header.alg);
|
|
50
52
|
const now = Math.floor(Date.now() / 1e3);
|
|
51
53
|
if (nbf && payload.nbf !== void 0) {
|
|
@@ -85,7 +87,7 @@ const symmetricAlgorithms = [
|
|
|
85
87
|
const verifyWithJwks = async (token, options, init) => {
|
|
86
88
|
const verifyOpts = options.verification || {};
|
|
87
89
|
const header = decodeHeader(token);
|
|
88
|
-
if (!isTokenHeader(header)) throw new require_utils_jwt_types.JwtHeaderInvalid(header);
|
|
90
|
+
if (!isTokenHeader(header, verifyOpts.typ)) throw new require_utils_jwt_types.JwtHeaderInvalid(header);
|
|
89
91
|
if (!header.kid) throw new require_utils_jwt_types.JwtHeaderRequiresKid(header);
|
|
90
92
|
if (symmetricAlgorithms.includes(header.alg)) throw new require_utils_jwt_types.JwtSymmetricAlgorithmNotAllowed(header.alg);
|
|
91
93
|
if (!options.allowedAlgorithms.includes(header.alg)) throw new require_utils_jwt_types.JwtAlgorithmNotAllowed(header.alg, options.allowedAlgorithms);
|
|
@@ -32,6 +32,11 @@ const defaultMatch = (accepts, config) => {
|
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
34
|
* Match the accept header with the given options.
|
|
35
|
+
*
|
|
36
|
+
* @param {Context} c - The context of the request.
|
|
37
|
+
* @param {acceptsOptions} options - The options for matching the accept header.
|
|
38
|
+
* @returns {string} The matched supported value or the default value.
|
|
39
|
+
*
|
|
35
40
|
* @example
|
|
36
41
|
* ```ts
|
|
37
42
|
* app.get('/users', (c) => {
|
|
@@ -99,6 +99,8 @@ const proxy = async (input, proxyInit) => {
|
|
|
99
99
|
...buildRequestInitFromRequest(raw, strictConnectionProcessing),
|
|
100
100
|
...preprocessRequestInit(requestInit)
|
|
101
101
|
});
|
|
102
|
+
req.headers.delete("transfer-encoding");
|
|
103
|
+
req.headers.delete("keep-alive");
|
|
102
104
|
req.headers.delete("accept-encoding");
|
|
103
105
|
const res = await (customFetch || fetch)(req);
|
|
104
106
|
const resHeaders = new Headers(res.headers);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DOM_ERROR_HANDLER } from "../constants.js";
|
|
2
|
-
import { Fragment } from "./jsx-dev-runtime.js";
|
|
2
|
+
import { Fragment, jsxDEV } from "./jsx-dev-runtime.js";
|
|
3
3
|
import "./jsx-runtime.js";
|
|
4
4
|
//#region src/jsx/dom/components.ts
|
|
5
5
|
const ErrorBoundary = (({ children, fallback, fallbackRender, onError }) => {
|
|
@@ -16,7 +16,7 @@ const Suspense = (({ children, fallback }) => {
|
|
|
16
16
|
res[DOM_ERROR_HANDLER] = (err, retry) => {
|
|
17
17
|
if (!(err instanceof Promise)) throw err;
|
|
18
18
|
err.finally(retry);
|
|
19
|
-
return fallback;
|
|
19
|
+
return fallback || jsxDEV(Fragment, { children: fallback });
|
|
20
20
|
};
|
|
21
21
|
return res;
|
|
22
22
|
});
|
|
@@ -15,7 +15,10 @@ const FormContext = createContext({
|
|
|
15
15
|
const actions = /* @__PURE__ */ new Set();
|
|
16
16
|
const registerAction = (action) => {
|
|
17
17
|
actions.add(action);
|
|
18
|
-
|
|
18
|
+
const remove = () => {
|
|
19
|
+
actions.delete(action);
|
|
20
|
+
};
|
|
21
|
+
action.then(remove, remove);
|
|
19
22
|
};
|
|
20
23
|
/**
|
|
21
24
|
* This hook returns the current form status
|
|
@@ -33,7 +36,7 @@ const useFormStatus = () => {
|
|
|
33
36
|
*/
|
|
34
37
|
const useOptimistic = (state, updateState) => {
|
|
35
38
|
const [optimisticState, setOptimisticState] = useState(state);
|
|
36
|
-
if (actions.size > 0) Promise.
|
|
39
|
+
if (actions.size > 0) Promise.allSettled(actions).then(() => {
|
|
37
40
|
setOptimisticState(state);
|
|
38
41
|
});
|
|
39
42
|
else setOptimisticState(state);
|
|
@@ -217,12 +217,15 @@ const form = (props) => {
|
|
|
217
217
|
ev.preventDefault();
|
|
218
218
|
const formData = new FormData(ev.target);
|
|
219
219
|
setState([formData, true]);
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
220
|
+
try {
|
|
221
|
+
const actionRes = currentAction(formData);
|
|
222
|
+
if (actionRes instanceof Promise) {
|
|
223
|
+
registerAction(actionRes);
|
|
224
|
+
await actionRes;
|
|
225
|
+
}
|
|
226
|
+
} finally {
|
|
227
|
+
setState([null, true]);
|
|
224
228
|
}
|
|
225
|
-
setState([null, true]);
|
|
226
229
|
}, []);
|
|
227
230
|
const ref = composeRef(props.ref, (el) => {
|
|
228
231
|
el.addEventListener("submit", onSubmit);
|
|
@@ -155,7 +155,11 @@ const findInsertBefore = (node) => {
|
|
|
155
155
|
};
|
|
156
156
|
const removeNode = (node) => {
|
|
157
157
|
if (!isNodeString(node)) {
|
|
158
|
-
node[DOM_STASH]
|
|
158
|
+
const stash = node[DOM_STASH];
|
|
159
|
+
if (stash?.[1][1]) {
|
|
160
|
+
stash[1][1].forEach((data) => data[2]?.());
|
|
161
|
+
delete stash[1][1];
|
|
162
|
+
}
|
|
159
163
|
refCleanupMap.get(node.e)?.();
|
|
160
164
|
if (node.p === 2) node.vC?.forEach((n) => n.p = 2);
|
|
161
165
|
node.vC?.forEach(removeNode);
|
|
@@ -212,8 +216,9 @@ const applyNodeObject = (node, container, isNew) => {
|
|
|
212
216
|
child.d = false;
|
|
213
217
|
el = child.e ||= document.createTextNode(child.t);
|
|
214
218
|
} else {
|
|
219
|
+
const isCreated = !child.e;
|
|
215
220
|
el = child.e ||= child.n ? document.createElementNS(child.n, child.tag) : document.createElement(child.tag);
|
|
216
|
-
applyProps(el, child.props, child.pP);
|
|
221
|
+
applyProps(el, child.props, isCreated ? void 0 : child.pP);
|
|
217
222
|
applyNodeObject(child, el, isNewLocal);
|
|
218
223
|
if (child.tag === "select") applySelectValue(el, child.props);
|
|
219
224
|
}
|
|
@@ -343,6 +348,7 @@ const build = (context, node, children) => {
|
|
|
343
348
|
prevNode = child;
|
|
344
349
|
}
|
|
345
350
|
}
|
|
351
|
+
if (prevNode && !prevNode.s) for (let p = prevNode; p && !isNodeString(p); p = p.vC?.at(-1)) p.nN = node.nN;
|
|
346
352
|
oldVChildren = oldChildrenByKey ? [...oldChildrenByKey.values()] : oldVChildren;
|
|
347
353
|
node.vR = buildWithPreviousChildren ? [...node.vC, ...oldVChildren || []] : oldVChildren || [];
|
|
348
354
|
node.vC = vChildren;
|
|
@@ -377,7 +383,7 @@ const build = (context, node, children) => {
|
|
|
377
383
|
if (context[0] === 1) context[1] = true;
|
|
378
384
|
else {
|
|
379
385
|
build(context, errorHandlerNode, [fallback]);
|
|
380
|
-
if ((errorHandler.length === 1 || context !== errorHandlerContext) && errorHandlerNode.c) {
|
|
386
|
+
if ((errorHandler.length === 1 || context !== errorHandlerContext) && errorHandlerNode.c && !context[5].some(([, , n]) => n === errorHandlerNode)) {
|
|
381
387
|
apply(errorHandlerNode, errorHandlerNode.c, false);
|
|
382
388
|
return;
|
|
383
389
|
}
|
|
@@ -15,6 +15,7 @@ import { auth } from "../../utils/basic-auth.js";
|
|
|
15
15
|
* @param {Function} [options.verifyUser] - The function to verify user credentials.
|
|
16
16
|
* @param {string | object | MessageFunction} [options.invalidUserMessage="Unauthorized"] - The invalid user message.
|
|
17
17
|
* @param {Function} [options.onAuthSuccess] - Callback function called on successful authentication.
|
|
18
|
+
* @param {...{ username: string; password: string }} [users] - Additional user credentials.
|
|
18
19
|
* @returns {MiddlewareHandler} The middleware handler function.
|
|
19
20
|
* @throws {HTTPException} If neither "username and password" nor "verifyUser" options are provided.
|
|
20
21
|
*
|
|
@@ -92,6 +92,10 @@ const every = (...middleware) => {
|
|
|
92
92
|
c.req.routeIndex = currentRouteIndex;
|
|
93
93
|
const res = await m(c, next);
|
|
94
94
|
if (res === false) throw new Error("Unmet condition");
|
|
95
|
+
if (res === true) {
|
|
96
|
+
if (!c.finalized) await next();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
95
99
|
return res;
|
|
96
100
|
}]]))(c, next);
|
|
97
101
|
};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { parseBody } from "../../utils/body.js";
|
|
2
2
|
//#region src/middleware/method-override/index.ts
|
|
3
3
|
const DEFAULT_METHOD_FORM_NAME = "_method";
|
|
4
|
+
const isBodylessMethod = (method) => /^(?:GET|HEAD)$/i.test(method);
|
|
5
|
+
const withoutBodyHeaders = (headers) => {
|
|
6
|
+
const newHeaders = new Headers(headers);
|
|
7
|
+
newHeaders.delete("content-type");
|
|
8
|
+
newHeaders.delete("content-length");
|
|
9
|
+
return newHeaders;
|
|
10
|
+
};
|
|
4
11
|
/**
|
|
5
12
|
* Method Override Middleware for Hono.
|
|
6
13
|
*
|
|
@@ -37,16 +44,21 @@ const methodOverride = (options) => async function methodOverride(c, next) {
|
|
|
37
44
|
if (contentType?.startsWith("multipart/form-data")) {
|
|
38
45
|
const method = (await clonedRequest.formData()).get(methodFormName);
|
|
39
46
|
if (method) {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
newHeaders.delete("content-type");
|
|
44
|
-
newHeaders.delete("content-length");
|
|
45
|
-
const request = new Request(c.req.url, {
|
|
46
|
-
body: newForm,
|
|
47
|
+
const newHeaders = withoutBodyHeaders(clonedRequest.headers);
|
|
48
|
+
let request;
|
|
49
|
+
if (isBodylessMethod(method)) request = new Request(c.req.url, {
|
|
47
50
|
headers: newHeaders,
|
|
48
51
|
method
|
|
49
52
|
});
|
|
53
|
+
else {
|
|
54
|
+
const newForm = await newRequest.formData();
|
|
55
|
+
newForm.delete(methodFormName);
|
|
56
|
+
request = new Request(c.req.url, {
|
|
57
|
+
body: newForm,
|
|
58
|
+
headers: newHeaders,
|
|
59
|
+
method
|
|
60
|
+
});
|
|
61
|
+
}
|
|
50
62
|
return app.fetch(request, c.env, getExecutionCtx(c));
|
|
51
63
|
}
|
|
52
64
|
}
|
|
@@ -55,9 +67,14 @@ const methodOverride = (options) => async function methodOverride(c, next) {
|
|
|
55
67
|
const method = params[methodFormName];
|
|
56
68
|
if (method) {
|
|
57
69
|
delete params[methodFormName];
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
70
|
+
const newHeaders = new Headers(newRequest.headers);
|
|
71
|
+
newHeaders.delete("content-length");
|
|
72
|
+
const request = isBodylessMethod(method) ? new Request(c.req.url, {
|
|
73
|
+
headers: withoutBodyHeaders(newHeaders),
|
|
74
|
+
method
|
|
75
|
+
}) : new Request(newRequest, {
|
|
76
|
+
body: new URLSearchParams(params),
|
|
77
|
+
headers: newHeaders,
|
|
61
78
|
method
|
|
62
79
|
});
|
|
63
80
|
return app.fetch(request, c.env, getExecutionCtx(c));
|
|
@@ -69,7 +86,10 @@ const methodOverride = (options) => async function methodOverride(c, next) {
|
|
|
69
86
|
if (method) {
|
|
70
87
|
const newHeaders = new Headers(c.req.raw.headers);
|
|
71
88
|
newHeaders.delete(headerName);
|
|
72
|
-
const request = new Request(c.req.
|
|
89
|
+
const request = isBodylessMethod(method) ? new Request(c.req.url, {
|
|
90
|
+
headers: withoutBodyHeaders(newHeaders),
|
|
91
|
+
method
|
|
92
|
+
}) : new Request(c.req.raw, {
|
|
73
93
|
headers: newHeaders,
|
|
74
94
|
method
|
|
75
95
|
});
|
|
@@ -81,7 +101,10 @@ const methodOverride = (options) => async function methodOverride(c, next) {
|
|
|
81
101
|
if (method) {
|
|
82
102
|
const url = new URL(c.req.url);
|
|
83
103
|
url.searchParams.delete(queryName);
|
|
84
|
-
const requestInit = {
|
|
104
|
+
const requestInit = isBodylessMethod(method) ? {
|
|
105
|
+
headers: withoutBodyHeaders(c.req.raw.headers),
|
|
106
|
+
method
|
|
107
|
+
} : {
|
|
85
108
|
body: c.req.raw.body,
|
|
86
109
|
headers: c.req.raw.headers,
|
|
87
110
|
method,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Request ID Middleware for Hono.
|
|
4
4
|
*
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {RequestIdOptions} [options] - Options for Request ID middleware.
|
|
6
6
|
* @param {number} [options.limitLength=255] - The maximum length of request id.
|
|
7
|
-
* @param {string} [options.headerName=X-Request-Id] - The header name used in request id.
|
|
8
|
-
* @param {
|
|
7
|
+
* @param {string} [options.headerName='X-Request-Id'] - The header name used in request id.
|
|
8
|
+
* @param {(c: Context) => string} [options.generator=() => crypto.randomUUID()] - The request id generation function.
|
|
9
9
|
*
|
|
10
10
|
* @returns {MiddlewareHandler} The middleware handler function.
|
|
11
11
|
*
|
|
@@ -28,7 +28,8 @@ const DEFAULT_OPTIONS = {
|
|
|
28
28
|
xPermittedCrossDomainPolicies: true,
|
|
29
29
|
xXssProtection: true,
|
|
30
30
|
removePoweredBy: true,
|
|
31
|
-
permissionsPolicy: {}
|
|
31
|
+
permissionsPolicy: {},
|
|
32
|
+
overwrite: true
|
|
32
33
|
};
|
|
33
34
|
const generateNonce = () => {
|
|
34
35
|
const arrayBuffer = /* @__PURE__ */ new Uint8Array(16);
|
|
@@ -66,6 +67,7 @@ const NONCE = (ctx) => {
|
|
|
66
67
|
* @param {overridableHeader} [customOptions.xXssProtection=true] - Settings for the X-XSS-Protection header.
|
|
67
68
|
* @param {boolean} [customOptions.removePoweredBy=true] - Settings for remove X-Powered-By header.
|
|
68
69
|
* @param {PermissionsPolicyOptions} [customOptions.permissionsPolicy] - Settings for the Permissions-Policy header.
|
|
70
|
+
* @param {boolean} [customOptions.overwrite=true] - Whether to replace a header that the response already has. Set `false` to keep a header that a handler set itself.
|
|
69
71
|
* @returns {MiddlewareHandler} The middleware handler function.
|
|
70
72
|
*
|
|
71
73
|
* @example
|
|
@@ -97,7 +99,7 @@ const secureHeaders = (customOptions) => {
|
|
|
97
99
|
return async function secureHeaders(ctx, next) {
|
|
98
100
|
const headersToSetForReq = callbacks.length === 0 ? headersToSet : callbacks.reduce((acc, cb) => cb(ctx, acc), headersToSet);
|
|
99
101
|
await next();
|
|
100
|
-
setHeaders(ctx, headersToSetForReq);
|
|
102
|
+
setHeaders(ctx, headersToSetForReq, options.overwrite !== false);
|
|
101
103
|
if (options?.removePoweredBy) ctx.res.headers.delete("X-Powered-By");
|
|
102
104
|
};
|
|
103
105
|
};
|
|
@@ -155,8 +157,9 @@ function getReportingEndpoints(reportingEndpoints = []) {
|
|
|
155
157
|
function getReportToOptions(reportTo = []) {
|
|
156
158
|
return reportTo.map((option) => JSON.stringify(option)).join(", ");
|
|
157
159
|
}
|
|
158
|
-
function setHeaders(ctx, headersToSet) {
|
|
160
|
+
function setHeaders(ctx, headersToSet, overwrite) {
|
|
159
161
|
headersToSet.forEach(([header, value]) => {
|
|
162
|
+
if (!overwrite && ctx.res.headers.has(header)) return;
|
|
160
163
|
ctx.res.headers.set(header, value);
|
|
161
164
|
});
|
|
162
165
|
}
|
|
@@ -17,6 +17,11 @@ export interface acceptsOptions extends acceptsConfig {
|
|
|
17
17
|
export declare const defaultMatch: (accepts: Accept[], config: acceptsConfig) => string;
|
|
18
18
|
/**
|
|
19
19
|
* Match the accept header with the given options.
|
|
20
|
+
*
|
|
21
|
+
* @param {Context} c - The context of the request.
|
|
22
|
+
* @param {acceptsOptions} options - The options for matching the accept header.
|
|
23
|
+
* @returns {string} The matched supported value or the default value.
|
|
24
|
+
*
|
|
20
25
|
* @example
|
|
21
26
|
* ```ts
|
|
22
27
|
* app.get('/users', (c) => {
|
|
@@ -4,7 +4,8 @@ import { JSX as JSX$1 } from "./intrinsic-elements.js";
|
|
|
4
4
|
import { Context } from "./context.js";
|
|
5
5
|
//#region src/jsx/base.d.ts
|
|
6
6
|
export type Props = Record<string, any>;
|
|
7
|
-
type
|
|
7
|
+
type FunctionComponentValue = HtmlEscapedString | Child;
|
|
8
|
+
type FunctionComponentResult = FunctionComponentValue | Promise<FunctionComponentValue>;
|
|
8
9
|
export type FC<P = Props> = {
|
|
9
10
|
(props: P): FunctionComponentResult;
|
|
10
11
|
defaultProps?: Partial<P> | undefined;
|
|
@@ -29,6 +29,7 @@ type BasicAuthOptions = {
|
|
|
29
29
|
* @param {Function} [options.verifyUser] - The function to verify user credentials.
|
|
30
30
|
* @param {string | object | MessageFunction} [options.invalidUserMessage="Unauthorized"] - The invalid user message.
|
|
31
31
|
* @param {Function} [options.onAuthSuccess] - Callback function called on successful authentication.
|
|
32
|
+
* @param {...{ username: string; password: string }} [users] - Additional user credentials.
|
|
32
33
|
* @returns {MiddlewareHandler} The middleware handler function.
|
|
33
34
|
* @throws {HTTPException} If neither "username and password" nor "verifyUser" options are provided.
|
|
34
35
|
*
|
|
@@ -12,10 +12,10 @@ export type RequestIdOptions = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Request ID Middleware for Hono.
|
|
14
14
|
*
|
|
15
|
-
* @param {
|
|
15
|
+
* @param {RequestIdOptions} [options] - Options for Request ID middleware.
|
|
16
16
|
* @param {number} [options.limitLength=255] - The maximum length of request id.
|
|
17
|
-
* @param {string} [options.headerName=X-Request-Id] - The header name used in request id.
|
|
18
|
-
* @param {
|
|
17
|
+
* @param {string} [options.headerName='X-Request-Id'] - The header name used in request id.
|
|
18
|
+
* @param {(c: Context) => string} [options.generator=() => crypto.randomUUID()] - The request id generation function.
|
|
19
19
|
*
|
|
20
20
|
* @returns {MiddlewareHandler} The middleware handler function.
|
|
21
21
|
*
|
|
@@ -68,6 +68,7 @@ interface SecureHeadersOptions {
|
|
|
68
68
|
xXssProtection?: overridableHeader;
|
|
69
69
|
removePoweredBy?: boolean;
|
|
70
70
|
permissionsPolicy?: PermissionsPolicyOptions;
|
|
71
|
+
overwrite?: boolean;
|
|
71
72
|
}
|
|
72
73
|
export declare const NONCE: ContentSecurityPolicyOptionHandler;
|
|
73
74
|
/**
|
|
@@ -94,6 +95,7 @@ export declare const NONCE: ContentSecurityPolicyOptionHandler;
|
|
|
94
95
|
* @param {overridableHeader} [customOptions.xXssProtection=true] - Settings for the X-XSS-Protection header.
|
|
95
96
|
* @param {boolean} [customOptions.removePoweredBy=true] - Settings for remove X-Powered-By header.
|
|
96
97
|
* @param {PermissionsPolicyOptions} [customOptions.permissionsPolicy] - Settings for the Permissions-Policy header.
|
|
98
|
+
* @param {boolean} [customOptions.overwrite=true] - Whether to replace a header that the response already has. Set `false` to keep a header that a handler set itself.
|
|
97
99
|
* @returns {MiddlewareHandler} The middleware handler function.
|
|
98
100
|
*
|
|
99
101
|
* @example
|
|
@@ -4,10 +4,10 @@ import { JWTPayload } from "./types.js";
|
|
|
4
4
|
//#region src/utils/jwt/jwt.d.ts
|
|
5
5
|
export interface TokenHeader {
|
|
6
6
|
alg: SignatureAlgorithm;
|
|
7
|
-
typ?:
|
|
7
|
+
typ?: string;
|
|
8
8
|
kid?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare function isTokenHeader(obj: unknown): obj is TokenHeader;
|
|
10
|
+
export declare function isTokenHeader(obj: unknown, typ?: string | string[]): obj is TokenHeader;
|
|
11
11
|
export declare const sign: (payload: JWTPayload, privateKey: SignatureKey, alg?: SignatureAlgorithm) => Promise<string>;
|
|
12
12
|
export type VerifyOptions = {
|
|
13
13
|
/** The expected issuer used for verifying the token */
|
|
@@ -20,6 +20,8 @@ export type VerifyOptions = {
|
|
|
20
20
|
iat?: boolean;
|
|
21
21
|
/** Acceptable audience(s) for the token */
|
|
22
22
|
aud?: string | string[] | RegExp;
|
|
23
|
+
/** The expected `typ` header, for example `at+jwt` for OAuth 2.0 access tokens. When set, the token must have it (default: `JWT`, or no `typ`) */
|
|
24
|
+
typ?: string | string[];
|
|
23
25
|
};
|
|
24
26
|
export type VerifyOptionsWithAlg = {
|
|
25
27
|
/** The algorithm used for decoding the token */
|
|
@@ -35,11 +35,21 @@ export type JSONValue = JSONObject | JSONArray | JSONPrimitive;
|
|
|
35
35
|
* which defaults to `bigint | ReadonlyArray<bigint>`.
|
|
36
36
|
* You can set it to `never` to disable this check.
|
|
37
37
|
*/
|
|
38
|
-
export type JSONParsed<T, TError = bigint | ReadonlyArray<bigint>> = T
|
|
38
|
+
export type JSONParsed<T, TError = bigint | ReadonlyArray<bigint>> = JSONParsedInner<T, TError, never>;
|
|
39
|
+
/**
|
|
40
|
+
* `true` when `T` is identical to a type in `TSeen`, a union of one-element tuples.
|
|
41
|
+
*/
|
|
42
|
+
type IsSeen<T, TSeen> = TSeen extends unknown ? (<G>() => G extends [T] ? 1 : 2) extends (<G>() => G extends TSeen ? 1 : 2) ? true : never : never;
|
|
43
|
+
/**
|
|
44
|
+
* A recursive type such as `JSONValue` refers to itself, so `JSONParsed` cannot expand it to the end.
|
|
45
|
+
* `TSeen` holds the types on the current path. A type that is already on the path becomes `JSONValue`.
|
|
46
|
+
*/
|
|
47
|
+
type JSONParsedInner<T, TError, TSeen> = [IsSeen<T, TSeen>] extends [never] ? JSONParsedStep<T, TError, TSeen | [T]> : JSONValue;
|
|
48
|
+
type JSONParsedStep<T, TError, TSeen> = T extends {
|
|
39
49
|
toJSON(): infer J;
|
|
40
50
|
} ? (() => J) extends (() => JSONPrimitive) ? J : (() => J) extends (() => {
|
|
41
51
|
toJSON(): unknown;
|
|
42
|
-
}) ? {} :
|
|
52
|
+
}) ? {} : JSONParsedInner<J, TError, TSeen> : T extends JSONPrimitive ? T : T extends InvalidJSONValue ? never : T extends ReadonlyArray<unknown> ? { [K in keyof T]: JSONParsedInner<InvalidToNull<T[K]>, TError, TSeen>; } extends (infer A) ? A extends ReadonlyArray<unknown> ? A : JSONParsedInner<InvalidToNull<T[number]>, TError, TSeen>[] : never : T extends Set<unknown> | Map<unknown, unknown> | Record<string, never> ? {} : T extends object ? T[keyof T] extends TError ? never : { [K in keyof OmitSymbolKeys<T> as IsInvalid<T[K]> extends true ? never : K]: boolean extends IsInvalid<T[K]> ? JSONParsedInner<T[K], TError, TSeen> | undefined : JSONParsedInner<T[K], TError, TSeen>; } : T extends unknown ? T extends TError ? never : JSONValue : never;
|
|
43
53
|
/**
|
|
44
54
|
* Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
|
|
45
55
|
* @copyright from sindresorhus/type-fest
|
|
@@ -72,6 +72,7 @@ const handleParsingAllValues = (form, key, value) => {
|
|
|
72
72
|
* @param {BodyData} form - The form data object.
|
|
73
73
|
* @param {string} key - The dot notation key.
|
|
74
74
|
* @param {BodyDataValue} value - The value to assign.
|
|
75
|
+
* @param {{ count: number }} state - The state object tracking nesting depth.
|
|
75
76
|
*/
|
|
76
77
|
const handleParsingNestedValues = (form, key, value, state) => {
|
|
77
78
|
if (/(?:^|\.)__proto__\./.test(key)) return;
|
|
@@ -24,6 +24,11 @@ const stringBufferToString = async (buffer, callbacks) => {
|
|
|
24
24
|
i--;
|
|
25
25
|
if (i < 0) break;
|
|
26
26
|
let r = resolvedBuffer[i];
|
|
27
|
+
if (r == null || typeof r === "boolean") continue;
|
|
28
|
+
if (typeof r === "number") {
|
|
29
|
+
str += r;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
27
32
|
if (typeof r === "object") callbacks.push(...r.callbacks || []);
|
|
28
33
|
const isEscaped = r.isEscaped;
|
|
29
34
|
r = await (typeof r === "object" ? r.toString() : r);
|