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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/assets/ps.json +24 -24
  2. package/bin/cli.mjs +12 -7
  3. package/dist/{chunk-P75VKZJY.mjs → chunk-3FHZB3Z5.mjs} +48 -17
  4. package/dist/{chunk-BGXSMOLX.js → chunk-7YQ57BQS.js} +1 -1
  5. package/dist/{chunk-SW5IKE5H.js → chunk-NQIFUZL4.js} +47 -16
  6. package/dist/{chunk-5622RBNB.mjs → chunk-XYVMNY2X.mjs} +1 -1
  7. package/dist/{core-CYwEPfN4.d.ts → core-C1kHRqU9.d.ts} +1 -1
  8. package/dist/{core-BIcUwV18.d.mts → core-CSiaRU7r.d.mts} +1 -1
  9. package/dist/helper.d.mts +1 -1
  10. package/dist/helper.d.ts +1 -1
  11. package/dist/helper.js +2 -2
  12. package/dist/helper.mjs +1 -1
  13. package/dist/http/elysia/index.d.mts +3 -3
  14. package/dist/http/elysia/index.d.ts +3 -3
  15. package/dist/http/elysia/index.js +19 -17
  16. package/dist/http/elysia/index.mjs +3 -1
  17. package/dist/http/express/index.d.mts +3 -3
  18. package/dist/http/express/index.d.ts +3 -3
  19. package/dist/http/express/index.js +19 -17
  20. package/dist/http/express/index.mjs +3 -1
  21. package/dist/http/fastify/index.d.mts +3 -3
  22. package/dist/http/fastify/index.d.ts +3 -3
  23. package/dist/http/fastify/index.js +18 -16
  24. package/dist/http/fastify/index.mjs +3 -1
  25. package/dist/http/h3/index.d.mts +3 -3
  26. package/dist/http/h3/index.d.ts +3 -3
  27. package/dist/http/h3/index.js +18 -16
  28. package/dist/http/h3/index.mjs +3 -1
  29. package/dist/http/hono/index.d.mts +3 -3
  30. package/dist/http/hono/index.d.ts +3 -3
  31. package/dist/http/hono/index.js +17 -15
  32. package/dist/http/hono/index.mjs +3 -1
  33. package/dist/http/hyper-express/index.d.mts +3 -3
  34. package/dist/http/hyper-express/index.d.ts +3 -3
  35. package/dist/http/hyper-express/index.js +17 -15
  36. package/dist/http/hyper-express/index.mjs +3 -1
  37. package/dist/http/koa/index.d.mts +3 -3
  38. package/dist/http/koa/index.d.ts +3 -3
  39. package/dist/http/koa/index.js +19 -17
  40. package/dist/http/koa/index.mjs +3 -1
  41. package/dist/index.d.mts +11 -11
  42. package/dist/index.d.ts +11 -11
  43. package/dist/index.js +21 -21
  44. package/dist/index.mjs +3 -3
  45. package/dist/{meta-BXKLFTgG.d.mts → meta-D1M85Hef.d.mts} +1 -0
  46. package/dist/{meta-BXKLFTgG.d.ts → meta-D1M85Hef.d.ts} +1 -0
  47. package/dist/rpc/bullmq/index.d.mts +3 -3
  48. package/dist/rpc/bullmq/index.d.ts +3 -3
  49. package/dist/rpc/bullmq/index.js +9 -8
  50. package/dist/rpc/bullmq/index.mjs +2 -1
  51. package/dist/rpc/kafka/index.d.mts +3 -3
  52. package/dist/rpc/kafka/index.d.ts +3 -3
  53. package/dist/rpc/kafka/index.js +8 -7
  54. package/dist/rpc/kafka/index.mjs +2 -1
  55. package/dist/rpc/nats/index.d.mts +3 -3
  56. package/dist/rpc/nats/index.d.ts +3 -3
  57. package/dist/rpc/nats/index.js +8 -7
  58. package/dist/rpc/nats/index.mjs +2 -1
  59. package/dist/rpc/rabbitmq/index.d.mts +3 -3
  60. package/dist/rpc/rabbitmq/index.d.ts +3 -3
  61. package/dist/rpc/rabbitmq/index.js +9 -8
  62. package/dist/rpc/rabbitmq/index.mjs +2 -1
  63. package/dist/rpc/redis/index.d.mts +3 -3
  64. package/dist/rpc/redis/index.d.ts +3 -3
  65. package/dist/rpc/redis/index.js +9 -8
  66. package/dist/rpc/redis/index.mjs +2 -1
  67. package/dist/test.d.mts +3 -3
  68. package/dist/test.d.ts +3 -3
  69. package/dist/test.js +2 -2
  70. package/dist/test.mjs +1 -1
  71. package/dist/{types-BtbL49Zs.d.mts → types-C9Remkup.d.ts} +2 -1
  72. package/dist/{types-m3IEDKjP.d.ts → types-JMhFVp-Z.d.mts} +2 -1
  73. package/dist/{types-VFzEM7LL.d.ts → types-ee1FBodH.d.ts} +2 -1
  74. package/dist/{types-h40T3cRG.d.mts → types-wbHHC93P.d.mts} +2 -1
  75. package/package.json +1 -1
  76. package/register/loader.mjs +366 -367
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  emitter,
7
7
  phecdaNamespace,
