@zuplo/cli 7.4.5 → 7.4.7
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/@modelcontextprotocol/client/node_modules/jose/dist/types/jwks/remote.d.ts +4 -4
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/general/verify.d.ts +3 -3
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/encrypt.d.ts +8 -14
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/sign.d.ts +8 -14
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/unsecured.d.ts +9 -15
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +30 -8
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +8 -4
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +6 -13
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/decrypt.js +19 -19
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/encrypt.js +27 -20
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwk/embedded.js +15 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwk/thumbprint.js +11 -5
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/local.js +45 -53
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/remote.js +82 -103
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/compact/sign.js +10 -9
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/flattened/sign.js +2 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/flattened/verify.js +8 -7
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/general/sign.js +5 -3
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/general/verify.js +51 -21
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/decrypt.js +7 -9
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/encrypt.js +21 -50
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/sign.js +8 -41
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/unsecured.js +21 -42
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/generate_key_pair.js +6 -2
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/generate_secret.js +7 -6
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/import.js +16 -12
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/asn1.js +7 -2
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/content_encryption.js +7 -15
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/deflate.js +8 -0
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/helpers.js +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +85 -28
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +40 -12
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwk_metadata.js +20 -0
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jws_sign.js +47 -36
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jws_verify.js +77 -45
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +82 -47
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key.js +24 -9
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key_management.js +10 -4
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key_options.js +6 -0
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/options.js +26 -0
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/type_checks.js +11 -13
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwks/remote.d.ts +4 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/general/verify.d.ts +3 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/encrypt.d.ts +8 -14
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/sign.d.ts +8 -14
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/unsecured.d.ts +9 -15
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +30 -8
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +8 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +6 -13
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/decrypt.js +19 -19
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/encrypt.js +27 -20
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwk/embedded.js +15 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwk/thumbprint.js +11 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/local.js +45 -53
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +82 -103
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/compact/sign.js +10 -9
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/flattened/sign.js +2 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/flattened/verify.js +8 -7
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/sign.js +5 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/verify.js +51 -21
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/decrypt.js +7 -9
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/encrypt.js +21 -50
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/sign.js +8 -41
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/unsecured.js +21 -42
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/generate_key_pair.js +6 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/generate_secret.js +7 -6
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/import.js +16 -12
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/asn1.js +7 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/content_encryption.js +7 -15
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/deflate.js +8 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/helpers.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +85 -28
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +40 -12
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwk_metadata.js +20 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_sign.js +47 -36
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_verify.js +77 -45
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +82 -47
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key.js +24 -9
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_management.js +10 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_options.js +6 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/options.js +26 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/type_checks.js +11 -13
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +1 -1
- package/node_modules/@posthog/core/dist/featureFlagLocalEvaluation.d.ts +35 -0
- package/node_modules/@posthog/core/dist/featureFlagLocalEvaluation.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/featureFlagLocalEvaluation.js +352 -0
- package/node_modules/@posthog/core/dist/featureFlagLocalEvaluation.mjs +294 -0
- package/node_modules/@posthog/core/dist/index.d.ts +2 -0
- package/node_modules/@posthog/core/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/index.js +164 -79
- package/node_modules/@posthog/core/dist/index.mjs +2 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +12 -18
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.js +15 -47
- package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +15 -47
- package/node_modules/@posthog/core/dist/surveys/index.d.ts +1 -0
- package/node_modules/@posthog/core/dist/surveys/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/surveys/index.js +13 -0
- package/node_modules/@posthog/core/dist/surveys/index.mjs +2 -1
- package/node_modules/@posthog/core/dist/surveys/property-matching.d.ts +11 -0
- package/node_modules/@posthog/core/dist/surveys/property-matching.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/surveys/property-matching.js +89 -0
- package/node_modules/@posthog/core/dist/surveys/property-matching.mjs +46 -0
- package/node_modules/@posthog/core/dist/types.d.ts +15 -4
- package/node_modules/@posthog/core/dist/types.d.ts.map +1 -1
- package/node_modules/@posthog/core/package.json +2 -2
- package/node_modules/@posthog/core/src/featureFlagLocalEvaluation.ts +375 -0
- package/node_modules/@posthog/core/src/index.ts +19 -0
- package/node_modules/@posthog/core/src/logs/index.spec.ts +77 -0
- package/node_modules/@posthog/core/src/logs/index.ts +1 -1
- package/node_modules/@posthog/core/src/posthog-core-stateless.ts +40 -65
- package/node_modules/@posthog/core/src/surveys/index.ts +1 -0
- package/node_modules/@posthog/core/src/surveys/property-matching.spec.ts +174 -0
- package/node_modules/@posthog/core/src/surveys/property-matching.ts +75 -0
- package/node_modules/@posthog/core/src/types.ts +20 -4
- package/node_modules/@posthog/types/dist/index.d.ts +1 -1
- package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/posthog-config.d.ts +20 -5
- package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/index.ts +1 -0
- package/node_modules/@posthog/types/src/posthog-config.ts +21 -5
- package/node_modules/@zuplo/core/customer.cli.minified.js +269 -269
- package/node_modules/@zuplo/core/index.minified.js +276 -276
- 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/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-IZE65N7D.js → chunk-CUK3VROF.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-4CDML74A.js → chunk-K4TBJG47.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-4VE55TG3.js → chunk-S4EBLGSU.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-4POCC75H.js → chunk-XF3IIUDX.js} +4 -4
- package/node_modules/@zuplo/runtime/out/esm/{chunk-4POCC75H.js.map → chunk-XF3IIUDX.js.map} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-XIFGUD6K.js +403 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-XIFGUD6K.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +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/package.json +1 -1
- 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 +25 -11
- package/node_modules/hono/dist/cjs/client/utils.js +3 -0
- package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +36 -2
- package/node_modules/hono/dist/cjs/jsx/dom/render.js +2 -0
- package/node_modules/hono/dist/cjs/middleware/etag/index.js +1 -1
- package/node_modules/hono/dist/cjs/request.js +8 -4
- 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 +4 -3
- package/node_modules/hono/dist/cjs/router/utils.js +27 -0
- package/node_modules/hono/dist/cjs/utils/cookie.js +1 -1
- package/node_modules/hono/dist/cjs/utils/stream.js +7 -1
- package/node_modules/hono/dist/client/client.js +25 -11
- package/node_modules/hono/dist/client/utils.js +3 -0
- package/node_modules/hono/dist/helper/accepts/accepts.js +36 -2
- package/node_modules/hono/dist/jsx/dom/render.js +2 -0
- package/node_modules/hono/dist/middleware/etag/index.js +1 -1
- package/node_modules/hono/dist/request.js +8 -4
- 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 +4 -3
- package/node_modules/hono/dist/router/utils.js +5 -0
- package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +3 -0
- package/node_modules/hono/dist/types/router/utils.d.ts +1 -0
- package/node_modules/hono/dist/utils/cookie.js +1 -1
- package/node_modules/hono/dist/utils/stream.js +7 -1
- package/node_modules/hono/package.json +1 -1
- package/package.json +11 -11
- package/node_modules/@zuplo/runtime/out/esm/chunk-4SX4HBWT.js +0 -409
- package/node_modules/@zuplo/runtime/out/esm/chunk-4SX4HBWT.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-IZE65N7D.js.map → chunk-CUK3VROF.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-4CDML74A.js.map → chunk-K4TBJG47.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-4VE55TG3.js.map → chunk-S4EBLGSU.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-4POCC75H.js.LEGAL.txt → chunk-XF3IIUDX.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-4SX4HBWT.js.LEGAL.txt → chunk-XIFGUD6K.js.LEGAL.txt} +0 -0
|
@@ -22,25 +22,20 @@ __export(router_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(router_exports);
|
|
23
23
|
var import_router = require("../../router");
|
|
24
24
|
var import_url = require("../../utils/url");
|
|
25
|
+
var import_utils = require("../utils");
|
|
25
26
|
var import_matcher = require("./matcher");
|
|
26
27
|
var import_node = require("./node");
|
|
27
28
|
var import_trie = require("./trie");
|
|
28
|
-
let wildcardRegExpCache =
|
|
29
|
+
let wildcardRegExpCache = (0, import_utils.createNullObject)();
|
|
29
30
|
function buildWildcardRegExp(path) {
|
|
30
31
|
return wildcardRegExpCache[path] ??= new RegExp(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(
|
|
32
|
+
`^${path.replace(
|
|
33
|
+
/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,
|
|
34
|
+
(match2, metaChar) => metaChar ? `\\${metaChar}` : match2 === "/*" ? import_node.TAIL_WILDCARD_REG_EXP_STR : match2 === "*" ? import_node.ONLY_WILDCARD_REG_EXP_STR : `/:${import_node.LABEL_REG_EXP_STR}`
|
|
34
35
|
)}$`
|
|
35
36
|
);
|
|
36
37
|
}
|
|
37
|
-
function clearWildcardRegExpCache() {
|
|
38
|
-
wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
39
|
-
}
|
|
40
38
|
function findMiddleware(middleware, path) {
|
|
41
|
-
if (!middleware) {
|
|
42
|
-
return void 0;
|
|
43
|
-
}
|
|
44
39
|
for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
|
|
45
40
|
if (buildWildcardRegExp(k).test(path)) {
|
|
46
41
|
return [...middleware[k]];
|
|
@@ -54,8 +49,8 @@ class RegExpRouter {
|
|
|
54
49
|
#routes;
|
|
55
50
|
#tries;
|
|
56
51
|
constructor() {
|
|
57
|
-
this.#middleware = { [import_router.METHOD_NAME_ALL]:
|
|
58
|
-
this.#routes = { [import_router.METHOD_NAME_ALL]:
|
|
52
|
+
this.#middleware = { [import_router.METHOD_NAME_ALL]: (0, import_utils.createNullObject)() };
|
|
53
|
+
this.#routes = { [import_router.METHOD_NAME_ALL]: (0, import_utils.createNullObject)() };
|
|
59
54
|
this.#tries = { [import_router.METHOD_NAME_ALL]: new import_trie.Trie() };
|
|
60
55
|
}
|
|
61
56
|
#insertPath(method, path) {
|
|
@@ -68,117 +63,86 @@ class RegExpRouter {
|
|
|
68
63
|
add(method, path, handler) {
|
|
69
64
|
const middleware = this.#middleware;
|
|
70
65
|
const routes = this.#routes;
|
|
71
|
-
if (!middleware
|
|
66
|
+
if (!middleware) {
|
|
72
67
|
throw new Error(import_router.MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
73
68
|
}
|
|
74
69
|
if (!middleware[method]) {
|
|
75
70
|
this.#tries[method] = new import_trie.Trie();
|
|
76
|
-
[middleware, routes]
|
|
77
|
-
handlerMap[method] =
|
|
78
|
-
|
|
71
|
+
for (const handlerMap of [middleware, routes]) {
|
|
72
|
+
handlerMap[method] = (0, import_utils.createNullObject)();
|
|
73
|
+
for (const p in handlerMap[import_router.METHOD_NAME_ALL]) {
|
|
79
74
|
handlerMap[method][p] = [...handlerMap[import_router.METHOD_NAME_ALL][p]];
|
|
80
75
|
this.#insertPath(method, p);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
83
78
|
}
|
|
84
79
|
if (path === "/*") {
|
|
85
80
|
path = "*";
|
|
86
81
|
}
|
|
87
|
-
const
|
|
82
|
+
const methods = method === import_router.METHOD_NAME_ALL ? Object.keys(middleware) : [method];
|
|
88
83
|
if (/\*$/.test(path)) {
|
|
89
84
|
const re = buildWildcardRegExp(path);
|
|
90
|
-
|
|
91
|
-
if (
|
|
85
|
+
for (const m of methods) {
|
|
86
|
+
if (!middleware[m][path]) {
|
|
92
87
|
this.#insertPath(m, path);
|
|
93
88
|
middleware[m][path] = findMiddleware(middleware[m], path) || findMiddleware(middleware[import_router.METHOD_NAME_ALL], path) || [];
|
|
94
89
|
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
re.test(p) &&
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
Object.keys(routes).forEach((m) => {
|
|
104
|
-
if (method === import_router.METHOD_NAME_ALL || method === m) {
|
|
105
|
-
Object.keys(routes[m]).forEach(
|
|
106
|
-
(p) => re.test(p) && routes[m][p].push([handler, paramCount])
|
|
107
|
-
);
|
|
90
|
+
}
|
|
91
|
+
for (const handlerMap of [middleware, routes]) {
|
|
92
|
+
for (const m of methods) {
|
|
93
|
+
for (const p in handlerMap[m]) {
|
|
94
|
+
re.test(p) && handlerMap[m][p].push([handler, path]);
|
|
95
|
+
}
|
|
108
96
|
}
|
|
109
|
-
}
|
|
97
|
+
}
|
|
110
98
|
return;
|
|
111
99
|
}
|
|
112
100
|
const paths = (0, import_url.checkOptionalParameter)(path) || [path];
|
|
113
|
-
for (
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this.#insertPath(m, path2);
|
|
119
|
-
routes[m][path2] = [
|
|
120
|
-
...findMiddleware(middleware[m], path2) || findMiddleware(middleware[import_router.METHOD_NAME_ALL], path2) || []
|
|
121
|
-
];
|
|
122
|
-
}
|
|
123
|
-
routes[m][path2].push([handler, paramCount - len + i + 1]);
|
|
101
|
+
for (const path2 of paths) {
|
|
102
|
+
for (const m of methods) {
|
|
103
|
+
if (!routes[m][path2]) {
|
|
104
|
+
this.#insertPath(m, path2);
|
|
105
|
+
routes[m][path2] = findMiddleware(middleware[m], path2) || findMiddleware(middleware[import_router.METHOD_NAME_ALL], path2) || [];
|
|
124
106
|
}
|
|
125
|
-
|
|
107
|
+
routes[m][path2].push([handler, path2]);
|
|
108
|
+
}
|
|
126
109
|
}
|
|
127
110
|
}
|
|
128
111
|
match = import_matcher.match;
|
|
129
112
|
buildAllMatchers() {
|
|
130
|
-
const matchers =
|
|
131
|
-
Object.keys(this.#routes)
|
|
132
|
-
matchers[method]
|
|
133
|
-
}
|
|
113
|
+
const matchers = (0, import_utils.createNullObject)();
|
|
114
|
+
for (const method of Object.keys(this.#routes)) {
|
|
115
|
+
matchers[method] = this.#buildMatcher(method);
|
|
116
|
+
}
|
|
134
117
|
this.#middleware = this.#routes = this.#tries = void 0;
|
|
135
|
-
|
|
118
|
+
wildcardRegExpCache = (0, import_utils.createNullObject)();
|
|
136
119
|
return matchers;
|
|
137
120
|
}
|
|
138
121
|
#buildMatcher(method) {
|
|
139
122
|
const middleware = this.#middleware[method];
|
|
140
123
|
const routes = this.#routes[method];
|
|
141
124
|
const trie = this.#tries[method];
|
|
142
|
-
const staticMap =
|
|
125
|
+
const staticMap = (0, import_utils.createNullObject)();
|
|
143
126
|
const handlerData = [];
|
|
144
|
-
[
|
|
127
|
+
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
128
|
+
for (const r of [middleware, routes]) {
|
|
145
129
|
for (const path in r) {
|
|
146
130
|
const handlers = r[path];
|
|
147
131
|
const pathData = trie.paths[path];
|
|
148
132
|
if (!pathData) {
|
|
149
|
-
staticMap[path] = [handlers.map(([h]) => [h,
|
|
133
|
+
staticMap[path] = [handlers.map(([h]) => [h, (0, import_utils.createNullObject)()]), import_matcher.emptyParam];
|
|
150
134
|
continue;
|
|
151
135
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
return [h, paramIndexMap];
|
|
161
|
-
});
|
|
136
|
+
handlerData[pathData[0]] = handlers.map(([h, handlerPath]) => [
|
|
137
|
+
h,
|
|
138
|
+
trie.paths[handlerPath][1].reduceRight((map, [key], i) => {
|
|
139
|
+
map[key] = paramReplacementMap[pathData[1][i][1]];
|
|
140
|
+
return map;
|
|
141
|
+
}, (0, import_utils.createNullObject)())
|
|
142
|
+
]);
|
|
162
143
|
}
|
|
163
|
-
});
|
|
164
|
-
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
165
|
-
for (let i = 0, len = handlerData.length; i < len; i++) {
|
|
166
|
-
for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {
|
|
167
|
-
const map = handlerData[i][j]?.[1];
|
|
168
|
-
if (!map) {
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
|
-
const keys = Object.keys(map);
|
|
172
|
-
for (let k = 0, len3 = keys.length; k < len3; k++) {
|
|
173
|
-
map[keys[k]] = paramReplacementMap[map[keys[k]]];
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
const handlerMap = [];
|
|
178
|
-
for (const i in indexReplacementMap) {
|
|
179
|
-
handlerMap[i] = handlerData[indexReplacementMap[i]];
|
|
180
144
|
}
|
|
181
|
-
return [regexp,
|
|
145
|
+
return [regexp, indexReplacementMap.map((i) => handlerData[i]), staticMap];
|
|
182
146
|
}
|
|
183
147
|
}
|
|
184
148
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -20,13 +20,14 @@ __export(trie_exports, {
|
|
|
20
20
|
Trie: () => Trie
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(trie_exports);
|
|
23
|
+
var import_utils = require("../utils");
|
|
23
24
|
var import_node = require("./node");
|
|
24
25
|
class Trie {
|
|
25
26
|
#context = { varIndex: 0 };
|
|
26
27
|
#root = new import_node.Node();
|
|
27
28
|
#index = 0;
|
|
28
29
|
// dynamic path -> [handler index, param assoc]; static paths are not registered
|
|
29
|
-
paths =
|
|
30
|
+
paths = (0, import_utils.createNullObject)();
|
|
30
31
|
insert(path, isStatic) {
|
|
31
32
|
if (isStatic) {
|
|
32
33
|
this.#root.insert(path.split(""), 0, [], this.#context, true);
|
|
@@ -22,11 +22,12 @@ __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
|
-
|
|
25
|
+
var import_utils = require("../utils");
|
|
26
|
+
const emptyParams = (0, import_utils.createNullObject)();
|
|
26
27
|
let order = 0;
|
|
27
28
|
class Node {
|
|
28
29
|
#methods = [];
|
|
29
|
-
#children =
|
|
30
|
+
#children = (0, import_utils.createNullObject)();
|
|
30
31
|
#patterns = [];
|
|
31
32
|
#pattern;
|
|
32
33
|
#params = emptyParams;
|
|
@@ -63,7 +64,7 @@ class Node {
|
|
|
63
64
|
const m = node.#methods[i];
|
|
64
65
|
const handlerSet = m[method] || m[import_router.METHOD_NAME_ALL];
|
|
65
66
|
if (handlerSet) {
|
|
66
|
-
handlerSet.params =
|
|
67
|
+
handlerSet.params = (0, import_utils.createNullObject)();
|
|
67
68
|
handlerSets.push(handlerSet);
|
|
68
69
|
for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {
|
|
69
70
|
const key = handlerSet.possibleKeys[i2];
|
|
@@ -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
|
+
});
|
|
@@ -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);
|
|
@@ -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
|
}
|
|
@@ -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) => {
|
|
@@ -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);
|
|
@@ -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));
|
|
@@ -10,7 +10,7 @@ var RETAINED_304_HEADERS = [
|
|
|
10
10
|
];
|
|
11
11
|
var stripWeak = (tag) => tag.replace(/^W\//, "");
|
|
12
12
|
function etagMatches(etag2, ifNoneMatch) {
|
|
13
|
-
return ifNoneMatch != null && ifNoneMatch.split(
|
|
13
|
+
return ifNoneMatch != null && ifNoneMatch.split(",").some((t) => stripWeak(t.trim()) === stripWeak(etag2));
|
|
14
14
|
}
|
|
15
15
|
function initializeGenerator(generator) {
|
|
16
16
|
if (!generator) {
|
|
@@ -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,
|
|
@@ -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
|
};
|