phecda-server 8.4.0 → 8.5.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 (46) hide show
  1. package/bin/cli.mjs +0 -3
  2. package/dist/{chunk-RS6H6TEX.js → chunk-5ZZAOOKE.js} +26 -26
  3. package/dist/{chunk-R73A7HS3.js → chunk-76UDKZOJ.js} +53 -53
  4. package/dist/{chunk-OUQM7GZH.js → chunk-LLF55NZP.js} +14 -4
  5. package/dist/{chunk-3OKDXHO7.mjs → chunk-MUUKKO67.mjs} +1 -1
  6. package/dist/{chunk-SRPCXPAQ.js → chunk-SKGOTR4T.js} +20 -20
  7. package/dist/{chunk-JRNXLEAU.mjs → chunk-URKOYTBU.mjs} +14 -4
  8. package/dist/{chunk-US2DTB3Z.mjs → chunk-WST6E6MQ.mjs} +1 -1
  9. package/dist/{chunk-YDJAOLT2.mjs → chunk-ZHNYWZRL.mjs} +1 -1
  10. package/dist/helper.d.mts +2 -1
  11. package/dist/helper.d.ts +2 -1
  12. package/dist/helper.js +5 -3
  13. package/dist/helper.mjs +4 -2
  14. package/dist/http/elysia/index.js +45 -41
  15. package/dist/http/elysia/index.mjs +10 -6
  16. package/dist/http/express/index.js +38 -38
  17. package/dist/http/express/index.mjs +3 -3
  18. package/dist/http/fastify/index.js +39 -39
  19. package/dist/http/fastify/index.mjs +4 -4
  20. package/dist/http/h3/index.js +39 -39
  21. package/dist/http/h3/index.mjs +3 -3
  22. package/dist/http/hono/index.js +35 -35
  23. package/dist/http/hono/index.mjs +3 -3
  24. package/dist/http/hyper-express/index.js +36 -36
  25. package/dist/http/hyper-express/index.mjs +3 -3
  26. package/dist/http/koa/index.js +38 -38
  27. package/dist/http/koa/index.mjs +3 -3
  28. package/dist/index.js +44 -44
  29. package/dist/index.mjs +4 -4
  30. package/dist/rpc/bullmq/index.js +11 -11
  31. package/dist/rpc/bullmq/index.mjs +2 -2
  32. package/dist/rpc/electron/index.js +8 -8
  33. package/dist/rpc/electron/index.mjs +2 -2
  34. package/dist/rpc/kafka/index.js +10 -10
  35. package/dist/rpc/kafka/index.mjs +2 -2
  36. package/dist/rpc/nats/index.js +11 -11
  37. package/dist/rpc/nats/index.mjs +2 -2
  38. package/dist/rpc/rabbitmq/index.js +12 -12
  39. package/dist/rpc/rabbitmq/index.mjs +2 -2
  40. package/dist/rpc/redis/index.js +10 -10
  41. package/dist/rpc/redis/index.mjs +2 -2
  42. package/dist/rpc/ws/index.js +7 -7
  43. package/dist/rpc/ws/index.mjs +2 -2
  44. package/dist/test.js +6 -6
  45. package/dist/test.mjs +2 -2
  46. package/package.json +1 -1
@@ -4,12 +4,12 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkOUQM7GZHjs = require('./chunk-OUQM7GZH.js');
7
+ var _chunkLLF55NZPjs = require('./chunk-LLF55NZP.js');
8
8
 
9
9
  // src/meta.ts
10
10
  var Meta = class {
11
11
  static {
12
- _chunkOUQM7GZHjs.__name.call(void 0, this, "Meta");
12
+ _chunkLLF55NZPjs.__name.call(void 0, this, "Meta");
13
13
  }
14
14
 
15
15
 
@@ -41,11 +41,11 @@ function defaultServerInject() {
41
41
  });
42
42
  }
43
43
  }
44
- _chunkOUQM7GZHjs.__name.call(void 0, defaultServerInject, "defaultServerInject");
44
+ _chunkLLF55NZPjs.__name.call(void 0, defaultServerInject, "defaultServerInject");
45
45
  var phecdaNamespace = /* @__PURE__ */ new Map();
