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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/bin/cli.mjs +10 -1
  2. package/dist/{chunk-M5HGFUCV.js → chunk-5RBTN33A.js} +23 -3
  3. package/dist/{chunk-RGSKKTHD.mjs → chunk-7ZGYJ5OW.mjs} +88 -54
  4. package/dist/{chunk-IRXNF6ZE.mjs → chunk-CVPZWDXU.mjs} +39 -30
  5. package/dist/{chunk-MENRZSGW.js → chunk-FX3LDQII.js} +88 -79
  6. package/dist/{chunk-C5BVKEGW.mjs → chunk-FXTJ3BJ6.mjs} +25 -5
  7. package/dist/{chunk-XSMUJ77A.js → chunk-KJUD2BKE.js} +103 -69
  8. package/dist/{chunk-JPSXNDXP.mjs → chunk-ODVWOXVB.mjs} +1 -1
  9. package/dist/{chunk-VYMSCWXC.js → chunk-V5EYXVJT.js} +24 -24
  10. package/dist/{core-DU7gQKSk.d.mts → core-BDkhrEyf.d.mts} +4 -3
  11. package/dist/{core-CzElxZoF.d.ts → core-D_cz0tKa.d.ts} +4 -3
  12. package/dist/helper.d.mts +7 -5
  13. package/dist/helper.d.ts +7 -5
  14. package/dist/helper.js +8 -3
  15. package/dist/helper.mjs +10 -5
  16. package/dist/http/elysia/index.d.mts +4 -4
  17. package/dist/http/elysia/index.d.ts +4 -4
  18. package/dist/http/elysia/index.js +41 -44
  19. package/dist/http/elysia/index.mjs +7 -10
  20. package/dist/http/express/index.d.mts +4 -4
  21. package/dist/http/express/index.d.ts +4 -4
  22. package/dist/http/express/index.js +38 -41
  23. package/dist/http/express/index.mjs +7 -10
  24. package/dist/http/fastify/index.d.mts +4 -4
  25. package/dist/http/fastify/index.d.ts +4 -4
  26. package/dist/http/fastify/index.js +39 -42
  27. package/dist/http/fastify/index.mjs +7 -10
  28. package/dist/http/h3/index.d.mts +4 -4
  29. package/dist/http/h3/index.d.ts +4 -4
  30. package/dist/http/h3/index.js +39 -42
  31. package/dist/http/h3/index.mjs +7 -10
  32. package/dist/http/hono/index.d.mts +4 -4
  33. package/dist/http/hono/index.d.ts +4 -4
  34. package/dist/http/hono/index.js +35 -39
  35. package/dist/http/hono/index.mjs +3 -7
  36. package/dist/http/hyper-express/index.d.mts +4 -4
  37. package/dist/http/hyper-express/index.d.ts +4 -4
  38. package/dist/http/hyper-express/index.js +36 -39
  39. package/dist/http/hyper-express/index.mjs +6 -9
  40. package/dist/http/koa/index.d.mts +4 -4
  41. package/dist/http/koa/index.d.ts +4 -4
  42. package/dist/http/koa/index.js +38 -41
  43. package/dist/http/koa/index.mjs +7 -10
  44. package/dist/index.d.mts +35 -33
  45. package/dist/index.d.ts +35 -33
  46. package/dist/index.js +42 -43
  47. package/dist/index.mjs +15 -16
  48. package/dist/{meta-BTnLXuCa.d.ts → meta-BX5jhe4Z.d.mts} +3 -4
  49. package/dist/{meta-BTnLXuCa.d.mts → meta-BX5jhe4Z.d.ts} +3 -4
  50. package/dist/rpc/bullmq/index.d.mts +4 -4
  51. package/dist/rpc/bullmq/index.d.ts +4 -4
  52. package/dist/rpc/bullmq/index.js +14 -14
  53. package/dist/rpc/bullmq/index.mjs +3 -3
  54. package/dist/rpc/kafka/index.d.mts +4 -4
  55. package/dist/rpc/kafka/index.d.ts +4 -4
  56. package/dist/rpc/kafka/index.js +14 -14
  57. package/dist/rpc/kafka/index.mjs +2 -2
  58. package/dist/rpc/nats/index.d.mts +4 -4
  59. package/dist/rpc/nats/index.d.ts +4 -4
  60. package/dist/rpc/nats/index.js +13 -13
  61. package/dist/rpc/nats/index.mjs +3 -3
  62. package/dist/rpc/rabbitmq/index.d.mts +4 -4
  63. package/dist/rpc/rabbitmq/index.d.ts +4 -4
  64. package/dist/rpc/rabbitmq/index.js +15 -15
  65. package/dist/rpc/rabbitmq/index.mjs +3 -3
  66. package/dist/rpc/redis/index.d.mts +4 -4
  67. package/dist/rpc/redis/index.d.ts +4 -4
  68. package/dist/rpc/redis/index.js +13 -13
  69. package/dist/rpc/redis/index.mjs +3 -3
  70. package/dist/test.d.mts +3 -3
  71. package/dist/test.d.ts +3 -3
  72. package/dist/test.js +6 -6
  73. package/dist/test.mjs +2 -2
  74. package/dist/{types-CbfaGkPA.d.ts → types-B-rUM9Fm.d.mts} +3 -3
  75. package/dist/{types--E-OCZhC.d.ts → types-CMeuFoyd.d.ts} +3 -3
  76. package/dist/{types-BxlzVoRv.d.mts → types-DKVhyZk_.d.mts} +3 -3
  77. package/dist/{types-BYqBeqrs.d.mts → types-MxxtkZXw.d.ts} +3 -3
  78. package/package.json +3 -2
  79. package/register/index.mjs +20 -11
  80. package/register/loader.mjs +13 -28
