phecda-server 7.0.0-alpha.8 → 7.0.0-alpha.9

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 (79) hide show
  1. package/dist/{chunk-VSGYTGHY.js → chunk-5RBTN33A.js} +22 -2
  2. package/dist/{chunk-B45BN7LY.mjs → chunk-7ZGYJ5OW.mjs} +88 -54
  3. package/dist/{chunk-SGMQZRP6.mjs → chunk-CVPZWDXU.mjs} +2 -23
  4. package/dist/{chunk-7EMAZGYO.js → chunk-FX3LDQII.js} +59 -80
  5. package/dist/{chunk-YKP4ODZA.mjs → chunk-FXTJ3BJ6.mjs} +23 -3
  6. package/dist/{chunk-QJIAXSLZ.js → chunk-KJUD2BKE.js} +103 -69
  7. package/dist/{chunk-7NWDKK7D.mjs → chunk-ODVWOXVB.mjs} +1 -1
  8. package/dist/{chunk-BBNJVYVX.js → chunk-V5EYXVJT.js} +24 -24
  9. package/dist/{core-BcKywWLd.d.mts → core-BDkhrEyf.d.mts} +4 -3
  10. package/dist/{core-BGEsBtTG.d.ts → core-D_cz0tKa.d.ts} +4 -3
  11. package/dist/helper.d.mts +6 -5
  12. package/dist/helper.d.ts +6 -5
  13. package/dist/helper.js +6 -3
  14. package/dist/helper.mjs +8 -5
  15. package/dist/http/elysia/index.d.mts +3 -3
  16. package/dist/http/elysia/index.d.ts +3 -3
  17. package/dist/http/elysia/index.js +41 -45
  18. package/dist/http/elysia/index.mjs +4 -8
  19. package/dist/http/express/index.d.mts +3 -3
  20. package/dist/http/express/index.d.ts +3 -3
  21. package/dist/http/express/index.js +38 -42
  22. package/dist/http/express/index.mjs +4 -8
  23. package/dist/http/fastify/index.d.mts +3 -3
  24. package/dist/http/fastify/index.d.ts +3 -3
  25. package/dist/http/fastify/index.js +39 -43
  26. package/dist/http/fastify/index.mjs +4 -8
  27. package/dist/http/h3/index.d.mts +3 -3
  28. package/dist/http/h3/index.d.ts +3 -3
  29. package/dist/http/h3/index.js +39 -43
  30. package/dist/http/h3/index.mjs +3 -7
  31. package/dist/http/hono/index.d.mts +3 -3
  32. package/dist/http/hono/index.d.ts +3 -3
  33. package/dist/http/hono/index.js +35 -39
  34. package/dist/http/hono/index.mjs +3 -7
  35. package/dist/http/hyper-express/index.d.mts +3 -3
  36. package/dist/http/hyper-express/index.d.ts +3 -3
  37. package/dist/http/hyper-express/index.js +36 -40
  38. package/dist/http/hyper-express/index.mjs +3 -7
  39. package/dist/http/koa/index.d.mts +3 -3
  40. package/dist/http/koa/index.d.ts +3 -3
  41. package/dist/http/koa/index.js +38 -42
  42. package/dist/http/koa/index.mjs +4 -8
  43. package/dist/index.d.mts +8 -8
  44. package/dist/index.d.ts +8 -8
  45. package/dist/index.js +40 -42
  46. package/dist/index.mjs +4 -6
  47. package/dist/{meta-B_HW7cWh.d.mts → meta-BX5jhe4Z.d.mts} +1 -2
  48. package/dist/{meta-B_HW7cWh.d.ts → meta-BX5jhe4Z.d.ts} +1 -2
  49. package/dist/rpc/bullmq/index.d.mts +3 -3
  50. package/dist/rpc/bullmq/index.d.ts +3 -3
  51. package/dist/rpc/bullmq/index.js +14 -14
  52. package/dist/rpc/bullmq/index.mjs +3 -3
  53. package/dist/rpc/kafka/index.d.mts +3 -3
  54. package/dist/rpc/kafka/index.d.ts +3 -3
  55. package/dist/rpc/kafka/index.js +14 -14
  56. package/dist/rpc/kafka/index.mjs +2 -2
  57. package/dist/rpc/nats/index.d.mts +3 -3
  58. package/dist/rpc/nats/index.d.ts +3 -3
  59. package/dist/rpc/nats/index.js +13 -13
  60. package/dist/rpc/nats/index.mjs +3 -3
  61. package/dist/rpc/rabbitmq/index.d.mts +3 -3
  62. package/dist/rpc/rabbitmq/index.d.ts +3 -3
  63. package/dist/rpc/rabbitmq/index.js +15 -15
  64. package/dist/rpc/rabbitmq/index.mjs +3 -3
  65. package/dist/rpc/redis/index.d.mts +3 -3
  66. package/dist/rpc/redis/index.d.ts +3 -3
  67. package/dist/rpc/redis/index.js +13 -13
  68. package/dist/rpc/redis/index.mjs +3 -3
  69. package/dist/test.d.mts +3 -3
  70. package/dist/test.d.ts +3 -3
  71. package/dist/test.js +6 -6
  72. package/dist/test.mjs +2 -2
  73. package/dist/{types-DEQb_e59.d.mts → types-B-rUM9Fm.d.mts} +1 -1
  74. package/dist/{types-PFPIQWVF.d.ts → types-CMeuFoyd.d.ts} +1 -1
  75. package/dist/{types-C2SQ9U9V.d.mts → types-DKVhyZk_.d.mts} +1 -1
  76. package/dist/{types-CYF0vha6.d.ts → types-MxxtkZXw.d.ts} +1 -1
  77. package/package.json +1 -1
  78. package/register/index.mjs +20 -11
  79. package/register/loader.mjs +12 -27
