@moostjs/event-http 0.2.7 → 0.2.8
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 +1 -1
- package/dist/index.d.ts +3 -62
- package/dist/index.mjs +1 -1
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { IncomingMessage } from 'http';
|
|
4
4
|
import { ServerResponse } from 'http';
|
|
5
|
+
import { TInterceptorFn } from '@moostjs/moost';
|
|
6
|
+
import { TMoostAdapter } from 'moost';
|
|
7
|
+
import { TMoostAdapterOptions } from 'moost';
|
|
5
8
|
import { TProstoRouterPathBuilder } from '@prostojs/router';
|
|
6
9
|
import { TProvideRegistry } from '@prostojs/infact';
|
|
7
10
|
import { TWooksHttpOptions } from '@wooksjs/event-http';
|
|
@@ -64,20 +67,6 @@ export declare const HeaderHook: (name: string) => ParameterDecorator;
|
|
|
64
67
|
|
|
65
68
|
export declare function HttpMethod(method: '*' | 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS', path?: string): MethodDecorator;
|
|
66
69
|
|
|
67
|
-
declare class InterceptorHandler {
|
|
68
|
-
protected handlers: TInterceptorFn[];
|
|
69
|
-
constructor(handlers: TInterceptorFn[]);
|
|
70
|
-
protected before: TInterceptorBefore[];
|
|
71
|
-
protected after: TInterceptorAfter[];
|
|
72
|
-
protected onError: TInterceptorOnError[];
|
|
73
|
-
response?: unknown;
|
|
74
|
-
responseOverwritten: boolean;
|
|
75
|
-
replyFn(reply: unknown): void;
|
|
76
|
-
init(): Promise<void>;
|
|
77
|
-
fireBefore(response: unknown): Promise<unknown>;
|
|
78
|
-
fireAfter(response: unknown): Promise<unknown>;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
70
|
/**
|
|
82
71
|
* Get Request IP Address
|
|
83
72
|
* @decorator
|
|
@@ -183,59 +172,11 @@ declare const setHeaderInterceptor: (name: string, value: string, opts?: {
|
|
|
183
172
|
*/
|
|
184
173
|
export declare const StatusHook: ParameterDecorator;
|
|
185
174
|
|
|
186
|
-
declare type TAny = any;
|
|
187
|
-
|
|
188
175
|
export declare interface THttpHandlerMeta {
|
|
189
176
|
method: string;
|
|
190
177
|
path: string;
|
|
191
178
|
}
|
|
192
179
|
|
|
193
|
-
declare type TInterceptorAfter = (response: TAny, reply: (response: TAny) => void) => void | Promise<void>;
|
|
194
|
-
|
|
195
|
-
declare type TInterceptorBefore = (reply: (response: TAny) => void) => void | Promise<void>;
|
|
196
|
-
|
|
197
|
-
declare type TInterceptorFn = {
|
|
198
|
-
(before: (fn: TInterceptorBefore) => void, after: (fn: TInterceptorAfter) => void, onError: (fn: TInterceptorOnError) => void): void | Promise<void>;
|
|
199
|
-
priority?: TInterceptorPriority;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
declare type TInterceptorOnError = (error: Error, reply: (response: TAny) => void) => void | Promise<void>;
|
|
203
|
-
|
|
204
|
-
declare enum TInterceptorPriority {
|
|
205
|
-
BEFORE_ALL = 0,
|
|
206
|
-
BEFORE_GUARD = 1,
|
|
207
|
-
GUARD = 2,
|
|
208
|
-
AFTER_GUARD = 3,
|
|
209
|
-
INTERCEPTOR = 4,
|
|
210
|
-
CATCH_ERROR = 5,
|
|
211
|
-
AFTER_ALL = 6
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
declare interface TMoostAdapter<H extends object> {
|
|
215
|
-
bindHandler<T extends TObject = TObject>(options: TMoostAdapterOptions<H, T>): void | Promise<void>;
|
|
216
|
-
onInit?: () => void | Promise<void>;
|
|
217
|
-
getProvideRegistry?: () => TProvideRegistry;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
declare interface TMoostAdapterOptions<H extends object, T extends object> {
|
|
221
|
-
prefix: string;
|
|
222
|
-
fakeInstance: T;
|
|
223
|
-
getInstance: () => Promise<T>;
|
|
224
|
-
silent: boolean;
|
|
225
|
-
method: keyof T;
|
|
226
|
-
handlers: TMoostHandler<H>[];
|
|
227
|
-
getIterceptorHandler: () => Promise<InterceptorHandler>;
|
|
228
|
-
registerEventScope: (scopeId: string) => () => void;
|
|
229
|
-
resolveArgs: () => Promise<unknown[]>;
|
|
230
|
-
logHandler: (eventName: string) => void;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
declare type TMoostHandler<T extends object> = T & {
|
|
234
|
-
type: string;
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
declare type TObject = object;
|
|
238
|
-
|
|
239
180
|
/**
|
|
240
181
|
* Get Requested URL
|
|
241
182
|
* @decorator
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WooksHttp, createHttpApp, useHttpContext, useRequest, useHeaders, HttpError, EHttpStatusCode, WooksURLSearchParams, useStatus, useSetHeader, useSetCookie, useAuthorization, useCookies, useSearchParams, useResponse, useSetCookies } from '@wooksjs/event-http';
|
|
2
2
|
import { getMoostMate as getMoostMate$1, Resolve } from 'moost';
|
|
3
|
-
import '
|
|
3
|
+
import '@wooksjs/event-core';
|
|
4
4
|
|
|
5
5
|
/******************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moostjs/event-http",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "@moostjs/event-http",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -28,8 +28,9 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/moostjs/moostjs/tree/main/packages/event-http#readme",
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"moost": "0.2.
|
|
32
|
-
"wooks": "^0.2.5"
|
|
31
|
+
"moost": "0.2.8",
|
|
32
|
+
"wooks": "^0.2.5",
|
|
33
|
+
"@wooksjs/event-core": "^0.2.5"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@wooksjs/event-http": "^0.2.5"
|