phecda-server 8.1.0 → 8.2.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-BLLRB5DQ.mjs → chunk-2P2UICBC.mjs} +2 -1
  3. package/dist/{chunk-UYZSUBX4.js → chunk-C424F7TV.js} +27 -27
  4. package/dist/{chunk-NQ55PA2X.mjs → chunk-JRNXLEAU.mjs} +2 -2
  5. package/dist/{chunk-FI5756JX.mjs → chunk-LYLSA56Y.mjs} +1 -1
  6. package/dist/{chunk-HKN3AAB2.js → chunk-MPKVT4SQ.js} +55 -54
  7. package/dist/{chunk-4LLLQOMF.js → chunk-OUQM7GZH.js} +2 -2
  8. package/dist/{chunk-OLNN4U3O.js → chunk-SRPCXPAQ.js} +20 -20
  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 +3 -1
  29. package/dist/index.d.ts +3 -1
  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
package/bin/cli.mjs CHANGED
@@ -95,6 +95,14 @@ cli
95
95
  hasUnimport = false
96
96
  }
97
97
 
98
+ if (hasUnimport) {
99
+ try {
100
+ await import('phecda-core')
101
+ } catch (e) {
102
+ log('please install \'phecda-core\' when using unimport', 'warn')
103
+ }
104
+ }
105
+
98
106
  const tsconfigPath = options.tsconfig
99
107
  const psconfigPath = process.env.PS_CONFIG_FILE || options.config
100
108
 
@@ -125,7 +133,7 @@ cli
125
133
  noImplicitReturns: true,
126
134
  skipLibCheck: true,
127
135
  },
128
- include: ['.', hasUnimport ? (process.env.PS_DTS_PATH || 'ps.d.ts') : undefined],
136
+ include: ['.', hasUnimport ? (process.env.PS_DTS_PATH || 'ps.d.ts') : false].filter(Boolean),
129
137
  },
130
138
 
131
139
  )
@@ -150,7 +158,14 @@ cli
150
158
  ],
151
159
  unimport: hasUnimport && {
152
160
  dirs: [
153
- '.',
161
+ ],
162
+ presets: [
163
+ {
164
+ package: 'phecda-core'
165
+ },
166
+ {
167
+ package: 'phecda-server'
168
+ }
154
169
  ],
155
170
  dirsScanOptions: {
156
171
  filePatterns: [
@@ -7,7 +7,7 @@ import {
7
7
  LOG_LEVEL,
8
8
  __name,
9
9
  log
10
- } from "./chunk-NQ55PA2X.mjs";
10
+ } from "./chunk-JRNXLEAU.mjs";
11
11
 
12
12
  // src/helper.ts
13
13
  import pc2 from "picocolors";
@@ -601,6 +601,7 @@ export {
601
601
  TimerException,
602
602
  WorkerException,
603
603
  defaultPipe,
604
+ defaultFilter,
604
605
  Context,
605
606
  addPipe,
606
607
  addFilter,
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk4LLLQOMFjs = require('./chunk-4LLLQOMF.js');
3
+ var _chunkOUQM7GZHjs = require('./chunk-OUQM7GZH.js');
4
4
 
5
5
  // src/decorators/param.ts
6
6
  var _phecdacore = require('phecda-core');
@@ -10,56 +10,56 @@ function BaseParam(data) {
10
10
  _phecdacore.setMeta.call(void 0, target, property, index, data);
11
11
  };
12
12
  }
13
- _chunk4LLLQOMFjs.__name.call(void 0, BaseParam, "BaseParam");
13
+ _chunkOUQM7GZHjs.__name.call(void 0, BaseParam, "BaseParam");
14
14
  function Body(key = "") {
15
15
  return BaseParam({
16
16
  type: "body",
17
17
  key
18
18
  });
19
19
  }
20
- _chunk4LLLQOMFjs.__name.call(void 0, Body, "Body");
20
+ _chunkOUQM7GZHjs.__name.call(void 0, Body, "Body");
21
21
  function Head(key) {
22
22
  return BaseParam({
23
23
  type: "headers",
24
24
  key: key.toLowerCase()
25
25
  });
26
26
  }
27
- _chunk4LLLQOMFjs.__name.call(void 0, Head, "Head");
27
+ _chunkOUQM7GZHjs.__name.call(void 0, Head, "Head");
28
28
  function Query(key = "") {
29
29
  return BaseParam({
30
30
  type: "query",
31
31
  key
32
32
  });
33
33
  }
34
- _chunk4LLLQOMFjs.__name.call(void 0, Query, "Query");
34
+ _chunkOUQM7GZHjs.__name.call(void 0, Query, "Query");
35
35
  function Param(key) {
36
36
  return BaseParam({
37
37
  type: "params",
38
38
  key
39
39
  });
40
40
  }
41
- _chunk4LLLQOMFjs.__name.call(void 0, Param, "Param");
41
+ _chunkOUQM7GZHjs.__name.call(void 0, Param, "Param");
42
42
  function Arg(target, k, index) {
43
43
  BaseParam({
44
44
  type: "args",
45
45
  key: `${index}`
46
46
  })(target, k, index);
47
47
  }
48
- _chunk4LLLQOMFjs.__name.call(void 0, Arg, "Arg");
48
+ _chunkOUQM7GZHjs.__name.call(void 0, Arg, "Arg");
49
49
  function OneFile(key = "") {
50
50
  return BaseParam({
51
51
  type: "file",
52
52
  key
53
53
  });
54
54
  }
55
- _chunk4LLLQOMFjs.__name.call(void 0, OneFile, "OneFile");
55
+ _chunkOUQM7GZHjs.__name.call(void 0, OneFile, "OneFile");
56
56
  function ManyFiles(key = "") {
57
57
  return BaseParam({
58
58
  type: "files",
59
59
  key
60
60
  });
61
61
  }
62
- _chunk4LLLQOMFjs.__name.call(void 0, ManyFiles, "ManyFiles");
62
+ _chunkOUQM7GZHjs.__name.call(void 0, ManyFiles, "ManyFiles");
63
63
 
64
64
  // src/decorators/aop.ts
65
65
 
@@ -70,7 +70,7 @@ function Guard(...guards) {
70
70
  });
71
71
  };
