phecda-server 7.0.0-alpha.2 → 7.0.0-alpha.4
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/ps.json +1 -1
- package/assets/schema.json +55 -55
- package/bin/cli.mjs +1 -0
- package/dist/{chunk-NQIFUZL4.js → chunk-6EBEME3I.js} +51 -51
- package/dist/{chunk-XYVMNY2X.mjs → chunk-A53KNKY4.mjs} +1 -1
- package/dist/{chunk-HMVLXNV3.mjs → chunk-KUGFI6SC.mjs} +1 -1
- package/dist/{chunk-3FHZB3Z5.mjs → chunk-MMG73S64.mjs} +1 -1
- package/dist/{chunk-7YQ57BQS.js → chunk-PKSWGQLW.js} +18 -18
- package/dist/{chunk-MBCHNDAY.js → chunk-QCOBXM7F.js} +24 -24
- package/dist/{chunk-WHJ5FALK.mjs → chunk-QD3QR3NW.mjs} +3 -3
- package/dist/{chunk-J5CFUN4V.js → chunk-RQSQRZL4.js} +3 -3
- package/dist/helper.js +3 -3
- package/dist/helper.mjs +2 -2
- package/dist/http/elysia/index.js +40 -40
- package/dist/http/elysia/index.mjs +3 -3
- package/dist/http/express/index.js +37 -37
- package/dist/http/express/index.mjs +2 -2
- package/dist/http/fastify/index.js +38 -38
- package/dist/http/fastify/index.mjs +3 -3
- package/dist/http/h3/index.js +37 -37
- package/dist/http/h3/index.mjs +2 -2
- package/dist/http/hono/index.js +35 -35
- package/dist/http/hono/index.mjs +2 -2
- package/dist/http/hyper-express/index.js +35 -35
- package/dist/http/hyper-express/index.mjs +2 -2
- package/dist/http/koa/index.js +37 -37
- package/dist/http/koa/index.mjs +2 -2
- package/dist/index.js +38 -38
- package/dist/index.mjs +4 -4
- package/dist/rpc/bullmq/index.js +14 -14
- package/dist/rpc/bullmq/index.mjs +2 -2
- package/dist/rpc/kafka/index.js +14 -14
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/nats/index.js +13 -13
- package/dist/rpc/nats/index.mjs +2 -2
- package/dist/rpc/rabbitmq/index.js +15 -15
- package/dist/rpc/rabbitmq/index.mjs +2 -2
- package/dist/rpc/redis/index.js +13 -13
- package/dist/rpc/redis/index.mjs +2 -2
- package/dist/test.d.mts +1 -1
- package/dist/test.d.ts +1 -1
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/package.json +2 -2
- package/register/index.mjs +41 -40
- package/register/loader.mjs +36 -11
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk6EBEME3Ijs = require('../../chunk-6EBEME3I.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkRQSQRZL4js = require('../../chunk-RQSQRZL4.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 = _chunk6EBEME3Ijs.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
|
+
_chunk6EBEME3Ijs.detectAopDep.call(void 0, meta, {
|
|
27
27
|
addons: [
|
|
28
28
|
...globalAddons,
|
|
29
29
|
...parallelAddons
|
|
@@ -32,27 +32,27 @@ function bind(router, data, opts = {}) {
|
|
|
32
32
|
});
|
|
33
33
|
registerRoute();
|
|
34
34
|
async function registerRoute() {
|
|
35
|
-
|
|
35
|
+
_chunk6EBEME3Ijs.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 _chunk6EBEME3Ijs.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
|
+
_chunkRQSQRZL4js.__name.call(void 0, errorHandler, "errorHandler");
|
|
45
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunk6EBEME3Ijs.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
49
|
const { tag, func } = item;
|
|
50
50
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
51
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
51
|
+
if (!metaMap.has(tag)) return resolve(await _chunk6EBEME3Ijs.Context.filterRecord.default(new (0, _chunk6EBEME3Ijs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
52
52
|
const meta2 = metaMap.get(tag)[func];
|
|
53
|
-
if (!meta2) return resolve(await
|
|
53
|
+
if (!meta2) return resolve(await _chunk6EBEME3Ijs.Context.filterRecord.default(new (0, _chunk6EBEME3Ijs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
54
54
|
const { data: { params } } = meta2;
|
|
55
|
-
const aop =
|
|
55
|
+
const aop = _chunk6EBEME3Ijs.Context.getAop(meta2, {
|
|
56
56
|
globalFilter,
|
|
57
57
|
globalGuards,
|
|
58
58
|
globalPipe
|
|
@@ -69,18 +69,18 @@ function bind(router, data, opts = {}) {
|
|
|
69
69
|
tag,
|
|
70
70
|
func,
|
|
71
71
|
app: router,
|
|
72
|
-
...
|
|
72
|
+
..._chunk6EBEME3Ijs.argToReq.call(void 0, params, item.args, req.headers),
|
|
73
73
|
next,
|
|
74
|
-
getCookie: /* @__PURE__ */
|
|
75
|
-
setCookie: /* @__PURE__ */
|
|
76
|
-
delCookie: /* @__PURE__ */
|
|
77
|
-
redirect: /* @__PURE__ */
|
|
78
|
-
setResHeaders: /* @__PURE__ */
|
|
79
|
-
setResStatus: /* @__PURE__ */
|
|
80
|
-
getRequest: /* @__PURE__ */
|
|
81
|
-
getResponse: /* @__PURE__ */
|
|
74
|
+
getCookie: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
|
|
75
|
+
setCookie: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, _optionalChain([opts2, 'optionalAccess', _2 => _2.expires]) && opts2.expires.getTime() - Date.now(), opts2 || {}), "setCookie"),
|
|
76
|
+
delCookie: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
|
|
77
|
+
redirect: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (url) => res.redirect(url), "redirect"),
|
|
78
|
+
setResHeaders: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
|
|
79
|
+
setResStatus: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (code) => res.status(code), "setResStatus"),
|
|
80
|
+
getRequest: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, () => req, "getRequest"),
|
|
81
|
+
getResponse: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, () => res, "getResponse")
|
|
82
82
|
};
|
|
83
|
-
const context = new (0,
|
|
83
|
+
const context = new (0, _chunk6EBEME3Ijs.Context)(contextData);
|
|
84
84
|
context.run(aop, resolve, resolve);
|
|
85
85
|
});
|
|
86
86
|
})).then((ret) => {
|
|
@@ -100,14 +100,14 @@ function bind(router, data, opts = {}) {
|
|
|
100
100
|
const needBody = params.some((item) => item.type === "body");
|
|
101
101
|
let aop;
|
|
102
102
|
if (!dynamic) {
|
|
103
|
-
aop =
|
|
103
|
+
aop = _chunk6EBEME3Ijs.Context.getAop(meta2, {
|
|
104
104
|
globalFilter,
|
|
105
105
|
globalGuards,
|
|
106
106
|
globalPipe
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
const subRouter = new (0, _hyperexpress.Router)();
|
|
110
|
-
|
|
110
|
+
_chunk6EBEME3Ijs.Context.applyAddons(addons, subRouter, "hyper-express");
|
|
111
111
|
subRouter[http.type](http.prefix + http.route, async (req, res, next) => {
|
|
112
112
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
113
113
|
const contextData = {
|
|
@@ -125,21 +125,21 @@ function bind(router, data, opts = {}) {
|
|
|
125
125
|
params: req.path_parameters,
|
|
126
126
|
headers: req.headers,
|
|
127
127
|
next,
|
|
128
|
-
getCookie: /* @__PURE__ */
|
|
129
|
-
setCookie: /* @__PURE__ */
|
|
130
|
-
delCookie: /* @__PURE__ */
|
|
131
|
-
redirect: /* @__PURE__ */
|
|
132
|
-
setResHeaders: /* @__PURE__ */
|
|
133
|
-
setResStatus: /* @__PURE__ */
|
|
134
|
-
getRequest: /* @__PURE__ */
|
|
135
|
-
getResponse: /* @__PURE__ */
|
|
128
|
+
getCookie: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
|
|
129
|
+
setCookie: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, _optionalChain([opts2, 'optionalAccess', _4 => _4.expires]) && opts2.expires.getTime() - Date.now(), opts2 || {}), "setCookie"),
|
|
130
|
+
delCookie: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (key) => res.clearCookie(key), "delCookie"),
|
|
131
|
+
redirect: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (url) => res.redirect(url), "redirect"),
|
|
132
|
+
setResHeaders: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
|
|
133
|
+
setResStatus: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (code) => res.status(code), "setResStatus"),
|
|
134
|
+
getRequest: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, () => req, "getRequest"),
|
|
135
|
+
getResponse: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, () => res, "getResponse")
|
|
136
136
|
};
|
|
137
|
-
const context = new (0,
|
|
137
|
+
const context = new (0, _chunk6EBEME3Ijs.Context)(contextData);
|
|
138
138
|
if (http.headers) {
|
|
139
139
|
for (const name in http.headers) res.set(name, http.headers[name]);
|
|
140
140
|
}
|
|
141
141
|
if (dynamic) {
|
|
142
|
-
aop =
|
|
142
|
+
aop = _chunk6EBEME3Ijs.Context.getAop(meta2, {
|
|
143
143
|
globalFilter,
|
|
144
144
|
globalGuards,
|
|
145
145
|
globalPipe
|
|
@@ -158,9 +158,9 @@ function bind(router, data, opts = {}) {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
|
|
161
|
+
_chunkRQSQRZL4js.__name.call(void 0, registerRoute, "registerRoute");
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
_chunkRQSQRZL4js.__name.call(void 0, bind, "bind");
|
|
164
164
|
|
|
165
165
|
|
|
166
166
|
exports.bind = bind;
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
argToReq,
|
|
5
5
|
createControllerMetaMap,
|
|
6
6
|
detectAopDep
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-MMG73S64.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__name
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-QD3QR3NW.mjs";
|
|
11
11
|
|
|
12
12
|
// src/http/hyper-express/bind.ts
|
|
13
13
|
import { Router } from "hyper-express";
|
package/dist/http/koa/index.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk6EBEME3Ijs = require('../../chunk-6EBEME3I.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkRQSQRZL4js = require('../../chunk-RQSQRZL4.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 = _chunk6EBEME3Ijs.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
|
+
_chunk6EBEME3Ijs.detectAopDep.call(void 0, meta, {
|
|
29
29
|
addons: [
|
|
30
30
|
...globalAddons,
|
|
31
31
|
...parallelAddons
|
|
@@ -34,29 +34,29 @@ function bind(router, data, opts = {}) {
|
|
|
34
34
|
});
|
|
35
35
|
registerRoute();
|
|
36
36
|
function registerRoute() {
|
|
37
|
-
|
|
37
|
+
_chunk6EBEME3Ijs.Context.applyAddons(globalAddons, router, "koa");
|
|
38
38
|
if (parallelRoute) {
|
|
39
39
|
const subRouter = new (0, _router2.default)();
|
|
40
|
-
|
|
40
|
+
_chunk6EBEME3Ijs.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 _chunk6EBEME3Ijs.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
|
+
_chunkRQSQRZL4js.__name.call(void 0, errorHandler, "errorHandler");
|
|
49
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunk6EBEME3Ijs.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
53
|
const { tag, func } = item;
|
|
54
54
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
55
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
55
|
+
if (!metaMap.has(tag)) return resolve(await _chunk6EBEME3Ijs.Context.filterRecord.default(new (0, _chunk6EBEME3Ijs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
56
56
|
const meta2 = metaMap.get(tag)[func];
|
|
57
|
-
if (!meta2) return resolve(await
|
|
57
|
+
if (!meta2) return resolve(await _chunk6EBEME3Ijs.Context.filterRecord.default(new (0, _chunk6EBEME3Ijs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
58
58
|
const { data: { params } } = meta2;
|
|
59
|
-
const aop =
|
|
59
|
+
const aop = _chunk6EBEME3Ijs.Context.getAop(meta2, {
|
|
60
60
|
globalGuards,
|
|
61
61
|
globalFilter,
|
|
62
62
|
globalPipe
|
|
@@ -71,21 +71,21 @@ function bind(router, data, opts = {}) {
|
|
|
71
71
|
parallel: true,
|
|
72
72
|
next,
|
|
73
73
|
app: router,
|
|
74
|
-
...
|
|
74
|
+
..._chunk6EBEME3Ijs.argToReq.call(void 0, params, item.args, ctx.headers),
|
|
75
75
|
tag,
|
|
76
76
|
func,
|
|
77
|
-
getCookie: /* @__PURE__ */
|
|
78
|
-
setCookie: /* @__PURE__ */
|
|
79
|
-
delCookie: /* @__PURE__ */
|
|
77
|
+
getCookie: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (key) => ctx.cookies.get(key), "getCookie"),
|
|
78
|
+
setCookie: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (key, value, opts2) => ctx.cookies.set(key, value, opts2), "setCookie"),
|
|
79
|
+
delCookie: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (key) => ctx.cookies.set(key, "", {
|
|
80
80
|
expires: /* @__PURE__ */ new Date(0)
|
|
81
81
|
}), "delCookie"),
|
|
82
|
-
redirect: /* @__PURE__ */
|
|
83
|
-
setResHeaders: /* @__PURE__ */
|
|
84
|
-
setResStatus: /* @__PURE__ */
|
|
85
|
-
getRequest: /* @__PURE__ */
|
|
86
|
-
getResponse: /* @__PURE__ */
|
|
82
|
+
redirect: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (url) => ctx.redirect(url), "redirect"),
|
|
83
|
+
setResHeaders: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (headers) => ctx.set(headers), "setResHeaders"),
|
|
84
|
+
setResStatus: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (status) => ctx.status = status, "setResStatus"),
|
|
85
|
+
getRequest: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, () => ctx.req, "getRequest"),
|
|
86
|
+
getResponse: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, () => ctx.res, "getResponse")
|
|
87
87
|
};
|
|
88
|
-
const context = new (0,
|
|
88
|
+
const context = new (0, _chunk6EBEME3Ijs.Context)(contextData);
|
|
89
89
|
context.run(aop, resolve, resolve);
|
|
90
90
|
});
|
|
91
91
|
})).then((ret) => {
|
|
@@ -104,14 +104,14 @@ function bind(router, data, opts = {}) {
|
|
|
104
104
|
if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
|
|
105
105
|
let aop;
|
|
106
106
|
if (!dynamic) {
|
|
107
|
-
aop =
|
|
107
|
+
aop = _chunk6EBEME3Ijs.Context.getAop(meta2, {
|
|
108
108
|
globalFilter,
|
|
109
109
|
globalGuards,
|
|
110
110
|
globalPipe
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
const subRouter = new (0, _router2.default)();
|
|
114
|
-
|
|
114
|
+
_chunk6EBEME3Ijs.Context.applyAddons(addons, subRouter, "koa");
|
|
115
115
|
router[http.type](http.prefix + http.route, async (ctx, next) => {
|
|
116
116
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
117
117
|
const contextData = {
|
|
@@ -128,21 +128,21 @@ function bind(router, data, opts = {}) {
|
|
|
128
128
|
body: ctx.request.body,
|
|
129
129
|
headers: ctx.headers,
|
|
130
130
|
next,
|
|
131
|
-
getCookie: /* @__PURE__ */
|
|
132
|
-
setCookie: /* @__PURE__ */
|
|
133
|
-
delCookie: /* @__PURE__ */
|
|
131
|
+
getCookie: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (key) => ctx.cookies.get(key), "getCookie"),
|
|
132
|
+
setCookie: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (key, value, opts2) => ctx.cookies.set(key, value, opts2), "setCookie"),
|
|
133
|
+
delCookie: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (key) => ctx.cookies.set(key, "", {
|
|
134
134
|
expires: /* @__PURE__ */ new Date(0)
|
|
135
135
|
}), "delCookie"),
|
|
136
|
-
redirect: /* @__PURE__ */
|
|
137
|
-
setResHeaders: /* @__PURE__ */
|
|
138
|
-
setResStatus: /* @__PURE__ */
|
|
139
|
-
getRequest: /* @__PURE__ */
|
|
140
|
-
getResponse: /* @__PURE__ */
|
|
136
|
+
redirect: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (url) => ctx.redirect(url), "redirect"),
|
|
137
|
+
setResHeaders: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (headers) => ctx.set(headers), "setResHeaders"),
|
|
138
|
+
setResStatus: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (status) => ctx.status = status, "setResStatus"),
|
|
139
|
+
getRequest: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, () => ctx.req, "getRequest"),
|
|
140
|
+
getResponse: /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, () => ctx.res, "getResponse")
|
|
141
141
|
};
|
|
142
|
-
const context = new (0,
|
|
142
|
+
const context = new (0, _chunk6EBEME3Ijs.Context)(contextData);
|
|
143
143
|
if (http.headers) ctx.set(http.headers);
|
|
144
144
|
if (dynamic) {
|
|
145
|
-
aop =
|
|
145
|
+
aop = _chunk6EBEME3Ijs.Context.getAop(meta2, {
|
|
146
146
|
globalFilter,
|
|
147
147
|
globalGuards,
|
|
148
148
|
globalPipe
|
|
@@ -161,13 +161,13 @@ function bind(router, data, opts = {}) {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
_chunkRQSQRZL4js.__name.call(void 0, registerRoute, "registerRoute");
|
|
165
|
+
_chunk6EBEME3Ijs.HMR.call(void 0, async () => {
|
|
166
166
|
router.stack = originStack;
|
|
167
167
|
registerRoute();
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
_chunkRQSQRZL4js.__name.call(void 0, bind, "bind");
|
|
171
171
|
|
|
172
172
|
|
|
173
173
|
exports.bind = bind;
|
package/dist/http/koa/index.mjs
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
argToReq,
|
|
6
6
|
createControllerMetaMap,
|
|
7
7
|
detectAopDep
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-MMG73S64.mjs";
|
|
9
9
|
import {
|
|
10
10
|
__name
|
|
11
|
-
} from "../../chunk-
|
|
11
|
+
} from "../../chunk-QD3QR3NW.mjs";
|
|
12
12
|
|
|
13
13
|
// src/http/koa/bind.ts
|
|
14
14
|
import Router from "@koa/router";
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkPKSWGQLWjs = require('./chunk-PKSWGQLW.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -31,7 +31,7 @@ var _chunk7YQ57BQSjs = require('./chunk-7YQ57BQS.js');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _chunkQCOBXM7Fjs = require('./chunk-QCOBXM7F.js');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
@@ -56,7 +56,7 @@ var _chunkMBCHNDAYjs = require('./chunk-MBCHNDAY.js');
|
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
var
|
|
59
|
+
var _chunk6EBEME3Ijs = require('./chunk-6EBEME3I.js');
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
@@ -70,13 +70,13 @@ var _chunkNQIFUZL4js = require('./chunk-NQIFUZL4.js');
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
var
|
|
73
|
+
var _chunkRQSQRZL4js = require('./chunk-RQSQRZL4.js');
|
|
74
74
|
|
|
75
75
|
// src/types.ts
|
|
76
76
|
var ResponseSymbol = Symbol("response");
|
|
77
77
|
var CustomResponse = class {
|
|
78
78
|
static {
|
|
79
|
-
|
|
79
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "CustomResponse");
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
};
|
|
@@ -89,35 +89,35 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
89
89
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
90
90
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
_chunkRQSQRZL4js.__name.call(void 0, _ts_decorate, "_ts_decorate");
|
|
93
93
|
function _ts_metadata(k, v) {
|
|
94
94
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
_chunkRQSQRZL4js.__name.call(void 0, _ts_metadata, "_ts_metadata");
|
|
97
97
|
var ServerBase = (_class = class extends _phecdacore.Base {constructor(...args2) { super(...args2); _class.prototype.__init.call(this); }
|
|
98
98
|
static {
|
|
99
|
-
|
|
99
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "ServerBase");
|
|
100
100
|
}
|
|
101
|
-
__init() {this.emitter = exports.emitter =
|
|
101
|
+
__init() {this.emitter = exports.emitter = _chunkPKSWGQLWjs.emitter}
|
|
102
102
|
}, _class);
|
|
103
103
|
var HttpBase = class extends ServerBase {
|
|
104
104
|
static {
|
|
105
|
-
|
|
105
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "HttpBase");
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
};
|
|
109
109
|
_ts_decorate([
|
|
110
|
-
|
|
110
|
+
_chunkQCOBXM7Fjs.Ctx,
|
|
111
111
|
_ts_metadata("design:type", typeof HttpContext === "undefined" ? Object : HttpContext)
|
|
112
112
|
], HttpBase.prototype, "context", void 0);
|
|
113
113
|
var RpcBase = class extends ServerBase {
|
|
114
114
|
static {
|
|
115
|
-
|
|
115
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "RpcBase");
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
};
|
|
119
119
|
_ts_decorate([
|
|
120
|
-
|
|
120
|
+
_chunkQCOBXM7Fjs.Ctx,
|
|
121
121
|
_ts_metadata("design:type", typeof RpcContext === "undefined" ? Object : RpcContext)
|
|
122
122
|
], RpcBase.prototype, "context", void 0);
|
|
123
123
|
|
|
@@ -125,15 +125,15 @@ _ts_decorate([
|
|
|
125
125
|
|
|
126
126
|
var PFilter = class extends ServerBase {
|
|
127
127
|
static {
|
|
128
|
-
|
|
128
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "PFilter");
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
constructor(tag) {
|
|
132
132
|
super();
|
|
133
133
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
134
|
-
|
|
134
|
+
_chunk6EBEME3Ijs.addFilter.call(void 0, this.key, this.use.bind(this));
|
|
135
135
|
this.onUnmount(() => {
|
|
136
|
-
delete
|
|
136
|
+
delete _chunk6EBEME3Ijs.Context.filterRecord[this.key];
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
};
|
|
@@ -142,16 +142,16 @@ var PFilter = class extends ServerBase {
|
|
|
142
142
|
|
|
143
143
|
var PGuard = (_class2 = class extends ServerBase {
|
|
144
144
|
static {
|
|
145
|
-
|
|
145
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "PGuard");
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
__init2() {this.priority = 0}
|
|
149
149
|
constructor(tag) {
|
|
150
150
|
super();_class2.prototype.__init2.call(this);;
|
|
151
151
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
152
|
-
|
|
152
|
+
_chunk6EBEME3Ijs.addGuard.call(void 0, this.key, this.use.bind(this), this.priority);
|
|
153
153
|
this.onUnmount(() => {
|
|
154
|
-
delete
|
|
154
|
+
delete _chunk6EBEME3Ijs.Context.guardRecord[this.key];
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
}, _class2);
|
|
@@ -160,15 +160,15 @@ var PGuard = (_class2 = class extends ServerBase {
|
|
|
160
160
|
|
|
161
161
|
var PPipe = class extends ServerBase {
|
|
162
162
|
static {
|
|
163
|
-
|
|
163
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "PPipe");
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
constructor(tag) {
|
|
167
167
|
super();
|
|
168
168
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
169
|
-
|
|
169
|
+
_chunk6EBEME3Ijs.addPipe.call(void 0, this.key, this.use.bind(this));
|
|
170
170
|
this.onUnmount(() => {
|
|
171
|
-
delete
|
|
171
|
+
delete _chunk6EBEME3Ijs.Context.pipeRecord[this.key];
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
};
|
|
@@ -177,16 +177,16 @@ var PPipe = class extends ServerBase {
|
|
|
177
177
|
|
|
178
178
|
var PAddon = (_class3 = class extends ServerBase {
|
|
179
179
|
static {
|
|
180
|
-
|
|
180
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "PAddon");
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
__init3() {this.priority = 0}
|
|
184
184
|
constructor(tag) {
|
|
185
185
|
super();_class3.prototype.__init3.call(this);;
|
|
186
186
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
187
|
-
|
|
187
|
+
_chunk6EBEME3Ijs.addAddon.call(void 0, this.key, this.use.bind(this), this.priority);
|
|
188
188
|
this.onUnmount(() => {
|
|
189
|
-
delete
|
|
189
|
+
delete _chunk6EBEME3Ijs.Context.addonRecord[this.key];
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
}, _class3);
|
|
@@ -195,7 +195,7 @@ var PAddon = (_class3 = class extends ServerBase {
|
|
|
195
195
|
|
|
196
196
|
var PExtension = class extends ServerBase {
|
|
197
197
|
static {
|
|
198
|
-
|
|
198
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "PExtension");
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
|
|
@@ -204,27 +204,27 @@ var PExtension = class extends ServerBase {
|
|
|
204
204
|
super();
|
|
205
205
|
const key = this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
206
206
|
if (this.pipe) {
|
|
207
|
-
|
|
207
|
+
_chunk6EBEME3Ijs.addPipe.call(void 0, key, this.pipe.bind(this));
|
|
208
208
|
this.onUnmount(() => {
|
|
209
|
-
delete
|
|
209
|
+
delete _chunk6EBEME3Ijs.Context.pipeRecord[key];
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
212
|
if (this.addon) {
|
|
213
|
-
|
|
213
|
+
_chunk6EBEME3Ijs.addAddon.call(void 0, key, this.addon.bind(this), this.addonPriority);
|
|
214
214
|
this.onUnmount(() => {
|
|
215
|
-
delete
|
|
215
|
+
delete _chunk6EBEME3Ijs.Context.addonRecord[key];
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
218
|
if (this.guard) {
|
|
219
|
-
|
|
219
|
+
_chunk6EBEME3Ijs.addGuard.call(void 0, key, this.guard.bind(this), this.guardPriority);
|
|
220
220
|
this.onUnmount(() => {
|
|
221
|
-
delete
|
|
221
|
+
delete _chunk6EBEME3Ijs.Context.guardRecord[key];
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
if (this.filter) {
|
|
225
|
-
|
|
225
|
+
_chunk6EBEME3Ijs.addFilter.call(void 0, key, this.filter.bind(this));
|
|
226
226
|
this.onUnmount(() => {
|
|
227
|
-
delete
|
|
227
|
+
delete _chunk6EBEME3Ijs.Context.filterRecord[key];
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
}
|
|
@@ -234,7 +234,7 @@ var PExtension = class extends ServerBase {
|
|
|
234
234
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
235
235
|
var Generator = class {
|
|
236
236
|
static {
|
|
237
|
-
|
|
237
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "Generator");
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
constructor(path) {
|
|
@@ -251,7 +251,7 @@ var Generator = class {
|
|
|
251
251
|
// src/generator/rpc.ts
|
|
252
252
|
var RPCGenerator = (_class4 = class extends Generator {constructor(...args3) { super(...args3); _class4.prototype.__init4.call(this);_class4.prototype.__init5.call(this); }
|
|
253
253
|
static {
|
|
254
|
-
|
|
254
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "RPCGenerator");
|
|
255
255
|
}
|
|
256
256
|
__init4() {this.name = "RPC"}
|
|
257
257
|
__init5() {this.classMap = {}}
|
|
@@ -287,7 +287,7 @@ var RPCGenerator = (_class4 = class extends Generator {constructor(...args3) { s
|
|
|
287
287
|
// src/generator/http.ts
|
|
288
288
|
var HTTPGenerator = (_class5 = class extends Generator {constructor(...args4) { super(...args4); _class5.prototype.__init6.call(this);_class5.prototype.__init7.call(this); }
|
|
289
289
|
static {
|
|
290
|
-
|
|
290
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "HTTPGenerator");
|
|
291
291
|
}
|
|
292
292
|
__init6() {this.name = "HTTP"}
|
|
293
293
|
__init7() {this.classMap = {}}
|
|
@@ -404,4 +404,4 @@ return ret
|
|
|
404
404
|
|
|
405
405
|
|
|
406
406
|
|
|
407
|
-
exports.Addon =
|
|
407
|
+
exports.Addon = _chunkQCOBXM7Fjs.Addon; exports.Arg = _chunkQCOBXM7Fjs.Arg; exports.BadGatewayException = _chunk6EBEME3Ijs.BadGatewayException; exports.BadRequestException = _chunk6EBEME3Ijs.BadRequestException; exports.BaseParam = _chunkQCOBXM7Fjs.BaseParam; exports.Body = _chunkQCOBXM7Fjs.Body; exports.ConflictException = _chunk6EBEME3Ijs.ConflictException; exports.Context = _chunk6EBEME3Ijs.Context; exports.Controller = _chunkQCOBXM7Fjs.Controller; exports.Ctx = _chunkQCOBXM7Fjs.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkQCOBXM7Fjs.Define; exports.Delete = _chunkQCOBXM7Fjs.Delete; exports.ERROR_SYMBOL = _chunkRQSQRZL4js.ERROR_SYMBOL; exports.Exception = _chunk6EBEME3Ijs.Exception; exports.Factory = _chunkPKSWGQLWjs.Factory; exports.Filter = _chunkQCOBXM7Fjs.Filter; exports.ForbiddenException = _chunk6EBEME3Ijs.ForbiddenException; exports.FrameworkException = _chunk6EBEME3Ijs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkQCOBXM7Fjs.Get; exports.Guard = _chunkQCOBXM7Fjs.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkQCOBXM7Fjs.Head; exports.Header = _chunkQCOBXM7Fjs.Header; exports.HttpBase = HttpBase; exports.IS_HMR = _chunkRQSQRZL4js.IS_HMR; exports.IS_ONLY_GENERATE = _chunkRQSQRZL4js.IS_ONLY_GENERATE; exports.IS_STRICT = _chunkRQSQRZL4js.IS_STRICT; exports.InvalidInputException = _chunk6EBEME3Ijs.InvalidInputException; exports.LOG_LEVEL = _chunkRQSQRZL4js.LOG_LEVEL; exports.Meta = _chunkPKSWGQLWjs.Meta; exports.Mixin = _chunkRQSQRZL4js.Mixin; exports.NotFoundException = _chunk6EBEME3Ijs.NotFoundException; exports.PAddon = PAddon; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PPipe = PPipe; exports.PS_EXIT_CODE = _chunkRQSQRZL4js.PS_EXIT_CODE; exports.Param = _chunkQCOBXM7Fjs.Param; exports.Patch = _chunkQCOBXM7Fjs.Patch; exports.PayloadLargeException = _chunk6EBEME3Ijs.PayloadLargeException; exports.Pipe = _chunkQCOBXM7Fjs.Pipe; exports.Post = _chunkQCOBXM7Fjs.Post; exports.Put = _chunkQCOBXM7Fjs.Put; exports.Query = _chunkQCOBXM7Fjs.Query; exports.Queue = _chunkQCOBXM7Fjs.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkQCOBXM7Fjs.Route; exports.Rpc = _chunkQCOBXM7Fjs.Rpc; exports.RpcBase = RpcBase; exports.Search = _chunkQCOBXM7Fjs.Search; exports.ServerBase = ServerBase; exports.ServerPhecda = _chunkPKSWGQLWjs.ServerPhecda; exports.ServiceUnavailableException = _chunk6EBEME3Ijs.ServiceUnavailableException; exports.TimeoutException = _chunk6EBEME3Ijs.TimeoutException; exports.TimerException = _chunk6EBEME3Ijs.TimerException; exports.UnauthorizedException = _chunk6EBEME3Ijs.UnauthorizedException; exports.UndefinedException = _chunk6EBEME3Ijs.UndefinedException; exports.UnsupportedMediaTypeException = _chunk6EBEME3Ijs.UnsupportedMediaTypeException; exports.ValidateException = _chunk6EBEME3Ijs.ValidateException; exports.WorkerException = _chunk6EBEME3Ijs.WorkerException; exports.addAddon = _chunk6EBEME3Ijs.addAddon; exports.addFilter = _chunk6EBEME3Ijs.addFilter; exports.addGuard = _chunk6EBEME3Ijs.addGuard; exports.addPipe = _chunk6EBEME3Ijs.addPipe; exports.defaultPipe = _chunk6EBEME3Ijs.defaultPipe; exports.defaultServerInject = _chunkPKSWGQLWjs.defaultServerInject; exports.emitter = _chunkPKSWGQLWjs.emitter; exports.getLogger = _chunkRQSQRZL4js.getLogger; exports.log = _chunkRQSQRZL4js.log; exports.phecdaNamespace = _chunkPKSWGQLWjs.phecdaNamespace; exports.runMiddleware = _chunkRQSQRZL4js.runMiddleware; exports.setLogger = _chunkRQSQRZL4js.setLogger; exports.useS = _chunkPKSWGQLWjs.useS;
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
emitter,
|
|
7
7
|
phecdaNamespace,
|
|
8
8
|
useS
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-A53KNKY4.mjs";
|
|
10
10
|
import {
|
|
11
11
|
Addon,
|
|
12
12
|
Arg,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
Route,
|
|
32
32
|
Rpc,
|
|
33
33
|
Search
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-KUGFI6SC.mjs";
|
|
35
35
|
import {
|
|
36
36
|
BadGatewayException,
|
|
37
37
|
BadRequestException,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
addGuard,
|
|
57
57
|
addPipe,
|
|
58
58
|
defaultPipe
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-MMG73S64.mjs";
|
|
60
60
|
import {
|
|
61
61
|
ERROR_SYMBOL,
|
|
62
62
|
IS_HMR,
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
log,
|
|
71
71
|
runMiddleware,
|
|
72
72
|
setLogger
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-QD3QR3NW.mjs";
|
|
74
74
|
|
|
75
75
|
// src/types.ts
|
|
76
76
|
var ResponseSymbol = Symbol("response");
|