phecda-server 8.6.0 → 8.7.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 (92) hide show
  1. package/bin/cli.mjs +1 -9
  2. package/dist/{chunk-XOWAQGBO.js → chunk-CCK6KDM3.js} +59 -65
  3. package/dist/{chunk-LLF55NZP.js → chunk-IBVPZSZJ.js} +6 -6
  4. package/dist/{chunk-URKOYTBU.mjs → chunk-ITDH2YDL.mjs} +6 -6
  5. package/dist/{chunk-5ZZAOOKE.js → chunk-KVWT2QTL.js} +26 -26
  6. package/dist/{chunk-LQFHZGVJ.mjs → chunk-LNL3MVTR.mjs} +2 -8
  7. package/dist/{chunk-ZHNYWZRL.mjs → chunk-T5F6Q2CZ.mjs} +1 -1
  8. package/dist/{chunk-MUUKKO67.mjs → chunk-UK3RDUEP.mjs} +1 -1
  9. package/dist/{chunk-SKGOTR4T.js → chunk-UP64TNWR.js} +20 -20
  10. package/dist/{core-BiS3xJKx.d.ts → core-Bd2ynlyb.d.ts} +1 -1
  11. package/dist/{core-BYxcQ8kf.d.mts → core-nqk9d66O.d.mts} +1 -1
  12. package/dist/helper.d.mts +1 -1
  13. package/dist/helper.d.ts +1 -1
  14. package/dist/helper.js +3 -3
  15. package/dist/helper.mjs +2 -2
  16. package/dist/http/elysia/index.d.mts +3 -3
  17. package/dist/http/elysia/index.d.ts +3 -3
  18. package/dist/http/elysia/index.js +40 -40
  19. package/dist/http/elysia/index.mjs +3 -3
  20. package/dist/http/express/index.d.mts +3 -3
  21. package/dist/http/express/index.d.ts +3 -3
  22. package/dist/http/express/index.js +37 -37
  23. package/dist/http/express/index.mjs +2 -2
  24. package/dist/http/fastify/index.d.mts +3 -3
  25. package/dist/http/fastify/index.d.ts +3 -3
  26. package/dist/http/fastify/index.js +38 -38
  27. package/dist/http/fastify/index.mjs +3 -3
  28. package/dist/http/h3/index.d.mts +3 -3
  29. package/dist/http/h3/index.d.ts +3 -3
  30. package/dist/http/h3/index.js +38 -38
  31. package/dist/http/h3/index.mjs +2 -2
  32. package/dist/http/hono/index.d.mts +3 -3
  33. package/dist/http/hono/index.d.ts +3 -3
  34. package/dist/http/hono/index.js +34 -34
  35. package/dist/http/hono/index.mjs +2 -2
  36. package/dist/http/hyper-express/index.d.mts +3 -3
  37. package/dist/http/hyper-express/index.d.ts +3 -3
  38. package/dist/http/hyper-express/index.js +35 -35
  39. package/dist/http/hyper-express/index.mjs +2 -2
  40. package/dist/http/koa/index.d.mts +3 -3
  41. package/dist/http/koa/index.d.ts +3 -3
  42. package/dist/http/koa/index.js +37 -37
  43. package/dist/http/koa/index.mjs +2 -2
  44. package/dist/index.d.mts +8 -8
  45. package/dist/index.d.ts +8 -8
  46. package/dist/index.js +54 -54
  47. package/dist/index.mjs +14 -14
  48. package/dist/{meta-Csp1xcSR.d.mts → meta-ZbvaS7xK.d.mts} +2 -2
  49. package/dist/{meta-Csp1xcSR.d.ts → meta-ZbvaS7xK.d.ts} +2 -2
  50. package/dist/rpc/bullmq/index.d.mts +3 -3
  51. package/dist/rpc/bullmq/index.d.ts +3 -3
  52. package/dist/rpc/bullmq/index.js +11 -11
  53. package/dist/rpc/bullmq/index.mjs +2 -2
  54. package/dist/rpc/electron/index.d.mts +3 -3
  55. package/dist/rpc/electron/index.d.ts +3 -3
  56. package/dist/rpc/electron/index.js +8 -8
  57. package/dist/rpc/electron/index.mjs +2 -2
  58. package/dist/rpc/kafka/index.d.mts +3 -3
  59. package/dist/rpc/kafka/index.d.ts +3 -3
  60. package/dist/rpc/kafka/index.js +10 -10
  61. package/dist/rpc/kafka/index.mjs +2 -2
  62. package/dist/rpc/nats/index.d.mts +3 -3
  63. package/dist/rpc/nats/index.d.ts +3 -3
  64. package/dist/rpc/nats/index.js +11 -11
  65. package/dist/rpc/nats/index.mjs +2 -2
  66. package/dist/rpc/rabbitmq/index.d.mts +3 -3
  67. package/dist/rpc/rabbitmq/index.d.ts +3 -3
  68. package/dist/rpc/rabbitmq/index.js +12 -12
  69. package/dist/rpc/rabbitmq/index.mjs +2 -2
  70. package/dist/rpc/redis/index.d.mts +3 -3
  71. package/dist/rpc/redis/index.d.ts +3 -3
  72. package/dist/rpc/redis/index.js +10 -10
  73. package/dist/rpc/redis/index.mjs +2 -2
  74. package/dist/rpc/web-ext/index.d.mts +3 -3
  75. package/dist/rpc/web-ext/index.d.ts +3 -3
  76. package/dist/rpc/web-ext/index.js +8 -8
  77. package/dist/rpc/web-ext/index.mjs +2 -2
  78. package/dist/rpc/ws/index.d.mts +3 -3
  79. package/dist/rpc/ws/index.d.ts +3 -3
  80. package/dist/rpc/ws/index.js +7 -7
  81. package/dist/rpc/ws/index.mjs +2 -2
  82. package/dist/test.d.mts +2 -2
  83. package/dist/test.d.ts +2 -2
  84. package/dist/test.js +6 -6
  85. package/dist/test.mjs +2 -2
  86. package/dist/{types-Bs64nYvd.d.ts → types-B4zY7i87.d.ts} +1 -1
  87. package/dist/{types-CjVwVyJT.d.mts → types-BfcBZVua.d.mts} +1 -1
  88. package/dist/{types-DExQe0qk.d.ts → types-CHWgzilt.d.ts} +1 -1
  89. package/dist/{types-DSlyrmns.d.mts → types-f_hV_rCD.d.mts} +1 -1
  90. package/package.json +1 -1
  91. package/register/index.mjs +2 -0
  92. package/register/loader.mjs +3 -3
