phecda-server 7.0.0-alpha.0 → 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 +24 -24
  2. package/assets/schema.json +55 -55
  3. package/bin/cli.mjs +31 -18
  4. package/dist/chunk-4LLLQOMF.js +152 -0
  5. package/dist/{chunk-BGXSMOLX.js → chunk-6OQ2SB5W.js} +138 -70
  6. package/dist/{chunk-SW5IKE5H.js → chunk-G7JFKM2M.js} +136 -89
  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-5622RBNB.mjs → chunk-YCES6ABN.mjs} +125 -57
  11. package/dist/{chunk-P75VKZJY.mjs → chunk-Z7NAAE4M.mjs} +94 -47
  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 +46 -40
  47. package/dist/index.d.ts +46 -40
  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 +384 -367
  84. package/register/utils.mjs +60 -56
  85. package/dist/chunk-J5CFUN4V.js +0 -73
  86. package/dist/chunk-WHJ5FALK.mjs +0 -73
@@ -3,11 +3,10 @@
3
3
 
4
4
 
5
5
 
6
+ var _chunkG7JFKM2Mjs = require('../../chunk-G7JFKM2M.js');
6
7
 
7
- var _chunkSW5IKE5Hjs = require('../../chunk-SW5IKE5H.js');
8
8
 
9
-
10
- var _chunkJ5CFUN4Vjs = require('../../chunk-J5CFUN4V.js');
9
+ var _chunk4LLLQOMFjs = require('../../chunk-4LLLQOMF.js');
11
10
 
12
11
  // src/http/hono/bind.ts
13
12
  var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
@@ -17,14 +16,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/hono");
17
16
  function bind(router, data, opts = {}) {
18
17
  const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
19
18
  const { moduleMap, meta } = data;
20
- const metaMap = _chunkSW5IKE5Hjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
19
+ const metaMap = _chunkG7JFKM2Mjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
20
  const { controller, http, func, tag } = meta2.data;
22
21
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
23
22
  debug(`register method "${func}" in module "${tag}"`);
24
23
  return true;
25
24
  }
26
25
  });
