@suveren/gateway 0.6.5 → 0.7.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.
Files changed (84) hide show
  1. package/bin/suveren-gateway.js +19 -2
  2. package/dist/control-plane/index.mjs +208 -34
  3. package/dist/ui/assets/index-CkWaRck1.css +1 -0
  4. package/dist/ui/assets/index-DHT9QCrE.js +110 -0
  5. package/dist/ui/favicon.svg +8 -0
  6. package/dist/ui/index.html +6 -2
  7. package/lib/autostart-templates.d.mts +2 -0
  8. package/lib/autostart-templates.mjs +16 -3
  9. package/node_modules/@hap/core/README.md +4 -4
  10. package/node_modules/@hap/core/package.json +1 -1
  11. package/node_modules/@hono/node-server/README.md +47 -1
  12. package/node_modules/@hono/node-server/dist/early-hints.cjs +35 -0
  13. package/node_modules/@hono/node-server/dist/early-hints.d.cts +16 -0
  14. package/node_modules/@hono/node-server/dist/early-hints.d.mts +16 -0
  15. package/node_modules/@hono/node-server/dist/early-hints.mjs +33 -0
  16. package/node_modules/@hono/node-server/dist/index.cjs +4 -1
  17. package/node_modules/@hono/node-server/dist/index.mjs +4 -1
  18. package/node_modules/@hono/node-server/package.json +14 -1
  19. package/node_modules/express-rate-limit/dist/index.cjs +6 -1
  20. package/node_modules/express-rate-limit/dist/index.mjs +6 -1
  21. package/node_modules/express-rate-limit/package.json +6 -6
  22. package/node_modules/hono/dist/cjs/context.js +28 -13
  23. package/node_modules/hono/dist/cjs/hono-base.js +3 -2
  24. package/node_modules/hono/dist/cjs/jsx/base.js +26 -14
  25. package/node_modules/hono/dist/cjs/jsx/hooks/index.js +2 -2
  26. package/node_modules/hono/dist/cjs/middleware/cache/index.js +103 -8
  27. package/node_modules/hono/dist/cjs/middleware/compress/index.js +5 -0
  28. package/node_modules/hono/dist/cjs/middleware/cors/index.js +1 -1
  29. package/node_modules/hono/dist/cjs/middleware/etag/index.js +4 -1
  30. package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +9 -4
  31. package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +9 -4
  32. package/node_modules/hono/dist/cjs/middleware/method-not-allowed/index.js +90 -0
  33. package/node_modules/hono/dist/cjs/request.js +6 -8
  34. package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +55 -56
  35. package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +64 -85
  36. package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +13 -5
  37. package/node_modules/hono/dist/cjs/router/trie-router/node.js +1 -1
  38. package/node_modules/hono/dist/cjs/router.js +1 -1
  39. package/node_modules/hono/dist/cjs/utils/cookie.js +1 -1
  40. package/node_modules/hono/dist/cjs/utils/stream.js +5 -2
  41. package/node_modules/hono/dist/cjs/utils/url.js +7 -7
  42. package/node_modules/hono/dist/context.js +28 -13
  43. package/node_modules/hono/dist/hono-base.js +3 -2
  44. package/node_modules/hono/dist/jsx/base.js +26 -14
  45. package/node_modules/hono/dist/jsx/hooks/index.js +2 -2
  46. package/node_modules/hono/dist/middleware/cache/index.js +103 -8
  47. package/node_modules/hono/dist/middleware/compress/index.js +5 -0
  48. package/node_modules/hono/dist/middleware/cors/index.js +1 -1
  49. package/node_modules/hono/dist/middleware/etag/index.js +4 -1
  50. package/node_modules/hono/dist/middleware/jwk/jwk.js +9 -4
  51. package/node_modules/hono/dist/middleware/jwt/jwt.js +9 -4
  52. package/node_modules/hono/dist/middleware/method-not-allowed/index.js +68 -0
  53. package/node_modules/hono/dist/request.js +7 -9
  54. package/node_modules/hono/dist/router/reg-exp-router/node.js +55 -56
  55. package/node_modules/hono/dist/router/reg-exp-router/router.js +64 -85
  56. package/node_modules/hono/dist/router/reg-exp-router/trie.js +13 -5
  57. package/node_modules/hono/dist/router/trie-router/node.js +1 -1
  58. package/node_modules/hono/dist/router.js +1 -1
  59. package/node_modules/hono/dist/types/client/types.d.ts +1 -1
  60. package/node_modules/hono/dist/types/hono-base.d.ts +4 -3
  61. package/node_modules/hono/dist/types/jsx/base.d.ts +4 -2
  62. package/node_modules/hono/dist/types/jsx/dom/index.d.ts +5 -5
  63. package/node_modules/hono/dist/types/jsx/dom/intrinsic-element/components.d.ts +2 -2
  64. package/node_modules/hono/dist/types/jsx/dom/server.d.ts +5 -5
  65. package/node_modules/hono/dist/types/jsx/hooks/index.d.ts +8 -6
  66. package/node_modules/hono/dist/types/jsx/index.d.ts +5 -5
  67. package/node_modules/hono/dist/types/middleware/cache/index.d.ts +6 -4
  68. package/node_modules/hono/dist/types/middleware/cors/index.d.ts +1 -1
  69. package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +2 -2
  70. package/node_modules/hono/dist/types/middleware/jwk/jwk.d.ts +2 -0
  71. package/node_modules/hono/dist/types/middleware/jwt/jwt.d.ts +2 -0
  72. package/node_modules/hono/dist/types/middleware/method-not-allowed/index.d.ts +49 -0
  73. package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +1 -1
  74. package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +2 -1
  75. package/node_modules/hono/dist/types/router.d.ts +1 -1
  76. package/node_modules/hono/dist/types/utils/headers.d.ts +2 -2
  77. package/node_modules/hono/dist/types/utils/url.d.ts +1 -0
  78. package/node_modules/hono/dist/utils/cookie.js +2 -2
  79. package/node_modules/hono/dist/utils/stream.js +5 -2
  80. package/node_modules/hono/dist/utils/url.js +5 -6
  81. package/node_modules/hono/package.json +9 -1
  82. package/package.json +1 -1
  83. package/dist/ui/assets/index-DIcuh0I4.css +0 -1
  84. package/dist/ui/assets/index-Dl5isaOV.js +0 -105
@@ -1,7 +1,7 @@
1
1
  // src/router.ts
2
2
  var METHOD_NAME_ALL = "ALL";
3
3
  var METHOD_NAME_ALL_LOWERCASE = "all";
4
- var METHODS = ["get", "post", "put", "delete", "options", "patch"];
4
+ var METHODS = ["get", "post", "put", "delete", "options", "patch", "query"];
5
5
  var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built.";