@@ -5,7 +5,8 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkVSGYTGHYjs = require('./chunk-VSGYTGHY.js');
8
+
9
+ var _chunk5RBTN33Ajs = require('./chunk-5RBTN33A.js');
9
10
 
10
11
  // src/helper.ts
11
12
  var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
@@ -15,14 +16,14 @@ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
15
16
 
16
17
 
17
18
  // src/pipe.ts
18
- var defaultPipe = /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, ({ arg }) => {
19
+ var defaultPipe = /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, ({ arg }) => {
19
20
  return arg;
20
21
  }, "defaultPipe");
21
22
 
22
23
  // src/exception/base.ts
23
24
  var Exception = class extends Error {
24
25
  static {
25
- _chunkVSGYTGHYjs.__name.call(void 0, this, "Exception");
26
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "Exception");
26
27
  }
27
28
 
28
29
 
@@ -35,7 +36,7 @@ var Exception = class extends Error {
35
36
  message: this.message,
36
37
  description: this.description,
37
38
  status: this.status,
38
- [_chunkVSGYTGHYjs.ERROR_SYMBOL]: true
39
+ [_chunk5RBTN33Ajs.ERROR_SYMBOL]: true
39
40
  };
40
41
  }
41
42
  };
@@ -43,7 +44,7 @@ var Exception = class extends Error {
43
44
  // src/exception/undefine.ts
44
45
  var UndefinedException = class extends Exception {
45
46
  static {
46
- _chunkVSGYTGHYjs.__name.call(void 0, this, "UndefinedException");
47
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "UndefinedException");
47
48
  }
48
49
  constructor(message) {
49
50
  super(message, 500, "Undefined error");
@@ -53,7 +54,7 @@ var UndefinedException = class extends Exception {
53
54
  // src/exception/validate.ts
54
55
  var ValidateException = class extends Exception {
55
56
  static {
56
- _chunkVSGYTGHYjs.__name.call(void 0, this, "ValidateException");
57
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "ValidateException");
57
58
  }
58
59
  constructor(message) {
59
60
  super(message, 400, "Validate exception");
@@ -63,7 +64,7 @@ var ValidateException = class extends Exception {
63
64
  // src/exception/forbidden.ts
64
65
  var ForbiddenException = class extends Exception {
65
66
  static {
66
- _chunkVSGYTGHYjs.__name.call(void 0, this, "ForbiddenException");
67
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "ForbiddenException");
67
68
  }
68
69
  constructor(message) {
69
70
  super(message, 403, "Forbidden resource");
@@ -73,7 +74,7 @@ var ForbiddenException = class extends Exception {
73
74
  // src/exception/bad-request.ts
74
75
  var BadRequestException = class extends Exception {
75
76
  static {
76
- _chunkVSGYTGHYjs.__name.call(void 0, this, "BadRequestException");
77
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "BadRequestException");
77
78
  }
78
79
  constructor(message) {
79
80
  super(message, 400, "Bad Request");
@@ -83,7 +84,7 @@ var BadRequestException = class extends Exception {
83
84
  // src/exception/not-found.ts
84
85
  var NotFoundException = class extends Exception {
85
86
  static {
86
- _chunkVSGYTGHYjs.__name.call(void 0, this, "NotFoundException");
87
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "NotFoundException");
87
88
  }
88
89
  constructor(message) {
89
90
  super(message, 404, "Not Found");
@@ -93,7 +94,7 @@ var NotFoundException = class extends Exception {
93
94
  // src/exception/conflict.ts
94
95
  var ConflictException = class extends Exception {
95
96
  static {
96
- _chunkVSGYTGHYjs.__name.call(void 0, this, "ConflictException");
97
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "ConflictException");
97
98
  }
98
99
  constructor(message) {
99
100
  super(message, 409, "Conflict");
@@ -103,7 +104,7 @@ var ConflictException = class extends Exception {
103
104
  // src/exception/bad-gateway.ts
104
105
  var BadGatewayException = class extends Exception {
105
106
  static {
106
- _chunkVSGYTGHYjs.__name.call(void 0, this, "BadGatewayException");
107
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "BadGatewayException");
107
108
  }
108
109
  constructor(message) {
109
110
  super(message, 502, "Bad Gatrway");
@@ -113,7 +114,7 @@ var BadGatewayException = class extends Exception {
113
114
  // src/exception/invalid-input.ts
114
115
  var InvalidInputException = class extends Exception {
115
116
  static {
116
- _chunkVSGYTGHYjs.__name.call(void 0, this, "InvalidInputException");
117
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "InvalidInputException");
117
118
  }
118
119
  constructor(message) {
119
120
  super(message, 502, "Invalid Input");
@@ -123,7 +124,7 @@ var InvalidInputException = class extends Exception {
123
124
  // src/exception/media-type.ts
124
125
  var UnsupportedMediaTypeException = class extends Exception {
125
126
  static {
126
- _chunkVSGYTGHYjs.__name.call(void 0, this, "UnsupportedMediaTypeException");
127
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "UnsupportedMediaTypeException");
127
128
  }
128
129
  constructor(message) {
129
130
  super(message, 415, "Unsupported Media Type");
@@ -133,7 +134,7 @@ var UnsupportedMediaTypeException = class extends Exception {
133
134
  // src/exception/payload-large.ts
134
135
  var PayloadLargeException = class extends Exception {
135
136
  static {
136
- _chunkVSGYTGHYjs.__name.call(void 0, this, "PayloadLargeException");
137
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "PayloadLargeException");
137
138
  }
138
139
  constructor(message) {
139
140
  super(message, 413, "Payload Too Large");
@@ -143,7 +144,7 @@ var PayloadLargeException = class extends Exception {
143
144
  // src/exception/timeout.ts
144
145
  var TimeoutException = class extends Exception {
145
146
  static {
146
- _chunkVSGYTGHYjs.__name.call(void 0, this, "TimeoutException");
147
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "TimeoutException");
147
148
  }
148
149
  constructor(message) {
149
150
  super(message, 408, "Request Timeout");
@@ -153,7 +154,7 @@ var TimeoutException = class extends Exception {
153
154
  // src/exception/unauthorized.ts
154
155
  var UnauthorizedException = class extends Exception {
155
156
  static {
156
- _chunkVSGYTGHYjs.__name.call(void 0, this, "UnauthorizedException");
157
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "UnauthorizedException");
157
158
  }
158
159
  constructor(message) {
159
160
  super(message, 401, "Unauthorized");
@@ -163,7 +164,7 @@ var UnauthorizedException = class extends Exception {
163
164
  // src/exception/unavailable-service.ts
164
165
  var ServiceUnavailableException = class extends Exception {
165
166
  static {
166
- _chunkVSGYTGHYjs.__name.call(void 0, this, "ServiceUnavailableException");
167
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "ServiceUnavailableException");
167
168
  }
168
169
  constructor(message) {
169
170
  super(message, 503, "Service Unavailable");
@@ -173,7 +174,7 @@ var ServiceUnavailableException = class extends Exception {
173
174
  // src/exception/framework.ts
174
175
  var FrameworkException = class extends Exception {
175
176
  static {
176
- _chunkVSGYTGHYjs.__name.call(void 0, this, "FrameworkException");
177
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "FrameworkException");
177
178
  }
178
179
  constructor(message) {
179
180
  super(`[phecda-server] ${message}`, 500, "Framework Error");
@@ -183,7 +184,7 @@ var FrameworkException = class extends Exception {
183
184
  // src/exception/timer.ts
184
185
  var TimerException = class extends Exception {
185
186
  static {
186
- _chunkVSGYTGHYjs.__name.call(void 0, this, "TimerException");
187
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "TimerException");
187
188
  }
188
189
  constructor(message) {
189
190
  super(message, 0, "Timer Error");
@@ -193,7 +194,7 @@ var TimerException = class extends Exception {
193
194
  // src/exception/worker.ts
194
195
  var WorkerException = class extends Exception {
195
196
  static {
196
- _chunkVSGYTGHYjs.__name.call(void 0, this, "WorkerException");
197
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "WorkerException");
197
198
  }
198
199
  constructor(message) {
199
200
  super(message, 0, "Worker Error");
@@ -201,14 +202,14 @@ var WorkerException = class extends Exception {
201
202
  };
202
203
 
203
204
  // src/filter.ts
204
- var defaultFilter = /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (e) => {
205
+ var defaultFilter = /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (e) => {
205
206
  if (!(e instanceof Exception)) {
206
- _chunkVSGYTGHYjs.log.call(void 0, e.message, "error");
207
- if (_chunkVSGYTGHYjs.LOG_LEVEL <= 0) console.error(e.stack);
207
+ _chunk5RBTN33Ajs.log.call(void 0, e.message, "error");
208
+ if (_chunk5RBTN33Ajs.LOG_LEVEL <= 0) console.error(e.stack);
208
209
  e = new UndefinedException(e.message || e);
209
210
  } else {
210
- _chunkVSGYTGHYjs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
211
- if (_chunkVSGYTGHYjs.LOG_LEVEL <= 0) console.error(e.stack);
211
+ _chunk5RBTN33Ajs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
212
+ if (_chunk5RBTN33Ajs.LOG_LEVEL <= 0) console.error(e.stack);
212
213
  }
213
214
  return e.data;
214
215
  }, "defaultFilter");
@@ -217,7 +218,7 @@ var defaultFilter = /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (e) =>
217
218
  var debug = _debug2.default.call(void 0, "phecda-server(Context)");
218
219
  var Context = (_class = class _Context {
219
220
  static {
220
- _chunkVSGYTGHYjs.__name.call(void 0, this, "Context");
221
+ _chunk5RBTN33Ajs.__name.call(void 0, this, "Context");
221
222
  }
222
223
 
223
224
 
@@ -235,13 +236,13 @@ var Context = (_class = class _Context {
235
236
  constructor(data) {
236
237
  this.data = data;
237
238
  this.canGetCtx = true;
238
- if (_chunkVSGYTGHYjs.IS_DEV)
239
+ if (_chunk5RBTN33Ajs.IS_DEV)
239
240
  data._context = this;
240
241
  const that = this;
241
242
  this.ctx = new Proxy(data, {
242
243
  get(target, p) {
243
- if (_chunkVSGYTGHYjs.IS_DEV && !that.canGetCtx) throw new FrameworkException("ctx must be obtained within the same request cycle in controller");
244
- if (!(p in target)) _chunkVSGYTGHYjs.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);
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);
245
246
  return target[p];
246
247
  },
247
248
  set(target, p, newValue) {
@@ -279,7 +280,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
279
280
  const { paramsType, data: { ctxs, tag, params, func } } = meta;
280
281
  try {
281
282
  let res;
282
- const nextHandler = /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (index) => {
283
+ const nextHandler = /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (index) => {
283
284
  return async () => {
284
285
  if (index === guards.length) {
285
286
  const instance = moduleMap.get(tag);
@@ -291,7 +292,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
291
292
  reflect: paramsType[item.index],
292
293
  ...item
293
294
  }, this.ctx)));
294
- if (_chunkVSGYTGHYjs.IS_DEV) {
295
+ if (_chunk5RBTN33Ajs.IS_DEV) {
295
296
  Promise.resolve().then(() => {
296
297
  this.canGetCtx = false;
297
298
  });
@@ -309,7 +310,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
309
310
  return res;
310
311
  });
311
312
  }
312
- _chunkVSGYTGHYjs.__name.call(void 0, next, "next");
313
+ _chunk5RBTN33Ajs.__name.call(void 0, next, "next");
313
314
  const ret = await guards[index](this.ctx, next);
314
315
  if (ret !== void 0) {
315
316
  res = ret;
@@ -354,12 +355,12 @@ function addPipe(key, pipe) {
354
355
  if (Context.pipeRecord[key] && Context.pipeRecord[key] !== pipe) debug(`overwrite Pipe "${String(key)}"`, "warn");
355
356
  Context.pipeRecord[key] = pipe;
356
357
  }
357
- _chunkVSGYTGHYjs.__name.call(void 0, addPipe, "addPipe");
358
+ _chunk5RBTN33Ajs.__name.call(void 0, addPipe, "addPipe");
358
359
  function addFilter(key, filter) {
359
360
  if (Context.filterRecord[key] && Context.filterRecord[key] !== filter) debug(`overwrite Filter "${String(key)}"`, "warn");
360
361
  Context.filterRecord[key] = filter;
361
362
  }
362
- _chunkVSGYTGHYjs.__name.call(void 0, addFilter, "addFilter");
363
+ _chunk5RBTN33Ajs.__name.call(void 0, addFilter, "addFilter");
363
364
  function addGuard(key, guard, priority = 0) {
364
365
  if (Context.guardRecord[key] && Context.guardRecord[key].value !== guard) debug(`overwrite Guard "${String(key)}"`, "warn");
365
366
  Context.guardRecord[key] = {
@@ -367,7 +368,7 @@ function addGuard(key, guard, priority = 0) {
367
368
  priority
368
369
  };
369
370
  }
370
- _chunkVSGYTGHYjs.__name.call(void 0, addGuard, "addGuard");
371
+ _chunk5RBTN33Ajs.__name.call(void 0, addGuard, "addGuard");
371
372
  function addAddon(key, addon, priority = 0) {
372
373
  if (Context.addonRecord[key] && Context.addonRecord[key].value !== addon) debug(`overwrite Addon "${String(key)}"`, "warn");
373
374
  Context.addonRecord[key] = {
@@ -375,41 +376,21 @@ function addAddon(key, addon, priority = 0) {
375
376
  priority
376
377
  };
377
378
  }
378
- _chunkVSGYTGHYjs.__name.call(void 0, addAddon, "addAddon");
379
-
380
- // src/hmr.ts
381
- function HMR(cb) {
382
- if (_chunkVSGYTGHYjs.IS_DEV) _optionalChain([globalThis, 'access', _ => _.__PS_HMR__, 'optionalAccess', _2 => _2.push, 'call', _3 => _3(cb)]);
383
- }
384
- _chunkVSGYTGHYjs.__name.call(void 0, HMR, "HMR");
379
+ _chunk5RBTN33Ajs.__name.call(void 0, addAddon, "addAddon");
385
380
 
386
381
  // src/http/helper.ts
387
382
  function resolveDep(ret, key) {
388
- if (key) return _optionalChain([ret, 'optionalAccess', _4 => _4[key]]);
383
+ if (key) return _optionalChain([ret, 'optionalAccess', _ => _[key]]);
389
384
  return ret;
390
385
  }
391
- _chunkVSGYTGHYjs.__name.call(void 0, resolveDep, "resolveDep");
392
- function argToReq(params, args, headers) {
393
- const req = {
394
- body: {},
395
- query: {},
396
- params: {},
397
- headers
398
- };
399
- params.forEach((param) => {
400
- if (param.key) req[param.type][param.key] = args[param.index];
401
- else req[param.type] = args[param.index];
402
- });
403
- return req;
404
- }
405
- _chunkVSGYTGHYjs.__name.call(void 0, argToReq, "argToReq");
386
+ _chunk5RBTN33Ajs.__name.call(void 0, resolveDep, "resolveDep");
406
387
 
407
388
  // src/rpc/helper.ts
408
389
  var _os = require('os');
409
390
  function genClientQueue(key) {
410
391
  return `PS-${key ? `${key}-` : ""}${_os.hostname.call(void 0, )}-${process.pid}`;
411
392
  }
412
- _chunkVSGYTGHYjs.__name.call(void 0, genClientQueue, "genClientQueue");
393
+ _chunk5RBTN33Ajs.__name.call(void 0, genClientQueue, "genClientQueue");
413
394
 
414
395
  // src/decorators/helper.ts
415
396
  function shallowClone(obj) {
@@ -417,11 +398,11 @@ function shallowClone(obj) {
417
398
  ...obj
418
399
  };
419
400
  }
420
- _chunkVSGYTGHYjs.__name.call(void 0, shallowClone, "shallowClone");
401
+ _chunk5RBTN33Ajs.__name.call(void 0, shallowClone, "shallowClone");
421
402
  function mergeObject(...args) {
422
403
  return Object.assign({}, ...args);
423
404
  }
424
- _chunkVSGYTGHYjs.__name.call(void 0, mergeObject, "mergeObject");
405
+ _chunk5RBTN33Ajs.__name.call(void 0, mergeObject, "mergeObject");
425
406
 
426
407
  // src/helper.ts
427
408
  function createControllerMetaMap(meta, filter) {
@@ -437,12 +418,12 @@ function createControllerMetaMap(meta, filter) {
437
418
  });
438
419
  }
439
420
  }
440
- _chunkVSGYTGHYjs.__name.call(void 0, handleMeta, "handleMeta");
421
+ _chunk5RBTN33Ajs.__name.call(void 0, handleMeta, "handleMeta");
441
422
  handleMeta();
442
- HMR(handleMeta);
423
+ _chunk5RBTN33Ajs.HMR.call(void 0, handleMeta);
443
424
  return metaMap;
444
425
  }
445
- _chunkVSGYTGHYjs.__name.call(void 0, createControllerMetaMap, "createControllerMetaMap");
426
+ _chunk5RBTN33Ajs.__name.call(void 0, createControllerMetaMap, "createControllerMetaMap");
446
427
  function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
447
428
  const addonSet = /* @__PURE__ */ new Set();
448
429
  const guardSet = /* @__PURE__ */ new Set();
@@ -455,10 +436,10 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
455
436
  pipeSet.clear();
456
437
  filterSet.clear();
457
438
  warningSet.clear();
458
- _optionalChain([addons, 'optionalAccess', _5 => _5.forEach, 'call', _6 => _6((item) => {
439
+ _optionalChain([addons, 'optionalAccess', _2 => _2.forEach, 'call', _3 => _3((item) => {
459
440
  addonSet.add(item);
460
441
  })]);
461
- _optionalChain([guards, 'optionalAccess', _7 => _7.forEach, 'call', _8 => _8((item) => {
442
+ _optionalChain([guards, 'optionalAccess', _4 => _4.forEach, 'call', _5 => _5((item) => {
462
443
  guardSet.add(item);
463
444
  })]);
464
445
  meta.forEach(({ data }) => {
@@ -486,31 +467,31 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
486
467
  ...filterSet
487
468
  ].filter((i) => !Context.filterRecord[i]);
488
469
  function exit() {
489
- if (_chunkVSGYTGHYjs.IS_STRICT) process.exit(5);
470
+ if (_chunk5RBTN33Ajs.IS_STRICT) process.exit(5);
490
471
  }
491
- _chunkVSGYTGHYjs.__name.call(void 0, exit, "exit");
472
+ _chunk5RBTN33Ajs.__name.call(void 0, exit, "exit");
492
473
  if (missAddons.length) {
493
- _chunkVSGYTGHYjs.log.call(void 0, `${_picocolors2.default.white(`Addon [${missAddons.join(",")}]`)} doesn't exist`, "warn");
474
+ _chunk5RBTN33Ajs.log.call(void 0, `${_picocolors2.default.white(`Addon [${missAddons.join(",")}]`)} doesn't exist`, "warn");
494
475
  exit();
495
476
  }
496
477
  if (missGuards.length) {
497
- _chunkVSGYTGHYjs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
478
+ _chunk5RBTN33Ajs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
498
479
  exit();
499
480
  }
500
481
  if (missPipes.length) {
501
- _chunkVSGYTGHYjs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
482
+ _chunk5RBTN33Ajs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
502
483
  exit();
503
484
  }
504
485
  if (missFilters.length) {
505
- _chunkVSGYTGHYjs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
486
+ _chunk5RBTN33Ajs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
506
487
  exit();
507
488
  }
508
- warningSet.forEach((warn) => _chunkVSGYTGHYjs.log.call(void 0, warn, "warn"));
489
+ warningSet.forEach((warn) => _chunk5RBTN33Ajs.log.call(void 0, warn, "warn"));
509
490
  if (warningSet.size) exit();
510
491
  }
511
- _chunkVSGYTGHYjs.__name.call(void 0, handleMeta, "handleMeta");
492
+ _chunk5RBTN33Ajs.__name.call(void 0, handleMeta, "handleMeta");
512
493
  handleMeta();
513
- HMR(handleMeta);
494
+ _chunk5RBTN33Ajs.HMR.call(void 0, handleMeta);
514
495
  return {
515
496
  addonSet,
516
497
  guardSet,
@@ -518,7 +499,7 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
518
499
  filterSet
519
500
  };
520
501
  }
521
- _chunkVSGYTGHYjs.__name.call(void 0, detectAopDep, "detectAopDep");
502
+ _chunk5RBTN33Ajs.__name.call(void 0, detectAopDep, "detectAopDep");
522
503
  function joinUrl(base, ...paths) {
523
504
  const joinedPath = [
524
505
  base,
@@ -526,9 +507,7 @@ function joinUrl(base, ...paths) {
526
507
  ].filter((p) => p).map((path) => path.replace(/(^\/)/g, "")).join("/");
527
508
  return `/${joinedPath}`;
528
509
  }
529
- _chunkVSGYTGHYjs.__name.call(void 0, joinUrl, "joinUrl");
530
-
531
-
510
+ _chunk5RBTN33Ajs.__name.call(void 0, joinUrl, "joinUrl");
532
511
 
533
512
 
534
513
 
@@ -561,4 +540,4 @@ _chunkVSGYTGHYjs.__name.call(void 0, joinUrl, "joinUrl");
561
540
 
562
541
 
563
542
 
564
- 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.HMR = HMR; exports.resolveDep = resolveDep; exports.argToReq = argToReq; exports.genClientQueue = genClientQueue; exports.shallowClone = shallowClone; exports.mergeObject = mergeObject; exports.createControllerMetaMap = createControllerMetaMap; exports.detectAopDep = detectAopDep; exports.joinUrl = joinUrl;
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;
@@ -7,7 +7,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
9
  var LOG_LEVEL = Number(process.env.PS_LOG_LEVEL || 0);
10
- var IS_READY = Symbol("IS_READY");
11
10
  var PS_EXIT_CODE = /* @__PURE__ */ function(PS_EXIT_CODE2) {
12
11
  PS_EXIT_CODE2[PS_EXIT_CODE2["RELAUNCH"] = 2] = "RELAUNCH";
13
12
  PS_EXIT_CODE2[PS_EXIT_CODE2["CODE"] = 4] = "CODE";
@@ -110,6 +109,25 @@ function runMiddleware(ctx, middleware) {
110
109
  }
111
110
  __name(runMiddleware, "runMiddleware");
112
111
 
112
+ // src/hmr.ts
113
+ function HMR(cb) {
114
+ if (IS_DEV) {
115
+ if (!globalThis.__PS_HMR__) globalThis.__PS_HMR__ = [];
116
+ globalThis.__PS_HMR__.push(cb);
117
+ }
118
+ }
119
+ __name(HMR, "HMR");
120
+ async function RELOAD(oldModels, newModels) {
121
+ log("reload module...");
122
+ for (const cb of globalThis.__PS_HMR__) await cb(oldModels, newModels);
123
+ log("reload done");
124
+ }
125
+ __name(RELOAD, "RELOAD");
126
+ function RELAUNCH() {
127
+ if (IS_DEV) process.exit(2);
128
+ }
129
+ __name(RELAUNCH, "RELAUNCH");
130
+
113
131
  export {
114
132
  __name,
115
133
  ERROR_SYMBOL,
@@ -117,11 +135,13 @@ export {
117
135
  IS_ONLY_GENERATE,
118
136
  IS_STRICT,
119
137
  LOG_LEVEL,
120
- IS_READY,
121
138
  PS_EXIT_CODE,
122
139
  setLogger,
123
140
  getLogger,
124
141
  log,
125
142
  runMiddleware,
126
- Mixin
143
+ Mixin,
144
+ HMR,
145
+ RELOAD,
146
+ RELAUNCH
127
147
  };