phecda-server 7.0.0-alpha.6 → 7.0.0-alpha.7

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 (45) hide show
  1. package/dist/{chunk-KSDE5G57.mjs → chunk-C5BVKEGW.mjs} +22 -1
  2. package/dist/{chunk-3C7Z3IJN.mjs → chunk-IRXNF6ZE.mjs} +1 -1
  3. package/dist/{chunk-ICI5KUDX.mjs → chunk-JPSXNDXP.mjs} +1 -1
  4. package/dist/{chunk-62FBZWGW.js → chunk-M5HGFUCV.js} +22 -1
  5. package/dist/{chunk-JF4YU32E.js → chunk-MENRZSGW.js} +51 -51
  6. package/dist/{chunk-HTY3H33L.mjs → chunk-RGSKKTHD.mjs} +1 -1
  7. package/dist/{chunk-UKRQVTEY.js → chunk-VYMSCWXC.js} +24 -24
  8. package/dist/{chunk-WYI2F7LD.js → chunk-XSMUJ77A.js} +19 -19
  9. package/dist/helper.js +3 -3
  10. package/dist/helper.mjs +2 -2
  11. package/dist/http/elysia/index.js +40 -40
  12. package/dist/http/elysia/index.mjs +3 -3
  13. package/dist/http/express/index.js +37 -37
  14. package/dist/http/express/index.mjs +2 -2
  15. package/dist/http/fastify/index.js +38 -38
  16. package/dist/http/fastify/index.mjs +3 -3
  17. package/dist/http/h3/index.js +37 -37
  18. package/dist/http/h3/index.mjs +2 -2
  19. package/dist/http/hono/index.js +35 -35
  20. package/dist/http/hono/index.mjs +2 -2
  21. package/dist/http/hyper-express/index.js +35 -35
  22. package/dist/http/hyper-express/index.mjs +2 -2
  23. package/dist/http/koa/index.js +37 -37
  24. package/dist/http/koa/index.mjs +2 -2
  25. package/dist/index.d.mts +3 -3
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.js +40 -40
  28. package/dist/index.mjs +5 -5
  29. package/dist/rpc/bullmq/index.d.mts +1 -1
  30. package/dist/rpc/bullmq/index.d.ts +1 -1
  31. package/dist/rpc/bullmq/index.js +14 -14
  32. package/dist/rpc/bullmq/index.mjs +2 -2
  33. package/dist/rpc/kafka/index.js +14 -14
  34. package/dist/rpc/kafka/index.mjs +2 -2
  35. package/dist/rpc/nats/index.js +13 -13
  36. package/dist/rpc/nats/index.mjs +2 -2
  37. package/dist/rpc/rabbitmq/index.js +15 -15
  38. package/dist/rpc/rabbitmq/index.mjs +2 -2
  39. package/dist/rpc/redis/index.js +13 -13
  40. package/dist/rpc/redis/index.mjs +2 -2
  41. package/dist/test.d.mts +1 -1
  42. package/dist/test.d.ts +1 -1
  43. package/dist/test.js +6 -6
  44. package/dist/test.mjs +2 -2
  45. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkWYI2F7LDjs = require('./chunk-WYI2F7LD.js');
9
+ var _chunkXSMUJ77Ajs = require('./chunk-XSMUJ77A.js');
10
10
 
11
11
 
12
12
 
@@ -31,7 +31,7 @@ var _chunkWYI2F7LDjs = require('./chunk-WYI2F7LD.js');
31
31
 
32
32
 
33
33
 
34
- var _chunkUKRQVTEYjs = require('./chunk-UKRQVTEY.js');
34
+ var _chunkVYMSCWXCjs = require('./chunk-VYMSCWXC.js');
35
35
 
36
36
 
37
37
 
@@ -56,7 +56,7 @@ var _chunkUKRQVTEYjs = require('./chunk-UKRQVTEY.js');
56
56
 
57
57
 
58
58
 
59
- var _chunkJF4YU32Ejs = require('./chunk-JF4YU32E.js');
59
+ var _chunkMENRZSGWjs = require('./chunk-MENRZSGW.js');
60
60
 
61
61
 
62
62
 
@@ -71,13 +71,13 @@ var _chunkJF4YU32Ejs = require('./chunk-JF4YU32E.js');
71
71
 
72
72
 
73
73
 
74
- var _chunk62FBZWGWjs = require('./chunk-62FBZWGW.js');
74
+ var _chunkM5HGFUCVjs = require('./chunk-M5HGFUCV.js');
75
75
 
76
76
  // src/types.ts
77
77
  var ResponseSymbol = Symbol("response");
78
78
  var CustomResponse = class {
79
79
  static {
80
- _chunk62FBZWGWjs.__name.call(void 0, this, "CustomResponse");
80
+ _chunkM5HGFUCVjs.__name.call(void 0, this, "CustomResponse");
81
81
  }
82
82
 
83
83
  };
@@ -90,38 +90,38 @@ function _ts_decorate(decorators, target, key, desc) {
90
90
  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
91
  return c > 3 && r && Object.defineProperty(target, key, r), r;
92
92
  }
93
- _chunk62FBZWGWjs.__name.call(void 0, _ts_decorate, "_ts_decorate");
93
+ _chunkM5HGFUCVjs.__name.call(void 0, _ts_decorate, "_ts_decorate");
94
94
  function _ts_metadata(k, v) {
95
95
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
96
96
  }