6
6
  var UnsupportedPathError = class extends Error {
7
7
  };
@@ -10,7 +10,7 @@ import type { HasRequiredKeys } from '../utils/types';
10
10
  type MethodNameAll = `$${typeof METHOD_NAME_ALL_LOWERCASE}`;
11
11
  /**
12
12
  * Type representing all standard HTTP methods prefixed with '$'
13
- * e.g., '$get' | '$post' | '$put' | '$delete' | '$options' | '$patch'
13
+ * e.g., '$get' | '$post' | '$put' | '$delete' | '$options' | '$patch' | '$query'
14
14
  */
15
15
  type StandardMethods = `$${(typeof METHODS)[number]}`;
16
16
  /**
@@ -65,6 +65,7 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
65
65
  delete: HandlerInterface<E, 'delete', S, BasePath, CurrentPath>;
66
66
  options: HandlerInterface<E, 'options', S, BasePath, CurrentPath>;
67
67
  patch: HandlerInterface<E, 'patch', S, BasePath, CurrentPath>;
68
+ query: HandlerInterface<E, 'query', S, BasePath, CurrentPath>;
68
69
  all: HandlerInterface<E, 'all', S, BasePath, CurrentPath>;
69
70
  on: OnHandlerInterface<E, S, BasePath>;
70
71
  use: MiddlewareHandlerInterface<E, S, BasePath>;
@@ -179,12 +180,12 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
179
180
  * @see {@link https://hono.dev/docs/api/hono#fetch}
180
181
  *
181
182
  * @param {Request} request - request Object of request
182
- * @param {Env} Env - env Object
183
- * @param {ExecutionContext} - context of execution
183
+ * @param {Env} env - env Object
184
+ * @param {ExecutionContext} executionCtx - context of execution
184
185
  * @returns {Response | Promise<Response>} response of request
185
186
  *
186
187
  */
