phecda-server 7.1.4 → 8.0.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 (84) hide show
  1. package/dist/{chunk-MKRHYZCL.mjs → chunk-FI5756JX.mjs} +2 -2
  2. package/dist/{chunk-YRS4ECPT.js → chunk-OLNN4U3O.js} +12 -8
  3. package/dist/{chunk-5MAGRSEM.mjs → chunk-PFPOEZHH.mjs} +12 -8
  4. package/dist/{chunk-DPPDWBYO.js → chunk-UYZSUBX4.js} +2 -2
  5. package/dist/{chunk-P3CS65OP.mjs → chunk-VAHCYYCB.mjs} +32 -17
  6. package/dist/{chunk-OV3UJLGP.js → chunk-YJ3QHGTC.js} +32 -17
  7. package/dist/{core-B5yKYkMJ.d.mts → core-BTSHIAyB.d.ts} +2 -1
  8. package/dist/{core-BRuvL6hY.d.ts → core-D1YYphEn.d.mts} +2 -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 +30 -30
  16. package/dist/http/elysia/index.mjs +15 -15
  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 +27 -27
  20. package/dist/http/express/index.mjs +14 -14
  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 +29 -29
  24. package/dist/http/fastify/index.mjs +15 -15
  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 +28 -28
  28. package/dist/http/h3/index.mjs +14 -14
  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 +26 -26
  32. package/dist/http/hono/index.mjs +14 -14
  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 +26 -26
  36. package/dist/http/hyper-express/index.mjs +14 -14
  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 +27 -27
  40. package/dist/http/koa/index.mjs +14 -14
  41. package/dist/index.d.mts +20 -13
  42. package/dist/index.d.ts +20 -13
  43. package/dist/index.js +112 -71
  44. package/dist/index.mjs +69 -28
  45. package/dist/{meta-C_eDyXnK.d.ts → meta-DNF6Fl27.d.mts} +11 -9
  46. package/dist/{meta-C_eDyXnK.d.mts → meta-DNF6Fl27.d.ts} +11 -9
  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 +16 -16
  50. package/dist/rpc/bullmq/index.mjs +11 -11
  51. package/dist/rpc/electron/index.d.mts +3 -3
  52. package/dist/rpc/electron/index.d.ts +3 -3
  53. package/dist/rpc/electron/index.js +11 -11
  54. package/dist/rpc/electron/index.mjs +7 -7
  55. package/dist/rpc/kafka/index.d.mts +3 -3
  56. package/dist/rpc/kafka/index.d.ts +3 -3
  57. package/dist/rpc/kafka/index.js +14 -14
  58. package/dist/rpc/kafka/index.mjs +9 -9
  59. package/dist/rpc/nats/index.d.mts +3 -3
  60. package/dist/rpc/nats/index.d.ts +3 -3
  61. package/dist/rpc/nats/index.js +14 -14
  62. package/dist/rpc/nats/index.mjs +9 -9
  63. package/dist/rpc/rabbitmq/index.d.mts +3 -3
  64. package/dist/rpc/rabbitmq/index.d.ts +3 -3
  65. package/dist/rpc/rabbitmq/index.js +14 -14
  66. package/dist/rpc/rabbitmq/index.mjs +9 -9
  67. package/dist/rpc/redis/index.d.mts +3 -3
  68. package/dist/rpc/redis/index.d.ts +3 -3
  69. package/dist/rpc/redis/index.js +14 -14
  70. package/dist/rpc/redis/index.mjs +9 -9
  71. package/dist/rpc/ws/index.d.mts +3 -3
  72. package/dist/rpc/ws/index.d.ts +3 -3
  73. package/dist/rpc/ws/index.js +10 -10
  74. package/dist/rpc/ws/index.mjs +6 -6
  75. package/dist/test.d.mts +2 -2
  76. package/dist/test.d.ts +2 -2
  77. package/dist/test.js +5 -5
  78. package/dist/test.mjs +4 -4
  79. package/dist/{types-7-m2wEkP.d.mts → types-BOZ8yE2L.d.mts} +1 -1
  80. package/dist/{types-BuvMT1ta.d.ts → types-Cosv4nol.d.ts} +1 -1
  81. package/dist/{types-BKHBmSQN.d.mts → types-DtiHAXQB.d.mts} +1 -1
  82. package/dist/{types-B6aU8oT-.d.ts → types-YJ55P7A_.d.ts} +1 -1
  83. package/package.json +3 -4
  84. package/register/export.mjs +5 -1
