phecda-server 5.1.1 → 5.2.0

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 (62) hide show
  1. package/assets/ps.json +25 -0
  2. package/assets/tsconfig.json +21 -0
  3. package/bin/cli.mjs +41 -80
  4. package/dist/{chunk-HMPTPTFL.js → chunk-5BVUCNMA.js} +2 -2
  5. package/dist/{chunk-FSBD5R22.js → chunk-BSE2DSDK.js} +64 -66
  6. package/dist/{chunk-2HKQPZDT.mjs → chunk-CKQW3FDK.mjs} +3 -3
  7. package/dist/{chunk-665MB62T.mjs → chunk-JE6BBDXW.mjs} +63 -65
  8. package/dist/{chunk-UU6RHGRF.mjs → chunk-V3WIKOP3.mjs} +10 -4
  9. package/dist/{chunk-3BV2GRS7.js → chunk-VMLHTEW3.js} +22 -16
  10. package/dist/core-7f6d2be6.d.ts +27 -0
  11. package/dist/{helper-fcbf6aa8.d.ts → helper-49c7213c.d.ts} +1 -1
  12. package/dist/{helper-6133f78f.d.ts → helper-5d755442.d.ts} +1 -1
  13. package/dist/helper.d.ts +25 -0
  14. package/dist/helper.js +21 -0
  15. package/dist/helper.mjs +21 -0
  16. package/dist/index.d.ts +5 -25
  17. package/dist/index.js +24 -42
  18. package/dist/index.mjs +5 -23
  19. package/dist/rpc/bullmq/index.d.ts +3 -2
  20. package/dist/rpc/bullmq/index.js +6 -6
  21. package/dist/rpc/bullmq/index.mjs +1 -1
  22. package/dist/rpc/kafka/index.d.ts +3 -2
  23. package/dist/rpc/kafka/index.js +5 -5
  24. package/dist/rpc/kafka/index.mjs +1 -1
  25. package/dist/rpc/nats/index.d.ts +3 -2
  26. package/dist/rpc/nats/index.js +5 -5
  27. package/dist/rpc/nats/index.mjs +1 -1
  28. package/dist/rpc/rabbitmq/index.d.ts +3 -2
  29. package/dist/rpc/rabbitmq/index.js +6 -6
  30. package/dist/rpc/rabbitmq/index.mjs +1 -1
  31. package/dist/rpc/redis/index.d.ts +3 -2
  32. package/dist/rpc/redis/index.js +6 -6
  33. package/dist/rpc/redis/index.mjs +1 -1
  34. package/dist/server/elysia/index.d.ts +3 -2
  35. package/dist/server/elysia/index.js +15 -15
  36. package/dist/server/elysia/index.mjs +2 -2
  37. package/dist/server/express/index.d.ts +3 -2
  38. package/dist/server/express/index.js +14 -14
  39. package/dist/server/express/index.mjs +1 -1
  40. package/dist/server/fastify/index.d.ts +3 -2
  41. package/dist/server/fastify/index.js +15 -15
  42. package/dist/server/fastify/index.mjs +2 -2
  43. package/dist/server/h3/index.d.ts +3 -2
  44. package/dist/server/h3/index.js +12 -12
  45. package/dist/server/h3/index.mjs +1 -1
  46. package/dist/server/hono/index.d.ts +3 -2
  47. package/dist/server/hono/index.js +13 -13
  48. package/dist/server/hono/index.mjs +1 -1
  49. package/dist/server/hyper-express/index.d.ts +3 -2
  50. package/dist/server/hyper-express/index.js +13 -13
  51. package/dist/server/hyper-express/index.mjs +1 -1
  52. package/dist/server/koa/index.d.ts +3 -2
  53. package/dist/server/koa/index.js +14 -14
  54. package/dist/server/koa/index.mjs +1 -1
  55. package/dist/test.d.ts +2 -1
  56. package/dist/test.js +2 -2
  57. package/dist/test.mjs +1 -1
  58. package/dist/{core-39f27fe8.d.ts → types-81be0ba3.d.ts} +2 -25
  59. package/package.json +61 -53
  60. package/register/loader.mjs +26 -13
  61. package/register/utils.mjs +6 -31
  62. /package/{bin → assets}/schema.json +0 -0
@@ -1,6 +1,7 @@
1
1
  import { NatsConnection } from 'nats';
