phecda-server 7.0.0-alpha.9 → 7.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/assets/schema.json +12 -9
- package/bin/cli.mjs +95 -36
- package/dist/{chunk-5RBTN33A.js → chunk-4LLLQOMF.js} +10 -5
- package/dist/{chunk-7ZGYJ5OW.mjs → chunk-AIAO6SV6.mjs} +10 -34
- package/dist/{chunk-V5EYXVJT.js → chunk-DPPDWBYO.js} +53 -25
- package/dist/{chunk-CVPZWDXU.mjs → chunk-E7EAPAGM.mjs} +10 -20
- package/dist/{chunk-ODVWOXVB.mjs → chunk-MKRHYZCL.mjs} +30 -2
- package/dist/{chunk-FXTJ3BJ6.mjs → chunk-NQ55PA2X.mjs} +9 -4
- package/dist/{chunk-FX3LDQII.js → chunk-XKK2SQ7W.js} +60 -70
- package/dist/{chunk-KJUD2BKE.js → chunk-ZWPOWMZP.js} +25 -49
- package/dist/{core-D_cz0tKa.d.ts → core-DbqWh47p.d.mts} +3 -2
- package/dist/{core-BDkhrEyf.d.mts → core-Rq7BhPHE.d.ts} +3 -2
- package/dist/helper.d.mts +3 -5
- package/dist/helper.d.ts +3 -5
- package/dist/helper.js +3 -5
- package/dist/helper.mjs +2 -4
- package/dist/http/elysia/index.d.mts +4 -4
- package/dist/http/elysia/index.d.ts +4 -4
- package/dist/http/elysia/index.js +41 -40
- package/dist/http/elysia/index.mjs +4 -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 +38 -37
- package/dist/http/express/index.mjs +3 -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 +39 -38
- package/dist/http/fastify/index.mjs +4 -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 +39 -38
- package/dist/http/h3/index.mjs +3 -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 +35 -34
- package/dist/http/hono/index.mjs +3 -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 +36 -35
- package/dist/http/hyper-express/index.mjs +3 -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 +38 -37
- package/dist/http/koa/index.mjs +3 -2
- package/dist/index.d.mts +76 -12
- package/dist/index.d.ts +76 -12
- package/dist/index.js +102 -49
- package/dist/index.mjs +66 -13
- package/dist/{meta-BX5jhe4Z.d.mts → meta-BoS1E-Nz.d.mts} +6 -23
- package/dist/{meta-BX5jhe4Z.d.ts → meta-BoS1E-Nz.d.ts} +6 -23
- package/dist/rpc/bullmq/index.d.mts +4 -6
- package/dist/rpc/bullmq/index.d.ts +4 -6
- package/dist/rpc/bullmq/index.js +12 -80
- package/dist/rpc/bullmq/index.mjs +4 -72
- package/dist/rpc/electron/index.d.mts +13 -0
- package/dist/rpc/electron/index.d.ts +13 -0
- package/dist/rpc/electron/index.js +72 -0
- package/dist/rpc/electron/index.mjs +72 -0
- package/dist/rpc/kafka/index.d.mts +4 -9
- package/dist/rpc/kafka/index.d.ts +4 -9
- package/dist/rpc/kafka/index.js +11 -90
- package/dist/rpc/kafka/index.mjs +4 -83
- package/dist/rpc/nats/index.d.mts +4 -6
- package/dist/rpc/nats/index.d.ts +4 -6
- package/dist/rpc/nats/index.js +12 -72
- package/dist/rpc/nats/index.mjs +3 -63
- package/dist/rpc/rabbitmq/index.d.mts +4 -6
- package/dist/rpc/rabbitmq/index.d.ts +4 -6
- package/dist/rpc/rabbitmq/index.js +13 -79
- package/dist/rpc/rabbitmq/index.mjs +4 -70
- package/dist/rpc/redis/index.d.mts +4 -9
- package/dist/rpc/redis/index.d.ts +4 -9
- package/dist/rpc/redis/index.js +11 -78
- package/dist/rpc/redis/index.mjs +4 -71
- package/dist/rpc/web-ext/index.d.mts +2 -0
- package/dist/rpc/web-ext/index.d.ts +2 -0
- package/dist/rpc/web-ext/index.js +1 -0
- package/dist/rpc/web-ext/index.mjs +0 -0
- package/dist/rpc/ws/index.d.mts +14 -0
- package/dist/rpc/ws/index.d.ts +14 -0
- package/dist/rpc/ws/index.js +73 -0
- package/dist/rpc/ws/index.mjs +73 -0
- package/dist/test.d.mts +7 -3
- package/dist/test.d.ts +7 -3
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/dist/types-CInz3bD0.d.ts +14 -0
- package/dist/types-E-rqlg3-.d.mts +14 -0
- package/dist/{types-DKVhyZk_.d.mts → types-SCJZFCYt.d.mts} +1 -1
- package/dist/{types-CMeuFoyd.d.ts → types-xruyYmyu.d.ts} +1 -1
- package/package.json +24 -8
- package/register/export.mjs +30 -0
- package/register/index.mjs +2 -3
- package/register/loader.mjs +83 -90
- package/register/utils.mjs +36 -6
- package/assets/ps.json +0 -24
- package/assets/tsconfig.json +0 -21
- package/dist/types-B-rUM9Fm.d.mts +0 -19
- package/dist/types-MxxtkZXw.d.ts +0 -19
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Context, Hono, MiddlewareHandler } from 'hono';
|
|
2
|
-
import { H as HttpCtx, a as HttpOptions } from '../../types-
|
|
3
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-SCJZFCYt.mjs';
|
|
3
|
+
import { F as Factory } from '../../core-DbqWh47p.mjs';
|
|
4
4
|
import 'node:http';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-BoS1E-Nz.mjs';
|
|
6
6
|
import 'phecda-core';
|
|
7
7
|
|
|
8
8
|
interface HonoCtx extends HttpCtx {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Context, Hono, MiddlewareHandler } from 'hono';
|
|
2
|
-
import { H as HttpCtx, a as HttpOptions } from '../../types-
|
|
3
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-xruyYmyu.js';
|
|
3
|
+
import { F as Factory } from '../../core-Rq7BhPHE.js';
|
|
4
4
|
import 'node:http';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-BoS1E-Nz.js';
|
|
6
6
|
import 'phecda-core';
|
|
7
7
|
|
|
8
8
|
interface HonoCtx extends HttpCtx {
|
package/dist/http/hono/index.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkXKK2SQ7Wjs = require('../../chunk-XKK2SQ7W.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk4LLLQOMFjs = require('../../chunk-4LLLQOMF.js');
|
|
10
10
|
|
|
11
11
|
// src/http/hono/bind.ts
|
|
12
12
|
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
@@ -16,14 +16,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/hono");
|
|
|
16
16
|
function bind(router, data, opts = {}) {
|
|
17
17
|
const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
|
|
18
18
|
const { moduleMap, meta } = data;
|
|
19
|
-
const metaMap =
|
|
19
|
+
const metaMap = _chunkXKK2SQ7Wjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
20
20
|
const { controller, http, func, tag } = meta2.data;
|
|
21
21
|
if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
|
|
22
22
|
debug(`register method "${func}" in module "${tag}"`);
|
|
23
23
|
return true;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
|
|
26
|
+
_chunkXKK2SQ7Wjs.detectAopDep.call(void 0, meta, {
|
|
27
27
|
addons: [
|
|
28
28
|
...globalAddons,
|
|
29
29
|
...parallelAddons
|
|
@@ -34,25 +34,26 @@ function bind(router, data, opts = {}) {
|
|
|
34
34
|
function registerRoute() {
|
|
35
35
|
if (parallelRoute) {
|
|
36
36
|
const subApp = new (0, _hono.Hono)();
|
|
37
|
-
|
|
37
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(parallelAddons, subApp, "hono");
|
|
38
38
|
subApp.post("", async (c) => {
|
|
39
39
|
const body = await c.req.json();
|
|
40
40
|
async function errorHandler(e) {
|
|
41
|
-
const error = await
|
|
41
|
+
const error = await _chunkXKK2SQ7Wjs.Context.filterRecord.default(e);
|
|
42
42
|
c.status(error.status);
|
|
43
43
|
return c.json(error);
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
if (!Array.isArray(body)) return errorHandler(new (0,
|
|
45
|
+
_chunk4LLLQOMFjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
46
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkXKK2SQ7Wjs.BadRequestException)("data format should be an array"));
|
|
47
47
|
try {
|
|
48
48
|
return Promise.all(body.map((item, i) => {
|
|
49
49
|
return new Promise(async (resolve) => {
|
|
50
|
+
if (!item) return resolve(null);
|
|
50
51
|
const { tag, func } = item;
|
|
51
52
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
52
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
53
|
+
if (!metaMap.has(tag)) return resolve(await _chunkXKK2SQ7Wjs.Context.filterRecord.default(new (0, _chunkXKK2SQ7Wjs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
53
54
|
const meta2 = metaMap.get(tag)[func];
|
|
54
|
-
if (!meta2) return resolve(await
|
|
55
|
-
const aop =
|
|
55
|
+
if (!meta2) return resolve(await _chunkXKK2SQ7Wjs.Context.filterRecord.default(new (0, _chunkXKK2SQ7Wjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
56
|
+
const aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
56
57
|
globalFilter,
|
|
57
58
|
globalGuards,
|
|
58
59
|
globalPipe
|
|
@@ -67,18 +68,18 @@ function bind(router, data, opts = {}) {
|
|
|
67
68
|
moduleMap,
|
|
68
69
|
app: router,
|
|
69
70
|
...item,
|
|
70
|
-
getCookie: /* @__PURE__ */
|
|
71
|
-
delCookie: /* @__PURE__ */
|
|
72
|
-
setCookie: /* @__PURE__ */
|
|
73
|
-
redirect: /* @__PURE__ */
|
|
74
|
-
setResHeaders: /* @__PURE__ */
|
|
71
|
+
getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => _cookie.getCookie.call(void 0, c, key), "getCookie"),
|
|
72
|
+
delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => _cookie.deleteCookie.call(void 0, c, key), "delCookie"),
|
|
73
|
+
setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => _cookie.setCookie.call(void 0, c, key, value, opts2), "setCookie"),
|
|
74
|
+
redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
|
|
75
|
+
setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => {
|
|
75
76
|
for (const name in headers) c.header(name, headers[name]);
|
|
76
77
|
}, "setResHeaders"),
|
|
77
|
-
setResStatus: /* @__PURE__ */
|
|
78
|
-
getRequest: /* @__PURE__ */
|
|
79
|
-
getResponse: /* @__PURE__ */
|
|
78
|
+
setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (status) => c.status(status), "setResStatus"),
|
|
79
|
+
getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => c.req.raw, "getRequest"),
|
|
80
|
+
getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => c.res, "getResponse")
|
|
80
81
|
};
|
|
81
|
-
const context = new (0,
|
|
82
|
+
const context = new (0, _chunkXKK2SQ7Wjs.Context)(contextData);
|
|
82
83
|
context.run(aop, resolve, resolve);
|
|
83
84
|
});
|
|
84
85
|
})).then((ret) => {
|
|
@@ -98,14 +99,14 @@ function bind(router, data, opts = {}) {
|
|
|
98
99
|
const needBody = params.some((item) => item.type === "body");
|
|
99
100
|
let aop;
|
|
100
101
|
if (!dynamic) {
|
|
101
|
-
aop =
|
|
102
|
+
aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
102
103
|
globalFilter,
|
|
103
104
|
globalGuards,
|
|
104
105
|
globalPipe
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
108
|
const subApp = new (0, _hono.Hono)();
|
|
108
|
-
|
|
109
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(addons, subApp, "hono");
|
|
109
110
|
subApp[http.type](http.route, async (c) => {
|
|
110
111
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
111
112
|
const contextData = {
|
|
@@ -121,23 +122,23 @@ function bind(router, data, opts = {}) {
|
|
|
121
122
|
params: c.req.param(),
|
|
122
123
|
headers: c.req.header(),
|
|
123
124
|
app: router,
|
|
124
|
-
getCookie: /* @__PURE__ */
|
|
125
|
-
delCookie: /* @__PURE__ */
|
|
126
|
-
setCookie: /* @__PURE__ */
|
|
127
|
-
redirect: /* @__PURE__ */
|
|
128
|
-
setResHeaders: /* @__PURE__ */
|
|
125
|
+
getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => _cookie.getCookie.call(void 0, c, key), "getCookie"),
|
|
126
|
+
delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => _cookie.deleteCookie.call(void 0, c, key), "delCookie"),
|
|
127
|
+
setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => _cookie.setCookie.call(void 0, c, key, value, opts2), "setCookie"),
|
|
128
|
+
redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url) => c.redirect(url), "redirect"),
|
|
129
|
+
setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => {
|
|
129
130
|
for (const name in headers) c.header(name, headers[name]);
|
|
130
131
|
}, "setResHeaders"),
|
|
131
|
-
setResStatus: /* @__PURE__ */
|
|
132
|
-
getRequest: /* @__PURE__ */
|
|
133
|
-
getResponse: /* @__PURE__ */
|
|
132
|
+
setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (status) => c.status(status), "setResStatus"),
|
|
133
|
+
getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => c.req.raw, "getRequest"),
|
|
134
|
+
getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => c.res, "getResponse")
|
|
134
135
|
};
|
|
135
|
-
const context = new (0,
|
|
136
|
+
const context = new (0, _chunkXKK2SQ7Wjs.Context)(contextData);
|
|
136
137
|
if (http.headers) {
|
|
137
138
|
for (const name in http.headers) c.header(name, http.headers[name]);
|
|
138
139
|
}
|
|
139
140
|
if (dynamic) {
|
|
140
|
-
aop =
|
|
141
|
+
aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
141
142
|
globalFilter,
|
|
142
143
|
globalGuards,
|
|
143
144
|
globalPipe
|
|
@@ -156,9 +157,9 @@ function bind(router, data, opts = {}) {
|
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
|
-
|
|
160
|
+
_chunk4LLLQOMFjs.__name.call(void 0, registerRoute, "registerRoute");
|
|
160
161
|
}
|
|
161
|
-
|
|
162
|
+
_chunk4LLLQOMFjs.__name.call(void 0, bind, "bind");
|
|
162
163
|
|
|
163
164
|
|
|
164
165
|
exports.bind = bind;
|
package/dist/http/hono/index.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
Context,
|
|
4
4
|
createControllerMetaMap,
|
|
5
5
|
detectAopDep
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-E7EAPAGM.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__name
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-NQ55PA2X.mjs";
|
|
10
10
|
|
|
11
11
|
// src/http/hono/bind.ts
|
|
12
12
|
import Debug from "debug";
|
|
@@ -47,6 +47,7 @@ function bind(router, data, opts = {}) {
|
|
|
47
47
|
try {
|
|
48
48
|
return Promise.all(body.map((item, i) => {
|
|
49
49
|
return new Promise(async (resolve) => {
|
|
50
|
+
if (!item) return resolve(null);
|
|
50
51
|
const { tag, func } = item;
|
|
51
52
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
52
53
|
if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Request, Response, Router, MiddlewareHandler } from 'hyper-express';
|
|
2
|
-
import { H as HttpCtx, a as HttpOptions } from '../../types-
|
|
3
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-SCJZFCYt.mjs';
|
|
3
|
+
import { F as Factory } from '../../core-DbqWh47p.mjs';
|
|
4
4
|
import 'node:http';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-BoS1E-Nz.mjs';
|
|
6
6
|
import 'phecda-core';
|
|
7
7
|
|
|
8
8
|
interface HyperExpressCtx extends HttpCtx {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Request, Response, Router, MiddlewareHandler } from 'hyper-express';
|
|
2
|
-
import { H as HttpCtx, a as HttpOptions } from '../../types-
|
|
3
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-xruyYmyu.js';
|
|
3
|
+
import { F as Factory } from '../../core-Rq7BhPHE.js';
|
|
4
4
|
import 'node:http';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-BoS1E-Nz.js';
|
|
6
6
|
import 'phecda-core';
|
|
7
7
|
|
|
8
8
|
interface HyperExpressCtx extends HttpCtx {
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkXKK2SQ7Wjs = require('../../chunk-XKK2SQ7W.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk4LLLQOMFjs = require('../../chunk-4LLLQOMF.js');
|
|
11
11
|
|
|
12
12
|
// src/http/hyper-express/bind.ts
|
|
13
13
|
var _hyperexpress = require('hyper-express');
|
|
@@ -16,14 +16,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/hyper-express");
|
|
|
16
16
|
function bind(router, data, opts = {}) {
|
|
17
17
|
const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
|
|
18
18
|
const { moduleMap, meta } = data;
|
|
19
|
-
const metaMap =
|
|
19
|
+
const metaMap = _chunkXKK2SQ7Wjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
20
20
|
const { controller, http, func, tag } = meta2.data;
|
|
21
21
|
if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
|
|
22
22
|
debug(`register method "${func}" in module "${tag}"`);
|
|
23
23
|
return true;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
|
|
26
|
+
_chunkXKK2SQ7Wjs.detectAopDep.call(void 0, meta, {
|
|
27
27
|
addons: [
|
|
28
28
|
...globalAddons,
|
|
29
29
|
...parallelAddons
|
|
@@ -32,26 +32,27 @@ function bind(router, data, opts = {}) {
|
|
|
32
32
|
});
|
|
33
33
|
registerRoute();
|
|
34
34
|
async function registerRoute() {
|
|
35
|
-
|
|
35
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(globalAddons, router, "hyper-express");
|
|
36
36
|
if (parallelRoute) {
|
|
37
37
|
const subRouter = new (0, _hyperexpress.Router)();
|
|
38
38
|
subRouter.post(parallelRoute, async (req, res, next) => {
|
|
39
39
|
const body = await req.json();
|
|
40
40
|
async function errorHandler(e) {
|
|
41
|
-
const error = await
|
|
41
|
+
const error = await _chunkXKK2SQ7Wjs.Context.filterRecord.default(e);
|
|
42
42
|
return res.status(error.status).json(error);
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
if (!Array.isArray(body)) return errorHandler(new (0,
|
|
44
|
+
_chunk4LLLQOMFjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
45
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkXKK2SQ7Wjs.BadRequestException)("data format should be an array"));
|
|
46
46
|
try {
|
|
47
47
|
return Promise.all(body.map((item, i) => {
|
|
48
48
|
return new Promise(async (resolve) => {
|
|
49
|
+
if (!item) return resolve(null);
|
|
49
50
|
const { tag, func } = item;
|
|
50
51
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
51
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
52
|
+
if (!metaMap.has(tag)) return resolve(await _chunkXKK2SQ7Wjs.Context.filterRecord.default(new (0, _chunkXKK2SQ7Wjs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
52
53
|
const meta2 = metaMap.get(tag)[func];
|
|
53
|
-
if (!meta2) return resolve(await
|
|
54
|
-
const aop =
|
|
54
|
+
if (!meta2) return resolve(await _chunkXKK2SQ7Wjs.Context.filterRecord.default(new (0, _chunkXKK2SQ7Wjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
55
|
+
const aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
55
56
|
globalFilter,
|
|
56
57
|
globalGuards,
|
|
57
58
|
globalPipe
|
|
@@ -68,16 +69,16 @@ function bind(router, data, opts = {}) {
|
|
|
68
69
|
app: router,
|
|
69
70
|
...item,
|
|
70
71
|
next,
|
|
71
|
-
getCookie: /* @__PURE__ */
|
|
72
|
-
setCookie: /* @__PURE__ */
|
|
73
|
-
delCookie: /* @__PURE__ */
|
|
74
|
-
redirect: /* @__PURE__ */
|
|
75
|
-
setResHeaders: /* @__PURE__ */
|
|
76
|
-
setResStatus: /* @__PURE__ */
|
|
77
|
-
getRequest: /* @__PURE__ */
|
|
78
|
-
getResponse: /* @__PURE__ */
|
|
72
|
+
getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
|
|
73
|
+
setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, _optionalChain([opts2, 'optionalAccess', _2 => _2.expires]) && opts2.expires.getTime() - Date.now(), opts2 || {}), "setCookie"),
|
|
74
|
+
delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
|
|
75
|
+
redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url) => res.redirect(url), "redirect"),
|
|
76
|
+
setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
|
|
77
|
+
setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
|
|
78
|
+
getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => req, "getRequest"),
|
|
79
|
+
getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => res, "getResponse")
|
|
79
80
|
};
|
|
80
|
-
const context = new (0,
|
|
81
|
+
const context = new (0, _chunkXKK2SQ7Wjs.Context)(contextData);
|
|
81
82
|
context.run(aop, resolve, resolve);
|
|
82
83
|
});
|
|
83
84
|
})).then((ret) => {
|
|
@@ -97,15 +98,15 @@ function bind(router, data, opts = {}) {
|
|
|
97
98
|
const needBody = params.some((item) => item.type === "body");
|
|
98
99
|
let aop;
|
|
99
100
|
if (!dynamic) {
|
|
100
|
-
aop =
|
|
101
|
+
aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
101
102
|
globalFilter,
|
|
102
103
|
globalGuards,
|
|
103
104
|
globalPipe
|
|
104
105
|
});
|
|
105
106
|
}
|
|
106
107
|
const subRouter = new (0, _hyperexpress.Router)();
|
|
107
|
-
|
|
108
|
-
subRouter[http.type](
|
|
108
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(addons, subRouter, "hyper-express");
|
|
109
|
+
subRouter[http.type](_chunkXKK2SQ7Wjs.joinUrl.call(void 0, http.prefix, http.route), async (req, res, next) => {
|
|
109
110
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
110
111
|
const contextData = {
|
|
111
112
|
type: "hyper-express",
|
|
@@ -122,21 +123,21 @@ function bind(router, data, opts = {}) {
|
|
|
122
123
|
params: req.path_parameters,
|
|
123
124
|
headers: req.headers,
|
|
124
125
|
next,
|
|
125
|
-
getCookie: /* @__PURE__ */
|
|
126
|
-
setCookie: /* @__PURE__ */
|
|
127
|
-
delCookie: /* @__PURE__ */
|
|
128
|
-
redirect: /* @__PURE__ */
|
|
129
|
-
setResHeaders: /* @__PURE__ */
|
|
130
|
-
setResStatus: /* @__PURE__ */
|
|
131
|
-
getRequest: /* @__PURE__ */
|
|
132
|
-
getResponse: /* @__PURE__ */
|
|
126
|
+
getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
|
|
127
|
+
setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, _optionalChain([opts2, 'optionalAccess', _4 => _4.expires]) && opts2.expires.getTime() - Date.now(), opts2 || {}), "setCookie"),
|
|
128
|
+
delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
|
|
129
|
+
redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url) => res.redirect(url), "redirect"),
|
|
130
|
+
setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
|
|
131
|
+
setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
|
|
132
|
+
getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => req, "getRequest"),
|
|
133
|
+
getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => res, "getResponse")
|
|
133
134
|
};
|
|
134
|
-
const context = new (0,
|
|
135
|
+
const context = new (0, _chunkXKK2SQ7Wjs.Context)(contextData);
|
|
135
136
|
if (http.headers) {
|
|
136
137
|
for (const name in http.headers) res.set(name, http.headers[name]);
|
|
137
138
|
}
|
|
138
139
|
if (dynamic) {
|
|
139
|
-
aop =
|
|
140
|
+
aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
140
141
|
globalFilter,
|
|
141
142
|
globalGuards,
|
|
142
143
|
globalPipe
|
|
@@ -155,9 +156,9 @@ function bind(router, data, opts = {}) {
|
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
|
-
|
|
159
|
+
_chunk4LLLQOMFjs.__name.call(void 0, registerRoute, "registerRoute");
|
|
159
160
|
}
|
|
160
|
-
|
|
161
|
+
_chunk4LLLQOMFjs.__name.call(void 0, bind, "bind");
|
|
161
162
|
|
|
162
163
|
|
|
163
164
|
exports.bind = bind;
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
createControllerMetaMap,
|
|
5
5
|
detectAopDep,
|
|
6
6
|
joinUrl
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-E7EAPAGM.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__name
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-NQ55PA2X.mjs";
|
|
11
11
|
|
|
12
12
|
// src/http/hyper-express/bind.ts
|
|
13
13
|
import { Router } from "hyper-express";
|
|
@@ -46,6 +46,7 @@ function bind(router, data, opts = {}) {
|
|
|
46
46
|
try {
|
|
47
47
|
return Promise.all(body.map((item, i) => {
|
|
48
48
|
return new Promise(async (resolve) => {
|
|
49
|
+
if (!item) return resolve(null);
|
|
49
50
|
const { tag, func } = item;
|
|
50
51
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
51
52
|
if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Router, { RouterParamContext } from '@koa/router';
|
|
2
2
|
import { DefaultContext, DefaultState } from 'koa';
|
|
3
|
-
import { H as HttpCtx, a as HttpOptions } from '../../types-
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-SCJZFCYt.mjs';
|
|
4
|
+
import { F as Factory } from '../../core-DbqWh47p.mjs';
|
|
5
5
|
import 'node:http';
|
|
6
|
-
import '../../meta-
|
|
6
|
+
import '../../meta-BoS1E-Nz.mjs';
|
|
7
7
|
import 'phecda-core';
|
|
8
8
|
|
|
9
9
|
interface KoaCtx extends HttpCtx {
|
package/dist/http/koa/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Router, { RouterParamContext } from '@koa/router';
|
|
2
2
|
import { DefaultContext, DefaultState } from 'koa';
|
|
3
|
-
import { H as HttpCtx, a as HttpOptions } from '../../types-
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-xruyYmyu.js';
|
|
4
|
+
import { F as Factory } from '../../core-Rq7BhPHE.js';
|
|
5
5
|
import 'node:http';
|
|
6
|
-
import '../../meta-
|
|
6
|
+
import '../../meta-BoS1E-Nz.js';
|
|
7
7
|
import 'phecda-core';
|
|
8
8
|
|
|
9
9
|
interface KoaCtx extends HttpCtx {
|
package/dist/http/koa/index.js
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkXKK2SQ7Wjs = require('../../chunk-XKK2SQ7W.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunk4LLLQOMFjs = require('../../chunk-4LLLQOMF.js');
|
|
12
12
|
|
|
13
13
|
// src/http/koa/bind.ts
|
|
14
14
|
var _router = require('@koa/router'); var _router2 = _interopRequireDefault(_router);
|
|
@@ -18,14 +18,14 @@ function bind(router, data, opts = {}) {
|
|
|
18
18
|
const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, dynamic = false } = opts;
|
|
19
19
|
const { moduleMap, meta } = data;
|
|
20
20
|
const originStack = router.stack.slice(0, router.stack.length);
|
|
21
|
-
const metaMap =
|
|
21
|
+
const metaMap = _chunkXKK2SQ7Wjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
22
22
|
const { controller, http, func, tag } = meta2.data;
|
|
23
23
|
if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
|
|
24
24
|
debug(`register method "${func}" in module "${tag}"`);
|
|
25
25
|
return true;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
|
|
28
|
+
_chunkXKK2SQ7Wjs.detectAopDep.call(void 0, meta, {
|
|
29
29
|
addons: [
|
|
30
30
|
...globalAddons,
|
|
31
31
|
...parallelAddons
|
|
@@ -34,28 +34,29 @@ function bind(router, data, opts = {}) {
|
|
|
34
34
|
});
|
|
35
35
|
registerRoute();
|
|
36
36
|
function registerRoute() {
|
|
37
|
-
|
|
37
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(globalAddons, router, "koa");
|
|
38
38
|
if (parallelRoute) {
|
|
39
39
|
const subRouter = new (0, _router2.default)();
|
|
40
|
-
|
|
40
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(parallelAddons, subRouter, "koa");
|
|
41
41
|
subRouter.post(parallelRoute, async (ctx, next) => {
|
|
42
42
|
const { body } = ctx.request;
|
|
43
43
|
async function errorHandler(e) {
|
|
44
|
-
const error = await
|
|
44
|
+
const error = await _chunkXKK2SQ7Wjs.Context.filterRecord.default(e);
|
|
45
45
|
ctx.status = error.status;
|
|
46
46
|
ctx.body = error;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
if (!Array.isArray(body)) return errorHandler(new (0,
|
|
48
|
+
_chunk4LLLQOMFjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
49
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkXKK2SQ7Wjs.BadRequestException)("data format should be an array"));
|
|
50
50
|
try {
|
|
51
51
|
return Promise.all(body.map((item, i) => {
|
|
52
52
|
return new Promise(async (resolve) => {
|
|
53
|
+
if (!item) return resolve(null);
|
|
53
54
|
const { tag, func } = item;
|
|
54
55
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
55
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
56
|
+
if (!metaMap.has(tag)) return resolve(await _chunkXKK2SQ7Wjs.Context.filterRecord.default(new (0, _chunkXKK2SQ7Wjs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
56
57
|
const meta2 = metaMap.get(tag)[func];
|
|
57
|
-
if (!meta2) return resolve(await
|
|
58
|
-
const aop =
|
|
58
|
+
if (!meta2) return resolve(await _chunkXKK2SQ7Wjs.Context.filterRecord.default(new (0, _chunkXKK2SQ7Wjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
59
|
+
const aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
59
60
|
globalGuards,
|
|
60
61
|
globalFilter,
|
|
61
62
|
globalPipe
|
|
@@ -71,18 +72,18 @@ function bind(router, data, opts = {}) {
|
|
|
71
72
|
next,
|
|
72
73
|
app: router,
|
|
73
74
|
...item,
|
|
74
|
-
getCookie: /* @__PURE__ */
|
|
75
|
-
setCookie: /* @__PURE__ */
|
|
76
|
-
delCookie: /* @__PURE__ */
|
|
75
|
+
getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => ctx.cookies.get(key), "getCookie"),
|
|
76
|
+
setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => ctx.cookies.set(key, value, opts2), "setCookie"),
|
|
77
|
+
delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => ctx.cookies.set(key, "", {
|
|
77
78
|
expires: /* @__PURE__ */ new Date(0)
|
|
78
79
|
}), "delCookie"),
|
|
79
|
-
redirect: /* @__PURE__ */
|
|
80
|
-
setResHeaders: /* @__PURE__ */
|
|
81
|
-
setResStatus: /* @__PURE__ */
|
|
82
|
-
getRequest: /* @__PURE__ */
|
|
83
|
-
getResponse: /* @__PURE__ */
|
|
80
|
+
redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url) => ctx.redirect(url), "redirect"),
|
|
81
|
+
setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => ctx.set(headers), "setResHeaders"),
|
|
82
|
+
setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (status) => ctx.status = status, "setResStatus"),
|
|
83
|
+
getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => ctx.req, "getRequest"),
|
|
84
|
+
getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => ctx.res, "getResponse")
|
|
84
85
|
};
|
|
85
|
-
const context = new (0,
|
|
86
|
+
const context = new (0, _chunkXKK2SQ7Wjs.Context)(contextData);
|
|
86
87
|
context.run(aop, resolve, resolve);
|
|
87
88
|
});
|
|
88
89
|
})).then((ret) => {
|
|
@@ -101,15 +102,15 @@ function bind(router, data, opts = {}) {
|
|
|
101
102
|
if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
|
|
102
103
|
let aop;
|
|
103
104
|
if (!dynamic) {
|
|
104
|
-
aop =
|
|
105
|
+
aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
105
106
|
globalFilter,
|
|
106
107
|
globalGuards,
|
|
107
108
|
globalPipe
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
111
|
const subRouter = new (0, _router2.default)();
|
|
111
|
-
|
|
112
|
-
router[http.type](
|
|
112
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(addons, subRouter, "koa");
|
|
113
|
+
router[http.type](_chunkXKK2SQ7Wjs.joinUrl.call(void 0, http.prefix, http.route), async (ctx, next) => {
|
|
113
114
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
114
115
|
const contextData = {
|
|
115
116
|
type: "koa",
|
|
@@ -125,21 +126,21 @@ function bind(router, data, opts = {}) {
|
|
|
125
126
|
body: ctx.request.body,
|
|
126
127
|
headers: ctx.headers,
|
|
127
128
|
next,
|
|
128
|
-
getCookie: /* @__PURE__ */
|
|
129
|
-
setCookie: /* @__PURE__ */
|
|
130
|
-
delCookie: /* @__PURE__ */
|
|
129
|
+
getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => ctx.cookies.get(key), "getCookie"),
|
|
130
|
+
setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => ctx.cookies.set(key, value, opts2), "setCookie"),
|
|
131
|
+
delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => ctx.cookies.set(key, "", {
|
|
131
132
|
expires: /* @__PURE__ */ new Date(0)
|
|
132
133
|
}), "delCookie"),
|
|
133
|
-
redirect: /* @__PURE__ */
|
|
134
|
-
setResHeaders: /* @__PURE__ */
|
|
135
|
-
setResStatus: /* @__PURE__ */
|
|
136
|
-
getRequest: /* @__PURE__ */
|
|
137
|
-
getResponse: /* @__PURE__ */
|
|
134
|
+
redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url) => ctx.redirect(url), "redirect"),
|
|
135
|
+
setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => ctx.set(headers), "setResHeaders"),
|
|
136
|
+
setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (status) => ctx.status = status, "setResStatus"),
|
|
137
|
+
getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => ctx.req, "getRequest"),
|
|
138
|
+
getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => ctx.res, "getResponse")
|
|
138
139
|
};
|
|
139
|
-
const context = new (0,
|
|
140
|
+
const context = new (0, _chunkXKK2SQ7Wjs.Context)(contextData);
|
|
140
141
|
if (http.headers) ctx.set(http.headers);
|
|
141
142
|
if (dynamic) {
|
|
142
|
-
aop =
|
|
143
|
+
aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
143
144
|
globalFilter,
|
|
144
145
|
globalGuards,
|
|
145
146
|
globalPipe
|
|
@@ -158,13 +159,13 @@ function bind(router, data, opts = {}) {
|
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
_chunk4LLLQOMFjs.__name.call(void 0, registerRoute, "registerRoute");
|
|
163
|
+
_chunk4LLLQOMFjs.HMR.call(void 0, async () => {
|
|
163
164
|
router.stack = originStack;
|
|
164
165
|
registerRoute();
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
|
-
|
|
168
|
+
_chunk4LLLQOMFjs.__name.call(void 0, bind, "bind");
|
|
168
169
|
|
|
169
170
|
|
|
170
171
|
exports.bind = bind;
|
package/dist/http/koa/index.mjs
CHANGED
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
createControllerMetaMap,
|
|
5
5
|
detectAopDep,
|
|
6
6
|
joinUrl
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-E7EAPAGM.mjs";
|
|
8
8
|
import {
|
|
9
9
|
HMR,
|
|
10
10
|
__name
|
|
11
|
-
} from "../../chunk-
|
|
11
|
+
} from "../../chunk-NQ55PA2X.mjs";
|
|
12
12
|
|
|
13
13
|
// src/http/koa/bind.ts
|
|
14
14
|
import Router from "@koa/router";
|
|
@@ -50,6 +50,7 @@ function bind(router, data, opts = {}) {
|
|
|
50
50
|
try {
|
|
51
51
|
return Promise.all(body.map((item, i) => {
|
|
52
52
|
return new Promise(async (resolve) => {
|
|
53
|
+
if (!item) return resolve(null);
|
|
53
54
|
const { tag, func } = item;
|
|
54
55
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
55
56
|
if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
|