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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/{chunk-VSGYTGHY.js → chunk-5RBTN33A.js} +22 -2
  2. package/dist/{chunk-B45BN7LY.mjs → chunk-7ZGYJ5OW.mjs} +88 -54
  3. package/dist/{chunk-SGMQZRP6.mjs → chunk-CVPZWDXU.mjs} +2 -23
  4. package/dist/{chunk-7EMAZGYO.js → chunk-FX3LDQII.js} +59 -80
  5. package/dist/{chunk-YKP4ODZA.mjs → chunk-FXTJ3BJ6.mjs} +23 -3
  6. package/dist/{chunk-QJIAXSLZ.js → chunk-KJUD2BKE.js} +103 -69
  7. package/dist/{chunk-7NWDKK7D.mjs → chunk-ODVWOXVB.mjs} +1 -1
  8. package/dist/{chunk-BBNJVYVX.js → chunk-V5EYXVJT.js} +24 -24
  9. package/dist/{core-BcKywWLd.d.mts → core-BDkhrEyf.d.mts} +4 -3
  10. package/dist/{core-BGEsBtTG.d.ts → core-D_cz0tKa.d.ts} +4 -3
  11. package/dist/helper.d.mts +6 -5
  12. package/dist/helper.d.ts +6 -5
  13. package/dist/helper.js +6 -3
  14. package/dist/helper.mjs +8 -5
  15. package/dist/http/elysia/index.d.mts +3 -3
  16. package/dist/http/elysia/index.d.ts +3 -3
  17. package/dist/http/elysia/index.js +41 -45
  18. package/dist/http/elysia/index.mjs +4 -8
  19. package/dist/http/express/index.d.mts +3 -3
  20. package/dist/http/express/index.d.ts +3 -3
  21. package/dist/http/express/index.js +38 -42
  22. package/dist/http/express/index.mjs +4 -8
  23. package/dist/http/fastify/index.d.mts +3 -3
  24. package/dist/http/fastify/index.d.ts +3 -3
  25. package/dist/http/fastify/index.js +39 -43
  26. package/dist/http/fastify/index.mjs +4 -8
  27. package/dist/http/h3/index.d.mts +3 -3
  28. package/dist/http/h3/index.d.ts +3 -3
  29. package/dist/http/h3/index.js +39 -43
  30. package/dist/http/h3/index.mjs +3 -7
  31. package/dist/http/hono/index.d.mts +3 -3
  32. package/dist/http/hono/index.d.ts +3 -3
  33. package/dist/http/hono/index.js +35 -39
  34. package/dist/http/hono/index.mjs +3 -7
  35. package/dist/http/hyper-express/index.d.mts +3 -3
  36. package/dist/http/hyper-express/index.d.ts +3 -3
  37. package/dist/http/hyper-express/index.js +36 -40
  38. package/dist/http/hyper-express/index.mjs +3 -7
  39. package/dist/http/koa/index.d.mts +3 -3
  40. package/dist/http/koa/index.d.ts +3 -3
  41. package/dist/http/koa/index.js +38 -42
  42. package/dist/http/koa/index.mjs +4 -8
  43. package/dist/index.d.mts +8 -8
  44. package/dist/index.d.ts +8 -8
  45. package/dist/index.js +40 -42
  46. package/dist/index.mjs +4 -6
  47. package/dist/{meta-B_HW7cWh.d.mts → meta-BX5jhe4Z.d.mts} +1 -2
  48. package/dist/{meta-B_HW7cWh.d.ts → meta-BX5jhe4Z.d.ts} +1 -2
  49. package/dist/rpc/bullmq/index.d.mts +3 -3
  50. package/dist/rpc/bullmq/index.d.ts +3 -3
  51. package/dist/rpc/bullmq/index.js +14 -14
  52. package/dist/rpc/bullmq/index.mjs +3 -3
  53. package/dist/rpc/kafka/index.d.mts +3 -3
  54. package/dist/rpc/kafka/index.d.ts +3 -3
  55. package/dist/rpc/kafka/index.js +14 -14
  56. package/dist/rpc/kafka/index.mjs +2 -2
  57. package/dist/rpc/nats/index.d.mts +3 -3
  58. package/dist/rpc/nats/index.d.ts +3 -3
  59. package/dist/rpc/nats/index.js +13 -13
  60. package/dist/rpc/nats/index.mjs +3 -3
  61. package/dist/rpc/rabbitmq/index.d.mts +3 -3
  62. package/dist/rpc/rabbitmq/index.d.ts +3 -3
  63. package/dist/rpc/rabbitmq/index.js +15 -15
  64. package/dist/rpc/rabbitmq/index.mjs +3 -3
  65. package/dist/rpc/redis/index.d.mts +3 -3
  66. package/dist/rpc/redis/index.d.ts +3 -3
  67. package/dist/rpc/redis/index.js +13 -13
  68. package/dist/rpc/redis/index.mjs +3 -3
  69. package/dist/test.d.mts +3 -3
  70. package/dist/test.d.ts +3 -3
  71. package/dist/test.js +6 -6
  72. package/dist/test.mjs +2 -2
  73. package/dist/{types-DEQb_e59.d.mts → types-B-rUM9Fm.d.mts} +1 -1
  74. package/dist/{types-PFPIQWVF.d.ts → types-CMeuFoyd.d.ts} +1 -1
  75. package/dist/{types-C2SQ9U9V.d.mts → types-DKVhyZk_.d.mts} +1 -1
  76. package/dist/{types-CYF0vha6.d.ts → types-MxxtkZXw.d.ts} +1 -1
  77. package/package.json +1 -1
  78. package/register/index.mjs +20 -11
  79. package/register/loader.mjs +12 -27