2
- import { F as Factory, T as ToClientMap } from '../../core-39f27fe8.js';
3
- import { b as RpcContext, R as RpcServerOptions, a as RpcClientOptions } from '../../helper-6133f78f.js';
2
+ import { F as Factory } from '../../core-7f6d2be6.js';
3
+ import { b as RpcContext, R as RpcServerOptions, a as RpcClientOptions } from '../../helper-5d755442.js';
4
+ import { T as ToClientMap } from '../../types-81be0ba3.js';
4
5
  import 'phecda-core';
5
6
 
6
7
  interface NatsCtx extends RpcContext {
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkFSBD5R22js = require('../../chunk-FSBD5R22.js');
6
+ var _chunkBSE2DSDKjs = require('../../chunk-BSE2DSDK.js');
7
7
 
8
8
 
9
9
  var _chunkZP7HNASUjs = require('../../chunk-ZP7HNASU.js');
@@ -17,14 +17,14 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
17
17
  const sc = _nats.StringCodec.call(void 0, );
18
18
  const subscriptionMap = {};
19
19
  const existQueue = /* @__PURE__ */ new Set();
20
- const metaMap = _chunkFSBD5R22js.createControllerMetaMap.call(void 0, meta, (meta2) => {
20
+ const metaMap = _chunkBSE2DSDKjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
21
  const { controller, rpc, func, tag } = meta2.data;
22
22
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _2 => _2.queue]) !== void 0) {
23
23
  debug(`register method "${func}" in module "${tag}"`);
24
24
  return true;
25
25
  }
26
26
  });
