phecda-server 6.0.2 → 7.0.0-alpha.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/bin/cli.mjs +160 -157
- package/dist/{chunk-HDQAT2IM.mjs → chunk-5622RBNB.mjs} +118 -90
- package/dist/chunk-BGXSMOLX.js +265 -0
- package/dist/{chunk-F3W3NN7F.mjs → chunk-HMVLXNV3.mjs} +5 -14
- package/dist/{chunk-GHFSIZUO.js → chunk-J5CFUN4V.js} +18 -3
- package/dist/{chunk-XCND2QW3.js → chunk-MBCHNDAY.js} +27 -36
- package/dist/{chunk-WXFZZZRY.mjs → chunk-P75VKZJY.mjs} +101 -137
- package/dist/chunk-SW5IKE5H.js +503 -0
- package/dist/{chunk-UXD62LGG.mjs → chunk-WHJ5FALK.mjs} +17 -2
- package/dist/core-BIcUwV18.d.mts +47 -0
- package/dist/core-CYwEPfN4.d.ts +47 -0
- package/dist/helper.d.mts +4 -6
- package/dist/helper.d.ts +4 -6
- package/dist/helper.js +3 -3
- package/dist/helper.mjs +2 -2
- package/dist/{server → http}/elysia/index.d.mts +5 -5
- package/dist/{server → http}/elysia/index.d.ts +5 -5
- package/dist/{server → http}/elysia/index.js +80 -62
- package/dist/{server → http}/elysia/index.mjs +50 -32
- package/dist/{server → http}/express/index.d.mts +5 -5
- package/dist/{server → http}/express/index.d.ts +5 -5
- package/dist/{server → http}/express/index.js +71 -55
- package/dist/{server → http}/express/index.mjs +42 -26
- package/dist/{server → http}/fastify/index.d.mts +5 -5
- package/dist/{server → http}/fastify/index.d.ts +5 -5
- package/dist/{server → http}/fastify/index.js +72 -72
- package/dist/{server → http}/fastify/index.mjs +47 -47
- package/dist/{server → http}/h3/index.d.mts +5 -5
- package/dist/{server → http}/h3/index.d.ts +5 -5
- package/dist/http/h3/index.js +160 -0
- package/dist/{server → http}/h3/index.mjs +68 -62
- package/dist/{server → http}/hono/index.d.mts +5 -5
- package/dist/{server → http}/hono/index.d.ts +5 -5
- package/dist/{server → http}/hono/index.js +69 -54
- package/dist/{server → http}/hono/index.mjs +41 -26
- package/dist/{server → http}/hyper-express/index.d.mts +5 -5
- package/dist/{server → http}/hyper-express/index.d.ts +5 -5
- package/dist/{server → http}/hyper-express/index.js +69 -56
- package/dist/{server → http}/hyper-express/index.mjs +41 -28
- package/dist/{server → http}/koa/index.d.mts +5 -5
- package/dist/{server → http}/koa/index.d.ts +5 -5
- package/dist/{server → http}/koa/index.js +71 -55
- package/dist/{server → http}/koa/index.mjs +42 -26
- package/dist/index.d.mts +53 -41
- package/dist/index.d.ts +53 -41
- package/dist/index.js +62 -78
- package/dist/index.mjs +46 -62
- package/dist/{meta-KtfiBIde.d.ts → meta-BXKLFTgG.d.mts} +2 -3
- package/dist/{meta-KtfiBIde.d.mts → meta-BXKLFTgG.d.ts} +2 -3
- package/dist/rpc/bullmq/index.d.mts +6 -6
- package/dist/rpc/bullmq/index.d.ts +6 -6
- package/dist/rpc/bullmq/index.js +24 -24
- package/dist/rpc/bullmq/index.mjs +14 -14
- package/dist/rpc/kafka/index.d.mts +3 -3
- package/dist/rpc/kafka/index.d.ts +3 -3
- package/dist/rpc/kafka/index.js +25 -21
- package/dist/rpc/kafka/index.mjs +15 -11
- package/dist/rpc/nats/index.d.mts +3 -3
- package/dist/rpc/nats/index.d.ts +3 -3
- package/dist/rpc/nats/index.js +22 -21
- package/dist/rpc/nats/index.mjs +13 -12
- package/dist/rpc/rabbitmq/index.d.mts +3 -3
- package/dist/rpc/rabbitmq/index.d.ts +3 -3
- package/dist/rpc/rabbitmq/index.js +23 -22
- package/dist/rpc/rabbitmq/index.mjs +12 -11
- package/dist/rpc/redis/index.d.mts +3 -3
- package/dist/rpc/redis/index.d.ts +3 -3
- package/dist/rpc/redis/index.js +24 -20
- package/dist/rpc/redis/index.mjs +15 -11
- package/dist/test.d.mts +3 -3
- package/dist/test.d.ts +3 -3
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/dist/{types-JVT0mgLD.d.ts → types-BtbL49Zs.d.mts} +2 -1
- package/dist/{types-DIw7B6Up.d.ts → types-VFzEM7LL.d.ts} +5 -5
- package/dist/{types-BvD3B5Ny.d.mts → types-h40T3cRG.d.mts} +5 -5
- package/dist/{types-t9D1fU6G.d.mts → types-m3IEDKjP.d.ts} +2 -1
- package/package.json +24 -24
- package/dist/chunk-7SYPUIBY.js +0 -539
- package/dist/chunk-LYEZ6RGX.js +0 -237
- package/dist/core-2SNw8m2B.d.mts +0 -30
- package/dist/core-BmJJLUqj.d.ts +0 -30
- package/dist/server/h3/index.js +0 -154
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { B as BaseContext, D as DefaultOptions, C as ControllerMetaData, b as MetaData, E as Emitter, c as BaseError } from './meta-
|
|
2
|
-
export { g as BaseRequestType, f as BaseReturn,
|
|
3
|
-
import { G as Generator } from './core-
|
|
4
|
-
export { F as Factory, O as Options,
|
|
1
|
+
import { B as BaseContext, a as ControllerMeta, D as DefaultOptions, C as ControllerMetaData, b as MetaData, E as Emitter, c as BaseError } from './meta-BXKLFTgG.mjs';
|
|
2
|
+
export { g as BaseRequestType, f as BaseReturn, h as CustomResponse, j as ERROR_SYMBOL, i as ExtractResponse, I as IS_HMR, k as IS_ONLY_GENERATE, l as IS_STRICT, L as LOG_LEVEL, M as Meta, O as OmitFunction, m as PS_EXIT_CODE, P as PickFunc, S as ServiceMetaData, e as ToClientFn, d as ToClientInstance, T as ToClientMap } from './meta-BXKLFTgG.mjs';
|
|
3
|
+
import { G as Generator } from './core-BIcUwV18.mjs';
|
|
4
|
+
export { F as Factory, O as Options, S as ServerPhecda, d as defaultServerInject, e as emitter, p as phecdaNamespace, u as useS } from './core-BIcUwV18.mjs';
|
|
5
5
|
import { Base } from 'phecda-core';
|
|
6
6
|
export * from 'phecda-core';
|
|
7
|
-
import { H as HttpContext } from './types-
|
|
8
|
-
export { C as CookieSerializeOptions, a as HttpOptions } from './types-
|
|
9
|
-
import { R as RpcContext } from './types-
|
|
10
|
-
export { b as RpcClientOptions, a as RpcServerOptions } from './types-
|
|
7
|
+
import { H as HttpContext } from './types-h40T3cRG.mjs';
|
|
8
|
+
export { C as CookieSerializeOptions, a as HttpOptions } from './types-h40T3cRG.mjs';
|
|
9
|
+
import { R as RpcContext } from './types-BtbL49Zs.mjs';
|
|
10
|
+
export { b as RpcClientOptions, a as RpcServerOptions } from './types-BtbL49Zs.mjs';
|
|
11
11
|
export { Mixin } from 'ts-mixer';
|
|
12
12
|
import 'node:http';
|
|
13
13
|
|
|
@@ -88,6 +88,11 @@ declare class WorkerException extends Exception {
|
|
|
88
88
|
constructor(message: string);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
interface AOP {
|
|
92
|
+
guards: GuardType[];
|
|
93
|
+
pipe: PipeType[];
|
|
94
|
+
filter: FilterType;
|
|
95
|
+
}
|
|
91
96
|
interface PipeArg {
|
|
92
97
|
arg: any;
|
|
93
98
|
pipe?: string;
|
|
@@ -97,8 +102,7 @@ interface PipeArg {
|
|
|
97
102
|
reflect: any;
|
|
98
103
|
define: Record<string, any>;
|
|
99
104
|
}
|
|
100
|
-
type GuardType<C extends BaseContext = any> = (
|
|
101
|
-
type InterceptorType<C extends BaseContext = any> = (ctx: C) => (any | ((ret: any) => any));
|
|
105
|
+
type GuardType<C extends BaseContext = any> = (ctx: C, next: () => Promise<any>) => any;
|
|
102
106
|
type PipeType<C extends BaseContext = any> = (arg: PipeArg, ctx: C) => Promise<any>;
|
|
103
107
|
type FilterType<C extends BaseContext = any, E extends Exception = any> = (err: E | Error, ctx?: C) => Error | any;
|
|
104
108
|
declare class Context<Data extends BaseContext> {
|
|
@@ -107,24 +111,34 @@ declare class Context<Data extends BaseContext> {
|
|
|
107
111
|
params: string[];
|
|
108
112
|
static filterRecord: Record<PropertyKey, FilterType>;
|
|
109
113
|
static pipeRecord: Record<PropertyKey, PipeType>;
|
|
110
|
-
static guardRecord: Record<PropertyKey,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
static guardRecord: Record<PropertyKey, {
|
|
115
|
+
value: GuardType;
|
|
116
|
+
priority: number;
|
|
117
|
+
}>;
|
|
118
|
+
static addonRecord: Record<PropertyKey, {
|
|
119
|
+
value: (router: any, framework: string) => any;
|
|
120
|
+
priority: number;
|
|
121
|
+
}>;
|
|
114
122
|
constructor(data: Data);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
static getAop(meta: ControllerMeta, opts: DefaultOptions): {
|
|
124
|
+
guards: GuardType<any>[];
|
|
125
|
+
pipe: PipeType<any>[];
|
|
126
|
+
filter: FilterType<any, any>;
|
|
127
|
+
};
|
|
128
|
+
run<ResponseData = any, ReturnErr = any>({ guards, filter, pipe, }: {
|
|
129
|
+
guards: GuardType[];
|
|
130
|
+
filter: FilterType;
|
|
131
|
+
pipe: PipeType[];
|
|
132
|
+
}, successCb: (data: any) => ResponseData, failCb: (err: any) => ReturnErr): Promise<ResponseData | ReturnErr>;
|
|
133
|
+
static getPipe(pipe: string[]): PipeType<any>[];
|
|
134
|
+
static getFilter(filter?: string): FilterType<any, any>;
|
|
135
|
+
static getGuards(guards: string[]): GuardType<any>[];
|
|
136
|
+
static applyAddons(addons: string[], router: any, framework: string): void;
|
|
137
|
+
}
|
|
138
|
+
declare function addPipe<C extends BaseContext>(key: PropertyKey, pipe: PipeType<C>): void;
|
|
139
|
+
declare function addFilter<C extends BaseContext>(key: PropertyKey, filter: FilterType<C>): void;
|
|
140
|
+
declare function addGuard<C extends BaseContext>(key: PropertyKey, guard: GuardType<C>, priority?: number): void;
|
|
141
|
+
declare function addAddon<T>(key: PropertyKey, addon: (router: any, framework: string) => T, priority?: number): void;
|
|
128
142
|
|
|
129
143
|
declare class RPCGenerator extends Generator {
|
|
130
144
|
name: string;
|
|
@@ -154,8 +168,7 @@ declare function Param(key: string): ParameterDecorator;
|
|
|
154
168
|
declare function Arg(target: any, k: string, index: number): void;
|
|
155
169
|
|
|
156
170
|
declare function Guard(...guards: string[]): (target: any, property?: PropertyKey) => void;
|
|
157
|
-
declare function
|
|
158
|
-
declare function Interceptor(...interceptors: string[]): (target: any, property?: PropertyKey) => void;
|
|
171
|
+
declare function Addon(...addons: string[]): (target: any, property?: PropertyKey) => void;
|
|
159
172
|
declare function Filter(filter: string): (target: any, property?: PropertyKey) => void;
|
|
160
173
|
declare function Pipe(pipe?: string): (target: any, property?: any, index?: any) => void;
|
|
161
174
|
|
|
@@ -196,12 +209,7 @@ declare abstract class PFilter<C extends BaseContext = any, E extends Exception
|
|
|
196
209
|
declare abstract class PGuard<C extends BaseContext = any> extends ServerBase {
|
|
197
210
|
abstract use(ctx: C): Promise<boolean> | boolean;
|
|
198
211
|
readonly key: PropertyKey;
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
declare abstract class PInterceptor<C extends BaseContext = any> extends ServerBase {
|
|
203
|
-
abstract use(ctx: C): Function | Promise<Function> | any;
|
|
204
|
-
readonly key: PropertyKey;
|
|
212
|
+
priority: number;
|
|
205
213
|
constructor(tag?: string);
|
|
206
214
|
}
|
|
207
215
|
|
|
@@ -218,14 +226,14 @@ declare abstract class PPipe<C extends BaseContext = any> extends ServerBase {
|
|
|
218
226
|
}, ctx: C): any;
|
|
219
227
|
}
|
|
220
228
|
|
|
221
|
-
declare abstract class
|
|
229
|
+
declare abstract class PAddon extends ServerBase {
|
|
222
230
|
readonly key: PropertyKey;
|
|
231
|
+
priority: number;
|
|
223
232
|
constructor(tag?: string);
|
|
224
|
-
abstract use<
|
|
233
|
+
abstract use<Addon = any>(framework: string): Addon | undefined;
|
|
225
234
|
}
|
|
226
235
|
|
|
227
236
|
interface PExtension<C extends BaseContext = any, E extends Exception = Exception> {
|
|
228
|
-
intercept(ctx: C): Function | Promise<Function> | any;
|
|
229
237
|
guard(ctx: C): Promise<boolean> | boolean;
|
|
230
238
|
pipe(param: {
|
|
231
239
|
arg: any;
|
|
@@ -236,15 +244,19 @@ interface PExtension<C extends BaseContext = any, E extends Exception = Exceptio
|
|
|
236
244
|
reflect: any;
|
|
237
245
|
}, ctx: C): any;
|
|
238
246
|
filter(error: Error | E, ctx?: C): BaseError;
|
|
239
|
-
|
|
247
|
+
addon<Addon = any>(framework: string): Addon;
|
|
240
248
|
}
|
|
241
249
|
declare class PExtension extends ServerBase {
|
|
242
250
|
readonly key: PropertyKey;
|
|
251
|
+
guardPriority: number;
|
|
252
|
+
addonPriority: number;
|
|
243
253
|
constructor(tag?: string);
|
|
244
254
|
}
|
|
245
255
|
|
|
246
|
-
type LogLevel = 'error' | 'info' | 'warn' | 'log';
|
|
256
|
+
type LogLevel = 'error' | 'info' | 'warn' | 'log' | 'debug';
|
|
247
257
|
declare function setLogger(logger: Record<LogLevel, (msg: string) => void>): void;
|
|
258
|
+
declare function getLogger(): Record<LogLevel, (msg: string) => void>;
|
|
248
259
|
declare function log(msg: string, level?: LogLevel): void;
|
|
260
|
+
declare function runMiddleware(ctx: HttpContext, middleware: (req: any, res: any, next?: any) => any): Promise<unknown>;
|
|
249
261
|
|
|
250
|
-
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter, Exception, Filter, type FilterType, ForbiddenException, FrameworkException, Generator, Get, Guard, type GuardType, HTTPGenerator, Head, Header, HttpBase, HttpContext,
|
|
262
|
+
export { type AOP, Addon, Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMeta, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter, Exception, Filter, type FilterType, ForbiddenException, FrameworkException, Generator, Get, Guard, type GuardType, HTTPGenerator, Head, Header, HttpBase, HttpContext, InvalidInputException, MetaData, NotFoundException, PAddon, PExtension, PFilter, PGuard, PPipe, Param, Patch, PayloadLargeException, Pipe, type PipeArg, type PipeType, Post, Put, Query, Queue, RPCGenerator, Route, Rpc, RpcBase, RpcContext, Search, ServerBase, ServiceUnavailableException, TimeoutException, TimerException, UnauthorizedException, UndefinedException, UnsupportedMediaTypeException, ValidateException, WorkerException, addAddon, addFilter, addGuard, addPipe, defaultPipe, getLogger, log, runMiddleware, setLogger };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { B as BaseContext, D as DefaultOptions, C as ControllerMetaData, b as MetaData, E as Emitter, c as BaseError } from './meta-
|
|
2
|
-
export { g as BaseRequestType, f as BaseReturn,
|
|
3
|
-
import { G as Generator } from './core-
|
|
4
|
-
export { F as Factory, O as Options,
|
|
1
|
+
import { B as BaseContext, a as ControllerMeta, D as DefaultOptions, C as ControllerMetaData, b as MetaData, E as Emitter, c as BaseError } from './meta-BXKLFTgG.js';
|
|
2
|
+
export { g as BaseRequestType, f as BaseReturn, h as CustomResponse, j as ERROR_SYMBOL, i as ExtractResponse, I as IS_HMR, k as IS_ONLY_GENERATE, l as IS_STRICT, L as LOG_LEVEL, M as Meta, O as OmitFunction, m as PS_EXIT_CODE, P as PickFunc, S as ServiceMetaData, e as ToClientFn, d as ToClientInstance, T as ToClientMap } from './meta-BXKLFTgG.js';
|
|
3
|
+
import { G as Generator } from './core-CYwEPfN4.js';
|
|
4
|
+
export { F as Factory, O as Options, S as ServerPhecda, d as defaultServerInject, e as emitter, p as phecdaNamespace, u as useS } from './core-CYwEPfN4.js';
|
|
5
5
|
import { Base } from 'phecda-core';
|
|
6
6
|
export * from 'phecda-core';
|
|
7
|
-
import { H as HttpContext } from './types-
|
|
8
|
-
export { C as CookieSerializeOptions, a as HttpOptions } from './types-
|
|
9
|
-
import { R as RpcContext } from './types-
|
|
10
|
-
export { b as RpcClientOptions, a as RpcServerOptions } from './types-
|
|
7
|
+
import { H as HttpContext } from './types-VFzEM7LL.js';
|
|
8
|
+
export { C as CookieSerializeOptions, a as HttpOptions } from './types-VFzEM7LL.js';
|
|
9
|
+
import { R as RpcContext } from './types-m3IEDKjP.js';
|
|
10
|
+
export { b as RpcClientOptions, a as RpcServerOptions } from './types-m3IEDKjP.js';
|
|
11
11
|
export { Mixin } from 'ts-mixer';
|
|
12
12
|
import 'node:http';
|
|
13
13
|
|
|
@@ -88,6 +88,11 @@ declare class WorkerException extends Exception {
|
|
|
88
88
|
constructor(message: string);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
interface AOP {
|
|
92
|
+
guards: GuardType[];
|
|
93
|
+
pipe: PipeType[];
|
|
94
|
+
filter: FilterType;
|
|
95
|
+
}
|
|
91
96
|
interface PipeArg {
|
|
92
97
|
arg: any;
|
|
93
98
|
pipe?: string;
|
|
@@ -97,8 +102,7 @@ interface PipeArg {
|
|
|
97
102
|
reflect: any;
|
|
98
103
|
define: Record<string, any>;
|
|
99
104
|
}
|
|
100
|
-
type GuardType<C extends BaseContext = any> = (
|
|
101
|
-
type InterceptorType<C extends BaseContext = any> = (ctx: C) => (any | ((ret: any) => any));
|
|
105
|
+
type GuardType<C extends BaseContext = any> = (ctx: C, next: () => Promise<any>) => any;
|
|
102
106
|
type PipeType<C extends BaseContext = any> = (arg: PipeArg, ctx: C) => Promise<any>;
|
|
103
107
|
type FilterType<C extends BaseContext = any, E extends Exception = any> = (err: E | Error, ctx?: C) => Error | any;
|
|
104
108
|
declare class Context<Data extends BaseContext> {
|
|
@@ -107,24 +111,34 @@ declare class Context<Data extends BaseContext> {
|
|
|
107
111
|
params: string[];
|
|
108
112
|
static filterRecord: Record<PropertyKey, FilterType>;
|
|
109
113
|
static pipeRecord: Record<PropertyKey, PipeType>;
|
|
110
|
-
static guardRecord: Record<PropertyKey,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
static guardRecord: Record<PropertyKey, {
|
|
115
|
+
value: GuardType;
|
|
116
|
+
priority: number;
|
|
117
|
+
}>;
|
|
118
|
+
static addonRecord: Record<PropertyKey, {
|
|
119
|
+
value: (router: any, framework: string) => any;
|
|
120
|
+
priority: number;
|
|
121
|
+
}>;
|
|
114
122
|
constructor(data: Data);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
static getAop(meta: ControllerMeta, opts: DefaultOptions): {
|
|
124
|
+
guards: GuardType<any>[];
|
|
125
|
+
pipe: PipeType<any>[];
|
|
126
|
+
filter: FilterType<any, any>;
|
|
127
|
+
};
|
|
128
|
+
run<ResponseData = any, ReturnErr = any>({ guards, filter, pipe, }: {
|
|
129
|
+
guards: GuardType[];
|
|
130
|
+
filter: FilterType;
|
|
131
|
+
pipe: PipeType[];
|
|
132
|
+
}, successCb: (data: any) => ResponseData, failCb: (err: any) => ReturnErr): Promise<ResponseData | ReturnErr>;
|
|
133
|
+
static getPipe(pipe: string[]): PipeType<any>[];
|
|
134
|
+
static getFilter(filter?: string): FilterType<any, any>;
|
|
135
|
+
static getGuards(guards: string[]): GuardType<any>[];
|
|
136
|
+
static applyAddons(addons: string[], router: any, framework: string): void;
|
|
137
|
+
}
|
|
138
|
+
declare function addPipe<C extends BaseContext>(key: PropertyKey, pipe: PipeType<C>): void;
|
|
139
|
+
declare function addFilter<C extends BaseContext>(key: PropertyKey, filter: FilterType<C>): void;
|
|
140
|
+
declare function addGuard<C extends BaseContext>(key: PropertyKey, guard: GuardType<C>, priority?: number): void;
|
|
141
|
+
declare function addAddon<T>(key: PropertyKey, addon: (router: any, framework: string) => T, priority?: number): void;
|
|
128
142
|
|
|
129
143
|
declare class RPCGenerator extends Generator {
|
|
130
144
|
name: string;
|
|
@@ -154,8 +168,7 @@ declare function Param(key: string): ParameterDecorator;
|
|
|
154
168
|
declare function Arg(target: any, k: string, index: number): void;
|
|
155
169
|
|
|
156
170
|
declare function Guard(...guards: string[]): (target: any, property?: PropertyKey) => void;
|
|
157
|
-
declare function
|
|
158
|
-
declare function Interceptor(...interceptors: string[]): (target: any, property?: PropertyKey) => void;
|
|
171
|
+
declare function Addon(...addons: string[]): (target: any, property?: PropertyKey) => void;
|
|
159
172
|
declare function Filter(filter: string): (target: any, property?: PropertyKey) => void;
|
|
160
173
|
declare function Pipe(pipe?: string): (target: any, property?: any, index?: any) => void;
|
|
161
174
|
|
|
@@ -196,12 +209,7 @@ declare abstract class PFilter<C extends BaseContext = any, E extends Exception
|
|
|
196
209
|
declare abstract class PGuard<C extends BaseContext = any> extends ServerBase {
|
|
197
210
|
abstract use(ctx: C): Promise<boolean> | boolean;
|
|
198
211
|
readonly key: PropertyKey;
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
declare abstract class PInterceptor<C extends BaseContext = any> extends ServerBase {
|
|
203
|
-
abstract use(ctx: C): Function | Promise<Function> | any;
|
|
204
|
-
readonly key: PropertyKey;
|
|
212
|
+
priority: number;
|
|
205
213
|
constructor(tag?: string);
|
|
206
214
|
}
|
|
207
215
|
|
|
@@ -218,14 +226,14 @@ declare abstract class PPipe<C extends BaseContext = any> extends ServerBase {
|
|
|
218
226
|
}, ctx: C): any;
|
|
219
227
|
}
|
|
220
228
|
|
|
221
|
-
declare abstract class
|
|
229
|
+
declare abstract class PAddon extends ServerBase {
|
|
222
230
|
readonly key: PropertyKey;
|
|
231
|
+
priority: number;
|
|
223
232
|
constructor(tag?: string);
|
|
224
|
-
abstract use<
|
|
233
|
+
abstract use<Addon = any>(framework: string): Addon | undefined;
|
|
225
234
|
}
|
|
226
235
|
|
|
227
236
|
interface PExtension<C extends BaseContext = any, E extends Exception = Exception> {
|
|
228
|
-
intercept(ctx: C): Function | Promise<Function> | any;
|
|
229
237
|
guard(ctx: C): Promise<boolean> | boolean;
|
|
230
238
|
pipe(param: {
|
|
231
239
|
arg: any;
|
|
@@ -236,15 +244,19 @@ interface PExtension<C extends BaseContext = any, E extends Exception = Exceptio
|
|
|
236
244
|
reflect: any;
|
|
237
245
|
}, ctx: C): any;
|
|
238
246
|
filter(error: Error | E, ctx?: C): BaseError;
|
|
239
|
-
|
|
247
|
+
addon<Addon = any>(framework: string): Addon;
|
|
240
248
|
}
|
|
241
249
|
declare class PExtension extends ServerBase {
|
|
242
250
|
readonly key: PropertyKey;
|
|
251
|
+
guardPriority: number;
|
|
252
|
+
addonPriority: number;
|
|
243
253
|
constructor(tag?: string);
|
|
244
254
|
}
|
|
245
255
|
|
|
246
|
-
type LogLevel = 'error' | 'info' | 'warn' | 'log';
|
|
256
|
+
type LogLevel = 'error' | 'info' | 'warn' | 'log' | 'debug';
|
|
247
257
|
declare function setLogger(logger: Record<LogLevel, (msg: string) => void>): void;
|
|
258
|
+
declare function getLogger(): Record<LogLevel, (msg: string) => void>;
|
|
248
259
|
declare function log(msg: string, level?: LogLevel): void;
|
|
260
|
+
declare function runMiddleware(ctx: HttpContext, middleware: (req: any, res: any, next?: any) => any): Promise<unknown>;
|
|
249
261
|
|
|
250
|
-
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter, Exception, Filter, type FilterType, ForbiddenException, FrameworkException, Generator, Get, Guard, type GuardType, HTTPGenerator, Head, Header, HttpBase, HttpContext,
|
|
262
|
+
export { type AOP, Addon, Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMeta, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter, Exception, Filter, type FilterType, ForbiddenException, FrameworkException, Generator, Get, Guard, type GuardType, HTTPGenerator, Head, Header, HttpBase, HttpContext, InvalidInputException, MetaData, NotFoundException, PAddon, PExtension, PFilter, PGuard, PPipe, Param, Patch, PayloadLargeException, Pipe, type PipeArg, type PipeType, Post, Put, Query, Queue, RPCGenerator, Route, Rpc, RpcBase, RpcContext, Search, ServerBase, ServiceUnavailableException, TimeoutException, TimerException, UnauthorizedException, UndefinedException, UnsupportedMediaTypeException, ValidateException, WorkerException, addAddon, addFilter, addGuard, addPipe, defaultPipe, getLogger, log, runMiddleware, setLogger };
|