27
- _chunkSW5IKE5Hjs.detectAopDep.call(void 0, meta, {
26
+ _chunkG7JFKM2Mjs.detectAopDep.call(void 0, meta, {
28
27
  addons: [
29
28
  ...globalAddons,
30
29
  ...parallelAddons
@@ -35,26 +34,25 @@ function bind(router, data, opts = {}) {
35
34
  function registerRoute() {
36
35
  if (parallelRoute) {
37
36
  const subApp = new (0, _hono.Hono)();
38
- _chunkSW5IKE5Hjs.Context.applyAddons(parallelAddons, subApp, "hono");
37
+ _chunkG7JFKM2Mjs.Context.applyAddons(parallelAddons, subApp, "hono");
39
38
  subApp.post("", async (c) => {
40
39
  const body = await c.req.json();
41
40
  async function errorHandler(e) {
42
- const error = await _chunkSW5IKE5Hjs.Context.filterRecord.default(e);
41
+ const error = await _chunkG7JFKM2Mjs.Context.filterRecord.default(e);
43
42
  c.status(error.status);
44
43
  return c.json(error);
45
44
  }
46
- _chunkJ5CFUN4Vjs.__name.call(void 0, errorHandler, "errorHandler");
47
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkSW5IKE5Hjs.BadRequestException)("data format should be an array"));
45
+ _chunk4LLLQOMFjs.__name.call(void 0, errorHandler, "errorHandler");
46
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkG7JFKM2Mjs.BadRequestException)("data format should be an array"));
48
47
  try {
49
48
  return Promise.all(body.map((item, i) => {
50
49
  return new Promise(async (resolve) => {
51
50
  const { tag, func } = item;
52
51
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
53
- if (!metaMap.has(tag)) return resolve(await _chunkSW5IKE5Hjs.Context.filterRecord.default(new (0, _chunkSW5IKE5Hjs.BadRequestException)(`module "${tag}" doesn't exist`)));
52
+ if (!metaMap.has(tag)) return resolve(await _chunkG7JFKM2Mjs.Context.filterRecord.default(new (0, _chunkG7JFKM2Mjs.BadRequestException)(`module "${tag}" doesn't exist`)));
54
53
  const meta2 = metaMap.get(tag)[func];
55
- if (!meta2) return resolve(await _chunkSW5IKE5Hjs.Context.filterRecord.default(new (0, _chunkSW5IKE5Hjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
56
- const { data: { params } } = meta2;
57
- const aop = _chunkSW5IKE5Hjs.Context.getAop(meta2, {
54
+ if (!meta2) return resolve(await _chunkG7JFKM2Mjs.Context.filterRecord.default(new (0, _chunkG7JFKM2Mjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
55
+ const aop = _chunkG7JFKM2Mjs.Context.getAop(meta2, {
58
56
  globalFilter,
59
57
  globalGuards,
60
58
  globalPipe
@@ -62,26 +60,25 @@ function bind(router, data, opts = {}) {
62
60
  const contextData = {
63
61
  type: "hono",
64
62
  parallel: true,
63
+ category: "http",
65
64
  context: c,
66
65
  index: i,
67
66
  meta: meta2,
68
67
  moduleMap,
69
- tag,
70
- func,
71
68
  app: router,
72
- ..._chunkSW5IKE5Hjs.argToReq.call(void 0, params, item.args, c.req.header()),
73
- getCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => _cookie.getCookie.call(void 0, c, key), "getCookie"),
74
- delCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => _cookie.deleteCookie.call(void 0, c, key), "delCookie"),
75
- setCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key, value, opts2) => _cookie.setCookie.call(void 0, c, key, value, opts2), "setCookie"),
76
- redirect: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
77
- setResHeaders: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (headers) => {
69
+ ...item,
70
+ getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => _cookie.getCookie.call(void 0, c, key), "getCookie"),
71
+ delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => _cookie.deleteCookie.call(void 0, c, key), "delCookie"),
72
+ setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => _cookie.setCookie.call(void 0, c, key, value, opts2), "setCookie"),
73
+ redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
74
+ setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => {
78
75
  for (const name in headers) c.header(name, headers[name]);
79
76
  }, "setResHeaders"),
80
- setResStatus: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (status) => c.status(status), "setResStatus"),
81
- getRequest: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => c.req.raw, "getRequest"),
82
- getResponse: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => c.res, "getResponse")
77
+ setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (status) => c.status(status), "setResStatus"),
78
+ getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => c.req.raw, "getRequest"),
79
+ getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => c.res, "getResponse")
83
80
  };
84
- const context = new (0, _chunkSW5IKE5Hjs.Context)(contextData);
81
+ const context = new (0, _chunkG7JFKM2Mjs.Context)(contextData);
85
82
  context.run(aop, resolve, resolve);
86
83
  });
87
84
  })).then((ret) => {
@@ -101,18 +98,19 @@ function bind(router, data, opts = {}) {
101
98
  const needBody = params.some((item) => item.type === "body");
102
99
  let aop;
103
100
  if (!dynamic) {
104
- aop = _chunkSW5IKE5Hjs.Context.getAop(meta2, {
101
+ aop = _chunkG7JFKM2Mjs.Context.getAop(meta2, {
105
102
  globalFilter,
106
103
  globalGuards,
107
104
  globalPipe
108
105
  });
109
106
  }
110
107
  const subApp = new (0, _hono.Hono)();
111
- _chunkSW5IKE5Hjs.Context.applyAddons(addons, subApp, "hono");
108
+ _chunkG7JFKM2Mjs.Context.applyAddons(addons, subApp, "hono");
112
109
  subApp[http.type](http.route, async (c) => {
113
110
  debug(`invoke method "${func}" in module "${tag}"`);
114
111
  const contextData = {
115
112
  type: "hono",
113
+ category: "http",
116
114
  context: c,
117
115
  meta: meta2,
118
116
  moduleMap,
@@ -123,23 +121,23 @@ function bind(router, data, opts = {}) {
123
121
  params: c.req.param(),
124
122
  headers: c.req.header(),
125
123
  app: router,
126
- getCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => _cookie.getCookie.call(void 0, c, key), "getCookie"),
127
- delCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => _cookie.deleteCookie.call(void 0, c, key), "delCookie"),
128
- setCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key, value, opts2) => _cookie.setCookie.call(void 0, c, key, value, opts2), "setCookie"),
129
- redirect: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
130
- setResHeaders: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (headers) => {
124
+ getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => _cookie.getCookie.call(void 0, c, key), "getCookie"),
125
+ delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => _cookie.deleteCookie.call(void 0, c, key), "delCookie"),
126
+ setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => _cookie.setCookie.call(void 0, c, key, value, opts2), "setCookie"),
127
+ redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
128
+ setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => {
131
129
  for (const name in headers) c.header(name, headers[name]);
132
130
  }, "setResHeaders"),
133
- setResStatus: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (status) => c.status(status), "setResStatus"),
134
- getRequest: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => c.req.raw, "getRequest"),
135
- getResponse: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => c.res, "getResponse")
131
+ setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (status) => c.status(status), "setResStatus"),
132
+ getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => c.req.raw, "getRequest"),
133
+ getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => c.res, "getResponse")
136
134
  };
