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
|
@@ -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/express/bind.ts
|
|
14
14
|
var _express = require('express');
|
|
@@ -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
|
|
@@ -33,32 +33,33 @@ function bind(router, data, opts = {}) {
|
|
|
33
33
|
guards: globalGuards
|
|
34
34
|
});
|
|
35
35
|
registerRoute();
|
|
36
|
-
|
|
36
|
+
_chunk4LLLQOMFjs.HMR.call(void 0, async () => {
|
|
37
37
|
router.stack = originStack;
|
|
38
38
|
registerRoute();
|
|
39
39
|
});
|
|
40
40
|
function registerRoute() {
|
|
41
|
-
|
|
41
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(globalAddons, router, "express");
|
|
42
42
|
if (parallelRoute) {
|
|
43
43
|
const subRouter = _express.Router.call(void 0, );
|
|
44
|
-
|
|
44
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(parallelAddons, subRouter, "express");
|
|
45
45
|
subRouter.use(async (req, res, next) => {
|
|
46
46
|
const { body } = req;
|
|
47
47
|
async function errorHandler(e) {
|
|
48
|
-
const error = await
|
|
48
|
+
const error = await _chunkXKK2SQ7Wjs.Context.filterRecord.default(e);
|
|
49
49
|
return res.status(error.status).json(error);
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
if (!Array.isArray(body)) return errorHandler(new (0,
|
|
51
|
+
_chunk4LLLQOMFjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
52
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkXKK2SQ7Wjs.BadRequestException)("data format should be an array"));
|
|
53
53
|
try {
|
|
54
54
|
return Promise.all(body.map((item, i) => {
|
|
55
55
|
return new Promise(async (resolve) => {
|
|
56
|
+
if (!item) return resolve(null);
|
|
56
57
|
const { tag, func } = item;
|
|
57
58
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
58
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
59
|
+
if (!metaMap.has(tag)) return resolve(await _chunkXKK2SQ7Wjs.Context.filterRecord.default(new (0, _chunkXKK2SQ7Wjs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
59
60
|
const meta2 = metaMap.get(tag)[func];
|
|
60
|
-
if (!meta2) return resolve(await
|
|
61
|
-
const aop =
|
|
61
|
+
if (!meta2) return resolve(await _chunkXKK2SQ7Wjs.Context.filterRecord.default(new (0, _chunkXKK2SQ7Wjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
62
|
+
const aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
62
63
|
globalFilter,
|
|
63
64
|
globalGuards,
|
|
64
65
|
globalPipe
|
|
@@ -75,18 +76,18 @@ function bind(router, data, opts = {}) {
|
|
|
75
76
|
next,
|
|
76
77
|
app: router,
|
|
77
78
|
...item,
|
|
78
|
-
getCookie: /* @__PURE__ */
|
|
79
|
-
setCookie: /* @__PURE__ */
|
|
80
|
-
delCookie: /* @__PURE__ */
|
|
79
|
+
getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
|
|
80
|
+
setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
|
|
81
|
+
delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => res.cookie(key, "", {
|
|
81
82
|
expires: /* @__PURE__ */ new Date(0)
|
|
82
83
|
}), "delCookie"),
|
|
83
|
-
redirect: /* @__PURE__ */
|
|
84
|
-
setResHeaders: /* @__PURE__ */
|
|
85
|
-
setResStatus: /* @__PURE__ */
|
|
86
|
-
getRequest: /* @__PURE__ */
|
|
87
|
-
getResponse: /* @__PURE__ */
|
|
84
|
+
redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url, status) => status ? res.redirect(status, url) : res.redirect(url), "redirect"),
|
|
85
|
+
setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
|
|
86
|
+
setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
|
|
87
|
+
getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => req, "getRequest"),
|
|
88
|
+
getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => res, "getResponse")
|
|
88
89
|
};
|
|
89
|
-
const context = new (0,
|
|
90
|
+
const context = new (0, _chunkXKK2SQ7Wjs.Context)(contextData);
|
|
90
91
|
context.run(aop, resolve, resolve);
|
|
91
92
|
});
|
|
92
93
|
})).then((ret) => {
|
|
@@ -105,15 +106,15 @@ function bind(router, data, opts = {}) {
|
|
|
105
106
|
if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
|
|
106
107
|
let aop;
|
|
107
108
|
if (!dynamic) {
|
|
108
|
-
aop =
|
|
109
|
+
aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
109
110
|
globalFilter,
|
|
110
111
|
globalGuards,
|
|
111
112
|
globalPipe
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
115
|
const subRouter = _express.Router.call(void 0, );
|
|
115
|
-
|
|
116
|
-
subRouter[http.type](
|
|
116
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(addons, subRouter, "express");
|
|
117
|
+
subRouter[http.type](_chunkXKK2SQ7Wjs.joinUrl.call(void 0, http.prefix, http.route), async (req, res, next) => {
|
|
117
118
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
118
119
|
const contextData = {
|
|
119
120
|
type: "express",
|
|
@@ -130,21 +131,21 @@ function bind(router, data, opts = {}) {
|
|
|
130
131
|
headers: req.headers,
|
|
131
132
|
app: router,
|
|
132
133
|
next,
|
|
133
|
-
getCookie: /* @__PURE__ */
|
|
134
|
-
setCookie: /* @__PURE__ */
|
|
135
|
-
delCookie: /* @__PURE__ */
|
|
134
|
+
getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
|
|
135
|
+
setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
|
|
136
|
+
delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => res.cookie(key, "", {
|
|
136
137
|
expires: /* @__PURE__ */ new Date(0)
|
|
137
138
|
}), "delCookie"),
|
|
138
|
-
redirect: /* @__PURE__ */
|
|
139
|
-
setResHeaders: /* @__PURE__ */
|
|
140
|
-
setResStatus: /* @__PURE__ */
|
|
141
|
-
getRequest: /* @__PURE__ */
|
|
142
|
-
getResponse: /* @__PURE__ */
|
|
139
|
+
redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url, status) => status ? res.redirect(status, url) : res.redirect(url), "redirect"),
|
|
140
|
+
setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
|
|
141
|
+
setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
|
|
142
|
+
getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => req, "getRequest"),
|
|
143
|
+
getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => res, "getResponse")
|
|
143
144
|
};
|
|
144
|
-
const context = new (0,
|
|
145
|
+
const context = new (0, _chunkXKK2SQ7Wjs.Context)(contextData);
|
|
145
146
|
if (http.headers) res.set(http.headers);
|
|
146
147
|
if (dynamic) {
|
|
147
|
-
aop =
|
|
148
|
+
aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
148
149
|
globalFilter,
|
|
149
150
|
globalGuards,
|
|
150
151
|
globalPipe
|
|
@@ -163,9 +164,9 @@ function bind(router, data, opts = {}) {
|
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
|
-
|
|
167
|
+
_chunk4LLLQOMFjs.__name.call(void 0, registerRoute, "registerRoute");
|
|
167
168
|
}
|
|
168
|
-
|
|
169
|
+
_chunk4LLLQOMFjs.__name.call(void 0, bind, "bind");
|
|
169
170
|
|
|
170
171
|
|
|
171
172
|
exports.bind = bind;
|
|
@@ -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/express/bind.ts
|
|
14
14
|
import { Router } from "express";
|
|
@@ -53,6 +53,7 @@ function bind(router, data, opts = {}) {
|
|
|
53
53
|
try {
|
|
54
54
|
return Promise.all(body.map((item, i) => {
|
|
55
55
|
return new Promise(async (resolve) => {
|
|
56
|
+
if (!item) return resolve(null);
|
|
56
57
|
const { tag, func } = item;
|
|
57
58
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
58
59
|
if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback, FastifyRegisterOptions, FastifyPluginOptions, RouteShorthandOptions } from 'fastify';
|
|
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 FastifyCtx extends HttpCtx {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback, FastifyRegisterOptions, FastifyPluginOptions, RouteShorthandOptions } from 'fastify';
|
|
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 FastifyCtx extends HttpCtx {
|
|
@@ -1,16 +1,16 @@
|
|
|
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 _chunkDPPDWBYOjs = require('../../chunk-DPPDWBYO.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkXKK2SQ7Wjs = require('../../chunk-XKK2SQ7W.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunk4LLLQOMFjs = require('../../chunk-4LLLQOMF.js');
|
|
14
14
|
|
|
15
15
|
// src/http/fastify/bind.ts
|
|
16
16
|
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
@@ -18,14 +18,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/fastify");
|
|
|
18
18
|
function bind(fastify, data, opts = {}) {
|
|
19
19
|
const { globalGuards, parallelRoute = "/__PHECDA_SERVER__", globalAddons = [], parallelAddons = [], globalFilter, globalPipe, fastifyOpts, dynamic = false } = opts;
|
|
20
20
|
const { moduleMap, meta } = data;
|
|
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', _2 => _2.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
|
|
@@ -33,27 +33,28 @@ function bind(fastify, data, opts = {}) {
|
|
|
33
33
|
guards: globalGuards
|
|
34
34
|
});
|
|
35
35
|
fastify.register(async (fastify2, _, done) => {
|
|
36
|
-
|
|
36
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(globalAddons, fastify2, "fastify");
|
|
37
37
|
if (parallelRoute) {
|
|
38
38
|
fastify2.register(async (fastify3, _opts, done2) => {
|
|
39
|
-
|
|
39
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(parallelAddons, fastify3, "fastify");
|
|
40
40
|
fastify3.post(parallelRoute, async (req, res) => {
|
|
41
41
|
const { body } = req;
|
|
42
42
|
async function errorHandler(e) {
|
|
43
|
-
const error = await
|
|
43
|
+
const error = await _chunkXKK2SQ7Wjs.Context.filterRecord.default(e);
|
|
44
44
|
return res.status(error.status).send(error);
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
if (!Array.isArray(body)) return errorHandler(new (0,
|
|
46
|
+
_chunk4LLLQOMFjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
47
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkXKK2SQ7Wjs.BadRequestException)("data format should be an array"));
|
|
48
48
|
try {
|
|
49
49
|
return Promise.all(body.map((item, i) => {
|
|
50
50
|
return new Promise(async (resolve) => {
|
|
51
|
+
if (!item) return resolve(null);
|
|
51
52
|
const { tag, func } = item;
|
|
52
53
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
53
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
54
|
+
if (!metaMap.has(tag)) return resolve(await _chunkXKK2SQ7Wjs.Context.filterRecord.default(new (0, _chunkXKK2SQ7Wjs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
54
55
|
const meta2 = metaMap.get(tag)[func];
|
|
55
|
-
if (!meta2) return resolve(await
|
|
56
|
-
const aop =
|
|
56
|
+
if (!meta2) return resolve(await _chunkXKK2SQ7Wjs.Context.filterRecord.default(new (0, _chunkXKK2SQ7Wjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
57
|
+
const aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
57
58
|
globalFilter,
|
|
58
59
|
globalGuards,
|
|
59
60
|
globalPipe
|
|
@@ -70,18 +71,18 @@ function bind(fastify, data, opts = {}) {
|
|
|
70
71
|
app: fastify3,
|
|
71
72
|
...item,
|
|
72
73
|
// @ts-expect-error need @fastify/cookie
|
|
73
|
-
getCookie: /* @__PURE__ */
|
|
74
|
+
getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
|
|
74
75
|
// @ts-expect-error need @fastify/cookie
|
|
75
|
-
setCookie: /* @__PURE__ */
|
|
76
|
+
setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => res.setCookie(key, value, opts2), "setCookie"),
|
|
76
77
|
// @ts-expect-error need @fastify/cookie
|
|
77
|
-
delCookie: /* @__PURE__ */
|
|
78
|
-
redirect: /* @__PURE__ */
|
|
79
|
-
setResHeaders: /* @__PURE__ */
|
|
80
|
-
setResStatus: /* @__PURE__ */
|
|
81
|
-
getRequest: /* @__PURE__ */
|
|
82
|
-
getResponse: /* @__PURE__ */
|
|
78
|
+
delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
|
|
79
|
+
redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url, status) => res.redirect(url, status), "redirect"),
|
|
80
|
+
setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => res.headers(headers), "setResHeaders"),
|
|
81
|
+
setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
|
|
82
|
+
getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => req.raw, "getRequest"),
|
|
83
|
+
getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => res.raw, "getResponse")
|
|
83
84
|
};
|
|
84
|
-
const context = new (0,
|
|
85
|
+
const context = new (0, _chunkXKK2SQ7Wjs.Context)(contextData);
|
|
85
86
|
context.run(aop, resolve, resolve);
|
|
86
87
|
});
|
|
87
88
|
})).then((ret) => {
|
|
@@ -100,16 +101,16 @@ function bind(fastify, data, opts = {}) {
|
|
|
100
101
|
const { data: { addons, define, http } } = meta2;
|
|
101
102
|
if (!_optionalChain([http, 'optionalAccess', _3 => _3.type])) continue;
|
|
102
103
|
fastify2.register(async (fastify3, _opts, done2) => {
|
|
103
|
-
|
|
104
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(addons, fastify3, "fastify");
|
|
104
105
|
let aop;
|
|
105
106
|
if (!dynamic) {
|
|
106
|
-
aop =
|
|
107
|
+
aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
107
108
|
globalFilter,
|
|
108
109
|
globalGuards,
|
|
109
110
|
globalPipe
|
|
110
111
|
});
|
|
111
112
|
}
|
|
112
|
-
fastify3[http.type](
|
|
113
|
+
fastify3[http.type](_chunkXKK2SQ7Wjs.joinUrl.call(void 0, http.prefix, http.route), _optionalChain([define, 'optionalAccess', _4 => _4.fastify]) || {}, async (req, res) => {
|
|
113
114
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
114
115
|
const contextData = {
|
|
115
116
|
type: "fastify",
|
|
@@ -126,23 +127,23 @@ function bind(fastify, data, opts = {}) {
|
|
|
126
127
|
headers: req.headers,
|
|
127
128
|
app: fastify3,
|
|
128
129
|
// @ts-expect-error need @fastify/cookie
|
|
129
|
-
getCookie: /* @__PURE__ */
|
|
130
|
+
getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
|
|
130
131
|
// @ts-expect-error need @fastify/cookie
|
|
131
|
-
setCookie: /* @__PURE__ */
|
|
132
|
+
setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => res.setCookie(key, value, opts2), "setCookie"),
|
|
132
133
|
// @ts-expect-error need @fastify/cookie
|
|
133
|
-
delCookie: /* @__PURE__ */
|
|
134
|
+
delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => res.clearCookie(key, {
|
|
134
135
|
url: ""
|
|
135
136
|
}), "delCookie"),
|
|
136
|
-
redirect: /* @__PURE__ */
|
|
137
|
-
setResHeaders: /* @__PURE__ */
|
|
138
|
-
setResStatus: /* @__PURE__ */
|
|
139
|
-
getRequest: /* @__PURE__ */
|
|
140
|
-
getResponse: /* @__PURE__ */
|
|
137
|
+
redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url, status) => res.redirect(url, status), "redirect"),
|
|
138
|
+
setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => res.headers(headers), "setResHeaders"),
|
|
139
|
+
setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
|
|
140
|
+
getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => req.raw, "getRequest"),
|
|
141
|
+
getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => res.raw, "getResponse")
|
|
141
142
|
};
|
|
142
|
-
const context = new (0,
|
|
143
|
+
const context = new (0, _chunkXKK2SQ7Wjs.Context)(contextData);
|
|
143
144
|
if (http.headers) res.headers(http.headers);
|
|
144
145
|
if (dynamic) {
|
|
145
|
-
aop =
|
|
146
|
+
aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
146
147
|
globalFilter,
|
|
147
148
|
globalGuards,
|
|
148
149
|
globalPipe
|
|
@@ -163,11 +164,11 @@ function bind(fastify, data, opts = {}) {
|
|
|
163
164
|
done();
|
|
164
165
|
}, fastifyOpts);
|
|
165
166
|
}
|
|
166
|
-
|
|
167
|
+
_chunk4LLLQOMFjs.__name.call(void 0, bind, "bind");
|
|
167
168
|
function Fastify(opts) {
|
|
168
|
-
return
|
|
169
|
+
return _chunkDPPDWBYOjs.Define.call(void 0, "fastify", opts);
|
|
169
170
|
}
|
|
170
|
-
|
|
171
|
+
_chunk4LLLQOMFjs.__name.call(void 0, Fastify, "Fastify");
|
|
171
172
|
|
|
172
173
|
|
|
173
174
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Define
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-MKRHYZCL.mjs";
|
|
4
4
|
import {
|
|
5
5
|
BadRequestException,
|
|
6
6
|
Context,
|
|
7
7
|
createControllerMetaMap,
|
|
8
8
|
detectAopDep,
|
|
9
9
|
joinUrl
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-E7EAPAGM.mjs";
|
|
11
11
|
import {
|
|
12
12
|
__name
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-NQ55PA2X.mjs";
|
|
14
14
|
|
|
15
15
|
// src/http/fastify/bind.ts
|
|
16
16
|
import Debug from "debug";
|
|
@@ -48,6 +48,7 @@ function bind(fastify, data, opts = {}) {
|
|
|
48
48
|
try {
|
|
49
49
|
return Promise.all(body.map((item, i) => {
|
|
50
50
|
return new Promise(async (resolve) => {
|
|
51
|
+
if (!item) return resolve(null);
|
|
51
52
|
const { tag, func } = item;
|
|
52
53
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
53
54
|
if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
|
package/dist/http/h3/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { H3Event, Router, _RequestMiddleware } from 'h3';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { H as HttpCtx, a as HttpOptions } from '../../types-
|
|
2
|
+
import { F as Factory } from '../../core-DbqWh47p.mjs';
|
|
3
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-SCJZFCYt.mjs';
|
|
4
4
|
import 'phecda-core';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-BoS1E-Nz.mjs';
|
|
6
6
|
import 'node:http';
|
|
7
7
|
|
|
8
8
|
interface H3Ctx extends HttpCtx {
|
package/dist/http/h3/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { H3Event, Router, _RequestMiddleware } from 'h3';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { H as HttpCtx, a as HttpOptions } from '../../types-
|
|
2
|
+
import { F as Factory } from '../../core-Rq7BhPHE.js';
|
|
3
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-xruyYmyu.js';
|
|
4
4
|
import 'phecda-core';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-BoS1E-Nz.js';
|
|
6
6
|
import 'node:http';
|
|
7
7
|
|
|
8
8
|
interface H3Ctx extends HttpCtx {
|
package/dist/http/h3/index.js
CHANGED
|
@@ -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/h3/bind.ts
|
|
13
13
|
var _h3 = require('h3');
|
|
@@ -16,14 +16,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/h3");
|
|
|
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,31 +32,32 @@ function bind(router, data, opts = {}) {
|
|
|
32
32
|
});
|
|
33
33
|
registerRoute();
|
|
34
34
|
function registerRoute() {
|
|
35
|
-
|
|
35
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(globalAddons, router, "h3");
|
|
36
36
|
if (parallelRoute) {
|
|
37
37
|
const subRouter = _h3.createRouter.call(void 0, );
|
|
38
|
-
|
|
38
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(parallelAddons, subRouter, "h3");
|
|
39
39
|
subRouter.post(parallelRoute, _h3.eventHandler.call(void 0, {
|
|
40
|
-
handler: /* @__PURE__ */
|
|
40
|
+
handler: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, async (event) => {
|
|
41
41
|
const body = await _h3.readBody.call(void 0, event, {
|
|
42
42
|
strict: true
|
|
43
43
|
});
|
|
44
44
|
async function errorHandler(e) {
|
|
45
|
-
const error = await
|
|
45
|
+
const error = await _chunkXKK2SQ7Wjs.Context.filterRecord.default(e);
|
|
46
46
|
_h3.setResponseStatus.call(void 0, event, error.status);
|
|
47
47
|
return error;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
if (!Array.isArray(body)) return errorHandler(new (0,
|
|
49
|
+
_chunk4LLLQOMFjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
50
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkXKK2SQ7Wjs.BadRequestException)("data format should be an array"));
|
|
51
51
|
try {
|
|
52
52
|
return Promise.all(body.map((item, i) => {
|
|
53
53
|
return new Promise(async (resolve) => {
|
|
54
|
+
if (!item) return resolve(null);
|
|
54
55
|
const { tag, func } = item;
|
|
55
56
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
56
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
57
|
+
if (!metaMap.has(tag)) return resolve(await _chunkXKK2SQ7Wjs.Context.filterRecord.default(new (0, _chunkXKK2SQ7Wjs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
57
58
|
const meta2 = metaMap.get(tag)[func];
|
|
58
|
-
if (!meta2) return resolve(await
|
|
59
|
-
const aop =
|
|
59
|
+
if (!meta2) return resolve(await _chunkXKK2SQ7Wjs.Context.filterRecord.default(new (0, _chunkXKK2SQ7Wjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
60
|
+
const aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
60
61
|
globalFilter,
|
|
61
62
|
globalGuards,
|
|
62
63
|
globalPipe
|
|
@@ -71,16 +72,16 @@ function bind(router, data, opts = {}) {
|
|
|
71
72
|
parallel: true,
|
|
72
73
|
app: router,
|
|
73
74
|
...item,
|
|
74
|
-
getCookie: /* @__PURE__ */
|
|
75
|
-
setCookie: /* @__PURE__ */
|
|
76
|
-
delCookie: /* @__PURE__ */
|
|
77
|
-
redirect: /* @__PURE__ */
|
|
78
|
-
setResHeaders: /* @__PURE__ */
|
|
79
|
-
setResStatus: /* @__PURE__ */
|
|
80
|
-
getRequest: /* @__PURE__ */
|
|
81
|
-
getResponse: /* @__PURE__ */
|
|
75
|
+
getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => _h3.getCookie.call(void 0, event, key), "getCookie"),
|
|
76
|
+
setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => _h3.setCookie.call(void 0, event, key, value, opts2), "setCookie"),
|
|
77
|
+
delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => _h3.deleteCookie.call(void 0, event, key), "delCookie"),
|
|
78
|
+
redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url, status) => _h3.sendRedirect.call(void 0, event, url, status), "redirect"),
|
|
79
|
+
setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => _h3.setResponseHeaders.call(void 0, event, headers), "setResHeaders"),
|
|
80
|
+
setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (code) => _h3.setResponseStatus.call(void 0, event, code), "setResStatus"),
|
|
81
|
+
getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => event.node.req, "getRequest"),
|
|
82
|
+
getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => event.node.res, "getResponse")
|
|
82
83
|
};
|
|
83
|
-
const context = new (0,
|
|
84
|
+
const context = new (0, _chunkXKK2SQ7Wjs.Context)(contextData);
|
|
84
85
|
context.run(aop, resolve, resolve);
|
|
85
86
|
});
|
|
86
87
|
}));
|
|
@@ -99,15 +100,15 @@ function bind(router, data, opts = {}) {
|
|
|
99
100
|
const needBody = params.some((item) => item.type === "body");
|
|
100
101
|
let aop;
|
|
101
102
|
if (!dynamic) {
|
|
102
|
-
aop =
|
|
103
|
+
aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
103
104
|
globalFilter,
|
|
104
105
|
globalGuards,
|
|
105
106
|
globalPipe
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
109
|
const subRouter = _h3.createRouter.call(void 0, );
|
|
109
|
-
|
|
110
|
-
subRouter[http.type](
|
|
110
|
+
_chunkXKK2SQ7Wjs.Context.applyAddons(addons, subRouter, "h3");
|
|
111
|
+
subRouter[http.type](_chunkXKK2SQ7Wjs.joinUrl.call(void 0, http.prefix, http.route), _h3.defineEventHandler.call(void 0, async (event) => {
|
|
111
112
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
112
113
|
const contextData = {
|
|
113
114
|
type: "h3",
|
|
@@ -124,19 +125,19 @@ function bind(router, data, opts = {}) {
|
|
|
124
125
|
body: needBody ? await _h3.readBody.call(void 0, event, {
|
|
125
126
|
strict: true
|
|
126
127
|
}) : void 0,
|
|
127
|
-
getCookie: /* @__PURE__ */
|
|
128
|
-
setCookie: /* @__PURE__ */
|
|
129
|
-
redirect: /* @__PURE__ */
|
|
130
|
-
setResHeaders: /* @__PURE__ */
|
|
131
|
-
setResStatus: /* @__PURE__ */
|
|
132
|
-
delCookie: /* @__PURE__ */
|
|
133
|
-
getRequest: /* @__PURE__ */
|
|
134
|
-
getResponse: /* @__PURE__ */
|
|
128
|
+
getCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => _h3.getCookie.call(void 0, event, key), "getCookie"),
|
|
129
|
+
setCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key, value, opts2) => _h3.setCookie.call(void 0, event, key, value, opts2), "setCookie"),
|
|
130
|
+
redirect: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (url) => _h3.sendRedirect.call(void 0, event, url), "redirect"),
|
|
131
|
+
setResHeaders: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (headers) => _h3.setResponseHeaders.call(void 0, event, headers), "setResHeaders"),
|
|
132
|
+
setResStatus: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (code) => _h3.setResponseStatus.call(void 0, event, code), "setResStatus"),
|
|
133
|
+
delCookie: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (key) => _h3.deleteCookie.call(void 0, event, key), "delCookie"),
|
|
134
|
+
getRequest: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => event.node.req, "getRequest"),
|
|
135
|
+
getResponse: /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, () => event.node.res, "getResponse")
|
|
135
136
|
};
|
|
136
|
-
const context = new (0,
|
|
137
|
+
const context = new (0, _chunkXKK2SQ7Wjs.Context)(contextData);
|
|
137
138
|
_h3.setHeaders.call(void 0, event, http.headers || {});
|
|
138
139
|
if (dynamic) {
|
|
139
|
-
aop =
|
|
140
|
+
aop = _chunkXKK2SQ7Wjs.Context.getAop(meta2, {
|
|
140
141
|
globalFilter,
|
|
141
142
|
globalGuards,
|
|
142
143
|
globalPipe
|
|
@@ -147,13 +148,13 @@ function bind(router, data, opts = {}) {
|
|
|
147
148
|
return err;
|
|
148
149
|
});
|
|
149
150
|
}));
|
|
150
|
-
router.use(
|
|
151
|
+
router.use(_chunkXKK2SQ7Wjs.joinUrl.call(void 0, http.prefix, http.route), _h3.useBase.call(void 0, "", subRouter.handler));
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
|
-
|
|
155
|
+
_chunk4LLLQOMFjs.__name.call(void 0, registerRoute, "registerRoute");
|
|
155
156
|
}
|
|
156
|
-
|
|
157
|
+
_chunk4LLLQOMFjs.__name.call(void 0, bind, "bind");
|
|
157
158
|
|
|
158
159
|
|
|
159
160
|
exports.bind = bind;
|
package/dist/http/h3/index.mjs
CHANGED
|
@@ -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/h3/bind.ts
|
|
13
13
|
import { createRouter, defineEventHandler, deleteCookie, eventHandler, getCookie, getQuery, getRequestHeaders, getRouterParams, readBody, sendRedirect, setCookie, setHeaders, setResponseHeaders, setResponseStatus, useBase } from "h3";
|
|
@@ -51,6 +51,7 @@ function bind(router, data, opts = {}) {
|
|
|
51
51
|
try {
|
|
52
52
|
return Promise.all(body.map((item, i) => {
|
|
53
53
|
return new Promise(async (resolve) => {
|
|
54
|
+
if (!item) return resolve(null);
|
|
54
55
|
const { tag, func } = item;
|
|
55
56
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
56
57
|
if (!metaMap.has(tag)) return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
|