phecda-server 6.1.0 → 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.
Files changed (80) hide show
  1. package/bin/cli.mjs +160 -157
  2. package/dist/{chunk-3H3T54IC.mjs → chunk-5622RBNB.mjs} +3 -4
  3. package/dist/{chunk-NL6QBQAR.js → chunk-BGXSMOLX.js} +20 -21
  4. package/dist/{chunk-J7B24YSE.mjs → chunk-HMVLXNV3.mjs} +5 -14
  5. package/dist/{chunk-TVT62GIX.js → chunk-J5CFUN4V.js} +8 -1
  6. package/dist/{chunk-JDV2XJYE.js → chunk-MBCHNDAY.js} +27 -36
  7. package/dist/{chunk-2CFYUXPM.mjs → chunk-P75VKZJY.mjs} +101 -137
  8. package/dist/chunk-SW5IKE5H.js +503 -0
  9. package/dist/{chunk-G7TD2VB7.mjs → chunk-WHJ5FALK.mjs} +7 -0
  10. package/dist/{core-P1CsH6jz.d.mts → core-BIcUwV18.d.mts} +1 -1
  11. package/dist/{core-BlN0Spy9.d.ts → core-CYwEPfN4.d.ts} +1 -1
  12. package/dist/helper.d.mts +4 -6
  13. package/dist/helper.d.ts +4 -6
  14. package/dist/helper.js +3 -3
  15. package/dist/helper.mjs +2 -2
  16. package/dist/{server → http}/elysia/index.d.mts +5 -5
  17. package/dist/{server → http}/elysia/index.d.ts +5 -5
  18. package/dist/{server → http}/elysia/index.js +80 -62
  19. package/dist/{server → http}/elysia/index.mjs +50 -32
  20. package/dist/{server → http}/express/index.d.mts +5 -5
  21. package/dist/{server → http}/express/index.d.ts +5 -5
  22. package/dist/{server → http}/express/index.js +71 -55
  23. package/dist/{server → http}/express/index.mjs +42 -26
  24. package/dist/{server → http}/fastify/index.d.mts +5 -5
  25. package/dist/{server → http}/fastify/index.d.ts +5 -5
  26. package/dist/{server → http}/fastify/index.js +72 -72
  27. package/dist/{server → http}/fastify/index.mjs +47 -47
  28. package/dist/{server → http}/h3/index.d.mts +5 -5
  29. package/dist/{server → http}/h3/index.d.ts +5 -5
  30. package/dist/http/h3/index.js +160 -0
  31. package/dist/{server → http}/h3/index.mjs +68 -62
  32. package/dist/{server → http}/hono/index.d.mts +5 -5
  33. package/dist/{server → http}/hono/index.d.ts +5 -5
  34. package/dist/{server → http}/hono/index.js +69 -54
  35. package/dist/{server → http}/hono/index.mjs +41 -26
  36. package/dist/{server → http}/hyper-express/index.d.mts +5 -5
  37. package/dist/{server → http}/hyper-express/index.d.ts +5 -5
  38. package/dist/{server → http}/hyper-express/index.js +69 -56
  39. package/dist/{server → http}/hyper-express/index.mjs +41 -28
  40. package/dist/{server → http}/koa/index.d.mts +5 -5
  41. package/dist/{server → http}/koa/index.d.ts +5 -5
  42. package/dist/{server → http}/koa/index.js +71 -55
  43. package/dist/{server → http}/koa/index.mjs +42 -26
  44. package/dist/index.d.mts +51 -40
  45. package/dist/index.d.ts +51 -40
  46. package/dist/index.js +59 -81
  47. package/dist/index.mjs +39 -61
  48. package/dist/{meta-KtfiBIde.d.ts → meta-BXKLFTgG.d.mts} +2 -3
  49. package/dist/{meta-KtfiBIde.d.mts → meta-BXKLFTgG.d.ts} +2 -3
  50. package/dist/rpc/bullmq/index.d.mts +6 -6
  51. package/dist/rpc/bullmq/index.d.ts +6 -6
  52. package/dist/rpc/bullmq/index.js +24 -24
  53. package/dist/rpc/bullmq/index.mjs +14 -14
  54. package/dist/rpc/kafka/index.d.mts +3 -3
  55. package/dist/rpc/kafka/index.d.ts +3 -3
  56. package/dist/rpc/kafka/index.js +25 -21
  57. package/dist/rpc/kafka/index.mjs +15 -11
  58. package/dist/rpc/nats/index.d.mts +3 -3
  59. package/dist/rpc/nats/index.d.ts +3 -3
  60. package/dist/rpc/nats/index.js +22 -21
  61. package/dist/rpc/nats/index.mjs +13 -12
  62. package/dist/rpc/rabbitmq/index.d.mts +3 -3
  63. package/dist/rpc/rabbitmq/index.d.ts +3 -3
  64. package/dist/rpc/rabbitmq/index.js +23 -22
  65. package/dist/rpc/rabbitmq/index.mjs +12 -11
  66. package/dist/rpc/redis/index.d.mts +3 -3
  67. package/dist/rpc/redis/index.d.ts +3 -3
  68. package/dist/rpc/redis/index.js +24 -20
  69. package/dist/rpc/redis/index.mjs +15 -11
  70. package/dist/test.d.mts +3 -3
  71. package/dist/test.d.ts +3 -3
  72. package/dist/test.js +6 -6
  73. package/dist/test.mjs +2 -2
  74. package/dist/{types-JVT0mgLD.d.ts → types-BtbL49Zs.d.mts} +2 -1
  75. package/dist/{types-DIw7B6Up.d.ts → types-VFzEM7LL.d.ts} +5 -5
  76. package/dist/{types-BvD3B5Ny.d.mts → types-h40T3cRG.d.mts} +5 -5
  77. package/dist/{types-t9D1fU6G.d.mts → types-m3IEDKjP.d.ts} +2 -1
  78. package/package.json +23 -23
  79. package/dist/chunk-DVTBLV6I.js +0 -539
  80. package/dist/server/h3/index.js +0 -154
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-KtfiBIde.js';
2
- export { g as BaseRequestType, f as BaseReturn, a as ControllerMeta, 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-KtfiBIde.js';
3
- import { G as Generator } from './core-BlN0Spy9.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-BlN0Spy9.js';
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-DIw7B6Up.js';
8
- export { C as CookieSerializeOptions, a as HttpOptions } from './types-DIw7B6Up.js';
9
- import { R as RpcContext } from './types-JVT0mgLD.js';
10
- export { b as RpcClientOptions, a as RpcServerOptions } from './types-JVT0mgLD.js';
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> = ((ctx: C) => Promise<boolean> | boolean);
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, GuardType>;
111
- static interceptorRecord: Record<PropertyKey, InterceptorType>;
112
- static pluginRecord: Record<PropertyKey, (framework: string) => any>;
113
- private postInterceptors;
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
- run<ReturnData = any, ReturnErr = any>(opts: DefaultOptions, successCb: (data: any) => ReturnData, failCb: (err: any) => ReturnErr): Promise<ReturnData | ReturnErr>;
116
- private usePipe;
117
- private useFilter;
118
- private useGuard;
119
- private usePostInterceptor;
120
- private useInterceptor;
121
- static usePlugin<Plugin>(plugins: string[], framework: string): Plugin[];
122
- }
123
- declare function addPlugin<T>(key: PropertyKey, handler: (framework: string) => T): void;
124
- declare function addPipe<C extends BaseContext>(key: PropertyKey, handler: PipeType<C>): void;
125
- declare function addFilter<C extends BaseContext>(key: PropertyKey, handler: FilterType<C>): void;
126
- declare function addGuard<C extends BaseContext>(key: PropertyKey, handler: GuardType<C>): void;
127
- declare function addInterceptor<C extends BaseContext>(key: PropertyKey, handler: InterceptorType<C>): void;
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 Plugin(...plugins: string[]): (target: any, property?: PropertyKey) => void;
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
- constructor(tag?: string);
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 PPlugin extends ServerBase {
229
+ declare abstract class PAddon extends ServerBase {
222
230
  readonly key: PropertyKey;
231
+ priority: number;
223
232
  constructor(tag?: string);
224
- abstract use<Plugin = any>(framework: string): Plugin | undefined;
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,10 +244,12 @@ 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
- plugin<Plugin = any>(framework: string): Plugin;
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
 
@@ -247,5 +257,6 @@ type LogLevel = 'error' | 'info' | 'warn' | 'log' | 'debug';
247
257
  declare function setLogger(logger: Record<LogLevel, (msg: string) => void>): void;
248
258
  declare function getLogger(): Record<LogLevel, (msg: string) => void>;
249
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>;
250
261
 
251
- 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, Interceptor, type InterceptorType, InvalidInputException, MetaData, NotFoundException, PExtension, PFilter, PGuard, PInterceptor, PPipe, PPlugin, Param, Patch, PayloadLargeException, Pipe, type PipeArg, type PipeType, Plugin, Post, Put, Query, Queue, RPCGenerator, Route, Rpc, RpcBase, RpcContext, Search, ServerBase, ServiceUnavailableException, TimeoutException, TimerException, UnauthorizedException, UndefinedException, UnsupportedMediaTypeException, ValidateException, WorkerException, addFilter, addGuard, addInterceptor, addPipe, addPlugin, defaultPipe, getLogger, log, setLogger };
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.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5;
2
2
 
3
3
 
4
4
 
@@ -6,6 +6,7 @@
6
6
 
7
7
 
8
8
 
9
+ var _chunkBGXSMOLXjs = require('./chunk-BGXSMOLX.js');
9
10
 
10
11
 
11
12
 
@@ -23,7 +24,6 @@
23
24
 
24
25
 
25
26
 
26
- var _chunkJDV2XJYEjs = require('./chunk-JDV2XJYE.js');
27
27
 
28
28
 
29
29
 
@@ -31,8 +31,8 @@ var _chunkJDV2XJYEjs = require('./chunk-JDV2XJYE.js');
31
31
 
32
32
 
33
33
 
34
+ var _chunkMBCHNDAYjs = require('./chunk-MBCHNDAY.js');
34
35
 
35
- var _chunkNL6QBQARjs = require('./chunk-NL6QBQAR.js');
36
36
 
37
37
 
38
38
 
@@ -56,9 +56,9 @@ var _chunkNL6QBQARjs = require('./chunk-NL6QBQAR.js');
56
56
 
57
57
 
58
58
 
59
+ var _chunkSW5IKE5Hjs = require('./chunk-SW5IKE5H.js');
59
60
 
60
61
 
61
- var _chunkDVTBLV6Ijs = require('./chunk-DVTBLV6I.js');
62
62
 
63
63
 
64
64
 
@@ -70,14 +70,13 @@ var _chunkDVTBLV6Ijs = require('./chunk-DVTBLV6I.js');
70
70
 
71
71
 
72
72
 
73
-
74
- var _chunkTVT62GIXjs = require('./chunk-TVT62GIX.js');
73
+ var _chunkJ5CFUN4Vjs = require('./chunk-J5CFUN4V.js');
75
74
 
76
75
  // src/types.ts
77
76
  var ResponseSymbol = Symbol("response");
78
77
  var CustomResponse = class {
79
78
  static {
80
- _chunkTVT62GIXjs.__name.call(void 0, this, "CustomResponse");
79
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "CustomResponse");
81
80
  }
82
81
 
83
82
  };