137
- const context = new (0, _chunkSW5IKE5Hjs.Context)(contextData);
135
+ const context = new (0, _chunkG7JFKM2Mjs.Context)(contextData);
138
136
  if (http.headers) {
139
137
  for (const name in http.headers) c.header(name, http.headers[name]);
140
138
  }
141
139
  if (dynamic) {
142
- aop = _chunkSW5IKE5Hjs.Context.getAop(meta2, {
140
+ aop = _chunkG7JFKM2Mjs.Context.getAop(meta2, {
143
141
  globalFilter,
144
142
  globalGuards,
145
143
  globalPipe
@@ -158,9 +156,9 @@ function bind(router, data, opts = {}) {
158
156
  }
159
157
  }
160
158
  }
161
- _chunkJ5CFUN4Vjs.__name.call(void 0, registerRoute, "registerRoute");
159
+ _chunk4LLLQOMFjs.__name.call(void 0, registerRoute, "registerRoute");
162
160
  }
163
- _chunkJ5CFUN4Vjs.__name.call(void 0, bind, "bind");
161
+ _chunk4LLLQOMFjs.__name.call(void 0, bind, "bind");
164
162
 
165
163
 
166
164
  exports.bind = bind;
@@ -1,13 +1,12 @@
1
1
  import {
2
2
  BadRequestException,
3
3
  Context,
4
- argToReq,
5
4
  createControllerMetaMap,
6
5
  detectAopDep
7
- } from "../../chunk-P75VKZJY.mjs";
6
+ } from "../../chunk-Z7NAAE4M.mjs";
8
7
  import {
9
8
  __name
10
- } from "../../chunk-WHJ5FALK.mjs";
9
+ } from "../../chunk-NQ55PA2X.mjs";
11
10
 
12
11
  // src/http/hono/bind.ts
13
12
  import Debug from "debug";
