phecda-server 8.5.4 → 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.
- package/bin/cli.mjs +1 -9
- package/dist/{chunk-76UDKZOJ.js → chunk-CCK6KDM3.js} +120 -76
- package/dist/{chunk-LLF55NZP.js → chunk-IBVPZSZJ.js} +6 -6
- package/dist/{chunk-URKOYTBU.mjs → chunk-ITDH2YDL.mjs} +6 -6
- package/dist/{chunk-5ZZAOOKE.js → chunk-KVWT2QTL.js} +26 -26
- package/dist/{chunk-WST6E6MQ.mjs → chunk-LNL3MVTR.mjs} +71 -27
- package/dist/{chunk-ZHNYWZRL.mjs → chunk-T5F6Q2CZ.mjs} +1 -1
- package/dist/{chunk-MUUKKO67.mjs → chunk-UK3RDUEP.mjs} +1 -1
- package/dist/{chunk-SKGOTR4T.js → chunk-UP64TNWR.js} +20 -20
- package/dist/{core-BiS3xJKx.d.ts → core-Bd2ynlyb.d.ts} +1 -1
- package/dist/{core-BYxcQ8kf.d.mts → core-nqk9d66O.d.mts} +1 -1
- 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/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.d.mts +3 -3
- package/dist/http/express/index.d.ts +3 -3
- package/dist/http/express/index.js +37 -37
- package/dist/http/express/index.mjs +2 -2
- package/dist/http/fastify/index.d.mts +3 -3
- package/dist/http/fastify/index.d.ts +3 -3
- package/dist/http/fastify/index.js +38 -38
- package/dist/http/fastify/index.mjs +3 -3
- package/dist/http/h3/index.d.mts +3 -3
- package/dist/http/h3/index.d.ts +3 -3
- package/dist/http/h3/index.js +38 -38
- package/dist/http/h3/index.mjs +2 -2
- package/dist/http/hono/index.d.mts +3 -3
- package/dist/http/hono/index.d.ts +3 -3
- package/dist/http/hono/index.js +34 -34
- package/dist/http/hono/index.mjs +2 -2
- package/dist/http/hyper-express/index.d.mts +3 -3
- package/dist/http/hyper-express/index.d.ts +3 -3
- package/dist/http/hyper-express/index.js +35 -35
- package/dist/http/hyper-express/index.mjs +2 -2
- package/dist/http/koa/index.d.mts +3 -3
- package/dist/http/koa/index.d.ts +3 -3
- package/dist/http/koa/index.js +37 -37
- package/dist/http/koa/index.mjs +2 -2
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +54 -54
- package/dist/index.mjs +19 -19
- package/dist/{meta-Csp1xcSR.d.mts → meta-ZbvaS7xK.d.mts} +2 -2
- package/dist/{meta-Csp1xcSR.d.ts → meta-ZbvaS7xK.d.ts} +2 -2
- package/dist/rpc/bullmq/index.d.mts +3 -3
- package/dist/rpc/bullmq/index.d.ts +3 -3
- package/dist/rpc/bullmq/index.js +11 -11
- package/dist/rpc/bullmq/index.mjs +2 -2
- package/dist/rpc/electron/index.d.mts +3 -3
- package/dist/rpc/electron/index.d.ts +3 -3
- package/dist/rpc/electron/index.js +8 -8
- package/dist/rpc/electron/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 +10 -10
- 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 +12 -12
- 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 +10 -10
- package/dist/rpc/redis/index.mjs +2 -2
- package/dist/rpc/web-ext/index.d.mts +3 -3
- package/dist/rpc/web-ext/index.d.ts +3 -3
- package/dist/rpc/web-ext/index.js +8 -8
- package/dist/rpc/web-ext/index.mjs +2 -2
- package/dist/rpc/ws/index.d.mts +3 -3
- package/dist/rpc/ws/index.d.ts +3 -3
- package/dist/rpc/ws/index.js +7 -7
- package/dist/rpc/ws/index.mjs +2 -2
- package/dist/test.d.mts +2 -2
- package/dist/test.d.ts +2 -2
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/dist/{types-Bs64nYvd.d.ts → types-B4zY7i87.d.ts} +1 -1
- package/dist/{types-CjVwVyJT.d.mts → types-BfcBZVua.d.mts} +1 -1
- package/dist/{types-DExQe0qk.d.ts → types-CHWgzilt.d.ts} +1 -1
- package/dist/{types-DSlyrmns.d.mts → types-f_hV_rCD.d.mts} +1 -1
- package/package.json +2 -2
- package/register/index.mjs +2 -0
- 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-
|
|
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-
|
|
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-
|
|
78
|
+
} from "./chunk-ITDH2YDL.mjs";
|
|
79
79
|
|
|
80
80
|
// src/types.ts
|
|
81
81
|
var CustomResponse = class {
|
|
@@ -129,7 +129,7 @@ _ts_decorate([
|
|
|
129
129
|
], RpcBase.prototype, "context", void 0);
|
|
130
130
|
|
|
131
131
|
// src/modules/filter.ts
|
|
132
|
-
import {
|
|
132
|
+
import { Init, getTag } from "phecda-core";
|
|
133
133
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
134
134
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
135
135
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -162,7 +162,7 @@ _ts_decorate2([
|
|
|
162
162
|
], PFilter.prototype, "_init", null);
|
|
163
163
|
|
|
164
164
|
// src/modules/guard.ts
|
|
165
|
-
import {
|
|
165
|
+
import { Init as Init2, getTag as getTag2 } from "phecda-core";
|
|
166
166
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
167
167
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
168
168
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -196,7 +196,7 @@ _ts_decorate3([
|
|
|
196
196
|
], PGuard.prototype, "_init", null);
|
|
197
197
|
|
|
198
198
|
// src/modules/pipe.ts
|
|
199
|
-
import {
|
|
199
|
+
import { Init as Init3, getTag as getTag3 } from "phecda-core";
|
|
200
200
|
function _ts_decorate4(decorators, target, key, desc) {
|
|
201
201
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
202
202
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -229,7 +229,7 @@ _ts_decorate4([
|
|
|
229
229
|
], PPipe.prototype, "_init", null);
|
|
230
230
|
|
|
231
231
|
// src/modules/addon.ts
|
|
232
|
-
import {
|
|
232
|
+
import { Init as Init4, getTag as getTag4 } from "phecda-core";
|
|
233
233
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
234
234
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
235
235
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -263,7 +263,7 @@ _ts_decorate5([
|
|
|
263
263
|
], PAddon.prototype, "_init", null);
|
|
264
264
|
|
|
265
265
|
// src/modules/extension.ts
|
|
266
|
-
import {
|
|
266
|
+
import { Init as Init5, getTag as getTag5 } from "phecda-core";
|
|
267
267
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
268
268
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
269
269
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -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
|
|
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,
|
|
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
|
|
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,
|
|
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-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
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-
|
|
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-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
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-
|
|
5
|
+
import '../../meta-ZbvaS7xK.js';
|
|
6
6
|
|
|
7
7
|
interface BullmqCtx extends RpcCtx {
|
|
8
8
|
type: 'bullmq';
|
package/dist/rpc/bullmq/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkCCK6KDM3js = require('../../chunk-CCK6KDM3.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
41
|
+
_chunkCCK6KDM3js.Context.applyAddons(addons, workerMap[queue], "bullmq");
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
|
|
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 =
|
|
55
|
+
const aop = _chunkCCK6KDM3js.Context.getAop(meta2, {
|
|
56
56
|
globalFilter,
|
|
57
57
|
globalGuards,
|
|
58
58
|
globalPipe
|
|
59
59
|
});
|
|
60
|
-
const context = new (0,
|
|
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
|
-
|
|
88
|
+
_chunkIBVPZSZJjs.__name.call(void 0, handleRequest, "handleRequest");
|
|
89
89
|
subscribeQueues();
|
|
90
|
-
|
|
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
|
-
|
|
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-
|
|
5
|
+
} from "../../chunk-LNL3MVTR.mjs";
|
|
6
6
|
import {
|
|
7
7
|
HMR,
|
|
8
8
|
__name
|
|
9
|
-
} from "../../chunk-
|
|
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-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
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-
|
|
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-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
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-
|
|
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
|
|
5
|
+
var _chunkCCK6KDM3js = require('../../chunk-CCK6KDM3.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
34
|
+
const aop = _chunkCCK6KDM3js.Context.getAop(meta2, {
|
|
35
35
|
globalFilter,
|
|
36
36
|
globalGuards,
|
|
37
37
|
globalPipe
|
|
38
38
|
});
|
|
39
|
-
const context = new (0,
|
|
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
|
-
|
|
67
|
+
_chunkIBVPZSZJjs.__name.call(void 0, callback, "callback");
|
|
68
68
|
}
|
|
69
|
-
|
|
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-
|
|
5
|
+
} from "../../chunk-LNL3MVTR.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
|
-
} from "../../chunk-
|
|
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-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
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-
|
|
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-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
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-
|
|
5
|
+
import '../../meta-ZbvaS7xK.js';
|
|
6
6
|
|
|
7
7
|
interface KafkaCtx extends RpcCtx {
|
|
8
8
|
type: 'kafka';
|
package/dist/rpc/kafka/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkCCK6KDM3js = require('../../chunk-CCK6KDM3.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
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 =
|
|
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
|
-
|
|
23
|
+
_chunkCCK6KDM3js.detectAopDep.call(void 0, meta, {
|
|
24
24
|
guards: globalGuards,
|
|
25
25
|
addons: globalAddons
|
|
26
26
|
}, "rpc");
|
|
27
|
-
|
|
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
|
-
|
|
49
|
+
_chunkIBVPZSZJjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
|
|
50
50
|
await subscribeQueues();
|
|
51
51
|
await consumer.run({
|
|
52
|
-
eachMessage: /* @__PURE__ */
|
|
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 =
|
|
61
|
+
const aop = _chunkCCK6KDM3js.Context.getAop(meta2, {
|
|
62
62
|
globalFilter,
|
|
63
63
|
globalGuards,
|
|
64
64
|
globalPipe
|
|
65
65
|
});
|
|
66
|
-
const context = new (0,
|
|
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
|
-
|
|
115
|
+
_chunkIBVPZSZJjs.__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-LNL3MVTR.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
|
-
} from "../../chunk-
|
|
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-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
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-
|
|
5
|
+
import '../../meta-ZbvaS7xK.mjs';
|
|
6
6
|
|
|
7
7
|
interface NatsCtx extends RpcCtx {
|
|
8
8
|
type: 'nats';
|
package/dist/rpc/nats/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { NatsConnection } from 'nats';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
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-
|
|
5
|
+
import '../../meta-ZbvaS7xK.js';
|
|
6
6
|
|
|
7
7
|
interface NatsCtx extends RpcCtx {
|
|
8
8
|
type: 'nats';
|
package/dist/rpc/nats/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkCCK6KDM3js = require('../../chunk-CCK6KDM3.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
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 =
|
|
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
|
-
|
|
27
|
+
_chunkCCK6KDM3js.detectAopDep.call(void 0, meta, {
|
|
28
28
|
addons: globalAddons,
|
|
29
29
|
guards: globalGuards
|
|
30
30
|
}, "rpc");
|
|
31
|
-
|
|
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
|
-
|
|
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 =
|
|
59
|
+
const aop = _chunkCCK6KDM3js.Context.getAop(meta2, {
|
|
60
60
|
globalFilter,
|
|
61
61
|
globalGuards,
|
|
62
62
|
globalPipe
|
|
63
63
|
});
|
|
64
|
-
const context = new (0,
|
|
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
|
-
|
|
91
|
+
_chunkIBVPZSZJjs.__name.call(void 0, handleRequest, "handleRequest");
|
|
92
92
|
subscribeQueues();
|
|
93
|
-
|
|
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
|
-
|
|
98
|
+
_chunkIBVPZSZJjs.__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-LNL3MVTR.mjs";
|
|
6
6
|
import {
|
|
7
7
|
HMR,
|
|
8
8
|
__name
|
|
9
|
-
} from "../../chunk-
|
|
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-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
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-
|
|
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-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
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-
|
|
5
|
+
import '../../meta-ZbvaS7xK.js';
|
|
6
6
|
|
|
7
7
|
interface RabbitmqCtx extends RpcCtx {
|
|
8
8
|
type: 'rabbitmq';
|