@@ -1,17 +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 _chunkBBNJVYVXjs = require('../../chunk-BBNJVYVX.js');
3
+ var _chunkV5EYXVJTjs = require('../../chunk-V5EYXVJT.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
+ var _chunkFX3LDQIIjs = require('../../chunk-FX3LDQII.js');
10
11
 
11
- var _chunk7EMAZGYOjs = require('../../chunk-7EMAZGYO.js');
12
12
 
13
-
14
- var _chunkVSGYTGHYjs = require('../../chunk-VSGYTGHY.js');
13
+ var _chunk5RBTN33Ajs = require('../../chunk-5RBTN33A.js');
15
14
 
16
15
  // src/http/fastify/bind.ts
17
16
  var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
@@ -19,14 +18,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/fastify");
19
18
  function bind(fastify, data, opts = {}) {
20
19
  const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, fastifyOpts, dynamic = false } = opts;
21
20
  const { moduleMap, meta } = data;
22
- const metaMap = _chunk7EMAZGYOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
+ const metaMap = _chunkFX3LDQIIjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
23
22
  const { controller, http, func, tag } = meta2.data;
24
23
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _2 => _2.type])) {
25
24
  debug(`register method "${func}" in module "${tag}"`);
26
25
  return true;
27
26
  }
28
27
  });