@@ -3,11 +3,10 @@
3
3
 
4
4
 
5
5
 
6
+ var _chunkFX3LDQIIjs = require('../../chunk-FX3LDQII.js');
6
7
 
7
- var _chunkMENRZSGWjs = require('../../chunk-MENRZSGW.js');
8
8
 
9
-
10
- var _chunkM5HGFUCVjs = require('../../chunk-M5HGFUCV.js');
9
+ var _chunk5RBTN33Ajs = require('../../chunk-5RBTN33A.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 = _chunkMENRZSGWjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
19
+ const metaMap = _chunkFX3LDQIIjs.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
- _chunkMENRZSGWjs.detectAopDep.call(void 0, meta, {
26
+ _chunkFX3LDQIIjs.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
- _chunkMENRZSGWjs.Context.applyAddons(parallelAddons, subApp, "hono");
37
+ _chunkFX3LDQIIjs.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 _chunkMENRZSGWjs.Context.filterRecord.default(e);
41
+ const error = await _chunkFX3LDQIIjs.Context.filterRecord.default(e);
43
42
  c.status(error.status);
44
43
  return c.json(error);
45
44
  }
46
- _chunkM5HGFUCVjs.__name.call(void 0, errorHandler, "errorHandler");
47
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkMENRZSGWjs.BadRequestException)("data format should be an array"));
45
+ _chunk5RBTN33Ajs.__name.call(void 0, errorHandler, "errorHandler");
46
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkFX3LDQIIjs.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 _chunkMENRZSGWjs.Context.filterRecord.default(new (0, _chunkMENRZSGWjs.BadRequestException)(`module "${tag}" doesn't exist`)));
52
+ if (!metaMap.has(tag)) return resolve(await _chunkFX3LDQIIjs.Context.filterRecord.default(new (0, _chunkFX3LDQIIjs.BadRequestException)(`module "${tag}" doesn't exist`)));
54
53
  const meta2 = metaMap.get(tag)[func];
