phecda-server 7.0.0-alpha.1 → 7.0.0-alpha.2

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 (71) hide show
  1. package/bin/cli.mjs +7 -7
  2. package/dist/{chunk-V7EI76QQ.mjs → chunk-3FHZB3Z5.mjs} +1 -1
  3. package/dist/{chunk-GSPBHZBH.js → chunk-NQIFUZL4.js} +1 -1
  4. package/dist/{core-CYwEPfN4.d.ts → core-C1kHRqU9.d.ts} +1 -1
  5. package/dist/{core-BIcUwV18.d.mts → core-CSiaRU7r.d.mts} +1 -1
  6. package/dist/helper.d.mts +1 -1
  7. package/dist/helper.d.ts +1 -1
  8. package/dist/helper.js +2 -2
  9. package/dist/helper.mjs +1 -1
  10. package/dist/http/elysia/index.d.mts +3 -3
  11. package/dist/http/elysia/index.d.ts +3 -3
  12. package/dist/http/elysia/index.js +19 -17
  13. package/dist/http/elysia/index.mjs +3 -1
  14. package/dist/http/express/index.d.mts +3 -3
  15. package/dist/http/express/index.d.ts +3 -3
  16. package/dist/http/express/index.js +19 -17
  17. package/dist/http/express/index.mjs +3 -1
  18. package/dist/http/fastify/index.d.mts +3 -3
  19. package/dist/http/fastify/index.d.ts +3 -3
  20. package/dist/http/fastify/index.js +18 -16
  21. package/dist/http/fastify/index.mjs +3 -1
  22. package/dist/http/h3/index.d.mts +3 -3
  23. package/dist/http/h3/index.d.ts +3 -3
  24. package/dist/http/h3/index.js +18 -16
  25. package/dist/http/h3/index.mjs +3 -1
  26. package/dist/http/hono/index.d.mts +3 -3
  27. package/dist/http/hono/index.d.ts +3 -3
  28. package/dist/http/hono/index.js +17 -15
  29. package/dist/http/hono/index.mjs +3 -1
  30. package/dist/http/hyper-express/index.d.mts +3 -3
  31. package/dist/http/hyper-express/index.d.ts +3 -3
  32. package/dist/http/hyper-express/index.js +17 -15
  33. package/dist/http/hyper-express/index.mjs +3 -1
  34. package/dist/http/koa/index.d.mts +3 -3
  35. package/dist/http/koa/index.d.ts +3 -3
  36. package/dist/http/koa/index.js +19 -17
  37. package/dist/http/koa/index.mjs +3 -1
  38. package/dist/index.d.mts +8 -8
  39. package/dist/index.d.ts +8 -8
  40. package/dist/index.js +19 -19
  41. package/dist/index.mjs +2 -2
  42. package/dist/{meta-BXKLFTgG.d.mts → meta-D1M85Hef.d.mts} +1 -0
  43. package/dist/{meta-BXKLFTgG.d.ts → meta-D1M85Hef.d.ts} +1 -0
  44. package/dist/rpc/bullmq/index.d.mts +3 -3
  45. package/dist/rpc/bullmq/index.d.ts +3 -3
  46. package/dist/rpc/bullmq/index.js +9 -8
  47. package/dist/rpc/bullmq/index.mjs +2 -1
  48. package/dist/rpc/kafka/index.d.mts +3 -3
  49. package/dist/rpc/kafka/index.d.ts +3 -3
  50. package/dist/rpc/kafka/index.js +8 -7
  51. package/dist/rpc/kafka/index.mjs +2 -1
  52. package/dist/rpc/nats/index.d.mts +3 -3
  53. package/dist/rpc/nats/index.d.ts +3 -3
  54. package/dist/rpc/nats/index.js +8 -7
  55. package/dist/rpc/nats/index.mjs +2 -1
  56. package/dist/rpc/rabbitmq/index.d.mts +3 -3
  57. package/dist/rpc/rabbitmq/index.d.ts +3 -3
  58. package/dist/rpc/rabbitmq/index.js +9 -8
  59. package/dist/rpc/rabbitmq/index.mjs +2 -1
  60. package/dist/rpc/redis/index.d.mts +3 -3
  61. package/dist/rpc/redis/index.d.ts +3 -3
  62. package/dist/rpc/redis/index.js +9 -8
  63. package/dist/rpc/redis/index.mjs +2 -1
  64. package/dist/test.d.mts +3 -3
  65. package/dist/test.d.ts +3 -3
  66. package/dist/{types-BtbL49Zs.d.mts → types-C9Remkup.d.ts} +2 -1
  67. package/dist/{types-m3IEDKjP.d.ts → types-JMhFVp-Z.d.mts} +2 -1
  68. package/dist/{types-VFzEM7LL.d.ts → types-ee1FBodH.d.ts} +2 -1
  69. package/dist/{types-h40T3cRG.d.mts → types-wbHHC93P.d.mts} +2 -1
  70. package/package.json +1 -1
  71. package/register/loader.mjs +1 -1
