phecda-server 8.2.0 → 8.3.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/dist/{chunk-MPKVT4SQ.js → chunk-R73A7HS3.js} +35 -34
- package/dist/{chunk-2P2UICBC.mjs → chunk-US2DTB3Z.mjs} +35 -34
- package/dist/{core-D1YYphEn.d.mts → core-mOKtuP0F.d.mts} +1 -1
- package/dist/{core-BTSHIAyB.d.ts → core-qL97H3d_.d.ts} +1 -1
- package/dist/helper.d.mts +1 -1
- package/dist/helper.d.ts +1 -1
- package/dist/helper.js +2 -2
- package/dist/helper.mjs +1 -1
- package/dist/http/elysia/index.d.mts +3 -3
- package/dist/http/elysia/index.d.ts +3 -3
- package/dist/http/elysia/index.js +17 -17
- package/dist/http/elysia/index.mjs +1 -1
- package/dist/http/express/index.d.mts +3 -3
- package/dist/http/express/index.d.ts +3 -3
- package/dist/http/express/index.js +16 -16
- package/dist/http/express/index.mjs +1 -1
- package/dist/http/fastify/index.d.mts +3 -3
- package/dist/http/fastify/index.d.ts +3 -3
- package/dist/http/fastify/index.js +16 -16
- package/dist/http/fastify/index.mjs +1 -1
- package/dist/http/h3/index.d.mts +3 -3
- package/dist/http/h3/index.d.ts +3 -3
- package/dist/http/h3/index.js +17 -17
- package/dist/http/h3/index.mjs +1 -1
- package/dist/http/hono/index.d.mts +3 -3
- package/dist/http/hono/index.d.ts +3 -3
- package/dist/http/hono/index.js +14 -14
- package/dist/http/hono/index.mjs +1 -1
- 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 +15 -15
- package/dist/http/hyper-express/index.mjs +1 -1
- package/dist/http/koa/index.d.mts +3 -3
- package/dist/http/koa/index.d.ts +3 -3
- package/dist/http/koa/index.js +16 -16
- package/dist/http/koa/index.mjs +1 -1
- package/dist/index.d.mts +29 -28
- package/dist/index.d.ts +29 -28
- package/dist/index.js +20 -20
- package/dist/index.mjs +1 -1
- package/dist/{meta-DNF6Fl27.d.mts → meta-EGS-4cNY.d.mts} +1 -1
- package/dist/{meta-DNF6Fl27.d.ts → meta-EGS-4cNY.d.ts} +1 -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 +6 -6
- package/dist/rpc/bullmq/index.mjs +1 -1
- package/dist/rpc/electron/index.d.mts +3 -3
- package/dist/rpc/electron/index.d.ts +3 -3
- package/dist/rpc/electron/index.js +5 -5
- package/dist/rpc/electron/index.mjs +1 -1
- package/dist/rpc/kafka/index.d.mts +3 -3
- package/dist/rpc/kafka/index.d.ts +3 -3
- package/dist/rpc/kafka/index.js +6 -6
- package/dist/rpc/kafka/index.mjs +1 -1
- package/dist/rpc/nats/index.d.mts +3 -3
- package/dist/rpc/nats/index.d.ts +3 -3
- package/dist/rpc/nats/index.js +6 -6
- package/dist/rpc/nats/index.mjs +1 -1
- package/dist/rpc/rabbitmq/index.d.mts +3 -3
- package/dist/rpc/rabbitmq/index.d.ts +3 -3
- package/dist/rpc/rabbitmq/index.js +6 -6
- package/dist/rpc/rabbitmq/index.mjs +1 -1
- package/dist/rpc/redis/index.d.mts +3 -3
- package/dist/rpc/redis/index.d.ts +3 -3
- package/dist/rpc/redis/index.js +6 -6
- package/dist/rpc/redis/index.mjs +1 -1
- package/dist/rpc/ws/index.d.mts +3 -3
- package/dist/rpc/ws/index.d.ts +3 -3
- package/dist/rpc/ws/index.js +5 -5
- package/dist/rpc/ws/index.mjs +1 -1
- package/dist/test.d.mts +2 -2
- package/dist/test.d.ts +2 -2
- package/dist/{types-DtiHAXQB.d.mts → types-BkU6kQWV.d.mts} +1 -1
- package/dist/{types-BOZ8yE2L.d.mts → types-CoOCYe_X.d.mts} +1 -1
- package/dist/{types-Cosv4nol.d.ts → types-DGUpAXle.d.ts} +1 -1
- package/dist/{types-YJ55P7A_.d.ts → types-NkRE3d35.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkR73A7HS3js = require('../../chunk-R73A7HS3.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkOUQM7GZHjs = require('../../chunk-OUQM7GZH.js');
|
|
@@ -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 = _chunkR73A7HS3js.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
20
20
|
const { controller, http, method, tag } = meta2.data;
|
|
21
21
|
if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.method])) {
|
|
22
22
|
debug(`register method "${method}" in module "${tag}"`);
|
|
23
23
|
return true;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
|
|
26
|
+
_chunkR73A7HS3js.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
|
+
_chunkR73A7HS3js.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 _chunkR73A7HS3js.Context.filterRecord.default(e);
|
|
42
42
|
return res.status(error.status).json(error);
|
|
43
43
|
}
|
|
44
44
|
_chunkOUQM7GZHjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
45
|
-
if (!Array.isArray(body)) return errorHandler(new (0,
|
|
45
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkR73A7HS3js.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
|
if (!item) return resolve(null);
|
|
50
50
|
const { tag, method } = item;
|
|
51
51
|
debug(`(parallel)invoke method "${method}" in module "${tag}"`);
|
|
52
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
52
|
+
if (!metaMap.has(tag)) return resolve(await _chunkR73A7HS3js.Context.filterRecord.default(new (0, _chunkR73A7HS3js.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
53
53
|
const meta2 = metaMap.get(tag)[method];
|
|
54
|
-
if (!meta2) return resolve(await
|
|
55
|
-
const aop =
|
|
54
|
+
if (!meta2) return resolve(await _chunkR73A7HS3js.Context.filterRecord.default(new (0, _chunkR73A7HS3js.BadRequestException)(`"${method}" in "${tag}" doesn't exist`)));
|
|
55
|
+
const aop = _chunkR73A7HS3js.Context.getAop(meta2, {
|
|
56
56
|
globalFilter,
|
|
57
57
|
globalGuards,
|
|
58
58
|
globalPipe
|
|
@@ -78,7 +78,7 @@ function bind(router, data, opts = {}) {
|
|
|
78
78
|
getRequest: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, () => req, "getRequest"),
|
|
79
79
|
getResponse: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, () => res, "getResponse")
|
|
80
80
|
};
|
|
81
|
-
const context = new (0,
|
|
81
|
+
const context = new (0, _chunkR73A7HS3js.Context)(contextData);
|
|
82
82
|
context.run(aop, resolve, resolve);
|
|
83
83
|
});
|
|
84
84
|
})).then((ret) => {
|
|
@@ -98,15 +98,15 @@ function bind(router, data, opts = {}) {
|
|
|
98
98
|
const needBody = params.some((item) => item.type === "body");
|
|
99
99
|
let aop;
|
|
100
100
|
if (!dynamic) {
|
|
101
|
-
aop =
|
|
101
|
+
aop = _chunkR73A7HS3js.Context.getAop(meta2, {
|
|
102
102
|
globalFilter,
|
|
103
103
|
globalGuards,
|
|
104
104
|
globalPipe
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
const subRouter = new (0, _hyperexpress.Router)();
|
|
108
|
-
|
|
109
|
-
subRouter[http.method](
|
|
108
|
+
_chunkR73A7HS3js.Context.applyAddons(addons, subRouter, "hyper-express");
|
|
109
|
+
subRouter[http.method](_chunkR73A7HS3js.joinUrl.call(void 0, http.prefix, http.route), async (req, res, next) => {
|
|
110
110
|
debug(`invoke method "${method}" in module "${tag}"`);
|
|
111
111
|
const contextData = {
|
|
112
112
|
type: "hyper-express",
|
|
@@ -132,12 +132,12 @@ function bind(router, data, opts = {}) {
|
|
|
132
132
|
getRequest: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, () => req, "getRequest"),
|
|
133
133
|
getResponse: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, () => res, "getResponse")
|
|
134
134
|
};
|
|
135
|
-
const context = new (0,
|
|
135
|
+
const context = new (0, _chunkR73A7HS3js.Context)(contextData);
|
|
136
136
|
if (http.headers) {
|
|
137
137
|
for (const name in http.headers) res.set(name, http.headers[name]);
|
|
138
138
|
}
|
|
139
139
|
if (dynamic) {
|
|
140
|
-
aop =
|
|
140
|
+
aop = _chunkR73A7HS3js.Context.getAop(meta2, {
|
|
141
141
|
globalFilter,
|
|
142
142
|
globalGuards,
|
|
143
143
|
globalPipe
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Router, { RouterParamContext } from '@koa/router';
|
|
2
2
|
import { DefaultContext, DefaultState } from 'koa';
|
|
3
|
-
import { H as HttpCtx, a as HttpOptions } from '../../types-
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-BkU6kQWV.mjs';
|
|
4
|
+
import { F as Factory } from '../../core-mOKtuP0F.mjs';
|
|
5
5
|
import 'node:http';
|
|
6
|
-
import '../../meta-
|
|
6
|
+
import '../../meta-EGS-4cNY.mjs';
|
|
7
7
|
import 'phecda-core';
|
|
8
8
|
|
|
9
9
|
interface KoaCtx extends HttpCtx {
|
package/dist/http/koa/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Router, { RouterParamContext } from '@koa/router';
|
|
2
2
|
import { DefaultContext, DefaultState } from 'koa';
|
|
3
|
-
import { H as HttpCtx, a as HttpOptions } from '../../types-
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-DGUpAXle.js';
|
|
4
|
+
import { F as Factory } from '../../core-qL97H3d_.js';
|
|
5
5
|
import 'node:http';
|
|
6
|
-
import '../../meta-
|
|
6
|
+
import '../../meta-EGS-4cNY.js';
|
|
7
7
|
import 'phecda-core';
|
|
8
8
|
|
|
9
9
|
interface KoaCtx extends HttpCtx {
|
package/dist/http/koa/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkR73A7HS3js = require('../../chunk-R73A7HS3.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -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 = _chunkR73A7HS3js.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
22
22
|
const { controller, http, method, tag } = meta2.data;
|
|
23
23
|
if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.method])) {
|
|
24
24
|
debug(`register method "${method}" in module "${tag}"`);
|
|
25
25
|
return true;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
|
|
28
|
+
_chunkR73A7HS3js.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
|
+
_chunkR73A7HS3js.Context.applyAddons(globalAddons, router, "koa");
|
|
38
38
|
if (parallelRoute) {
|
|
39
39
|
const subRouter = new (0, _router2.default)();
|
|
40
|
-
|
|
40
|
+
_chunkR73A7HS3js.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 _chunkR73A7HS3js.Context.filterRecord.default(e);
|
|
45
45
|
ctx.status = error.status;
|
|
46
46
|
ctx.body = error;
|
|
47
47
|
}
|
|
48
48
|
_chunkOUQM7GZHjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
49
|
-
if (!Array.isArray(body)) return errorHandler(new (0,
|
|
49
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkR73A7HS3js.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
|
if (!item) return resolve(null);
|
|
54
54
|
const { tag, method } = item;
|
|
55
55
|
debug(`(parallel)invoke method "${method}" in module "${tag}"`);
|
|
56
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
56
|
+
if (!metaMap.has(tag)) return resolve(await _chunkR73A7HS3js.Context.filterRecord.default(new (0, _chunkR73A7HS3js.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
57
57
|
const meta2 = metaMap.get(tag)[method];
|
|
58
|
-
if (!meta2) return resolve(await
|
|
59
|
-
const aop =
|
|
58
|
+
if (!meta2) return resolve(await _chunkR73A7HS3js.Context.filterRecord.default(new (0, _chunkR73A7HS3js.BadRequestException)(`"${method}" in "${tag}" doesn't exist`)));
|
|
59
|
+
const aop = _chunkR73A7HS3js.Context.getAop(meta2, {
|
|
60
60
|
globalGuards,
|
|
61
61
|
globalFilter,
|
|
62
62
|
globalPipe
|
|
@@ -83,7 +83,7 @@ function bind(router, data, opts = {}) {
|
|
|
83
83
|
getRequest: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, () => ctx.req, "getRequest"),
|
|
84
84
|
getResponse: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, () => ctx.res, "getResponse")
|
|
85
85
|
};
|
|
86
|
-
const context = new (0,
|
|
86
|
+
const context = new (0, _chunkR73A7HS3js.Context)(contextData);
|
|
87
87
|
context.run(aop, resolve, resolve);
|
|
88
88
|
});
|
|
89
89
|
})).then((ret) => {
|
|
@@ -102,15 +102,15 @@ function bind(router, data, opts = {}) {
|
|
|
102
102
|
if (!_optionalChain([http, 'optionalAccess', _2 => _2.method])) continue;
|
|
103
103
|
let aop;
|
|
104
104
|
if (!dynamic) {
|
|
105
|
-
aop =
|
|
105
|
+
aop = _chunkR73A7HS3js.Context.getAop(meta2, {
|
|
106
106
|
globalFilter,
|
|
107
107
|
globalGuards,
|
|
108
108
|
globalPipe
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
const subRouter = new (0, _router2.default)();
|
|
112
|
-
|
|
113
|
-
router[http.method](
|
|
112
|
+
_chunkR73A7HS3js.Context.applyAddons(addons, subRouter, "koa");
|
|
113
|
+
router[http.method](_chunkR73A7HS3js.joinUrl.call(void 0, http.prefix, http.route), async (ctx, next) => {
|
|
114
114
|
debug(`invoke method "${method}" in module "${tag}"`);
|
|
115
115
|
const contextData = {
|
|
116
116
|
type: "koa",
|
|
@@ -137,10 +137,10 @@ function bind(router, data, opts = {}) {
|
|
|
137
137
|
getRequest: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, () => ctx.req, "getRequest"),
|
|
138
138
|
getResponse: /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, () => ctx.res, "getResponse")
|
|
139
139
|
};
|
|
140
|
-
const context = new (0,
|
|
140
|
+
const context = new (0, _chunkR73A7HS3js.Context)(contextData);
|
|
141
141
|
if (http.headers) ctx.set(http.headers);
|
|
142
142
|
if (dynamic) {
|
|
143
|
-
aop =
|
|
143
|
+
aop = _chunkR73A7HS3js.Context.getAop(meta2, {
|
|
144
144
|
globalFilter,
|
|
145
145
|
globalGuards,
|
|
146
146
|
globalPipe
|
package/dist/http/koa/index.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,91 +1,92 @@
|
|
|
1
|
-
import { B as BaseCtx, a as ControllerMeta, D as DefaultOptions,
|
|
2
|
-
export { d as BaseRequestMethod, C as CustomResponse, g as ERROR_SYMBOL, e as ExtractResponse, I as IS_DEV, h as IS_ONLY_GENERATE, j as IS_PURE, i as IS_STRICT, L as LOG_LEVEL, f as MetaData, P as PS_EXIT_CODE, S as ServiceMetaData } from './meta-
|
|
3
|
-
import { G as Generator } from './core-
|
|
4
|
-
export { F as Factory, O as Options, S as ServerPhecda, d as defaultServerInject, e as emitter, p as phecdaNamespace, u as useS } from './core-
|
|
1
|
+
import { B as BaseCtx, b as BaseError, a as ControllerMeta, D as DefaultOptions, c as ControllerMetaData, M as Meta, E as Emitter } from './meta-EGS-4cNY.mjs';
|
|
2
|
+
export { d as BaseRequestMethod, C as CustomResponse, g as ERROR_SYMBOL, e as ExtractResponse, I as IS_DEV, h as IS_ONLY_GENERATE, j as IS_PURE, i as IS_STRICT, L as LOG_LEVEL, f as MetaData, P as PS_EXIT_CODE, S as ServiceMetaData } from './meta-EGS-4cNY.mjs';
|
|
3
|
+
import { G as Generator } from './core-mOKtuP0F.mjs';
|
|
4
|
+
export { F as Factory, O as Options, S as ServerPhecda, d as defaultServerInject, e as emitter, p as phecdaNamespace, u as useS } from './core-mOKtuP0F.mjs';
|
|
5
5
|
import { Construct, Base } from 'phecda-core';
|
|
6
6
|
export * from 'phecda-core';
|
|
7
|
-
import { H as HttpCtx } from './types-
|
|
8
|
-
export { C as CookieSerializeOptions, a as HttpOptions } from './types-
|
|
9
|
-
import { R as RpcCtx } from './types-
|
|
10
|
-
export { a as RpcServerOptions } from './types-
|
|
7
|
+
import { H as HttpCtx } from './types-BkU6kQWV.mjs';
|
|
8
|
+
export { C as CookieSerializeOptions, a as HttpOptions } from './types-BkU6kQWV.mjs';
|
|
9
|
+
import { R as RpcCtx } from './types-CoOCYe_X.mjs';
|
|
10
|
+
export { a as RpcServerOptions } from './types-CoOCYe_X.mjs';
|
|
11
11
|
export { Mixin } from 'ts-mixer';
|
|
12
12
|
import 'node:http';
|
|
13
13
|
|
|
14
14
|
declare class Exception extends Error {
|
|
15
15
|
message: string;
|
|
16
|
+
metadata?: any | undefined;
|
|
16
17
|
status: number;
|
|
17
18
|
description: string;
|
|
18
|
-
constructor(message: string, status?: number, description?: string);
|
|
19
|
+
constructor(message: string, metadata?: any | undefined, status?: number, description?: string);
|
|
19
20
|
get data(): {
|
|
20
21
|
message: string;
|
|
21
22
|
description: string;
|
|
22
23
|
status: number;
|
|
23
|
-
__PS_ERROR__:
|
|
24
|
+
__PS_ERROR__: true;
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
declare class UndefinedException extends Exception {
|
|
28
|
-
constructor(message: string);
|
|
29
|
+
constructor(message: string, metadata?: any);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
declare class ValidateException extends Exception {
|
|
32
|
-
constructor(message: string);
|
|
33
|
+
constructor(message: string, metadata?: any);
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
declare class ForbiddenException extends Exception {
|
|
36
|
-
constructor(message: string);
|
|
37
|
+
constructor(message: string, metadata?: any);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
declare class BadRequestException extends Exception {
|
|
40
|
-
constructor(message: string);
|
|
41
|
+
constructor(message: string, metadata?: any);
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
declare class NotFoundException extends Exception {
|
|
44
|
-
constructor(message: string);
|
|
45
|
+
constructor(message: string, metadata?: any);
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
declare class ConflictException extends Exception {
|
|
48
|
-
constructor(message: string);
|
|
49
|
+
constructor(message: string, metadata?: any);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
declare class BadGatewayException extends Exception {
|
|
52
|
-
constructor(message: string);
|
|
53
|
+
constructor(message: string, metadata?: any);
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
declare class InvalidInputException extends Exception {
|
|
56
|
-
constructor(message: string);
|
|
57
|
+
constructor(message: string, metadata?: any);
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
declare class UnsupportedMediaTypeException extends Exception {
|
|
60
|
-
constructor(message: string);
|
|
61
|
+
constructor(message: string, metadata?: any);
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
declare class PayloadLargeException extends Exception {
|
|
64
|
-
constructor(message: string);
|
|
65
|
+
constructor(message: string, metadata?: any);
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
declare class TimeoutException extends Exception {
|
|
68
|
-
constructor(message: string);
|
|
69
|
+
constructor(message: string, metadata?: any);
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
declare class UnauthorizedException extends Exception {
|
|
72
|
-
constructor(message: string);
|
|
73
|
+
constructor(message: string, metadata?: any);
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
declare class ServiceUnavailableException extends Exception {
|
|
76
|
-
constructor(message: string);
|
|
77
|
+
constructor(message: string, metadata?: any);
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
declare class FrameworkException extends Exception {
|
|
80
|
-
constructor(message: string);
|
|
81
|
+
constructor(message: string, metadata?: any);
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
declare class TimerException extends Exception {
|
|
84
|
-
constructor(message: string);
|
|
85
|
+
constructor(message: string, metadata?: any);
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
declare class WorkerException extends Exception {
|
|
88
|
-
constructor(message: string);
|
|
89
|
+
constructor(message: string, metadata?: any);
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
interface AOP {
|
|
@@ -105,7 +106,7 @@ interface PipeArg {
|
|
|
105
106
|
}
|
|
106
107
|
type GuardType<Ctx extends BaseCtx = any> = (ctx: Ctx, next: () => Promise<any>) => any;
|
|
107
108
|
type PipeType<Ctx extends BaseCtx = any> = (arg: PipeArg, ctx: Ctx) => Promise<any>;
|
|
108
|
-
type FilterType<Ctx extends BaseCtx = any, E extends Exception = any> = (err: E | Error, ctx?: Ctx) =>
|
|
109
|
+
type FilterType<Ctx extends BaseCtx = any, E extends Exception = any> = (err: E | Error, ctx?: Ctx) => BaseError;
|
|
109
110
|
declare class Context<Ctx extends BaseCtx> {
|
|
110
111
|
data: Ctx;
|
|
111
112
|
method: string;
|
|
@@ -335,7 +336,7 @@ declare abstract class PAddon extends ServerBase {
|
|
|
335
336
|
}
|
|
336
337
|
|
|
337
338
|
interface PExtension<Ctx extends BaseCtx = any, E extends Exception = Exception> {
|
|
338
|
-
guard(ctx: Ctx
|
|
339
|
+
guard(ctx: Ctx, next: () => Promise<any>): any;
|
|
339
340
|
pipe(param: {
|
|
340
341
|
arg: any;
|
|
341
342
|
option?: any;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,91 +1,92 @@
|
|
|
1
|
-
import { B as BaseCtx, a as ControllerMeta, D as DefaultOptions,
|
|
2
|
-
export { d as BaseRequestMethod, C as CustomResponse, g as ERROR_SYMBOL, e as ExtractResponse, I as IS_DEV, h as IS_ONLY_GENERATE, j as IS_PURE, i as IS_STRICT, L as LOG_LEVEL, f as MetaData, P as PS_EXIT_CODE, S as ServiceMetaData } from './meta-
|
|
3
|
-
import { G as Generator } from './core-
|
|
4
|
-
export { F as Factory, O as Options, S as ServerPhecda, d as defaultServerInject, e as emitter, p as phecdaNamespace, u as useS } from './core-
|
|
1
|
+
import { B as BaseCtx, b as BaseError, a as ControllerMeta, D as DefaultOptions, c as ControllerMetaData, M as Meta, E as Emitter } from './meta-EGS-4cNY.js';
|
|
2
|
+
export { d as BaseRequestMethod, C as CustomResponse, g as ERROR_SYMBOL, e as ExtractResponse, I as IS_DEV, h as IS_ONLY_GENERATE, j as IS_PURE, i as IS_STRICT, L as LOG_LEVEL, f as MetaData, P as PS_EXIT_CODE, S as ServiceMetaData } from './meta-EGS-4cNY.js';
|
|
3
|
+
import { G as Generator } from './core-qL97H3d_.js';
|
|
4
|
+
export { F as Factory, O as Options, S as ServerPhecda, d as defaultServerInject, e as emitter, p as phecdaNamespace, u as useS } from './core-qL97H3d_.js';
|
|
5
5
|
import { Construct, Base } from 'phecda-core';
|
|
6
6
|
export * from 'phecda-core';
|
|
7
|
-
import { H as HttpCtx } from './types-
|
|
8
|
-
export { C as CookieSerializeOptions, a as HttpOptions } from './types-
|
|
9
|
-
import { R as RpcCtx } from './types-
|
|
10
|
-
export { a as RpcServerOptions } from './types-
|
|
7
|
+
import { H as HttpCtx } from './types-DGUpAXle.js';
|
|
8
|
+
export { C as CookieSerializeOptions, a as HttpOptions } from './types-DGUpAXle.js';
|
|
9
|
+
import { R as RpcCtx } from './types-NkRE3d35.js';
|
|
10
|
+
export { a as RpcServerOptions } from './types-NkRE3d35.js';
|
|
11
11
|
export { Mixin } from 'ts-mixer';
|
|
12
12
|
import 'node:http';
|
|
13
13
|
|
|
14
14
|
declare class Exception extends Error {
|
|
15
15
|
message: string;
|
|
16
|
+
metadata?: any | undefined;
|
|
16
17
|
status: number;
|
|
17
18
|
description: string;
|
|
18
|
-
constructor(message: string, status?: number, description?: string);
|
|
19
|
+
constructor(message: string, metadata?: any | undefined, status?: number, description?: string);
|
|
19
20
|
get data(): {
|
|
20
21
|
message: string;
|
|
21
22
|
description: string;
|
|
22
23
|
status: number;
|
|
23
|
-
__PS_ERROR__:
|
|
24
|
+
__PS_ERROR__: true;
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
declare class UndefinedException extends Exception {
|
|
28
|
-
constructor(message: string);
|
|
29
|
+
constructor(message: string, metadata?: any);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
declare class ValidateException extends Exception {
|
|
32
|
-
constructor(message: string);
|
|
33
|
+
constructor(message: string, metadata?: any);
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
declare class ForbiddenException extends Exception {
|
|
36
|
-
constructor(message: string);
|
|
37
|
+
constructor(message: string, metadata?: any);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
declare class BadRequestException extends Exception {
|
|
40
|
-
constructor(message: string);
|
|
41
|
+
constructor(message: string, metadata?: any);
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
declare class NotFoundException extends Exception {
|
|
44
|
-
constructor(message: string);
|
|
45
|
+
constructor(message: string, metadata?: any);
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
declare class ConflictException extends Exception {
|
|
48
|
-
constructor(message: string);
|
|
49
|
+
constructor(message: string, metadata?: any);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
declare class BadGatewayException extends Exception {
|
|
52
|
-
constructor(message: string);
|
|
53
|
+
constructor(message: string, metadata?: any);
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
declare class InvalidInputException extends Exception {
|
|
56
|
-
constructor(message: string);
|
|
57
|
+
constructor(message: string, metadata?: any);
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
declare class UnsupportedMediaTypeException extends Exception {
|
|
60
|
-
constructor(message: string);
|
|
61
|
+
constructor(message: string, metadata?: any);
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
declare class PayloadLargeException extends Exception {
|
|
64
|
-
constructor(message: string);
|
|
65
|
+
constructor(message: string, metadata?: any);
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
declare class TimeoutException extends Exception {
|
|
68
|
-
constructor(message: string);
|
|
69
|
+
constructor(message: string, metadata?: any);
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
declare class UnauthorizedException extends Exception {
|
|
72
|
-
constructor(message: string);
|
|
73
|
+
constructor(message: string, metadata?: any);
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
declare class ServiceUnavailableException extends Exception {
|
|
76
|
-
constructor(message: string);
|
|
77
|
+
constructor(message: string, metadata?: any);
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
declare class FrameworkException extends Exception {
|
|
80
|
-
constructor(message: string);
|
|
81
|
+
constructor(message: string, metadata?: any);
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
declare class TimerException extends Exception {
|
|
84
|
-
constructor(message: string);
|
|
85
|
+
constructor(message: string, metadata?: any);
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
declare class WorkerException extends Exception {
|
|
88
|
-
constructor(message: string);
|
|
89
|
+
constructor(message: string, metadata?: any);
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
interface AOP {
|
|
@@ -105,7 +106,7 @@ interface PipeArg {
|
|
|
105
106
|
}
|
|
106
107
|
type GuardType<Ctx extends BaseCtx = any> = (ctx: Ctx, next: () => Promise<any>) => any;
|
|
107
108
|
type PipeType<Ctx extends BaseCtx = any> = (arg: PipeArg, ctx: Ctx) => Promise<any>;
|
|
108
|
-
type FilterType<Ctx extends BaseCtx = any, E extends Exception = any> = (err: E | Error, ctx?: Ctx) =>
|
|
109
|
+
type FilterType<Ctx extends BaseCtx = any, E extends Exception = any> = (err: E | Error, ctx?: Ctx) => BaseError;
|
|
109
110
|
declare class Context<Ctx extends BaseCtx> {
|
|
110
111
|
data: Ctx;
|
|
111
112
|
method: string;
|
|
@@ -335,7 +336,7 @@ declare abstract class PAddon extends ServerBase {
|
|
|
335
336
|
}
|
|
336
337
|
|
|
337
338
|
interface PExtension<Ctx extends BaseCtx = any, E extends Exception = Exception> {
|
|
338
|
-
guard(ctx: Ctx
|
|
339
|
+
guard(ctx: Ctx, next: () => Promise<any>): any;
|
|
339
340
|
pipe(param: {
|
|
340
341
|
arg: any;
|
|
341
342
|
option?: any;
|