@@ -90,35 +89,35 @@ function _ts_decorate(decorators, target, key, desc) {
90
89
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
91
90
  return c > 3 && r && Object.defineProperty(target, key, r), r;
92
91
  }
93
- _chunkTVT62GIXjs.__name.call(void 0, _ts_decorate, "_ts_decorate");
92
+ _chunkJ5CFUN4Vjs.__name.call(void 0, _ts_decorate, "_ts_decorate");
94
93
  function _ts_metadata(k, v) {
95
94
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
96
95
  }
97
- _chunkTVT62GIXjs.__name.call(void 0, _ts_metadata, "_ts_metadata");
96
+ _chunkJ5CFUN4Vjs.__name.call(void 0, _ts_metadata, "_ts_metadata");
98
97
  var ServerBase = (_class = class extends _phecdacore.Base {constructor(...args2) { super(...args2); _class.prototype.__init.call(this); }
99
98
  static {
100
- _chunkTVT62GIXjs.__name.call(void 0, this, "ServerBase");
99
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "ServerBase");
101
100
  }
102
- __init() {this.emitter = exports.emitter = _chunkNL6QBQARjs.emitter}
101
+ __init() {this.emitter = exports.emitter = _chunkBGXSMOLXjs.emitter}
103
102
  }, _class);
