phecda-server 8.4.1 → 8.5.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-RS6H6TEX.js → chunk-5ZZAOOKE.js} +26 -26
- package/dist/{chunk-R73A7HS3.js → chunk-76UDKZOJ.js} +53 -53
- package/dist/{chunk-OUQM7GZH.js → chunk-LLF55NZP.js} +14 -4
- package/dist/{chunk-3OKDXHO7.mjs → chunk-MUUKKO67.mjs} +1 -1
- package/dist/{chunk-SRPCXPAQ.js → chunk-SKGOTR4T.js} +20 -20
- package/dist/{chunk-JRNXLEAU.mjs → chunk-URKOYTBU.mjs} +14 -4
- package/dist/{chunk-US2DTB3Z.mjs → chunk-WST6E6MQ.mjs} +1 -1
- package/dist/{chunk-YDJAOLT2.mjs → chunk-ZHNYWZRL.mjs} +1 -1
- package/dist/helper.d.mts +2 -1
- package/dist/helper.d.ts +2 -1
- package/dist/helper.js +5 -3
- package/dist/helper.mjs +4 -2
- package/dist/http/elysia/index.js +45 -41
- package/dist/http/elysia/index.mjs +10 -6
- package/dist/http/express/index.js +38 -38
- package/dist/http/express/index.mjs +3 -3
- package/dist/http/fastify/index.js +39 -39
- package/dist/http/fastify/index.mjs +4 -4
- package/dist/http/h3/index.js +39 -39
- package/dist/http/h3/index.mjs +3 -3
- package/dist/http/hono/index.js +35 -35
- package/dist/http/hono/index.mjs +3 -3
- package/dist/http/hyper-express/index.js +36 -36
- package/dist/http/hyper-express/index.mjs +3 -3
- package/dist/http/koa/index.js +38 -38
- package/dist/http/koa/index.mjs +3 -3
- package/dist/index.js +44 -44
- package/dist/index.mjs +4 -4
- package/dist/rpc/bullmq/index.js +11 -11
- package/dist/rpc/bullmq/index.mjs +2 -2
- package/dist/rpc/electron/index.js +8 -8
- package/dist/rpc/electron/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 +11 -11
- package/dist/rpc/nats/index.mjs +2 -2
- package/dist/rpc/rabbitmq/index.js +12 -12
- package/dist/rpc/rabbitmq/index.mjs +2 -2
- package/dist/rpc/redis/index.js +10 -10
- package/dist/rpc/redis/index.mjs +2 -2
- package/dist/rpc/ws/index.js +7 -7
- package/dist/rpc/ws/index.mjs +2 -2
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLLF55NZPjs = require('./chunk-LLF55NZP.js');
|
|
4
4
|
|
|
5
5
|
// src/decorators/param.ts
|
|
6
6
|
var _phecdacore = require('phecda-core');
|
|
@@ -10,49 +10,49 @@ function BaseParam(data) {
|
|
|
10
10
|
_phecdacore.setMeta.call(void 0, target, property, index, data);
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
_chunkLLF55NZPjs.__name.call(void 0, BaseParam, "BaseParam");
|
|
14
14
|
function Body(key = "") {
|
|
15
15
|
return BaseParam({
|
|
16
16
|
type: "body",
|
|
17
17
|
key
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
_chunkLLF55NZPjs.__name.call(void 0, Body, "Body");
|
|
21
21
|
function Head(key) {
|
|
22
22
|
return BaseParam({
|
|
23
23
|
type: "headers",
|
|
24
24
|
key: key.toLowerCase()
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
_chunkLLF55NZPjs.__name.call(void 0, Head, "Head");
|
|
28
28
|
function Query(key = "") {
|
|
29
29
|
return BaseParam({
|
|
30
30
|
type: "query",
|
|
31
31
|
key
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
_chunkLLF55NZPjs.__name.call(void 0, Query, "Query");
|
|
35
35
|
function Param(key) {
|
|
36
36
|
return BaseParam({
|
|
37
37
|
type: "params",
|
|
38
38
|
key
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
_chunkLLF55NZPjs.__name.call(void 0, Param, "Param");
|
|
42
42
|
function Arg(target, k, index) {
|
|
43
43
|
BaseParam({
|
|
44
44
|
type: "args",
|
|
45
45
|
key: `${index}`
|
|
46
46
|
})(target, k, index);
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
_chunkLLF55NZPjs.__name.call(void 0, Arg, "Arg");
|
|
49
49
|
function UploadFile(key = "") {
|
|
50
50
|
return BaseParam({
|
|
51
51
|
type: "file",
|
|
52
52
|
key
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
_chunkLLF55NZPjs.__name.call(void 0, UploadFile, "UploadFile");
|
|
56
56
|
|
|
57
57
|
// src/decorators/aop.ts
|
|
58
58
|
|
|
@@ -63,7 +63,7 @@ function Guard(...guards) {
|
|
|
63
63
|
});
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
_chunkLLF55NZPjs.__name.call(void 0, Guard, "Guard");
|
|
67
67
|
function Addon(...addons) {
|
|
68
68
|
return (target, property) => {
|
|
69
69
|
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
@@ -71,7 +71,7 @@ function Addon(...addons) {
|
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
_chunkLLF55NZPjs.__name.call(void 0, Addon, "Addon");
|
|
75
75
|
function Filter(filter) {
|
|
76
76
|
return (target, property) => {
|
|
77
77
|
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
@@ -79,7 +79,7 @@ function Filter(filter) {
|
|
|
79
79
|
});
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
_chunkLLF55NZPjs.__name.call(void 0, Filter, "Filter");
|
|
83
83
|
function Pipe(pipe) {
|
|
84
84
|
return (target, property, index) => {
|
|
85
85
|
if (typeof index === "number") {
|
|
@@ -93,7 +93,7 @@ function Pipe(pipe) {
|
|
|
93
93
|
});
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
_chunkLLF55NZPjs.__name.call(void 0, Pipe, "Pipe");
|
|
97
97
|
|
|
98
98
|
// src/decorators/http.ts
|
|
99
99
|
|
|
@@ -107,7 +107,7 @@ function Route(route, method) {
|
|
|
107
107
|
});
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
_chunkLLF55NZPjs.__name.call(void 0, Route, "Route");
|
|
111
111
|
function Header(headers) {
|
|
112
112
|
return (target, property) => {
|
|
113
113
|
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
@@ -117,31 +117,31 @@ function Header(headers) {
|
|
|
117
117
|
});
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
_chunkLLF55NZPjs.__name.call(void 0, Header, "Header");
|
|
121
121
|
function Get(route = "") {
|
|
122
122
|
return Route(route, "get");
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
_chunkLLF55NZPjs.__name.call(void 0, Get, "Get");
|
|
125
125
|
function Post(route = "") {
|
|
126
126
|
return Route(route, "post");
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
_chunkLLF55NZPjs.__name.call(void 0, Post, "Post");
|
|
129
129
|
function Put(route = "") {
|
|
130
130
|
return Route(route, "put");
|
|
131
131
|
}
|
|
132
|
-
|
|
132
|
+
_chunkLLF55NZPjs.__name.call(void 0, Put, "Put");
|
|
133
133
|
function Search(route = "") {
|
|
134
134
|
return Route(route, "search");
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
_chunkLLF55NZPjs.__name.call(void 0, Search, "Search");
|
|
137
137
|
function Patch(route = "") {
|
|
138
138
|
return Route(route, "patch");
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
_chunkLLF55NZPjs.__name.call(void 0, Patch, "Patch");
|
|
141
141
|
function Delete(route = "") {
|
|
142
142
|
return Route(route, "delete");
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
_chunkLLF55NZPjs.__name.call(void 0, Delete, "Delete");
|
|
145
145
|
function Controller(prefix = "") {
|
|
146
146
|
return (target) => {
|
|
147
147
|
_phecdacore.setMeta.call(void 0, target, void 0, void 0, {
|
|
@@ -152,7 +152,7 @@ function Controller(prefix = "") {
|
|
|
152
152
|
});
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
_chunkLLF55NZPjs.__name.call(void 0, Controller, "Controller");
|
|
156
156
|
|
|
157
157
|
// src/decorators/rpc.ts
|
|
158
158
|
|
|
@@ -166,7 +166,7 @@ function Queue(queue = "", isEvent) {
|
|
|
166
166
|
});
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
_chunkLLF55NZPjs.__name.call(void 0, Queue, "Queue");
|
|
170
170
|
function Rpc() {
|
|
171
171
|
return (target) => {
|
|
172
172
|
_phecdacore.setMeta.call(void 0, target, void 0, void 0, {
|
|
@@ -174,11 +174,11 @@ function Rpc() {
|
|
|
174
174
|
});
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
|
-
|
|
177
|
+
_chunkLLF55NZPjs.__name.call(void 0, Rpc, "Rpc");
|
|
178
178
|
|
|
179
179
|
// src/decorators/ctx.ts
|
|
180
180
|
|
|
181
|
-
var Ctx = /* @__PURE__ */
|
|
181
|
+
var Ctx = /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (target, property) => {
|
|
182
182
|
_phecdacore.setMeta.call(void 0, target, _phecdacore.SHARE_KEY, void 0, {
|
|
183
183
|
ctxs: [
|
|
184
184
|
property
|
|
@@ -207,7 +207,7 @@ function Define(key, value) {
|
|
|
207
207
|
}
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
|
|
210
|
+
_chunkLLF55NZPjs.__name.call(void 0, Define, "Define");
|
|
211
211
|
|
|
212
212
|
// src/decorators/openapi.ts
|
|
213
213
|
|
|
@@ -218,7 +218,7 @@ function ApiDoc(config) {
|
|
|
218
218
|
});
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
|
-
|
|
221
|
+
_chunkLLF55NZPjs.__name.call(void 0, ApiDoc, "ApiDoc");
|
|
222
222
|
|
|
223
223
|
|
|
224
224
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkLLF55NZPjs = require('./chunk-LLF55NZP.js');
|
|
11
11
|
|
|
12
12
|
// src/helper.ts
|
|
13
13
|
var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
|
|
@@ -22,7 +22,7 @@ var _phecdacore = require('phecda-core');
|
|
|
22
22
|
// src/exception/base.ts
|
|
23
23
|
var Exception = class extends Error {
|
|
24
24
|
static {
|
|
25
|
-
|
|
25
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "Exception");
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
|
|
@@ -36,7 +36,7 @@ var Exception = class extends Error {
|
|
|
36
36
|
message: this.message,
|
|
37
37
|
description: this.description,
|
|
38
38
|
status: this.status,
|
|
39
|
-
[
|
|
39
|
+
[_chunkLLF55NZPjs.ERROR_SYMBOL]: true
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
};
|
|
@@ -44,7 +44,7 @@ var Exception = class extends Error {
|
|
|
44
44
|
// src/exception/undefine.ts
|
|
45
45
|
var UndefinedException = class extends Exception {
|
|
46
46
|
static {
|
|
47
|
-
|
|
47
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "UndefinedException");
|
|
48
48
|
}
|
|
49
49
|
constructor(message, metadata) {
|
|
50
50
|
super(message, metadata, 500, "Undefined error");
|
|
@@ -54,7 +54,7 @@ var UndefinedException = class extends Exception {
|
|
|
54
54
|
// src/exception/validate.ts
|
|
55
55
|
var ValidateException = class extends Exception {
|
|
56
56
|
static {
|
|
57
|
-
|
|
57
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "ValidateException");
|
|
58
58
|
}
|
|
59
59
|
constructor(message, metadata) {
|
|
60
60
|
super(message, metadata, 400, "Validate exception");
|
|
@@ -64,7 +64,7 @@ var ValidateException = class extends Exception {
|
|
|
64
64
|
// src/exception/forbidden.ts
|
|
65
65
|
var ForbiddenException = class extends Exception {
|
|
66
66
|
static {
|
|
67
|
-
|
|
67
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "ForbiddenException");
|
|
68
68
|
}
|
|
69
69
|
constructor(message, metadata) {
|
|
70
70
|
super(message, metadata, 403, "Forbidden resource");
|
|
@@ -74,7 +74,7 @@ var ForbiddenException = class extends Exception {
|
|
|
74
74
|
// src/exception/bad-request.ts
|
|
75
75
|
var BadRequestException = class extends Exception {
|
|
76
76
|
static {
|
|
77
|
-
|
|
77
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "BadRequestException");
|
|
78
78
|
}
|
|
79
79
|
constructor(message, metadata) {
|
|
80
80
|
super(message, metadata, 400, "Bad Request");
|
|
@@ -84,7 +84,7 @@ var BadRequestException = class extends Exception {
|
|
|
84
84
|
// src/exception/not-found.ts
|
|
85
85
|
var NotFoundException = class extends Exception {
|
|
86
86
|
static {
|
|
87
|
-
|
|
87
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "NotFoundException");
|
|
88
88
|
}
|
|
89
89
|
constructor(message, metadata) {
|
|
90
90
|
super(message, metadata, 404, "Not Found");
|
|
@@ -94,7 +94,7 @@ var NotFoundException = class extends Exception {
|
|
|
94
94
|
// src/exception/conflict.ts
|
|
95
95
|
var ConflictException = class extends Exception {
|
|
96
96
|
static {
|
|
97
|
-
|
|
97
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "ConflictException");
|
|
98
98
|
}
|
|
99
99
|
constructor(message, metadata) {
|
|
100
100
|
super(message, metadata, 409, "Conflict");
|
|
@@ -104,7 +104,7 @@ var ConflictException = class extends Exception {
|
|
|
104
104
|
// src/exception/bad-gateway.ts
|
|
105
105
|
var BadGatewayException = class extends Exception {
|
|
106
106
|
static {
|
|
107
|
-
|
|
107
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "BadGatewayException");
|
|
108
108
|
}
|
|
109
109
|
constructor(message, metadata) {
|
|
110
110
|
super(message, metadata, 502, "Bad Gatrway");
|
|
@@ -114,7 +114,7 @@ var BadGatewayException = class extends Exception {
|
|
|
114
114
|
// src/exception/invalid-input.ts
|
|
115
115
|
var InvalidInputException = class extends Exception {
|
|
116
116
|
static {
|
|
117
|
-
|
|
117
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "InvalidInputException");
|
|
118
118
|
}
|
|
119
119
|
constructor(message, metadata) {
|
|
120
120
|
super(message, metadata, 502, "Invalid Input");
|
|
@@ -124,7 +124,7 @@ var InvalidInputException = class extends Exception {
|
|
|
124
124
|
// src/exception/media-type.ts
|
|
125
125
|
var UnsupportedMediaTypeException = class extends Exception {
|
|
126
126
|
static {
|
|
127
|
-
|
|
127
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "UnsupportedMediaTypeException");
|
|
128
128
|
}
|
|
129
129
|
constructor(message, metadata) {
|
|
130
130
|
super(message, metadata, 415, "Unsupported Media Type");
|
|
@@ -134,7 +134,7 @@ var UnsupportedMediaTypeException = class extends Exception {
|
|
|
134
134
|
// src/exception/payload-large.ts
|
|
135
135
|
var PayloadLargeException = class extends Exception {
|
|
136
136
|
static {
|
|
137
|
-
|
|
137
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "PayloadLargeException");
|
|
138
138
|
}
|
|
139
139
|
constructor(message, metadata) {
|
|
140
140
|
super(message, metadata, 413, "Payload Too Large");
|
|
@@ -144,7 +144,7 @@ var PayloadLargeException = class extends Exception {
|
|
|
144
144
|
// src/exception/timeout.ts
|
|
145
145
|
var TimeoutException = class extends Exception {
|
|
146
146
|
static {
|
|
147
|
-
|
|
147
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "TimeoutException");
|
|
148
148
|
}
|
|
149
149
|
constructor(message, metadata) {
|
|
150
150
|
super(message, metadata, 408, "Request Timeout");
|
|
@@ -154,7 +154,7 @@ var TimeoutException = class extends Exception {
|
|
|
154
154
|
// src/exception/unauthorized.ts
|
|
155
155
|
var UnauthorizedException = class extends Exception {
|
|
156
156
|
static {
|
|
157
|
-
|
|
157
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "UnauthorizedException");
|
|
158
158
|
}
|
|
159
159
|
constructor(message, metadata) {
|
|
160
160
|
super(message, metadata, 401, "Unauthorized");
|
|
@@ -164,7 +164,7 @@ var UnauthorizedException = class extends Exception {
|
|
|
164
164
|
// src/exception/unavailable-service.ts
|
|
165
165
|
var ServiceUnavailableException = class extends Exception {
|
|
166
166
|
static {
|
|
167
|
-
|
|
167
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "ServiceUnavailableException");
|
|
168
168
|
}
|
|
169
169
|
constructor(message, metadata) {
|
|
170
170
|
super(message, metadata, 503, "Service Unavailable");
|
|
@@ -174,7 +174,7 @@ var ServiceUnavailableException = class extends Exception {
|
|
|
174
174
|
// src/exception/framework.ts
|
|
175
175
|
var FrameworkException = class extends Exception {
|
|
176
176
|
static {
|
|
177
|
-
|
|
177
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "FrameworkException");
|
|
178
178
|
}
|
|
179
179
|
constructor(message, metadata) {
|
|
180
180
|
super(`[phecda-server] ${message}`, metadata, 500, "Framework Error");
|
|
@@ -184,7 +184,7 @@ var FrameworkException = class extends Exception {
|
|
|
184
184
|
// src/exception/timer.ts
|
|
185
185
|
var TimerException = class extends Exception {
|
|
186
186
|
static {
|
|
187
|
-
|
|
187
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "TimerException");
|
|
188
188
|
}
|
|
189
189
|
constructor(message, metadata) {
|
|
190
190
|
super(message, metadata, 0, "Timer Error");
|
|
@@ -194,7 +194,7 @@ var TimerException = class extends Exception {
|
|
|
194
194
|
// src/exception/worker.ts
|
|
195
195
|
var WorkerException = class extends Exception {
|
|
196
196
|
static {
|
|
197
|
-
|
|
197
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "WorkerException");
|
|
198
198
|
}
|
|
199
199
|
constructor(message, metadata) {
|
|
200
200
|
super(message, metadata, 0, "Worker Error");
|
|
@@ -202,7 +202,7 @@ var WorkerException = class extends Exception {
|
|
|
202
202
|
};
|
|
203
203
|
|
|
204
204
|
// src/pipe.ts
|
|
205
|
-
var defaultPipe = /* @__PURE__ */
|
|
205
|
+
var defaultPipe = /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, async ({ arg, reflect, meta, index, type }, { method }) => {
|
|
206
206
|
if (meta.const) {
|
|
207
207
|
if (arg !== meta.const) throw new ValidateException(`param ${index + 1} must be ${meta.const}`);
|
|
208
208
|
}
|
|
@@ -286,14 +286,14 @@ var defaultPipe = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, async ({
|
|
|
286
286
|
}, "defaultPipe");
|
|
287
287
|
|
|
288
288
|
// src/filter.ts
|
|
289
|
-
var defaultFilter = /* @__PURE__ */
|
|
289
|
+
var defaultFilter = /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (e) => {
|
|
290
290
|
if (!(e instanceof Exception)) {
|
|
291
|
-
|
|
292
|
-
if (
|
|
291
|
+
_chunkLLF55NZPjs.log.call(void 0, e.message, "error");
|
|
292
|
+
if (_chunkLLF55NZPjs.LOG_LEVEL <= 0) console.error(e.stack);
|
|
293
293
|
e = new UndefinedException(e.message || e);
|
|
294
294
|
} else {
|
|
295
|
-
|
|
296
|
-
if (
|
|
295
|
+
_chunkLLF55NZPjs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
|
|
296
|
+
if (_chunkLLF55NZPjs.LOG_LEVEL <= 0) console.error(e.stack);
|
|
297
297
|
}
|
|
298
298
|
return e.data;
|
|
299
299
|
}, "defaultFilter");
|
|
@@ -302,7 +302,7 @@ var defaultFilter = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (e) =>
|
|
|
302
302
|
var debug = _debug2.default.call(void 0, "phecda-server(Context)");
|
|
303
303
|
var Context = (_class = class _Context {
|
|
304
304
|
static {
|
|
305
|
-
|
|
305
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "Context");
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
|
|
@@ -319,11 +319,11 @@ var Context = (_class = class _Context {
|
|
|
319
319
|
// protected canGetCtx = true
|
|
320
320
|
constructor(data) {
|
|
321
321
|
this.data = data;
|
|
322
|
-
if (
|
|
322
|
+
if (_chunkLLF55NZPjs.IS_DEV)
|
|
323
323
|
data._context = this;
|
|
324
324
|
this.ctx = new Proxy(data, {
|
|
325
325
|
get(target, p) {
|
|
326
|
-
if (!(p in target))
|
|
326
|
+
if (!(p in target)) _chunkLLF55NZPjs.log.call(void 0, `attribute "${p}" does not exist on ctx, which might be due to a missing AOP role (such as a guard).`, "warn", data.tag);
|
|
327
327
|
return target[p];
|
|
328
328
|
},
|
|
329
329
|
set(target, p, newValue) {
|
|
@@ -361,7 +361,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
|
|
|
361
361
|
const { paramsType, data: { ctxs, tag, params, method } } = meta;
|
|
362
362
|
try {
|
|
363
363
|
let res;
|
|
364
|
-
const nextHandler = /* @__PURE__ */
|
|
364
|
+
const nextHandler = /* @__PURE__ */ _chunkLLF55NZPjs.__name.call(void 0, (index) => {
|
|
365
365
|
return async () => {
|
|
366
366
|
if (index === guards.length) {
|
|
367
367
|
const instance = moduleMap.get(tag);
|
|
@@ -385,7 +385,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
|
|
|
385
385
|
return res;
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
|
-
|
|
388
|
+
_chunkLLF55NZPjs.__name.call(void 0, next, "next");
|
|
389
389
|
const ret = await guards[index](this.ctx, next);
|
|
390
390
|
if (ret !== void 0) {
|
|
391
391
|
res = ret;
|
|
@@ -430,12 +430,12 @@ function addPipe(key, pipe) {
|
|
|
430
430
|
if (Context.pipeRecord[key] && Context.pipeRecord[key] !== pipe) debug(`overwrite Pipe "${String(key)}"`, "warn");
|
|
431
431
|
Context.pipeRecord[key] = pipe;
|
|
432
432
|
}
|
|
433
|
-
|
|
433
|
+
_chunkLLF55NZPjs.__name.call(void 0, addPipe, "addPipe");
|
|
434
434
|
function addFilter(key, filter) {
|
|
435
435
|
if (Context.filterRecord[key] && Context.filterRecord[key] !== filter) debug(`overwrite Filter "${String(key)}"`, "warn");
|
|
436
436
|
Context.filterRecord[key] = filter;
|
|
437
437
|
}
|
|
438
|
-
|
|
438
|
+
_chunkLLF55NZPjs.__name.call(void 0, addFilter, "addFilter");
|
|
439
439
|
function addGuard(key, guard, priority = 0) {
|
|
440
440
|
if (Context.guardRecord[key] && Context.guardRecord[key].value !== guard) debug(`overwrite Guard "${String(key)}"`, "warn");
|
|
441
441
|
Context.guardRecord[key] = {
|
|
@@ -443,7 +443,7 @@ function addGuard(key, guard, priority = 0) {
|
|
|
443
443
|
priority
|
|
444
444
|
};
|
|
445
445
|
}
|
|
446
|
-
|
|
446
|
+
_chunkLLF55NZPjs.__name.call(void 0, addGuard, "addGuard");
|
|
447
447
|
function addAddon(key, addon, priority = 0) {
|
|
448
448
|
if (Context.addonRecord[key] && Context.addonRecord[key].value !== addon) debug(`overwrite Addon "${String(key)}"`, "warn");
|
|
449
449
|
Context.addonRecord[key] = {
|
|
@@ -451,14 +451,14 @@ function addAddon(key, addon, priority = 0) {
|
|
|
451
451
|
priority
|
|
452
452
|
};
|
|
453
453
|
}
|
|
454
|
-
|
|
454
|
+
_chunkLLF55NZPjs.__name.call(void 0, addAddon, "addAddon");
|
|
455
455
|
|
|
456
456
|
// src/http/helper.ts
|
|
457
457
|
function resolveDep(ret, key) {
|
|
458
458
|
if (key) return _optionalChain([ret, 'optionalAccess', _ => _[key]]);
|
|
459
459
|
return ret;
|
|
460
460
|
}
|
|
461
|
-
|
|
461
|
+
_chunkLLF55NZPjs.__name.call(void 0, resolveDep, "resolveDep");
|
|
462
462
|
|
|
463
463
|
// src/decorators/helper.ts
|
|
464
464
|
function shallowClone(obj) {
|
|
@@ -466,11 +466,11 @@ function shallowClone(obj) {
|
|
|
466
466
|
...obj
|
|
467
467
|
};
|
|
468
468
|
}
|
|
469
|
-
|
|
469
|
+
_chunkLLF55NZPjs.__name.call(void 0, shallowClone, "shallowClone");
|
|
470
470
|
function mergeObject(...args) {
|
|
471
471
|
return Object.assign({}, ...args);
|
|
472
472
|
}
|
|
473
|
-
|
|
473
|
+
_chunkLLF55NZPjs.__name.call(void 0, mergeObject, "mergeObject");
|
|
474
474
|
|
|
475
475
|
// src/helper.ts
|
|
476
476
|
function createControllerMetaMap(meta, filter) {
|
|
@@ -486,14 +486,14 @@ function createControllerMetaMap(meta, filter) {
|
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
|
-
|
|
489
|
+
_chunkLLF55NZPjs.__name.call(void 0, handleMeta, "handleMeta");
|
|
490
490
|
handleMeta();
|
|
491
|
-
|
|
491
|
+
_chunkLLF55NZPjs.HMR.call(void 0, handleMeta);
|
|
492
492
|
return metaMap;
|
|
493
493
|
}
|
|
494
|
-
|
|
494
|
+
_chunkLLF55NZPjs.__name.call(void 0, createControllerMetaMap, "createControllerMetaMap");
|
|
495
495
|
function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
|
|
496
|
-
if (
|
|
496
|
+
if (_chunkLLF55NZPjs.IS_PURE) return;
|
|
497
497
|
const addonSet = /* @__PURE__ */ new Set();
|
|
498
498
|
const guardSet = /* @__PURE__ */ new Set();
|
|
499
499
|
const pipeSet = /* @__PURE__ */ new Set();
|
|
@@ -538,34 +538,34 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
|
|
|
538
538
|
...filterSet
|
|
539
539
|
].filter((i) => !Context.filterRecord[i]);
|
|
540
540
|
function exit() {
|
|
541
|
-
if (
|
|
542
|
-
|
|
541
|
+
if (_chunkLLF55NZPjs.IS_STRICT) {
|
|
542
|
+
_chunkLLF55NZPjs.log.call(void 0, "Does not meet strict mode requirements", "error");
|
|
543
543
|
process.exit(1);
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
|
-
|
|
546
|
+
_chunkLLF55NZPjs.__name.call(void 0, exit, "exit");
|
|
547
547
|
if (missAddons.length) {
|
|
548
|
-
|
|
548
|
+
_chunkLLF55NZPjs.log.call(void 0, `${_picocolors2.default.white(`Addon [${missAddons.join(",")}]`)} doesn't exist`, "warn");
|
|
549
549
|
exit();
|
|
550
550
|
}
|
|
551
551
|
if (missGuards.length) {
|
|
552
|
-
|
|
552
|
+
_chunkLLF55NZPjs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
|
|
553
553
|
exit();
|
|
554
554
|
}
|
|
555
555
|
if (missPipes.length) {
|
|
556
|
-
|
|
556
|
+
_chunkLLF55NZPjs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
|
|
557
557
|
exit();
|
|
558
558
|
}
|
|
559
559
|
if (missFilters.length) {
|
|
560
|
-
|
|
560
|
+
_chunkLLF55NZPjs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
|
|
561
561
|
exit();
|
|
562
562
|
}
|
|
563
|
-
warningSet.forEach((warn) =>
|
|
563
|
+
warningSet.forEach((warn) => _chunkLLF55NZPjs.log.call(void 0, warn, "warn"));
|
|
564
564
|
if (warningSet.size) exit();
|
|
565
565
|
}
|
|
566
|
-
|
|
566
|
+
_chunkLLF55NZPjs.__name.call(void 0, handleMeta, "handleMeta");
|
|
567
567
|
handleMeta();
|
|
568
|
-
|
|
568
|
+
_chunkLLF55NZPjs.HMR.call(void 0, handleMeta);
|
|
569
569
|
return {
|
|
570
570
|
addonSet,
|
|
571
571
|
guardSet,
|
|
@@ -573,7 +573,7 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
|
|
|
573
573
|
filterSet
|
|
574
574
|
};
|
|
575
575
|
}
|
|
576
|
-
|
|
576
|
+
_chunkLLF55NZPjs.__name.call(void 0, detectAopDep, "detectAopDep");
|
|
577
577
|
function joinUrl(base, ...paths) {
|
|
578
578
|
const joinedPath = [
|
|
579
579
|
base,
|
|
@@ -581,7 +581,7 @@ function joinUrl(base, ...paths) {
|
|
|
581
581
|
].filter((p) => p).map((path) => path.replace(/(^\/)/g, "")).join("/");
|
|
582
582
|
return `/${joinedPath}`;
|
|
583
583
|
}
|
|
584
|
-
|
|
584
|
+
_chunkLLF55NZPjs.__name.call(void 0, joinUrl, "joinUrl");
|
|
585
585
|
|
|
586
586
|
|
|
587
587
|
|
|
@@ -119,9 +119,11 @@ function HMR(cb) {
|
|
|
119
119
|
}
|
|
120
120
|
__name(HMR, "HMR");
|
|
121
121
|
async function RELOAD(oldModels, newModels) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
if (IS_DEV) {
|
|
123
|
+
log("reload module...");
|
|
124
|
+
for (const cb of globalThis.__PS_HMR__) await cb(oldModels, newModels);
|
|
125
|
+
log("reload done");
|
|
126
|
+
}
|
|
125
127
|
}
|
|
126
128
|
__name(RELOAD, "RELOAD");
|
|
127
129
|
function RELAUNCH() {
|
|
@@ -131,6 +133,14 @@ function RELAUNCH() {
|
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
__name(RELAUNCH, "RELAUNCH");
|
|
136
|
+
function EXIT() {
|
|
137
|
+
if (IS_DEV) {
|
|
138
|
+
log("exit...");
|
|
139
|
+
process.exit(PS_EXIT_CODE.EXIT);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
__name(EXIT, "EXIT");
|
|
143
|
+
|
|
134
144
|
|
|
135
145
|
|
|
136
146
|
|
|
@@ -149,4 +159,4 @@ __name(RELAUNCH, "RELAUNCH");
|
|
|
149
159
|
|
|
150
160
|
|
|
151
161
|
|
|
152
|
-
exports.__name = __name; exports.ERROR_SYMBOL = ERROR_SYMBOL; exports.IS_DEV = IS_DEV; exports.IS_ONLY_GENERATE = IS_ONLY_GENERATE; exports.IS_STRICT = IS_STRICT; exports.IS_PURE = IS_PURE; exports.LOG_LEVEL = LOG_LEVEL; exports.PS_EXIT_CODE = PS_EXIT_CODE; exports.setLogger = setLogger; exports.getLogger = getLogger; exports.log = log; exports.runMiddleware = runMiddleware; exports.Mixin = _tsmixer.Mixin; exports.HMR = HMR; exports.RELOAD = RELOAD; exports.RELAUNCH = RELAUNCH;
|
|
162
|
+
exports.__name = __name; exports.ERROR_SYMBOL = ERROR_SYMBOL; exports.IS_DEV = IS_DEV; exports.IS_ONLY_GENERATE = IS_ONLY_GENERATE; exports.IS_STRICT = IS_STRICT; exports.IS_PURE = IS_PURE; exports.LOG_LEVEL = LOG_LEVEL; exports.PS_EXIT_CODE = PS_EXIT_CODE; exports.setLogger = setLogger; exports.getLogger = getLogger; exports.log = log; exports.runMiddleware = runMiddleware; exports.Mixin = _tsmixer.Mixin; exports.HMR = HMR; exports.RELOAD = RELOAD; exports.RELAUNCH = RELAUNCH; exports.EXIT = EXIT;
|