97
- _chunk62FBZWGWjs.__name.call(void 0, _ts_metadata, "_ts_metadata");
97
+ _chunkM5HGFUCVjs.__name.call(void 0, _ts_metadata, "_ts_metadata");
98
98
  var ServerBase = (_class = class extends _phecdacore.Base {constructor(...args2) { super(...args2); _class.prototype.__init.call(this); }
99
99
  static {
100
- _chunk62FBZWGWjs.__name.call(void 0, this, "ServerBase");
100
+ _chunkM5HGFUCVjs.__name.call(void 0, this, "ServerBase");
101
101
  }
102
- __init() {this.emitter = exports.emitter = _chunkWYI2F7LDjs.emitter}
103
- log(msg, level) {
104
- _chunk62FBZWGWjs.log.call(void 0, msg, level, this.tag);
102
+ __init() {this.emitter = exports.emitter = _chunkXSMUJ77Ajs.emitter}
103
+ log(msg, level = "log") {
104
+ _chunkM5HGFUCVjs.log.call(void 0, msg, level, this.tag);
105
105
  }
106
106
  }, _class);
107
107
  var HttpBase = class extends ServerBase {
108
108
  static {
109
- _chunk62FBZWGWjs.__name.call(void 0, this, "HttpBase");
109
+ _chunkM5HGFUCVjs.__name.call(void 0, this, "HttpBase");
110
110
  }
111
111
 
112
112
  };
113
113
  _ts_decorate([
114
- _chunkUKRQVTEYjs.Ctx,
114
+ _chunkVYMSCWXCjs.Ctx,
115
115
  _ts_metadata("design:type", typeof HttpContext === "undefined" ? Object : HttpContext)
116
116
  ], HttpBase.prototype, "context", void 0);
117
117
  var RpcBase = class extends ServerBase {
118
118
  static {
119
- _chunk62FBZWGWjs.__name.call(void 0, this, "RpcBase");
119
+ _chunkM5HGFUCVjs.__name.call(void 0, this, "RpcBase");
120
120
  }
121
121
 
122
122
  };
123
123
  _ts_decorate([
124
- _chunkUKRQVTEYjs.Ctx,
124
+ _chunkVYMSCWXCjs.Ctx,
125
125
  _ts_metadata("design:type", typeof RpcContext === "undefined" ? Object : RpcContext)
126
126
  ], RpcBase.prototype, "context", void 0);
127
127
 
@@ -129,15 +129,15 @@ _ts_decorate([
129
129
 
130
130
  var PFilter = class extends ServerBase {
131
131
  static {
132
- _chunk62FBZWGWjs.__name.call(void 0, this, "PFilter");
132
+ _chunkM5HGFUCVjs.__name.call(void 0, this, "PFilter");
133
133
  }
134
134
 
135
135
  constructor(tag) {
136
136
  super();
137
137
  this.key = tag || _phecdacore.getTag.call(void 0, this);
138
- _chunkJF4YU32Ejs.addFilter.call(void 0, this.key, this.use.bind(this));
138
+ _chunkMENRZSGWjs.addFilter.call(void 0, this.key, this.use.bind(this));
139
139
  this.onUnmount(() => {
140
- delete _chunkJF4YU32Ejs.Context.filterRecord[this.key];
140
+ delete _chunkMENRZSGWjs.Context.filterRecord[this.key];
141
141
  });
142
142
  }
143
143
  };
@@ -146,16 +146,16 @@ var PFilter = class extends ServerBase {
146
146
 
147
147
  var PGuard = (_class2 = class extends ServerBase {
148
148
  static {
149
- _chunk62FBZWGWjs.__name.call(void 0, this, "PGuard");
149
+ _chunkM5HGFUCVjs.__name.call(void 0, this, "PGuard");
150
150
  }
151
151
 
152
152
  __init2() {this.priority = 0}
153
153
  constructor(tag) {
154
154
  super();_class2.prototype.__init2.call(this);;
155
155
  this.key = tag || _phecdacore.getTag.call(void 0, this);
156
- _chunkJF4YU32Ejs.addGuard.call(void 0, this.key, this.use.bind(this), this.priority);
156
+ _chunkMENRZSGWjs.addGuard.call(void 0, this.key, this.use.bind(this), this.priority);
157
157
  this.onUnmount(() => {
158
- delete _chunkJF4YU32Ejs.Context.guardRecord[this.key];
158
+ delete _chunkMENRZSGWjs.Context.guardRecord[this.key];
159
159
  });
160
160
  }
161
161
  }, _class2);
@@ -164,15 +164,15 @@ var PGuard = (_class2 = class extends ServerBase {
164
164
 
165
165
  var PPipe = class extends ServerBase {
166
166
  static {
167
- _chunk62FBZWGWjs.__name.call(void 0, this, "PPipe");
167
+ _chunkM5HGFUCVjs.__name.call(void 0, this, "PPipe");
168
168
  }
169
169
 
170
170
  constructor(tag) {
171
171
  super();
172
172
  this.key = tag || _phecdacore.getTag.call(void 0, this);
173
- _chunkJF4YU32Ejs.addPipe.call(void 0, this.key, this.use.bind(this));
173
+ _chunkMENRZSGWjs.addPipe.call(void 0, this.key, this.use.bind(this));
174
174
  this.onUnmount(() => {
175
- delete _chunkJF4YU32Ejs.Context.pipeRecord[this.key];
175
+ delete _chunkMENRZSGWjs.Context.pipeRecord[this.key];
176
176
  });
177
177
  }
178
178
  };
@@ -181,16 +181,16 @@ var PPipe = class extends ServerBase {
181
181
 
182
182
  var PAddon = (_class3 = class extends ServerBase {
183
183
  static {
184
- _chunk62FBZWGWjs.__name.call(void 0, this, "PAddon");
184
+ _chunkM5HGFUCVjs.__name.call(void 0, this, "PAddon");
185
185
  }
186
186
 
187
187
  __init3() {this.priority = 0}
188
188
  constructor(tag) {
189
189
  super();_class3.prototype.__init3.call(this);;
190
190
  this.key = tag || _phecdacore.getTag.call(void 0, this);
191
- _chunkJF4YU32Ejs.addAddon.call(void 0, this.key, this.use.bind(this), this.priority);
191
+ _chunkMENRZSGWjs.addAddon.call(void 0, this.key, this.use.bind(this), this.priority);
192
192
  this.onUnmount(() => {
193
- delete _chunkJF4YU32Ejs.Context.addonRecord[this.key];
193
+ delete _chunkMENRZSGWjs.Context.addonRecord[this.key];
194
194
  });
195
195
  }
196
196
  }, _class3);
@@ -199,7 +199,7 @@ var PAddon = (_class3 = class extends ServerBase {
199
199
 
200
200
  var PExtension = class extends ServerBase {
201
201
  static {
202
- _chunk62FBZWGWjs.__name.call(void 0, this, "PExtension");
202
+ _chunkM5HGFUCVjs.__name.call(void 0, this, "PExtension");
203
203
  }
204
204
 
205
205
 
@@ -208,27 +208,27 @@ var PExtension = class extends ServerBase {
208
208
  super();
209
209
  const key = this.key = tag || _phecdacore.getTag.call(void 0, this);
210
210
  if (this.pipe) {
211
- _chunkJF4YU32Ejs.addPipe.call(void 0, key, this.pipe.bind(this));
211
+ _chunkMENRZSGWjs.addPipe.call(void 0, key, this.pipe.bind(this));
212
212
  this.onUnmount(() => {
213
- delete _chunkJF4YU32Ejs.Context.pipeRecord[key];
213
+ delete _chunkMENRZSGWjs.Context.pipeRecord[key];
214
214
  });
215
215
  }
216
216
  if (this.addon) {
217
- _chunkJF4YU32Ejs.addAddon.call(void 0, key, this.addon.bind(this), this.addonPriority);
217
+ _chunkMENRZSGWjs.addAddon.call(void 0, key, this.addon.bind(this), this.addonPriority);
218
218
  this.onUnmount(() => {
219
- delete _chunkJF4YU32Ejs.Context.addonRecord[key];
219
+ delete _chunkMENRZSGWjs.Context.addonRecord[key];
220
220
  });
221
221
  }
222
222
  if (this.guard) {
223
- _chunkJF4YU32Ejs.addGuard.call(void 0, key, this.guard.bind(this), this.guardPriority);
223
+ _chunkMENRZSGWjs.addGuard.call(void 0, key, this.guard.bind(this), this.guardPriority);
224
224
  this.onUnmount(() => {
225
- delete _chunkJF4YU32Ejs.Context.guardRecord[key];
225
+ delete _chunkMENRZSGWjs.Context.guardRecord[key];
226
226
  });
227
227
  }
228
228
  if (this.filter) {
229
- _chunkJF4YU32Ejs.addFilter.call(void 0, key, this.filter.bind(this));
229
+ _chunkMENRZSGWjs.addFilter.call(void 0, key, this.filter.bind(this));
230
230
  this.onUnmount(() => {
231
- delete _chunkJF4YU32Ejs.Context.filterRecord[key];
231
+ delete _chunkMENRZSGWjs.Context.filterRecord[key];
232
232
  });
233
233
  }
234
234
  }
@@ -238,7 +238,7 @@ var PExtension = class extends ServerBase {
238
238
  var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
239
239
  var Generator = class {
240
240
  static {
241
- _chunk62FBZWGWjs.__name.call(void 0, this, "Generator");
241
+ _chunkM5HGFUCVjs.__name.call(void 0, this, "Generator");
242
242
  }
243
243
 
244
244
  constructor(path) {
@@ -255,7 +255,7 @@ var Generator = class {
255
255
  // src/generator/rpc.ts
256
256
  var RPCGenerator = (_class4 = class extends Generator {constructor(...args3) { super(...args3); _class4.prototype.__init4.call(this);_class4.prototype.__init5.call(this); }
257
257
  static {
258
- _chunk62FBZWGWjs.__name.call(void 0, this, "RPCGenerator");
258
+ _chunkM5HGFUCVjs.__name.call(void 0, this, "RPCGenerator");
259
259
  }
260
260
  __init4() {this.name = "RPC"}
261
261
  __init5() {this.classMap = {}}
@@ -291,7 +291,7 @@ var RPCGenerator = (_class4 = class extends Generator {constructor(...args3) { s
291
291
  // src/generator/http.ts
292
292
  var HTTPGenerator = (_class5 = class extends Generator {constructor(...args4) { super(...args4); _class5.prototype.__init6.call(this);_class5.prototype.__init7.call(this); }
293
293
  static {
294
- _chunk62FBZWGWjs.__name.call(void 0, this, "HTTPGenerator");
294
+ _chunkM5HGFUCVjs.__name.call(void 0, this, "HTTPGenerator");
295
295
  }
296
296
  __init6() {this.name = "HTTP"}
297
297
  __init7() {this.classMap = {}}
@@ -409,4 +409,4 @@ return ret
409
409
 
410
410
 
411
411
 
412
- exports.Addon = _chunkUKRQVTEYjs.Addon; exports.Arg = _chunkUKRQVTEYjs.Arg; exports.BadGatewayException = _chunkJF4YU32Ejs.BadGatewayException; exports.BadRequestException = _chunkJF4YU32Ejs.BadRequestException; exports.BaseParam = _chunkUKRQVTEYjs.BaseParam; exports.Body = _chunkUKRQVTEYjs.Body; exports.ConflictException = _chunkJF4YU32Ejs.ConflictException; exports.Context = _chunkJF4YU32Ejs.Context; exports.Controller = _chunkUKRQVTEYjs.Controller; exports.Ctx = _chunkUKRQVTEYjs.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkUKRQVTEYjs.Define; exports.Delete = _chunkUKRQVTEYjs.Delete; exports.ERROR_SYMBOL = _chunk62FBZWGWjs.ERROR_SYMBOL; exports.Exception = _chunkJF4YU32Ejs.Exception; exports.Factory = _chunkWYI2F7LDjs.Factory; exports.Filter = _chunkUKRQVTEYjs.Filter; exports.ForbiddenException = _chunkJF4YU32Ejs.ForbiddenException; exports.FrameworkException = _chunkJF4YU32Ejs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkUKRQVTEYjs.Get; exports.Guard = _chunkUKRQVTEYjs.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkUKRQVTEYjs.Head; exports.Header = _chunkUKRQVTEYjs.Header; exports.HttpBase = HttpBase; exports.IS_HMR = _chunk62FBZWGWjs.IS_HMR; exports.IS_ONLY_GENERATE = _chunk62FBZWGWjs.IS_ONLY_GENERATE; exports.IS_READY = _chunk62FBZWGWjs.IS_READY; exports.IS_STRICT = _chunk62FBZWGWjs.IS_STRICT; exports.InvalidInputException = _chunkJF4YU32Ejs.InvalidInputException; exports.LOG_LEVEL = _chunk62FBZWGWjs.LOG_LEVEL; exports.Meta = _chunkWYI2F7LDjs.Meta; exports.Mixin = _chunk62FBZWGWjs.Mixin; exports.NotFoundException = _chunkJF4YU32Ejs.NotFoundException; exports.PAddon = PAddon; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PPipe = PPipe; exports.PS_EXIT_CODE = _chunk62FBZWGWjs.PS_EXIT_CODE; exports.Param = _chunkUKRQVTEYjs.Param; exports.Patch = _chunkUKRQVTEYjs.Patch; exports.PayloadLargeException = _chunkJF4YU32Ejs.PayloadLargeException; exports.Pipe = _chunkUKRQVTEYjs.Pipe; exports.Post = _chunkUKRQVTEYjs.Post; exports.Put = _chunkUKRQVTEYjs.Put; exports.Query = _chunkUKRQVTEYjs.Query; exports.Queue = _chunkUKRQVTEYjs.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkUKRQVTEYjs.Route; exports.Rpc = _chunkUKRQVTEYjs.Rpc; exports.RpcBase = RpcBase; exports.Search = _chunkUKRQVTEYjs.Search; exports.ServerBase = ServerBase; exports.ServerPhecda = _chunkWYI2F7LDjs.ServerPhecda; exports.ServiceUnavailableException = _chunkJF4YU32Ejs.ServiceUnavailableException; exports.TimeoutException = _chunkJF4YU32Ejs.TimeoutException; exports.TimerException = _chunkJF4YU32Ejs.TimerException; exports.UnauthorizedException = _chunkJF4YU32Ejs.UnauthorizedException; exports.UndefinedException = _chunkJF4YU32Ejs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkJF4YU32Ejs.UnsupportedMediaTypeException; exports.ValidateException = _chunkJF4YU32Ejs.ValidateException; exports.WorkerException = _chunkJF4YU32Ejs.WorkerException; exports.addAddon = _chunkJF4YU32Ejs.addAddon; exports.addFilter = _chunkJF4YU32Ejs.addFilter; exports.addGuard = _chunkJF4YU32Ejs.addGuard; exports.addPipe = _chunkJF4YU32Ejs.addPipe; exports.defaultPipe = _chunkJF4YU32Ejs.defaultPipe; exports.defaultServerInject = _chunkWYI2F7LDjs.defaultServerInject; exports.emitter = _chunkWYI2F7LDjs.emitter; exports.getLogger = _chunk62FBZWGWjs.getLogger; exports.log = _chunk62FBZWGWjs.log; exports.phecdaNamespace = _chunkWYI2F7LDjs.phecdaNamespace; exports.runMiddleware = _chunk62FBZWGWjs.runMiddleware; exports.setLogger = _chunk62FBZWGWjs.setLogger; exports.useS = _chunkWYI2F7LDjs.useS;
412
+ exports.Addon = _chunkVYMSCWXCjs.Addon; exports.Arg = _chunkVYMSCWXCjs.Arg; exports.BadGatewayException = _chunkMENRZSGWjs.BadGatewayException; exports.BadRequestException = _chunkMENRZSGWjs.BadRequestException; exports.BaseParam = _chunkVYMSCWXCjs.BaseParam; exports.Body = _chunkVYMSCWXCjs.Body; exports.ConflictException = _chunkMENRZSGWjs.ConflictException; exports.Context = _chunkMENRZSGWjs.Context; exports.Controller = _chunkVYMSCWXCjs.Controller; exports.Ctx = _chunkVYMSCWXCjs.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkVYMSCWXCjs.Define; exports.Delete = _chunkVYMSCWXCjs.Delete; exports.ERROR_SYMBOL = _chunkM5HGFUCVjs.ERROR_SYMBOL; exports.Exception = _chunkMENRZSGWjs.Exception; exports.Factory = _chunkXSMUJ77Ajs.Factory; exports.Filter = _chunkVYMSCWXCjs.Filter; exports.ForbiddenException = _chunkMENRZSGWjs.ForbiddenException; exports.FrameworkException = _chunkMENRZSGWjs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkVYMSCWXCjs.Get; exports.Guard = _chunkVYMSCWXCjs.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkVYMSCWXCjs.Head; exports.Header = _chunkVYMSCWXCjs.Header; exports.HttpBase = HttpBase; exports.IS_HMR = _chunkM5HGFUCVjs.IS_HMR; exports.IS_ONLY_GENERATE = _chunkM5HGFUCVjs.IS_ONLY_GENERATE; exports.IS_READY = _chunkM5HGFUCVjs.IS_READY; exports.IS_STRICT = _chunkM5HGFUCVjs.IS_STRICT; exports.InvalidInputException = _chunkMENRZSGWjs.InvalidInputException; exports.LOG_LEVEL = _chunkM5HGFUCVjs.LOG_LEVEL; exports.Meta = _chunkXSMUJ77Ajs.Meta; exports.Mixin = _chunkM5HGFUCVjs.Mixin; exports.NotFoundException = _chunkMENRZSGWjs.NotFoundException; exports.PAddon = PAddon; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PPipe = PPipe; exports.PS_EXIT_CODE = _chunkM5HGFUCVjs.PS_EXIT_CODE; exports.Param = _chunkVYMSCWXCjs.Param; exports.Patch = _chunkVYMSCWXCjs.Patch; exports.PayloadLargeException = _chunkMENRZSGWjs.PayloadLargeException; exports.Pipe = _chunkVYMSCWXCjs.Pipe; exports.Post = _chunkVYMSCWXCjs.Post; exports.Put = _chunkVYMSCWXCjs.Put; exports.Query = _chunkVYMSCWXCjs.Query; exports.Queue = _chunkVYMSCWXCjs.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkVYMSCWXCjs.Route; exports.Rpc = _chunkVYMSCWXCjs.Rpc; exports.RpcBase = RpcBase; exports.Search = _chunkVYMSCWXCjs.Search; exports.ServerBase = ServerBase; exports.ServerPhecda = _chunkXSMUJ77Ajs.ServerPhecda; exports.ServiceUnavailableException = _chunkMENRZSGWjs.ServiceUnavailableException; exports.TimeoutException = _chunkMENRZSGWjs.TimeoutException; exports.TimerException = _chunkMENRZSGWjs.TimerException; exports.UnauthorizedException = _chunkMENRZSGWjs.UnauthorizedException; exports.UndefinedException = _chunkMENRZSGWjs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkMENRZSGWjs.UnsupportedMediaTypeException; exports.ValidateException = _chunkMENRZSGWjs.ValidateException; exports.WorkerException = _chunkMENRZSGWjs.WorkerException; exports.addAddon = _chunkMENRZSGWjs.addAddon; exports.addFilter = _chunkMENRZSGWjs.addFilter; exports.addGuard = _chunkMENRZSGWjs.addGuard; exports.addPipe = _chunkMENRZSGWjs.addPipe; exports.defaultPipe = _chunkMENRZSGWjs.defaultPipe; exports.defaultServerInject = _chunkXSMUJ77Ajs.defaultServerInject; exports.emitter = _chunkXSMUJ77Ajs.emitter; exports.getLogger = _chunkM5HGFUCVjs.getLogger; exports.log = _chunkM5HGFUCVjs.log; exports.phecdaNamespace = _chunkXSMUJ77Ajs.phecdaNamespace; exports.runMiddleware = _chunkM5HGFUCVjs.runMiddleware; exports.setLogger = _chunkM5HGFUCVjs.setLogger; exports.useS = _chunkXSMUJ77Ajs.useS;
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  emitter,
7
7
  phecdaNamespace,
8
8
  useS
9
- } from "./chunk-HTY3H33L.mjs";
9
+ } from "./chunk-RGSKKTHD.mjs";
10
10
  import {
11
11
  Addon,
12
12
  Arg,
@@ -31,7 +31,7 @@ import {
31
31
  Route,
32
32
  Rpc,
33
33
  Search
34
- } from "./chunk-ICI5KUDX.mjs";
34
+ } from "./chunk-JPSXNDXP.mjs";
35
35
  import {
36
36
  BadGatewayException,
37
37
  BadRequestException,
@@ -56,7 +56,7 @@ import {
56
56
  addGuard,
57
57
  addPipe,
58
58
  defaultPipe
59
- } from "./chunk-3C7Z3IJN.mjs";
59
+ } from "./chunk-IRXNF6ZE.mjs";
60
60
  import {
61
61
  ERROR_SYMBOL,
62
62
  IS_HMR,
@@ -71,7 +71,7 @@ import {
71
71
  log,
72
72
  runMiddleware,
73
73
  setLogger
74
- } from "./chunk-KSDE5G57.mjs";
74
+ } from "./chunk-C5BVKEGW.mjs";
75
75
 
76
76
  // src/types.ts
77
77
  var ResponseSymbol = Symbol("response");
@@ -100,7 +100,7 @@ var ServerBase = class extends Base {
100
100
  __name(this, "ServerBase");
101
101
  }
102
102
  emitter = emitter;
103
- log(msg, level) {
103
+ log(msg, level = "log") {
104
104
  log(msg, level, this.tag);
105
105
  }
106
106
  };
@@ -13,7 +13,7 @@ type BullmqOptions = Omit<RpcServerOptions, 'globalAddons'> & {
13
13
  };
14
14
  declare function create({ moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: BullmqOptions): Promise<{
15
15
  workerMap: Record<string, Worker<any, any, string>>;
16
- queueMap: Record<string, Queue<any, any, string>>;
16
+ queueMap: Record<string, Queue<any, any, string, any, any, string>>;
17
17
  }>;
18
18
 
19
19
  declare function createClient<S extends Record<string, any>>(controllers: S, opts?: RpcClientOptions & BullmqOptions): Promise<ToClientMap<S>>;
@@ -13,7 +13,7 @@ type BullmqOptions = Omit<RpcServerOptions, 'globalAddons'> & {
13
13
  };
14
14
  declare function create({ moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: BullmqOptions): Promise<{
15
15
  workerMap: Record<string, Worker<any, any, string>>;
16
- queueMap: Record<string, Queue<any, any, string>>;
16
+ queueMap: Record<string, Queue<any, any, string, any, any, string>>;
17
17
  }>;
18
18
 
19
19
  declare function createClient<S extends Record<string, any>>(controllers: S, opts?: RpcClientOptions & BullmqOptions): Promise<ToClientMap<S>>;
@@ -4,10 +4,10 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkJF4YU32Ejs = require('../../chunk-JF4YU32E.js');
7
+ var _chunkMENRZSGWjs = require('../../chunk-MENRZSGW.js');
8
8
 
9
9
 
10
- var _chunk62FBZWGWjs = require('../../chunk-62FBZWGW.js');
10
+ var _chunkM5HGFUCVjs = require('../../chunk-M5HGFUCV.js');
11
11
 
12
12
  // src/rpc/bullmq/create.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 = _chunkJF4YU32Ejs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
+ const metaMap = _chunkMENRZSGWjs.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
- _chunkJF4YU32Ejs.detectAopDep.call(void 0, meta, {
28
+ _chunkMENRZSGWjs.detectAopDep.call(void 0, meta, {
29
29
  guards: globalGuards
30
30
  }, "rpc");
31
31
  async function subscribeQueues() {
@@ -39,12 +39,12 @@ async function create({ moduleMap, meta }, opts = {}) {
39
39
  if (existQueue.has(queue)) continue;
40
40
  existQueue.add(queue);
41
41
  workerMap[queue] = new (0, _bullmq.Worker)(queue, handleRequest, workerOpts);
42
- _chunkJF4YU32Ejs.Context.applyAddons(addons, workerMap[queue], "bullmq");
42
+ _chunkMENRZSGWjs.Context.applyAddons(addons, workerMap[queue], "bullmq");
43
43
  }
44
44
  }
45
45
  }
46
46
  }
47
- _chunk62FBZWGWjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
47
+ _chunkM5HGFUCVjs.__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,12 +53,12 @@ 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 aop = _chunkJF4YU32Ejs.Context.getAop(meta2, {
56
+ const aop = _chunkMENRZSGWjs.Context.getAop(meta2, {
57
57
  globalFilter,
58
58
  globalGuards,
59
59
  globalPipe
60
60
  });
61
- const context = new (0, _chunkJF4YU32Ejs.Context)({
61
+ const context = new (0, _chunkMENRZSGWjs.Context)({
62
62
  type: "bullmq",
63
63
  category: "rpc",
64
64
  moduleMap,
@@ -86,9 +86,9 @@ async function create({ moduleMap, meta }, opts = {}) {
86
86
  }
87
87
  });
88
88
  }
89
- _chunk62FBZWGWjs.__name.call(void 0, handleRequest, "handleRequest");
89
+ _chunkM5HGFUCVjs.__name.call(void 0, handleRequest, "handleRequest");
90
90
  subscribeQueues();
91
- _chunkJF4YU32Ejs.HMR.call(void 0, async () => {
91
+ _chunkMENRZSGWjs.HMR.call(void 0, async () => {
92
92
  for (const i in workerMap) await workerMap[i].close(true);
93
93
  for (const i in queueMap) await queueMap[i].close();
94
94
  await subscribeQueues();
@@ -98,7 +98,7 @@ async function create({ moduleMap, meta }, opts = {}) {
98
98
  queueMap
99
99
  };
100
100
  }
101
- _chunk62FBZWGWjs.__name.call(void 0, create, "create");
101
+ _chunkM5HGFUCVjs.__name.call(void 0, create, "create");
102
102
 
103
103
  // src/rpc/bullmq/client.ts
104
104
  var _events = require('events');
@@ -109,7 +109,7 @@ async function createClient(controllers, opts = {}) {
109
109
  const { max, workerOpts, queueOpts, timeout, key } = opts;
110
110
  const ret = {};
111
111
  const emitter = new (0, _events.EventEmitter)();
112
- const clientQueue = _chunkJF4YU32Ejs.genClientQueue.call(void 0, key);
112
+ const clientQueue = _chunkMENRZSGWjs.genClientQueue.call(void 0, key);
113
113
  const queueMap = {};
114
114
  new (0, _bullmq.Worker)(clientQueue, async (job) => {
115
115
  const { data, id, error } = job.data;
@@ -154,7 +154,7 @@ async function createClient(controllers, opts = {}) {
154
154
  if (error) reject(data);
155
155
  else resolve(data);
156
156
  }
157
- _chunk62FBZWGWjs.__name.call(void 0, listener, "listener");
157
+ _chunkM5HGFUCVjs.__name.call(void 0, listener, "listener");
158
158
  eventCount++;
159
159
  emitter.once(id, listener);
160
160
  });
@@ -164,7 +164,7 @@ async function createClient(controllers, opts = {}) {
164
164
  }
165
165
  return ret;
166
166
  }
167
- _chunk62FBZWGWjs.__name.call(void 0, createClient, "createClient");
167
+ _chunkM5HGFUCVjs.__name.call(void 0, createClient, "createClient");
168
168
 
169
169
 
170
170
 
@@ -4,10 +4,10 @@ import {
4
4
  createControllerMetaMap,
5
5
  detectAopDep,
6
6
  genClientQueue
7
- } from "../../chunk-3C7Z3IJN.mjs";
7
+ } from "../../chunk-IRXNF6ZE.mjs";
8
8
  import {
9
9
  __name
10
- } from "../../chunk-KSDE5G57.mjs";
10
+ } from "../../chunk-C5BVKEGW.mjs";
11
11
 
12
12
  // src/rpc/bullmq/create.ts
13
13
  import { Queue, Worker } from "bullmq";
@@ -3,10 +3,10 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkJF4YU32Ejs = require('../../chunk-JF4YU32E.js');
6
+ var _chunkMENRZSGWjs = require('../../chunk-MENRZSGW.js');
7
7
 
8
8
 
9
- var _chunk62FBZWGWjs = require('../../chunk-62FBZWGW.js');
9
+ var _chunkM5HGFUCVjs = require('../../chunk-M5HGFUCV.js');
10
10
 
11
11
  // src/rpc/kafka/bind.ts
12
12
  var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
@@ -14,18 +14,18 @@ var debug = _debug2.default.call(void 0, "phecda-server/kafka");
14
14
  async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
15
15
  const { globalGuards, globalFilter, globalPipe, globalAddons = [], defaultQueue } = opts;
16
16
  const existQueue = /* @__PURE__ */ new Set();
17
- const metaMap = _chunkJF4YU32Ejs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const metaMap = _chunkMENRZSGWjs.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
- _chunkJF4YU32Ejs.detectAopDep.call(void 0, meta, {
24
+ _chunkMENRZSGWjs.detectAopDep.call(void 0, meta, {
25
25
  guards: globalGuards,
26
26
  addons: globalAddons
27
27
  }, "rpc");
28
- _chunkJF4YU32Ejs.Context.applyAddons(globalAddons, {
28
+ _chunkMENRZSGWjs.Context.applyAddons(globalAddons, {
29
29
  consumer,
30
30
  producer
31
31
  }, "kafka");
@@ -47,10 +47,10 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
47
47
  }
48
48
  }
49
49
  }
50
- _chunk62FBZWGWjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
50
+ _chunkM5HGFUCVjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
51
51
  await subscribeQueues();
52
52
  await consumer.run({
53
- eachMessage: /* @__PURE__ */ _chunk62FBZWGWjs.__name.call(void 0, async ({ message, partition, topic, heartbeat, pause }) => {
53
+ eachMessage: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, async ({ message, partition, topic, heartbeat, pause }) => {
54
54
  if (!existQueue.has(topic)) return;
55
55
  const data = JSON.parse(message.value.toString());
56
56
  const { tag, func, id, queue: clientQueue, _ps, args } = data;
@@ -59,12 +59,12 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
59
59
  const meta2 = metaMap.get(tag)[func];
60
60
  const { data: { rpc } } = meta2;
61
61
  const isEvent = rpc.isEvent;
62
- const aop = _chunkJF4YU32Ejs.Context.getAop(meta2, {
62
+ const aop = _chunkMENRZSGWjs.Context.getAop(meta2, {
63
63
  globalFilter,
64
64
  globalGuards,
65
65
  globalPipe
66
66
  });
67
- const context = new (0, _chunkJF4YU32Ejs.Context)({
67
+ const context = new (0, _chunkMENRZSGWjs.Context)({
68
68
  type: "kafka",
69
69
  category: "rpc",
70
70
  moduleMap,
@@ -113,7 +113,7 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
113
113
  }, "eachMessage")
114
114
  });
115
115
  }
116
- _chunk62FBZWGWjs.__name.call(void 0, bind, "bind");
116
+ _chunkM5HGFUCVjs.__name.call(void 0, bind, "bind");
117
117
 
118
118
  // src/rpc/kafka/client.ts
119
119
  var _events = require('events');
@@ -122,7 +122,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
122
122
  let eventCount = 1;
123
123
  const ret = {};
124
124
  const emitter = new (0, _events.EventEmitter)();
125
- const clientQueue = _chunkJF4YU32Ejs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
125
+ const clientQueue = _chunkMENRZSGWjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
126
126
  await consumer.subscribe({
127
127
  topic: clientQueue,
128
128
  fromBeginning: true
@@ -172,7 +172,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
172
172
  if (error) reject(data);
173
173
  else resolve(data);
174
174
  }
175
- _chunk62FBZWGWjs.__name.call(void 0, listener, "listener");
175
+ _chunkM5HGFUCVjs.__name.call(void 0, listener, "listener");
176
176
  eventCount++;
177
177
  emitter.once(id, listener);
178
178
  });
@@ -181,7 +181,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
181
181
  });
182
182
  }
183
183
  await consumer.run({
184
- eachMessage: /* @__PURE__ */ _chunk62FBZWGWjs.__name.call(void 0, async ({ message, topic }) => {
184
+ eachMessage: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, async ({ message, topic }) => {
185
185
  if (clientQueue === topic && message.value) {
186
186
  const { data, id, error } = JSON.parse(message.value.toString());
187
187
  emitter.emit(id, data, error);
@@ -190,7 +190,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
190
190
  });
191
191
  return ret;
192
192
  }
193
- _chunk62FBZWGWjs.__name.call(void 0, createClient, "createClient");
193
+ _chunkM5HGFUCVjs.__name.call(void 0, createClient, "createClient");
194
194
 
195
195
 
196
196
 
@@ -3,10 +3,10 @@ import {
3
3
  createControllerMetaMap,
4
4
  detectAopDep,
5
5
  genClientQueue
6
- } from "../../chunk-3C7Z3IJN.mjs";
6
+ } from "../../chunk-IRXNF6ZE.mjs";
7
7
  import {
8
8
  __name
9
- } from "../../chunk-KSDE5G57.mjs";
9
+ } from "../../chunk-C5BVKEGW.mjs";
10
10
 
11
11
  // src/rpc/kafka/bind.ts
12
12
  import Debug from "debug";
@@ -3,10 +3,10 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkJF4YU32Ejs = require('../../chunk-JF4YU32E.js');
6
+ var _chunkMENRZSGWjs = require('../../chunk-MENRZSGW.js');
7
7
 
8
8
 
9
- var _chunk62FBZWGWjs = require('../../chunk-62FBZWGW.js');
9
+ var _chunkM5HGFUCVjs = require('../../chunk-M5HGFUCV.js');
10
10
 
11
11
  // src/rpc/nats/bind.ts
12
12
  var _nats = require('nats');
@@ -17,18 +17,18 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
17
17
  const sc = _nats.StringCodec.call(void 0, );
18
18
  const subscriptionMap = {};
19
19
  const existQueue = /* @__PURE__ */ new Set();
20
- const metaMap = _chunkJF4YU32Ejs.createControllerMetaMap.call(void 0, meta, (meta2) => {
20
+ const metaMap = _chunkMENRZSGWjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
21
  const { controller, rpc, func, tag } = meta2.data;
22
22
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _2 => _2.queue]) !== void 0) {
23
23
  debug(`register method "${func}" in module "${tag}"`);
24
24
  return true;
25
25
  }
26
26
  });
27
- _chunkJF4YU32Ejs.detectAopDep.call(void 0, meta, {
27
+ _chunkMENRZSGWjs.detectAopDep.call(void 0, meta, {
28
28
  addons: globalAddons,
29
29
  guards: globalGuards
30
30
  }, "rpc");
31
- _chunkJF4YU32Ejs.Context.applyAddons(globalAddons, nc, "nats");
31
+ _chunkMENRZSGWjs.Context.applyAddons(globalAddons, nc, "nats");
32
32
  async function subscribeQueues() {
33
33
  existQueue.clear();
34
34
  for (const [tag, record] of metaMap) {
@@ -47,7 +47,7 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
47
47
  }
48
48
  }
49
49
  }
50
- _chunk62FBZWGWjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
50
+ _chunkM5HGFUCVjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
51
51
  async function handleRequest(_, msg) {
52
52
  const data = JSON.parse(sc.decode(msg.data));
53
53
  const { tag, func, id, _ps, args } = data;
@@ -56,12 +56,12 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
56
56
  const meta2 = metaMap.get(tag)[func];
57
57
  const { data: { rpc: { isEvent } = {} } } = meta2;
58
58
  if (isEvent) msg.respond("{}");
59
- const aop = _chunkJF4YU32Ejs.Context.getAop(meta2, {
59
+ const aop = _chunkMENRZSGWjs.Context.getAop(meta2, {
60
60
  globalFilter,
61
61
  globalGuards,
62
62
  globalPipe
63
63
  });
64
- const context = new (0, _chunkJF4YU32Ejs.Context)({
64
+ const context = new (0, _chunkMENRZSGWjs.Context)({
65
65
  type: "nats",
66
66
  category: "rpc",
67
67
  moduleMap,
@@ -88,14 +88,14 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
88
88
  })));
89
89
  });
90
90
  }
91
- _chunk62FBZWGWjs.__name.call(void 0, handleRequest, "handleRequest");
91
+ _chunkM5HGFUCVjs.__name.call(void 0, handleRequest, "handleRequest");
92
92
  subscribeQueues();
93
- _chunkJF4YU32Ejs.HMR.call(void 0, async () => {
93
+ _chunkMENRZSGWjs.HMR.call(void 0, async () => {
94
94
  for (const i in subscriptionMap) subscriptionMap[i].unsubscribe();
95
95
  await subscribeQueues();
96
96
  });
97
97
  }
98
- _chunk62FBZWGWjs.__name.call(void 0, bind, "bind");
98
+ _chunkM5HGFUCVjs.__name.call(void 0, bind, "bind");
99
99
 
100
100
  // src/rpc/nats/client.ts
101
101
 
@@ -145,7 +145,7 @@ async function createClient(nc, controllers, opts) {
145
145
  if (error) reject(data);
146
146
  else resolve(data);
147
147
  }
148
- _chunk62FBZWGWjs.__name.call(void 0, handler, "handler");
148
+ _chunkM5HGFUCVjs.__name.call(void 0, handler, "handler");
149
149
  eventCount++;
150
150
  });
151
151
  };
@@ -154,7 +154,7 @@ async function createClient(nc, controllers, opts) {
154
154
  }
155
155
  return ret;
156
156
  }
157
- _chunk62FBZWGWjs.__name.call(void 0, createClient, "createClient");
157
+ _chunkM5HGFUCVjs.__name.call(void 0, createClient, "createClient");
158
158
 
159
159
 
160
160