phecda-server 5.3.0 → 5.3.2

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 (41) hide show
  1. package/dist/{chunk-AUAAKHWS.js → chunk-2HVTWYS2.js} +38 -43
  2. package/dist/{chunk-BZKJ5NBU.mjs → chunk-3IPYLGY2.mjs} +1 -1
  3. package/dist/{chunk-RVWBJ6LV.js → chunk-GHFSIZUO.js} +2 -10
  4. package/dist/{chunk-LHLQIQPH.mjs → chunk-NT6HEBC6.mjs} +1 -1
  5. package/dist/{chunk-QYX5Q7KO.js → chunk-RZ7IXJYQ.js} +60 -60
  6. package/dist/{chunk-5E2AVYP2.mjs → chunk-SXOZVIKW.mjs} +3 -8
  7. package/dist/{chunk-N4ULJDEQ.js → chunk-UIKQNJN3.js} +19 -19
  8. package/dist/{chunk-MESZCLSS.mjs → chunk-UXD62LGG.mjs} +2 -10
  9. package/dist/helper.js +3 -3
  10. package/dist/helper.mjs +2 -2
  11. package/dist/index.d.mts +3 -4
  12. package/dist/index.d.ts +3 -4
  13. package/dist/index.js +43 -48
  14. package/dist/index.mjs +7 -12
  15. package/dist/rpc/bullmq/index.js +12 -12
  16. package/dist/rpc/bullmq/index.mjs +2 -2
  17. package/dist/rpc/kafka/index.js +12 -12
  18. package/dist/rpc/kafka/index.mjs +2 -2
  19. package/dist/rpc/nats/index.js +11 -11
  20. package/dist/rpc/nats/index.mjs +2 -2
  21. package/dist/rpc/rabbitmq/index.js +13 -13
  22. package/dist/rpc/rabbitmq/index.mjs +2 -2
  23. package/dist/rpc/redis/index.js +11 -11
  24. package/dist/rpc/redis/index.mjs +2 -2
  25. package/dist/server/elysia/index.js +32 -32
  26. package/dist/server/elysia/index.mjs +3 -3
  27. package/dist/server/express/index.js +30 -30
  28. package/dist/server/express/index.mjs +2 -2
  29. package/dist/server/fastify/index.js +31 -31
  30. package/dist/server/fastify/index.mjs +3 -3
  31. package/dist/server/h3/index.js +30 -30
  32. package/dist/server/h3/index.mjs +2 -2
  33. package/dist/server/hono/index.js +29 -29
  34. package/dist/server/hono/index.mjs +2 -2
  35. package/dist/server/hyper-express/index.js +29 -29
  36. package/dist/server/hyper-express/index.mjs +2 -2
  37. package/dist/server/koa/index.js +30 -30
  38. package/dist/server/koa/index.mjs +2 -2
  39. package/dist/test.js +6 -6
  40. package/dist/test.mjs +2 -2
  41. package/package.json +3 -2
