phecda-server 5.0.0-alpha.16 → 5.0.0-alpha.18

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 (37) hide show
  1. package/dist/{chunk-CPTMTSPU.mjs → chunk-EASQZ4RI.mjs} +4 -6
  2. package/dist/{chunk-CRAV4WSB.js → chunk-EVF2CXTP.js} +3 -3
  3. package/dist/{chunk-RQOJIVQM.js → chunk-JQOV7JUD.js} +21 -23
  4. package/dist/{chunk-6FRXLKGA.mjs → chunk-N7GEBDPZ.mjs} +1 -1
  5. package/dist/{chunk-MGHJFKVZ.mjs → chunk-P57NA4BR.mjs} +1 -1
  6. package/dist/{chunk-ONUMVNO7.mjs → chunk-UFSW7A6B.mjs} +3 -3
  7. package/dist/{chunk-VUOACQPJ.js → chunk-XAFRQQNM.js} +52 -52
  8. package/dist/{chunk-T4C6CCWM.js → chunk-XHKBG2VA.js} +3 -3
  9. package/dist/{core-b8dcc009.d.ts → core-eb2a0799.d.ts} +1 -5
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.js +79 -79
  12. package/dist/index.mjs +30 -30
  13. package/dist/rpc/kafka/index.d.ts +1 -1
  14. package/dist/rpc/kafka/index.js +9 -9
  15. package/dist/rpc/kafka/index.mjs +2 -2
  16. package/dist/rpc/rabbitmq/index.d.ts +1 -1
  17. package/dist/rpc/rabbitmq/index.js +9 -9
  18. package/dist/rpc/rabbitmq/index.mjs +2 -2
  19. package/dist/rpc/redis/index.d.ts +1 -1
  20. package/dist/rpc/redis/index.js +9 -9
  21. package/dist/rpc/redis/index.mjs +2 -2
  22. package/dist/server/express/index.d.ts +2 -1
  23. package/dist/server/express/index.js +32 -32
  24. package/dist/server/express/index.mjs +10 -10
  25. package/dist/server/fastify/index.d.ts +1 -1
  26. package/dist/server/fastify/index.js +27 -29
  27. package/dist/server/fastify/index.mjs +5 -7
  28. package/dist/server/h3/index.d.ts +1 -1
  29. package/dist/server/h3/index.js +26 -28
  30. package/dist/server/h3/index.mjs +5 -7
  31. package/dist/server/koa/index.d.ts +2 -1
  32. package/dist/server/koa/index.js +32 -32
  33. package/dist/server/koa/index.mjs +10 -10
  34. package/dist/test.d.ts +1 -1
  35. package/dist/test.js +6 -6
  36. package/dist/test.mjs +2 -2
  37. package/package.json +2 -2
@@ -2,16 +2,14 @@ import {
2
2
  IS_DEV,
3
3
  __name,
4
4
  log
5
- } from "./chunk-ONUMVNO7.mjs";
5
+ } from "./chunk-UFSW7A6B.mjs";
6
6
 
7
7
  // src/meta.ts
8
8
  var Meta = class {
9
9
  data;
10
- handlers;
11
10
  paramsType;
12
- constructor(data, handlers, paramsType) {
11
+ constructor(data, paramsType) {
13
12
  this.data = data;
14
- this.handlers = handlers;
15
13
  this.paramsType = paramsType;
16
14
  }
17
15
  };
@@ -102,7 +100,7 @@ __name(generateHTTPCode, "generateHTTPCode");
102
100
  import "reflect-metadata";
103
101
  import fs from "fs";
104
102
  import EventEmitter from "node:events";
105
- import { Empty, SHARE_KEY, getExposeKey, getHandler, getProperty, getState, getTag, injectProperty, invokeHandler, isPhecda } from "phecda-core";
103
+ import { Empty, SHARE_KEY, getExposeKey, getProperty, getState, getTag, injectProperty, invokeHandler, isPhecda } from "phecda-core";
106
104
  import Debug from "debug";
107
105
  function Injectable() {
108
106
  return (target) => Empty(target);
@@ -313,7 +311,7 @@ function getMetaFromInstance(instance, tag, name) {
313
311
  ...state.interceptors
314
312
  ])
315
313
  ];
316
- return new Meta(meta, getHandler(instance, i), getParamTypes(instance, i) || []);
314
+ return new Meta(meta, getParamTypes(instance, i) || []);
317
315
  });
318
316
  }
319
317
  __name(getMetaFromInstance, "getMetaFromInstance");
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkT4C6CCWMjs = require('./chunk-T4C6CCWM.js');
3
+ var _chunkXHKBG2VAjs = require('./chunk-XHKBG2VA.js');
4
4
 
5
5
  // src/server/helper.ts