package/bin/cli.mjs CHANGED
@@ -3,7 +3,7 @@ import { fork } from 'child_process'
3
3
  import { createRequire } from 'module'
4
4
  import { fileURLToPath } from 'url'
5
5
 
6
- import { dirname, join, resolve } from 'path'
6
+ import { dirname, resolve } from 'path'
7
7
  import pc from 'picocolors'
8
8
  import cac from 'cac'
9
9
  import fse from 'fs-extra'
@@ -85,11 +85,11 @@ cli
85
85
  default: 'tsconfig.json',
86
86
  })
87
87
  .action(async (root, options) => {
88
- if (!root)
89
- root = ''
88
+ if (root)
89
+ process.chdir(root)
90
90
 
91
- const tsconfigPath = join(root, options.tsconfig)
92
- const psconfigPath = join(root, options.config)
91
+ const tsconfigPath = options.tsconfig
92
+ const psconfigPath = options.config
93
93
 
94
94
  if (!fse.existsSync(tsconfigPath)) {
95
95
  log(`create ${tsconfigPath}`)
@@ -116,7 +116,7 @@ cli
116
116
  .alias('run')
117
117
  .action((file, root, options) => {
118
118
  if (root)
119
- process.env.PS_WORKDIR = root
119
+ process.chdir(root)
120
120
  process.env.PS_CONFIG_FILE = options.config
121
121
 
122
122
  log('process start!')
@@ -154,7 +154,7 @@ cli
154
154
  .allowUnknownOptions()
155
155
  .action((file, root, options) => {
156
156
  if (root)
157
- process.env.PS_WORKDIR = root
157
+ process.chdir(root)
158
158
  process.env.PS_GENERATE = 'true'
159
159
  process.env.PS_CONFIG_FILE = options.config
160
160
  startChild(file, options['--'])
@@ -442,7 +442,7 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
442
442
  });
443
443
  meta.forEach(({ data }) => {
444
444
  if (data.controller !== controller) {
445
- if (data[controller]) warningSet.add(`Should use ${controller} controller to decorate class "${data.name}" or method "${data.func}"`);
445
+ if (data[controller]) warningSet.add(`Should use ${controller} controller to decorate class "${data.name}"`);
446
446
  return;
447
447
  }
448
448
  if (data.filter) filterSet.add(data.filter);
@@ -442,7 +442,7 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
442
442
  })]);
443
443
  meta.forEach(({ data }) => {
444
444
  if (data.controller !== controller) {
445
- if (data[controller]) warningSet.add(`Should use ${controller} controller to decorate class "${data.name}" or method "${data.func}"`);
445
+ if (data[controller]) warningSet.add(`Should use ${controller} controller to decorate class "${data.name}"`);
446
446
  return;
447
447
  }
448
448
  if (data.filter) filterSet.add(data.filter);
@@ -1,5 +1,5 @@
1
1
  import { Construct } from 'phecda-core';
2
- import { b as MetaData, M as Meta, E as Emitter } from './meta-BXKLFTgG.js';
2
+ import { b as MetaData, M as Meta, E as Emitter } from './meta-D1M85Hef.js';
3
3
 
4
4
  declare abstract class Generator {
5
5
  private _path;
@@ -1,5 +1,5 @@
1
1
  import { Construct } from 'phecda-core';
2
- import { b as MetaData, M as Meta, E as Emitter } from './meta-BXKLFTgG.mjs';
2
+ import { b as MetaData, M as Meta, E as Emitter } from './meta-D1M85Hef.mjs';
3
3
 
4
4
  declare abstract class Generator {
5
5
  private _path;
package/dist/helper.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as ControllerMetaData, M as Meta, a as ControllerMeta } from './meta-BXKLFTgG.mjs';
1
+ import { C as ControllerMetaData, M as Meta, a as ControllerMeta } from './meta-D1M85Hef.mjs';
2
2
  import 'phecda-core';
3
3
 
4
4
  declare function HMR(cb: (...args: any) => any): void;
package/dist/helper.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as ControllerMetaData, M as Meta, a as ControllerMeta } from './meta-BXKLFTgG.js';
1
+ import { C as ControllerMetaData, M as Meta, a as ControllerMeta } from './meta-D1M85Hef.js';
2
2
  import 'phecda-core';
3
3
 
4
4
  declare function HMR(cb: (...args: any) => any): void;
package/dist/helper.js CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkGSPBHZBHjs = require('./chunk-GSPBHZBH.js');
10
+ var _chunkNQIFUZL4js = require('./chunk-NQIFUZL4.js');
11
11
  require('./chunk-J5CFUN4V.js');
12
12
 
13
13
 
@@ -18,4 +18,4 @@ require('./chunk-J5CFUN4V.js');
18
18
 
19
19
 
20
20
 
21
- exports.HMR = _chunkGSPBHZBHjs.HMR; exports.argToReq = _chunkGSPBHZBHjs.argToReq; exports.createControllerMetaMap = _chunkGSPBHZBHjs.createControllerMetaMap; exports.detectAopDep = _chunkGSPBHZBHjs.detectAopDep; exports.genClientQueue = _chunkGSPBHZBHjs.genClientQueue; exports.mergeObject = _chunkGSPBHZBHjs.mergeObject; exports.resolveDep = _chunkGSPBHZBHjs.resolveDep; exports.shallowClone = _chunkGSPBHZBHjs.shallowClone;
21
+ exports.HMR = _chunkNQIFUZL4js.HMR; exports.argToReq = _chunkNQIFUZL4js.argToReq; exports.createControllerMetaMap = _chunkNQIFUZL4js.createControllerMetaMap; exports.detectAopDep = _chunkNQIFUZL4js.detectAopDep; exports.genClientQueue = _chunkNQIFUZL4js.genClientQueue; exports.mergeObject = _chunkNQIFUZL4js.mergeObject; exports.resolveDep = _chunkNQIFUZL4js.resolveDep; exports.shallowClone = _chunkNQIFUZL4js.shallowClone;
package/dist/helper.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  mergeObject,
8
8
  resolveDep,
9
9
  shallowClone
10
- } from "./chunk-V7EI76QQ.mjs";
10
+ } from "./chunk-3FHZB3Z5.mjs";
11
11
  import "./chunk-WHJ5FALK.mjs";
12
12
  export {
13
13
  HMR,
@@ -1,9 +1,9 @@
1
1
  import { Elysia as Elysia$1, Context, LocalHook, InputSchema, RouteSchema, SingletonBase } from 'elysia';
2
2
  import { BaseMacro } from 'elysia/dist/types';
3
- import { H as HttpContext, a as HttpOptions } from '../../types-h40T3cRG.mjs';
4
- import { F as Factory } from '../../core-BIcUwV18.mjs';
3
+ import { H as HttpContext, a as HttpOptions } from '../../types-wbHHC93P.mjs';
4
+ import { F as Factory } from '../../core-CSiaRU7r.mjs';
5
5
  import 'node:http';
6
- import '../../meta-BXKLFTgG.mjs';
6
+ import '../../meta-D1M85Hef.mjs';
7
7
  import 'phecda-core';
8
8
 
9
9
  interface ElysiaCtx extends HttpContext {
@@ -1,9 +1,9 @@
1
1
  import { Elysia as Elysia$1, Context, LocalHook, InputSchema, RouteSchema, SingletonBase } from 'elysia';
2
2
  import { BaseMacro } from 'elysia/dist/types';
3
- import { H as HttpContext, a as HttpOptions } from '../../types-VFzEM7LL.js';
4
- import { F as Factory } from '../../core-CYwEPfN4.js';
3
+ import { H as HttpContext, a as HttpOptions } from '../../types-ee1FBodH.js';
4
+ import { F as Factory } from '../../core-C1kHRqU9.js';
5
5
  import 'node:http';
6
- import '../../meta-BXKLFTgG.js';
6
+ import '../../meta-D1M85Hef.js';
7
7
  import 'phecda-core';
8
8
 
9
9
  interface ElysiaCtx extends HttpContext {
@@ -7,7 +7,7 @@ var _chunkMBCHNDAYjs = require('../../chunk-MBCHNDAY.js');
7
7
 
8
8
 
9
9
 
10
- var _chunkGSPBHZBHjs = require('../../chunk-GSPBHZBH.js');
10
+ var _chunkNQIFUZL4js = require('../../chunk-NQIFUZL4.js');
11
11
 
12
12
 
13
13
  var _chunkJ5CFUN4Vjs = require('../../chunk-J5CFUN4V.js');
@@ -19,14 +19,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/elysia");
19
19
  function bind(app, data, opts = {}) {
20
20
  const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
21
21
  const { moduleMap, meta } = data;
22
- const metaMap = _chunkGSPBHZBHjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
+ const metaMap = _chunkNQIFUZL4js.createControllerMetaMap.call(void 0, meta, (meta2) => {
23
23
  const { controller, http, func, tag } = meta2.data;
24
24
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
25
25
  debug(`register method "${func}" in module "${tag}"`);
26
26
  return true;
27
27
  }
28
28
  });
29
- _chunkGSPBHZBHjs.detectAopDep.call(void 0, meta, {
29
+ _chunkNQIFUZL4js.detectAopDep.call(void 0, meta, {
30
30
  addons: [
31
31
  ...globalAddons,
32
32
  ...parallelAddons
@@ -35,35 +35,36 @@ function bind(app, data, opts = {}) {
35
35
  });
36
36
  registerRoute();
37
37
  function registerRoute() {
38
- _chunkGSPBHZBHjs.Context.applyAddons(globalAddons, app, "elysia");
38
+ _chunkNQIFUZL4js.Context.applyAddons(globalAddons, app, "elysia");
39
39
  if (parallelRoute) {
40
40
  const parallelRouter = new (0, _elysia.Elysia)();
41
- _chunkGSPBHZBHjs.Context.applyAddons(parallelAddons, app, "elysia");
41
+ _chunkNQIFUZL4js.Context.applyAddons(parallelAddons, app, "elysia");
42
42
  parallelRouter.post(parallelRoute, async (c) => {
43
43
  const { body } = c;
44
44
  async function errorHandler(e) {
45
- const error = await _chunkGSPBHZBHjs.Context.filterRecord.default(e);
45
+ const error = await _chunkNQIFUZL4js.Context.filterRecord.default(e);
46
46
  c.set.status = error.status;
47
47
  return error;
48
48
  }
49
49
  _chunkJ5CFUN4Vjs.__name.call(void 0, errorHandler, "errorHandler");
50
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkGSPBHZBHjs.BadRequestException)("data format should be an array"));
50
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkNQIFUZL4js.BadRequestException)("data format should be an array"));
51
51
  try {
52
52
  return Promise.all(body.map((item, i) => {
53
53
  return new Promise(async (resolve) => {
54
54
  const { tag, func } = item;
55
55
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
56
- if (!metaMap.has(tag)) return resolve(await _chunkGSPBHZBHjs.Context.filterRecord.default(new (0, _chunkGSPBHZBHjs.BadRequestException)(`module "${tag}" doesn't exist`)));
56
+ if (!metaMap.has(tag)) return resolve(await _chunkNQIFUZL4js.Context.filterRecord.default(new (0, _chunkNQIFUZL4js.BadRequestException)(`module "${tag}" doesn't exist`)));
57
57
  const meta2 = metaMap.get(tag)[func];
58
- if (!meta2) return resolve(await _chunkGSPBHZBHjs.Context.filterRecord.default(new (0, _chunkGSPBHZBHjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
58
+ if (!meta2) return resolve(await _chunkNQIFUZL4js.Context.filterRecord.default(new (0, _chunkNQIFUZL4js.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
59
59
  const { data: { params } } = meta2;
60
- const aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
60
+ const aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
61
61
  globalGuards,
62
62
  globalFilter,
63
63
  globalPipe
64
64
  });
65
65
  const contextData = {
66
66
  type: "elysia",
67
+ category: "http",
67
68
  parallel: true,
68
69
  context: c,
69
70
  index: i,
@@ -72,7 +73,7 @@ function bind(app, data, opts = {}) {
72
73
  tag,
73
74
  func,
74
75
  app,
75
- ..._chunkGSPBHZBHjs.argToReq.call(void 0, params, item.args, c.headers),
76
+ ..._chunkNQIFUZL4js.argToReq.call(void 0, params, item.args, c.headers),
76
77
  getCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
77
78
  setCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
78
79
  ...opts2,
@@ -89,7 +90,7 @@ function bind(app, data, opts = {}) {
89
90
  throw new Error("elysia can't support getResponse");
90
91
  }, "getResponse")
91
92
  };
92
- const context = new (0, _chunkGSPBHZBHjs.Context)(contextData);
93
+ const context = new (0, _chunkNQIFUZL4js.Context)(contextData);
93
94
  context.run(aop, resolve, resolve);
94
95
  });
95
96
  })).then((ret) => {
@@ -111,17 +112,18 @@ function bind(app, data, opts = {}) {
111
112
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
112
113
  let aop;
113
114
  if (!dynamic) {
114
- aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
115
+ aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
115
116
  globalFilter,
116
117
  globalGuards,
117
118
  globalPipe
118
119
  });
119
120
  }
120
- _chunkGSPBHZBHjs.Context.applyAddons(addons, subApp, "elysia");
121
+ _chunkNQIFUZL4js.Context.applyAddons(addons, subApp, "elysia");
121
122
  subApp[http.type](http.prefix + http.route, async (c) => {
122
123
  debug(`invoke method "${func}" in module "${tag}"`);
123
124
  const contextData = {
124
125
  type: "elysia",
126
+ category: "http",
125
127
  context: c,
126
128
  meta: meta2,
127
129
  moduleMap,
@@ -149,16 +151,16 @@ function bind(app, data, opts = {}) {
149
151
  }, "getResponse")
150
152
  };
151
153
  if (dynamic) {
152
- aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
154
+ aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
153
155
  globalFilter,
154
156
  globalGuards,
155
157
  globalPipe
156
158
  });
157
159
  }
158
- const context = new (0, _chunkGSPBHZBHjs.Context)(contextData);
160
+ const context = new (0, _chunkNQIFUZL4js.Context)(contextData);
159
161
  if (http.headers) c.set.headers = http.headers;
160
162
  if (dynamic) {
161
- aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
163
+ aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
162
164
  globalFilter,
163
165
  globalGuards,
164
166
  globalPipe
@@ -7,7 +7,7 @@ import {
7
7
  argToReq,
8
8
  createControllerMetaMap,
9
9
  detectAopDep
10
- } from "../../chunk-V7EI76QQ.mjs";
10
+ } from "../../chunk-3FHZB3Z5.mjs";
11
11
  import {
12
12
  __name
13
13
  } from "../../chunk-WHJ5FALK.mjs";
@@ -64,6 +64,7 @@ function bind(app, data, opts = {}) {
64
64
  });
65
65
  const contextData = {
66
66
  type: "elysia",
67
+ category: "http",
67
68
  parallel: true,
68
69
  context: c,
69
70
  index: i,
@@ -122,6 +123,7 @@ function bind(app, data, opts = {}) {
122
123
  debug(`invoke method "${func}" in module "${tag}"`);
123
124
  const contextData = {
124
125
  type: "elysia",
126
+ category: "http",
125
127
  context: c,
126
128
  meta: meta2,
127
129
  moduleMap,
@@ -1,8 +1,8 @@
1
1
  import { Request, Response, Router, RequestHandler } from 'express';
2
- import { H as HttpContext, a as HttpOptions } from '../../types-h40T3cRG.mjs';
3
- import { F as Factory } from '../../core-BIcUwV18.mjs';
2
+ import { H as HttpContext, a as HttpOptions } from '../../types-wbHHC93P.mjs';
3
+ import { F as Factory } from '../../core-CSiaRU7r.mjs';
4
4
  import 'node:http';
5
- import '../../meta-BXKLFTgG.mjs';
5
+ import '../../meta-D1M85Hef.mjs';
6
6
  import 'phecda-core';
7
7
 
8
8
  interface ExpressCtx extends HttpContext {
@@ -1,8 +1,8 @@
1
1
  import { Request, Response, Router, RequestHandler } from 'express';
2
- import { H as HttpContext, a as HttpOptions } from '../../types-VFzEM7LL.js';
3
- import { F as Factory } from '../../core-CYwEPfN4.js';
2
+ import { H as HttpContext, a as HttpOptions } from '../../types-ee1FBodH.js';
3
+ import { F as Factory } from '../../core-C1kHRqU9.js';
4
4
  import 'node:http';
5
- import '../../meta-BXKLFTgG.js';
5
+ import '../../meta-D1M85Hef.js';
6
6
  import 'phecda-core';
7
7
 
8
8
  interface ExpressCtx extends HttpContext {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkGSPBHZBHjs = require('../../chunk-GSPBHZBH.js');
8
+ var _chunkNQIFUZL4js = require('../../chunk-NQIFUZL4.js');
9
9
 
10
10
 
11
11
  var _chunkJ5CFUN4Vjs = require('../../chunk-J5CFUN4V.js');
@@ -18,14 +18,14 @@ function bind(router, data, opts = {}) {
18
18
  const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
19
19
  const { moduleMap, meta } = data;
20
20
  const originStack = router.stack.slice(0, router.stack.length);
21
- const metaMap = _chunkGSPBHZBHjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
+ const metaMap = _chunkNQIFUZL4js.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
22
  const { controller, http, func, tag } = meta2.data;
23
23
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
24
24
  debug(`register method "${func}" in module "${tag}"`);
25
25
  return true;
26
26
  }
27
27
  });
28
- _chunkGSPBHZBHjs.detectAopDep.call(void 0, meta, {
28
+ _chunkNQIFUZL4js.detectAopDep.call(void 0, meta, {
29
29
  addons: [
30
30
  ...globalAddons,
31
31
  ...parallelAddons
@@ -33,39 +33,40 @@ function bind(router, data, opts = {}) {
33
33
  guards: globalGuards
34
34
  });
35
35
  registerRoute();
36
- _chunkGSPBHZBHjs.HMR.call(void 0, async () => {
36
+ _chunkNQIFUZL4js.HMR.call(void 0, async () => {
37
37
  router.stack = originStack;
38
38
  registerRoute();
39
39
  });
40
40
  function registerRoute() {
41
- _chunkGSPBHZBHjs.Context.applyAddons(globalAddons, router, "express");
41
+ _chunkNQIFUZL4js.Context.applyAddons(globalAddons, router, "express");
42
42
  if (parallelRoute) {
43
43
  const subRouter = _express.Router.call(void 0, );
44
- _chunkGSPBHZBHjs.Context.applyAddons(parallelAddons, subRouter, "express");
44
+ _chunkNQIFUZL4js.Context.applyAddons(parallelAddons, subRouter, "express");
45
45
  subRouter.use(async (req, res, next) => {
46
46
  const { body } = req;
47
47
  async function errorHandler(e) {
48
- const error = await _chunkGSPBHZBHjs.Context.filterRecord.default(e);
48
+ const error = await _chunkNQIFUZL4js.Context.filterRecord.default(e);
49
49
  return res.status(error.status).json(error);
50
50
  }
51
51
  _chunkJ5CFUN4Vjs.__name.call(void 0, errorHandler, "errorHandler");
52
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkGSPBHZBHjs.BadRequestException)("data format should be an array"));
52
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkNQIFUZL4js.BadRequestException)("data format should be an array"));
53
53
  try {
54
54
  return Promise.all(body.map((item, i) => {
55
55
  return new Promise(async (resolve) => {
56
56
  const { tag, func } = item;
57
57
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
58
- if (!metaMap.has(tag)) return resolve(await _chunkGSPBHZBHjs.Context.filterRecord.default(new (0, _chunkGSPBHZBHjs.BadRequestException)(`module "${tag}" doesn't exist`)));
58
+ if (!metaMap.has(tag)) return resolve(await _chunkNQIFUZL4js.Context.filterRecord.default(new (0, _chunkNQIFUZL4js.BadRequestException)(`module "${tag}" doesn't exist`)));
59
59
  const meta2 = metaMap.get(tag)[func];
60
- if (!meta2) return resolve(await _chunkGSPBHZBHjs.Context.filterRecord.default(new (0, _chunkGSPBHZBHjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
60
+ if (!meta2) return resolve(await _chunkNQIFUZL4js.Context.filterRecord.default(new (0, _chunkNQIFUZL4js.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
61
61
  const { data: { params } } = meta2;
62
- const aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
62
+ const aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
63
63
  globalFilter,
64
64
  globalGuards,
65
65
  globalPipe
66
66
  });
67
67
  const contextData = {
68
68
  type: "express",
69
+ category: "http",
69
70
  parallel: true,
70
71
  request: req,
71
72
  index: i,
@@ -76,7 +77,7 @@ function bind(router, data, opts = {}) {
76
77
  func,
77
78
  next,
78
79
  app: router,
79
- ..._chunkGSPBHZBHjs.argToReq.call(void 0, params, item.args, req.headers),
80
+ ..._chunkNQIFUZL4js.argToReq.call(void 0, params, item.args, req.headers),
80
81
  getCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
81
82
  setCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
82
83
  delCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => res.cookie(key, "", {
@@ -88,7 +89,7 @@ function bind(router, data, opts = {}) {
88
89
  getRequest: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => req, "getRequest"),
89
90
  getResponse: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => res, "getResponse")
90
91
  };
91
- const context = new (0, _chunkGSPBHZBHjs.Context)(contextData);
92
+ const context = new (0, _chunkNQIFUZL4js.Context)(contextData);
92
93
  context.run(aop, resolve, resolve);
93
94
  });
94
95
  })).then((ret) => {
@@ -107,18 +108,19 @@ function bind(router, data, opts = {}) {
107
108
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
108
109
  let aop;
109
110
  if (!dynamic) {
110
- aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
111
+ aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
111
112
  globalFilter,
112
113
  globalGuards,
113
114
  globalPipe
114
115
  });
115
116
  }
116
117
  const subRouter = _express.Router.call(void 0, );
117
- _chunkGSPBHZBHjs.Context.applyAddons(addons, subRouter, "express");
118
+ _chunkNQIFUZL4js.Context.applyAddons(addons, subRouter, "express");
118
119
  subRouter[http.type](http.prefix + http.route, async (req, res, next) => {
119
120
  debug(`invoke method "${func}" in module "${tag}"`);
120
121
  const contextData = {
121
122
  type: "express",
123
+ category: "http",
122
124
  request: req,
123
125
  meta: meta2,
124
126
  response: res,
@@ -142,10 +144,10 @@ function bind(router, data, opts = {}) {
142
144
  getRequest: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => req, "getRequest"),
143
145
  getResponse: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => res, "getResponse")
144
146
  };
145
- const context = new (0, _chunkGSPBHZBHjs.Context)(contextData);
147
+ const context = new (0, _chunkNQIFUZL4js.Context)(contextData);
146
148
  if (http.headers) res.set(http.headers);
147
149
  if (dynamic) {
148
- aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
150
+ aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
149
151
  globalFilter,
150
152
  globalGuards,
151
153
  globalPipe
@@ -5,7 +5,7 @@ import {
5
5
  argToReq,
6
6
  createControllerMetaMap,
7
7
  detectAopDep
8
- } from "../../chunk-V7EI76QQ.mjs";
8
+ } from "../../chunk-3FHZB3Z5.mjs";
9
9
  import {
10
10
  __name
11
11
  } from "../../chunk-WHJ5FALK.mjs";
@@ -66,6 +66,7 @@ function bind(router, data, opts = {}) {
66
66
  });
67
67
  const contextData = {
68
68
  type: "express",
69
+ category: "http",
69
70
  parallel: true,
70
71
  request: req,
71
72
  index: i,
@@ -119,6 +120,7 @@ function bind(router, data, opts = {}) {
119
120
  debug(`invoke method "${func}" in module "${tag}"`);
120
121
  const contextData = {
121
122
  type: "express",
123
+ category: "http",
122
124
  request: req,
123
125
  meta: meta2,
124
126
  response: res,
@@ -1,8 +1,8 @@
1
1
  import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback, FastifyRegisterOptions, FastifyPluginOptions, RouteShorthandOptions } from 'fastify';
2
- import { H as HttpContext, a as HttpOptions } from '../../types-h40T3cRG.mjs';
3
- import { F as Factory } from '../../core-BIcUwV18.mjs';
2
+ import { H as HttpContext, a as HttpOptions } from '../../types-wbHHC93P.mjs';
3
+ import { F as Factory } from '../../core-CSiaRU7r.mjs';
4
4
  import 'node:http';
5
- import '../../meta-BXKLFTgG.mjs';
5
+ import '../../meta-D1M85Hef.mjs';
6
6
  import 'phecda-core';
7
7
 
8
8
  interface FastifyCtx extends HttpContext {
@@ -1,8 +1,8 @@
1
1
  import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback, FastifyRegisterOptions, FastifyPluginOptions, RouteShorthandOptions } from 'fastify';
2
- import { H as HttpContext, a as HttpOptions } from '../../types-VFzEM7LL.js';
3
- import { F as Factory } from '../../core-CYwEPfN4.js';
2
+ import { H as HttpContext, a as HttpOptions } from '../../types-ee1FBodH.js';
3
+ import { F as Factory } from '../../core-C1kHRqU9.js';
4
4
  import 'node:http';
5
- import '../../meta-BXKLFTgG.js';
5
+ import '../../meta-D1M85Hef.js';
6
6
  import 'phecda-core';
7
7
 
8
8
  interface FastifyCtx extends HttpContext {
@@ -7,7 +7,7 @@ var _chunkMBCHNDAYjs = require('../../chunk-MBCHNDAY.js');
7
7
 
8
8
 
9
9
 
10
- var _chunkGSPBHZBHjs = require('../../chunk-GSPBHZBH.js');
10
+ var _chunkNQIFUZL4js = require('../../chunk-NQIFUZL4.js');
11
11
 
12
12
 
13
13
  var _chunkJ5CFUN4Vjs = require('../../chunk-J5CFUN4V.js');
@@ -18,14 +18,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/fastify");
18
18
  function bind(fastify, data, opts = {}) {
19
19
  const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, fastifyOpts, dynamic = false } = opts;
20
20
  const { moduleMap, meta } = data;
21
- const metaMap = _chunkGSPBHZBHjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
+ const metaMap = _chunkNQIFUZL4js.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
22
  const { controller, http, func, tag } = meta2.data;
23
23
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _2 => _2.type])) {
24
24
  debug(`register method "${func}" in module "${tag}"`);
25
25
  return true;
26
26
  }
27
27
  });
28
- _chunkGSPBHZBHjs.detectAopDep.call(void 0, meta, {
28
+ _chunkNQIFUZL4js.detectAopDep.call(void 0, meta, {
29
29
  addons: [
30
30
  ...globalAddons,
31
31
  ...parallelAddons
@@ -33,34 +33,35 @@ function bind(fastify, data, opts = {}) {
33
33
  guards: globalGuards
34
34
  });
35
35
  fastify.register(async (fastify2, _, done) => {
36
- _chunkGSPBHZBHjs.Context.applyAddons(globalAddons, fastify2, "fastify");
36
+ _chunkNQIFUZL4js.Context.applyAddons(globalAddons, fastify2, "fastify");
37
37
  if (parallelRoute) {
38
38
  fastify2.register(async (fastify3, _opts, done2) => {
39
- _chunkGSPBHZBHjs.Context.applyAddons(parallelAddons, fastify3, "fastify");
39
+ _chunkNQIFUZL4js.Context.applyAddons(parallelAddons, fastify3, "fastify");
40
40
  fastify3.post(parallelRoute, async (req, res) => {
41
41
  const { body } = req;
42
42
  async function errorHandler(e) {
43
- const error = await _chunkGSPBHZBHjs.Context.filterRecord.default(e);
43
+ const error = await _chunkNQIFUZL4js.Context.filterRecord.default(e);
44
44
  return res.status(error.status).send(error);
45
45
  }
46
46
  _chunkJ5CFUN4Vjs.__name.call(void 0, errorHandler, "errorHandler");
47
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkGSPBHZBHjs.BadRequestException)("data format should be an array"));
47
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkNQIFUZL4js.BadRequestException)("data format should be an array"));
48
48
  try {
49
49
  return Promise.all(body.map((item, i) => {
50
50
  return new Promise(async (resolve) => {
51
51
  const { tag, func } = item;
52
52
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
53
- if (!metaMap.has(tag)) return resolve(await _chunkGSPBHZBHjs.Context.filterRecord.default(new (0, _chunkGSPBHZBHjs.BadRequestException)(`module "${tag}" doesn't exist`)));
53
+ if (!metaMap.has(tag)) return resolve(await _chunkNQIFUZL4js.Context.filterRecord.default(new (0, _chunkNQIFUZL4js.BadRequestException)(`module "${tag}" doesn't exist`)));
54
54
  const meta2 = metaMap.get(tag)[func];
55
- if (!meta2) return resolve(await _chunkGSPBHZBHjs.Context.filterRecord.default(new (0, _chunkGSPBHZBHjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
55
+ if (!meta2) return resolve(await _chunkNQIFUZL4js.Context.filterRecord.default(new (0, _chunkNQIFUZL4js.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
56
56
  const { data: { params } } = meta2;
57
- const aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
57
+ const aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
58
58
  globalFilter,
59
59
  globalGuards,
60
60
  globalPipe
61
61
  });
62
62
  const contextData = {
63
63
  type: "fastify",
64
+ category: "http",
64
65
  parallel: true,
65
66
  request: req,
66
67
  index: i,
@@ -70,7 +71,7 @@ function bind(fastify, data, opts = {}) {
70
71
  tag,
71
72
  func,
72
73
  app: fastify3,
73
- ..._chunkGSPBHZBHjs.argToReq.call(void 0, params, item.args, req.headers),
74
+ ..._chunkNQIFUZL4js.argToReq.call(void 0, params, item.args, req.headers),
74
75
  // @ts-expect-error need @fastify/cookie
75
76
  getCookie: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
76
77
  // @ts-expect-error need @fastify/cookie
@@ -83,7 +84,7 @@ function bind(fastify, data, opts = {}) {
83
84
  getRequest: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => req.raw, "getRequest"),
84
85
  getResponse: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => res.raw, "getResponse")
85
86
  };
86
- const context = new (0, _chunkGSPBHZBHjs.Context)(contextData);
87
+ const context = new (0, _chunkNQIFUZL4js.Context)(contextData);
87
88
  context.run(aop, resolve, resolve);
88
89
  });
89
90
  })).then((ret) => {
@@ -102,10 +103,10 @@ function bind(fastify, data, opts = {}) {
102
103
  const { data: { addons, define, http } } = meta2;
103
104
  if (!_optionalChain([http, 'optionalAccess', _3 => _3.type])) continue;
104
105
  fastify2.register(async (fastify3, _opts, done2) => {
105
- _chunkGSPBHZBHjs.Context.applyAddons(addons, fastify3, "fastify");
106
+ _chunkNQIFUZL4js.Context.applyAddons(addons, fastify3, "fastify");
106
107
  let aop;
107
108
  if (!dynamic) {
108
- aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
109
+ aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
109
110
  globalFilter,
110
111
  globalGuards,
111
112
  globalPipe
@@ -115,6 +116,7 @@ function bind(fastify, data, opts = {}) {
115
116
  debug(`invoke method "${func}" in module "${tag}"`);
116
117
  const contextData = {
117
118
  type: "fastify",
119
+ category: "http",
118
120
  request: req,
119
121
  meta: meta2,
120
122
  response: res,
@@ -140,10 +142,10 @@ function bind(fastify, data, opts = {}) {
140
142
  getRequest: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => req.raw, "getRequest"),
141
143
  getResponse: /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, () => res.raw, "getResponse")
142
144
  };
143
- const context = new (0, _chunkGSPBHZBHjs.Context)(contextData);
145
+ const context = new (0, _chunkNQIFUZL4js.Context)(contextData);
144
146
  if (http.headers) res.headers(http.headers);
145
147
  if (dynamic) {
146
- aop = _chunkGSPBHZBHjs.Context.getAop(meta2, {
148
+ aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
147
149
  globalFilter,
148
150
  globalGuards,
149
151
  globalPipe