routup 3.0.0-alpha.3 → 3.1.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 (63) hide show
  1. package/README.md +23 -19
  2. package/dist/adapters/node/module.d.ts +7 -0
  3. package/dist/{utils → adapters/raw}/header.d.ts +1 -1
  4. package/dist/{layer → adapters/raw}/index.d.ts +1 -1
  5. package/dist/adapters/raw/module.d.ts +4 -0
  6. package/dist/{dispatcher/adapters → adapters}/raw/type.d.ts +1 -1
  7. package/dist/adapters/web/module.d.ts +4 -0
  8. package/dist/constants.d.ts +7 -7
  9. package/dist/dispatcher/event/dispatch.d.ts +4 -0
  10. package/dist/dispatcher/event/error.d.ts +5 -0
  11. package/dist/dispatcher/event/index.d.ts +5 -0
  12. package/dist/dispatcher/event/is.d.ts +3 -0
  13. package/dist/dispatcher/event/module.d.ts +56 -0
  14. package/dist/dispatcher/event/types.d.ts +9 -0
  15. package/dist/dispatcher/index.d.ts +1 -2
  16. package/dist/dispatcher/type.d.ts +2 -30
  17. package/dist/error/create.d.ts +3 -3
  18. package/dist/error/is.d.ts +2 -2
  19. package/dist/error/module.d.ts +1 -1
  20. package/dist/handler/constants.d.ts +1 -0
  21. package/dist/handler/core/define.d.ts +4 -3
  22. package/dist/handler/core/types.d.ts +3 -3
  23. package/dist/handler/error/define.d.ts +4 -3
  24. package/dist/handler/error/types.d.ts +5 -5
  25. package/dist/handler/index.d.ts +1 -0
  26. package/dist/handler/is.d.ts +3 -1
  27. package/dist/handler/module.d.ts +23 -0
  28. package/dist/handler/types-base.d.ts +6 -2
  29. package/dist/handler/types.d.ts +3 -4
  30. package/dist/hook/constants.d.ts +8 -0
  31. package/dist/hook/index.d.ts +3 -0
  32. package/dist/hook/module.d.ts +19 -0
  33. package/dist/hook/types.d.ts +5 -0
  34. package/dist/index.cjs +658 -468
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.ts +1 -1
  37. package/dist/index.mjs +649 -461
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/plugin/types.d.ts +0 -5
  40. package/dist/response/helpers/send-web-blob.d.ts +1 -1
  41. package/dist/response/helpers/send-web-response.d.ts +1 -1
  42. package/dist/router/constants.d.ts +8 -0
  43. package/dist/router/index.d.ts +0 -1
  44. package/dist/router/module.d.ts +58 -24
  45. package/dist/router/types.d.ts +7 -0
  46. package/dist/types.d.ts +1 -0
  47. package/dist/utils/index.d.ts +2 -1
  48. package/dist/utils/method.d.ts +3 -0
  49. package/dist/utils/next.d.ts +2 -0
  50. package/package.json +8 -8
  51. package/dist/dispatcher/adapters/node/module.d.ts +0 -7
  52. package/dist/dispatcher/adapters/raw/module.d.ts +0 -4
  53. package/dist/dispatcher/adapters/web/index.d.ts +0 -2
  54. package/dist/dispatcher/adapters/web/module.d.ts +0 -5
  55. package/dist/dispatcher/utils.d.ts +0 -5
  56. package/dist/layer/constants.d.ts +0 -1
  57. package/dist/layer/module.d.ts +0 -17
  58. package/dist/layer/type.d.ts +0 -8
  59. package/dist/layer/utils.d.ts +0 -2
  60. /package/dist/{dispatcher/adapters → adapters}/index.d.ts +0 -0
  61. /package/dist/{dispatcher/adapters → adapters}/node/index.d.ts +0 -0
  62. /package/dist/{dispatcher/adapters/raw → adapters/web}/index.d.ts +0 -0
  63. /package/dist/{dispatcher/adapters → adapters}/web/type.d.ts +0 -0
package/README.md CHANGED
@@ -40,6 +40,7 @@ npm install routup --save
40
40
  - 🚀 runtime agnostic (Node.JS, Bun, Deno, ...)
41
41
  - 📝 different handler types (base & error)
42
42
  - ✨ promise (async) support for core- & error-handlers