72
72
  }
73
- _chunk4LLLQOMFjs.__name.call(void 0, Guard, "Guard");
73
+ _chunkOUQM7GZHjs.__name.call(void 0, Guard, "Guard");
74
74
  function Addon(...addons) {
75
75
  return (target, property) => {
76
76
  _phecdacore.setMeta.call(void 0, target, property, void 0, {
@@ -78,7 +78,7 @@ function Addon(...addons) {
78
78
  });
79
79
  };
80
80
  }
81
- _chunk4LLLQOMFjs.__name.call(void 0, Addon, "Addon");
81
+ _chunkOUQM7GZHjs.__name.call(void 0, Addon, "Addon");
82
82
  function Filter(filter) {
83
83
  return (target, property) => {
84
84
  _phecdacore.setMeta.call(void 0, target, property, void 0, {
@@ -86,7 +86,7 @@ function Filter(filter) {
86
86
  });
87
87
  };
88
88
  }
89
- _chunk4LLLQOMFjs.__name.call(void 0, Filter, "Filter");
89
+ _chunkOUQM7GZHjs.__name.call(void 0, Filter, "Filter");
90
90
  function Pipe(pipe) {
91
91
  return (target, property, index) => {
92
92
  if (typeof index === "number") {
@@ -100,7 +100,7 @@ function Pipe(pipe) {
100
100
  });
101
101
  };
102
102
  }
103
- _chunk4LLLQOMFjs.__name.call(void 0, Pipe, "Pipe");
103
+ _chunkOUQM7GZHjs.__name.call(void 0, Pipe, "Pipe");
104
104
 
105
105
  // src/decorators/http.ts
106
106
 
@@ -114,7 +114,7 @@ function Route(route, method) {
114
114
  });
115
115
  };
116
116
  }