55
- if (!meta2) return resolve(await _chunkMENRZSGWjs.Context.filterRecord.default(new (0, _chunkMENRZSGWjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
56
- const { data: { params } } = meta2;
57
- const aop = _chunkMENRZSGWjs.Context.getAop(meta2, {
54
+ if (!meta2) return resolve(await _chunkFX3LDQIIjs.Context.filterRecord.default(new (0, _chunkFX3LDQIIjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
55
+ const aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
58
56
  globalFilter,
59
57
  globalGuards,
60
58
  globalPipe
@@ -67,22 +65,20 @@ function bind(router, data, opts = {}) {
67
65
  index: i,
68
66
  meta: meta2,
69
67
  moduleMap,
70
- tag,
71
- func,
72
68
  app: router,
73
- ..._chunkMENRZSGWjs.argToReq.call(void 0, params, item.args, c.req.header()),
74
- getCookie: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (key) => _cookie.getCookie.call(void 0, c, key), "getCookie"),
75
- delCookie: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (key) => _cookie.deleteCookie.call(void 0, c, key), "delCookie"),
76
- setCookie: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (key, value, opts2) => _cookie.setCookie.call(void 0, c, key, value, opts2), "setCookie"),
77
- redirect: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
78
- setResHeaders: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (headers) => {
69
+ ...item,
70
+ getCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => _cookie.getCookie.call(void 0, c, key), "getCookie"),
71
+ delCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => _cookie.deleteCookie.call(void 0, c, key), "delCookie"),
72
+ setCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key, value, opts2) => _cookie.setCookie.call(void 0, c, key, value, opts2), "setCookie"),
73
+ redirect: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
74
+ setResHeaders: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (headers) => {
79
75
  for (const name in headers) c.header(name, headers[name]);
80
76
  }, "setResHeaders"),
81
- setResStatus: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (status) => c.status(status), "setResStatus"),
82
- getRequest: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, () => c.req.raw, "getRequest"),
83
- getResponse: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, () => c.res, "getResponse")
77
+ setResStatus: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (status) => c.status(status), "setResStatus"),
78
+ getRequest: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => c.req.raw, "getRequest"),
79
+ getResponse: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => c.res, "getResponse")
84
80
  };
85
- const context = new (0, _chunkMENRZSGWjs.Context)(contextData);
81
+ const context = new (0, _chunkFX3LDQIIjs.Context)(contextData);
86
82
  context.run(aop, resolve, resolve);
87
83
  });
88
84
  })).then((ret) => {
@@ -102,14 +98,14 @@ function bind(router, data, opts = {}) {
102
98
  const needBody = params.some((item) => item.type === "body");
103
99
  let aop;
104
100
  if (!dynamic) {
105
- aop = _chunkMENRZSGWjs.Context.getAop(meta2, {
101
+ aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
106
102
  globalFilter,
107
103
  globalGuards,
108
104
  globalPipe
109
105
  });
110
106
  }
111
107
  const subApp = new (0, _hono.Hono)();
112
- _chunkMENRZSGWjs.Context.applyAddons(addons, subApp, "hono");
108
+ _chunkFX3LDQIIjs.Context.applyAddons(addons, subApp, "hono");
113
109
  subApp[http.type](http.route, async (c) => {
114
110
  debug(`invoke method "${func}" in module "${tag}"`);
115
111
  const contextData = {
@@ -125,23 +121,23 @@ function bind(router, data, opts = {}) {
125
121
  params: c.req.param(),
126
122
  headers: c.req.header(),
127
123
  app: router,
128
- getCookie: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (key) => _cookie.getCookie.call(void 0, c, key), "getCookie"),
129
- delCookie: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (key) => _cookie.deleteCookie.call(void 0, c, key), "delCookie"),
130
- setCookie: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (key, value, opts2) => _cookie.setCookie.call(void 0, c, key, value, opts2), "setCookie"),
131
- redirect: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
132
- setResHeaders: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (headers) => {
124
+ getCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => _cookie.getCookie.call(void 0, c, key), "getCookie"),
125
+ delCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => _cookie.deleteCookie.call(void 0, c, key), "delCookie"),
126
+ setCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key, value, opts2) => _cookie.setCookie.call(void 0, c, key, value, opts2), "setCookie"),
127
+ redirect: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
128
+ setResHeaders: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (headers) => {
133
129
  for (const name in headers) c.header(name, headers[name]);
134
130
  }, "setResHeaders"),
135
- setResStatus: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (status) => c.status(status), "setResStatus"),
136
- getRequest: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, () => c.req.raw, "getRequest"),
137
- getResponse: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, () => c.res, "getResponse")
131
+ setResStatus: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (status) => c.status(status), "setResStatus"),
132
+ getRequest: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => c.req.raw, "getRequest"),
133
+ getResponse: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => c.res, "getResponse")
138
134
  };
139
- const context = new (0, _chunkMENRZSGWjs.Context)(contextData);
135
+ const context = new (0, _chunkFX3LDQIIjs.Context)(contextData);
140
136
  if (http.headers) {
141
137
  for (const name in http.headers) c.header(name, http.headers[name]);
142
138
  }
