phecda-server 8.5.3 → 8.6.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-WST6E6MQ.mjs → chunk-LQFHZGVJ.mjs} +72 -22
- package/dist/{chunk-76UDKZOJ.js → chunk-XOWAQGBO.js} +71 -21
- package/dist/{core-DCERPmy5.d.mts → core-BYxcQ8kf.d.mts} +1 -1
- package/dist/{core-D7uMDEXI.d.ts → core-BiS3xJKx.d.ts} +1 -1
- package/dist/helper.d.mts +1 -1
- package/dist/helper.d.ts +1 -1
- package/dist/helper.js +2 -2
- package/dist/helper.mjs +1 -1
- package/dist/http/elysia/index.d.mts +3 -3
- package/dist/http/elysia/index.d.ts +3 -3
- package/dist/http/elysia/index.js +17 -17
- package/dist/http/elysia/index.mjs +1 -1
- package/dist/http/express/index.d.mts +3 -3
- package/dist/http/express/index.d.ts +3 -3
- package/dist/http/express/index.js +16 -16
- package/dist/http/express/index.mjs +1 -1
- package/dist/http/fastify/index.d.mts +3 -3
- package/dist/http/fastify/index.d.ts +3 -3
- package/dist/http/fastify/index.js +16 -16
- package/dist/http/fastify/index.mjs +1 -1
- package/dist/http/h3/index.d.mts +3 -3
- package/dist/http/h3/index.d.ts +3 -3
- package/dist/http/h3/index.js +17 -17
- package/dist/http/h3/index.mjs +1 -1
- package/dist/http/hono/index.d.mts +3 -3
- package/dist/http/hono/index.d.ts +3 -3
- package/dist/http/hono/index.js +14 -14
- package/dist/http/hono/index.mjs +1 -1
- 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 +15 -15
- package/dist/http/hyper-express/index.mjs +1 -1
- package/dist/http/koa/index.d.mts +3 -3
- package/dist/http/koa/index.d.ts +3 -3
- package/dist/http/koa/index.js +16 -16
- package/dist/http/koa/index.mjs +1 -1
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +20 -20
- package/dist/index.mjs +6 -6
- package/dist/{meta-CZDDYaRV.d.mts → meta-Csp1xcSR.d.mts} +1 -1
- package/dist/{meta-CZDDYaRV.d.ts → meta-Csp1xcSR.d.ts} +1 -1
- package/dist/rpc/bullmq/index.d.mts +3 -3
- package/dist/rpc/bullmq/index.d.ts +3 -3
- package/dist/rpc/bullmq/index.js +6 -6
- package/dist/rpc/bullmq/index.mjs +1 -1
- package/dist/rpc/electron/index.d.mts +3 -3
- package/dist/rpc/electron/index.d.ts +3 -3
- package/dist/rpc/electron/index.js +5 -5
- package/dist/rpc/electron/index.mjs +1 -1
- package/dist/rpc/kafka/index.d.mts +3 -3
- package/dist/rpc/kafka/index.d.ts +3 -3
- package/dist/rpc/kafka/index.js +6 -6
- package/dist/rpc/kafka/index.mjs +1 -1
- package/dist/rpc/nats/index.d.mts +3 -3
- package/dist/rpc/nats/index.d.ts +3 -3
- package/dist/rpc/nats/index.js +6 -6
- package/dist/rpc/nats/index.mjs +1 -1
- package/dist/rpc/rabbitmq/index.d.mts +3 -3
- package/dist/rpc/rabbitmq/index.d.ts +3 -3
- package/dist/rpc/rabbitmq/index.js +6 -6
- package/dist/rpc/rabbitmq/index.mjs +1 -1
- package/dist/rpc/redis/index.d.mts +3 -3
- package/dist/rpc/redis/index.d.ts +3 -3
- package/dist/rpc/redis/index.js +6 -6
- package/dist/rpc/redis/index.mjs +1 -1
- package/dist/rpc/web-ext/index.d.mts +11 -1
- package/dist/rpc/web-ext/index.d.ts +11 -1
- package/dist/rpc/web-ext/index.js +71 -1
- package/dist/rpc/web-ext/index.mjs +71 -0
- package/dist/rpc/ws/index.d.mts +3 -3
- package/dist/rpc/ws/index.d.ts +3 -3
- package/dist/rpc/ws/index.js +5 -5
- package/dist/rpc/ws/index.mjs +1 -1
- package/dist/test.d.mts +2 -2
- package/dist/test.d.ts +2 -2
- package/dist/{types-S1PZEcrK.d.ts → types-Bs64nYvd.d.ts} +1 -1
- package/dist/{types-LPSac5sm.d.mts → types-CjVwVyJT.d.mts} +1 -1
- package/dist/{types-DG5DI_EC.d.ts → types-DExQe0qk.d.ts} +1 -1
- package/dist/{types-BbnTNTe3.d.mts → types-DSlyrmns.d.mts} +1 -1
- package/package.json +2 -2
package/dist/rpc/nats/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkXOWAQGBOjs = require('../../chunk-XOWAQGBO.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -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 = _chunkXOWAQGBOjs.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
|
+
_chunkXOWAQGBOjs.detectAopDep.call(void 0, meta, {
|
|
28
28
|
addons: globalAddons,
|
|
29
29
|
guards: globalGuards
|
|
30
30
|
}, "rpc");
|
|
31
|
-
|
|
31
|
+
_chunkXOWAQGBOjs.Context.applyAddons(globalAddons, nc, "nats");
|
|
32
32
|
async function subscribeQueues() {
|
|
33
33
|
existQueue.clear();
|
|
34
34
|
for (const [tag, record] of metaMap) {
|
|
@@ -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 = _chunkXOWAQGBOjs.Context.getAop(meta2, {
|
|
60
60
|
globalFilter,
|
|
61
61
|
globalGuards,
|
|
62
62
|
globalPipe
|
|
63
63
|
});
|
|
64
|
-
const context = new (0,
|
|
64
|
+
const context = new (0, _chunkXOWAQGBOjs.Context)({
|
|
65
65
|
type: "nats",
|
|
66
66
|
category: "rpc",
|
|
67
67
|
moduleMap,
|
package/dist/rpc/nats/index.mjs
CHANGED
|
@@ -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-BYxcQ8kf.mjs';
|
|
3
|
+
import { R as RpcCtx, a as RpcServerOptions } from '../../types-DSlyrmns.mjs';
|
|
4
4
|
import 'phecda-core';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-Csp1xcSR.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-BiS3xJKx.js';
|
|
3
|
+
import { R as RpcCtx, a as RpcServerOptions } from '../../types-DExQe0qk.js';
|
|
4
4
|
import 'phecda-core';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-Csp1xcSR.js';
|
|
6
6
|
|
|
7
7
|
interface RabbitmqCtx extends RpcCtx {
|
|
8
8
|
type: 'rabbitmq';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkXOWAQGBOjs = require('../../chunk-XOWAQGBO.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -13,19 +13,19 @@ 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 = _chunkXOWAQGBOjs.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
|
+
_chunkXOWAQGBOjs.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
|
+
_chunkXOWAQGBOjs.Context.applyAddons(globalAddons, ch, "rabbitmq");
|
|
29
29
|
async function subscribeQueues() {
|
|
30
30
|
existQueue.clear();
|
|
31
31
|
for (const [tag, record] of metaMap) {
|
|
@@ -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 = _chunkXOWAQGBOjs.Context.getAop(meta2, {
|
|
61
61
|
globalFilter,
|
|
62
62
|
globalGuards,
|
|
63
63
|
globalPipe
|
|
64
64
|
});
|
|
65
|
-
const context = new (0,
|
|
65
|
+
const context = new (0, _chunkXOWAQGBOjs.Context)({
|
|
66
66
|
type: "rabbitmq",
|
|
67
67
|
category: "rpc",
|
|
68
68
|
moduleMap,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Redis from 'ioredis';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
2
|
+
import { F as Factory } from '../../core-BYxcQ8kf.mjs';
|
|
3
|
+
import { R as RpcCtx, a as RpcServerOptions } from '../../types-DSlyrmns.mjs';
|
|
4
4
|
import 'phecda-core';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-Csp1xcSR.mjs';
|
|
6
6
|
|
|
7
7
|
interface RedisCtx extends RpcCtx {
|
|
8
8
|
type: 'redis';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Redis from 'ioredis';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
2
|
+
import { F as Factory } from '../../core-BiS3xJKx.js';
|
|
3
|
+
import { R as RpcCtx, a as RpcServerOptions } from '../../types-DExQe0qk.js';
|
|
4
4
|
import 'phecda-core';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-Csp1xcSR.js';
|
|
6
6
|
|
|
7
7
|
interface RedisCtx extends RpcCtx {
|
|
8
8
|
type: 'redis';
|
package/dist/rpc/redis/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkXOWAQGBOjs = require('../../chunk-XOWAQGBO.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -13,19 +13,19 @@ 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 = _chunkXOWAQGBOjs.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
|
+
_chunkXOWAQGBOjs.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
|
+
_chunkXOWAQGBOjs.Context.applyAddons(globalAddons, {
|
|
29
29
|
pub,
|
|
30
30
|
sub
|
|
31
31
|
}, "redis");
|
|
@@ -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 = _chunkXOWAQGBOjs.Context.getAop(meta2, {
|
|
58
58
|
globalFilter,
|
|
59
59
|
globalGuards,
|
|
60
60
|
globalPipe
|
|
61
61
|
});
|
|
62
|
-
const context = new (0,
|
|
62
|
+
const context = new (0, _chunkXOWAQGBOjs.Context)({
|
|
63
63
|
type: "redis",
|
|
64
64
|
category: "rpc",
|
|
65
65
|
moduleMap,
|
package/dist/rpc/redis/index.mjs
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
import { F as Factory } from '../../core-BYxcQ8kf.mjs';
|
|
2
|
+
import { R as RpcCtx, a as RpcServerOptions } from '../../types-DSlyrmns.mjs';
|
|
3
|
+
import 'phecda-core';
|
|
4
|
+
import '../../meta-Csp1xcSR.mjs';
|
|
1
5
|
|
|
2
|
-
|
|
6
|
+
interface WebExtCtx extends RpcCtx {
|
|
7
|
+
type: 'browser-extension';
|
|
8
|
+
sender: chrome.runtime.MessageSender;
|
|
9
|
+
}
|
|
10
|
+
declare function bind({ moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: RpcServerOptions): void;
|
|
11
|
+
|
|
12
|
+
export { type WebExtCtx, bind };
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
import { F as Factory } from '../../core-BiS3xJKx.js';
|
|
2
|
+
import { R as RpcCtx, a as RpcServerOptions } from '../../types-DExQe0qk.js';
|
|
3
|
+
import 'phecda-core';
|
|
4
|
+
import '../../meta-Csp1xcSR.js';
|
|
1
5
|
|
|
2
|
-
|
|
6
|
+
interface WebExtCtx extends RpcCtx {
|
|
7
|
+
type: 'browser-extension';
|
|
8
|
+
sender: chrome.runtime.MessageSender;
|
|
9
|
+
}
|
|
10
|
+
declare function bind({ moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: RpcServerOptions): void;
|
|
11
|
+
|
|
12
|
+
export { type WebExtCtx, bind };
|
|
@@ -1 +1,71 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkXOWAQGBOjs = require('../../chunk-XOWAQGBO.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkLLF55NZPjs = require('../../chunk-LLF55NZP.js');
|
|
9
|
+
|
|
10
|
+
// src/rpc/web-ext/bind.ts
|
|
11
|
+
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
12
|
+
var debug = _debug2.default.call(void 0, "phecda-server/electron");
|
|
13
|
+
function bind({ moduleMap, meta }, opts = {}) {
|
|
14
|
+
const { globalGuards, globalFilter, globalPipe, globalAddons = [] } = opts;
|
|
15
|
+
const metaMap = _chunkXOWAQGBOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
16
|
+
const { controller, rpc, method, tag } = meta2.data;
|
|
17
|
+
if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
|
|
18
|
+
debug(`register method "${method}" in module "${tag}"`);
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
_chunkXOWAQGBOjs.detectAopDep.call(void 0, meta, {
|
|
23
|
+
guards: globalGuards,
|
|
24
|
+
addons: globalAddons
|
|
25
|
+
}, "rpc");
|
|
26
|
+
chrome.runtime.onMessage.addListener(callback);
|
|
27
|
+
async function callback(data, sender, sendResponse) {
|
|
28
|
+
const { method, id, tag, _ps, args } = data || {};
|
|
29
|
+
debug(`invoke method "${method}" in module "${tag}"`);
|
|
30
|
+
if (_ps !== 1) return;
|
|
31
|
+
const meta2 = metaMap.get(tag)[method];
|
|
32
|
+
const { data: { rpc: { isEvent } = {} } } = meta2;
|
|
33
|
+
const aop = _chunkXOWAQGBOjs.Context.getAop(meta2, {
|
|
34
|
+
globalFilter,
|
|
35
|
+
globalGuards,
|
|
36
|
+
globalPipe
|
|
37
|
+
});
|
|
38
|
+
const context = new (0, _chunkXOWAQGBOjs.Context)({
|
|
39
|
+
type: "browser-extension",
|
|
40
|
+
category: "rpc",
|
|
41
|
+
moduleMap,
|
|
42
|
+
meta: meta2,
|
|
43
|
+
tag,
|
|
44
|
+
method,
|
|
45
|
+
args,
|
|
46
|
+
id,
|
|
47
|
+
isEvent,
|
|
48
|
+
queue: tag,
|
|
49
|
+
sender
|
|
50
|
+
});
|
|
51
|
+
return await context.run(aop, (returnData) => {
|
|
52
|
+
if (!isEvent) sendResponse({
|
|
53
|
+
data: returnData,
|
|
54
|
+
id
|
|
55
|
+
});
|
|
56
|
+
}, (err) => {
|
|
57
|
+
if (!isEvent) {
|
|
58
|
+
sendResponse({
|
|
59
|
+
data: err,
|
|
60
|
+
error: true,
|
|
61
|
+
id
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
_chunkLLF55NZPjs.__name.call(void 0, callback, "callback");
|
|
67
|
+
}
|
|
68
|
+
_chunkLLF55NZPjs.__name.call(void 0, bind, "bind");
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
exports.bind = bind;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Context,
|
|
3
|
+
createControllerMetaMap,
|
|
4
|
+
detectAopDep
|
|
5
|
+
} from "../../chunk-LQFHZGVJ.mjs";
|
|
6
|
+
import {
|
|
7
|
+
__name
|
|
8
|
+
} from "../../chunk-URKOYTBU.mjs";
|
|
9
|
+
|
|
10
|
+
// src/rpc/web-ext/bind.ts
|
|
11
|
+
import Debug from "debug";
|
|
12
|
+
var debug = Debug("phecda-server/electron");
|
|
13
|
+
function bind({ moduleMap, meta }, opts = {}) {
|
|
14
|
+
const { globalGuards, globalFilter, globalPipe, globalAddons = [] } = opts;
|
|
15
|
+
const metaMap = createControllerMetaMap(meta, (meta2) => {
|
|
16
|
+
const { controller, rpc, method, tag } = meta2.data;
|
|
17
|
+
if (controller === "rpc" && rpc?.queue !== void 0) {
|
|
18
|
+
debug(`register method "${method}" in module "${tag}"`);
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
detectAopDep(meta, {
|
|
23
|
+
guards: globalGuards,
|
|
24
|
+
addons: globalAddons
|
|
25
|
+
}, "rpc");
|
|
26
|
+
chrome.runtime.onMessage.addListener(callback);
|
|
27
|
+
async function callback(data, sender, sendResponse) {
|
|
28
|
+
const { method, id, tag, _ps, args } = data || {};
|
|
29
|
+
debug(`invoke method "${method}" in module "${tag}"`);
|
|
30
|
+
if (_ps !== 1) return;
|
|
31
|
+
const meta2 = metaMap.get(tag)[method];
|
|
32
|
+
const { data: { rpc: { isEvent } = {} } } = meta2;
|
|
33
|
+
const aop = Context.getAop(meta2, {
|
|
34
|
+
globalFilter,
|
|
35
|
+
globalGuards,
|
|
36
|
+
globalPipe
|
|
37
|
+
});
|
|
38
|
+
const context = new Context({
|
|
39
|
+
type: "browser-extension",
|
|
40
|
+
category: "rpc",
|
|
41
|
+
moduleMap,
|
|
42
|
+
meta: meta2,
|
|
43
|
+
tag,
|
|
44
|
+
method,
|
|
45
|
+
args,
|
|
46
|
+
id,
|
|
47
|
+
isEvent,
|
|
48
|
+
queue: tag,
|
|
49
|
+
sender
|
|
50
|
+
});
|
|
51
|
+
return await context.run(aop, (returnData) => {
|
|
52
|
+
if (!isEvent) sendResponse({
|
|
53
|
+
data: returnData,
|
|
54
|
+
id
|
|
55
|
+
});
|
|
56
|
+
}, (err) => {
|
|
57
|
+
if (!isEvent) {
|
|
58
|
+
sendResponse({
|
|
59
|
+
data: err,
|
|
60
|
+
error: true,
|
|
61
|
+
id
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
__name(callback, "callback");
|
|
67
|
+
}
|
|
68
|
+
__name(bind, "bind");
|
|
69
|
+
export {
|
|
70
|
+
bind
|
|
71
|
+
};
|
package/dist/rpc/ws/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import WS from 'ws';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
2
|
+
import { F as Factory } from '../../core-BYxcQ8kf.mjs';
|
|
3
|
+
import { R as RpcCtx, a as RpcServerOptions } from '../../types-DSlyrmns.mjs';
|
|
4
4
|
import 'phecda-core';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-Csp1xcSR.mjs';
|
|
6
6
|
|
|
7
7
|
interface WsCtx extends RpcCtx {
|
|
8
8
|
type: 'ws';
|
package/dist/rpc/ws/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import WS from 'ws';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcCtx, a as RpcServerOptions } from '../../types-
|
|
2
|
+
import { F as Factory } from '../../core-BiS3xJKx.js';
|
|
3
|
+
import { R as RpcCtx, a as RpcServerOptions } from '../../types-DExQe0qk.js';
|
|
4
4
|
import 'phecda-core';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-Csp1xcSR.js';
|
|
6
6
|
|
|
7
7
|
interface WsCtx extends RpcCtx {
|
|
8
8
|
type: 'ws';
|
package/dist/rpc/ws/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkXOWAQGBOjs = require('../../chunk-XOWAQGBO.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkLLF55NZPjs = require('../../chunk-LLF55NZP.js');
|
|
@@ -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 = _chunkXOWAQGBOjs.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
|
+
_chunkXOWAQGBOjs.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 = _chunkXOWAQGBOjs.Context.getAop(meta2, {
|
|
36
36
|
globalFilter,
|
|
37
37
|
globalGuards,
|
|
38
38
|
globalPipe
|
|
39
39
|
});
|
|
40
|
-
const context = new (0,
|
|
40
|
+
const context = new (0, _chunkXOWAQGBOjs.Context)({
|
|
41
41
|
type: "ws",
|
|
42
42
|
category: "rpc",
|
|
43
43
|
meta: meta2,
|
package/dist/rpc/ws/index.mjs
CHANGED
package/dist/test.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import * as supertest from 'supertest';
|
|
|
2
2
|
import { Test } from 'supertest';
|
|
3
3
|
import { Server } from 'node:http';
|
|
4
4
|
import { Construct } from 'phecda-core';
|
|
5
|
-
import { F as Factory } from './core-
|
|
6
|
-
import {
|
|
5
|
+
import { F as Factory } from './core-BYxcQ8kf.mjs';
|
|
6
|
+
import { d as CustomResponse } from './meta-Csp1xcSR.mjs';
|
|
7
7
|
|
|
8
8
|
type PickFuncKeys<Type> = {
|
|
9
9
|
[Key in keyof Type]: Type[Key] extends (...args: any) => any ? (ReturnType<Type[Key]> extends CustomResponse<any> ? never : Key) : never;
|
package/dist/test.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as supertest from 'supertest';
|
|
|
2
2
|
import { Test } from 'supertest';
|
|
3
3
|
import { Server } from 'node:http';
|
|
4
4
|
import { Construct } from 'phecda-core';
|
|
5
|
-
import { F as Factory } from './core-
|
|
6
|
-
import {
|
|
5
|
+
import { F as Factory } from './core-BiS3xJKx.js';
|
|
6
|
+
import { d as CustomResponse } from './meta-Csp1xcSR.js';
|
|
7
7
|
|
|
8
8
|
type PickFuncKeys<Type> = {
|
|
9
9
|
[Key in keyof Type]: Type[Key] extends (...args: any) => any ? (ReturnType<Type[Key]> extends CustomResponse<any> ? never : Key) : never;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import { B as BaseCtx, D as DefaultOptions } from './meta-
|
|
2
|
+
import { B as BaseCtx, D as DefaultOptions } from './meta-Csp1xcSR.js';
|
|
3
3
|
|
|
4
4
|
interface HttpOptions extends DefaultOptions {
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import { B as BaseCtx, D as DefaultOptions } from './meta-
|
|
2
|
+
import { B as BaseCtx, D as DefaultOptions } from './meta-Csp1xcSR.mjs';
|
|
3
3
|
|
|
4
4
|
interface HttpOptions extends DefaultOptions {
|
|
5
5
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-server",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.6.0",
|
|
4
4
|
"description": "server framework that provide IOC/type-reuse/http&rpc-adaptor",
|
|
5
5
|
"author": "fgsreally",
|
|
6
6
|
"license": "MIT",
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
"fs-extra": "^11.3.2",
|
|
168
168
|
"picocolors": "^1.1.1",
|
|
169
169
|
"ts-mixer": "^6.0.4",
|
|
170
|
-
"phecda-core": "5.
|
|
170
|
+
"phecda-core": "5.3.0"
|
|
171
171
|
},
|
|
172
172
|
"devDependencies": {
|
|
173
173
|
"@koa/router": "^12.0.2",
|