phecda-server 5.3.3 → 6.0.1

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 (69) hide show
  1. package/dist/chunk-F3W3NN7F.mjs +238 -0
  2. package/dist/{chunk-ECSI4QBK.mjs → chunk-HDQAT2IM.mjs} +55 -65
  3. package/dist/{chunk-3D7AROG2.js → chunk-LYEZ6RGX.js} +54 -64
  4. package/dist/{chunk-RZ7IXJYQ.js → chunk-TZYATAJX.js} +12 -30
  5. package/dist/chunk-XCND2QW3.js +238 -0
  6. package/dist/{chunk-3IPYLGY2.mjs → chunk-YUXERDQ6.mjs} +13 -31
  7. package/dist/{core-dx9E5x2N.d.ts → core-Blq8frmr.d.ts} +4 -3
  8. package/dist/{core-Bc2ENEHX.d.mts → core-D2oL8Ge0.d.mts} +4 -3
  9. package/dist/helper.js +2 -2
  10. package/dist/helper.mjs +1 -1
  11. package/dist/index.d.mts +10 -10
  12. package/dist/index.d.ts +10 -10
  13. package/dist/index.js +29 -27
  14. package/dist/index.mjs +9 -7
  15. package/dist/rpc/bullmq/index.d.mts +1 -1
  16. package/dist/rpc/bullmq/index.d.ts +1 -1
  17. package/dist/rpc/bullmq/index.js +6 -6
  18. package/dist/rpc/bullmq/index.mjs +1 -1
  19. package/dist/rpc/kafka/index.d.mts +1 -1
  20. package/dist/rpc/kafka/index.d.ts +1 -1
  21. package/dist/rpc/kafka/index.js +5 -5
  22. package/dist/rpc/kafka/index.mjs +1 -1
  23. package/dist/rpc/nats/index.d.mts +1 -1
  24. package/dist/rpc/nats/index.d.ts +1 -1
  25. package/dist/rpc/nats/index.js +5 -5
  26. package/dist/rpc/nats/index.mjs +1 -1
  27. package/dist/rpc/rabbitmq/index.d.mts +1 -1
  28. package/dist/rpc/rabbitmq/index.d.ts +1 -1
  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.mts +1 -1
  32. package/dist/rpc/redis/index.d.ts +1 -1
  33. package/dist/rpc/redis/index.js +6 -6
  34. package/dist/rpc/redis/index.mjs +1 -1
  35. package/dist/server/elysia/index.d.mts +1 -1
  36. package/dist/server/elysia/index.d.ts +1 -1
  37. package/dist/server/elysia/index.js +15 -15
  38. package/dist/server/elysia/index.mjs +2 -2
  39. package/dist/server/express/index.d.mts +1 -1
  40. package/dist/server/express/index.d.ts +1 -1
  41. package/dist/server/express/index.js +14 -14
  42. package/dist/server/express/index.mjs +1 -1
  43. package/dist/server/fastify/index.d.mts +1 -1
  44. package/dist/server/fastify/index.d.ts +1 -1
  45. package/dist/server/fastify/index.js +15 -15
  46. package/dist/server/fastify/index.mjs +2 -2
  47. package/dist/server/h3/index.d.mts +1 -1
  48. package/dist/server/h3/index.d.ts +1 -1
  49. package/dist/server/h3/index.js +12 -12
  50. package/dist/server/h3/index.mjs +1 -1
  51. package/dist/server/hono/index.d.mts +1 -1
  52. package/dist/server/hono/index.d.ts +1 -1
  53. package/dist/server/hono/index.js +13 -13
  54. package/dist/server/hono/index.mjs +1 -1
  55. package/dist/server/hyper-express/index.d.mts +1 -1
  56. package/dist/server/hyper-express/index.d.ts +1 -1
  57. package/dist/server/hyper-express/index.js +13 -13
  58. package/dist/server/hyper-express/index.mjs +1 -1
  59. package/dist/server/koa/index.d.mts +1 -1
  60. package/dist/server/koa/index.d.ts +1 -1
  61. package/dist/server/koa/index.js +14 -14
  62. package/dist/server/koa/index.mjs +1 -1
  63. package/dist/test.d.mts +1 -1
  64. package/dist/test.d.ts +1 -1
  65. package/dist/test.js +2 -2
  66. package/dist/test.mjs +1 -1
  67. package/package.json +2 -2
  68. package/dist/chunk-2HVTWYS2.js +0 -279
  69. package/dist/chunk-SXOZVIKW.mjs +0 -279