29
- _chunk7EMAZGYOjs.detectAopDep.call(void 0, meta, {
28
+ _chunkFX3LDQIIjs.detectAopDep.call(void 0, meta, {
30
29
  addons: [
31
30
  ...globalAddons,
32
31
  ...parallelAddons
@@ -34,28 +33,27 @@ function bind(fastify, data, opts = {}) {
34
33
  guards: globalGuards
35
34
  });
36
35
  fastify.register(async (fastify2, _, done) => {
37
- _chunk7EMAZGYOjs.Context.applyAddons(globalAddons, fastify2, "fastify");
36
+ _chunkFX3LDQIIjs.Context.applyAddons(globalAddons, fastify2, "fastify");
38
37
  if (parallelRoute) {
39
38
  fastify2.register(async (fastify3, _opts, done2) => {
40
- _chunk7EMAZGYOjs.Context.applyAddons(parallelAddons, fastify3, "fastify");
39
+ _chunkFX3LDQIIjs.Context.applyAddons(parallelAddons, fastify3, "fastify");
41
40
  fastify3.post(parallelRoute, async (req, res) => {
42
41
  const { body } = req;
43
42
  async function errorHandler(e) {
44
- const error = await _chunk7EMAZGYOjs.Context.filterRecord.default(e);
43
+ const error = await _chunkFX3LDQIIjs.Context.filterRecord.default(e);
45
44
  return res.status(error.status).send(error);
46
45
  }
47
- _chunkVSGYTGHYjs.__name.call(void 0, errorHandler, "errorHandler");
48
- if (!Array.isArray(body)) return errorHandler(new (0, _chunk7EMAZGYOjs.BadRequestException)("data format should be an array"));
46
+ _chunk5RBTN33Ajs.__name.call(void 0, errorHandler, "errorHandler");
47
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkFX3LDQIIjs.BadRequestException)("data format should be an array"));
49
48
  try {
50
49
  return Promise.all(body.map((item, i) => {
51
50
  return new Promise(async (resolve) => {
52
51
  const { tag, func } = item;
53
52
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
54
- if (!metaMap.has(tag)) return resolve(await _chunk7EMAZGYOjs.Context.filterRecord.default(new (0, _chunk7EMAZGYOjs.BadRequestException)(`module "${tag}" doesn't exist`)));
53
+ if (!metaMap.has(tag)) return resolve(await _chunkFX3LDQIIjs.Context.filterRecord.default(new (0, _chunkFX3LDQIIjs.BadRequestException)(`module "${tag}" doesn't exist`)));
55
54
  const meta2 = metaMap.get(tag)[func];
56
- if (!meta2) return resolve(await _chunk7EMAZGYOjs.Context.filterRecord.default(new (0, _chunk7EMAZGYOjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
57
- const { data: { params } } = meta2;
58
- const aop = _chunk7EMAZGYOjs.Context.getAop(meta2, {
55
+ if (!meta2) return resolve(await _chunkFX3LDQIIjs.Context.filterRecord.default(new (0, _chunkFX3LDQIIjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
56
+ const aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
59
57
  globalFilter,
60
58
  globalGuards,
61
59
  globalPipe
@@ -69,23 +67,21 @@ function bind(fastify, data, opts = {}) {
69
67
  meta: meta2,
70
68
  response: res,
71
69
  moduleMap,
72
- tag,
73
- func,
74
70
  app: fastify3,
75
- ..._chunk7EMAZGYOjs.argToReq.call(void 0, params, item.args, req.headers),
71
+ ...item,
76
72
  // @ts-expect-error need @fastify/cookie
77
- getCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
73
+ getCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
78
74
  // @ts-expect-error need @fastify/cookie
79
- setCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key, value, opts2) => res.setCookie(key, value, opts2), "setCookie"),
75
+ setCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key, value, opts2) => res.setCookie(key, value, opts2), "setCookie"),
80
76
  // @ts-expect-error need @fastify/cookie
81
- delCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
82
- redirect: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (url, status) => res.redirect(url, status), "redirect"),
83
- setResHeaders: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (headers) => res.headers(headers), "setResHeaders"),
84
- setResStatus: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
85
- getRequest: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => req.raw, "getRequest"),
86
- getResponse: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => res.raw, "getResponse")
77
+ delCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
78
+ redirect: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (url, status) => res.redirect(url, status), "redirect"),
79
+ setResHeaders: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (headers) => res.headers(headers), "setResHeaders"),
80
+ setResStatus: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
81
+ getRequest: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => req.raw, "getRequest"),
82
+ getResponse: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => res.raw, "getResponse")
87
83
  };
88
- const context = new (0, _chunk7EMAZGYOjs.Context)(contextData);
84
+ const context = new (0, _chunkFX3LDQIIjs.Context)(contextData);
89
85
  context.run(aop, resolve, resolve);
90
86
  });
91
87
  })).then((ret) => {
@@ -104,16 +100,16 @@ function bind(fastify, data, opts = {}) {
104
100
  const { data: { addons, define, http } } = meta2;
105
101
  if (!_optionalChain([http, 'optionalAccess', _3 => _3.type])) continue;
106
102
  fastify2.register(async (fastify3, _opts, done2) => {
107
- _chunk7EMAZGYOjs.Context.applyAddons(addons, fastify3, "fastify");
103
+ _chunkFX3LDQIIjs.Context.applyAddons(addons, fastify3, "fastify");
108
104
  let aop;
109
105
  if (!dynamic) {
110
- aop = _chunk7EMAZGYOjs.Context.getAop(meta2, {
106
+ aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
111
107
  globalFilter,
112
108
  globalGuards,
113
109
  globalPipe
114
110
  });
115
111
  }
116
- fastify3[http.type](_chunk7EMAZGYOjs.joinUrl.call(void 0, http.prefix, http.route), _optionalChain([define, 'optionalAccess', _4 => _4.fastify]) || {}, async (req, res) => {
112
+ fastify3[http.type](_chunkFX3LDQIIjs.joinUrl.call(void 0, http.prefix, http.route), _optionalChain([define, 'optionalAccess', _4 => _4.fastify]) || {}, async (req, res) => {
117
113
  debug(`invoke method "${func}" in module "${tag}"`);
118
114
  const contextData = {
119
115
  type: "fastify",
@@ -130,23 +126,23 @@ function bind(fastify, data, opts = {}) {
130
126
  headers: req.headers,
131
127
  app: fastify3,
132
128
  // @ts-expect-error need @fastify/cookie
133
- getCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
129
+ getCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
134
130
  // @ts-expect-error need @fastify/cookie
135
- setCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key, value, opts2) => res.setCookie(key, value, opts2), "setCookie"),
131
+ setCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key, value, opts2) => res.setCookie(key, value, opts2), "setCookie"),
136
132
  // @ts-expect-error need @fastify/cookie
137
- delCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => res.clearCookie(key, {
133
+ delCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => res.clearCookie(key, {
138
134
  url: ""
139
135
  }), "delCookie"),
140
- redirect: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (url, status) => res.redirect(url, status), "redirect"),
141
- setResHeaders: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (headers) => res.headers(headers), "setResHeaders"),
142
- setResStatus: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
143
- getRequest: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => req.raw, "getRequest"),
144
- getResponse: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => res.raw, "getResponse")
136
+ redirect: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (url, status) => res.redirect(url, status), "redirect"),
137
+ setResHeaders: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (headers) => res.headers(headers), "setResHeaders"),
138
+ setResStatus: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
139
+ getRequest: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => req.raw, "getRequest"),
140
+ getResponse: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => res.raw, "getResponse")
145
141
  };
146
- const context = new (0, _chunk7EMAZGYOjs.Context)(contextData);
142
+ const context = new (0, _chunkFX3LDQIIjs.Context)(contextData);
147
143
  if (http.headers) res.headers(http.headers);
148
144
  if (dynamic) {
149
- aop = _chunk7EMAZGYOjs.Context.getAop(meta2, {
145
+ aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
150
146
  globalFilter,
151
147
  globalGuards,
152
148
  globalPipe
@@ -167,11 +163,11 @@ function bind(fastify, data, opts = {}) {
167
163
  done();
168
164
  }, fastifyOpts);
169
165
  }
170
- _chunkVSGYTGHYjs.__name.call(void 0, bind, "bind");
166
+ _chunk5RBTN33Ajs.__name.call(void 0, bind, "bind");
171
167
  function Fastify(opts) {
172
- return _chunkBBNJVYVXjs.Define.call(void 0, "fastify", opts);
168
+ return _chunkV5EYXVJTjs.Define.call(void 0, "fastify", opts);
173
169
  }
174
- _chunkVSGYTGHYjs.__name.call(void 0, Fastify, "Fastify");
170
+ _chunk5RBTN33Ajs.__name.call(void 0, Fastify, "Fastify");
175
171
 
176
172
 
177
173
 
@@ -1,17 +1,16 @@
1
1
  import {
2
2
  Define
3
- } from "../../chunk-7NWDKK7D.mjs";
3
+ } from "../../chunk-ODVWOXVB.mjs";
4
4
  import {
5
5
  BadRequestException,
6
6
  Context,
7
- argToReq,
8
7
  createControllerMetaMap,
9
8
  detectAopDep,
10
9
  joinUrl
11
- } from "../../chunk-SGMQZRP6.mjs";
10
+ } from "../../chunk-CVPZWDXU.mjs";
12
11
  import {
13
12
  __name
14
- } from "../../chunk-YKP4ODZA.mjs";
13
+ } from "../../chunk-FXTJ3BJ6.mjs";
15
14
 
16
15
  // src/http/fastify/bind.ts
17
16
  import Debug from "debug";
@@ -54,7 +53,6 @@ function bind(fastify, data, opts = {}) {
54
53
  if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
55
54
  const meta2 = metaMap.get(tag)[func];
56
55
  if (!meta2) return resolve(await Context.filterRecord.default(new BadRequestException(`"${func}" in "${tag}" doesn't exist`)));
57
- const { data: { params } } = meta2;
58
56
  const aop = Context.getAop(meta2, {
59
57
  globalFilter,
60
58
  globalGuards,
@@ -69,10 +67,8 @@ function bind(fastify, data, opts = {}) {
69
67
  meta: meta2,
70
68
  response: res,
71
69
  moduleMap,
72
- tag,
73
- func,
74
70
  app: fastify3,
75
- ...argToReq(params, item.args, req.headers),
71
+ ...item,
76
72
  // @ts-expect-error need @fastify/cookie
77
73
  getCookie: /* @__PURE__ */ __name((key) => req.cookies[key], "getCookie"),
78
74
  // @ts-expect-error need @fastify/cookie
@@ -1,8 +1,8 @@
1
1
  import { H3Event, Router, _RequestMiddleware } from 'h3';
2
- import { F as Factory } from '../../core-BcKywWLd.mjs';
3
- import { H as HttpCtx, a as HttpOptions } from '../../types-C2SQ9U9V.mjs';
2
+ import { F as Factory } from '../../core-BDkhrEyf.mjs';
3
+ import { H as HttpCtx, a as HttpOptions } from '../../types-DKVhyZk_.mjs';
4
4
  import 'phecda-core';
5
- import '../../meta-B_HW7cWh.mjs';
5
+ import '../../meta-BX5jhe4Z.mjs';
6
6
  import 'node:http';
7
7
 
8
8
  interface H3Ctx extends HttpCtx {
@@ -1,8 +1,8 @@
1
1
  import { H3Event, Router, _RequestMiddleware } from 'h3';
2
- import { F as Factory } from '../../core-BGEsBtTG.js';
3
- import { H as HttpCtx, a as HttpOptions } from '../../types-PFPIQWVF.js';
2
+ import { F as Factory } from '../../core-D_cz0tKa.js';
3
+ import { H as HttpCtx, a as HttpOptions } from '../../types-CMeuFoyd.js';
4
4
  import 'phecda-core';
5
- import '../../meta-B_HW7cWh.js';
5
+ import '../../meta-BX5jhe4Z.js';
6
6
  import 'node:http';
7
7
 
8
8
  interface H3Ctx extends HttpCtx {
@@ -4,11 +4,10 @@
4
4
 
5
5
 
6
6
 
7
+ var _chunkFX3LDQIIjs = require('../../chunk-FX3LDQII.js');
7
8
 
8
- var _chunk7EMAZGYOjs = require('../../chunk-7EMAZGYO.js');
9
9
 
10
-
11
- var _chunkVSGYTGHYjs = require('../../chunk-VSGYTGHY.js');
10
+ var _chunk5RBTN33Ajs = require('../../chunk-5RBTN33A.js');
12
11
 
13
12
  // src/http/h3/bind.ts
14
13
  var _h3 = require('h3');
@@ -17,14 +16,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/h3");
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 = _chunk7EMAZGYOjs.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
- _chunk7EMAZGYOjs.detectAopDep.call(void 0, meta, {
26
+ _chunkFX3LDQIIjs.detectAopDep.call(void 0, meta, {
28
27
  addons: [
29
28
  ...globalAddons,
30
29
  ...parallelAddons
@@ -33,32 +32,31 @@ function bind(router, data, opts = {}) {
33
32
  });
34
33
  registerRoute();
35
34
  function registerRoute() {
36
- _chunk7EMAZGYOjs.Context.applyAddons(globalAddons, router, "h3");
35
+ _chunkFX3LDQIIjs.Context.applyAddons(globalAddons, router, "h3");
37
36
  if (parallelRoute) {
38
37
  const subRouter = _h3.createRouter.call(void 0, );
39
- _chunk7EMAZGYOjs.Context.applyAddons(parallelAddons, subRouter, "h3");
38
+ _chunkFX3LDQIIjs.Context.applyAddons(parallelAddons, subRouter, "h3");
40
39
  subRouter.post(parallelRoute, _h3.eventHandler.call(void 0, {
41
- handler: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, async (event) => {
40
+ handler: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, async (event) => {
42
41
  const body = await _h3.readBody.call(void 0, event, {
43
42
  strict: true
44
43
  });
45
44
  async function errorHandler(e) {
46
- const error = await _chunk7EMAZGYOjs.Context.filterRecord.default(e);
45
+ const error = await _chunkFX3LDQIIjs.Context.filterRecord.default(e);
47
46
  _h3.setResponseStatus.call(void 0, event, error.status);
48
47
  return error;
49
48
  }
50
- _chunkVSGYTGHYjs.__name.call(void 0, errorHandler, "errorHandler");
51
- if (!Array.isArray(body)) return errorHandler(new (0, _chunk7EMAZGYOjs.BadRequestException)("data format should be an array"));
49
+ _chunk5RBTN33Ajs.__name.call(void 0, errorHandler, "errorHandler");
50
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkFX3LDQIIjs.BadRequestException)("data format should be an array"));
52
51
  try {
53
52
  return Promise.all(body.map((item, i) => {
54
53
  return new Promise(async (resolve) => {
55
54
  const { tag, func } = item;
56
55
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
57
- if (!metaMap.has(tag)) return resolve(await _chunk7EMAZGYOjs.Context.filterRecord.default(new (0, _chunk7EMAZGYOjs.BadRequestException)(`module "${tag}" doesn't exist`)));
56
+ if (!metaMap.has(tag)) return resolve(await _chunkFX3LDQIIjs.Context.filterRecord.default(new (0, _chunkFX3LDQIIjs.BadRequestException)(`module "${tag}" doesn't exist`)));
58
57
  const meta2 = metaMap.get(tag)[func];
59
- if (!meta2) return resolve(await _chunk7EMAZGYOjs.Context.filterRecord.default(new (0, _chunk7EMAZGYOjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
60
- const { data: { params } } = meta2;
61
- const aop = _chunk7EMAZGYOjs.Context.getAop(meta2, {
58
+ if (!meta2) return resolve(await _chunkFX3LDQIIjs.Context.filterRecord.default(new (0, _chunkFX3LDQIIjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
59
+ const aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
62
60
  globalFilter,
63
61
  globalGuards,
64
62
  globalPipe
@@ -70,21 +68,19 @@ function bind(router, data, opts = {}) {
70
68
  event,
71
69
  meta: meta2,
72
70
  moduleMap,
73
- tag,
74
- func,
75
71
  parallel: true,
76
72
  app: router,
77
- ..._chunk7EMAZGYOjs.argToReq.call(void 0, params, item.args, _h3.getRequestHeaders.call(void 0, event)),
78
- getCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => _h3.getCookie.call(void 0, event, key), "getCookie"),
79
- setCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key, value, opts2) => _h3.setCookie.call(void 0, event, key, value, opts2), "setCookie"),
80
- delCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => _h3.deleteCookie.call(void 0, event, key), "delCookie"),
81
- redirect: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (url, status) => _h3.sendRedirect.call(void 0, event, url, status), "redirect"),
82
- setResHeaders: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (headers) => _h3.setResponseHeaders.call(void 0, event, headers), "setResHeaders"),
83
- setResStatus: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (code) => _h3.setResponseStatus.call(void 0, event, code), "setResStatus"),
84
- getRequest: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => event.node.req, "getRequest"),
85
- getResponse: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => event.node.res, "getResponse")
73
+ ...item,
74
+ getCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => _h3.getCookie.call(void 0, event, key), "getCookie"),
75
+ setCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key, value, opts2) => _h3.setCookie.call(void 0, event, key, value, opts2), "setCookie"),
76
+ delCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => _h3.deleteCookie.call(void 0, event, key), "delCookie"),
77
+ redirect: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (url, status) => _h3.sendRedirect.call(void 0, event, url, status), "redirect"),
78
+ setResHeaders: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (headers) => _h3.setResponseHeaders.call(void 0, event, headers), "setResHeaders"),
79
+ setResStatus: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (code) => _h3.setResponseStatus.call(void 0, event, code), "setResStatus"),
80
+ getRequest: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => event.node.req, "getRequest"),
81
+ getResponse: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => event.node.res, "getResponse")
86
82
  };
87
- const context = new (0, _chunk7EMAZGYOjs.Context)(contextData);
83
+ const context = new (0, _chunkFX3LDQIIjs.Context)(contextData);
88
84
  context.run(aop, resolve, resolve);
89
85
  });
90
86
  }));
@@ -103,15 +99,15 @@ function bind(router, data, opts = {}) {
103
99
  const needBody = params.some((item) => item.type === "body");
104
100
  let aop;
105
101
  if (!dynamic) {
106
- aop = _chunk7EMAZGYOjs.Context.getAop(meta2, {
102
+ aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
107
103
  globalFilter,
108
104
  globalGuards,
109
105
  globalPipe
110
106
  });
111
107
  }
112
108
  const subRouter = _h3.createRouter.call(void 0, );
113
- _chunk7EMAZGYOjs.Context.applyAddons(addons, subRouter, "h3");
114
- subRouter[http.type](_chunk7EMAZGYOjs.joinUrl.call(void 0, http.prefix, http.route), _h3.defineEventHandler.call(void 0, async (event) => {
109
+ _chunkFX3LDQIIjs.Context.applyAddons(addons, subRouter, "h3");
110
+ subRouter[http.type](_chunkFX3LDQIIjs.joinUrl.call(void 0, http.prefix, http.route), _h3.defineEventHandler.call(void 0, async (event) => {
115
111
  debug(`invoke method "${func}" in module "${tag}"`);
116
112
  const contextData = {
117
113
  type: "h3",
@@ -128,19 +124,19 @@ function bind(router, data, opts = {}) {
128
124
  body: needBody ? await _h3.readBody.call(void 0, event, {
129
125
  strict: true
130
126
  }) : void 0,
131
- getCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => _h3.getCookie.call(void 0, event, key), "getCookie"),
132
- setCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key, value, opts2) => _h3.setCookie.call(void 0, event, key, value, opts2), "setCookie"),
133
- redirect: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (url) => _h3.sendRedirect.call(void 0, event, url), "redirect"),
134
- setResHeaders: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (headers) => _h3.setResponseHeaders.call(void 0, event, headers), "setResHeaders"),
135
- setResStatus: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (code) => _h3.setResponseStatus.call(void 0, event, code), "setResStatus"),
136
- delCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => _h3.deleteCookie.call(void 0, event, key), "delCookie"),
137
- getRequest: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => event.node.req, "getRequest"),
138
- getResponse: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => event.node.res, "getResponse")
127
+ getCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => _h3.getCookie.call(void 0, event, key), "getCookie"),
128
+ setCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key, value, opts2) => _h3.setCookie.call(void 0, event, key, value, opts2), "setCookie"),
129
+ redirect: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (url) => _h3.sendRedirect.call(void 0, event, url), "redirect"),
130
+ setResHeaders: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (headers) => _h3.setResponseHeaders.call(void 0, event, headers), "setResHeaders"),
131
+ setResStatus: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (code) => _h3.setResponseStatus.call(void 0, event, code), "setResStatus"),
132
+ delCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => _h3.deleteCookie.call(void 0, event, key), "delCookie"),
133
+ getRequest: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => event.node.req, "getRequest"),
134
+ getResponse: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => event.node.res, "getResponse")
139
135
  };
