@moostjs/event-http 0.5.27 → 0.5.29
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/dist/index.cjs +21 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.mjs +16 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -202,6 +202,21 @@ function SetStatus(...args) {
|
|
|
202
202
|
return (0, moost.Intercept)(setStatusInterceptor(...args));
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region packages/event-http/src/decorators/limits.decorator.ts
|
|
207
|
+
const globalBodySizeLimit = (n) => (0, moost.defineInterceptorFn)(() => {
|
|
208
|
+
(0, __wooksjs_event_http.useRequest)().setMaxInflated(n);
|
|
209
|
+
}, moost.TInterceptorPriority.BEFORE_ALL);
|
|
210
|
+
const globalCompressedBodySizeLimit = (n) => (0, moost.defineInterceptorFn)(() => {
|
|
211
|
+
(0, __wooksjs_event_http.useRequest)().setMaxCompressed(n);
|
|
212
|
+
}, moost.TInterceptorPriority.BEFORE_ALL);
|
|
213
|
+
const globalBodyReadTimeoutMs = (n) => (0, moost.defineInterceptorFn)(() => {
|
|
214
|
+
(0, __wooksjs_event_http.useRequest)().setReadTimeoutMs(n);
|
|
215
|
+
}, moost.TInterceptorPriority.BEFORE_ALL);
|
|
216
|
+
const BodySizeLimit = (n) => (0, moost.Intercept)(globalBodySizeLimit(n));
|
|
217
|
+
const CompressedBodySizeLimit = (n) => (0, moost.Intercept)(globalCompressedBodySizeLimit(n));
|
|
218
|
+
const BodyReadTimeoutMs = (n) => (0, moost.Intercept)(globalBodyReadTimeoutMs(n));
|
|
219
|
+
|
|
205
220
|
//#endregion
|
|
206
221
|
//#region packages/event-http/src/event-http.ts
|
|
207
222
|
function _define_property(obj, key, value) {
|
|
@@ -306,6 +321,9 @@ var MoostHttp = class {
|
|
|
306
321
|
exports.All = All
|
|
307
322
|
exports.Authorization = Authorization
|
|
308
323
|
exports.Body = Body
|
|
324
|
+
exports.BodyReadTimeoutMs = BodyReadTimeoutMs
|
|
325
|
+
exports.BodySizeLimit = BodySizeLimit
|
|
326
|
+
exports.CompressedBodySizeLimit = CompressedBodySizeLimit
|
|
309
327
|
exports.Cookie = Cookie
|
|
310
328
|
exports.CookieAttrsHook = CookieAttrsHook
|
|
311
329
|
exports.CookieHook = CookieHook
|
|
@@ -337,6 +355,9 @@ exports.SetHeader = SetHeader
|
|
|
337
355
|
exports.SetStatus = SetStatus
|
|
338
356
|
exports.StatusHook = StatusHook
|
|
339
357
|
exports.Url = Url
|
|
358
|
+
exports.globalBodyReadTimeoutMs = globalBodyReadTimeoutMs
|
|
359
|
+
exports.globalBodySizeLimit = globalBodySizeLimit
|
|
360
|
+
exports.globalCompressedBodySizeLimit = globalCompressedBodySizeLimit
|
|
340
361
|
Object.defineProperty(exports, 'useHttpContext', {
|
|
341
362
|
enumerable: true,
|
|
342
363
|
get: function () {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { THook } from '@wooksjs/event-core';
|
|
3
3
|
import { TCookieAttributes as TCookieAttributes$1, useSetCookies, WooksHttp, TWooksHttpOptions } from '@wooksjs/event-http';
|
|
4
4
|
export { HttpError, TCacheControl, TCookieAttributesInput, TSetCookieData, useHttpContext } from '@wooksjs/event-http';
|
|
5
|
+
import * as moost from 'moost';
|
|
5
6
|
import { TInterceptorFn, TMoostAdapter, Moost, TConsoleBase, TMoostAdapterOptions } from 'moost';
|
|
6
7
|
import * as _prostojs_infact from '@prostojs/infact';
|
|
7
8
|
import * as http from 'http';
|
|
@@ -55,6 +56,13 @@ declare const setStatusInterceptor: (code: number, opts?: {
|
|
|
55
56
|
}) => TInterceptorFn;
|
|
56
57
|
declare function SetStatus(...args: Parameters<typeof setStatusInterceptor>): ClassDecorator & MethodDecorator;
|
|
57
58
|
|
|
59
|
+
declare const globalBodySizeLimit: (n: number) => moost.TInterceptorFn;
|
|
60
|
+
declare const globalCompressedBodySizeLimit: (n: number) => moost.TInterceptorFn;
|
|
61
|
+
declare const globalBodyReadTimeoutMs: (n: number) => moost.TInterceptorFn;
|
|
62
|
+
declare const BodySizeLimit: (n: number) => ClassDecorator & MethodDecorator;
|
|
63
|
+
declare const CompressedBodySizeLimit: (n: number) => ClassDecorator & MethodDecorator;
|
|
64
|
+
declare const BodyReadTimeoutMs: (n: number) => ClassDecorator & MethodDecorator;
|
|
65
|
+
|
|
58
66
|
interface THttpHandlerMeta {
|
|
59
67
|
method: string;
|
|
60
68
|
path: string;
|
|
@@ -89,4 +97,4 @@ declare class MoostHttp implements TMoostAdapter<THttpHandlerMeta> {
|
|
|
89
97
|
bindHandler<T extends object = object>(opts: TMoostAdapterOptions<THttpHandlerMeta, T>): void;
|
|
90
98
|
}
|
|
91
99
|
|
|
92
|
-
export { All, Authorization, Body, Cookie, CookieAttrsHook, CookieHook, Delete, Get, Header, HeaderHook, HttpMethod, Ip, IpList, Method, MoostHttp, Patch, Post, Put, Query, RawBody, Req, ReqId, Res, SetCookie, SetHeader, SetStatus, StatusHook, type TCookieAttributes, type TCookieHook, type THeaderHook, type THttpHandlerMeta, type TStatusHook, Url };
|
|
100
|
+
export { All, Authorization, Body, BodyReadTimeoutMs, BodySizeLimit, CompressedBodySizeLimit, Cookie, CookieAttrsHook, CookieHook, Delete, Get, Header, HeaderHook, HttpMethod, Ip, IpList, Method, MoostHttp, Patch, Post, Put, Query, RawBody, Req, ReqId, Res, SetCookie, SetHeader, SetStatus, StatusHook, type TCookieAttributes, type TCookieHook, type THeaderHook, type THttpHandlerMeta, type TStatusHook, Url, globalBodyReadTimeoutMs, globalBodySizeLimit, globalCompressedBodySizeLimit };
|
package/dist/index.mjs
CHANGED
|
@@ -178,6 +178,21 @@ function SetStatus(...args) {
|
|
|
178
178
|
return Intercept(setStatusInterceptor(...args));
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region packages/event-http/src/decorators/limits.decorator.ts
|
|
183
|
+
const globalBodySizeLimit = (n) => defineInterceptorFn(() => {
|
|
184
|
+
useRequest().setMaxInflated(n);
|
|
185
|
+
}, TInterceptorPriority.BEFORE_ALL);
|
|
186
|
+
const globalCompressedBodySizeLimit = (n) => defineInterceptorFn(() => {
|
|
187
|
+
useRequest().setMaxCompressed(n);
|
|
188
|
+
}, TInterceptorPriority.BEFORE_ALL);
|
|
189
|
+
const globalBodyReadTimeoutMs = (n) => defineInterceptorFn(() => {
|
|
190
|
+
useRequest().setReadTimeoutMs(n);
|
|
191
|
+
}, TInterceptorPriority.BEFORE_ALL);
|
|
192
|
+
const BodySizeLimit = (n) => Intercept(globalBodySizeLimit(n));
|
|
193
|
+
const CompressedBodySizeLimit = (n) => Intercept(globalCompressedBodySizeLimit(n));
|
|
194
|
+
const BodyReadTimeoutMs = (n) => Intercept(globalBodyReadTimeoutMs(n));
|
|
195
|
+
|
|
181
196
|
//#endregion
|
|
182
197
|
//#region packages/event-http/src/event-http.ts
|
|
183
198
|
function _define_property(obj, key, value) {
|
|
@@ -279,4 +294,4 @@ var MoostHttp = class {
|
|
|
279
294
|
};
|
|
280
295
|
|
|
281
296
|
//#endregion
|
|
282
|
-
export { All, Authorization, Body, Cookie, CookieAttrsHook, CookieHook, Delete, Get, Header, HeaderHook, HttpError, HttpMethod, Ip, IpList, Method, MoostHttp, Patch, Post, Put, Query, RawBody, Req, ReqId, Res, SetCookie, SetHeader, SetStatus, StatusHook, Url, useHttpContext };
|
|
297
|
+
export { All, Authorization, Body, BodyReadTimeoutMs, BodySizeLimit, CompressedBodySizeLimit, Cookie, CookieAttrsHook, CookieHook, Delete, Get, Header, HeaderHook, HttpError, HttpMethod, Ip, IpList, Method, MoostHttp, Patch, Post, Put, Query, RawBody, Req, ReqId, Res, SetCookie, SetHeader, SetStatus, StatusHook, Url, globalBodyReadTimeoutMs, globalBodySizeLimit, globalCompressedBodySizeLimit, useHttpContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moostjs/event-http",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.29",
|
|
4
4
|
"description": "@moostjs/event-http",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@prostojs/infact": "^0.3.3",
|
|
42
42
|
"@prostojs/router": "^0.2.1",
|
|
43
|
-
"@wooksjs/event-core": "^0.
|
|
44
|
-
"@wooksjs/event-http": "^0.
|
|
45
|
-
"@wooksjs/http-body": "^0.
|
|
46
|
-
"moost": "^0.5.
|
|
43
|
+
"@wooksjs/event-core": "^0.6.0",
|
|
44
|
+
"@wooksjs/event-http": "^0.6.0",
|
|
45
|
+
"@wooksjs/http-body": "^0.6.0",
|
|
46
|
+
"moost": "^0.5.29"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"vitest": "^3.0.5"
|