phecda-server 7.0.0-alpha.1 → 7.0.0-alpha.10

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 (86) hide show
  1. package/assets/ps.json +1 -1
  2. package/assets/schema.json +55 -55
  3. package/bin/cli.mjs +31 -23
  4. package/dist/chunk-4LLLQOMF.js +152 -0
  5. package/dist/{chunk-7YQ57BQS.js → chunk-6OQ2SB5W.js} +137 -69
  6. package/dist/{chunk-GSPBHZBH.js → chunk-G7JFKM2M.js} +96 -80
  7. package/dist/{chunk-MBCHNDAY.js → chunk-KCPBITYZ.js} +24 -24
  8. package/dist/{chunk-HMVLXNV3.mjs → chunk-MUI6MTUO.mjs} +1 -1
  9. package/dist/chunk-NQ55PA2X.mjs +152 -0
  10. package/dist/{chunk-XYVMNY2X.mjs → chunk-YCES6ABN.mjs} +124 -56
  11. package/dist/{chunk-V7EI76QQ.mjs → chunk-Z7NAAE4M.mjs} +48 -32
  12. package/dist/{core-BIcUwV18.d.mts → core-CUTbX_IS.d.ts} +5 -3
  13. package/dist/{core-CYwEPfN4.d.ts → core-DIfgUKIU.d.mts} +5 -3
  14. package/dist/helper.d.mts +8 -6
  15. package/dist/helper.d.ts +8 -6
  16. package/dist/helper.js +8 -3
  17. package/dist/helper.mjs +10 -5
  18. package/dist/http/elysia/index.d.mts +4 -4
  19. package/dist/http/elysia/index.d.ts +4 -4
  20. package/dist/http/elysia/index.js +43 -44
  21. package/dist/http/elysia/index.mjs +9 -10
  22. package/dist/http/express/index.d.mts +4 -4
  23. package/dist/http/express/index.d.ts +4 -4
  24. package/dist/http/express/index.js +40 -41
  25. package/dist/http/express/index.mjs +9 -10
  26. package/dist/http/fastify/index.d.mts +4 -4
  27. package/dist/http/fastify/index.d.ts +4 -4
  28. package/dist/http/fastify/index.js +41 -42
  29. package/dist/http/fastify/index.mjs +9 -10
  30. package/dist/http/h3/index.d.mts +4 -4
  31. package/dist/http/h3/index.d.ts +4 -4
  32. package/dist/http/h3/index.js +41 -42
  33. package/dist/http/h3/index.mjs +9 -10
  34. package/dist/http/hono/index.d.mts +4 -4
  35. package/dist/http/hono/index.d.ts +4 -4
  36. package/dist/http/hono/index.js +37 -39
  37. package/dist/http/hono/index.mjs +5 -7
  38. package/dist/http/hyper-express/index.d.mts +4 -4
  39. package/dist/http/hyper-express/index.d.ts +4 -4
  40. package/dist/http/hyper-express/index.js +38 -39
  41. package/dist/http/hyper-express/index.mjs +8 -9
  42. package/dist/http/koa/index.d.mts +4 -4
  43. package/dist/http/koa/index.d.ts +4 -4
  44. package/dist/http/koa/index.js +40 -41
  45. package/dist/http/koa/index.mjs +9 -10
  46. package/dist/index.d.mts +44 -38
  47. package/dist/index.d.ts +44 -38
  48. package/dist/index.js +48 -42
  49. package/dist/index.mjs +21 -15
  50. package/dist/{meta-BXKLFTgG.d.mts → meta-CR-D39hQ.d.mts} +7 -5
  51. package/dist/{meta-BXKLFTgG.d.ts → meta-CR-D39hQ.d.ts} +7 -5
  52. package/dist/rpc/bullmq/index.d.mts +5 -5
  53. package/dist/rpc/bullmq/index.d.ts +5 -5
  54. package/dist/rpc/bullmq/index.js +15 -14
  55. package/dist/rpc/bullmq/index.mjs +4 -3
  56. package/dist/rpc/kafka/index.d.mts +4 -4
  57. package/dist/rpc/kafka/index.d.ts +4 -4
  58. package/dist/rpc/kafka/index.js +15 -14
  59. package/dist/rpc/kafka/index.mjs +3 -2
  60. package/dist/rpc/nats/index.d.mts +4 -4
  61. package/dist/rpc/nats/index.d.ts +4 -4
  62. package/dist/rpc/nats/index.js +14 -13
  63. package/dist/rpc/nats/index.mjs +4 -3
  64. package/dist/rpc/rabbitmq/index.d.mts +4 -4
  65. package/dist/rpc/rabbitmq/index.d.ts +4 -4
  66. package/dist/rpc/rabbitmq/index.js +16 -15
  67. package/dist/rpc/rabbitmq/index.mjs +4 -3
  68. package/dist/rpc/redis/index.d.mts +4 -4
  69. package/dist/rpc/redis/index.d.ts +4 -4
  70. package/dist/rpc/redis/index.js +14 -13
  71. package/dist/rpc/redis/index.mjs +4 -3
  72. package/dist/test.d.mts +3 -3
  73. package/dist/test.d.ts +3 -3
  74. package/dist/test.js +6 -6
  75. package/dist/test.mjs +2 -2
  76. package/dist/{types-h40T3cRG.d.mts → types-BF1TDbFV.d.ts} +4 -3
  77. package/dist/{types-BtbL49Zs.d.mts → types-DYRu0vic.d.ts} +4 -3
  78. package/dist/{types-VFzEM7LL.d.ts → types-DYviSl5B.d.mts} +4 -3
  79. package/dist/{types-m3IEDKjP.d.ts → types-DqH1qA-q.d.mts} +4 -3
  80. package/package.json +8 -5
  81. package/register/export.mjs +30 -0
  82. package/register/index.mjs +50 -40
  83. package/register/loader.mjs +84 -66
  84. package/register/utils.mjs +60 -56
  85. package/dist/chunk-J5CFUN4V.js +0 -73
  86. package/dist/chunk-WHJ5FALK.mjs +0 -73
