phecda-server 5.3.2 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2UTKBEZE.mjs +233 -0
- package/dist/{chunk-NT6HEBC6.mjs → chunk-HDQAT2IM.mjs} +63 -62
- package/dist/{chunk-UIKQNJN3.js → chunk-LYEZ6RGX.js} +62 -61
- package/dist/chunk-PALEEADE.js +233 -0
- package/dist/{chunk-RZ7IXJYQ.js → chunk-TZYATAJX.js} +12 -30
- package/dist/{chunk-3IPYLGY2.mjs → chunk-YUXERDQ6.mjs} +13 -31
- package/dist/{core-dx9E5x2N.d.ts → core-Blq8frmr.d.ts} +4 -3
- package/dist/{core-Bc2ENEHX.d.mts → core-D2oL8Ge0.d.mts} +4 -3
- package/dist/helper.js +2 -2
- package/dist/helper.mjs +1 -1
- package/dist/index.d.mts +9 -10
- package/dist/index.d.ts +9 -10
- package/dist/index.js +27 -27
- package/dist/index.mjs +6 -6
- package/dist/rpc/bullmq/index.d.mts +1 -1
- package/dist/rpc/bullmq/index.d.ts +1 -1
- package/dist/rpc/bullmq/index.js +6 -6
- package/dist/rpc/bullmq/index.mjs +1 -1
- package/dist/rpc/kafka/index.d.mts +1 -1
- package/dist/rpc/kafka/index.d.ts +1 -1
- package/dist/rpc/kafka/index.js +5 -5
- package/dist/rpc/kafka/index.mjs +1 -1
- package/dist/rpc/nats/index.d.mts +1 -1
- package/dist/rpc/nats/index.d.ts +1 -1
- package/dist/rpc/nats/index.js +5 -5
- package/dist/rpc/nats/index.mjs +1 -1
- package/dist/rpc/rabbitmq/index.d.mts +1 -1
- package/dist/rpc/rabbitmq/index.d.ts +1 -1
- package/dist/rpc/rabbitmq/index.js +6 -6
- package/dist/rpc/rabbitmq/index.mjs +1 -1
- package/dist/rpc/redis/index.d.mts +1 -1
- package/dist/rpc/redis/index.d.ts +1 -1
- package/dist/rpc/redis/index.js +6 -6
- package/dist/rpc/redis/index.mjs +1 -1
- package/dist/server/elysia/index.d.mts +1 -1
- package/dist/server/elysia/index.d.ts +1 -1
- package/dist/server/elysia/index.js +15 -15
- package/dist/server/elysia/index.mjs +2 -2
- package/dist/server/express/index.d.mts +1 -1
- package/dist/server/express/index.d.ts +1 -1
- package/dist/server/express/index.js +14 -14
- package/dist/server/express/index.mjs +1 -1
- package/dist/server/fastify/index.d.mts +1 -1
- package/dist/server/fastify/index.d.ts +1 -1
- package/dist/server/fastify/index.js +15 -15
- package/dist/server/fastify/index.mjs +2 -2
- package/dist/server/h3/index.d.mts +1 -1
- package/dist/server/h3/index.d.ts +1 -1
- package/dist/server/h3/index.js +12 -12
- package/dist/server/h3/index.mjs +1 -1
- package/dist/server/hono/index.d.mts +1 -1
- package/dist/server/hono/index.d.ts +1 -1
- package/dist/server/hono/index.js +13 -13
- package/dist/server/hono/index.mjs +1 -1
- package/dist/server/hyper-express/index.d.mts +1 -1
- package/dist/server/hyper-express/index.d.ts +1 -1
- package/dist/server/hyper-express/index.js +13 -13
- package/dist/server/hyper-express/index.mjs +1 -1
- package/dist/server/koa/index.d.mts +1 -1
- package/dist/server/koa/index.d.ts +1 -1
- package/dist/server/koa/index.js +14 -14
- package/dist/server/koa/index.mjs +1 -1
- package/dist/test.d.mts +1 -1
- package/dist/test.d.ts +1 -1
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-2HVTWYS2.js +0 -279
- package/dist/chunk-SXOZVIKW.mjs +0 -279
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
|
|
@@ -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, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe } = opts;
|
|
18
18
|
const { moduleMap, meta } = data;
|
|
19
|
-
const metaMap =
|
|
19
|
+
const metaMap = _chunkTZYATAJXjs.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
|
+
_chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
|
|
27
27
|
plugins: [
|
|
28
28
|
...globalPlugins,
|
|
29
29
|
...parallelPlugins
|
|
@@ -33,25 +33,25 @@ function bind(router, data, opts = {}) {
|
|
|
33
33
|
});
|
|
34
34
|
registerRoute();
|
|
35
35
|
async function registerRoute() {
|
|
36
|
-
|
|
36
|
+
_chunkTZYATAJXjs.Context.usePlugin(globalPlugins, "hono").forEach((p) => router.use(p));
|
|
37
37
|
if (parallelRoute) {
|
|
38
|
-
router.post(parallelRoute, ...
|
|
38
|
+
router.post(parallelRoute, ..._chunkTZYATAJXjs.Context.usePlugin(parallelPlugins, "hono"), async (c) => {
|
|
39
39
|
const body = await c.req.json();
|
|
40
40
|
async function errorHandler(e) {
|
|
41
|
-
const error = await
|
|
41
|
+
const error = await _chunkTZYATAJXjs.Context.filterRecord.default(e);
|
|
42
42
|
c.status(error.status);
|
|
43
43
|
return c.json(error);
|
|
44
44
|
}
|
|
45
45
|
_chunkGHFSIZUOjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
46
|
-
if (!Array.isArray(body)) return errorHandler(new (0,
|
|
46
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkTZYATAJXjs.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
50
|
const { tag, func } = item;
|
|
51
51
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
52
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
52
|
+
if (!metaMap.has(tag)) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
53
53
|
const meta2 = metaMap.get(tag)[func];
|
|
54
|
-
if (!meta2) return resolve(await
|
|
54
|
+
if (!meta2) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
55
55
|
const { data: { params } } = meta2;
|
|
56
56
|
const contextData = {
|
|
57
57
|
type: "hono",
|
|
@@ -63,7 +63,7 @@ function bind(router, data, opts = {}) {
|
|
|
63
63
|
tag,
|
|
64
64
|
func,
|
|
65
65
|
app: router,
|
|
66
|
-
...
|
|
66
|
+
..._chunkTZYATAJXjs.argToReq.call(void 0, params, item.args, c.req.header()),
|
|
67
67
|
getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => _cookie.getCookie.call(void 0, c, key), "getCookie"),
|
|
68
68
|
delCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => _cookie.deleteCookie.call(void 0, c, key), "delCookie"),
|
|
69
69
|
setCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key, value, opts2) => _cookie.setCookie.call(void 0, c, key, value, opts2), "setCookie"),
|
|
@@ -73,7 +73,7 @@ function bind(router, data, opts = {}) {
|
|
|
73
73
|
}, "setResHeaders"),
|
|
74
74
|
setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => c.status(status), "setResStatus")
|
|
75
75
|
};
|
|
76
|
-
const context = new (0,
|
|
76
|
+
const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
|
|
77
77
|
context.run({
|
|
78
78
|
globalGuards,
|
|
79
79
|
globalInterceptors,
|
|
@@ -95,7 +95,7 @@ function bind(router, data, opts = {}) {
|
|
|
95
95
|
const { data: { params, plugins, http } } = meta2;
|
|
96
96
|
if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
|
|
97
97
|
const needBody = params.some((item) => item.type === "body");
|
|
98
|
-
router[http.type](http.prefix + http.route, ...
|
|
98
|
+
router[http.type](http.prefix + http.route, ..._chunkTZYATAJXjs.Context.usePlugin(plugins, "hono"), async (c) => {
|
|
99
99
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
100
100
|
const contextData = {
|
|
101
101
|
type: "hono",
|
|
@@ -118,7 +118,7 @@ function bind(router, data, opts = {}) {
|
|
|
118
118
|
}, "setResHeaders"),
|
|
119
119
|
setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => c.status(status), "setResStatus")
|
|
120
120
|
};
|
|
121
|
-
const context = new (0,
|
|
121
|
+
const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
|
|
122
122
|
if (http.headers) {
|
|
123
123
|
for (const name in http.headers) c.header(name, http.headers[name]);
|
|
124
124
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Request, Response, Router, MiddlewareHandler } from 'hyper-express';
|
|
2
2
|
import { H as HttpContext, a as HttpOptions } from '../../types-Dgxirc9f.mjs';
|
|
3
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { F as Factory } from '../../core-D2oL8Ge0.mjs';
|
|
4
4
|
import 'node:http';
|
|
5
5
|
import '../../types-BlIBlnVT.mjs';
|
|
6
6
|
import 'phecda-core';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Request, Response, Router, MiddlewareHandler } from 'hyper-express';
|
|
2
2
|
import { H as HttpContext, a as HttpOptions } from '../../types-BCJhmpQh.js';
|
|
3
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { F as Factory } from '../../core-Blq8frmr.js';
|
|
4
4
|
import 'node:http';
|
|
5
5
|
import '../../types-BlIBlnVT.js';
|
|
6
6
|
import 'phecda-core';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
|
|
@@ -15,14 +15,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/hyper-express");
|
|
|
15
15
|
function bind(router, data, opts = {}) {
|
|
16
16
|
const { globalGuards, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe } = opts;
|
|
17
17
|
const { moduleMap, meta } = data;
|
|
18
|
-
const metaMap =
|
|
18
|
+
const metaMap = _chunkTZYATAJXjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
19
19
|
const { controller, http, func, tag } = meta2.data;
|
|
20
20
|
if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
|
|
21
21
|
debug(`register method "${func}" in module "${tag}"`);
|
|
22
22
|
return true;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
|
|
25
|
+
_chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
|
|
26
26
|
plugins: [
|
|
27
27
|
...globalPlugins,
|
|
28
28
|
...parallelPlugins
|
|
@@ -32,26 +32,26 @@ function bind(router, data, opts = {}) {
|
|
|
32
32
|
});
|
|
33
33
|
registerRoute();
|
|
34
34
|
async function registerRoute() {
|
|
35
|
-
|
|
35
|
+
_chunkTZYATAJXjs.Context.usePlugin(globalPlugins, "hyper-express").forEach((p) => router.use(p));
|
|
36
36
|
if (parallelRoute) {
|
|
37
37
|
router.post(parallelRoute, {
|
|
38
|
-
middlewares:
|
|
38
|
+
middlewares: _chunkTZYATAJXjs.Context.usePlugin(parallelPlugins, "hyper-express")
|
|
39
39
|
}, async (req, res, next) => {
|
|
40
40
|
const body = await req.json();
|
|
41
41
|
async function errorHandler(e) {
|
|
42
|
-
const error = await
|
|
42
|
+
const error = await _chunkTZYATAJXjs.Context.filterRecord.default(e);
|
|
43
43
|
return res.status(error.status).json(error);
|
|
44
44
|
}
|
|
45
45
|
_chunkGHFSIZUOjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
46
|
-
if (!Array.isArray(body)) return errorHandler(new (0,
|
|
46
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkTZYATAJXjs.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
50
|
const { tag, func } = item;
|
|
51
51
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
52
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
52
|
+
if (!metaMap.has(tag)) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
53
53
|
const meta2 = metaMap.get(tag)[func];
|
|
54
|
-
if (!meta2) return resolve(await
|
|
54
|
+
if (!meta2) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
55
55
|
const { data: { params } } = meta2;
|
|
56
56
|
const contextData = {
|
|
57
57
|
type: "hyper-express",
|
|
@@ -65,7 +65,7 @@ function bind(router, data, opts = {}) {
|
|
|
65
65
|
func,
|
|
66
66
|
next,
|
|
67
67
|
app: router,
|
|
68
|
-
...
|
|
68
|
+
..._chunkTZYATAJXjs.argToReq.call(void 0, params, item.args, req.headers),
|
|
69
69
|
getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
|
|
70
70
|
setCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, _optionalChain([opts2, 'optionalAccess', _2 => _2.expires]) && opts2.expires.getTime() - Date.now(), opts2 || {}), "setCookie"),
|
|
71
71
|
delCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
|
|
@@ -73,7 +73,7 @@ function bind(router, data, opts = {}) {
|
|
|
73
73
|
setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
|
|
74
74
|
setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (code) => res.status(code), "setResStatus")
|
|
75
75
|
};
|
|
76
|
-
const context = new (0,
|
|
76
|
+
const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
|
|
77
77
|
context.run({
|
|
78
78
|
globalGuards,
|
|
79
79
|
globalInterceptors,
|
|
@@ -95,7 +95,7 @@ function bind(router, data, opts = {}) {
|
|
|
95
95
|
const { data: { params, plugins, http } } = meta2;
|
|
96
96
|
if (!_optionalChain([http, 'optionalAccess', _3 => _3.type])) continue;
|
|
97
97
|
const needBody = params.some((item) => item.type === "body");
|
|
98
|
-
router[http.type](http.prefix + http.route, ...
|
|
98
|
+
router[http.type](http.prefix + http.route, ..._chunkTZYATAJXjs.Context.usePlugin(plugins, "hyper-express"), async (req, res, next) => {
|
|
99
99
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
100
100
|
const contextData = {
|
|
101
101
|
type: "hyper-express",
|
|
@@ -118,7 +118,7 @@ function bind(router, data, opts = {}) {
|
|
|
118
118
|
setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
|
|
119
119
|
setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (code) => res.status(code), "setResStatus")
|
|
120
120
|
};
|
|
121
|
-
const context = new (0,
|
|
121
|
+
const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
|
|
122
122
|
if (http.headers) {
|
|
123
123
|
for (const name in http.headers) res.set(name, http.headers[name]);
|
|
124
124
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Router, { RouterParamContext } from '@koa/router';
|
|
2
2
|
import { DefaultContext, DefaultState } from 'koa';
|
|
3
3
|
import { H as HttpContext, a as HttpOptions } from '../../types-Dgxirc9f.mjs';
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
4
|
+
import { F as Factory } from '../../core-D2oL8Ge0.mjs';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import '../../types-BlIBlnVT.mjs';
|
|
7
7
|
import 'phecda-core';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Router, { RouterParamContext } from '@koa/router';
|
|
2
2
|
import { DefaultContext, DefaultState } from 'koa';
|
|
3
3
|
import { H as HttpContext, a as HttpOptions } from '../../types-BCJhmpQh.js';
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
4
|
+
import { F as Factory } from '../../core-Blq8frmr.js';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import '../../types-BlIBlnVT.js';
|
|
7
7
|
import 'phecda-core';
|
package/dist/server/koa/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
|
|
@@ -17,14 +17,14 @@ function bind(router, data, opts = {}) {
|
|
|
17
17
|
const { globalGuards, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe } = opts;
|
|
18
18
|
const { moduleMap, meta } = data;
|
|
19
19
|
const originStack = router.stack.slice(0, router.stack.length);
|
|
20
|
-
const metaMap =
|
|
20
|
+
const metaMap = _chunkTZYATAJXjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
21
21
|
const { controller, http, func, tag } = meta2.data;
|
|
22
22
|
if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
|
|
23
23
|
debug(`register method "${func}" in module "${tag}"`);
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
_chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
|
|
28
28
|
plugins: [
|
|
29
29
|
...globalPlugins,
|
|
30
30
|
...parallelPlugins
|
|
@@ -34,25 +34,25 @@ function bind(router, data, opts = {}) {
|
|
|
34
34
|
});
|
|
35
35
|
registerRoute();
|
|
36
36
|
async function registerRoute() {
|
|
37
|
-
|
|
37
|
+
_chunkTZYATAJXjs.Context.usePlugin(globalPlugins, "koa").forEach((p) => router.use(p));
|
|
38
38
|
if (parallelRoute) {
|
|
39
|
-
router.post(parallelRoute, ...
|
|
39
|
+
router.post(parallelRoute, ..._chunkTZYATAJXjs.Context.usePlugin(parallelPlugins, "koa"), async (ctx, next) => {
|
|
40
40
|
const { body } = ctx.request;
|
|
41
41
|
async function errorHandler(e) {
|
|
42
|
-
const error = await
|
|
42
|
+
const error = await _chunkTZYATAJXjs.Context.filterRecord.default(e);
|
|
43
43
|
ctx.status = error.status;
|
|
44
44
|
ctx.body = error;
|
|
45
45
|
}
|
|
46
46
|
_chunkGHFSIZUOjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
47
|
-
if (!Array.isArray(body)) return errorHandler(new (0,
|
|
47
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkTZYATAJXjs.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 _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.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 _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
56
56
|
const { data: { params } } = meta2;
|
|
57
57
|
const contextData = {
|
|
58
58
|
type: "koa",
|
|
@@ -63,7 +63,7 @@ function bind(router, data, opts = {}) {
|
|
|
63
63
|
parallel: true,
|
|
64
64
|
next,
|
|
65
65
|
app: router,
|
|
66
|
-
...
|
|
66
|
+
..._chunkTZYATAJXjs.argToReq.call(void 0, params, item.args, ctx.headers),
|
|
67
67
|
tag,
|
|
68
68
|
func,
|
|
69
69
|
getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => ctx.cookies.get(key), "getCookie"),
|
|
@@ -75,7 +75,7 @@ function bind(router, data, opts = {}) {
|
|
|
75
75
|
setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => ctx.set(headers), "setResHeaders"),
|
|
76
76
|
setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => ctx.status = status, "setResStatus")
|
|
77
77
|
};
|
|
78
|
-
const context = new (0,
|
|
78
|
+
const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
|
|
79
79
|
context.run({
|
|
80
80
|
globalGuards,
|
|
81
81
|
globalInterceptors,
|
|
@@ -96,7 +96,7 @@ function bind(router, data, opts = {}) {
|
|
|
96
96
|
const meta2 = metaMap.get(tag)[func];
|
|
97
97
|
const { data: { plugins, http } } = meta2;
|
|
98
98
|
if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
|
|
99
|
-
router[http.type](http.prefix + http.route, ...
|
|
99
|
+
router[http.type](http.prefix + http.route, ..._chunkTZYATAJXjs.Context.usePlugin(plugins, "koa"), async (ctx, next) => {
|
|
100
100
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
101
101
|
const contextData = {
|
|
102
102
|
type: "koa",
|
|
@@ -120,7 +120,7 @@ function bind(router, data, opts = {}) {
|
|
|
120
120
|
setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => ctx.set(headers), "setResHeaders"),
|
|
121
121
|
setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => ctx.status = status, "setResStatus")
|
|
122
122
|
};
|
|
123
|
-
const context = new (0,
|
|
123
|
+
const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
|
|
124
124
|
if (http.headers) ctx.set(http.headers);
|
|
125
125
|
await context.run({
|
|
126
126
|
globalGuards,
|
|
@@ -140,7 +140,7 @@ function bind(router, data, opts = {}) {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
_chunkGHFSIZUOjs.__name.call(void 0, registerRoute, "registerRoute");
|
|
143
|
-
|
|
143
|
+
_chunkTZYATAJXjs.HMR.call(void 0, async () => {
|
|
144
144
|
router.stack = originStack;
|
|
145
145
|
registerRoute();
|
|
146
146
|
});
|
package/dist/test.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import * as supertest from 'supertest';
|
|
|
2
2
|
import { Test } from 'supertest';
|
|
3
3
|
import { Server } from 'node:http';
|
|
4
4
|
import { Construct } from 'phecda-core';
|
|
5
|
-
import { F as Factory } from './core-
|
|
5
|
+
import { F as Factory } from './core-D2oL8Ge0.mjs';
|
|
6
6
|
import { P as PickFunc } from './types-BlIBlnVT.mjs';
|
|
7
7
|
|
|
8
8
|
declare function TestFactory<T extends Construct[]>(...Modules: T): Promise<{
|
package/dist/test.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as supertest from 'supertest';
|
|
|
2
2
|
import { Test } from 'supertest';
|
|
3
3
|
import { Server } from 'node:http';
|
|
4
4
|
import { Construct } from 'phecda-core';
|
|
5
|
-
import { F as Factory } from './core-
|
|
5
|
+
import { F as Factory } from './core-Blq8frmr.js';
|
|
6
6
|
import { P as PickFunc } from './types-BlIBlnVT.js';
|
|
7
7
|
|
|
8
8
|
declare function TestFactory<T extends Construct[]>(...Modules: T): Promise<{
|
package/dist/test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLYEZ6RGXjs = require('./chunk-LYEZ6RGX.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkGHFSIZUOjs = require('./chunk-GHFSIZUO.js');
|
|
@@ -8,7 +8,7 @@ var _chunkGHFSIZUOjs = require('./chunk-GHFSIZUO.js');
|
|
|
8
8
|
// src/test.ts
|
|
9
9
|
var _phecdacore = require('phecda-core');
|
|
10
10
|
async function TestFactory(...Modules) {
|
|
11
|
-
const { moduleMap, modelMap } = await
|
|
11
|
+
const { moduleMap, modelMap } = await _chunkLYEZ6RGXjs.Factory.call(void 0, Modules);
|
|
12
12
|
return {
|
|
13
13
|
get(Model) {
|
|
14
14
|
const tag = _phecdacore.getTag.call(void 0, Model);
|
package/dist/test.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "server framework that provide IOC/type-reuse/http&rpc-adaptor",
|
|
5
5
|
"author": "fgsreally",
|
|
6
6
|
"license": "MIT",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"picocolors": "^1.0.0",
|
|
147
147
|
"reflect-metadata": "^0.1.13",
|
|
148
148
|
"ts-mixer": "^6.0.4",
|
|
149
|
-
"phecda-core": "
|
|
149
|
+
"phecda-core": "4.0.0"
|
|
150
150
|
},
|
|
151
151
|
"devDependencies": {
|
|
152
152
|
"@koa/router": "^12.0.1",
|