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/elysia/bind.ts
17
16
  var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
@@ -20,14 +19,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/elysia");
20
19
  function bind(app, data, opts = {}) {
21
20
  const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
22
21
  const { moduleMap, meta } = data;
23
- const metaMap = _chunk7EMAZGYOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
+ const metaMap = _chunkFX3LDQIIjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
24
23
  const { controller, http, func, tag } = meta2.data;
25
24
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
26
25
  debug(`register method "${func}" in module "${tag}"`);
27
26
  return true;
28
27
  }
29
28
  });
30
- _chunk7EMAZGYOjs.detectAopDep.call(void 0, meta, {
29
+ _chunkFX3LDQIIjs.detectAopDep.call(void 0, meta, {
31
30
  addons: [
32
31
  ...globalAddons,
33
32
  ...parallelAddons
@@ -36,29 +35,28 @@ function bind(app, data, opts = {}) {
36
35
  });
37
36
  registerRoute();
38
37
  function registerRoute() {
39
- _chunk7EMAZGYOjs.Context.applyAddons(globalAddons, app, "elysia");
38
+ _chunkFX3LDQIIjs.Context.applyAddons(globalAddons, app, "elysia");
40
39
  if (parallelRoute) {
41
40
  const parallelRouter = new (0, _elysia.Elysia)();
42
- _chunk7EMAZGYOjs.Context.applyAddons(parallelAddons, app, "elysia");
41
+ _chunkFX3LDQIIjs.Context.applyAddons(parallelAddons, app, "elysia");
43
42
  parallelRouter.post(parallelRoute, async (c) => {
44
43
  const { body } = c;
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
  c.set.status = 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
  globalGuards,
63
61
  globalFilter,
64
62
  globalPipe
@@ -71,27 +69,25 @@ function bind(app, data, opts = {}) {
71
69
  index: i,
72
70
  meta: meta2,
73
71
  moduleMap,
74
- tag,
75
- func,
76
72
  app,
77
- ..._chunk7EMAZGYOjs.argToReq.call(void 0, params, item.args, c.headers),
78
- getCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
79
- setCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
73
+ ...item,
74
+ getCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
75
+ setCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
80
76
  ...opts2,
81
77
  value
82
78
  }), "setCookie"),
83
- delCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
84
- redirect: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
85
- setResHeaders: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
86
- setResStatus: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
87
- getRequest: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => {
79
+ delCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
80
+ redirect: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
81
+ setResHeaders: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
82
+ setResStatus: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
83
+ getRequest: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => {
88
84
  throw new Error("elysia can't support getRequest");
89
85
  }, "getRequest"),
90
- getResponse: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => {
86
+ getResponse: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => {
91
87
  throw new Error("elysia can't support getResponse");
92
88
  }, "getResponse")
93
89
  };
94
- const context = new (0, _chunk7EMAZGYOjs.Context)(contextData);
90
+ const context = new (0, _chunkFX3LDQIIjs.Context)(contextData);
95
91
  context.run(aop, resolve, resolve);
96
92
  });
97
93
  })).then((ret) => {
@@ -113,14 +109,14 @@ function bind(app, data, opts = {}) {
113
109
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
114
110
  let aop;
115
111
  if (!dynamic) {
116
- aop = _chunk7EMAZGYOjs.Context.getAop(meta2, {
112
+ aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
117
113
  globalFilter,
118
114
  globalGuards,
119
115
  globalPipe
120
116
  });
121
117
  }
122
- _chunk7EMAZGYOjs.Context.applyAddons(addons, subApp, "elysia");
123
- subApp[http.type](_chunk7EMAZGYOjs.joinUrl.call(void 0, http.prefix, http.route), async (c) => {
118
+ _chunkFX3LDQIIjs.Context.applyAddons(addons, subApp, "elysia");
119
+ subApp[http.type](_chunkFX3LDQIIjs.joinUrl.call(void 0, http.prefix, http.route), async (c) => {
124
120
  debug(`invoke method "${func}" in module "${tag}"`);
125
121
  const contextData = {
126
122
  type: "elysia",
@@ -135,33 +131,33 @@ function bind(app, data, opts = {}) {
135
131
  params: c.params,
136
132
  headers: c.headers,
137
133
  app,
138
- getCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
139
- setCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
134
+ getCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
135
+ setCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
140
136
  ...opts2,
141
137
  value
142
138
  }), "setCookie"),
143
- delCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
144
- redirect: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
145
- setResHeaders: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
146
- setResStatus: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
147
- getRequest: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => {
139
+ delCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
140
+ redirect: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
141
+ setResHeaders: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
142
+ setResStatus: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
143
+ getRequest: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => {
148
144
  throw new Error("elysia can't support getRequest");
149
145
  }, "getRequest"),
150
- getResponse: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => {
146
+ getResponse: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => {
151
147
  throw new Error("elysia can't support getResponse");
152
148
  }, "getResponse")
153
149
  };
154
150
  if (dynamic) {
155
- aop = _chunk7EMAZGYOjs.Context.getAop(meta2, {
151
+ aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
156
152
  globalFilter,
157
153
  globalGuards,
158
154
  globalPipe
159
155
  });
160
156
  }
161
- const context = new (0, _chunk7EMAZGYOjs.Context)(contextData);
157
+ const context = new (0, _chunkFX3LDQIIjs.Context)(contextData);
162
158
  if (http.headers) c.set.headers = http.headers;
163
159
  if (dynamic) {
164
- aop = _chunk7EMAZGYOjs.Context.getAop(meta2, {
160
+ aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
165
161
  globalFilter,
166
162
  globalGuards,
167
163
  globalPipe
@@ -176,13 +172,13 @@ function bind(app, data, opts = {}) {
176
172
  }
177
173
  }
178
174
  }
179
- _chunkVSGYTGHYjs.__name.call(void 0, registerRoute, "registerRoute");
175
+ _chunk5RBTN33Ajs.__name.call(void 0, registerRoute, "registerRoute");
180
176
  }
181
- _chunkVSGYTGHYjs.__name.call(void 0, bind, "bind");
177
+ _chunk5RBTN33Ajs.__name.call(void 0, bind, "bind");
182
178
  function Elysia(opts) {
183
- return _chunkBBNJVYVXjs.Define.call(void 0, "elysia", opts);
179
+ return _chunkV5EYXVJTjs.Define.call(void 0, "elysia", opts);
184
180
  }
185
- _chunkVSGYTGHYjs.__name.call(void 0, Elysia, "Elysia");
181
+ _chunk5RBTN33Ajs.__name.call(void 0, Elysia, "Elysia");
186
182
 
187
183
 
188
184
 
@@ -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/elysia/bind.ts
17
16
  import Debug from "debug";
@@ -57,7 +56,6 @@ function bind(app, 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
  globalGuards,
63
61
  globalFilter,
@@ -71,10 +69,8 @@ function bind(app, data, opts = {}) {
71
69
  index: i,
72
70
  meta: meta2,
73
71
  moduleMap,
74
- tag,
75
- func,
76
72
  app,
77
- ...argToReq(params, item.args, c.headers),
73
+ ...item,
78
74
  getCookie: /* @__PURE__ */ __name((key) => c.cookie[key].value, "getCookie"),
79
75
  setCookie: /* @__PURE__ */ __name((key, value, opts2 = {}) => c.cookie[key].set({
80
76
  ...opts2,
@@ -1,8 +1,8 @@
1
1
  import { Request, Response, Router, RequestHandler } from 'express';
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 ExpressCtx extends HttpCtx {
@@ -1,8 +1,8 @@
1
1
  import { Request, Response, Router, RequestHandler } from 'express';
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 ExpressCtx extends HttpCtx {
@@ -4,12 +4,11 @@
4
4
 
5
5
 
6
6
 
7
+ var _chunkFX3LDQIIjs = require('../../chunk-FX3LDQII.js');
7
8
 
8
9
 
9
- var _chunk7EMAZGYOjs = require('../../chunk-7EMAZGYO.js');
10
10
 
11
-
12
- var _chunkVSGYTGHYjs = require('../../chunk-VSGYTGHY.js');
11
+ var _chunk5RBTN33Ajs = require('../../chunk-5RBTN33A.js');
13
12
 
14
13
  // src/http/express/bind.ts
15
14
  var _express = require('express');
@@ -19,14 +18,14 @@ function bind(router, data, opts = {}) {
19
18
  const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
20
19
  const { moduleMap, meta } = data;
21
20
  const originStack = router.stack.slice(0, router.stack.length);
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', _ => _.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,33 +33,32 @@ function bind(router, data, opts = {}) {
34
33
  guards: globalGuards
35
34
  });
36
35
  registerRoute();
37
- _chunk7EMAZGYOjs.HMR.call(void 0, async () => {
36
+ _chunk5RBTN33Ajs.HMR.call(void 0, async () => {
38
37
  router.stack = originStack;
39
38
  registerRoute();
40
39
  });
41
40
  function registerRoute() {
42
- _chunk7EMAZGYOjs.Context.applyAddons(globalAddons, router, "express");
41
+ _chunkFX3LDQIIjs.Context.applyAddons(globalAddons, router, "express");
43
42
  if (parallelRoute) {
44
43
  const subRouter = _express.Router.call(void 0, );
45
- _chunk7EMAZGYOjs.Context.applyAddons(parallelAddons, subRouter, "express");
44
+ _chunkFX3LDQIIjs.Context.applyAddons(parallelAddons, subRouter, "express");
46
45
  subRouter.use(async (req, res, next) => {
47
46
  const { body } = req;
48
47
  async function errorHandler(e) {
49
- const error = await _chunk7EMAZGYOjs.Context.filterRecord.default(e);
48
+ const error = await _chunkFX3LDQIIjs.Context.filterRecord.default(e);
50
49
  return res.status(error.status).json(error);
51
50
  }
52
- _chunkVSGYTGHYjs.__name.call(void 0, errorHandler, "errorHandler");
53
- if (!Array.isArray(body)) return errorHandler(new (0, _chunk7EMAZGYOjs.BadRequestException)("data format should be an array"));
51
+ _chunk5RBTN33Ajs.__name.call(void 0, errorHandler, "errorHandler");
52
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkFX3LDQIIjs.BadRequestException)("data format should be an array"));
54
53
  try {
55
54
  return Promise.all(body.map((item, i) => {
56
55
  return new Promise(async (resolve) => {
57
56
  const { tag, func } = item;
58
57
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
59
- if (!metaMap.has(tag)) return resolve(await _chunk7EMAZGYOjs.Context.filterRecord.default(new (0, _chunk7EMAZGYOjs.BadRequestException)(`module "${tag}" doesn't exist`)));
58
+ if (!metaMap.has(tag)) return resolve(await _chunkFX3LDQIIjs.Context.filterRecord.default(new (0, _chunkFX3LDQIIjs.BadRequestException)(`module "${tag}" doesn't exist`)));
60
59
  const meta2 = metaMap.get(tag)[func];
61
- if (!meta2) return resolve(await _chunk7EMAZGYOjs.Context.filterRecord.default(new (0, _chunk7EMAZGYOjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
62
- const { data: { params } } = meta2;
63
- const aop = _chunk7EMAZGYOjs.Context.getAop(meta2, {
60
+ if (!meta2) return resolve(await _chunkFX3LDQIIjs.Context.filterRecord.default(new (0, _chunkFX3LDQIIjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
61
+ const aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
64
62
  globalFilter,
65
63
  globalGuards,
66
64
  globalPipe
@@ -74,23 +72,21 @@ function bind(router, data, opts = {}) {
74
72
  meta: meta2,
75
73
  response: res,
76
74
  moduleMap,
77
- tag,
78
- func,
79
75
  next,
80
76
  app: router,
81
- ..._chunk7EMAZGYOjs.argToReq.call(void 0, params, item.args, req.headers),
82
- getCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
83
- setCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
84
- delCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => res.cookie(key, "", {
77
+ ...item,
78
+ getCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
79
+ setCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
80
+ delCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => res.cookie(key, "", {
85
81
  expires: /* @__PURE__ */ new Date(0)
86
82
  }), "delCookie"),
87
- redirect: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (url, status) => status ? res.redirect(status, url) : res.redirect(url), "redirect"),
88
- setResHeaders: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
89
- setResStatus: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
90
- getRequest: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => req, "getRequest"),
91
- getResponse: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => res, "getResponse")
83
+ redirect: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (url, status) => status ? res.redirect(status, url) : res.redirect(url), "redirect"),
84
+ setResHeaders: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
85
+ setResStatus: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
86
+ getRequest: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => req, "getRequest"),
87
+ getResponse: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => res, "getResponse")
92
88
  };
93
- const context = new (0, _chunk7EMAZGYOjs.Context)(contextData);
89
+ const context = new (0, _chunkFX3LDQIIjs.Context)(contextData);
94
90
  context.run(aop, resolve, resolve);
95
91
  });
96
92
  })).then((ret) => {
@@ -109,15 +105,15 @@ function bind(router, data, opts = {}) {
109
105
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
110
106
  let aop;
111
107
  if (!dynamic) {
112
- aop = _chunk7EMAZGYOjs.Context.getAop(meta2, {
108
+ aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
113
109
  globalFilter,
114
110
  globalGuards,
115
111
  globalPipe
116
112
  });
117
113
  }
118
114
  const subRouter = _express.Router.call(void 0, );
119
- _chunk7EMAZGYOjs.Context.applyAddons(addons, subRouter, "express");
120
- subRouter[http.type](_chunk7EMAZGYOjs.joinUrl.call(void 0, http.prefix, http.route), async (req, res, next) => {
115
+ _chunkFX3LDQIIjs.Context.applyAddons(addons, subRouter, "express");
116
+ subRouter[http.type](_chunkFX3LDQIIjs.joinUrl.call(void 0, http.prefix, http.route), async (req, res, next) => {
121
117
  debug(`invoke method "${func}" in module "${tag}"`);
122
118
  const contextData = {
123
119
  type: "express",
@@ -134,21 +130,21 @@ function bind(router, data, opts = {}) {
134
130
  headers: req.headers,
135
131
  app: router,
136
132
  next,
137
- getCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
138
- setCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
139
- delCookie: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (key) => res.cookie(key, "", {
133
+ getCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
134
+ setCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
135
+ delCookie: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (key) => res.cookie(key, "", {
140
136
  expires: /* @__PURE__ */ new Date(0)
141
137
  }), "delCookie"),
142
- redirect: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (url, status) => status ? res.redirect(status, url) : res.redirect(url), "redirect"),
143
- setResHeaders: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
144
- setResStatus: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
145
- getRequest: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => req, "getRequest"),
146
- getResponse: /* @__PURE__ */ _chunkVSGYTGHYjs.__name.call(void 0, () => res, "getResponse")
138
+ redirect: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (url, status) => status ? res.redirect(status, url) : res.redirect(url), "redirect"),
139
+ setResHeaders: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
140
+ setResStatus: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
141
+ getRequest: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => req, "getRequest"),
142
+ getResponse: /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, () => res, "getResponse")
147
143
  };
148
- const context = new (0, _chunk7EMAZGYOjs.Context)(contextData);
144
+ const context = new (0, _chunkFX3LDQIIjs.Context)(contextData);
149
145
  if (http.headers) res.set(http.headers);
150
146
  if (dynamic) {
151
- aop = _chunk7EMAZGYOjs.Context.getAop(meta2, {
147
+ aop = _chunkFX3LDQIIjs.Context.getAop(meta2, {
152
148
  globalFilter,
153
149
  globalGuards,
154
150
  globalPipe
@@ -167,9 +163,9 @@ function bind(router, data, opts = {}) {
167
163
  }
168
164
  }
169
165
  }
170
- _chunkVSGYTGHYjs.__name.call(void 0, registerRoute, "registerRoute");
166
+ _chunk5RBTN33Ajs.__name.call(void 0, registerRoute, "registerRoute");
171
167
  }
172
- _chunkVSGYTGHYjs.__name.call(void 0, bind, "bind");
168
+ _chunk5RBTN33Ajs.__name.call(void 0, bind, "bind");
173
169
 
174
170
 
175
171
  exports.bind = bind;
@@ -1,15 +1,14 @@
1
1
  import {
2
2
  BadRequestException,
3
3
  Context,
4
- HMR,
5
- argToReq,
6
4
  createControllerMetaMap,
7
5
  detectAopDep,
8
6
  joinUrl
9
- } from "../../chunk-SGMQZRP6.mjs";
7
+ } from "../../chunk-CVPZWDXU.mjs";
10
8
  import {
9
+ HMR,
11
10
  __name
12
- } from "../../chunk-YKP4ODZA.mjs";
11
+ } from "../../chunk-FXTJ3BJ6.mjs";
13
12
 
14
13
  // src/http/express/bind.ts
15
14
  import { Router } from "express";
@@ -59,7 +58,6 @@ function bind(router, data, opts = {}) {
59
58
  if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
60
59
  const meta2 = metaMap.get(tag)[func];
61
60
  if (!meta2) return resolve(await Context.filterRecord.default(new BadRequestException(`"${func}" in "${tag}" doesn't exist`)));
62
- const { data: { params } } = meta2;
63
61
  const aop = Context.getAop(meta2, {
64
62
  globalFilter,
65
63
  globalGuards,
@@ -74,11 +72,9 @@ function bind(router, data, opts = {}) {
74
72
  meta: meta2,
75
73
  response: res,
76
74
  moduleMap,
77
- tag,
78
- func,
79
75
  next,
80
76
  app: router,
81
- ...argToReq(params, item.args, req.headers),
77
+ ...item,
82
78
  getCookie: /* @__PURE__ */ __name((key) => req.cookies[key], "getCookie"),
83
79
  setCookie: /* @__PURE__ */ __name((key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
84
80
  delCookie: /* @__PURE__ */ __name((key) => res.cookie(key, "", {
@@ -1,8 +1,8 @@
1
1
  import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback, FastifyRegisterOptions, FastifyPluginOptions, RouteShorthandOptions } from 'fastify';
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 FastifyCtx extends HttpCtx {
@@ -1,8 +1,8 @@
1
1
  import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback, FastifyRegisterOptions, FastifyPluginOptions, RouteShorthandOptions } from 'fastify';
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 FastifyCtx extends HttpCtx {