117
- _chunk4LLLQOMFjs.__name.call(void 0, Route, "Route");
117
+ _chunkOUQM7GZHjs.__name.call(void 0, Route, "Route");
118
118
  function Header(headers) {
119
119
  return (target, property) => {
120
120
  _phecdacore.setMeta.call(void 0, target, property, void 0, {
@@ -124,31 +124,31 @@ function Header(headers) {
124
124
  });
125
125
  };
126
126
  }
127
- _chunk4LLLQOMFjs.__name.call(void 0, Header, "Header");
127
+ _chunkOUQM7GZHjs.__name.call(void 0, Header, "Header");
128
128
  function Get(route = "") {
129
129
  return Route(route, "get");
130
130
  }
131
- _chunk4LLLQOMFjs.__name.call(void 0, Get, "Get");
131
+ _chunkOUQM7GZHjs.__name.call(void 0, Get, "Get");
132
132
  function Post(route = "") {
133
133
  return Route(route, "post");
134
134
  }
135
- _chunk4LLLQOMFjs.__name.call(void 0, Post, "Post");
135
+ _chunkOUQM7GZHjs.__name.call(void 0, Post, "Post");
136
136
  function Put(route = "") {
137
137
  return Route(route, "put");
138
138
  }
139
- _chunk4LLLQOMFjs.__name.call(void 0, Put, "Put");
139
+ _chunkOUQM7GZHjs.__name.call(void 0, Put, "Put");
140
140
  function Search(route = "") {
141
141
  return Route(route, "search");
142
142
  }
143
- _chunk4LLLQOMFjs.__name.call(void 0, Search, "Search");
143
+ _chunkOUQM7GZHjs.__name.call(void 0, Search, "Search");
144
144
  function Patch(route = "") {
145
145
  return Route(route, "patch");
146
146
  }
147
- _chunk4LLLQOMFjs.__name.call(void 0, Patch, "Patch");
147
+ _chunkOUQM7GZHjs.__name.call(void 0, Patch, "Patch");
148
148
  function Delete(route = "") {
149
149
  return Route(route, "delete");
150
150
  }
151
- _chunk4LLLQOMFjs.__name.call(void 0, Delete, "Delete");
151
+ _chunkOUQM7GZHjs.__name.call(void 0, Delete, "Delete");
152
152
  function Controller(prefix = "") {
153
153
  return (target) => {
154
154
  _phecdacore.setMeta.call(void 0, target, void 0, void 0, {
@@ -159,7 +159,7 @@ function Controller(prefix = "") {
159
159
  });
160
160
  };
161
161
  }
162
- _chunk4LLLQOMFjs.__name.call(void 0, Controller, "Controller");
162
+ _chunkOUQM7GZHjs.__name.call(void 0, Controller, "Controller");
163
163
 
164
164
  // src/decorators/rpc.ts
165
165
 
@@ -173,7 +173,7 @@ function Queue(queue = "", isEvent) {
173
173
  });
174
174
  };
175
175
  }
176
- _chunk4LLLQOMFjs.__name.call(void 0, Queue, "Queue");
176
+ _chunkOUQM7GZHjs.__name.call(void 0, Queue, "Queue");
177
177
  function Rpc() {
178
178
  return (target) => {
179
179
  _phecdacore.setMeta.call(void 0, target, void 0, void 0, {
@@ -181,11 +181,11 @@ function Rpc() {
181
181
  });
182
182
  };
183
183
  }
184
- _chunk4LLLQOMFjs.__name.call(void 0, Rpc, "Rpc");
184
+ _chunkOUQM7GZHjs.__name.call(void 0, Rpc, "Rpc");
185
185
 
186
186
  // src/decorators/ctx.ts
187
187
 
188
- var Ctx = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (target, property) => {
188
+ var Ctx = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (target, property) => {
189
189
  _phecdacore.setMeta.call(void 0, target, _phecdacore.SHARE_KEY, void 0, {
190
190
  ctxs: [
191
191
  property
@@ -214,7 +214,7 @@ function Define(key, value) {
214
214
  }
215
215
  };
216
216
  }
217
- _chunk4LLLQOMFjs.__name.call(void 0, Define, "Define");
217
+ _chunkOUQM7GZHjs.__name.call(void 0, Define, "Define");
218
218
 
219
219
  // src/decorators/openapi.ts
220
220
 
@@ -225,7 +225,7 @@ function ApiDoc(config) {
225
225
  });
226
226
  };
227
227
  }
228
- _chunk4LLLQOMFjs.__name.call(void 0, ApiDoc, "ApiDoc");
228
+ _chunkOUQM7GZHjs.__name.call(void 0, ApiDoc, "ApiDoc");
229
229
 
230
230
 
231
231
 
@@ -8,11 +8,11 @@ var IS_ONLY_GENERATE = !!process.env.PS_GENERATE;
8
8
  var IS_STRICT = !!process.env.PS_STRICT;
9
9
  var IS_PURE = !!process.env.PS_PURE;
10
10
  var LOG_LEVEL = Number(process.env.PS_LOG_LEVEL || 0);
11
- var PS_EXIT_CODE = /* @__PURE__ */ function(PS_EXIT_CODE2) {
11
+ var PS_EXIT_CODE = /* @__PURE__ */ (function(PS_EXIT_CODE2) {
12
12
  PS_EXIT_CODE2[PS_EXIT_CODE2["RELAUNCH"] = 4171] = "RELAUNCH";
13
13
  PS_EXIT_CODE2[PS_EXIT_CODE2["EXIT"] = 4172] = "EXIT";
14
14
  return PS_EXIT_CODE2;
15
- }({});
15
+ })({});
16
16
 
17
17
  // src/utils.ts
18
18
  import pc from "picocolors";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __name
3
- } from "./chunk-NQ55PA2X.mjs";
3
+ } from "./chunk-JRNXLEAU.mjs";
4
4
 
