phecda-server 5.3.1 → 5.3.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/dist/{chunk-ODUYOCDF.js → chunk-2HVTWYS2.js} +37 -37
- package/dist/{chunk-N4ULJDEQ.js → chunk-3D7AROG2.js} +36 -25
- package/dist/{chunk-BZKJ5NBU.mjs → chunk-3IPYLGY2.mjs} +1 -1
- package/dist/{chunk-LHLQIQPH.mjs → chunk-ECSI4QBK.mjs} +18 -7
- package/dist/{chunk-RVWBJ6LV.js → chunk-GHFSIZUO.js} +2 -10
- package/dist/{chunk-QYX5Q7KO.js → chunk-RZ7IXJYQ.js} +60 -60
- package/dist/{chunk-ORQAEOSE.mjs → chunk-SXOZVIKW.mjs} +2 -2
- 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 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +43 -43
- package/dist/index.mjs +6 -6
- 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 +2 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkGHFSIZUOjs = require('./chunk-GHFSIZUO.js');
|
|
9
9
|
|
|
10
10
|
// src/helper.ts
|
|
11
11
|
var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
|
|
@@ -19,7 +19,7 @@ var _phecdacore = require('phecda-core');
|
|
|
19
19
|
// src/exception/base.ts
|
|
20
20
|
var Exception = class extends Error {
|
|
21
21
|
static {
|
|
22
|
-
|
|
22
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "Exception");
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
|
|
@@ -35,7 +35,7 @@ var Exception = class extends Error {
|
|
|
35
35
|
message: this.message,
|
|
36
36
|
description: this.description,
|
|
37
37
|
status: this.status,
|
|
38
|
-
[
|
|
38
|
+
[_chunkGHFSIZUOjs.ERROR_SYMBOL]: true
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
};
|
|
@@ -43,7 +43,7 @@ var Exception = class extends Error {
|
|
|
43
43
|
// src/exception/validate.ts
|
|
44
44
|
var ValidateException = class extends Exception {
|
|
45
45
|
static {
|
|
46
|
-
|
|
46
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "ValidateException");
|
|
47
47
|
}
|
|
48
48
|
constructor(message) {
|
|
49
49
|
super(message, 400, "Validate exception");
|
|
@@ -51,7 +51,7 @@ var ValidateException = class extends Exception {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
// src/pipe.ts
|
|
54
|
-
var defaultPipe = /* @__PURE__ */
|
|
54
|
+
var defaultPipe = /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, ({ arg, reflect, index }) => {
|
|
55
55
|
if (_phecdacore.isPhecda.call(void 0, reflect)) {
|
|
56
56
|
const instance = _phecdacore.plainToClass.call(void 0, reflect, arg);
|
|
57
57
|
const err = _phecdacore.transformInstance.call(void 0, instance);
|
|
@@ -73,7 +73,7 @@ var defaultPipe = /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, ({ arg, r
|
|
|
73
73
|
// src/exception/undefine.ts
|
|
74
74
|
var UndefinedException = class extends Exception {
|
|
75
75
|
static {
|
|
76
|
-
|
|
76
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "UndefinedException");
|
|
77
77
|
}
|
|
78
78
|
constructor(message) {
|
|
79
79
|
super(message, 500, "Undefined error");
|
|
@@ -83,7 +83,7 @@ var UndefinedException = class extends Exception {
|
|
|
83
83
|
// src/exception/forbidden.ts
|
|
84
84
|
var ForbiddenException = class extends Exception {
|
|
85
85
|
static {
|
|
86
|
-
|
|
86
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "ForbiddenException");
|
|
87
87
|
}
|
|
88
88
|
constructor(message) {
|
|
89
89
|
super(message, 403, "Forbidden resource");
|
|
@@ -93,7 +93,7 @@ var ForbiddenException = class extends Exception {
|
|
|
93
93
|
// src/exception/bad-request.ts
|
|
94
94
|
var BadRequestException = class extends Exception {
|
|
95
95
|
static {
|
|
96
|
-
|
|
96
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "BadRequestException");
|
|
97
97
|
}
|
|
98
98
|
constructor(message) {
|
|
99
99
|
super(message, 400, "Bad Request");
|
|
@@ -103,7 +103,7 @@ var BadRequestException = class extends Exception {
|
|
|
103
103
|
// src/exception/not-found.ts
|
|
104
104
|
var NotFoundException = class extends Exception {
|
|
105
105
|
static {
|
|
106
|
-
|
|
106
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "NotFoundException");
|
|
107
107
|
}
|
|
108
108
|
constructor(message) {
|
|
109
109
|
super(message, 404, "Not Found");
|
|
@@ -113,7 +113,7 @@ var NotFoundException = class extends Exception {
|
|
|
113
113
|
// src/exception/conflict.ts
|
|
114
114
|
var ConflictException = class extends Exception {
|
|
115
115
|
static {
|
|
116
|
-
|
|
116
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "ConflictException");
|
|
117
117
|
}
|
|
118
118
|
constructor(message) {
|
|
119
119
|
super(message, 409, "Conflict");
|
|
@@ -123,7 +123,7 @@ var ConflictException = class extends Exception {
|
|
|
123
123
|
// src/exception/bad-gateway.ts
|
|
124
124
|
var BadGatewayException = class extends Exception {
|
|
125
125
|
static {
|
|
126
|
-
|
|
126
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "BadGatewayException");
|
|
127
127
|
}
|
|
128
128
|
constructor(message) {
|
|
129
129
|
super(message, 502, "Bad Gatrway");
|
|
@@ -133,7 +133,7 @@ var BadGatewayException = class extends Exception {
|
|
|
133
133
|
// src/exception/invalid-input.ts
|
|
134
134
|
var InvalidInputException = class extends Exception {
|
|
135
135
|
static {
|
|
136
|
-
|
|
136
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "InvalidInputException");
|
|
137
137
|
}
|
|
138
138
|
constructor(message) {
|
|
139
139
|
super(message, 502, "Invalid Input");
|
|
@@ -143,7 +143,7 @@ var InvalidInputException = class extends Exception {
|
|
|
143
143
|
// src/exception/media-type.ts
|
|
144
144
|
var UnsupportedMediaTypeException = class extends Exception {
|
|
145
145
|
static {
|
|
146
|
-
|
|
146
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "UnsupportedMediaTypeException");
|
|
147
147
|
}
|
|
148
148
|
constructor(message) {
|
|
149
149
|
super(message, 415, "Unsupported Media Type");
|
|
@@ -153,7 +153,7 @@ var UnsupportedMediaTypeException = class extends Exception {
|
|
|
153
153
|
// src/exception/payload-large.ts
|
|
154
154
|
var PayloadLargeException = class extends Exception {
|
|
155
155
|
static {
|
|
156
|
-
|
|
156
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "PayloadLargeException");
|
|
157
157
|
}
|
|
158
158
|
constructor(message) {
|
|
159
159
|
super(message, 413, "Payload Too Large");
|
|
@@ -163,7 +163,7 @@ var PayloadLargeException = class extends Exception {
|
|
|
163
163
|
// src/exception/timeout.ts
|
|
164
164
|
var TimeoutException = class extends Exception {
|
|
165
165
|
static {
|
|
166
|
-
|
|
166
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "TimeoutException");
|
|
167
167
|
}
|
|
168
168
|
constructor(message) {
|
|
169
169
|
super(message, 408, "Request Timeout");
|
|
@@ -173,7 +173,7 @@ var TimeoutException = class extends Exception {
|
|
|
173
173
|
// src/exception/unauthorized.ts
|
|
174
174
|
var UnauthorizedException = class extends Exception {
|
|
175
175
|
static {
|
|
176
|
-
|
|
176
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "UnauthorizedException");
|
|
177
177
|
}
|
|
178
178
|
constructor(message) {
|
|
179
179
|
super(message, 401, "Unauthorized");
|
|
@@ -183,7 +183,7 @@ var UnauthorizedException = class extends Exception {
|
|
|
183
183
|
// src/exception/unavailable-service.ts
|
|
184
184
|
var ServiceUnavailableException = class extends Exception {
|
|
185
185
|
static {
|
|
186
|
-
|
|
186
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "ServiceUnavailableException");
|
|
187
187
|
}
|
|
188
188
|
constructor(message) {
|
|
189
189
|
super(message, 503, "Service Unavailable");
|
|
@@ -193,7 +193,7 @@ var ServiceUnavailableException = class extends Exception {
|
|
|
193
193
|
// src/exception/framework.ts
|
|
194
194
|
var FrameworkException = class extends Exception {
|
|
195
195
|
static {
|
|
196
|
-
|
|
196
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "FrameworkException");
|
|
197
197
|
}
|
|
198
198
|
constructor(message) {
|
|
199
199
|
super(`[phecda-server] ${message}`, 500, "Framework Error");
|
|
@@ -203,7 +203,7 @@ var FrameworkException = class extends Exception {
|
|
|
203
203
|
// src/exception/timer.ts
|
|
204
204
|
var TimerException = class extends Exception {
|
|
205
205
|
static {
|
|
206
|
-
|
|
206
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "TimerException");
|
|
207
207
|
}
|
|
208
208
|
constructor(message) {
|
|
209
209
|
super(message, 0, "Timer Error");
|
|
@@ -213,7 +213,7 @@ var TimerException = class extends Exception {
|
|
|
213
213
|
// src/exception/worker.ts
|
|
214
214
|
var WorkerException = class extends Exception {
|
|
215
215
|
static {
|
|
216
|
-
|
|
216
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "WorkerException");
|
|
217
217
|
}
|
|
218
218
|
constructor(message) {
|
|
219
219
|
super(message, 0, "Worker Error");
|
|
@@ -221,14 +221,14 @@ var WorkerException = class extends Exception {
|
|
|
221
221
|
};
|
|
222
222
|
|
|
223
223
|
// src/filter.ts
|
|
224
|
-
var defaultFilter = /* @__PURE__ */
|
|
224
|
+
var defaultFilter = /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (e) => {
|
|
225
225
|
if (!(e instanceof Exception)) {
|
|
226
|
-
|
|
227
|
-
if (
|
|
226
|
+
_chunkGHFSIZUOjs.log.call(void 0, e.message, "error");
|
|
227
|
+
if (_chunkGHFSIZUOjs.LOG_LEVEL <= 0) console.error(e.stack);
|
|
228
228
|
e = new UndefinedException(e.message || e);
|
|
229
229
|
} else {
|
|
230
|
-
|
|
231
|
-
if (
|
|
230
|
+
_chunkGHFSIZUOjs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
|
|
231
|
+
if (_chunkGHFSIZUOjs.LOG_LEVEL <= 0) console.error(e.stack);
|
|
232
232
|
}
|
|
233
233
|
return e.data;
|
|
234
234
|
}, "defaultFilter");
|
|
@@ -237,7 +237,7 @@ var defaultFilter = /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (e) =>
|
|
|
237
237
|
var debug = _debug2.default.call(void 0, "phecda-server(Context)");
|
|
238
238
|
var Context = (_class = class _Context {
|
|
239
239
|
static {
|
|
240
|
-
|
|
240
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "Context");
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
|
|
@@ -254,7 +254,7 @@ var Context = (_class = class _Context {
|
|
|
254
254
|
|
|
255
255
|
constructor(data) {
|
|
256
256
|
this.data = data;
|
|
257
|
-
if (
|
|
257
|
+
if (_chunkGHFSIZUOjs.IS_HMR)
|
|
258
258
|
data._context = this;
|
|
259
259
|
}
|
|
260
260
|
async run(opts, successCb, failCb) {
|
|
@@ -295,7 +295,7 @@ var Context = (_class = class _Context {
|
|
|
295
295
|
usePipe(args) {
|
|
296
296
|
return Promise.all(args.map((item) => {
|
|
297
297
|
if (item.pipe && !_Context.pipeRecord[item.pipe]) {
|
|
298
|
-
if (
|
|
298
|
+
if (_chunkGHFSIZUOjs.IS_STRICT) {
|
|
299
299
|
throw new FrameworkException(`can't find pipe named '${item.pipe}'`);
|
|
300
300
|
} else {
|
|
301
301
|
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`);
|
|
@@ -307,7 +307,7 @@ var Context = (_class = class _Context {
|
|
|
307
307
|
}
|
|
308
308
|
useFilter(arg, filter = "default") {
|
|
309
309
|
if (!_Context.filterRecord[filter]) {
|
|
310
|
-
if (
|
|
310
|
+
if (_chunkGHFSIZUOjs.IS_STRICT) {
|
|
311
311
|
throw new FrameworkException(`can't find filter named "${filter}"`);
|
|
312
312
|
} else {
|
|
313
313
|
debug(`Can't find filter named "${filter}" when handling func "${this.data.func}" on module "${this.data.tag}",use default filter instead`);
|
|
@@ -319,7 +319,7 @@ var Context = (_class = class _Context {
|
|
|
319
319
|
async useGuard(guards) {
|
|
320
320
|
for (const guard of new Set(guards)) {
|
|
321
321
|
if (!(guard in _Context.guardRecord)) {
|
|
322
|
-
if (
|
|
322
|
+
if (_chunkGHFSIZUOjs.IS_STRICT) throw new FrameworkException(`Can't find guard named "${guard}"`);
|
|
323
323
|
else debug(`Can't find guard named "${guard}" when handling func "${this.data.func}" on module "${this.data.tag}",skip it`);
|
|
324
324
|
continue;
|
|
325
325
|
}
|
|
@@ -336,7 +336,7 @@ var Context = (_class = class _Context {
|
|
|
336
336
|
const cb = [];
|
|
337
337
|
for (const interceptor of new Set(interceptors)) {
|
|
338
338
|
if (!(interceptor in _Context.interceptorRecord)) {
|
|
339
|
-
if (
|
|
339
|
+
if (_chunkGHFSIZUOjs.IS_STRICT) throw new FrameworkException(`can't find interceptor named "${interceptor}"`);
|
|
340
340
|
else debug(`Can't find interceptor named "${interceptor}" when handling func "${this.data.func}" on module "${this.data.tag}",skip it`);
|
|
341
341
|
continue;
|
|
342
342
|
}
|
|
@@ -352,7 +352,7 @@ var Context = (_class = class _Context {
|
|
|
352
352
|
const ret = [];
|
|
353
353
|
for (const m of new Set(plugins)) {
|
|
354
354
|
if (!(m in _Context.pluginRecord)) {
|
|
355
|
-
if (
|
|
355
|
+
if (_chunkGHFSIZUOjs.IS_STRICT) throw new FrameworkException(`can't find middleware named '${m}'`);
|
|
356
356
|
continue;
|
|
357
357
|
}
|
|
358
358
|
const plugin = _Context.pluginRecord[m](framework);
|
|
@@ -362,43 +362,43 @@ var Context = (_class = class _Context {
|
|
|
362
362
|
}
|
|
363
363
|
}, _class.__initStatic(), _class.__initStatic2(), _class.__initStatic3(), _class.__initStatic4(), _class.__initStatic5(), _class);
|
|
364
364
|
function addPlugin(key, handler) {
|
|
365
|
-
if (Context.pluginRecord[key] && Context.pluginRecord[key] !== handler)
|
|
365
|
+
if (Context.pluginRecord[key] && Context.pluginRecord[key] !== handler) _chunkGHFSIZUOjs.log.call(void 0, `overwrite Plugin "${String(key)}"`, "warn");
|
|
366
366
|
Context.pluginRecord[key] = handler;
|
|
367
367
|
}
|
|
368
|
-
|
|
368
|
+
_chunkGHFSIZUOjs.__name.call(void 0, addPlugin, "addPlugin");
|
|
369
369
|
function addPipe(key, handler) {
|
|
370
|
-
if (Context.pipeRecord[key] && Context.pipeRecord[key] !== handler)
|
|
370
|
+
if (Context.pipeRecord[key] && Context.pipeRecord[key] !== handler) _chunkGHFSIZUOjs.log.call(void 0, `overwrite Pipe "${String(key)}"`, "warn");
|
|
371
371
|
Context.pipeRecord[key] = handler;
|
|
372
372
|
}
|
|
373
|
-
|
|
373
|
+
_chunkGHFSIZUOjs.__name.call(void 0, addPipe, "addPipe");
|
|
374
374
|
function addFilter(key, handler) {
|
|
375
|
-
if (Context.filterRecord[key] && Context.filterRecord[key] !== handler)
|
|
375
|
+
if (Context.filterRecord[key] && Context.filterRecord[key] !== handler) _chunkGHFSIZUOjs.log.call(void 0, `overwrite Filter "${String(key)}"`, "warn");
|
|
376
376
|
Context.filterRecord[key] = handler;
|
|
377
377
|
}
|
|
378
|
-
|
|
378
|
+
_chunkGHFSIZUOjs.__name.call(void 0, addFilter, "addFilter");
|
|
379
379
|
function addGuard(key, handler) {
|
|
380
|
-
if (Context.guardRecord[key] && Context.guardRecord[key] !== handler)
|
|
380
|
+
if (Context.guardRecord[key] && Context.guardRecord[key] !== handler) _chunkGHFSIZUOjs.log.call(void 0, `overwrite Guard "${String(key)}"`, "warn");
|
|
381
381
|
Context.guardRecord[key] = handler;
|
|
382
382
|
}
|
|
383
|
-
|
|
383
|
+
_chunkGHFSIZUOjs.__name.call(void 0, addGuard, "addGuard");
|
|
384
384
|
function addInterceptor(key, handler) {
|
|
385
|
-
if (Context.interceptorRecord[key] && Context.interceptorRecord[key] !== handler)
|
|
385
|
+
if (Context.interceptorRecord[key] && Context.interceptorRecord[key] !== handler) _chunkGHFSIZUOjs.log.call(void 0, `overwrite Interceptor "${String(key)}"`, "warn");
|
|
386
386
|
Context.interceptorRecord[key] = handler;
|
|
387
387
|
}
|
|
388
|
-
|
|
388
|
+
_chunkGHFSIZUOjs.__name.call(void 0, addInterceptor, "addInterceptor");
|
|
389
389
|
|
|
390
390
|
// src/hmr.ts
|
|
391
391
|
function HMR(cb) {
|
|
392
|
-
if (
|
|
392
|
+
if (_chunkGHFSIZUOjs.IS_HMR) _optionalChain([globalThis, 'access', _ => _.__PS_HMR__, 'optionalAccess', _2 => _2.push, 'call', _3 => _3(cb)]);
|
|
393
393
|
}
|
|
394
|
-
|
|
394
|
+
_chunkGHFSIZUOjs.__name.call(void 0, HMR, "HMR");
|
|
395
395
|
|
|
396
396
|
// src/server/helper.ts
|
|
397
397
|
function resolveDep(ret, key) {
|
|
398
398
|
if (key) return _optionalChain([ret, 'optionalAccess', _4 => _4[key]]);
|
|
399
399
|
return ret;
|
|
400
400
|
}
|
|
401
|
-
|
|
401
|
+
_chunkGHFSIZUOjs.__name.call(void 0, resolveDep, "resolveDep");
|
|
402
402
|
function argToReq(params, args, headers) {
|
|
403
403
|
const req = {
|
|
404
404
|
body: {},
|
|
@@ -412,14 +412,14 @@ function argToReq(params, args, headers) {
|
|
|
412
412
|
});
|
|
413
413
|
return req;
|
|
414
414
|
}
|
|
415
|
-
|
|
415
|
+
_chunkGHFSIZUOjs.__name.call(void 0, argToReq, "argToReq");
|
|
416
416
|
|
|
417
417
|
// src/rpc/helper.ts
|
|
418
418
|
var _os = require('os');
|
|
419
419
|
function genClientQueue(key) {
|
|
420
420
|
return `PS-${key ? `${key}-` : ""}${_os.hostname.call(void 0, )}-${process.pid}`;
|
|
421
421
|
}
|
|
422
|
-
|
|
422
|
+
_chunkGHFSIZUOjs.__name.call(void 0, genClientQueue, "genClientQueue");
|
|
423
423
|
|
|
424
424
|
// src/decorators/helper.ts
|
|
425
425
|
function shallowClone(obj) {
|
|
@@ -427,11 +427,11 @@ function shallowClone(obj) {
|
|
|
427
427
|
...obj
|
|
428
428
|
};
|
|
429
429
|
}
|
|
430
|
-
|
|
430
|
+
_chunkGHFSIZUOjs.__name.call(void 0, shallowClone, "shallowClone");
|
|
431
431
|
function mergeObject(...args) {
|
|
432
432
|
return Object.assign({}, ...args);
|
|
433
433
|
}
|
|
434
|
-
|
|
434
|
+
_chunkGHFSIZUOjs.__name.call(void 0, mergeObject, "mergeObject");
|
|
435
435
|
|
|
436
436
|
// src/helper.ts
|
|
437
437
|
function createControllerMetaMap(meta, filter) {
|
|
@@ -447,12 +447,12 @@ function createControllerMetaMap(meta, filter) {
|
|
|
447
447
|
});
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
|
-
|
|
450
|
+
_chunkGHFSIZUOjs.__name.call(void 0, handleMeta, "handleMeta");
|
|
451
451
|
handleMeta();
|
|
452
452
|
HMR(handleMeta);
|
|
453
453
|
return metaMap;
|
|
454
454
|
}
|
|
455
|
-
|
|
455
|
+
_chunkGHFSIZUOjs.__name.call(void 0, createControllerMetaMap, "createControllerMetaMap");
|
|
456
456
|
function detectAopDep(meta, { guards, interceptors, plugins } = {}, controller = "http") {
|
|
457
457
|
const pluginSet = /* @__PURE__ */ new Set();
|
|
458
458
|
const guardSet = /* @__PURE__ */ new Set();
|
|
@@ -504,14 +504,14 @@ function detectAopDep(meta, { guards, interceptors, plugins } = {}, controller =
|
|
|
504
504
|
const missFilters = [
|
|
505
505
|
...filterSet
|
|
506
506
|
].filter((i) => !Context.filterRecord[i]);
|
|
507
|
-
if (missPlugins.length)
|
|
508
|
-
if (missGuards.length)
|
|
509
|
-
if (missInterceptors.length)
|
|
510
|
-
if (missPipes.length)
|
|
511
|
-
if (missFilters.length)
|
|
512
|
-
warningSet.forEach((warn) =>
|
|
513
|
-
}
|
|
514
|
-
|
|
507
|
+
if (missPlugins.length) _chunkGHFSIZUOjs.log.call(void 0, `${_picocolors2.default.white(`Plugin [${missPlugins.join(",")}]`)} doesn't exist`, "warn");
|
|
508
|
+
if (missGuards.length) _chunkGHFSIZUOjs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
|
|
509
|
+
if (missInterceptors.length) _chunkGHFSIZUOjs.log.call(void 0, `${_picocolors2.default.cyan(`Interceptor [${missInterceptors.join(",")}]`)} doesn't exist`, "warn");
|
|
510
|
+
if (missPipes.length) _chunkGHFSIZUOjs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
|
|
511
|
+
if (missFilters.length) _chunkGHFSIZUOjs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
|
|
512
|
+
warningSet.forEach((warn) => _chunkGHFSIZUOjs.log.call(void 0, warn, "warn"));
|
|
513
|
+
}
|
|
514
|
+
_chunkGHFSIZUOjs.__name.call(void 0, handleMeta, "handleMeta");
|
|
515
515
|
handleMeta();
|
|
516
516
|
HMR(handleMeta);
|
|
517
517
|
return {
|
|
@@ -522,7 +522,7 @@ function detectAopDep(meta, { guards, interceptors, plugins } = {}, controller =
|
|
|
522
522
|
filterSet
|
|
523
523
|
};
|
|
524
524
|
}
|
|
525
|
-
|
|
525
|
+
_chunkGHFSIZUOjs.__name.call(void 0, detectAopDep, "detectAopDep");
|
|
526
526
|
|
|
527
527
|
|
|
528
528
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mergeObject,
|
|
3
3
|
shallowClone
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3IPYLGY2.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__name
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-UXD62LGG.mjs";
|
|
8
8
|
|
|
9
9
|
// src/decorators/param.ts
|
|
10
10
|
import { getState, setPropertyState } from "phecda-core";
|
|
@@ -15,6 +15,7 @@ var PS_EXIT_CODE;
|
|
|
15
15
|
|
|
16
16
|
// src/utils.ts
|
|
17
17
|
import pc from "picocolors";
|
|
18
|
+
import { Mixin } from "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](`${pc.magenta("[phecda-server]")} ${pc.gray(`${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`)} ${pc[color](msg)} ${pc.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
|
export {
|
|
56
48
|
__name,
|
|
@@ -62,5 +54,5 @@ export {
|
|
|
62
54
|
PS_EXIT_CODE,
|
|
63
55
|
setLogger,
|
|
64
56
|
log,
|
|
65
|
-
|
|
57
|
+
Mixin
|
|
66
58
|
};
|
package/dist/helper.js
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
require('./chunk-
|
|
10
|
+
var _chunkRZ7IXJYQjs = require('./chunk-RZ7IXJYQ.js');
|
|
11
|
+
require('./chunk-GHFSIZUO.js');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -18,4 +18,4 @@ require('./chunk-RVWBJ6LV.js');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
exports.HMR =
|
|
21
|
+
exports.HMR = _chunkRZ7IXJYQjs.HMR; exports.argToReq = _chunkRZ7IXJYQjs.argToReq; exports.createControllerMetaMap = _chunkRZ7IXJYQjs.createControllerMetaMap; exports.detectAopDep = _chunkRZ7IXJYQjs.detectAopDep; exports.genClientQueue = _chunkRZ7IXJYQjs.genClientQueue; exports.mergeObject = _chunkRZ7IXJYQjs.mergeObject; exports.resolveDep = _chunkRZ7IXJYQjs.resolveDep; exports.shallowClone = _chunkRZ7IXJYQjs.shallowClone;
|
package/dist/helper.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -2,12 +2,13 @@ import { B as BaseContext, D as DefaultOptions, C as ControllerMetaData, M as Me
|
|
|
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
3
|
import { G as Generator } from './core-Bc2ENEHX.mjs';
|
|
4
4
|
export { F as Factory, O as Options, c as createPhecda, e as emitter } from './core-Bc2ENEHX.mjs';
|
|
5
|
-
import { Base
|
|
5
|
+
import { Base } from 'phecda-core';
|
|
6
6
|
export * from 'phecda-core';
|
|
7
7
|
import { H as HttpContext } from './types-Dgxirc9f.mjs';
|
|
8
8
|
export { C as CookieSerializeOptions, a as HttpOptions } from './types-Dgxirc9f.mjs';
|
|
9
9
|
import { R as RpcContext } from './types-AgVwUXPC.mjs';
|
|
10
10
|
export { b as RpcClientOptions, a as RpcServerOptions } from './types-AgVwUXPC.mjs';
|
|
11
|
+
export { Mixin } from 'ts-mixer';
|
|
11
12
|
import 'node:http';
|
|
12
13
|
|
|
13
14
|
declare class Exception extends Error {
|
|
@@ -245,6 +246,5 @@ declare class PExtension extends ServerBase {
|
|
|
245
246
|
type LogLevel = 'error' | 'info' | 'warn' | 'log';
|
|
246
247
|
declare function setLogger(logger: Record<LogLevel, (msg: string) => void>): void;
|
|
247
248
|
declare function log(msg: string, level?: LogLevel): void;
|
|
248
|
-
declare function Mix<C1 extends Construct | AbConstruct, C2 extends Construct>(InternalClass: C1, ExtendClass: C2): new (...args: ConstructorParameters<C2>) => InstanceType<C1> & InstanceType<C2>;
|
|
249
249
|
|
|
250
|
-
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter, Event, Exception, Filter, type FilterType, ForbiddenException, FrameworkException, Generator, Get, Guard, type GuardType, HTTPGenerator, Head, Header, HttpBase, HttpContext, Interceptor, type InterceptorType, InvalidInputException, MetaData,
|
|
250
|
+
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter, Event, 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
|
@@ -2,12 +2,13 @@ import { B as BaseContext, D as DefaultOptions, C as ControllerMetaData, M as Me
|
|
|
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
3
|
import { G as Generator } from './core-dx9E5x2N.js';
|
|
4
4
|
export { F as Factory, O as Options, c as createPhecda, e as emitter } from './core-dx9E5x2N.js';
|
|
5
|
-
import { Base
|
|
5
|
+
import { Base } from 'phecda-core';
|
|
6
6
|
export * from 'phecda-core';
|
|
7
7
|
import { H as HttpContext } from './types-BCJhmpQh.js';
|
|
8
8
|
export { C as CookieSerializeOptions, a as HttpOptions } from './types-BCJhmpQh.js';
|
|
9
9
|
import { R as RpcContext } from './types-B-ZFZajI.js';
|
|
10
10
|
export { b as RpcClientOptions, a as RpcServerOptions } from './types-B-ZFZajI.js';
|
|
11
|
+
export { Mixin } from 'ts-mixer';
|
|
11
12
|
import 'node:http';
|
|
12
13
|
|
|
13
14
|
declare class Exception extends Error {
|
|
@@ -245,6 +246,5 @@ declare class PExtension extends ServerBase {
|
|
|
245
246
|
type LogLevel = 'error' | 'info' | 'warn' | 'log';
|
|
246
247
|
declare function setLogger(logger: Record<LogLevel, (msg: string) => void>): void;
|
|
247
248
|
declare function log(msg: string, level?: LogLevel): void;
|
|
248
|
-
declare function Mix<C1 extends Construct | AbConstruct, C2 extends Construct>(InternalClass: C1, ExtendClass: C2): new (...args: ConstructorParameters<C2>) => InstanceType<C1> & InstanceType<C2>;
|
|
249
249
|
|
|
250
|
-
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter, Event, Exception, Filter, type FilterType, ForbiddenException, FrameworkException, Generator, Get, Guard, type GuardType, HTTPGenerator, Head, Header, HttpBase, HttpContext, Interceptor, type InterceptorType, InvalidInputException, MetaData,
|
|
250
|
+
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Emitter, Event, 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 };
|