package/dist/index.mjs CHANGED
@@ -1,12 +1,3 @@
1
- import {
2
- Factory,
3
- Meta,
4
- ServerPhecda,
5
- defaultServerInject,
6
- emitter,
7
- phecdaNamespace,
8
- useS
9
- } from "./chunk-ZHNYWZRL.mjs";
10
1
  import {
11
2
  Addon,
12
3
  ApiDoc,
@@ -33,7 +24,16 @@ import {
33
24
  Rpc,
34
25
  Search,
35
26
  UploadFile
36
- } from "./chunk-MUUKKO67.mjs";
27
+ } from "./chunk-UK3RDUEP.mjs";
28
+ import {
29
+ Factory,
30
+ Meta,
31
+ ServerPhecda,
32
+ defaultServerInject,
33
+ emitter,
34
+ phecdaNamespace,
35
+ useS
36
+ } from "./chunk-T5F6Q2CZ.mjs";
37
37
  import {
38
38
  BadGatewayException,
39
39
  BadRequestException,
@@ -60,12 +60,12 @@ import {
60
60
  defaultFilter,
61
61
  defaultPipe,
62
62
  joinUrl
63
- } from "./chunk-LQFHZGVJ.mjs";
63
+ } from "./chunk-LNL3MVTR.mjs";
64
64
  import {
65
65
  ERROR_SYMBOL,
66
- IS_DEV,
67
66
  IS_ONLY_GENERATE,
68
67
  IS_PURE,
68
+ IS_RUNTIME,
69
69
  IS_STRICT,
70
70
  LOG_LEVEL,
71
71
  Mixin,
@@ -75,7 +75,7 @@ import {
75
75
  log,
76
76
  runMiddleware,
77
77
  setLogger
78
- } from "./chunk-URKOYTBU.mjs";
78
+ } from "./chunk-ITDH2YDL.mjs";
79
79
 
80
80
  // src/types.ts