46
46
  var ServerPhecda = (_class = class {
47
47
  static {
48
- _chunkOUQM7GZHjs.__name.call(void 0, this, "ServerPhecda");
48
+ _chunkLLF55NZPjs.__name.call(void 0, this, "ServerPhecda");
49
49
  }
50
50
  __init() {this.moduleMap = /* @__PURE__ */ new Map()}
51
51
  __init2() {this.meta = []}
@@ -57,7 +57,7 @@ var ServerPhecda = (_class = class {
57
57
 
58
58
  constructor(options) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);
59
59
  defaultServerInject();
60
- const { namespace = "default", parseModule = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (module) => module, "parseModule"), parseMeta = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (meta) => meta, "parseMeta"), generators = [] } = options;
60
+ const { namespace = "default", parseModule = /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (module) => module, "parseModule"), parseMeta = /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (meta) => meta, "parseMeta"), generators = [] } = options;
61
61
  phecdaNamespace.set(namespace, this);
62
62
  this.parseMeta = parseMeta;
63
63
  this.parseModule = parseModule;
@@ -67,20 +67,20 @@ var ServerPhecda = (_class = class {
67
67
  for (const model of models) await this.buildDepModule(model);
68
68
  this.hmr();
69
69
  this.generateCode().then(() => {
70
- if (_chunkOUQM7GZHjs.IS_ONLY_GENERATE) {
71
- _chunkOUQM7GZHjs.log.call(void 0, "Only generate code");
72
- process.exit(_chunkOUQM7GZHjs.PS_EXIT_CODE.EXIT);
70
+ if (_chunkLLF55NZPjs.IS_ONLY_GENERATE) {
71
+ _chunkLLF55NZPjs.log.call(void 0, "Only generate code");
72
+ process.exit(_chunkLLF55NZPjs.PS_EXIT_CODE.EXIT);
73
73
  }
74
74
  });
75
75
  }
76
- __init6() {this.generateCode = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, async () => {
76
+ __init6() {this.generateCode = /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, async () => {
77
77
  return Promise.all(this.generators.map((generator) => {
78
78
  debug(`generate "${generator.name}" code to ${generator.path}`);
79
79
  return generator.output(this.meta);
80
80
  }));
81
81
  }, "generateCode")}
82
82
  hmr() {
83
- _chunkOUQM7GZHjs.HMR.call(void 0, async (oldModels, newModels) => {
83
+ _chunkLLF55NZPjs.HMR.call(void 0, async (oldModels, newModels) => {
84
84
  debug("reload models ");
85
85
  await this.replace(oldModels, newModels);
86
86
  this.generateCode();
@@ -122,7 +122,7 @@ var ServerPhecda = (_class = class {
122
122
  if (this.moduleMap.has(tag)) {
123
123
  module = this.moduleMap.get(tag);
124
124
  if (!module) {
125
- _chunkOUQM7GZHjs.log.call(void 0, `Exist Circular-Dependency or Multiple modules with the same tag [${String(tag)}]`, "warn");
125
+ _chunkLLF55NZPjs.log.call(void 0, `Exist Circular-Dependency or Multiple modules with the same tag [${String(tag)}]`, "warn");
126
126
  return {
127
127
  module: this.createProxyModule(tag),
128
128
  tag
@@ -130,8 +130,8 @@ var ServerPhecda = (_class = class {
130
130
  }
131
131
  if (this.modelMap.get(module) !== Model && !this.modelSet.has(Model)) {
132
132
  this.modelSet.add(Model);
133
- if (module instanceof Model) _chunkOUQM7GZHjs.log.call(void 0, `Module taged ${String(tag)} has been overridden`);
134
- else _chunkOUQM7GZHjs.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Model.name}"`, "warn");
133
+ if (module instanceof Model) _chunkLLF55NZPjs.log.call(void 0, `Module taged ${String(tag)} has been overridden`);
134
+ else _chunkLLF55NZPjs.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Model.name}"`, "warn");
135
135
  }
136
136
  return {
137
137
  module,
@@ -154,7 +154,7 @@ var ServerPhecda = (_class = class {
154
154
  }
155
155
  this.meta.push(...getMetaFromInstance(module, tag, Model).map(this.parseMeta).filter((item) => !!item));
156
156
  debug(`init module "${String(tag)}"`);
157
- if (!_chunkOUQM7GZHjs.IS_ONLY_GENERATE) await _phecdacore.invokeInit.call(void 0, module);
157
+ if (!_chunkLLF55NZPjs.IS_ONLY_GENERATE) await _phecdacore.invokeInit.call(void 0, module);
158
158
  debug(`add module "${String(tag)}"`);
159
159
  this.moduleMap.set(tag, module);
160
160
  this.modelMap.set(module, Model);
@@ -216,7 +216,7 @@ async function Factory(models, opts = {}) {
216
216
  await phecda.start(models);
217
217
  return phecda;
218
218
  }
219
- _chunkOUQM7GZHjs.__name.call(void 0, Factory, "Factory");
219
+ _chunkLLF55NZPjs.__name.call(void 0, Factory, "Factory");
220
220
  function useS(nsOrModel, namespace) {
221
221
  if (!nsOrModel) {
222
222
  namespace = "default";
@@ -229,7 +229,7 @@ function useS(nsOrModel, namespace) {
229
229
  if (nsOrModel && typeof nsOrModel !== "string") return serverPhecda.get(nsOrModel);
230
230
  else return serverPhecda;
231
231
  }
232
- _chunkOUQM7GZHjs.__name.call(void 0, useS, "useS");
232
+ _chunkLLF55NZPjs.__name.call(void 0, useS, "useS");
233
233
  function getMetaFromInstance(instance, tag, model) {
234
234
  const name = model.name;
235
235
  const propertyKeys = _phecdacore.getMetaKey.call(void 0, instance).filter((item) => typeof item === "string");
@@ -244,7 +244,7 @@ function getMetaFromInstance(instance, tag, model) {
244
244
  method: i
245
245
  };
246
246
  if (baseMeta.controller) {
247
- if (typeof tag !== "string") _chunkOUQM7GZHjs.log.call(void 0, `can't use Tag with ${typeof tag} on controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
247
+ if (typeof tag !== "string") _chunkLLF55NZPjs.log.call(void 0, `can't use Tag with ${typeof tag} on controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
248
248
  metaData.controller = baseMeta.controller;
249
249
  metaData[baseMeta.controller] = {
250
250
  ...baseMeta[baseMeta.controller],
@@ -286,7 +286,7 @@ function getMetaFromInstance(instance, tag, model) {
286
286
  return new Meta(deepFreeze(metaData), getParamTypes(instance, i) || [], instance, model);
287
287
  });
288
288
  }
289
- _chunkOUQM7GZHjs.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
289
+ _chunkLLF55NZPjs.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
290
290
  function deepFreeze(object) {
291
291
  Object.freeze(object);
292
292
  Object.getOwnPropertyNames(object).forEach((prop) => {
@@ -294,11 +294,11 @@ function deepFreeze(object) {
294
294
  });
295
295
  return object;
296
296
  }
297
- _chunkOUQM7GZHjs.__name.call(void 0, deepFreeze, "deepFreeze");
297
+ _chunkLLF55NZPjs.__name.call(void 0, deepFreeze, "deepFreeze");
298
298
  function getParamTypes(Model, key) {
299
299
  return Reflect.getMetadata("design:paramtypes", Model, key);
300
300
  }
301
- _chunkOUQM7GZHjs.__name.call(void 0, getParamTypes, "getParamTypes");
301
+ _chunkLLF55NZPjs.__name.call(void 0, getParamTypes, "getParamTypes");
302
302
 
303
303
 
304
304
 
@@ -119,9 +119,11 @@ function HMR(cb) {
119
119
  }
120
120
  __name(HMR, "HMR");
121
121
  async function RELOAD(oldModels, newModels) {
122
- log("reload module...");
123
- for (const cb of globalThis.__PS_HMR__) await cb(oldModels, newModels);
124
- log("reload done");
122
+ if (IS_DEV) {
123
+ log("reload module...");
124
+ for (const cb of globalThis.__PS_HMR__) await cb(oldModels, newModels);
125
+ log("reload done");
126
+ }
125
127
  }
126
128
  __name(RELOAD, "RELOAD");
127
129
  function RELAUNCH() {
@@ -131,6 +133,13 @@ function RELAUNCH() {
131
133
  }
132
134
  }
133
135
  __name(RELAUNCH, "RELAUNCH");
136
+ function EXIT() {
137
+ if (IS_DEV) {
138
+ log("exit...");
139
+ process.exit(PS_EXIT_CODE.EXIT);
140
+ }
141
+ }
142
+ __name(EXIT, "EXIT");
134
143
 
135
144
  export {
136
145
  __name,
@@ -148,5 +157,6 @@ export {
148
157
  Mixin,
149
158
  HMR,
150
159
  RELOAD,
151
- RELAUNCH
160
+ RELAUNCH,
161
+ EXIT
152
162
  };
@@ -7,7 +7,7 @@ import {
7
7
  LOG_LEVEL,
8
8
  __name,
9
9
  log
10
- } from "./chunk-JRNXLEAU.mjs";
10
+ } from "./chunk-URKOYTBU.mjs";
11
11
 
12
12
  // src/helper.ts
13
13
  import pc2 from "picocolors";
@@ -4,7 +4,7 @@ import {
4
4
  PS_EXIT_CODE,
5
5
  __name,
6
6
  log
7
- } from "./chunk-JRNXLEAU.mjs";
7
+ } from "./chunk-URKOYTBU.mjs";
8
8
 
9
9
  // src/meta.ts
10
10
  var Meta = class {
package/dist/helper.d.mts CHANGED
@@ -4,6 +4,7 @@ import { Construct } from 'phecda-core';
4
4
  declare function HMR(cb: (oldModels: Construct[], newModels: Construct[]) => any): void;
5
5
  declare function RELOAD(oldModels: Construct[], newModels: Construct[]): Promise<void>;
6
6
  declare function RELAUNCH(): void;
7
+ declare function EXIT(): void;
7
8
 
8
9
  declare function resolveDep(ret: any, key: string): any;
9
10
 
@@ -22,4 +23,4 @@ declare function detectAopDep(meta: Meta[], { guards, addons }?: {
22
23
  } | undefined;
23
24
  declare function joinUrl(base: string, ...paths: string[]): string;
24
25
 
25
- export { HMR, RELAUNCH, RELOAD, createControllerMetaMap, detectAopDep, joinUrl, mergeObject, resolveDep, shallowClone };
26
+ export { EXIT, HMR, RELAUNCH, RELOAD, createControllerMetaMap, detectAopDep, joinUrl, mergeObject, resolveDep, shallowClone };
package/dist/helper.d.ts CHANGED
@@ -4,6 +4,7 @@ import { Construct } from 'phecda-core';
4
4
  declare function HMR(cb: (oldModels: Construct[], newModels: Construct[]) => any): void;
5
5
  declare function RELOAD(oldModels: Construct[], newModels: Construct[]): Promise<void>;
6
6
  declare function RELAUNCH(): void;
7
+ declare function EXIT(): void;
7
8
 
8
9
  declare function resolveDep(ret: any, key: string): any;
9
10
 
@@ -22,4 +23,4 @@ declare function detectAopDep(meta: Meta[], { guards, addons }?: {
22
23
  } | undefined;
23
24
  declare function joinUrl(base: string, ...paths: string[]): string;
24
25
 
25
- export { HMR, RELAUNCH, RELOAD, createControllerMetaMap, detectAopDep, joinUrl, mergeObject, resolveDep, shallowClone };
26
+ export { EXIT, HMR, RELAUNCH, RELOAD, createControllerMetaMap, detectAopDep, joinUrl, mergeObject, resolveDep, shallowClone };
package/dist/helper.js CHANGED
@@ -5,13 +5,13 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkR73A7HS3js = require('./chunk-R73A7HS3.js');
8
+ var _chunk76UDKZOJjs = require('./chunk-76UDKZOJ.js');
9
9
 
10
10
 
11
11
 
12
12
 
13
- var _chunkOUQM7GZHjs = require('./chunk-OUQM7GZH.js');
14
13
 
14
+ var _chunkLLF55NZPjs = require('./chunk-LLF55NZP.js');
15
15
 
16
16
 
17
17
 
@@ -21,4 +21,6 @@ var _chunkOUQM7GZHjs = require('./chunk-OUQM7GZH.js');
21
21
 
22
22
 
23
23
 
24
- exports.HMR = _chunkOUQM7GZHjs.HMR; exports.RELAUNCH = _chunkOUQM7GZHjs.RELAUNCH; exports.RELOAD = _chunkOUQM7GZHjs.RELOAD; exports.createControllerMetaMap = _chunkR73A7HS3js.createControllerMetaMap; exports.detectAopDep = _chunkR73A7HS3js.detectAopDep; exports.joinUrl = _chunkR73A7HS3js.joinUrl; exports.mergeObject = _chunkR73A7HS3js.mergeObject; exports.resolveDep = _chunkR73A7HS3js.resolveDep; exports.shallowClone = _chunkR73A7HS3js.shallowClone;
24
+
25
+
26
+ exports.EXIT = _chunkLLF55NZPjs.EXIT; exports.HMR = _chunkLLF55NZPjs.HMR; exports.RELAUNCH = _chunkLLF55NZPjs.RELAUNCH; exports.RELOAD = _chunkLLF55NZPjs.RELOAD; exports.createControllerMetaMap = _chunk76UDKZOJjs.createControllerMetaMap; exports.detectAopDep = _chunk76UDKZOJjs.detectAopDep; exports.joinUrl = _chunk76UDKZOJjs.joinUrl; exports.mergeObject = _chunk76UDKZOJjs.mergeObject; exports.resolveDep = _chunk76UDKZOJjs.resolveDep; exports.shallowClone = _chunk76UDKZOJjs.shallowClone;
package/dist/helper.mjs CHANGED
@@ -5,13 +5,15 @@ import {
5
5
  mergeObject,
6
6
  resolveDep,
7
7
  shallowClone
8
- } from "./chunk-US2DTB3Z.mjs";
8
+ } from "./chunk-WST6E6MQ.mjs";
9
9
  import {
10
+ EXIT,
10
11
  HMR,
11
12
  RELAUNCH,
12
13
  RELOAD
13
- } from "./chunk-JRNXLEAU.mjs";
14
+ } from "./chunk-URKOYTBU.mjs";
14
15
  export {
16
+ EXIT,
15
17
  HMR,
16
18
  RELAUNCH,
17
19
  RELOAD,
@@ -1,32 +1,32 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkRS6H6TEXjs = require('../../chunk-RS6H6TEX.js');
3
+ var _chunk5ZZAOOKEjs = require('../../chunk-5ZZAOOKE.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
- var _chunkR73A7HS3js = require('../../chunk-R73A7HS3.js');
10
+ var _chunk76UDKZOJjs = require('../../chunk-76UDKZOJ.js');
11
11
 
12
12
 
13
- var _chunkOUQM7GZHjs = require('../../chunk-OUQM7GZH.js');
13
+ var _chunkLLF55NZPjs = require('../../chunk-LLF55NZP.js');
14
14
 
15
15
  // src/http/elysia/bind.ts
16
16
  var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
17
17
  var _elysia = require('elysia');
18
18
  var debug = _debug2.default.call(void 0, "phecda-server/elysia");
19
19
  function bind(app, data, opts = {}) {
20
- const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
20
+ const { globalGuards, parallelRoute, globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
21
21
  const { moduleMap, meta } = data;
22
- const metaMap = _chunkR73A7HS3js.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
+ const metaMap = _chunk76UDKZOJjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
23
23
  const { controller, http, method, tag } = meta2.data;
24
24
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.method])) {
25
25
  debug(`register method "${method}" in module "${tag}"`);
26
26
  return true;
27
27
  }
28
28
  });
29
- _chunkR73A7HS3js.detectAopDep.call(void 0, meta, {
29
+ _chunk76UDKZOJjs.detectAopDep.call(void 0, meta, {
30
30
  addons: [
31
31
  ...globalAddons,
32
32
  ...parallelAddons
@@ -35,29 +35,33 @@ function bind(app, data, opts = {}) {
35
35
  });
36
36
  registerRoute();
37
37
  function registerRoute() {
38
- _chunkR73A7HS3js.Context.applyAddons(globalAddons, app, "elysia");
38
+ _chunk76UDKZOJjs.Context.applyAddons(globalAddons, app, "elysia");
39
39
  if (parallelRoute) {
40
40
  const parallelRouter = new (0, _elysia.Elysia)();
41
- _chunkR73A7HS3js.Context.applyAddons(parallelAddons, app, "elysia");
41
+ _chunk76UDKZOJjs.Context.applyAddons(parallelAddons, app, "elysia");
42
42
  parallelRouter.post(parallelRoute, async (c) => {
43
43
  const { body } = c;
44
44
  async function errorHandler(e) {
45
- const error = await _chunkR73A7HS3js.Context.filterRecord.default(e);
45
+ const error = await _chunk76UDKZOJjs.Context.filterRecord.default(e);
46
46
  c.set.status = error.status;
47
47
  return error;
48
48
  }
49
- _chunkOUQM7GZHjs.__name.call(void 0, errorHandler, "errorHandler");
50
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkR73A7HS3js.BadRequestException)("data format should be an array"));
49
+ _chunkLLF55NZPjs.__name.call(void 0, errorHandler, "errorHandler");
50
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunk76UDKZOJjs.BadRequestException)("data format should be an array"));
51
51
  try {
52
52
  return Promise.all(body.map((item, i) => {
53
53
  return new Promise(async (resolve) => {
54
54
  if (!item) return resolve(null);
55
55
  const { tag, method } = item;
56
56
  debug(`(parallel)invoke method "${method}" in module "${tag}"`);
57
- if (!metaMap.has(tag)) return resolve(await _chunkR73A7HS3js.Context.filterRecord.default(new (0, _chunkR73A7HS3js.BadRequestException)(`module "${tag}" doesn't exist`)));
57
+ if (!metaMap.has(tag)) {
58
+ return resolve(await _chunk76UDKZOJjs.Context.filterRecord.default(new (0, _chunk76UDKZOJjs.BadRequestException)(`module "${tag}" doesn't exist`)));
59
+ }
58
60
  const meta2 = metaMap.get(tag)[method];
59
- if (!meta2) return resolve(await _chunkR73A7HS3js.Context.filterRecord.default(new (0, _chunkR73A7HS3js.BadRequestException)(`"${method}" in "${tag}" doesn't exist`)));
60
- const aop = _chunkR73A7HS3js.Context.getAop(meta2, {
61
+ if (!meta2) {
62
+ return resolve(await _chunk76UDKZOJjs.Context.filterRecord.default(new (0, _chunk76UDKZOJjs.BadRequestException)(`"${method}" in "${tag}" doesn't exist`)));
63
+ }
64
+ const aop = _chunk76UDKZOJjs.Context.getAop(meta2, {
61
65
  globalGuards,
62
66
  globalFilter,
63
67
  globalPipe
@@ -72,23 +76,23 @@ function bind(app, data, opts = {}) {
72
76
  moduleMap,
73
77
  app,
74
78
  ...item,
75
- getCookie: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
76
- setCookie: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
79
+ getCookie: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
80
+ setCookie: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
77
81
  ...opts2,
78
82
  value
79
83
  }), "setCookie"),
80
- delCookie: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
81
- redirect: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
82
- setResHeaders: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
83
- setResStatus: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
84
- getRequest: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, () => {
84
+ delCookie: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
85
+ redirect: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
86
+ setResHeaders: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
87
+ setResStatus: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
88
+ getRequest: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, () => {
85
89
  throw new Error("elysia can't support getRequest");
86
90
  }, "getRequest"),
87
- getResponse: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, () => {
91
+ getResponse: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, () => {
88
92
  throw new Error("elysia can't support getResponse");
89
93
  }, "getResponse")
90
94
  };
91
- const context = new (0, _chunkR73A7HS3js.Context)(contextData);
95
+ const context = new (0, _chunk76UDKZOJjs.Context)(contextData);
92
96
  context.run(aop, resolve, resolve);
93
97
  });
94
98
  })).then((ret) => {
@@ -110,14 +114,14 @@ function bind(app, data, opts = {}) {
110
114
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.method])) continue;
111
115
  let aop;
112
116
  if (!dynamic) {
113
- aop = _chunkR73A7HS3js.Context.getAop(meta2, {
117
+ aop = _chunk76UDKZOJjs.Context.getAop(meta2, {
114
118
  globalFilter,
115
119
  globalGuards,
116
120
  globalPipe
117
121
  });
118
122
  }
119
- _chunkR73A7HS3js.Context.applyAddons(addons, subApp, "elysia");
120
- subApp[http.method](_chunkR73A7HS3js.joinUrl.call(void 0, http.prefix, http.route), async (c) => {
123
+ _chunk76UDKZOJjs.Context.applyAddons(addons, subApp, "elysia");
124
+ subApp[http.method](_chunk76UDKZOJjs.joinUrl.call(void 0, http.prefix, http.route), async (c) => {
121
125
  debug(`invoke method "${method}" in module "${tag}"`);
122
126
  const contextData = {
123
127
  type: "elysia",
@@ -132,33 +136,33 @@ function bind(app, data, opts = {}) {
132
136
  params: c.params,
133
137
  headers: c.headers,
134
138
  app,
135
- getCookie: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
136
- setCookie: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
139
+ getCookie: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
140
+ setCookie: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
137
141
  ...opts2,
138
142
  value
139
143
  }), "setCookie"),
140
- delCookie: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
141
- redirect: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
142
- setResHeaders: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
143
- setResStatus: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
144
- getRequest: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, () => {
144
+ delCookie: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
145
+ redirect: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
146
+ setResHeaders: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
147
+ setResStatus: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
148
+ getRequest: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, () => {
145
149
  throw new Error("elysia can't support getRequest");
146
150
  }, "getRequest"),
147
- getResponse: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, () => {
151
+ getResponse: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, () => {
148
152
  throw new Error("elysia can't support getResponse");
149
153
  }, "getResponse")
150
154
  };
151
155
  if (dynamic) {
152
- aop = _chunkR73A7HS3js.Context.getAop(meta2, {
156
+ aop = _chunk76UDKZOJjs.Context.getAop(meta2, {
153
157
  globalFilter,
154
158
  globalGuards,
155
159
  globalPipe
156
160
  });
157
161
  }
158
- const context = new (0, _chunkR73A7HS3js.Context)(contextData);
162
+ const context = new (0, _chunk76UDKZOJjs.Context)(contextData);
159
163
  if (http.headers) c.set.headers = http.headers;
160
164
  if (dynamic) {
161
- aop = _chunkR73A7HS3js.Context.getAop(meta2, {
165
+ aop = _chunk76UDKZOJjs.Context.getAop(meta2, {
162
166
  globalFilter,
163
167
  globalGuards,
164
168
  globalPipe
@@ -173,13 +177,13 @@ function bind(app, data, opts = {}) {
173
177
  }
174
178
  }
175
179
  }
176
- _chunkOUQM7GZHjs.__name.call(void 0, registerRoute, "registerRoute");
180
+ _chunkLLF55NZPjs.__name.call(void 0, registerRoute, "registerRoute");
177
181
  }
178
- _chunkOUQM7GZHjs.__name.call(void 0, bind, "bind");
182
+ _chunkLLF55NZPjs.__name.call(void 0, bind, "bind");
179
183
  function Elysia(opts) {
180
- return _chunkRS6H6TEXjs.Define.call(void 0, "elysia", opts);
184
+ return _chunk5ZZAOOKEjs.Define.call(void 0, "elysia", opts);
181
185
  }
182
- _chunkOUQM7GZHjs.__name.call(void 0, Elysia, "Elysia");
186
+ _chunkLLF55NZPjs.__name.call(void 0, Elysia, "Elysia");
183
187
 
184
188
 
185
189
 
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  Define
3
- } from "../../chunk-3OKDXHO7.mjs";
3
+ } from "../../chunk-MUUKKO67.mjs";
4
4
  import {
5
5
  BadRequestException,
6
6
  Context,
7
7
  createControllerMetaMap,
8
8
  detectAopDep,
9
9
  joinUrl
10
- } from "../../chunk-US2DTB3Z.mjs";
10
+ } from "../../chunk-WST6E6MQ.mjs";
11
11
  import {
12
12
  __name
13
- } from "../../chunk-JRNXLEAU.mjs";
13
+ } from "../../chunk-URKOYTBU.mjs";
14
14
 
15
15
  // src/http/elysia/bind.ts
16
16
  import Debug from "debug";
17
17
  import { Elysia as App } from "elysia";
18
18
  var debug = Debug("phecda-server/elysia");
19
19
  function bind(app, data, opts = {}) {
20
- const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
20
+ const { globalGuards, parallelRoute, globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
21
21
  const { moduleMap, meta } = data;
22
22
  const metaMap = createControllerMetaMap(meta, (meta2) => {
23
23
  const { controller, http, method, tag } = meta2.data;
@@ -54,9 +54,13 @@ function bind(app, data, opts = {}) {
54
54
  if (!item) return resolve(null);
55
55
  const { tag, method } = item;
56
56
  debug(`(parallel)invoke method "${method}" in module "${tag}"`);
57
- if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
57
+ if (!metaMap.has(tag)) {
58
+ return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
59
+ }
58
60
  const meta2 = metaMap.get(tag)[method];
59
- if (!meta2) return resolve(await Context.filterRecord.default(new BadRequestException(`"${method}" in "${tag}" doesn't exist`)));
61
+ if (!meta2) {
62
+ return resolve(await Context.filterRecord.default(new BadRequestException(`"${method}" in "${tag}" doesn't exist`)));
63
+ }
60
64
  const aop = Context.getAop(meta2, {
61
65
  globalGuards,
62
66
  globalFilter,