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

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