143
139
  if (dynamic) {
144
- aop = _chunkMENRZSGWjs.Context.getAop(meta2, {
140
+ aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
145
141
  globalFilter,
146
142
  globalGuards,
147
143
  globalPipe
@@ -160,9 +156,9 @@ function bind(router, data, opts = {}) {
160
156
  }
161
157
  }
162
158
  }
163
- _chunkM5HGFUCVjs.__name.call(void 0, registerRoute, "registerRoute");
159
+ _chunk5RBTN33Ajs.__name.call(void 0, registerRoute, "registerRoute");
164
160
  }
165
- _chunkM5HGFUCVjs.__name.call(void 0, bind, "bind");
161
+ _chunk5RBTN33Ajs.__name.call(void 0, bind, "bind");
166
162
 
167
163
 
168
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-IRXNF6ZE.mjs";
6
+ } from "../../chunk-CVPZWDXU.mjs";
8
7
  import {
9
8
  __name
10
- } from "../../chunk-C5BVKEGW.mjs";
9
+ } from "../../chunk-FXTJ3BJ6.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,
@@ -67,10 +65,8 @@ function bind(router, data, opts = {}) {
67
65
  index: i,
68
66
  meta: meta2,
69
67
  moduleMap,
70
- tag,
71
- func,
72
68
  app: router,
73
- ...argToReq(params, item.args, c.req.header()),
69
+ ...item,
74
70
  getCookie: /* @__PURE__ */ __name((key) => getCookie(c, key), "getCookie"),
75
71
  delCookie: /* @__PURE__ */ __name((key) => deleteCookie(c, key), "delCookie"),
76
72
  setCookie: /* @__PURE__ */ __name((key, value, opts2) => setCookie(c, key, value, opts2), "setCookie"),
@@ -1,11 +1,11 @@
1
1
  import { Request, Response, Router, MiddlewareHandler } from 'hyper-express';
2
- import { H as HttpContext, a as HttpOptions } from '../../types-BxlzVoRv.mjs';
3
- import { F as Factory } from '../../core-DU7gQKSk.mjs';
2
+ import { H as HttpCtx, a as HttpOptions } from '../../types-DKVhyZk_.mjs';
3
+ import { F as Factory } from '../../core-BDkhrEyf.mjs';
4
4
  import 'node:http';
5
- import '../../meta-BTnLXuCa.mjs';
5
+ import '../../meta-BX5jhe4Z.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--E-OCZhC.js';
3
- import { F as Factory } from '../../core-CzElxZoF.js';
2
+ import { H as HttpCtx, a as HttpOptions } from '../../types-CMeuFoyd.js';
3
+ import { F as Factory } from '../../core-D_cz0tKa.js';
4
4
  import 'node:http';
5
- import '../../meta-BTnLXuCa.js';
5
+ import '../../meta-BX5jhe4Z.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 _chunkMENRZSGWjs = require('../../chunk-MENRZSGW.js');
7
+ var _chunkFX3LDQIIjs = require('../../chunk-FX3LDQII.js');
8
8
 
9
9
 
10
- var _chunkM5HGFUCVjs = require('../../chunk-M5HGFUCV.js');
10
+ var _chunk5RBTN33Ajs = require('../../chunk-5RBTN33A.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 = _chunkMENRZSGWjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
19
+ const metaMap = _chunkFX3LDQIIjs.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
- _chunkMENRZSGWjs.detectAopDep.call(void 0, meta, {
26
+ _chunkFX3LDQIIjs.detectAopDep.call(void 0, meta, {
27
27
  addons: [
28
28
  ...globalAddons,
29
29
  ...parallelAddons
@@ -32,27 +32,26 @@ function bind(router, data, opts = {}) {
32
32
  });
33
33
  registerRoute();
34
34
  async function registerRoute() {
35
- _chunkMENRZSGWjs.Context.applyAddons(globalAddons, router, "hyper-express");
35
+ _chunkFX3LDQIIjs.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 _chunkMENRZSGWjs.Context.filterRecord.default(e);
41
+ const error = await _chunkFX3LDQIIjs.Context.filterRecord.default(e);
42
42
  return res.status(error.status).json(error);
43
43
  }
44
- _chunkM5HGFUCVjs.__name.call(void 0, errorHandler, "errorHandler");
45
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkMENRZSGWjs.BadRequestException)("data format should be an array"));
44
+ _chunk5RBTN33Ajs.__name.call(void 0, errorHandler, "errorHandler");
45
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkFX3LDQIIjs.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 _chunkMENRZSGWjs.Context.filterRecord.default(new (0, _chunkMENRZSGWjs.BadRequestException)(`module "${tag}" doesn't exist`)));
51
+ if (!metaMap.has(tag)) return resolve(await _chunkFX3LDQIIjs.Context.filterRecord.default(new (0, _chunkFX3LDQIIjs.BadRequestException)(`module "${tag}" doesn't exist`)));
52
52
  const meta2 = metaMap.get(tag)[func];
53
- if (!meta2) return resolve(await _chunkMENRZSGWjs.Context.filterRecord.default(new (0, _chunkMENRZSGWjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
54
- const { data: { params } } = meta2;
55
- const aop = _chunkMENRZSGWjs.Context.getAop(meta2, {
53
+ if (!meta2) return resolve(await _chunkFX3LDQIIjs.Context.filterRecord.default(new (0, _chunkFX3LDQIIjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
54
+ const aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
56
55
  globalFilter,
57
56
  globalGuards,
58
57
  globalPipe
@@ -66,21 +65,19 @@ function bind(router, data, opts = {}) {
66
65
  meta: meta2,
67
66
  response: res,
68
67
  moduleMap,
69
- tag,
70
- func,
71
68
  app: router,
72
- ..._chunkMENRZSGWjs.argToReq.call(void 0, params, item.args, req.headers),
69
+ ...item,
73
70
  next,
74
- getCookie: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
75
- setCookie: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, _optionalChain([opts2, 'optionalAccess', _2 => _2.expires]) && opts2.expires.getTime() - Date.now(), opts2 || {}), "setCookie"),
76
- delCookie: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
77
- redirect: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (url) => res.redirect(url), "redirect"),
78
- setResHeaders: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
79
- setResStatus: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
80
- getRequest: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, () => req, "getRequest"),
81
- getResponse: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, () => res, "getResponse")
71
+ getCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
72
+ setCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__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__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
74
+ redirect: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (url) => res.redirect(url), "redirect"),
75
+ setResHeaders: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
76
+ setResStatus: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
77
+ getRequest: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => req, "getRequest"),
78
+ getResponse: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => res, "getResponse")
82
79
  };
83
- const context = new (0, _chunkMENRZSGWjs.Context)(contextData);
80
+ const context = new (0, _chunkFX3LDQIIjs.Context)(contextData);
84
81
  context.run(aop, resolve, resolve);
85
82
  });
86
83
  })).then((ret) => {
@@ -100,15 +97,15 @@ function bind(router, data, opts = {}) {
100
97
  const needBody = params.some((item) => item.type === "body");
101
98
  let aop;
102
99
  if (!dynamic) {
103
- aop = _chunkMENRZSGWjs.Context.getAop(meta2, {
100
+ aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
104
101
  globalFilter,
105
102
  globalGuards,
106
103
  globalPipe
107
104
  });
108
105
  }
109
106
  const subRouter = new (0, _hyperexpress.Router)();
110
- _chunkMENRZSGWjs.Context.applyAddons(addons, subRouter, "hyper-express");
111
- subRouter[http.type](http.prefix + http.route, async (req, res, next) => {
107
+ _chunkFX3LDQIIjs.Context.applyAddons(addons, subRouter, "hyper-express");
108
+ subRouter[http.type](_chunkFX3LDQIIjs.joinUrl.call(void 0, http.prefix, http.route), async (req, res, next) => {
112
109
  debug(`invoke method "${func}" in module "${tag}"`);
113
110
  const contextData = {
114
111
  type: "hyper-express",
@@ -125,21 +122,21 @@ function bind(router, data, opts = {}) {
125
122
  params: req.path_parameters,
126
123
  headers: req.headers,
127
124
  next,
128
- getCookie: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
129
- setCookie: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, _optionalChain([opts2, 'optionalAccess', _4 => _4.expires]) && opts2.expires.getTime() - Date.now(), opts2 || {}), "setCookie"),
130
- delCookie: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
131
- redirect: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (url) => res.redirect(url), "redirect"),
132
- setResHeaders: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
133
- setResStatus: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
134
- getRequest: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, () => req, "getRequest"),
135
- getResponse: /* @__PURE__ */ _chunkM5HGFUCVjs.__name.call(void 0, () => res, "getResponse")
125
+ getCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
126
+ setCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__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__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
128
+ redirect: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (url) => res.redirect(url), "redirect"),
129
+ setResHeaders: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
130
+ setResStatus: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
131
+ getRequest: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => req, "getRequest"),
132
+ getResponse: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => res, "getResponse")
136
133
  };
137
- const context = new (0, _chunkMENRZSGWjs.Context)(contextData);
134
+ const context = new (0, _chunkFX3LDQIIjs.Context)(contextData);
138
135
  if (http.headers) {
139
136
  for (const name in http.headers) res.set(name, http.headers[name]);
140
137
  }
141
138
  if (dynamic) {
142
- aop = _chunkMENRZSGWjs.Context.getAop(meta2, {
139
+ aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
143
140
  globalFilter,
144
141
  globalGuards,
145
142
  globalPipe
@@ -158,9 +155,9 @@ function bind(router, data, opts = {}) {
158
155
  }
159
156
  }
160
157
  }
161
- _chunkM5HGFUCVjs.__name.call(void 0, registerRoute, "registerRoute");
158
+ _chunk5RBTN33Ajs.__name.call(void 0, registerRoute, "registerRoute");
162
159
  }
163
- _chunkM5HGFUCVjs.__name.call(void 0, bind, "bind");
160
+ _chunk5RBTN33Ajs.__name.call(void 0, bind, "bind");
164
161
 
165
162
 
166
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-IRXNF6ZE.mjs";
5
+ detectAopDep,
6
+ joinUrl
7
+ } from "../../chunk-CVPZWDXU.mjs";
8
8
  import {
9
9
  __name
10
- } from "../../chunk-C5BVKEGW.mjs";
10
+ } from "../../chunk-FXTJ3BJ6.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,
@@ -66,10 +65,8 @@ function bind(router, data, opts = {}) {
66
65
  meta: meta2,
67
66
  response: res,
68
67
  moduleMap,
69
- tag,
70
- func,
71
68
  app: router,
72
- ...argToReq(params, item.args, req.headers),
69
+ ...item,
73
70
  next,
74
71
  getCookie: /* @__PURE__ */ __name((key) => req.cookies[key], "getCookie"),
75
72
  setCookie: /* @__PURE__ */ __name((key, value, opts2) => res.cookie(key, value, opts2?.expires && opts2.expires.getTime() - Date.now(), opts2 || {}), "setCookie"),
@@ -108,7 +105,7 @@ function bind(router, data, opts = {}) {
108
105
  }
109
106
  const subRouter = new Router();
110
107
  Context.applyAddons(addons, subRouter, "hyper-express");
111
- subRouter[http.type](http.prefix + http.route, async (req, res, next) => {
108
+ subRouter[http.type](joinUrl(http.prefix, http.route), async (req, res, next) => {
112
109
  debug(`invoke method "${func}" in module "${tag}"`);
113
110
  const contextData = {
114
111
  type: "hyper-express",
@@ -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-BxlzVoRv.mjs';
4
- import { F as Factory } from '../../core-DU7gQKSk.mjs';
3
+ import { H as HttpCtx, a as HttpOptions } from '../../types-DKVhyZk_.mjs';
4
+ import { F as Factory } from '../../core-BDkhrEyf.mjs';
5
5
  import 'node:http';
6
- import '../../meta-BTnLXuCa.mjs';
6
+ import '../../meta-BX5jhe4Z.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--E-OCZhC.js';
4
- import { F as Factory } from '../../core-CzElxZoF.js';
3
+ import { H as HttpCtx, a as HttpOptions } from '../../types-CMeuFoyd.js';
4
+ import { F as Factory } from '../../core-D_cz0tKa.js';
5
5
  import 'node:http';
6
- import '../../meta-BTnLXuCa.js';
6
+ import '../../meta-BX5jhe4Z.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;