8
8
  useS
9
- } from "./chunk-5622RBNB.mjs";
9
+ } from "./chunk-XYVMNY2X.mjs";
10
10
  import {
11
11
  Addon,
12
12
  Arg,
@@ -56,7 +56,7 @@ import {
56
56
  addGuard,
57
57
  addPipe,
58
58
  defaultPipe
59
- } from "./chunk-P75VKZJY.mjs";
59
+ } from "./chunk-3FHZB3Z5.mjs";
60
60
  import {
61
61
  ERROR_SYMBOL,
62
62
  IS_HMR,
@@ -308,7 +308,7 @@ var HTTPGenerator = class extends Generator {
308
308
  if (!this.classMap[name]) this.classMap[name] = {};
309
309
  this.classMap[name][func] = `
310
310
  ${func}(...args){
311
- const ret={tag:"${tag}",func:"${func}",body:{},headers:{},query:{},params:{},method:"${http.type}",url:"${url}",args}
311
+ const ret={tag:"${tag}",func:"${func}",body:{},headers:{},query:{},params:{},method:"${http.type}",url:"${url}"}
312
312
 
313
313
  ${params.reduce((p, c, i) => `${p}ret.${c.type}${c.key ? `['${c.key}']` : ""}=args[${i}]
314
314
  ${c.type === "params" ? `ret.url=ret.url.replace('{{${c.key}}}',args[${i}])` : ""}
@@ -37,6 +37,7 @@ interface BaseContext {
37
37
  type: string;
38
38
  tag: string;
39
39
  func: string;
40
+ category: string;
40
41
  [key: string]: any;
41
42
  }
42
43
  interface DefaultOptions {
@@ -37,6 +37,7 @@ interface BaseContext {
37
37
  type: string;
38
38
  tag: string;
39
39
  func: string;
40
+ category: string;
40
41
  [key: string]: any;
41
42
  }
42
43
  interface DefaultOptions {
@@ -1,7 +1,7 @@
1
1
  import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
2
- import { F as Factory } from '../../core-BIcUwV18.mjs';
3
- import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-BtbL49Zs.mjs';
4
- import { T as ToClientMap } from '../../meta-BXKLFTgG.mjs';
2
+ import { F as Factory } from '../../core-CSiaRU7r.mjs';
3
+ import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-JMhFVp-Z.mjs';
4
+ import { T as ToClientMap } from '../../meta-D1M85Hef.mjs';
5
5
  import 'phecda-core';
6
6
 
7
7
  interface BullmqCtx extends RpcContext {
@@ -1,7 +1,7 @@
1
1
  import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
2
- import { F as Factory } from '../../core-CYwEPfN4.js';
3
- import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-m3IEDKjP.js';
4
- import { T as ToClientMap } from '../../meta-BXKLFTgG.js';
2
+ import { F as Factory } from '../../core-C1kHRqU9.js';
3
+ import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-C9Remkup.js';
4
+ import { T as ToClientMap } from '../../meta-D1M85Hef.js';
5
5
  import 'phecda-core';
6
6
 
7
7
  interface BullmqCtx extends RpcContext {
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkSW5IKE5Hjs = require('../../chunk-SW5IKE5H.js');
7
+ var _chunkNQIFUZL4js = require('../../chunk-NQIFUZL4.js');
8
8
 
9
9
 
10
10
  var _chunkJ5CFUN4Vjs = require('../../chunk-J5CFUN4V.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 = _chunkSW5IKE5Hjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
+ const metaMap = _chunkNQIFUZL4js.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
- _chunkSW5IKE5Hjs.detectAopDep.call(void 0, meta, {
28
+ _chunkNQIFUZL4js.detectAopDep.call(void 0, meta, {
29
29
  guards: globalGuards
30
30
  }, "rpc");
31
31
  async function subscribeQueues() {
@@ -39,7 +39,7 @@ async function create({ moduleMap, meta }, opts = {}) {
39
39
  if (existQueue.has(queue)) continue;
40
40
  existQueue.add(queue);
41
41
  workerMap[queue] = new (0, _bullmq.Worker)(queue, handleRequest, workerOpts);
42
- _chunkSW5IKE5Hjs.Context.applyAddons(addons, workerMap[queue], "bullmq");
42
+ _chunkNQIFUZL4js.Context.applyAddons(addons, workerMap[queue], "bullmq");
43
43
  }
44
44
  }
45
45
  }
@@ -53,13 +53,14 @@ 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 aop = _chunkSW5IKE5Hjs.Context.getAop(meta2, {
56
+ const aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
57
57
  globalFilter,
58
58
  globalGuards,
59
59
  globalPipe
60
60
  });
61
- const context = new (0, _chunkSW5IKE5Hjs.Context)({
61
+ const context = new (0, _chunkNQIFUZL4js.Context)({
62
62
  type: "bullmq",
63
+ category: "rpc",
63
64
  moduleMap,
64
65
  meta: meta2,
65
66
  tag,
@@ -87,7 +88,7 @@ async function create({ moduleMap, meta }, opts = {}) {
87
88
  }
88
89
  _chunkJ5CFUN4Vjs.__name.call(void 0, handleRequest, "handleRequest");
89
90
  subscribeQueues();
90
- _chunkSW5IKE5Hjs.HMR.call(void 0, async () => {
91
+ _chunkNQIFUZL4js.HMR.call(void 0, async () => {
91
92
  for (const i in workerMap) await workerMap[i].close(true);
92
93
  for (const i in queueMap) await queueMap[i].close();
93
94
  await subscribeQueues();
@@ -108,7 +109,7 @@ async function createClient(controllers, opts = {}) {
108
109
  const { max, workerOpts, queueOpts, timeout, key } = opts;
109
110
  const ret = {};
110
111
  const emitter = new (0, _events.EventEmitter)();
111
- const clientQueue = _chunkSW5IKE5Hjs.genClientQueue.call(void 0, key);
112
+ const clientQueue = _chunkNQIFUZL4js.genClientQueue.call(void 0, key);
112
113
  const queueMap = {};
113
114
  new (0, _bullmq.Worker)(clientQueue, async (job) => {
114
115
  const { data, id, error } = job.data;
@@ -4,7 +4,7 @@ import {
4
4
  createControllerMetaMap,
5
5
  detectAopDep,
6
6
  genClientQueue
7
- } from "../../chunk-P75VKZJY.mjs";
7
+ } from "../../chunk-3FHZB3Z5.mjs";
8
8
  import {
9
9
  __name
10
10
  } from "../../chunk-WHJ5FALK.mjs";
@@ -60,6 +60,7 @@ async function create({ moduleMap, meta }, opts = {}) {
60
60
  });
61
61
  const context = new Context({
62
62
  type: "bullmq",
63
+ category: "rpc",
63
64
  moduleMap,
64
65
  meta: meta2,
65
66
  tag,
@@ -1,7 +1,7 @@
1
1
  import { Consumer, Producer } from 'kafkajs';
2
- import { F as Factory } from '../../core-BIcUwV18.mjs';
3
- import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-BtbL49Zs.mjs';
4
- import { T as ToClientMap } from '../../meta-BXKLFTgG.mjs';
2
+ import { F as Factory } from '../../core-CSiaRU7r.mjs';
3
+ import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-JMhFVp-Z.mjs';
4
+ import { T as ToClientMap } from '../../meta-D1M85Hef.mjs';
5
5
  import 'phecda-core';
6
6
 
7
7
  interface KafkaCtx extends RpcContext {
@@ -1,7 +1,7 @@
1
1
  import { Consumer, Producer } from 'kafkajs';
2
- import { F as Factory } from '../../core-CYwEPfN4.js';
3
- import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-m3IEDKjP.js';
4
- import { T as ToClientMap } from '../../meta-BXKLFTgG.js';
2
+ import { F as Factory } from '../../core-C1kHRqU9.js';
3
+ import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-C9Remkup.js';
4
+ import { T as ToClientMap } from '../../meta-D1M85Hef.js';
5
5
  import 'phecda-core';
6
6
 
7
7
  interface KafkaCtx extends RpcContext {
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkSW5IKE5Hjs = require('../../chunk-SW5IKE5H.js');
6
+ var _chunkNQIFUZL4js = require('../../chunk-NQIFUZL4.js');
7
7
 
8
8
 
9
9
  var _chunkJ5CFUN4Vjs = require('../../chunk-J5CFUN4V.js');
@@ -14,18 +14,18 @@ var debug = _debug2.default.call(void 0, "phecda-server/kafka");
14
14
  async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
15
15
  const { globalGuards, globalFilter, globalPipe, globalAddons = [], defaultQueue } = opts;
16
16
  const existQueue = /* @__PURE__ */ new Set();
17
- const metaMap = _chunkSW5IKE5Hjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const metaMap = _chunkNQIFUZL4js.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
- _chunkSW5IKE5Hjs.detectAopDep.call(void 0, meta, {
24
+ _chunkNQIFUZL4js.detectAopDep.call(void 0, meta, {
25
25
  guards: globalGuards,
26
26
  addons: globalAddons
27
27
  }, "rpc");
28
- _chunkSW5IKE5Hjs.Context.applyAddons(globalAddons, {
28
+ _chunkNQIFUZL4js.Context.applyAddons(globalAddons, {
29
29
  consumer,
30
30
  producer
31
31
  }, "kafka");
@@ -59,13 +59,14 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
59
59
  const meta2 = metaMap.get(tag)[func];
60
60
  const { data: { rpc } } = meta2;
61
61
  const isEvent = rpc.isEvent;
62
- const aop = _chunkSW5IKE5Hjs.Context.getAop(meta2, {
62
+ const aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
63
63
  globalFilter,
64
64
  globalGuards,
65
65
  globalPipe
66
66
  });
67
- const context = new (0, _chunkSW5IKE5Hjs.Context)({
67
+ const context = new (0, _chunkNQIFUZL4js.Context)({
68
68
  type: "kafka",
69
+ category: "rpc",
69
70
  moduleMap,
70
71
  meta: meta2,
71
72
  args,
@@ -121,7 +122,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
121
122
  let eventCount = 1;
122
123
  const ret = {};
123
124
  const emitter = new (0, _events.EventEmitter)();
124
- const clientQueue = _chunkSW5IKE5Hjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
125
+ const clientQueue = _chunkNQIFUZL4js.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
125
126
  await consumer.subscribe({
126
127
  topic: clientQueue,
127
128
  fromBeginning: true
@@ -3,7 +3,7 @@ import {
3
3
  createControllerMetaMap,
4
4
  detectAopDep,
5
5
  genClientQueue
6
- } from "../../chunk-P75VKZJY.mjs";
6
+ } from "../../chunk-3FHZB3Z5.mjs";
7
7
  import {
8
8
  __name
9
9
  } from "../../chunk-WHJ5FALK.mjs";
@@ -66,6 +66,7 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
66
66
  });
67
67
  const context = new Context({
68
68
  type: "kafka",
69
+ category: "rpc",
69
70
  moduleMap,
70
71
  meta: meta2,
71
72
  args,
@@ -1,7 +1,7 @@
1
1
  import { NatsConnection } from 'nats';
2
- import { F as Factory } from '../../core-BIcUwV18.mjs';
3
- import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-BtbL49Zs.mjs';
4
- import { T as ToClientMap } from '../../meta-BXKLFTgG.mjs';
2
+ import { F as Factory } from '../../core-CSiaRU7r.mjs';
3
+ import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-JMhFVp-Z.mjs';
4
+ import { T as ToClientMap } from '../../meta-D1M85Hef.mjs';
5
5
  import 'phecda-core';
6
6
 
7
7
  interface NatsCtx extends RpcContext {
@@ -1,7 +1,7 @@
1
1
  import { NatsConnection } from 'nats';
2
- import { F as Factory } from '../../core-CYwEPfN4.js';
3
- import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-m3IEDKjP.js';
4
- import { T as ToClientMap } from '../../meta-BXKLFTgG.js';
2
+ import { F as Factory } from '../../core-C1kHRqU9.js';
3
+ import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-C9Remkup.js';
4
+ import { T as ToClientMap } from '../../meta-D1M85Hef.js';
5
5
  import 'phecda-core';
6
6
 
7
7
  interface NatsCtx extends RpcContext {
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkSW5IKE5Hjs = require('../../chunk-SW5IKE5H.js');
6
+ var _chunkNQIFUZL4js = require('../../chunk-NQIFUZL4.js');
7
7
 
8
8
 
9
9
  var _chunkJ5CFUN4Vjs = require('../../chunk-J5CFUN4V.js');
@@ -17,18 +17,18 @@ 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 = _chunkSW5IKE5Hjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
20
+ const metaMap = _chunkNQIFUZL4js.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
- _chunkSW5IKE5Hjs.detectAopDep.call(void 0, meta, {
27
+ _chunkNQIFUZL4js.detectAopDep.call(void 0, meta, {
28
28
  addons: globalAddons,
29
29
  guards: globalGuards
30
30
  }, "rpc");
31
- _chunkSW5IKE5Hjs.Context.applyAddons(globalAddons, nc, "nats");
31
+ _chunkNQIFUZL4js.Context.applyAddons(globalAddons, nc, "nats");
32
32
  async function subscribeQueues() {
33
33
  existQueue.clear();
34
34
  for (const [tag, record] of metaMap) {
@@ -56,13 +56,14 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
56
56
  const meta2 = metaMap.get(tag)[func];
57
57
  const { data: { rpc: { isEvent } = {} } } = meta2;
58
58
  if (isEvent) msg.respond("{}");
59
- const aop = _chunkSW5IKE5Hjs.Context.getAop(meta2, {
59
+ const aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
60
60
  globalFilter,
61
61
  globalGuards,
62
62
  globalPipe
63
63
  });
64
- const context = new (0, _chunkSW5IKE5Hjs.Context)({
64
+ const context = new (0, _chunkNQIFUZL4js.Context)({
65
65
  type: "nats",
66
+ category: "rpc",
66
67
  moduleMap,
67
68
  meta: meta2,
68
69
  tag,
@@ -89,7 +90,7 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
89
90
  }
90
91
  _chunkJ5CFUN4Vjs.__name.call(void 0, handleRequest, "handleRequest");
91
92
  subscribeQueues();
92
- _chunkSW5IKE5Hjs.HMR.call(void 0, async () => {
93
+ _chunkNQIFUZL4js.HMR.call(void 0, async () => {
93
94
  for (const i in subscriptionMap) subscriptionMap[i].unsubscribe();
94
95
  await subscribeQueues();
95
96
  });
@@ -3,7 +3,7 @@ import {
3
3
  HMR,
4
4
  createControllerMetaMap,
5
5
  detectAopDep
6
- } from "../../chunk-P75VKZJY.mjs";
6
+ } from "../../chunk-3FHZB3Z5.mjs";
7
7
  import {
8
8
  __name
9
9
  } from "../../chunk-WHJ5FALK.mjs";
@@ -63,6 +63,7 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
63
63
  });
64
64
  const context = new Context({
65
65
  type: "nats",
66
+ category: "rpc",
66
67
  moduleMap,
67
68
  meta: meta2,
68
69
  tag,
@@ -1,7 +1,7 @@
1
1
  import amqplib from 'amqplib';
2
- import { F as Factory } from '../../core-BIcUwV18.mjs';
3
- import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-BtbL49Zs.mjs';
4
- import { T as ToClientMap } from '../../meta-BXKLFTgG.mjs';
2
+ import { F as Factory } from '../../core-CSiaRU7r.mjs';
3
+ import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-JMhFVp-Z.mjs';
4
+ import { T as ToClientMap } from '../../meta-D1M85Hef.mjs';
5
5
  import 'phecda-core';
6
6
 
7
7
  interface RabbitmqCtx extends RpcContext {
@@ -1,7 +1,7 @@
1
1
  import amqplib from 'amqplib';
2
- import { F as Factory } from '../../core-CYwEPfN4.js';
3
- import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-m3IEDKjP.js';
4
- import { T as ToClientMap } from '../../meta-BXKLFTgG.js';
2
+ import { F as Factory } from '../../core-C1kHRqU9.js';
3
+ import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-C9Remkup.js';
4
+ import { T as ToClientMap } from '../../meta-D1M85Hef.js';
5
5
  import 'phecda-core';
6
6
 
7
7
  interface RabbitmqCtx extends RpcContext {
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkSW5IKE5Hjs = require('../../chunk-SW5IKE5H.js');
7
+ var _chunkNQIFUZL4js = require('../../chunk-NQIFUZL4.js');
8
8
 
9
9
 
10
10
  var _chunkJ5CFUN4Vjs = require('../../chunk-J5CFUN4V.js');
@@ -14,19 +14,19 @@ 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, globalFilter, globalPipe, globalAddons = [], defaultQueue } = opts;
17
- const metaMap = _chunkSW5IKE5Hjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const metaMap = _chunkNQIFUZL4js.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
- _chunkSW5IKE5Hjs.detectAopDep.call(void 0, meta, {
24
+ _chunkNQIFUZL4js.detectAopDep.call(void 0, meta, {
25
25
  guards: globalGuards,
26
26
  addons: globalAddons
27
27
  }, "rpc");
28
28
  const existQueue = /* @__PURE__ */ new Set();
29
- _chunkSW5IKE5Hjs.Context.applyAddons(globalAddons, ch, "rabbitmq");
29
+ _chunkNQIFUZL4js.Context.applyAddons(globalAddons, ch, "rabbitmq");
30
30
  async function subscribeQueues() {
31
31
  existQueue.clear();
32
32
  for (const [tag, record] of metaMap) {
@@ -58,13 +58,14 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
58
58
  debug(`invoke method "${func}" in module "${tag}"`);
59
59
  const meta2 = metaMap.get(tag)[func];
60
60
  const { data: { rpc: { isEvent } = {} } } = meta2;
61
- const aop = _chunkSW5IKE5Hjs.Context.getAop(meta2, {
61
+ const aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
62
62
  globalFilter,
63
63
  globalGuards,
64
64
  globalPipe
65
65
  });
66
- const context = new (0, _chunkSW5IKE5Hjs.Context)({
66
+ const context = new (0, _chunkNQIFUZL4js.Context)({
67
67
  type: "rabbitmq",
68
+ category: "rpc",
68
69
  moduleMap,
69
70
  meta: meta2,
70
71
  tag,
@@ -92,7 +93,7 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
92
93
  }
93
94
  _chunkJ5CFUN4Vjs.__name.call(void 0, handleRequest, "handleRequest");
94
95
  subscribeQueues();
95
- _chunkSW5IKE5Hjs.HMR.call(void 0, async () => {
96
+ _chunkNQIFUZL4js.HMR.call(void 0, async () => {
96
97
  for (const queue of existQueue) await ch.deleteQueue(queue);
97
98
  await subscribeQueues();
98
99
  });
@@ -106,7 +107,7 @@ async function createClient(ch, controllers, opts) {
106
107
  let eventCount = 0;
107
108
  const ret = {};
108
109
  const emitter = new (0, _events.EventEmitter)();
109
- const clientQueue = _chunkSW5IKE5Hjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
110
+ const clientQueue = _chunkNQIFUZL4js.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
110
111
  await ch.assertQueue(clientQueue);
111
112
  ch.consume(clientQueue, (msg) => {
112
113
  if (!msg) return;
@@ -4,7 +4,7 @@ import {
4
4
  createControllerMetaMap,
5
5
  detectAopDep,
6
6
  genClientQueue
7
- } from "../../chunk-P75VKZJY.mjs";
7
+ } from "../../chunk-3FHZB3Z5.mjs";
8
8
  import {
9
9
  __name
10
10
  } from "../../chunk-WHJ5FALK.mjs";
@@ -65,6 +65,7 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
65
65
  });
66
66
  const context = new Context({
67
67
  type: "rabbitmq",
68
+ category: "rpc",
68
69
  moduleMap,
69
70
  meta: meta2,
70
71
  tag,
@@ -1,7 +1,7 @@
1
1
  import Redis from 'ioredis';
2
- import { F as Factory } from '../../core-BIcUwV18.mjs';
3
- import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-BtbL49Zs.mjs';
4
- import { T as ToClientMap } from '../../meta-BXKLFTgG.mjs';
2
+ import { F as Factory } from '../../core-CSiaRU7r.mjs';
3
+ import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-JMhFVp-Z.mjs';
4
+ import { T as ToClientMap } from '../../meta-D1M85Hef.mjs';
5
5
  import 'phecda-core';
6
6
 
7
7
  interface RedisCtx extends RpcContext {
@@ -1,7 +1,7 @@
1
1
  import Redis from 'ioredis';
2
- import { F as Factory } from '../../core-CYwEPfN4.js';
3
- import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-m3IEDKjP.js';
4
- import { T as ToClientMap } from '../../meta-BXKLFTgG.js';
2
+ import { F as Factory } from '../../core-C1kHRqU9.js';
3
+ import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-C9Remkup.js';
4
+ import { T as ToClientMap } from '../../meta-D1M85Hef.js';
5
5
  import 'phecda-core';
6
6
 
7
7
  interface RedisCtx extends RpcContext {
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkSW5IKE5Hjs = require('../../chunk-SW5IKE5H.js');
7
+ var _chunkNQIFUZL4js = require('../../chunk-NQIFUZL4.js');
8
8
 
9
9
 
10
10
  var _chunkJ5CFUN4Vjs = require('../../chunk-J5CFUN4V.js');
@@ -14,19 +14,19 @@ 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, globalFilter, globalPipe, globalAddons = [], defaultQueue } = opts;
17
- const metaMap = _chunkSW5IKE5Hjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const metaMap = _chunkNQIFUZL4js.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
- _chunkSW5IKE5Hjs.detectAopDep.call(void 0, meta, {
24
+ _chunkNQIFUZL4js.detectAopDep.call(void 0, meta, {
25
25
  guards: globalGuards,
26
26
  addons: globalAddons
27
27
  }, "rpc");
28
28
  const existQueue = /* @__PURE__ */ new Set();
29
- _chunkSW5IKE5Hjs.Context.applyAddons(globalAddons, {
29
+ _chunkNQIFUZL4js.Context.applyAddons(globalAddons, {
30
30
  pub,
31
31
  sub
32
32
  }, "redis");
@@ -55,13 +55,14 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
55
55
  if (_ps !== 1) return;
56
56
  const meta2 = metaMap.get(tag)[func];
57
57
  const { data: { rpc: { isEvent } = {} } } = meta2;
58
- const aop = _chunkSW5IKE5Hjs.Context.getAop(meta2, {
58
+ const aop = _chunkNQIFUZL4js.Context.getAop(meta2, {
59
59
  globalFilter,
60
60
  globalGuards,
61
61
  globalPipe
62
62
  });
63
- const context = new (0, _chunkSW5IKE5Hjs.Context)({
63
+ const context = new (0, _chunkNQIFUZL4js.Context)({
64
64
  type: "redis",
65
+ category: "rpc",
65
66
  moduleMap,
66
67
  redis: sub,
67
68
  meta: meta2,
@@ -91,7 +92,7 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
91
92
  }
92
93
  });
93
94
  subscribeQueues();
94
- _chunkSW5IKE5Hjs.HMR.call(void 0, async () => {
95
+ _chunkNQIFUZL4js.HMR.call(void 0, async () => {
95
96
  for (const queue of existQueue) await sub.unsubscribe(queue);
96
97
  subscribeQueues();
97
98
  });
@@ -105,7 +106,7 @@ async function createClient({ pub, sub }, controllers, opts) {
105
106
  let eventId = 1;
106
107
  let eventCount = 0;
107
108
  const emitter = new (0, _events2.default)();
108
- const clientQueue = _chunkSW5IKE5Hjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
109
+ const clientQueue = _chunkNQIFUZL4js.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
109
110
  await sub.subscribe(clientQueue);
110
111
  for (const i in controllers) {
111
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-P75VKZJY.mjs";
7
+ } from "../../chunk-3FHZB3Z5.mjs";
8
8
  import {
9
9
  __name
10
10
  } from "../../chunk-WHJ5FALK.mjs";
@@ -62,6 +62,7 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
62
62
  });
63
63
  const context = new Context({
64
64
  type: "redis",
65
+ category: "rpc",
65
66
  moduleMap,
66
67
  redis: sub,
67
68
  meta: meta2,
package/dist/test.d.mts CHANGED
@@ -2,8 +2,8 @@ import * as supertest from 'supertest';
2
2
  import { Test } from 'supertest';
3
3
  import { Server } from 'node:http';
4
4
  import { Construct } from 'phecda-core';
5
- import { F as Factory } from './core-BIcUwV18.mjs';
6
- import { P as PickFunc } from './meta-BXKLFTgG.mjs';
5
+ import { F as Factory } from './core-CSiaRU7r.mjs';
6
+ import { P as PickFunc } from './meta-D1M85Hef.mjs';
7
7
 
8
8
  declare function TestFactory<T extends Construct[]>(...Modules: T): Promise<{
9
9
  get<C extends T[number]>(Model: C): InstanceType<C>;
@@ -11,7 +11,7 @@ declare function TestFactory<T extends Construct[]>(...Modules: T): Promise<{
11
11
  type SuperTestRequest<T> = {
12
12
  [K in keyof T]: T[K] extends (...args: infer R) => any ? (...args: R) => Test : never;
13
13
  };
14
- declare function TestHttp(app: Server | any, { moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, isAgent?: boolean): Promise<supertest.SuperTestWithHost<Test> & Pick<supertest.Request, "type" | "query" | "key" | "use" | "on" | "set" | "accept" | "auth" | "withCredentials" | "retry" | "ok" | "redirects" | "timeout" | "buffer" | "serialize" | "parse" | "ca" | "pfx" | "cert"> & {
14
+ declare function TestHttp(app: Server | any, { moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, isAgent?: boolean): Promise<supertest.SuperTestWithHost<Test> & Pick<supertest.Request, "use" | "on" | "set" | "query" | "type" | "accept" | "auth" | "withCredentials" | "retry" | "ok" | "redirects" | "timeout" | "buffer" | "serialize" | "parse" | "ca" | "key" | "pfx" | "cert"> & {
15
15
  module: <T extends Construct>(Module: T) => SuperTestRequest<PickFunc<InstanceType<T>>>;
16
16
  }>;
17
17
 
package/dist/test.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as supertest from 'supertest';
2
2
  import { Test } from 'supertest';
3
3
  import { Server } from 'node:http';
4
4
  import { Construct } from 'phecda-core';
5
- import { F as Factory } from './core-CYwEPfN4.js';
6
- import { P as PickFunc } from './meta-BXKLFTgG.js';
5
+ import { F as Factory } from './core-C1kHRqU9.js';
6
+ import { P as PickFunc } from './meta-D1M85Hef.js';
7
7
 
8
8
  declare function TestFactory<T extends Construct[]>(...Modules: T): Promise<{
9
9
  get<C extends T[number]>(Model: C): InstanceType<C>;
@@ -11,7 +11,7 @@ declare function TestFactory<T extends Construct[]>(...Modules: T): Promise<{
11
11
  type SuperTestRequest<T> = {
12
12
  [K in keyof T]: T[K] extends (...args: infer R) => any ? (...args: R) => Test : never;
13
13
  };
14
- declare function TestHttp(app: Server | any, { moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, isAgent?: boolean): Promise<supertest.SuperTestWithHost<Test> & Pick<supertest.Request, "type" | "query" | "key" | "use" | "on" | "set" | "accept" | "auth" | "withCredentials" | "retry" | "ok" | "redirects" | "timeout" | "buffer" | "serialize" | "parse" | "ca" | "pfx" | "cert"> & {
14
+ declare function TestHttp(app: Server | any, { moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, isAgent?: boolean): Promise<supertest.SuperTestWithHost<Test> & Pick<supertest.Request, "use" | "on" | "set" | "query" | "type" | "accept" | "auth" | "withCredentials" | "retry" | "ok" | "redirects" | "timeout" | "buffer" | "serialize" | "parse" | "ca" | "key" | "pfx" | "cert"> & {
15
15
  module: <T extends Construct>(Module: T) => SuperTestRequest<PickFunc<InstanceType<T>>>;
16
16
  }>;
17
17
 
package/dist/test.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
2
2
 
3
- var _chunkBGXSMOLXjs = require('./chunk-BGXSMOLX.js');
3
+ var _chunk7YQ57BQSjs = require('./chunk-7YQ57BQS.js');
4
4
 
5
5
 
6
6
  var _chunkJ5CFUN4Vjs = require('./chunk-J5CFUN4V.js');
@@ -8,7 +8,7 @@ var _chunkJ5CFUN4Vjs = require('./chunk-J5CFUN4V.js');
8
8
  // src/test.ts
9
9
  var _phecdacore = require('phecda-core');
10
10
  async function TestFactory(...Modules) {
11
- const { moduleMap, modelMap } = await _chunkBGXSMOLXjs.Factory.call(void 0, Modules);
11
+ const { moduleMap, modelMap } = await _chunk7YQ57BQSjs.Factory.call(void 0, Modules);
12
12
  return {
13
13
  get(Model) {
14
14
  const tag = _phecdacore.getTag.call(void 0, Model);
package/dist/test.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Factory
3
- } from "./chunk-5622RBNB.mjs";
3
+ } from "./chunk-XYVMNY2X.mjs";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-WHJ5FALK.mjs";