phecda-server 8.1.0 → 8.3.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 (50) hide show
  1. package/bin/cli.mjs +17 -2
  2. package/dist/{chunk-UYZSUBX4.js → chunk-C424F7TV.js} +27 -27
  3. package/dist/{chunk-NQ55PA2X.mjs → chunk-JRNXLEAU.mjs} +2 -2
  4. package/dist/{chunk-FI5756JX.mjs → chunk-LYLSA56Y.mjs} +1 -1
  5. package/dist/{chunk-4LLLQOMF.js → chunk-OUQM7GZH.js} +2 -2
  6. package/dist/{chunk-HKN3AAB2.js → chunk-R73A7HS3.js} +90 -88
  7. package/dist/{chunk-OLNN4U3O.js → chunk-SRPCXPAQ.js} +20 -20
  8. package/dist/{chunk-BLLRB5DQ.mjs → chunk-US2DTB3Z.mjs} +37 -35
  9. package/dist/{chunk-PFPOEZHH.mjs → chunk-YDJAOLT2.mjs} +1 -1
  10. package/dist/helper.js +3 -3
  11. package/dist/helper.mjs +2 -2
  12. package/dist/http/elysia/index.d.mts +3 -3
  13. package/dist/http/elysia/index.d.ts +3 -3
  14. package/dist/http/elysia/index.js +40 -40
  15. package/dist/http/elysia/index.mjs +3 -3
  16. package/dist/http/express/index.js +37 -37
  17. package/dist/http/express/index.mjs +2 -2
  18. package/dist/http/fastify/index.js +38 -38
  19. package/dist/http/fastify/index.mjs +3 -3
  20. package/dist/http/h3/index.js +38 -38
  21. package/dist/http/h3/index.mjs +2 -2
  22. package/dist/http/hono/index.js +34 -34
  23. package/dist/http/hono/index.mjs +2 -2
  24. package/dist/http/hyper-express/index.js +35 -35
  25. package/dist/http/hyper-express/index.mjs +2 -2
  26. package/dist/http/koa/index.js +37 -37
  27. package/dist/http/koa/index.mjs +2 -2
  28. package/dist/index.d.mts +21 -18
  29. package/dist/index.d.ts +21 -18
  30. package/dist/index.js +46 -44
  31. package/dist/index.mjs +6 -4
  32. package/dist/rpc/bullmq/index.js +11 -11
  33. package/dist/rpc/bullmq/index.mjs +2 -2
  34. package/dist/rpc/electron/index.js +8 -8
  35. package/dist/rpc/electron/index.mjs +2 -2
  36. package/dist/rpc/kafka/index.js +10 -10
  37. package/dist/rpc/kafka/index.mjs +2 -2
  38. package/dist/rpc/nats/index.js +11 -11
  39. package/dist/rpc/nats/index.mjs +2 -2
  40. package/dist/rpc/rabbitmq/index.js +12 -12
  41. package/dist/rpc/rabbitmq/index.mjs +2 -2
  42. package/dist/rpc/redis/index.js +10 -10
  43. package/dist/rpc/redis/index.mjs +2 -2
  44. package/dist/rpc/ws/index.js +7 -7
  45. package/dist/rpc/ws/index.mjs +2 -2
  46. package/dist/test.js +6 -6
  47. package/dist/test.mjs +2 -2
  48. package/package.json +31 -31
  49. package/register/utils.mjs +1 -10
  50. package/register/export.mjs +0 -39
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
 
10
- var _chunk4LLLQOMFjs = require('./chunk-4LLLQOMF.js');
10
+ var _chunkOUQM7GZHjs = require('./chunk-OUQM7GZH.js');
11
11
 
12
12
  // src/helper.ts
13
13
  var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
@@ -22,20 +22,21 @@ var _phecdacore = require('phecda-core');
22
22
  // src/exception/base.ts
23
23
  var Exception = class extends Error {
24
24
  static {
25
- _chunk4LLLQOMFjs.__name.call(void 0, this, "Exception");
25
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "Exception");
26
26
  }
27
27
 
28
28
 
29
29
 
30
- constructor(message, status = 0, description = "Exception") {
31
- super(message), this.message = message, this.status = status, this.description = description;
30
+
31
+ constructor(message, metadata, status = 0, description = "Exception") {
32
+ super(message), this.message = message, this.metadata = metadata, this.status = status, this.description = description;
32
33
  }
33
34
  get data() {
34
35
  return {
35
36
  message: this.message,
36
37
  description: this.description,
37
38
  status: this.status,
38
- [_chunk4LLLQOMFjs.ERROR_SYMBOL]: true
39
+ [_chunkOUQM7GZHjs.ERROR_SYMBOL]: true
39
40
  };
40
41
  }
41
42
  };