package/dist/index.mjs CHANGED
@@ -2,8 +2,9 @@ import {
2
2
  Factory,
3
3
  Meta,
4
4
  createPhecda,
5
- emitter
6
- } from "./chunk-ECSI4QBK.mjs";
5
+ emitter,
6
+ isObject
7
+ } from "./chunk-HDQAT2IM.mjs";
7
8
  import {
8
9
  Arg,
9
10
  BaseParam,
@@ -12,7 +13,6 @@ import {
12
13
  Ctx,
13
14
  Define,
14
15
  Delete,
15
- Event,
16
16
  Filter,
17
17
  Get,
18
18
  Guard,
@@ -28,8 +28,9 @@ import {
28
28
  Query,
29
29
  Queue,
30
30
  Route,
31
- Rpc
32
- } from "./chunk-SXOZVIKW.mjs";
31
+ Rpc,
32
+ Search
33
+ } from "./chunk-F3W3NN7F.mjs";
33
34
  import {
34
35
  BadGatewayException,
35
36
  BadRequestException,
@@ -55,7 +56,7 @@ import {
55
56
  addPipe,
56
57
  addPlugin,
57
58
  defaultPipe
58
- } from "./chunk-3IPYLGY2.mjs";
59
+ } from "./chunk-YUXERDQ6.mjs";
59
60
  import {
60
61
  ERROR_SYMBOL,
61
62
  IS_HMR,
@@ -357,7 +358,6 @@ export {
357
358
  Define,
358
359
  Delete,
359
360
  ERROR_SYMBOL,
360
- Event,
361
361
  Exception,
362
362
  Factory,
363
363
  Filter,
@@ -399,6 +399,7 @@ export {
399
399
  Route,
400
400
  Rpc,
401
401
  RpcBase,
402
+ Search,
402
403
  ServerBase,
403
404
  ServiceUnavailableException,
404
405
  TimeoutException,
@@ -416,6 +417,7 @@ export {
416
417
  createPhecda,
417
418
  defaultPipe,
418
419
  emitter,
420
+ isObject,
419
421
  log,
420
422
  setLogger
421
423
  };
@@ -1,5 +1,5 @@
1
1
  import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
2
- import { F as Factory } from '../../core-Bc2ENEHX.mjs';
2
+ import { F as Factory } from '../../core-D2oL8Ge0.mjs';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-AgVwUXPC.mjs';
4
4
  import { T as ToClientMap } from '../../types-BlIBlnVT.mjs';
5
5
  import 'phecda-core';
@@ -1,5 +1,5 @@
1
1
  import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
2
- import { F as Factory } from '../../core-dx9E5x2N.js';
2
+ import { F as Factory } from '../../core-Blq8frmr.js';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-B-ZFZajI.js';
4
4
  import { T as ToClientMap } from '../../types-BlIBlnVT.js';
5
5
  import 'phecda-core';
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkRZ7IXJYQjs = require('../../chunk-RZ7IXJYQ.js');
7
+ var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
8
8
 
9
9
 
10
10
  var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
@@ -18,14 +18,14 @@ async function create({ moduleMap, meta }, opts = {}) {
18
18
  const workerMap = {};
19
19
  const queueMap = {};
20
20
  const existQueue = /* @__PURE__ */ new Set();
21
- const metaMap = _chunkRZ7IXJYQjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
+ const metaMap = _chunkTZYATAJXjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
22
  const { controller, rpc, func, tag } = meta2.data;
23
23
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
24
24
  debug(`register method "${func}" in module "${tag}"`);
25
25
  return true;
26
26
  }
27
27
  });
28
- _chunkRZ7IXJYQjs.detectAopDep.call(void 0, meta, {
28
+ _chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
29
29
  guards: globalGuards,
30
30
  interceptors: globalInterceptors
31
31
  }, "rpc");
@@ -53,7 +53,7 @@ async function create({ moduleMap, meta }, opts = {}) {
53
53
  const meta2 = metaMap.get(tag)[func];
54
54
  const { data: { rpc: { isEvent } = {} } } = meta2;
55
55
  if (!isEvent && !(clientQueue in queueMap)) queueMap[clientQueue] = new (0, _bullmq.Queue)(clientQueue, queueOpts);
56
- const context = new (0, _chunkRZ7IXJYQjs.Context)({
56
+ const context = new (0, _chunkTZYATAJXjs.Context)({
57
57
  type: "bullmq",
58
58
  moduleMap,
59
59
  meta: meta2,
@@ -87,7 +87,7 @@ async function create({ moduleMap, meta }, opts = {}) {
87
87
  }
88
88
  _chunkGHFSIZUOjs.__name.call(void 0, handleRequest, "handleRequest");
89
89
  subscribeQueues();
90
- _chunkRZ7IXJYQjs.HMR.call(void 0, async () => {
90
+ _chunkTZYATAJXjs.HMR.call(void 0, async () => {
91
91
  for (const i in workerMap) await workerMap[i].close(true);
92
92
  for (const i in queueMap) await queueMap[i].close();
93
93
  await subscribeQueues();
@@ -108,7 +108,7 @@ async function createClient(controllers, opts = {}) {
108
108
  const { max, workerOpts, queueOpts, timeout, key } = opts;
109
109
  const ret = {};
110
110
  const emitter = new (0, _events.EventEmitter)();
111
- const clientQueue = _chunkRZ7IXJYQjs.genClientQueue.call(void 0, key);
111
+ const clientQueue = _chunkTZYATAJXjs.genClientQueue.call(void 0, key);
112
112
  const queueMap = {};
113
113
  new (0, _bullmq.Worker)(clientQueue, async (job) => {
114
114
  const { data, id, error } = job.data;
@@ -4,7 +4,7 @@ import {
4
4
  createControllerMetaMap,
5
5
  detectAopDep,
6
6
  genClientQueue
7
- } from "../../chunk-3IPYLGY2.mjs";
7
+ } from "../../chunk-YUXERDQ6.mjs";
8
8
  import {
9
9
  __name
10
10
  } from "../../chunk-UXD62LGG.mjs";
@@ -1,5 +1,5 @@
1
1
  import { Consumer, Producer } from 'kafkajs';
2
- import { F as Factory } from '../../core-Bc2ENEHX.mjs';
2
+ import { F as Factory } from '../../core-D2oL8Ge0.mjs';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-AgVwUXPC.mjs';
4
4
  import { T as ToClientMap } from '../../types-BlIBlnVT.mjs';
5
5
  import 'phecda-core';
@@ -1,5 +1,5 @@
1
1
  import { Consumer, Producer } from 'kafkajs';
2
- import { F as Factory } from '../../core-dx9E5x2N.js';
2
+ import { F as Factory } from '../../core-Blq8frmr.js';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-B-ZFZajI.js';
4
4
  import { T as ToClientMap } from '../../types-BlIBlnVT.js';
5
5
  import 'phecda-core';
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkRZ7IXJYQjs = require('../../chunk-RZ7IXJYQ.js');
6
+ var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
7
7
 
8
8
 
9
9
  var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
@@ -14,14 +14,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/kafka");
14
14
  async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
15
15
  const { globalGuards, globalInterceptors, globalFilter, globalPipe } = opts;
16
16
  const existQueue = /* @__PURE__ */ new Set();
17
- const metaMap = _chunkRZ7IXJYQjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const metaMap = _chunkTZYATAJXjs.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
- _chunkRZ7IXJYQjs.detectAopDep.call(void 0, meta, {
24
+ _chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
25
25
  guards: globalGuards,
26
26
  interceptors: globalInterceptors
27
27
  }, "rpc");
@@ -55,7 +55,7 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
55
55
  const meta2 = metaMap.get(tag)[func];
56
56
  const { data: { rpc } } = meta2;
57
57
  const isEvent = rpc.isEvent;
58
- const context = new (0, _chunkRZ7IXJYQjs.Context)({
58
+ const context = new (0, _chunkTZYATAJXjs.Context)({
59
59
  type: "kafka",
60
60
  moduleMap,
61
61
  meta: meta2,
@@ -117,7 +117,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
117
117
  let eventCount = 1;
118
118
  const ret = {};
119
119
  const emitter = new (0, _events.EventEmitter)();
120
- const clientQueue = _chunkRZ7IXJYQjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
120
+ const clientQueue = _chunkTZYATAJXjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
121
121
  await consumer.subscribe({
122
122
  topic: clientQueue,
123
123
  fromBeginning: true
@@ -3,7 +3,7 @@ import {
3
3
  createControllerMetaMap,
4
4
  detectAopDep,
5
5
  genClientQueue
6
- } from "../../chunk-3IPYLGY2.mjs";
6
+ } from "../../chunk-YUXERDQ6.mjs";
7
7
  import {
8
8
  __name
9
9
  } from "../../chunk-UXD62LGG.mjs";
@@ -1,5 +1,5 @@
1
1
  import { NatsConnection } from 'nats';
2
- import { F as Factory } from '../../core-Bc2ENEHX.mjs';
2
+ import { F as Factory } from '../../core-D2oL8Ge0.mjs';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-AgVwUXPC.mjs';
4
4
  import { T as ToClientMap } from '../../types-BlIBlnVT.mjs';
5
5
  import 'phecda-core';
@@ -1,5 +1,5 @@
1
1
  import { NatsConnection } from 'nats';
2
- import { F as Factory } from '../../core-dx9E5x2N.js';
2
+ import { F as Factory } from '../../core-Blq8frmr.js';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-B-ZFZajI.js';
4
4
  import { T as ToClientMap } from '../../types-BlIBlnVT.js';
5
5
  import 'phecda-core';
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkRZ7IXJYQjs = require('../../chunk-RZ7IXJYQ.js');
6
+ var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
7
7
 
8
8
 
9
9
  var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.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 = _chunkRZ7IXJYQjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
20
+ const metaMap = _chunkTZYATAJXjs.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
- _chunkRZ7IXJYQjs.detectAopDep.call(void 0, meta, {
27
+ _chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
28
28
  guards: globalGuards,
29
29
  interceptors: globalInterceptors
30
30
  }, "rpc");
@@ -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, _chunkRZ7IXJYQjs.Context)({
58
+ const context = new (0, _chunkTZYATAJXjs.Context)({
59
59
  type: "nats",
60
60
  moduleMap,
61
61
  meta: meta2,
@@ -88,7 +88,7 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
88
88
  }
89
89
  _chunkGHFSIZUOjs.__name.call(void 0, handleRequest, "handleRequest");
90
90
  subscribeQueues();
91
- _chunkRZ7IXJYQjs.HMR.call(void 0, async () => {
91
+ _chunkTZYATAJXjs.HMR.call(void 0, async () => {
92
92
  for (const i in subscriptionMap) subscriptionMap[i].unsubscribe();
93
93
  await subscribeQueues();
94
94
  });
@@ -3,7 +3,7 @@ import {
3
3
  HMR,
4
4
  createControllerMetaMap,
5
5
  detectAopDep
6
- } from "../../chunk-3IPYLGY2.mjs";
6
+ } from "../../chunk-YUXERDQ6.mjs";
7
7
  import {
8
8
  __name
9
9
  } from "../../chunk-UXD62LGG.mjs";
@@ -1,5 +1,5 @@
1
1
  import amqplib from 'amqplib';
2
- import { F as Factory } from '../../core-Bc2ENEHX.mjs';
2
+ import { F as Factory } from '../../core-D2oL8Ge0.mjs';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-AgVwUXPC.mjs';
4
4
  import { T as ToClientMap } from '../../types-BlIBlnVT.mjs';
5
5
  import 'phecda-core';
@@ -1,5 +1,5 @@
1
1
  import amqplib from 'amqplib';
2
- import { F as Factory } from '../../core-dx9E5x2N.js';
2
+ import { F as Factory } from '../../core-Blq8frmr.js';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-B-ZFZajI.js';
4
4
  import { T as ToClientMap } from '../../types-BlIBlnVT.js';
5
5
  import 'phecda-core';
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkRZ7IXJYQjs = require('../../chunk-RZ7IXJYQ.js');
7
+ var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
8
8
 
9
9
 
10
10
  var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.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 = _chunkRZ7IXJYQjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const metaMap = _chunkTZYATAJXjs.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
- _chunkRZ7IXJYQjs.detectAopDep.call(void 0, meta, {
24
+ _chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
25
25
  guards: globalGuards,
26
26
  interceptors: globalInterceptors
27
27
  }, "rpc");
@@ -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, _chunkRZ7IXJYQjs.Context)({
60
+ const context = new (0, _chunkTZYATAJXjs.Context)({
61
61
  type: "rabbitmq",
62
62
  moduleMap,
63
63
  meta: meta2,
@@ -91,7 +91,7 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
91
91
  }
92
92
  _chunkGHFSIZUOjs.__name.call(void 0, handleRequest, "handleRequest");
93
93
  subscribeQueues();
94
- _chunkRZ7IXJYQjs.HMR.call(void 0, async () => {
94
+ _chunkTZYATAJXjs.HMR.call(void 0, async () => {
95
95
  for (const queue of existQueue) await ch.deleteQueue(queue);
96
96
  await subscribeQueues();
97
97
  });
@@ -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 = _chunkRZ7IXJYQjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
108
+ const clientQueue = _chunkTZYATAJXjs.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;
@@ -4,7 +4,7 @@ import {
4
4
  createControllerMetaMap,
5
5
  detectAopDep,
6
6
  genClientQueue
7
- } from "../../chunk-3IPYLGY2.mjs";
7
+ } from "../../chunk-YUXERDQ6.mjs";
8
8
  import {
9
9
  __name
10
10
  } from "../../chunk-UXD62LGG.mjs";
@@ -1,5 +1,5 @@
1
1
  import Redis from 'ioredis';
2
- import { F as Factory } from '../../core-Bc2ENEHX.mjs';
2
+ import { F as Factory } from '../../core-D2oL8Ge0.mjs';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-AgVwUXPC.mjs';
4
4
  import { T as ToClientMap } from '../../types-BlIBlnVT.mjs';
5
5
  import 'phecda-core';
@@ -1,5 +1,5 @@
1
1
  import Redis from 'ioredis';
2
- import { F as Factory } from '../../core-dx9E5x2N.js';
2
+ import { F as Factory } from '../../core-Blq8frmr.js';
3
3
  import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-B-ZFZajI.js';
4
4
  import { T as ToClientMap } from '../../types-BlIBlnVT.js';
5
5
  import 'phecda-core';
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkRZ7IXJYQjs = require('../../chunk-RZ7IXJYQ.js');
7
+ var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
8
8
 
9
9
 
10
10
  var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.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 = _chunkRZ7IXJYQjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const metaMap = _chunkTZYATAJXjs.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
- _chunkRZ7IXJYQjs.detectAopDep.call(void 0, meta, {
24
+ _chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
25
25
  guards: globalGuards,
26
26
  interceptors: globalInterceptors
27
27
  }, "rpc");
@@ -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, _chunkRZ7IXJYQjs.Context)({
54
+ const context = new (0, _chunkTZYATAJXjs.Context)({
55
55
  type: "redis",
56
56
  moduleMap,
57
57
  redis: sub,
@@ -87,7 +87,7 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
87
87
  }
88
88
  });
89
89
  subscribeQueues();
90
- _chunkRZ7IXJYQjs.HMR.call(void 0, async () => {
90
+ _chunkTZYATAJXjs.HMR.call(void 0, async () => {
91
91
  for (const queue of existQueue) await sub.unsubscribe(queue);
92
92
  subscribeQueues();
93
93
  });
@@ -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 = _chunkRZ7IXJYQjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
104
+ const clientQueue = _chunkTZYATAJXjs.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](), {
@@ -4,7 +4,7 @@ import {
4
4
  createControllerMetaMap,
5
5
  detectAopDep,
6
6
  genClientQueue
7
- } from "../../chunk-3IPYLGY2.mjs";
7
+ } from "../../chunk-YUXERDQ6.mjs";
8
8
  import {
9
9
  __name
10
10
  } from "../../chunk-UXD62LGG.mjs";
@@ -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-Dgxirc9f.mjs';
4
- import { F as Factory } from '../../core-Bc2ENEHX.mjs';
4
+ import { F as Factory } from '../../core-D2oL8Ge0.mjs';
5
5
  import 'node:http';
6
6
  import '../../types-BlIBlnVT.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-BCJhmpQh.js';
4
- import { F as Factory } from '../../core-dx9E5x2N.js';
4
+ import { F as Factory } from '../../core-Blq8frmr.js';
5
5
  import 'node:http';
6
6
  import '../../types-BlIBlnVT.js';
7
7
  import 'phecda-core';
@@ -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 _chunk2HVTWYS2js = require('../../chunk-2HVTWYS2.js');
3
+ var _chunkXCND2QW3js = require('../../chunk-XCND2QW3.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
- var _chunkRZ7IXJYQjs = require('../../chunk-RZ7IXJYQ.js');
10
+ var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
11
11
 
12
12
 
13
13
  var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.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 = _chunkRZ7IXJYQjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
+ const metaMap = _chunkTZYATAJXjs.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
- _chunkRZ7IXJYQjs.detectAopDep.call(void 0, meta, {
29
+ _chunkTZYATAJXjs.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
- _chunkRZ7IXJYQjs.Context.usePlugin(globalPlugins, "elysia").forEach((p) => p(app));
39
+ _chunkTZYATAJXjs.Context.usePlugin(globalPlugins, "elysia").forEach((p) => p(app));
40
40
  const parallelRouter = new (0, _elysia.Elysia)();
41
- _chunkRZ7IXJYQjs.Context.usePlugin(parallelPlugins, "elysia").forEach((p) => p(parallelRouter));
41
+ _chunkTZYATAJXjs.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 _chunkRZ7IXJYQjs.Context.filterRecord.default(e);
46
+ const error = await _chunkTZYATAJXjs.Context.filterRecord.default(e);
47
47
  c.set.status = error.status;
48
48
  return error;
49
49
  }
50
50
  _chunkGHFSIZUOjs.__name.call(void 0, errorHandler, "errorHandler");
51
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkRZ7IXJYQjs.BadRequestException)("data format should be an array"));
51
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkTZYATAJXjs.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 _chunkRZ7IXJYQjs.Context.filterRecord.default(new (0, _chunkRZ7IXJYQjs.BadRequestException)(`module "${tag}" doesn't exist`)));
57
+ if (!metaMap.has(tag)) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`module "${tag}" doesn't exist`)));
58
58
  const meta2 = metaMap.get(tag)[func];
59
- if (!meta2) return resolve(await _chunkRZ7IXJYQjs.Context.filterRecord.default(new (0, _chunkRZ7IXJYQjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
59
+ if (!meta2) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
60
60
  const { data: { params } } = meta2;
61
61
  const contextData = {
62
62
  type: "elysia",
@@ -68,7 +68,7 @@ function bind(app, data, opts = {}) {
68
68
  tag,
69
69
  func,
70
70
  app,
71
- ..._chunkRZ7IXJYQjs.argToReq.call(void 0, params, item.args, c.headers),
71
+ ..._chunkTZYATAJXjs.argToReq.call(void 0, params, item.args, c.headers),
72
72
  getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
73
73
  setCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
74
74
  ...opts2,
@@ -79,7 +79,7 @@ function bind(app, data, opts = {}) {
79
79
  setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
80
80
  setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus")
81
81
  };
82
- const context = new (0, _chunkRZ7IXJYQjs.Context)(contextData);
82
+ const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
83
83
  context.run({
84
84
  globalGuards,
85
85
  globalInterceptors,
@@ -102,7 +102,7 @@ function bind(app, data, opts = {}) {
102
102
  const { data: { define, plugins, http } } = meta2;
103
103
  const funcRouter = new (0, _elysia.Elysia)();
104
104
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
105
- _chunkRZ7IXJYQjs.Context.usePlugin(plugins, "elysia").forEach((p) => p(funcRouter));
105
+ _chunkTZYATAJXjs.Context.usePlugin(plugins, "elysia").forEach((p) => p(funcRouter));
106
106
  funcRouter[http.type](http.prefix + http.route, async (c) => {
107
107
  debug(`invoke method "${func}" in module "${tag}"`);
108
108
  const contextData = {
@@ -127,7 +127,7 @@ function bind(app, data, opts = {}) {
127
127
  setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
128
128
  setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus")
129
129
  };
130
- const context = new (0, _chunkRZ7IXJYQjs.Context)(contextData);
130
+ const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
131
131
  if (http.headers) c.set.headers = http.headers;
132
132
  return context.run({
133
133
  globalGuards,
@@ -147,7 +147,7 @@ function bind(app, data, opts = {}) {
147
147
  }
148
148
  _chunkGHFSIZUOjs.__name.call(void 0, bind, "bind");
149
149
  function Elysia(opts) {
150
- return _chunk2HVTWYS2js.Define.call(void 0, "elysia", opts);
150
+ return _chunkXCND2QW3js.Define.call(void 0, "elysia", opts);
151
151
  }
152
152
  _chunkGHFSIZUOjs.__name.call(void 0, Elysia, "Elysia");
153
153
 
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  Define
3
- } from "../../chunk-SXOZVIKW.mjs";
3
+ } from "../../chunk-F3W3NN7F.mjs";
4
4
  import {
5
5
  BadRequestException,
6
6
  Context,
7
7
  argToReq,
8
8
  createControllerMetaMap,
9
9
  detectAopDep
10
- } from "../../chunk-3IPYLGY2.mjs";
10
+ } from "../../chunk-YUXERDQ6.mjs";
11
11
  import {
12
12
  __name
13
13
  } from "../../chunk-UXD62LGG.mjs";
@@ -1,6 +1,6 @@
1
1
  import { Request, Response, Router, RequestHandler } from 'express';
2
2
  import { H as HttpContext, a as HttpOptions } from '../../types-Dgxirc9f.mjs';
3
- import { F as Factory } from '../../core-Bc2ENEHX.mjs';
3
+ import { F as Factory } from '../../core-D2oL8Ge0.mjs';
4
4
  import 'node:http';
5
5
  import '../../types-BlIBlnVT.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-BCJhmpQh.js';
3
- import { F as Factory } from '../../core-dx9E5x2N.js';
3
+ import { F as Factory } from '../../core-Blq8frmr.js';
4
4
  import 'node:http';
5
5
  import '../../types-BlIBlnVT.js';
6
6
  import 'phecda-core';