@esportsplus/routing 0.0.18 → 0.0.19
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.
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Middleware, Request, Response } from '../types';
|
|
2
2
|
import dispatch from './dispatch';
|
|
3
3
|
import match from './match';
|
|
4
|
+
declare const factory: <R>(...fns: Middleware<R>[]) => import("@esportsplus/middleware/build/types").Next<Request<R>, Response<R>>;
|
|
4
5
|
declare const _default: {
|
|
5
|
-
dispatch: <R>(request:
|
|
6
|
-
factory: <
|
|
7
|
-
match: <R_2>(router: import("../router").Router<R_2>, subdomain?: string | undefined) =>
|
|
6
|
+
dispatch: <R>(request: Request<R>) => Response<R>;
|
|
7
|
+
factory: <R_1>(...fns: Middleware<R_1>[]) => import("@esportsplus/middleware/build/types").Next<Request<R_1>, Response<R_1>>;
|
|
8
|
+
match: <R_2>(router: import("../router").Router<R_2>, subdomain?: string | undefined) => Middleware<R_2>;
|
|
8
9
|
};
|
|
9
10
|
export default _default;
|
|
10
11
|
export { dispatch, factory, match };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import middleware from '@esportsplus/middleware';
|
|
2
2
|
import dispatch from './dispatch';
|
|
3
3
|
import match from './match';
|
|
4
|
+
const factory = (...fns) => {
|
|
5
|
+
return middleware(...fns);
|
|
6
|
+
};
|
|
4
7
|
export default { dispatch, factory, match };
|
|
5
8
|
export { dispatch, factory, match };
|
package/build/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Middleware as M, Next as N } from '@esportsplus/middleware';
|
|
2
2
|
import { Route, Router } from './router';
|
|
3
|
-
type Middleware<R> = M<Request<R>,
|
|
4
|
-
type Next<R> = N<Request<R>,
|
|
3
|
+
type Middleware<R> = M<Request<R>, Response<R>>;
|
|
4
|
+
type Next<R> = N<Request<R>, Response<R>>;
|
|
5
5
|
type Options<R> = {
|
|
6
6
|
middleware?: Middleware<R>[];
|
|
7
7
|
name?: string;
|
|
@@ -21,5 +21,6 @@ type Request<R> = {
|
|
|
21
21
|
query: Record<string, unknown>;
|
|
22
22
|
subdomain?: string;
|
|
23
23
|
};
|
|
24
|
-
type Responder<R> = (request: Request<R>) =>
|
|
25
|
-
|
|
24
|
+
type Responder<R> = (request: Request<R>) => Response<R>;
|
|
25
|
+
type Response<R> = Promise<R> | R;
|
|
26
|
+
export { Middleware, Next, Options, Request, Responder, Response, Route, Router };
|
package/package.json
CHANGED
package/src/middleware/index.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Middleware, Request, Response } from '~/types';
|
|
2
|
+
import middleware from '@esportsplus/middleware';
|
|
2
3
|
import dispatch from './dispatch';
|
|
3
4
|
import match from './match';
|
|
4
5
|
|
|
5
6
|
|
|
7
|
+
const factory = <R>(...fns: Middleware<R>[]) => {
|
|
8
|
+
return middleware<Request<R>, Response<R>>(...fns);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
|
|
6
12
|
export default { dispatch, factory, match };
|
|
7
13
|
export { dispatch, factory, match };
|
package/src/types.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { Middleware as M, Next as N } from '@esportsplus/middleware';
|
|
|
2
2
|
import { Route, Router } from './router';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
type Middleware<R> = M<Request<R>,
|
|
5
|
+
type Middleware<R> = M<Request<R>, Response<R>>;
|
|
6
6
|
|
|
7
|
-
type Next<R> = N<Request<R>,
|
|
7
|
+
type Next<R> = N<Request<R>, Response<R>>;
|
|
8
8
|
|
|
9
9
|
type Options<R> = {
|
|
10
10
|
middleware?: Middleware<R>[];
|
|
@@ -27,7 +27,9 @@ type Request<R> = {
|
|
|
27
27
|
subdomain?: string;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
type Responder<R> = (request: Request<R>) =>
|
|
30
|
+
type Responder<R> = (request: Request<R>) => Response<R>;
|
|
31
31
|
|
|
32
|
+
type Response<R> = Promise<R> | R;
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
|
|
35
|
+
export { Middleware, Next, Options, Request, Responder, Response, Route, Router };
|