@moostjs/event-http 0.5.26 → 0.5.28
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 +22 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.mjs +17 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ const moost = __toESM(require("moost"));
|
|
|
26
26
|
const __wooksjs_event_core = __toESM(require("@wooksjs/event-core"));
|
|
27
27
|
const __wooksjs_event_http = __toESM(require("@wooksjs/event-http"));
|
|
28
28
|
const __wooksjs_http_body = __toESM(require("@wooksjs/http-body"));
|
|
29
|
+
const packages_moost_dist = __toESM(require("packages/moost/dist"));
|
|
29
30
|
const __prostojs_infact = __toESM(require("@prostojs/infact"));
|
|
30
31
|
const http = __toESM(require("http"));
|
|
31
32
|
const https = __toESM(require("https"));
|
|
@@ -202,6 +203,21 @@ function SetStatus(...args) {
|
|
|
202
203
|
return (0, moost.Intercept)(setStatusInterceptor(...args));
|
|
203
204
|
}
|
|
204
205
|
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region packages/event-http/src/decorators/limits.decorator.ts
|
|
208
|
+
const globalBodySizeLimit = (n) => (0, packages_moost_dist.defineInterceptorFn)(() => {
|
|
209
|
+
(0, __wooksjs_event_http.useRequest)().setMaxInflated(n);
|
|
210
|
+
}, packages_moost_dist.TInterceptorPriority.BEFORE_ALL);
|
|
211
|
+
const globalCompressedBodySizeLimit = (n) => (0, packages_moost_dist.defineInterceptorFn)(() => {
|
|
212
|
+
(0, __wooksjs_event_http.useRequest)().setMaxCompressed(n);
|
|
213
|
+
}, packages_moost_dist.TInterceptorPriority.BEFORE_ALL);
|
|
214
|
+
const globalBodyReadTimeoutMs = (n) => (0, packages_moost_dist.defineInterceptorFn)(() => {
|
|
215
|
+
(0, __wooksjs_event_http.useRequest)().setReadTimeoutMs(n);
|
|
216
|
+
}, packages_moost_dist.TInterceptorPriority.BEFORE_ALL);
|
|
217
|
+
const BodySizeLimit = (n) => (0, packages_moost_dist.Intercept)(globalBodySizeLimit(n));
|
|
218
|
+
const CompressedBodySizeLimit = (n) => (0, packages_moost_dist.Intercept)(globalCompressedBodySizeLimit(n));
|
|
219
|
+
const BodyReadTimeoutMs = (n) => (0, packages_moost_dist.Intercept)(globalBodyReadTimeoutMs(n));
|
|
220
|
+
|
|
205
221
|
//#endregion
|
|
206
222
|
//#region packages/event-http/src/event-http.ts
|
|
207
223
|
function _define_property(obj, key, value) {
|
|
@@ -306,6 +322,9 @@ var MoostHttp = class {
|
|
|
306
322
|
exports.All = All
|
|
307
323
|
exports.Authorization = Authorization
|
|
308
324
|
exports.Body = Body
|
|
325
|
+
exports.BodyReadTimeoutMs = BodyReadTimeoutMs
|
|
326
|
+
exports.BodySizeLimit = BodySizeLimit
|
|
327
|
+
exports.CompressedBodySizeLimit = CompressedBodySizeLimit
|
|
309
328
|
exports.Cookie = Cookie
|
|
310
329
|
exports.CookieAttrsHook = CookieAttrsHook
|
|
311
330
|
exports.CookieHook = CookieHook
|
|
@@ -337,6 +356,9 @@ exports.SetHeader = SetHeader
|
|
|
337
356
|
exports.SetStatus = SetStatus
|
|
338
357
|
exports.StatusHook = StatusHook
|
|
339
358
|
exports.Url = Url
|
|
359
|
+
exports.globalBodyReadTimeoutMs = globalBodyReadTimeoutMs
|
|
360
|
+
exports.globalBodySizeLimit = globalBodySizeLimit
|
|
361
|
+
exports.globalCompressedBodySizeLimit = globalCompressedBodySizeLimit
|
|
340
362
|
Object.defineProperty(exports, 'useHttpContext', {
|
|
341
363
|
enumerable: true,
|
|
342
364
|
get: function () {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ 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
5
|
import { TInterceptorFn, TMoostAdapter, Moost, TConsoleBase, TMoostAdapterOptions } from 'moost';
|
|
6
|
+
import * as packages_moost_dist from 'packages/moost/dist';
|
|
6
7
|
import * as _prostojs_infact from '@prostojs/infact';
|
|
7
8
|
import * as http from 'http';
|
|
8
9
|
import { TProstoRouterPathBuilder } from '@prostojs/router';
|
|
@@ -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) => packages_moost_dist.TInterceptorFn;
|
|
60
|
+
declare const globalCompressedBodySizeLimit: (n: number) => packages_moost_dist.TInterceptorFn;
|
|
61
|
+
declare const globalBodyReadTimeoutMs: (n: number) => packages_moost_dist.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
|
@@ -2,6 +2,7 @@ import { Intercept, Resolve, TInterceptorPriority, defineInterceptorFn, defineMo
|
|
|
2
2
|
import { attachHook } from "@wooksjs/event-core";
|
|
3
3
|
import { HttpError, WooksHttp, createHttpApp, useAuthorization, useCookies, useHeaders, useHttpContext, useRequest, useResponse, useSearchParams, useSetCookie, useSetCookies, useSetHeader, useStatus } from "@wooksjs/event-http";
|
|
4
4
|
import { useBody } from "@wooksjs/http-body";
|
|
5
|
+
import { Intercept as Intercept$1, TInterceptorPriority as TInterceptorPriority$1, defineInterceptorFn as defineInterceptorFn$1 } from "packages/moost/dist";
|
|
5
6
|
import { createProvideRegistry } from "@prostojs/infact";
|
|
6
7
|
import { Server } from "http";
|
|
7
8
|
import { Server as Server$1 } from "https";
|
|
@@ -178,6 +179,21 @@ function SetStatus(...args) {
|
|
|
178
179
|
return Intercept(setStatusInterceptor(...args));
|
|
179
180
|
}
|
|
180
181
|
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region packages/event-http/src/decorators/limits.decorator.ts
|
|
184
|
+
const globalBodySizeLimit = (n) => defineInterceptorFn$1(() => {
|
|
185
|
+
useRequest().setMaxInflated(n);
|
|
186
|
+
}, TInterceptorPriority$1.BEFORE_ALL);
|
|
187
|
+
const globalCompressedBodySizeLimit = (n) => defineInterceptorFn$1(() => {
|
|
188
|
+
useRequest().setMaxCompressed(n);
|
|
189
|
+
}, TInterceptorPriority$1.BEFORE_ALL);
|
|
190
|
+
const globalBodyReadTimeoutMs = (n) => defineInterceptorFn$1(() => {
|
|
191
|
+
useRequest().setReadTimeoutMs(n);
|
|
192
|
+
}, TInterceptorPriority$1.BEFORE_ALL);
|
|
193
|
+
const BodySizeLimit = (n) => Intercept$1(globalBodySizeLimit(n));
|
|
194
|
+
const CompressedBodySizeLimit = (n) => Intercept$1(globalCompressedBodySizeLimit(n));
|
|
195
|
+
const BodyReadTimeoutMs = (n) => Intercept$1(globalBodyReadTimeoutMs(n));
|
|
196
|
+
|
|
181
197
|
//#endregion
|
|
182
198
|
//#region packages/event-http/src/event-http.ts
|
|
183
199
|
function _define_property(obj, key, value) {
|
|
@@ -279,4 +295,4 @@ var MoostHttp = class {
|
|
|
279
295
|
};
|
|
280
296
|
|
|
281
297
|
//#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 };
|
|
298
|
+
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.28",
|
|
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.28"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"vitest": "^3.0.5"
|