phecda-server 6.0.2 → 6.1.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 (72) hide show
  1. package/dist/{chunk-WXFZZZRY.mjs → chunk-2CFYUXPM.mjs} +1 -1
  2. package/dist/{chunk-HDQAT2IM.mjs → chunk-3H3T54IC.mjs} +116 -87
  3. package/dist/{chunk-7SYPUIBY.js → chunk-DVTBLV6I.js} +60 -60
  4. package/dist/{chunk-UXD62LGG.mjs → chunk-G7TD2VB7.mjs} +10 -2
  5. package/dist/{chunk-F3W3NN7F.mjs → chunk-J7B24YSE.mjs} +1 -1
  6. package/dist/{chunk-XCND2QW3.js → chunk-JDV2XJYE.js} +25 -25
  7. package/dist/chunk-NL6QBQAR.js +266 -0
  8. package/dist/{chunk-GHFSIZUO.js → chunk-TVT62GIX.js} +11 -3
  9. package/dist/core-BlN0Spy9.d.ts +47 -0
  10. package/dist/core-P1CsH6jz.d.mts +47 -0
  11. package/dist/helper.js +3 -3
  12. package/dist/helper.mjs +2 -2
  13. package/dist/index.d.mts +6 -5
  14. package/dist/index.d.ts +6 -5
  15. package/dist/index.js +49 -43
  16. package/dist/index.mjs +15 -9
  17. package/dist/rpc/bullmq/index.d.mts +1 -1
  18. package/dist/rpc/bullmq/index.d.ts +1 -1
  19. package/dist/rpc/bullmq/index.js +12 -12
  20. package/dist/rpc/bullmq/index.mjs +2 -2
  21. package/dist/rpc/kafka/index.d.mts +1 -1
  22. package/dist/rpc/kafka/index.d.ts +1 -1
  23. package/dist/rpc/kafka/index.js +12 -12
  24. package/dist/rpc/kafka/index.mjs +2 -2
  25. package/dist/rpc/nats/index.d.mts +1 -1
  26. package/dist/rpc/nats/index.d.ts +1 -1
  27. package/dist/rpc/nats/index.js +11 -11
  28. package/dist/rpc/nats/index.mjs +2 -2
  29. package/dist/rpc/rabbitmq/index.d.mts +1 -1
  30. package/dist/rpc/rabbitmq/index.d.ts +1 -1
  31. package/dist/rpc/rabbitmq/index.js +13 -13
  32. package/dist/rpc/rabbitmq/index.mjs +2 -2
  33. package/dist/rpc/redis/index.d.mts +1 -1
  34. package/dist/rpc/redis/index.d.ts +1 -1
  35. package/dist/rpc/redis/index.js +11 -11
  36. package/dist/rpc/redis/index.mjs +2 -2
  37. package/dist/server/elysia/index.d.mts +1 -1
  38. package/dist/server/elysia/index.d.ts +1 -1
  39. package/dist/server/elysia/index.js +36 -36
  40. package/dist/server/elysia/index.mjs +3 -3
  41. package/dist/server/express/index.d.mts +1 -1
  42. package/dist/server/express/index.d.ts +1 -1
  43. package/dist/server/express/index.js +34 -34
  44. package/dist/server/express/index.mjs +2 -2
  45. package/dist/server/fastify/index.d.mts +1 -1
  46. package/dist/server/fastify/index.d.ts +1 -1
  47. package/dist/server/fastify/index.js +35 -35
  48. package/dist/server/fastify/index.mjs +3 -3
  49. package/dist/server/h3/index.d.mts +1 -1
  50. package/dist/server/h3/index.d.ts +1 -1
  51. package/dist/server/h3/index.js +34 -34
  52. package/dist/server/h3/index.mjs +2 -2
  53. package/dist/server/hono/index.d.mts +1 -1
  54. package/dist/server/hono/index.d.ts +1 -1
  55. package/dist/server/hono/index.js +33 -33
  56. package/dist/server/hono/index.mjs +2 -2
  57. package/dist/server/hyper-express/index.d.mts +1 -1
  58. package/dist/server/hyper-express/index.d.ts +1 -1
  59. package/dist/server/hyper-express/index.js +33 -33
  60. package/dist/server/hyper-express/index.mjs +2 -2
  61. package/dist/server/koa/index.d.mts +1 -1
  62. package/dist/server/koa/index.d.ts +1 -1
  63. package/dist/server/koa/index.js +34 -34
  64. package/dist/server/koa/index.mjs +2 -2
  65. package/dist/test.d.mts +1 -1
  66. package/dist/test.d.ts +1 -1
  67. package/dist/test.js +6 -6
  68. package/dist/test.mjs +2 -2
  69. package/package.json +2 -2
  70. package/dist/chunk-LYEZ6RGX.js +0 -237
  71. package/dist/core-2SNw8m2B.d.mts +0 -30
  72. package/dist/core-BmJJLUqj.d.ts +0 -30