43
+ - 📌 robust hook system
43
44
  - 🔌 powerful plugin system
44
45
  - 🧰 tree shakeable response & request helpers
45
46
  - 🤝️ different handler declaration styles (shorthand & verbose)
@@ -61,6 +62,8 @@ as all concepts and basics are taught there.
61
62
  ### Handlers
62
63
 
63
64
  Both core and error handlers, can be defined in two different ways.
65
+ Core handler functions can have up to 3 arguments (req, res, next) whereas error handler functions can have up to 4 arguments (err, req, res, next).
66
+ This should be familiar to anyone who has used express before.
64
67
 
65
68
  **`Shorthand`**
66
69
 
@@ -187,17 +190,18 @@ According to the fact that routup is a minimalistic framework,
187
190
  it depends on [plugins](https://github.com/routup/plugins) to cover some
188
191
  typically http framework functions, which are not integrated in the main package.
189
192
 
190
- | Name | Description |
191
- |-----------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
192
- | [body](https://github.com/routup/plugins/tree/master/packages/body) | Read and parse the request body. |
193
- | [cookie](https://github.com/routup/plugins/tree/master/packages/cookie) | Read and parse request cookies and serialize cookies for the response. |
194
- | [decorators](https://github.com/routup/plugins/tree/master/packages/decorators) | Create request handlers with class-, method- & parameter-decorators. |
195
- | [prometheus](https://github.com/routup/plugins/tree/master/packages/prometheus) | Collect and serve metrics for prometheus. |
196
- | [query](https://github.com/routup/plugins/tree/master/packages/query) | Read and parse the query string of the request url. |
197
- | [rate-limit](https://github.com/routup/plugins/tree/master/packages/rate-limit) | Rate limit incoming requests. |
198
- | [rate-limit-redis](https://github.com/routup/plugins/tree/master/packages/rate-limit-redis) | Redis adapter for the rate-limit plugin. |
199
- | [static](https://github.com/routup/plugins/tree/master/packages/static) | Serve static files from a directory. |
200
- | [swagger](https://github.com/routup/plugins/tree/master/packages/swagger) | Serve generated docs from URL or based on a JSON file. |
193
+ | Name | Description |
194
+ |---------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
195
+ | [assets](https://github.com/routup/plugins/tree/master/packages/assets) | Serve static files from a directory. |
196
+ | [basic](https://github.com/routup/plugins/tree/master/packages/basic) | Bundle of the body, cookie and query plugin. |
197
+ | [body](https://github.com/routup/plugins/tree/master/packages/body) | Read and parse the request body. |
198
+ | [cookie](https://github.com/routup/plugins/tree/master/packages/cookie) | Read and parse request cookies and serialize cookies for the response. |
199
+ | [decorators](https://github.com/routup/plugins/tree/master/packages/decorators) | Create request handlers with class-, method- & parameter-decorators. |
200
+ | [prometheus](https://github.com/routup/plugins/tree/master/packages/prometheus) | Collect and serve metrics for prometheus. |
201
+ | [query](https://github.com/routup/plugins/tree/master/packages/query) | Read and parse the query string of the request url. |
202
+ | [rate-limit](https://github.com/routup/plugins/tree/master/packages/rate-limit) | Rate limit incoming requests. |
203
+ | [rate-limit-redis](https://github.com/routup/plugins/tree/master/packages/rate-limit-redis) | Redis adapter for the rate-limit plugin. |
204
+ | [swagger](https://github.com/routup/plugins/tree/master/packages/swagger) | Serve generated docs from URL or based on a JSON file. |
201
205
 
202
206
  ## Benchmarks
203
207
 
@@ -207,14 +211,14 @@ typically http framework functions, which are not integrated in the main package
207
211
  * Date: `Wed Sep 13 2023 15:11:58 GMT+0200 (Mitteleuropäische Sommerzeit) `
208
212
  * Method: `autocannon -c 100 -d 40 -p 10 localhost:3000` (two rounds; one to warm-up, one to measure)
209
213
 
210
- | Package | Requests/s | Latency (ms) | Throughput/MB |
211
- |:-----------|:-----------:|--------------:|----------------:|
212
- | http | 61062 | 15.87 | 10.89 |
213
- | fastify | 59679 | 16.26 | 10.70 |
214
- | koa | 45763 | 21.35 | 8.16 |
215
- | **routup** | 43881 | 22.29 | 8.87 |
216
- | hapi | 41374 | 23.67 | 7.38 |
217
- | express | 13376 | 74.18 | 2.39 |
214
+ | Package | Requests/s | Latency (ms) | Throughput/MB |
215
+ |:-----------|:-----------:|-------------:|--------------:|
216
+ | http | 61062 | 15.87 | 10.89 |
217
+ | fastify | 59679 | 16.26 | 10.70 |
218
+ | koa | 45763 | 21.35 | 8.16 |
219
+ | **routup** | 44588 | 21.91 | 9.02 |
220
+ | hapi | 41374 | 23.67 | 7.38 |
221
+ | express | 13376 | 74.18 | 2.39 |
218
222
 
219
223
  Benchmarks were generated using autocannon.
220
224
  To recreate the results, this can be done using the [benchmarks'](https://github.com/routup/benchmarks) repository.
@@ -0,0 +1,7 @@
1
+ /// <reference types="node" />
2
+ import type { RequestListener } from 'node:http';
3
+ import type { Request } from '../../request';
4
+ import type { Response } from '../../response';
5
+ import type { Router } from '../../router';
6
+ export declare function dispatchNodeRequest(router: Router, request: Request, response: Response): Promise<void>;
7
+ export declare function createNodeDispatcher(router: Router): RequestListener;
@@ -1,3 +1,3 @@
1
- import type { RawResponseHeader } from '../dispatcher';
1
+ import type { RawResponseHeader } from './type';
2
2
  export declare function transformHeaderToTuples(key: string, value: RawResponseHeader): [string, string][];
3
3
  export declare function transformHeadersToTuples(input: Record<string, RawResponseHeader>): [string, string][];
@@ -1,3 +1,3 @@
1
+ export * from './header';
1
2
  export * from './module';
2
3
  export * from './type';
3
- export * from './utils';
@@ -0,0 +1,4 @@
1
+ import type { Router } from '../../router';
2
+ import type { RawRequest, RawResponse } from './type';
3
+ export declare function dispatchRawRequest(router: Router, request: RawRequest): Promise<RawResponse>;
4
+ export declare function createRawDispatcher(router: Router): (request: RawRequest) => Promise<RawResponse>;
@@ -1,4 +1,4 @@
1
- import type { RequestBody, RequestHeaders } from '../../../request';
1
+ import type { RequestBody, RequestHeaders } from '../../request';
2
2
  export type RawRequest = {
3
3
  method: string;
4
4
  path: string;
@@ -0,0 +1,4 @@
1
+ import type { Router } from '../../router';
2
+ import type { WebRequest } from '../../types';
3
+ export declare function dispatchWebRequest(router: Router, request: WebRequest): Promise<Response>;
4
+ export declare function createWebDispatcher(router: Router): (request: WebRequest) => Promise<Response>;
@@ -1,11 +1,11 @@
1
1
  export declare enum MethodName {
2
- GET = "get",
3
- POST = "post",
4
- PUT = "put",
5
- PATCH = "patch",
6
- DELETE = "delete",
7
- OPTIONS = "options",
8
- HEAD = "head"
2
+ GET = "GET",
3
+ POST = "POST",
4
+ PUT = "PUT",
5
+ PATCH = "PATCH",
6
+ DELETE = "DELETE",
7
+ OPTIONS = "OPTIONS",
8
+ HEAD = "HEAD"
9
9
  }
10
10
  export declare enum HeaderName {
11
11
  ACCEPT = "accept",
@@ -0,0 +1,4 @@
1
+ import type { DispatchEvent } from './module';
2
+ type DispatchTargetFn = (next: (err?: Error) => any) => unknown;
3
+ export declare function dispatch(event: DispatchEvent, target: DispatchTargetFn): Promise<boolean>;
4
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { RoutupError } from '../../error';
2
+ import { DispatchEvent } from './module';
3
+ export declare class DispatchErrorEvent extends DispatchEvent {
4
+ error: RoutupError;
5
+ }
@@ -0,0 +1,5 @@
1
+ export * from './dispatch';
2
+ export * from './is';
3
+ export * from './error';
4
+ export * from './module';
5
+ export * from './types';
@@ -0,0 +1,3 @@
1
+ import type { DispatchErrorEvent } from './error';
2
+ import type { DispatchEvent } from './module';
3
+ export declare function isDispatcherErrorEvent(event: DispatchEvent | DispatchErrorEvent): event is DispatchErrorEvent;
@@ -0,0 +1,56 @@
1
+ import { MethodName } from '../../constants';
2
+ import type { RoutupError } from '../../error';
3
+ import type { Request } from '../../request';
4
+ import type { Response } from '../../response';
5
+ import type { Next } from '../../types';
6
+ import type { DispatchEventCreateContext } from './types';
7
+ export declare class DispatchEvent {
8
+ /**
9
+ * Request Object.
10
+ */
11
+ request: Request;
12
+ /**
13
+ * Response Object.
14
+ */
15
+ response: Response;
16
+ /**
17
+ * Params collected during execution.
18
+ */
19
+ params: Record<string, any>;
20
+ /**
21
+ * Request path.
22
+ */
23
+ path: string;
24
+ /**
25
+ * HTTP Method used for the request.
26
+ */
27
+ method: `${MethodName}`;
28
+ /**
29
+ * The relative path on which the router is hung.
30
+ */
31
+ mountPath: string;
32
+ /**
33
+ * The error which occurred during the dispatch process.
34
+ */
35
+ error?: RoutupError;
36
+ /**
37
+ * Signal that the request hasn't been handled.
38
+ * Therefore, the request must be passed to the next handler or router in the chain.
39
+ */
40
+ next: Next;
41
+ /**
42
+ * Indicate if the request has already been dispatched/send.
43
+ */
44
+ protected _dispatched: boolean;
45
+ /**
46
+ * Ids of chained router instances.
47
+ */
48
+ routerPath: number[];
49
+ /**
50
+ * Collected methods during dispatch process.
51
+ */
52
+ methodsAllowed: string[];
53
+ constructor(context: DispatchEventCreateContext);
54
+ get dispatched(): boolean;
55
+ set dispatched(value: boolean);
56
+ }
@@ -0,0 +1,9 @@
1
+ import type { MethodName } from '../../constants';
2
+ import type { Request } from '../../request';
3
+ import type { Response } from '../../response';
4
+ export type DispatchEventCreateContext = {
5
+ request: Request;
6
+ response: Response;
7
+ method?: `${MethodName}`;
8
+ path?: string;
9
+ };
@@ -1,3 +1,2 @@
1
- export * from './adapters';
1
+ export * from './event';
2
2
  export * from './type';
3
- export * from './utils';
@@ -1,32 +1,4 @@
1
- import type { ErrorProxy } from '../error';
2
- import type { Request } from '../request';
3
- import type { Response } from '../response';
1
+ import type { DispatchEvent } from './event';
4
2
  export interface Dispatcher {
5
- dispatch(event: DispatcherEvent, meta: DispatcherMeta): Promise<boolean>;
3
+ dispatch(event: DispatchEvent): Promise<void>;
6
4
  }
7
- export type DispatcherMeta = {
8
- /**
9
- * Params collected on path.
10
- */
11
- params: Record<string, any>;
12
- /**
13
- * Path to check for the current instance.
14
- */
15
- path: string;
16
- /**
17
- * The relative path on which the router is hung.
18
- */
19
- mountPath: string;
20
- /**
21
- * The error which occurred during a previous handler.
22
- */
23
- error?: ErrorProxy;
24
- /**
25
- * Ids of chained router instances.
26
- */
27
- routerPath: number[];
28
- };
29
- export type DispatcherEvent = {
30
- req: Request;
31
- res: Response;
32
- };
@@ -1,11 +1,11 @@
1
1
  import type { Input } from '@ebec/http';
2
- import { ErrorProxy } from './module';
2
+ import { RoutupError } from './module';
3
3
  /**
4
- * Create an error proxy by
4
+ * Create an internal error object by
5
5
  * - an existing error (accessible via cause property)
6
6
  * - options
7
7
  * - message
8
8
  *
9
9
  * @param input
10
10
  */
11
- export declare function createError(input: Input): ErrorProxy;
11
+ export declare function createError(input: Input | unknown): RoutupError;
@@ -1,2 +1,2 @@
1
- import { ErrorProxy } from './module';
2
- export declare function isError(input: unknown): input is ErrorProxy;
1
+ import { RoutupError } from './module';
2
+ export declare function isError(input: unknown): input is RoutupError;
@@ -1,3 +1,3 @@
1
1
  import { HTTPError } from '@ebec/http';
2
- export declare class ErrorProxy extends HTTPError {
2
+ export declare class RoutupError extends HTTPError {
3
3
  }
@@ -2,3 +2,4 @@ export declare enum HandlerType {
2
2
  CORE = "core",
3
3
  ERROR = "error"
4
4
  }
5
+ export declare const HandlerSymbol: unique symbol;
@@ -1,3 +1,4 @@
1
- import type { CoreHandler, CoreHandlerFn } from './types';
2
- export declare function coreHandler(input: Omit<CoreHandler, 'type'>): CoreHandler;
3
- export declare function coreHandler(input: CoreHandlerFn): CoreHandler;
1
+ import { Handler } from '../module';
2
+ import type { CoreHandlerConfig, CoreHandlerFn } from './types';
3
+ export declare function coreHandler(input: Omit<CoreHandlerConfig, 'type'>): Handler;
4
+ export declare function coreHandler(input: CoreHandlerFn): Handler;
@@ -1,10 +1,10 @@
1
1
  import type { Request } from '../../request';
2
2
  import type { Response } from '../../response';
3
+ import type { Next } from '../../types';
3
4
  import type { HandlerType } from '../constants';
4
- import type { Next } from '../types';
5
- import type { HandlerBase } from '../types-base';
5
+ import type { HandlerBaseConfig } from '../types-base';
6
6
  export type CoreHandlerFn = (req: Request, res: Response, next: Next) => unknown | Promise<unknown>;
7
- export type CoreHandler = HandlerBase & {
7
+ export type CoreHandlerConfig = HandlerBaseConfig & {
8
8
  type: `${HandlerType.CORE}`;
9
9
  fn: CoreHandlerFn;
10
10
  };
@@ -1,3 +1,4 @@
1
- import type { ErrorHandler, ErrorHandlerFn } from './types';
2
- export declare function errorHandler(input: Omit<ErrorHandler, 'type'>): ErrorHandler;
3
- export declare function errorHandler(input: ErrorHandlerFn): ErrorHandler;
1
+ import { Handler } from '../module';
2
+ import type { ErrorHandlerConfig, ErrorHandlerFn } from './types';
3
+ export declare function errorHandler(input: Omit<ErrorHandlerConfig, 'type'>): Handler;
4
+ export declare function errorHandler(input: ErrorHandlerFn): Handler;
@@ -1,11 +1,11 @@
1
- import type { ErrorProxy } from '../../error';
1
+ import type { RoutupError } from '../../error';
2
2
  import type { Request } from '../../request';
3
3
  import type { Response } from '../../response';
4
+ import type { Next } from '../../types';
4
5
  import type { HandlerType } from '../constants';
5
- import type { Next } from '../types';
6
- import type { HandlerBase } from '../types-base';
7
- export type ErrorHandlerFn = (err: ErrorProxy, req: Request, res: Response, next: Next) => unknown | Promise<unknown>;
8
- export type ErrorHandler = HandlerBase & {
6
+ import type { HandlerBaseConfig } from '../types-base';
7
+ export type ErrorHandlerFn = (err: RoutupError, req: Request, res: Response, next: Next) => unknown | Promise<unknown>;
8
+ export type ErrorHandlerConfig = HandlerBaseConfig & {
9
9
  type: `${HandlerType.ERROR}`;
10
10
  fn: ErrorHandlerFn;
11
11
  };
@@ -2,5 +2,6 @@ export * from './core';
2
2
  export * from './error';
3
3
  export * from './constants';
4
4
  export * from './is';
5
+ export * from './module';
5
6
  export * from './types';
6
7
  export * from './types-base';
@@ -1,2 +1,4 @@
1
- import type { Handler } from './types';
1
+ import type { Handler } from './module';
2
+ import type { HandlerConfig } from './types';
3
+ export declare function isHandlerConfig(input: unknown): input is HandlerConfig;
2
4
  export declare function isHandler(input: unknown): input is Handler;
@@ -0,0 +1,23 @@
1
+ import { MethodName } from '../constants';
2
+ import type { DispatchEvent, Dispatcher } from '../dispatcher';
3
+ import { HookManager } from '../hook';
4
+ import type { Path } from '../path';
5
+ import { PathMatcher } from '../path';
6
+ import type { HandlerConfig } from './types';
7
+ export declare class Handler implements Dispatcher {
8
+ readonly '@instanceof': symbol;
9
+ protected config: HandlerConfig;
10
+ protected hookManager: HookManager;
11
+ protected pathMatcher: PathMatcher | undefined;
12
+ protected _method: MethodName | undefined;
13
+ constructor(handler: HandlerConfig);
14
+ get type(): "error" | "core";
15
+ get path(): Path | undefined;
16
+ get method(): MethodName | undefined;
17
+ dispatch(event: DispatchEvent): Promise<void>;
18
+ matchPath(path: string): boolean;
19
+ setPath(path?: Path): void;
20
+ matchMethod(method: `${MethodName}`): boolean;
21
+ setMethod(input?: `${MethodName}`): void;
22
+ protected mountHooks(): void;
23
+ }
@@ -1,6 +1,10 @@
1
1
  import type { MethodName } from '../constants';
2
+ import type { HookDefaultListener, HookErrorListener } from '../hook';
2
3
  import type { Path } from '../path';
3
- export type HandlerBase = {
4
- method?: `${MethodName}` | `${Uppercase<MethodName>}`;
4
+ export type HandlerBaseConfig = {
5
+ method?: Uppercase<MethodName> | Lowercase<MethodName>;
5
6
  path?: Path;
7
+ onError?: HookErrorListener;
8
+ onBefore?: HookDefaultListener;
9
+ onAfter?: HookDefaultListener;
6
10
  };
@@ -1,5 +1,4 @@
1
- import type { CoreHandler, CoreHandlerFn } from './core';
2
- import type { ErrorHandler, ErrorHandlerFn } from './error';
3
- export type Next = (err?: Error) => void;
4
- export type Handler = CoreHandler | ErrorHandler;
1
+ import type { CoreHandlerConfig, CoreHandlerFn } from './core';
2
+ import type { ErrorHandlerConfig, ErrorHandlerFn } from './error';
3
+ export type HandlerConfig = CoreHandlerConfig | ErrorHandlerConfig;
5
4
  export type HandlerFn = CoreHandlerFn | ErrorHandlerFn;
@@ -0,0 +1,8 @@
1
+ export declare enum HookName {
2
+ ERROR = "error",
3
+ DISPATCH_START = "dispatchStart",
4
+ DISPATCH_END = "dispatchEnd",
5
+ CHILD_MATCH = "childMatch",
6
+ CHILD_DISPATCH_BEFORE = "childDispatchBefore",
7
+ CHILD_DISPATCH_AFTER = "childDispatchAfter"
8
+ }
@@ -0,0 +1,3 @@
1
+ export * from './constants';
2
+ export * from './module';
3
+ export * from './types';
@@ -0,0 +1,19 @@
1
+ import type { DispatchEvent } from '../dispatcher';
2
+ import { HookName } from './constants';
3
+ import type { HookListener, HookUnsubscribeFn } from './types';
4
+ export declare class HookManager {
5
+ protected items: Record<string, HookListener[]>;
6
+ constructor();
7
+ addListener(name: `${HookName}`, fn: HookListener): HookUnsubscribeFn;
8
+ removeListener(name: `${HookName}`): void;
9
+ removeListener(name: `${HookName}`, fn: HookListener): void;
10
+ /**
11
+ * @throws RoutupError
12
+ *
13
+ * @param name
14
+ * @param event
15
+ */
16
+ trigger(name: `${HookName}`, event: DispatchEvent): Promise<void>;
17
+ private triggerListener;
18
+ private isErrorListenerHook;
19
+ }
@@ -0,0 +1,5 @@
1
+ import type { DispatchErrorEvent, DispatchEvent } from '../dispatcher';
2
+ export type HookErrorListener = (event: DispatchErrorEvent) => Promise<unknown> | unknown;
3
+ export type HookDefaultListener = (event: DispatchEvent) => Promise<unknown> | unknown;
4
+ export type HookListener = HookErrorListener | HookDefaultListener;
5
+ export type HookUnsubscribeFn = () => void;