@suveren/gateway 0.7.4 → 0.8.0
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/content/integrations/mollie.json +103 -28
- package/dist/control-plane/index.mjs +248 -58
- package/dist/mcp-server/http.mjs +577 -124
- package/dist/ui/assets/index-BFnSVa9N.js +110 -0
- package/dist/ui/assets/{index-CkWaRck1.css → index-BYVb_0oG.css} +1 -1
- package/dist/ui/index.html +2 -2
- package/node_modules/@hap/core/dist/index.d.mts +285 -13
- package/node_modules/@hap/core/dist/index.d.ts +285 -13
- package/node_modules/@hap/core/dist/index.js +281 -13
- package/node_modules/@hap/core/dist/index.mjs +266 -12
- package/node_modules/@hap/core/package.json +4 -2
- package/node_modules/@hap/core/src/did-key.ts +126 -0
- package/node_modules/@hap/core/src/frame.ts +115 -14
- package/node_modules/@hap/core/src/gatekeeper.ts +26 -0
- package/node_modules/@hap/core/src/identity.ts +21 -5
- package/node_modules/@hap/core/src/index.ts +3 -0
- package/node_modules/@hap/core/src/mandate.ts +207 -0
- package/node_modules/@hap/core/src/receipt.ts +74 -0
- package/node_modules/@hap/core/src/types.ts +87 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/package.json +16 -10
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/buffer.buffer.d.ts +10 -5
- package/node_modules/@types/node/crypto.d.ts +2 -4
- package/node_modules/@types/node/dgram.d.ts +119 -4
- package/node_modules/@types/node/ffi.d.ts +1 -1
- package/node_modules/@types/node/fs/promises.d.ts +61 -65
- package/node_modules/@types/node/fs.d.ts +86 -76
- package/node_modules/@types/node/http.d.ts +17 -1
- package/node_modules/@types/node/http2.d.ts +12 -4
- package/node_modules/@types/node/index.d.ts +1 -0
- package/node_modules/@types/node/inspector.d.ts +2 -1
- package/node_modules/@types/node/net.d.ts +108 -16
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/process.d.ts +52 -0
- package/node_modules/@types/node/quic.d.ts +246 -38
- package/node_modules/@types/node/sqlite.d.ts +6 -2
- package/node_modules/@types/node/stream/iter.d.ts +4 -4
- package/node_modules/@types/node/test.d.ts +36 -0
- package/node_modules/@types/node/tls.d.ts +24 -0
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +5 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +1 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +1 -0
- package/node_modules/@types/node/tty.d.ts +4 -3
- package/node_modules/@types/node/vfs.d.ts +210 -0
- package/node_modules/@types/node/vm.d.ts +1 -1
- package/node_modules/express-rate-limit/dist/index.cjs +6 -3
- package/node_modules/express-rate-limit/dist/index.d.cts +11 -0
- package/node_modules/express-rate-limit/dist/index.d.mts +11 -0
- package/node_modules/express-rate-limit/dist/index.d.ts +11 -0
- package/node_modules/express-rate-limit/dist/index.mjs +6 -3
- package/node_modules/express-rate-limit/{license.md → license} +7 -6
- package/node_modules/express-rate-limit/package.json +5 -5
- package/node_modules/express-rate-limit/readme.md +1 -0
- package/node_modules/fast-uri/index.js +215 -47
- package/node_modules/fast-uri/lib/schemes.js +9 -4
- package/node_modules/fast-uri/lib/utils.js +396 -92
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/component-safe-serialization.test.js +163 -0
- package/node_modules/fast-uri/test/equal.test.js +31 -3
- package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +2 -0
- package/node_modules/fast-uri/test/ipv6-canonical.test.js +34 -0
- package/node_modules/fast-uri/test/ipv6-validation.test.js +124 -0
- package/node_modules/fast-uri/test/malformed-percent.test.js +77 -0
- package/node_modules/fast-uri/test/malformed-urn.test.js +61 -0
- package/node_modules/fast-uri/test/parse.test.js +7 -3
- package/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
- package/node_modules/fast-uri/test/reserved-path-normalization.test.js +109 -0
- package/node_modules/fast-uri/test/scheme-validation.test.js +124 -0
- package/node_modules/fast-uri/test/security-normalization.test.js +101 -0
- package/node_modules/fast-uri/test/security.test.js +75 -3
- package/node_modules/fast-uri/test/urn-full-input.test.js +29 -0
- package/node_modules/fast-uri/test/websocket-query-preservation.test.js +24 -0
- package/node_modules/hono/dist/cjs/client/client.js +25 -11
- package/node_modules/hono/dist/cjs/client/utils.js +4 -1
- package/node_modules/hono/dist/cjs/context.js +4 -0
- package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +36 -2
- package/node_modules/hono/dist/cjs/helper/ssg/ssg.js +1 -1
- package/node_modules/hono/dist/cjs/helper/ssg/utils.js +30 -10
- package/node_modules/hono/dist/cjs/jsx/dom/render.js +2 -0
- package/node_modules/hono/dist/cjs/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/cors/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/csrf/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/etag/digest.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/etag/index.js +3 -3
- package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +3 -1
- package/node_modules/hono/dist/cjs/request.js +8 -4
- package/node_modules/hono/dist/cjs/router/linear-router/router.js +7 -2
- package/node_modules/hono/dist/cjs/router/pattern-router/router.js +3 -9
- package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +10 -3
- package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +47 -83
- package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +2 -1
- package/node_modules/hono/dist/cjs/router/trie-router/node.js +46 -69
- package/node_modules/hono/dist/cjs/router/trie-router/router.js +3 -11
- package/node_modules/hono/dist/cjs/router/utils.js +27 -0
- package/node_modules/hono/dist/cjs/utils/body.js +15 -3
- package/node_modules/hono/dist/cjs/utils/cookie.js +1 -1
- package/node_modules/hono/dist/cjs/utils/ipaddr.js +5 -3
- package/node_modules/hono/dist/cjs/utils/stream.js +7 -1
- package/node_modules/hono/dist/cjs/utils/url.js +9 -1
- package/node_modules/hono/dist/client/client.js +25 -11
- package/node_modules/hono/dist/client/utils.js +4 -1
- package/node_modules/hono/dist/context.js +4 -0
- package/node_modules/hono/dist/helper/accepts/accepts.js +36 -2
- package/node_modules/hono/dist/helper/ssg/ssg.js +1 -1
- package/node_modules/hono/dist/helper/ssg/utils.js +30 -10
- package/node_modules/hono/dist/jsx/dom/render.js +2 -0
- package/node_modules/hono/dist/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/middleware/cors/index.js +1 -1
- package/node_modules/hono/dist/middleware/csrf/index.js +1 -1
- package/node_modules/hono/dist/middleware/etag/digest.js +1 -1
- package/node_modules/hono/dist/middleware/etag/index.js +3 -3
- package/node_modules/hono/dist/middleware/pretty-json/index.js +3 -1
- package/node_modules/hono/dist/request.js +8 -4
- package/node_modules/hono/dist/router/linear-router/router.js +7 -2
- package/node_modules/hono/dist/router/pattern-router/router.js +3 -9
- package/node_modules/hono/dist/router/reg-exp-router/node.js +6 -2
- package/node_modules/hono/dist/router/reg-exp-router/router.js +53 -84
- package/node_modules/hono/dist/router/reg-exp-router/trie.js +2 -1
- package/node_modules/hono/dist/router/trie-router/node.js +46 -69
- package/node_modules/hono/dist/router/trie-router/router.js +3 -11
- package/node_modules/hono/dist/router/utils.js +5 -0
- package/node_modules/hono/dist/types/context.d.ts +4 -0
- package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +3 -0
- package/node_modules/hono/dist/types/router/trie-router/node.d.ts +1 -2
- package/node_modules/hono/dist/types/router/trie-router/router.d.ts +0 -1
- package/node_modules/hono/dist/types/router/utils.d.ts +1 -0
- package/node_modules/hono/dist/types/utils/url.d.ts +4 -0
- package/node_modules/hono/dist/utils/body.js +15 -3
- package/node_modules/hono/dist/utils/cookie.js +1 -1
- package/node_modules/hono/dist/utils/ipaddr.js +5 -3
- package/node_modules/hono/dist/utils/stream.js +7 -1
- package/node_modules/hono/dist/utils/url.js +9 -1
- package/node_modules/hono/package.json +1 -1
- package/node_modules/ip-address/README.md +92 -82
- package/node_modules/ip-address/dist/common.d.ts +20 -0
- package/node_modules/ip-address/dist/common.js +36 -0
- package/node_modules/ip-address/dist/common.js.map +1 -1
- package/node_modules/ip-address/dist/ipv4.d.ts +50 -0
- package/node_modules/ip-address/dist/ipv4.js +75 -0
- package/node_modules/ip-address/dist/ipv4.js.map +1 -1
- package/node_modules/ip-address/dist/ipv6.d.ts +79 -10
- package/node_modules/ip-address/dist/ipv6.js +120 -30
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/dist/v4/constants.d.ts +12 -0
- package/node_modules/ip-address/dist/v4/constants.js +40 -1
- package/node_modules/ip-address/dist/v4/constants.js.map +1 -1
- package/node_modules/ip-address/dist/v6/constants.d.ts +14 -0
- package/node_modules/ip-address/dist/v6/constants.js +47 -1
- package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
- package/node_modules/ip-address/package.json +1 -1
- package/node_modules/is-plain-object/README.md +39 -95
- package/node_modules/is-plain-object/dist/is-plain-object.js +0 -2
- package/node_modules/is-plain-object/is-plain-object.d.ts +6 -1
- package/node_modules/is-plain-object/package.json +8 -34
- package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +7 -16
- package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +10 -20
- package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +7 -16
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +16 -38
- package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +7 -16
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +19 -38
- package/node_modules/jose/dist/types/jwk/embedded.d.ts +3 -8
- package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +5 -5
- package/node_modules/jose/dist/types/jwks/local.d.ts +6 -10
- package/node_modules/jose/dist/types/jwks/remote.d.ts +17 -28
- package/node_modules/jose/dist/types/jws/compact/sign.d.ts +5 -10
- package/node_modules/jose/dist/types/jws/compact/verify.d.ts +9 -18
- package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +7 -16
- package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +9 -18
- package/node_modules/jose/dist/types/jws/general/sign.d.ts +11 -21
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +12 -21
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +10 -20
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +17 -29
- package/node_modules/jose/dist/types/jwt/sign.d.ts +12 -19
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +17 -28
- package/node_modules/jose/dist/types/jwt/verify.d.ts +9 -19
- package/node_modules/jose/dist/types/key/export.d.ts +4 -4
- package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +6 -8
- package/node_modules/jose/dist/types/key/generate_secret.d.ts +4 -11
- package/node_modules/jose/dist/types/key/import.d.ts +10 -17
- package/node_modules/jose/dist/types/types.d.ts +48 -86
- package/node_modules/jose/dist/types/util/base64url.d.ts +2 -2
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +3 -10
- package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +4 -4
- package/node_modules/jose/dist/types/util/errors.d.ts +26 -53
- package/node_modules/jose/dist/webapi/index.js +70 -32
- package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +7 -8
- package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +42 -26
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +14 -10
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +53 -71
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +38 -49
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +121 -158
- package/node_modules/jose/dist/webapi/jwk/embedded.js +30 -18
- package/node_modules/jose/dist/webapi/jwk/thumbprint.js +54 -64
- package/node_modules/jose/dist/webapi/jwks/local.js +49 -74
- package/node_modules/jose/dist/webapi/jwks/remote.js +91 -160
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +21 -20
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +7 -8
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +29 -30
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +21 -23
- package/node_modules/jose/dist/webapi/jws/general/sign.js +61 -70
- package/node_modules/jose/dist/webapi/jws/general/verify.js +47 -41
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +13 -22
- package/node_modules/jose/dist/webapi/jwt/encrypt.js +58 -100
- package/node_modules/jose/dist/webapi/jwt/sign.js +18 -50
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +34 -63
- package/node_modules/jose/dist/webapi/jwt/verify.js +12 -14
- package/node_modules/jose/dist/webapi/key/export.js +32 -37
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +40 -44
- package/node_modules/jose/dist/webapi/key/generate_secret.js +35 -39
- package/node_modules/jose/dist/webapi/key/import.js +52 -52
- package/node_modules/jose/dist/webapi/lib/asn1.js +130 -164
- package/node_modules/jose/dist/webapi/lib/base64.js +18 -20
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +34 -38
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +79 -123
- package/node_modules/jose/dist/webapi/lib/crypto_key.js +24 -25
- package/node_modules/jose/dist/webapi/lib/deflate.js +46 -40
- package/node_modules/jose/dist/webapi/lib/helpers.js +40 -37
- package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +10 -24
- package/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -15
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +106 -93
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +210 -176
- package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +105 -107
- package/node_modules/jose/dist/webapi/lib/jwk_metadata.js +19 -0
- package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +9 -16
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +62 -61
- package/node_modules/jose/dist/webapi/lib/jws_sign.js +58 -72
- package/node_modules/jose/dist/webapi/lib/jws_verify.js +90 -103
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +134 -185
- package/node_modules/jose/dist/webapi/lib/key.js +84 -121
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +13 -8
- package/node_modules/jose/dist/webapi/lib/key_descriptor.js +8 -6
- package/node_modules/jose/dist/webapi/lib/key_management.js +200 -225
- package/node_modules/jose/dist/webapi/lib/key_options.js +8 -0
- package/node_modules/jose/dist/webapi/lib/options.js +57 -44
- package/node_modules/jose/dist/webapi/lib/signing.js +18 -22
- package/node_modules/jose/dist/webapi/lib/type_checks.js +28 -33
- package/node_modules/jose/dist/webapi/util/base64url.js +26 -35
- package/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -31
- package/node_modules/jose/dist/webapi/util/decode_protected_header.js +18 -23
- package/node_modules/jose/dist/webapi/util/errors.js +94 -84
- package/node_modules/jose/package.json +17 -81
- package/package.json +2 -2
- package/profiles/calendar/0.5.profile.json +190 -0
- package/profiles/charge/0.5.profile.json +210 -0
- package/profiles/customers/0.7.profile.json +157 -0
- package/profiles/deploy/0.9.profile.json +176 -0
- package/profiles/email/0.6.profile.json +208 -0
- package/profiles/index.json +9 -1
- package/profiles/publish/0.5.profile.json +186 -0
- package/profiles/purchase/0.5.profile.json +231 -0
- package/profiles/records/0.5.profile.json +117 -0
- package/dist/ui/assets/index-0Q2eNytX.js +0 -110
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/HISTORY.md +0 -114
|
@@ -22,77 +22,53 @@ __export(node_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(node_exports);
|
|
23
23
|
var import_router = require("../../router");
|
|
24
24
|
var import_url = require("../../utils/url");
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
return false;
|
|
31
|
-
};
|
|
25
|
+
var import_utils = require("../utils");
|
|
26
|
+
const emptyParams = (0, import_utils.createNullObject)();
|
|
27
|
+
let order = 0;
|
|
32
28
|
class Node {
|
|
33
|
-
#methods;
|
|
34
|
-
#children;
|
|
35
|
-
#patterns;
|
|
36
|
-
#
|
|
29
|
+
#methods = [];
|
|
30
|
+
#children = (0, import_utils.createNullObject)();
|
|
31
|
+
#patterns = [];
|
|
32
|
+
#pattern;
|
|
37
33
|
#params = emptyParams;
|
|
38
|
-
constructor(method, handler, children) {
|
|
39
|
-
this.#children = children || /* @__PURE__ */ Object.create(null);
|
|
40
|
-
this.#methods = [];
|
|
41
|
-
if (method && handler) {
|
|
42
|
-
const m = /* @__PURE__ */ Object.create(null);
|
|
43
|
-
m[method] = { handler, possibleKeys: [], score: 0 };
|
|
44
|
-
this.#methods = [m];
|
|
45
|
-
}
|
|
46
|
-
this.#patterns = [];
|
|
47
|
-
}
|
|
48
34
|
insert(method, path, handler) {
|
|
49
|
-
this.#order = ++this.#order;
|
|
50
35
|
let curNode = this;
|
|
51
36
|
const parts = (0, import_url.splitRoutingPath)(path);
|
|
52
|
-
const possibleKeys =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const nextP = parts[i
|
|
56
|
-
const pattern = (0, import_url.getPattern)(p, nextP);
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
continue;
|
|
37
|
+
const possibleKeys = /* @__PURE__ */ new Set();
|
|
38
|
+
let i = 0;
|
|
39
|
+
for (const p of parts) {
|
|
40
|
+
const nextP = parts[++i];
|
|
41
|
+
const pattern = (0, import_url.getPattern)(p, nextP) || (nextP === void 0 && p && p.indexOf("*") === p.length - 1 ? p : null);
|
|
42
|
+
const isParam = Array.isArray(pattern);
|
|
43
|
+
const key = isParam ? pattern[0] : pattern || p;
|
|
44
|
+
const child = curNode.#children[key] ||= new Node();
|
|
45
|
+
if (pattern && !child.#pattern) {
|
|
46
|
+
child.#pattern = pattern;
|
|
47
|
+
curNode.#patterns.push(child);
|
|
64
48
|
}
|
|
65
|
-
curNode
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
possibleKeys.push(pattern[1]);
|
|
49
|
+
curNode = child;
|
|
50
|
+
if (isParam) {
|
|
51
|
+
possibleKeys.add(pattern[1]);
|
|
69
52
|
}
|
|
70
|
-
curNode = curNode.#children[key];
|
|
71
53
|
}
|
|
72
54
|
curNode.#methods.push({
|
|
73
55
|
[method]: {
|
|
74
56
|
handler,
|
|
75
|
-
possibleKeys: possibleKeys
|
|
76
|
-
score:
|
|
57
|
+
possibleKeys: [...possibleKeys],
|
|
58
|
+
score: ++order
|
|
77
59
|
}
|
|
78
60
|
});
|
|
79
|
-
return curNode;
|
|
80
61
|
}
|
|
81
62
|
#pushHandlerSets(handlerSets, node, method, nodeParams, params) {
|
|
82
63
|
for (let i = 0, len = node.#methods.length; i < len; i++) {
|
|
83
64
|
const m = node.#methods[i];
|
|
84
65
|
const handlerSet = m[method] || m[import_router.METHOD_NAME_ALL];
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
handlerSet.params = /* @__PURE__ */ Object.create(null);
|
|
66
|
+
if (handlerSet) {
|
|
67
|
+
handlerSet.params = (0, import_utils.createNullObject)();
|
|
88
68
|
handlerSets.push(handlerSet);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const processed = processedSet[handlerSet.score];
|
|
93
|
-
handlerSet.params[key] = params?.[key] && !processed ? params[key] : nodeParams[key] ?? params?.[key];
|
|
94
|
-
processedSet[handlerSet.score] = true;
|
|
95
|
-
}
|
|
69
|
+
for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {
|
|
70
|
+
const key = handlerSet.possibleKeys[i2];
|
|
71
|
+
handlerSet.params[key] = params?.[key] && !i2 ? params[key] : nodeParams[key] ?? params?.[key];
|
|
96
72
|
}
|
|
97
73
|
}
|
|
98
74
|
}
|
|
@@ -124,33 +100,33 @@ class Node {
|
|
|
124
100
|
tempNodes.push(nextNode);
|
|
125
101
|
}
|
|
126
102
|
}
|
|
127
|
-
for (
|
|
128
|
-
const pattern =
|
|
103
|
+
for (const child of node.#patterns) {
|
|
104
|
+
const pattern = child.#pattern;
|
|
129
105
|
const params = node.#params === emptyParams ? {} : { ...node.#params };
|
|
130
|
-
if (pattern === "
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
106
|
+
if (typeof pattern === "string") {
|
|
107
|
+
if (pattern === "*" || part.startsWith(pattern.slice(0, -1))) {
|
|
108
|
+
this.#pushHandlerSets(handlerSets, child, method, node.#params);
|
|
109
|
+
if (pattern === "*") {
|
|
110
|
+
child.#params = params;
|
|
111
|
+
tempNodes.push(child);
|
|
112
|
+
}
|
|
136
113
|
}
|
|
137
114
|
continue;
|
|
138
115
|
}
|
|
139
|
-
const [
|
|
140
|
-
if (!part &&
|
|
116
|
+
const [, name, matcher] = pattern;
|
|
117
|
+
if (!part && matcher === true) {
|
|
141
118
|
continue;
|
|
142
119
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
partOffsets = new Array(len);
|
|
120
|
+
if (matcher !== true) {
|
|
121
|
+
if (!partOffsets) {
|
|
122
|
+
partOffsets = [];
|
|
147
123
|
let offset = path[0] === "/" ? 1 : 0;
|
|
148
124
|
for (let p = 0; p < len; p++) {
|
|
149
125
|
partOffsets[p] = offset;
|
|
150
126
|
offset += parts[p].length + 1;
|
|
151
127
|
}
|
|
152
128
|
}
|
|
153
|
-
const restPathString = path.
|
|
129
|
+
const restPathString = path.slice(partOffsets[i]);
|
|
154
130
|
const m = matcher.exec(restPathString);
|
|
155
131
|
if (m) {
|
|
156
132
|
params[name] = m[0];
|
|
@@ -164,11 +140,12 @@ class Node {
|
|
|
164
140
|
params
|
|
165
141
|
);
|
|
166
142
|
}
|
|
167
|
-
|
|
143
|
+
for (const _ in child.#children) {
|
|
168
144
|
child.#params = params;
|
|
169
145
|
const componentCount = m[0].match(/\//g)?.length ?? 0;
|
|
170
146
|
const targetCurNodes = curNodesQueue[componentCount] ||= [];
|
|
171
147
|
targetCurNodes.push(child);
|
|
148
|
+
break;
|
|
172
149
|
}
|
|
173
150
|
continue;
|
|
174
151
|
}
|
|
@@ -196,7 +173,7 @@ class Node {
|
|
|
196
173
|
const shifted = curNodesQueue.shift();
|
|
197
174
|
curNodes = shifted ? tempNodes.concat(shifted) : tempNodes;
|
|
198
175
|
}
|
|
199
|
-
if (handlerSets
|
|
176
|
+
if (handlerSets[1]) {
|
|
200
177
|
handlerSets.sort((a, b) => {
|
|
201
178
|
return a.score - b.score;
|
|
202
179
|
});
|
|
@@ -24,19 +24,11 @@ var import_url = require("../../utils/url");
|
|
|
24
24
|
var import_node = require("./node");
|
|
25
25
|
class TrieRouter {
|
|
26
26
|
name = "TrieRouter";
|
|
27
|
-
#node;
|
|
28
|
-
constructor() {
|
|
29
|
-
this.#node = new import_node.Node();
|
|
30
|
-
}
|
|
27
|
+
#node = new import_node.Node();
|
|
31
28
|
add(method, path, handler) {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
for (let i = 0, len = results.length; i < len; i++) {
|
|
35
|
-
this.#node.insert(method, results[i], handler);
|
|
36
|
-
}
|
|
37
|
-
return;
|
|
29
|
+
for (const result of (0, import_url.checkOptionalParameter)(path) || [path]) {
|
|
30
|
+
this.#node.insert(method, result, handler);
|
|
38
31
|
}
|
|
39
|
-
this.#node.insert(method, path, handler);
|
|
40
32
|
}
|
|
41
33
|
match(method, path) {
|
|
42
34
|
return this.#node.search(method, path);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var utils_exports = {};
|
|
19
|
+
__export(utils_exports, {
|
|
20
|
+
createNullObject: () => createNullObject
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(utils_exports);
|
|
23
|
+
const createNullObject = () => /* @__PURE__ */ Object.create(null);
|
|
24
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
+
0 && (module.exports = {
|
|
26
|
+
createNullObject
|
|
27
|
+
});
|
|
@@ -21,6 +21,8 @@ __export(body_exports, {
|
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(body_exports);
|
|
23
23
|
var import_buffer = require("./buffer");
|
|
24
|
+
const MAX_NESTING_DEPTH = 32;
|
|
25
|
+
const MAX_NESTED_OBJECTS = 1e4;
|
|
24
26
|
const isRawRequest = (request) => "headers" in request;
|
|
25
27
|
const parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
26
28
|
const { all = false, dot = false } = options;
|
|
@@ -53,6 +55,7 @@ async function parseFormData(request, options) {
|
|
|
53
55
|
}
|
|
54
56
|
function convertFormDataToBodyData(formData, options) {
|
|
55
57
|
const form = /* @__PURE__ */ Object.create(null);
|
|
58
|
+
const nestingState = { count: 0 };
|
|
56
59
|
formData.forEach((value, key) => {
|
|
57
60
|
const shouldParseAllValues = options.all || key.endsWith("[]");
|
|
58
61
|
if (!shouldParseAllValues) {
|
|
@@ -65,7 +68,7 @@ function convertFormDataToBodyData(formData, options) {
|
|
|
65
68
|
Object.entries(form).forEach(([key, value]) => {
|
|
66
69
|
const shouldParseDotValues = key.includes(".");
|
|
67
70
|
if (shouldParseDotValues) {
|
|
68
|
-
handleParsingNestedValues(form, key, value);
|
|
71
|
+
handleParsingNestedValues(form, key, value, nestingState);
|
|
69
72
|
delete form[key];
|
|
70
73
|
}
|
|
71
74
|
});
|
|
@@ -88,23 +91,32 @@ const handleParsingAllValues = (form, key, value) => {
|
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
};
|
|
91
|
-
const handleParsingNestedValues = (form, key, value) => {
|
|
94
|
+
const handleParsingNestedValues = (form, key, value, state) => {
|
|
92
95
|
if (/(?:^|\.)__proto__\./.test(key)) {
|
|
93
96
|
return;
|
|
94
97
|
}
|
|
95
98
|
let nestedForm = form;
|
|
96
|
-
const keys = key.split(".");
|
|
99
|
+
const keys = key.split(".", MAX_NESTING_DEPTH + 2);
|
|
100
|
+
if (keys.length > MAX_NESTING_DEPTH + 1) {
|
|
101
|
+
throwNestingLimitExceeded();
|
|
102
|
+
}
|
|
97
103
|
keys.forEach((key2, index) => {
|
|
98
104
|
if (index === keys.length - 1) {
|
|
99
105
|
nestedForm[key2] = value;
|
|
100
106
|
} else {
|
|
101
107
|
if (!nestedForm[key2] || typeof nestedForm[key2] !== "object" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) {
|
|
108
|
+
if (state.count++ >= MAX_NESTED_OBJECTS) {
|
|
109
|
+
throwNestingLimitExceeded();
|
|
110
|
+
}
|
|
102
111
|
nestedForm[key2] = /* @__PURE__ */ Object.create(null);
|
|
103
112
|
}
|
|
104
113
|
nestedForm = nestedForm[key2];
|
|
105
114
|
}
|
|
106
115
|
});
|
|
107
116
|
};
|
|
117
|
+
const throwNestingLimitExceeded = () => {
|
|
118
|
+
throw new Error("Nesting limit exceeded");
|
|
119
|
+
};
|
|
108
120
|
// Annotate the CommonJS export names for ESM import in node:
|
|
109
121
|
0 && (module.exports = {
|
|
110
122
|
parseBody
|
|
@@ -101,7 +101,7 @@ const parseSigned = async (cookie, secret, name) => {
|
|
|
101
101
|
const secretKey = await getCryptoKey(secret);
|
|
102
102
|
for (const [key, value] of Object.entries(parse(cookie, name))) {
|
|
103
103
|
const signatureStartPos = value.lastIndexOf(".");
|
|
104
|
-
if (signatureStartPos <
|
|
104
|
+
if (signatureStartPos < 0) {
|
|
105
105
|
continue;
|
|
106
106
|
}
|
|
107
107
|
const signedValue = value.substring(0, signatureStartPos);
|
|
@@ -30,12 +30,14 @@ __export(ipaddr_exports, {
|
|
|
30
30
|
module.exports = __toCommonJS(ipaddr_exports);
|
|
31
31
|
const expandIPv6 = (ipV6) => {
|
|
32
32
|
const sections = ipV6.split(":");
|
|
33
|
-
|
|
33
|
+
const lastSection = sections.at(-1);
|
|
34
|
+
if (IPV4_REGEX.test(lastSection)) {
|
|
35
|
+
const octets = lastSection.split(".").map(Number);
|
|
34
36
|
sections.splice(
|
|
35
37
|
-1,
|
|
36
38
|
1,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
(octets[0] << 8 | octets[1]).toString(16),
|
|
40
|
+
(octets[2] << 8 | octets[3]).toString(16)
|
|
39
41
|
);
|
|
40
42
|
}
|
|
41
43
|
for (let i = 0; i < sections.length; i++) {
|
|
@@ -96,7 +96,13 @@ class StreamingApi {
|
|
|
96
96
|
abort() {
|
|
97
97
|
if (!this.aborted) {
|
|
98
98
|
this.aborted = true;
|
|
99
|
-
this.abortSubscribers.forEach((subscriber) =>
|
|
99
|
+
this.abortSubscribers.forEach((subscriber) => {
|
|
100
|
+
try {
|
|
101
|
+
void Promise.resolve(subscriber()).catch(() => {
|
|
102
|
+
});
|
|
103
|
+
} catch {
|
|
104
|
+
}
|
|
105
|
+
});
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
108
|
}
|
|
@@ -119,7 +119,11 @@ const getPath = (request) => {
|
|
|
119
119
|
};
|
|
120
120
|
const getQueryStrings = (url) => {
|
|
121
121
|
const queryIndex = url.indexOf("?", 8);
|
|
122
|
-
|
|
122
|
+
if (queryIndex === -1) {
|
|
123
|
+
return "";
|
|
124
|
+
}
|
|
125
|
+
const hashIndex = url.indexOf("#", 8);
|
|
126
|
+
return hashIndex === -1 ? url.slice(queryIndex) : queryIndex < hashIndex ? url.slice(queryIndex, hashIndex) : "";
|
|
123
127
|
};
|
|
124
128
|
const getPathNoStrict = (request) => {
|
|
125
129
|
const result = getPath(request);
|
|
@@ -166,6 +170,10 @@ const _decodeURI = (value) => {
|
|
|
166
170
|
return tryDecodeURIComponent(value);
|
|
167
171
|
};
|
|
168
172
|
const _getQueryParam = (url, key, multiple) => {
|
|
173
|
+
const hashIndex = url.indexOf("#", 8);
|
|
174
|
+
if (hashIndex !== -1) {
|
|
175
|
+
url = url.slice(0, hashIndex);
|
|
176
|
+
}
|
|
169
177
|
let encoded;
|
|
170
178
|
if (!multiple && key && key.indexOf("%") === -1 && key.indexOf("+") === -1) {
|
|
171
179
|
let keyIndex2 = url.indexOf("?", 8);
|
|
@@ -26,6 +26,10 @@ var createProxy = (callback, path) => {
|
|
|
26
26
|
});
|
|
27
27
|
return proxy;
|
|
28
28
|
};
|
|
29
|
+
var appendQueryParams = (url, searchParams) => {
|
|
30
|
+
const queryString = searchParams.toString();
|
|
31
|
+
return queryString ? `${url}?${queryString}` : url;
|
|
32
|
+
};
|
|
29
33
|
var ClientRequestImpl = class {
|
|
30
34
|
url;
|
|
31
35
|
method;
|
|
@@ -52,6 +56,9 @@ var ClientRequestImpl = class {
|
|
|
52
56
|
}
|
|
53
57
|
if (Array.isArray(v)) {
|
|
54
58
|
for (const v2 of v) {
|
|
59
|
+
if (v2 === void 0) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
55
62
|
form.append(k, v2);
|
|
56
63
|
}
|
|
57
64
|
} else {
|
|
@@ -76,19 +83,29 @@ var ClientRequestImpl = class {
|
|
|
76
83
|
if (args?.cookie) {
|
|
77
84
|
const cookies = [];
|
|
78
85
|
for (const [key, value] of Object.entries(args.cookie)) {
|
|
86
|
+
if (value === void 0) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
79
89
|
cookies.push(serialize(key, value));
|
|
80
90
|
}
|
|
81
|
-
|
|
91
|
+
if (cookies.length > 0) {
|
|
92
|
+
headerValues["Cookie"] = cookies.join("; ");
|
|
93
|
+
}
|
|
82
94
|
}
|
|
83
95
|
if (this.cType) {
|
|
84
96
|
headerValues["Content-Type"] = this.cType;
|
|
85
97
|
}
|
|
86
|
-
const headers = new Headers(
|
|
98
|
+
const headers = new Headers();
|
|
99
|
+
for (const [key, value] of Object.entries(headerValues)) {
|
|
100
|
+
if (value !== void 0) {
|
|
101
|
+
headers.set(key, value);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
87
104
|
let url = this.url;
|
|
88
105
|
url = removeIndexString(url);
|
|
89
106
|
url = replaceUrlParam(url, this.pathParams);
|
|
90
107
|
if (this.queryParams) {
|
|
91
|
-
url = url
|
|
108
|
+
url = appendQueryParams(url, this.queryParams);
|
|
92
109
|
}
|
|
93
110
|
methodUpperCase = this.method.toUpperCase();
|
|
94
111
|
const setBody = !(methodUpperCase === "GET" || methodUpperCase === "HEAD");
|
|
@@ -132,7 +149,7 @@ var hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
|
|
|
132
149
|
result = replaceUrlParam(url, opts.args[0].param);
|
|
133
150
|
}
|
|
134
151
|
if (opts.args[0].query) {
|
|
135
|
-
result = result
|
|
152
|
+
result = appendQueryParams(result, buildSearchParamsOption(opts.args[0].query));
|
|
136
153
|
}
|
|
137
154
|
}
|
|
138
155
|
result = removeIndexString(result);
|
|
@@ -143,18 +160,15 @@ var hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
|
|
|
143
160
|
}
|
|
144
161
|
if (method === "ws") {
|
|
145
162
|
const webSocketUrl = replaceUrlProtocol(
|
|
146
|
-
opts.args[0]
|
|
163
|
+
opts.args[0]?.param ? replaceUrlParam(url, opts.args[0].param) : url,
|
|
147
164
|
"ws"
|
|
148
165
|
);
|
|
149
166
|
const targetUrl = new URL(webSocketUrl);
|
|
150
167
|
const queryParams = opts.args[0]?.query;
|
|
151
168
|
if (queryParams) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
} else {
|
|
156
|
-
targetUrl.searchParams.set(key, value);
|
|
157
|
-
}
|
|
169
|
+
const searchParams = buildSearchParamsOption(queryParams);
|
|
170
|
+
searchParams.forEach((value, key) => {
|
|
171
|
+
targetUrl.searchParams.append(key, value);
|
|
158
172
|
});
|
|
159
173
|
}
|
|
160
174
|
const establishWebSocket = (...args) => {
|
|
@@ -9,7 +9,7 @@ var mergePath = (base, path) => {
|
|
|
9
9
|
var replaceUrlParam = (urlString, params) => {
|
|
10
10
|
for (const [k, v] of Object.entries(params)) {
|
|
11
11
|
const reg = new RegExp("/:" + k + "(?:{[^/]+})?\\??(?=/|$)");
|
|
12
|
-
urlString = urlString.replace(reg, v ? `/${v}` : "");
|
|
12
|
+
urlString = urlString.replace(reg, () => v ? `/${v}` : "");
|
|
13
13
|
}
|
|
14
14
|
return urlString;
|
|
15
15
|
};
|
|
@@ -21,6 +21,9 @@ var buildSearchParams = (query) => {
|
|
|
21
21
|
}
|
|
22
22
|
if (Array.isArray(v)) {
|
|
23
23
|
for (const v2 of v) {
|
|
24
|
+
if (v2 === void 0) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
24
27
|
searchParams.append(k, v2);
|
|
25
28
|
}
|
|
26
29
|
} else {
|
|
@@ -202,6 +202,10 @@ var Context = class {
|
|
|
202
202
|
* c.header('X-Message', 'Hello!')
|
|
203
203
|
* c.header('Content-Type', 'text/plain')
|
|
204
204
|
*
|
|
205
|
+
* // Append multiple headers using the append option (e.g. Vary)
|
|
206
|
+
* c.header('Vary', 'Accept-Encoding', { append: true })
|
|
207
|
+
* c.header('Vary', 'User-Agent', { append: true })
|
|
208
|
+
*
|
|
205
209
|
* return c.body('Thank you for coming')
|
|
206
210
|
* })
|
|
207
211
|
* ```
|
|
@@ -1,9 +1,43 @@
|
|
|
1
1
|
// src/helper/accepts/accepts.ts
|
|
2
2
|
import { parseAccept } from "../../utils/accept.js";
|
|
3
|
+
var matchType = (acceptType, supportedType) => {
|
|
4
|
+
if (acceptType === supportedType) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
if (acceptType === "*/*" || acceptType === "*") {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
if (acceptType.endsWith("/*")) {
|
|
11
|
+
const [acceptMain] = acceptType.split("/");
|
|
12
|
+
const [supportedMain] = supportedType.split("/");
|
|
13
|
+
return acceptMain === supportedMain;
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
};
|
|
17
|
+
var getSpecificity = (type) => {
|
|
18
|
+
if (type === "*/*" || type === "*") {
|
|
19
|
+
return 1;
|
|
20
|
+
}
|
|
21
|
+
if (type.endsWith("/*")) {
|
|
22
|
+
return 2;
|
|
23
|
+
}
|
|
24
|
+
return 3;
|
|
25
|
+
};
|
|
3
26
|
var defaultMatch = (accepts2, config) => {
|
|
4
27
|
const { supports, default: defaultSupport } = config;
|
|
5
|
-
const
|
|
6
|
-
|
|
28
|
+
const sortedAccepts = accepts2.slice().sort((a, b) => {
|
|
29
|
+
if (b.q !== a.q) {
|
|
30
|
+
return b.q - a.q;
|
|
31
|
+
}
|
|
32
|
+
return getSpecificity(b.type) - getSpecificity(a.type);
|
|
33
|
+
});
|
|
34
|
+
for (const accept of sortedAccepts) {
|
|
35
|
+
const matched = supports.find((supported) => matchType(accept.type, supported));
|
|
36
|
+
if (matched) {
|
|
37
|
+
return matched;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return defaultSupport;
|
|
7
41
|
};
|
|
8
42
|
var accepts = (c, options) => {
|
|
9
43
|
const acceptHeader = c.req.header(options.header);
|
|
@@ -184,7 +184,7 @@ var saveContentToFile = async (data, fsModule, outDir, extensionMap) => {
|
|
|
184
184
|
const { routePath, content, mimeType } = awaitedData;
|
|
185
185
|
const filePath = generateFilePath(routePath, outDir, mimeType, extensionMap);
|
|
186
186
|
const dirPath = dirname(filePath);
|
|
187
|
-
if (!createdDirs.has(dirPath)) {
|
|
187
|
+
if (dirPath !== "" && !createdDirs.has(dirPath)) {
|
|
188
188
|
await fsModule.mkdir(dirPath, { recursive: true });
|
|
189
189
|
createdDirs.add(dirPath);
|
|
190
190
|
}
|
|
@@ -8,8 +8,14 @@ var dirname = (path) => {
|
|
|
8
8
|
var normalizePath = (path) => {
|
|
9
9
|
return path.replace(/(\\)/g, "/").replace(/\/$/g, "");
|
|
10
10
|
};
|
|
11
|
-
var
|
|
12
|
-
|
|
11
|
+
var getUncRoot = (path) => {
|
|
12
|
+
const uncRoot = path.replace(/\\/g, "/").match(/^\/\/([^/]+)\/([^/]+)/);
|
|
13
|
+
if (uncRoot) {
|
|
14
|
+
return `${uncRoot[1].toLowerCase()}/${uncRoot[2].toLowerCase()}`;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var handleParent = (resultPaths) => {
|
|
18
|
+
if (resultPaths.length === 0 || resultPaths[resultPaths.length - 1] === "..") {
|
|
13
19
|
resultPaths.push("..");
|
|
14
20
|
} else {
|
|
15
21
|
resultPaths.pop();
|
|
@@ -22,22 +28,20 @@ var handleNonDot = (path, resultPaths) => {
|
|
|
22
28
|
}
|
|
23
29
|
};
|
|
24
30
|
var handleSegments = (paths, resultPaths) => {
|
|
25
|
-
let beforeParentFlag = false;
|
|
26
31
|
for (const path of paths) {
|
|
27
32
|
if (path === "..") {
|
|
28
|
-
handleParent(resultPaths
|
|
29
|
-
beforeParentFlag = true;
|
|
33
|
+
handleParent(resultPaths);
|
|
30
34
|
} else {
|
|
31
35
|
handleNonDot(path, resultPaths);
|
|
32
|
-
beforeParentFlag = false;
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
};
|
|
36
39
|
var joinPaths = (...paths) => {
|
|
40
|
+
const hasUncPrefix = getUncRoot(paths[0]) !== void 0;
|
|
37
41
|
paths = paths.map(normalizePath);
|
|
38
42
|
const resultPaths = [];
|
|
39
43
|
handleSegments(paths.join("/").split("/"), resultPaths);
|
|
40
|
-
return (paths[0][0] === "/" ? "/" : "") + resultPaths.join("/");
|
|
44
|
+
return (hasUncPrefix ? "//" : paths[0][0] === "/" ? "/" : "") + resultPaths.join("/");
|
|
41
45
|
};
|
|
42
46
|
var filterStaticGenerateRoutes = (hono) => {
|
|
43
47
|
return hono.routes.reduce((acc, { method, handler, path }) => {
|
|
@@ -51,10 +55,26 @@ var filterStaticGenerateRoutes = (hono) => {
|
|
|
51
55
|
var isDynamicRoute = (path) => {
|
|
52
56
|
return path.split("/").some((segment) => segment.startsWith(":") || segment.includes("*"));
|
|
53
57
|
};
|
|
58
|
+
var toSegments = (path) => path === "" ? [] : path.split("/");
|
|
59
|
+
var getPathRoot = (path) => {
|
|
60
|
+
const normalizedPath = path.replace(/\\/g, "/");
|
|
61
|
+
const uncRoot = getUncRoot(normalizedPath);
|
|
62
|
+
if (uncRoot) {
|
|
63
|
+
return `unc:${uncRoot}`;
|
|
64
|
+
}
|
|
65
|
+
const driveRoot = normalizedPath.match(/^([A-Za-z]):/);
|
|
66
|
+
if (driveRoot) {
|
|
67
|
+
const kind = normalizedPath[2] === "/" ? "drive-absolute" : "drive-relative";
|
|
68
|
+
return `${kind}:${driveRoot[1].toLowerCase()}`;
|
|
69
|
+
}
|
|
70
|
+
return normalizedPath.startsWith("/") ? "absolute" : "relative";
|
|
71
|
+
};
|
|
54
72
|
var ensureWithinOutDir = (outDir, filePath) => {
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
|
|
73
|
+
const outDirSegments = toSegments(joinPaths(outDir));
|
|
74
|
+
const filePathSegments = toSegments(joinPaths(filePath));
|
|
75
|
+
const hasMismatchedPathRoot = getPathRoot(outDir) !== getPathRoot(filePath);
|
|
76
|
+
const climbsAboveOutDir = filePathSegments[outDirSegments.length] === "..";
|
|
77
|
+
if (hasMismatchedPathRoot || filePathSegments.length <= outDirSegments.length || !outDirSegments.every((segment, i) => segment === filePathSegments[i]) || climbsAboveOutDir) {
|
|
58
78
|
throw new Error(`Path traversal detected: "${filePath}" is outside the output directory`);
|
|
59
79
|
}
|
|
60
80
|
};
|
|
@@ -78,6 +78,7 @@ var applyProps = (container, attributes, oldAttributes) => {
|
|
|
78
78
|
} else if (key === "dangerouslySetInnerHTML" && value) {
|
|
79
79
|
container.innerHTML = value.__html;
|
|
80
80
|
} else if (key === "ref") {
|
|
81
|
+
refCleanupMap.get(container)?.();
|
|
81
82
|
let cleanup;
|
|
82
83
|
if (typeof value === "function") {
|
|
83
84
|
cleanup = value(container) || (() => value(null));
|
|
@@ -142,6 +143,7 @@ var applyProps = (container, attributes, oldAttributes) => {
|
|
|
142
143
|
container.removeEventListener(eventSpec[0], value, eventSpec[1]);
|
|
143
144
|
} else if (key === "ref") {
|
|
144
145
|
refCleanupMap.get(container)?.();
|
|
146
|
+
refCleanupMap.delete(container);
|
|
145
147
|
} else {
|
|
146
148
|
try {
|
|
147
149
|
container.removeAttribute(toAttributeName(container, key));
|
|
@@ -23,7 +23,7 @@ var parseVaryDirectives = (vary) => {
|
|
|
23
23
|
};
|
|
24
24
|
var createCacheKey = (key, requestUrl, request, varyHeaders) => {
|
|
25
25
|
const url = new URL(cacheKeyPath, requestUrl);
|
|
26
|
-
url.searchParams.append(cacheKeyParameter, key
|
|
26
|
+
url.searchParams.append(cacheKeyParameter, key);
|
|
27
27
|
url.searchParams.append(cacheMethodKeyParameter, request.method);
|
|
28
28
|
if (request.method === "QUERY") {
|
|
29
29
|
url.searchParams.append(queryDigestKeyParameter, request.digest);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { HTTPException } from "../../http-exception.js";
|
|
3
3
|
var secFetchSiteValues = ["same-origin", "same-site", "none", "cross-site"];
|
|
4
4
|
var isSecFetchSite = (value) => secFetchSiteValues.includes(value);
|
|
5
|
-
var isSafeMethodRe = /^(GET|HEAD)$/;
|
|
5
|
+
var isSafeMethodRe = /^(GET|HEAD|OPTIONS)$/;
|
|
6
6
|
var isRequestedByFormElementRe = /^\b(application\/x-www-form-urlencoded|multipart\/form-data|text\/plain)\b/i;
|
|
7
7
|
var csrf = (options) => {
|
|
8
8
|
const originHandler = ((optsOrigin) => {
|