6
6
  function resolveDep(ret, key) {
@@ -8,7 +8,7 @@ function resolveDep(ret, key) {
8
8
  return _optionalChain([ret, 'optionalAccess', _ => _[key]]);
9
9
  return ret;
10
10
  }
11
- _chunkT4C6CCWMjs.__name.call(void 0, resolveDep, "resolveDep");
11
+ _chunkXHKBG2VAjs.__name.call(void 0, resolveDep, "resolveDep");
12
12
  function argToReq(params, args, headers) {
13
13
  const req = {
14
14
  body: {},
@@ -24,7 +24,7 @@ function argToReq(params, args, headers) {
24
24
  });
25
25
  return req;
26
26
  }
27
- _chunkT4C6CCWMjs.__name.call(void 0, argToReq, "argToReq");
27
+ _chunkXHKBG2VAjs.__name.call(void 0, argToReq, "argToReq");
28
28
 
29
29
 
30
30
 
@@ -2,23 +2,21 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkT4C6CCWMjs = require('./chunk-T4C6CCWM.js');
5
+ var _chunkXHKBG2VAjs = require('./chunk-XHKBG2VA.js');
6
6
 
7
7
  // src/meta.ts
8
8
  var Meta = class {
9
9
 
10
10
 
11
-
12
- constructor(data, handlers, paramsType) {
11
+ constructor(data, paramsType) {
13
12
  this.data = data;
14
- this.handlers = handlers;
15
13
  this.paramsType = paramsType;
16
14
  }
17
15
  };
18
- _chunkT4C6CCWMjs.__name.call(void 0, Meta, "Meta");
16
+ _chunkXHKBG2VAjs.__name.call(void 0, Meta, "Meta");
19
17
 
20
18
  // src/compiler/rpc.ts
21
- var Compiler = /* @__PURE__ */ _chunkT4C6CCWMjs.__name.call(void 0, (_class =class Compiler2 {
19
+ var Compiler = /* @__PURE__ */ _chunkXHKBG2VAjs.__name.call(void 0, (_class =class Compiler2 {
22
20
  __init() {this.classMap = {}}
23
21
  constructor() {;_class.prototype.__init.call(this);
24
22
  }
@@ -54,10 +52,10 @@ function generateRPCCode(meta) {
54
52
  compiler.addMethod(i);
55
53
  return compiler.getContent();
56
54
  }
57
- _chunkT4C6CCWMjs.__name.call(void 0, generateRPCCode, "generateRPCCode");
55
+ _chunkXHKBG2VAjs.__name.call(void 0, generateRPCCode, "generateRPCCode");
58
56
 
59
57
  // src/compiler/http.ts
60
- var Compiler3 = /* @__PURE__ */ _chunkT4C6CCWMjs.__name.call(void 0, (_class2 =class Compiler4 {
58
+ var Compiler3 = /* @__PURE__ */ _chunkXHKBG2VAjs.__name.call(void 0, (_class2 =class Compiler4 {
61
59
  __init2() {this.classMap = {}}
62
60
  constructor() {;_class2.prototype.__init2.call(this);
63
61
  }
@@ -96,7 +94,7 @@ function generateHTTPCode(meta) {
96
94
  compiler.addMethod(i);
97
95
  return compiler.getContent();
98
96
  }
99
- _chunkT4C6CCWMjs.__name.call(void 0, generateHTTPCode, "generateHTTPCode");
97
+ _chunkXHKBG2VAjs.__name.call(void 0, generateHTTPCode, "generateHTTPCode");
100
98
 
101
99
  // src/core.ts
102
100
  require('reflect-metadata');
@@ -107,7 +105,7 @@ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
107
105
  function Injectable() {
108
106
  return (target) => _phecdacore.Empty.call(void 0, target);
109
107
  }
110
- _chunkT4C6CCWMjs.__name.call(void 0, Injectable, "Injectable");
108
+ _chunkXHKBG2VAjs.__name.call(void 0, Injectable, "Injectable");
111
109
  var debug = _debug2.default.call(void 0, "phecda-server");
112
110
  var emitter = new (0, _events2.default)();
113
111
  async function Factory(Modules, opts = {}) {
@@ -144,13 +142,13 @@ async function Factory(Modules, opts = {}) {
144
142
  }
145
143
  return instance;
146
144
  }
147
- _chunkT4C6CCWMjs.__name.call(void 0, del, "del");
145
+ _chunkXHKBG2VAjs.__name.call(void 0, del, "del");
148
146
  async function destroy() {
149
147
  debug("destroy all");
150
148
  for (const [tag] of moduleMap)
151
149
  await del(tag);
152
150
  }
153
- _chunkT4C6CCWMjs.__name.call(void 0, destroy, "destroy");
151
+ _chunkXHKBG2VAjs.__name.call(void 0, destroy, "destroy");
154
152
  async function add(Module) {
155
153
  const tag = _optionalChain([Module, 'access', _3 => _3.prototype, 'optionalAccess', _4 => _4.__TAG__]) || Module.name;
156
154
  const oldInstance = await del(tag);
@@ -168,7 +166,7 @@ async function Factory(Modules, opts = {}) {
168
166
  });
169
167
  }
170
168
  }
171
- _chunkT4C6CCWMjs.__name.call(void 0, add, "add");
169
+ _chunkXHKBG2VAjs.__name.call(void 0, add, "add");
172
170
  async function buildNestModule(Module) {
173
171
  const paramtypes = getParamTypes(Module);
174
172
  let instance;
@@ -179,7 +177,7 @@ async function Factory(Modules, opts = {}) {
179
177
  throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${String(tag)}--[module] ${Module}`);
180
178
  if (constructorMap.get(tag) !== Module && !constructorSet.has(Module)) {
181
179
  constructorSet.add(Module);
182
- _chunkT4C6CCWMjs.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Module.name}"`, "warn");
180
+ _chunkXHKBG2VAjs.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Module.name}"`, "warn");
183
181
  }
184
182
  return {
185
183
  instance,
@@ -212,7 +210,7 @@ async function Factory(Modules, opts = {}) {
212
210
  tag
213
211
  };
214
212
  }
215
- _chunkT4C6CCWMjs.__name.call(void 0, buildNestModule, "buildNestModule");
213
+ _chunkXHKBG2VAjs.__name.call(void 0, buildNestModule, "buildNestModule");
216
214
  for (const Module of Modules)
217
215
  await buildNestModule(Module);
218
216
  function writeCode() {
@@ -225,9 +223,9 @@ async function Factory(Modules, opts = {}) {
225
223
  _fs2.default.promises.writeFile(rpc, generateRPCCode(meta.map((item) => item.data)));
226
224
  }
227
225
  }
228
- _chunkT4C6CCWMjs.__name.call(void 0, writeCode, "writeCode");
226
+ _chunkXHKBG2VAjs.__name.call(void 0, writeCode, "writeCode");
229
227
  writeCode();
230
- if (_chunkT4C6CCWMjs.IS_DEV) {
228
+ if (_chunkXHKBG2VAjs.IS_DEV) {
231
229
  if (!globalThis.__PS_HMR__)
232
230
  globalThis.__PS_HMR__ = [];
233
231
  _optionalChain([globalThis, 'access', _5 => _5.__PS_HMR__, 'optionalAccess', _6 => _6.push, 'call', _7 => _7(async (files) => {
@@ -251,7 +249,7 @@ async function Factory(Modules, opts = {}) {
251
249
  destroy
252
250
  };
253
251
  }
254
- _chunkT4C6CCWMjs.__name.call(void 0, Factory, "Factory");
252
+ _chunkXHKBG2VAjs.__name.call(void 0, Factory, "Factory");
255
253
  function getMetaFromInstance(instance, tag, name) {
256
254
  const vars = _phecdacore.getExposeKey.call(void 0, instance).filter((item) => item !== _phecdacore.SHARE_KEY);
257
255
  const baseState = _phecdacore.getState.call(void 0, instance, _phecdacore.SHARE_KEY) || {};
@@ -275,7 +273,7 @@ function getMetaFromInstance(instance, tag, name) {
275
273
  };
276
274
  }
277
275
  if (typeof tag !== "string" && (meta.rpc || meta.http))
278
- _chunkT4C6CCWMjs.log.call(void 0, `can't use Tag with ${typeof tag} on http/rpc controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
276
+ _chunkXHKBG2VAjs.log.call(void 0, `can't use Tag with ${typeof tag} on http/rpc controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
279
277
  meta.name = name;
280
278
  meta.tag = tag;
281
279
  meta.method = i;
@@ -313,14 +311,14 @@ function getMetaFromInstance(instance, tag, name) {
313
311
  ...state.interceptors
314
312
  ])
315
313
  ];
316
- return new Meta(meta, _phecdacore.getHandler.call(void 0, instance, i), getParamTypes(instance, i) || []);
314
+ return new Meta(meta, getParamTypes(instance, i) || []);
317
315
  });
318
316
  }
319
- _chunkT4C6CCWMjs.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
317
+ _chunkXHKBG2VAjs.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
320
318
  function getParamTypes(Module, key) {
321
319
  return Reflect.getMetadata("design:paramtypes", Module, key);
322
320
  }
323
- _chunkT4C6CCWMjs.__name.call(void 0, getParamTypes, "getParamTypes");
321
+ _chunkXHKBG2VAjs.__name.call(void 0, getParamTypes, "getParamTypes");
324
322
  function initState(state) {
325
323
  if (!state.define)
326
324
  state.define = {};
@@ -333,7 +331,7 @@ function initState(state) {
333
331
  if (!state.interceptors)
334
332
  state.interceptors = [];
335
333
  }
336
- _chunkT4C6CCWMjs.__name.call(void 0, initState, "initState");
334
+ _chunkXHKBG2VAjs.__name.call(void 0, initState, "initState");
337
335
 
338
336
 
339
337
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __name
3
- } from "./chunk-ONUMVNO7.mjs";
3
+ } from "./chunk-UFSW7A6B.mjs";
4
4
 
5
5
  // src/server/helper.ts
6
6
  function resolveDep(ret, key) {
@@ -6,7 +6,7 @@ import {
6
6
  __name,
7
7
  __publicField,
8
8
  log
9
- } from "./chunk-ONUMVNO7.mjs";
9
+ } from "./chunk-UFSW7A6B.mjs";
10
10
 
11
11
  // src/exception/base.ts
12
12
  var Exception = class extends Error {
@@ -54,10 +54,10 @@ function setConfig(key, conf, force = true) {
54
54
  }
55
55
  __name(setConfig, "setConfig");
56
56
  function Mix(InternalClass, ExtendClass) {
57
- return class extends ExtendClass {
57
+ return class extends InternalClass {
58
58
  constructor(...args) {
59
- super(...args);
60
- Object.assign(this, new InternalClass());
59
+ super();
60
+ Object.assign(this, new ExtendClass(...args));
61
61
  }
62
62
  };
63
63
  }
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkT4C6CCWMjs = require('./chunk-T4C6CCWM.js');
9
+ var _chunkXHKBG2VAjs = require('./chunk-XHKBG2VA.js');
10
10
 
11
11
  // src/exception/base.ts
12
12
  var Exception = class extends Error {
@@ -24,11 +24,11 @@ var Exception = class extends Error {
24
24
  message: this.message,
25
25
  description: this.description,
26
26
  status: this.status,
27
- [_chunkT4C6CCWMjs.ERROR_SYMBOL]: true
27
+ [_chunkXHKBG2VAjs.ERROR_SYMBOL]: true
28
28
  };
29
29
  }
30
30
  };
31
- _chunkT4C6CCWMjs.__name.call(void 0, Exception, "Exception");
31
+ _chunkXHKBG2VAjs.__name.call(void 0, Exception, "Exception");
32
32
 
33
33
  // src/exception/validate.ts
34
34
  var ValidateException = class extends Exception {
@@ -36,11 +36,11 @@ var ValidateException = class extends Exception {
36
36
  super(message, 400, "Validate exception");
37
37
  }
38
38
  };
39
- _chunkT4C6CCWMjs.__name.call(void 0, ValidateException, "ValidateException");
39
+ _chunkXHKBG2VAjs.__name.call(void 0, ValidateException, "ValidateException");
40
40
 
41
41
  // src/pipe.ts
42
42
  var _phecdacore = require('phecda-core');
43
- var defaultPipe = /* @__PURE__ */ _chunkT4C6CCWMjs.__name.call(void 0, async ({ arg, reflect, index }) => {
43
+ var defaultPipe = /* @__PURE__ */ _chunkXHKBG2VAjs.__name.call(void 0, async ({ arg, reflect, index }) => {
44
44
  if (_phecdacore.isPhecda.call(void 0, reflect)) {
45
45
  const instance = _phecdacore.plainToClass.call(void 0, reflect, arg);
46
46
  const err = await _phecdacore.transformClass.call(void 0, instance);
@@ -66,7 +66,7 @@ var UndefinedException = class extends Exception {
66
66
  super(message, 500, "Undefined error");
67
67
  }
68
68
  };
69
- _chunkT4C6CCWMjs.__name.call(void 0, UndefinedException, "UndefinedException");
69
+ _chunkXHKBG2VAjs.__name.call(void 0, UndefinedException, "UndefinedException");
70
70
 
71
71
  // src/exception/forbidden.ts
72
72
  var ForbiddenException = class extends Exception {
@@ -74,7 +74,7 @@ var ForbiddenException = class extends Exception {
74
74
  super(message, 403, "Forbidden resource");
75
75
  }
76
76
  };
77
- _chunkT4C6CCWMjs.__name.call(void 0, ForbiddenException, "ForbiddenException");
77
+ _chunkXHKBG2VAjs.__name.call(void 0, ForbiddenException, "ForbiddenException");
78
78
 
79
79
  // src/exception/bad-request.ts
80
80
  var BadRequestException = class extends Exception {
@@ -82,7 +82,7 @@ var BadRequestException = class extends Exception {
82
82
  super(message, 400, "Bad Request");
83
83
  }
84
84
  };
85
- _chunkT4C6CCWMjs.__name.call(void 0, BadRequestException, "BadRequestException");
85
+ _chunkXHKBG2VAjs.__name.call(void 0, BadRequestException, "BadRequestException");
86
86
 
87
87
  // src/exception/not-found.ts
88
88
  var NotFoundException = class extends Exception {
@@ -90,7 +90,7 @@ var NotFoundException = class extends Exception {
90
90
  super(message, 404, "Not Found");
91
91
  }
92
92
  };
93
- _chunkT4C6CCWMjs.__name.call(void 0, NotFoundException, "NotFoundException");
93
+ _chunkXHKBG2VAjs.__name.call(void 0, NotFoundException, "NotFoundException");
94
94
 
95
95
  // src/exception/conflict.ts
96
96
  var ConflictException = class extends Exception {
@@ -98,7 +98,7 @@ var ConflictException = class extends Exception {
98
98
  super(message, 409, "Conflict");
99
99
  }
100
100
  };
101
- _chunkT4C6CCWMjs.__name.call(void 0, ConflictException, "ConflictException");
101
+ _chunkXHKBG2VAjs.__name.call(void 0, ConflictException, "ConflictException");
102
102
 
103
103
  // src/exception/bad-gateway.ts
104
104
  var BadGatewayException = class extends Exception {
@@ -106,7 +106,7 @@ var BadGatewayException = class extends Exception {
106
106
  super(message, 502, "Bad Gatrway");
107
107
  }
108
108
  };
109
- _chunkT4C6CCWMjs.__name.call(void 0, BadGatewayException, "BadGatewayException");
109
+ _chunkXHKBG2VAjs.__name.call(void 0, BadGatewayException, "BadGatewayException");
110
110
 
111
111
  // src/exception/invalid-input.ts
112
112
  var InvalidInputException = class extends Exception {
@@ -114,7 +114,7 @@ var InvalidInputException = class extends Exception {
114
114
  super(message, 502, "Invalid Input");
115
115
  }
116
116
  };
117
- _chunkT4C6CCWMjs.__name.call(void 0, InvalidInputException, "InvalidInputException");
117
+ _chunkXHKBG2VAjs.__name.call(void 0, InvalidInputException, "InvalidInputException");
118
118
 
119
119
  // src/exception/media-type.ts
120
120
  var UnsupportedMediaTypeException = class extends Exception {
@@ -122,7 +122,7 @@ var UnsupportedMediaTypeException = class extends Exception {
122
122
  super(message, 415, "Unsupported Media Type");
123
123
  }
124
124
  };
125
- _chunkT4C6CCWMjs.__name.call(void 0, UnsupportedMediaTypeException, "UnsupportedMediaTypeException");
125
+ _chunkXHKBG2VAjs.__name.call(void 0, UnsupportedMediaTypeException, "UnsupportedMediaTypeException");
126
126
 
127
127
  // src/exception/payload-large.ts
128
128
  var PayloadLargeException = class extends Exception {
@@ -130,7 +130,7 @@ var PayloadLargeException = class extends Exception {
130
130
  super(message, 413, "Payload Too Large");
131
131
  }
132
132
  };
133
- _chunkT4C6CCWMjs.__name.call(void 0, PayloadLargeException, "PayloadLargeException");
133
+ _chunkXHKBG2VAjs.__name.call(void 0, PayloadLargeException, "PayloadLargeException");
134
134
 
135
135
  // src/exception/timeout.ts
136
136
  var TimeoutException = class extends Exception {
@@ -138,7 +138,7 @@ var TimeoutException = class extends Exception {
138
138
  super(message, 408, "Request Timeout");
139
139
  }
140
140
  };
141
- _chunkT4C6CCWMjs.__name.call(void 0, TimeoutException, "TimeoutException");
141
+ _chunkXHKBG2VAjs.__name.call(void 0, TimeoutException, "TimeoutException");
142
142
 
143
143
  // src/exception/unauthorized.ts
144
144
  var UnauthorizedException = class extends Exception {
@@ -146,7 +146,7 @@ var UnauthorizedException = class extends Exception {
146
146
  super(message, 401, "Unauthorized");
147
147
  }
148
148
  };
149
- _chunkT4C6CCWMjs.__name.call(void 0, UnauthorizedException, "UnauthorizedException");
149
+ _chunkXHKBG2VAjs.__name.call(void 0, UnauthorizedException, "UnauthorizedException");
150
150
 
151
151
  // src/exception/unavailable-service.ts
152
152
  var ServiceUnavailableException = class extends Exception {
@@ -154,7 +154,7 @@ var ServiceUnavailableException = class extends Exception {
154
154
  super(message, 503, "Service Unavailable");
155
155
  }
156
156
  };
157
- _chunkT4C6CCWMjs.__name.call(void 0, ServiceUnavailableException, "ServiceUnavailableException");
157
+ _chunkXHKBG2VAjs.__name.call(void 0, ServiceUnavailableException, "ServiceUnavailableException");
158
158
 
159
159
  // src/exception/framework.ts
160
160
  var FrameworkException = class extends Exception {
@@ -162,21 +162,21 @@ var FrameworkException = class extends Exception {
162
162
  super(`[phecda-server] ${message}`, 500, "Framework Error");
163
163
  }
164
164
  };
165
- _chunkT4C6CCWMjs.__name.call(void 0, FrameworkException, "FrameworkException");
165
+ _chunkXHKBG2VAjs.__name.call(void 0, FrameworkException, "FrameworkException");
166
166
 
167
167
  // src/context.ts
168
168
  var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
169
169
 
170
170
  // src/filter.ts
171
- var defaultFilter = /* @__PURE__ */ _chunkT4C6CCWMjs.__name.call(void 0, (e) => {
171
+ var defaultFilter = /* @__PURE__ */ _chunkXHKBG2VAjs.__name.call(void 0, (e) => {
172
172
  if (!(e instanceof Exception)) {
173
- _chunkT4C6CCWMjs.log.call(void 0, e.message, "error");
174
- if (!_chunkT4C6CCWMjs.IS_LOG_BAN)
173
+ _chunkXHKBG2VAjs.log.call(void 0, e.message, "error");
174
+ if (!_chunkXHKBG2VAjs.IS_LOG_BAN)
175
175
  console.error(e.stack);
176
176
  e = new UndefinedException(e.message || e);
177
177
  } else {
178
- _chunkT4C6CCWMjs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
179
- if (!_chunkT4C6CCWMjs.IS_LOG_BAN)
178
+ _chunkXHKBG2VAjs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
179
+ if (!_chunkXHKBG2VAjs.IS_LOG_BAN)
180
180
  console.error(e.stack);
181
181
  }
182
182
  return e.data;
@@ -194,7 +194,7 @@ var Histroy = (_class = class {constructor() { _class.prototype.__init.call(this
194
194
  return false;
195
195
  }
196
196
  }, _class);
197
- _chunkT4C6CCWMjs.__name.call(void 0, Histroy, "Histroy");
197
+ _chunkXHKBG2VAjs.__name.call(void 0, Histroy, "Histroy");
198
198
 
199
199
  // src/context.ts
200
200
  var guardRecord = {};
@@ -207,13 +207,13 @@ var _Context = class {
207
207
  constructor(data) {
208
208
  this.data = data;
209
209
  this.history = new Histroy();
210
- if (_chunkT4C6CCWMjs.IS_DEV)
210
+ if (_chunkXHKBG2VAjs.IS_DEV)
211
211
  data._context = this;
212
212
  }
213
213
  usePipe(args) {
214
214
  return Promise.all(args.map((item) => {
215
215
  if (item.pipe && !_Context.pipeRecord[item.pipe]) {
216
- if (_chunkT4C6CCWMjs.IS_STRICT)
216
+ if (_chunkXHKBG2VAjs.IS_STRICT)
217
217
  throw new FrameworkException(`can't find pipe named '${item.pipe}'`);
218
218
  else
219
219
  return _Context.pipeRecord.default(item, this.data);
@@ -223,7 +223,7 @@ var _Context = class {
223
223
  }
224
224
  useFilter(arg, filter = "default") {
225
225
  if (!_Context.filterRecord[filter]) {
226
- if (_chunkT4C6CCWMjs.IS_STRICT)
226
+ if (_chunkXHKBG2VAjs.IS_STRICT)
227
227
  throw new FrameworkException(`can't find filter named '${filter}'`);
228
228
  else
229
229
  return _Context.filterRecord.default(arg, this.data);
@@ -234,7 +234,7 @@ var _Context = class {
234
234
  for (const guard of guards) {
235
235
  if (this.history.record(guard, "guard")) {
236
236
  if (!(guard in _Context.guardRecord)) {
237
- if (_chunkT4C6CCWMjs.IS_STRICT)
237
+ if (_chunkXHKBG2VAjs.IS_STRICT)
238
238
  throw new FrameworkException(`can't find guard named '${guard}'`);
239
239
  continue;
240
240
  }
@@ -253,7 +253,7 @@ var _Context = class {
253
253
  for (const interceptor of interceptors) {
254
254
  if (this.history.record(interceptor, "interceptor")) {
255
255
  if (!(interceptor in _Context.interceptorRecord)) {
256
- if (_chunkT4C6CCWMjs.IS_STRICT)
256
+ if (_chunkXHKBG2VAjs.IS_STRICT)
257
257
  throw new FrameworkException(`can't find interceptor named '${interceptor}'`);
258
258
  continue;
259
259
  }
@@ -272,7 +272,7 @@ var _Context = class {
272
272
  const ret = [];
273
273
  for (const m of plugins) {
274
274
  if (!(m in _Context.pluginRecord)) {
275
- if (_chunkT4C6CCWMjs.IS_STRICT)
275
+ if (_chunkXHKBG2VAjs.IS_STRICT)
276
276
  throw new FrameworkException(`can't find middleware named '${m}'`);
277
277
  continue;
278
278
  }
@@ -282,46 +282,46 @@ var _Context = class {
282
282
  }
283
283
  };
284
284
  var Context = _Context;
285
- _chunkT4C6CCWMjs.__name.call(void 0, Context, "Context");
286
- _chunkT4C6CCWMjs.__publicField.call(void 0, Context, "filterRecord", {
285
+ _chunkXHKBG2VAjs.__name.call(void 0, Context, "Context");
286
+ _chunkXHKBG2VAjs.__publicField.call(void 0, Context, "filterRecord", {
287
287
  default: defaultFilter
288
288
  });
289
- _chunkT4C6CCWMjs.__publicField.call(void 0, Context, "pipeRecord", {
289
+ _chunkXHKBG2VAjs.__publicField.call(void 0, Context, "pipeRecord", {
290
290
  default: defaultPipe
291
291
  });
292
- _chunkT4C6CCWMjs.__publicField.call(void 0, Context, "guardRecord", {});
293
- _chunkT4C6CCWMjs.__publicField.call(void 0, Context, "interceptorRecord", {});
294
- _chunkT4C6CCWMjs.__publicField.call(void 0, Context, "pluginRecord", {});
292
+ _chunkXHKBG2VAjs.__publicField.call(void 0, Context, "guardRecord", {});
293
+ _chunkXHKBG2VAjs.__publicField.call(void 0, Context, "interceptorRecord", {});
294
+ _chunkXHKBG2VAjs.__publicField.call(void 0, Context, "pluginRecord", {});
295
295
  function addPlugin(key, handler) {
296
296
  if (Context.pluginRecord[key] && Context.pluginRecord[key] !== handler)
297
- _chunkT4C6CCWMjs.log.call(void 0, `overwrite Plugin "${String(key)}"`, "warn");
297
+ _chunkXHKBG2VAjs.log.call(void 0, `overwrite Plugin "${String(key)}"`, "warn");
298
298
  Context.pluginRecord[key] = handler;
299
299
  }
300
- _chunkT4C6CCWMjs.__name.call(void 0, addPlugin, "addPlugin");
300
+ _chunkXHKBG2VAjs.__name.call(void 0, addPlugin, "addPlugin");
301
301
  function addPipe(key, handler) {
302
302
  if (Context.pipeRecord[key] && Context.pipeRecord[key] !== handler)
303
- _chunkT4C6CCWMjs.log.call(void 0, `overwrite Pipe "${String(key)}"`, "warn");
303
+ _chunkXHKBG2VAjs.log.call(void 0, `overwrite Pipe "${String(key)}"`, "warn");
304
304
  Context.pipeRecord[key] = handler;
305
305
  }
306
- _chunkT4C6CCWMjs.__name.call(void 0, addPipe, "addPipe");
306
+ _chunkXHKBG2VAjs.__name.call(void 0, addPipe, "addPipe");
307
307
  function addFilter(key, handler) {
308
308
  if (Context.filterRecord[key] && Context.filterRecord[key] !== handler)
309
- _chunkT4C6CCWMjs.log.call(void 0, `overwrite Filter "${String(key)}"`, "warn");
309
+ _chunkXHKBG2VAjs.log.call(void 0, `overwrite Filter "${String(key)}"`, "warn");
310
310
  Context.filterRecord[key] = handler;
311
311
  }
312
- _chunkT4C6CCWMjs.__name.call(void 0, addFilter, "addFilter");
312
+ _chunkXHKBG2VAjs.__name.call(void 0, addFilter, "addFilter");
313
313
  function addGuard(key, handler) {
314
314
  if (Context.guardRecord[key] && Context.guardRecord[key] !== handler)
315
- _chunkT4C6CCWMjs.log.call(void 0, `overwrite Guard "${String(key)}"`, "warn");
315
+ _chunkXHKBG2VAjs.log.call(void 0, `overwrite Guard "${String(key)}"`, "warn");
316
316
  Context.guardRecord[key] = handler;
317
317
  }
318
- _chunkT4C6CCWMjs.__name.call(void 0, addGuard, "addGuard");
318
+ _chunkXHKBG2VAjs.__name.call(void 0, addGuard, "addGuard");
319
319
  function addInterceptor(key, handler) {
320
320
  if (Context.interceptorRecord[key] && Context.interceptorRecord[key] !== handler)
321
- _chunkT4C6CCWMjs.log.call(void 0, `overwrite Interceptor "${String(key)}"`, "warn");
321
+ _chunkXHKBG2VAjs.log.call(void 0, `overwrite Interceptor "${String(key)}"`, "warn");
322
322
  Context.interceptorRecord[key] = handler;
323
323
  }
324
- _chunkT4C6CCWMjs.__name.call(void 0, addInterceptor, "addInterceptor");
324
+ _chunkXHKBG2VAjs.__name.call(void 0, addInterceptor, "addInterceptor");
325
325
  function isAopDepInject(meta, { guards, interceptors, plugins } = {}) {
326
326
  const pluginSet = new Set(plugins);
327
327
  const guardSet = new Set(guards);
@@ -355,17 +355,17 @@ function isAopDepInject(meta, { guards, interceptors, plugins } = {}) {
355
355
  ...filterSet
356
356
  ].filter((i) => !Context.filterRecord[i]);
357
357
  if (missPlugins.length)
358
- _chunkT4C6CCWMjs.log.call(void 0, `${_picocolors2.default.white(`Plugin [${missPlugins.join(",")}]`)} doesn't exist`, "warn");
358
+ _chunkXHKBG2VAjs.log.call(void 0, `${_picocolors2.default.white(`Plugin [${missPlugins.join(",")}]`)} doesn't exist`, "warn");
359
359
  if (missGuards.length)
360
- _chunkT4C6CCWMjs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
360
+ _chunkXHKBG2VAjs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
361
361
  if (missInterceptors.length)
362
- _chunkT4C6CCWMjs.log.call(void 0, `${_picocolors2.default.cyan(`Interceptor [${missInterceptors.join(",")}]`)} doesn't exist`, "warn");
362
+ _chunkXHKBG2VAjs.log.call(void 0, `${_picocolors2.default.cyan(`Interceptor [${missInterceptors.join(",")}]`)} doesn't exist`, "warn");
363
363
  if (missPipes.length)
364
- _chunkT4C6CCWMjs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
364
+ _chunkXHKBG2VAjs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
365
365
  if (missFilters.length)
366
- _chunkT4C6CCWMjs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
366
+ _chunkXHKBG2VAjs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
367
367
  }
368
- _chunkT4C6CCWMjs.__name.call(void 0, isAopDepInject, "isAopDepInject");
368
+ _chunkXHKBG2VAjs.__name.call(void 0, isAopDepInject, "isAopDepInject");
369
369
 
370
370
 
371
371
 
@@ -54,10 +54,10 @@ function setConfig(key, conf, force = true) {
54
54
  }
55
55
  __name(setConfig, "setConfig");
56
56
  function Mix(InternalClass, ExtendClass) {
57
- return class extends ExtendClass {
57
+ return class extends InternalClass {
58
58
  constructor(...args) {
59
- super(...args);
60
- Object.assign(this, new InternalClass());
59
+ super();
60
+ Object.assign(this, new ExtendClass(...args));
61
61
  }
62
62
  };
63
63
  }
@@ -28,9 +28,8 @@ declare const PS_IMPORT_RE: RegExp;
28
28
 
29
29
  declare class Meta {
30
30
  data: P.MetaData;
31
- handlers: P.Handler[];
32
31
  paramsType: any[];
33
- constructor(data: P.MetaData, handlers: P.Handler[], paramsType: any[]);
32
+ constructor(data: P.MetaData, paramsType: any[]);
34
33
  }
35
34
 
36
35
  interface Emitter {
@@ -87,9 +86,6 @@ declare namespace P {
87
86
  reflect: any;
88
87
  }, ctx: C) => Promise<any>;
89
88
  type Filter<C extends BaseContext = any, E extends Exception = any> = (err: E | Error, ctx?: C) => Error | any;
90
- interface Handler {
91
- error?: (arg: any) => void;
92
- }
93
89
  interface MetaData {
94
90
  http?: {
95
91
  type: RequestType;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as Exception, P, M as Meta, U as UNMOUNT_SYMBOL } from './core-b8dcc009.js';
2
- export { A as APP_SYMBOL, k as ERROR_SYMBOL, a as Emitter, F as Factory, h as IS_DEV, j as IS_LOG_BAN, i as IS_STRICT, I as Injectable, d as MERGE_SYMBOL, g as META_SYMBOL, f as MODULE_SYMBOL, l as PS_FILE_RE, m as PS_IMPORT_RE, c as PickFunc, b as PickKeysByValue, R as RequestType, T as ToControllerMap, e as emitter } from './core-b8dcc009.js';
1
+ import { E as Exception, P, M as Meta, U as UNMOUNT_SYMBOL } from './core-eb2a0799.js';
2
+ export { A as APP_SYMBOL, k as ERROR_SYMBOL, a as Emitter, F as Factory, h as IS_DEV, j as IS_LOG_BAN, i as IS_STRICT, I as Injectable, d as MERGE_SYMBOL, g as META_SYMBOL, f as MODULE_SYMBOL, l as PS_FILE_RE, m as PS_IMPORT_RE, c as PickFunc, b as PickKeysByValue, R as RequestType, T as ToControllerMap, e as emitter } from './core-eb2a0799.js';
3
3
  import { Construct, AbConstruct } from 'phecda-core';
4
4
  export * from 'phecda-core';
5
5
  import 'node:http';