phecda-server 5.3.0 → 5.3.2
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-AUAAKHWS.js → chunk-2HVTWYS2.js} +38 -43
- package/dist/{chunk-BZKJ5NBU.mjs → chunk-3IPYLGY2.mjs} +1 -1
- package/dist/{chunk-RVWBJ6LV.js → chunk-GHFSIZUO.js} +2 -10
- package/dist/{chunk-LHLQIQPH.mjs → chunk-NT6HEBC6.mjs} +1 -1
- package/dist/{chunk-QYX5Q7KO.js → chunk-RZ7IXJYQ.js} +60 -60
- package/dist/{chunk-5E2AVYP2.mjs → chunk-SXOZVIKW.mjs} +3 -8
- package/dist/{chunk-N4ULJDEQ.js → chunk-UIKQNJN3.js} +19 -19
- package/dist/{chunk-MESZCLSS.mjs → chunk-UXD62LGG.mjs} +2 -10
- package/dist/helper.js +3 -3
- package/dist/helper.mjs +2 -2
- package/dist/index.d.mts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +43 -48
- package/dist/index.mjs +7 -12
- package/dist/rpc/bullmq/index.js +12 -12
- package/dist/rpc/bullmq/index.mjs +2 -2
- package/dist/rpc/kafka/index.js +12 -12
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/nats/index.js +11 -11
- package/dist/rpc/nats/index.mjs +2 -2
- package/dist/rpc/rabbitmq/index.js +13 -13
- package/dist/rpc/rabbitmq/index.mjs +2 -2
- package/dist/rpc/redis/index.js +11 -11
- package/dist/rpc/redis/index.mjs +2 -2
- package/dist/server/elysia/index.js +32 -32
- package/dist/server/elysia/index.mjs +3 -3
- package/dist/server/express/index.js +30 -30
- package/dist/server/express/index.mjs +2 -2
- package/dist/server/fastify/index.js +31 -31
- package/dist/server/fastify/index.mjs +3 -3
- package/dist/server/h3/index.js +30 -30
- package/dist/server/h3/index.mjs +2 -2
- package/dist/server/hono/index.js +29 -29
- package/dist/server/hono/index.mjs +2 -2
- package/dist/server/hyper-express/index.js +29 -29
- package/dist/server/hyper-express/index.mjs +2 -2
- package/dist/server/koa/index.js +30 -30
- package/dist/server/koa/index.mjs +2 -2
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/package.json +3 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkRZ7IXJYQjs = require('./chunk-RZ7IXJYQ.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkGHFSIZUOjs = require('./chunk-GHFSIZUO.js');
|
|
8
8
|
|
|
9
9
|
// src/decorators/param.ts
|
|
10
10
|
var _phecdacore = require('phecda-core');
|
|
@@ -14,7 +14,7 @@ function BaseParam(data) {
|
|
|
14
14
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
15
15
|
if (!state.params) state.params = [
|
|
16
16
|
..._optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _ => _.params]) || []
|
|
17
|
-
].map(
|
|
17
|
+
].map(_chunkRZ7IXJYQjs.shallowClone);
|
|
18
18
|
const existItem = state.params.find((item) => item.index === index);
|
|
19
19
|
if (existItem) Object.assign(existItem, data);
|
|
20
20
|
else state.params.push({
|
|
@@ -24,42 +24,42 @@ function BaseParam(data) {
|
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
_chunkGHFSIZUOjs.__name.call(void 0, BaseParam, "BaseParam");
|
|
28
28
|
function Body(key = "") {
|
|
29
29
|
return BaseParam({
|
|
30
30
|
type: "body",
|
|
31
31
|
key
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Body, "Body");
|
|
35
35
|
function Head(key) {
|
|
36
36
|
return BaseParam({
|
|
37
37
|
type: "headers",
|
|
38
38
|
key: key.toLowerCase()
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Head, "Head");
|
|
42
42
|
function Query(key = "") {
|
|
43
43
|
return BaseParam({
|
|
44
44
|
type: "query",
|
|
45
45
|
key
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Query, "Query");
|
|
49
49
|
function Param(key) {
|
|
50
50
|
return BaseParam({
|
|
51
51
|
type: "params",
|
|
52
52
|
key
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Param, "Param");
|
|
56
56
|
function Arg(target, k, index) {
|
|
57
57
|
BaseParam({
|
|
58
58
|
type: "args",
|
|
59
59
|
key: `${index}`
|
|
60
60
|
})(target, k, index);
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Arg, "Arg");
|
|
63
63
|
|
|
64
64
|
// src/decorators/aop.ts
|
|
65
65
|
|
|
@@ -76,7 +76,7 @@ function Guard(...guards) {
|
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Guard, "Guard");
|
|
80
80
|
function Plugin(...plugins) {
|
|
81
81
|
return (target, k) => {
|
|
82
82
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
@@ -90,7 +90,7 @@ function Plugin(...plugins) {
|
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Plugin, "Plugin");
|
|
94
94
|
function Interceptor(...interceptors) {
|
|
95
95
|
return (target, k) => {
|
|
96
96
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
@@ -104,13 +104,13 @@ function Interceptor(...interceptors) {
|
|
|
104
104
|
});
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Interceptor, "Interceptor");
|
|
108
108
|
function Filter(filter) {
|
|
109
109
|
return (target, k) => {
|
|
110
110
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => state.filter = filter);
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Filter, "Filter");
|
|
114
114
|
function Pipe(pipe) {
|
|
115
115
|
return (target, k, index) => {
|
|
116
116
|
if (typeof index === "number") {
|
|
@@ -122,86 +122,86 @@ function Pipe(pipe) {
|
|
|
122
122
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => state.pipe = pipe);
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Pipe, "Pipe");
|
|
126
126
|
|
|
127
127
|
// src/decorators/http.ts
|
|
128
128
|
|
|
129
129
|
function Route(route, type) {
|
|
130
130
|
return (target, k) => {
|
|
131
131
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
132
|
-
state.http =
|
|
132
|
+
state.http = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.http || _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _5 => _5.http]), {
|
|
133
133
|
route,
|
|
134
134
|
type
|
|
135
135
|
});
|
|
136
136
|
});
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Route, "Route");
|
|
140
140
|
function Header(headers) {
|
|
141
141
|
return (target, k) => {
|
|
142
142
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
143
|
-
if (!state.http) state.http =
|
|
144
|
-
state.http =
|
|
145
|
-
headers:
|
|
143
|
+
if (!state.http) state.http = _chunkRZ7IXJYQjs.mergeObject.call(void 0, _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _6 => _6.http]));
|
|
144
|
+
state.http = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.http, {
|
|
145
|
+
headers: _chunkRZ7IXJYQjs.mergeObject.call(void 0, _optionalChain([state, 'access', _7 => _7.http, 'optionalAccess', _8 => _8.headers]), headers)
|
|
146
146
|
});
|
|
147
147
|
});
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Header, "Header");
|
|
151
151
|
function Get(route = "") {
|
|
152
152
|
return Route(route, "get");
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Get, "Get");
|
|
155
155
|
function Post(route = "") {
|
|
156
156
|
return Route(route, "post");
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Post, "Post");
|
|
159
159
|
function Put(route = "") {
|
|
160
160
|
return Route(route, "put");
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Put, "Put");
|
|
163
163
|
function Patch(route = "") {
|
|
164
164
|
return Route(route, "patch");
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Patch, "Patch");
|
|
167
167
|
function Delete(route = "") {
|
|
168
168
|
return Route(route, "delete");
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Delete, "Delete");
|
|
171
171
|
function Controller(prefix = "") {
|
|
172
172
|
return (target) => {
|
|
173
173
|
_phecdacore.setPropertyState.call(void 0, target, void 0, (state) => {
|
|
174
174
|
state.controller = "http";
|
|
175
|
-
state.http =
|
|
175
|
+
state.http = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.http || _optionalChain([_phecdacore.getState.call(void 0, target), 'optionalAccess', _9 => _9.http]), {
|
|
176
176
|
prefix
|
|
177
177
|
});
|
|
178
178
|
});
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Controller, "Controller");
|
|
182
182
|
|
|
183
183
|
// src/decorators/rpc.ts
|
|
184
184
|
|
|
185
185
|
function Event(isEvent = true) {
|
|
186
186
|
return (target, k) => {
|
|
187
187
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
188
|
-
state.rpc =
|
|
188
|
+
state.rpc = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.rpc || _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _10 => _10.rpc]), {
|
|
189
189
|
isEvent
|
|
190
190
|
});
|
|
191
191
|
});
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Event, "Event");
|
|
195
195
|
function Queue(queue = "") {
|
|
196
196
|
return (target, k) => {
|
|
197
197
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
198
|
-
state.rpc =
|
|
198
|
+
state.rpc = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.rpc || _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _11 => _11.rpc]), {
|
|
199
199
|
queue
|
|
200
200
|
});
|
|
201
201
|
});
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
|
-
|
|
204
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Queue, "Queue");
|
|
205
205
|
function Rpc() {
|
|
206
206
|
return (target) => {
|
|
207
207
|
_phecdacore.setPropertyState.call(void 0, target, void 0, (state) => {
|
|
@@ -209,15 +209,11 @@ function Rpc() {
|
|
|
209
209
|
});
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Rpc, "Rpc");
|
|
213
213
|
|
|
214
214
|
// src/decorators/ctx.ts
|
|
215
215
|
|
|
216
|
-
|
|
217
|
-
return (target) => _phecdacore.Empty.call(void 0, target);
|
|
218
|
-
}
|
|
219
|
-
_chunkRVWBJ6LVjs.__name.call(void 0, Injectable, "Injectable");
|
|
220
|
-
var Ctx = /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (target, key) => {
|
|
216
|
+
var Ctx = /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (target, key) => {
|
|
221
217
|
_phecdacore.setPropertyState.call(void 0, target, _phecdacore.SHARE_KEY, (state) => {
|
|
222
218
|
if (!state.ctxs) state.ctxs = /* @__PURE__ */ new Set([
|
|
223
219
|
..._optionalChain([_phecdacore.getState.call(void 0, target), 'optionalAccess', _12 => _12.ctxs]) || []
|
|
@@ -232,9 +228,9 @@ function Define(key, value) {
|
|
|
232
228
|
const parentState = _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _13 => _13.params]) || [];
|
|
233
229
|
if (!state.params) state.params = [
|
|
234
230
|
...parentState
|
|
235
|
-
].map(
|
|
231
|
+
].map(_chunkRZ7IXJYQjs.shallowClone);
|
|
236
232
|
const existItem = state.params.find((item) => item.index === index);
|
|
237
|
-
if (existItem) existItem.define =
|
|
233
|
+
if (existItem) existItem.define = _chunkRZ7IXJYQjs.mergeObject.call(void 0, existItem.define, {
|
|
238
234
|
[key]: value
|
|
239
235
|
});
|
|
240
236
|
else state.params.push({
|
|
@@ -248,13 +244,12 @@ function Define(key, value) {
|
|
|
248
244
|
}
|
|
249
245
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
250
246
|
const parentState = _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _14 => _14.define]);
|
|
251
|
-
if (!state.define) state.define =
|
|
247
|
+
if (!state.define) state.define = _chunkRZ7IXJYQjs.mergeObject.call(void 0, parentState);
|
|
252
248
|
state.define[key] = value;
|
|
253
249
|
});
|
|
254
250
|
};
|
|
255
251
|
}
|
|
256
|
-
|
|
257
|
-
|
|
252
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Define, "Define");
|
|
258
253
|
|
|
259
254
|
|
|
260
255
|
|
|
@@ -281,4 +276,4 @@ _chunkRVWBJ6LVjs.__name.call(void 0, Define, "Define");
|
|
|
281
276
|
|
|
282
277
|
|
|
283
278
|
|
|
284
|
-
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.Event = Event; exports.Queue = Queue; exports.Rpc = Rpc; exports.
|
|
279
|
+
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.Event = Event; exports.Queue = Queue; exports.Rpc = Rpc; exports.Ctx = Ctx; exports.Define = Define;
|
|
@@ -15,6 +15,7 @@ var PS_EXIT_CODE;
|
|
|
15
15
|
|
|
16
16
|
// src/utils.ts
|
|
17
17
|
var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
|
|
18
|
+
var _tsmixer = require('ts-mixer');
|
|
18
19
|
var time;
|
|
19
20
|
var internalLogger = console;
|
|
20
21
|
function setLogger(logger) {
|
|
@@ -42,15 +43,6 @@ function log(msg, level = "log") {
|
|
|
42
43
|
internalLogger[level](`${_picocolors2.default.magenta("[phecda-server]")} ${_picocolors2.default.gray(`${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`)} ${_picocolors2.default[color](msg)} ${_picocolors2.default.gray(interval)}`);
|
|
43
44
|
}
|
|
44
45
|
__name(log, "log");
|
|
45
|
-
function Mix(InternalClass, ExtendClass) {
|
|
46
|
-
return class extends InternalClass {
|
|
47
|
-
constructor(...args) {
|
|
48
|
-
super();
|
|
49
|
-
Object.assign(this, new ExtendClass(...args));
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
__name(Mix, "Mix");
|
|
54
46
|
|
|
55
47
|
|
|
56
48
|
|
|
@@ -63,4 +55,4 @@ __name(Mix, "Mix");
|
|
|
63
55
|
|
|
64
56
|
|
|
65
57
|
|
|
66
|
-
exports.__name = __name; exports.ERROR_SYMBOL = ERROR_SYMBOL; exports.IS_HMR = IS_HMR; exports.IS_ONLY_GENERATE = IS_ONLY_GENERATE; exports.IS_STRICT = IS_STRICT; exports.LOG_LEVEL = LOG_LEVEL; exports.PS_EXIT_CODE = PS_EXIT_CODE; exports.setLogger = setLogger; exports.log = log; exports.
|
|
58
|
+
exports.__name = __name; exports.ERROR_SYMBOL = ERROR_SYMBOL; exports.IS_HMR = IS_HMR; exports.IS_ONLY_GENERATE = IS_ONLY_GENERATE; exports.IS_STRICT = IS_STRICT; exports.LOG_LEVEL = LOG_LEVEL; exports.PS_EXIT_CODE = PS_EXIT_CODE; exports.setLogger = setLogger; exports.log = log; exports.Mixin = _tsmixer.Mixin;
|