@@ -3,10 +3,10 @@
3
3
 
4
4
 
5
5
 
6
- var _chunk7SYPUIBYjs = require('../../chunk-7SYPUIBY.js');
6
+ var _chunkDVTBLV6Ijs = require('../../chunk-DVTBLV6I.js');
7
7
 
8
8
 
9
- var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
9
+ var _chunkTVT62GIXjs = require('../../chunk-TVT62GIX.js');
10
10
 
11
11
  // src/rpc/nats/bind.ts
12
12
  var _nats = require('nats');
@@ -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 = _chunk7SYPUIBYjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
20
+ const metaMap = _chunkDVTBLV6Ijs.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
- _chunk7SYPUIBYjs.detectAopDep.call(void 0, meta, {
27
+ _chunkDVTBLV6Ijs.detectAopDep.call(void 0, meta, {
28
28
  guards: globalGuards,
29
29
  interceptors: globalInterceptors
30
30
  }, "rpc");
@@ -46,7 +46,7 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
46
46
  }
47
47
  }
48
48
  }
49
- _chunkGHFSIZUOjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
49
+ _chunkTVT62GIXjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
50
50
  async function handleRequest(_, msg) {
51
51
  const data = JSON.parse(sc.decode(msg.data));
52
52
  const { tag, func, id, _ps, args } = data;
@@ -55,7 +55,7 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
55
55
  const meta2 = metaMap.get(tag)[func];
56
56
  const { data: { rpc: { isEvent } = {} } } = meta2;
57
57
  if (isEvent) msg.respond("{}");
58
- const context = new (0, _chunk7SYPUIBYjs.Context)({
58
+ const context = new (0, _chunkDVTBLV6Ijs.Context)({
59
59
  type: "nats",
60
60
  moduleMap,
61
61
  meta: meta2,
@@ -86,14 +86,14 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
86
86
  })));
87
87
  });
88
88
  }
89
- _chunkGHFSIZUOjs.__name.call(void 0, handleRequest, "handleRequest");
89
+ _chunkTVT62GIXjs.__name.call(void 0, handleRequest, "handleRequest");
90
90
  subscribeQueues();
91
- _chunk7SYPUIBYjs.HMR.call(void 0, async () => {
91
+ _chunkDVTBLV6Ijs.HMR.call(void 0, async () => {
92
92
  for (const i in subscriptionMap) subscriptionMap[i].unsubscribe();
93
93
  await subscribeQueues();
94
94
  });
95
95
  }
96
- _chunkGHFSIZUOjs.__name.call(void 0, bind, "bind");
96
+ _chunkTVT62GIXjs.__name.call(void 0, bind, "bind");
97
97
 
98
98
  // src/rpc/nats/client.ts
99
99
 
@@ -143,7 +143,7 @@ async function createClient(nc, controllers, opts) {
143
143
  if (error) reject(data);
144
144
  else resolve(data);
145
145
  }
146
- _chunkGHFSIZUOjs.__name.call(void 0, handler, "handler");
146
+ _chunkTVT62GIXjs.__name.call(void 0, handler, "handler");
147
147
  eventCount++;
148
148
  });
149
149
  };
@@ -152,7 +152,7 @@ async function createClient(nc, controllers, opts) {
152
152
  }
153
153
  return ret;
154
154
  }
155
- _chunkGHFSIZUOjs.__name.call(void 0, createClient, "createClient");
155
+ _chunkTVT62GIXjs.__name.call(void 0, createClient, "createClient");
156
156
 
157
157
 
158
158
 
@@ -3,10 +3,10 @@ import {
3
3
  HMR,
4
4
  createControllerMetaMap,
5
5
  detectAopDep
6
- } from "../../chunk-WXFZZZRY.mjs";
6
+ } from "../../chunk-2CFYUXPM.mjs";
7
7
  import {
8
8
  __name
9
- } from "../../chunk-UXD62LGG.mjs";
9
+ } from "../../chunk-G7TD2VB7.mjs";
10
10
 