package/dist/index.d.ts CHANGED
@@ -2,12 +2,13 @@ import { B as BaseContext, D as DefaultOptions, C as ControllerMetaData, M as Me
2
2
  export { e as BaseRequestType, d as BaseReturn, i as ControllerMeta, f as CustomResponse, j as ERROR_SYMBOL, g as ExtractResponse, I as IS_HMR, k as IS_ONLY_GENERATE, l as IS_STRICT, L as LOG_LEVEL, h as Meta, O as OmitFunction, m as PS_EXIT_CODE, P as PickFunc, S as ServiceMetaData, c as ToClientFn, b as ToClientInstance, T as ToClientMap } from './types-BlIBlnVT.js';
3
3
  import { G as Generator } from './core-dx9E5x2N.js';
4
4
  export { F as Factory, O as Options, c as createPhecda, e as emitter } from './core-dx9E5x2N.js';
5
- import { Base, Construct, AbConstruct } from 'phecda-core';
5
+ import { Base } from 'phecda-core';
6
6
  export * from 'phecda-core';
7
7
  import { H as HttpContext } from './types-BCJhmpQh.js';
8
8
  export { C as CookieSerializeOptions, a as HttpOptions } from './types-BCJhmpQh.js';
9
9
  import { R as RpcContext } from './types-B-ZFZajI.js';
10
10
  export { b as RpcClientOptions, a as RpcServerOptions } from './types-B-ZFZajI.js';
11
+ export { Mixin } from 'ts-mixer';
11
12
  import 'node:http';
12
13
 
13
14
  declare class Exception extends Error {
@@ -171,7 +172,6 @@ declare function Event(isEvent?: boolean): (target: any, k?: PropertyKey) => voi
171
172
  declare function Queue(queue?: string): (target: any, k?: PropertyKey) => void;
172
173
  declare function Rpc(): ClassDecorator;
173
174
 
174
- declare function Injectable(): (target: any) => void;
175
175
  declare const Ctx: PropertyDecorator;
176
176
  declare function Define(key: string, value: any): any;
177
177
 
@@ -246,6 +246,5 @@ declare class PExtension extends ServerBase {
246
246
  type LogLevel = 'error' | 'info' | 'warn' | 'log';
247
247
  declare function setLogger(logger: Record<LogLevel, (msg: string) => void>): void;
248
248
  declare function log(msg: string, level?: LogLevel): void;
249
- declare function Mix<C1 extends Construct | AbConstruct, C2 extends Construct>(InternalClass: C1, ExtendClass: C2): new (...args: ConstructorParameters<C2>) => InstanceType<C1> & InstanceType<C2>;
250
249
 
251
- export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter, Event, Exception, Filter, type FilterType, ForbiddenException, FrameworkException, Generator, Get, Guard, type GuardType, HTTPGenerator, Head, Header, HttpBase, HttpContext, Injectable, Interceptor, type InterceptorType, InvalidInputException, MetaData, Mix, 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, ServerBase, ServiceUnavailableException, TimeoutException, TimerException, UnauthorizedException, UndefinedException, UnsupportedMediaTypeException, ValidateException, WorkerException, addFilter, addGuard, addInterceptor, addPipe, addPlugin, defaultPipe, log, setLogger };
250
+ export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter, Event, 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, ServerBase, ServiceUnavailableException, TimeoutException, TimerException, UnauthorizedException, UndefinedException, UnsupportedMediaTypeException, ValidateException, WorkerException, addFilter, addGuard, addInterceptor, addPipe, addPlugin, defaultPipe, log, setLogger };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkN4ULJDEQjs = require('./chunk-N4ULJDEQ.js');
6
+ var _chunkUIKQNJN3js = require('./chunk-UIKQNJN3.js');
7
7
 
8
8
 
9
9
 
@@ -29,8 +29,8 @@ var _chunkN4ULJDEQjs = require('./chunk-N4ULJDEQ.js');
29
29
 
30
30
 
31
31
 
32
+ var _chunk2HVTWYS2js = require('./chunk-2HVTWYS2.js');
32
33
 
33
- var _chunkAUAAKHWSjs = require('./chunk-AUAAKHWS.js');
34
34
 
35
35
 
36
36
 
@@ -55,8 +55,8 @@ var _chunkAUAAKHWSjs = require('./chunk-AUAAKHWS.js');
55
55
 
56
56
 
57
57
 
58
+ var _chunkRZ7IXJYQjs = require('./chunk-RZ7IXJYQ.js');
58
59
 
59
- var _chunkQYX5Q7KOjs = require('./chunk-QYX5Q7KO.js');
60
60
 
61
61
 
62
62
 
@@ -67,14 +67,13 @@ var _chunkQYX5Q7KOjs = require('./chunk-QYX5Q7KO.js');
67
67
 
68
68
 
69
69
 
70
-
71
- var _chunkRVWBJ6LVjs = require('./chunk-RVWBJ6LV.js');
70
+ var _chunkGHFSIZUOjs = require('./chunk-GHFSIZUO.js');
72
71
 
73
72
  // src/types.ts
74
73
  var ResponseSymbol = Symbol("response");
75
74
  var CustomResponse = class {
76
75
  static {
77
- _chunkRVWBJ6LVjs.__name.call(void 0, this, "CustomResponse");
76
+ _chunkGHFSIZUOjs.__name.call(void 0, this, "CustomResponse");
78
77
  }
79
78
 
80
79
  };
@@ -87,38 +86,35 @@ function _ts_decorate(decorators, target, key, desc) {
87
86
  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;
88
87
  return c > 3 && r && Object.defineProperty(target, key, r), r;
89
88
  }
90
- _chunkRVWBJ6LVjs.__name.call(void 0, _ts_decorate, "_ts_decorate");
89
+ _chunkGHFSIZUOjs.__name.call(void 0, _ts_decorate, "_ts_decorate");
91
90
  function _ts_metadata(k, v) {
92
91
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
93
92
  }
94
- _chunkRVWBJ6LVjs.__name.call(void 0, _ts_metadata, "_ts_metadata");
93
+ _chunkGHFSIZUOjs.__name.call(void 0, _ts_metadata, "_ts_metadata");
95
94
  var ServerBase = (_class = class extends _phecdacore.Base {constructor(...args2) { super(...args2); _class.prototype.__init.call(this); }
96
95
  static {
97
- _chunkRVWBJ6LVjs.__name.call(void 0, this, "ServerBase");
96
+ _chunkGHFSIZUOjs.__name.call(void 0, this, "ServerBase");
98
97
  }
99
- __init() {this.emitter = exports.emitter = _chunkN4ULJDEQjs.emitter}
98
+ __init() {this.emitter = exports.emitter = _chunkUIKQNJN3js.emitter}
100
99
  }, _class);
101
- ServerBase = exports.ServerBase = _ts_decorate([
102
- _phecdacore.Empty
103
- ], ServerBase);
104
100
  var HttpBase = class extends ServerBase {
105
101
  static {
106
- _chunkRVWBJ6LVjs.__name.call(void 0, this, "HttpBase");
102
+ _chunkGHFSIZUOjs.__name.call(void 0, this, "HttpBase");
107
103
  }
108
104
 
109
105
  };
110
106
  _ts_decorate([
111
- _chunkAUAAKHWSjs.Ctx,
107
+ _chunk2HVTWYS2js.Ctx,
112
108
  _ts_metadata("design:type", typeof HttpContext === "undefined" ? Object : HttpContext)
113
109
  ], HttpBase.prototype, "context", void 0);
114
110
  var RpcBase = class extends ServerBase {
115
111
  static {
116
- _chunkRVWBJ6LVjs.__name.call(void 0, this, "RpcBase");
112
+ _chunkGHFSIZUOjs.__name.call(void 0, this, "RpcBase");
117
113
  }
118
114
 
119
115
  };
120
116
  _ts_decorate([
121
- _chunkAUAAKHWSjs.Ctx,
117
+ _chunk2HVTWYS2js.Ctx,
122
118
  _ts_metadata("design:type", typeof RpcContext === "undefined" ? Object : RpcContext)
123
119
  ], RpcBase.prototype, "context", void 0);
124
120
 
@@ -126,15 +122,15 @@ _ts_decorate([
126
122
 
127
123
  var PFilter = class extends ServerBase {
128
124
  static {
129
- _chunkRVWBJ6LVjs.__name.call(void 0, this, "PFilter");
125
+ _chunkGHFSIZUOjs.__name.call(void 0, this, "PFilter");
130
126
  }
131
127
 
132
128
  constructor(tag) {
133
129
  super();
134
130
  this.key = tag || _phecdacore.getTag.call(void 0, this);
135
- _chunkQYX5Q7KOjs.addFilter.call(void 0, this.key, this.use.bind(this));
131
+ _chunkRZ7IXJYQjs.addFilter.call(void 0, this.key, this.use.bind(this));
136
132
  this.onUnmount(() => {
137
- delete _chunkQYX5Q7KOjs.Context.filterRecord[this.key];
133
+ delete _chunkRZ7IXJYQjs.Context.filterRecord[this.key];
138
134
  });
139
135
  }
140
136
  };
@@ -143,15 +139,15 @@ var PFilter = class extends ServerBase {
143
139
 
144
140
  var PGuard = class extends ServerBase {
145
141
  static {
146
- _chunkRVWBJ6LVjs.__name.call(void 0, this, "PGuard");
142
+ _chunkGHFSIZUOjs.__name.call(void 0, this, "PGuard");
147
143
  }
148
144
 
149
145
  constructor(tag) {
150
146
  super();
151
147
  this.key = tag || _phecdacore.getTag.call(void 0, this);
152
- _chunkQYX5Q7KOjs.addGuard.call(void 0, this.key, this.use.bind(this));
148
+ _chunkRZ7IXJYQjs.addGuard.call(void 0, this.key, this.use.bind(this));
153
149
  this.onUnmount(() => {
154
- delete _chunkQYX5Q7KOjs.Context.guardRecord[this.key];
150
+ delete _chunkRZ7IXJYQjs.Context.guardRecord[this.key];
155
151
  });
156
152
  }
157
153
  };
@@ -160,16 +156,16 @@ var PGuard = class extends ServerBase {
160
156
 
161
157
  var PInterceptor = class extends ServerBase {
162
158
  static {
163
- _chunkRVWBJ6LVjs.__name.call(void 0, this, "PInterceptor");
159
+ _chunkGHFSIZUOjs.__name.call(void 0, this, "PInterceptor");
164
160
  }
165
161
 
166
162
  constructor(tag) {
167
163
  super();
168
164
  this.key = tag || _phecdacore.getTag.call(void 0, this);
169
165
  this.onUnmount(() => {
170
- delete _chunkQYX5Q7KOjs.Context.interceptorRecord[this.key];
166
+ delete _chunkRZ7IXJYQjs.Context.interceptorRecord[this.key];
171
167
  });
172
- _chunkQYX5Q7KOjs.addInterceptor.call(void 0, this.key, this.use.bind(this));
168
+ _chunkRZ7IXJYQjs.addInterceptor.call(void 0, this.key, this.use.bind(this));
173
169
  }
174
170
  };
175
171
 
@@ -177,15 +173,15 @@ var PInterceptor = class extends ServerBase {
177
173
 
178
174
  var PPipe = class extends ServerBase {
179
175
  static {
180
- _chunkRVWBJ6LVjs.__name.call(void 0, this, "PPipe");
176
+ _chunkGHFSIZUOjs.__name.call(void 0, this, "PPipe");
181
177
  }
182
178
 
183
179
  constructor(tag) {
184
180
  super();
185
181
  this.key = tag || _phecdacore.getTag.call(void 0, this);
186
- _chunkQYX5Q7KOjs.addPipe.call(void 0, this.key, this.use.bind(this));
182
+ _chunkRZ7IXJYQjs.addPipe.call(void 0, this.key, this.use.bind(this));
187
183
  this.onUnmount(() => {
188
- delete _chunkQYX5Q7KOjs.Context.pipeRecord[this.key];
184
+ delete _chunkRZ7IXJYQjs.Context.pipeRecord[this.key];
189
185
  });
190
186
  }
191
187
  };
@@ -194,15 +190,15 @@ var PPipe = class extends ServerBase {
194
190
 
195
191
  var PPlugin = class extends ServerBase {
196
192
  static {
197
- _chunkRVWBJ6LVjs.__name.call(void 0, this, "PPlugin");
193
+ _chunkGHFSIZUOjs.__name.call(void 0, this, "PPlugin");
198
194
  }
199
195
 
200
196
  constructor(tag) {
201
197
  super();
202
198
  this.key = tag || _phecdacore.getTag.call(void 0, this);
203
- _chunkQYX5Q7KOjs.addPlugin.call(void 0, this.key, this.use.bind(this));
199
+ _chunkRZ7IXJYQjs.addPlugin.call(void 0, this.key, this.use.bind(this));
204
200
  this.onUnmount(() => {
205
- delete _chunkQYX5Q7KOjs.Context.pluginRecord[this.key];
201
+ delete _chunkRZ7IXJYQjs.Context.pluginRecord[this.key];
206
202
  });
207
203
  }
208
204
  };
@@ -211,40 +207,40 @@ var PPlugin = class extends ServerBase {
211
207
 
212
208
  var PExtension = class extends ServerBase {
213
209
  static {
214
- _chunkRVWBJ6LVjs.__name.call(void 0, this, "PExtension");
210
+ _chunkGHFSIZUOjs.__name.call(void 0, this, "PExtension");
215
211
  }
216
212
 
217
213
  constructor(tag) {
218
214
  super();
219
215
  const key = this.key = tag || _phecdacore.getTag.call(void 0, this);
220
216
  if (this.pipe) {
221
- _chunkQYX5Q7KOjs.addPipe.call(void 0, key, this.pipe.bind(this));
217
+ _chunkRZ7IXJYQjs.addPipe.call(void 0, key, this.pipe.bind(this));
222
218
  this.onUnmount(() => {
223
- delete _chunkQYX5Q7KOjs.Context.pipeRecord[key];
219
+ delete _chunkRZ7IXJYQjs.Context.pipeRecord[key];
224
220
  });
225
221
  }
226
222
  if (this.plugin) {
227
- _chunkQYX5Q7KOjs.addPlugin.call(void 0, key, this.plugin.bind(this));
223
+ _chunkRZ7IXJYQjs.addPlugin.call(void 0, key, this.plugin.bind(this));
228
224
  this.onUnmount(() => {
229
- delete _chunkQYX5Q7KOjs.Context.pluginRecord[key];
225
+ delete _chunkRZ7IXJYQjs.Context.pluginRecord[key];
230
226
  });
231
227
  }
232
228
  if (this.intercept) {
233
- _chunkQYX5Q7KOjs.addInterceptor.call(void 0, key, this.intercept.bind(this));
229
+ _chunkRZ7IXJYQjs.addInterceptor.call(void 0, key, this.intercept.bind(this));
234
230
  this.onUnmount(() => {
235
- delete _chunkQYX5Q7KOjs.Context.interceptorRecord[key];
231
+ delete _chunkRZ7IXJYQjs.Context.interceptorRecord[key];
236
232
  });
237
233
  }
238
234
  if (this.guard) {
239
- _chunkQYX5Q7KOjs.addGuard.call(void 0, key, this.guard.bind(this));
235
+ _chunkRZ7IXJYQjs.addGuard.call(void 0, key, this.guard.bind(this));
240
236
  this.onUnmount(() => {
241
- delete _chunkQYX5Q7KOjs.Context.guardRecord[key];
237
+ delete _chunkRZ7IXJYQjs.Context.guardRecord[key];
242
238
  });
243
239
  }
244
240
  if (this.filter) {
245
- _chunkQYX5Q7KOjs.addFilter.call(void 0, key, this.filter.bind(this));
241
+ _chunkRZ7IXJYQjs.addFilter.call(void 0, key, this.filter.bind(this));
246
242
  this.onUnmount(() => {
247
- delete _chunkQYX5Q7KOjs.Context.filterRecord[key];
243
+ delete _chunkRZ7IXJYQjs.Context.filterRecord[key];
248
244
  });
249
245
  }
250
246
  }
@@ -254,7 +250,7 @@ var PExtension = class extends ServerBase {
254
250
  var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
255
251
  var Generator = class {
256
252
  static {
257
- _chunkRVWBJ6LVjs.__name.call(void 0, this, "Generator");
253
+ _chunkGHFSIZUOjs.__name.call(void 0, this, "Generator");
258
254
  }
259
255
 
260
256
  constructor(path) {
@@ -271,7 +267,7 @@ var Generator = class {
271
267
  // src/generator/rpc.ts
272
268
  var RPCGenerator = (_class2 = class extends Generator {constructor(...args3) { super(...args3); _class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this); }
273
269
  static {
274
- _chunkRVWBJ6LVjs.__name.call(void 0, this, "RPCGenerator");
270
+ _chunkGHFSIZUOjs.__name.call(void 0, this, "RPCGenerator");
275
271
  }
276
272
  __init2() {this.name = "RPC"}
277
273
  __init3() {this.classMap = {}}
@@ -307,7 +303,7 @@ var RPCGenerator = (_class2 = class extends Generator {constructor(...args3) { s
307
303
  // src/generator/http.ts
308
304
  var HTTPGenerator = (_class3 = class extends Generator {constructor(...args4) { super(...args4); _class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this); }
309
305
  static {
310
- _chunkRVWBJ6LVjs.__name.call(void 0, this, "HTTPGenerator");
306
+ _chunkGHFSIZUOjs.__name.call(void 0, this, "HTTPGenerator");
311
307
  }
312
308
  __init4() {this.name = "HTTP"}
313
309
  __init5() {this.classMap = {}}
@@ -422,5 +418,4 @@ return ret
422
418
 
423
419
 
424
420
 
425
-
426
- exports.Arg = _chunkAUAAKHWSjs.Arg; exports.BadGatewayException = _chunkQYX5Q7KOjs.BadGatewayException; exports.BadRequestException = _chunkQYX5Q7KOjs.BadRequestException; exports.BaseParam = _chunkAUAAKHWSjs.BaseParam; exports.Body = _chunkAUAAKHWSjs.Body; exports.ConflictException = _chunkQYX5Q7KOjs.ConflictException; exports.Context = _chunkQYX5Q7KOjs.Context; exports.Controller = _chunkAUAAKHWSjs.Controller; exports.Ctx = _chunkAUAAKHWSjs.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkAUAAKHWSjs.Define; exports.Delete = _chunkAUAAKHWSjs.Delete; exports.ERROR_SYMBOL = _chunkRVWBJ6LVjs.ERROR_SYMBOL; exports.Event = _chunkAUAAKHWSjs.Event; exports.Exception = _chunkQYX5Q7KOjs.Exception; exports.Factory = _chunkN4ULJDEQjs.Factory; exports.Filter = _chunkAUAAKHWSjs.Filter; exports.ForbiddenException = _chunkQYX5Q7KOjs.ForbiddenException; exports.FrameworkException = _chunkQYX5Q7KOjs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkAUAAKHWSjs.Get; exports.Guard = _chunkAUAAKHWSjs.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkAUAAKHWSjs.Head; exports.Header = _chunkAUAAKHWSjs.Header; exports.HttpBase = HttpBase; exports.IS_HMR = _chunkRVWBJ6LVjs.IS_HMR; exports.IS_ONLY_GENERATE = _chunkRVWBJ6LVjs.IS_ONLY_GENERATE; exports.IS_STRICT = _chunkRVWBJ6LVjs.IS_STRICT; exports.Injectable = _chunkAUAAKHWSjs.Injectable; exports.Interceptor = _chunkAUAAKHWSjs.Interceptor; exports.InvalidInputException = _chunkQYX5Q7KOjs.InvalidInputException; exports.LOG_LEVEL = _chunkRVWBJ6LVjs.LOG_LEVEL; exports.Meta = _chunkN4ULJDEQjs.Meta; exports.Mix = _chunkRVWBJ6LVjs.Mix; exports.NotFoundException = _chunkQYX5Q7KOjs.NotFoundException; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PInterceptor = PInterceptor; exports.PPipe = PPipe; exports.PPlugin = PPlugin; exports.PS_EXIT_CODE = _chunkRVWBJ6LVjs.PS_EXIT_CODE; exports.Param = _chunkAUAAKHWSjs.Param; exports.Patch = _chunkAUAAKHWSjs.Patch; exports.PayloadLargeException = _chunkQYX5Q7KOjs.PayloadLargeException; exports.Pipe = _chunkAUAAKHWSjs.Pipe; exports.Plugin = _chunkAUAAKHWSjs.Plugin; exports.Post = _chunkAUAAKHWSjs.Post; exports.Put = _chunkAUAAKHWSjs.Put; exports.Query = _chunkAUAAKHWSjs.Query; exports.Queue = _chunkAUAAKHWSjs.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkAUAAKHWSjs.Route; exports.Rpc = _chunkAUAAKHWSjs.Rpc; exports.RpcBase = RpcBase; exports.ServerBase = ServerBase; exports.ServiceUnavailableException = _chunkQYX5Q7KOjs.ServiceUnavailableException; exports.TimeoutException = _chunkQYX5Q7KOjs.TimeoutException; exports.TimerException = _chunkQYX5Q7KOjs.TimerException; exports.UnauthorizedException = _chunkQYX5Q7KOjs.UnauthorizedException; exports.UndefinedException = _chunkQYX5Q7KOjs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkQYX5Q7KOjs.UnsupportedMediaTypeException; exports.ValidateException = _chunkQYX5Q7KOjs.ValidateException; exports.WorkerException = _chunkQYX5Q7KOjs.WorkerException; exports.addFilter = _chunkQYX5Q7KOjs.addFilter; exports.addGuard = _chunkQYX5Q7KOjs.addGuard; exports.addInterceptor = _chunkQYX5Q7KOjs.addInterceptor; exports.addPipe = _chunkQYX5Q7KOjs.addPipe; exports.addPlugin = _chunkQYX5Q7KOjs.addPlugin; exports.createPhecda = _chunkN4ULJDEQjs.createPhecda; exports.defaultPipe = _chunkQYX5Q7KOjs.defaultPipe; exports.emitter = _chunkN4ULJDEQjs.emitter; exports.log = _chunkRVWBJ6LVjs.log; exports.setLogger = _chunkRVWBJ6LVjs.setLogger;
421
+ exports.Arg = _chunk2HVTWYS2js.Arg; exports.BadGatewayException = _chunkRZ7IXJYQjs.BadGatewayException; exports.BadRequestException = _chunkRZ7IXJYQjs.BadRequestException; exports.BaseParam = _chunk2HVTWYS2js.BaseParam; exports.Body = _chunk2HVTWYS2js.Body; exports.ConflictException = _chunkRZ7IXJYQjs.ConflictException; exports.Context = _chunkRZ7IXJYQjs.Context; exports.Controller = _chunk2HVTWYS2js.Controller; exports.Ctx = _chunk2HVTWYS2js.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunk2HVTWYS2js.Define; exports.Delete = _chunk2HVTWYS2js.Delete; exports.ERROR_SYMBOL = _chunkGHFSIZUOjs.ERROR_SYMBOL; exports.Event = _chunk2HVTWYS2js.Event; exports.Exception = _chunkRZ7IXJYQjs.Exception; exports.Factory = _chunkUIKQNJN3js.Factory; exports.Filter = _chunk2HVTWYS2js.Filter; exports.ForbiddenException = _chunkRZ7IXJYQjs.ForbiddenException; exports.FrameworkException = _chunkRZ7IXJYQjs.FrameworkException; exports.Generator = Generator; exports.Get = _chunk2HVTWYS2js.Get; exports.Guard = _chunk2HVTWYS2js.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunk2HVTWYS2js.Head; exports.Header = _chunk2HVTWYS2js.Header; exports.HttpBase = HttpBase; exports.IS_HMR = _chunkGHFSIZUOjs.IS_HMR; exports.IS_ONLY_GENERATE = _chunkGHFSIZUOjs.IS_ONLY_GENERATE; exports.IS_STRICT = _chunkGHFSIZUOjs.IS_STRICT; exports.Interceptor = _chunk2HVTWYS2js.Interceptor; exports.InvalidInputException = _chunkRZ7IXJYQjs.InvalidInputException; exports.LOG_LEVEL = _chunkGHFSIZUOjs.LOG_LEVEL; exports.Meta = _chunkUIKQNJN3js.Meta; exports.Mixin = _chunkGHFSIZUOjs.Mixin; exports.NotFoundException = _chunkRZ7IXJYQjs.NotFoundException; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PInterceptor = PInterceptor; exports.PPipe = PPipe; exports.PPlugin = PPlugin; exports.PS_EXIT_CODE = _chunkGHFSIZUOjs.PS_EXIT_CODE; exports.Param = _chunk2HVTWYS2js.Param; exports.Patch = _chunk2HVTWYS2js.Patch; exports.PayloadLargeException = _chunkRZ7IXJYQjs.PayloadLargeException; exports.Pipe = _chunk2HVTWYS2js.Pipe; exports.Plugin = _chunk2HVTWYS2js.Plugin; exports.Post = _chunk2HVTWYS2js.Post; exports.Put = _chunk2HVTWYS2js.Put; exports.Query = _chunk2HVTWYS2js.Query; exports.Queue = _chunk2HVTWYS2js.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunk2HVTWYS2js.Route; exports.Rpc = _chunk2HVTWYS2js.Rpc; exports.RpcBase = RpcBase; exports.ServerBase = ServerBase; exports.ServiceUnavailableException = _chunkRZ7IXJYQjs.ServiceUnavailableException; exports.TimeoutException = _chunkRZ7IXJYQjs.TimeoutException; exports.TimerException = _chunkRZ7IXJYQjs.TimerException; exports.UnauthorizedException = _chunkRZ7IXJYQjs.UnauthorizedException; exports.UndefinedException = _chunkRZ7IXJYQjs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkRZ7IXJYQjs.UnsupportedMediaTypeException; exports.ValidateException = _chunkRZ7IXJYQjs.ValidateException; exports.WorkerException = _chunkRZ7IXJYQjs.WorkerException; exports.addFilter = _chunkRZ7IXJYQjs.addFilter; exports.addGuard = _chunkRZ7IXJYQjs.addGuard; exports.addInterceptor = _chunkRZ7IXJYQjs.addInterceptor; exports.addPipe = _chunkRZ7IXJYQjs.addPipe; exports.addPlugin = _chunkRZ7IXJYQjs.addPlugin; exports.createPhecda = _chunkUIKQNJN3js.createPhecda; exports.defaultPipe = _chunkRZ7IXJYQjs.defaultPipe; exports.emitter = _chunkUIKQNJN3js.emitter; exports.log = _chunkGHFSIZUOjs.log; exports.setLogger = _chunkGHFSIZUOjs.setLogger;
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Meta,
4
4
  createPhecda,
5
5
  emitter
6
- } from "./chunk-LHLQIQPH.mjs";
6
+ } from "./chunk-NT6HEBC6.mjs";
7
7
  import {
8
8
  Arg,
9
9
  BaseParam,
@@ -18,7 +18,6 @@ import {
18
18
  Guard,
19
19
  Head,
20
20
  Header,
21
- Injectable,
22
21
  Interceptor,
23
22
  Param,
24
23
  Patch,
@@ -30,7 +29,7 @@ import {
30
29
  Queue,
31
30
  Route,
32
31
  Rpc
33
- } from "./chunk-5E2AVYP2.mjs";
32
+ } from "./chunk-SXOZVIKW.mjs";
34
33
  import {
35
34
  BadGatewayException,
36
35
  BadRequestException,
@@ -56,19 +55,19 @@ import {
56
55
  addPipe,
57
56
  addPlugin,
58
57
  defaultPipe
59
- } from "./chunk-BZKJ5NBU.mjs";
58
+ } from "./chunk-3IPYLGY2.mjs";
60
59
  import {
61
60
  ERROR_SYMBOL,
62
61
  IS_HMR,
63
62
  IS_ONLY_GENERATE,
64
63
  IS_STRICT,
65
64
  LOG_LEVEL,
66
- Mix,
65
+ Mixin,
67
66
  PS_EXIT_CODE,
68
67
  __name,
69
68
  log,
70
69
  setLogger
71
- } from "./chunk-MESZCLSS.mjs";
70
+ } from "./chunk-UXD62LGG.mjs";
72
71
 
73
72
  // src/types.ts
74
73
  var ResponseSymbol = Symbol("response");
@@ -80,7 +79,7 @@ var CustomResponse = class {
80
79
  };
81
80
 
82
81
  // src/modules/base.ts
83
- import { Base, Empty } from "phecda-core";
82
+ import { Base } from "phecda-core";
84
83
  function _ts_decorate(decorators, target, key, desc) {
85
84
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
86
85
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -98,9 +97,6 @@ var ServerBase = class extends Base {
98
97
  }
99
98
  emitter = emitter;
100
99
  };
101
- ServerBase = _ts_decorate([
102
- Empty
103
- ], ServerBase);
104
100
  var HttpBase = class extends ServerBase {
105
101
  static {
106
102
  __name(this, "HttpBase");
@@ -377,12 +373,11 @@ export {
377
373
  IS_HMR,
378
374
  IS_ONLY_GENERATE,
379
375
  IS_STRICT,
380
- Injectable,
381
376
  Interceptor,
382
377
  InvalidInputException,
383
378
  LOG_LEVEL,
384
379
  Meta,
385
- Mix,
380
+ Mixin,
386
381
  NotFoundException,
387
382
  PExtension,
388
383
  PFilter,
@@ -4,10 +4,10 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkQYX5Q7KOjs = require('../../chunk-QYX5Q7KO.js');
7
+ var _chunkRZ7IXJYQjs = require('../../chunk-RZ7IXJYQ.js');
8
8
 
9
9
 
10
- var _chunkRVWBJ6LVjs = require('../../chunk-RVWBJ6LV.js');
10
+ var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
11
11
 
12
12
  // src/rpc/bullmq/bind.ts
13
13
  var _bullmq = require('bullmq');
@@ -18,14 +18,14 @@ async function create({ moduleMap, meta }, opts = {}) {
18
18
  const workerMap = {};
19
19
  const queueMap = {};
20
20
  const existQueue = /* @__PURE__ */ new Set();
21
- const metaMap = _chunkQYX5Q7KOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
+ const metaMap = _chunkRZ7IXJYQjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
22
  const { controller, rpc, func, tag } = meta2.data;
23
23
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
24
24
  debug(`register method "${func}" in module "${tag}"`);
25
25
  return true;
26
26
  }
27
27
  });
28
- _chunkQYX5Q7KOjs.detectAopDep.call(void 0, meta, {
28
+ _chunkRZ7IXJYQjs.detectAopDep.call(void 0, meta, {
29
29
  guards: globalGuards,
30
30
  interceptors: globalInterceptors
31
31
  }, "rpc");
@@ -44,7 +44,7 @@ async function create({ moduleMap, meta }, opts = {}) {
44
44
  }
45
45
  }
46
46
  }
47
- _chunkRVWBJ6LVjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
47
+ _chunkGHFSIZUOjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
48
48
  async function handleRequest(job) {
49
49
  const { data } = job;
50
50
  const { tag, func, args, id, queue: clientQueue, _ps } = data;
@@ -53,7 +53,7 @@ async function create({ moduleMap, meta }, opts = {}) {
53
53
  const meta2 = metaMap.get(tag)[func];
54
54
  const { data: { rpc: { isEvent } = {} } } = meta2;
55
55
  if (!isEvent && !(clientQueue in queueMap)) queueMap[clientQueue] = new (0, _bullmq.Queue)(clientQueue, queueOpts);
56
- const context = new (0, _chunkQYX5Q7KOjs.Context)({
56
+ const context = new (0, _chunkRZ7IXJYQjs.Context)({
57
57
  type: "bullmq",
58
58
  moduleMap,
59
59
  meta: meta2,
@@ -85,9 +85,9 @@ async function create({ moduleMap, meta }, opts = {}) {
85
85
  }
86
86
  });
87
87
  }
88
- _chunkRVWBJ6LVjs.__name.call(void 0, handleRequest, "handleRequest");
88
+ _chunkGHFSIZUOjs.__name.call(void 0, handleRequest, "handleRequest");
89
89
  subscribeQueues();
90
- _chunkQYX5Q7KOjs.HMR.call(void 0, async () => {
90
+ _chunkRZ7IXJYQjs.HMR.call(void 0, async () => {
91
91
  for (const i in workerMap) await workerMap[i].close(true);
92
92
  for (const i in queueMap) await queueMap[i].close();
93
93
  await subscribeQueues();
@@ -97,7 +97,7 @@ async function create({ moduleMap, meta }, opts = {}) {
97
97
  queueMap
98
98
  };
99
99
  }
100
- _chunkRVWBJ6LVjs.__name.call(void 0, create, "create");
100
+ _chunkGHFSIZUOjs.__name.call(void 0, create, "create");
101
101
 
102
102
  // src/rpc/bullmq/client.ts
103
103
  var _events = require('events');
@@ -108,7 +108,7 @@ async function createClient(controllers, opts = {}) {
108
108
  const { max, workerOpts, queueOpts, timeout, key } = opts;
109
109
  const ret = {};
110
110
  const emitter = new (0, _events.EventEmitter)();
111
- const clientQueue = _chunkQYX5Q7KOjs.genClientQueue.call(void 0, key);
111
+ const clientQueue = _chunkRZ7IXJYQjs.genClientQueue.call(void 0, key);
112
112
  const queueMap = {};
113
113
  new (0, _bullmq.Worker)(clientQueue, async (job) => {
114
114
  const { data, id, error } = job.data;
@@ -153,7 +153,7 @@ async function createClient(controllers, opts = {}) {
153
153
  if (error) reject(data);
154
154
  else resolve(data);
155
155
  }
156
- _chunkRVWBJ6LVjs.__name.call(void 0, listener, "listener");
156
+ _chunkGHFSIZUOjs.__name.call(void 0, listener, "listener");
157
157
  eventCount++;
158
158
  emitter.once(id, listener);
159
159
  });
@@ -163,7 +163,7 @@ async function createClient(controllers, opts = {}) {
163
163
  }
164
164
  return ret;
165
165
  }
166
- _chunkRVWBJ6LVjs.__name.call(void 0, createClient, "createClient");
166
+ _chunkGHFSIZUOjs.__name.call(void 0, createClient, "createClient");
167
167
 
168
168
 
169
169
 
@@ -4,10 +4,10 @@ import {
4
4
  createControllerMetaMap,
5
5
  detectAopDep,
6
6
  genClientQueue
7
- } from "../../chunk-BZKJ5NBU.mjs";
7
+ } from "../../chunk-3IPYLGY2.mjs";
8
8
  import {
9
9
  __name
10
- } from "../../chunk-MESZCLSS.mjs";
10
+ } from "../../chunk-UXD62LGG.mjs";
11
11
 
12
12
  // src/rpc/bullmq/bind.ts
13
13
  import { Queue, Worker } from "bullmq";
@@ -3,10 +3,10 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkQYX5Q7KOjs = require('../../chunk-QYX5Q7KO.js');
6
+ var _chunkRZ7IXJYQjs = require('../../chunk-RZ7IXJYQ.js');
7
7
 
8
8
 
9
- var _chunkRVWBJ6LVjs = require('../../chunk-RVWBJ6LV.js');
9
+ var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
10
10
 
11
11
  // src/rpc/kafka/bind.ts
12
12
  var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
@@ -14,14 +14,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/kafka");
14
14
  async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
15
15
  const { globalGuards, globalInterceptors, globalFilter, globalPipe } = opts;
16
16
  const existQueue = /* @__PURE__ */ new Set();
17
- const metaMap = _chunkQYX5Q7KOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const metaMap = _chunkRZ7IXJYQjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
18
18
  const { controller, rpc, func, tag } = meta2.data;
19
19
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
20
20
  debug(`register method "${func}" in module "${tag}"`);
21
21
  return true;
22
22
  }
23
23
  });
24
- _chunkQYX5Q7KOjs.detectAopDep.call(void 0, meta, {
24
+ _chunkRZ7IXJYQjs.detectAopDep.call(void 0, meta, {
25
25
  guards: globalGuards,
26
26
  interceptors: globalInterceptors
27
27
  }, "rpc");
@@ -43,10 +43,10 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
43
43
  }
44
44
  }
45
45
  }
46
- _chunkRVWBJ6LVjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
46
+ _chunkGHFSIZUOjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
47
47
  await subscribeQueues();
48
48
  await consumer.run({
49
- eachMessage: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, async ({ message, partition, topic, heartbeat, pause }) => {
49
+ eachMessage: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, async ({ message, partition, topic, heartbeat, pause }) => {
50
50
  if (!existQueue.has(topic)) return;
51
51
  const data = JSON.parse(message.value.toString());
52
52
  const { tag, func, id, queue: clientQueue, _ps, args } = data;
@@ -55,7 +55,7 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
55
55
  const meta2 = metaMap.get(tag)[func];
56
56
  const { data: { rpc } } = meta2;
57
57
  const isEvent = rpc.isEvent;
58
- const context = new (0, _chunkQYX5Q7KOjs.Context)({
58
+ const context = new (0, _chunkRZ7IXJYQjs.Context)({
59
59
  type: "kafka",
60
60
  moduleMap,
61
61
  meta: meta2,
@@ -108,7 +108,7 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
108
108
  }, "eachMessage")
109
109
  });
110
110
  }
111
- _chunkRVWBJ6LVjs.__name.call(void 0, bind, "bind");
111
+ _chunkGHFSIZUOjs.__name.call(void 0, bind, "bind");
112
112
 
113
113
  // src/rpc/kafka/client.ts
114
114
  var _events = require('events');
@@ -117,7 +117,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
117
117
  let eventCount = 1;
118
118
  const ret = {};
119
119
  const emitter = new (0, _events.EventEmitter)();
120
- const clientQueue = _chunkQYX5Q7KOjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
120
+ const clientQueue = _chunkRZ7IXJYQjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
121
121
  await consumer.subscribe({
122
122
  topic: clientQueue,
123
123
  fromBeginning: true
@@ -167,7 +167,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
167
167
  if (error) reject(data);
168
168
  else resolve(data);
169
169
  }
170
- _chunkRVWBJ6LVjs.__name.call(void 0, listener, "listener");
170
+ _chunkGHFSIZUOjs.__name.call(void 0, listener, "listener");
171
171
  eventCount++;
172
172
  emitter.once(id, listener);
173
173
  });
@@ -176,7 +176,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
176
176
  });
177
177
  }
178
178
  await consumer.run({
179
- eachMessage: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, async ({ message, topic }) => {
179
+ eachMessage: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, async ({ message, topic }) => {
180
180
  if (clientQueue === topic && message.value) {
181
181
  const { data, id, error } = JSON.parse(message.value.toString());
182
182
  emitter.emit(id, data, error);
@@ -185,7 +185,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
185
185
  });
186
186
  return ret;
187
187
  }
188
- _chunkRVWBJ6LVjs.__name.call(void 0, createClient, "createClient");
188
+ _chunkGHFSIZUOjs.__name.call(void 0, createClient, "createClient");
189
189
 
190
190
 
191
191
 
@@ -3,10 +3,10 @@ import {
3
3
  createControllerMetaMap,
4
4
  detectAopDep,
5
5
  genClientQueue
6
- } from "../../chunk-BZKJ5NBU.mjs";
6
+ } from "../../chunk-3IPYLGY2.mjs";
7
7
  import {
8
8
  __name
9
- } from "../../chunk-MESZCLSS.mjs";
9
+ } from "../../chunk-UXD62LGG.mjs";
10
10
 
11
11
  // src/rpc/kafka/bind.ts
12
12
  import Debug from "debug";