187
- fetch: (request: Request, Env?: E['Bindings'] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response>;
188
+ fetch: (request: Request, env?: E['Bindings'] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response>;
188
189
  /**
189
190
  * `.request()` is a useful method for testing.
190
191
  * You can pass a URL or pathname to send a GET request.
@@ -3,14 +3,16 @@ import { DOM_MEMO } from './constants';
3
3
  import type { Context } from './context';
4
4
  import type { JSX as HonoJSX, IntrinsicElements as IntrinsicElementsDefined } from './intrinsic-elements';
5
5
  export type Props = Record<string, any>;
6
+ type FunctionComponentResult = HtmlEscapedString | Child[] | Promise<HtmlEscapedString | Child[]> | null;
6
7
  export type FC<P = Props> = {
7
- (props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null;
8
+ (props: P): FunctionComponentResult;
8
9
  defaultProps?: Partial<P> | undefined;
9
10
  displayName?: string | undefined;
10
11
  };
11
12
  export type DOMAttributes = HonoJSX.HTMLAttributes;
12
13
  export declare namespace JSX {
13
14
  type Element = HtmlEscapedString | Promise<HtmlEscapedString>;
15
+ type ElementType = string | ((props: never) => FunctionComponentResult);
14
16
  interface ElementChildrenAttribute {
15
17
  children: Child;
16
18
  }
@@ -30,7 +32,6 @@ export declare class JSXNode implements HtmlEscaped {
30
32
  key?: string;
31
33
  children: Child[];
32
34
  isEscaped: true;
33
- suspendedContext?: <T>(callback: () => T) => T;
34
35
  constructor(tag: string | Function, props: Props, children: Child[]);
35
36
  get type(): string | Function;
36
37
  get ref(): any;
@@ -54,3 +55,4 @@ export declare const Fragment: ({ children, }: {
54
55
  export declare const isValidElement: (element: unknown) => element is JSXNode;
55
56
  export declare const cloneElement: <T extends JSXNode | JSX.Element>(element: T, props: Partial<Props>, ...children: Child[]) => T;
56
57
  export declare const reactAPICompatVersion = "19.0.0-hono-jsx";
58
+ export {};
@@ -24,7 +24,7 @@ declare const _default: {
24
24
  <T = undefined>(): [T | undefined, (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void];
25
25
  };
26
26
  useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
27
- useRef: <T>(initialValue: T | null) => import("..").RefObject<T>;
27
+ useRef: typeof useRef;
28
28
  useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
29
29
  use: <T>(promise: Promise<T>) => T;
30
30
  startTransition: (callback: () => void) => void;
@@ -38,11 +38,11 @@ declare const _default: {
38
38
  useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [T, (action: A) => void];
39
39
  useId: () => string;
40
40
  useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
41
- createRef: <T>() => import("..").RefObject<T>;
42
- forwardRef: <T, P = {}>(Component: (props: P, ref?: import("..").RefObject<T>) => JSX.Element) => ((props: P & {
43
- ref?: import("..").RefObject<T>;
41
+ createRef: <T>() => import("..").RefObject<T | null>;
42
+ forwardRef: <T, P = {}>(Component: (props: P, ref?: import("..").RefObject<T | null>) => JSX.Element) => ((props: P & {
43
+ ref?: import("..").RefObject<T | null>;
44
44
  }) => JSX.Element);
45
- useImperativeHandle: <T>(ref: import("..").RefObject<T>, createHandle: () => T, deps: readonly unknown[]) => void;
45
+ useImperativeHandle: <T>(ref: import("..").RefObject<T | null>, createHandle: () => T, deps: readonly unknown[]) => void;
46
46
  useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
47
47
  useFormStatus: () => {
48
48
  pending: false;
@@ -1,7 +1,7 @@
1
1
  import type { IntrinsicElements } from '../../intrinsic-elements';
2
2
  import type { FC, PropsWithChildren, RefObject } from '../../types';
3
3
  export declare const clearCache: () => void;
4
- export declare const composeRef: <T>(ref: RefObject<T> | Function | undefined, cb: (e: T) => void | (() => void)) => ((e: T) => () => void);
4
+ export declare const composeRef: <T>(ref: RefObject<T | null> | Function | undefined, cb: (e: T) => void | (() => void)) => ((e: T) => () => void);
5
5
  export declare const title: FC<PropsWithChildren>;
6
6
  export declare const script: FC<PropsWithChildren<IntrinsicElements['script']>>;
7
7
  export declare const style: FC<PropsWithChildren<IntrinsicElements['style']>>;
@@ -10,7 +10,7 @@ export declare const meta: FC<PropsWithChildren>;
10
10
  export declare const form: FC<PropsWithChildren<{
11
11
  action?: Function | string;
12
12
  method?: 'get' | 'post';
13
- ref?: RefObject<HTMLFormElement> | ((e: HTMLFormElement | null) => void | (() => void));
13
+ ref?: RefObject<HTMLFormElement | null> | ((e: HTMLFormElement | null) => void | (() => void));
14
14
  }>>;
15
15
  export declare const input: FC<PropsWithChildren<IntrinsicElements['input']>>;
16
16
  export declare const button: FC<PropsWithChildren<IntrinsicElements['button']>>;
@@ -43,7 +43,7 @@ declare const _default: {
43
43
  <T = undefined>(): [T | undefined, (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void];
44
44
  };
45
45
  useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
46
- useRef: <T>(initialValue: T | null) => import("..").RefObject<T>;
46
+ useRef: typeof import("..").useRef;
47
47
  useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
48
48
  use: <T>(promise: Promise<T>) => T;
49
49
  startTransition: (callback: () => void) => void;
@@ -57,11 +57,11 @@ declare const _default: {
57
57
  useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [T, (action: A) => void];
58
58
  useId: () => string;
59
59
  useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
60
- createRef: <T>() => import("..").RefObject<T>;
61
- forwardRef: <T, P = {}>(Component: (props: P, ref?: import("..").RefObject<T>) => import("./jsx-dev-runtime").JSX.Element) => ((props: P & {
62
- ref?: import("..").RefObject<T>;
60
+ createRef: <T>() => import("..").RefObject<T | null>;
61
+ forwardRef: <T, P = {}>(Component: (props: P, ref?: import("..").RefObject<T | null>) => import("./jsx-dev-runtime").JSX.Element) => ((props: P & {
62
+ ref?: import("..").RefObject<T | null>;
63
63
  }) => import("./jsx-dev-runtime").JSX.Element);
64
- useImperativeHandle: <T>(ref: import("..").RefObject<T>, createHandle: () => T, deps: readonly unknown[]) => void;
64
+ useImperativeHandle: <T>(ref: import("..").RefObject<T | null>, createHandle: () => T, deps: readonly unknown[]) => void;
65
65
  useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
66
66
  useFormStatus: () => {
67
67
  pending: false;
@@ -29,17 +29,19 @@ export declare const useLayoutEffect: (effect: () => void | (() => void), deps?:
29
29
  export declare const useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
30
30
  export declare const useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
31
31
  export type RefObject<T> = {
32
- current: T | null;
32
+ current: T;
33
33
  };
34
- export declare const useRef: <T>(initialValue: T | null) => RefObject<T>;
34
+ export declare function useRef<T>(initialValue: T): RefObject<T>;
35
+ export declare function useRef<T>(initialValue: T | null): RefObject<T | null>;
36
+ export declare function useRef<T>(initialValue: T | undefined): RefObject<T | undefined>;
35
37
  export declare const use: <T>(promise: Promise<T>) => T;
36
38
  export declare const useMemo: <T>(factory: () => T, deps: readonly unknown[]) => T;
37
39
  export declare const useId: () => string;
38
40
  export declare const useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
39
- export declare const createRef: <T>() => RefObject<T>;
40
- export declare const forwardRef: <T, P = {}>(Component: (props: P, ref?: RefObject<T>) => JSX.Element) => ((props: P & {
41
- ref?: RefObject<T>;
41
+ export declare const createRef: <T>() => RefObject<T | null>;
42
+ export declare const forwardRef: <T, P = {}>(Component: (props: P, ref?: RefObject<T | null>) => JSX.Element) => ((props: P & {
43
+ ref?: RefObject<T | null>;
42
44
  }) => JSX.Element);
43
- export declare const useImperativeHandle: <T>(ref: RefObject<T>, createHandle: () => T, deps: readonly unknown[]) => void;
45
+ export declare const useImperativeHandle: <T>(ref: RefObject<T | null>, createHandle: () => T, deps: readonly unknown[]) => void;
44
46
  export declare const useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
45
47
  export {};
@@ -37,7 +37,7 @@ declare const _default: {
37
37
  <T = undefined>(): [T | undefined, (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void];
38
38
  };
39
39
  useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
40
- useRef: <T>(initialValue: T | null) => import("./hooks").RefObject<T>;
40
+ useRef: typeof useRef;
41
41
  useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
42
42
  useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [T, (action: A) => void];
43
43
  useId: () => string;
@@ -51,11 +51,11 @@ declare const _default: {
51
51
  useMemo: <T>(factory: () => T, deps: readonly unknown[]) => T;
52
52
  useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
53
53
  useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
54
- createRef: <T>() => import("./hooks").RefObject<T>;
55
- forwardRef: <T, P = {}>(Component: (props: P, ref?: import("./hooks").RefObject<T>) => import("./base").JSX.Element) => ((props: P & {
56
- ref?: import("./hooks").RefObject<T>;
54
+ createRef: <T>() => import("./hooks").RefObject<T | null>;
55
+ forwardRef: <T, P = {}>(Component: (props: P, ref?: import("./hooks").RefObject<T | null>) => import("./base").JSX.Element) => ((props: P & {
56
+ ref?: import("./hooks").RefObject<T | null>;
57
57
  }) => import("./base").JSX.Element);
58
- useImperativeHandle: <T>(ref: import("./hooks").RefObject<T>, createHandle: () => T, deps: readonly unknown[]) => void;
58
+ useImperativeHandle: <T>(ref: import("./hooks").RefObject<T | null>, createHandle: () => T, deps: readonly unknown[]) => void;
59
59
  useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
60
60
  useActionState: <T>(fn: Function, initialState: T, permalink?: string) => [T, Function];
61
61
  useOptimistic: <T, N>(state: T, updateState: (currentState: T, action: N) => T) => [T, (action: N) => void];
@@ -15,15 +15,16 @@ import type { StatusCode } from '../../utils/http-status';
15
15
  * @param {boolean} [options.wait=false] - A boolean indicating if Hono should wait for the Promise of the `cache.put` function to resolve before continuing with the request. Required to be true for the Deno environment.
16
16
  * @param {string} [options.cacheControl] - A string of directives for the `Cache-Control` header.
17
17
  * @param {string | string[]} [options.vary] - Adds the configured request headers to the cache key variants and sets the `Vary` header in the response. If the original response header already contains a `Vary` header, the values are merged, removing any duplicates.
18
- * @param {Function} [options.keyGenerator] - Generates keys for every request in the `cacheName` store. This can be used to cache data based on request parameters or context parameters.
18
+ * @param {Function} [options.keyGenerator] - Generates keys for every request in the `cacheName` store. This can be used to cache data based on request parameters or context parameters. QUERY keys additionally include a digest of the request content and its representation metadata.
19
+ * @param {number} [options.maxQueryBodySize=65536] - The maximum QUERY request body size in bytes that can be cached. Larger QUERY requests bypass the cache.
19
20
  * @param {number[]} [options.cacheableStatusCodes=[200]] - An array of status codes that can be cached.
20
- * @param {Function | false} [options.onCacheNotAvailable] - A callback invoked when `globalThis.caches` is not available. By default, a message is logged to the console. Set to `false` to suppress the log, or provide a custom function.
21
+ * @param {Function | false} [options.onCacheNotAvailable] - A callback invoked with the reason when `globalThis.caches` is not available or QUERY caching cannot use Web Crypto. By default, the reason is logged to the console. Set to `false` to suppress the log, or provide a custom function.
21
22
  * @returns {MiddlewareHandler} The middleware handler function.
22
23
  * @throws {Error} If the `vary` option includes "*".
23
24
  *
24
25
  * @example
25
26
  * ```ts
26
- * app.get(
27
+ * app.use(
27
28
  * '*',
28
29
  * cache({
29
30
  * cacheName: 'my-app',
@@ -38,6 +39,7 @@ export declare const cache: (options: {
38
39
  cacheControl?: string;
39
40
  vary?: string | string[];
40
41
  keyGenerator?: (c: Context) => Promise<string> | string;
42
+ maxQueryBodySize?: number;
41
43
  cacheableStatusCodes?: StatusCode[];
42
- onCacheNotAvailable?: (() => void) | false;
44
+ onCacheNotAvailable?: ((reason: string) => void) | false;
43
45
  }) => MiddlewareHandler;
@@ -19,7 +19,7 @@ type CORSOptions = {
19
19
  *
20
20
  * @param {CORSOptions} [options] - The options for the CORS middleware.
21
21
  * @param {string | string[] | ((origin: string, c: Context) => Promise<string | undefined | null> | string | undefined | null)} [options.origin='*'] - The value of "Access-Control-Allow-Origin" CORS header.
22
- * @param {string[] | ((origin: string, c: Context) => Promise<string[]> | string[])} [options.allowMethods=['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH']] - The value of "Access-Control-Allow-Methods" CORS header.
22
+ * @param {string[] | ((origin: string, c: Context) => Promise<string[]> | string[])} [options.allowMethods=['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH', 'QUERY']] - The value of "Access-Control-Allow-Methods" CORS header.
23
23
  * @param {string[]} [options.allowHeaders=[]] - The value of "Access-Control-Allow-Headers" CORS header.
24
24
  * @param {number} [options.maxAge] - The value of "Access-Control-Max-Age" CORS header.
25
25
  * @param {boolean} [options.credentials] - The value of "Access-Control-Allow-Credentials" CORS header.
@@ -5,15 +5,15 @@
5
5
  import type { Context, PropsForRenderer } from '../../context';
6
6
  import type { FC, Context as JSXContext, PropsWithChildren } from '../../jsx';
7
7
  import type { Env, Input, MiddlewareHandler } from '../../types';
8
- import type { HtmlEscapedString } from '../../utils/html';
9
8
  export declare const RequestContext: JSXContext<Context<any, any, {}> | null>;
10
9
  type RendererOptions = {
11
10
  docType?: boolean | string;
12
11
  stream?: boolean | Record<string, string>;
13
12
  };
13
+ type ComponentResult = Exclude<ReturnType<FC>, null>;
14
14
  type ComponentWithChildren = (props: PropsWithChildren<PropsForRenderer & {
15
15
  Layout: FC;
16
- }>, c: Context) => HtmlEscapedString | Promise<HtmlEscapedString>;
16
+ }>, c: Context) => ComponentResult;
17
17
  /**
18
18
  * JSX Renderer Middleware for hono.
19
19
  *
@@ -20,6 +20,7 @@ import type { VerifyOptions } from '../../utils/jwt/jwt';
20
20
  * @param {boolean} [options.allow_anon] - If set to `true`, the middleware allows requests without a token to proceed without authentication.
21
21
  * @param {string} [options.cookie] - If set, the middleware attempts to retrieve the token from a cookie with these options (optionally signed) only if no token is found in the header.
22
22
  * @param {string} [options.headerName='Authorization'] - The name of the header to look for the JWT token. Default is 'Authorization'.
23
+ * @param {string} [options.realm] - The protection space described by the `realm` parameter of the returned `WWW-Authenticate` challenge header. Defaults to the request URL.
23
24
  * @param {AsymmetricAlgorithm[]} options.alg - An array of allowed asymmetric algorithms for JWT verification. Only tokens signed with these algorithms will be accepted.
24
25
  * @param {RequestInit} [init] - Optional init options for the `fetch` request when retrieving JWKS from a URI.
25
26
  * @param {VerifyOptions} [options.verification] - Additional options for JWK payload verification.
@@ -50,5 +51,6 @@ export declare const jwk: (options: {
50
51
  };
51
52
  headerName?: string;
52
53
  alg: AsymmetricAlgorithm[];
54
+ realm?: string;
53
55
  verification?: VerifyOptions;
54
56
  }, init?: RequestInit) => MiddlewareHandler;
@@ -21,6 +21,7 @@ export type JwtVariables<T = any> = {
21
21
  * @param {string} [options.cookie] - If this value is set, then the value is retrieved from the cookie header using that value as a key, which is then validated as a token.
22
22
  * @param {SignatureAlgorithm} options.alg - An algorithm type that is used for verifying (required). Available types are `HS256` | `HS384` | `HS512` | `RS256` | `RS384` | `RS512` | `PS256` | `PS384` | `PS512` | `ES256` | `ES384` | `ES512` | `EdDSA`.
23
23
  * @param {string} [options.headerName='Authorization'] - The name of the header to look for the JWT token. Default is 'Authorization'.
24
+ * @param {string} [options.realm] - The protection space described by the `realm` parameter of the returned `WWW-Authenticate` challenge header. Defaults to the request URL.
24
25
  * @param {VerifyOptions} [options.verification] - Additional options for JWT payload verification.
25
26
  * @returns {MiddlewareHandler} The middleware handler function.
26
27
  *
@@ -51,6 +52,7 @@ export declare const jwt: (options: {
51
52
  };
52
53
  alg: SignatureAlgorithm;
53
54
  headerName?: string;
55
+ realm?: string;
54
56
  verification?: VerifyOptions;
55
57
  }) => MiddlewareHandler;
56
58
  export declare const verifyWithJwks: (token: string, options: {
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @module
3
+ * Method Not Allowed Middleware for Hono.
4
+ */
5
+ import type { Context } from '../../context';
6
+ import type { Hono } from '../../hono';
7
+ import type { Env, MiddlewareHandler } from '../../types';
8
+ type MethodNotAllowedHandler<E extends Env> = (c: Context<E>, allowedMethods: string[]) => Response | Promise<Response>;
9
+ type MethodNotAllowedOptions<E extends Env> = {
10
+ app: Hono<E, any, any>;
11
+ onMethodNotAllowed?: MethodNotAllowedHandler<E>;
12
+ };
13
+ /**
14
+ * Method Not Allowed Middleware for Hono.
15
+ *
16
+ * Returns a `405 Method Not Allowed` response with an `Allow` header when the request path
17
+ * matches a registered route but the request method is not supported.
18
+ *
19
+ * @param {MethodNotAllowedOptions} options - The options for the middleware.
20
+ * @param {Hono} options.app - The Hono instance used by the application.
21
+ * @param {MethodNotAllowedHandler} [options.onMethodNotAllowed] - Generates the response, including its `Allow` header.
22
+ * @returns {MiddlewareHandler} The middleware handler function.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const app = new Hono()
27
+ *
28
+ * app.use(methodNotAllowed({ app }))
29
+ *
30
+ * app.get('/hello', (c) => c.text('Hello!'))
31
+ * app.post('/hello', (c) => c.text('Posted!'))
32
+ *
33
+ * // PUT /hello -> 405 Method Not Allowed
34
+ * // Allow: GET, HEAD, POST
35
+ * ```
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * app.use(
40
+ * methodNotAllowed({
41
+ * app,
42
+ * onMethodNotAllowed: (c, methods) =>
43
+ * c.json({ error: 'Method Not Allowed' }, 405, { Allow: methods.join(', ') }),
44
+ * })
45
+ * )
46
+ * ```
47
+ */
48
+ export declare const methodNotAllowed: <E extends Env = Env>(options: MethodNotAllowedOptions<E>) => MiddlewareHandler<E>;
49
+ export {};
@@ -5,6 +5,6 @@ export interface Context {
5
5
  }
6
6
  export declare class Node {
7
7
 
8
- insert(tokens: readonly string[], index: number, paramMap: ParamAssocArray, context: Context, pathErrorCheckOnly: boolean): void;
8
+ insert(tokens: readonly string[], index: number, paramMap: ParamAssocArray, context: Context, isStatic: boolean): void;
9
9
  buildRegExpStr(): string;
10
10
  }
@@ -2,6 +2,7 @@ import type { ParamAssocArray } from './node';
2
2
  export type ReplacementMap = number[];
3
3
  export declare class Trie {
4
4
 
5
- insert(path: string, index: number, pathErrorCheckOnly: boolean): ParamAssocArray;
5
+ paths: Record<string, [number, ParamAssocArray]>;
6
+ insert(path: string, isStatic: boolean): void;
6
7
  buildRegExp(): [RegExp, ReplacementMap, ReplacementMap];
7
8
  }
@@ -13,7 +13,7 @@ export declare const METHOD_NAME_ALL_LOWERCASE: "all";
13
13
  /**
14
14
  * Array of supported HTTP methods.
15
15
  */
16
- export declare const METHODS: readonly ["get", "post", "put", "delete", "options", "patch"];
16
+ export declare const METHODS: readonly ["get", "post", "put", "delete", "options", "patch", "query"];
17
17
  /**
18
18
  * Error message indicating that a route cannot be added because the matcher is already built.
19
19
  */
@@ -2,7 +2,7 @@
2
2
  * @module
3
3
  * HTTP Headers utility.
4
4
  */
5
- export type RequestHeader = 'A-IM' | 'Accept' | 'Accept-Additions' | 'Accept-CH' | 'Accept-Charset' | 'Accept-Datetime' | 'Accept-Encoding' | 'Accept-Features' | 'Accept-Language' | 'Accept-Patch' | 'Accept-Post' | 'Accept-Ranges' | 'Accept-Signature' | 'Access-Control' | 'Access-Control-Allow-Credentials' | 'Access-Control-Allow-Headers' | 'Access-Control-Allow-Methods' | 'Access-Control-Allow-Origin' | 'Access-Control-Expose-Headers' | 'Access-Control-Max-Age' | 'Access-Control-Request-Headers' | 'Access-Control-Request-Method' | 'Age' | 'Allow' | 'ALPN' | 'Alt-Svc' | 'Alt-Used' | 'Alternates' | 'AMP-Cache-Transform' | 'Apply-To-Redirect-Ref' | 'Authentication-Control' | 'Authentication-Info' | 'Authorization' | 'Available-Dictionary' | 'C-Ext' | 'C-Man' | 'C-Opt' | 'C-PEP' | 'C-PEP-Info' | 'Cache-Control' | 'Cache-Status' | 'Cal-Managed-ID' | 'CalDAV-Timezones' | 'Capsule-Protocol' | 'CDN-Cache-Control' | 'CDN-Loop' | 'Cert-Not-After' | 'Cert-Not-Before' | 'Clear-Site-Data' | 'Client-Cert' | 'Client-Cert-Chain' | 'Close' | 'CMCD-Object' | 'CMCD-Request' | 'CMCD-Session' | 'CMCD-Status' | 'CMSD-Dynamic' | 'CMSD-Static' | 'Concealed-Auth-Export' | 'Configuration-Context' | 'Connection' | 'Content-Base' | 'Content-Digest' | 'Content-Disposition' | 'Content-Encoding' | 'Content-ID' | 'Content-Language' | 'Content-Length' | 'Content-Location' | 'Content-MD5' | 'Content-Range' | 'Content-Script-Type' | 'Content-Security-Policy' | 'Content-Security-Policy-Report-Only' | 'Content-Style-Type' | 'Content-Type' | 'Content-Version' | 'Cookie' | 'Cookie2' | 'Cross-Origin-Embedder-Policy' | 'Cross-Origin-Embedder-Policy-Report-Only' | 'Cross-Origin-Opener-Policy' | 'Cross-Origin-Opener-Policy-Report-Only' | 'Cross-Origin-Resource-Policy' | 'CTA-Common-Access-Token' | 'DASL' | 'Date' | 'DAV' | 'Default-Style' | 'Delta-Base' | 'Deprecation' | 'Depth' | 'Derived-From' | 'Destination' | 'Differential-ID' | 'Dictionary-ID' | 'Digest' | 'DPoP' | 'DPoP-Nonce' | 'Early-Data' | 'EDIINT-Features' | 'ETag' | 'Expect' | 'Expect-CT' | 'Expires' | 'Ext' | 'Forwarded' | 'From' | 'GetProfile' | 'Hobareg' | 'Host' | 'HTTP2-Settings' | 'If' | 'If-Match' | 'If-Modified-Since' | 'If-None-Match' | 'If-Range' | 'If-Schedule-Tag-Match' | 'If-Unmodified-Since' | 'IM' | 'Include-Referred-Token-Binding-ID' | 'Isolation' | 'Keep-Alive' | 'Label' | 'Last-Event-ID' | 'Last-Modified' | 'Link' | 'Link-Template' | 'Location' | 'Lock-Token' | 'Man' | 'Max-Forwards' | 'Memento-Datetime' | 'Meter' | 'Method-Check' | 'Method-Check-Expires' | 'MIME-Version' | 'Negotiate' | 'NEL' | 'OData-EntityId' | 'OData-Isolation' | 'OData-MaxVersion' | 'OData-Version' | 'Opt' | 'Optional-WWW-Authenticate' | 'Ordering-Type' | 'Origin' | 'Origin-Agent-Cluster' | 'OSCORE' | 'OSLC-Core-Version' | 'Overwrite' | 'P3P' | 'PEP' | 'PEP-Info' | 'Permissions-Policy' | 'PICS-Label' | 'Ping-From' | 'Ping-To' | 'Position' | 'Pragma' | 'Prefer' | 'Preference-Applied' | 'Priority' | 'ProfileObject' | 'Protocol' | 'Protocol-Info' | 'Protocol-Query' | 'Protocol-Request' | 'Proxy-Authenticate' | 'Proxy-Authentication-Info' | 'Proxy-Authorization' | 'Proxy-Features' | 'Proxy-Instruction' | 'Proxy-Status' | 'Public' | 'Public-Key-Pins' | 'Public-Key-Pins-Report-Only' | 'Range' | 'Redirect-Ref' | 'Referer' | 'Referer-Root' | 'Referrer-Policy' | 'Refresh' | 'Repeatability-Client-ID' | 'Repeatability-First-Sent' | 'Repeatability-Request-ID' | 'Repeatability-Result' | 'Replay-Nonce' | 'Reporting-Endpoints' | 'Repr-Digest' | 'Retry-After' | 'Safe' | 'Schedule-Reply' | 'Schedule-Tag' | 'Sec-GPC' | 'Sec-Purpose' | 'Sec-Token-Binding' | 'Sec-WebSocket-Accept' | 'Sec-WebSocket-Extensions' | 'Sec-WebSocket-Key' | 'Sec-WebSocket-Protocol' | 'Sec-WebSocket-Version' | 'Security-Scheme' | 'Server' | 'Server-Timing' | 'Set-Cookie' | 'Set-Cookie2' | 'SetProfile' | 'Signature' | 'Signature-Input' | 'SLUG' | 'SoapAction' | 'Status-URI' | 'Strict-Transport-Security' | 'Sunset' | 'Surrogate-Capability' | 'Surrogate-Control' | 'TCN' | 'TE' | 'Timeout' | 'Timing-Allow-Origin' | 'Topic' | 'Traceparent' | 'Tracestate' | 'Trailer' | 'Transfer-Encoding' | 'TTL' | 'Upgrade' | 'Urgency' | 'URI' | 'Use-As-Dictionary' | 'User-Agent' | 'Variant-Vary' | 'Vary' | 'Via' | 'Want-Content-Digest' | 'Want-Digest' | 'Want-Repr-Digest' | 'Warning' | 'WWW-Authenticate' | 'X-Content-Type-Options' | 'X-Frame-Options';
6
- export type ResponseHeader = 'Access-Control-Allow-Credentials' | 'Access-Control-Allow-Headers' | 'Access-Control-Allow-Methods' | 'Access-Control-Allow-Origin' | 'Access-Control-Expose-Headers' | 'Access-Control-Max-Age' | 'Age' | 'Allow' | 'Cache-Control' | 'Clear-Site-Data' | 'Content-Disposition' | 'Content-Encoding' | 'Content-Language' | 'Content-Length' | 'Content-Location' | 'Content-Range' | 'Content-Security-Policy' | 'Content-Security-Policy-Report-Only' | 'Content-Type' | 'Cookie' | 'Cross-Origin-Embedder-Policy' | 'Cross-Origin-Opener-Policy' | 'Cross-Origin-Resource-Policy' | 'Date' | 'ETag' | 'Expires' | 'Last-Modified' | 'Location' | 'Permissions-Policy' | 'Pragma' | 'Retry-After' | 'Save-Data' | 'Sec-CH-Prefers-Color-Scheme' | 'Sec-CH-Prefers-Reduced-Motion' | 'Sec-CH-UA' | 'Sec-CH-UA-Arch' | 'Sec-CH-UA-Bitness' | 'Sec-CH-UA-Form-Factor' | 'Sec-CH-UA-Full-Version' | 'Sec-CH-UA-Full-Version-List' | 'Sec-CH-UA-Mobile' | 'Sec-CH-UA-Model' | 'Sec-CH-UA-Platform' | 'Sec-CH-UA-Platform-Version' | 'Sec-CH-UA-WoW64' | 'Sec-Fetch-Dest' | 'Sec-Fetch-Mode' | 'Sec-Fetch-Site' | 'Sec-Fetch-User' | 'Sec-GPC' | 'Server' | 'Server-Timing' | 'Service-Worker-Navigation-Preload' | 'Set-Cookie' | 'Strict-Transport-Security' | 'Timing-Allow-Origin' | 'Trailer' | 'Transfer-Encoding' | 'Upgrade' | 'Vary' | 'WWW-Authenticate' | 'Warning' | 'X-Content-Type-Options' | 'X-DNS-Prefetch-Control' | 'X-Frame-Options' | 'X-Permitted-Cross-Domain-Policies' | 'X-Powered-By' | 'X-Robots-Tag' | 'X-XSS-Protection';
5
+ export type RequestHeader = 'A-IM' | 'Accept' | 'Accept-Additions' | 'Accept-CH' | 'Accept-Charset' | 'Accept-Datetime' | 'Accept-Encoding' | 'Accept-Features' | 'Accept-Language' | 'Accept-Patch' | 'Accept-Post' | 'Accept-Query' | 'Accept-Ranges' | 'Accept-Signature' | 'Access-Control' | 'Access-Control-Allow-Credentials' | 'Access-Control-Allow-Headers' | 'Access-Control-Allow-Methods' | 'Access-Control-Allow-Origin' | 'Access-Control-Expose-Headers' | 'Access-Control-Max-Age' | 'Access-Control-Request-Headers' | 'Access-Control-Request-Method' | 'Activate-Storage-Access' | 'Age' | 'Allow' | 'ALPN' | 'Alt-Svc' | 'Alt-Used' | 'Alternates' | 'AMP-Cache-Transform' | 'Apply-To-Redirect-Ref' | 'Authentication-Control' | 'Authentication-Info' | 'Authorization' | 'Available-Dictionary' | 'C-Ext' | 'C-Man' | 'C-Opt' | 'C-PEP' | 'C-PEP-Info' | 'Cache-Control' | 'Cache-Group-Invalidation' | 'Cache-Groups' | 'Cache-Status' | 'Cal-Managed-ID' | 'CalDAV-Timezones' | 'Capsule-Protocol' | 'CDN-Cache-Control' | 'CDN-Loop' | 'Cert-Not-After' | 'Cert-Not-Before' | 'Clear-Site-Data' | 'Client-Cert' | 'Client-Cert-Chain' | 'Close' | 'CMCD-Object' | 'CMCD-Request' | 'CMCD-Session' | 'CMCD-Status' | 'CMSD-Dynamic' | 'CMSD-Static' | 'Concealed-Auth-Export' | 'Configuration-Context' | 'Connection' | 'Content-Base' | 'Content-Digest' | 'Content-Disposition' | 'Content-Encoding' | 'Content-ID' | 'Content-Language' | 'Content-Length' | 'Content-Location' | 'Content-MD5' | 'Content-Range' | 'Content-Script-Type' | 'Content-Security-Policy' | 'Content-Security-Policy-Report-Only' | 'Content-Style-Type' | 'Content-Type' | 'Content-Version' | 'Cookie' | 'Cookie2' | 'Cross-Origin-Embedder-Policy' | 'Cross-Origin-Embedder-Policy-Report-Only' | 'Cross-Origin-Opener-Policy' | 'Cross-Origin-Opener-Policy-Report-Only' | 'Cross-Origin-Resource-Policy' | 'CTA-Common-Access-Token' | 'DASL' | 'Date' | 'DAV' | 'Default-Style' | 'Delta-Base' | 'Deprecation' | 'Depth' | 'Derived-From' | 'Destination' | 'Detached-JWS' | 'Differential-ID' | 'Dictionary-ID' | 'Digest' | 'DPoP' | 'DPoP-Nonce' | 'Early-Data' | 'EDIINT-Features' | 'ETag' | 'Expect' | 'Expect-CT' | 'Expires' | 'Ext' | 'Forwarded' | 'From' | 'GetProfile' | 'Hobareg' | 'Host' | 'HTTP2-Settings' | 'If' | 'If-Match' | 'If-Modified-Since' | 'If-None-Match' | 'If-Range' | 'If-Schedule-Tag-Match' | 'If-Unmodified-Since' | 'IM' | 'Include-Referred-Token-Binding-ID' | 'Incremental' | 'Isolation' | 'Keep-Alive' | 'Label' | 'Last-Event-ID' | 'Last-Modified' | 'Link' | 'Link-Template' | 'Location' | 'Lock-Token' | 'Man' | 'Max-Forwards' | 'Memento-Datetime' | 'Meter' | 'Method-Check' | 'Method-Check-Expires' | 'MIME-Version' | 'Negotiate' | 'NEL' | 'OData-EntityId' | 'OData-Isolation' | 'OData-MaxVersion' | 'OData-Version' | 'Opt' | 'Optional-WWW-Authenticate' | 'Ordering-Type' | 'Origin' | 'Origin-Agent-Cluster' | 'OSCORE' | 'OSLC-Core-Version' | 'Overwrite' | 'P3P' | 'PEP' | 'PEP-Info' | 'Permissions-Policy' | 'PICS-Label' | 'Ping-From' | 'Ping-To' | 'Position' | 'Pragma' | 'Prefer' | 'Preference-Applied' | 'Priority' | 'ProfileObject' | 'Protocol' | 'Protocol-Info' | 'Protocol-Query' | 'Protocol-Request' | 'Proxy-Authenticate' | 'Proxy-Authentication-Info' | 'Proxy-Authorization' | 'Proxy-Features' | 'Proxy-Instruction' | 'Proxy-Status' | 'Public' | 'Public-Key-Pins' | 'Public-Key-Pins-Report-Only' | 'Range' | 'Redirect-Ref' | 'Referer' | 'Referer-Root' | 'Referrer-Policy' | 'Refresh' | 'Repeatability-Client-ID' | 'Repeatability-First-Sent' | 'Repeatability-Request-ID' | 'Repeatability-Result' | 'Replay-Nonce' | 'Reporting-Endpoints' | 'Repr-Digest' | 'Retry-After' | 'Safe' | 'Schedule-Reply' | 'Schedule-Tag' | 'Sec-Fetch-Dest' | 'Sec-Fetch-Mode' | 'Sec-Fetch-Site' | 'Sec-Fetch-Storage-Access' | 'Sec-Fetch-User' | 'Sec-GPC' | 'Sec-Purpose' | 'Sec-Token-Binding' | 'Sec-WebSocket-Accept' | 'Sec-WebSocket-Extensions' | 'Sec-WebSocket-Key' | 'Sec-WebSocket-Protocol' | 'Sec-WebSocket-Version' | 'Security-Scheme' | 'Server' | 'Server-Timing' | 'Set-Cookie' | 'Set-Cookie2' | 'Set-Txn' | 'SetProfile' | 'Signature' | 'Signature-Input' | 'SLUG' | 'SoapAction' | 'Status-URI' | 'Strict-Transport-Security' | 'Sunset' | 'Surrogate-Capability' | 'Surrogate-Control' | 'TCN' | 'TE' | 'Timeout' | 'Timing-Allow-Origin' | 'Topic' | 'Traceparent' | 'Tracestate' | 'Trailer' | 'Transfer-Encoding' | 'TTL' | 'Unencoded-Digest' | 'Upgrade' | 'Urgency' | 'URI' | 'Use-As-Dictionary' | 'User-Agent' | 'Variant-Vary' | 'Vary' | 'Via' | 'Want-Content-Digest' | 'Want-Digest' | 'Want-Repr-Digest' | 'Want-Unencoded-Digest' | 'Warning' | 'WWW-Authenticate' | 'X-Content-Type-Options' | 'X-Frame-Options';
6
+ export type ResponseHeader = 'Accept-Query' | 'Access-Control-Allow-Credentials' | 'Access-Control-Allow-Headers' | 'Access-Control-Allow-Methods' | 'Access-Control-Allow-Origin' | 'Access-Control-Expose-Headers' | 'Access-Control-Max-Age' | 'Activate-Storage-Access' | 'Age' | 'Allow' | 'Cache-Control' | 'Cache-Group-Invalidation' | 'Cache-Groups' | 'Clear-Site-Data' | 'Content-Disposition' | 'Content-Encoding' | 'Content-Language' | 'Content-Length' | 'Content-Location' | 'Content-Range' | 'Content-Security-Policy' | 'Content-Security-Policy-Report-Only' | 'Content-Type' | 'Cookie' | 'Cross-Origin-Embedder-Policy' | 'Cross-Origin-Opener-Policy' | 'Cross-Origin-Resource-Policy' | 'Date' | 'ETag' | 'Expires' | 'Incremental' | 'Last-Modified' | 'Location' | 'Permissions-Policy' | 'Pragma' | 'Retry-After' | 'Save-Data' | 'Sec-CH-Prefers-Color-Scheme' | 'Sec-CH-Prefers-Reduced-Motion' | 'Sec-CH-UA' | 'Sec-CH-UA-Arch' | 'Sec-CH-UA-Bitness' | 'Sec-CH-UA-Form-Factor' | 'Sec-CH-UA-Full-Version' | 'Sec-CH-UA-Full-Version-List' | 'Sec-CH-UA-Mobile' | 'Sec-CH-UA-Model' | 'Sec-CH-UA-Platform' | 'Sec-CH-UA-Platform-Version' | 'Sec-CH-UA-WoW64' | 'Sec-Fetch-Dest' | 'Sec-Fetch-Mode' | 'Sec-Fetch-Site' | 'Sec-Fetch-User' | 'Sec-GPC' | 'Server' | 'Server-Timing' | 'Service-Worker-Navigation-Preload' | 'Set-Cookie' | 'Set-Txn' | 'Strict-Transport-Security' | 'Timing-Allow-Origin' | 'Trailer' | 'Transfer-Encoding' | 'Unencoded-Digest' | 'Upgrade' | 'Vary' | 'Want-Unencoded-Digest' | 'Warning' | 'WWW-Authenticate' | 'X-Content-Type-Options' | 'X-DNS-Prefetch-Control' | 'X-Frame-Options' | 'X-Permitted-Cross-Domain-Policies' | 'X-Powered-By' | 'X-Robots-Tag' | 'X-XSS-Protection';
7
7
  export type AcceptHeader = 'Accept' | 'Accept-Charset' | 'Accept-Encoding' | 'Accept-Language' | 'Accept-Patch' | 'Accept-Post' | 'Accept-Ranges';
8
8
  export type CustomHeader = string & {};
@@ -33,6 +33,7 @@ export declare const getPathNoStrict: (request: Request) => string;
33
33
  */
34
34
  export declare const mergePath: (...paths: string[]) => string;
35
35
  export declare const checkOptionalParameter: (path: string) => string[] | null;
36
+ export declare const tryDecodeURIComponent: (str: string) => string;
36
37
  export declare const getQueryParam: (url: string, key?: string) => string | undefined | Record<string, string>;
37
38
  export declare const getQueryParams: (url: string, key?: string) => string[] | undefined | Record<string, string[]>;
38
39
  export declare const decodeURIComponent_: typeof decodeURIComponent;
@@ -1,5 +1,5 @@
1
1
  // src/utils/cookie.ts
2
- import { decodeURIComponent_, tryDecode } from "./url.js";
2
+ import { tryDecodeURIComponent } from "./url.js";
3
3
  var algorithm = { name: "HMAC", hash: "SHA-256" };
4
4
  var getCryptoKey = async (secret) => {
5
5
  const secretBuf = typeof secret === "string" ? new TextEncoder().encode(secret) : secret;
@@ -64,7 +64,7 @@ var parse = (cookie, name) => {
64
64
  cookieValue = cookieValue.slice(1, -1);
65
65
  }
66
66
  if (validCookieValueRegEx.test(cookieValue)) {
67
- parsedCookie[cookieName] = cookieValue.indexOf("%") !== -1 ? tryDecode(cookieValue, decodeURIComponent_) : cookieValue;
67
+ parsedCookie[cookieName] = tryDecodeURIComponent(cookieValue);
68
68
  if (name) {
69
69
  break;
70
70
  }
@@ -59,8 +59,11 @@ var StreamingApi = class {
59
59
  }
60
60
  async pipe(body) {
61
61
  this.writer.releaseLock();
62
- await body.pipeTo(this.writable, { preventClose: true });
63
- this.writer = this.writable.getWriter();
62
+ try {
63
+ await body.pipeTo(this.writable, { preventClose: true, preventAbort: true });
64
+ } finally {
65
+ this.writer = this.writable.getWriter();
66
+ }
64
67
  }
65
68
  onAbort(listener) {
66
69
  this.abortSubscribers.push(listener);
@@ -124,18 +124,16 @@ var checkOptionalParameter = (path) => {
124
124
  });
125
125
  return results.filter((v, i, a) => a.indexOf(v) === i);
126
126
  };
127
+ var tryDecodeURIComponent = (str) => str.indexOf("%") !== -1 ? tryDecode(str, decodeURIComponent_) : str;
127
128
  var _decodeURI = (value) => {
128
- if (!/[%+]/.test(value)) {
129
- return value;
130
- }
131
129
  if (value.indexOf("+") !== -1) {
132
130
  value = value.replace(/\+/g, " ");
133
131
  }
134
- return value.indexOf("%") !== -1 ? tryDecode(value, decodeURIComponent_) : value;
132
+ return tryDecodeURIComponent(value);
135
133
  };
136
134
  var _getQueryParam = (url, key, multiple) => {
137
135
  let encoded;
138
- if (!multiple && key && !/[%+]/.test(key)) {
136
+ if (!multiple && key && key.indexOf("%") === -1 && key.indexOf("+") === -1) {
139
137
  let keyIndex2 = url.indexOf("?", 8);
140
138
  if (keyIndex2 === -1) {
141
139
  return void 0;
@@ -218,5 +216,6 @@ export {
218
216
  splitPath,
219
217
  splitRoutingPath,
220
218
  tryDecode,
221
- tryDecodeURI
219
+ tryDecodeURI,
220
+ tryDecodeURIComponent
222
221
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "4.12.34",
3
+ "version": "4.13.1",
4
4
  "description": "Web framework built on Web Standards",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",
@@ -231,6 +231,11 @@
231
231
  "import": "./dist/middleware/logger/index.js",
232
232
  "require": "./dist/cjs/middleware/logger/index.js"
233
233
  },
234
+ "./method-not-allowed": {
235
+ "types": "./dist/types/middleware/method-not-allowed/index.d.ts",
236
+ "import": "./dist/middleware/method-not-allowed/index.js",
237
+ "require": "./dist/cjs/middleware/method-not-allowed/index.js"
238
+ },
234
239
  "./method-override": {
235
240
  "types": "./dist/types/middleware/method-override/index.d.ts",
236
241
  "import": "./dist/middleware/method-override/index.js",
@@ -528,6 +533,9 @@
528
533
  "logger": [
529
534
  "./dist/types/middleware/logger"
530
535
  ],
536
+ "method-not-allowed": [
537
+ "./dist/types/middleware/method-not-allowed"
538
+ ],
531
539
  "method-override": [
532
540
  "./dist/types/middleware/method-override"
533
541
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suveren/gateway",
3
- "version": "0.6.5",
3
+ "version": "0.7.0",
4
4
  "description": "Suveren gateway — local agent gateway built in compliance with the Human Agency Protocol (HAP). Runs the UI, control plane, and MCP server in one Node process.",
5
5
  "type": "module",
6
6
  "main": "server.js",