phecda-server 5.3.3 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2UTKBEZE.mjs +233 -0
- package/dist/{chunk-ECSI4QBK.mjs → chunk-HDQAT2IM.mjs} +55 -65
- package/dist/{chunk-3D7AROG2.js → chunk-LYEZ6RGX.js} +54 -64
- package/dist/chunk-PALEEADE.js +233 -0
- package/dist/{chunk-RZ7IXJYQ.js → chunk-TZYATAJX.js} +12 -30
- package/dist/{chunk-3IPYLGY2.mjs → chunk-YUXERDQ6.mjs} +13 -31
- package/dist/{core-dx9E5x2N.d.ts → core-Blq8frmr.d.ts} +4 -3
- package/dist/{core-Bc2ENEHX.d.mts → core-D2oL8Ge0.d.mts} +4 -3
- package/dist/helper.js +2 -2
- package/dist/helper.mjs +1 -1
- package/dist/index.d.mts +9 -10
- package/dist/index.d.ts +9 -10
- package/dist/index.js +27 -27
- package/dist/index.mjs +6 -6
- package/dist/rpc/bullmq/index.d.mts +1 -1
- package/dist/rpc/bullmq/index.d.ts +1 -1
- package/dist/rpc/bullmq/index.js +6 -6
- package/dist/rpc/bullmq/index.mjs +1 -1
- package/dist/rpc/kafka/index.d.mts +1 -1
- package/dist/rpc/kafka/index.d.ts +1 -1
- package/dist/rpc/kafka/index.js +5 -5
- package/dist/rpc/kafka/index.mjs +1 -1
- package/dist/rpc/nats/index.d.mts +1 -1
- package/dist/rpc/nats/index.d.ts +1 -1
- package/dist/rpc/nats/index.js +5 -5
- package/dist/rpc/nats/index.mjs +1 -1
- package/dist/rpc/rabbitmq/index.d.mts +1 -1
- package/dist/rpc/rabbitmq/index.d.ts +1 -1
- package/dist/rpc/rabbitmq/index.js +6 -6
- package/dist/rpc/rabbitmq/index.mjs +1 -1
- package/dist/rpc/redis/index.d.mts +1 -1
- package/dist/rpc/redis/index.d.ts +1 -1
- package/dist/rpc/redis/index.js +6 -6
- package/dist/rpc/redis/index.mjs +1 -1
- package/dist/server/elysia/index.d.mts +1 -1
- package/dist/server/elysia/index.d.ts +1 -1
- package/dist/server/elysia/index.js +15 -15
- package/dist/server/elysia/index.mjs +2 -2
- package/dist/server/express/index.d.mts +1 -1
- package/dist/server/express/index.d.ts +1 -1
- package/dist/server/express/index.js +14 -14
- package/dist/server/express/index.mjs +1 -1
- package/dist/server/fastify/index.d.mts +1 -1
- package/dist/server/fastify/index.d.ts +1 -1
- package/dist/server/fastify/index.js +15 -15
- package/dist/server/fastify/index.mjs +2 -2
- package/dist/server/h3/index.d.mts +1 -1
- package/dist/server/h3/index.d.ts +1 -1
- package/dist/server/h3/index.js +12 -12
- package/dist/server/h3/index.mjs +1 -1
- package/dist/server/hono/index.d.mts +1 -1
- package/dist/server/hono/index.d.ts +1 -1
- package/dist/server/hono/index.js +13 -13
- package/dist/server/hono/index.mjs +1 -1
- package/dist/server/hyper-express/index.d.mts +1 -1
- package/dist/server/hyper-express/index.d.ts +1 -1
- package/dist/server/hyper-express/index.js +13 -13
- package/dist/server/hyper-express/index.mjs +1 -1
- package/dist/server/koa/index.d.mts +1 -1
- package/dist/server/koa/index.d.ts +1 -1
- package/dist/server/koa/index.js +14 -14
- package/dist/server/koa/index.mjs +1 -1
- package/dist/test.d.mts +1 -1
- package/dist/test.d.ts +1 -1
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-2HVTWYS2.js +0 -279
- package/dist/chunk-SXOZVIKW.mjs +0 -279
|
@@ -0,0 +1,233 @@
|
|
|
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 Patch(route = "") {
|
|
135
|
+
return Route(route, "patch");
|
|
136
|
+
}
|
|
137
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Patch, "Patch");
|
|
138
|
+
function Delete(route = "") {
|
|
139
|
+
return Route(route, "delete");
|
|
140
|
+
}
|
|
141
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Delete, "Delete");
|
|
142
|
+
function Controller(prefix = "") {
|
|
143
|
+
return (target) => {
|
|
144
|
+
_phecdacore.setMeta.call(void 0, target, void 0, void 0, {
|
|
145
|
+
controller: "http",
|
|
146
|
+
http: {
|
|
147
|
+
prefix
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Controller, "Controller");
|
|
153
|
+
|
|
154
|
+
// src/decorators/rpc.ts
|
|
155
|
+
|
|
156
|
+
function Queue(queue = "", isEvent) {
|
|
157
|
+
return (target, property) => {
|
|
158
|
+
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
159
|
+
rpc: {
|
|
160
|
+
queue,
|
|
161
|
+
isEvent
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Queue, "Queue");
|
|
167
|
+
function Rpc() {
|
|
168
|
+
return (target) => {
|
|
169
|
+
_phecdacore.setMeta.call(void 0, target, void 0, void 0, {
|
|
170
|
+
controller: "rpc"
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Rpc, "Rpc");
|
|
175
|
+
|
|
176
|
+
// src/decorators/ctx.ts
|
|
177
|
+
|
|
178
|
+
var Ctx = /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (target, property) => {
|
|
179
|
+
_phecdacore.setMeta.call(void 0, target, _phecdacore.SHARE_KEY, void 0, {
|
|
180
|
+
ctxs: [
|
|
181
|
+
property
|
|
182
|
+
]
|
|
183
|
+
});
|
|
184
|
+
}, "Ctx");
|
|
185
|
+
function Define(key, value) {
|
|
186
|
+
return (target, property, index) => {
|
|
187
|
+
if (typeof index === "number") {
|
|
188
|
+
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
189
|
+
params: [
|
|
190
|
+
{
|
|
191
|
+
define: {
|
|
192
|
+
[key]: value
|
|
193
|
+
},
|
|
194
|
+
index
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
});
|
|
198
|
+
} else {
|
|
199
|
+
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
200
|
+
define: {
|
|
201
|
+
[key]: value
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Define, "Define");
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
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.Patch = Patch; exports.Delete = Delete; exports.Controller = Controller; exports.Queue = Queue; exports.Rpc = Rpc; exports.Ctx = Ctx; exports.Define = Define;
|
|
@@ -14,7 +14,9 @@ var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefau
|
|
|
14
14
|
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
15
15
|
|
|
16
16
|
// src/pipe.ts
|
|
17
|
-
var
|
|
17
|
+
var defaultPipe = /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, ({ 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
|
-
_chunkGHFSIZUOjs.__name.call(void 0, this, "
|
|
48
|
+
_chunkGHFSIZUOjs.__name.call(void 0, 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 (_phecdacore.isPhecda.call(void 0, reflect)) {
|
|
56
|
-
const instance = _phecdacore.plainToClass.call(void 0, reflect, arg);
|
|
57
|
-
const err = _phecdacore.transformInstance.call(void 0, 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
|
-
_chunkGHFSIZUOjs.__name.call(void 0, this, "
|
|
58
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "ValidateException");
|
|
77
59
|
}
|
|
78
60
|
constructor(message) {
|
|
79
|
-
super(message,
|
|
61
|
+
super(message, 400, "Validate exception");
|
|
80
62
|
}
|
|
81
63
|
};
|
|
82
64
|
|
|
@@ -557,4 +539,4 @@ _chunkGHFSIZUOjs.__name.call(void 0, detectAopDep, "detectAopDep");
|
|
|
557
539
|
|
|
558
540
|
|
|
559
541
|
|
|
560
|
-
exports.
|
|
542
|
+
exports.defaultPipe = defaultPipe; exports.Exception = Exception; exports.UndefinedException = UndefinedException; exports.ValidateException = ValidateException; exports.ForbiddenException = ForbiddenException; exports.BadRequestException = BadRequestException; exports.NotFoundException = NotFoundException; exports.ConflictException = ConflictException; exports.BadGatewayException = BadGatewayException; exports.InvalidInputException = InvalidInputException; exports.UnsupportedMediaTypeException = UnsupportedMediaTypeException; exports.PayloadLargeException = PayloadLargeException; exports.TimeoutException = TimeoutException; exports.UnauthorizedException = UnauthorizedException; exports.ServiceUnavailableException = ServiceUnavailableException; exports.FrameworkException = FrameworkException; exports.TimerException = TimerException; exports.WorkerException = WorkerException; exports.HMR = HMR; exports.resolveDep = resolveDep; exports.argToReq = argToReq; exports.genClientQueue = genClientQueue; exports.shallowClone = shallowClone; exports.mergeObject = mergeObject; exports.createControllerMetaMap = createControllerMetaMap; exports.detectAopDep = detectAopDep; exports.Context = Context; exports.addPlugin = addPlugin; exports.addPipe = addPipe; exports.addFilter = addFilter; exports.addGuard = addGuard; exports.addInterceptor = addInterceptor;
|
|
@@ -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,11 +153,11 @@ 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;
|
|
@@ -168,8 +168,7 @@ declare function Patch(route?: string): MethodDecorator;
|
|
|
168
168
|
declare function Delete(route?: string): MethodDecorator;
|
|
169
169
|
declare function Controller(prefix?: string): (target: any) => void;
|
|
170
170
|
|
|
171
|
-
declare function
|
|
172
|
-
declare function Queue(queue?: string): (target: any, k?: PropertyKey) => void;
|
|
171
|
+
declare function Queue(queue?: string, isEvent?: boolean): (target: any, property?: PropertyKey) => void;
|
|
173
172
|
declare function Rpc(): ClassDecorator;
|
|
174
173
|
|
|
175
174
|
declare const Ctx: PropertyDecorator;
|
|
@@ -247,4 +246,4 @@ type LogLevel = 'error' | 'info' | 'warn' | 'log';
|
|
|
247
246
|
declare function setLogger(logger: Record<LogLevel, (msg: string) => void>): void;
|
|
248
247
|
declare function log(msg: string, level?: LogLevel): void;
|
|
249
248
|
|
|
250
|
-
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter,
|
|
249
|
+
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, 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,11 +153,11 @@ 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;
|
|
@@ -168,8 +168,7 @@ declare function Patch(route?: string): MethodDecorator;
|
|
|
168
168
|
declare function Delete(route?: string): MethodDecorator;
|
|
169
169
|
declare function Controller(prefix?: string): (target: any) => void;
|
|
170
170
|
|
|
171
|
-
declare function
|
|
172
|
-
declare function Queue(queue?: string): (target: any, k?: PropertyKey) => void;
|
|
171
|
+
declare function Queue(queue?: string, isEvent?: boolean): (target: any, property?: PropertyKey) => void;
|
|
173
172
|
declare function Rpc(): ClassDecorator;
|
|
174
173
|
|
|
175
174
|
declare const Ctx: PropertyDecorator;
|
|
@@ -247,4 +246,4 @@ type LogLevel = 'error' | 'info' | 'warn' | 'log';
|
|
|
247
246
|
declare function setLogger(logger: Record<LogLevel, (msg: string) => void>): void;
|
|
248
247
|
declare function log(msg: string, level?: LogLevel): void;
|
|
249
248
|
|
|
250
|
-
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter,
|
|
249
|
+
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, ServerBase, ServiceUnavailableException, TimeoutException, TimerException, UnauthorizedException, UndefinedException, UnsupportedMediaTypeException, ValidateException, WorkerException, addFilter, addGuard, addInterceptor, addPipe, addPlugin, defaultPipe, log, setLogger };
|