phecda-server 7.0.0-alpha.9 → 7.0.1

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 (99) hide show
  1. package/assets/schema.json +12 -9
  2. package/bin/cli.mjs +95 -36
  3. package/dist/{chunk-5RBTN33A.js → chunk-4LLLQOMF.js} +10 -5
  4. package/dist/{chunk-7ZGYJ5OW.mjs → chunk-AIAO6SV6.mjs} +10 -34
  5. package/dist/{chunk-V5EYXVJT.js → chunk-DPPDWBYO.js} +53 -25
  6. package/dist/{chunk-CVPZWDXU.mjs → chunk-E7EAPAGM.mjs} +10 -20
  7. package/dist/{chunk-ODVWOXVB.mjs → chunk-MKRHYZCL.mjs} +30 -2
  8. package/dist/{chunk-FXTJ3BJ6.mjs → chunk-NQ55PA2X.mjs} +9 -4
  9. package/dist/{chunk-FX3LDQII.js → chunk-XKK2SQ7W.js} +60 -70
  10. package/dist/{chunk-KJUD2BKE.js → chunk-ZWPOWMZP.js} +25 -49
  11. package/dist/{core-D_cz0tKa.d.ts → core-DbqWh47p.d.mts} +3 -2
  12. package/dist/{core-BDkhrEyf.d.mts → core-Rq7BhPHE.d.ts} +3 -2
  13. package/dist/helper.d.mts +3 -5
  14. package/dist/helper.d.ts +3 -5
  15. package/dist/helper.js +3 -5
  16. package/dist/helper.mjs +2 -4
  17. package/dist/http/elysia/index.d.mts +4 -4
  18. package/dist/http/elysia/index.d.ts +4 -4
  19. package/dist/http/elysia/index.js +41 -40
  20. package/dist/http/elysia/index.mjs +4 -3
  21. package/dist/http/express/index.d.mts +3 -3
  22. package/dist/http/express/index.d.ts +3 -3
  23. package/dist/http/express/index.js +38 -37
  24. package/dist/http/express/index.mjs +3 -2
  25. package/dist/http/fastify/index.d.mts +3 -3
  26. package/dist/http/fastify/index.d.ts +3 -3
  27. package/dist/http/fastify/index.js +39 -38
  28. package/dist/http/fastify/index.mjs +4 -3
  29. package/dist/http/h3/index.d.mts +3 -3
  30. package/dist/http/h3/index.d.ts +3 -3
  31. package/dist/http/h3/index.js +39 -38
  32. package/dist/http/h3/index.mjs +3 -2
  33. package/dist/http/hono/index.d.mts +3 -3
  34. package/dist/http/hono/index.d.ts +3 -3
  35. package/dist/http/hono/index.js +35 -34
  36. package/dist/http/hono/index.mjs +3 -2
  37. package/dist/http/hyper-express/index.d.mts +3 -3
  38. package/dist/http/hyper-express/index.d.ts +3 -3
  39. package/dist/http/hyper-express/index.js +36 -35
  40. package/dist/http/hyper-express/index.mjs +3 -2
  41. package/dist/http/koa/index.d.mts +3 -3
  42. package/dist/http/koa/index.d.ts +3 -3
  43. package/dist/http/koa/index.js +38 -37
  44. package/dist/http/koa/index.mjs +3 -2
  45. package/dist/index.d.mts +76 -12
  46. package/dist/index.d.ts +76 -12
  47. package/dist/index.js +102 -49
  48. package/dist/index.mjs +66 -13
  49. package/dist/{meta-BX5jhe4Z.d.mts → meta-BoS1E-Nz.d.mts} +6 -23
  50. package/dist/{meta-BX5jhe4Z.d.ts → meta-BoS1E-Nz.d.ts} +6 -23
  51. package/dist/rpc/bullmq/index.d.mts +4 -6
  52. package/dist/rpc/bullmq/index.d.ts +4 -6
  53. package/dist/rpc/bullmq/index.js +12 -80
  54. package/dist/rpc/bullmq/index.mjs +4 -72
  55. package/dist/rpc/electron/index.d.mts +13 -0
  56. package/dist/rpc/electron/index.d.ts +13 -0
  57. package/dist/rpc/electron/index.js +72 -0
  58. package/dist/rpc/electron/index.mjs +72 -0
  59. package/dist/rpc/kafka/index.d.mts +4 -9
  60. package/dist/rpc/kafka/index.d.ts +4 -9
  61. package/dist/rpc/kafka/index.js +11 -90
  62. package/dist/rpc/kafka/index.mjs +4 -83
  63. package/dist/rpc/nats/index.d.mts +4 -6
  64. package/dist/rpc/nats/index.d.ts +4 -6
  65. package/dist/rpc/nats/index.js +12 -72
  66. package/dist/rpc/nats/index.mjs +3 -63
  67. package/dist/rpc/rabbitmq/index.d.mts +4 -6
  68. package/dist/rpc/rabbitmq/index.d.ts +4 -6
  69. package/dist/rpc/rabbitmq/index.js +13 -79
  70. package/dist/rpc/rabbitmq/index.mjs +4 -70
  71. package/dist/rpc/redis/index.d.mts +4 -9
  72. package/dist/rpc/redis/index.d.ts +4 -9
  73. package/dist/rpc/redis/index.js +11 -78
  74. package/dist/rpc/redis/index.mjs +4 -71
  75. package/dist/rpc/web-ext/index.d.mts +2 -0
  76. package/dist/rpc/web-ext/index.d.ts +2 -0
  77. package/dist/rpc/web-ext/index.js +1 -0
  78. package/dist/rpc/web-ext/index.mjs +0 -0
  79. package/dist/rpc/ws/index.d.mts +14 -0
  80. package/dist/rpc/ws/index.d.ts +14 -0
  81. package/dist/rpc/ws/index.js +73 -0
  82. package/dist/rpc/ws/index.mjs +73 -0
  83. package/dist/test.d.mts +7 -3
  84. package/dist/test.d.ts +7 -3
  85. package/dist/test.js +6 -6
  86. package/dist/test.mjs +2 -2
  87. package/dist/types-CInz3bD0.d.ts +14 -0
  88. package/dist/types-E-rqlg3-.d.mts +14 -0
  89. package/dist/{types-DKVhyZk_.d.mts → types-SCJZFCYt.d.mts} +1 -1
  90. package/dist/{types-CMeuFoyd.d.ts → types-xruyYmyu.d.ts} +1 -1
  91. package/package.json +24 -8
  92. package/register/export.mjs +30 -0
  93. package/register/index.mjs +2 -3
  94. package/register/loader.mjs +83 -90
  95. package/register/utils.mjs +36 -6
  96. package/assets/ps.json +0 -24
  97. package/assets/tsconfig.json +0 -21
  98. package/dist/types-B-rUM9Fm.d.mts +0 -19
  99. package/dist/types-MxxtkZXw.d.ts +0 -19
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __name
3
- } from "./chunk-FXTJ3BJ6.mjs";
3
+ } from "./chunk-NQ55PA2X.mjs";
4
4
 