11
11
  // src/rpc/nats/bind.ts
12
12
  import { StringCodec } from "nats";
@@ -1,5 +1,5 @@
1
1
  import amqplib from 'amqplib';
2
- import { F as Factory } from '../../core-2SNw8m2B.mjs';
2
+ import { F as Factory } from '../../core-P1CsH6jz.mjs';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-t9D1fU6G.mjs';
4
4
  import { T as ToClientMap } from '../../meta-KtfiBIde.mjs';
5
5
  import 'phecda-core';
@@ -1,5 +1,5 @@
1
1
  import amqplib from 'amqplib';
2
- import { F as Factory } from '../../core-BmJJLUqj.js';
2
+ import { F as Factory } from '../../core-BlN0Spy9.js';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-JVT0mgLD.js';
4
4
  import { T as ToClientMap } from '../../meta-KtfiBIde.js';
5
5
  import 'phecda-core';
@@ -4,24 +4,24 @@
4
4
 
5
5
 
6
6
 
7
- var _chunk7SYPUIBYjs = require('../../chunk-7SYPUIBY.js');
7
+ var _chunkDVTBLV6Ijs = require('../../chunk-DVTBLV6I.js');
8
8
 
9
9
 
10
- var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
10
+ var _chunkTVT62GIXjs = require('../../chunk-TVT62GIX.js');
11
11
 
12
12
  // src/rpc/rabbitmq/bind.ts
13
13
  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 = _chunk7SYPUIBYjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const metaMap = _chunkDVTBLV6Ijs.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
- _chunk7SYPUIBYjs.detectAopDep.call(void 0, meta, {
24
+ _chunkDVTBLV6Ijs.detectAopDep.call(void 0, meta, {
25
25
  guards: globalGuards,
26
26
  interceptors: globalInterceptors
27
27
  }, "rpc");
@@ -44,12 +44,12 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
44
44
  }
45
45
  }
46
46
  }