104
103
  var HttpBase = class extends ServerBase {
105
104
  static {
106
- _chunkTVT62GIXjs.__name.call(void 0, this, "HttpBase");
105
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "HttpBase");
107
106
  }
108
107
 
109
108
  };
110
109
  _ts_decorate([
111
- _chunkJDV2XJYEjs.Ctx,
110
+ _chunkMBCHNDAYjs.Ctx,
112
111
  _ts_metadata("design:type", typeof HttpContext === "undefined" ? Object : HttpContext)
113
112
  ], HttpBase.prototype, "context", void 0);
114
113
  var RpcBase = class extends ServerBase {
115
114
  static {
116
- _chunkTVT62GIXjs.__name.call(void 0, this, "RpcBase");
115
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "RpcBase");
117
116
  }
118
117
 
119
118
  };
120
119
  _ts_decorate([
121
- _chunkJDV2XJYEjs.Ctx,
120
+ _chunkMBCHNDAYjs.Ctx,
122
121
  _ts_metadata("design:type", typeof RpcContext === "undefined" ? Object : RpcContext)
123
122
  ], RpcBase.prototype, "context", void 0);
124
123
 
@@ -126,125 +125,106 @@ _ts_decorate([
126
125
 
127
126
  var PFilter = class extends ServerBase {
128
127
  static {
129
- _chunkTVT62GIXjs.__name.call(void 0, this, "PFilter");
128
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "PFilter");
130
129
  }
131
130
 
132
131
  constructor(tag) {
133
132
  super();
134
133
  this.key = tag || _phecdacore.getTag.call(void 0, this);
135
- _chunkDVTBLV6Ijs.addFilter.call(void 0, this.key, this.use.bind(this));
134
+ _chunkSW5IKE5Hjs.addFilter.call(void 0, this.key, this.use.bind(this));
136
135
  this.onUnmount(() => {
137
- delete _chunkDVTBLV6Ijs.Context.filterRecord[this.key];
136
+ delete _chunkSW5IKE5Hjs.Context.filterRecord[this.key];
138
137
  });
139
138
  }
140
139
  };
141
140
 
142
141
  // src/modules/guard.ts
143
142
 
144
- var PGuard = class extends ServerBase {
143
+ var PGuard = (_class2 = class extends ServerBase {
145
144
  static {
146
- _chunkTVT62GIXjs.__name.call(void 0, this, "PGuard");
145
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "PGuard");
147
146
  }
148
147
 
148
+ __init2() {this.priority = 0}
149
149
  constructor(tag) {
150
- super();
150
+ super();_class2.prototype.__init2.call(this);;
151
151
  this.key = tag || _phecdacore.getTag.call(void 0, this);
152
- _chunkDVTBLV6Ijs.addGuard.call(void 0, this.key, this.use.bind(this));
152
+ _chunkSW5IKE5Hjs.addGuard.call(void 0, this.key, this.use.bind(this), this.priority);
153
153
  this.onUnmount(() => {
154
- delete _chunkDVTBLV6Ijs.Context.guardRecord[this.key];
154
+ delete _chunkSW5IKE5Hjs.Context.guardRecord[this.key];
155
155
  });
156
156
  }
157
- };
158
-
159
- // src/modules/interceptor.ts
160
-
161
- var PInterceptor = class extends ServerBase {
162
- static {
163
- _chunkTVT62GIXjs.__name.call(void 0, this, "PInterceptor");
164
- }
165
-
166
- constructor(tag) {
167
- super();
168
- this.key = tag || _phecdacore.getTag.call(void 0, this);
169
- this.onUnmount(() => {
170
- delete _chunkDVTBLV6Ijs.Context.interceptorRecord[this.key];
171
- });
172
- _chunkDVTBLV6Ijs.addInterceptor.call(void 0, this.key, this.use.bind(this));
173
- }
174
- };
157
+ }, _class2);
175
158
 
