phecda-server 7.0.0-alpha.3 → 7.0.0-alpha.5
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 +55 -55
- package/dist/{chunk-MMG73S64.mjs → chunk-2ESEXJQM.mjs} +1 -1
- package/dist/{chunk-A53KNKY4.mjs → chunk-3ISYBU3P.mjs} +33 -3
- package/dist/{chunk-6EBEME3I.js → chunk-K54JYYXK.js} +51 -51
- package/dist/{chunk-RQSQRZL4.js → chunk-KFFS2P7I.js} +3 -1
- package/dist/{chunk-KUGFI6SC.mjs → chunk-PXLG75ED.mjs} +1 -1
- package/dist/{chunk-PKSWGQLW.js → chunk-TR5Z4SDI.js} +50 -20
- package/dist/{chunk-QD3QR3NW.mjs → chunk-UXGJD2PK.mjs} +2 -0
- package/dist/{chunk-QCOBXM7F.js → chunk-Y2OLA5OJ.js} +24 -24
- package/dist/{core-C1kHRqU9.d.ts → core-CzElxZoF.d.ts} +2 -1
- package/dist/{core-CSiaRU7r.d.mts → core-DU7gQKSk.d.mts} +2 -1
- package/dist/helper.d.mts +1 -1
- package/dist/helper.d.ts +1 -1
- package/dist/helper.js +3 -3
- package/dist/helper.mjs +2 -2
- package/dist/http/elysia/index.d.mts +3 -3
- package/dist/http/elysia/index.d.ts +3 -3
- package/dist/http/elysia/index.js +40 -40
- package/dist/http/elysia/index.mjs +3 -3
- package/dist/http/express/index.d.mts +3 -3
- package/dist/http/express/index.d.ts +3 -3
- package/dist/http/express/index.js +37 -37
- package/dist/http/express/index.mjs +2 -2
- package/dist/http/fastify/index.d.mts +3 -3
- package/dist/http/fastify/index.d.ts +3 -3
- package/dist/http/fastify/index.js +38 -38
- package/dist/http/fastify/index.mjs +3 -3
- package/dist/http/h3/index.d.mts +3 -3
- package/dist/http/h3/index.d.ts +3 -3
- package/dist/http/h3/index.js +37 -37
- package/dist/http/h3/index.mjs +2 -2
- package/dist/http/hono/index.d.mts +3 -3
- package/dist/http/hono/index.d.ts +3 -3
- package/dist/http/hono/index.js +35 -35
- package/dist/http/hono/index.mjs +2 -2
- package/dist/http/hyper-express/index.d.mts +3 -3
- package/dist/http/hyper-express/index.d.ts +3 -3
- package/dist/http/hyper-express/index.js +35 -35
- package/dist/http/hyper-express/index.mjs +2 -2
- package/dist/http/koa/index.d.mts +3 -3
- package/dist/http/koa/index.d.ts +3 -3
- package/dist/http/koa/index.js +37 -37
- package/dist/http/koa/index.mjs +2 -2
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +40 -38
- package/dist/index.mjs +6 -4
- package/dist/{meta-D1M85Hef.d.ts → meta-BTnLXuCa.d.mts} +2 -1
- package/dist/{meta-D1M85Hef.d.mts → meta-BTnLXuCa.d.ts} +2 -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 +14 -14
- package/dist/rpc/bullmq/index.mjs +2 -2
- package/dist/rpc/kafka/index.d.mts +3 -3
- package/dist/rpc/kafka/index.d.ts +3 -3
- package/dist/rpc/kafka/index.js +14 -14
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/nats/index.d.mts +3 -3
- package/dist/rpc/nats/index.d.ts +3 -3
- package/dist/rpc/nats/index.js +13 -13
- package/dist/rpc/nats/index.mjs +2 -2
- package/dist/rpc/rabbitmq/index.d.mts +3 -3
- package/dist/rpc/rabbitmq/index.d.ts +3 -3
- package/dist/rpc/rabbitmq/index.js +15 -15
- package/dist/rpc/rabbitmq/index.mjs +2 -2
- package/dist/rpc/redis/index.d.mts +3 -3
- package/dist/rpc/redis/index.d.ts +3 -3
- package/dist/rpc/redis/index.js +13 -13
- package/dist/rpc/redis/index.mjs +2 -2
- package/dist/test.d.mts +2 -2
- package/dist/test.d.ts +2 -2
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/dist/{types-ee1FBodH.d.ts → types--E-OCZhC.d.ts} +1 -1
- package/dist/{types-JMhFVp-Z.d.mts → types-BYqBeqrs.d.mts} +1 -1
- package/dist/{types-wbHHC93P.d.mts → types-BxlzVoRv.d.mts} +1 -1
- package/dist/{types-C9Remkup.d.ts → types-CbfaGkPA.d.ts} +1 -1
- package/package.json +2 -2
- package/register/index.mjs +41 -40
- package/register/loader.mjs +37 -11
- package/register/utils.mjs +56 -56
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Define
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-PXLG75ED.mjs";
|
|
4
4
|
import {
|
|
5
5
|
BadRequestException,
|
|
6
6
|
Context,
|
|
7
7
|
argToReq,
|
|
8
8
|
createControllerMetaMap,
|
|
9
9
|
detectAopDep
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-2ESEXJQM.mjs";
|
|
11
11
|
import {
|
|
12
12
|
__name
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-UXGJD2PK.mjs";
|
|
14
14
|
|
|
15
15
|
// src/http/elysia/bind.ts
|
|
16
16
|
import Debug from "debug";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Request, Response, Router, RequestHandler } from 'express';
|
|
2
|
-
import { H as HttpContext, a as HttpOptions } from '../../types-
|
|
3
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { H as HttpContext, a as HttpOptions } from '../../types-BxlzVoRv.mjs';
|
|
3
|
+
import { F as Factory } from '../../core-DU7gQKSk.mjs';
|
|
4
4
|
import 'node:http';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-BTnLXuCa.mjs';
|
|
6
6
|
import 'phecda-core';
|
|
7
7
|
|
|
8
8
|
interface ExpressCtx extends HttpContext {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Request, Response, Router, RequestHandler } from 'express';
|
|
2
|
-
import { H as HttpContext, a as HttpOptions } from '../../types-
|
|
3
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { H as HttpContext, a as HttpOptions } from '../../types--E-OCZhC.js';
|
|
3
|
+
import { F as Factory } from '../../core-CzElxZoF.js';
|
|
4
4
|
import 'node:http';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-BTnLXuCa.js';
|
|
6
6
|
import 'phecda-core';
|
|
7
7
|
|
|
8
8
|
interface ExpressCtx extends HttpContext {
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkK54JYYXKjs = require('../../chunk-K54JYYXK.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkKFFS2P7Ijs = require('../../chunk-KFFS2P7I.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 = _chunkK54JYYXKjs.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
|
+
_chunkK54JYYXKjs.detectAopDep.call(void 0, meta, {
|
|
29
29
|
addons: [
|
|
30
30
|
...globalAddons,
|
|
31
31
|
...parallelAddons
|
|
@@ -33,33 +33,33 @@ function bind(router, data, opts = {}) {
|
|
|
33
33
|
guards: globalGuards
|
|
34
34
|
});
|
|
35
35
|
registerRoute();
|
|
36
|
-
|
|
36
|
+
_chunkK54JYYXKjs.HMR.call(void 0, async () => {
|
|
37
37
|
router.stack = originStack;
|
|
38
38
|
registerRoute();
|
|
39
39
|
});
|
|
40
40
|
function registerRoute() {
|
|
41
|
-
|
|
41
|
+
_chunkK54JYYXKjs.Context.applyAddons(globalAddons, router, "express");
|
|
42
42
|
if (parallelRoute) {
|
|
43
43
|
const subRouter = _express.Router.call(void 0, );
|
|
44
|
-
|
|
44
|
+
_chunkK54JYYXKjs.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 _chunkK54JYYXKjs.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
|
+
_chunkKFFS2P7Ijs.__name.call(void 0, errorHandler, "errorHandler");
|
|
52
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkK54JYYXKjs.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
56
|
const { tag, func } = item;
|
|
57
57
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
58
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
58
|
+
if (!metaMap.has(tag)) return resolve(await _chunkK54JYYXKjs.Context.filterRecord.default(new (0, _chunkK54JYYXKjs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
59
59
|
const meta2 = metaMap.get(tag)[func];
|
|
60
|
-
if (!meta2) return resolve(await
|
|
60
|
+
if (!meta2) return resolve(await _chunkK54JYYXKjs.Context.filterRecord.default(new (0, _chunkK54JYYXKjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
61
61
|
const { data: { params } } = meta2;
|
|
62
|
-
const aop =
|
|
62
|
+
const aop = _chunkK54JYYXKjs.Context.getAop(meta2, {
|
|
63
63
|
globalFilter,
|
|
64
64
|
globalGuards,
|
|
65
65
|
globalPipe
|
|
@@ -77,19 +77,19 @@ function bind(router, data, opts = {}) {
|
|
|
77
77
|
func,
|
|
78
78
|
next,
|
|
79
79
|
app: router,
|
|
80
|
-
...
|
|
81
|
-
getCookie: /* @__PURE__ */
|
|
82
|
-
setCookie: /* @__PURE__ */
|
|
83
|
-
delCookie: /* @__PURE__ */
|
|
80
|
+
..._chunkK54JYYXKjs.argToReq.call(void 0, params, item.args, req.headers),
|
|
81
|
+
getCookie: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
|
|
82
|
+
setCookie: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
|
|
83
|
+
delCookie: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (key) => res.cookie(key, "", {
|
|
84
84
|
expires: /* @__PURE__ */ new Date(0)
|
|
85
85
|
}), "delCookie"),
|
|
86
|
-
redirect: /* @__PURE__ */
|
|
87
|
-
setResHeaders: /* @__PURE__ */
|
|
88
|
-
setResStatus: /* @__PURE__ */
|
|
89
|
-
getRequest: /* @__PURE__ */
|
|
90
|
-
getResponse: /* @__PURE__ */
|
|
86
|
+
redirect: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (url, status) => status ? res.redirect(status, url) : res.redirect(url), "redirect"),
|
|
87
|
+
setResHeaders: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
|
|
88
|
+
setResStatus: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
|
|
89
|
+
getRequest: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, () => req, "getRequest"),
|
|
90
|
+
getResponse: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, () => res, "getResponse")
|
|
91
91
|
};
|
|
92
|
-
const context = new (0,
|
|
92
|
+
const context = new (0, _chunkK54JYYXKjs.Context)(contextData);
|
|
93
93
|
context.run(aop, resolve, resolve);
|
|
94
94
|
});
|
|
95
95
|
})).then((ret) => {
|
|
@@ -108,14 +108,14 @@ function bind(router, data, opts = {}) {
|
|
|
108
108
|
if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
|
|
109
109
|
let aop;
|
|
110
110
|
if (!dynamic) {
|
|
111
|
-
aop =
|
|
111
|
+
aop = _chunkK54JYYXKjs.Context.getAop(meta2, {
|
|
112
112
|
globalFilter,
|
|
113
113
|
globalGuards,
|
|
114
114
|
globalPipe
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
const subRouter = _express.Router.call(void 0, );
|
|
118
|
-
|
|
118
|
+
_chunkK54JYYXKjs.Context.applyAddons(addons, subRouter, "express");
|
|
119
119
|
subRouter[http.type](http.prefix + http.route, async (req, res, next) => {
|
|
120
120
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
121
121
|
const contextData = {
|
|
@@ -133,21 +133,21 @@ function bind(router, data, opts = {}) {
|
|
|
133
133
|
headers: req.headers,
|
|
134
134
|
app: router,
|
|
135
135
|
next,
|
|
136
|
-
getCookie: /* @__PURE__ */
|
|
137
|
-
setCookie: /* @__PURE__ */
|
|
138
|
-
delCookie: /* @__PURE__ */
|
|
136
|
+
getCookie: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
|
|
137
|
+
setCookie: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
|
|
138
|
+
delCookie: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (key) => res.cookie(key, "", {
|
|
139
139
|
expires: /* @__PURE__ */ new Date(0)
|
|
140
140
|
}), "delCookie"),
|
|
141
|
-
redirect: /* @__PURE__ */
|
|
142
|
-
setResHeaders: /* @__PURE__ */
|
|
143
|
-
setResStatus: /* @__PURE__ */
|
|
144
|
-
getRequest: /* @__PURE__ */
|
|
145
|
-
getResponse: /* @__PURE__ */
|
|
141
|
+
redirect: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (url, status) => status ? res.redirect(status, url) : res.redirect(url), "redirect"),
|
|
142
|
+
setResHeaders: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
|
|
143
|
+
setResStatus: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
|
|
144
|
+
getRequest: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, () => req, "getRequest"),
|
|
145
|
+
getResponse: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, () => res, "getResponse")
|
|
146
146
|
};
|
|
147
|
-
const context = new (0,
|
|
147
|
+
const context = new (0, _chunkK54JYYXKjs.Context)(contextData);
|
|
148
148
|
if (http.headers) res.set(http.headers);
|
|
149
149
|
if (dynamic) {
|
|
150
|
-
aop =
|
|
150
|
+
aop = _chunkK54JYYXKjs.Context.getAop(meta2, {
|
|
151
151
|
globalFilter,
|
|
152
152
|
globalGuards,
|
|
153
153
|
globalPipe
|
|
@@ -166,9 +166,9 @@ function bind(router, data, opts = {}) {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
_chunkKFFS2P7Ijs.__name.call(void 0, registerRoute, "registerRoute");
|
|
170
170
|
}
|
|
171
|
-
|
|
171
|
+
_chunkKFFS2P7Ijs.__name.call(void 0, bind, "bind");
|
|
172
172
|
|
|
173
173
|
|
|
174
174
|
exports.bind = bind;
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
argToReq,
|
|
6
6
|
createControllerMetaMap,
|
|
7
7
|
detectAopDep
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-2ESEXJQM.mjs";
|
|
9
9
|
import {
|
|
10
10
|
__name
|
|
11
|
-
} from "../../chunk-
|
|
11
|
+
} from "../../chunk-UXGJD2PK.mjs";
|
|
12
12
|
|
|
13
13
|
// src/http/express/bind.ts
|
|
14
14
|
import { Router } from "express";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback, FastifyRegisterOptions, FastifyPluginOptions, RouteShorthandOptions } from 'fastify';
|
|
2
|
-
import { H as HttpContext, a as HttpOptions } from '../../types-
|
|
3
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { H as HttpContext, a as HttpOptions } from '../../types-BxlzVoRv.mjs';
|
|
3
|
+
import { F as Factory } from '../../core-DU7gQKSk.mjs';
|
|
4
4
|
import 'node:http';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-BTnLXuCa.mjs';
|
|
6
6
|
import 'phecda-core';
|
|
7
7
|
|
|
8
8
|
interface FastifyCtx extends HttpContext {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback, FastifyRegisterOptions, FastifyPluginOptions, RouteShorthandOptions } from 'fastify';
|
|
2
|
-
import { H as HttpContext, a as HttpOptions } from '../../types-
|
|
3
|
-
import { F as Factory } from '../../core-
|
|
2
|
+
import { H as HttpContext, a as HttpOptions } from '../../types--E-OCZhC.js';
|
|
3
|
+
import { F as Factory } from '../../core-CzElxZoF.js';
|
|
4
4
|
import 'node:http';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-BTnLXuCa.js';
|
|
6
6
|
import 'phecda-core';
|
|
7
7
|
|
|
8
8
|
interface FastifyCtx extends HttpContext {
|
|
@@ -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 _chunkY2OLA5OJjs = require('../../chunk-Y2OLA5OJ.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkK54JYYXKjs = require('../../chunk-K54JYYXK.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkKFFS2P7Ijs = require('../../chunk-KFFS2P7I.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 = _chunkK54JYYXKjs.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
|
+
_chunkK54JYYXKjs.detectAopDep.call(void 0, meta, {
|
|
29
29
|
addons: [
|
|
30
30
|
...globalAddons,
|
|
31
31
|
...parallelAddons
|
|
@@ -33,28 +33,28 @@ function bind(fastify, data, opts = {}) {
|
|
|
33
33
|
guards: globalGuards
|
|
34
34
|
});
|
|
35
35
|
fastify.register(async (fastify2, _, done) => {
|
|
36
|
-
|
|
36
|
+
_chunkK54JYYXKjs.Context.applyAddons(globalAddons, fastify2, "fastify");
|
|
37
37
|
if (parallelRoute) {
|
|
38
38
|
fastify2.register(async (fastify3, _opts, done2) => {
|
|
39
|
-
|
|
39
|
+
_chunkK54JYYXKjs.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 _chunkK54JYYXKjs.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
|
+
_chunkKFFS2P7Ijs.__name.call(void 0, errorHandler, "errorHandler");
|
|
47
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkK54JYYXKjs.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
51
|
const { tag, func } = item;
|
|
52
52
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
53
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
53
|
+
if (!metaMap.has(tag)) return resolve(await _chunkK54JYYXKjs.Context.filterRecord.default(new (0, _chunkK54JYYXKjs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
54
54
|
const meta2 = metaMap.get(tag)[func];
|
|
55
|
-
if (!meta2) return resolve(await
|
|
55
|
+
if (!meta2) return resolve(await _chunkK54JYYXKjs.Context.filterRecord.default(new (0, _chunkK54JYYXKjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
56
56
|
const { data: { params } } = meta2;
|
|
57
|
-
const aop =
|
|
57
|
+
const aop = _chunkK54JYYXKjs.Context.getAop(meta2, {
|
|
58
58
|
globalFilter,
|
|
59
59
|
globalGuards,
|
|
60
60
|
globalPipe
|
|
@@ -71,20 +71,20 @@ function bind(fastify, data, opts = {}) {
|
|
|
71
71
|
tag,
|
|
72
72
|
func,
|
|
73
73
|
app: fastify3,
|
|
74
|
-
...
|
|
74
|
+
..._chunkK54JYYXKjs.argToReq.call(void 0, params, item.args, req.headers),
|
|
75
75
|
// @ts-expect-error need @fastify/cookie
|
|
76
|
-
getCookie: /* @__PURE__ */
|
|
76
|
+
getCookie: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
|
|
77
77
|
// @ts-expect-error need @fastify/cookie
|
|
78
|
-
setCookie: /* @__PURE__ */
|
|
78
|
+
setCookie: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (key, value, opts2) => res.setCookie(key, value, opts2), "setCookie"),
|
|
79
79
|
// @ts-expect-error need @fastify/cookie
|
|
80
|
-
delCookie: /* @__PURE__ */
|
|
81
|
-
redirect: /* @__PURE__ */
|
|
82
|
-
setResHeaders: /* @__PURE__ */
|
|
83
|
-
setResStatus: /* @__PURE__ */
|
|
84
|
-
getRequest: /* @__PURE__ */
|
|
85
|
-
getResponse: /* @__PURE__ */
|
|
80
|
+
delCookie: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
|
|
81
|
+
redirect: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (url, status) => res.redirect(url, status), "redirect"),
|
|
82
|
+
setResHeaders: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (headers) => res.headers(headers), "setResHeaders"),
|
|
83
|
+
setResStatus: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
|
|
84
|
+
getRequest: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, () => req.raw, "getRequest"),
|
|
85
|
+
getResponse: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, () => res.raw, "getResponse")
|
|
86
86
|
};
|
|
87
|
-
const context = new (0,
|
|
87
|
+
const context = new (0, _chunkK54JYYXKjs.Context)(contextData);
|
|
88
88
|
context.run(aop, resolve, resolve);
|
|
89
89
|
});
|
|
90
90
|
})).then((ret) => {
|
|
@@ -103,10 +103,10 @@ function bind(fastify, data, opts = {}) {
|
|
|
103
103
|
const { data: { addons, define, http } } = meta2;
|
|
104
104
|
if (!_optionalChain([http, 'optionalAccess', _3 => _3.type])) continue;
|
|
105
105
|
fastify2.register(async (fastify3, _opts, done2) => {
|
|
106
|
-
|
|
106
|
+
_chunkK54JYYXKjs.Context.applyAddons(addons, fastify3, "fastify");
|
|
107
107
|
let aop;
|
|
108
108
|
if (!dynamic) {
|
|
109
|
-
aop =
|
|
109
|
+
aop = _chunkK54JYYXKjs.Context.getAop(meta2, {
|
|
110
110
|
globalFilter,
|
|
111
111
|
globalGuards,
|
|
112
112
|
globalPipe
|
|
@@ -129,23 +129,23 @@ function bind(fastify, data, opts = {}) {
|
|
|
129
129
|
headers: req.headers,
|
|
130
130
|
app: fastify3,
|
|
131
131
|
// @ts-expect-error need @fastify/cookie
|
|
132
|
-
getCookie: /* @__PURE__ */
|
|
132
|
+
getCookie: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
|
|
133
133
|
// @ts-expect-error need @fastify/cookie
|
|
134
|
-
setCookie: /* @__PURE__ */
|
|
134
|
+
setCookie: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (key, value, opts2) => res.setCookie(key, value, opts2), "setCookie"),
|
|
135
135
|
// @ts-expect-error need @fastify/cookie
|
|
136
|
-
delCookie: /* @__PURE__ */
|
|
136
|
+
delCookie: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (key) => res.clearCookie(key, {
|
|
137
137
|
url: ""
|
|
138
138
|
}), "delCookie"),
|
|
139
|
-
redirect: /* @__PURE__ */
|
|
140
|
-
setResHeaders: /* @__PURE__ */
|
|
141
|
-
setResStatus: /* @__PURE__ */
|
|
142
|
-
getRequest: /* @__PURE__ */
|
|
143
|
-
getResponse: /* @__PURE__ */
|
|
139
|
+
redirect: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (url, status) => res.redirect(url, status), "redirect"),
|
|
140
|
+
setResHeaders: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (headers) => res.headers(headers), "setResHeaders"),
|
|
141
|
+
setResStatus: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, (code) => res.status(code), "setResStatus"),
|
|
142
|
+
getRequest: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, () => req.raw, "getRequest"),
|
|
143
|
+
getResponse: /* @__PURE__ */ _chunkKFFS2P7Ijs.__name.call(void 0, () => res.raw, "getResponse")
|
|
144
144
|
};
|
|
145
|
-
const context = new (0,
|
|
145
|
+
const context = new (0, _chunkK54JYYXKjs.Context)(contextData);
|
|
146
146
|
if (http.headers) res.headers(http.headers);
|
|
147
147
|
if (dynamic) {
|
|
148
|
-
aop =
|
|
148
|
+
aop = _chunkK54JYYXKjs.Context.getAop(meta2, {
|
|
149
149
|
globalFilter,
|
|
150
150
|
globalGuards,
|
|
151
151
|
globalPipe
|
|
@@ -166,11 +166,11 @@ function bind(fastify, data, opts = {}) {
|
|
|
166
166
|
done();
|
|
167
167
|
}, fastifyOpts);
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
_chunkKFFS2P7Ijs.__name.call(void 0, bind, "bind");
|
|
170
170
|
function Fastify(opts) {
|
|
171
|
-
return
|
|
171
|
+
return _chunkY2OLA5OJjs.Define.call(void 0, "fastify", opts);
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
_chunkKFFS2P7Ijs.__name.call(void 0, Fastify, "Fastify");
|
|
174
174
|
|
|
175
175
|
|
|
176
176
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Define
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-PXLG75ED.mjs";
|
|
4
4
|
import {
|
|
5
5
|
BadRequestException,
|
|
6
6
|
Context,
|
|
7
7
|
argToReq,
|
|
8
8
|
createControllerMetaMap,
|
|
9
9
|
detectAopDep
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-2ESEXJQM.mjs";
|
|
11
11
|
import {
|
|
12
12
|
__name
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-UXGJD2PK.mjs";
|
|
14
14
|
|
|
15
15
|
// src/http/fastify/bind.ts
|
|
16
16
|
import Debug from "debug";
|
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 HttpContext, a as HttpOptions } from '../../types-
|
|
2
|
+
import { F as Factory } from '../../core-DU7gQKSk.mjs';
|
|
3
|
+
import { H as HttpContext, a as HttpOptions } from '../../types-BxlzVoRv.mjs';
|
|
4
4
|
import 'phecda-core';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-BTnLXuCa.mjs';
|
|
6
6
|
import 'node:http';
|
|
7
7
|
|
|
8
8
|
interface H3Ctx extends HttpContext {
|
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 HttpContext, a as HttpOptions } from '../../types-
|
|
2
|
+
import { F as Factory } from '../../core-CzElxZoF.js';
|
|
3
|
+
import { H as HttpContext, a as HttpOptions } from '../../types--E-OCZhC.js';
|
|
4
4
|
import 'phecda-core';
|
|
5
|
-
import '../../meta-
|
|
5
|
+
import '../../meta-BTnLXuCa.js';
|
|
6
6
|
import 'node:http';
|
|
7
7
|
|
|
8
8
|
interface H3Ctx extends HttpContext {
|