phecda-server 5.2.2 → 5.2.3
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/bin/cli.mjs +1 -0
- package/dist/{chunk-VMLHTEW3.js → chunk-AWY6FTH4.js} +38 -38
- package/dist/{chunk-ZP7HNASU.js → chunk-FNJWO324.js} +1 -1
- package/dist/{chunk-BSE2DSDK.js → chunk-H6NYBVBV.js} +64 -64
- package/dist/{chunk-V3WIKOP3.mjs → chunk-IJNA24EZ.mjs} +2 -2
- package/dist/{chunk-5BVUCNMA.js → chunk-J5SL4QLN.js} +24 -21
- package/dist/{chunk-JE6BBDXW.mjs → chunk-Q4AGVGVA.mjs} +1 -1
- package/dist/{chunk-VLV3AO3H.mjs → chunk-VYDBNZJ2.mjs} +1 -1
- package/dist/{chunk-CKQW3FDK.mjs → chunk-YAVIRFUE.mjs} +7 -4
- package/dist/helper.js +3 -3
- package/dist/helper.mjs +2 -2
- package/dist/index.js +54 -48
- package/dist/index.mjs +20 -14
- package/dist/rpc/bullmq/index.js +12 -12
- package/dist/rpc/bullmq/index.mjs +2 -2
- package/dist/rpc/kafka/index.js +10 -10
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/nats/index.js +12 -11
- package/dist/rpc/nats/index.mjs +3 -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 +20 -20
- package/dist/server/elysia/index.mjs +3 -3
- package/dist/server/express/index.js +18 -18
- package/dist/server/express/index.mjs +2 -2
- package/dist/server/fastify/index.js +19 -19
- package/dist/server/fastify/index.mjs +3 -3
- package/dist/server/h3/index.js +16 -16
- package/dist/server/h3/index.mjs +2 -2
- package/dist/server/hono/index.js +17 -17
- package/dist/server/hono/index.mjs +2 -2
- package/dist/server/hyper-express/index.js +17 -17
- package/dist/server/hyper-express/index.mjs +2 -2
- package/dist/server/koa/index.js +18 -18
- package/dist/server/koa/index.mjs +2 -2
- package/dist/test.d.ts +1 -1
- package/dist/test.js +8 -8
- package/dist/test.mjs +2 -2
- package/package.json +1 -1
- package/register/loader.mjs +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -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 _chunkH6NYBVBVjs = require('./chunk-H6NYBVBV.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkFNJWO324js = require('./chunk-FNJWO324.js');
|
|
8
8
|
|
|
9
9
|
// src/decorators/param.ts
|
|
10
10
|
var _phecdacore = require('phecda-core');
|
|
@@ -16,7 +16,7 @@ function BaseParam(data) {
|
|
|
16
16
|
if (!state.params)
|
|
17
17
|
state.params = [
|
|
18
18
|
..._optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _ => _.params]) || []
|
|
19
|
-
].map(
|
|
19
|
+
].map(_chunkH6NYBVBVjs.shallowClone);
|
|
20
20
|
const existItem = state.params.find((item) => item.index === index);
|
|
21
21
|
if (existItem)
|
|
22
22
|
Object.assign(existItem, data);
|
|
@@ -28,42 +28,42 @@ function BaseParam(data) {
|
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
_chunkFNJWO324js.__name.call(void 0, BaseParam, "BaseParam");
|
|
32
32
|
function Body(key = "") {
|
|
33
33
|
return BaseParam({
|
|
34
34
|
type: "body",
|
|
35
35
|
key
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
_chunkFNJWO324js.__name.call(void 0, Body, "Body");
|
|
39
39
|
function Head(key) {
|
|
40
40
|
return BaseParam({
|
|
41
41
|
type: "headers",
|
|
42
42
|
key: key.toLowerCase()
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
_chunkFNJWO324js.__name.call(void 0, Head, "Head");
|
|
46
46
|
function Query(key = "") {
|
|
47
47
|
return BaseParam({
|
|
48
48
|
type: "query",
|
|
49
49
|
key
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
_chunkFNJWO324js.__name.call(void 0, Query, "Query");
|
|
53
53
|
function Param(key) {
|
|
54
54
|
return BaseParam({
|
|
55
55
|
type: "params",
|
|
56
56
|
key
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
_chunkFNJWO324js.__name.call(void 0, Param, "Param");
|
|
60
60
|
function Arg(target, k, index) {
|
|
61
61
|
BaseParam({
|
|
62
62
|
type: "args",
|
|
63
63
|
key: `${index}`
|
|
64
64
|
})(target, k, index);
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
_chunkFNJWO324js.__name.call(void 0, Arg, "Arg");
|
|
67
67
|
|
|
68
68
|
// src/decorators/aop.ts
|
|
69
69
|
|
|
@@ -82,7 +82,7 @@ function Guard(...guards) {
|
|
|
82
82
|
});
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
_chunkFNJWO324js.__name.call(void 0, Guard, "Guard");
|
|
86
86
|
function Plugin(...plugins) {
|
|
87
87
|
return (target, k) => {
|
|
88
88
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
@@ -98,7 +98,7 @@ function Plugin(...plugins) {
|
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
_chunkFNJWO324js.__name.call(void 0, Plugin, "Plugin");
|
|
102
102
|
function Interceptor(...interceptors) {
|
|
103
103
|
return (target, k) => {
|
|
104
104
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
@@ -114,13 +114,13 @@ function Interceptor(...interceptors) {
|
|
|
114
114
|
});
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
_chunkFNJWO324js.__name.call(void 0, Interceptor, "Interceptor");
|
|
118
118
|
function Filter(filter) {
|
|
119
119
|
return (target, k) => {
|
|
120
120
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => state.filter = filter);
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
_chunkFNJWO324js.__name.call(void 0, Filter, "Filter");
|
|
124
124
|
function Pipe(pipe) {
|
|
125
125
|
return (target, k, index) => {
|
|
126
126
|
if (typeof index === "number") {
|
|
@@ -132,87 +132,87 @@ function Pipe(pipe) {
|
|
|
132
132
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => state.pipe = pipe);
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
_chunkFNJWO324js.__name.call(void 0, Pipe, "Pipe");
|
|
136
136
|
|
|
137
137
|
// src/decorators/http.ts
|
|
138
138
|
|
|
139
139
|
function Route(route, type) {
|
|
140
140
|
return (target, k) => {
|
|
141
141
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
142
|
-
state.http =
|
|
142
|
+
state.http = _chunkH6NYBVBVjs.mergeObject.call(void 0, state.http || _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _5 => _5.http]), {
|
|
143
143
|
route,
|
|
144
144
|
type
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
_chunkFNJWO324js.__name.call(void 0, Route, "Route");
|
|
150
150
|
function Header(headers) {
|
|
151
151
|
return (target, k) => {
|
|
152
152
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
153
153
|
if (!state.http)
|
|
154
|
-
state.http =
|
|
155
|
-
state.http =
|
|
156
|
-
headers:
|
|
154
|
+
state.http = _chunkH6NYBVBVjs.mergeObject.call(void 0, _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _6 => _6.http]));
|
|
155
|
+
state.http = _chunkH6NYBVBVjs.mergeObject.call(void 0, state.http, {
|
|
156
|
+
headers: _chunkH6NYBVBVjs.mergeObject.call(void 0, _optionalChain([state, 'access', _7 => _7.http, 'optionalAccess', _8 => _8.headers]), headers)
|
|
157
157
|
});
|
|
158
158
|
});
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
|
-
|
|
161
|
+
_chunkFNJWO324js.__name.call(void 0, Header, "Header");
|
|
162
162
|
function Get(route = "") {
|
|
163
163
|
return Route(route, "get");
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
_chunkFNJWO324js.__name.call(void 0, Get, "Get");
|
|
166
166
|
function Post(route = "") {
|
|
167
167
|
return Route(route, "post");
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
_chunkFNJWO324js.__name.call(void 0, Post, "Post");
|
|
170
170
|
function Put(route = "") {
|
|
171
171
|
return Route(route, "put");
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
_chunkFNJWO324js.__name.call(void 0, Put, "Put");
|
|
174
174
|
function Patch(route = "") {
|
|
175
175
|
return Route(route, "patch");
|
|
176
176
|
}
|
|
177
|
-
|
|
177
|
+
_chunkFNJWO324js.__name.call(void 0, Patch, "Patch");
|
|
178
178
|
function Delete(route = "") {
|
|
179
179
|
return Route(route, "delete");
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
_chunkFNJWO324js.__name.call(void 0, Delete, "Delete");
|
|
182
182
|
function Controller(prefix = "") {
|
|
183
183
|
return (target) => {
|
|
184
184
|
_phecdacore.setPropertyState.call(void 0, target, void 0, (state) => {
|
|
185
185
|
state.controller = "http";
|
|
186
|
-
state.http =
|
|
186
|
+
state.http = _chunkH6NYBVBVjs.mergeObject.call(void 0, state.http || _optionalChain([_phecdacore.getState.call(void 0, target), 'optionalAccess', _9 => _9.http]), {
|
|
187
187
|
prefix
|
|
188
188
|
});
|
|
189
189
|
});
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
_chunkFNJWO324js.__name.call(void 0, Controller, "Controller");
|
|
193
193
|
|
|
194
194
|
// src/decorators/rpc.ts
|
|
195
195
|
|
|
196
196
|
function Event(isEvent = true) {
|
|
197
197
|
return (target, k) => {
|
|
198
198
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
199
|
-
state.rpc =
|
|
199
|
+
state.rpc = _chunkH6NYBVBVjs.mergeObject.call(void 0, state.rpc || _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _10 => _10.rpc]), {
|
|
200
200
|
isEvent
|
|
201
201
|
});
|
|
202
202
|
});
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
_chunkFNJWO324js.__name.call(void 0, Event, "Event");
|
|
206
206
|
function Queue(queue = "") {
|
|
207
207
|
return (target, k) => {
|
|
208
208
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
209
|
-
state.rpc =
|
|
209
|
+
state.rpc = _chunkH6NYBVBVjs.mergeObject.call(void 0, state.rpc || _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _11 => _11.rpc]), {
|
|
210
210
|
queue
|
|
211
211
|
});
|
|
212
212
|
});
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
_chunkFNJWO324js.__name.call(void 0, Queue, "Queue");
|
|
216
216
|
function Rpc() {
|
|
217
217
|
return (target) => {
|
|
218
218
|
_phecdacore.setPropertyState.call(void 0, target, void 0, (state) => {
|
|
@@ -220,15 +220,15 @@ function Rpc() {
|
|
|
220
220
|
});
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
|
-
|
|
223
|
+
_chunkFNJWO324js.__name.call(void 0, Rpc, "Rpc");
|
|
224
224
|
|
|
225
225
|
// src/decorators/ctx.ts
|
|
226
226
|
|
|
227
227
|
function Injectable() {
|
|
228
228
|
return (target) => _phecdacore.Empty.call(void 0, target);
|
|
229
229
|
}
|
|
230
|
-
|
|
231
|
-
var Ctx = /* @__PURE__ */
|
|
230
|
+
_chunkFNJWO324js.__name.call(void 0, Injectable, "Injectable");
|
|
231
|
+
var Ctx = /* @__PURE__ */ _chunkFNJWO324js.__name.call(void 0, (target, key) => {
|
|
232
232
|
_phecdacore.setPropertyState.call(void 0, target, _phecdacore.SHARE_KEY, (state) => {
|
|
233
233
|
if (!state.ctxs)
|
|
234
234
|
state.ctxs = /* @__PURE__ */ new Set([
|
|
@@ -245,10 +245,10 @@ function Define(key, value) {
|
|
|
245
245
|
if (!state.params)
|
|
246
246
|
state.params = [
|
|
247
247
|
...parentState
|
|
248
|
-
].map(
|
|
248
|
+
].map(_chunkH6NYBVBVjs.shallowClone);
|
|
249
249
|
const existItem = state.params.find((item) => item.index === index);
|
|
250
250
|
if (existItem)
|
|
251
|
-
existItem.define =
|
|
251
|
+
existItem.define = _chunkH6NYBVBVjs.mergeObject.call(void 0, existItem.define, {
|
|
252
252
|
[key]: value
|
|
253
253
|
});
|
|
254
254
|
else
|
|
@@ -264,12 +264,12 @@ function Define(key, value) {
|
|
|
264
264
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
265
265
|
const parentState = _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _14 => _14.define]);
|
|
266
266
|
if (!state.define)
|
|
267
|
-
state.define =
|
|
267
|
+
state.define = _chunkH6NYBVBVjs.mergeObject.call(void 0, parentState);
|
|
268
268
|
state.define[key] = value;
|
|
269
269
|
});
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
|
-
|
|
272
|
+
_chunkFNJWO324js.__name.call(void 0, Define, "Define");
|
|
273
273
|
|
|
274
274
|
|
|
275
275
|
|
|
@@ -42,7 +42,7 @@ function log(msg, level = "log") {
|
|
|
42
42
|
warn: "yellow",
|
|
43
43
|
log: "green"
|
|
44
44
|
}[level];
|
|
45
|
-
const date = new Date();
|
|
45
|
+
const date = /* @__PURE__ */ new Date();
|
|
46
46
|
const current = Date.now();
|
|
47
47
|
const interval = time && current - time ? `+${current - time}` : "";
|
|
48
48
|
time = current;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkFNJWO324js = require('./chunk-FNJWO324.js');
|
|
10
10
|
|
|
11
11
|
// src/helper.ts
|
|
12
12
|
var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
|
|
@@ -33,11 +33,11 @@ var Exception = class extends Error {
|
|
|
33
33
|
message: this.message,
|
|
34
34
|
description: this.description,
|
|
35
35
|
status: this.status,
|
|
36
|
-
[
|
|
36
|
+
[_chunkFNJWO324js.ERROR_SYMBOL]: true
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
_chunkFNJWO324js.__name.call(void 0, Exception, "Exception");
|
|
41
41
|
|
|
42
42
|
// src/exception/validate.ts
|
|
43
43
|
var ValidateException = class extends Exception {
|
|
@@ -45,10 +45,10 @@ var ValidateException = class extends Exception {
|
|
|
45
45
|
super(message, 400, "Validate exception");
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
_chunkFNJWO324js.__name.call(void 0, ValidateException, "ValidateException");
|
|
49
49
|
|
|
50
50
|
// src/pipe.ts
|
|
51
|
-
var defaultPipe = /* @__PURE__ */
|
|
51
|
+
var defaultPipe = /* @__PURE__ */ _chunkFNJWO324js.__name.call(void 0, ({ arg, reflect, index }) => {
|
|
52
52
|
if (_phecdacore.isPhecda.call(void 0, reflect)) {
|
|
53
53
|
const instance = _phecdacore.plainToClass.call(void 0, reflect, arg);
|
|
54
54
|
const err = _phecdacore.transformInstance.call(void 0, instance);
|
|
@@ -76,7 +76,7 @@ var UndefinedException = class extends Exception {
|
|
|
76
76
|
super(message, 500, "Undefined error");
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
|
-
|
|
79
|
+
_chunkFNJWO324js.__name.call(void 0, UndefinedException, "UndefinedException");
|
|
80
80
|
|
|
81
81
|
// src/exception/forbidden.ts
|
|
82
82
|
var ForbiddenException = class extends Exception {
|
|
@@ -84,7 +84,7 @@ var ForbiddenException = class extends Exception {
|
|
|
84
84
|
super(message, 403, "Forbidden resource");
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
|
|
87
|
+
_chunkFNJWO324js.__name.call(void 0, ForbiddenException, "ForbiddenException");
|
|
88
88
|
|
|
89
89
|
// src/exception/bad-request.ts
|
|
90
90
|
var BadRequestException = class extends Exception {
|
|
@@ -92,7 +92,7 @@ var BadRequestException = class extends Exception {
|
|
|
92
92
|
super(message, 400, "Bad Request");
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
|
-
|
|
95
|
+
_chunkFNJWO324js.__name.call(void 0, BadRequestException, "BadRequestException");
|
|
96
96
|
|
|
97
97
|
// src/exception/not-found.ts
|
|
98
98
|
var NotFoundException = class extends Exception {
|
|
@@ -100,7 +100,7 @@ var NotFoundException = class extends Exception {
|
|
|
100
100
|
super(message, 404, "Not Found");
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
|
|
103
|
+
_chunkFNJWO324js.__name.call(void 0, NotFoundException, "NotFoundException");
|
|
104
104
|
|
|
105
105
|
// src/exception/conflict.ts
|
|
106
106
|
var ConflictException = class extends Exception {
|
|
@@ -108,7 +108,7 @@ var ConflictException = class extends Exception {
|
|
|
108
108
|
super(message, 409, "Conflict");
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
-
|
|
111
|
+
_chunkFNJWO324js.__name.call(void 0, ConflictException, "ConflictException");
|
|
112
112
|
|
|
113
113
|
// src/exception/bad-gateway.ts
|
|
114
114
|
var BadGatewayException = class extends Exception {
|
|
@@ -116,7 +116,7 @@ var BadGatewayException = class extends Exception {
|
|
|
116
116
|
super(message, 502, "Bad Gatrway");
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
|
-
|
|
119
|
+
_chunkFNJWO324js.__name.call(void 0, BadGatewayException, "BadGatewayException");
|
|
120
120
|
|
|
121
121
|
// src/exception/invalid-input.ts
|
|
122
122
|
var InvalidInputException = class extends Exception {
|
|
@@ -124,7 +124,7 @@ var InvalidInputException = class extends Exception {
|
|
|
124
124
|
super(message, 502, "Invalid Input");
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
|
-
|
|
127
|
+
_chunkFNJWO324js.__name.call(void 0, InvalidInputException, "InvalidInputException");
|
|
128
128
|
|
|
129
129
|
// src/exception/media-type.ts
|
|
130
130
|
var UnsupportedMediaTypeException = class extends Exception {
|
|
@@ -132,7 +132,7 @@ var UnsupportedMediaTypeException = class extends Exception {
|
|
|
132
132
|
super(message, 415, "Unsupported Media Type");
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
|
-
|
|
135
|
+
_chunkFNJWO324js.__name.call(void 0, UnsupportedMediaTypeException, "UnsupportedMediaTypeException");
|
|
136
136
|
|
|
137
137
|
// src/exception/payload-large.ts
|
|
138
138
|
var PayloadLargeException = class extends Exception {
|
|
@@ -140,7 +140,7 @@ var PayloadLargeException = class extends Exception {
|
|
|
140
140
|
super(message, 413, "Payload Too Large");
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
|
-
|
|
143
|
+
_chunkFNJWO324js.__name.call(void 0, PayloadLargeException, "PayloadLargeException");
|
|
144
144
|
|
|
145
145
|
// src/exception/timeout.ts
|
|
146
146
|
var TimeoutException = class extends Exception {
|
|
@@ -148,7 +148,7 @@ var TimeoutException = class extends Exception {
|
|
|
148
148
|
super(message, 408, "Request Timeout");
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
|
-
|
|
151
|
+
_chunkFNJWO324js.__name.call(void 0, TimeoutException, "TimeoutException");
|
|
152
152
|
|
|
153
153
|
// src/exception/unauthorized.ts
|
|
154
154
|
var UnauthorizedException = class extends Exception {
|
|
@@ -156,7 +156,7 @@ var UnauthorizedException = class extends Exception {
|
|
|
156
156
|
super(message, 401, "Unauthorized");
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
|
-
|
|
159
|
+
_chunkFNJWO324js.__name.call(void 0, UnauthorizedException, "UnauthorizedException");
|
|
160
160
|
|
|
161
161
|
// src/exception/unavailable-service.ts
|
|
162
162
|
var ServiceUnavailableException = class extends Exception {
|
|
@@ -164,7 +164,7 @@ var ServiceUnavailableException = class extends Exception {
|
|
|
164
164
|
super(message, 503, "Service Unavailable");
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
|
-
|
|
167
|
+
_chunkFNJWO324js.__name.call(void 0, ServiceUnavailableException, "ServiceUnavailableException");
|
|
168
168
|
|
|
169
169
|
// src/exception/framework.ts
|
|
170
170
|
var FrameworkException = class extends Exception {
|
|
@@ -172,7 +172,7 @@ var FrameworkException = class extends Exception {
|
|
|
172
172
|
super(`[phecda-server] ${message}`, 500, "Framework Error");
|
|
173
173
|
}
|
|
174
174
|
};
|
|
175
|
-
|
|
175
|
+
_chunkFNJWO324js.__name.call(void 0, FrameworkException, "FrameworkException");
|
|
176
176
|
|
|
177
177
|
// src/exception/timer.ts
|
|
178
178
|
var TimerException = class extends Exception {
|
|
@@ -180,7 +180,7 @@ var TimerException = class extends Exception {
|
|
|
180
180
|
super(message, 0, "Timer Error");
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
|
-
|
|
183
|
+
_chunkFNJWO324js.__name.call(void 0, TimerException, "TimerException");
|
|
184
184
|
|
|
185
185
|
// src/exception/worker.ts
|
|
186
186
|
var WorkerException = class extends Exception {
|
|
@@ -188,18 +188,18 @@ var WorkerException = class extends Exception {
|
|
|
188
188
|
super(message, 0, "Worker Error");
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
|
-
|
|
191
|
+
_chunkFNJWO324js.__name.call(void 0, WorkerException, "WorkerException");
|
|
192
192
|
|
|
193
193
|
// src/filter.ts
|
|
194
|
-
var defaultFilter = /* @__PURE__ */
|
|
194
|
+
var defaultFilter = /* @__PURE__ */ _chunkFNJWO324js.__name.call(void 0, (e) => {
|
|
195
195
|
if (!(e instanceof Exception)) {
|
|
196
|
-
|
|
197
|
-
if (
|
|
196
|
+
_chunkFNJWO324js.log.call(void 0, e.message, "error");
|
|
197
|
+
if (_chunkFNJWO324js.LOG_LEVEL <= 0)
|
|
198
198
|
console.error(e.stack);
|
|
199
199
|
e = new UndefinedException(e.message || e);
|
|
200
200
|
} else {
|
|
201
|
-
|
|
202
|
-
if (
|
|
201
|
+
_chunkFNJWO324js.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
|
|
202
|
+
if (_chunkFNJWO324js.LOG_LEVEL <= 0)
|
|
203
203
|
console.error(e.stack);
|
|
204
204
|
}
|
|
205
205
|
return e.data;
|
|
@@ -214,7 +214,7 @@ var _Context = class {
|
|
|
214
214
|
|
|
215
215
|
constructor(data) {
|
|
216
216
|
this.data = data;
|
|
217
|
-
if (
|
|
217
|
+
if (_chunkFNJWO324js.IS_HMR)
|
|
218
218
|
data._context = this;
|
|
219
219
|
}
|
|
220
220
|
async run(opts, successCb, failCb) {
|
|
@@ -257,7 +257,7 @@ var _Context = class {
|
|
|
257
257
|
usePipe(args) {
|
|
258
258
|
return Promise.all(args.map((item) => {
|
|
259
259
|
if (item.pipe && !_Context.pipeRecord[item.pipe]) {
|
|
260
|
-
if (
|
|
260
|
+
if (_chunkFNJWO324js.IS_STRICT) {
|
|
261
261
|
throw new FrameworkException(`can't find pipe named '${item.pipe}'`);
|
|
262
262
|
} else {
|
|
263
263
|
debug(`Can't find pipe named "${item.pipe}" when handling the ${item.index + 1}th argument of the func "${this.data.func}" on module "${this.data.tag}",use default pipe instead`);
|
|
@@ -269,7 +269,7 @@ var _Context = class {
|
|
|
269
269
|
}
|
|
270
270
|
useFilter(arg, filter = "default") {
|
|
271
271
|
if (!_Context.filterRecord[filter]) {
|
|
272
|
-
if (
|
|
272
|
+
if (_chunkFNJWO324js.IS_STRICT) {
|
|
273
273
|
throw new FrameworkException(`can't find filter named "${filter}"`);
|
|
274
274
|
} else {
|
|
275
275
|
debug(`Can't find filter named "${filter}" when handling func "${this.data.func}" on module "${this.data.tag}",use default filter instead`);
|
|
@@ -281,7 +281,7 @@ var _Context = class {
|
|
|
281
281
|
async useGuard(guards) {
|
|
282
282
|
for (const guard of new Set(guards)) {
|
|
283
283
|
if (!(guard in _Context.guardRecord)) {
|
|
284
|
-
if (
|
|
284
|
+
if (_chunkFNJWO324js.IS_STRICT)
|
|
285
285
|
throw new FrameworkException(`Can't find guard named "${guard}"`);
|
|
286
286
|
else
|
|
287
287
|
debug(`Can't find guard named "${guard}" when handling func "${this.data.func}" on module "${this.data.tag}",skip it`);
|
|
@@ -302,7 +302,7 @@ var _Context = class {
|
|
|
302
302
|
const cb = [];
|
|
303
303
|
for (const interceptor of new Set(interceptors)) {
|
|
304
304
|
if (!(interceptor in _Context.interceptorRecord)) {
|
|
305
|
-
if (
|
|
305
|
+
if (_chunkFNJWO324js.IS_STRICT)
|
|
306
306
|
throw new FrameworkException(`can't find interceptor named "${interceptor}"`);
|
|
307
307
|
else
|
|
308
308
|
debug(`Can't find interceptor named "${interceptor}" when handling func "${this.data.func}" on module "${this.data.tag}",skip it`);
|
|
@@ -322,7 +322,7 @@ var _Context = class {
|
|
|
322
322
|
const ret = [];
|
|
323
323
|
for (const m of new Set(plugins)) {
|
|
324
324
|
if (!(m in _Context.pluginRecord)) {
|
|
325
|
-
if (
|
|
325
|
+
if (_chunkFNJWO324js.IS_STRICT)
|
|
326
326
|
throw new FrameworkException(`can't find middleware named '${m}'`);
|
|
327
327
|
continue;
|
|
328
328
|
}
|
|
@@ -333,53 +333,53 @@ var _Context = class {
|
|
|
333
333
|
}
|
|
334
334
|
};
|
|
335
335
|
var Context = _Context;
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
_chunkFNJWO324js.__name.call(void 0, Context, "Context");
|
|
337
|
+
_chunkFNJWO324js.__publicField.call(void 0, Context, "filterRecord", {
|
|
338
338
|
default: defaultFilter
|
|
339
339
|
});
|
|
340
|
-
|
|
340
|
+
_chunkFNJWO324js.__publicField.call(void 0, Context, "pipeRecord", {
|
|
341
341
|
default: defaultPipe
|
|
342
342
|
});
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
343
|
+
_chunkFNJWO324js.__publicField.call(void 0, Context, "guardRecord", {});
|
|
344
|
+
_chunkFNJWO324js.__publicField.call(void 0, Context, "interceptorRecord", {});
|
|
345
|
+
_chunkFNJWO324js.__publicField.call(void 0, Context, "pluginRecord", {});
|
|
346
346
|
function addPlugin(key, handler) {
|
|
347
347
|
if (Context.pluginRecord[key] && Context.pluginRecord[key] !== handler)
|
|
348
|
-
|
|
348
|
+
_chunkFNJWO324js.log.call(void 0, `overwrite Plugin "${String(key)}"`, "warn");
|
|
349
349
|
Context.pluginRecord[key] = handler;
|
|
350
350
|
}
|
|
351
|
-
|
|
351
|
+
_chunkFNJWO324js.__name.call(void 0, addPlugin, "addPlugin");
|
|
352
352
|
function addPipe(key, handler) {
|
|
353
353
|
if (Context.pipeRecord[key] && Context.pipeRecord[key] !== handler)
|
|
354
|
-
|
|
354
|
+
_chunkFNJWO324js.log.call(void 0, `overwrite Pipe "${String(key)}"`, "warn");
|
|
355
355
|
Context.pipeRecord[key] = handler;
|
|
356
356
|
}
|
|
357
|
-
|
|
357
|
+
_chunkFNJWO324js.__name.call(void 0, addPipe, "addPipe");
|
|
358
358
|
function addFilter(key, handler) {
|
|
359
359
|
if (Context.filterRecord[key] && Context.filterRecord[key] !== handler)
|
|
360
|
-
|
|
360
|
+
_chunkFNJWO324js.log.call(void 0, `overwrite Filter "${String(key)}"`, "warn");
|
|
361
361
|
Context.filterRecord[key] = handler;
|
|
362
362
|
}
|
|
363
|
-
|
|
363
|
+
_chunkFNJWO324js.__name.call(void 0, addFilter, "addFilter");
|
|
364
364
|
function addGuard(key, handler) {
|
|
365
365
|
if (Context.guardRecord[key] && Context.guardRecord[key] !== handler)
|
|
366
|
-
|
|
366
|
+
_chunkFNJWO324js.log.call(void 0, `overwrite Guard "${String(key)}"`, "warn");
|
|
367
367
|
Context.guardRecord[key] = handler;
|
|
368
368
|
}
|
|
369
|
-
|
|
369
|
+
_chunkFNJWO324js.__name.call(void 0, addGuard, "addGuard");
|
|
370
370
|
function addInterceptor(key, handler) {
|
|
371
371
|
if (Context.interceptorRecord[key] && Context.interceptorRecord[key] !== handler)
|
|
372
|
-
|
|
372
|
+
_chunkFNJWO324js.log.call(void 0, `overwrite Interceptor "${String(key)}"`, "warn");
|
|
373
373
|
Context.interceptorRecord[key] = handler;
|
|
374
374
|
}
|
|
375
|
-
|
|
375
|
+
_chunkFNJWO324js.__name.call(void 0, addInterceptor, "addInterceptor");
|
|
376
376
|
|
|
377
377
|
// src/hmr.ts
|
|
378
378
|
function HMR(cb) {
|
|
379
|
-
if (
|
|
379
|
+
if (_chunkFNJWO324js.IS_HMR)
|
|
380
380
|
_optionalChain([globalThis, 'access', _ => _.__PS_HMR__, 'optionalAccess', _2 => _2.push, 'call', _3 => _3(cb)]);
|
|
381
381
|
}
|
|
382
|
-
|
|
382
|
+
_chunkFNJWO324js.__name.call(void 0, HMR, "HMR");
|
|
383
383
|
|
|
384
384
|
// src/server/helper.ts
|
|
385
385
|
function resolveDep(ret, key) {
|
|
@@ -387,7 +387,7 @@ function resolveDep(ret, key) {
|
|
|
387
387
|
return _optionalChain([ret, 'optionalAccess', _4 => _4[key]]);
|
|
388
388
|
return ret;
|
|
389
389
|
}
|
|
390
|
-
|
|
390
|
+
_chunkFNJWO324js.__name.call(void 0, resolveDep, "resolveDep");
|
|
391
391
|
function argToReq(params, args, headers) {
|
|
392
392
|
const req = {
|
|
393
393
|
body: {},
|
|
@@ -403,14 +403,14 @@ function argToReq(params, args, headers) {
|
|
|
403
403
|
});
|
|
404
404
|
return req;
|
|
405
405
|
}
|
|
406
|
-
|
|
406
|
+
_chunkFNJWO324js.__name.call(void 0, argToReq, "argToReq");
|
|
407
407
|
|
|
408
408
|
// src/rpc/helper.ts
|
|
409
409
|
var _os = require('os');
|
|
410
410
|
function genClientQueue(key) {
|
|
411
411
|
return `PS-${key ? `${key}-` : ""}${_os.hostname.call(void 0, )}-${process.pid}`;
|
|
412
412
|
}
|
|
413
|
-
|
|
413
|
+
_chunkFNJWO324js.__name.call(void 0, genClientQueue, "genClientQueue");
|
|
414
414
|
|
|
415
415
|
// src/decorators/helper.ts
|
|
416
416
|
function shallowClone(obj) {
|
|
@@ -418,11 +418,11 @@ function shallowClone(obj) {
|
|
|
418
418
|
...obj
|
|
419
419
|
};
|
|
420
420
|
}
|
|
421
|
-
|
|
421
|
+
_chunkFNJWO324js.__name.call(void 0, shallowClone, "shallowClone");
|
|
422
422
|
function mergeObject(...args) {
|
|
423
423
|
return Object.assign({}, ...args);
|
|
424
424
|
}
|
|
425
|
-
|
|
425
|
+
_chunkFNJWO324js.__name.call(void 0, mergeObject, "mergeObject");
|
|
426
426
|
|
|
427
427
|
// src/helper.ts
|
|
428
428
|
function createControllerMetaMap(meta, filter) {
|
|
@@ -441,12 +441,12 @@ function createControllerMetaMap(meta, filter) {
|
|
|
441
441
|
});
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
|
|
444
|
+
_chunkFNJWO324js.__name.call(void 0, handleMeta, "handleMeta");
|
|
445
445
|
handleMeta();
|
|
446
446
|
HMR(handleMeta);
|
|
447
447
|
return metaMap;
|
|
448
448
|
}
|
|
449
|
-
|
|
449
|
+
_chunkFNJWO324js.__name.call(void 0, createControllerMetaMap, "createControllerMetaMap");
|
|
450
450
|
function detectAopDep(meta, { guards, interceptors, plugins } = {}, controller = "http") {
|
|
451
451
|
const pluginSet = /* @__PURE__ */ new Set();
|
|
452
452
|
const guardSet = /* @__PURE__ */ new Set();
|
|
@@ -502,18 +502,18 @@ function detectAopDep(meta, { guards, interceptors, plugins } = {}, controller =
|
|
|
502
502
|
...filterSet
|
|
503
503
|
].filter((i) => !Context.filterRecord[i]);
|
|
504
504
|
if (missPlugins.length)
|
|
505
|
-
|
|
505
|
+
_chunkFNJWO324js.log.call(void 0, `${_picocolors2.default.white(`Plugin [${missPlugins.join(",")}]`)} doesn't exist`, "warn");
|
|
506
506
|
if (missGuards.length)
|
|
507
|
-
|
|
507
|
+
_chunkFNJWO324js.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
|
|
508
508
|
if (missInterceptors.length)
|
|
509
|
-
|
|
509
|
+
_chunkFNJWO324js.log.call(void 0, `${_picocolors2.default.cyan(`Interceptor [${missInterceptors.join(",")}]`)} doesn't exist`, "warn");
|
|
510
510
|
if (missPipes.length)
|
|
511
|
-
|
|
511
|
+
_chunkFNJWO324js.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
|
|
512
512
|
if (missFilters.length)
|
|
513
|
-
|
|
514
|
-
warningSet.forEach((warn) =>
|
|
513
|
+
_chunkFNJWO324js.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
|
|
514
|
+
warningSet.forEach((warn) => _chunkFNJWO324js.log.call(void 0, warn, "warn"));
|
|
515
515
|
}
|
|
516
|
-
|
|
516
|
+
_chunkFNJWO324js.__name.call(void 0, handleMeta, "handleMeta");
|
|
517
517
|
handleMeta();
|
|
518
518
|
HMR(handleMeta);
|
|
519
519
|
return {
|
|
@@ -524,7 +524,7 @@ function detectAopDep(meta, { guards, interceptors, plugins } = {}, controller =
|
|
|
524
524
|
filterSet
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
|
-
|
|
527
|
+
_chunkFNJWO324js.__name.call(void 0, detectAopDep, "detectAopDep");
|
|
528
528
|
|
|
529
529
|
|
|
530
530
|
|