5
5
  // src/decorators/param.ts
6
6
  import { setMeta } from "phecda-core";
@@ -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,7 +22,7 @@ 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
 
@@ -35,7 +35,7 @@ var Exception = class extends Error {
35
35
  message: this.message,
36
36
  description: this.description,
37
37
  status: this.status,
38
- [_chunk4LLLQOMFjs.ERROR_SYMBOL]: true
38
+ [_chunkOUQM7GZHjs.ERROR_SYMBOL]: true
39
39
  };
40
40
  }
41
41
  };
@@ -43,7 +43,7 @@ var Exception = class extends Error {
43
43
  // src/exception/undefine.ts
44
44
  var UndefinedException = class extends Exception {
45
45
  static {
46
- _chunk4LLLQOMFjs.__name.call(void 0, this, "UndefinedException");
46
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "UndefinedException");
47
47
  }
48
48
  constructor(message) {
49
49
  super(message, 500, "Undefined error");
@@ -53,7 +53,7 @@ var UndefinedException = class extends Exception {
53
53
  // src/exception/validate.ts
54
54
  var ValidateException = class extends Exception {
55
55
  static {
56
- _chunk4LLLQOMFjs.__name.call(void 0, this, "ValidateException");
56
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "ValidateException");
57
57
  }
58
58
  constructor(message) {
59
59
  super(message, 400, "Validate exception");
@@ -63,7 +63,7 @@ var ValidateException = class extends Exception {
63
63
  // src/exception/forbidden.ts
64
64
  var ForbiddenException = class extends Exception {
65
65
  static {
66
- _chunk4LLLQOMFjs.__name.call(void 0, this, "ForbiddenException");
66
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "ForbiddenException");
67
67
  }
68
68
  constructor(message) {
69
69
  super(message, 403, "Forbidden resource");
@@ -73,7 +73,7 @@ var ForbiddenException = class extends Exception {
73
73
  // src/exception/bad-request.ts
74
74
  var BadRequestException = class extends Exception {
75
75
  static {
76
- _chunk4LLLQOMFjs.__name.call(void 0, this, "BadRequestException");
76
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "BadRequestException");
77
77
  }
78
78
  constructor(message) {
79
79
  super(message, 400, "Bad Request");
@@ -83,7 +83,7 @@ var BadRequestException = class extends Exception {
83
83
  // src/exception/not-found.ts
84
84
  var NotFoundException = class extends Exception {
85
85
  static {
86
- _chunk4LLLQOMFjs.__name.call(void 0, this, "NotFoundException");
86
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "NotFoundException");
87
87
  }
88
88
  constructor(message) {
89
89
  super(message, 404, "Not Found");
@@ -93,7 +93,7 @@ var NotFoundException = class extends Exception {
93
93
  // src/exception/conflict.ts
94
94
  var ConflictException = class extends Exception {
95
95
  static {
96
- _chunk4LLLQOMFjs.__name.call(void 0, this, "ConflictException");
96
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "ConflictException");
97
97
  }
98
98
  constructor(message) {
99
99
  super(message, 409, "Conflict");
@@ -103,7 +103,7 @@ var ConflictException = class extends Exception {
103
103
  // src/exception/bad-gateway.ts
104
104
  var BadGatewayException = class extends Exception {
105
105
  static {
106
- _chunk4LLLQOMFjs.__name.call(void 0, this, "BadGatewayException");
106
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "BadGatewayException");
107
107
  }
108
108
  constructor(message) {
109
109
  super(message, 502, "Bad Gatrway");
@@ -113,7 +113,7 @@ var BadGatewayException = class extends Exception {
113
113
  // src/exception/invalid-input.ts
114
114
  var InvalidInputException = class extends Exception {
115
115
  static {
116
- _chunk4LLLQOMFjs.__name.call(void 0, this, "InvalidInputException");
116
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "InvalidInputException");
117
117
  }
118
118
  constructor(message) {
119
119
  super(message, 502, "Invalid Input");
@@ -123,7 +123,7 @@ var InvalidInputException = class extends Exception {
123
123
  // src/exception/media-type.ts
124
124
  var UnsupportedMediaTypeException = class extends Exception {
125
125
  static {
126
- _chunk4LLLQOMFjs.__name.call(void 0, this, "UnsupportedMediaTypeException");
126
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "UnsupportedMediaTypeException");
127
127
  }
128
128
  constructor(message) {
129
129
  super(message, 415, "Unsupported Media Type");
@@ -133,7 +133,7 @@ var UnsupportedMediaTypeException = class extends Exception {
133
133
  // src/exception/payload-large.ts
134
134
  var PayloadLargeException = class extends Exception {
135
135
  static {
136
- _chunk4LLLQOMFjs.__name.call(void 0, this, "PayloadLargeException");
136
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "PayloadLargeException");
137
137
  }
138
138
  constructor(message) {
139
139
  super(message, 413, "Payload Too Large");
@@ -143,7 +143,7 @@ var PayloadLargeException = class extends Exception {
143
143
  // src/exception/timeout.ts
144
144
  var TimeoutException = class extends Exception {
145
145
  static {
146
- _chunk4LLLQOMFjs.__name.call(void 0, this, "TimeoutException");
146
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "TimeoutException");
147
147
  }
148
148
  constructor(message) {
149
149
  super(message, 408, "Request Timeout");
@@ -153,7 +153,7 @@ var TimeoutException = class extends Exception {
153
153
  // src/exception/unauthorized.ts
154
154
  var UnauthorizedException = class extends Exception {
155
155
  static {
156
- _chunk4LLLQOMFjs.__name.call(void 0, this, "UnauthorizedException");
156
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "UnauthorizedException");
157
157
  }
158
158
  constructor(message) {
159
159
  super(message, 401, "Unauthorized");
@@ -163,7 +163,7 @@ var UnauthorizedException = class extends Exception {
163
163
  // src/exception/unavailable-service.ts
164
164
  var ServiceUnavailableException = class extends Exception {
165
165
  static {
166
- _chunk4LLLQOMFjs.__name.call(void 0, this, "ServiceUnavailableException");
166
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "ServiceUnavailableException");
167
167
  }
168
168
  constructor(message) {
169
169
  super(message, 503, "Service Unavailable");
@@ -173,7 +173,7 @@ var ServiceUnavailableException = class extends Exception {
173
173
  // src/exception/framework.ts
174
174
  var FrameworkException = class extends Exception {
175
175
  static {
176
- _chunk4LLLQOMFjs.__name.call(void 0, this, "FrameworkException");
176
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "FrameworkException");
177
177
  }
178
178
  constructor(message) {
179
179
  super(`[phecda-server] ${message}`, 500, "Framework Error");
@@ -183,7 +183,7 @@ var FrameworkException = class extends Exception {
183
183
  // src/exception/timer.ts
184
184
  var TimerException = class extends Exception {
185
185
  static {
186
- _chunk4LLLQOMFjs.__name.call(void 0, this, "TimerException");
186
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "TimerException");
187
187
  }
188
188
  constructor(message) {
189
189
  super(message, 0, "Timer Error");
@@ -193,7 +193,7 @@ var TimerException = class extends Exception {
193
193
  // src/exception/worker.ts
194
194
  var WorkerException = class extends Exception {
195
195
  static {
196
- _chunk4LLLQOMFjs.__name.call(void 0, this, "WorkerException");
196
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "WorkerException");
197
197
  }
198
198
  constructor(message) {
199
199
  super(message, 0, "Worker Error");
@@ -201,7 +201,7 @@ var WorkerException = class extends Exception {
201
201
  };
202
202
 
203
203
  // src/pipe.ts
204
- var defaultPipe = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, async ({ arg, reflect, meta, index, type }, { method }) => {
204
+ var defaultPipe = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, async ({ arg, reflect, meta, index, type }, { method }) => {
205
205
  if (meta.const) {
206
206
  if (arg !== meta.const) throw new ValidateException(`param ${index + 1} must be ${meta.const}`);
207
207
  }
@@ -285,14 +285,14 @@ var defaultPipe = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, async ({
285
285
  }, "defaultPipe");
286
286
 
287
287
  // src/filter.ts
288
- var defaultFilter = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (e) => {
288
+ var defaultFilter = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (e) => {
289
289
  if (!(e instanceof Exception)) {
290
- _chunk4LLLQOMFjs.log.call(void 0, e.message, "error");
291
- if (_chunk4LLLQOMFjs.LOG_LEVEL <= 0) console.error(e.stack);
290
+ _chunkOUQM7GZHjs.log.call(void 0, e.message, "error");
291
+ if (_chunkOUQM7GZHjs.LOG_LEVEL <= 0) console.error(e.stack);
292
292
  e = new UndefinedException(e.message || e);
293
293
  } else {
294
- _chunk4LLLQOMFjs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
295
- if (_chunk4LLLQOMFjs.LOG_LEVEL <= 0) console.error(e.stack);
294
+ _chunkOUQM7GZHjs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
295
+ if (_chunkOUQM7GZHjs.LOG_LEVEL <= 0) console.error(e.stack);
296
296
  }
297
297
  return e.data;
298
298
  }, "defaultFilter");
@@ -301,7 +301,7 @@ var defaultFilter = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (e) =>
301
301
  var debug = _debug2.default.call(void 0, "phecda-server(Context)");
302
302
  var Context = (_class = class _Context {
303
303
  static {
304
- _chunk4LLLQOMFjs.__name.call(void 0, this, "Context");
304
+ _chunkOUQM7GZHjs.__name.call(void 0, this, "Context");
305
305
  }
306
306
 
307
307
 
@@ -318,11 +318,11 @@ var Context = (_class = class _Context {
318
318
  // protected canGetCtx = true
319
319
  constructor(data) {
320
320
  this.data = data;
321
- if (_chunk4LLLQOMFjs.IS_DEV)
321
+ if (_chunkOUQM7GZHjs.IS_DEV)
322
322
  data._context = this;
323
323
  this.ctx = new Proxy(data, {
324
324
  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);
325
+ 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
326
  return target[p];
327
327
  },
328
328
  set(target, p, newValue) {
@@ -360,7 +360,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
360
360
  const { paramsType, data: { ctxs, tag, params, method } } = meta;
361
361
  try {
362
362
  let res;
363
- const nextHandler = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (index) => {
363
+ const nextHandler = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (index) => {
364
364
  return async () => {
365
365
  if (index === guards.length) {
366
366
  const instance = moduleMap.get(tag);
@@ -384,7 +384,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
384
384
  return res;
385
385
  });
386
386
  }
387
- _chunk4LLLQOMFjs.__name.call(void 0, next, "next");
387
+ _chunkOUQM7GZHjs.__name.call(void 0, next, "next");
388
388
  const ret = await guards[index](this.ctx, next);
389
389
  if (ret !== void 0) {
390
390
  res = ret;
@@ -429,12 +429,12 @@ function addPipe(key, pipe) {
429
429
  if (Context.pipeRecord[key] && Context.pipeRecord[key] !== pipe) debug(`overwrite Pipe "${String(key)}"`, "warn");
430
430
  Context.pipeRecord[key] = pipe;
431
431
  }
432
- _chunk4LLLQOMFjs.__name.call(void 0, addPipe, "addPipe");
432
+ _chunkOUQM7GZHjs.__name.call(void 0, addPipe, "addPipe");
433
433
  function addFilter(key, filter) {
434
434
  if (Context.filterRecord[key] && Context.filterRecord[key] !== filter) debug(`overwrite Filter "${String(key)}"`, "warn");
435
435
  Context.filterRecord[key] = filter;
436
436
  }
437
- _chunk4LLLQOMFjs.__name.call(void 0, addFilter, "addFilter");
437
+ _chunkOUQM7GZHjs.__name.call(void 0, addFilter, "addFilter");
438
438
  function addGuard(key, guard, priority = 0) {
439
439
  if (Context.guardRecord[key] && Context.guardRecord[key].value !== guard) debug(`overwrite Guard "${String(key)}"`, "warn");
440
440
  Context.guardRecord[key] = {
@@ -442,7 +442,7 @@ function addGuard(key, guard, priority = 0) {
442
442
  priority
443
443
  };
444
444
  }
445
- _chunk4LLLQOMFjs.__name.call(void 0, addGuard, "addGuard");
445
+ _chunkOUQM7GZHjs.__name.call(void 0, addGuard, "addGuard");
446
446
  function addAddon(key, addon, priority = 0) {
447
447
  if (Context.addonRecord[key] && Context.addonRecord[key].value !== addon) debug(`overwrite Addon "${String(key)}"`, "warn");
448
448
  Context.addonRecord[key] = {
@@ -450,14 +450,14 @@ function addAddon(key, addon, priority = 0) {
450
450
  priority
451
451
  };
452
452
  }
453
- _chunk4LLLQOMFjs.__name.call(void 0, addAddon, "addAddon");
453
+ _chunkOUQM7GZHjs.__name.call(void 0, addAddon, "addAddon");
454
454
 
455
455
  // src/http/helper.ts
456
456
  function resolveDep(ret, key) {
457
457
  if (key) return _optionalChain([ret, 'optionalAccess', _ => _[key]]);
458
458
  return ret;
459
459
  }
460
- _chunk4LLLQOMFjs.__name.call(void 0, resolveDep, "resolveDep");
460
+ _chunkOUQM7GZHjs.__name.call(void 0, resolveDep, "resolveDep");
461
461
 
462
462
  // src/decorators/helper.ts
463
463
  function shallowClone(obj) {
@@ -465,11 +465,11 @@ function shallowClone(obj) {
465
465
  ...obj
466
466
  };
467
467
  }
468
- _chunk4LLLQOMFjs.__name.call(void 0, shallowClone, "shallowClone");
468
+ _chunkOUQM7GZHjs.__name.call(void 0, shallowClone, "shallowClone");
469
469
  function mergeObject(...args) {
470
470
  return Object.assign({}, ...args);
471
471
  }
472
- _chunk4LLLQOMFjs.__name.call(void 0, mergeObject, "mergeObject");
472
+ _chunkOUQM7GZHjs.__name.call(void 0, mergeObject, "mergeObject");
473
473
 
474
474
  // src/helper.ts
475
475
  function createControllerMetaMap(meta, filter) {
@@ -485,14 +485,14 @@ function createControllerMetaMap(meta, filter) {
485
485
  });
486
486
  }
487
487
  }
488
- _chunk4LLLQOMFjs.__name.call(void 0, handleMeta, "handleMeta");
488
+ _chunkOUQM7GZHjs.__name.call(void 0, handleMeta, "handleMeta");
489
489
  handleMeta();
490
- _chunk4LLLQOMFjs.HMR.call(void 0, handleMeta);
490
+ _chunkOUQM7GZHjs.HMR.call(void 0, handleMeta);
491
491
  return metaMap;
492
492
  }
493
- _chunk4LLLQOMFjs.__name.call(void 0, createControllerMetaMap, "createControllerMetaMap");
493
+ _chunkOUQM7GZHjs.__name.call(void 0, createControllerMetaMap, "createControllerMetaMap");
494
494
  function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
495
- if (_chunk4LLLQOMFjs.IS_PURE) return;
495
+ if (_chunkOUQM7GZHjs.IS_PURE) return;
496
496
  const addonSet = /* @__PURE__ */ new Set();
497
497
  const guardSet = /* @__PURE__ */ new Set();
498
498
  const pipeSet = /* @__PURE__ */ new Set();
@@ -537,34 +537,34 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
537
537
  ...filterSet
538
538
  ].filter((i) => !Context.filterRecord[i]);
539
539
  function exit() {
540
- if (_chunk4LLLQOMFjs.IS_STRICT) {
541
- _chunk4LLLQOMFjs.log.call(void 0, "Does not meet strict mode requirements", "error");
540
+ if (_chunkOUQM7GZHjs.IS_STRICT) {
541
+ _chunkOUQM7GZHjs.log.call(void 0, "Does not meet strict mode requirements", "error");
542
542
  process.exit(1);
543
543
  }
544
544
  }
545
- _chunk4LLLQOMFjs.__name.call(void 0, exit, "exit");
545
+ _chunkOUQM7GZHjs.__name.call(void 0, exit, "exit");
546
546
  if (missAddons.length) {
547
- _chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.white(`Addon [${missAddons.join(",")}]`)} doesn't exist`, "warn");
547
+ _chunkOUQM7GZHjs.log.call(void 0, `${_picocolors2.default.white(`Addon [${missAddons.join(",")}]`)} doesn't exist`, "warn");
548
548
  exit();
549
549
  }
550
550
  if (missGuards.length) {
551
- _chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
551
+ _chunkOUQM7GZHjs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
552
552
  exit();
553
553
  }
554
554
  if (missPipes.length) {
555
- _chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
555
+ _chunkOUQM7GZHjs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
556
556
  exit();
557
557
  }
558
558
  if (missFilters.length) {
559
- _chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
559
+ _chunkOUQM7GZHjs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
560
560
  exit();
561
561
  }
562
- warningSet.forEach((warn) => _chunk4LLLQOMFjs.log.call(void 0, warn, "warn"));
562
+ warningSet.forEach((warn) => _chunkOUQM7GZHjs.log.call(void 0, warn, "warn"));
563
563
  if (warningSet.size) exit();
564
564
  }
565
- _chunk4LLLQOMFjs.__name.call(void 0, handleMeta, "handleMeta");
565
+ _chunkOUQM7GZHjs.__name.call(void 0, handleMeta, "handleMeta");
566
566
  handleMeta();
567
- _chunk4LLLQOMFjs.HMR.call(void 0, handleMeta);
567
+ _chunkOUQM7GZHjs.HMR.call(void 0, handleMeta);
568
568
  return {
569
569
  addonSet,
570
570
  guardSet,
@@ -572,7 +572,7 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
572
572
  filterSet
573
573
  };
574
574
  }
575
- _chunk4LLLQOMFjs.__name.call(void 0, detectAopDep, "detectAopDep");
575
+ _chunkOUQM7GZHjs.__name.call(void 0, detectAopDep, "detectAopDep");
576
576
  function joinUrl(base, ...paths) {
577
577
  const joinedPath = [
578
578
  base,
@@ -580,7 +580,7 @@ function joinUrl(base, ...paths) {
580
580
  ].filter((p) => p).map((path) => path.replace(/(^\/)/g, "")).join("/");
581
581
  return `/${joinedPath}`;
582
582
  }
583
- _chunk4LLLQOMFjs.__name.call(void 0, joinUrl, "joinUrl");
583
+ _chunkOUQM7GZHjs.__name.call(void 0, joinUrl, "joinUrl");
584
584
 
585
585
 
586
586
 
@@ -612,4 +612,5 @@ _chunk4LLLQOMFjs.__name.call(void 0, joinUrl, "joinUrl");
612
612
 
613
613
 
614
614
 
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;
615
+
616
+ 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;
@@ -8,11 +8,11 @@ var IS_ONLY_GENERATE = !!process.env.PS_GENERATE;
8
8
  var IS_STRICT = !!process.env.PS_STRICT;
9
9
  var IS_PURE = !!process.env.PS_PURE;
10
10
  var LOG_LEVEL = Number(process.env.PS_LOG_LEVEL || 0);
11
- var PS_EXIT_CODE = /* @__PURE__ */ function(PS_EXIT_CODE2) {
11
+ var PS_EXIT_CODE = /* @__PURE__ */ (function(PS_EXIT_CODE2) {
12
12
  PS_EXIT_CODE2[PS_EXIT_CODE2["RELAUNCH"] = 4171] = "RELAUNCH";
13
13
  PS_EXIT_CODE2[PS_EXIT_CODE2["EXIT"] = 4172] = "EXIT";
14
14
  return PS_EXIT_CODE2;
15
- }({});
15
+ })({});
16
16
 
17
17
  // src/utils.ts
18
18
  var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);