140
- const context = new (0, _chunk7EMAZGYOjs.Context)(contextData);
136
+ const context = new (0, _chunkFX3LDQIIjs.Context)(contextData);
141
137
  _h3.setHeaders.call(void 0, event, http.headers || {});
142
138
  if (dynamic) {
143
- aop = _chunk7EMAZGYOjs.Context.getAop(meta2, {
139
+ aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
144
140
  globalFilter,
145
141
  globalGuards,
146
142
  globalPipe
@@ -151,13 +147,13 @@ function bind(router, data, opts = {}) {
151
147
  return err;
152
148
  });
153
149
  }));
154
- router.use(_chunk7EMAZGYOjs.joinUrl.call(void 0, http.prefix, http.route), _h3.useBase.call(void 0, "", subRouter.handler));
150
+ router.use(_chunkFX3LDQIIjs.joinUrl.call(void 0, http.prefix, http.route), _h3.useBase.call(void 0, "", subRouter.handler));
155
151
  }
156
152
  }
157
153
  }
158
- _chunkVSGYTGHYjs.__name.call(void 0, registerRoute, "registerRoute");
154
+ _chunk5RBTN33Ajs.__name.call(void 0, registerRoute, "registerRoute");
159
155
  }
160
- _chunkVSGYTGHYjs.__name.call(void 0, bind, "bind");
156
+ _chunk5RBTN33Ajs.__name.call(void 0, bind, "bind");
161
157
 
