Skip to content

Commit eaebfb9

Browse files
feat(MiddlewareCore): add core abstraction.
1 parent de36d4c commit eaebfb9

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Interface.
2+
import { MiddlewareShape } from "../interface/middleware.shape";
3+
/**
4+
* @description
5+
* @export
6+
* @abstract
7+
* @class MiddlewareCore
8+
* @typedef {MiddlewareCore}
9+
* @template [Input=any]
10+
* @template [Output=void]
11+
* @template [Middleware=any]
12+
* @implements {MiddlewareShape<Input, Middleware>}
13+
*/
14+
export abstract class MiddlewareCore<
15+
Input = any,
16+
Output = void,
17+
Middleware = any
18+
> implements MiddlewareShape<Input, Output, Middleware> {
19+
/**
20+
* @description
21+
* @public
22+
* @abstract
23+
* @param {...Input[]} args
24+
*/
25+
public abstract execute(context: Input): this;
26+
public abstract execute(...args: Input[]): this;
27+
28+
/**
29+
* @description
30+
* @public
31+
* @abstract
32+
* @param {Middleware} middleware
33+
* @returns {this}
34+
*/
35+
public abstract use(middleware: Middleware): this;
36+
37+
public abstract executeAsync(context: Input): Promise<Output>;
38+
public abstract executeAsync(...args: Input[]): Promise<Output>;
39+
}

0 commit comments

Comments
 (0)