phecda-server 6.0.1 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-YUXERDQ6.mjs → chunk-2CFYUXPM.mjs} +9 -12
- package/dist/{chunk-HDQAT2IM.mjs → chunk-3H3T54IC.mjs} +116 -87
- package/dist/{chunk-TZYATAJX.js → chunk-DVTBLV6I.js} +62 -65
- package/dist/{chunk-UXD62LGG.mjs → chunk-G7TD2VB7.mjs} +10 -2
- package/dist/{chunk-F3W3NN7F.mjs → chunk-J7B24YSE.mjs} +1 -1
- package/dist/{chunk-XCND2QW3.js → chunk-JDV2XJYE.js} +25 -25
- package/dist/chunk-NL6QBQAR.js +266 -0
- package/dist/{chunk-GHFSIZUO.js → chunk-TVT62GIX.js} +11 -3
- package/dist/core-BlN0Spy9.d.ts +47 -0
- package/dist/core-P1CsH6jz.d.mts +47 -0
- package/dist/helper.d.mts +1 -1
- package/dist/helper.d.ts +1 -1
- package/dist/helper.js +3 -3
- package/dist/helper.mjs +2 -2
- package/dist/index.d.mts +12 -11
- package/dist/index.d.ts +12 -11
- package/dist/index.js +49 -43
- package/dist/index.mjs +19 -13
- package/dist/{types-BlIBlnVT.d.ts → meta-KtfiBIde.d.mts} +44 -44
- package/dist/{types-BlIBlnVT.d.mts → meta-KtfiBIde.d.ts} +44 -44
- package/dist/rpc/bullmq/index.d.mts +3 -3
- package/dist/rpc/bullmq/index.d.ts +3 -3
- package/dist/rpc/bullmq/index.js +12 -12
- package/dist/rpc/bullmq/index.mjs +2 -2
- package/dist/rpc/kafka/index.d.mts +3 -3
- package/dist/rpc/kafka/index.d.ts +3 -3
- package/dist/rpc/kafka/index.js +12 -12
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/nats/index.d.mts +3 -3
- package/dist/rpc/nats/index.d.ts +3 -3
- package/dist/rpc/nats/index.js +11 -11
- package/dist/rpc/nats/index.mjs +2 -2
- package/dist/rpc/rabbitmq/index.d.mts +3 -3
- package/dist/rpc/rabbitmq/index.d.ts +3 -3
- package/dist/rpc/rabbitmq/index.js +13 -13
- package/dist/rpc/rabbitmq/index.mjs +2 -2
- package/dist/rpc/redis/index.d.mts +3 -3
- package/dist/rpc/redis/index.d.ts +3 -3
- package/dist/rpc/redis/index.js +11 -11
- package/dist/rpc/redis/index.mjs +2 -2
- package/dist/server/elysia/index.d.mts +3 -3
- package/dist/server/elysia/index.d.ts +3 -3
- package/dist/server/elysia/index.js +44 -32
- package/dist/server/elysia/index.mjs +17 -5
- package/dist/server/express/index.d.mts +3 -3
- package/dist/server/express/index.d.ts +3 -3
- package/dist/server/express/index.js +34 -30
- package/dist/server/express/index.mjs +8 -4
- package/dist/server/fastify/index.d.mts +3 -3
- package/dist/server/fastify/index.d.ts +3 -3
- package/dist/server/fastify/index.js +35 -31
- package/dist/server/fastify/index.mjs +9 -5
- package/dist/server/h3/index.d.mts +3 -3
- package/dist/server/h3/index.d.ts +3 -3
- package/dist/server/h3/index.js +34 -30
- package/dist/server/h3/index.mjs +8 -4
- package/dist/server/hono/index.d.mts +3 -3
- package/dist/server/hono/index.d.ts +3 -3
- package/dist/server/hono/index.js +33 -29
- package/dist/server/hono/index.mjs +8 -4
- package/dist/server/hyper-express/index.d.mts +3 -3
- package/dist/server/hyper-express/index.d.ts +3 -3
- package/dist/server/hyper-express/index.js +33 -29
- package/dist/server/hyper-express/index.mjs +8 -4
- package/dist/server/koa/index.d.mts +3 -3
- package/dist/server/koa/index.d.ts +3 -3
- package/dist/server/koa/index.js +34 -30
- package/dist/server/koa/index.mjs +8 -4
- package/dist/test.d.mts +3 -3
- package/dist/test.d.ts +3 -3
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/dist/{types-BCJhmpQh.d.ts → types-BvD3B5Ny.d.mts} +4 -2
- package/dist/{types-Dgxirc9f.d.mts → types-DIw7B6Up.d.ts} +4 -2
- package/dist/{types-B-ZFZajI.d.ts → types-JVT0mgLD.d.ts} +1 -1
- package/dist/{types-AgVwUXPC.d.mts → types-t9D1fU6G.d.mts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-LYEZ6RGX.js +0 -237
- package/dist/core-Blq8frmr.d.ts +0 -30
- package/dist/core-D2oL8Ge0.d.mts +0 -30
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
createControllerMetaMap,
|
|
5
5
|
detectAopDep,
|
|
6
6
|
genClientQueue
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-2CFYUXPM.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__name
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-G7TD2VB7.mjs";
|
|
11
11
|
|
|
12
12
|
// src/rpc/bullmq/bind.ts
|
|
13
13
|
import { Queue, Worker } from "bullmq";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Consumer, Producer } from 'kafkajs';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-
|
|
4
|
-
import { T as ToClientMap } from '../../
|
|
2
|
+
import { F as Factory } from '../../core-P1CsH6jz.mjs';
|
|
3
|
+
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-t9D1fU6G.mjs';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-KtfiBIde.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-
|
|
3
|
-
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-
|
|
4
|
-
import { T as ToClientMap } from '../../
|
|
2
|
+
import { F as Factory } from '../../core-BlN0Spy9.js';
|
|
3
|
+
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-JVT0mgLD.js';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-KtfiBIde.js';
|
|
5
5
|
import 'phecda-core';
|
|
6
6
|
|
|
7
7
|
interface KafkaCtx extends RpcContext {
|
package/dist/rpc/kafka/index.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkDVTBLV6Ijs = require('../../chunk-DVTBLV6I.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkTVT62GIXjs = require('../../chunk-TVT62GIX.js');
|
|
10
10
|
|
|
11
11
|
// src/rpc/kafka/bind.ts
|
|
12
12
|
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
@@ -14,14 +14,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/kafka");
|
|
|
14
14
|
async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
|
|
15
15
|
const { globalGuards, globalInterceptors, globalFilter, globalPipe } = opts;
|
|
16
16
|
const existQueue = /* @__PURE__ */ new Set();
|
|
17
|
-
const metaMap =
|
|
17
|
+
const metaMap = _chunkDVTBLV6Ijs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
18
18
|
const { controller, rpc, func, tag } = meta2.data;
|
|
19
19
|
if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
|
|
20
20
|
debug(`register method "${func}" in module "${tag}"`);
|
|
21
21
|
return true;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
|
|
24
|
+
_chunkDVTBLV6Ijs.detectAopDep.call(void 0, meta, {
|
|
25
25
|
guards: globalGuards,
|
|
26
26
|
interceptors: globalInterceptors
|
|
27
27
|
}, "rpc");
|
|
@@ -43,10 +43,10 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
_chunkTVT62GIXjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
|
|
47
47
|
await subscribeQueues();
|
|
48
48
|
await consumer.run({
|
|
49
|
-
eachMessage: /* @__PURE__ */
|
|
49
|
+
eachMessage: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, async ({ message, partition, topic, heartbeat, pause }) => {
|
|
50
50
|
if (!existQueue.has(topic)) return;
|
|
51
51
|
const data = JSON.parse(message.value.toString());
|
|
52
52
|
const { tag, func, id, queue: clientQueue, _ps, args } = data;
|
|
@@ -55,7 +55,7 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
|
|
|
55
55
|
const meta2 = metaMap.get(tag)[func];
|
|
56
56
|
const { data: { rpc } } = meta2;
|
|
57
57
|
const isEvent = rpc.isEvent;
|
|
58
|
-
const context = new (0,
|
|
58
|
+
const context = new (0, _chunkDVTBLV6Ijs.Context)({
|
|
59
59
|
type: "kafka",
|
|
60
60
|
moduleMap,
|
|
61
61
|
meta: meta2,
|
|
@@ -108,7 +108,7 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
|
|
|
108
108
|
}, "eachMessage")
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
_chunkTVT62GIXjs.__name.call(void 0, bind, "bind");
|
|
112
112
|
|
|
113
113
|
// src/rpc/kafka/client.ts
|
|
114
114
|
var _events = require('events');
|
|
@@ -117,7 +117,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
|
|
|
117
117
|
let eventCount = 1;
|
|
118
118
|
const ret = {};
|
|
119
119
|
const emitter = new (0, _events.EventEmitter)();
|
|
120
|
-
const clientQueue =
|
|
120
|
+
const clientQueue = _chunkDVTBLV6Ijs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
|
|
121
121
|
await consumer.subscribe({
|
|
122
122
|
topic: clientQueue,
|
|
123
123
|
fromBeginning: true
|
|
@@ -167,7 +167,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
|
|
|
167
167
|
if (error) reject(data);
|
|
168
168
|
else resolve(data);
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
_chunkTVT62GIXjs.__name.call(void 0, listener, "listener");
|
|
171
171
|
eventCount++;
|
|
172
172
|
emitter.once(id, listener);
|
|
173
173
|
});
|
|
@@ -176,7 +176,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
|
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
178
|
await consumer.run({
|
|
179
|
-
eachMessage: /* @__PURE__ */
|
|
179
|
+
eachMessage: /* @__PURE__ */ _chunkTVT62GIXjs.__name.call(void 0, async ({ message, topic }) => {
|
|
180
180
|
if (clientQueue === topic && message.value) {
|
|
181
181
|
const { data, id, error } = JSON.parse(message.value.toString());
|
|
182
182
|
emitter.emit(id, data, error);
|
|
@@ -185,7 +185,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
|
|
|
185
185
|
});
|
|
186
186
|
return ret;
|
|
187
187
|
}
|
|
188
|
-
|
|
188
|
+
_chunkTVT62GIXjs.__name.call(void 0, createClient, "createClient");
|
|
189
189
|
|
|
190
190
|
|
|
191
191
|
|
package/dist/rpc/kafka/index.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
createControllerMetaMap,
|
|
4
4
|
detectAopDep,
|
|
5
5
|
genClientQueue
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-2CFYUXPM.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__name
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-G7TD2VB7.mjs";
|
|
10
10
|
|
|
11
11
|
// src/rpc/kafka/bind.ts
|
|
12
12
|
import Debug from "debug";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NatsConnection } from 'nats';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-
|
|
4
|
-
import { T as ToClientMap } from '../../
|
|
2
|
+
import { F as Factory } from '../../core-P1CsH6jz.mjs';
|
|
3
|
+
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-t9D1fU6G.mjs';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-KtfiBIde.mjs';
|
|
5
5
|
import 'phecda-core';
|
|
6
6
|
|
|
7
7
|
interface NatsCtx extends RpcContext {
|
package/dist/rpc/nats/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NatsConnection } from 'nats';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-
|
|
4
|
-
import { T as ToClientMap } from '../../
|
|
2
|
+
import { F as Factory } from '../../core-BlN0Spy9.js';
|
|
3
|
+
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-JVT0mgLD.js';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-KtfiBIde.js';
|
|
5
5
|
import 'phecda-core';
|
|
6
6
|
|
|
7
7
|
interface NatsCtx extends RpcContext {
|
package/dist/rpc/nats/index.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkDVTBLV6Ijs = require('../../chunk-DVTBLV6I.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkTVT62GIXjs = require('../../chunk-TVT62GIX.js');
|
|
10
10
|
|
|
11
11
|
// src/rpc/nats/bind.ts
|
|
12
12
|
var _nats = require('nats');
|
|
@@ -17,14 +17,14 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
|
|
|
17
17
|
const sc = _nats.StringCodec.call(void 0, );
|
|
18
18
|
const subscriptionMap = {};
|
|
19
19
|
const existQueue = /* @__PURE__ */ new Set();
|
|
20
|
-
const metaMap =
|
|
20
|
+
const metaMap = _chunkDVTBLV6Ijs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
21
21
|
const { controller, rpc, func, tag } = meta2.data;
|
|
22
22
|
if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _2 => _2.queue]) !== void 0) {
|
|
23
23
|
debug(`register method "${func}" in module "${tag}"`);
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
_chunkDVTBLV6Ijs.detectAopDep.call(void 0, meta, {
|
|
28
28
|
guards: globalGuards,
|
|
29
29
|
interceptors: globalInterceptors
|
|
30
30
|
}, "rpc");
|
|
@@ -46,7 +46,7 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
_chunkTVT62GIXjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
|
|
50
50
|
async function handleRequest(_, msg) {
|
|
51
51
|
const data = JSON.parse(sc.decode(msg.data));
|
|
52
52
|
const { tag, func, id, _ps, args } = data;
|
|
@@ -55,7 +55,7 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
|
|
|
55
55
|
const meta2 = metaMap.get(tag)[func];
|
|
56
56
|
const { data: { rpc: { isEvent } = {} } } = meta2;
|
|
57
57
|
if (isEvent) msg.respond("{}");
|
|
58
|
-
const context = new (0,
|
|
58
|
+
const context = new (0, _chunkDVTBLV6Ijs.Context)({
|
|
59
59
|
type: "nats",
|
|
60
60
|
moduleMap,
|
|
61
61
|
meta: meta2,
|
|
@@ -86,14 +86,14 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
|
|
|
86
86
|
})));
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
_chunkTVT62GIXjs.__name.call(void 0, handleRequest, "handleRequest");
|
|
90
90
|
subscribeQueues();
|
|
91
|
-
|
|
91
|
+
_chunkDVTBLV6Ijs.HMR.call(void 0, async () => {
|
|
92
92
|
for (const i in subscriptionMap) subscriptionMap[i].unsubscribe();
|
|
93
93
|
await subscribeQueues();
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
_chunkTVT62GIXjs.__name.call(void 0, bind, "bind");
|
|
97
97
|
|
|
98
98
|
// src/rpc/nats/client.ts
|
|
99
99
|
|
|
@@ -143,7 +143,7 @@ async function createClient(nc, controllers, opts) {
|
|
|
143
143
|
if (error) reject(data);
|
|
144
144
|
else resolve(data);
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
_chunkTVT62GIXjs.__name.call(void 0, handler, "handler");
|
|
147
147
|
eventCount++;
|
|
148
148
|
});
|
|
149
149
|
};
|
|
@@ -152,7 +152,7 @@ async function createClient(nc, controllers, opts) {
|
|
|
152
152
|
}
|
|
153
153
|
return ret;
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
_chunkTVT62GIXjs.__name.call(void 0, createClient, "createClient");
|
|
156
156
|
|
|
157
157
|
|
|
158
158
|
|
package/dist/rpc/nats/index.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
HMR,
|
|
4
4
|
createControllerMetaMap,
|
|
5
5
|
detectAopDep
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-2CFYUXPM.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__name
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-G7TD2VB7.mjs";
|
|
10
10
|
|
|
11
11
|
// src/rpc/nats/bind.ts
|
|
12
12
|
import { StringCodec } from "nats";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import amqplib from 'amqplib';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-
|
|
4
|
-
import { T as ToClientMap } from '../../
|
|
2
|
+
import { F as Factory } from '../../core-P1CsH6jz.mjs';
|
|
3
|
+
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-t9D1fU6G.mjs';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-KtfiBIde.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-
|
|
3
|
-
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-
|
|
4
|
-
import { T as ToClientMap } from '../../
|
|
2
|
+
import { F as Factory } from '../../core-BlN0Spy9.js';
|
|
3
|
+
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-JVT0mgLD.js';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-KtfiBIde.js';
|
|
5
5
|
import 'phecda-core';
|
|
6
6
|
|
|
7
7
|
interface RabbitmqCtx extends RpcContext {
|
|
@@ -4,24 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkDVTBLV6Ijs = require('../../chunk-DVTBLV6I.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkTVT62GIXjs = require('../../chunk-TVT62GIX.js');
|
|
11
11
|
|
|
12
12
|
// src/rpc/rabbitmq/bind.ts
|
|
13
13
|
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
14
14
|
var debug = _debug2.default.call(void 0, "phecda-server/rabbitmq");
|
|
15
15
|
async function bind(ch, { moduleMap, meta }, opts = {}) {
|
|
16
16
|
const { globalGuards, globalInterceptors, globalFilter, globalPipe } = opts;
|
|
17
|
-
const metaMap =
|
|
17
|
+
const metaMap = _chunkDVTBLV6Ijs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
18
18
|
const { controller, rpc, func, tag } = meta2.data;
|
|
19
19
|
if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
|
|
20
20
|
debug(`register method "${func}" in module "${tag}"`);
|
|
21
21
|
return true;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
|
|
24
|
+
_chunkDVTBLV6Ijs.detectAopDep.call(void 0, meta, {
|
|
25
25
|
guards: globalGuards,
|
|
26
26
|
interceptors: globalInterceptors
|
|
27
27
|
}, "rpc");
|
|
@@ -44,12 +44,12 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
_chunkTVT62GIXjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
|
|
48
48
|
async function handleRequest(msg) {
|
|
49
49
|
function send(queue, data) {
|
|
50
50
|
ch.sendToQueue(queue, Buffer.from(JSON.stringify(data)));
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
_chunkTVT62GIXjs.__name.call(void 0, send, "send");
|
|
53
53
|
if (msg) {
|
|
54
54
|
const data = JSON.parse(msg.content.toString());
|
|
55
55
|
const { tag, func, id, queue: clientQueue, _ps, args } = data;
|
|
@@ -57,7 +57,7 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
|
|
|
57
57
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
58
58
|
const meta2 = metaMap.get(tag)[func];
|
|
59
59
|
const { data: { rpc: { isEvent } = {} } } = meta2;
|
|
60
|
-
const context = new (0,
|
|
60
|
+
const context = new (0, _chunkDVTBLV6Ijs.Context)({
|
|
61
61
|
type: "rabbitmq",
|
|
62
62
|
moduleMap,
|
|
63
63
|
meta: meta2,
|
|
@@ -89,14 +89,14 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
|
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
_chunkTVT62GIXjs.__name.call(void 0, handleRequest, "handleRequest");
|
|
93
93
|
subscribeQueues();
|
|
94
|
-
|
|
94
|
+
_chunkDVTBLV6Ijs.HMR.call(void 0, async () => {
|
|
95
95
|
for (const queue of existQueue) await ch.deleteQueue(queue);
|
|
96
96
|
await subscribeQueues();
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
_chunkTVT62GIXjs.__name.call(void 0, bind, "bind");
|
|
100
100
|
|
|
101
101
|
// src/rpc/rabbitmq/client.ts
|
|
102
102
|
var _events = require('events');
|
|
@@ -105,7 +105,7 @@ async function createClient(ch, controllers, opts) {
|
|
|
105
105
|
let eventCount = 0;
|
|
106
106
|
const ret = {};
|
|
107
107
|
const emitter = new (0, _events.EventEmitter)();
|
|
108
|
-
const clientQueue =
|
|
108
|
+
const clientQueue = _chunkDVTBLV6Ijs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
|
|
109
109
|
await ch.assertQueue(clientQueue);
|
|
110
110
|
ch.consume(clientQueue, (msg) => {
|
|
111
111
|
if (!msg) return;
|
|
@@ -150,7 +150,7 @@ async function createClient(ch, controllers, opts) {
|
|
|
150
150
|
if (error) reject(data);
|
|
151
151
|
else resolve(data);
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
_chunkTVT62GIXjs.__name.call(void 0, listener, "listener");
|
|
154
154
|
eventCount++;
|
|
155
155
|
emitter.once(id, listener);
|
|
156
156
|
});
|
|
@@ -160,7 +160,7 @@ async function createClient(ch, controllers, opts) {
|
|
|
160
160
|
}
|
|
161
161
|
return ret;
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
_chunkTVT62GIXjs.__name.call(void 0, createClient, "createClient");
|
|
164
164
|
|
|
165
165
|
|
|
166
166
|
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
createControllerMetaMap,
|
|
5
5
|
detectAopDep,
|
|
6
6
|
genClientQueue
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-2CFYUXPM.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__name
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-G7TD2VB7.mjs";
|
|
11
11
|
|
|
12
12
|
// src/rpc/rabbitmq/bind.ts
|
|
13
13
|
import Debug from "debug";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Redis from 'ioredis';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-
|
|
4
|
-
import { T as ToClientMap } from '../../
|
|
2
|
+
import { F as Factory } from '../../core-P1CsH6jz.mjs';
|
|
3
|
+
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-t9D1fU6G.mjs';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-KtfiBIde.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-
|
|
3
|
-
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-
|
|
4
|
-
import { T as ToClientMap } from '../../
|
|
2
|
+
import { F as Factory } from '../../core-BlN0Spy9.js';
|
|
3
|
+
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-JVT0mgLD.js';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-KtfiBIde.js';
|
|
5
5
|
import 'phecda-core';
|
|
6
6
|
|
|
7
7
|
interface RedisCtx extends RpcContext {
|
package/dist/rpc/redis/index.js
CHANGED
|
@@ -4,24 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkDVTBLV6Ijs = require('../../chunk-DVTBLV6I.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkTVT62GIXjs = require('../../chunk-TVT62GIX.js');
|
|
11
11
|
|
|
12
12
|
// src/rpc/redis/bind.ts
|
|
13
13
|
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
14
14
|
var debug = _debug2.default.call(void 0, "phecda-server/redis");
|
|
15
15
|
function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
|
|
16
16
|
const { globalGuards, globalInterceptors, globalFilter, globalPipe } = opts;
|
|
17
|
-
const metaMap =
|
|
17
|
+
const metaMap = _chunkDVTBLV6Ijs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
18
18
|
const { controller, rpc, func, tag } = meta2.data;
|
|
19
19
|
if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
|
|
20
20
|
debug(`register method "${func}" in module "${tag}"`);
|
|
21
21
|
return true;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
|
|
24
|
+
_chunkDVTBLV6Ijs.detectAopDep.call(void 0, meta, {
|
|
25
25
|
guards: globalGuards,
|
|
26
26
|
interceptors: globalInterceptors
|
|
27
27
|
}, "rpc");
|
|
@@ -41,7 +41,7 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
_chunkTVT62GIXjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
|
|
45
45
|
sub.on("message", async (channel, msg) => {
|
|
46
46
|
if (!existQueue.has(channel)) return;
|
|
47
47
|
if (msg) {
|
|
@@ -51,7 +51,7 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
|
|
|
51
51
|
if (_ps !== 1) return;
|
|
52
52
|
const meta2 = metaMap.get(tag)[func];
|
|
53
53
|
const { data: { rpc: { isEvent } = {} } } = meta2;
|
|
54
|
-
const context = new (0,
|
|
54
|
+
const context = new (0, _chunkDVTBLV6Ijs.Context)({
|
|
55
55
|
type: "redis",
|
|
56
56
|
moduleMap,
|
|
57
57
|
redis: sub,
|
|
@@ -87,12 +87,12 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
|
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
subscribeQueues();
|
|
90
|
-
|
|
90
|
+
_chunkDVTBLV6Ijs.HMR.call(void 0, async () => {
|
|
91
91
|
for (const queue of existQueue) await sub.unsubscribe(queue);
|
|
92
92
|
subscribeQueues();
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
_chunkTVT62GIXjs.__name.call(void 0, bind, "bind");
|
|
96
96
|
|
|
97
97
|
// src/rpc/redis/client.ts
|
|
98
98
|
var _events = require('events'); var _events2 = _interopRequireDefault(_events);
|
|
@@ -101,7 +101,7 @@ async function createClient({ pub, sub }, controllers, opts) {
|
|
|
101
101
|
let eventId = 1;
|
|
102
102
|
let eventCount = 0;
|
|
103
103
|
const emitter = new (0, _events2.default)();
|
|
104
|
-
const clientQueue =
|
|
104
|
+
const clientQueue = _chunkDVTBLV6Ijs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
|
|
105
105
|
await sub.subscribe(clientQueue);
|
|
106
106
|
for (const i in controllers) {
|
|
107
107
|
ret[i] = new Proxy(new controllers[i](), {
|
|
@@ -141,7 +141,7 @@ async function createClient({ pub, sub }, controllers, opts) {
|
|
|
141
141
|
if (error) reject(data);
|
|
142
142
|
else resolve(data);
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
_chunkTVT62GIXjs.__name.call(void 0, listener, "listener");
|
|
145
145
|
eventCount++;
|
|
146
146
|
emitter.once(id, listener);
|
|
147
147
|
});
|
|
@@ -157,7 +157,7 @@ async function createClient({ pub, sub }, controllers, opts) {
|
|
|
157
157
|
});
|
|
158
158
|
return ret;
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
_chunkTVT62GIXjs.__name.call(void 0, createClient, "createClient");
|
|
161
161
|
|
|
162
162
|
|
|
163
163
|
|
package/dist/rpc/redis/index.mjs
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
createControllerMetaMap,
|
|
5
5
|
detectAopDep,
|
|
6
6
|
genClientQueue
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-2CFYUXPM.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__name
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-G7TD2VB7.mjs";
|
|
11
11
|
|
|
12
12
|
// src/rpc/redis/bind.ts
|
|
13
13
|
import Debug from "debug";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Elysia as Elysia$1, Context, LocalHook, InputSchema, RouteSchema, SingletonBase } from 'elysia';
|
|
2
2
|
import { BaseMacro } from 'elysia/dist/types';
|
|
3
|
-
import { H as HttpContext, a as HttpOptions } from '../../types-
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { H as HttpContext, a as HttpOptions } from '../../types-BvD3B5Ny.mjs';
|
|
4
|
+
import { F as Factory } from '../../core-P1CsH6jz.mjs';
|
|
5
5
|
import 'node:http';
|
|
6
|
-
import '../../
|
|
6
|
+
import '../../meta-KtfiBIde.mjs';
|
|
7
7
|
import 'phecda-core';
|
|
8
8
|
|
|
9
9
|
interface ElysiaCtx extends HttpContext {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Elysia as Elysia$1, Context, LocalHook, InputSchema, RouteSchema, SingletonBase } from 'elysia';
|
|
2
2
|
import { BaseMacro } from 'elysia/dist/types';
|
|
3
|
-
import { H as HttpContext, a as HttpOptions } from '../../types-
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { H as HttpContext, a as HttpOptions } from '../../types-DIw7B6Up.js';
|
|
4
|
+
import { F as Factory } from '../../core-BlN0Spy9.js';
|
|
5
5
|
import 'node:http';
|
|
6
|
-
import '../../
|
|
6
|
+
import '../../meta-KtfiBIde.js';
|
|
7
7
|
import 'phecda-core';
|
|
8
8
|
|
|
9
9
|
interface ElysiaCtx extends HttpContext {
|