@wooksjs/event-http 0.5.25 → 0.6.0
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 +422 -255
- package/dist/index.d.ts +22 -3
- package/dist/index.mjs +424 -258
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _wooksjs_event_core from '@wooksjs/event-core';
|
|
2
|
-
import { TEventOptions, TEmpty } from '@wooksjs/event-core';
|
|
2
|
+
import { TEventOptions, TEmpty, TCtxHelpers, TGenericContextStore } from '@wooksjs/event-core';
|
|
3
3
|
export { useEventLogger, useRouteParams } from '@wooksjs/event-core';
|
|
4
4
|
import * as http from 'http';
|
|
5
5
|
import { IncomingMessage, ServerResponse, IncomingHttpHeaders, Server } from 'http';
|
|
@@ -205,6 +205,12 @@ interface TRequestCache {
|
|
|
205
205
|
remoteIp: string;
|
|
206
206
|
forwarded: string[];
|
|
207
207
|
};
|
|
208
|
+
contentEncodings?: string[];
|
|
209
|
+
isCompressed?: boolean;
|
|
210
|
+
maxCompressed?: number;
|
|
211
|
+
maxInflated?: number;
|
|
212
|
+
maxRatio?: number;
|
|
213
|
+
readTimeoutMs?: number;
|
|
208
214
|
}
|
|
209
215
|
interface TSearchParamsCache {
|
|
210
216
|
raw?: string;
|
|
@@ -284,6 +290,12 @@ declare function useSetHeader(name: string): {
|
|
|
284
290
|
};
|
|
285
291
|
type THeaderHook = ReturnType<typeof useSetHeader>;
|
|
286
292
|
|
|
293
|
+
declare const DEFAULT_LIMITS: {
|
|
294
|
+
readonly maxCompressed: number;
|
|
295
|
+
readonly maxInflated: number;
|
|
296
|
+
readonly maxRatio: 100;
|
|
297
|
+
readonly readTimeoutMs: 10000;
|
|
298
|
+
};
|
|
287
299
|
declare function useRequest(): {
|
|
288
300
|
rawRequest: http.IncomingMessage;
|
|
289
301
|
url: string | undefined;
|
|
@@ -298,6 +310,13 @@ declare function useRequest(): {
|
|
|
298
310
|
remoteIp: string;
|
|
299
311
|
forwarded: string[];
|
|
300
312
|
};
|
|
313
|
+
isCompressed: () => boolean;
|
|
314
|
+
getMaxCompressed: () => number;
|
|
315
|
+
setMaxCompressed: (limit: number) => unknown;
|
|
316
|
+
getReadTimeoutMs: () => number;
|
|
317
|
+
setReadTimeoutMs: (limit: number) => unknown;
|
|
318
|
+
getMaxInflated: () => number;
|
|
319
|
+
setMaxInflated: (limit: number) => unknown;
|
|
301
320
|
};
|
|
302
321
|
|
|
303
322
|
interface TUseResponseOptions {
|
|
@@ -382,7 +401,7 @@ declare class HttpErrorRenderer extends BaseHttpResponseRenderer<TWooksErrorBody
|
|
|
382
401
|
}
|
|
383
402
|
|
|
384
403
|
declare function createHttpContext(data: THttpEventData, options: TEventOptions): <T>(cb: (...a: any[]) => T) => T;
|
|
385
|
-
declare function useHttpContext<T extends TEmpty>():
|
|
404
|
+
declare function useHttpContext<T extends TEmpty>(): TCtxHelpers<THttpContextStore & T & TGenericContextStore<THttpEventData>>;
|
|
386
405
|
|
|
387
406
|
declare function createWooksResponder(renderer?: TWooksResponseRenderer<any>, errorRenderer?: TWooksResponseRenderer<any>): {
|
|
388
407
|
createResponse: <T = unknown>(data: T) => BaseHttpResponse<T | TWooksErrorBodyExt> | null;
|
|
@@ -430,4 +449,4 @@ declare class WooksHttp extends WooksAdapterBase {
|
|
|
430
449
|
}
|
|
431
450
|
declare function createHttpApp(opts?: TWooksHttpOptions, wooks?: Wooks | WooksAdapterBase): WooksHttp;
|
|
432
451
|
|
|
433
|
-
export { BaseHttpResponse, BaseHttpResponseRenderer, EHttpStatusCode, HttpError, HttpErrorRenderer, type TAuthCache, type TCacheControl, type TCookieAttributes, type TCookieAttributesInput, type TCookieHook, type THeaderHook, type THttpContextStore, type THttpEvent, type THttpEventData, type TRequestCache, type TSearchParamsCache, type TSetCookieData, type TStatusHook, type TWooksErrorBody, type TWooksErrorBodyExt, type TWooksHttpOptions, type TWooksResponseRenderer, WooksHttp, WooksURLSearchParams, createHttpApp, createHttpContext, createWooksResponder, httpStatusCodes, renderCacheControl, useAccept, useAuthorization, useCookies, useHeaders, useHttpContext, useRequest, useResponse, useSearchParams, useSetCacheControl, useSetCookie, useSetCookies, useSetHeader, useSetHeaders, useStatus };
|
|
452
|
+
export { BaseHttpResponse, BaseHttpResponseRenderer, DEFAULT_LIMITS, EHttpStatusCode, HttpError, HttpErrorRenderer, type TAuthCache, type TCacheControl, type TCookieAttributes, type TCookieAttributesInput, type TCookieHook, type THeaderHook, type THttpContextStore, type THttpEvent, type THttpEventData, type TRequestCache, type TSearchParamsCache, type TSetCookieData, type TStatusHook, type TWooksErrorBody, type TWooksErrorBodyExt, type TWooksHttpOptions, type TWooksResponseRenderer, WooksHttp, WooksURLSearchParams, createHttpApp, createHttpContext, createWooksResponder, httpStatusCodes, renderCacheControl, useAccept, useAuthorization, useCookies, useHeaders, useHttpContext, useRequest, useResponse, useSearchParams, useSetCacheControl, useSetCookie, useSetCookies, useSetHeader, useSetHeaders, useStatus };
|