package/dist/helper.mjs CHANGED
@@ -1,20 +1,25 @@
1
1
  import {
2
- HMR,
3
- argToReq,
4
2
  createControllerMetaMap,
5
3
  detectAopDep,
6
4
  genClientQueue,
5
+ joinUrl,
7
6
  mergeObject,
8
7
  resolveDep,
9
8
  shallowClone
10
- } from "./chunk-V7EI76QQ.mjs";
11
- import "./chunk-WHJ5FALK.mjs";
9
+ } from "./chunk-Z7NAAE4M.mjs";
10
+ import {
11
+ HMR,
12
+ RELAUNCH,
13
+ RELOAD
14
+ } from "./chunk-NQ55PA2X.mjs";
12
15
  export {
13
16
  HMR,
14
- argToReq,
17
+ RELAUNCH,
18
+ RELOAD,
15
19
  createControllerMetaMap,
16
20
  detectAopDep,
17
21
  genClientQueue,
22
+ joinUrl,
18
23
  mergeObject,
19
24
  resolveDep,
20
25
  shallowClone
@@ -1,12 +1,12 @@
1
1
  import { Elysia as Elysia$1, Context, LocalHook, InputSchema, RouteSchema, SingletonBase } from 'elysia';
2
2
  import { BaseMacro } from 'elysia/dist/types';
3
- import { H as HttpContext, a as HttpOptions } from '../../types-h40T3cRG.mjs';
4
- import { F as Factory } from '../../core-BIcUwV18.mjs';
3
+ import { H as HttpCtx, a as HttpOptions } from '../../types-DYviSl5B.mjs';
4
+ import { F as Factory } from '../../core-DIfgUKIU.mjs';
5
5
  import 'node:http';
6
- import '../../meta-BXKLFTgG.mjs';
6
+ import '../../meta-CR-D39hQ.mjs';
7
7
  import 'phecda-core';
8
8
 
9
- interface ElysiaCtx extends HttpContext {
9
+ interface ElysiaCtx extends HttpCtx {
10
10
  type: 'elysia';
11
11
  app: Elysia$1;
12
12
  context: Context;
@@ -1,12 +1,12 @@
1
1
  import { Elysia as Elysia$1, Context, LocalHook, InputSchema, RouteSchema, SingletonBase } from 'elysia';
2
2
  import { BaseMacro } from 'elysia/dist/types';
3
- import { H as HttpContext, a as HttpOptions } from '../../types-VFzEM7LL.js';
4
- import { F as Factory } from '../../core-CYwEPfN4.js';
3
+ import { H as HttpCtx, a as HttpOptions } from '../../types-BF1TDbFV.js';
4
+ import { F as Factory } from '../../core-CUTbX_IS.js';
5
5
  import 'node:http';
6
- import '../../meta-BXKLFTgG.js';
6
+ import '../../meta-CR-D39hQ.js';
7
7
  import 'phecda-core';
8
8
 
9
- interface ElysiaCtx extends HttpContext {
9
+ interface ElysiaCtx extends HttpCtx {
10
10
  type: 'elysia';
11
11
  app: Elysia$1;
12
12
  context: Context;
@@ -1,16 +1,16 @@
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 _chunkMBCHNDAYjs = require('../../chunk-MBCHNDAY.js');
3
+ var _chunkKCPBITYZjs = require('../../chunk-KCPBITYZ.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
- var _chunkGSPBHZBHjs = require('../../chunk-GSPBHZBH.js');
10
+ var _chunkG7JFKM2Mjs = require('../../chunk-G7JFKM2M.js');
11
11
 
12
12
 
13
- var _chunkJ5CFUN4Vjs = require('../../chunk-J5CFUN4V.js');
13
+ var _chunk4LLLQOMFjs = require('../../chunk-4LLLQOMF.js');
14
14
 
15
15
  // src/http/elysia/bind.ts
16
16
  var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
@@ -19,14 +19,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/elysia");
19
19
  function bind(app, data, opts = {}) {
20
20
  const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
21
21
  const { moduleMap, meta } = data;
22
- const metaMap = _chunkGSPBHZBHjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
+ const metaMap = _chunkG7JFKM2Mjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
23
23
  const { controller, http, func, tag } = meta2.data;
24
24
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
25
25
  debug(`register method "${func}" in module "${tag}"`);
26
26
  return true;
27
27
  }
28
28
  });
29
- _chunkGSPBHZBHjs.detectAopDep.call(void 0, meta, {
29
+ _chunkG7JFKM2Mjs.detectAopDep.call(void 0, meta, {
30
30
  addons: [
31
31
  ...globalAddons,
32
32
  ...parallelAddons
@@ -35,61 +35,59 @@ function bind(app, data, opts = {}) {
35
35
  });
36
36
  registerRoute();
37
37
  function registerRoute() {
38
- _chunkGSPBHZBHjs.Context.applyAddons(globalAddons, app, "elysia");
38
+ _chunkG7JFKM2Mjs.Context.applyAddons(globalAddons, app, "elysia");
39
39
  if (parallelRoute) {
40
40
  const parallelRouter = new (0, _elysia.Elysia)();
41
- _chunkGSPBHZBHjs.Context.applyAddons(parallelAddons, app, "elysia");
41
+ _chunkG7JFKM2Mjs.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 _chunkGSPBHZBHjs.Context.filterRecord.default(e);
45
+ const error = await _chunkG7JFKM2Mjs.Context.filterRecord.default(e);
46
46
  c.set.status = error.status;
47
47
  return error;
48
48
  }
49
- _chunkJ5CFUN4Vjs.__name.call(void 0, errorHandler, "errorHandler");
50
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkGSPBHZBHjs.BadRequestException)("data format should be an array"));
49
+ _chunk4LLLQOMFjs.__name.call(void 0, errorHandler, "errorHandler");
50
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkG7JFKM2Mjs.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
  const { tag, func } = item;
55
55
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
56
- if (!metaMap.has(tag)) return resolve(await _chunkGSPBHZBHjs.Context.filterRecord.default(new (0, _chunkGSPBHZBHjs.BadRequestException)(`module "${tag}" doesn't exist`)));
56
+ if (!metaMap.has(tag)) return resolve(await _chunkG7JFKM2Mjs.Context.filterRecord.default(new (0, _chunkG7JFKM2Mjs.BadRequestException)(`module "${tag}" doesn't exist`)));
57
57
  const meta2 = metaMap.get(tag)[func];
58
- if (!meta2) return resolve(await _chunkGSPBHZBHjs.Context.filterRecord.default(new (0, _chunkGSPBHZBHjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
59
- const { data: { params } } = meta2;
60
- const aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
58
+ if (!meta2) return resolve(await _chunkG7JFKM2Mjs.Context.filterRecord.default(new (0, _chunkG7JFKM2Mjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
59
+ const aop = _chunkG7JFKM2Mjs.Context.getAop(meta2, {
61
60
  globalGuards,
62
61
  globalFilter,
63
62
  globalPipe
64
63
  });
65
64
  const contextData = {
66
65
  type: "elysia",
66
+ category: "http",
67
67
  parallel: true,
68
68
  context: c,
69
69
  index: i,
70
70
  meta: meta2,
71
71
  moduleMap,
72
- tag,
73
- func,
74
72
  app,
75
- ..._chunkGSPBHZBHjs.argToReq.call(void 0, params, item.args, c.headers),
76
- getCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
77
- setCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
73
+ ...item,
74
+ getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
75
+ setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
78
76
  ...opts2,
79
77
  value
80
78
  }), "setCookie"),
81
- delCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
82
- redirect: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
83
- setResHeaders: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
84
- setResStatus: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
85
- getRequest: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => {
79
+ delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
80
+ redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
81
+ setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
82
+ setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
83
+ getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => {
86
84
  throw new Error("elysia can't support getRequest");
87
85
  }, "getRequest"),
88
- getResponse: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => {
86
+ getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => {
89
87
  throw new Error("elysia can't support getResponse");
90
88
  }, "getResponse")
91
89
  };
92
- const context = new (0, _chunkGSPBHZBHjs.Context)(contextData);
90
+ const context = new (0, _chunkG7JFKM2Mjs.Context)(contextData);
93
91
  context.run(aop, resolve, resolve);
94
92
  });
95
93
  })).then((ret) => {
@@ -111,17 +109,18 @@ function bind(app, data, opts = {}) {
111
109
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
112
110
  let aop;
113
111
  if (!dynamic) {
114
- aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
112
+ aop = _chunkG7JFKM2Mjs.Context.getAop(meta2, {
115
113
  globalFilter,
116
114
  globalGuards,
117
115
  globalPipe
118
116
  });
119
117
  }
120
- _chunkGSPBHZBHjs.Context.applyAddons(addons, subApp, "elysia");
121
- subApp[http.type](http.prefix + http.route, async (c) => {
118
+ _chunkG7JFKM2Mjs.Context.applyAddons(addons, subApp, "elysia");
119
+ subApp[http.type](_chunkG7JFKM2Mjs.joinUrl.call(void 0, http.prefix, http.route), async (c) => {
122
120
  debug(`invoke method "${func}" in module "${tag}"`);
123
121
  const contextData = {
124
122
  type: "elysia",
123
+ category: "http",
125
124
  context: c,
126
125
  meta: meta2,
127
126
  moduleMap,
@@ -132,33 +131,33 @@ function bind(app, data, opts = {}) {
132
131
  params: c.params,
133
132
  headers: c.headers,
134
133
  app,
135
- getCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
136
- setCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
134
+ getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
135
+ setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
137
136
  ...opts2,
138
137
  value
139
138
  }), "setCookie"),
140
- delCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
141
- redirect: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
142
- setResHeaders: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
143
- setResStatus: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
144
- getRequest: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => {
139
+ delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
140
+ redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
141
+ setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
142
+ setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
143
+ getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => {
145
144
  throw new Error("elysia can't support getRequest");
146
145
  }, "getRequest"),
147
- getResponse: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => {
146
+ getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => {
148
147
  throw new Error("elysia can't support getResponse");
149
148
  }, "getResponse")
150
149
  };
151
150
  if (dynamic) {
152
- aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
151
+ aop = _chunkG7JFKM2Mjs.Context.getAop(meta2, {
153
152
  globalFilter,
154
153
  globalGuards,
155
154
  globalPipe
156
155
  });
157
156
  }
158
- const context = new (0, _chunkGSPBHZBHjs.Context)(contextData);
157
+ const context = new (0, _chunkG7JFKM2Mjs.Context)(contextData);
159
158
  if (http.headers) c.set.headers = http.headers;
160
159
  if (dynamic) {
161
- aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
160
+ aop = _chunkG7JFKM2Mjs.Context.getAop(meta2, {
162
161
  globalFilter,
163
162
  globalGuards,
164
163
  globalPipe
@@ -173,13 +172,13 @@ function bind(app, data, opts = {}) {
173
172
  }
174
173
  }
175
174
  }
176
- _chunkJ5CFUN4Vjs.__name.call(void 0, registerRoute, "registerRoute");
175
+ _chunk4LLLQOMFjs.__name.call(void 0, registerRoute, "registerRoute");
177
176
  }
178
- _chunkJ5CFUN4Vjs.__name.call(void 0, bind, "bind");
177
+ _chunk4LLLQOMFjs.__name.call(void 0, bind, "bind");
179
178
  function Elysia(opts) {
180
- return _chunkMBCHNDAYjs.Define.call(void 0, "elysia", opts);
179
+ return _chunkKCPBITYZjs.Define.call(void 0, "elysia", opts);
181
180
  }
182
- _chunkJ5CFUN4Vjs.__name.call(void 0, Elysia, "Elysia");
181
+ _chunk4LLLQOMFjs.__name.call(void 0, Elysia, "Elysia");
183
182
 
184
183
 
185
184
 
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  Define
3
- } from "../../chunk-HMVLXNV3.mjs";
3
+ } from "../../chunk-MUI6MTUO.mjs";
4
4
  import {
5
5
  BadRequestException,
6
6
  Context,
7
- argToReq,
8
7
  createControllerMetaMap,
9
- detectAopDep
10
- } from "../../chunk-V7EI76QQ.mjs";
8
+ detectAopDep,
9
+ joinUrl
10
+ } from "../../chunk-Z7NAAE4M.mjs";
11
11
  import {
12
12
  __name
13
- } from "../../chunk-WHJ5FALK.mjs";
13
+ } from "../../chunk-NQ55PA2X.mjs";
14
14
 
15
15
  // src/http/elysia/bind.ts
16
16
  import Debug from "debug";
@@ -56,7 +56,6 @@ function bind(app, data, opts = {}) {
56
56
  if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
57
57
  const meta2 = metaMap.get(tag)[func];
58
58
  if (!meta2) return resolve(await Context.filterRecord.default(new BadRequestException(`"${func}" in "${tag}" doesn't exist`)));
59
- const { data: { params } } = meta2;
60
59
  const aop = Context.getAop(meta2, {
61
60
  globalGuards,
62
61
  globalFilter,
@@ -64,15 +63,14 @@ function bind(app, data, opts = {}) {
64
63
  });
65
64
  const contextData = {
66
65
  type: "elysia",
66
+ category: "http",
67
67
  parallel: true,
68
68
  context: c,
69
69
  index: i,
70
70
  meta: meta2,
71
71
  moduleMap,
72
- tag,
73
- func,
74
72
  app,
75
- ...argToReq(params, item.args, c.headers),
73
+ ...item,
76
74
  getCookie: /* @__PURE__ */ __name((key) => c.cookie[key].value, "getCookie"),
77
75
  setCookie: /* @__PURE__ */ __name((key, value, opts2 = {}) => c.cookie[key].set({
78
76
  ...opts2,
@@ -118,10 +116,11 @@ function bind(app, data, opts = {}) {
118
116
  });
119
117
  }
120
118
  Context.applyAddons(addons, subApp, "elysia");
121
- subApp[http.type](http.prefix + http.route, async (c) => {
119
+ subApp[http.type](joinUrl(http.prefix, http.route), async (c) => {
122
120
  debug(`invoke method "${func}" in module "${tag}"`);
123
121
  const contextData = {
124
122
  type: "elysia",
123
+ category: "http",
125
124
  context: c,
126
125
  meta: meta2,
127
126
  moduleMap,
@@ -1,11 +1,11 @@
1
1
  import { Request, Response, Router, RequestHandler } from 'express';
2
- import { H as HttpContext, a as HttpOptions } from '../../types-h40T3cRG.mjs';
3
- import { F as Factory } from '../../core-BIcUwV18.mjs';
2
+ import { H as HttpCtx, a as HttpOptions } from '../../types-DYviSl5B.mjs';
3
+ import { F as Factory } from '../../core-DIfgUKIU.mjs';
4
4
  import 'node:http';
5
- import '../../meta-BXKLFTgG.mjs';
5
+ import '../../meta-CR-D39hQ.mjs';
6
6
  import 'phecda-core';
7
7
 
8
- interface ExpressCtx extends HttpContext {
8
+ interface ExpressCtx extends HttpCtx {
9
9
  type: 'express';
10
10
  request: Request;
11
11
  response: Response;
@@ -1,11 +1,11 @@
1
1
  import { Request, Response, Router, RequestHandler } from 'express';
2
- import { H as HttpContext, a as HttpOptions } from '../../types-VFzEM7LL.js';
3
- import { F as Factory } from '../../core-CYwEPfN4.js';
2
+ import { H as HttpCtx, a as HttpOptions } from '../../types-BF1TDbFV.js';
3
+ import { F as Factory } from '../../core-CUTbX_IS.js';
4
4
  import 'node:http';
5
- import '../../meta-BXKLFTgG.js';
5
+ import '../../meta-CR-D39hQ.js';
6
6
  import 'phecda-core';
7
7
 
8
- interface ExpressCtx extends HttpContext {
8
+ interface ExpressCtx extends HttpCtx {
9
9
  type: 'express';
10
10
  request: Request;
11
11
  response: Response;
@@ -4,11 +4,11 @@
4
4
 
5
5
 
6
6
 
7
+ var _chunkG7JFKM2Mjs = require('../../chunk-G7JFKM2M.js');
7
8
 
8
- var _chunkGSPBHZBHjs = require('../../chunk-GSPBHZBH.js');
9
9
 
10
10
 
11
- var _chunkJ5CFUN4Vjs = require('../../chunk-J5CFUN4V.js');
11
+ var _chunk4LLLQOMFjs = require('../../chunk-4LLLQOMF.js');
12
12
 
13
13
  // src/http/express/bind.ts
14
14
  var _express = require('express');
@@ -18,14 +18,14 @@ function bind(router, data, opts = {}) {
18
18
  const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
19
19
  const { moduleMap, meta } = data;
20
20
  const originStack = router.stack.slice(0, router.stack.length);
21
- const metaMap = _chunkGSPBHZBHjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
+ const metaMap = _chunkG7JFKM2Mjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
22
  const { controller, http, func, tag } = meta2.data;
23
23
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
24
24
  debug(`register method "${func}" in module "${tag}"`);
25
25
  return true;
26
26
  }
27
27
  });
28
- _chunkGSPBHZBHjs.detectAopDep.call(void 0, meta, {
28
+ _chunkG7JFKM2Mjs.detectAopDep.call(void 0, meta, {
29
29
  addons: [
30
30
  ...globalAddons,
31
31
  ...parallelAddons
@@ -33,62 +33,60 @@ function bind(router, data, opts = {}) {
33
33
  guards: globalGuards
34
34
  });
35
35
  registerRoute();
36
- _chunkGSPBHZBHjs.HMR.call(void 0, async () => {
36
+ _chunk4LLLQOMFjs.HMR.call(void 0, async () => {
37
37
  router.stack = originStack;
38
38
  registerRoute();
39
39
  });
40
40
  function registerRoute() {
41
- _chunkGSPBHZBHjs.Context.applyAddons(globalAddons, router, "express");
41
+ _chunkG7JFKM2Mjs.Context.applyAddons(globalAddons, router, "express");
42
42
  if (parallelRoute) {
43
43
  const subRouter = _express.Router.call(void 0, );
44
- _chunkGSPBHZBHjs.Context.applyAddons(parallelAddons, subRouter, "express");
44
+ _chunkG7JFKM2Mjs.Context.applyAddons(parallelAddons, subRouter, "express");
45
45
  subRouter.use(async (req, res, next) => {
46
46
  const { body } = req;
47
47
  async function errorHandler(e) {
48
- const error = await _chunkGSPBHZBHjs.Context.filterRecord.default(e);
48
+ const error = await _chunkG7JFKM2Mjs.Context.filterRecord.default(e);
49
49
  return res.status(error.status).json(error);
50
50
  }
51
- _chunkJ5CFUN4Vjs.__name.call(void 0, errorHandler, "errorHandler");
52
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkGSPBHZBHjs.BadRequestException)("data format should be an array"));
51
+ _chunk4LLLQOMFjs.__name.call(void 0, errorHandler, "errorHandler");
52
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkG7JFKM2Mjs.BadRequestException)("data format should be an array"));
53
53
  try {
54
54
  return Promise.all(body.map((item, i) => {
55
55
  return new Promise(async (resolve) => {
56
56
  const { tag, func } = item;
57
57
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
58
- if (!metaMap.has(tag)) return resolve(await _chunkGSPBHZBHjs.Context.filterRecord.default(new (0, _chunkGSPBHZBHjs.BadRequestException)(`module "${tag}" doesn't exist`)));
58
+ if (!metaMap.has(tag)) return resolve(await _chunkG7JFKM2Mjs.Context.filterRecord.default(new (0, _chunkG7JFKM2Mjs.BadRequestException)(`module "${tag}" doesn't exist`)));
59
59
  const meta2 = metaMap.get(tag)[func];
60
- if (!meta2) return resolve(await _chunkGSPBHZBHjs.Context.filterRecord.default(new (0, _chunkGSPBHZBHjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
61
- const { data: { params } } = meta2;
62
- const aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
60
+ if (!meta2) return resolve(await _chunkG7JFKM2Mjs.Context.filterRecord.default(new (0, _chunkG7JFKM2Mjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
61
+ const aop = _chunkG7JFKM2Mjs.Context.getAop(meta2, {
63
62
  globalFilter,
64
63
  globalGuards,
65
64
  globalPipe
66
65
  });
67
66
  const contextData = {
68
67
  type: "express",
68
+ category: "http",
69
69
  parallel: true,
70
70
  request: req,
71
71
  index: i,
72
72
  meta: meta2,
73
73
  response: res,
74
74
  moduleMap,
75
- tag,
76
- func,
77
75
  next,
78
76
  app: router,
79
- ..._chunkGSPBHZBHjs.argToReq.call(void 0, params, item.args, req.headers),
80
- getCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
81
- setCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
82
- delCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => res.cookie(key, "", {
77
+ ...item,
78
+ getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
79
+ setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
80
+ delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => res.cookie(key, "", {
83
81
  expires: /* @__PURE__ */ new Date(0)
84
82
  }), "delCookie"),
85
- redirect: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (url, status) => status ? res.redirect(status, url) : res.redirect(url), "redirect"),
86
- setResHeaders: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
87
- setResStatus: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
88
- getRequest: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => req, "getRequest"),
89
- getResponse: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => res, "getResponse")
83
+ redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url, status) => status ? res.redirect(status, url) : res.redirect(url), "redirect"),
84
+ setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
85
+ setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
86
+ getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => req, "getRequest"),
87
+ getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => res, "getResponse")
90
88
  };
91
- const context = new (0, _chunkGSPBHZBHjs.Context)(contextData);
89
+ const context = new (0, _chunkG7JFKM2Mjs.Context)(contextData);
92
90
  context.run(aop, resolve, resolve);
93
91
  });
94
92
  })).then((ret) => {
@@ -107,18 +105,19 @@ function bind(router, data, opts = {}) {
107
105
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
108
106
  let aop;
109
107
  if (!dynamic) {
110
- aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
108
+ aop = _chunkG7JFKM2Mjs.Context.getAop(meta2, {
111
109
  globalFilter,
112
110
  globalGuards,
113
111
  globalPipe
114
112
  });
115
113
  }
116
114
  const subRouter = _express.Router.call(void 0, );
117
- _chunkGSPBHZBHjs.Context.applyAddons(addons, subRouter, "express");
118
- subRouter[http.type](http.prefix + http.route, async (req, res, next) => {
115
+ _chunkG7JFKM2Mjs.Context.applyAddons(addons, subRouter, "express");
116
+ subRouter[http.type](_chunkG7JFKM2Mjs.joinUrl.call(void 0, http.prefix, http.route), async (req, res, next) => {
119
117
  debug(`invoke method "${func}" in module "${tag}"`);
120
118
  const contextData = {
121
119
  type: "express",
120
+ category: "http",
122
121
  request: req,
123
122
  meta: meta2,
124
123
  response: res,
@@ -131,21 +130,21 @@ function bind(router, data, opts = {}) {
131
130
  headers: req.headers,
132
131
  app: router,
133
132
  next,
134
- getCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
135
- setCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
136
- delCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => res.cookie(key, "", {
133
+ getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
134
+ setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
135
+ delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => res.cookie(key, "", {
137
136
  expires: /* @__PURE__ */ new Date(0)
138
137
  }), "delCookie"),
139
- redirect: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (url, status) => status ? res.redirect(status, url) : res.redirect(url), "redirect"),
140
- setResHeaders: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
141
- setResStatus: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
142
- getRequest: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => req, "getRequest"),
143
- getResponse: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => res, "getResponse")
138
+ redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url, status) => status ? res.redirect(status, url) : res.redirect(url), "redirect"),
139
+ setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
140
+ setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
141
+ getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => req, "getRequest"),
142
+ getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => res, "getResponse")
144
143
  };
145
- const context = new (0, _chunkGSPBHZBHjs.Context)(contextData);
144
+ const context = new (0, _chunkG7JFKM2Mjs.Context)(contextData);
146
145
  if (http.headers) res.set(http.headers);
147
146
  if (dynamic) {
148
- aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
147
+ aop = _chunkG7JFKM2Mjs.Context.getAop(meta2, {
149
148
  globalFilter,
150
149
  globalGuards,
151
150
  globalPipe
@@ -164,9 +163,9 @@ function bind(router, data, opts = {}) {
164
163
  }
165
164
  }
166
165
  }
167
- _chunkJ5CFUN4Vjs.__name.call(void 0, registerRoute, "registerRoute");
166
+ _chunk4LLLQOMFjs.__name.call(void 0, registerRoute, "registerRoute");
168
167
  }
169
- _chunkJ5CFUN4Vjs.__name.call(void 0, bind, "bind");
168
+ _chunk4LLLQOMFjs.__name.call(void 0, bind, "bind");
170
169
 
171
170
 
172
171
  exports.bind = bind;
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  BadRequestException,
3
3
  Context,
4
- HMR,
5
- argToReq,
6
4
  createControllerMetaMap,
7
- detectAopDep
8
- } from "../../chunk-V7EI76QQ.mjs";
5
+ detectAopDep,
6
+ joinUrl
7
+ } from "../../chunk-Z7NAAE4M.mjs";
9
8
  import {
9
+ HMR,
10
10
  __name
11
- } from "../../chunk-WHJ5FALK.mjs";
11
+ } from "../../chunk-NQ55PA2X.mjs";
12
12
 
13
13
  // src/http/express/bind.ts
14
14
  import { Router } from "express";
@@ -58,7 +58,6 @@ function bind(router, data, opts = {}) {
58
58
  if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
59
59
  const meta2 = metaMap.get(tag)[func];
60
60
  if (!meta2) return resolve(await Context.filterRecord.default(new BadRequestException(`"${func}" in "${tag}" doesn't exist`)));
61
- const { data: { params } } = meta2;
62
61
  const aop = Context.getAop(meta2, {
63
62
  globalFilter,
64
63
  globalGuards,
@@ -66,17 +65,16 @@ function bind(router, data, opts = {}) {
66
65
  });
67
66
  const contextData = {
68
67
  type: "express",
68
+ category: "http",
69
69
  parallel: true,
70
70
  request: req,
71
71
  index: i,
72
72
  meta: meta2,
73
73
  response: res,
74
74
  moduleMap,
75
- tag,
76
- func,
77
75
  next,
78
76
  app: router,
79
- ...argToReq(params, item.args, req.headers),
77
+ ...item,
80
78
  getCookie: /* @__PURE__ */ __name((key) => req.cookies[key], "getCookie"),
81
79
  setCookie: /* @__PURE__ */ __name((key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
82
80
  delCookie: /* @__PURE__ */ __name((key) => res.cookie(key, "", {
@@ -115,10 +113,11 @@ function bind(router, data, opts = {}) {
115
113
  }
116
114
  const subRouter = Router();
117
115
  Context.applyAddons(addons, subRouter, "express");
118
- subRouter[http.type](http.prefix + http.route, async (req, res, next) => {
116
+ subRouter[http.type](joinUrl(http.prefix, http.route), async (req, res, next) => {
119
117
  debug(`invoke method "${func}" in module "${tag}"`);
120
118
  const contextData = {
121
119
  type: "express",
120
+ category: "http",
122
121
  request: req,
123
122
  meta: meta2,
124
123
  response: res,
@@ -1,11 +1,11 @@
1
1
  import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback, FastifyRegisterOptions, FastifyPluginOptions, RouteShorthandOptions } from 'fastify';
2
- import { H as HttpContext, a as HttpOptions } from '../../types-h40T3cRG.mjs';
3
- import { F as Factory } from '../../core-BIcUwV18.mjs';
2
+ import { H as HttpCtx, a as HttpOptions } from '../../types-DYviSl5B.mjs';
3
+ import { F as Factory } from '../../core-DIfgUKIU.mjs';
4
4
  import 'node:http';
5
- import '../../meta-BXKLFTgG.mjs';
5
+ import '../../meta-CR-D39hQ.mjs';
6
6
  import 'phecda-core';
7
7
 
8
- interface FastifyCtx extends HttpContext {
8
+ interface FastifyCtx extends HttpCtx {
9
9
  type: 'fastify';
10
10
  request: FastifyRequest;
11
11
  response: FastifyReply;
@@ -1,11 +1,11 @@
1
1
  import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback, FastifyRegisterOptions, FastifyPluginOptions, RouteShorthandOptions } from 'fastify';
2
- import { H as HttpContext, a as HttpOptions } from '../../types-VFzEM7LL.js';
3
- import { F as Factory } from '../../core-CYwEPfN4.js';
2
+ import { H as HttpCtx, a as HttpOptions } from '../../types-BF1TDbFV.js';
3
+ import { F as Factory } from '../../core-CUTbX_IS.js';
4
4
  import 'node:http';
5
- import '../../meta-BXKLFTgG.js';
5
+ import '../../meta-CR-D39hQ.js';
6
6
  import 'phecda-core';
7
7
 
8
- interface FastifyCtx extends HttpContext {
8
+ interface FastifyCtx extends HttpCtx {
9
9
  type: 'fastify';
10
10
  request: FastifyRequest;
11
11
  response: FastifyReply;