phecda-server 5.3.3 → 6.0.1
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-F3W3NN7F.mjs +238 -0
- package/dist/{chunk-ECSI4QBK.mjs → chunk-HDQAT2IM.mjs} +55 -65
- package/dist/{chunk-3D7AROG2.js → chunk-LYEZ6RGX.js} +54 -64
- package/dist/{chunk-RZ7IXJYQ.js → chunk-TZYATAJX.js} +12 -30
- package/dist/chunk-XCND2QW3.js +238 -0
- package/dist/{chunk-3IPYLGY2.mjs → chunk-YUXERDQ6.mjs} +13 -31
- package/dist/{core-dx9E5x2N.d.ts → core-Blq8frmr.d.ts} +4 -3
- package/dist/{core-Bc2ENEHX.d.mts → core-D2oL8Ge0.d.mts} +4 -3
- package/dist/helper.js +2 -2
- package/dist/helper.mjs +1 -1
- package/dist/index.d.mts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +29 -27
- package/dist/index.mjs +9 -7
- package/dist/rpc/bullmq/index.d.mts +1 -1
- package/dist/rpc/bullmq/index.d.ts +1 -1
- package/dist/rpc/bullmq/index.js +6 -6
- package/dist/rpc/bullmq/index.mjs +1 -1
- package/dist/rpc/kafka/index.d.mts +1 -1
- package/dist/rpc/kafka/index.d.ts +1 -1
- package/dist/rpc/kafka/index.js +5 -5
- package/dist/rpc/kafka/index.mjs +1 -1
- package/dist/rpc/nats/index.d.mts +1 -1
- package/dist/rpc/nats/index.d.ts +1 -1
- package/dist/rpc/nats/index.js +5 -5
- package/dist/rpc/nats/index.mjs +1 -1
- package/dist/rpc/rabbitmq/index.d.mts +1 -1
- package/dist/rpc/rabbitmq/index.d.ts +1 -1
- package/dist/rpc/rabbitmq/index.js +6 -6
- package/dist/rpc/rabbitmq/index.mjs +1 -1
- package/dist/rpc/redis/index.d.mts +1 -1
- package/dist/rpc/redis/index.d.ts +1 -1
- package/dist/rpc/redis/index.js +6 -6
- package/dist/rpc/redis/index.mjs +1 -1
- package/dist/server/elysia/index.d.mts +1 -1
- package/dist/server/elysia/index.d.ts +1 -1
- package/dist/server/elysia/index.js +15 -15
- package/dist/server/elysia/index.mjs +2 -2
- package/dist/server/express/index.d.mts +1 -1
- package/dist/server/express/index.d.ts +1 -1
- package/dist/server/express/index.js +14 -14
- package/dist/server/express/index.mjs +1 -1
- package/dist/server/fastify/index.d.mts +1 -1
- package/dist/server/fastify/index.d.ts +1 -1
- package/dist/server/fastify/index.js +15 -15
- package/dist/server/fastify/index.mjs +2 -2
- package/dist/server/h3/index.d.mts +1 -1
- package/dist/server/h3/index.d.ts +1 -1
- package/dist/server/h3/index.js +12 -12
- package/dist/server/h3/index.mjs +1 -1
- package/dist/server/hono/index.d.mts +1 -1
- package/dist/server/hono/index.d.ts +1 -1
- package/dist/server/hono/index.js +13 -13
- package/dist/server/hono/index.mjs +1 -1
- package/dist/server/hyper-express/index.d.mts +1 -1
- package/dist/server/hyper-express/index.d.ts +1 -1
- package/dist/server/hyper-express/index.js +13 -13
- package/dist/server/hyper-express/index.mjs +1 -1
- package/dist/server/koa/index.d.mts +1 -1
- package/dist/server/koa/index.d.ts +1 -1
- package/dist/server/koa/index.js +14 -14
- package/dist/server/koa/index.mjs +1 -1
- package/dist/test.d.mts +1 -1
- package/dist/test.d.ts +1 -1
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-2HVTWYS2.js +0 -279
- package/dist/chunk-SXOZVIKW.mjs +0 -279
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
Factory,
|
|
3
3
|
Meta,
|
|
4
4
|
createPhecda,
|
|
5
|
-
emitter
|
|
6
|
-
|
|
5
|
+
emitter,
|
|
6
|
+
isObject
|
|
7
|
+
} from "./chunk-HDQAT2IM.mjs";
|
|
7
8
|
import {
|
|
8
9
|
Arg,
|
|
9
10
|
BaseParam,
|
|
@@ -12,7 +13,6 @@ import {
|
|
|
12
13
|
Ctx,
|
|
13
14
|
Define,
|
|
14
15
|
Delete,
|
|
15
|
-
Event,
|
|
16
16
|
Filter,
|
|
17
17
|
Get,
|
|
18
18
|
Guard,
|
|
@@ -28,8 +28,9 @@ import {
|
|
|
28
28
|
Query,
|
|
29
29
|
Queue,
|
|
30
30
|
Route,
|
|
31
|
-
Rpc
|
|
32
|
-
|
|
31
|
+
Rpc,
|
|
32
|
+
Search
|
|
33
|
+
} from "./chunk-F3W3NN7F.mjs";
|
|
33
34
|
import {
|
|
34
35
|
BadGatewayException,
|
|
35
36
|
BadRequestException,
|
|
@@ -55,7 +56,7 @@ import {
|
|
|
55
56
|
addPipe,
|
|
56
57
|
addPlugin,
|
|
57
58
|
defaultPipe
|
|
58
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-YUXERDQ6.mjs";
|
|
59
60
|
import {
|
|
60
61
|
ERROR_SYMBOL,
|
|
61
62
|
IS_HMR,
|
|
@@ -357,7 +358,6 @@ export {
|
|
|
357
358
|
Define,
|
|
358
359
|
Delete,
|
|
359
360
|
ERROR_SYMBOL,
|
|
360
|
-
Event,
|
|
361
361
|
Exception,
|
|
362
362
|
Factory,
|
|
363
363
|
Filter,
|
|
@@ -399,6 +399,7 @@ export {
|
|
|
399
399
|
Route,
|
|
400
400
|
Rpc,
|
|
401
401
|
RpcBase,
|
|
402
|
+
Search,
|
|
402
403
|
ServerBase,
|
|
403
404
|
ServiceUnavailableException,
|
|
404
405
|
TimeoutException,
|
|
@@ -416,6 +417,7 @@ export {
|
|
|
416
417
|
createPhecda,
|
|
417
418
|
defaultPipe,
|
|
418
419
|
emitter,
|
|
420
|
+
isObject,
|
|
419
421
|
log,
|
|
420
422
|
setLogger
|
|
421
423
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { F as Factory } from '../../core-D2oL8Ge0.mjs';
|
|
3
3
|
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-AgVwUXPC.mjs';
|
|
4
4
|
import { T as ToClientMap } from '../../types-BlIBlnVT.mjs';
|
|
5
5
|
import 'phecda-core';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { F as Factory } from '../../core-Blq8frmr.js';
|
|
3
3
|
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-B-ZFZajI.js';
|
|
4
4
|
import { T as ToClientMap } from '../../types-BlIBlnVT.js';
|
|
5
5
|
import 'phecda-core';
|
package/dist/rpc/bullmq/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
|
|
@@ -18,14 +18,14 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
18
18
|
const workerMap = {};
|
|
19
19
|
const queueMap = {};
|
|
20
20
|
const existQueue = /* @__PURE__ */ new Set();
|
|
21
|
-
const metaMap =
|
|
21
|
+
const metaMap = _chunkTZYATAJXjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
22
22
|
const { controller, rpc, func, tag } = meta2.data;
|
|
23
23
|
if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
|
|
24
24
|
debug(`register method "${func}" in module "${tag}"`);
|
|
25
25
|
return true;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
|
|
28
|
+
_chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
|
|
29
29
|
guards: globalGuards,
|
|
30
30
|
interceptors: globalInterceptors
|
|
31
31
|
}, "rpc");
|
|
@@ -53,7 +53,7 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
53
53
|
const meta2 = metaMap.get(tag)[func];
|
|
54
54
|
const { data: { rpc: { isEvent } = {} } } = meta2;
|
|
55
55
|
if (!isEvent && !(clientQueue in queueMap)) queueMap[clientQueue] = new (0, _bullmq.Queue)(clientQueue, queueOpts);
|
|
56
|
-
const context = new (0,
|
|
56
|
+
const context = new (0, _chunkTZYATAJXjs.Context)({
|
|
57
57
|
type: "bullmq",
|
|
58
58
|
moduleMap,
|
|
59
59
|
meta: meta2,
|
|
@@ -87,7 +87,7 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
87
87
|
}
|
|
88
88
|
_chunkGHFSIZUOjs.__name.call(void 0, handleRequest, "handleRequest");
|
|
89
89
|
subscribeQueues();
|
|
90
|
-
|
|
90
|
+
_chunkTZYATAJXjs.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();
|
|
@@ -108,7 +108,7 @@ async function createClient(controllers, opts = {}) {
|
|
|
108
108
|
const { max, workerOpts, queueOpts, timeout, key } = opts;
|
|
109
109
|
const ret = {};
|
|
110
110
|
const emitter = new (0, _events.EventEmitter)();
|
|
111
|
-
const clientQueue =
|
|
111
|
+
const clientQueue = _chunkTZYATAJXjs.genClientQueue.call(void 0, key);
|
|
112
112
|
const queueMap = {};
|
|
113
113
|
new (0, _bullmq.Worker)(clientQueue, async (job) => {
|
|
114
114
|
const { data, id, error } = job.data;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Consumer, Producer } from 'kafkajs';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { F as Factory } from '../../core-D2oL8Ge0.mjs';
|
|
3
3
|
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-AgVwUXPC.mjs';
|
|
4
4
|
import { T as ToClientMap } from '../../types-BlIBlnVT.mjs';
|
|
5
5
|
import 'phecda-core';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Consumer, Producer } from 'kafkajs';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { F as Factory } from '../../core-Blq8frmr.js';
|
|
3
3
|
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-B-ZFZajI.js';
|
|
4
4
|
import { T as ToClientMap } from '../../types-BlIBlnVT.js';
|
|
5
5
|
import 'phecda-core';
|
package/dist/rpc/kafka/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
|
|
@@ -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 = _chunkTZYATAJXjs.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
|
+
_chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
|
|
25
25
|
guards: globalGuards,
|
|
26
26
|
interceptors: globalInterceptors
|
|
27
27
|
}, "rpc");
|
|
@@ -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, _chunkTZYATAJXjs.Context)({
|
|
59
59
|
type: "kafka",
|
|
60
60
|
moduleMap,
|
|
61
61
|
meta: meta2,
|
|
@@ -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 = _chunkTZYATAJXjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
|
|
121
121
|
await consumer.subscribe({
|
|
122
122
|
topic: clientQueue,
|
|
123
123
|
fromBeginning: true
|
package/dist/rpc/kafka/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NatsConnection } from 'nats';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { F as Factory } from '../../core-D2oL8Ge0.mjs';
|
|
3
3
|
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-AgVwUXPC.mjs';
|
|
4
4
|
import { T as ToClientMap } from '../../types-BlIBlnVT.mjs';
|
|
5
5
|
import 'phecda-core';
|
package/dist/rpc/nats/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NatsConnection } from 'nats';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { F as Factory } from '../../core-Blq8frmr.js';
|
|
3
3
|
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-B-ZFZajI.js';
|
|
4
4
|
import { T as ToClientMap } from '../../types-BlIBlnVT.js';
|
|
5
5
|
import 'phecda-core';
|
package/dist/rpc/nats/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
|
|
@@ -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 = _chunkTZYATAJXjs.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
|
+
_chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
|
|
28
28
|
guards: globalGuards,
|
|
29
29
|
interceptors: globalInterceptors
|
|
30
30
|
}, "rpc");
|
|
@@ -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, _chunkTZYATAJXjs.Context)({
|
|
59
59
|
type: "nats",
|
|
60
60
|
moduleMap,
|
|
61
61
|
meta: meta2,
|
|
@@ -88,7 +88,7 @@ async function bind(nc, { moduleMap, meta }, opts = {}) {
|
|
|
88
88
|
}
|
|
89
89
|
_chunkGHFSIZUOjs.__name.call(void 0, handleRequest, "handleRequest");
|
|
90
90
|
subscribeQueues();
|
|
91
|
-
|
|
91
|
+
_chunkTZYATAJXjs.HMR.call(void 0, async () => {
|
|
92
92
|
for (const i in subscriptionMap) subscriptionMap[i].unsubscribe();
|
|
93
93
|
await subscribeQueues();
|
|
94
94
|
});
|
package/dist/rpc/nats/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import amqplib from 'amqplib';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { F as Factory } from '../../core-D2oL8Ge0.mjs';
|
|
3
3
|
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-AgVwUXPC.mjs';
|
|
4
4
|
import { T as ToClientMap } from '../../types-BlIBlnVT.mjs';
|
|
5
5
|
import 'phecda-core';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import amqplib from 'amqplib';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { F as Factory } from '../../core-Blq8frmr.js';
|
|
3
3
|
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-B-ZFZajI.js';
|
|
4
4
|
import { T as ToClientMap } from '../../types-BlIBlnVT.js';
|
|
5
5
|
import 'phecda-core';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
|
|
@@ -14,14 +14,14 @@ 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 = _chunkTZYATAJXjs.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
|
+
_chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
|
|
25
25
|
guards: globalGuards,
|
|
26
26
|
interceptors: globalInterceptors
|
|
27
27
|
}, "rpc");
|
|
@@ -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, _chunkTZYATAJXjs.Context)({
|
|
61
61
|
type: "rabbitmq",
|
|
62
62
|
moduleMap,
|
|
63
63
|
meta: meta2,
|
|
@@ -91,7 +91,7 @@ async function bind(ch, { moduleMap, meta }, opts = {}) {
|
|
|
91
91
|
}
|
|
92
92
|
_chunkGHFSIZUOjs.__name.call(void 0, handleRequest, "handleRequest");
|
|
93
93
|
subscribeQueues();
|
|
94
|
-
|
|
94
|
+
_chunkTZYATAJXjs.HMR.call(void 0, async () => {
|
|
95
95
|
for (const queue of existQueue) await ch.deleteQueue(queue);
|
|
96
96
|
await subscribeQueues();
|
|
97
97
|
});
|
|
@@ -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 = _chunkTZYATAJXjs.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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Redis from 'ioredis';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { F as Factory } from '../../core-D2oL8Ge0.mjs';
|
|
3
3
|
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-AgVwUXPC.mjs';
|
|
4
4
|
import { T as ToClientMap } from '../../types-BlIBlnVT.mjs';
|
|
5
5
|
import 'phecda-core';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Redis from 'ioredis';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { F as Factory } from '../../core-Blq8frmr.js';
|
|
3
3
|
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-B-ZFZajI.js';
|
|
4
4
|
import { T as ToClientMap } from '../../types-BlIBlnVT.js';
|
|
5
5
|
import 'phecda-core';
|
package/dist/rpc/redis/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
|
|
@@ -14,14 +14,14 @@ 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 = _chunkTZYATAJXjs.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
|
+
_chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
|
|
25
25
|
guards: globalGuards,
|
|
26
26
|
interceptors: globalInterceptors
|
|
27
27
|
}, "rpc");
|
|
@@ -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, _chunkTZYATAJXjs.Context)({
|
|
55
55
|
type: "redis",
|
|
56
56
|
moduleMap,
|
|
57
57
|
redis: sub,
|
|
@@ -87,7 +87,7 @@ function bind({ sub, pub }, { moduleMap, meta }, opts = {}) {
|
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
subscribeQueues();
|
|
90
|
-
|
|
90
|
+
_chunkTZYATAJXjs.HMR.call(void 0, async () => {
|
|
91
91
|
for (const queue of existQueue) await sub.unsubscribe(queue);
|
|
92
92
|
subscribeQueues();
|
|
93
93
|
});
|
|
@@ -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 = _chunkTZYATAJXjs.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](), {
|
package/dist/rpc/redis/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Elysia as Elysia$1, Context, LocalHook, InputSchema, RouteSchema, SingletonBase } from 'elysia';
|
|
2
2
|
import { BaseMacro } from 'elysia/dist/types';
|
|
3
3
|
import { H as HttpContext, a as HttpOptions } from '../../types-Dgxirc9f.mjs';
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
4
|
+
import { F as Factory } from '../../core-D2oL8Ge0.mjs';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import '../../types-BlIBlnVT.mjs';
|
|
7
7
|
import 'phecda-core';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Elysia as Elysia$1, Context, LocalHook, InputSchema, RouteSchema, SingletonBase } from 'elysia';
|
|
2
2
|
import { BaseMacro } from 'elysia/dist/types';
|
|
3
3
|
import { H as HttpContext, a as HttpOptions } from '../../types-BCJhmpQh.js';
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
4
|
+
import { F as Factory } from '../../core-Blq8frmr.js';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import '../../types-BlIBlnVT.js';
|
|
7
7
|
import 'phecda-core';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkXCND2QW3js = require('../../chunk-XCND2QW3.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
|
|
@@ -19,14 +19,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/elysia");
|
|
|
19
19
|
function bind(app, data, opts = {}) {
|
|
20
20
|
const { globalGuards, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe } = opts;
|
|
21
21
|
const { moduleMap, meta } = data;
|
|
22
|
-
const metaMap =
|
|
22
|
+
const metaMap = _chunkTZYATAJXjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
23
23
|
const { controller, http, func, tag } = meta2.data;
|
|
24
24
|
if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
|
|
25
25
|
debug(`register method "${func}" in module "${tag}"`);
|
|
26
26
|
return true;
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
|
|
29
|
+
_chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
|
|
30
30
|
plugins: [
|
|
31
31
|
...globalPlugins,
|
|
32
32
|
...parallelPlugins
|
|
@@ -36,27 +36,27 @@ function bind(app, data, opts = {}) {
|
|
|
36
36
|
});
|
|
37
37
|
registerRoute();
|
|
38
38
|
async function registerRoute() {
|
|
39
|
-
|
|
39
|
+
_chunkTZYATAJXjs.Context.usePlugin(globalPlugins, "elysia").forEach((p) => p(app));
|
|
40
40
|
const parallelRouter = new (0, _elysia.Elysia)();
|
|
41
|
-
|
|
41
|
+
_chunkTZYATAJXjs.Context.usePlugin(parallelPlugins, "elysia").forEach((p) => p(parallelRouter));
|
|
42
42
|
if (parallelRoute) {
|
|
43
43
|
parallelRouter.post(parallelRoute, async (c) => {
|
|
44
44
|
const { body } = c;
|
|
45
45
|
async function errorHandler(e) {
|
|
46
|
-
const error = await
|
|
46
|
+
const error = await _chunkTZYATAJXjs.Context.filterRecord.default(e);
|
|
47
47
|
c.set.status = error.status;
|
|
48
48
|
return error;
|
|
49
49
|
}
|
|
50
50
|
_chunkGHFSIZUOjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
51
|
-
if (!Array.isArray(body)) return errorHandler(new (0,
|
|
51
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkTZYATAJXjs.BadRequestException)("data format should be an array"));
|
|
52
52
|
try {
|
|
53
53
|
return Promise.all(body.map((item, i) => {
|
|
54
54
|
return new Promise(async (resolve) => {
|
|
55
55
|
const { tag, func } = item;
|
|
56
56
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
57
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
57
|
+
if (!metaMap.has(tag)) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
58
58
|
const meta2 = metaMap.get(tag)[func];
|
|
59
|
-
if (!meta2) return resolve(await
|
|
59
|
+
if (!meta2) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
60
60
|
const { data: { params } } = meta2;
|
|
61
61
|
const contextData = {
|
|
62
62
|
type: "elysia",
|
|
@@ -68,7 +68,7 @@ function bind(app, data, opts = {}) {
|
|
|
68
68
|
tag,
|
|
69
69
|
func,
|
|
70
70
|
app,
|
|
71
|
-
...
|
|
71
|
+
..._chunkTZYATAJXjs.argToReq.call(void 0, params, item.args, c.headers),
|
|
72
72
|
getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
|
|
73
73
|
setCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
|
|
74
74
|
...opts2,
|
|
@@ -79,7 +79,7 @@ function bind(app, data, opts = {}) {
|
|
|
79
79
|
setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
|
|
80
80
|
setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus")
|
|
81
81
|
};
|
|
82
|
-
const context = new (0,
|
|
82
|
+
const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
|
|
83
83
|
context.run({
|
|
84
84
|
globalGuards,
|
|
85
85
|
globalInterceptors,
|
|
@@ -102,7 +102,7 @@ function bind(app, data, opts = {}) {
|
|
|
102
102
|
const { data: { define, plugins, http } } = meta2;
|
|
103
103
|
const funcRouter = new (0, _elysia.Elysia)();
|
|
104
104
|
if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
|
|
105
|
-
|
|
105
|
+
_chunkTZYATAJXjs.Context.usePlugin(plugins, "elysia").forEach((p) => p(funcRouter));
|
|
106
106
|
funcRouter[http.type](http.prefix + http.route, async (c) => {
|
|
107
107
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
108
108
|
const contextData = {
|
|
@@ -127,7 +127,7 @@ function bind(app, data, opts = {}) {
|
|
|
127
127
|
setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
|
|
128
128
|
setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus")
|
|
129
129
|
};
|
|
130
|
-
const context = new (0,
|
|
130
|
+
const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
|
|
131
131
|
if (http.headers) c.set.headers = http.headers;
|
|
132
132
|
return context.run({
|
|
133
133
|
globalGuards,
|
|
@@ -147,7 +147,7 @@ function bind(app, data, opts = {}) {
|
|
|
147
147
|
}
|
|
148
148
|
_chunkGHFSIZUOjs.__name.call(void 0, bind, "bind");
|
|
149
149
|
function Elysia(opts) {
|
|
150
|
-
return
|
|
150
|
+
return _chunkXCND2QW3js.Define.call(void 0, "elysia", opts);
|
|
151
151
|
}
|
|
152
152
|
_chunkGHFSIZUOjs.__name.call(void 0, Elysia, "Elysia");
|
|
153
153
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Define
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-F3W3NN7F.mjs";
|
|
4
4
|
import {
|
|
5
5
|
BadRequestException,
|
|
6
6
|
Context,
|
|
7
7
|
argToReq,
|
|
8
8
|
createControllerMetaMap,
|
|
9
9
|
detectAopDep
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-YUXERDQ6.mjs";
|
|
11
11
|
import {
|
|
12
12
|
__name
|
|
13
13
|
} from "../../chunk-UXD62LGG.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Request, Response, Router, RequestHandler } from 'express';
|
|
2
2
|
import { H as HttpContext, a as HttpOptions } from '../../types-Dgxirc9f.mjs';
|
|
3
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { F as Factory } from '../../core-D2oL8Ge0.mjs';
|
|
4
4
|
import 'node:http';
|
|
5
5
|
import '../../types-BlIBlnVT.mjs';
|
|
6
6
|
import 'phecda-core';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Request, Response, Router, RequestHandler } from 'express';
|
|
2
2
|
import { H as HttpContext, a as HttpOptions } from '../../types-BCJhmpQh.js';
|
|
3
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { F as Factory } from '../../core-Blq8frmr.js';
|
|
4
4
|
import 'node:http';
|
|
5
5
|
import '../../types-BlIBlnVT.js';
|
|
6
6
|
import 'phecda-core';
|