@@ -53,7 +52,6 @@ function bind(router, data, opts = {}) {
53
52
  if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
54
53
  const meta2 = metaMap.get(tag)[func];
55
54
  if (!meta2) return resolve(await Context.filterRecord.default(new BadRequestException(`"${func}" in "${tag}" doesn't exist`)));
56
- const { data: { params } } = meta2;
57
55
  const aop = Context.getAop(meta2, {
58
56
  globalFilter,
59
57
  globalGuards,
@@ -62,14 +60,13 @@ function bind(router, data, opts = {}) {
62
60
  const contextData = {
63
61
  type: "hono",
64
62
  parallel: true,
63
+ category: "http",
65
64
  context: c,
66
65
  index: i,
67
66
  meta: meta2,
68
67
  moduleMap,
69
- tag,
70
- func,
71
68
  app: router,
72
- ...argToReq(params, item.args, c.req.header()),
69
+ ...item,
73
70
  getCookie: /* @__PURE__ */ __name((key) => getCookie(c, key), "getCookie"),
74
71
  delCookie: /* @__PURE__ */ __name((key) => deleteCookie(c, key), "delCookie"),
75
72
  setCookie: /* @__PURE__ */ __name((key, value, opts2) => setCookie(c, key, value, opts2), "setCookie"),
@@ -113,6 +110,7 @@ function bind(router, data, opts = {}) {
113
110
  debug(`invoke method "${func}" in module "${tag}"`);
114
111
  const contextData = {
115
112
  type: "hono",
113
+ category: "http",
116
114
  context: c,
117
115
  meta: meta2,
118
116
  moduleMap,
@@ -1,11 +1,11 @@
1
1
  import { Request, Response, Router, MiddlewareHandler } from 'hyper-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 HyperExpressCtx extends HttpContext {
8
+ interface HyperExpressCtx extends HttpCtx {
9
9
  type: 'hyper-express';
10
10
  request: Request;
11
11
  response: Response;
@@ -1,11 +1,11 @@
1
1
  import { Request, Response, Router, MiddlewareHandler } from 'hyper-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 HyperExpressCtx extends HttpContext {
8
+ interface HyperExpressCtx extends HttpCtx {
9
9
  type: 'hyper-express';
10
10
  request: Request;
11
11
  response: Response;
@@ -4,10 +4,10 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkSW5IKE5Hjs = require('../../chunk-SW5IKE5H.js');
7
+ var _chunkG7JFKM2Mjs = require('../../chunk-G7JFKM2M.js');
8
8
 
9
9
 
10
- var _chunkJ5CFUN4Vjs = require('../../chunk-J5CFUN4V.js');
10
+ var _chunk4LLLQOMFjs = require('../../chunk-4LLLQOMF.js');
11
11
 
12
12
  // src/http/hyper-express/bind.ts
13
13
  var _hyperexpress = require('hyper-express');
@@ -16,14 +16,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/hyper-express");
16
16
  function bind(router, data, opts = {}) {
17
17
  const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
18
18
  const { moduleMap, meta } = data;
19
- const metaMap = _chunkSW5IKE5Hjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
19
+ const metaMap = _chunkG7JFKM2Mjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
20
20
  const { controller, http, func, tag } = meta2.data;
21
21
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
22
22
  debug(`register method "${func}" in module "${tag}"`);
23
23
  return true;
24
24
  }
25
25
  });
26
- _chunkSW5IKE5Hjs.detectAopDep.call(void 0, meta, {
26
+ _chunkG7JFKM2Mjs.detectAopDep.call(void 0, meta, {
27
27
  addons: [
28
28
  ...globalAddons,
29
29
  ...parallelAddons
@@ -32,54 +32,52 @@ function bind(router, data, opts = {}) {
32
32
  });
33
33
  registerRoute();
34
34
  async function registerRoute() {
35
- _chunkSW5IKE5Hjs.Context.applyAddons(globalAddons, router, "hyper-express");
35
+ _chunkG7JFKM2Mjs.Context.applyAddons(globalAddons, router, "hyper-express");
36
36
  if (parallelRoute) {
37
37
  const subRouter = new (0, _hyperexpress.Router)();
38
38
  subRouter.post(parallelRoute, async (req, res, next) => {
39
39
  const body = await req.json();
40
40
  async function errorHandler(e) {
41
- const error = await _chunkSW5IKE5Hjs.Context.filterRecord.default(e);
41
+ const error = await _chunkG7JFKM2Mjs.Context.filterRecord.default(e);
42
42
  return res.status(error.status).json(error);
43
43
  }
44
- _chunkJ5CFUN4Vjs.__name.call(void 0, errorHandler, "errorHandler");
45
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkSW5IKE5Hjs.BadRequestException)("data format should be an array"));
44
+ _chunk4LLLQOMFjs.__name.call(void 0, errorHandler, "errorHandler");
45
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkG7JFKM2Mjs.BadRequestException)("data format should be an array"));
46
46
  try {
47
47
  return Promise.all(body.map((item, i) => {
48
48
  return new Promise(async (resolve) => {
49
49
  const { tag, func } = item;
50
50
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
51
- if (!metaMap.has(tag)) return resolve(await _chunkSW5IKE5Hjs.Context.filterRecord.default(new (0, _chunkSW5IKE5Hjs.BadRequestException)(`module "${tag}" doesn't exist`)));
51
+ if (!metaMap.has(tag)) return resolve(await _chunkG7JFKM2Mjs.Context.filterRecord.default(new (0, _chunkG7JFKM2Mjs.BadRequestException)(`module "${tag}" doesn't exist`)));
52
52
  const meta2 = metaMap.get(tag)[func];
53
- if (!meta2) return resolve(await _chunkSW5IKE5Hjs.Context.filterRecord.default(new (0, _chunkSW5IKE5Hjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
54
- const { data: { params } } = meta2;
55
- const aop = _chunkSW5IKE5Hjs.Context.getAop(meta2, {
53
+ if (!meta2) return resolve(await _chunkG7JFKM2Mjs.Context.filterRecord.default(new (0, _chunkG7JFKM2Mjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
54
+ const aop = _chunkG7JFKM2Mjs.Context.getAop(meta2, {
56
55
  globalFilter,
57
56
  globalGuards,
58
57
  globalPipe
59
58
  });
60
59
  const contextData = {
61
60
  type: "hyper-express",
61
+ category: "http",
62
62
  parallel: true,
63
63
  request: req,
64
64
  index: i,
65
65
  meta: meta2,
66
66
  response: res,
67
67
  moduleMap,
68
- tag,
69
- func,
70
68
  app: router,
71
- ..._chunkSW5IKE5Hjs.argToReq.call(void 0, params, item.args, req.headers),
69
+ ...item,
72
70
  next,
73
- getCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
74
- setCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, _optionalChain([opts2, 'optionalAccess', _2 => _2.expires]) && opts2.expires.getTime() - Date.now(), opts2 || {}), "setCookie"),
75
- delCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
76
- redirect: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (url) => res.redirect(url), "redirect"),
77
- setResHeaders: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
78
- setResStatus: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
79
- getRequest: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => req, "getRequest"),
80
- getResponse: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => res, "getResponse")
71
+ getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
72
+ setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, _optionalChain([opts2, 'optionalAccess', _2 => _2.expires]) && opts2.expires.getTime() - Date.now(), opts2 || {}), "setCookie"),
73
+ delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
74
+ redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url) => res.redirect(url), "redirect"),
75
+ setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
76
+ setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
77
+ getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => req, "getRequest"),
78
+ getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => res, "getResponse")
81
79
  };
82
- const context = new (0, _chunkSW5IKE5Hjs.Context)(contextData);
80
+ const context = new (0, _chunkG7JFKM2Mjs.Context)(contextData);
83
81
  context.run(aop, resolve, resolve);
84
82
  });
85
83
  })).then((ret) => {
@@ -99,18 +97,19 @@ function bind(router, data, opts = {}) {
99
97
  const needBody = params.some((item) => item.type === "body");
100
98
  let aop;
101
99
  if (!dynamic) {
102
- aop = _chunkSW5IKE5Hjs.Context.getAop(meta2, {
100
+ aop = _chunkG7JFKM2Mjs.Context.getAop(meta2, {
103
101
  globalFilter,
104
102
  globalGuards,
105
103
  globalPipe
106
104
  });
107
105
  }
108
106
  const subRouter = new (0, _hyperexpress.Router)();
109
- _chunkSW5IKE5Hjs.Context.applyAddons(addons, subRouter, "hyper-express");
110
- subRouter[http.type](http.prefix + http.route, async (req, res, next) => {
107
+ _chunkG7JFKM2Mjs.Context.applyAddons(addons, subRouter, "hyper-express");
108
+ subRouter[http.type](_chunkG7JFKM2Mjs.joinUrl.call(void 0, http.prefix, http.route), async (req, res, next) => {
111
109
  debug(`invoke method "${func}" in module "${tag}"`);
112
110
  const contextData = {
113
111
  type: "hyper-express",
112
+ category: "http",
114
113
  request: req,
115
114
  meta: meta2,
116
115
  response: res,
@@ -123,21 +122,21 @@ function bind(router, data, opts = {}) {
123
122
  params: req.path_parameters,
124
123
  headers: req.headers,
125
124
  next,
126
- getCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
127
- setCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, _optionalChain([opts2, 'optionalAccess', _4 => _4.expires]) && opts2.expires.getTime() - Date.now(), opts2 || {}), "setCookie"),
128
- delCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
129
- redirect: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (url) => res.redirect(url), "redirect"),
130
- setResHeaders: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
131
- setResStatus: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
132
- getRequest: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => req, "getRequest"),
133
- getResponse: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => res, "getResponse")
125
+ getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
126
+ setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, _optionalChain([opts2, 'optionalAccess', _4 => _4.expires]) && opts2.expires.getTime() - Date.now(), opts2 || {}), "setCookie"),
127
+ delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
128
+ redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url) => res.redirect(url), "redirect"),
129
+ setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
130
+ setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
131
+ getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => req, "getRequest"),
132
+ getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => res, "getResponse")
134
133
  };
135
- const context = new (0, _chunkSW5IKE5Hjs.Context)(contextData);
134
+ const context = new (0, _chunkG7JFKM2Mjs.Context)(contextData);
136
135
  if (http.headers) {
137
136
  for (const name in http.headers) res.set(name, http.headers[name]);
138
137
  }
139
138
  if (dynamic) {
140
- aop = _chunkSW5IKE5Hjs.Context.getAop(meta2, {
139
+ aop = _chunkG7JFKM2Mjs.Context.getAop(meta2, {
141
140
  globalFilter,
142
141
  globalGuards,
143
142
  globalPipe
@@ -156,9 +155,9 @@ function bind(router, data, opts = {}) {
156
155
  }
157
156
  }
158
157
  }
159
- _chunkJ5CFUN4Vjs.__name.call(void 0, registerRoute, "registerRoute");
158
+ _chunk4LLLQOMFjs.__name.call(void 0, registerRoute, "registerRoute");
160
159
  }
161
- _chunkJ5CFUN4Vjs.__name.call(void 0, bind, "bind");
160
+ _chunk4LLLQOMFjs.__name.call(void 0, bind, "bind");
162
161
 
163
162
 
164
163
  exports.bind = bind;
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  BadRequestException,
3
3
  Context,
4
- argToReq,
5
4
  createControllerMetaMap,
6
- detectAopDep
7
- } from "../../chunk-P75VKZJY.mjs";
5
+ detectAopDep,
6
+ joinUrl
7
+ } from "../../chunk-Z7NAAE4M.mjs";
8
8
  import {
9
9
  __name
10
- } from "../../chunk-WHJ5FALK.mjs";
10
+ } from "../../chunk-NQ55PA2X.mjs";
11
11
 
12
12
  // src/http/hyper-express/bind.ts
13
13
  import { Router } from "hyper-express";
@@ -51,7 +51,6 @@ function bind(router, data, opts = {}) {
51
51
  if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
52
52
  const meta2 = metaMap.get(tag)[func];
53
53
  if (!meta2) return resolve(await Context.filterRecord.default(new BadRequestException(`"${func}" in "${tag}" doesn't exist`)));
54
- const { data: { params } } = meta2;
55
54
  const aop = Context.getAop(meta2, {
56
55
  globalFilter,
57
56
  globalGuards,
@@ -59,16 +58,15 @@ function bind(router, data, opts = {}) {
59
58
  });
60
59
  const contextData = {
61
60
  type: "hyper-express",
61
+ category: "http",
62
62
  parallel: true,
63
63
  request: req,
64
64
  index: i,
65
65
  meta: meta2,
66
66
  response: res,
67
67
  moduleMap,
68
- tag,
69
- func,
70
68
  app: router,
71
- ...argToReq(params, item.args, req.headers),
69
+ ...item,
72
70
  next,
73
71
  getCookie: /* @__PURE__ */ __name((key) => req.cookies[key], "getCookie"),
74
72
  setCookie: /* @__PURE__ */ __name((key, value, opts2) => res.cookie(key, value, opts2?.expires && opts2.expires.getTime() - Date.now(), opts2 || {}), "setCookie"),
@@ -107,10 +105,11 @@ function bind(router, data, opts = {}) {
107
105
  }
108
106
  const subRouter = new Router();
109
107
  Context.applyAddons(addons, subRouter, "hyper-express");
110
- subRouter[http.type](http.prefix + http.route, async (req, res, next) => {
108
+ subRouter[http.type](joinUrl(http.prefix, http.route), async (req, res, next) => {
111
109
  debug(`invoke method "${func}" in module "${tag}"`);
112
110
  const contextData = {
113
111
  type: "hyper-express",
112
+ category: "http",
114
113
  request: req,
115
114
  meta: meta2,
116
115
  response: res,
@@ -1,12 +1,12 @@
1
1
  import Router, { RouterParamContext } from '@koa/router';
2
2
  import { DefaultContext, DefaultState } from 'koa';
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 KoaCtx extends HttpContext {
9
+ interface KoaCtx extends HttpCtx {
10
10
  type: 'koa';
11
11
  ctx: DefaultContext & RouterParamContext<DefaultState, DefaultContext>;
12
12
  next: Function;
@@ -1,12 +1,12 @@
1
1
  import Router, { RouterParamContext } from '@koa/router';
2
2
  import { DefaultContext, DefaultState } from 'koa';
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 KoaCtx extends HttpContext {
9
+ interface KoaCtx extends HttpCtx {
10
10
  type: 'koa';
11
11
  ctx: DefaultContext & RouterParamContext<DefaultState, DefaultContext>;
12
12
  next: Function;