@@ -43,165 +44,165 @@ var Exception = class extends Error {
43
44
  // src/exception/undefine.ts
44
45
  var UndefinedException = class extends Exception {
45
46
  static {
46
- _chunk4LLLQOMFjs.__name.call(void 0, this, "UndefinedException");
47
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "UndefinedException");
47
48
  }
48
- constructor(message) {
49
- super(message, 500, "Undefined error");
49
+ constructor(message, metadata) {
50
+ super(message, metadata, 500, "Undefined error");
50
51
  }
51
52
  };
52
53
 
53
54
  // src/exception/validate.ts
54
55
  var ValidateException = class extends Exception {
55
56
  static {
56
- _chunk4LLLQOMFjs.__name.call(void 0, this, "ValidateException");
57
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "ValidateException");
57
58
  }
58
- constructor(message) {
59
- super(message, 400, "Validate exception");
59
+ constructor(message, metadata) {
60
+ super(message, metadata, 400, "Validate exception");
60
61
  }
61
62
  };
62
63
 
63
64
  // src/exception/forbidden.ts
64
65
  var ForbiddenException = class extends Exception {
65
66
  static {
66
- _chunk4LLLQOMFjs.__name.call(void 0, this, "ForbiddenException");
67
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "ForbiddenException");
67
68
  }
68
- constructor(message) {
69
- super(message, 403, "Forbidden resource");
69
+ constructor(message, metadata) {
70
+ super(message, metadata, 403, "Forbidden resource");
70
71
  }
71
72
  };
72
73
 
73
74
  // src/exception/bad-request.ts
74
75
  var BadRequestException = class extends Exception {
75
76
  static {
76
- _chunk4LLLQOMFjs.__name.call(void 0, this, "BadRequestException");
77
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "BadRequestException");
77
78
  }
78
- constructor(message) {
79
- super(message, 400, "Bad Request");
79
+ constructor(message, metadata) {
80
+ super(message, metadata, 400, "Bad Request");
80
81
  }
81
82
  };
82
83
 
83
84
  // src/exception/not-found.ts
84
85
  var NotFoundException = class extends Exception {
85
86
  static {
86
- _chunk4LLLQOMFjs.__name.call(void 0, this, "NotFoundException");
87
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "NotFoundException");
87
88
  }
88
- constructor(message) {
89
- super(message, 404, "Not Found");
89
+ constructor(message, metadata) {
90
+ super(message, metadata, 404, "Not Found");
90
91
  }
91
92
  };
92
93
 
93
94
  // src/exception/conflict.ts
94
95
  var ConflictException = class extends Exception {
95
96
  static {
96
- _chunk4LLLQOMFjs.__name.call(void 0, this, "ConflictException");
97
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "ConflictException");
97
98
  }
98
- constructor(message) {
99
- super(message, 409, "Conflict");
99
+ constructor(message, metadata) {
100
+ super(message, metadata, 409, "Conflict");
100
101
  }
101
102
  };
102
103
 
103
104
  // src/exception/bad-gateway.ts
104
105
  var BadGatewayException = class extends Exception {
105
106
  static {
106
- _chunk4LLLQOMFjs.__name.call(void 0, this, "BadGatewayException");
107
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "BadGatewayException");
107
108
  }
108
- constructor(message) {
109
- super(message, 502, "Bad Gatrway");
109
+ constructor(message, metadata) {
110
+ super(message, metadata, 502, "Bad Gatrway");
110
111
  }
111
112
  };
112
113
 
113
114
  // src/exception/invalid-input.ts
114
115
  var InvalidInputException = class extends Exception {
115
116
  static {
116
- _chunk4LLLQOMFjs.__name.call(void 0, this, "InvalidInputException");
117
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "InvalidInputException");
117
118
  }
118
- constructor(message) {
119
- super(message, 502, "Invalid Input");
119
+ constructor(message, metadata) {
120
+ super(message, metadata, 502, "Invalid Input");
120
121
  }
121
122
  };
122
123
 
123
124
  // src/exception/media-type.ts
124
125
  var UnsupportedMediaTypeException = class extends Exception {
125
126
  static {
126
- _chunk4LLLQOMFjs.__name.call(void 0, this, "UnsupportedMediaTypeException");
127
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "UnsupportedMediaTypeException");
127
128
  }
128
- constructor(message) {
129
- super(message, 415, "Unsupported Media Type");
129
+ constructor(message, metadata) {
130
+ super(message, metadata, 415, "Unsupported Media Type");
130
131
  }
131
132
  };
132
133
 
133
134
  // src/exception/payload-large.ts
134
135
  var PayloadLargeException = class extends Exception {
135
136
  static {
136
- _chunk4LLLQOMFjs.__name.call(void 0, this, "PayloadLargeException");
137
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "PayloadLargeException");
137
138
  }
138
- constructor(message) {
139
- super(message, 413, "Payload Too Large");
139
+ constructor(message, metadata) {
140
+ super(message, metadata, 413, "Payload Too Large");
140
141
  }
141
142
  };
142
143
 
143
144
  // src/exception/timeout.ts
144
145
  var TimeoutException = class extends Exception {
145
146
  static {
146
- _chunk4LLLQOMFjs.__name.call(void 0, this, "TimeoutException");
147
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "TimeoutException");
147
148
  }
148
- constructor(message) {
149
- super(message, 408, "Request Timeout");
149
+ constructor(message, metadata) {
150
+ super(message, metadata, 408, "Request Timeout");
150
151
  }
151
152
  };
152
153
 
153
154
  // src/exception/unauthorized.ts
154
155
  var UnauthorizedException = class extends Exception {
155
156
  static {
156
- _chunk4LLLQOMFjs.__name.call(void 0, this, "UnauthorizedException");
157
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "UnauthorizedException");
157
158
  }
158
- constructor(message) {
159
- super(message, 401, "Unauthorized");
159
+ constructor(message, metadata) {
160
+ super(message, metadata, 401, "Unauthorized");
160
161
  }
161
162
  };
162
163
 
163
164
  // src/exception/unavailable-service.ts
164
165
  var ServiceUnavailableException = class extends Exception {
165
166
  static {
166
- _chunk4LLLQOMFjs.__name.call(void 0, this, "ServiceUnavailableException");
167
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "ServiceUnavailableException");
167
168
  }
168
- constructor(message) {
169
- super(message, 503, "Service Unavailable");
169
+ constructor(message, metadata) {
170
+ super(message, metadata, 503, "Service Unavailable");
170
171
  }
171
172
  };
172
173
 
173
174
  // src/exception/framework.ts
174
175
  var FrameworkException = class extends Exception {
175
176
  static {
176
- _chunk4LLLQOMFjs.__name.call(void 0, this, "FrameworkException");
177
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "FrameworkException");
177
178
  }
178
- constructor(message) {
179
- super(`[phecda-server] ${message}`, 500, "Framework Error");
179
+ constructor(message, metadata) {
180
+ super(`[phecda-server] ${message}`, metadata, 500, "Framework Error");
180
181
  }
181
182
  };
182
183
 
183
184
  // src/exception/timer.ts
184
185
  var TimerException = class extends Exception {
185
186
  static {
186
- _chunk4LLLQOMFjs.__name.call(void 0, this, "TimerException");
187
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "TimerException");
187
188
  }
188
- constructor(message) {
189
- super(message, 0, "Timer Error");
189
+ constructor(message, metadata) {
190
+ super(message, metadata, 0, "Timer Error");
190
191
  }
191
192
  };
192
193
 
193
194
  // src/exception/worker.ts
194
195
  var WorkerException = class extends Exception {
195
196
  static {
196
- _chunk4LLLQOMFjs.__name.call(void 0, this, "WorkerException");
197
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "WorkerException");
197
198
  }
198
- constructor(message) {
199
- super(message, 0, "Worker Error");
199
+ constructor(message, metadata) {
200
+ super(message, metadata, 0, "Worker Error");
200
201
  }
201
202
  };
202
203
 
203
204
  // src/pipe.ts
204
- var defaultPipe = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, async ({ arg, reflect, meta, index, type }, { method }) => {
205
+ var defaultPipe = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, async ({ arg, reflect, meta, index, type }, { method }) => {
205
206
  if (meta.const) {
206
207
  if (arg !== meta.const) throw new ValidateException(`param ${index + 1} must be ${meta.const}`);
207
208
  }
@@ -285,14 +286,14 @@ var defaultPipe = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, async ({
285
286
  }, "defaultPipe");
286
287
 
287
288
  // src/filter.ts
288
- var defaultFilter = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (e) => {
289
+ var defaultFilter = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (e) => {
289
290
  if (!(e instanceof Exception)) {
290
- _chunk4LLLQOMFjs.log.call(void 0, e.message, "error");
291
- if (_chunk4LLLQOMFjs.LOG_LEVEL <= 0) console.error(e.stack);
291
+ _chunkOUQM7GZHjs.log.call(void 0, e.message, "error");
292
+ if (_chunkOUQM7GZHjs.LOG_LEVEL <= 0) console.error(e.stack);
292
293
  e = new UndefinedException(e.message || e);
293
294
  } else {
294
- _chunk4LLLQOMFjs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
295
- if (_chunk4LLLQOMFjs.LOG_LEVEL <= 0) console.error(e.stack);
295
+ _chunkOUQM7GZHjs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
296
+ if (_chunkOUQM7GZHjs.LOG_LEVEL <= 0) console.error(e.stack);
296
297
  }
297
298
  return e.data;
298
299
  }, "defaultFilter");
@@ -301,7 +302,7 @@ var defaultFilter = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (e) =>
301
302
  var debug = _debug2.default.call(void 0, "phecda-server(Context)");
302
303
  var Context = (_class = class _Context {
303
304
  static {
304
- _chunk4LLLQOMFjs.__name.call(void 0, this, "Context");
305
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "Context");
305
306
  }
306
307
 
307
308
 
@@ -318,11 +319,11 @@ var Context = (_class = class _Context {
318
319
  // protected canGetCtx = true
319
320
  constructor(data) {
320
321
  this.data = data;
321
- if (_chunk4LLLQOMFjs.IS_DEV)
322
+ if (_chunkOUQM7GZHjs.IS_DEV)
322
323
  data._context = this;
323
324
  this.ctx = new Proxy(data, {
324
325
  get(target, p) {
325
- if (!(p in target)) _chunk4LLLQOMFjs.log.call(void 0, `attribute "${p}" does not exist on ctx, which might be due to a missing AOP role (such as a guard).`, "warn", data.tag);
326
+ if (!(p in target)) _chunkOUQM7GZHjs.log.call(void 0, `attribute "${p}" does not exist on ctx, which might be due to a missing AOP role (such as a guard).`, "warn", data.tag);
326
327
  return target[p];
327
328
  },
328
329
  set(target, p, newValue) {
@@ -360,7 +361,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
360
361
  const { paramsType, data: { ctxs, tag, params, method } } = meta;
361
362
  try {
362
363
  let res;
363
- const nextHandler = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (index) => {
364
+ const nextHandler = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (index) => {
364
365
  return async () => {
365
366
  if (index === guards.length) {
366
367
  const instance = moduleMap.get(tag);
@@ -384,7 +385,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
384
385
  return res;
385
386
  });
386
387
  }
387
- _chunk4LLLQOMFjs.__name.call(void 0, next, "next");
388
+ _chunkOUQM7GZHjs.__name.call(void 0, next, "next");
388
389
  const ret = await guards[index](this.ctx, next);
389
390
  if (ret !== void 0) {
390
391
  res = ret;
@@ -429,12 +430,12 @@ function addPipe(key, pipe) {
429
430
  if (Context.pipeRecord[key] && Context.pipeRecord[key] !== pipe) debug(`overwrite Pipe "${String(key)}"`, "warn");
430
431
  Context.pipeRecord[key] = pipe;
431
432
  }
432
- _chunk4LLLQOMFjs.__name.call(void 0, addPipe, "addPipe");
433
+ _chunkOUQM7GZHjs.__name.call(void 0, addPipe, "addPipe");
433
434
  function addFilter(key, filter) {
434
435
  if (Context.filterRecord[key] && Context.filterRecord[key] !== filter) debug(`overwrite Filter "${String(key)}"`, "warn");
435
436
  Context.filterRecord[key] = filter;
436
437
  }
437
- _chunk4LLLQOMFjs.__name.call(void 0, addFilter, "addFilter");
438
+ _chunkOUQM7GZHjs.__name.call(void 0, addFilter, "addFilter");
438
439
  function addGuard(key, guard, priority = 0) {
439
440
  if (Context.guardRecord[key] && Context.guardRecord[key].value !== guard) debug(`overwrite Guard "${String(key)}"`, "warn");
440
441
  Context.guardRecord[key] = {
@@ -442,7 +443,7 @@ function addGuard(key, guard, priority = 0) {
442
443
  priority
443
444
  };
444
445
  }
445
- _chunk4LLLQOMFjs.__name.call(void 0, addGuard, "addGuard");
446
+ _chunkOUQM7GZHjs.__name.call(void 0, addGuard, "addGuard");
446
447
  function addAddon(key, addon, priority = 0) {
447
448
  if (Context.addonRecord[key] && Context.addonRecord[key].value !== addon) debug(`overwrite Addon "${String(key)}"`, "warn");
448
449
  Context.addonRecord[key] = {
@@ -450,14 +451,14 @@ function addAddon(key, addon, priority = 0) {
450
451
  priority
451
452
  };
452
453
  }
453
- _chunk4LLLQOMFjs.__name.call(void 0, addAddon, "addAddon");
454
+ _chunkOUQM7GZHjs.__name.call(void 0, addAddon, "addAddon");
454
455
 
455
456
  // src/http/helper.ts
456
457
  function resolveDep(ret, key) {
457
458
  if (key) return _optionalChain([ret, 'optionalAccess', _ => _[key]]);
458
459
  return ret;
459
460
  }
460
- _chunk4LLLQOMFjs.__name.call(void 0, resolveDep, "resolveDep");
461
+ _chunkOUQM7GZHjs.__name.call(void 0, resolveDep, "resolveDep");
461
462
 
462
463
  // src/decorators/helper.ts
463
464
  function shallowClone(obj) {
@@ -465,11 +466,11 @@ function shallowClone(obj) {
465
466
  ...obj
466
467
  };
467
468
  }
468
- _chunk4LLLQOMFjs.__name.call(void 0, shallowClone, "shallowClone");
469
+ _chunkOUQM7GZHjs.__name.call(void 0, shallowClone, "shallowClone");
469
470
  function mergeObject(...args) {
470
471
  return Object.assign({}, ...args);
471
472
  }
472
- _chunk4LLLQOMFjs.__name.call(void 0, mergeObject, "mergeObject");
473
+ _chunkOUQM7GZHjs.__name.call(void 0, mergeObject, "mergeObject");
473
474
 
474
475
  // src/helper.ts
475
476
  function createControllerMetaMap(meta, filter) {
@@ -485,14 +486,14 @@ function createControllerMetaMap(meta, filter) {
485
486
  });
486
487
  }
487
488
  }
488
- _chunk4LLLQOMFjs.__name.call(void 0, handleMeta, "handleMeta");
489
+ _chunkOUQM7GZHjs.__name.call(void 0, handleMeta, "handleMeta");
489
490
  handleMeta();
490
- _chunk4LLLQOMFjs.HMR.call(void 0, handleMeta);
491
+ _chunkOUQM7GZHjs.HMR.call(void 0, handleMeta);
491
492
  return metaMap;
492
493
  }
493
- _chunk4LLLQOMFjs.__name.call(void 0, createControllerMetaMap, "createControllerMetaMap");
494
+ _chunkOUQM7GZHjs.__name.call(void 0, createControllerMetaMap, "createControllerMetaMap");
494
495
  function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
495
- if (_chunk4LLLQOMFjs.IS_PURE) return;
496
+ if (_chunkOUQM7GZHjs.IS_PURE) return;
496
497
  const addonSet = /* @__PURE__ */ new Set();
497
498
  const guardSet = /* @__PURE__ */ new Set();
498
499
  const pipeSet = /* @__PURE__ */ new Set();
@@ -537,34 +538,34 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
537
538
  ...filterSet
538
539
  ].filter((i) => !Context.filterRecord[i]);
539
540
  function exit() {
540
- if (_chunk4LLLQOMFjs.IS_STRICT) {
541
- _chunk4LLLQOMFjs.log.call(void 0, "Does not meet strict mode requirements", "error");
541
+ if (_chunkOUQM7GZHjs.IS_STRICT) {
542
+ _chunkOUQM7GZHjs.log.call(void 0, "Does not meet strict mode requirements", "error");
542
543
  process.exit(1);
543
544
  }
544
545
  }
545
- _chunk4LLLQOMFjs.__name.call(void 0, exit, "exit");
546
+ _chunkOUQM7GZHjs.__name.call(void 0, exit, "exit");
546
547
  if (missAddons.length) {
547
- _chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.white(`Addon [${missAddons.join(",")}]`)} doesn't exist`, "warn");
548
+ _chunkOUQM7GZHjs.log.call(void 0, `${_picocolors2.default.white(`Addon [${missAddons.join(",")}]`)} doesn't exist`, "warn");
548
549
  exit();
549
550
  }
550
551
  if (missGuards.length) {
551
- _chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
552
+ _chunkOUQM7GZHjs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
552
553
  exit();
553
554
  }
554
555
  if (missPipes.length) {
555
- _chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
556
+ _chunkOUQM7GZHjs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
556
557
  exit();
557
558
  }
558
559
  if (missFilters.length) {
559
- _chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
560
+ _chunkOUQM7GZHjs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
560
561
  exit();
561
562
  }
562
- warningSet.forEach((warn) => _chunk4LLLQOMFjs.log.call(void 0, warn, "warn"));
563
+ warningSet.forEach((warn) => _chunkOUQM7GZHjs.log.call(void 0, warn, "warn"));
563
564
  if (warningSet.size) exit();
564
565
  }
565
- _chunk4LLLQOMFjs.__name.call(void 0, handleMeta, "handleMeta");
566
+ _chunkOUQM7GZHjs.__name.call(void 0, handleMeta, "handleMeta");
566
567
  handleMeta();
567
- _chunk4LLLQOMFjs.HMR.call(void 0, handleMeta);
568
+ _chunkOUQM7GZHjs.HMR.call(void 0, handleMeta);
568
569
  return {
569
570
  addonSet,
570
571
  guardSet,
@@ -572,7 +573,7 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
572
573
  filterSet
573
574
  };
574
575
  }
575
- _chunk4LLLQOMFjs.__name.call(void 0, detectAopDep, "detectAopDep");
576
+ _chunkOUQM7GZHjs.__name.call(void 0, detectAopDep, "detectAopDep");
576
577
  function joinUrl(base, ...paths) {
577
578
  const joinedPath = [
578
579
  base,
@@ -580,7 +581,8 @@ function joinUrl(base, ...paths) {
580
581
  ].filter((p) => p).map((path) => path.replace(/(^\/)/g, "")).join("/");
581
582
  return `/${joinedPath}`;
582
583
  }
583
- _chunk4LLLQOMFjs.__name.call(void 0, joinUrl, "joinUrl");
584
+ _chunkOUQM7GZHjs.__name.call(void 0, joinUrl, "joinUrl");
585
+
584
586
 
585
587
 
586
588
 
@@ -612,4 +614,4 @@ _chunk4LLLQOMFjs.__name.call(void 0, joinUrl, "joinUrl");
612
614
 
613
615
 
614
616
 
615
- exports.Exception = Exception; exports.UndefinedException = UndefinedException; exports.ValidateException = ValidateException; exports.ForbiddenException = ForbiddenException; exports.BadRequestException = BadRequestException; exports.NotFoundException = NotFoundException; exports.ConflictException = ConflictException; exports.BadGatewayException = BadGatewayException; exports.InvalidInputException = InvalidInputException; exports.UnsupportedMediaTypeException = UnsupportedMediaTypeException; exports.PayloadLargeException = PayloadLargeException; exports.TimeoutException = TimeoutException; exports.UnauthorizedException = UnauthorizedException; exports.ServiceUnavailableException = ServiceUnavailableException; exports.FrameworkException = FrameworkException; exports.TimerException = TimerException; exports.WorkerException = WorkerException; exports.defaultPipe = defaultPipe; exports.Context = Context; exports.addPipe = addPipe; exports.addFilter = addFilter; exports.addGuard = addGuard; exports.addAddon = addAddon; exports.resolveDep = resolveDep; exports.shallowClone = shallowClone; exports.mergeObject = mergeObject; exports.createControllerMetaMap = createControllerMetaMap; exports.detectAopDep = detectAopDep; exports.joinUrl = joinUrl;
617
+ exports.Exception = Exception; exports.UndefinedException = UndefinedException; exports.ValidateException = ValidateException; exports.ForbiddenException = ForbiddenException; exports.BadRequestException = BadRequestException; exports.NotFoundException = NotFoundException; exports.ConflictException = ConflictException; exports.BadGatewayException = BadGatewayException; exports.InvalidInputException = InvalidInputException; exports.UnsupportedMediaTypeException = UnsupportedMediaTypeException; exports.PayloadLargeException = PayloadLargeException; exports.TimeoutException = TimeoutException; exports.UnauthorizedException = UnauthorizedException; exports.ServiceUnavailableException = ServiceUnavailableException; exports.FrameworkException = FrameworkException; exports.TimerException = TimerException; exports.WorkerException = WorkerException; exports.defaultPipe = defaultPipe; exports.defaultFilter = defaultFilter; exports.Context = Context; exports.addPipe = addPipe; exports.addFilter = addFilter; exports.addGuard = addGuard; exports.addAddon = addAddon; exports.resolveDep = resolveDep; exports.shallowClone = shallowClone; exports.mergeObject = mergeObject; exports.createControllerMetaMap = createControllerMetaMap; exports.detectAopDep = detectAopDep; exports.joinUrl = joinUrl;
@@ -4,12 +4,12 @@
4
4
 
5
5
 
6
6
 
7
- var _chunk4LLLQOMFjs = require('./chunk-4LLLQOMF.js');
7
+ var _chunkOUQM7GZHjs = require('./chunk-OUQM7GZH.js');
8
8
 
9
9
  // src/meta.ts
10
10
  var Meta = class {
11
11
  static {
12
- _chunk4LLLQOMFjs.__name.call(void 0, this, "Meta");
12
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "Meta");
13
13
  }
14
14
 
15
15
 
@@ -41,11 +41,11 @@ function defaultServerInject() {
41
41
  });
42
42
  }
43
43
  }
44
- _chunk4LLLQOMFjs.__name.call(void 0, defaultServerInject, "defaultServerInject");
44
+ _chunkOUQM7GZHjs.__name.call(void 0, defaultServerInject, "defaultServerInject");
45
45
  var phecdaNamespace = /* @__PURE__ */ new Map();
46
46
  var ServerPhecda = (_class = class {
47
47
  static {
48
- _chunk4LLLQOMFjs.__name.call(void 0, this, "ServerPhecda");
48
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "ServerPhecda");
49
49
  }
50
50
  __init() {this.moduleMap = /* @__PURE__ */ new Map()}
51
51
  __init2() {this.meta = []}
@@ -57,7 +57,7 @@ var ServerPhecda = (_class = class {
57
57
 
58
58
  constructor(options) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);
59
59
  defaultServerInject();
60
- const { namespace = "default", parseModule = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (module) => module, "parseModule"), parseMeta = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (meta) => meta, "parseMeta"), generators = [] } = options;
60
+ const { namespace = "default", parseModule = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (module) => module, "parseModule"), parseMeta = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (meta) => meta, "parseMeta"), generators = [] } = options;
61
61
  phecdaNamespace.set(namespace, this);
62
62
  this.parseMeta = parseMeta;
63
63
  this.parseModule = parseModule;
@@ -67,20 +67,20 @@ var ServerPhecda = (_class = class {
67
67
  for (const model of models) await this.buildDepModule(model);
68
68
  this.hmr();
69
69
  this.generateCode().then(() => {
70
- if (_chunk4LLLQOMFjs.IS_ONLY_GENERATE) {
71
- _chunk4LLLQOMFjs.log.call(void 0, "Only generate code");
72
- process.exit(_chunk4LLLQOMFjs.PS_EXIT_CODE.EXIT);
70
+ if (_chunkOUQM7GZHjs.IS_ONLY_GENERATE) {
71
+ _chunkOUQM7GZHjs.log.call(void 0, "Only generate code");
72
+ process.exit(_chunkOUQM7GZHjs.PS_EXIT_CODE.EXIT);
73
73
  }
74
74
  });
75
75
  }
76
- __init6() {this.generateCode = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, async () => {
76
+ __init6() {this.generateCode = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, async () => {
77
77
  return Promise.all(this.generators.map((generator) => {
78
78
  debug(`generate "${generator.name}" code to ${generator.path}`);
79
79
  return generator.output(this.meta);
80
80
  }));
81
81
  }, "generateCode")}
82
82
  hmr() {
83
- _chunk4LLLQOMFjs.HMR.call(void 0, async (oldModels, newModels) => {
83
+ _chunkOUQM7GZHjs.HMR.call(void 0, async (oldModels, newModels) => {
84
84
  debug("reload models ");
85
85
  await this.replace(oldModels, newModels);
86
86
  this.generateCode();
@@ -122,7 +122,7 @@ var ServerPhecda = (_class = class {
122
122
  if (this.moduleMap.has(tag)) {
123
123
  module = this.moduleMap.get(tag);
124
124
  if (!module) {
125
- _chunk4LLLQOMFjs.log.call(void 0, `Exist Circular-Dependency or Multiple modules with the same tag [${String(tag)}]`, "warn");
125
+ _chunkOUQM7GZHjs.log.call(void 0, `Exist Circular-Dependency or Multiple modules with the same tag [${String(tag)}]`, "warn");
126
126
  return {
127
127
  module: this.createProxyModule(tag),
128
128
  tag
@@ -130,8 +130,8 @@ var ServerPhecda = (_class = class {
130
130
  }
131
131
  if (this.modelMap.get(module) !== Model && !this.modelSet.has(Model)) {
132
132
  this.modelSet.add(Model);
133
- if (module instanceof Model) _chunk4LLLQOMFjs.log.call(void 0, `Module taged ${String(tag)} has been overridden`);
134
- else _chunk4LLLQOMFjs.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Model.name}"`, "warn");
133
+ if (module instanceof Model) _chunkOUQM7GZHjs.log.call(void 0, `Module taged ${String(tag)} has been overridden`);
134
+ else _chunkOUQM7GZHjs.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Model.name}"`, "warn");
135
135
  }
136
136
  return {
137
137
  module,
@@ -154,7 +154,7 @@ var ServerPhecda = (_class = class {
154
154
  }
155
155
  this.meta.push(...getMetaFromInstance(module, tag, Model).map(this.parseMeta).filter((item) => !!item));
156
156
  debug(`init module "${String(tag)}"`);
157
- if (!_chunk4LLLQOMFjs.IS_ONLY_GENERATE) await _phecdacore.invokeInit.call(void 0, module);
157
+ if (!_chunkOUQM7GZHjs.IS_ONLY_GENERATE) await _phecdacore.invokeInit.call(void 0, module);
158
158
  debug(`add module "${String(tag)}"`);
159
159
  this.moduleMap.set(tag, module);
160
160
  this.modelMap.set(module, Model);
@@ -216,7 +216,7 @@ async function Factory(models, opts = {}) {
216
216
  await phecda.start(models);
217
217
  return phecda;
218
218
  }
219
- _chunk4LLLQOMFjs.__name.call(void 0, Factory, "Factory");
219
+ _chunkOUQM7GZHjs.__name.call(void 0, Factory, "Factory");
220
220
  function useS(nsOrModel, namespace) {
221
221
  if (!nsOrModel) {
222
222
  namespace = "default";
@@ -229,7 +229,7 @@ function useS(nsOrModel, namespace) {
229
229
  if (nsOrModel && typeof nsOrModel !== "string") return serverPhecda.get(nsOrModel);
230
230
  else return serverPhecda;
231
231
  }
232
- _chunk4LLLQOMFjs.__name.call(void 0, useS, "useS");
232
+ _chunkOUQM7GZHjs.__name.call(void 0, useS, "useS");
233
233
  function getMetaFromInstance(instance, tag, model) {
234
234
  const name = model.name;
235
235
  const propertyKeys = _phecdacore.getMetaKey.call(void 0, instance).filter((item) => typeof item === "string");
@@ -244,7 +244,7 @@ function getMetaFromInstance(instance, tag, model) {
244
244
  method: i
245
245
  };
246
246
  if (baseMeta.controller) {
247
- if (typeof tag !== "string") _chunk4LLLQOMFjs.log.call(void 0, `can't use Tag with ${typeof tag} on controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
247
+ if (typeof tag !== "string") _chunkOUQM7GZHjs.log.call(void 0, `can't use Tag with ${typeof tag} on controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
248
248
  metaData.controller = baseMeta.controller;
249
249
  metaData[baseMeta.controller] = {
250
250
  ...baseMeta[baseMeta.controller],
@@ -286,7 +286,7 @@ function getMetaFromInstance(instance, tag, model) {
286
286
  return new Meta(deepFreeze(metaData), getParamTypes(instance, i) || [], instance, model);
287
287
  });
288
288
  }
289
- _chunk4LLLQOMFjs.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
289
+ _chunkOUQM7GZHjs.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
290
290
  function deepFreeze(object) {
291
291
  Object.freeze(object);
292
292
  Object.getOwnPropertyNames(object).forEach((prop) => {
@@ -294,11 +294,11 @@ function deepFreeze(object) {
294
294
  });
295
295
  return object;
296
296
  }
297
- _chunk4LLLQOMFjs.__name.call(void 0, deepFreeze, "deepFreeze");
297
+ _chunkOUQM7GZHjs.__name.call(void 0, deepFreeze, "deepFreeze");
298
298
  function getParamTypes(Model, key) {
299
299
  return Reflect.getMetadata("design:paramtypes", Model, key);
300
300
  }
301
- _chunk4LLLQOMFjs.__name.call(void 0, getParamTypes, "getParamTypes");
301
+ _chunkOUQM7GZHjs.__name.call(void 0, getParamTypes, "getParamTypes");
302
302
 
303
303
 
304
304