162
158
 
163
159
  exports.bind = bind;
@@ -1,14 +1,13 @@
1
1
  import {
2
2
  BadRequestException,
3
3
  Context,
4
- argToReq,
5
4
  createControllerMetaMap,
6
5
  detectAopDep,
7
6
  joinUrl
8
- } from "../../chunk-SGMQZRP6.mjs";
7
+ } from "../../chunk-CVPZWDXU.mjs";
9
8
  import {
10
9
  __name
11
- } from "../../chunk-YKP4ODZA.mjs";
10
+ } from "../../chunk-FXTJ3BJ6.mjs";
12
11
 
13
12
  // src/http/h3/bind.ts
14
13
  import { createRouter, defineEventHandler, deleteCookie, eventHandler, getCookie, getQuery, getRequestHeaders, getRouterParams, readBody, sendRedirect, setCookie, setHeaders, setResponseHeaders, setResponseStatus, useBase } from "h3";
@@ -57,7 +56,6 @@ function bind(router, data, opts = {}) {
57
56
  if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
58
57
  const meta2 = metaMap.get(tag)[func];
59
58
  if (!meta2) return resolve(await Context.filterRecord.default(new BadRequestException(`"${func}" in "${tag}" doesn't exist`)));
60
- const { data: { params } } = meta2;
61
59
  const aop = Context.getAop(meta2, {
62
60
  globalFilter,
63
61
  globalGuards,
@@ -70,11 +68,9 @@ function bind(router, data, opts = {}) {
70
68
  event,
71
69
  meta: meta2,
72
70
  moduleMap,
73
- tag,
74
- func,
75
71
  parallel: true,
76
72
  app: router,
77
- ...argToReq(params, item.args, getRequestHeaders(event)),
73
+ ...item,
78
74
  getCookie: /* @__PURE__ */ __name((key) => getCookie(event, key), "getCookie"),
79
75
  setCookie: /* @__PURE__ */ __name((key, value, opts2) => setCookie(event, key, value, opts2), "setCookie"),
80
76
  delCookie: /* @__PURE__ */ __name((key) => deleteCookie(event, key), "delCookie"),
@@ -1,8 +1,8 @@
1
1
  import { Context, Hono, MiddlewareHandler } from 'hono';
2
- import { H as HttpCtx, a as HttpOptions } from '../../types-C2SQ9U9V.mjs';
3
- import { F as Factory } from '../../core-BcKywWLd.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-B_HW7cWh.mjs';
5
+ import '../../meta-BX5jhe4Z.mjs';
6
6
  import 'phecda-core';
7
7
 
8
8
  interface HonoCtx extends HttpCtx {
@@ -1,8 +1,8 @@
1
1
  import { Context, Hono, MiddlewareHandler } from 'hono';
2
- import { H as HttpCtx, a as HttpOptions } from '../../types-PFPIQWVF.js';
3
- import { F as Factory } from '../../core-BGEsBtTG.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-B_HW7cWh.js';
5
+ import '../../meta-BX5jhe4Z.js';
6
6
  import 'phecda-core';
7
7
 
8
8
  interface HonoCtx extends HttpCtx {