phecda-server 5.3.3 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-F3W3NN7F.mjs +238 -0
- package/dist/{chunk-ECSI4QBK.mjs → chunk-HDQAT2IM.mjs} +55 -65
- package/dist/{chunk-3D7AROG2.js → chunk-LYEZ6RGX.js} +54 -64
- package/dist/{chunk-RZ7IXJYQ.js → chunk-TZYATAJX.js} +12 -30
- package/dist/chunk-XCND2QW3.js +238 -0
- 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 +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +29 -27
- package/dist/index.mjs +9 -7
- 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
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkGHFSIZUOjs = require('./chunk-GHFSIZUO.js');
|
|
4
|
+
|
|
5
|
+
// src/decorators/param.ts
|
|
6
|
+
var _phecdacore = require('phecda-core');
|
|
7
|
+
function BaseParam(data) {
|
|
8
|
+
return (target, property, index) => {
|
|
9
|
+
if (!property) return;
|
|
10
|
+
_phecdacore.setMeta.call(void 0, target, property, index, data);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
_chunkGHFSIZUOjs.__name.call(void 0, BaseParam, "BaseParam");
|
|
14
|
+
function Body(key = "") {
|
|
15
|
+
return BaseParam({
|
|
16
|
+
type: "body",
|
|
17
|
+
key
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Body, "Body");
|
|
21
|
+
function Head(key) {
|
|
22
|
+
return BaseParam({
|
|
23
|
+
type: "headers",
|
|
24
|
+
key: key.toLowerCase()
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Head, "Head");
|
|
28
|
+
function Query(key = "") {
|
|
29
|
+
return BaseParam({
|
|
30
|
+
type: "query",
|
|
31
|
+
key
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Query, "Query");
|
|
35
|
+
function Param(key) {
|
|
36
|
+
return BaseParam({
|
|
37
|
+
type: "params",
|
|
38
|
+
key
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Param, "Param");
|
|
42
|
+
function Arg(target, k, index) {
|
|
43
|
+
BaseParam({
|
|
44
|
+
type: "args",
|
|
45
|
+
key: `${index}`
|
|
46
|
+
})(target, k, index);
|
|
47
|
+
}
|
|
48
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Arg, "Arg");
|
|
49
|
+
|
|
50
|
+
// src/decorators/aop.ts
|
|
51
|
+
|
|
52
|
+
function Guard(...guards) {
|
|
53
|
+
return (target, property) => {
|
|
54
|
+
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
55
|
+
guards
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Guard, "Guard");
|
|
60
|
+
function Plugin(...plugins) {
|
|
61
|
+
return (target, property) => {
|
|
62
|
+
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
63
|
+
plugins
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Plugin, "Plugin");
|
|
68
|
+
function Interceptor(...interceptors) {
|
|
69
|
+
return (target, property) => {
|
|
70
|
+
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
71
|
+
interceptors
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Interceptor, "Interceptor");
|
|
76
|
+
function Filter(filter) {
|
|
77
|
+
return (target, property) => {
|
|
78
|
+
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
79
|
+
filter
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Filter, "Filter");
|
|
84
|
+
function Pipe(pipe) {
|
|
85
|
+
return (target, property, index) => {
|
|
86
|
+
if (typeof index === "number") {
|
|
87
|
+
BaseParam({
|
|
88
|
+
pipe
|
|
89
|
+
})(target, property, index);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
93
|
+
pipe
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Pipe, "Pipe");
|
|
98
|
+
|
|
99
|
+
// src/decorators/http.ts
|
|
100
|
+
|
|
101
|
+
function Route(route, type) {
|
|
102
|
+
return (target, property) => {
|
|
103
|
+
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
104
|
+
http: {
|
|
105
|
+
route,
|
|
106
|
+
type
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Route, "Route");
|
|
112
|
+
function Header(headers) {
|
|
113
|
+
return (target, property) => {
|
|
114
|
+
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
115
|
+
http: {
|
|
116
|
+
headers
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Header, "Header");
|
|
122
|
+
function Get(route = "") {
|
|
123
|
+
return Route(route, "get");
|
|
124
|
+
}
|
|
125
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Get, "Get");
|
|
126
|
+
function Post(route = "") {
|
|
127
|
+
return Route(route, "post");
|
|
128
|
+
}
|
|
129
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Post, "Post");
|
|
130
|
+
function Put(route = "") {
|
|
131
|
+
return Route(route, "put");
|
|
132
|
+
}
|
|
133
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Put, "Put");
|
|
134
|
+
function Search(route = "") {
|
|
135
|
+
return Route(route, "search");
|
|
136
|
+
}
|
|
137
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Search, "Search");
|
|
138
|
+
function Patch(route = "") {
|
|
139
|
+
return Route(route, "patch");
|
|
140
|
+
}
|
|
141
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Patch, "Patch");
|
|
142
|
+
function Delete(route = "") {
|
|
143
|
+
return Route(route, "delete");
|
|
144
|
+
}
|
|
145
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Delete, "Delete");
|
|
146
|
+
function Controller(prefix = "") {
|
|
147
|
+
return (target) => {
|
|
148
|
+
_phecdacore.setMeta.call(void 0, target, void 0, void 0, {
|
|
149
|
+
controller: "http",
|
|
150
|
+
http: {
|
|
151
|
+
prefix
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Controller, "Controller");
|
|
157
|
+
|
|
158
|
+
// src/decorators/rpc.ts
|
|
159
|
+
|
|
160
|
+
function Queue(queue = "", isEvent) {
|
|
161
|
+
return (target, property) => {
|
|
162
|
+
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
163
|
+
rpc: {
|
|
164
|
+
queue,
|
|
165
|
+
isEvent
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Queue, "Queue");
|
|
171
|
+
function Rpc() {
|
|
172
|
+
return (target) => {
|
|
173
|
+
_phecdacore.setMeta.call(void 0, target, void 0, void 0, {
|
|
174
|
+
controller: "rpc"
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Rpc, "Rpc");
|
|
179
|
+
|
|
180
|
+
// src/decorators/ctx.ts
|
|
181
|
+
|
|
182
|
+
var Ctx = /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (target, property) => {
|
|
183
|
+
_phecdacore.setMeta.call(void 0, target, _phecdacore.SHARE_KEY, void 0, {
|
|
184
|
+
ctxs: [
|
|
185
|
+
property
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
}, "Ctx");
|
|
189
|
+
function Define(key, value) {
|
|
190
|
+
return (target, property, index) => {
|
|
191
|
+
if (typeof index === "number") {
|
|
192
|
+
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
193
|
+
params: [
|
|
194
|
+
{
|
|
195
|
+
define: {
|
|
196
|
+
[key]: value
|
|
197
|
+
},
|
|
198
|
+
index
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
});
|
|
202
|
+
} else {
|
|
203
|
+
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
204
|
+
define: {
|
|
205
|
+
[key]: value
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Define, "Define");
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
exports.BaseParam = BaseParam; exports.Body = Body; exports.Head = Head; exports.Query = Query; exports.Param = Param; exports.Arg = Arg; exports.Guard = Guard; exports.Plugin = Plugin; exports.Interceptor = Interceptor; exports.Filter = Filter; exports.Pipe = Pipe; exports.Route = Route; exports.Header = Header; exports.Get = Get; exports.Post = Post; exports.Put = Put; exports.Search = Search; exports.Patch = Patch; exports.Delete = Delete; exports.Controller = Controller; exports.Queue = Queue; exports.Rpc = Rpc; exports.Ctx = Ctx; exports.Define = Define;
|
|
@@ -14,7 +14,9 @@ import pc from "picocolors";
|
|
|
14
14
|
import Debug from "debug";
|
|
15
15
|
|
|
16
16
|
// src/pipe.ts
|
|
17
|
-
|
|
17
|
+
var defaultPipe = /* @__PURE__ */ __name(({ arg }) => {
|
|
18
|
+
return arg;
|
|
19
|
+
}, "defaultPipe");
|
|
18
20
|
|
|
19
21
|
// src/exception/base.ts
|
|
20
22
|
var Exception = class extends Error {
|
|
@@ -40,43 +42,23 @@ var Exception = class extends Error {
|
|
|
40
42
|
}
|
|
41
43
|
};
|
|
42
44
|
|
|
43
|
-
// src/exception/
|
|
44
|
-
var
|
|
45
|
+
// src/exception/undefine.ts
|
|
46
|
+
var UndefinedException = class extends Exception {
|
|
45
47
|
static {
|
|
46
|
-
__name(this, "
|
|
48
|
+
__name(this, "UndefinedException");
|
|
47
49
|
}
|
|
48
50
|
constructor(message) {
|
|
49
|
-
super(message,
|
|
51
|
+
super(message, 500, "Undefined error");
|
|
50
52
|
}
|
|
51
53
|
};
|
|
52
54
|
|
|
53
|
-
// src/
|
|
54
|
-
var
|
|
55
|
-
if (isPhecda(reflect)) {
|
|
56
|
-
const instance = plainToClass(reflect, arg);
|
|
57
|
-
const err = transformInstance(instance);
|
|
58
|
-
if (err.length > 0) throw new ValidateException(err[0]);
|
|
59
|
-
arg = instance;
|
|
60
|
-
} else {
|
|
61
|
-
if (arg === void 0 && !reflect) return void 0;
|
|
62
|
-
if ([
|
|
63
|
-
Number,
|
|
64
|
-
Boolean
|
|
65
|
-
].includes(reflect)) {
|
|
66
|
-
arg = reflect(arg);
|
|
67
|
-
if (reflect === Number && Object.is(arg, NaN)) throw new ValidateException(`parameter ${Number(index) + 1} should be a number`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return arg;
|
|
71
|
-
}, "defaultPipe");
|
|
72
|
-
|
|
73
|
-
// src/exception/undefine.ts
|
|
74
|
-
var UndefinedException = class extends Exception {
|
|
55
|
+
// src/exception/validate.ts
|
|
56
|
+
var ValidateException = class extends Exception {
|
|
75
57
|
static {
|
|
76
|
-
__name(this, "
|
|
58
|
+
__name(this, "ValidateException");
|
|
77
59
|
}
|
|
78
60
|
constructor(message) {
|
|
79
|
-
super(message,
|
|
61
|
+
super(message, 400, "Validate exception");
|
|
80
62
|
}
|
|
81
63
|
};
|
|
82
64
|
|
|
@@ -525,10 +507,10 @@ function detectAopDep(meta, { guards, interceptors, plugins } = {}, controller =
|
|
|
525
507
|
__name(detectAopDep, "detectAopDep");
|
|
526
508
|
|
|
527
509
|
export {
|
|
528
|
-
Exception,
|
|
529
|
-
ValidateException,
|
|
530
510
|
defaultPipe,
|
|
511
|
+
Exception,
|
|
531
512
|
UndefinedException,
|
|
513
|
+
ValidateException,
|
|
532
514
|
ForbiddenException,
|
|
533
515
|
BadRequestException,
|
|
534
516
|
NotFoundException,
|
|
@@ -16,7 +16,7 @@ interface Options {
|
|
|
16
16
|
parseMeta?: (meta: Meta) => Meta | null | undefined;
|
|
17
17
|
generators?: Generator[];
|
|
18
18
|
}
|
|
19
|
-
declare function
|
|
19
|
+
declare function createPhecda(models: Construct[], opts?: Options): Promise<{
|
|
20
20
|
moduleMap: Map<PropertyKey, any>;
|
|
21
21
|
modelMap: WeakMap<any, Construct>;
|
|
22
22
|
meta: Meta[];
|
|
@@ -24,6 +24,7 @@ declare function Factory(models: Construct[], opts?: Options): Promise<{
|
|
|
24
24
|
del: (tag: PropertyKey) => Promise<any>;
|
|
25
25
|
destroy: () => Promise<void>;
|
|
26
26
|
}>;
|
|
27
|
-
declare const
|
|
27
|
+
declare const Factory: typeof createPhecda;
|
|
28
|
+
declare function isObject(o: any): boolean;
|
|
28
29
|
|
|
29
|
-
export { Factory as F, Generator as G, type Options as O, createPhecda as c, emitter as e };
|
|
30
|
+
export { Factory as F, Generator as G, type Options as O, createPhecda as c, emitter as e, isObject as i };
|
|
@@ -16,7 +16,7 @@ interface Options {
|
|
|
16
16
|
parseMeta?: (meta: Meta) => Meta | null | undefined;
|
|
17
17
|
generators?: Generator[];
|
|
18
18
|
}
|
|
19
|
-
declare function
|
|
19
|
+
declare function createPhecda(models: Construct[], opts?: Options): Promise<{
|
|
20
20
|
moduleMap: Map<PropertyKey, any>;
|
|
21
21
|
modelMap: WeakMap<any, Construct>;
|
|
22
22
|
meta: Meta[];
|
|
@@ -24,6 +24,7 @@ declare function Factory(models: Construct[], opts?: Options): Promise<{
|
|
|
24
24
|
del: (tag: PropertyKey) => Promise<any>;
|
|
25
25
|
destroy: () => Promise<void>;
|
|
26
26
|
}>;
|
|
27
|
-
declare const
|
|
27
|
+
declare const Factory: typeof createPhecda;
|
|
28
|
+
declare function isObject(o: any): boolean;
|
|
28
29
|
|
|
29
|
-
export { Factory as F, Generator as G, type Options as O, createPhecda as c, emitter as e };
|
|
30
|
+
export { Factory as F, Generator as G, type Options as O, createPhecda as c, emitter as e, isObject as i };
|
package/dist/helper.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkTZYATAJXjs = require('./chunk-TZYATAJX.js');
|
|
11
11
|
require('./chunk-GHFSIZUO.js');
|
|
12
12
|
|
|
13
13
|
|
|
@@ -18,4 +18,4 @@ require('./chunk-GHFSIZUO.js');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
exports.HMR =
|
|
21
|
+
exports.HMR = _chunkTZYATAJXjs.HMR; exports.argToReq = _chunkTZYATAJXjs.argToReq; exports.createControllerMetaMap = _chunkTZYATAJXjs.createControllerMetaMap; exports.detectAopDep = _chunkTZYATAJXjs.detectAopDep; exports.genClientQueue = _chunkTZYATAJXjs.genClientQueue; exports.mergeObject = _chunkTZYATAJXjs.mergeObject; exports.resolveDep = _chunkTZYATAJXjs.resolveDep; exports.shallowClone = _chunkTZYATAJXjs.shallowClone;
|
package/dist/helper.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { B as BaseContext, D as DefaultOptions, C as ControllerMetaData, M as MetaData, E as Emitter, a as BaseError } from './types-BlIBlnVT.mjs';
|
|
2
2
|
export { e as BaseRequestType, d as BaseReturn, i as ControllerMeta, f as CustomResponse, j as ERROR_SYMBOL, g as ExtractResponse, I as IS_HMR, k as IS_ONLY_GENERATE, l as IS_STRICT, L as LOG_LEVEL, h as Meta, O as OmitFunction, m as PS_EXIT_CODE, P as PickFunc, S as ServiceMetaData, c as ToClientFn, b as ToClientInstance, T as ToClientMap } from './types-BlIBlnVT.mjs';
|
|
3
|
-
import { G as Generator } from './core-
|
|
4
|
-
export { F as Factory, O as Options, c as createPhecda, e as emitter } from './core-
|
|
3
|
+
import { G as Generator } from './core-D2oL8Ge0.mjs';
|
|
4
|
+
export { F as Factory, O as Options, c as createPhecda, e as emitter, i as isObject } from './core-D2oL8Ge0.mjs';
|
|
5
5
|
import { Base } from 'phecda-core';
|
|
6
6
|
export * from 'phecda-core';
|
|
7
7
|
import { H as HttpContext } from './types-Dgxirc9f.mjs';
|
|
@@ -153,23 +153,23 @@ declare function Query(key?: string): ParameterDecorator;
|
|
|
153
153
|
declare function Param(key: string): ParameterDecorator;
|
|
154
154
|
declare function Arg(target: any, k: string, index: number): void;
|
|
155
155
|
|
|
156
|
-
declare function Guard(...guards: string[]): (target: any,
|
|
157
|
-
declare function Plugin(...plugins: string[]): (target: any,
|
|
158
|
-
declare function Interceptor(...interceptors: string[]): (target: any,
|
|
159
|
-
declare function Filter(filter: string): (target: any,
|
|
160
|
-
declare function Pipe(pipe?: string): (target: any,
|
|
156
|
+
declare function Guard(...guards: string[]): (target: any, property?: PropertyKey) => void;
|
|
157
|
+
declare function Plugin(...plugins: string[]): (target: any, property?: PropertyKey) => void;
|
|
158
|
+
declare function Interceptor(...interceptors: string[]): (target: any, property?: PropertyKey) => void;
|
|
159
|
+
declare function Filter(filter: string): (target: any, property?: PropertyKey) => void;
|
|
160
|
+
declare function Pipe(pipe?: string): (target: any, property?: any, index?: any) => void;
|
|
161
161
|
|
|
162
162
|
declare function Route(route: string, type: string): MethodDecorator;
|
|
163
163
|
declare function Header(headers: Record<string, string>): MethodDecorator;
|
|
164
164
|
declare function Get(route?: string): MethodDecorator;
|
|
165
165
|
declare function Post(route?: string): MethodDecorator;
|
|
166
166
|
declare function Put(route?: string): MethodDecorator;
|
|
167
|
+
declare function Search(route?: string): MethodDecorator;
|
|
167
168
|
declare function Patch(route?: string): MethodDecorator;
|
|
168
169
|
declare function Delete(route?: string): MethodDecorator;
|
|
169
170
|
declare function Controller(prefix?: string): (target: any) => void;
|
|
170
171
|
|
|
171
|
-
declare function
|
|
172
|
-
declare function Queue(queue?: string): (target: any, k?: PropertyKey) => void;
|
|
172
|
+
declare function Queue(queue?: string, isEvent?: boolean): (target: any, property?: PropertyKey) => void;
|
|
173
173
|
declare function Rpc(): ClassDecorator;
|
|
174
174
|
|
|
175
175
|
declare const Ctx: PropertyDecorator;
|
|
@@ -247,4 +247,4 @@ type LogLevel = 'error' | 'info' | 'warn' | 'log';
|
|
|
247
247
|
declare function setLogger(logger: Record<LogLevel, (msg: string) => void>): void;
|
|
248
248
|
declare function log(msg: string, level?: LogLevel): void;
|
|
249
249
|
|
|
250
|
-
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter,
|
|
250
|
+
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter, Exception, Filter, type FilterType, ForbiddenException, FrameworkException, Generator, Get, Guard, type GuardType, HTTPGenerator, Head, Header, HttpBase, HttpContext, Interceptor, type InterceptorType, InvalidInputException, MetaData, NotFoundException, PExtension, PFilter, PGuard, PInterceptor, PPipe, PPlugin, Param, Patch, PayloadLargeException, Pipe, type PipeArg, type PipeType, Plugin, Post, Put, Query, Queue, RPCGenerator, Route, Rpc, RpcBase, RpcContext, Search, ServerBase, ServiceUnavailableException, TimeoutException, TimerException, UnauthorizedException, UndefinedException, UnsupportedMediaTypeException, ValidateException, WorkerException, addFilter, addGuard, addInterceptor, addPipe, addPlugin, defaultPipe, log, setLogger };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { B as BaseContext, D as DefaultOptions, C as ControllerMetaData, M as MetaData, E as Emitter, a as BaseError } from './types-BlIBlnVT.js';
|
|
2
2
|
export { e as BaseRequestType, d as BaseReturn, i as ControllerMeta, f as CustomResponse, j as ERROR_SYMBOL, g as ExtractResponse, I as IS_HMR, k as IS_ONLY_GENERATE, l as IS_STRICT, L as LOG_LEVEL, h as Meta, O as OmitFunction, m as PS_EXIT_CODE, P as PickFunc, S as ServiceMetaData, c as ToClientFn, b as ToClientInstance, T as ToClientMap } from './types-BlIBlnVT.js';
|
|
3
|
-
import { G as Generator } from './core-
|
|
4
|
-
export { F as Factory, O as Options, c as createPhecda, e as emitter } from './core-
|
|
3
|
+
import { G as Generator } from './core-Blq8frmr.js';
|
|
4
|
+
export { F as Factory, O as Options, c as createPhecda, e as emitter, i as isObject } from './core-Blq8frmr.js';
|
|
5
5
|
import { Base } from 'phecda-core';
|
|
6
6
|
export * from 'phecda-core';
|
|
7
7
|
import { H as HttpContext } from './types-BCJhmpQh.js';
|
|
@@ -153,23 +153,23 @@ declare function Query(key?: string): ParameterDecorator;
|
|
|
153
153
|
declare function Param(key: string): ParameterDecorator;
|
|
154
154
|
declare function Arg(target: any, k: string, index: number): void;
|
|
155
155
|
|
|
156
|
-
declare function Guard(...guards: string[]): (target: any,
|
|
157
|
-
declare function Plugin(...plugins: string[]): (target: any,
|
|
158
|
-
declare function Interceptor(...interceptors: string[]): (target: any,
|
|
159
|
-
declare function Filter(filter: string): (target: any,
|
|
160
|
-
declare function Pipe(pipe?: string): (target: any,
|
|
156
|
+
declare function Guard(...guards: string[]): (target: any, property?: PropertyKey) => void;
|
|
157
|
+
declare function Plugin(...plugins: string[]): (target: any, property?: PropertyKey) => void;
|
|
158
|
+
declare function Interceptor(...interceptors: string[]): (target: any, property?: PropertyKey) => void;
|
|
159
|
+
declare function Filter(filter: string): (target: any, property?: PropertyKey) => void;
|
|
160
|
+
declare function Pipe(pipe?: string): (target: any, property?: any, index?: any) => void;
|
|
161
161
|
|
|
162
162
|
declare function Route(route: string, type: string): MethodDecorator;
|
|
163
163
|
declare function Header(headers: Record<string, string>): MethodDecorator;
|
|
164
164
|
declare function Get(route?: string): MethodDecorator;
|
|
165
165
|
declare function Post(route?: string): MethodDecorator;
|
|
166
166
|
declare function Put(route?: string): MethodDecorator;
|
|
167
|
+
declare function Search(route?: string): MethodDecorator;
|
|
167
168
|
declare function Patch(route?: string): MethodDecorator;
|
|
168
169
|
declare function Delete(route?: string): MethodDecorator;
|
|
169
170
|
declare function Controller(prefix?: string): (target: any) => void;
|
|
170
171
|
|
|
171
|
-
declare function
|
|
172
|
-
declare function Queue(queue?: string): (target: any, k?: PropertyKey) => void;
|
|
172
|
+
declare function Queue(queue?: string, isEvent?: boolean): (target: any, property?: PropertyKey) => void;
|
|
173
173
|
declare function Rpc(): ClassDecorator;
|
|
174
174
|
|
|
175
175
|
declare const Ctx: PropertyDecorator;
|
|
@@ -247,4 +247,4 @@ type LogLevel = 'error' | 'info' | 'warn' | 'log';
|
|
|
247
247
|
declare function setLogger(logger: Record<LogLevel, (msg: string) => void>): void;
|
|
248
248
|
declare function log(msg: string, level?: LogLevel): void;
|
|
249
249
|
|
|
250
|
-
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter,
|
|
250
|
+
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter, Exception, Filter, type FilterType, ForbiddenException, FrameworkException, Generator, Get, Guard, type GuardType, HTTPGenerator, Head, Header, HttpBase, HttpContext, Interceptor, type InterceptorType, InvalidInputException, MetaData, NotFoundException, PExtension, PFilter, PGuard, PInterceptor, PPipe, PPlugin, Param, Patch, PayloadLargeException, Pipe, type PipeArg, type PipeType, Plugin, Post, Put, Query, Queue, RPCGenerator, Route, Rpc, RpcBase, RpcContext, Search, ServerBase, ServiceUnavailableException, TimeoutException, TimerException, UnauthorizedException, UndefinedException, UnsupportedMediaTypeException, ValidateException, WorkerException, addFilter, addGuard, addInterceptor, addPipe, addPlugin, defaultPipe, log, setLogger };
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var _chunk3D7AROG2js = require('./chunk-3D7AROG2.js');
|
|
7
6
|
|
|
7
|
+
var _chunkLYEZ6RGXjs = require('./chunk-LYEZ6RGX.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -29,8 +29,8 @@ var _chunk3D7AROG2js = require('./chunk-3D7AROG2.js');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var _chunk2HVTWYS2js = require('./chunk-2HVTWYS2.js');
|
|
33
32
|
|
|
33
|
+
var _chunkXCND2QW3js = require('./chunk-XCND2QW3.js');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
@@ -55,7 +55,8 @@ var _chunk2HVTWYS2js = require('./chunk-2HVTWYS2.js');
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
|
|
59
|
+
var _chunkTZYATAJXjs = require('./chunk-TZYATAJX.js');
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
|
|
@@ -95,7 +96,7 @@ var ServerBase = (_class = class extends _phecdacore.Base {constructor(...args2)
|
|
|
95
96
|
static {
|
|
96
97
|
_chunkGHFSIZUOjs.__name.call(void 0, this, "ServerBase");
|
|
97
98
|
}
|
|
98
|
-
__init() {this.emitter = exports.emitter =
|
|
99
|
+
__init() {this.emitter = exports.emitter = _chunkLYEZ6RGXjs.emitter}
|
|
99
100
|
}, _class);
|
|
100
101
|
var HttpBase = class extends ServerBase {
|
|
101
102
|
static {
|
|
@@ -104,7 +105,7 @@ var HttpBase = class extends ServerBase {
|
|
|
104
105
|
|
|
105
106
|
};
|
|
106
107
|
_ts_decorate([
|
|
107
|
-
|
|
108
|
+
_chunkXCND2QW3js.Ctx,
|
|
108
109
|
_ts_metadata("design:type", typeof HttpContext === "undefined" ? Object : HttpContext)
|
|
109
110
|
], HttpBase.prototype, "context", void 0);
|
|
110
111
|
var RpcBase = class extends ServerBase {
|
|
@@ -114,7 +115,7 @@ var RpcBase = class extends ServerBase {
|
|
|
114
115
|
|
|
115
116
|
};
|
|
116
117
|
_ts_decorate([
|
|
117
|
-
|
|
118
|
+
_chunkXCND2QW3js.Ctx,
|
|
118
119
|
_ts_metadata("design:type", typeof RpcContext === "undefined" ? Object : RpcContext)
|
|
119
120
|
], RpcBase.prototype, "context", void 0);
|
|
120
121
|
|
|
@@ -128,9 +129,9 @@ var PFilter = class extends ServerBase {
|
|
|
128
129
|
constructor(tag) {
|
|
129
130
|
super();
|
|
130
131
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
131
|
-
|
|
132
|
+
_chunkTZYATAJXjs.addFilter.call(void 0, this.key, this.use.bind(this));
|
|
132
133
|
this.onUnmount(() => {
|
|
133
|
-
delete
|
|
134
|
+
delete _chunkTZYATAJXjs.Context.filterRecord[this.key];
|
|
134
135
|
});
|
|
135
136
|
}
|
|
136
137
|
};
|
|
@@ -145,9 +146,9 @@ var PGuard = class extends ServerBase {
|
|
|
145
146
|
constructor(tag) {
|
|
146
147
|
super();
|
|
147
148
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
148
|
-
|
|
149
|
+
_chunkTZYATAJXjs.addGuard.call(void 0, this.key, this.use.bind(this));
|
|
149
150
|
this.onUnmount(() => {
|
|
150
|
-
delete
|
|
151
|
+
delete _chunkTZYATAJXjs.Context.guardRecord[this.key];
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
154
|
};
|
|
@@ -163,9 +164,9 @@ var PInterceptor = class extends ServerBase {
|
|
|
163
164
|
super();
|
|
164
165
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
165
166
|
this.onUnmount(() => {
|
|
166
|
-
delete
|
|
167
|
+
delete _chunkTZYATAJXjs.Context.interceptorRecord[this.key];
|
|
167
168
|
});
|
|
168
|
-
|
|
169
|
+
_chunkTZYATAJXjs.addInterceptor.call(void 0, this.key, this.use.bind(this));
|
|
169
170
|
}
|
|
170
171
|
};
|
|
171
172
|
|
|
@@ -179,9 +180,9 @@ var PPipe = class extends ServerBase {
|
|
|
179
180
|
constructor(tag) {
|
|
180
181
|
super();
|
|
181
182
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
182
|
-
|
|
183
|
+
_chunkTZYATAJXjs.addPipe.call(void 0, this.key, this.use.bind(this));
|
|
183
184
|
this.onUnmount(() => {
|
|
184
|
-
delete
|
|
185
|
+
delete _chunkTZYATAJXjs.Context.pipeRecord[this.key];
|
|
185
186
|
});
|
|
186
187
|
}
|
|
187
188
|
};
|
|
@@ -196,9 +197,9 @@ var PPlugin = class extends ServerBase {
|
|
|
196
197
|
constructor(tag) {
|
|
197
198
|
super();
|
|
198
199
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
199
|
-
|
|
200
|
+
_chunkTZYATAJXjs.addPlugin.call(void 0, this.key, this.use.bind(this));
|
|
200
201
|
this.onUnmount(() => {
|
|
201
|
-
delete
|
|
202
|
+
delete _chunkTZYATAJXjs.Context.pluginRecord[this.key];
|
|
202
203
|
});
|
|
203
204
|
}
|
|
204
205
|
};
|
|
@@ -214,33 +215,33 @@ var PExtension = class extends ServerBase {
|
|
|
214
215
|
super();
|
|
215
216
|
const key = this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
216
217
|
if (this.pipe) {
|
|
217
|
-
|
|
218
|
+
_chunkTZYATAJXjs.addPipe.call(void 0, key, this.pipe.bind(this));
|
|
218
219
|
this.onUnmount(() => {
|
|
219
|
-
delete
|
|
220
|
+
delete _chunkTZYATAJXjs.Context.pipeRecord[key];
|
|
220
221
|
});
|
|
221
222
|
}
|
|
222
223
|
if (this.plugin) {
|
|
223
|
-
|
|
224
|
+
_chunkTZYATAJXjs.addPlugin.call(void 0, key, this.plugin.bind(this));
|
|
224
225
|
this.onUnmount(() => {
|
|
225
|
-
delete
|
|
226
|
+
delete _chunkTZYATAJXjs.Context.pluginRecord[key];
|
|
226
227
|
});
|
|
227
228
|
}
|
|
228
229
|
if (this.intercept) {
|
|
229
|
-
|
|
230
|
+
_chunkTZYATAJXjs.addInterceptor.call(void 0, key, this.intercept.bind(this));
|
|
230
231
|
this.onUnmount(() => {
|
|
231
|
-
delete
|
|
232
|
+
delete _chunkTZYATAJXjs.Context.interceptorRecord[key];
|
|
232
233
|
});
|
|
233
234
|
}
|
|
234
235
|
if (this.guard) {
|
|
235
|
-
|
|
236
|
+
_chunkTZYATAJXjs.addGuard.call(void 0, key, this.guard.bind(this));
|
|
236
237
|
this.onUnmount(() => {
|
|
237
|
-
delete
|
|
238
|
+
delete _chunkTZYATAJXjs.Context.guardRecord[key];
|
|
238
239
|
});
|
|
239
240
|
}
|
|
240
241
|
if (this.filter) {
|
|
241
|
-
|
|
242
|
+
_chunkTZYATAJXjs.addFilter.call(void 0, key, this.filter.bind(this));
|
|
242
243
|
this.onUnmount(() => {
|
|
243
|
-
delete
|
|
244
|
+
delete _chunkTZYATAJXjs.Context.filterRecord[key];
|
|
244
245
|
});
|
|
245
246
|
}
|
|
246
247
|
}
|
|
@@ -418,4 +419,5 @@ return ret
|
|
|
418
419
|
|
|
419
420
|
|
|
420
421
|
|
|
421
|
-
|
|
422
|
+
|
|
423
|
+
exports.Arg = _chunkXCND2QW3js.Arg; exports.BadGatewayException = _chunkTZYATAJXjs.BadGatewayException; exports.BadRequestException = _chunkTZYATAJXjs.BadRequestException; exports.BaseParam = _chunkXCND2QW3js.BaseParam; exports.Body = _chunkXCND2QW3js.Body; exports.ConflictException = _chunkTZYATAJXjs.ConflictException; exports.Context = _chunkTZYATAJXjs.Context; exports.Controller = _chunkXCND2QW3js.Controller; exports.Ctx = _chunkXCND2QW3js.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkXCND2QW3js.Define; exports.Delete = _chunkXCND2QW3js.Delete; exports.ERROR_SYMBOL = _chunkGHFSIZUOjs.ERROR_SYMBOL; exports.Exception = _chunkTZYATAJXjs.Exception; exports.Factory = _chunkLYEZ6RGXjs.Factory; exports.Filter = _chunkXCND2QW3js.Filter; exports.ForbiddenException = _chunkTZYATAJXjs.ForbiddenException; exports.FrameworkException = _chunkTZYATAJXjs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkXCND2QW3js.Get; exports.Guard = _chunkXCND2QW3js.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkXCND2QW3js.Head; exports.Header = _chunkXCND2QW3js.Header; exports.HttpBase = HttpBase; exports.IS_HMR = _chunkGHFSIZUOjs.IS_HMR; exports.IS_ONLY_GENERATE = _chunkGHFSIZUOjs.IS_ONLY_GENERATE; exports.IS_STRICT = _chunkGHFSIZUOjs.IS_STRICT; exports.Interceptor = _chunkXCND2QW3js.Interceptor; exports.InvalidInputException = _chunkTZYATAJXjs.InvalidInputException; exports.LOG_LEVEL = _chunkGHFSIZUOjs.LOG_LEVEL; exports.Meta = _chunkLYEZ6RGXjs.Meta; exports.Mixin = _chunkGHFSIZUOjs.Mixin; exports.NotFoundException = _chunkTZYATAJXjs.NotFoundException; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PInterceptor = PInterceptor; exports.PPipe = PPipe; exports.PPlugin = PPlugin; exports.PS_EXIT_CODE = _chunkGHFSIZUOjs.PS_EXIT_CODE; exports.Param = _chunkXCND2QW3js.Param; exports.Patch = _chunkXCND2QW3js.Patch; exports.PayloadLargeException = _chunkTZYATAJXjs.PayloadLargeException; exports.Pipe = _chunkXCND2QW3js.Pipe; exports.Plugin = _chunkXCND2QW3js.Plugin; exports.Post = _chunkXCND2QW3js.Post; exports.Put = _chunkXCND2QW3js.Put; exports.Query = _chunkXCND2QW3js.Query; exports.Queue = _chunkXCND2QW3js.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkXCND2QW3js.Route; exports.Rpc = _chunkXCND2QW3js.Rpc; exports.RpcBase = RpcBase; exports.Search = _chunkXCND2QW3js.Search; exports.ServerBase = ServerBase; exports.ServiceUnavailableException = _chunkTZYATAJXjs.ServiceUnavailableException; exports.TimeoutException = _chunkTZYATAJXjs.TimeoutException; exports.TimerException = _chunkTZYATAJXjs.TimerException; exports.UnauthorizedException = _chunkTZYATAJXjs.UnauthorizedException; exports.UndefinedException = _chunkTZYATAJXjs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkTZYATAJXjs.UnsupportedMediaTypeException; exports.ValidateException = _chunkTZYATAJXjs.ValidateException; exports.WorkerException = _chunkTZYATAJXjs.WorkerException; exports.addFilter = _chunkTZYATAJXjs.addFilter; exports.addGuard = _chunkTZYATAJXjs.addGuard; exports.addInterceptor = _chunkTZYATAJXjs.addInterceptor; exports.addPipe = _chunkTZYATAJXjs.addPipe; exports.addPlugin = _chunkTZYATAJXjs.addPlugin; exports.createPhecda = _chunkLYEZ6RGXjs.createPhecda; exports.defaultPipe = _chunkTZYATAJXjs.defaultPipe; exports.emitter = _chunkLYEZ6RGXjs.emitter; exports.isObject = _chunkLYEZ6RGXjs.isObject; exports.log = _chunkGHFSIZUOjs.log; exports.setLogger = _chunkGHFSIZUOjs.setLogger;
|