81
81
  var CustomResponse = class {
@@ -564,9 +564,9 @@ export {
564
564
  Head,
565
565
  Header,
566
566
  HttpBase,
567
- IS_DEV,
568
567
  IS_ONLY_GENERATE,
569
568
  IS_PURE,
569
+ IS_RUNTIME,
570
570
  IS_STRICT,
571
571
  InvalidInputException,
572
572
  LOG_LEVEL,
@@ -1,7 +1,7 @@
1
1
  import { Events, Construct } from 'phecda-core';
2
2
 
3
3
  declare const ERROR_SYMBOL = "__PS_ERROR__";
4
- declare const IS_DEV: boolean;
4
+ declare const IS_RUNTIME: boolean;
5
5
  declare const IS_ONLY_GENERATE: boolean;
6
6
  declare const IS_STRICT: boolean;
7
7
  declare const IS_PURE: boolean;
@@ -91,4 +91,4 @@ interface ControllerMeta extends Meta {
91
91
  data: ControllerMetaData;
92
92
  }
93
93
 
94
- export { type BaseCtx as B, type ControllerMeta as C, type DefaultOptions as D, type Emitter as E, IS_DEV as I, LOG_LEVEL as L, Meta as M, PS_EXIT_CODE as P, type ServiceMetaData as S, type BaseError as a, type ControllerMetaData as b, type BaseRequestMethod as c, CustomResponse as d, ERROR_SYMBOL as e, type ExtractResponse as f, IS_ONLY_GENERATE as g, IS_PURE as h, IS_STRICT as i, type MetaData as j };
94
+ export { type BaseCtx as B, type ControllerMeta as C, type DefaultOptions as D, type Emitter as E, IS_ONLY_GENERATE as I, LOG_LEVEL as L, Meta as M, PS_EXIT_CODE as P, type ServiceMetaData as S, type BaseError as a, type ControllerMetaData as b, type BaseRequestMethod as c, CustomResponse as d, ERROR_SYMBOL as e, type ExtractResponse as f, IS_PURE as g, IS_RUNTIME as h, IS_STRICT as i, type MetaData as j };
@@ -1,7 +1,7 @@
1
1
  import { Events, Construct } from 'phecda-core';
2
2
 
3
3
  declare const ERROR_SYMBOL = "__PS_ERROR__";
4
- declare const IS_DEV: boolean;
4
+ declare const IS_RUNTIME: boolean;
5
5
  declare const IS_ONLY_GENERATE: boolean;
6
6
  declare const IS_STRICT: boolean;
7
7
  declare const IS_PURE: boolean;
@@ -91,4 +91,4 @@ interface ControllerMeta extends Meta {
91
91
  data: ControllerMetaData;
92
92
  }
93
93
 
94
- export { type BaseCtx as B, type ControllerMeta as C, type DefaultOptions as D, type Emitter as E, IS_DEV as I, LOG_LEVEL as L, Meta as M, PS_EXIT_CODE as P, type ServiceMetaData as S, type BaseError as a, type ControllerMetaData as b, type BaseRequestMethod as c, CustomResponse as d, ERROR_SYMBOL as e, type ExtractResponse as f, IS_ONLY_GENERATE as g, IS_PURE as h, IS_STRICT as i, type MetaData as j };
94
+ export { type BaseCtx as B, type ControllerMeta as C, type DefaultOptions as D, type Emitter as E, IS_ONLY_GENERATE as I, LOG_LEVEL as L, Meta as M, PS_EXIT_CODE as P, type ServiceMetaData as S, type BaseError as a, type ControllerMetaData as b, type BaseRequestMethod as c, CustomResponse as d, ERROR_SYMBOL as e, type ExtractResponse as f, IS_PURE as g, IS_RUNTIME as h, IS_STRICT as i, type MetaData as j };
@@ -1,8 +1,8 @@
1
1
  import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
2
- import { F as Factory } from '../../core-BYxcQ8kf.mjs';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-DSlyrmns.mjs';
2
+ import { F as Factory } from '../../core-nqk9d66O.mjs';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-f_hV_rCD.mjs';
4
4
  import 'phecda-core';
5
- import '../../meta-Csp1xcSR.mjs';
5
+ import '../../meta-ZbvaS7xK.mjs';
6
6
 
7
7
  interface BullmqCtx extends RpcCtx {
8
8
  type: 'bullmq';
@@ -1,8 +1,8 @@
1
1
  import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
2
- import { F as Factory } from '../../core-BiS3xJKx.js';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-DExQe0qk.js';
2
+ import { F as Factory } from '../../core-Bd2ynlyb.js';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-CHWgzilt.js';
4
4
  import 'phecda-core';
5
- import '../../meta-Csp1xcSR.js';
5
+ import '../../meta-ZbvaS7xK.js';
6
6
 
7
7
  interface BullmqCtx extends RpcCtx {
8
8
  type: 'bullmq';
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkXOWAQGBOjs = require('../../chunk-XOWAQGBO.js');
5
+ var _chunkCCK6KDM3js = require('../../chunk-CCK6KDM3.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkLLF55NZPjs = require('../../chunk-LLF55NZP.js');
9
+ var _chunkIBVPZSZJjs = require('../../chunk-IBVPZSZJ.js');
10
10
 
11
11
  // src/rpc/bullmq/create.ts
12
12
  var _bullmq = require('bullmq');
@@ -17,14 +17,14 @@ async function create({ moduleMap, meta }, opts = {}) {
17
17
  const workerMap = {};
18
18
  const queueMap = {};
19
19
  const existQueue = /* @__PURE__ */ new Set();
20
- const metaMap = _chunkXOWAQGBOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
20
+ const metaMap = _chunkCCK6KDM3js.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
21
  const { controller, rpc, method, tag } = meta2.data;
22
22
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
23
23
  debug(`register method "${method}" in module "${tag}"`);
24
24
  return true;
25
25
  }
26
26
  });
27
- _chunkXOWAQGBOjs.detectAopDep.call(void 0, meta, {
27
+ _chunkCCK6KDM3js.detectAopDep.call(void 0, meta, {
28
28
  guards: globalGuards
29
29
  }, "rpc");
30
30
  async function subscribeQueues() {
@@ -38,12 +38,12 @@ async function create({ moduleMap, meta }, opts = {}) {
38
38
  if (existQueue.has(queue)) continue;
39
39
  existQueue.add(queue);
40
40
  workerMap[queue] = new (0, _bullmq.Worker)(queue, handleRequest, workerOpts);
41
- _chunkXOWAQGBOjs.Context.applyAddons(addons, workerMap[queue], "bullmq");
41
+ _chunkCCK6KDM3js.Context.applyAddons(addons, workerMap[queue], "bullmq");
42
42
  }
43
43
  }
44
44
  }
45
45
  }
46
- _chunkLLF55NZPjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
46
+ _chunkIBVPZSZJjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
47
47
  async function handleRequest(job) {
48
48
  const { data } = job;
49
49
  const { tag, method, args, id, queue: clientQueue, _ps } = data;
@@ -52,12 +52,12 @@ async function create({ moduleMap, meta }, opts = {}) {
52
52
  const meta2 = metaMap.get(tag)[method];
53
53
  const { data: { rpc: { isEvent } = {} } } = meta2;
54
54
  if (!isEvent && !(clientQueue in queueMap)) queueMap[clientQueue] = new (0, _bullmq.Queue)(clientQueue, queueOpts);
55
- const aop = _chunkXOWAQGBOjs.Context.getAop(meta2, {
55
+ const aop = _chunkCCK6KDM3js.Context.getAop(meta2, {
56
56
  globalFilter,
57
57
  globalGuards,
58
58
  globalPipe
59
59
  });
60
- const context = new (0, _chunkXOWAQGBOjs.Context)({
60
+ const context = new (0, _chunkCCK6KDM3js.Context)({
61
61
  type: "bullmq",
62
62
  category: "rpc",
63
63
  moduleMap,
@@ -85,9 +85,9 @@ async function create({ moduleMap, meta }, opts = {}) {
85
85
  }
86
86
  });
87
87
  }
88
- _chunkLLF55NZPjs.__name.call(void 0, handleRequest, "handleRequest");
88
+ _chunkIBVPZSZJjs.__name.call(void 0, handleRequest, "handleRequest");
89
89
  subscribeQueues();
90
- _chunkLLF55NZPjs.HMR.call(void 0, async () => {
90
+ _chunkIBVPZSZJjs.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();
@@ -97,7 +97,7 @@ async function create({ moduleMap, meta }, opts = {}) {
97
97
  queueMap
98
98
  };
99
99
  }
100
- _chunkLLF55NZPjs.__name.call(void 0, create, "create");
100
+ _chunkIBVPZSZJjs.__name.call(void 0, create, "create");
101
101
 
102
102
 
103
103
  exports.create = create;
@@ -2,11 +2,11 @@ import {
2
2
  Context,
3
3
  createControllerMetaMap,
4
4
  detectAopDep
5
- } from "../../chunk-LQFHZGVJ.mjs";
5
+ } from "../../chunk-LNL3MVTR.mjs";
6
6
  import {
7
7
  HMR,
8
8
  __name
9
- } from "../../chunk-URKOYTBU.mjs";
9
+ } from "../../chunk-ITDH2YDL.mjs";
10
10
 
11
11
  // src/rpc/bullmq/create.ts
12
12
  import { Queue, Worker } from "bullmq";
@@ -1,8 +1,8 @@
1
1
  import Electron from 'electron';
2
- import { F as Factory } from '../../core-BYxcQ8kf.mjs';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-DSlyrmns.mjs';
2
+ import { F as Factory } from '../../core-nqk9d66O.mjs';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-f_hV_rCD.mjs';
4
4
  import 'phecda-core';
5
- import '../../meta-Csp1xcSR.mjs';
5
+ import '../../meta-ZbvaS7xK.mjs';
6
6
 
7
7
  interface ElectronCtx extends RpcCtx {
8
8
  type: 'electron';
@@ -1,8 +1,8 @@
1
1
  import Electron from 'electron';
2
- import { F as Factory } from '../../core-BiS3xJKx.js';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-DExQe0qk.js';
2
+ import { F as Factory } from '../../core-Bd2ynlyb.js';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-CHWgzilt.js';
4
4
  import 'phecda-core';
5
- import '../../meta-Csp1xcSR.js';
5
+ import '../../meta-ZbvaS7xK.js';
6
6
 
7
7
  interface ElectronCtx extends RpcCtx {
8
8
  type: 'electron';
@@ -2,24 +2,24 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkXOWAQGBOjs = require('../../chunk-XOWAQGBO.js');
5
+ var _chunkCCK6KDM3js = require('../../chunk-CCK6KDM3.js');
6
6
 
7
7
 
8
- var _chunkLLF55NZPjs = require('../../chunk-LLF55NZP.js');
8
+ var _chunkIBVPZSZJjs = require('../../chunk-IBVPZSZJ.js');
9
9
 
10
10
  // src/rpc/electron/bind.ts
11
11
  var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
12
12
  var debug = _debug2.default.call(void 0, "phecda-server/electron");
13
13
  function bind(IPC, { moduleMap, meta }, opts = {}) {
14
14
  const { globalGuards, globalFilter, globalPipe, globalAddons = [] } = opts;
15
- const metaMap = _chunkXOWAQGBOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
15
+ const metaMap = _chunkCCK6KDM3js.createControllerMetaMap.call(void 0, meta, (meta2) => {
16
16
  const { controller, rpc, method, tag } = meta2.data;
17
17
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
18
18
  debug(`register method "${method}" in module "${tag}"`);
19
19
  return true;
20
20
  }
21
21
  });
22
- _chunkXOWAQGBOjs.detectAopDep.call(void 0, meta, {
22
+ _chunkCCK6KDM3js.detectAopDep.call(void 0, meta, {
23
23
  guards: globalGuards,
24
24
  addons: globalAddons
25
25
  }, "rpc");
@@ -31,12 +31,12 @@ function bind(IPC, { moduleMap, meta }, opts = {}) {
31
31
  if (_ps !== 1) return;
32
32
  const meta2 = metaMap.get(tag)[method];
33
33
  const { data: { rpc: { isEvent } = {} } } = meta2;
34
- const aop = _chunkXOWAQGBOjs.Context.getAop(meta2, {
34
+ const aop = _chunkCCK6KDM3js.Context.getAop(meta2, {
35
35
  globalFilter,
36
36
  globalGuards,
37
37
  globalPipe
38
38
  });
39
- const context = new (0, _chunkXOWAQGBOjs.Context)({
39
+ const context = new (0, _chunkCCK6KDM3js.Context)({
40
40
  type: "electron",
41
41
  category: "rpc",
42
42
  moduleMap,
@@ -64,9 +64,9 @@ function bind(IPC, { moduleMap, meta }, opts = {}) {
64
64
  }
65
65
  });
66
66
  }
67
- _chunkLLF55NZPjs.__name.call(void 0, callback, "callback");
67
+ _chunkIBVPZSZJjs.__name.call(void 0, callback, "callback");
68
68
  }
69
- _chunkLLF55NZPjs.__name.call(void 0, bind, "bind");
69
+ _chunkIBVPZSZJjs.__name.call(void 0, bind, "bind");
70
70
 
71
71
 
72
72
  exports.bind = bind;
@@ -2,10 +2,10 @@ import {
2
2
  Context,
3
3
  createControllerMetaMap,
4
4
  detectAopDep
5
- } from "../../chunk-LQFHZGVJ.mjs";
5
+ } from "../../chunk-LNL3MVTR.mjs";
6
6
  import {
7
7
  __name
8
- } from "../../chunk-URKOYTBU.mjs";
8
+ } from "../../chunk-ITDH2YDL.mjs";
9
9
 
10
10
  // src/rpc/electron/bind.ts
11
11
  import Debug from "debug";
@@ -1,8 +1,8 @@
1
1
  import { Consumer, Producer } from 'kafkajs';
2
- import { F as Factory } from '../../core-BYxcQ8kf.mjs';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-DSlyrmns.mjs';
2
+ import { F as Factory } from '../../core-nqk9d66O.mjs';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-f_hV_rCD.mjs';
4
4
  import 'phecda-core';
5
- import '../../meta-Csp1xcSR.mjs';
5
+ import '../../meta-ZbvaS7xK.mjs';
6
6
 
7
7
  interface KafkaCtx extends RpcCtx {
8
8
  type: 'kafka';
@@ -1,8 +1,8 @@
1
1
  import { Consumer, Producer } from 'kafkajs';
2
- import { F as Factory } from '../../core-BiS3xJKx.js';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-DExQe0qk.js';
2
+ import { F as Factory } from '../../core-Bd2ynlyb.js';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-CHWgzilt.js';
4
4
  import 'phecda-core';
5
- import '../../meta-Csp1xcSR.js';
5
+ import '../../meta-ZbvaS7xK.js';
6
6
 
7
7
  interface KafkaCtx extends RpcCtx {
8
8
  type: 'kafka';
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkXOWAQGBOjs = require('../../chunk-XOWAQGBO.js');
5
+ var _chunkCCK6KDM3js = require('../../chunk-CCK6KDM3.js');
6
6
 
7
7
 
8
- var _chunkLLF55NZPjs = require('../../chunk-LLF55NZP.js');
8
+ var _chunkIBVPZSZJjs = require('../../chunk-IBVPZSZJ.js');
9
9
 
10
10
  // src/rpc/kafka/bind.ts
11
11
  var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
@@ -13,18 +13,18 @@ var debug = _debug2.default.call(void 0, "phecda-server/kafka");
13
13
  async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
14
14
  const { globalGuards, globalFilter, globalPipe, globalAddons = [], defaultQueue } = opts;
15
15
  const existQueue = /* @__PURE__ */ new Set();
16
- const metaMap = _chunkXOWAQGBOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
16
+ const metaMap = _chunkCCK6KDM3js.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
17
  const { controller, rpc, method, tag } = meta2.data;
18
18
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
19
19
  debug(`register method "${method}" in module "${tag}"`);
20
20
  return true;
21
21
  }
22
22
  });
23
- _chunkXOWAQGBOjs.detectAopDep.call(void 0, meta, {
23
+ _chunkCCK6KDM3js.detectAopDep.call(void 0, meta, {
24
24
  guards: globalGuards,
25
25
  addons: globalAddons
26
26
  }, "rpc");
27
- _chunkXOWAQGBOjs.Context.applyAddons(globalAddons, {
27
+ _chunkCCK6KDM3js.Context.applyAddons(globalAddons, {
28
28
  consumer,
29
29
  producer
30
30
  }, "kafka");
@@ -46,10 +46,10 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
46
46
  }
47
47
  }
48
48
  }
49
- _chunkLLF55NZPjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
49
+ _chunkIBVPZSZJjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
50
50
  await subscribeQueues();
51
51
  await consumer.run({
52
- eachMessage: /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, async ({ message, partition, topic, heartbeat, pause }) => {
52
+ eachMessage: /* @__PURE__ */ _chunkIBVPZSZJjs.__name.call(void 0, async ({ message, partition, topic, heartbeat, pause }) => {
53
53
  if (!existQueue.has(topic)) return;
54
54
  const data = JSON.parse(message.value.toString());
55
55
  const { tag, method, id, queue: clientQueue, _ps, args } = data;
@@ -58,12 +58,12 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
58
58
  const meta2 = metaMap.get(tag)[method];
59
59
  const { data: { rpc } } = meta2;
60
60
  const isEvent = rpc.isEvent;
61
- const aop = _chunkXOWAQGBOjs.Context.getAop(meta2, {
61
+ const aop = _chunkCCK6KDM3js.Context.getAop(meta2, {
62
62
  globalFilter,
63
63
  globalGuards,
64
64
  globalPipe
65
65
  });
66
- const context = new (0, _chunkXOWAQGBOjs.Context)({
66
+ const context = new (0, _chunkCCK6KDM3js.Context)({
67
67
  type: "kafka",
68
68
  category: "rpc",
69
69
  moduleMap,
@@ -112,7 +112,7 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
112
112
  }, "eachMessage")
113
113
  });
114
114
  }
115
- _chunkLLF55NZPjs.__name.call(void 0, bind, "bind");
115
+ _chunkIBVPZSZJjs.__name.call(void 0, bind, "bind");
116
116
 
117
117
 
118
118
  exports.bind = bind;
@@ -2,10 +2,10 @@ import {
2
2
  Context,
3
3
  createControllerMetaMap,
4
4
  detectAopDep
5
- } from "../../chunk-LQFHZGVJ.mjs";
5
+ } from "../../chunk-LNL3MVTR.mjs";
6
6
  import {
7
7
  __name
8
- } from "../../chunk-URKOYTBU.mjs";
8
+ } from "../../chunk-ITDH2YDL.mjs";
9
9
 
10
10
  // src/rpc/kafka/bind.ts
11
11
  import Debug from "debug";
@@ -1,8 +1,8 @@
1
1
  import { NatsConnection } from 'nats';
2
- import { F as Factory } from '../../core-BYxcQ8kf.mjs';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-DSlyrmns.mjs';
2
+ import { F as Factory } from '../../core-nqk9d66O.mjs';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-f_hV_rCD.mjs';
4
4
  import 'phecda-core';
5
- import '../../meta-Csp1xcSR.mjs';
5
+ import '../../meta-ZbvaS7xK.mjs';
6
6
 
7
7
  interface NatsCtx extends RpcCtx {
8
8
  type: 'nats';
@@ -1,8 +1,8 @@
1
1
  import { NatsConnection } from 'nats';
2
- import { F as Factory } from '../../core-BiS3xJKx.js';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-DExQe0qk.js';
2
+ import { F as Factory } from '../../core-Bd2ynlyb.js';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-CHWgzilt.js';
4
4
  import 'phecda-core';
5
- import '../../meta-Csp1xcSR.js';
5
+ import '../../meta-ZbvaS7xK.js';
6
6
 
7
7
  interface NatsCtx extends RpcCtx {
8
8
  type: 'nats';
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkXOWAQGBOjs = require('../../chunk-XOWAQGBO.js');
5
+ var _chunkCCK6KDM3js = require('../../chunk-CCK6KDM3.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkLLF55NZPjs = require('../../chunk-LLF55NZP.js');
9
+ var _chunkIBVPZSZJjs = require('../../chunk-IBVPZSZJ.js');
10
10
 
11
11
  // src/rpc/nats/bind.ts
12
12
  var _nats = require('nats');
@@ -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 = _chunkXOWAQGBOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
20
+ const metaMap = _chunkCCK6KDM3js.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
21
  const { controller, rpc, method, tag } = meta2.data;
22
22
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _2 => _2.queue]) !== void 0) {
23
23
  debug(`register method "${method}" in module "${tag}"`);
24
24
  return true;
25
25
  }
26
26
  });
27
- _chunkXOWAQGBOjs.detectAopDep.call(void 0, meta, {
27
+ _chunkCCK6KDM3js.detectAopDep.call(void 0, meta, {
28
28
  addons: globalAddons,
29
29
  guards: globalGuards
30
30
  }, "rpc");
31
- _chunkXOWAQGBOjs.Context.applyAddons(globalAddons, nc, "nats");
31
+ _chunkCCK6KDM3js.Context.applyAddons(globalAddons, nc, "nats");
32
32
  async function subscribeQueues() {
33
33
  existQueue.clear();
34
34
  for (const [tag, record] of metaMap) {
@@ -47,7 +47,7 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
47
47
  }
48
48
  }
49
49
  }
50
- _chunkLLF55NZPjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
50
+ _chunkIBVPZSZJjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
51
51
  async function handleRequest(_, msg) {
52
52
  const data = JSON.parse(sc.decode(msg.data));
53
53
  const { tag, method, id, _ps, args } = data;
@@ -56,12 +56,12 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
56
56
  const meta2 = metaMap.get(tag)[method];
57
57
  const { data: { rpc: { isEvent } = {} } } = meta2;
58
58
  if (isEvent) msg.respond("{}");
59
- const aop = _chunkXOWAQGBOjs.Context.getAop(meta2, {
59
+ const aop = _chunkCCK6KDM3js.Context.getAop(meta2, {
60
60
  globalFilter,
61
61
  globalGuards,
62
62
  globalPipe
63
63
  });
64
- const context = new (0, _chunkXOWAQGBOjs.Context)({
64
+ const context = new (0, _chunkCCK6KDM3js.Context)({
65
65
  type: "nats",
66
66
  category: "rpc",
67
67
  moduleMap,
@@ -88,14 +88,14 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
88
88
  })));
89
89
  });
90
90
  }
91
- _chunkLLF55NZPjs.__name.call(void 0, handleRequest, "handleRequest");
91
+ _chunkIBVPZSZJjs.__name.call(void 0, handleRequest, "handleRequest");
92
92
  subscribeQueues();
93
- _chunkLLF55NZPjs.HMR.call(void 0, async () => {
93
+ _chunkIBVPZSZJjs.HMR.call(void 0, async () => {
94
94
  for (const i in subscriptionMap) subscriptionMap[i].unsubscribe();
95
95
  await subscribeQueues();
96
96
  });
97
97
  }
98
- _chunkLLF55NZPjs.__name.call(void 0, bind, "bind");
98
+ _chunkIBVPZSZJjs.__name.call(void 0, bind, "bind");
99
99
 
100
100
 
101
101
  exports.bind = bind;
@@ -2,11 +2,11 @@ import {
2
2
  Context,
3
3
  createControllerMetaMap,
4
4
  detectAopDep
5
- } from "../../chunk-LQFHZGVJ.mjs";
5
+ } from "../../chunk-LNL3MVTR.mjs";
6
6
  import {
7
7
  HMR,
8
8
  __name
9
- } from "../../chunk-URKOYTBU.mjs";
9
+ } from "../../chunk-ITDH2YDL.mjs";
10
10
 
11
11
  // src/rpc/nats/bind.ts
12
12
  import { StringCodec } from "nats";
@@ -1,8 +1,8 @@
1
1
  import amqplib from 'amqplib';
2
- import { F as Factory } from '../../core-BYxcQ8kf.mjs';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-DSlyrmns.mjs';
2
+ import { F as Factory } from '../../core-nqk9d66O.mjs';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-f_hV_rCD.mjs';
4
4
  import 'phecda-core';
5
- import '../../meta-Csp1xcSR.mjs';
5
+ import '../../meta-ZbvaS7xK.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-BiS3xJKx.js';
3
- import { R as RpcCtx, a as RpcServerOptions } from '../../types-DExQe0qk.js';
2
+ import { F as Factory } from '../../core-Bd2ynlyb.js';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-CHWgzilt.js';
4
4
  import 'phecda-core';
5
- import '../../meta-Csp1xcSR.js';
5
+ import '../../meta-ZbvaS7xK.js';
6
6
 
7
7
  interface RabbitmqCtx extends RpcCtx {
8
8
  type: 'rabbitmq';
@@ -2,30 +2,30 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkXOWAQGBOjs = require('../../chunk-XOWAQGBO.js');
5
+ var _chunkCCK6KDM3js = require('../../chunk-CCK6KDM3.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkLLF55NZPjs = require('../../chunk-LLF55NZP.js');
9
+ var _chunkIBVPZSZJjs = require('../../chunk-IBVPZSZJ.js');
10
10
 
11
11
  // src/rpc/rabbitmq/bind.ts
12
12
  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 = _chunkXOWAQGBOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
16
+ const metaMap = _chunkCCK6KDM3js.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
17
  const { controller, rpc, method, tag } = meta2.data;
18
18
  if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
19
19
  debug(`register method "${method}" in module "${tag}"`);
20
20
  return true;
21
21
  }
22
22
  });
23
- _chunkXOWAQGBOjs.detectAopDep.call(void 0, meta, {
23
+ _chunkCCK6KDM3js.detectAopDep.call(void 0, meta, {
24
24
  guards: globalGuards,
25
25
  addons: globalAddons
26
26
  }, "rpc");
27
27
  const existQueue = /* @__PURE__ */ new Set();
28
- _chunkXOWAQGBOjs.Context.applyAddons(globalAddons, ch, "rabbitmq");
28
+ _chunkCCK6KDM3js.Context.applyAddons(globalAddons, ch, "rabbitmq");
29
29
  async function subscribeQueues() {
30
30
  existQueue.clear();
31
31
  for (const [tag, record] of metaMap) {
@@ -44,12 +44,12 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
44
44
  }
45
45
  }
46
46
  }
47
- _chunkLLF55NZPjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
47
+ _chunkIBVPZSZJjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
48
48
  async function handleRequest(msg) {
49
49
  function send(queue, data) {
50
50
  ch.sendToQueue(queue, Buffer.from(JSON.stringify(data)));
51
51
  }
52
- _chunkLLF55NZPjs.__name.call(void 0, send, "send");
52
+ _chunkIBVPZSZJjs.__name.call(void 0, send, "send");
53
53
  if (msg) {
54
54
  const data = JSON.parse(msg.content.toString());
55
55
  const { tag, method, id, queue: clientQueue, _ps, args } = data;
@@ -57,12 +57,12 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
57
57
  debug(`invoke method "${method}" in module "${tag}"`);
58
58
  const meta2 = metaMap.get(tag)[method];
59
59
  const { data: { rpc: { isEvent } = {} } } = meta2;
60
- const aop = _chunkXOWAQGBOjs.Context.getAop(meta2, {
60
+ const aop = _chunkCCK6KDM3js.Context.getAop(meta2, {
61
61
  globalFilter,
62
62
  globalGuards,
63
63
  globalPipe
64
64
  });
65
- const context = new (0, _chunkXOWAQGBOjs.Context)({
65
+ const context = new (0, _chunkCCK6KDM3js.Context)({
66
66
  type: "rabbitmq",
67
67
  category: "rpc",
68
68
  moduleMap,
@@ -90,14 +90,14 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
90
90
  });
91
91
  }
92
92
  }
93
- _chunkLLF55NZPjs.__name.call(void 0, handleRequest, "handleRequest");
93
+ _chunkIBVPZSZJjs.__name.call(void 0, handleRequest, "handleRequest");
94
94
  subscribeQueues();
95
- _chunkLLF55NZPjs.HMR.call(void 0, async () => {
95
+ _chunkIBVPZSZJjs.HMR.call(void 0, async () => {
96
96
  for (const queue of existQueue) await ch.deleteQueue(queue);
97
97
  await subscribeQueues();
98
98
  });
99
99
  }
100
- _chunkLLF55NZPjs.__name.call(void 0, bind, "bind");
100
+ _chunkIBVPZSZJjs.__name.call(void 0, bind, "bind");
101
101
 
102
102
 
103
103
  exports.bind = bind;