176
159
  // src/modules/pipe.ts
177
160
 
178
161
  var PPipe = class extends ServerBase {
179
162
  static {
180
- _chunkTVT62GIXjs.__name.call(void 0, this, "PPipe");
163
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "PPipe");
181
164
  }
182
165
 
183
166
  constructor(tag) {
184
167
  super();
185
168
  this.key = tag || _phecdacore.getTag.call(void 0, this);
186
- _chunkDVTBLV6Ijs.addPipe.call(void 0, this.key, this.use.bind(this));
169
+ _chunkSW5IKE5Hjs.addPipe.call(void 0, this.key, this.use.bind(this));
187
170
  this.onUnmount(() => {
188
- delete _chunkDVTBLV6Ijs.Context.pipeRecord[this.key];
171
+ delete _chunkSW5IKE5Hjs.Context.pipeRecord[this.key];
189
172
  });
190
173
  }
191
174
  };
192
175
 
193
- // src/modules/plugin.ts
176
+ // src/modules/addon.ts
194
177
 
195
- var PPlugin = class extends ServerBase {
178
+ var PAddon = (_class3 = class extends ServerBase {
196
179
  static {
197
- _chunkTVT62GIXjs.__name.call(void 0, this, "PPlugin");
180
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "PAddon");
198
181
  }
199
182
 
183
+ __init3() {this.priority = 0}
200
184
  constructor(tag) {
201
- super();
185
+ super();_class3.prototype.__init3.call(this);;
202
186
  this.key = tag || _phecdacore.getTag.call(void 0, this);
203
- _chunkDVTBLV6Ijs.addPlugin.call(void 0, this.key, this.use.bind(this));
187
+ _chunkSW5IKE5Hjs.addAddon.call(void 0, this.key, this.use.bind(this), this.priority);
204
188
  this.onUnmount(() => {
205
- delete _chunkDVTBLV6Ijs.Context.pluginRecord[this.key];
189
+ delete _chunkSW5IKE5Hjs.Context.addonRecord[this.key];
206
190
  });
207
191
  }
208
- };
192
+ }, _class3);
209
193
 
