phecda-server 8.1.0 → 8.3.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/bin/cli.mjs +17 -2
- package/dist/{chunk-UYZSUBX4.js → chunk-C424F7TV.js} +27 -27
- package/dist/{chunk-NQ55PA2X.mjs → chunk-JRNXLEAU.mjs} +2 -2
- package/dist/{chunk-FI5756JX.mjs → chunk-LYLSA56Y.mjs} +1 -1
- package/dist/{chunk-4LLLQOMF.js → chunk-OUQM7GZH.js} +2 -2
- package/dist/{chunk-HKN3AAB2.js → chunk-R73A7HS3.js} +90 -88
- package/dist/{chunk-OLNN4U3O.js → chunk-SRPCXPAQ.js} +20 -20
- package/dist/{chunk-BLLRB5DQ.mjs → chunk-US2DTB3Z.mjs} +37 -35
- package/dist/{chunk-PFPOEZHH.mjs → chunk-YDJAOLT2.mjs} +1 -1
- package/dist/helper.js +3 -3
- package/dist/helper.mjs +2 -2
- package/dist/http/elysia/index.d.mts +3 -3
- package/dist/http/elysia/index.d.ts +3 -3
- package/dist/http/elysia/index.js +40 -40
- package/dist/http/elysia/index.mjs +3 -3
- package/dist/http/express/index.js +37 -37
- package/dist/http/express/index.mjs +2 -2
- package/dist/http/fastify/index.js +38 -38
- package/dist/http/fastify/index.mjs +3 -3
- package/dist/http/h3/index.js +38 -38
- package/dist/http/h3/index.mjs +2 -2
- package/dist/http/hono/index.js +34 -34
- package/dist/http/hono/index.mjs +2 -2
- package/dist/http/hyper-express/index.js +35 -35
- package/dist/http/hyper-express/index.mjs +2 -2
- package/dist/http/koa/index.js +37 -37
- package/dist/http/koa/index.mjs +2 -2
- package/dist/index.d.mts +21 -18
- package/dist/index.d.ts +21 -18
- package/dist/index.js +46 -44
- package/dist/index.mjs +6 -4
- package/dist/rpc/bullmq/index.js +11 -11
- package/dist/rpc/bullmq/index.mjs +2 -2
- package/dist/rpc/electron/index.js +8 -8
- package/dist/rpc/electron/index.mjs +2 -2
- package/dist/rpc/kafka/index.js +10 -10
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/nats/index.js +11 -11
- package/dist/rpc/nats/index.mjs +2 -2
- package/dist/rpc/rabbitmq/index.js +12 -12
- package/dist/rpc/rabbitmq/index.mjs +2 -2
- package/dist/rpc/redis/index.js +10 -10
- package/dist/rpc/redis/index.mjs +2 -2
- package/dist/rpc/ws/index.js +7 -7
- package/dist/rpc/ws/index.mjs +2 -2
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/package.json +31 -31
- package/register/utils.mjs +1 -10
- package/register/export.mjs +0 -39
package/dist/rpc/kafka/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkR73A7HS3js = require('../../chunk-R73A7HS3.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkOUQM7GZHjs = require('../../chunk-OUQM7GZH.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 =
|
|
16
|
+
const metaMap = _chunkR73A7HS3js.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
|
-
|
|
23
|
+
_chunkR73A7HS3js.detectAopDep.call(void 0, meta, {
|
|
24
24
|
guards: globalGuards,
|
|
25
25
|
addons: globalAddons
|
|
26
26
|
}, "rpc");
|
|
27
|
-
|
|
27
|
+
_chunkR73A7HS3js.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
|
-
|
|
49
|
+
_chunkOUQM7GZHjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
|
|
50
50
|
await subscribeQueues();
|
|
51
51
|
await consumer.run({
|
|
52
|
-
eachMessage: /* @__PURE__ */
|
|
52
|
+
eachMessage: /* @__PURE__ */ _chunkOUQM7GZHjs.__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 =
|
|
61
|
+
const aop = _chunkR73A7HS3js.Context.getAop(meta2, {
|
|
62
62
|
globalFilter,
|
|
63
63
|
globalGuards,
|
|
64
64
|
globalPipe
|
|
65
65
|
});
|
|
66
|
-
const context = new (0,
|
|
66
|
+
const context = new (0, _chunkR73A7HS3js.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
|
-
|
|
115
|
+
_chunkOUQM7GZHjs.__name.call(void 0, bind, "bind");
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
exports.bind = bind;
|
package/dist/rpc/kafka/index.mjs
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
Context,
|
|
3
3
|
createControllerMetaMap,
|
|
4
4
|
detectAopDep
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-US2DTB3Z.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-JRNXLEAU.mjs";
|
|
9
9
|
|
|
10
10
|
// src/rpc/kafka/bind.ts
|
|
11
11
|
import Debug from "debug";
|
package/dist/rpc/nats/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkR73A7HS3js = require('../../chunk-R73A7HS3.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkOUQM7GZHjs = require('../../chunk-OUQM7GZH.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 =
|
|
20
|
+
const metaMap = _chunkR73A7HS3js.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
|
-
|
|
27
|
+
_chunkR73A7HS3js.detectAopDep.call(void 0, meta, {
|
|
28
28
|
addons: globalAddons,
|
|
29
29
|
guards: globalGuards
|
|
30
30
|
}, "rpc");
|
|
31
|
-
|
|
31
|
+
_chunkR73A7HS3js.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
|
-
|
|
50
|
+
_chunkOUQM7GZHjs.__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 =
|
|
59
|
+
const aop = _chunkR73A7HS3js.Context.getAop(meta2, {
|
|
60
60
|
globalFilter,
|
|
61
61
|
globalGuards,
|
|
62
62
|
globalPipe
|
|
63
63
|
});
|
|
64
|
-
const context = new (0,
|
|
64
|
+
const context = new (0, _chunkR73A7HS3js.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
|
-
|
|
91
|
+
_chunkOUQM7GZHjs.__name.call(void 0, handleRequest, "handleRequest");
|
|
92
92
|
subscribeQueues();
|
|
93
|
-
|
|
93
|
+
_chunkOUQM7GZHjs.HMR.call(void 0, async () => {
|
|
94
94
|
for (const i in subscriptionMap) subscriptionMap[i].unsubscribe();
|
|
95
95
|
await subscribeQueues();
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
_chunkOUQM7GZHjs.__name.call(void 0, bind, "bind");
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
exports.bind = bind;
|
package/dist/rpc/nats/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
Context,
|
|
3
3
|
createControllerMetaMap,
|
|
4
4
|
detectAopDep
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-US2DTB3Z.mjs";
|
|
6
6
|
import {
|
|
7
7
|
HMR,
|
|
8
8
|
__name
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-JRNXLEAU.mjs";
|
|
10
10
|
|
|
11
11
|
// src/rpc/nats/bind.ts
|
|
12
12
|
import { StringCodec } from "nats";
|
|
@@ -2,30 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkR73A7HS3js = require('../../chunk-R73A7HS3.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkOUQM7GZHjs = require('../../chunk-OUQM7GZH.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 =
|
|
16
|
+
const metaMap = _chunkR73A7HS3js.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
|
-
|
|
23
|
+
_chunkR73A7HS3js.detectAopDep.call(void 0, meta, {
|
|
24
24
|
guards: globalGuards,
|
|
25
25
|
addons: globalAddons
|
|
26
26
|
}, "rpc");
|
|
27
27
|
const existQueue = /* @__PURE__ */ new Set();
|
|
28
|
-
|
|
28
|
+
_chunkR73A7HS3js.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
|
-
|
|
47
|
+
_chunkOUQM7GZHjs.__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
|
+
_chunkOUQM7GZHjs.__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 =
|
|
60
|
+
const aop = _chunkR73A7HS3js.Context.getAop(meta2, {
|
|
61
61
|
globalFilter,
|
|
62
62
|
globalGuards,
|
|
63
63
|
globalPipe
|
|
64
64
|
});
|
|
65
|
-
const context = new (0,
|
|
65
|
+
const context = new (0, _chunkR73A7HS3js.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
|
-
|
|
93
|
+
_chunkOUQM7GZHjs.__name.call(void 0, handleRequest, "handleRequest");
|
|
94
94
|
subscribeQueues();
|
|
95
|
-
|
|
95
|
+
_chunkOUQM7GZHjs.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
|
-
|
|
100
|
+
_chunkOUQM7GZHjs.__name.call(void 0, bind, "bind");
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
exports.bind = bind;
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
Context,
|
|
3
3
|
createControllerMetaMap,
|
|
4
4
|
detectAopDep
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-US2DTB3Z.mjs";
|
|
6
6
|
import {
|
|
7
7
|
HMR,
|
|
8
8
|
__name
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-JRNXLEAU.mjs";
|
|
10
10
|
|
|
11
11
|
// src/rpc/rabbitmq/bind.ts
|
|
12
12
|
import Debug from "debug";
|
package/dist/rpc/redis/index.js
CHANGED
|
@@ -2,30 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkR73A7HS3js = require('../../chunk-R73A7HS3.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkOUQM7GZHjs = require('../../chunk-OUQM7GZH.js');
|
|
10
10
|
|
|
11
11
|
// src/rpc/redis/bind.ts
|
|
12
12
|
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 =
|
|
16
|
+
const metaMap = _chunkR73A7HS3js.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
|
-
|
|
23
|
+
_chunkR73A7HS3js.detectAopDep.call(void 0, meta, {
|
|
24
24
|
guards: globalGuards,
|
|
25
25
|
addons: globalAddons
|
|
26
26
|
}, "rpc");
|
|
27
27
|
const existQueue = /* @__PURE__ */ new Set();
|
|
28
|
-
|
|
28
|
+
_chunkR73A7HS3js.Context.applyAddons(globalAddons, {
|
|
29
29
|
pub,
|
|
30
30
|
sub
|
|
31
31
|
}, "redis");
|
|
@@ -44,7 +44,7 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
_chunkOUQM7GZHjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
|
|
48
48
|
sub.on("message", async (channel, msg) => {
|
|
49
49
|
if (!existQueue.has(channel)) return;
|
|
50
50
|
if (msg) {
|
|
@@ -54,12 +54,12 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
|
|
|
54
54
|
if (_ps !== 1) return;
|
|
55
55
|
const meta2 = metaMap.get(tag)[method];
|
|
56
56
|
const { data: { rpc: { isEvent } = {} } } = meta2;
|
|
57
|
-
const aop =
|
|
57
|
+
const aop = _chunkR73A7HS3js.Context.getAop(meta2, {
|
|
58
58
|
globalFilter,
|
|
59
59
|
globalGuards,
|
|
60
60
|
globalPipe
|
|
61
61
|
});
|
|
62
|
-
const context = new (0,
|
|
62
|
+
const context = new (0, _chunkR73A7HS3js.Context)({
|
|
63
63
|
type: "redis",
|
|
64
64
|
category: "rpc",
|
|
65
65
|
moduleMap,
|
|
@@ -91,12 +91,12 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
|
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
subscribeQueues();
|
|
94
|
-
|
|
94
|
+
_chunkOUQM7GZHjs.HMR.call(void 0, async () => {
|
|
95
95
|
for (const queue of existQueue) await sub.unsubscribe(queue);
|
|
96
96
|
subscribeQueues();
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
_chunkOUQM7GZHjs.__name.call(void 0, bind, "bind");
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
exports.bind = bind;
|
package/dist/rpc/redis/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
Context,
|
|
3
3
|
createControllerMetaMap,
|
|
4
4
|
detectAopDep
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-US2DTB3Z.mjs";
|
|
6
6
|
import {
|
|
7
7
|
HMR,
|
|
8
8
|
__name
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-JRNXLEAU.mjs";
|
|
10
10
|
|
|
11
11
|
// src/rpc/redis/bind.ts
|
|
12
12
|
import Debug from "debug";
|
package/dist/rpc/ws/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkR73A7HS3js = require('../../chunk-R73A7HS3.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkOUQM7GZHjs = require('../../chunk-OUQM7GZH.js');
|
|
9
9
|
|
|
10
10
|
// src/rpc/ws/bind.ts
|
|
11
11
|
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
@@ -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 =
|
|
16
|
+
const metaMap = _chunkR73A7HS3js.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
|
-
|
|
23
|
+
_chunkR73A7HS3js.detectAopDep.call(void 0, meta, {
|
|
24
24
|
guards: globalGuards,
|
|
25
25
|
addons: globalAddons
|
|
26
26
|
}, "rpc");
|
|
@@ -32,12 +32,12 @@ function bind(wss, data, opts = {}) {
|
|
|
32
32
|
if (_ps !== 1) return;
|
|
33
33
|
const meta2 = metaMap.get(tag)[method];
|
|
34
34
|
const { data: { rpc: { isEvent } = {} } } = meta2;
|
|
35
|
-
const aop =
|
|
35
|
+
const aop = _chunkR73A7HS3js.Context.getAop(meta2, {
|
|
36
36
|
globalFilter,
|
|
37
37
|
globalGuards,
|
|
38
38
|
globalPipe
|
|
39
39
|
});
|
|
40
|
-
const context = new (0,
|
|
40
|
+
const context = new (0, _chunkR73A7HS3js.Context)({
|
|
41
41
|
type: "ws",
|
|
42
42
|
category: "rpc",
|
|
43
43
|
meta: meta2,
|
|
@@ -67,7 +67,7 @@ function bind(wss, data, opts = {}) {
|
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
_chunkOUQM7GZHjs.__name.call(void 0, bind, "bind");
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
exports.bind = bind;
|
package/dist/rpc/ws/index.mjs
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
Context,
|
|
3
3
|
createControllerMetaMap,
|
|
4
4
|
detectAopDep
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-US2DTB3Z.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-JRNXLEAU.mjs";
|
|
9
9
|
|
|
10
10
|
// src/rpc/ws/bind.ts
|
|
11
11
|
import Debug from "debug";
|
package/dist/test.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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
|
|
3
|
+
var _chunkSRPCXPAQjs = require('./chunk-SRPCXPAQ.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkOUQM7GZHjs = require('./chunk-OUQM7GZH.js');
|
|
7
7
|
|
|
8
8
|
// src/test.ts
|
|
9
9
|
var _phecdacore = require('phecda-core');
|
|
10
10
|
async function TestFactory(...Modules) {
|
|
11
|
-
const { moduleMap, modelMap } = await
|
|
11
|
+
const { moduleMap, modelMap } = await _chunkSRPCXPAQjs.Factory.call(void 0, Modules);
|
|
12
12
|
return {
|
|
13
13
|
get(Model) {
|
|
14
14
|
const tag = _phecdacore.getTag.call(void 0, Model);
|
|
@@ -19,7 +19,7 @@ async function TestFactory(...Modules) {
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
_chunkOUQM7GZHjs.__name.call(void 0, TestFactory, "TestFactory");
|
|
23
23
|
async function TestHttp(app, { moduleMap, meta }, isAgent = true) {
|
|
24
24
|
const { default: request, agent } = await Promise.resolve().then(() => _interopRequireWildcard(require("supertest")));
|
|
25
25
|
const Agent = agent(app);
|
|
@@ -59,11 +59,11 @@ async function TestHttp(app, { moduleMap, meta }, isAgent = true) {
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
_chunkOUQM7GZHjs.__name.call(void 0, module, "module");
|
|
63
63
|
Agent.module = module;
|
|
64
64
|
return Agent;
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
_chunkOUQM7GZHjs.__name.call(void 0, TestHttp, "TestHttp");
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
package/dist/test.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-server",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0",
|
|
4
4
|
"description": "server framework that provide IOC/type-reuse/http&rpc-adaptor",
|
|
5
5
|
"author": "fgsreally",
|
|
6
6
|
"license": "MIT",
|
|
@@ -151,48 +151,48 @@
|
|
|
151
151
|
"bin"
|
|
152
152
|
],
|
|
153
153
|
"dependencies": {
|
|
154
|
-
"@swc-node/core": "^1.
|
|
154
|
+
"@swc-node/core": "^1.14.1",
|
|
155
155
|
"cac": "^6.7.14",
|
|
156
|
-
"chokidar": "^3.
|
|
157
|
-
"debug": "^4.3
|
|
158
|
-
"fs-extra": "^11.2
|
|
159
|
-
"picocolors": "^1.
|
|
156
|
+
"chokidar": "^3.6.0",
|
|
157
|
+
"debug": "^4.4.3",
|
|
158
|
+
"fs-extra": "^11.3.2",
|
|
159
|
+
"picocolors": "^1.1.1",
|
|
160
160
|
"ts-mixer": "^6.0.4",
|
|
161
|
-
"phecda-core": "5.1.
|
|
161
|
+
"phecda-core": "5.1.1"
|
|
162
162
|
},
|
|
163
163
|
"devDependencies": {
|
|
164
|
-
"@koa/router": "^12.0.
|
|
164
|
+
"@koa/router": "^12.0.2",
|
|
165
165
|
"@nucleoidjs/kafkajs-mock": "^0.0.1",
|
|
166
|
-
"@types/amqplib": "^0.10.
|
|
166
|
+
"@types/amqplib": "^0.10.7",
|
|
167
167
|
"@types/chrome": "^0.0.309",
|
|
168
168
|
"@types/debug": "^4.1.12",
|
|
169
|
-
"@types/express": "^4.17.
|
|
169
|
+
"@types/express": "^4.17.23",
|
|
170
170
|
"@types/fs-extra": "^11.0.4",
|
|
171
|
-
"@types/koa": "^2.
|
|
171
|
+
"@types/koa": "^2.15.0",
|
|
172
172
|
"@types/koa__router": "^12.0.4",
|
|
173
|
-
"@types/supertest": "^2.0.
|
|
174
|
-
"@types/ws": "^8.
|
|
175
|
-
"amqplib": "^0.10.
|
|
176
|
-
"bullmq": "^5.
|
|
177
|
-
"electron": "^33.
|
|
178
|
-
"elysia": "^1.
|
|
179
|
-
"express": "^4.
|
|
180
|
-
"fastify": "^4.
|
|
181
|
-
"h3": "^1.
|
|
182
|
-
"hono": "^4.
|
|
183
|
-
"hyper-express": "^6.
|
|
184
|
-
"ioredis": "^5.
|
|
185
|
-
"ioredis-mock": "^8.
|
|
173
|
+
"@types/supertest": "^2.0.16",
|
|
174
|
+
"@types/ws": "^8.18.1",
|
|
175
|
+
"amqplib": "^0.10.9",
|
|
176
|
+
"bullmq": "^5.58.9",
|
|
177
|
+
"electron": "^33.4.11",
|
|
178
|
+
"elysia": "^1.4.8",
|
|
179
|
+
"express": "^4.21.2",
|
|
180
|
+
"fastify": "^4.29.1",
|
|
181
|
+
"h3": "^1.15.4",
|
|
182
|
+
"hono": "^4.9.9",
|
|
183
|
+
"hyper-express": "^6.17.3",
|
|
184
|
+
"ioredis": "^5.8.0",
|
|
185
|
+
"ioredis-mock": "^8.12.1",
|
|
186
186
|
"kafkajs": "^2.2.4",
|
|
187
|
-
"koa": "^2.
|
|
187
|
+
"koa": "^2.16.2",
|
|
188
188
|
"koa-body": "^6.0.1",
|
|
189
189
|
"mock-amqplib": "^1.8.2",
|
|
190
|
-
"nats": "^2.
|
|
191
|
-
"supertest": "^6.3.
|
|
192
|
-
"tsup": "^8.
|
|
193
|
-
"typescript": "^5.
|
|
194
|
-
"unimport": "^3.
|
|
195
|
-
"ws": "^8.18.
|
|
190
|
+
"nats": "^2.29.3",
|
|
191
|
+
"supertest": "^6.3.4",
|
|
192
|
+
"tsup": "^8.5.0",
|
|
193
|
+
"typescript": "^5.9.2",
|
|
194
|
+
"unimport": "^3.14.6",
|
|
195
|
+
"ws": "^8.18.3"
|
|
196
196
|
},
|
|
197
197
|
"scripts": {
|
|
198
198
|
"dev": "tsup --watch",
|
package/register/utils.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { basename } from 'path'
|
|
2
2
|
import { transform } from '@swc-node/core'
|
|
3
|
-
import psExports from './export.mjs'
|
|
4
3
|
import { fileURLToPath } from 'node:url'
|
|
5
4
|
import path from 'node:path'
|
|
6
5
|
|
|
@@ -34,15 +33,7 @@ export async function genUnImportRet(opts) {
|
|
|
34
33
|
try {
|
|
35
34
|
const { createUnimport } = await
|
|
36
35
|
import('unimport')
|
|
37
|
-
return createUnimport(
|
|
38
|
-
...opts,
|
|
39
|
-
|
|
40
|
-
presets: [{
|
|
41
|
-
from: 'phecda-server',
|
|
42
|
-
imports: psExports,
|
|
43
|
-
},]
|
|
44
|
-
.concat(opts.presets || []),
|
|
45
|
-
})
|
|
36
|
+
return createUnimport(opts)
|
|
46
37
|
} catch (e) {
|
|
47
38
|
return false
|
|
48
39
|
}
|
package/register/export.mjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export default ['Addon', 'Arg', 'Assign', 'BadGatewayException', 'BadRequestException',
|
|
2
|
-
'Base', 'Body', 'Clear',
|
|
3
|
-
'ConflictException', 'Controller',
|
|
4
|
-
'Ctx', 'CustomResponse',
|
|
5
|
-
'Delete',
|
|
6
|
-
'Define',
|
|
7
|
-
'ERROR_SYMBOL',
|
|
8
|
-
'Effect', 'Empty', 'Err', 'Exception', 'Expose', 'Factory', 'Filter', 'ForbiddenException',
|
|
9
|
-
'FrameworkException',
|
|
10
|
-
'Generator', 'Get', 'Global', 'Guard', 'HTTPGenerator', 'Head', 'Header', 'HttpBase',
|
|
11
|
-
'If', 'Init', 'Inject', 'Injectable',
|
|
12
|
-
'InvalidInputException', 'Isolate',
|
|
13
|
-
'Mixin',
|
|
14
|
-
'NotFoundException', 'PAddon', 'PExtension', 'PFilter', 'PGuard',
|
|
15
|
-
'PPipe', 'Param', 'Patch', 'PayloadLargeException', 'Pipe', 'Pipeline', 'Post',
|
|
16
|
-
'Provide', 'Put', 'Query', 'Queue', 'RPCGenerator', 'Route',
|
|
17
|
-
'Rpc', 'RpcBase', 'Search', 'ServerBase', 'ServerPhecda', 'ServiceUnavailableException', 'Storage',
|
|
18
|
-
'Tag', 'TimeoutException', 'TimerException', 'UnauthorizedException', 'UndefinedException',
|
|
19
|
-
'Unique', 'Unmount', 'UnsupportedMediaTypeException', 'ValidateException',
|
|
20
|
-
'Watcher', 'WorkerException',
|
|
21
|
-
'addAddon', 'addDecoToClass',
|
|
22
|
-
'addFilter', 'addGuard', 'addPipe', 'emitter',
|
|
23
|
-
'getMergedMeta', 'getMeta', 'getMetaKey', 'getMetaParams', 'getOwnMeta', 'getOwnMetaKey', 'getOwnMetaParams',
|
|
24
|
-
'getTag',
|
|
25
|
-
'isPhecda', 'log', 'phecdaNamespace', 'runMiddleware',
|
|
26
|
-
'setInject',
|
|
27
|
-
'setLogger',
|
|
28
|
-
'setMeta',
|
|
29
|
-
'useS', 'wait', 'OneFile', 'ManyFiles',
|
|
30
|
-
'Rule', 'Required', 'Optional',
|
|
31
|
-
'validate',
|
|
32
|
-
'Min', 'Max', 'Enum', 'OneOf', 'Nested',
|
|
33
|
-
'Const',
|
|
34
|
-
'Doc', 'DocGenerator',
|
|
35
|
-
'pick', 'omit', 'partial',
|
|
36
|
-
'functionToClass', 'objectToClass'
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
]
|