keq 5.0.0-alpha.24 → 5.0.0-alpha.25
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/CHANGELOG.md +21 -0
- package/dist/exception/http-exceptions/bad-gateway.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/bad-gateway.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/bad-request.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/bad-request.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/conflict.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/conflict.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/content-too-large.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/content-too-large.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/forbidden.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/forbidden.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/gateway-timeout.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/gateway-timeout.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/http-version-not-supported.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/http-version-not-supported.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/im-a-teapot.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/im-a-teapot.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/internal-server-error.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/internal-server-error.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/method-not-allowed.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/method-not-allowed.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/not-acceptable.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/not-acceptable.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/not-founded.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/not-founded.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/not-implemented.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/not-implemented.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/precondition-failed.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/precondition-failed.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/proxy-authentication-required.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/proxy-authentication-required.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/request-timeout.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/request-timeout.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/request.exception.d.ts +7 -2
- package/dist/exception/http-exceptions/request.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/service-unavailable.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/service-unavailable.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/too-many-requests.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/too-many-requests.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/unauthorized.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/unauthorized.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/unsupported-media-type.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/unsupported-media-type.exception.d.ts.map +1 -1
- package/dist/exception/http-exceptions/uri-too-long.exception.d.ts +2 -2
- package/dist/exception/http-exceptions/uri-too-long.exception.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +108 -73
- package/dist/index.mjs.map +1 -1
- package/dist/request/request.d.ts +2 -1
- package/dist/request/request.d.ts.map +1 -1
- package/dist/router/index.d.ts +0 -5
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/keq-router.d.ts +25 -7
- package/dist/router/keq-router.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -35,52 +35,54 @@ var TimeoutException = class extends AbortException {
|
|
|
35
35
|
|
|
36
36
|
// src/exception/http-exceptions/request.exception.ts
|
|
37
37
|
var RequestException = class extends Exception {
|
|
38
|
-
constructor(statusCode, message,
|
|
38
|
+
constructor(statusCode, message, options) {
|
|
39
39
|
super(message);
|
|
40
40
|
__publicField(this, "statusCode");
|
|
41
41
|
__publicField(this, "retry");
|
|
42
|
+
__publicField(this, "response");
|
|
42
43
|
this.statusCode = statusCode;
|
|
43
|
-
this.retry =
|
|
44
|
+
this.retry = !(options == null ? void 0 : options.fatal);
|
|
45
|
+
this.response = options == null ? void 0 : options.response;
|
|
44
46
|
Object.defineProperty(this, "name", { value: "RequestException" });
|
|
45
47
|
}
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
// src/exception/http-exceptions/bad-request.exception.ts
|
|
49
51
|
var BadRequestException = class extends RequestException {
|
|
50
|
-
constructor(message = "Bad Request",
|
|
51
|
-
super(400, message,
|
|
52
|
+
constructor(message = "Bad Request", options) {
|
|
53
|
+
super(400, message, { fatal: true, ...options });
|
|
52
54
|
Object.defineProperty(this, "name", { value: "BadRequestException" });
|
|
53
55
|
}
|
|
54
56
|
};
|
|
55
57
|
|
|
56
58
|
// src/exception/http-exceptions/unauthorized.exception.ts
|
|
57
59
|
var UnauthorizedException = class extends RequestException {
|
|
58
|
-
constructor(message = "Unauthorized",
|
|
59
|
-
super(401, message,
|
|
60
|
+
constructor(message = "Unauthorized", options) {
|
|
61
|
+
super(401, message, { fatal: true, ...options });
|
|
60
62
|
Object.defineProperty(this, "name", { value: "UnauthorizedException" });
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
// src/exception/http-exceptions/forbidden.exception.ts
|
|
65
67
|
var ForbiddenException = class extends RequestException {
|
|
66
|
-
constructor(message = "Forbidden",
|
|
67
|
-
super(403, message,
|
|
68
|
+
constructor(message = "Forbidden", options) {
|
|
69
|
+
super(403, message, { fatal: true, ...options });
|
|
68
70
|
Object.defineProperty(this, "name", { value: "ForbiddenException" });
|
|
69
71
|
}
|
|
70
72
|
};
|
|
71
73
|
|
|
72
74
|
// src/exception/http-exceptions/not-founded.exception.ts
|
|
73
75
|
var NotFoundedException = class extends RequestException {
|
|
74
|
-
constructor(message = "Not Founded",
|
|
75
|
-
super(404, message,
|
|
76
|
+
constructor(message = "Not Founded", options) {
|
|
77
|
+
super(404, message, { fatal: true, ...options });
|
|
76
78
|
Object.defineProperty(this, "name", { value: "NotFoundedException" });
|
|
77
79
|
}
|
|
78
80
|
};
|
|
79
81
|
|
|
80
82
|
// src/exception/http-exceptions/method-not-allowed.exception.ts
|
|
81
83
|
var MethodNotAllowedException = class extends RequestException {
|
|
82
|
-
constructor(message = "Method Not Allowed",
|
|
83
|
-
super(405, message,
|
|
84
|
+
constructor(message = "Method Not Allowed", options) {
|
|
85
|
+
super(405, message, { fatal: true, ...options });
|
|
84
86
|
Object.defineProperty(this, "name", {
|
|
85
87
|
value: "MethodNotAllowedException"
|
|
86
88
|
});
|
|
@@ -89,16 +91,16 @@ var MethodNotAllowedException = class extends RequestException {
|
|
|
89
91
|
|
|
90
92
|
// src/exception/http-exceptions/not-acceptable.exception.ts
|
|
91
93
|
var NotAcceptableException = class extends RequestException {
|
|
92
|
-
constructor(message = "Not Acceptable",
|
|
93
|
-
super(406, message,
|
|
94
|
+
constructor(message = "Not Acceptable", options) {
|
|
95
|
+
super(406, message, { fatal: true, ...options });
|
|
94
96
|
Object.defineProperty(this, "name", { value: "NotAcceptableException" });
|
|
95
97
|
}
|
|
96
98
|
};
|
|
97
99
|
|
|
98
100
|
// src/exception/http-exceptions/proxy-authentication-required.exception.ts
|
|
99
101
|
var ProxyAuthenticationRequiredException = class extends RequestException {
|
|
100
|
-
constructor(message = "Proxy Authentication Required",
|
|
101
|
-
super(407, message,
|
|
102
|
+
constructor(message = "Proxy Authentication Required", options) {
|
|
103
|
+
super(407, message, { fatal: true, ...options });
|
|
102
104
|
Object.defineProperty(this, "name", {
|
|
103
105
|
value: "ProxyAuthenticationRequiredException"
|
|
104
106
|
});
|
|
@@ -107,8 +109,8 @@ var ProxyAuthenticationRequiredException = class extends RequestException {
|
|
|
107
109
|
|
|
108
110
|
// src/exception/http-exceptions/request-timeout.exception.ts
|
|
109
111
|
var RequestTimeoutException = class extends RequestException {
|
|
110
|
-
constructor(message = "Request Timeout",
|
|
111
|
-
super(408, message,
|
|
112
|
+
constructor(message = "Request Timeout", options) {
|
|
113
|
+
super(408, message, { fatal: false, ...options });
|
|
112
114
|
Object.defineProperty(this, "name", {
|
|
113
115
|
value: "RequestTimeoutException"
|
|
114
116
|
});
|
|
@@ -117,16 +119,16 @@ var RequestTimeoutException = class extends RequestException {
|
|
|
117
119
|
|
|
118
120
|
// src/exception/http-exceptions/conflict.exception.ts
|
|
119
121
|
var ConflictException = class extends RequestException {
|
|
120
|
-
constructor(message = "Conflict",
|
|
121
|
-
super(409, message,
|
|
122
|
+
constructor(message = "Conflict", options) {
|
|
123
|
+
super(409, message, { fatal: true, ...options });
|
|
122
124
|
Object.defineProperty(this, "name", { value: "ConflictException" });
|
|
123
125
|
}
|
|
124
126
|
};
|
|
125
127
|
|
|
126
128
|
// src/exception/http-exceptions/precondition-failed.exception.ts
|
|
127
129
|
var PreconditionFailedException = class extends RequestException {
|
|
128
|
-
constructor(message = "Precondition Failed",
|
|
129
|
-
super(412, message,
|
|
130
|
+
constructor(message = "Precondition Failed", options) {
|
|
131
|
+
super(412, message, { fatal: true, ...options });
|
|
130
132
|
Object.defineProperty(this, "name", {
|
|
131
133
|
value: "PreconditionFailedException"
|
|
132
134
|
});
|
|
@@ -135,8 +137,8 @@ var PreconditionFailedException = class extends RequestException {
|
|
|
135
137
|
|
|
136
138
|
// src/exception/http-exceptions/content-too-large.exception.ts
|
|
137
139
|
var ContentTooLargeException = class extends RequestException {
|
|
138
|
-
constructor(message = "Content Too Large",
|
|
139
|
-
super(413, message,
|
|
140
|
+
constructor(message = "Content Too Large", options) {
|
|
141
|
+
super(413, message, { fatal: true, ...options });
|
|
140
142
|
Object.defineProperty(this, "name", {
|
|
141
143
|
value: "ContentTooLargeException"
|
|
142
144
|
});
|
|
@@ -145,40 +147,40 @@ var ContentTooLargeException = class extends RequestException {
|
|
|
145
147
|
|
|
146
148
|
// src/exception/http-exceptions/uri-too-long.exception.ts
|
|
147
149
|
var UriTooLongException = class extends RequestException {
|
|
148
|
-
constructor(message = "URI Too Long",
|
|
149
|
-
super(414, message,
|
|
150
|
+
constructor(message = "URI Too Long", options) {
|
|
151
|
+
super(414, message, { fatal: true, ...options });
|
|
150
152
|
Object.defineProperty(this, "name", { value: "UriTooLongException" });
|
|
151
153
|
}
|
|
152
154
|
};
|
|
153
155
|
|
|
154
156
|
// src/exception/http-exceptions/unsupported-media-type.exception.ts
|
|
155
157
|
var UnsupportedMediaTypeException = class extends RequestException {
|
|
156
|
-
constructor(message = "Unsupported Media Type",
|
|
157
|
-
super(415, message,
|
|
158
|
+
constructor(message = "Unsupported Media Type", options) {
|
|
159
|
+
super(415, message, { fatal: true, ...options });
|
|
158
160
|
Object.defineProperty(this, "name", { value: "UnsupportedMediaTypeException" });
|
|
159
161
|
}
|
|
160
162
|
};
|
|
161
163
|
|
|
162
164
|
// src/exception/http-exceptions/im-a-teapot.exception.ts
|
|
163
165
|
var ImATeapotException = class extends RequestException {
|
|
164
|
-
constructor(message = "I'm a teapot",
|
|
165
|
-
super(418, message,
|
|
166
|
+
constructor(message = "I'm a teapot", options) {
|
|
167
|
+
super(418, message, { fatal: true, ...options });
|
|
166
168
|
Object.defineProperty(this, "name", { value: "ImATeapotException" });
|
|
167
169
|
}
|
|
168
170
|
};
|
|
169
171
|
|
|
170
172
|
// src/exception/http-exceptions/too-many-requests.exception.ts
|
|
171
173
|
var TooManyRequestsException = class extends RequestException {
|
|
172
|
-
constructor(message = "Too Many Requests",
|
|
173
|
-
super(429, message,
|
|
174
|
+
constructor(message = "Too Many Requests", options) {
|
|
175
|
+
super(429, message, { fatal: false, ...options });
|
|
174
176
|
Object.defineProperty(this, "name", { value: "TooManyRequestsException" });
|
|
175
177
|
}
|
|
176
178
|
};
|
|
177
179
|
|
|
178
180
|
// src/exception/http-exceptions/internal-server-error.exception.ts
|
|
179
181
|
var InternalServerErrorException = class extends RequestException {
|
|
180
|
-
constructor(message = "Internal Server Error",
|
|
181
|
-
super(500, message,
|
|
182
|
+
constructor(message = "Internal Server Error", options) {
|
|
183
|
+
super(500, message, { fatal: false, ...options });
|
|
182
184
|
Object.defineProperty(this, "name", {
|
|
183
185
|
value: "InternalServerErrorException"
|
|
184
186
|
});
|
|
@@ -187,24 +189,24 @@ var InternalServerErrorException = class extends RequestException {
|
|
|
187
189
|
|
|
188
190
|
// src/exception/http-exceptions/not-implemented.exception.ts
|
|
189
191
|
var NotImplementedException = class extends RequestException {
|
|
190
|
-
constructor(message = "Not Implemented",
|
|
191
|
-
super(501, message,
|
|
192
|
+
constructor(message = "Not Implemented", options) {
|
|
193
|
+
super(501, message, { fatal: true, ...options });
|
|
192
194
|
Object.defineProperty(this, "name", { value: "NotImplementedException" });
|
|
193
195
|
}
|
|
194
196
|
};
|
|
195
197
|
|
|
196
198
|
// src/exception/http-exceptions/bad-gateway.exception.ts
|
|
197
199
|
var BadGatewayException = class extends RequestException {
|
|
198
|
-
constructor(message = "Bad Gateway",
|
|
199
|
-
super(502, message,
|
|
200
|
+
constructor(message = "Bad Gateway", options) {
|
|
201
|
+
super(502, message, { fatal: false, ...options });
|
|
200
202
|
Object.defineProperty(this, "name", { value: "BadGatewayException" });
|
|
201
203
|
}
|
|
202
204
|
};
|
|
203
205
|
|
|
204
206
|
// src/exception/http-exceptions/service-unavailable.exception.ts
|
|
205
207
|
var ServiceUnavailableException = class extends RequestException {
|
|
206
|
-
constructor(message = "Service Unavailable",
|
|
207
|
-
super(503, message,
|
|
208
|
+
constructor(message = "Service Unavailable", options) {
|
|
209
|
+
super(503, message, { fatal: false, ...options });
|
|
208
210
|
Object.defineProperty(this, "name", {
|
|
209
211
|
value: "ServiceUnavailableException"
|
|
210
212
|
});
|
|
@@ -213,8 +215,8 @@ var ServiceUnavailableException = class extends RequestException {
|
|
|
213
215
|
|
|
214
216
|
// src/exception/http-exceptions/gateway-timeout.exception.ts
|
|
215
217
|
var GatewayTimeoutException = class extends RequestException {
|
|
216
|
-
constructor(message = "Gateway Timeout",
|
|
217
|
-
super(504, message,
|
|
218
|
+
constructor(message = "Gateway Timeout", options) {
|
|
219
|
+
super(504, message, { fatal: false, ...options });
|
|
218
220
|
Object.defineProperty(this, "name", { value: "GatewayTimeoutException" });
|
|
219
221
|
}
|
|
220
222
|
};
|
|
@@ -1596,11 +1598,11 @@ function keqPathnameRoute(pathname) {
|
|
|
1596
1598
|
}
|
|
1597
1599
|
|
|
1598
1600
|
// src/router/keq-router.ts
|
|
1599
|
-
var KeqRouter = class {
|
|
1601
|
+
var KeqRouter = class _KeqRouter {
|
|
1600
1602
|
constructor(middlewares = []) {
|
|
1601
1603
|
this.middlewares = middlewares;
|
|
1602
1604
|
}
|
|
1603
|
-
buildMiddleware(route, middlewares) {
|
|
1605
|
+
static buildMiddleware(route, middlewares) {
|
|
1604
1606
|
if (middlewares.length === 0) {
|
|
1605
1607
|
throw new TypeException("At least one middleware is required to build a route middleware");
|
|
1606
1608
|
}
|
|
@@ -1611,42 +1613,72 @@ var KeqRouter = class {
|
|
|
1611
1613
|
};
|
|
1612
1614
|
return middleware;
|
|
1613
1615
|
}
|
|
1614
|
-
route(route, ...
|
|
1615
|
-
const
|
|
1616
|
-
|
|
1617
|
-
this.middlewares.push(middleware);
|
|
1616
|
+
route(route, middleware, ...additionalMiddlewares) {
|
|
1617
|
+
const mid = _KeqRouter.route(route, middleware, ...additionalMiddlewares);
|
|
1618
|
+
this.middlewares.push(mid);
|
|
1618
1619
|
return this;
|
|
1619
1620
|
}
|
|
1620
|
-
host(host, ...
|
|
1621
|
-
const
|
|
1622
|
-
|
|
1623
|
-
this.middlewares.push(middleware);
|
|
1621
|
+
host(host, middleware, ...additionalMiddlewares) {
|
|
1622
|
+
const mid = _KeqRouter.host(host, middleware, ...additionalMiddlewares);
|
|
1623
|
+
this.middlewares.push(mid);
|
|
1624
1624
|
return this;
|
|
1625
1625
|
}
|
|
1626
|
-
method(method, ...
|
|
1627
|
-
const
|
|
1628
|
-
|
|
1629
|
-
this.middlewares.push(middleware);
|
|
1626
|
+
method(method, middleware, ...additionalMiddlewares) {
|
|
1627
|
+
const mid = _KeqRouter.method(method, middleware, ...additionalMiddlewares);
|
|
1628
|
+
this.middlewares.push(mid);
|
|
1630
1629
|
return this;
|
|
1631
1630
|
}
|
|
1632
|
-
pathname(pathname, ...
|
|
1633
|
-
const
|
|
1634
|
-
|
|
1635
|
-
this.middlewares.push(middleware);
|
|
1631
|
+
pathname(pathname, middleware, ...additionalMiddlewares) {
|
|
1632
|
+
const mid = _KeqRouter.pathname(pathname, middleware, ...additionalMiddlewares);
|
|
1633
|
+
this.middlewares.push(mid);
|
|
1636
1634
|
return this;
|
|
1637
1635
|
}
|
|
1638
|
-
location(...
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1641
|
-
this.middlewares.push(middleware);
|
|
1636
|
+
location(middleware, ...additionalMiddlewares) {
|
|
1637
|
+
const mid = _KeqRouter.location(middleware, ...additionalMiddlewares);
|
|
1638
|
+
this.middlewares.push(mid);
|
|
1642
1639
|
return this;
|
|
1643
1640
|
}
|
|
1644
|
-
module(moduleName, ...
|
|
1645
|
-
const
|
|
1646
|
-
|
|
1647
|
-
this.middlewares.push(middleware);
|
|
1641
|
+
module(moduleName, middleware, ...additionalMiddlewares) {
|
|
1642
|
+
const mid = _KeqRouter.module(moduleName, middleware, ...additionalMiddlewares);
|
|
1643
|
+
this.middlewares.push(mid);
|
|
1648
1644
|
return this;
|
|
1649
1645
|
}
|
|
1646
|
+
static route(route, middleware, ...additionalMiddlewares) {
|
|
1647
|
+
const list = Array.isArray(middleware) ? middleware : [middleware, ...additionalMiddlewares];
|
|
1648
|
+
const mid = _KeqRouter.buildMiddleware(route, list);
|
|
1649
|
+
mid.__keqMiddlewareName__ = "route(".concat(route.__keqRouteName__ || route.name, ", ").concat(list.map(getMiddlewareName).join(", "), ")");
|
|
1650
|
+
return mid;
|
|
1651
|
+
}
|
|
1652
|
+
static host(host, middleware, ...additionalMiddlewares) {
|
|
1653
|
+
const list = Array.isArray(middleware) ? middleware : [middleware, ...additionalMiddlewares];
|
|
1654
|
+
const mid = _KeqRouter.buildMiddleware(keqHostRoute(host), list);
|
|
1655
|
+
mid.__keqMiddlewareName__ = "host(".concat(JSON.stringify(host), ", ").concat(list.map(getMiddlewareName).join(", "), ")");
|
|
1656
|
+
return mid;
|
|
1657
|
+
}
|
|
1658
|
+
static method(method, middleware, ...additionalMiddlewares) {
|
|
1659
|
+
const list = Array.isArray(middleware) ? middleware : [middleware, ...additionalMiddlewares];
|
|
1660
|
+
const mid = _KeqRouter.buildMiddleware(keqMethodRoute(method), list);
|
|
1661
|
+
mid.__keqMiddlewareName__ = "method(".concat(JSON.stringify(method), ", ").concat(list.map(getMiddlewareName).join(", "), ")");
|
|
1662
|
+
return mid;
|
|
1663
|
+
}
|
|
1664
|
+
static pathname(pathname, middleware, ...additionalMiddlewares) {
|
|
1665
|
+
const list = Array.isArray(middleware) ? middleware : [middleware, ...additionalMiddlewares];
|
|
1666
|
+
const mid = _KeqRouter.buildMiddleware(keqPathnameRoute(pathname), list);
|
|
1667
|
+
mid.__keqMiddlewareName__ = "pathname(".concat(JSON.stringify(pathname), ", ").concat(list.map(getMiddlewareName).join(", "), ")");
|
|
1668
|
+
return mid;
|
|
1669
|
+
}
|
|
1670
|
+
static location(middleware, ...additionalMiddlewares) {
|
|
1671
|
+
const list = Array.isArray(middleware) ? middleware : [middleware, ...additionalMiddlewares];
|
|
1672
|
+
const mid = _KeqRouter.buildMiddleware(keqLocationRoute(), list);
|
|
1673
|
+
mid.__keqMiddlewareName__ = "location(".concat(list.map(getMiddlewareName).join(", "), ")");
|
|
1674
|
+
return mid;
|
|
1675
|
+
}
|
|
1676
|
+
static module(moduleName, middleware, ...additionalMiddlewares) {
|
|
1677
|
+
const list = Array.isArray(middleware) ? middleware : [middleware, ...additionalMiddlewares];
|
|
1678
|
+
const mid = _KeqRouter.buildMiddleware(keqModuleRoute(moduleName), list);
|
|
1679
|
+
mid.__keqMiddlewareName__ = "module(".concat(JSON.stringify(moduleName), ", ").concat(list.map(getMiddlewareName).join(", "), ")");
|
|
1680
|
+
return mid;
|
|
1681
|
+
}
|
|
1650
1682
|
};
|
|
1651
1683
|
|
|
1652
1684
|
// src/middlewares/timeout-middleware/index.ts
|
|
@@ -1848,6 +1880,14 @@ var KeqRequest = class {
|
|
|
1848
1880
|
useRouter() {
|
|
1849
1881
|
return new KeqRouter(this.preMiddlewares);
|
|
1850
1882
|
}
|
|
1883
|
+
on(event, listener) {
|
|
1884
|
+
const middleware = async (context, next) => {
|
|
1885
|
+
context.emitter.on(event, listener);
|
|
1886
|
+
await next();
|
|
1887
|
+
};
|
|
1888
|
+
this.use(middleware);
|
|
1889
|
+
return this;
|
|
1890
|
+
}
|
|
1851
1891
|
};
|
|
1852
1892
|
var request = new KeqRequest();
|
|
1853
1893
|
|
|
@@ -1891,11 +1931,6 @@ export {
|
|
|
1891
1931
|
composeRoute,
|
|
1892
1932
|
createProxyResponse,
|
|
1893
1933
|
createRequest,
|
|
1894
|
-
keqHostRoute,
|
|
1895
|
-
keqLocationRoute,
|
|
1896
|
-
keqMethodRoute,
|
|
1897
|
-
keqModuleRoute,
|
|
1898
|
-
keqPathnameRoute,
|
|
1899
1934
|
request
|
|
1900
1935
|
};
|
|
1901
1936
|
//# sourceMappingURL=index.mjs.map
|