210
194
  // src/modules/extension.ts
211
195
 
212
196
  var PExtension = class extends ServerBase {
213
197
  static {
214
- _chunkTVT62GIXjs.__name.call(void 0, this, "PExtension");
198
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "PExtension");
215
199
  }
216
200
 
201
+
202
+
217
203
  constructor(tag) {
218
204
  super();
219
205
  const key = this.key = tag || _phecdacore.getTag.call(void 0, this);
220
206
  if (this.pipe) {
221
- _chunkDVTBLV6Ijs.addPipe.call(void 0, key, this.pipe.bind(this));
207
+ _chunkSW5IKE5Hjs.addPipe.call(void 0, key, this.pipe.bind(this));
222
208
  this.onUnmount(() => {
223
- delete _chunkDVTBLV6Ijs.Context.pipeRecord[key];
209
+ delete _chunkSW5IKE5Hjs.Context.pipeRecord[key];
224
210
  });
225
211
  }
226
- if (this.plugin) {
227
- _chunkDVTBLV6Ijs.addPlugin.call(void 0, key, this.plugin.bind(this));
212
+ if (this.addon) {
213
+ _chunkSW5IKE5Hjs.addAddon.call(void 0, key, this.addon.bind(this), this.addonPriority);
228
214
  this.onUnmount(() => {
229
- delete _chunkDVTBLV6Ijs.Context.pluginRecord[key];
230
- });
231
- }
232
- if (this.intercept) {
233
- _chunkDVTBLV6Ijs.addInterceptor.call(void 0, key, this.intercept.bind(this));
234
- this.onUnmount(() => {
235
- delete _chunkDVTBLV6Ijs.Context.interceptorRecord[key];
215
+ delete _chunkSW5IKE5Hjs.Context.addonRecord[key];
236
216
  });
237
217
  }
238
218
  if (this.guard) {
239
- _chunkDVTBLV6Ijs.addGuard.call(void 0, key, this.guard.bind(this));
219
+ _chunkSW5IKE5Hjs.addGuard.call(void 0, key, this.guard.bind(this), this.guardPriority);
240
220
  this.onUnmount(() => {
241
- delete _chunkDVTBLV6Ijs.Context.guardRecord[key];
221
+ delete _chunkSW5IKE5Hjs.Context.guardRecord[key];
242
222
  });
243
223
  }
244
224
  if (this.filter) {
245
- _chunkDVTBLV6Ijs.addFilter.call(void 0, key, this.filter.bind(this));
225
+ _chunkSW5IKE5Hjs.addFilter.call(void 0, key, this.filter.bind(this));
246
226
  this.onUnmount(() => {
247
- delete _chunkDVTBLV6Ijs.Context.filterRecord[key];
227
+ delete _chunkSW5IKE5Hjs.Context.filterRecord[key];
248
228
  });
249
229
  }
250
230
  }
@@ -254,7 +234,7 @@ var PExtension = class extends ServerBase {
254
234
  var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
255
235
  var Generator = class {
256
236
  static {
257
- _chunkTVT62GIXjs.__name.call(void 0, this, "Generator");
237
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "Generator");
258
238
  }
259
239
 
260
240
  constructor(path) {
@@ -269,12 +249,12 @@ var Generator = class {
269
249
  };
270
250
 
271
251
  // src/generator/rpc.ts
272
- var RPCGenerator = (_class2 = class extends Generator {constructor(...args3) { super(...args3); _class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this); }
252
+ var RPCGenerator = (_class4 = class extends Generator {constructor(...args3) { super(...args3); _class4.prototype.__init4.call(this);_class4.prototype.__init5.call(this); }
273
253
  static {
274
- _chunkTVT62GIXjs.__name.call(void 0, this, "RPCGenerator");
254
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "RPCGenerator");
275
255
  }
276
- __init2() {this.name = "RPC"}
277
- __init3() {this.classMap = {}}
256
+ __init4() {this.name = "RPC"}
257
+ __init5() {this.classMap = {}}
278
258
  getContent() {
279
259
  let content = "";
280
260
  for (const name in this.classMap) {
@@ -302,15 +282,15 @@ var RPCGenerator = (_class2 = class extends Generator {constructor(...args3) { s
302
282
  }
303
283
  return this.getContent();
304
284
  }
305
- }, _class2);
285
+ }, _class4);
306
286
 
307
287
  // src/generator/http.ts
308
- var HTTPGenerator = (_class3 = class extends Generator {constructor(...args4) { super(...args4); _class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this); }
288
+ var HTTPGenerator = (_class5 = class extends Generator {constructor(...args4) { super(...args4); _class5.prototype.__init6.call(this);_class5.prototype.__init7.call(this); }
309
289
  static {
310
- _chunkTVT62GIXjs.__name.call(void 0, this, "HTTPGenerator");
290
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "HTTPGenerator");
311
291
  }
312
- __init4() {this.name = "HTTP"}
313
- __init5() {this.classMap = {}}
292
+ __init6() {this.name = "HTTP"}
293
+ __init7() {this.classMap = {}}
314
294
  getContent() {
315
295
  let content = "";
316
296
  for (const name in this.classMap) {
@@ -343,7 +323,7 @@ return ret
343
323
  }
344
324
  return this.getContent();
345
325
  }
346
- }, _class3);
326
+ }, _class5);
347
327
 
348
328
  // src/index.ts
349
329
 
@@ -424,6 +404,4 @@ return ret
424
404
 
425
405
 
426
406
 
427
-
428
-
429
- exports.Arg = _chunkJDV2XJYEjs.Arg; exports.BadGatewayException = _chunkDVTBLV6Ijs.BadGatewayException; exports.BadRequestException = _chunkDVTBLV6Ijs.BadRequestException; exports.BaseParam = _chunkJDV2XJYEjs.BaseParam; exports.Body = _chunkJDV2XJYEjs.Body; exports.ConflictException = _chunkDVTBLV6Ijs.ConflictException; exports.Context = _chunkDVTBLV6Ijs.Context; exports.Controller = _chunkJDV2XJYEjs.Controller; exports.Ctx = _chunkJDV2XJYEjs.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkJDV2XJYEjs.Define; exports.Delete = _chunkJDV2XJYEjs.Delete; exports.ERROR_SYMBOL = _chunkTVT62GIXjs.ERROR_SYMBOL; exports.Exception = _chunkDVTBLV6Ijs.Exception; exports.Factory = _chunkNL6QBQARjs.Factory; exports.Filter = _chunkJDV2XJYEjs.Filter; exports.ForbiddenException = _chunkDVTBLV6Ijs.ForbiddenException; exports.FrameworkException = _chunkDVTBLV6Ijs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkJDV2XJYEjs.Get; exports.Guard = _chunkJDV2XJYEjs.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkJDV2XJYEjs.Head; exports.Header = _chunkJDV2XJYEjs.Header; exports.HttpBase = HttpBase; exports.IS_HMR = _chunkTVT62GIXjs.IS_HMR; exports.IS_ONLY_GENERATE = _chunkTVT62GIXjs.IS_ONLY_GENERATE; exports.IS_STRICT = _chunkTVT62GIXjs.IS_STRICT; exports.Interceptor = _chunkJDV2XJYEjs.Interceptor; exports.InvalidInputException = _chunkDVTBLV6Ijs.InvalidInputException; exports.LOG_LEVEL = _chunkTVT62GIXjs.LOG_LEVEL; exports.Meta = _chunkNL6QBQARjs.Meta; exports.Mixin = _chunkTVT62GIXjs.Mixin; exports.NotFoundException = _chunkDVTBLV6Ijs.NotFoundException; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PInterceptor = PInterceptor; exports.PPipe = PPipe; exports.PPlugin = PPlugin; exports.PS_EXIT_CODE = _chunkTVT62GIXjs.PS_EXIT_CODE; exports.Param = _chunkJDV2XJYEjs.Param; exports.Patch = _chunkJDV2XJYEjs.Patch; exports.PayloadLargeException = _chunkDVTBLV6Ijs.PayloadLargeException; exports.Pipe = _chunkJDV2XJYEjs.Pipe; exports.Plugin = _chunkJDV2XJYEjs.Plugin; exports.Post = _chunkJDV2XJYEjs.Post; exports.Put = _chunkJDV2XJYEjs.Put; exports.Query = _chunkJDV2XJYEjs.Query; exports.Queue = _chunkJDV2XJYEjs.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkJDV2XJYEjs.Route; exports.Rpc = _chunkJDV2XJYEjs.Rpc; exports.RpcBase = RpcBase; exports.Search = _chunkJDV2XJYEjs.Search; exports.ServerBase = ServerBase; exports.ServerPhecda = _chunkNL6QBQARjs.ServerPhecda; exports.ServiceUnavailableException = _chunkDVTBLV6Ijs.ServiceUnavailableException; exports.TimeoutException = _chunkDVTBLV6Ijs.TimeoutException; exports.TimerException = _chunkDVTBLV6Ijs.TimerException; exports.UnauthorizedException = _chunkDVTBLV6Ijs.UnauthorizedException; exports.UndefinedException = _chunkDVTBLV6Ijs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkDVTBLV6Ijs.UnsupportedMediaTypeException; exports.ValidateException = _chunkDVTBLV6Ijs.ValidateException; exports.WorkerException = _chunkDVTBLV6Ijs.WorkerException; exports.addFilter = _chunkDVTBLV6Ijs.addFilter; exports.addGuard = _chunkDVTBLV6Ijs.addGuard; exports.addInterceptor = _chunkDVTBLV6Ijs.addInterceptor; exports.addPipe = _chunkDVTBLV6Ijs.addPipe; exports.addPlugin = _chunkDVTBLV6Ijs.addPlugin; exports.defaultPipe = _chunkDVTBLV6Ijs.defaultPipe; exports.defaultServerInject = _chunkNL6QBQARjs.defaultServerInject; exports.emitter = _chunkNL6QBQARjs.emitter; exports.getLogger = _chunkTVT62GIXjs.getLogger; exports.log = _chunkTVT62GIXjs.log; exports.phecdaNamespace = _chunkNL6QBQARjs.phecdaNamespace; exports.setLogger = _chunkTVT62GIXjs.setLogger; exports.useS = _chunkNL6QBQARjs.useS;
407
+ exports.Addon = _chunkMBCHNDAYjs.Addon; exports.Arg = _chunkMBCHNDAYjs.Arg; exports.BadGatewayException = _chunkSW5IKE5Hjs.BadGatewayException; exports.BadRequestException = _chunkSW5IKE5Hjs.BadRequestException; exports.BaseParam = _chunkMBCHNDAYjs.BaseParam; exports.Body = _chunkMBCHNDAYjs.Body; exports.ConflictException = _chunkSW5IKE5Hjs.ConflictException; exports.Context = _chunkSW5IKE5Hjs.Context; exports.Controller = _chunkMBCHNDAYjs.Controller; exports.Ctx = _chunkMBCHNDAYjs.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkMBCHNDAYjs.Define; exports.Delete = _chunkMBCHNDAYjs.Delete; exports.ERROR_SYMBOL = _chunkJ5CFUN4Vjs.ERROR_SYMBOL; exports.Exception = _chunkSW5IKE5Hjs.Exception; exports.Factory = _chunkBGXSMOLXjs.Factory; exports.Filter = _chunkMBCHNDAYjs.Filter; exports.ForbiddenException = _chunkSW5IKE5Hjs.ForbiddenException; exports.FrameworkException = _chunkSW5IKE5Hjs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkMBCHNDAYjs.Get; exports.Guard = _chunkMBCHNDAYjs.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkMBCHNDAYjs.Head; exports.Header = _chunkMBCHNDAYjs.Header; exports.HttpBase = HttpBase; exports.IS_HMR = _chunkJ5CFUN4Vjs.IS_HMR; exports.IS_ONLY_GENERATE = _chunkJ5CFUN4Vjs.IS_ONLY_GENERATE; exports.IS_STRICT = _chunkJ5CFUN4Vjs.IS_STRICT; exports.InvalidInputException = _chunkSW5IKE5Hjs.InvalidInputException; exports.LOG_LEVEL = _chunkJ5CFUN4Vjs.LOG_LEVEL; exports.Meta = _chunkBGXSMOLXjs.Meta; exports.Mixin = _chunkJ5CFUN4Vjs.Mixin; exports.NotFoundException = _chunkSW5IKE5Hjs.NotFoundException; exports.PAddon = PAddon; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PPipe = PPipe; exports.PS_EXIT_CODE = _chunkJ5CFUN4Vjs.PS_EXIT_CODE; exports.Param = _chunkMBCHNDAYjs.Param; exports.Patch = _chunkMBCHNDAYjs.Patch; exports.PayloadLargeException = _chunkSW5IKE5Hjs.PayloadLargeException; exports.Pipe = _chunkMBCHNDAYjs.Pipe; exports.Post = _chunkMBCHNDAYjs.Post; exports.Put = _chunkMBCHNDAYjs.Put; exports.Query = _chunkMBCHNDAYjs.Query; exports.Queue = _chunkMBCHNDAYjs.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkMBCHNDAYjs.Route; exports.Rpc = _chunkMBCHNDAYjs.Rpc; exports.RpcBase = RpcBase; exports.Search = _chunkMBCHNDAYjs.Search; exports.ServerBase = ServerBase; exports.ServerPhecda = _chunkBGXSMOLXjs.ServerPhecda; exports.ServiceUnavailableException = _chunkSW5IKE5Hjs.ServiceUnavailableException; exports.TimeoutException = _chunkSW5IKE5Hjs.TimeoutException; exports.TimerException = _chunkSW5IKE5Hjs.TimerException; exports.UnauthorizedException = _chunkSW5IKE5Hjs.UnauthorizedException; exports.UndefinedException = _chunkSW5IKE5Hjs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkSW5IKE5Hjs.UnsupportedMediaTypeException; exports.ValidateException = _chunkSW5IKE5Hjs.ValidateException; exports.WorkerException = _chunkSW5IKE5Hjs.WorkerException; exports.addAddon = _chunkSW5IKE5Hjs.addAddon; exports.addFilter = _chunkSW5IKE5Hjs.addFilter; exports.addGuard = _chunkSW5IKE5Hjs.addGuard; exports.addPipe = _chunkSW5IKE5Hjs.addPipe; exports.defaultPipe = _chunkSW5IKE5Hjs.defaultPipe; exports.defaultServerInject = _chunkBGXSMOLXjs.defaultServerInject; exports.emitter = _chunkBGXSMOLXjs.emitter; exports.getLogger = _chunkJ5CFUN4Vjs.getLogger; exports.log = _chunkJ5CFUN4Vjs.log; exports.phecdaNamespace = _chunkBGXSMOLXjs.phecdaNamespace; exports.runMiddleware = _chunkJ5CFUN4Vjs.runMiddleware; exports.setLogger = _chunkJ5CFUN4Vjs.setLogger; exports.useS = _chunkBGXSMOLXjs.useS;