@@ -2,7 +2,7 @@ import {
2
2
  Context,
3
3
  createControllerMetaMap,
4
4
  detectAopDep
5
- } from "../../chunk-P3CS65OP.mjs";
5
+ } from "../../chunk-VAHCYYCB.mjs";
6
6
  import {
7
7
  HMR,
8
8
  __name
@@ -18,9 +18,9 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
18
18
  const subscriptionMap = {};
19
19
  const existQueue = /* @__PURE__ */ new Set();
20
20
  const metaMap = createControllerMetaMap(meta, (meta2) => {
21
- const { controller, rpc, func, tag } = meta2.data;
21
+ const { controller, rpc, method, tag } = meta2.data;
22
22
  if (controller === "rpc" && rpc?.queue !== void 0) {
23
- debug(`register method "${func}" in module "${tag}"`);
23
+ debug(`register method "${method}" in module "${tag}"`);
24
24
  return true;
25
25
  }
26
26
  });
@@ -32,8 +32,8 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
32
32
  async function subscribeQueues() {
33
33
  existQueue.clear();
34
34
  for (const [tag, record] of metaMap) {
35
- for (const func in record) {
36
- const meta2 = metaMap.get(tag)[func];
35
+ for (const method in record) {
36
+ const meta2 = metaMap.get(tag)[method];
37
37
  const { data: { rpc } } = meta2;
38
38
  if (rpc) {
39
39
  const queue = rpc.queue || defaultQueue || tag;
@@ -50,10 +50,10 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
50
50
  __name(subscribeQueues, "subscribeQueues");
51
51
  async function handleRequest(_, msg) {
52
52
  const data = JSON.parse(sc.decode(msg.data));
53
- const { tag, func, id, _ps, args } = data;
53
+ const { tag, method, id, _ps, args } = data;
54
54
  if (_ps !== 1) return;
55
- debug(`invoke method "${func}" in module "${tag}"`);
56
- const meta2 = metaMap.get(tag)[func];
55
+ debug(`invoke method "${method}" in module "${tag}"`);
56
+ const meta2 = metaMap.get(tag)[method];
57
57
  const { data: { rpc: { isEvent } = {} } } = meta2;
58
58
  if (isEvent) msg.respond("{}");
59
59
  const aop = Context.getAop(meta2, {
@@ -67,7 +67,7 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
67
67
  moduleMap,
68
68
  meta: meta2,
69
69
  tag,
70
- func,
70
+ method,
71
71
  args,
72
72
  id,
73
73
  msg,
@@ -1,8 +1,8 @@
1
1
  import amqplib from 'amqplib';
2
- import { F as Factory } from '../../core-B5yKYkMJ.mjs';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-7-m2wEkP.mjs';
2
+ import { F as Factory } from '../../core-D1YYphEn.mjs';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-BOZ8yE2L.mjs';
4
4
  import 'phecda-core';
5
- import '../../meta-C_eDyXnK.mjs';
5
+ import '../../meta-DNF6Fl27.mjs';
6
6
 
7
7
  interface RabbitmqCtx extends RpcCtx {
8
8
  type: 'rabbitmq';
@@ -1,8 +1,8 @@
1
1
  import amqplib from 'amqplib';
2
- import { F as Factory } from '../../core-BRuvL6hY.js';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-B6aU8oT-.js';
2
+ import { F as Factory } from '../../core-BTSHIAyB.js';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-YJ55P7A_.js';
4
4
  import 'phecda-core';
5
- import '../../meta-C_eDyXnK.js';
5
+ import '../../meta-DNF6Fl27.js';
6
6
 
7
7
  interface RabbitmqCtx extends RpcCtx {
8
8
  type: 'rabbitmq';
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkOV3UJLGPjs = require('../../chunk-OV3UJLGP.js');
5
+ var _chunkYJ3QHGTCjs = require('../../chunk-YJ3QHGTC.js');
6
6
 
7
7
 
8
8
 
@@ -13,24 +13,24 @@ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
13
13
  var debug = _debug2.default.call(void 0, "phecda-server/rabbitmq");
14
14
  async function bind(ch, { moduleMap, meta }, opts = {}) {
15
15
  const { globalGuards, globalFilter, globalPipe, globalAddons = [], defaultQueue } = opts;
16
- const metaMap = _chunkOV3UJLGPjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
- const { controller, rpc, func, tag } = meta2.data;
16
+ const metaMap = _chunkYJ3QHGTCjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const { controller, rpc, method, tag } = meta2.data;
18
18
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
19
- debug(`register method "${func}" in module "${tag}"`);
19
+ debug(`register method "${method}" in module "${tag}"`);
20
20
  return true;
21
21
  }
22
22
  });
23
- _chunkOV3UJLGPjs.detectAopDep.call(void 0, meta, {
23
+ _chunkYJ3QHGTCjs.detectAopDep.call(void 0, meta, {
24
24
  guards: globalGuards,
25
25
  addons: globalAddons
26
26
  }, "rpc");
27
27
  const existQueue = /* @__PURE__ */ new Set();
28
- _chunkOV3UJLGPjs.Context.applyAddons(globalAddons, ch, "rabbitmq");
28
+ _chunkYJ3QHGTCjs.Context.applyAddons(globalAddons, ch, "rabbitmq");
29
29
  async function subscribeQueues() {
30
30
  existQueue.clear();
31
31
  for (const [tag, record] of metaMap) {
32
- for (const func in record) {
33
- const meta2 = metaMap.get(tag)[func];
32
+ for (const method in record) {
33
+ const meta2 = metaMap.get(tag)[method];
34
34
  const { data: { rpc } } = meta2;
35
35
  if (rpc) {
36
36
  const queue = rpc.queue || defaultQueue || tag;
@@ -52,23 +52,23 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
52
52
  _chunk4LLLQOMFjs.__name.call(void 0, send, "send");
53
53
  if (msg) {
54
54
  const data = JSON.parse(msg.content.toString());
55
- const { tag, func, id, queue: clientQueue, _ps, args } = data;
55
+ const { tag, method, id, queue: clientQueue, _ps, args } = data;
56
56
  if (_ps !== 1) return;
57
- debug(`invoke method "${func}" in module "${tag}"`);
58
- const meta2 = metaMap.get(tag)[func];
57
+ debug(`invoke method "${method}" in module "${tag}"`);
58
+ const meta2 = metaMap.get(tag)[method];
59
59
  const { data: { rpc: { isEvent } = {} } } = meta2;
60
- const aop = _chunkOV3UJLGPjs.Context.getAop(meta2, {
60
+ const aop = _chunkYJ3QHGTCjs.Context.getAop(meta2, {
61
61
  globalFilter,
62
62
  globalGuards,
63
63
  globalPipe
64
64
  });
65
- const context = new (0, _chunkOV3UJLGPjs.Context)({
65
+ const context = new (0, _chunkYJ3QHGTCjs.Context)({
66
66
  type: "rabbitmq",
67
67
  category: "rpc",
68
68
  moduleMap,
69
69
  meta: meta2,
70
70
  tag,
71
- func,
71
+ method,
72
72
  args,
73
73
  id,
74
74
  ch,
@@ -2,7 +2,7 @@ import {
2
2
  Context,
3
3
  createControllerMetaMap,
4
4
  detectAopDep
5
- } from "../../chunk-P3CS65OP.mjs";
5
+ } from "../../chunk-VAHCYYCB.mjs";
6
6
  import {
7
7
  HMR,
8
8
  __name
@@ -14,9 +14,9 @@ var debug = Debug("phecda-server/rabbitmq");
14
14
  async function bind(ch, { moduleMap, meta }, opts = {}) {
15
15
  const { globalGuards, globalFilter, globalPipe, globalAddons = [], defaultQueue } = opts;
16
16
  const metaMap = createControllerMetaMap(meta, (meta2) => {
17
- const { controller, rpc, func, tag } = meta2.data;
17
+ const { controller, rpc, method, tag } = meta2.data;
18
18
  if (controller === "rpc" && rpc?.queue !== void 0) {
19
- debug(`register method "${func}" in module "${tag}"`);
19
+ debug(`register method "${method}" in module "${tag}"`);
20
20
  return true;
21
21
  }
22
22
  });
@@ -29,8 +29,8 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
29
29
  async function subscribeQueues() {
30
30
  existQueue.clear();
31
31
  for (const [tag, record] of metaMap) {
32
- for (const func in record) {
33
- const meta2 = metaMap.get(tag)[func];
32
+ for (const method in record) {
33
+ const meta2 = metaMap.get(tag)[method];
34
34
  const { data: { rpc } } = meta2;
35
35
  if (rpc) {
36
36
  const queue = rpc.queue || defaultQueue || tag;
@@ -52,10 +52,10 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
52
52
  __name(send, "send");
53
53
  if (msg) {
54
54
  const data = JSON.parse(msg.content.toString());
55
- const { tag, func, id, queue: clientQueue, _ps, args } = data;
55
+ const { tag, method, id, queue: clientQueue, _ps, args } = data;
56
56
  if (_ps !== 1) return;
57
- debug(`invoke method "${func}" in module "${tag}"`);
58
- const meta2 = metaMap.get(tag)[func];
57
+ debug(`invoke method "${method}" in module "${tag}"`);
58
+ const meta2 = metaMap.get(tag)[method];
59
59
  const { data: { rpc: { isEvent } = {} } } = meta2;
60
60
  const aop = Context.getAop(meta2, {
61
61
  globalFilter,
@@ -68,7 +68,7 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
68
68
  moduleMap,
69
69
  meta: meta2,
70
70
  tag,
71
- func,
71
+ method,
72
72
  args,
73
73
  id,
74
74
  ch,
@@ -1,8 +1,8 @@
1
1
  import Redis from 'ioredis';
2
- import { F as Factory } from '../../core-B5yKYkMJ.mjs';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-7-m2wEkP.mjs';
2
+ import { F as Factory } from '../../core-D1YYphEn.mjs';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-BOZ8yE2L.mjs';
4
4
  import 'phecda-core';
5
- import '../../meta-C_eDyXnK.mjs';
5
+ import '../../meta-DNF6Fl27.mjs';
6
6
 
7
7
  interface RedisCtx extends RpcCtx {
8
8
  type: 'redis';
@@ -1,8 +1,8 @@
1
1
  import Redis from 'ioredis';
2
- import { F as Factory } from '../../core-BRuvL6hY.js';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-B6aU8oT-.js';
2
+ import { F as Factory } from '../../core-BTSHIAyB.js';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-YJ55P7A_.js';
4
4
  import 'phecda-core';
5
- import '../../meta-C_eDyXnK.js';
5
+ import '../../meta-DNF6Fl27.js';
6
6
 
7
7
  interface RedisCtx extends RpcCtx {
8
8
  type: 'redis';
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkOV3UJLGPjs = require('../../chunk-OV3UJLGP.js');
5
+ var _chunkYJ3QHGTCjs = require('../../chunk-YJ3QHGTC.js');
6
6
 
7
7
 
8
8
 
@@ -13,27 +13,27 @@ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
13
13
  var debug = _debug2.default.call(void 0, "phecda-server/redis");
14
14
  function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
15
15
  const { globalGuards, globalFilter, globalPipe, globalAddons = [], defaultQueue } = opts;
16
- const metaMap = _chunkOV3UJLGPjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
- const { controller, rpc, func, tag } = meta2.data;
16
+ const metaMap = _chunkYJ3QHGTCjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const { controller, rpc, method, tag } = meta2.data;
18
18
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
19
- debug(`register method "${func}" in module "${tag}"`);
19
+ debug(`register method "${method}" in module "${tag}"`);
20
20
  return true;
21
21
  }
22
22
  });
23
- _chunkOV3UJLGPjs.detectAopDep.call(void 0, meta, {
23
+ _chunkYJ3QHGTCjs.detectAopDep.call(void 0, meta, {
24
24
  guards: globalGuards,
25
25
  addons: globalAddons
26
26
  }, "rpc");
27
27
  const existQueue = /* @__PURE__ */ new Set();
28
- _chunkOV3UJLGPjs.Context.applyAddons(globalAddons, {
28
+ _chunkYJ3QHGTCjs.Context.applyAddons(globalAddons, {
29
29
  pub,
30
30
  sub
31
31
  }, "redis");
32
32
  async function subscribeQueues() {
33
33
  existQueue.clear();
34
34
  for (const [tag, record] of metaMap) {
35
- for (const func in record) {
36
- const meta2 = metaMap.get(tag)[func];
35
+ for (const method in record) {
36
+ const meta2 = metaMap.get(tag)[method];
37
37
  const { data: { rpc } } = meta2;
38
38
  if (rpc) {
39
39
  const queue = rpc.queue || defaultQueue || tag;
@@ -49,17 +49,17 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
49
49
  if (!existQueue.has(channel)) return;
50
50
  if (msg) {
51
51
  const data = JSON.parse(msg);
52
- const { func, id, tag, queue: clientQueue, _ps, args } = data;
53
- debug(`invoke method "${func}" in module "${tag}"`);
52
+ const { method, id, tag, queue: clientQueue, _ps, args } = data;
53
+ debug(`invoke method "${method}" in module "${tag}"`);
54
54
  if (_ps !== 1) return;
55
- const meta2 = metaMap.get(tag)[func];
55
+ const meta2 = metaMap.get(tag)[method];
56
56
  const { data: { rpc: { isEvent } = {} } } = meta2;
57
- const aop = _chunkOV3UJLGPjs.Context.getAop(meta2, {
57
+ const aop = _chunkYJ3QHGTCjs.Context.getAop(meta2, {
58
58
  globalFilter,
59
59
  globalGuards,
60
60
  globalPipe
61
61
  });
62
- const context = new (0, _chunkOV3UJLGPjs.Context)({
62
+ const context = new (0, _chunkYJ3QHGTCjs.Context)({
63
63
  type: "redis",
64
64
  category: "rpc",
65
65
  moduleMap,
@@ -68,7 +68,7 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
68
68
  msg,
69
69
  channel,
70
70
  tag,
71
- func,
71
+ method,
72
72
  args,
73
73
  id,
74
74
  isEvent,
@@ -2,7 +2,7 @@ import {
2
2
  Context,
3
3
  createControllerMetaMap,
4
4
  detectAopDep
5
- } from "../../chunk-P3CS65OP.mjs";
5
+ } from "../../chunk-VAHCYYCB.mjs";
6
6
  import {
7
7
  HMR,
8
8
  __name
@@ -14,9 +14,9 @@ var debug = Debug("phecda-server/redis");
14
14
  function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
15
15
  const { globalGuards, globalFilter, globalPipe, globalAddons = [], defaultQueue } = opts;
16
16
  const metaMap = createControllerMetaMap(meta, (meta2) => {
17
- const { controller, rpc, func, tag } = meta2.data;
17
+ const { controller, rpc, method, tag } = meta2.data;
18
18
  if (controller === "rpc" && rpc?.queue !== void 0) {
19
- debug(`register method "${func}" in module "${tag}"`);
19
+ debug(`register method "${method}" in module "${tag}"`);
20
20
  return true;
21
21
  }
22
22
  });
@@ -32,8 +32,8 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
32
32
  async function subscribeQueues() {
33
33
  existQueue.clear();
34
34
  for (const [tag, record] of metaMap) {
35
- for (const func in record) {
36
- const meta2 = metaMap.get(tag)[func];
35
+ for (const method in record) {
36
+ const meta2 = metaMap.get(tag)[method];
37
37
  const { data: { rpc } } = meta2;
38
38
  if (rpc) {
39
39
  const queue = rpc.queue || defaultQueue || tag;
@@ -49,10 +49,10 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
49
49
  if (!existQueue.has(channel)) return;
50
50
  if (msg) {
51
51
  const data = JSON.parse(msg);
52
- const { func, id, tag, queue: clientQueue, _ps, args } = data;
53
- debug(`invoke method "${func}" in module "${tag}"`);
52
+ const { method, id, tag, queue: clientQueue, _ps, args } = data;
53
+ debug(`invoke method "${method}" in module "${tag}"`);
54
54
  if (_ps !== 1) return;
55
- const meta2 = metaMap.get(tag)[func];
55
+ const meta2 = metaMap.get(tag)[method];
56
56
  const { data: { rpc: { isEvent } = {} } } = meta2;
57
57
  const aop = Context.getAop(meta2, {
58
58
  globalFilter,
@@ -68,7 +68,7 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
68
68
  msg,
69
69
  channel,
70
70
  tag,
71
- func,
71
+ method,
72
72
  args,
73
73
  id,
74
74
  isEvent,
@@ -1,8 +1,8 @@
1
1
  import WS from 'ws';
2
- import { F as Factory } from '../../core-B5yKYkMJ.mjs';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-7-m2wEkP.mjs';
2
+ import { F as Factory } from '../../core-D1YYphEn.mjs';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-BOZ8yE2L.mjs';
4
4
  import 'phecda-core';
5
- import '../../meta-C_eDyXnK.mjs';
5
+ import '../../meta-DNF6Fl27.mjs';
6
6
 
7
7
  interface WsCtx extends RpcCtx {
8
8
  type: 'ws';
@@ -1,8 +1,8 @@
1
1
  import WS from 'ws';
2
- import { F as Factory } from '../../core-BRuvL6hY.js';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-B6aU8oT-.js';
2
+ import { F as Factory } from '../../core-BTSHIAyB.js';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-YJ55P7A_.js';
4
4
  import 'phecda-core';
5
- import '../../meta-C_eDyXnK.js';
5
+ import '../../meta-DNF6Fl27.js';
6
6
 
7
7
  interface WsCtx extends RpcCtx {
8
8
  type: 'ws';
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkOV3UJLGPjs = require('../../chunk-OV3UJLGP.js');
5
+ var _chunkYJ3QHGTCjs = require('../../chunk-YJ3QHGTC.js');
6
6
 
7
7
 
8
8
  var _chunk4LLLQOMFjs = require('../../chunk-4LLLQOMF.js');
@@ -13,14 +13,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/ws");
13
13
  function bind(wss, data, opts = {}) {
14
14
  const { globalGuards, globalAddons, globalFilter, globalPipe } = opts;
15
15
  const { moduleMap, meta } = data;
16
- const metaMap = _chunkOV3UJLGPjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
- const { controller, rpc, func, tag } = meta2.data;
16
+ const metaMap = _chunkYJ3QHGTCjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const { controller, rpc, method, tag } = meta2.data;
18
18
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
19
- debug(`register method "${func}" in module "${tag}"`);
19
+ debug(`register method "${method}" in module "${tag}"`);
20
20
  return true;
21
21
  }
22
22
  });
23
- _chunkOV3UJLGPjs.detectAopDep.call(void 0, meta, {
23
+ _chunkYJ3QHGTCjs.detectAopDep.call(void 0, meta, {
24
24
  guards: globalGuards,
25
25
  addons: globalAddons
26
26
  }, "rpc");
@@ -28,22 +28,22 @@ function bind(wss, data, opts = {}) {
28
28
  ws.on("message", async (raw) => {
29
29
  try {
30
30
  const data2 = JSON.parse(raw.toString());
31
- const { func, id, tag, _ps, args, queue } = data2;
31
+ const { method, id, tag, _ps, args, queue } = data2;
32
32
  if (_ps !== 1) return;
33
- const meta2 = metaMap.get(tag)[func];
33
+ const meta2 = metaMap.get(tag)[method];
34
34
  const { data: { rpc: { isEvent } = {} } } = meta2;
35
- const aop = _chunkOV3UJLGPjs.Context.getAop(meta2, {
35
+ const aop = _chunkYJ3QHGTCjs.Context.getAop(meta2, {
36
36
  globalFilter,
37
37
  globalGuards,
38
38
  globalPipe
39
39
  });
40
- const context = new (0, _chunkOV3UJLGPjs.Context)({
40
+ const context = new (0, _chunkYJ3QHGTCjs.Context)({
41
41
  type: "ws",
42
42
  category: "rpc",
43
43
  meta: meta2,
44
44
  moduleMap,
45
45
  tag,
46
- func,
46
+ method,
47
47
  args,
48
48
  id,
49
49
  queue,
@@ -2,7 +2,7 @@ import {
2
2
  Context,
3
3
  createControllerMetaMap,
4
4
  detectAopDep
5
- } from "../../chunk-P3CS65OP.mjs";
5
+ } from "../../chunk-VAHCYYCB.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "../../chunk-NQ55PA2X.mjs";
@@ -14,9 +14,9 @@ function bind(wss, data, opts = {}) {
14
14
  const { globalGuards, globalAddons, globalFilter, globalPipe } = opts;
15
15
  const { moduleMap, meta } = data;
16
16
  const metaMap = createControllerMetaMap(meta, (meta2) => {
17
- const { controller, rpc, func, tag } = meta2.data;
17
+ const { controller, rpc, method, tag } = meta2.data;
18
18
  if (controller === "rpc" && rpc?.queue !== void 0) {
19
- debug(`register method "${func}" in module "${tag}"`);
19
+ debug(`register method "${method}" in module "${tag}"`);
20
20
  return true;
21
21
  }
22
22
  });
@@ -28,9 +28,9 @@ function bind(wss, data, opts = {}) {
28
28
  ws.on("message", async (raw) => {
29
29
  try {
30
30
  const data2 = JSON.parse(raw.toString());
31
- const { func, id, tag, _ps, args, queue } = data2;
31
+ const { method, id, tag, _ps, args, queue } = data2;
32
32
  if (_ps !== 1) return;
33
- const meta2 = metaMap.get(tag)[func];
33
+ const meta2 = metaMap.get(tag)[method];
34
34
  const { data: { rpc: { isEvent } = {} } } = meta2;
35
35
  const aop = Context.getAop(meta2, {
36
36
  globalFilter,
@@ -43,7 +43,7 @@ function bind(wss, data, opts = {}) {
43
43
  meta: meta2,
44
44
  moduleMap,
45
45
  tag,
46
- func,
46
+ method,
47
47
  args,
48
48
  id,
49
49
  queue,
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-B5yKYkMJ.mjs';
6
- import { C as CustomResponse } from './meta-C_eDyXnK.mjs';
5
+ import { F as Factory } from './core-D1YYphEn.mjs';
6
+ import { C as CustomResponse } from './meta-DNF6Fl27.mjs';
7
7
 
8
8
  type PickFuncKeys<Type> = {
9
9
  [Key in keyof Type]: Type[Key] extends (...args: any) => any ? (ReturnType<Type[Key]> extends CustomResponse<any> ? never : Key) : never;
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-BRuvL6hY.js';
6
- import { C as CustomResponse } from './meta-C_eDyXnK.js';
5
+ import { F as Factory } from './core-BTSHIAyB.js';
6
+ import { C as CustomResponse } from './meta-DNF6Fl27.js';
7
7
 
8
8
  type PickFuncKeys<Type> = {
9
9
  [Key in keyof Type]: Type[Key] extends (...args: any) => any ? (ReturnType<Type[Key]> extends CustomResponse<any> ? never : Key) : never;
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 _chunkYRS4ECPTjs = require('./chunk-YRS4ECPT.js');
3
+ var _chunkOLNN4U3Ojs = require('./chunk-OLNN4U3O.js');
4
4
 
5
5
 
6
6
  var _chunk4LLLQOMFjs = require('./chunk-4LLLQOMF.js');
@@ -8,7 +8,7 @@ var _chunk4LLLQOMFjs = require('./chunk-4LLLQOMF.js');
8
8
  // src/test.ts
9
9
  var _phecdacore = require('phecda-core');
10
10
  async function TestFactory(...Modules) {
11
- const { moduleMap, modelMap } = await _chunkYRS4ECPTjs.Factory.call(void 0, Modules);
11
+ const { moduleMap, modelMap } = await _chunkOLNN4U3Ojs.Factory.call(void 0, Modules);
12
12
  return {
13
13
  get(Model) {
14
14
  const tag = _phecdacore.getTag.call(void 0, Model);
@@ -29,13 +29,13 @@ async function TestHttp(app, { moduleMap, meta }, isAgent = true) {
29
29
  if (!module2) throw new Error(`module "${String(tag)}" doesn't exist`);
30
30
  return new Proxy({}, {
31
31
  get(_target, p) {
32
- const { data } = meta.find(({ data: data2 }) => data2.name === Module.name && data2.func === p && data2.tag === tag);
32
+ const { data } = meta.find(({ data: data2 }) => data2.name === Module.name && data2.method === p && data2.tag === tag);
33
33
  return (...args) => {
34
34
  const ret = {
35
35
  body: {},
36
36
  headers: {},
37
37
  query: {},
38
- func: data.http.type,
38
+ method: data.http.method,
39
39
  url: data.http.prefix + data.http.route
40
40
  };
41
41
  data.params.forEach((item) => {
@@ -50,7 +50,7 @@ async function TestHttp(app, { moduleMap, meta }, isAgent = true) {
50
50
  if (item.key) ret[item.type][item.key] = args[item.index];
51
51
  else ret[item.type] = args[item.index];
52
52
  });
53
- let agent2 = (isAgent ? Agent : request(app))[ret.func](ret.url);
53
+ let agent2 = (isAgent ? Agent : request(app))[ret.method](ret.url);
54
54
  if (Object.keys(ret.query).length > 0) agent2 = agent2.query(ret.query);
55
55
  if (Object.keys(ret.headers).length > 0) agent2 = agent2.set(ret.headers);
56
56
  if (Object.keys(ret.body).length > 0) agent2 = agent2.send(ret.body);
package/dist/test.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Factory
3
- } from "./chunk-5MAGRSEM.mjs";
3
+ } from "./chunk-PFPOEZHH.mjs";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-NQ55PA2X.mjs";
@@ -29,13 +29,13 @@ async function TestHttp(app, { moduleMap, meta }, isAgent = true) {
29
29
  if (!module2) throw new Error(`module "${String(tag)}" doesn't exist`);
30
30
  return new Proxy({}, {
31
31
  get(_target, p) {
32
- const { data } = meta.find(({ data: data2 }) => data2.name === Module.name && data2.func === p && data2.tag === tag);
32
+ const { data } = meta.find(({ data: data2 }) => data2.name === Module.name && data2.method === p && data2.tag === tag);
33
33
  return (...args) => {
34
34
  const ret = {
35
35
  body: {},
36
36
  headers: {},
37
37
  query: {},
38
- func: data.http.type,
38
+ method: data.http.method,
39
39
  url: data.http.prefix + data.http.route
40
40
  };
41
41
  data.params.forEach((item) => {
@@ -50,7 +50,7 @@ async function TestHttp(app, { moduleMap, meta }, isAgent = true) {
50
50
  if (item.key) ret[item.type][item.key] = args[item.index];
51
51
  else ret[item.type] = args[item.index];
52
52
  });
53
- let agent2 = (isAgent ? Agent : request(app))[ret.func](ret.url);
53
+ let agent2 = (isAgent ? Agent : request(app))[ret.method](ret.url);
54
54
  if (Object.keys(ret.query).length > 0) agent2 = agent2.query(ret.query);
55
55
  if (Object.keys(ret.headers).length > 0) agent2 = agent2.set(ret.headers);
56
56
  if (Object.keys(ret.body).length > 0) agent2 = agent2.send(ret.body);
@@ -1,4 +1,4 @@
1
- import { B as BaseCtx, D as DefaultOptions } from './meta-C_eDyXnK.mjs';
1
+ import { B as BaseCtx, D as DefaultOptions } from './meta-DNF6Fl27.mjs';
2
2
 
3
3
  interface RpcServerOptions extends DefaultOptions {
4
4
  defaultQueue?: string;
@@ -1,5 +1,5 @@
1
1
  import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http';
2
- import { B as BaseCtx, D as DefaultOptions } from './meta-C_eDyXnK.js';
2
+ import { B as BaseCtx, D as DefaultOptions } from './meta-DNF6Fl27.js';
3
3
 
4
4
  interface HttpOptions extends DefaultOptions {
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http';
2
- import { B as BaseCtx, D as DefaultOptions } from './meta-C_eDyXnK.mjs';
2
+ import { B as BaseCtx, D as DefaultOptions } from './meta-DNF6Fl27.mjs';
3
3
 
4
4
  interface HttpOptions extends DefaultOptions {
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { B as BaseCtx, D as DefaultOptions } from './meta-C_eDyXnK.js';
1
+ import { B as BaseCtx, D as DefaultOptions } from './meta-DNF6Fl27.js';
2
2
 
3
3
  interface RpcServerOptions extends DefaultOptions {
4
4
  defaultQueue?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-server",
3
- "version": "7.1.4",
3
+ "version": "8.0.0",
4
4
  "description": "server framework that provide IOC/type-reuse/http&rpc-adaptor",
5
5
  "author": "fgsreally",
6
6
  "license": "MIT",
@@ -151,15 +151,14 @@
151
151
  "bin"
152
152
  ],
153
153
  "dependencies": {
154
- "@swc-node/core": "^1.10.6",
154
+ "@swc-node/core": "^1.13.3",
155
155
  "cac": "^6.7.14",
156
156
  "chokidar": "^3.5.3",
157
157
  "debug": "^4.3.4",
158
158
  "fs-extra": "^11.2.0",
159
159
  "picocolors": "^1.0.0",
160
- "reflect-metadata": "^0.1.13",
161
160
  "ts-mixer": "^6.0.4",
162
- "phecda-core": "4.5.1"
161
+ "phecda-core": "5.0.0"
163
162
  },
164
163
  "devDependencies": {
165
164
  "@koa/router": "^12.0.1",