27
- _chunkFSBD5R22js.detectAopDep.call(void 0, meta, {
27
+ _chunkBSE2DSDKjs.detectAopDep.call(void 0, meta, {
28
28
  guards: globalGuards,
29
29
  interceptors: globalInterceptors
30
30
  }, "rpc");
@@ -58,7 +58,7 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
58
58
  const { data: { rpc: { isEvent } = {} } } = meta2;
59
59
  if (isEvent)
60
60
  msg.respond("{}");
61
- const context = new (0, _chunkFSBD5R22js.Context)({
61
+ const context = new (0, _chunkBSE2DSDKjs.Context)({
62
62
  type: "nats",
63
63
  moduleMap,
64
64
  meta: meta2,
@@ -92,7 +92,7 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
92
92
  }
93
93
  _chunkZP7HNASUjs.__name.call(void 0, handleRequest, "handleRequest");
94
94
  subscribeQueues();
95
- _chunkFSBD5R22js.HMR.call(void 0, async () => {
95
+ _chunkBSE2DSDKjs.HMR.call(void 0, async () => {
96
96
  for (const i in subscriptionMap)
97
97
  subscriptionMap[i].unsubscribe();
98
98
  await subscribeQueues();
@@ -3,7 +3,7 @@ import {
3
3
  HMR,
4
4
  createControllerMetaMap,
5
5
  detectAopDep
6
- } from "../../chunk-665MB62T.mjs";
6
+ } from "../../chunk-JE6BBDXW.mjs";
7
7
  import {
8
8
  __name
9
9
  } from "../../chunk-VLV3AO3H.mjs";
@@ -1,6 +1,7 @@
1
1
  import amqplib from 'amqplib';
2
- import { F as Factory, T as ToClientMap } from '../../core-39f27fe8.js';
3
- import { b as RpcContext, R as RpcServerOptions, a as RpcClientOptions } from '../../helper-6133f78f.js';
2
+ import { F as Factory } from '../../core-7f6d2be6.js';
3
+ import { b as RpcContext, R as RpcServerOptions, a as RpcClientOptions } from '../../helper-5d755442.js';
4
+ import { T as ToClientMap } from '../../types-81be0ba3.js';
4
5
  import 'phecda-core';
5
6
 
6
7
  interface RabbitmqCtx extends RpcContext {
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkFSBD5R22js = require('../../chunk-FSBD5R22.js');
7
+ var _chunkBSE2DSDKjs = require('../../chunk-BSE2DSDK.js');
8
8
 
9
9
 
10
10
  var _chunkZP7HNASUjs = require('../../chunk-ZP7HNASU.js');
@@ -14,14 +14,14 @@ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
14
14
  var debug = _debug2.default.call(void 0, "phecda-server/rabbitmq");
15
15
  async function bind(ch, { moduleMap, meta }, opts = {}) {
16
16
  const { globalGuards, globalInterceptors, globalFilter, globalPipe } = opts;
17
- const metaMap = _chunkFSBD5R22js.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const metaMap = _chunkBSE2DSDKjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
18
18
  const { controller, rpc, func, tag } = meta2.data;
19
19
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
20
20
  debug(`register method "${func}" in module "${tag}"`);
21
21
  return true;
22
22
  }
23
23
  });
24
- _chunkFSBD5R22js.detectAopDep.call(void 0, meta, {
24
+ _chunkBSE2DSDKjs.detectAopDep.call(void 0, meta, {
25
25
  guards: globalGuards,
26
26
  interceptors: globalInterceptors
27
27
  }, "rpc");
@@ -59,7 +59,7 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
59
59
  debug(`invoke method "${func}" in module "${tag}"`);
60
60
  const meta2 = metaMap.get(tag)[func];
61
61
  const { data: { rpc: { isEvent } = {} } } = meta2;
62
- const context = new (0, _chunkFSBD5R22js.Context)({
62
+ const context = new (0, _chunkBSE2DSDKjs.Context)({
63
63
  type: "rabbitmq",
64
64
  moduleMap,
65
65
  meta: meta2,
@@ -95,7 +95,7 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
95
95
  }
96
96
  _chunkZP7HNASUjs.__name.call(void 0, handleRequest, "handleRequest");
97
97
  subscribeQueues();
98
- _chunkFSBD5R22js.HMR.call(void 0, async () => {
98
+ _chunkBSE2DSDKjs.HMR.call(void 0, async () => {
99
99
  for (const queue of existQueue)
100
100
  await ch.deleteQueue(queue);
101
101
  await subscribeQueues();
@@ -110,7 +110,7 @@ async function createClient(ch, controllers, opts) {
110
110
  let eventCount = 0;
111
111
  const ret = {};
112
112
  const emitter = new (0, _events.EventEmitter)();
113
- const clientQueue = _chunkFSBD5R22js.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
113
+ const clientQueue = _chunkBSE2DSDKjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
114
114
  await ch.assertQueue(clientQueue);
115
115
  ch.consume(clientQueue, (msg) => {
116
116
  if (!msg)
@@ -4,7 +4,7 @@ import {
4
4
  createControllerMetaMap,
5
5
  detectAopDep,
6
6
  genClientQueue
7
- } from "../../chunk-665MB62T.mjs";
7
+ } from "../../chunk-JE6BBDXW.mjs";
8
8
  import {
9
9
  __name
10
10
  } from "../../chunk-VLV3AO3H.mjs";
@@ -1,6 +1,7 @@
1
1
  import Redis from 'ioredis';
2
- import { F as Factory, T as ToClientMap } from '../../core-39f27fe8.js';
3
- import { b as RpcContext, R as RpcServerOptions, a as RpcClientOptions } from '../../helper-6133f78f.js';
2
+ import { F as Factory } from '../../core-7f6d2be6.js';
3
+ import { b as RpcContext, R as RpcServerOptions, a as RpcClientOptions } from '../../helper-5d755442.js';
4
+ import { T as ToClientMap } from '../../types-81be0ba3.js';
4
5
  import 'phecda-core';
5
6
 
6
7
  interface RedisCtx extends RpcContext {
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkFSBD5R22js = require('../../chunk-FSBD5R22.js');
7
+ var _chunkBSE2DSDKjs = require('../../chunk-BSE2DSDK.js');
8
8
 
9
9
 
10
10
  var _chunkZP7HNASUjs = require('../../chunk-ZP7HNASU.js');
@@ -14,14 +14,14 @@ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
14
14
  var debug = _debug2.default.call(void 0, "phecda-server/redis");
15
15
  function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
16
16
  const { globalGuards, globalInterceptors, globalFilter, globalPipe } = opts;
17
- const metaMap = _chunkFSBD5R22js.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const metaMap = _chunkBSE2DSDKjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
18
18
  const { controller, rpc, func, tag } = meta2.data;
19
19
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
20
20
  debug(`register method "${func}" in module "${tag}"`);
21
21
  return true;
22
22
  }
23
23
  });
24
- _chunkFSBD5R22js.detectAopDep.call(void 0, meta, {
24
+ _chunkBSE2DSDKjs.detectAopDep.call(void 0, meta, {
25
25
  guards: globalGuards,
26
26
  interceptors: globalInterceptors
27
27
  }, "rpc");
@@ -54,7 +54,7 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
54
54
  return;
55
55
  const meta2 = metaMap.get(tag)[func];
56
56
  const { data: { rpc: { isEvent } = {} } } = meta2;
57
- const context = new (0, _chunkFSBD5R22js.Context)({
57
+ const context = new (0, _chunkBSE2DSDKjs.Context)({
58
58
  type: "redis",
59
59
  moduleMap,
60
60
  redis: sub,
@@ -91,7 +91,7 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
91
91
  }
92
92
  });
93
93
  subscribeQueues();
94
- _chunkFSBD5R22js.HMR.call(void 0, async () => {
94
+ _chunkBSE2DSDKjs.HMR.call(void 0, async () => {
95
95
  for (const queue of existQueue)
96
96
  await sub.unsubscribe(queue);
97
97
  subscribeQueues();
@@ -106,7 +106,7 @@ async function createClient({ pub, sub }, controllers, opts) {
106
106
  let eventId = 1;
107
107
  let eventCount = 0;
108
108
  const emitter = new (0, _events2.default)();
109
- const clientQueue = _chunkFSBD5R22js.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
109
+ const clientQueue = _chunkBSE2DSDKjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
110
110
  await sub.subscribe(clientQueue);
111
111
  for (const i in controllers) {
112
112
  ret[i] = new Proxy(new controllers[i](), {
@@ -4,7 +4,7 @@ import {
4
4
  createControllerMetaMap,
5
5
  detectAopDep,
6
6
  genClientQueue
7
- } from "../../chunk-665MB62T.mjs";
7
+ } from "../../chunk-JE6BBDXW.mjs";
8
8
  import {
9
9
  __name
10
10
  } from "../../chunk-VLV3AO3H.mjs";
@@ -1,8 +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 { a as HttpContext, H as HttpOptions } from '../../helper-fcbf6aa8.js';
4
- import { F as Factory } from '../../core-39f27fe8.js';
3
+ import { a as HttpContext, H as HttpOptions } from '../../helper-49c7213c.js';
4
+ import { F as Factory } from '../../core-7f6d2be6.js';
5
5
  import 'node:http';
6
+ import '../../types-81be0ba3.js';
6
7
  import 'phecda-core';
7
8
 
8
9
  interface ElysiaCtx extends HttpContext {
@@ -1,13 +1,13 @@
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 _chunk3BV2GRS7js = require('../../chunk-3BV2GRS7.js');
3
+ var _chunkVMLHTEW3js = require('../../chunk-VMLHTEW3.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
- var _chunkFSBD5R22js = require('../../chunk-FSBD5R22.js');
10
+ var _chunkBSE2DSDKjs = require('../../chunk-BSE2DSDK.js');
11
11
 
12
12
 
13
13
  var _chunkZP7HNASUjs = require('../../chunk-ZP7HNASU.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, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe } = opts;
21
21
  const { moduleMap, meta } = data;
22
- const metaMap = _chunkFSBD5R22js.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
+ const metaMap = _chunkBSE2DSDKjs.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
- _chunkFSBD5R22js.detectAopDep.call(void 0, meta, {
29
+ _chunkBSE2DSDKjs.detectAopDep.call(void 0, meta, {
30
30
  plugins: [
31
31
  ...globalPlugins,
32
32
  ...parallelPlugins
@@ -36,30 +36,30 @@ function bind(app, data, opts = {}) {
36
36
  });
37
37
  registerRoute();
38
38
  async function registerRoute() {
39
- _chunkFSBD5R22js.Context.usePlugin(globalPlugins, "elysia").forEach((p) => p(app));
39
+ _chunkBSE2DSDKjs.Context.usePlugin(globalPlugins, "elysia").forEach((p) => p(app));
40
40
  const parallelRouter = new (0, _elysia.Elysia)();
41
- _chunkFSBD5R22js.Context.usePlugin(parallelPlugins, "elysia").forEach((p) => p(parallelRouter));
41
+ _chunkBSE2DSDKjs.Context.usePlugin(parallelPlugins, "elysia").forEach((p) => p(parallelRouter));
42
42
  if (parallelRoute) {
43
43
  parallelRouter.post(parallelRoute, async (c) => {
44
44
  const { body } = c;
45
45
  async function errorHandler(e) {
46
- const error = await _chunkFSBD5R22js.Context.filterRecord.default(e);
46
+ const error = await _chunkBSE2DSDKjs.Context.filterRecord.default(e);
47
47
  c.set.status = error.status;
48
48
  return error;
49
49
  }
50
50
  _chunkZP7HNASUjs.__name.call(void 0, errorHandler, "errorHandler");
51
51
  if (!Array.isArray(body))
52
- return errorHandler(new (0, _chunkFSBD5R22js.BadRequestException)("data format should be an array"));
52
+ return errorHandler(new (0, _chunkBSE2DSDKjs.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
58
  if (!metaMap.has(tag))
59
- return resolve(await _chunkFSBD5R22js.Context.filterRecord.default(new (0, _chunkFSBD5R22js.BadRequestException)(`module "${tag}" doesn't exist`)));
59
+ return resolve(await _chunkBSE2DSDKjs.Context.filterRecord.default(new (0, _chunkBSE2DSDKjs.BadRequestException)(`module "${tag}" doesn't exist`)));
60
60
  const meta2 = metaMap.get(tag)[func];
61
61
  if (!meta2)
62
- return resolve(await _chunkFSBD5R22js.Context.filterRecord.default(new (0, _chunkFSBD5R22js.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
62
+ return resolve(await _chunkBSE2DSDKjs.Context.filterRecord.default(new (0, _chunkBSE2DSDKjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
63
63
  const { data: { params } } = meta2;
64
64
  const contextData = {
65
65
  type: "elysia",
@@ -71,9 +71,9 @@ function bind(app, data, opts = {}) {
71
71
  tag,
72
72
  func,
73
73
  app,
74
- ..._chunkFSBD5R22js.argToReq.call(void 0, params, item.args, c.headers)
74
+ ..._chunkBSE2DSDKjs.argToReq.call(void 0, params, item.args, c.headers)
75
75
  };
76
- const context = new (0, _chunkFSBD5R22js.Context)(contextData);
76
+ const context = new (0, _chunkBSE2DSDKjs.Context)(contextData);
77
77
  context.run({
78
78
  globalGuards,
79
79
  globalInterceptors,
@@ -97,7 +97,7 @@ function bind(app, data, opts = {}) {
97
97
  const funcRouter = new (0, _elysia.Elysia)();
98
98
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type]))
99
99
  continue;
100
- _chunkFSBD5R22js.Context.usePlugin(plugins, "elysia").forEach((p) => p(funcRouter));
100
+ _chunkBSE2DSDKjs.Context.usePlugin(plugins, "elysia").forEach((p) => p(funcRouter));
101
101
  funcRouter[http.type](http.prefix + http.route, async (c) => {
102
102
  debug(`invoke method "${func}" in module "${tag}"`);
103
103
  const contextData = {
@@ -113,7 +113,7 @@ function bind(app, data, opts = {}) {
113
113
  headers: c.headers,
114
114
  app
115
115
  };
116
- const context = new (0, _chunkFSBD5R22js.Context)(contextData);
116
+ const context = new (0, _chunkBSE2DSDKjs.Context)(contextData);
117
117
  if (http.headers)
118
118
  c.set.headers = http.headers;
119
119
  return context.run({
@@ -134,7 +134,7 @@ function bind(app, data, opts = {}) {
134
134
  }
135
135
  _chunkZP7HNASUjs.__name.call(void 0, bind, "bind");
136
136
  function Elysia(opts) {
137
- return _chunk3BV2GRS7js.Define.call(void 0, "elysia", opts);
137
+ return _chunkVMLHTEW3js.Define.call(void 0, "elysia", opts);
138
138
  }
139
139
  _chunkZP7HNASUjs.__name.call(void 0, Elysia, "Elysia");
140
140
 
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  Define
3
- } from "../../chunk-UU6RHGRF.mjs";
3
+ } from "../../chunk-V3WIKOP3.mjs";
4
4
  import {
5
5
  BadRequestException,
6
6
  Context,
7
7
  argToReq,
8
8
  createControllerMetaMap,
9
9
  detectAopDep
10
- } from "../../chunk-665MB62T.mjs";
10
+ } from "../../chunk-JE6BBDXW.mjs";
11
11
  import {
12
12
  __name
13
13
  } from "../../chunk-VLV3AO3H.mjs";
@@ -1,7 +1,8 @@
1
1
  import { Request, Response, Router, RequestHandler } from 'express';
2
- import { a as HttpContext, H as HttpOptions } from '../../helper-fcbf6aa8.js';
3
- import { F as Factory } from '../../core-39f27fe8.js';
2
+ import { a as HttpContext, H as HttpOptions } from '../../helper-49c7213c.js';
3
+ import { F as Factory } from '../../core-7f6d2be6.js';
4
4
  import 'node:http';
5
+ import '../../types-81be0ba3.js';
5
6
  import 'phecda-core';
6
7
 
7
8
  interface ExpressCtx extends HttpContext {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkFSBD5R22js = require('../../chunk-FSBD5R22.js');
8
+ var _chunkBSE2DSDKjs = require('../../chunk-BSE2DSDK.js');
9
9
 
10
10
 
11
11
  var _chunkZP7HNASUjs = require('../../chunk-ZP7HNASU.js');
@@ -17,14 +17,14 @@ function bind(router, data, opts = {}) {
17
17
  const { globalGuards, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe } = opts;
18
18
  const { moduleMap, meta } = data;
19
19
  const originStack = router.stack.slice(0, router.stack.length);
20
- const metaMap = _chunkFSBD5R22js.createControllerMetaMap.call(void 0, meta, (meta2) => {
20
+ const metaMap = _chunkBSE2DSDKjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
21
  const { controller, http, func, tag } = meta2.data;
22
22
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
23
23
  debug(`register method "${func}" in module "${tag}"`);
24
24
  return true;
25
25
  }
26
26
  });
27
- _chunkFSBD5R22js.detectAopDep.call(void 0, meta, {
27
+ _chunkBSE2DSDKjs.detectAopDep.call(void 0, meta, {
28
28
  plugins: [
29
29
  ...globalPlugins,
30
30
  ...parallelPlugins
@@ -33,32 +33,32 @@ function bind(router, data, opts = {}) {
33
33
  interceptors: globalInterceptors
34
34
  });
35
35
  registerRoute();
36
- _chunkFSBD5R22js.HMR.call(void 0, async () => {
36
+ _chunkBSE2DSDKjs.HMR.call(void 0, async () => {
37
37
  router.stack = originStack;
38
38
  registerRoute();
39
39
  });
40
40
  async function registerRoute() {
41
- _chunkFSBD5R22js.Context.usePlugin(globalPlugins, "express").forEach((p) => router.use(p));
41
+ _chunkBSE2DSDKjs.Context.usePlugin(globalPlugins, "express").forEach((p) => router.use(p));
42
42
  if (parallelRoute) {
43
- router.post(parallelRoute, ..._chunkFSBD5R22js.Context.usePlugin(parallelPlugins, "express"), async (req, res, next) => {
43
+ router.post(parallelRoute, ..._chunkBSE2DSDKjs.Context.usePlugin(parallelPlugins, "express"), async (req, res, next) => {
44
44
  const { body } = req;
45
45
  async function errorHandler(e) {
46
- const error = await _chunkFSBD5R22js.Context.filterRecord.default(e);
46
+ const error = await _chunkBSE2DSDKjs.Context.filterRecord.default(e);
47
47
  return res.status(error.status).json(error);
48
48
  }
49
49
  _chunkZP7HNASUjs.__name.call(void 0, errorHandler, "errorHandler");
50
50
  if (!Array.isArray(body))
51
- return errorHandler(new (0, _chunkFSBD5R22js.BadRequestException)("data format should be an array"));
51
+ return errorHandler(new (0, _chunkBSE2DSDKjs.BadRequestException)("data format should be an array"));
52
52
  try {
53
53
  return Promise.all(body.map((item, i) => {
54
54
  return new Promise(async (resolve) => {
55
55
  const { tag, func } = item;
56
56
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
57
57
  if (!metaMap.has(tag))
58
- return resolve(await _chunkFSBD5R22js.Context.filterRecord.default(new (0, _chunkFSBD5R22js.BadRequestException)(`module "${tag}" doesn't exist`)));
58
+ return resolve(await _chunkBSE2DSDKjs.Context.filterRecord.default(new (0, _chunkBSE2DSDKjs.BadRequestException)(`module "${tag}" doesn't exist`)));
59
59
  const meta2 = metaMap.get(tag)[func];
60
60
  if (!meta2)
61
- return resolve(await _chunkFSBD5R22js.Context.filterRecord.default(new (0, _chunkFSBD5R22js.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
61
+ return resolve(await _chunkBSE2DSDKjs.Context.filterRecord.default(new (0, _chunkBSE2DSDKjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
62
62
  const { data: { params } } = meta2;
63
63
  const contextData = {
64
64
  type: "express",
@@ -72,9 +72,9 @@ function bind(router, data, opts = {}) {
72
72
  func,
73
73
  next,
74
74
  app: router,
75
- ..._chunkFSBD5R22js.argToReq.call(void 0, params, item.args, req.headers)
75
+ ..._chunkBSE2DSDKjs.argToReq.call(void 0, params, item.args, req.headers)
76
76
  };
77
- const context = new (0, _chunkFSBD5R22js.Context)(contextData);
77
+ const context = new (0, _chunkBSE2DSDKjs.Context)(contextData);
78
78
  context.run({
79
79
  globalGuards,
80
80
  globalInterceptors,
@@ -96,7 +96,7 @@ function bind(router, data, opts = {}) {
96
96
  const { data: { plugins, http } } = meta2;
97
97
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type]))
98
98
  continue;
99
- router[http.type](http.prefix + http.route, ..._chunkFSBD5R22js.Context.usePlugin(plugins, "express"), async (req, res, next) => {
99
+ router[http.type](http.prefix + http.route, ..._chunkBSE2DSDKjs.Context.usePlugin(plugins, "express"), async (req, res, next) => {
100
100
  debug(`invoke method "${func}" in module "${tag}"`);
101
101
  const contextData = {
102
102
  type: "express",
@@ -113,7 +113,7 @@ function bind(router, data, opts = {}) {
113
113
  app: router,
114
114
  next
115
115
  };
116
- const context = new (0, _chunkFSBD5R22js.Context)(contextData);
116
+ const context = new (0, _chunkBSE2DSDKjs.Context)(contextData);
117
117
  if (http.headers) {
118
118
  for (const name in http.headers)
119
119
  res.set(name, http.headers[name]);
@@ -5,7 +5,7 @@ import {
5
5
  argToReq,
6
6
  createControllerMetaMap,
7
7
  detectAopDep
8
- } from "../../chunk-665MB62T.mjs";
8
+ } from "../../chunk-JE6BBDXW.mjs";
9
9
  import {
10
10
  __name
11
11
  } from "../../chunk-VLV3AO3H.mjs";
@@ -1,7 +1,8 @@
1
1
  import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback, FastifyRegisterOptions, FastifyPluginOptions, RouteShorthandOptions } from 'fastify';
2
- import { a as HttpContext, H as HttpOptions } from '../../helper-fcbf6aa8.js';
3
- import { F as Factory } from '../../core-39f27fe8.js';
2
+ import { a as HttpContext, H as HttpOptions } from '../../helper-49c7213c.js';
3
+ import { F as Factory } from '../../core-7f6d2be6.js';
4
4
  import 'node:http';
5
+ import '../../types-81be0ba3.js';
5
6
  import 'phecda-core';
6
7
 
7
8
  interface FastifyCtx extends HttpContext {
@@ -1,13 +1,13 @@
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 _chunk3BV2GRS7js = require('../../chunk-3BV2GRS7.js');
3
+ var _chunkVMLHTEW3js = require('../../chunk-VMLHTEW3.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
- var _chunkFSBD5R22js = require('../../chunk-FSBD5R22.js');
10
+ var _chunkBSE2DSDKjs = require('../../chunk-BSE2DSDK.js');
11
11
 
12
12
 
13
13
  var _chunkZP7HNASUjs = require('../../chunk-ZP7HNASU.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, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe, fastifyOpts } = opts;
20
20
  const { moduleMap, meta } = data;
21
- const metaMap = _chunkFSBD5R22js.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
+ const metaMap = _chunkBSE2DSDKjs.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
- _chunkFSBD5R22js.detectAopDep.call(void 0, meta, {
28
+ _chunkBSE2DSDKjs.detectAopDep.call(void 0, meta, {
29
29
  plugins: [
30
30
  ...globalPlugins,
31
31
  ...parallelPlugins
@@ -34,12 +34,12 @@ function bind(fastify, data, opts = {}) {
34
34
  interceptors: globalInterceptors
35
35
  });
36
36
  fastify.register((fastify2, _, done) => {
37
- _chunkFSBD5R22js.Context.usePlugin(globalPlugins, "fastify").forEach((p) => {
37
+ _chunkBSE2DSDKjs.Context.usePlugin(globalPlugins, "fastify").forEach((p) => {
38
38
  p[Symbol.for("skip-override")] = true;
39
39
  fastify2.register(p);
40
40
  });
41
41
  fastify2.register((fastify3, _opts, done2) => {
42
- _chunkFSBD5R22js.Context.usePlugin(parallelPlugins, "fastify").forEach((p) => {
42
+ _chunkBSE2DSDKjs.Context.usePlugin(parallelPlugins, "fastify").forEach((p) => {
43
43
  p[Symbol.for("skip-override")] = true;
44
44
  fastify3.register(p);
45
45
  });
@@ -47,22 +47,22 @@ function bind(fastify, data, opts = {}) {
47
47
  fastify3.post(parallelRoute, async (req, res) => {
48
48
  const { body } = req;
49
49
  async function errorHandler(e) {
50
- const error = await _chunkFSBD5R22js.Context.filterRecord.default(e);
50
+ const error = await _chunkBSE2DSDKjs.Context.filterRecord.default(e);
51
51
  return res.status(error.status).send(error);
52
52
  }
53
53
  _chunkZP7HNASUjs.__name.call(void 0, errorHandler, "errorHandler");
54
54
  if (!Array.isArray(body))
55
- return errorHandler(new (0, _chunkFSBD5R22js.BadRequestException)("data format should be an array"));
55
+ return errorHandler(new (0, _chunkBSE2DSDKjs.BadRequestException)("data format should be an array"));
56
56
  try {
57
57
  return Promise.all(body.map((item, i) => {
58
58
  return new Promise(async (resolve) => {
59
59
  const { tag, func } = item;
60
60
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
61
61
  if (!metaMap.has(tag))
62
- return resolve(await _chunkFSBD5R22js.Context.filterRecord.default(new (0, _chunkFSBD5R22js.BadRequestException)(`module "${tag}" doesn't exist`)));
62
+ return resolve(await _chunkBSE2DSDKjs.Context.filterRecord.default(new (0, _chunkBSE2DSDKjs.BadRequestException)(`module "${tag}" doesn't exist`)));
63
63
  const meta2 = metaMap.get(tag)[func];
64
64
  if (!meta2)
65
- return resolve(await _chunkFSBD5R22js.Context.filterRecord.default(new (0, _chunkFSBD5R22js.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
65
+ return resolve(await _chunkBSE2DSDKjs.Context.filterRecord.default(new (0, _chunkBSE2DSDKjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
66
66
  const { data: { params } } = meta2;
67
67
  const contextData = {
68
68
  type: "fastify",
@@ -75,9 +75,9 @@ function bind(fastify, data, opts = {}) {
75
75
  tag,
76
76
  func,
77
77
  app: fastify3,
78
- ..._chunkFSBD5R22js.argToReq.call(void 0, params, item.args, req.headers)
78
+ ..._chunkBSE2DSDKjs.argToReq.call(void 0, params, item.args, req.headers)
79
79
  };
80
- const context = new (0, _chunkFSBD5R22js.Context)(contextData);
80
+ const context = new (0, _chunkBSE2DSDKjs.Context)(contextData);
81
81
  context.run({
82
82
  globalGuards,
83
83
  globalInterceptors,
@@ -102,7 +102,7 @@ function bind(fastify, data, opts = {}) {
102
102
  if (!_optionalChain([http, 'optionalAccess', _3 => _3.type]))
103
103
  continue;
104
104
  fastify2.register((fastify3, _opts, done2) => {
105
- _chunkFSBD5R22js.Context.usePlugin(plugins, "fastify").forEach((p) => {
105
+ _chunkBSE2DSDKjs.Context.usePlugin(plugins, "fastify").forEach((p) => {
106
106
  p[Symbol.for("skip-override")] = true;
107
107
  fastify3.register(p);
108
108
  });
@@ -122,7 +122,7 @@ function bind(fastify, data, opts = {}) {
122
122
  headers: req.headers,
123
123
  app: fastify3
124
124
  };
125
- const context = new (0, _chunkFSBD5R22js.Context)(contextData);
125
+ const context = new (0, _chunkBSE2DSDKjs.Context)(contextData);
126
126
  if (http.headers) {
127
127
  for (const name in http.headers)
128
128
  res.header(name, http.headers[name]);
@@ -151,7 +151,7 @@ function bind(fastify, data, opts = {}) {
151
151
  }
152
152
  _chunkZP7HNASUjs.__name.call(void 0, bind, "bind");
153
153
  function Fastify(opts) {
154
- return _chunk3BV2GRS7js.Define.call(void 0, "fastify", opts);
154
+ return _chunkVMLHTEW3js.Define.call(void 0, "fastify", opts);
155
155
  }
156
156
  _chunkZP7HNASUjs.__name.call(void 0, Fastify, "Fastify");
157
157
 
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  Define
3
- } from "../../chunk-UU6RHGRF.mjs";
3
+ } from "../../chunk-V3WIKOP3.mjs";
4
4
  import {
5
5
  BadRequestException,
6
6
  Context,
7
7
  argToReq,
8
8
  createControllerMetaMap,
9
9
  detectAopDep
10
- } from "../../chunk-665MB62T.mjs";
10
+ } from "../../chunk-JE6BBDXW.mjs";
11
11
  import {
12
12
  __name
13
13
  } from "../../chunk-VLV3AO3H.mjs";
@@ -1,7 +1,8 @@
1
1
  import { H3Event, Router, _RequestMiddleware } from 'h3';
2
- import { F as Factory } from '../../core-39f27fe8.js';
3
- import { a as HttpContext, H as HttpOptions } from '../../helper-fcbf6aa8.js';
2
+ import { F as Factory } from '../../core-7f6d2be6.js';
3
+ import { a as HttpContext, H as HttpOptions } from '../../helper-49c7213c.js';
4
4
  import 'phecda-core';
5
+ import '../../types-81be0ba3.js';
5
6
  import 'node:http';
6
7
 
7
8
  interface H3Ctx extends HttpContext {