@suveren/gateway 0.7.3 → 0.7.6
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/gmail.json +3 -6
- package/dist/control-plane/index.mjs +294 -62
- package/dist/mcp-server/http.mjs +467 -73
- package/dist/ui/assets/{index-CkWaRck1.css → index-BYVb_0oG.css} +1 -1
- package/dist/ui/assets/index-CsrM6RQr.js +110 -0
- package/dist/ui/index.html +2 -2
- package/node_modules/@hap/core/dist/index.d.mts +258 -9
- package/node_modules/@hap/core/dist/index.d.ts +258 -9
- package/node_modules/@hap/core/dist/index.js +227 -5
- package/node_modules/@hap/core/dist/index.mjs +213 -4
- package/node_modules/@hap/core/package.json +3 -2
- package/node_modules/@hap/core/src/did-key.ts +126 -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 +81 -5
- package/node_modules/@hono/node-server/dist/index.cjs +151 -9
- package/node_modules/@hono/node-server/dist/index.mjs +151 -9
- package/node_modules/@hono/node-server/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/README.md +2 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/package.json +1 -1
- 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/@modelcontextprotocol/sdk/node_modules/type-is/node_modules/content-type/README.md +2 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@modelcontextprotocol/sdk/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/type-is/node_modules/content-type/package.json +1 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/buffer.buffer.d.ts +5 -5
- package/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@types/node/http.d.ts +16 -0
- package/node_modules/@types/node/http2.d.ts +10 -2
- 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 +210 -28
- package/node_modules/@types/node/sqlite.d.ts +6 -2
- package/node_modules/@types/node/test.d.ts +36 -0
- package/node_modules/eventsource-parser/dist/index.cjs +2 -2
- package/node_modules/eventsource-parser/dist/index.cjs.map +1 -1
- package/node_modules/eventsource-parser/dist/index.js +2 -2
- package/node_modules/eventsource-parser/dist/index.js.map +1 -1
- package/node_modules/eventsource-parser/package.json +1 -1
- package/node_modules/eventsource-parser/src/parse.ts +4 -2
- package/node_modules/fast-uri/index.js +201 -48
- package/node_modules/fast-uri/lib/schemes.js +9 -4
- package/node_modules/fast-uri/lib/utils.js +388 -91
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/component-safe-serialization.test.js +105 -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 +90 -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 +27 -13
- 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/jsx/intrinsic-element/components.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/cors/index.js +16 -13
- package/node_modules/hono/dist/cjs/middleware/csrf/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/etag/digest.js +47 -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/middleware/secure-headers/secure-headers.js +6 -3
- 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 +11 -3
- package/node_modules/hono/dist/client/client.js +27 -13
- 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/jsx/intrinsic-element/components.js +1 -1
- package/node_modules/hono/dist/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/middleware/cors/index.js +16 -13
- package/node_modules/hono/dist/middleware/csrf/index.js +1 -1
- package/node_modules/hono/dist/middleware/etag/digest.js +47 -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/middleware/secure-headers/secure-headers.js +6 -3
- 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/middleware/secure-headers/permissions-policy.d.ts +3 -3
- 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 +11 -3
- package/node_modules/hono/package.json +1 -1
- package/node_modules/ip-address/README.md +134 -134
- package/node_modules/ip-address/dist/address-error.d.ts +11 -0
- package/node_modules/ip-address/dist/address-error.js.map +1 -1
- package/node_modules/ip-address/dist/ipv4.d.ts +22 -6
- package/node_modules/ip-address/dist/ipv4.js +22 -6
- package/node_modules/ip-address/dist/ipv4.js.map +1 -1
- package/node_modules/ip-address/dist/ipv6.d.ts +10 -3
- package/node_modules/ip-address/dist/ipv6.js +26 -17
- package/node_modules/ip-address/dist/ipv6.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/encrypt.d.ts +4 -3
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +4 -3
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +4 -3
- package/node_modules/jose/dist/types/jwks/remote.d.ts +4 -4
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +3 -3
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +12 -17
- package/node_modules/jose/dist/types/jwt/sign.d.ts +8 -14
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +9 -15
- package/node_modules/jose/dist/types/types.d.ts +4 -2
- package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +30 -8
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +8 -4
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +6 -13
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +19 -19
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +32 -21
- package/node_modules/jose/dist/webapi/jwk/embedded.js +15 -1
- package/node_modules/jose/dist/webapi/jwk/thumbprint.js +11 -5
- package/node_modules/jose/dist/webapi/jwks/local.js +45 -53
- package/node_modules/jose/dist/webapi/jwks/remote.js +82 -103
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +10 -9
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +2 -1
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +8 -7
- package/node_modules/jose/dist/webapi/jws/general/sign.js +5 -3
- package/node_modules/jose/dist/webapi/jws/general/verify.js +51 -21
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +7 -9
- package/node_modules/jose/dist/webapi/jwt/encrypt.js +21 -50
- package/node_modules/jose/dist/webapi/jwt/sign.js +8 -41
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +21 -42
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +6 -2
- package/node_modules/jose/dist/webapi/key/generate_secret.js +7 -6
- package/node_modules/jose/dist/webapi/key/import.js +16 -12
- package/node_modules/jose/dist/webapi/lib/asn1.js +7 -2
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +7 -15
- package/node_modules/jose/dist/webapi/lib/deflate.js +8 -0
- package/node_modules/jose/dist/webapi/lib/helpers.js +1 -1
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +85 -28
- package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +45 -13
- package/node_modules/jose/dist/webapi/lib/jwk_metadata.js +20 -0
- package/node_modules/jose/dist/webapi/lib/jws_sign.js +47 -36
- package/node_modules/jose/dist/webapi/lib/jws_verify.js +77 -45
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +82 -47
- package/node_modules/jose/dist/webapi/lib/key.js +24 -9
- package/node_modules/jose/dist/webapi/lib/key_management.js +10 -4
- package/node_modules/jose/dist/webapi/lib/key_options.js +6 -0
- package/node_modules/jose/dist/webapi/lib/options.js +26 -0
- package/node_modules/jose/dist/webapi/lib/type_checks.js +11 -13
- package/node_modules/jose/package.json +1 -1
- package/package.json +2 -2
- package/dist/ui/assets/index-DdJeSfV9.js +0 -110
- package/node_modules/@modelcontextprotocol/sdk/node_modules/negotiator/HISTORY.md +0 -114
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// src/middleware/pretty-json/index.ts
|
|
2
|
+
var jsonContentTypeRegex = /^application\/(?:[a-z0-9._-]+\+)?json(?=$|[;\s])/i;
|
|
2
3
|
var prettyJSON = (options) => {
|
|
3
4
|
const targetQuery = options?.query ?? "pretty";
|
|
4
5
|
return async function prettyJSON2(c, next) {
|
|
5
6
|
const pretty = options?.force || c.req.query(targetQuery) || c.req.query(targetQuery) === "";
|
|
6
7
|
await next();
|
|
7
|
-
|
|
8
|
+
const contentType = c.res.headers.get("Content-Type");
|
|
9
|
+
if (pretty && contentType && jsonContentTypeRegex.test(contentType)) {
|
|
8
10
|
const obj = await c.res.json();
|
|
9
11
|
c.res = new Response(JSON.stringify(obj, null, options?.space ?? 2), c.res);
|
|
10
12
|
}
|
|
@@ -137,14 +137,17 @@ function getPermissionsPolicyDirectives(policy) {
|
|
|
137
137
|
return Object.entries(policy).map(([directive, value]) => {
|
|
138
138
|
const kebabDirective = camelToKebab(directive);
|
|
139
139
|
if (typeof value === "boolean") {
|
|
140
|
-
return `${kebabDirective}=${value ? "*" : "
|
|
140
|
+
return `${kebabDirective}=${value ? "*" : "()"}`;
|
|
141
141
|
}
|
|
142
142
|
if (Array.isArray(value)) {
|
|
143
143
|
if (value.length === 0) {
|
|
144
144
|
return `${kebabDirective}=()`;
|
|
145
145
|
}
|
|
146
|
-
if (value.length === 1 &&
|
|
147
|
-
return `${kebabDirective}
|
|
146
|
+
if (value.length === 1 && value[0] === "*") {
|
|
147
|
+
return `${kebabDirective}=*`;
|
|
148
|
+
}
|
|
149
|
+
if (value.length === 1 && value[0] === "none") {
|
|
150
|
+
return `${kebabDirective}=()`;
|
|
148
151
|
}
|
|
149
152
|
const allowlist = value.map((item) => ["self", "src"].includes(item) ? item : `"${item}"`);
|
|
150
153
|
return `${kebabDirective}=(${allowlist.join(" ")})`;
|
|
@@ -46,13 +46,13 @@ var HonoRequest = class {
|
|
|
46
46
|
return key ? this.#getDecodedParam(key) : this.#getAllDecodedParams();
|
|
47
47
|
}
|
|
48
48
|
#getDecodedParam(key) {
|
|
49
|
-
const paramKey = this.#matchResult[0][this.routeIndex][1][key];
|
|
49
|
+
const paramKey = this.#matchResult[0][this.routeIndex]?.[1][key];
|
|
50
50
|
const param = this.#getParamValue(paramKey);
|
|
51
51
|
return param && tryDecodeURIComponent(param);
|
|
52
52
|
}
|
|
53
53
|
#getAllDecodedParams() {
|
|
54
54
|
const decoded = {};
|
|
55
|
-
const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);
|
|
55
|
+
const keys = Object.keys(this.#matchResult[0][this.routeIndex]?.[1] ?? {});
|
|
56
56
|
for (const key of keys) {
|
|
57
57
|
const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key]);
|
|
58
58
|
if (value !== void 0) {
|
|
@@ -292,10 +292,14 @@ var cloneRawRequest = async (req) => {
|
|
|
292
292
|
message: "Cannot clone request: body was already consumed and not cached. Please use HonoRequest methods (e.g., req.json(), req.text()) instead of consuming req.raw directly."
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
|
-
|
|
295
|
+
let body = await req[cacheKey]();
|
|
296
296
|
const headers = req.header();
|
|
297
|
-
if (
|
|
297
|
+
if (cacheKey === "json") {
|
|
298
|
+
body = JSON.stringify(body);
|
|
299
|
+
delete headers["content-length"];
|
|
300
|
+
} else if (body instanceof FormData) {
|
|
298
301
|
delete headers["content-type"];
|
|
302
|
+
delete headers["content-length"];
|
|
299
303
|
}
|
|
300
304
|
const requestInit = {
|
|
301
305
|
body,
|
|
@@ -29,7 +29,8 @@ var LinearRouter = class {
|
|
|
29
29
|
}
|
|
30
30
|
} else if (hasStar && !hasLabel) {
|
|
31
31
|
const endsWithStar = routePath.charCodeAt(routePath.length - 1) === 42;
|
|
32
|
-
const
|
|
32
|
+
const endsWithSlashStar = routePath.endsWith("/*");
|
|
33
|
+
const parts = (endsWithStar ? routePath.slice(0, endsWithSlashStar ? -2 : -1) : routePath).split(splitByStarRe);
|
|
33
34
|
const lastIndex = parts.length - 1;
|
|
34
35
|
for (let j = 0, pos = 0, len2 = parts.length; j < len2; j++) {
|
|
35
36
|
const part = parts[j];
|
|
@@ -39,7 +40,11 @@ var LinearRouter = class {
|
|
|
39
40
|
}
|
|
40
41
|
pos += part.length;
|
|
41
42
|
if (j === lastIndex) {
|
|
42
|
-
if (
|
|
43
|
+
if (endsWithSlashStar) {
|
|
44
|
+
if (pos !== path.length && path.charCodeAt(pos) !== 47) {
|
|
45
|
+
continue ROUTES_LOOP;
|
|
46
|
+
}
|
|
47
|
+
} else if (!endsWithStar && pos !== path.length && !(pos === path.length - 1 && path.charCodeAt(pos) === 47)) {
|
|
43
48
|
continue ROUTES_LOOP;
|
|
44
49
|
}
|
|
45
50
|
} else {
|
|
@@ -5,10 +5,8 @@ var PatternRouter = class {
|
|
|
5
5
|
name = "PatternRouter";
|
|
6
6
|
#routes = [];
|
|
7
7
|
add(method, path, handler) {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
path = path.slice(0, -2);
|
|
11
|
-
}
|
|
8
|
+
const suffix = path.endsWith("/*") ? "(?:$|/)" : path.endsWith("*") ? "" : "/?$";
|
|
9
|
+
path = path.replace(/\*$/, "");
|
|
12
10
|
if (path.at(-1) === "?") {
|
|
13
11
|
path = path.slice(0, -1);
|
|
14
12
|
this.add(method, path.replace(/\/[^/]+$/, ""), handler);
|
|
@@ -20,11 +18,7 @@ var PatternRouter = class {
|
|
|
20
18
|
}
|
|
21
19
|
);
|
|
22
20
|
try {
|
|
23
|
-
this.#routes.push([
|
|
24
|
-
new RegExp(`^${parts.join("")}${endsWithWildcard ? "" : "/?$"}`),
|
|
25
|
-
method,
|
|
26
|
-
handler
|
|
27
|
-
]);
|
|
21
|
+
this.#routes.push([new RegExp(`^${parts.join("")}${suffix}`), method, handler]);
|
|
28
22
|
} catch {
|
|
29
23
|
throw new UnsupportedPathError();
|
|
30
24
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/router/reg-exp-router/node.ts
|
|
2
|
+
import { createNullObject } from "../utils.js";
|
|
2
3
|
var LABEL_REG_EXP_STR = "[^/]+";
|
|
3
4
|
var ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
4
5
|
var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
@@ -27,7 +28,7 @@ var Node = class _Node {
|
|
|
27
28
|
// handler index of a dynamic path, or -1 for a static path terminal
|
|
28
29
|
#index;
|
|
29
30
|
#varIndex;
|
|
30
|
-
#children =
|
|
31
|
+
#children = createNullObject();
|
|
31
32
|
insert(tokens, index, paramMap, context, isStatic) {
|
|
32
33
|
let node = this;
|
|
33
34
|
for (let i = 0, len = tokens.length; i < len; i++) {
|
|
@@ -105,6 +106,9 @@ var Node = class _Node {
|
|
|
105
106
|
}
|
|
106
107
|
};
|
|
107
108
|
export {
|
|
109
|
+
LABEL_REG_EXP_STR,
|
|
108
110
|
Node,
|
|
109
|
-
|
|
111
|
+
ONLY_WILDCARD_REG_EXP_STR,
|
|
112
|
+
PATH_ERROR,
|
|
113
|
+
TAIL_WILDCARD_REG_EXP_STR
|
|
110
114
|
};
|
|
@@ -5,25 +5,25 @@ import {
|
|
|
5
5
|
UnsupportedPathError
|
|
6
6
|
} from "../../router.js";
|
|
7
7
|
import { checkOptionalParameter } from "../../utils/url.js";
|
|
8
|
+
import { createNullObject } from "../utils.js";
|
|
8
9
|
import { match, emptyParam } from "./matcher.js";
|
|
9
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
LABEL_REG_EXP_STR,
|
|
12
|
+
ONLY_WILDCARD_REG_EXP_STR,
|
|
13
|
+
PATH_ERROR,
|
|
14
|
+
TAIL_WILDCARD_REG_EXP_STR
|
|
15
|
+
} from "./node.js";
|
|
10
16
|
import { Trie } from "./trie.js";
|
|
11
|
-
var wildcardRegExpCache =
|
|
17
|
+
var wildcardRegExpCache = createNullObject();
|
|
12
18
|
function buildWildcardRegExp(path) {
|
|
13
19
|
return wildcardRegExpCache[path] ??= new RegExp(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
(
|
|
20
|
+
`^${path.replace(
|
|
21
|
+
/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,
|
|
22
|
+
(match2, metaChar) => metaChar ? `\\${metaChar}` : match2 === "/*" ? TAIL_WILDCARD_REG_EXP_STR : match2 === "*" ? ONLY_WILDCARD_REG_EXP_STR : `/:${LABEL_REG_EXP_STR}`
|
|
17
23
|
)}$`
|
|
18
24
|
);
|
|
19
25
|
}
|
|
20
|
-
function clearWildcardRegExpCache() {
|
|
21
|
-
wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
22
|
-
}
|
|
23
26
|
function findMiddleware(middleware, path) {
|
|
24
|
-
if (!middleware) {
|
|
25
|
-
return void 0;
|
|
26
|
-
}
|
|
27
27
|
for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
|
|
28
28
|
if (buildWildcardRegExp(k).test(path)) {
|
|
29
29
|
return [...middleware[k]];
|
|
@@ -37,8 +37,8 @@ var RegExpRouter = class {
|
|
|
37
37
|
#routes;
|
|
38
38
|
#tries;
|
|
39
39
|
constructor() {
|
|
40
|
-
this.#middleware = { [METHOD_NAME_ALL]:
|
|
41
|
-
this.#routes = { [METHOD_NAME_ALL]:
|
|
40
|
+
this.#middleware = { [METHOD_NAME_ALL]: createNullObject() };
|
|
41
|
+
this.#routes = { [METHOD_NAME_ALL]: createNullObject() };
|
|
42
42
|
this.#tries = { [METHOD_NAME_ALL]: new Trie() };
|
|
43
43
|
}
|
|
44
44
|
#insertPath(method, path) {
|
|
@@ -51,117 +51,86 @@ var RegExpRouter = class {
|
|
|
51
51
|
add(method, path, handler) {
|
|
52
52
|
const middleware = this.#middleware;
|
|
53
53
|
const routes = this.#routes;
|
|
54
|
-
if (!middleware
|
|
54
|
+
if (!middleware) {
|
|
55
55
|
throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
56
56
|
}
|
|
57
57
|
if (!middleware[method]) {
|
|
58
58
|
this.#tries[method] = new Trie();
|
|
59
|
-
[middleware, routes]
|
|
60
|
-
handlerMap[method] =
|
|
61
|
-
|
|
59
|
+
for (const handlerMap of [middleware, routes]) {
|
|
60
|
+
handlerMap[method] = createNullObject();
|
|
61
|
+
for (const p in handlerMap[METHOD_NAME_ALL]) {
|
|
62
62
|
handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]];
|
|
63
63
|
this.#insertPath(method, p);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
66
|
}
|
|
67
67
|
if (path === "/*") {
|
|
68
68
|
path = "*";
|
|
69
69
|
}
|
|
70
|
-
const
|
|
70
|
+
const methods = method === METHOD_NAME_ALL ? Object.keys(middleware) : [method];
|
|
71
71
|
if (/\*$/.test(path)) {
|
|
72
72
|
const re = buildWildcardRegExp(path);
|
|
73
|
-
|
|
74
|
-
if (
|
|
73
|
+
for (const m of methods) {
|
|
74
|
+
if (!middleware[m][path]) {
|
|
75
75
|
this.#insertPath(m, path);
|
|
76
76
|
middleware[m][path] = findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
|
|
77
77
|
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
re.test(p) &&
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
Object.keys(routes).forEach((m) => {
|
|
87
|
-
if (method === METHOD_NAME_ALL || method === m) {
|
|
88
|
-
Object.keys(routes[m]).forEach(
|
|
89
|
-
(p) => re.test(p) && routes[m][p].push([handler, paramCount])
|
|
90
|
-
);
|
|
78
|
+
}
|
|
79
|
+
for (const handlerMap of [middleware, routes]) {
|
|
80
|
+
for (const m of methods) {
|
|
81
|
+
for (const p in handlerMap[m]) {
|
|
82
|
+
re.test(p) && handlerMap[m][p].push([handler, path]);
|
|
83
|
+
}
|
|
91
84
|
}
|
|
92
|
-
}
|
|
85
|
+
}
|
|
93
86
|
return;
|
|
94
87
|
}
|
|
95
88
|
const paths = checkOptionalParameter(path) || [path];
|
|
96
|
-
for (
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.#insertPath(m, path2);
|
|
102
|
-
routes[m][path2] = [
|
|
103
|
-
...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []
|
|
104
|
-
];
|
|
105
|
-
}
|
|
106
|
-
routes[m][path2].push([handler, paramCount - len + i + 1]);
|
|
89
|
+
for (const path2 of paths) {
|
|
90
|
+
for (const m of methods) {
|
|
91
|
+
if (!routes[m][path2]) {
|
|
92
|
+
this.#insertPath(m, path2);
|
|
93
|
+
routes[m][path2] = findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || [];
|
|
107
94
|
}
|
|
108
|
-
|
|
95
|
+
routes[m][path2].push([handler, path2]);
|
|
96
|
+
}
|
|
109
97
|
}
|
|
110
98
|
}
|
|
111
99
|
match = match;
|
|
112
100
|
buildAllMatchers() {
|
|
113
|
-
const matchers =
|
|
114
|
-
Object.keys(this.#routes)
|
|
115
|
-
matchers[method]
|
|
116
|
-
}
|
|
101
|
+
const matchers = createNullObject();
|
|
102
|
+
for (const method of Object.keys(this.#routes)) {
|
|
103
|
+
matchers[method] = this.#buildMatcher(method);
|
|
104
|
+
}
|
|
117
105
|
this.#middleware = this.#routes = this.#tries = void 0;
|
|
118
|
-
|
|
106
|
+
wildcardRegExpCache = createNullObject();
|
|
119
107
|
return matchers;
|
|
120
108
|
}
|
|
121
109
|
#buildMatcher(method) {
|
|
122
110
|
const middleware = this.#middleware[method];
|
|
123
111
|
const routes = this.#routes[method];
|
|
124
112
|
const trie = this.#tries[method];
|
|
125
|
-
const staticMap =
|
|
113
|
+
const staticMap = createNullObject();
|
|
126
114
|
const handlerData = [];
|
|
127
|
-
[
|
|
115
|
+
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
116
|
+
for (const r of [middleware, routes]) {
|
|
128
117
|
for (const path in r) {
|
|
129
118
|
const handlers = r[path];
|
|
130
119
|
const pathData = trie.paths[path];
|
|
131
120
|
if (!pathData) {
|
|
132
|
-
staticMap[path] = [handlers.map(([h]) => [h,
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
const paramAssoc = pathData[1];
|
|
136
|
-
handlerData[pathData[0]] = handlers.map(([h, paramCount]) => {
|
|
137
|
-
const paramIndexMap = /* @__PURE__ */ Object.create(null);
|
|
138
|
-
paramCount -= 1;
|
|
139
|
-
for (; paramCount >= 0; paramCount--) {
|
|
140
|
-
const [key, value] = paramAssoc[paramCount];
|
|
141
|
-
paramIndexMap[key] = value;
|
|
142
|
-
}
|
|
143
|
-
return [h, paramIndexMap];
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
148
|
-
for (let i = 0, len = handlerData.length; i < len; i++) {
|
|
149
|
-
for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {
|
|
150
|
-
const map = handlerData[i][j]?.[1];
|
|
151
|
-
if (!map) {
|
|
121
|
+
staticMap[path] = [handlers.map(([h]) => [h, createNullObject()]), emptyParam];
|
|
152
122
|
continue;
|
|
153
123
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
124
|
+
handlerData[pathData[0]] = handlers.map(([h, handlerPath]) => [
|
|
125
|
+
h,
|
|
126
|
+
trie.paths[handlerPath][1].reduceRight((map, [key], i) => {
|
|
127
|
+
map[key] = paramReplacementMap[pathData[1][i][1]];
|
|
128
|
+
return map;
|
|
129
|
+
}, createNullObject())
|
|
130
|
+
]);
|
|
158
131
|
}
|
|
159
132
|
}
|
|
160
|
-
|
|
161
|
-
for (const i in indexReplacementMap) {
|
|
162
|
-
handlerMap[i] = handlerData[indexReplacementMap[i]];
|
|
163
|
-
}
|
|
164
|
-
return [regexp, handlerMap, staticMap];
|
|
133
|
+
return [regexp, indexReplacementMap.map((i) => handlerData[i]), staticMap];
|
|
165
134
|
}
|
|
166
135
|
};
|
|
167
136
|
export {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// src/router/reg-exp-router/trie.ts
|
|
2
|
+
import { createNullObject } from "../utils.js";
|
|
2
3
|
import { Node } from "./node.js";
|
|
3
4
|
var Trie = class {
|
|
4
5
|
#context = { varIndex: 0 };
|
|
5
6
|
#root = new Node();
|
|
6
7
|
#index = 0;
|
|
7
8
|
// dynamic path -> [handler index, param assoc]; static paths are not registered
|
|
8
|
-
paths =
|
|
9
|
+
paths = createNullObject();
|
|
9
10
|
insert(path, isStatic) {
|
|
10
11
|
if (isStatic) {
|
|
11
12
|
this.#root.insert(path.split(""), 0, [], this.#context, true);
|
|
@@ -1,77 +1,53 @@
|
|
|
1
1
|
// src/router/trie-router/node.ts
|
|
2
2
|
import { METHOD_NAME_ALL } from "../../router.js";
|
|
3
3
|
import { getPattern, splitPath, splitRoutingPath } from "../../utils/url.js";
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
return false;
|
|
10
|
-
};
|
|
4
|
+
import { createNullObject } from "../utils.js";
|
|
5
|
+
var emptyParams = createNullObject();
|
|
6
|
+
var order = 0;
|
|
11
7
|
var Node = class _Node {
|
|
12
|
-
#methods;
|
|
13
|
-
#children;
|
|
14
|
-
#patterns;
|
|
15
|
-
#
|
|
8
|
+
#methods = [];
|
|
9
|
+
#children = createNullObject();
|
|
10
|
+
#patterns = [];
|
|
11
|
+
#pattern;
|
|
16
12
|
#params = emptyParams;
|
|
17
|
-
constructor(method, handler, children) {
|
|
18
|
-
this.#children = children || /* @__PURE__ */ Object.create(null);
|
|
19
|
-
this.#methods = [];
|
|
20
|
-
if (method && handler) {
|
|
21
|
-
const m = /* @__PURE__ */ Object.create(null);
|
|
22
|
-
m[method] = { handler, possibleKeys: [], score: 0 };
|
|
23
|
-
this.#methods = [m];
|
|
24
|
-
}
|
|
25
|
-
this.#patterns = [];
|
|
26
|
-
}
|
|
27
13
|
insert(method, path, handler) {
|
|
28
|
-
this.#order = ++this.#order;
|
|
29
14
|
let curNode = this;
|
|
30
15
|
const parts = splitRoutingPath(path);
|
|
31
|
-
const possibleKeys =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const nextP = parts[i
|
|
35
|
-
const pattern = getPattern(p, nextP);
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
continue;
|
|
16
|
+
const possibleKeys = /* @__PURE__ */ new Set();
|
|
17
|
+
let i = 0;
|
|
18
|
+
for (const p of parts) {
|
|
19
|
+
const nextP = parts[++i];
|
|
20
|
+
const pattern = getPattern(p, nextP) || (nextP === void 0 && p && p.indexOf("*") === p.length - 1 ? p : null);
|
|
21
|
+
const isParam = Array.isArray(pattern);
|
|
22
|
+
const key = isParam ? pattern[0] : pattern || p;
|
|
23
|
+
const child = curNode.#children[key] ||= new _Node();
|
|
24
|
+
if (pattern && !child.#pattern) {
|
|
25
|
+
child.#pattern = pattern;
|
|
26
|
+
curNode.#patterns.push(child);
|
|
43
27
|
}
|
|
44
|
-
curNode
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
possibleKeys.push(pattern[1]);
|
|
28
|
+
curNode = child;
|
|
29
|
+
if (isParam) {
|
|
30
|
+
possibleKeys.add(pattern[1]);
|
|
48
31
|
}
|
|
49
|
-
curNode = curNode.#children[key];
|
|
50
32
|
}
|
|
51
33
|
curNode.#methods.push({
|
|
52
34
|
[method]: {
|
|
53
35
|
handler,
|
|
54
|
-
possibleKeys: possibleKeys
|
|
55
|
-
score:
|
|
36
|
+
possibleKeys: [...possibleKeys],
|
|
37
|
+
score: ++order
|
|
56
38
|
}
|
|
57
39
|
});
|
|
58
|
-
return curNode;
|
|
59
40
|
}
|
|
60
41
|
#pushHandlerSets(handlerSets, node, method, nodeParams, params) {
|
|
61
42
|
for (let i = 0, len = node.#methods.length; i < len; i++) {
|
|
62
43
|
const m = node.#methods[i];
|
|
63
44
|
const handlerSet = m[method] || m[METHOD_NAME_ALL];
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
handlerSet.params = /* @__PURE__ */ Object.create(null);
|
|
45
|
+
if (handlerSet) {
|
|
46
|
+
handlerSet.params = createNullObject();
|
|
67
47
|
handlerSets.push(handlerSet);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const processed = processedSet[handlerSet.score];
|
|
72
|
-
handlerSet.params[key] = params?.[key] && !processed ? params[key] : nodeParams[key] ?? params?.[key];
|
|
73
|
-
processedSet[handlerSet.score] = true;
|
|
74
|
-
}
|
|
48
|
+
for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {
|
|
49
|
+
const key = handlerSet.possibleKeys[i2];
|
|
50
|
+
handlerSet.params[key] = params?.[key] && !i2 ? params[key] : nodeParams[key] ?? params?.[key];
|
|
75
51
|
}
|
|
76
52
|
}
|
|
77
53
|
}
|
|
@@ -103,33 +79,33 @@ var Node = class _Node {
|
|
|
103
79
|
tempNodes.push(nextNode);
|
|
104
80
|
}
|
|
105
81
|
}
|
|
106
|
-
for (
|
|
107
|
-
const pattern =
|
|
82
|
+
for (const child of node.#patterns) {
|
|
83
|
+
const pattern = child.#pattern;
|
|
108
84
|
const params = node.#params === emptyParams ? {} : { ...node.#params };
|
|
109
|
-
if (pattern === "
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
85
|
+
if (typeof pattern === "string") {
|
|
86
|
+
if (pattern === "*" || part.startsWith(pattern.slice(0, -1))) {
|
|
87
|
+
this.#pushHandlerSets(handlerSets, child, method, node.#params);
|
|
88
|
+
if (pattern === "*") {
|
|
89
|
+
child.#params = params;
|
|
90
|
+
tempNodes.push(child);
|
|
91
|
+
}
|
|
115
92
|
}
|
|
116
93
|
continue;
|
|
117
94
|
}
|
|
118
|
-
const [
|
|
119
|
-
if (!part &&
|
|
95
|
+
const [, name, matcher] = pattern;
|
|
96
|
+
if (!part && matcher === true) {
|
|
120
97
|
continue;
|
|
121
98
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
partOffsets = new Array(len);
|
|
99
|
+
if (matcher !== true) {
|
|
100
|
+
if (!partOffsets) {
|
|
101
|
+
partOffsets = [];
|
|
126
102
|
let offset = path[0] === "/" ? 1 : 0;
|
|
127
103
|
for (let p = 0; p < len; p++) {
|
|
128
104
|
partOffsets[p] = offset;
|
|
129
105
|
offset += parts[p].length + 1;
|
|
130
106
|
}
|
|
131
107
|
}
|
|
132
|
-
const restPathString = path.
|
|
108
|
+
const restPathString = path.slice(partOffsets[i]);
|
|
133
109
|
const m = matcher.exec(restPathString);
|
|
134
110
|
if (m) {
|
|
135
111
|
params[name] = m[0];
|
|
@@ -143,11 +119,12 @@ var Node = class _Node {
|
|
|
143
119
|
params
|
|
144
120
|
);
|
|
145
121
|
}
|
|
146
|
-
|
|
122
|
+
for (const _ in child.#children) {
|
|
147
123
|
child.#params = params;
|
|
148
124
|
const componentCount = m[0].match(/\//g)?.length ?? 0;
|
|
149
125
|
const targetCurNodes = curNodesQueue[componentCount] ||= [];
|
|
150
126
|
targetCurNodes.push(child);
|
|
127
|
+
break;
|
|
151
128
|
}
|
|
152
129
|
continue;
|
|
153
130
|
}
|
|
@@ -175,7 +152,7 @@ var Node = class _Node {
|
|
|
175
152
|
const shifted = curNodesQueue.shift();
|
|
176
153
|
curNodes = shifted ? tempNodes.concat(shifted) : tempNodes;
|
|
177
154
|
}
|
|
178
|
-
if (handlerSets
|
|
155
|
+
if (handlerSets[1]) {
|
|
179
156
|
handlerSets.sort((a, b) => {
|
|
180
157
|
return a.score - b.score;
|
|
181
158
|
});
|
|
@@ -3,19 +3,11 @@ import { checkOptionalParameter } from "../../utils/url.js";
|
|
|
3
3
|
import { Node } from "./node.js";
|
|
4
4
|
var TrieRouter = class {
|
|
5
5
|
name = "TrieRouter";
|
|
6
|
-
#node;
|
|
7
|
-
constructor() {
|
|
8
|
-
this.#node = new Node();
|
|
9
|
-
}
|
|
6
|
+
#node = new Node();
|
|
10
7
|
add(method, path, handler) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
for (let i = 0, len = results.length; i < len; i++) {
|
|
14
|
-
this.#node.insert(method, results[i], handler);
|
|
15
|
-
}
|
|
16
|
-
return;
|
|
8
|
+
for (const result of checkOptionalParameter(path) || [path]) {
|
|
9
|
+
this.#node.insert(method, result, handler);
|
|
17
10
|
}
|
|
18
|
-
this.#node.insert(method, path, handler);
|
|
19
11
|
}
|
|
20
12
|
match(method, path) {
|
|
21
13
|
return this.#node.search(method, path);
|
|
@@ -323,6 +323,10 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
|
|
|
323
323
|
* c.header('X-Message', 'Hello!')
|
|
324
324
|
* c.header('Content-Type', 'text/plain')
|
|
325
325
|
*
|
|
326
|
+
* // Append multiple headers using the append option (e.g. Vary)
|
|
327
|
+
* c.header('Vary', 'Accept-Encoding', { append: true })
|
|
328
|
+
* c.header('Vary', 'User-Agent', { append: true })
|
|
329
|
+
*
|
|
326
330
|
* return c.body('Thank you for coming')
|
|
327
331
|
* })
|
|
328
332
|
* ```
|
|
@@ -2,13 +2,13 @@ export type PermissionsPolicyDirective = StandardizedFeatures | ProposedFeatures
|
|
|
2
2
|
/**
|
|
3
3
|
* These features have been declared in a published version of the respective specification.
|
|
4
4
|
*/
|
|
5
|
-
type StandardizedFeatures = 'accelerometer' | 'ambientLightSensor' | 'attributionReporting' | 'autoplay' | 'battery' | 'bluetooth' | 'camera' | 'chUa' | 'chUaArch' | 'chUaBitness' | 'chUaFullVersion' | 'chUaFullVersionList' | 'chUaMobile' | 'chUaModel' | 'chUaPlatform' | 'chUaPlatformVersion' | 'chUaWow64' | 'computePressure' | 'crossOriginIsolated' | 'directSockets' | 'displayCapture' | 'encryptedMedia' | 'executionWhileNotRendered' | 'executionWhileOutOfViewport' | 'fullscreen' | 'geolocation' | 'gyroscope' | 'hid' | 'identityCredentialsGet' | 'idleDetection' | 'keyboardMap' | 'magnetometer' | 'microphone' | 'midi' | 'navigationOverride' | 'payment' | 'pictureInPicture' | 'publickeyCredentialsGet' | 'screenWakeLock' | 'serial' | 'storageAccess' | 'syncXhr' | 'usb' | 'webShare' | 'windowManagement' | 'xrSpatialTracking';
|
|
5
|
+
type StandardizedFeatures = 'accelerometer' | 'ambientLightSensor' | 'attributionReporting' | 'autoplay' | 'battery' | 'bluetooth' | 'camera' | 'chUa' | 'chUaArch' | 'chUaBitness' | 'chUaFullVersion' | 'chUaFullVersionList' | 'chUaHighEntropyValues' | 'chUaMobile' | 'chUaModel' | 'chUaPlatform' | 'chUaPlatformVersion' | 'chUaWow64' | 'computePressure' | 'crossOriginIsolated' | 'directSockets' | 'displayCapture' | 'encryptedMedia' | 'executionWhileNotRendered' | 'executionWhileOutOfViewport' | 'fullscreen' | 'geolocation' | 'gyroscope' | 'hid' | 'identityCredentialsGet' | 'idleDetection' | 'keyboardMap' | 'magnetometer' | 'mediasession' | 'microphone' | 'midi' | 'navigationOverride' | 'otpCredentials' | 'payment' | 'pictureInPicture' | 'publickeyCredentialsGet' | 'screenWakeLock' | 'serial' | 'storageAccess' | 'syncXhr' | 'tools' | 'usb' | 'webShare' | 'windowManagement' | 'xrSpatialTracking';
|
|
6
6
|
/**
|
|
7
7
|
* These features have been proposed, but the definitions have not yet been integrated into their respective specs.
|
|
8
8
|
*/
|
|
9
|
-
type ProposedFeatures = 'clipboardRead' | 'clipboardWrite' | 'gamepad' | 'sharedAutofill' | 'speakerSelection';
|
|
9
|
+
type ProposedFeatures = 'autofill' | 'clipboardRead' | 'clipboardWrite' | 'deferredFetch' | 'gamepad' | 'languageDetector' | 'languageModel' | 'manualText' | 'rewriter' | 'sharedAutofill' | 'speakerSelection' | 'summarizer' | 'translator' | 'writer';
|
|
10
10
|
/**
|
|
11
11
|
* These features generally have an explainer only, but may be available for experimentation by web developers.
|
|
12
12
|
*/
|
|
13
|
-
type ExperimentalFeatures = 'allScreensCapture' | 'browsingTopics' | 'capturedSurfaceControl' | 'conversionMeasurement' | 'digitalCredentialsGet' | 'focusWithoutUserActivation' | 'joinAdInterestGroup' | 'localFonts' | 'runAdAuction' | 'smartCard' | 'syncScript' | 'trustTokenRedemption' | 'unload' | 'verticalScroll';
|
|
13
|
+
type ExperimentalFeatures = 'allScreensCapture' | 'browsingTopics' | 'capturedSurfaceControl' | 'conversionMeasurement' | 'digitalCredentialsCreate' | 'digitalCredentialsGet' | 'focusWithoutUserActivation' | 'joinAdInterestGroup' | 'localFonts' | 'monetization' | 'runAdAuction' | 'smartCard' | 'syncScript' | 'trustTokenRedemption' | 'unload' | 'verticalScroll';
|
|
14
14
|
export {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export declare const LABEL_REG_EXP_STR = "[^/]+";
|
|
2
|
+
export declare const ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
3
|
+
export declare const TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
1
4
|
export declare const PATH_ERROR: unique symbol;
|
|
2
5
|
export type ParamAssocArray = [string, number][];
|
|
3
6
|
export interface Context {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Params } from '../../router';
|
|
2
2
|
export declare class Node<T> {
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
insert(method: string, path: string, handler: T): Node<T>;
|
|
4
|
+
insert(method: string, path: string, handler: T): void;
|
|
6
5
|
search(method: string, path: string): [[T, Params][]];
|
|
7
6
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createNullObject: () => any;
|