47
- _chunkGHFSIZUOjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
47
+ _chunkTVT62GIXjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
48
48
  async function handleRequest(msg) {
49
49
  function send(queue, data) {
50
50
  ch.sendToQueue(queue, Buffer.from(JSON.stringify(data)));
51
51
  }
52
- _chunkGHFSIZUOjs.__name.call(void 0, send, "send");
52
+ _chunkTVT62GIXjs.__name.call(void 0, send, "send");
53
53
  if (msg) {
54
54
  const data = JSON.parse(msg.content.toString());
55
55
  const { tag, func, id, queue: clientQueue, _ps, args } = data;
@@ -57,7 +57,7 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
57
57
  debug(`invoke method "${func}" in module "${tag}"`);
58
58
  const meta2 = metaMap.get(tag)[func];
59
59
  const { data: { rpc: { isEvent } = {} } } = meta2;
60
- const context = new (0, _chunk7SYPUIBYjs.Context)({
60
+ const context = new (0, _chunkDVTBLV6Ijs.Context)({
61
61
  type: "rabbitmq",
62
62
  moduleMap,
63
63
  meta: meta2,
@@ -89,14 +89,14 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
89
89
  });
90
90
  }
91
91
  }
92
- _chunkGHFSIZUOjs.__name.call(void 0, handleRequest, "handleRequest");
92
+ _chunkTVT62GIXjs.__name.call(void 0, handleRequest, "handleRequest");
93
93
  subscribeQueues();
94
- _chunk7SYPUIBYjs.HMR.call(void 0, async () => {
94
+ _chunkDVTBLV6Ijs.HMR.call(void 0, async () => {
95
95
  for (const queue of existQueue) await ch.deleteQueue(queue);
96
96
  await subscribeQueues();
97
97
  });
98
98
  }
99
- _chunkGHFSIZUOjs.__name.call(void 0, bind, "bind");
99
+ _chunkTVT62GIXjs.__name.call(void 0, bind, "bind");
100
100
 
101
101
  // src/rpc/rabbitmq/client.ts
102
102
  var _events = require('events');
@@ -105,7 +105,7 @@ async function createClient(ch, controllers, opts) {
105
105
  let eventCount = 0;
106
106
  const ret = {};
107
107
  const emitter = new (0, _events.EventEmitter)();
108
- const clientQueue = _chunk7SYPUIBYjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
108
+ const clientQueue = _chunkDVTBLV6Ijs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
109
109
  await ch.assertQueue(clientQueue);
110
110
  ch.consume(clientQueue, (msg) => {
111
111
  if (!msg) return;
@@ -150,7 +150,7 @@ async function createClient(ch, controllers, opts) {
150
150
  if (error) reject(data);
151
151
  else resolve(data);
152
152
  }
153
- _chunkGHFSIZUOjs.__name.call(void 0, listener, "listener");
153
+ _chunkTVT62GIXjs.__name.call(void 0, listener, "listener");
154
154
  eventCount++;
155
155
  emitter.once(id, listener);
156
156
  });
@@ -160,7 +160,7 @@ async function createClient(ch, controllers, opts) {
160
160
  }
161
161
  return ret;
162
162
  }
163
- _chunkGHFSIZUOjs.__name.call(void 0, createClient, "createClient");
163
+ _chunkTVT62GIXjs.__name.call(void 0, createClient, "createClient");
164
164
 
165
165
 
166
166
 
@@ -4,10 +4,10 @@ import {
4
4
  createControllerMetaMap,
5
5
  detectAopDep,
6
6
  genClientQueue
7
- } from "../../chunk-WXFZZZRY.mjs";
7
+ } from "../../chunk-2CFYUXPM.mjs";
8
8
  import {
9
9
  __name
10
- } from "../../chunk-UXD62LGG.mjs";
10
+ } from "../../chunk-G7TD2VB7.mjs";
11
11
 
12
12
  // src/rpc/rabbitmq/bind.ts
13
13
  import Debug from "debug";
@@ -1,5 +1,5 @@
1
1
  import Redis from 'ioredis';
2
- import { F as Factory } from '../../core-2SNw8m2B.mjs';
2
+ import { F as Factory } from '../../core-P1CsH6jz.mjs';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-t9D1fU6G.mjs';
4
4
  import { T as ToClientMap } from '../../meta-KtfiBIde.mjs';
5
5
  import 'phecda-core';
@@ -1,5 +1,5 @@
1
1
  import Redis from 'ioredis';
2
- import { F as Factory } from '../../core-BmJJLUqj.js';
2
+ import { F as Factory } from '../../core-BlN0Spy9.js';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-JVT0mgLD.js';
4
4
  import { T as ToClientMap } from '../../meta-KtfiBIde.js';
5
5
  import 'phecda-core';
@@ -4,24 +4,24 @@
4
4
 
5
5
 
6
6
 
7
- var _chunk7SYPUIBYjs = require('../../chunk-7SYPUIBY.js');
7
+ var _chunkDVTBLV6Ijs = require('../../chunk-DVTBLV6I.js');
8
8
 
9
9
 
10
- var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
10
+ var _chunkTVT62GIXjs = require('../../chunk-TVT62GIX.js');
11
11
 
12
12
  // src/rpc/redis/bind.ts
13
13
  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 = _chunk7SYPUIBYjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const metaMap = _chunkDVTBLV6Ijs.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
- _chunk7SYPUIBYjs.detectAopDep.call(void 0, meta, {
24
+ _chunkDVTBLV6Ijs.detectAopDep.call(void 0, meta, {
25
25
  guards: globalGuards,
26
26
  interceptors: globalInterceptors
27
27
  }, "rpc");
@@ -41,7 +41,7 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
41
41
  }
42
42
  }
43
43
  }