5
5
  // src/decorators/param.ts
6
6
  import { setMeta } from "phecda-core";
@@ -46,6 +46,20 @@ function Arg(target, k, index) {
46
46
  })(target, k, index);
47
47
  }
48
48
  __name(Arg, "Arg");
49
+ function OneFile(key = "") {
50
+ return BaseParam({
51
+ type: "file",
52
+ key
53
+ });
54
+ }
55
+ __name(OneFile, "OneFile");
56
+ function ManyFiles(key = "") {
57
+ return BaseParam({
58
+ type: "files",
59
+ key
60
+ });
61
+ }
62
+ __name(ManyFiles, "ManyFiles");
49
63
 
50
64
  // src/decorators/aop.ts
51
65
  import { setMeta as setMeta2 } from "phecda-core";
@@ -202,6 +216,17 @@ function Define(key, value) {
202
216
  }
203
217
  __name(Define, "Define");
204
218
 
219
+ // src/decorators/openapi.ts
220
+ import { setMeta as setMeta6 } from "phecda-core";
221
+ function ApiDoc(config) {
222
+ return function(target, propertyKey, _descriptor) {
223
+ setMeta6(target, propertyKey, void 0, {
224
+ openapi: config
225
+ });
226
+ };
227
+ }
228
+ __name(ApiDoc, "ApiDoc");
229
+
205
230
  export {
206
231
  BaseParam,
207
232
  Body,
@@ -209,6 +234,8 @@ export {
209
234
  Query,
210
235
  Param,
211
236
  Arg,
237
+ OneFile,
238
+ ManyFiles,
212
239
  Guard,
213
240
  Addon,
214
241
  Filter,
@@ -225,5 +252,6 @@ export {
225
252
  Queue,
226
253
  Rpc,
227
254
  Ctx,
228
- Define
255
+ Define,
256
+ ApiDoc
229
257
  };
@@ -6,10 +6,11 @@ var ERROR_SYMBOL = "__PS_ERROR__";
6
6
  var IS_DEV = process.env.NODE_ENV === "development";
7
7
  var IS_ONLY_GENERATE = !!process.env.PS_GENERATE;
8
8
  var IS_STRICT = !!process.env.PS_STRICT;
9
+ var IS_PURE = !!process.env.PS_PURE;
9
10
  var LOG_LEVEL = Number(process.env.PS_LOG_LEVEL || 0);
10
11
  var PS_EXIT_CODE = /* @__PURE__ */ function(PS_EXIT_CODE2) {
11
- PS_EXIT_CODE2[PS_EXIT_CODE2["RELAUNCH"] = 2] = "RELAUNCH";
12
- PS_EXIT_CODE2[PS_EXIT_CODE2["CODE"] = 4] = "CODE";
12
+ PS_EXIT_CODE2[PS_EXIT_CODE2["RELAUNCH"] = 4171] = "RELAUNCH";
13
+ PS_EXIT_CODE2[PS_EXIT_CODE2["EXIT"] = 4172] = "EXIT";
13
14
  return PS_EXIT_CODE2;
14
15
  }({});
15
16
 
@@ -81,7 +82,7 @@ ${JSON.stringify(message, (key, value) => typeof value === "bigint" ? value.toSt
81
82
  log(msg, level, ctx) {
82
83
  if (!this.isAllowLog(level)) return;
83
84
  msg = this.stringifyMessage(msg, level);
84
- const pidMsg = this.colorize(`[phecda-server] ${process.pid}`, level);
85
+ const pidMsg = this.colorize(`[${process.env.PS_APP_NAME || "phecda-server"}] ${process.pid}`, level);
85
86
  const ctxMsg = ctx ? this.colorize(pc.bold(`[${ctx}] `), level) : "";
86
87
  const timeDiff = this.diffTimestamp();
87
88
  const levelMsg = this.colorize(level.toUpperCase().padStart(7, " "), level);
@@ -124,7 +125,10 @@ async function RELOAD(oldModels, newModels) {
124
125
  }
125
126
  __name(RELOAD, "RELOAD");
126
127
  function RELAUNCH() {
127
- if (IS_DEV) process.exit(2);
128
+ if (IS_DEV) {
129
+ log("relaunch...");
130
+ process.exit(PS_EXIT_CODE.RELAUNCH);
131
+ }
128
132
  }
129
133
  __name(RELAUNCH, "RELAUNCH");
130
134
 
@@ -134,6 +138,7 @@ export {
134
138
  IS_DEV,
135
139
  IS_ONLY_GENERATE,
136
140
  IS_STRICT,
141
+ IS_PURE,
137
142
  LOG_LEVEL,
138
143
  PS_EXIT_CODE,
139
144
  setLogger,
@@ -6,7 +6,8 @@
6
6
 
7
7
 
8
8
 
9
- var _chunk5RBTN33Ajs = require('./chunk-5RBTN33A.js');
9
+
10
+ var _chunk4LLLQOMFjs = require('./chunk-4LLLQOMF.js');
10
11
 
11
12
  // src/helper.ts
12
13
  var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
@@ -16,14 +17,14 @@ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
16
17
 
17
18
 
18
19
  // src/pipe.ts
19
- var defaultPipe = /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, ({ arg }) => {
20
+ var defaultPipe = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, ({ arg }) => {
20
21
  return arg;
21
22
  }, "defaultPipe");
22
23
 
23
24
  // src/exception/base.ts
24
25
  var Exception = class extends Error {
25
26
  static {
26
- _chunk5RBTN33Ajs.__name.call(void 0, this, "Exception");
27
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "Exception");
27
28
  }
28
29
 
29
30
 
@@ -36,7 +37,7 @@ var Exception = class extends Error {
36
37
  message: this.message,
37
38
  description: this.description,
38
39
  status: this.status,
39
- [_chunk5RBTN33Ajs.ERROR_SYMBOL]: true
40
+ [_chunk4LLLQOMFjs.ERROR_SYMBOL]: true
40
41
  };
41
42
  }
42
43
  };
@@ -44,7 +45,7 @@ var Exception = class extends Error {
44
45
  // src/exception/undefine.ts
45
46
  var UndefinedException = class extends Exception {
46
47
  static {
47
- _chunk5RBTN33Ajs.__name.call(void 0, this, "UndefinedException");
48
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "UndefinedException");
48
49
  }
49
50
  constructor(message) {
50
51
  super(message, 500, "Undefined error");
@@ -54,7 +55,7 @@ var UndefinedException = class extends Exception {
54
55
  // src/exception/validate.ts
55
56
  var ValidateException = class extends Exception {
56
57
  static {
57
- _chunk5RBTN33Ajs.__name.call(void 0, this, "ValidateException");
58
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "ValidateException");
58
59
  }
59
60
  constructor(message) {
60
61
  super(message, 400, "Validate exception");
@@ -64,7 +65,7 @@ var ValidateException = class extends Exception {
64
65
  // src/exception/forbidden.ts
65
66
  var ForbiddenException = class extends Exception {
66
67
  static {
67
- _chunk5RBTN33Ajs.__name.call(void 0, this, "ForbiddenException");
68
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "ForbiddenException");
68
69
  }
69
70
  constructor(message) {
70
71
  super(message, 403, "Forbidden resource");
@@ -74,7 +75,7 @@ var ForbiddenException = class extends Exception {
74
75
  // src/exception/bad-request.ts
75
76
  var BadRequestException = class extends Exception {
76
77
  static {
77
- _chunk5RBTN33Ajs.__name.call(void 0, this, "BadRequestException");
78
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "BadRequestException");
78
79
  }
79
80
  constructor(message) {
80
81
  super(message, 400, "Bad Request");
@@ -84,7 +85,7 @@ var BadRequestException = class extends Exception {
84
85
  // src/exception/not-found.ts
85
86
  var NotFoundException = class extends Exception {
86
87
  static {
87
- _chunk5RBTN33Ajs.__name.call(void 0, this, "NotFoundException");
88
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "NotFoundException");
88
89
  }
89
90
  constructor(message) {
90
91
  super(message, 404, "Not Found");
@@ -94,7 +95,7 @@ var NotFoundException = class extends Exception {
94
95
  // src/exception/conflict.ts
95
96
  var ConflictException = class extends Exception {
96
97
  static {
97
- _chunk5RBTN33Ajs.__name.call(void 0, this, "ConflictException");
98
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "ConflictException");
98
99
  }
99
100
  constructor(message) {
100
101
  super(message, 409, "Conflict");
@@ -104,7 +105,7 @@ var ConflictException = class extends Exception {
104
105
  // src/exception/bad-gateway.ts
105
106
  var BadGatewayException = class extends Exception {
106
107
  static {
107
- _chunk5RBTN33Ajs.__name.call(void 0, this, "BadGatewayException");
108
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "BadGatewayException");
108
109
  }
109
110
  constructor(message) {
110
111
  super(message, 502, "Bad Gatrway");
@@ -114,7 +115,7 @@ var BadGatewayException = class extends Exception {
114
115
  // src/exception/invalid-input.ts
115
116
  var InvalidInputException = class extends Exception {
116
117
  static {
117
- _chunk5RBTN33Ajs.__name.call(void 0, this, "InvalidInputException");
118
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "InvalidInputException");
118
119
  }
119
120
  constructor(message) {
120
121
  super(message, 502, "Invalid Input");
@@ -124,7 +125,7 @@ var InvalidInputException = class extends Exception {
124
125
  // src/exception/media-type.ts
125
126
  var UnsupportedMediaTypeException = class extends Exception {
126
127
  static {
127
- _chunk5RBTN33Ajs.__name.call(void 0, this, "UnsupportedMediaTypeException");
128
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "UnsupportedMediaTypeException");
128
129
  }
129
130
  constructor(message) {
130
131
  super(message, 415, "Unsupported Media Type");
@@ -134,7 +135,7 @@ var UnsupportedMediaTypeException = class extends Exception {
134
135
  // src/exception/payload-large.ts
135
136
  var PayloadLargeException = class extends Exception {
136
137
  static {
137
- _chunk5RBTN33Ajs.__name.call(void 0, this, "PayloadLargeException");
138
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "PayloadLargeException");
138
139
  }
139
140
  constructor(message) {
140
141
  super(message, 413, "Payload Too Large");
@@ -144,7 +145,7 @@ var PayloadLargeException = class extends Exception {
144
145
  // src/exception/timeout.ts
145
146
  var TimeoutException = class extends Exception {
146
147
  static {
147
- _chunk5RBTN33Ajs.__name.call(void 0, this, "TimeoutException");
148
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "TimeoutException");
148
149
  }
149
150
  constructor(message) {
150
151
  super(message, 408, "Request Timeout");
@@ -154,7 +155,7 @@ var TimeoutException = class extends Exception {
154
155
  // src/exception/unauthorized.ts
155
156
  var UnauthorizedException = class extends Exception {
156
157
  static {
157
- _chunk5RBTN33Ajs.__name.call(void 0, this, "UnauthorizedException");
158
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "UnauthorizedException");
158
159
  }
159
160
  constructor(message) {
160
161
  super(message, 401, "Unauthorized");
@@ -164,7 +165,7 @@ var UnauthorizedException = class extends Exception {
164
165
  // src/exception/unavailable-service.ts
165
166
  var ServiceUnavailableException = class extends Exception {
166
167
  static {
167
- _chunk5RBTN33Ajs.__name.call(void 0, this, "ServiceUnavailableException");
168
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "ServiceUnavailableException");
168
169
  }
169
170
  constructor(message) {
170
171
  super(message, 503, "Service Unavailable");
@@ -174,7 +175,7 @@ var ServiceUnavailableException = class extends Exception {
174
175
  // src/exception/framework.ts
175
176
  var FrameworkException = class extends Exception {
176
177
  static {
177
- _chunk5RBTN33Ajs.__name.call(void 0, this, "FrameworkException");
178
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "FrameworkException");
178
179
  }
179
180
  constructor(message) {
180
181
  super(`[phecda-server] ${message}`, 500, "Framework Error");
@@ -184,7 +185,7 @@ var FrameworkException = class extends Exception {
184
185
  // src/exception/timer.ts
185
186
  var TimerException = class extends Exception {
186
187
  static {
187
- _chunk5RBTN33Ajs.__name.call(void 0, this, "TimerException");
188
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "TimerException");
188
189
  }
189
190
  constructor(message) {
190
191
  super(message, 0, "Timer Error");
@@ -194,7 +195,7 @@ var TimerException = class extends Exception {
194
195
  // src/exception/worker.ts
195
196
  var WorkerException = class extends Exception {
196
197
  static {
197
- _chunk5RBTN33Ajs.__name.call(void 0, this, "WorkerException");
198
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "WorkerException");
198
199
  }
199
200
  constructor(message) {
200
201
  super(message, 0, "Worker Error");
@@ -202,14 +203,14 @@ var WorkerException = class extends Exception {
202
203
  };
203
204
 
204
205
  // src/filter.ts
205
- var defaultFilter = /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (e) => {
206
+ var defaultFilter = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (e) => {
206
207
  if (!(e instanceof Exception)) {
207
- _chunk5RBTN33Ajs.log.call(void 0, e.message, "error");
208
- if (_chunk5RBTN33Ajs.LOG_LEVEL <= 0) console.error(e.stack);
208
+ _chunk4LLLQOMFjs.log.call(void 0, e.message, "error");
209
+ if (_chunk4LLLQOMFjs.LOG_LEVEL <= 0) console.error(e.stack);
209
210
  e = new UndefinedException(e.message || e);
210
211
  } else {
211
- _chunk5RBTN33Ajs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
212
- if (_chunk5RBTN33Ajs.LOG_LEVEL <= 0) console.error(e.stack);
212
+ _chunk4LLLQOMFjs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
213
+ if (_chunk4LLLQOMFjs.LOG_LEVEL <= 0) console.error(e.stack);
213
214
  }
214
215
  return e.data;
215
216
  }, "defaultFilter");
@@ -218,7 +219,7 @@ var defaultFilter = /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (e) =>
218
219
  var debug = _debug2.default.call(void 0, "phecda-server(Context)");
219
220
  var Context = (_class = class _Context {
220
221
  static {
221
- _chunk5RBTN33Ajs.__name.call(void 0, this, "Context");
222
+ _chunk4LLLQOMFjs.__name.call(void 0, this, "Context");
222
223
  }
223
224
 
224
225
 
@@ -232,17 +233,14 @@ var Context = (_class = class _Context {
232
233
  static __initStatic3() {this.guardRecord = {}}
233
234
  static __initStatic4() {this.addonRecord = {}}
234
235
 
235
-
236
+ // protected canGetCtx = true
236
237
  constructor(data) {
237
238
  this.data = data;
238
- this.canGetCtx = true;
239
- if (_chunk5RBTN33Ajs.IS_DEV)
239
+ if (_chunk4LLLQOMFjs.IS_DEV)
240
240
  data._context = this;
241
- const that = this;
242
241
  this.ctx = new Proxy(data, {
243
242
  get(target, p) {
244
- if (_chunk5RBTN33Ajs.IS_DEV && !that.canGetCtx) throw new FrameworkException("ctx must be obtained within the same request cycle in controller");
245
- if (!(p in target)) _chunk5RBTN33Ajs.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);
243
+ 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);
246
244
  return target[p];
247
245
  },
248
246
  set(target, p, newValue) {
@@ -280,7 +278,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
280
278
  const { paramsType, data: { ctxs, tag, params, func } } = meta;
281
279
  try {
282
280
  let res;
283
- const nextHandler = /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (index) => {
281
+ const nextHandler = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (index) => {
284
282
  return async () => {
285
283
  if (index === guards.length) {
286
284
  const instance = moduleMap.get(tag);
@@ -292,13 +290,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
292
290
  reflect: paramsType[item.index],
293
291
  ...item
294
292
  }, this.ctx)));
295
- if (_chunk5RBTN33Ajs.IS_DEV) {
296
- Promise.resolve().then(() => {
297
- this.canGetCtx = false;
298
- });
299
- }
300
293
  res = await instance[func](...args);
301
- this.canGetCtx = true;
302
294
  } else {
303
295
  let nextPromise;
304
296
  async function next() {
@@ -310,7 +302,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
310
302
  return res;
311
303
  });
312
304
  }
313
- _chunk5RBTN33Ajs.__name.call(void 0, next, "next");
305
+ _chunk4LLLQOMFjs.__name.call(void 0, next, "next");
314
306
  const ret = await guards[index](this.ctx, next);
315
307
  if (ret !== void 0) {
316
308
  res = ret;
@@ -355,12 +347,12 @@ function addPipe(key, pipe) {
355
347
  if (Context.pipeRecord[key] && Context.pipeRecord[key] !== pipe) debug(`overwrite Pipe "${String(key)}"`, "warn");
356
348
  Context.pipeRecord[key] = pipe;
357
349
  }
358
- _chunk5RBTN33Ajs.__name.call(void 0, addPipe, "addPipe");
350
+ _chunk4LLLQOMFjs.__name.call(void 0, addPipe, "addPipe");
359
351
  function addFilter(key, filter) {
360
352
  if (Context.filterRecord[key] && Context.filterRecord[key] !== filter) debug(`overwrite Filter "${String(key)}"`, "warn");
361
353
  Context.filterRecord[key] = filter;
362
354
  }
363
- _chunk5RBTN33Ajs.__name.call(void 0, addFilter, "addFilter");
355
+ _chunk4LLLQOMFjs.__name.call(void 0, addFilter, "addFilter");
364
356
  function addGuard(key, guard, priority = 0) {
365
357
  if (Context.guardRecord[key] && Context.guardRecord[key].value !== guard) debug(`overwrite Guard "${String(key)}"`, "warn");
366
358
  Context.guardRecord[key] = {
@@ -368,7 +360,7 @@ function addGuard(key, guard, priority = 0) {
368
360
  priority
369
361
  };
370
362
  }
371
- _chunk5RBTN33Ajs.__name.call(void 0, addGuard, "addGuard");
363
+ _chunk4LLLQOMFjs.__name.call(void 0, addGuard, "addGuard");
372
364
  function addAddon(key, addon, priority = 0) {
373
365
  if (Context.addonRecord[key] && Context.addonRecord[key].value !== addon) debug(`overwrite Addon "${String(key)}"`, "warn");
374
366
  Context.addonRecord[key] = {
@@ -376,21 +368,14 @@ function addAddon(key, addon, priority = 0) {
376
368
  priority
377
369
  };
378
370
  }
379
- _chunk5RBTN33Ajs.__name.call(void 0, addAddon, "addAddon");
371
+ _chunk4LLLQOMFjs.__name.call(void 0, addAddon, "addAddon");
380
372
 
381
373
  // src/http/helper.ts
382
374
  function resolveDep(ret, key) {
383
375
  if (key) return _optionalChain([ret, 'optionalAccess', _ => _[key]]);
384
376
  return ret;
385
377
  }
386
- _chunk5RBTN33Ajs.__name.call(void 0, resolveDep, "resolveDep");
387
-
388
- // src/rpc/helper.ts
389
- var _os = require('os');
390
- function genClientQueue(key) {
391
- return `PS-${key ? `${key}-` : ""}${_os.hostname.call(void 0, )}-${process.pid}`;
392
- }
393
- _chunk5RBTN33Ajs.__name.call(void 0, genClientQueue, "genClientQueue");
378
+ _chunk4LLLQOMFjs.__name.call(void 0, resolveDep, "resolveDep");
394
379
 
395
380
  // src/decorators/helper.ts
396
381
  function shallowClone(obj) {
@@ -398,11 +383,11 @@ function shallowClone(obj) {
398
383
  ...obj
399
384
  };
400
385
  }
401
- _chunk5RBTN33Ajs.__name.call(void 0, shallowClone, "shallowClone");
386
+ _chunk4LLLQOMFjs.__name.call(void 0, shallowClone, "shallowClone");
402
387
  function mergeObject(...args) {
403
388
  return Object.assign({}, ...args);
404
389
  }
405
- _chunk5RBTN33Ajs.__name.call(void 0, mergeObject, "mergeObject");
390
+ _chunk4LLLQOMFjs.__name.call(void 0, mergeObject, "mergeObject");
406
391
 
407
392
  // src/helper.ts
408
393
  function createControllerMetaMap(meta, filter) {
@@ -418,13 +403,14 @@ function createControllerMetaMap(meta, filter) {
418
403
  });
419
404
  }
420
405
  }
421
- _chunk5RBTN33Ajs.__name.call(void 0, handleMeta, "handleMeta");
406
+ _chunk4LLLQOMFjs.__name.call(void 0, handleMeta, "handleMeta");
422
407
  handleMeta();
423
- _chunk5RBTN33Ajs.HMR.call(void 0, handleMeta);
408
+ _chunk4LLLQOMFjs.HMR.call(void 0, handleMeta);
424
409
  return metaMap;
425
410
  }
426
- _chunk5RBTN33Ajs.__name.call(void 0, createControllerMetaMap, "createControllerMetaMap");
411
+ _chunk4LLLQOMFjs.__name.call(void 0, createControllerMetaMap, "createControllerMetaMap");
427
412
  function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
413
+ if (_chunk4LLLQOMFjs.IS_PURE) return;
428
414
  const addonSet = /* @__PURE__ */ new Set();
429
415
  const guardSet = /* @__PURE__ */ new Set();
430
416
  const pipeSet = /* @__PURE__ */ new Set();
@@ -443,6 +429,8 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
443
429
  guardSet.add(item);
444
430
  })]);
445
431
  meta.forEach(({ data }) => {
432
+ if (!data.controller) return;
433
+ if (typeof data.tag !== "string") warningSet.add(`Tag of controller "${data.name}" should be a string`);
446
434
  if (data.controller !== controller) {
447
435
  if (data[controller]) warningSet.add(`Should use ${controller} controller to decorate class "${data.name}"`);
448
436
  return;
@@ -467,31 +455,34 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
467
455
  ...filterSet
468
456
  ].filter((i) => !Context.filterRecord[i]);
469
457
  function exit() {
470
- if (_chunk5RBTN33Ajs.IS_STRICT) process.exit(5);
458
+ if (_chunk4LLLQOMFjs.IS_STRICT) {
459
+ _chunk4LLLQOMFjs.log.call(void 0, "Does not meet strict mode requirements", "error");
460
+ process.exit(1);
461
+ }
471
462
  }
472
- _chunk5RBTN33Ajs.__name.call(void 0, exit, "exit");
463
+ _chunk4LLLQOMFjs.__name.call(void 0, exit, "exit");
473
464
  if (missAddons.length) {
474
- _chunk5RBTN33Ajs.log.call(void 0, `${_picocolors2.default.white(`Addon [${missAddons.join(",")}]`)} doesn't exist`, "warn");
465
+ _chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.white(`Addon [${missAddons.join(",")}]`)} doesn't exist`, "warn");
475
466
  exit();
476
467
  }
477
468
  if (missGuards.length) {
478
- _chunk5RBTN33Ajs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
469
+ _chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
479
470
  exit();
480
471
  }
481
472
  if (missPipes.length) {
482
- _chunk5RBTN33Ajs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
473
+ _chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
483
474
  exit();
484
475
  }
485
476
  if (missFilters.length) {
486
- _chunk5RBTN33Ajs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
477
+ _chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
487
478
  exit();
488
479
  }
489
- warningSet.forEach((warn) => _chunk5RBTN33Ajs.log.call(void 0, warn, "warn"));
480
+ warningSet.forEach((warn) => _chunk4LLLQOMFjs.log.call(void 0, warn, "warn"));
490
481
  if (warningSet.size) exit();
491
482
  }
492
- _chunk5RBTN33Ajs.__name.call(void 0, handleMeta, "handleMeta");
483
+ _chunk4LLLQOMFjs.__name.call(void 0, handleMeta, "handleMeta");
493
484
  handleMeta();
494
- _chunk5RBTN33Ajs.HMR.call(void 0, handleMeta);
485
+ _chunk4LLLQOMFjs.HMR.call(void 0, handleMeta);
495
486
  return {
496
487
  addonSet,
497
488
  guardSet,
@@ -499,7 +490,7 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
499
490
  filterSet
500
491
  };
501
492
  }
502
- _chunk5RBTN33Ajs.__name.call(void 0, detectAopDep, "detectAopDep");
493
+ _chunk4LLLQOMFjs.__name.call(void 0, detectAopDep, "detectAopDep");
503
494
  function joinUrl(base, ...paths) {
504
495
  const joinedPath = [
505
496
  base,
@@ -507,8 +498,7 @@ function joinUrl(base, ...paths) {
507
498
  ].filter((p) => p).map((path) => path.replace(/(^\/)/g, "")).join("/");
508
499
  return `/${joinedPath}`;
509
500
  }
510
- _chunk5RBTN33Ajs.__name.call(void 0, joinUrl, "joinUrl");
511
-
501
+ _chunk4LLLQOMFjs.__name.call(void 0, joinUrl, "joinUrl");
512
502
 
513
503
 
514
504
 
@@ -540,4 +530,4 @@ _chunk5RBTN33Ajs.__name.call(void 0, joinUrl, "joinUrl");
540
530
 
541
531
 
542
532
 
543
- exports.defaultPipe = defaultPipe; 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.Context = Context; exports.addPipe = addPipe; exports.addFilter = addFilter; exports.addGuard = addGuard; exports.addAddon = addAddon; exports.resolveDep = resolveDep; exports.genClientQueue = genClientQueue; exports.shallowClone = shallowClone; exports.mergeObject = mergeObject; exports.createControllerMetaMap = createControllerMetaMap; exports.detectAopDep = detectAopDep; exports.joinUrl = joinUrl;
533
+ exports.defaultPipe = defaultPipe; 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.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;