44
- _chunkGHFSIZUOjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
44
+ _chunkTVT62GIXjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
45
45
  sub.on("message", async (channel, msg) => {
46
46
  if (!existQueue.has(channel)) return;
47
47
  if (msg) {
@@ -51,7 +51,7 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
51
51
  if (_ps !== 1) return;
52
52
  const meta2 = metaMap.get(tag)[func];
53
53
  const { data: { rpc: { isEvent } = {} } } = meta2;
54
- const context = new (0, _chunk7SYPUIBYjs.Context)({
54
+ const context = new (0, _chunkDVTBLV6Ijs.Context)({
55
55
  type: "redis",
56
56
  moduleMap,
57
57
  redis: sub,
@@ -87,12 +87,12 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
87
87
  }
88
88
  });
89
89
  subscribeQueues();
90
- _chunk7SYPUIBYjs.HMR.call(void 0, async () => {
90
+ _chunkDVTBLV6Ijs.HMR.call(void 0, async () => {
91
91
  for (const queue of existQueue) await sub.unsubscribe(queue);
92
92
  subscribeQueues();
93
93
  });
94
94
  }
95
- _chunkGHFSIZUOjs.__name.call(void 0, bind, "bind");
95
+ _chunkTVT62GIXjs.__name.call(void 0, bind, "bind");
96
96
 
97
97
  // src/rpc/redis/client.ts
98
98
  var _events = require('events'); var _events2 = _interopRequireDefault(_events);
@@ -101,7 +101,7 @@ async function createClient({ pub, sub }, controllers, opts) {
101
101
  let eventId = 1;
102
102
  let eventCount = 0;
103
103
  const emitter = new (0, _events2.default)();
104
- const clientQueue = _chunk7SYPUIBYjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
104
+ const clientQueue = _chunkDVTBLV6Ijs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
105
105
  await sub.subscribe(clientQueue);
106
106
  for (const i in controllers) {
107
107
  ret[i] = new Proxy(new controllers[i](), {
@@ -141,7 +141,7 @@ async function createClient({ pub, sub }, controllers, opts) {
141
141
  if (error) reject(data);
142
142
  else resolve(data);
143
143
  }
144
- _chunkGHFSIZUOjs.__name.call(void 0, listener, "listener");
144
+ _chunkTVT62GIXjs.__name.call(void 0, listener, "listener");
145
145
  eventCount++;
146
146
  emitter.once(id, listener);
147
147
  });
@@ -157,7 +157,7 @@ async function createClient({ pub, sub }, controllers, opts) {
157
157
  });
158
158
  return ret;
159
159
  }
160
- _chunkGHFSIZUOjs.__name.call(void 0, createClient, "createClient");
160
+ _chunkTVT62GIXjs.__name.call(void 0, createClient, "createClient");
161
161
 
162
162
 
163
163
 
@@ -4,10 +4,10 @@ import {
4
4
  createControllerMetaMap,
5
5
  detectAopDep,
6
6
  genClientQueue
7
- } from "../../chunk-WXFZZZRY.mjs";
7
+ } from "../../chunk-2CFYUXPM.mjs";
8
8
  import {
9
9
  __name
10
- } from "../../chunk-UXD62LGG.mjs";
10
+ } from "../../chunk-G7TD2VB7.mjs";
11
11
 
12
12
  // src/rpc/redis/bind.ts
13
13
  import Debug from "debug";
@@ -1,7 +1,7 @@
1
1
  import { Elysia as Elysia$1, Context, LocalHook, InputSchema, RouteSchema, SingletonBase } from 'elysia';
2
2
  import { BaseMacro } from 'elysia/dist/types';
3
3
  import { H as HttpContext, a as HttpOptions } from '../../types-BvD3B5Ny.mjs';
4
- import { F as Factory } from '../../core-2SNw8m2B.mjs';
4
+ import { F as Factory } from '../../core-P1CsH6jz.mjs';
5
5
  import 'node:http';
6
6
  import '../../meta-KtfiBIde.mjs';
7
7
  import 'phecda-core';
@@ -1,7 +1,7 @@
1
1
  import { Elysia as Elysia$1, Context, LocalHook, InputSchema, RouteSchema, SingletonBase } from 'elysia';
2
2
  import { BaseMacro } from 'elysia/dist/types';
3
3
  import { H as HttpContext, a as HttpOptions } from '../../types-DIw7B6Up.js';
4
- import { F as Factory } from '../../core-BmJJLUqj.js';
4
+ import { F as Factory } from '../../core-BlN0Spy9.js';
5
5
  import 'node:http';
6
6
  import '../../meta-KtfiBIde.js';
7
7
  import 'phecda-core';
@@ -1,16 +1,16 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkXCND2QW3js = require('../../chunk-XCND2QW3.js');
3
+ var _chunkJDV2XJYEjs = require('../../chunk-JDV2XJYE.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
- var _chunk7SYPUIBYjs = require('../../chunk-7SYPUIBY.js');
10
+ var _chunkDVTBLV6Ijs = require('../../chunk-DVTBLV6I.js');
11
11
 
12
12
 
13
- var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
13
+ var _chunkTVT62GIXjs = require('../../chunk-TVT62GIX.js');
14
14
 
15
15
  // src/server/elysia/bind.ts
16
16
  var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
@@ -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 = _chunk7SYPUIBYjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
+ const metaMap = _chunkDVTBLV6Ijs.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
- _chunk7SYPUIBYjs.detectAopDep.call(void 0, meta, {
29
+ _chunkDVTBLV6Ijs.detectAopDep.call(void 0, meta, {
30
30
  plugins: [
31
31
  ...globalPlugins,
32
32
  ...parallelPlugins
@@ -36,27 +36,27 @@ function bind(app, data, opts = {}) {
36
36
  });
37
37
  registerRoute();
38
38
  async function registerRoute() {
39
- _chunk7SYPUIBYjs.Context.usePlugin(globalPlugins, "elysia").forEach((p) => p(app));
39
+ _chunkDVTBLV6Ijs.Context.usePlugin(globalPlugins, "elysia").forEach((p) => p(app));
40
40
  const parallelRouter = new (0, _elysia.Elysia)();
41
- _chunk7SYPUIBYjs.Context.usePlugin(parallelPlugins, "elysia").forEach((p) => p(parallelRouter));
41
+ _chunkDVTBLV6Ijs.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 _chunk7SYPUIBYjs.Context.filterRecord.default(e);
46
+ const error = await _chunkDVTBLV6Ijs.Context.filterRecord.default(e);
47
47
  c.set.status = error.status;
48
48
  return error;
49
49
  }
50
- _chunkGHFSIZUOjs.__name.call(void 0, errorHandler, "errorHandler");
51
- if (!Array.isArray(body)) return errorHandler(new (0, _chunk7SYPUIBYjs.BadRequestException)("data format should be an array"));
50
+ _chunkTVT62GIXjs.__name.call(void 0, errorHandler, "errorHandler");
51
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkDVTBLV6Ijs.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
- if (!metaMap.has(tag)) return resolve(await _chunk7SYPUIBYjs.Context.filterRecord.default(new (0, _chunk7SYPUIBYjs.BadRequestException)(`module "${tag}" doesn't exist`)));
57
+ if (!metaMap.has(tag)) return resolve(await _chunkDVTBLV6Ijs.Context.filterRecord.default(new (0, _chunkDVTBLV6Ijs.BadRequestException)(`module "${tag}" doesn't exist`)));
58
58
  const meta2 = metaMap.get(tag)[func];
59
- if (!meta2) return resolve(await _chunk7SYPUIBYjs.Context.filterRecord.default(new (0, _chunk7SYPUIBYjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
59
+ if (!meta2) return resolve(await _chunkDVTBLV6Ijs.Context.filterRecord.default(new (0, _chunkDVTBLV6Ijs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
60
60
  const { data: { params } } = meta2;
61
61
  const contextData = {
62
62
  type: "elysia",
@@ -68,24 +68,24 @@ function bind(app, data, opts = {}) {
68
68
  tag,
69
69
  func,
70
70
  app,
71
- ..._chunk7SYPUIBYjs.argToReq.call(void 0, params, item.args, c.headers),
72
- getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
73
- setCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
71
+ ..._chunkDVTBLV6Ijs.argToReq.call(void 0, params, item.args, c.headers),
72
+ getCookie: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
73
+ setCookie: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
74
74
  ...opts2,
75
75
  value
76
76
  }), "setCookie"),
77
- delCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
78
- redirect: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
79
- setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
80
- setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
81
- getRequest: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, () => {
77
+ delCookie: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
78
+ redirect: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
79
+ setResHeaders: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
80
+ setResStatus: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
81
+ getRequest: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, () => {
82
82
  throw new Error("elysia can't support getRequest");
83
83
  }, "getRequest"),
84
- getResponse: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, () => {
84
+ getResponse: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, () => {
85
85
  throw new Error("elysia can't support getResponse");
86
86
  }, "getResponse")
87
87
  };
88
- const context = new (0, _chunk7SYPUIBYjs.Context)(contextData);
88
+ const context = new (0, _chunkDVTBLV6Ijs.Context)(contextData);
89
89
  context.run({
90
90
  globalGuards,
91
91
  globalInterceptors,
@@ -108,7 +108,7 @@ function bind(app, data, opts = {}) {
108
108
  const { data: { define, plugins, http } } = meta2;
109
109
  const funcRouter = new (0, _elysia.Elysia)();
110
110
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
111
- _chunk7SYPUIBYjs.Context.usePlugin(plugins, "elysia").forEach((p) => p(funcRouter));
111
+ _chunkDVTBLV6Ijs.Context.usePlugin(plugins, "elysia").forEach((p) => p(funcRouter));
112
112
  funcRouter[http.type](http.prefix + http.route, async (c) => {
113
113
  debug(`invoke method "${func}" in module "${tag}"`);
114
114
  const contextData = {
@@ -123,23 +123,23 @@ function bind(app, data, opts = {}) {
123
123
  params: c.params,
124
124
  headers: c.headers,
125
125
  app,
126
- getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
127
- setCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
126
+ getCookie: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
127
+ setCookie: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
128
128
  ...opts2,
129
129
  value
130
130
  }), "setCookie"),
131
- delCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
132
- redirect: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
133
- setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
134
- setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
135
- getRequest: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, () => {
131
+ delCookie: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, (key) => c.cookie[key].remove(), "delCookie"),
132
+ redirect: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
133
+ setResHeaders: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
134
+ setResStatus: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus"),
135
+ getRequest: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, () => {
136
136
  throw new Error("elysia can't support getRequest");
137
137
  }, "getRequest"),
138
- getResponse: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, () => {
138
+ getResponse: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, () => {
139
139
  throw new Error("elysia can't support getResponse");
140
140
  }, "getResponse")
141
141
  };
142
- const context = new (0, _chunk7SYPUIBYjs.Context)(contextData);
142
+ const context = new (0, _chunkDVTBLV6Ijs.Context)(contextData);
143
143
  if (http.headers) c.set.headers = http.headers;
144
144
  return context.run({
145
145
  globalGuards,
@@ -155,13 +155,13 @@ function bind(app, data, opts = {}) {
155
155
  }
156
156
  }
157
157
  }
158
- _chunkGHFSIZUOjs.__name.call(void 0, registerRoute, "registerRoute");
158
+ _chunkTVT62GIXjs.__name.call(void 0, registerRoute, "registerRoute");
159
159
  }
160
- _chunkGHFSIZUOjs.__name.call(void 0, bind, "bind");
160
+ _chunkTVT62GIXjs.__name.call(void 0, bind, "bind");
161
161
  function Elysia(opts) {
162
- return _chunkXCND2QW3js.Define.call(void 0, "elysia", opts);
162
+ return _chunkJDV2XJYEjs.Define.call(void 0, "elysia", opts);
163
163
  }
164
- _chunkGHFSIZUOjs.__name.call(void 0, Elysia, "Elysia");
164
+ _chunkTVT62GIXjs.__name.call(void 0, Elysia, "Elysia");
165
165
 
166
166
 
167
167
 
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  Define
3
- } from "../../chunk-F3W3NN7F.mjs";
3
+ } from "../../chunk-J7B24YSE.mjs";
4
4
  import {
5
5
  BadRequestException,
6
6
  Context,
7
7
  argToReq,
8
8
  createControllerMetaMap,
9
9
  detectAopDep
10
- } from "../../chunk-WXFZZZRY.mjs";
10
+ } from "../../chunk-2CFYUXPM.mjs";
11
11
  import {
12
12
  __name
13
- } from "../../chunk-UXD62LGG.mjs";
13
+ } from "../../chunk-G7TD2VB7.mjs";
14
14
 
15
15
  // src/server/elysia/bind.ts
16
16
  import Debug from "debug";
@@ -1,6 +1,6 @@
1
1
  import { Request, Response, Router, RequestHandler } from 'express';
2
2
  import { H as HttpContext, a as HttpOptions } from '../../types-BvD3B5Ny.mjs';
3
- import { F as Factory } from '../../core-2SNw8m2B.mjs';
3
+ import { F as Factory } from '../../core-P1CsH6jz.mjs';
4
4
  import 'node:http';
5
5
  import '../../meta-KtfiBIde.mjs';
6
6
  import 'phecda-core';
@@ -1,6 +1,6 @@
1
1
  import { Request, Response, Router, RequestHandler } from 'express';
2
2
  import { H as HttpContext, a as HttpOptions } from '../../types-DIw7B6Up.js';
3
- import { F as Factory } from '../../core-BmJJLUqj.js';
3
+ import { F as Factory } from '../../core-BlN0Spy9.js';
4
4
  import 'node:http';
5
5
  import '../../meta-KtfiBIde.js';
6
6
  import 'phecda-core';