phecda-server 5.0.0-alpha.17 → 5.0.0-alpha.18
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-D26I5GHO.mjs → chunk-EASQZ4RI.mjs} +1 -1
- package/dist/{chunk-CRAV4WSB.js → chunk-EVF2CXTP.js} +3 -3
- package/dist/{chunk-C37JSJDO.js → chunk-JQOV7JUD.js} +19 -19
- package/dist/{chunk-6FRXLKGA.mjs → chunk-N7GEBDPZ.mjs} +1 -1
- package/dist/{chunk-MGHJFKVZ.mjs → chunk-P57NA4BR.mjs} +1 -1
- package/dist/{chunk-ONUMVNO7.mjs → chunk-UFSW7A6B.mjs} +3 -3
- package/dist/{chunk-VUOACQPJ.js → chunk-XAFRQQNM.js} +52 -52
- package/dist/{chunk-T4C6CCWM.js → chunk-XHKBG2VA.js} +3 -3
- package/dist/index.js +79 -79
- package/dist/index.mjs +30 -30
- package/dist/rpc/kafka/index.js +9 -9
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/rabbitmq/index.js +9 -9
- package/dist/rpc/rabbitmq/index.mjs +2 -2
- package/dist/rpc/redis/index.js +9 -9
- package/dist/rpc/redis/index.mjs +2 -2
- package/dist/server/express/index.js +25 -25
- package/dist/server/express/index.mjs +3 -3
- package/dist/server/fastify/index.js +23 -23
- package/dist/server/fastify/index.mjs +3 -3
- package/dist/server/h3/index.js +22 -22
- package/dist/server/h3/index.mjs +3 -3
- package/dist/server/koa/index.js +25 -25
- package/dist/server/koa/index.mjs +3 -3
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
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
|
-
var
|
|
3
|
+
var _chunkXHKBG2VAjs = require('./chunk-XHKBG2VA.js');
|
|
4
4
|
|
|
5
5
|
// src/server/helper.ts
|
|
6
6
|
function resolveDep(ret, key) {
|
|
@@ -8,7 +8,7 @@ function resolveDep(ret, key) {
|
|
|
8
8
|
return _optionalChain([ret, 'optionalAccess', _ => _[key]]);
|
|
9
9
|
return ret;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
_chunkXHKBG2VAjs.__name.call(void 0, resolveDep, "resolveDep");
|
|
12
12
|
function argToReq(params, args, headers) {
|
|
13
13
|
const req = {
|
|
14
14
|
body: {},
|
|
@@ -24,7 +24,7 @@ function argToReq(params, args, headers) {
|
|
|
24
24
|
});
|
|
25
25
|
return req;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
_chunkXHKBG2VAjs.__name.call(void 0, argToReq, "argToReq");
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkXHKBG2VAjs = require('./chunk-XHKBG2VA.js');
|
|
6
6
|
|
|
7
7
|
// src/meta.ts
|
|
8
8
|
var Meta = class {
|
|
@@ -13,10 +13,10 @@ var Meta = class {
|
|
|
13
13
|
this.paramsType = paramsType;
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
_chunkXHKBG2VAjs.__name.call(void 0, Meta, "Meta");
|
|
17
17
|
|
|
18
18
|
// src/compiler/rpc.ts
|
|
19
|
-
var Compiler = /* @__PURE__ */
|
|
19
|
+
var Compiler = /* @__PURE__ */ _chunkXHKBG2VAjs.__name.call(void 0, (_class =class Compiler2 {
|
|
20
20
|
__init() {this.classMap = {}}
|
|
21
21
|
constructor() {;_class.prototype.__init.call(this);
|
|
22
22
|
}
|
|
@@ -52,10 +52,10 @@ function generateRPCCode(meta) {
|
|
|
52
52
|
compiler.addMethod(i);
|
|
53
53
|
return compiler.getContent();
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
_chunkXHKBG2VAjs.__name.call(void 0, generateRPCCode, "generateRPCCode");
|
|
56
56
|
|
|
57
57
|
// src/compiler/http.ts
|
|
58
|
-
var Compiler3 = /* @__PURE__ */
|
|
58
|
+
var Compiler3 = /* @__PURE__ */ _chunkXHKBG2VAjs.__name.call(void 0, (_class2 =class Compiler4 {
|
|
59
59
|
__init2() {this.classMap = {}}
|
|
60
60
|
constructor() {;_class2.prototype.__init2.call(this);
|
|
61
61
|
}
|
|
@@ -94,7 +94,7 @@ function generateHTTPCode(meta) {
|
|
|
94
94
|
compiler.addMethod(i);
|
|
95
95
|
return compiler.getContent();
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
_chunkXHKBG2VAjs.__name.call(void 0, generateHTTPCode, "generateHTTPCode");
|
|
98
98
|
|
|
99
99
|
// src/core.ts
|
|
100
100
|
require('reflect-metadata');
|
|
@@ -105,7 +105,7 @@ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
|
105
105
|
function Injectable() {
|
|
106
106
|
return (target) => _phecdacore.Empty.call(void 0, target);
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
_chunkXHKBG2VAjs.__name.call(void 0, Injectable, "Injectable");
|
|
109
109
|
var debug = _debug2.default.call(void 0, "phecda-server");
|
|
110
110
|
var emitter = new (0, _events2.default)();
|
|
111
111
|
async function Factory(Modules, opts = {}) {
|
|
@@ -142,13 +142,13 @@ async function Factory(Modules, opts = {}) {
|
|
|
142
142
|
}
|
|
143
143
|
return instance;
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
_chunkXHKBG2VAjs.__name.call(void 0, del, "del");
|
|
146
146
|
async function destroy() {
|
|
147
147
|
debug("destroy all");
|
|
148
148
|
for (const [tag] of moduleMap)
|
|
149
149
|
await del(tag);
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
_chunkXHKBG2VAjs.__name.call(void 0, destroy, "destroy");
|
|
152
152
|
async function add(Module) {
|
|
153
153
|
const tag = _optionalChain([Module, 'access', _3 => _3.prototype, 'optionalAccess', _4 => _4.__TAG__]) || Module.name;
|
|
154
154
|
const oldInstance = await del(tag);
|
|
@@ -166,7 +166,7 @@ async function Factory(Modules, opts = {}) {
|
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
_chunkXHKBG2VAjs.__name.call(void 0, add, "add");
|
|
170
170
|
async function buildNestModule(Module) {
|
|
171
171
|
const paramtypes = getParamTypes(Module);
|
|
172
172
|
let instance;
|
|
@@ -177,7 +177,7 @@ async function Factory(Modules, opts = {}) {
|
|
|
177
177
|
throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${String(tag)}--[module] ${Module}`);
|
|
178
178
|
if (constructorMap.get(tag) !== Module && !constructorSet.has(Module)) {
|
|
179
179
|
constructorSet.add(Module);
|
|
180
|
-
|
|
180
|
+
_chunkXHKBG2VAjs.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Module.name}"`, "warn");
|
|
181
181
|
}
|
|
182
182
|
return {
|
|
183
183
|
instance,
|
|
@@ -210,7 +210,7 @@ async function Factory(Modules, opts = {}) {
|
|
|
210
210
|
tag
|
|
211
211
|
};
|
|
212
212
|
}
|
|
213
|
-
|
|
213
|
+
_chunkXHKBG2VAjs.__name.call(void 0, buildNestModule, "buildNestModule");
|
|
214
214
|
for (const Module of Modules)
|
|
215
215
|
await buildNestModule(Module);
|
|
216
216
|
function writeCode() {
|
|
@@ -223,9 +223,9 @@ async function Factory(Modules, opts = {}) {
|
|
|
223
223
|
_fs2.default.promises.writeFile(rpc, generateRPCCode(meta.map((item) => item.data)));
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
|
|
226
|
+
_chunkXHKBG2VAjs.__name.call(void 0, writeCode, "writeCode");
|
|
227
227
|
writeCode();
|
|
228
|
-
if (
|
|
228
|
+
if (_chunkXHKBG2VAjs.IS_DEV) {
|
|
229
229
|
if (!globalThis.__PS_HMR__)
|
|
230
230
|
globalThis.__PS_HMR__ = [];
|
|
231
231
|
_optionalChain([globalThis, 'access', _5 => _5.__PS_HMR__, 'optionalAccess', _6 => _6.push, 'call', _7 => _7(async (files) => {
|
|
@@ -249,7 +249,7 @@ async function Factory(Modules, opts = {}) {
|
|
|
249
249
|
destroy
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
|
|
252
|
+
_chunkXHKBG2VAjs.__name.call(void 0, Factory, "Factory");
|
|
253
253
|
function getMetaFromInstance(instance, tag, name) {
|
|
254
254
|
const vars = _phecdacore.getExposeKey.call(void 0, instance).filter((item) => item !== _phecdacore.SHARE_KEY);
|
|
255
255
|
const baseState = _phecdacore.getState.call(void 0, instance, _phecdacore.SHARE_KEY) || {};
|
|
@@ -273,7 +273,7 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
273
273
|
};
|
|
274
274
|
}
|
|
275
275
|
if (typeof tag !== "string" && (meta.rpc || meta.http))
|
|
276
|
-
|
|
276
|
+
_chunkXHKBG2VAjs.log.call(void 0, `can't use Tag with ${typeof tag} on http/rpc controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
|
|
277
277
|
meta.name = name;
|
|
278
278
|
meta.tag = tag;
|
|
279
279
|
meta.method = i;
|
|
@@ -314,11 +314,11 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
314
314
|
return new Meta(meta, getParamTypes(instance, i) || []);
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
|
|
317
|
+
_chunkXHKBG2VAjs.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
|
|
318
318
|
function getParamTypes(Module, key) {
|
|
319
319
|
return Reflect.getMetadata("design:paramtypes", Module, key);
|
|
320
320
|
}
|
|
321
|
-
|
|
321
|
+
_chunkXHKBG2VAjs.__name.call(void 0, getParamTypes, "getParamTypes");
|
|
322
322
|
function initState(state) {
|
|
323
323
|
if (!state.define)
|
|
324
324
|
state.define = {};
|
|
@@ -331,7 +331,7 @@ function initState(state) {
|
|
|
331
331
|
if (!state.interceptors)
|
|
332
332
|
state.interceptors = [];
|
|
333
333
|
}
|
|
334
|
-
|
|
334
|
+
_chunkXHKBG2VAjs.__name.call(void 0, initState, "initState");
|
|
335
335
|
|
|
336
336
|
|
|
337
337
|
|
|
@@ -54,10 +54,10 @@ function setConfig(key, conf, force = true) {
|
|
|
54
54
|
}
|
|
55
55
|
__name(setConfig, "setConfig");
|
|
56
56
|
function Mix(InternalClass, ExtendClass) {
|
|
57
|
-
return class extends
|
|
57
|
+
return class extends InternalClass {
|
|
58
58
|
constructor(...args) {
|
|
59
|
-
super(
|
|
60
|
-
Object.assign(this, new
|
|
59
|
+
super();
|
|
60
|
+
Object.assign(this, new ExtendClass(...args));
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkXHKBG2VAjs = require('./chunk-XHKBG2VA.js');
|
|
10
10
|
|
|
11
11
|
// src/exception/base.ts
|
|
12
12
|
var Exception = class extends Error {
|
|
@@ -24,11 +24,11 @@ var Exception = class extends Error {
|
|
|
24
24
|
message: this.message,
|
|
25
25
|
description: this.description,
|
|
26
26
|
status: this.status,
|
|
27
|
-
[
|
|
27
|
+
[_chunkXHKBG2VAjs.ERROR_SYMBOL]: true
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
_chunkXHKBG2VAjs.__name.call(void 0, Exception, "Exception");
|
|
32
32
|
|
|
33
33
|
// src/exception/validate.ts
|
|
34
34
|
var ValidateException = class extends Exception {
|
|
@@ -36,11 +36,11 @@ var ValidateException = class extends Exception {
|
|
|
36
36
|
super(message, 400, "Validate exception");
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
_chunkXHKBG2VAjs.__name.call(void 0, ValidateException, "ValidateException");
|
|
40
40
|
|
|
41
41
|
// src/pipe.ts
|
|
42
42
|
var _phecdacore = require('phecda-core');
|
|
43
|
-
var defaultPipe = /* @__PURE__ */
|
|
43
|
+
var defaultPipe = /* @__PURE__ */ _chunkXHKBG2VAjs.__name.call(void 0, async ({ arg, reflect, index }) => {
|
|
44
44
|
if (_phecdacore.isPhecda.call(void 0, reflect)) {
|
|
45
45
|
const instance = _phecdacore.plainToClass.call(void 0, reflect, arg);
|
|
46
46
|
const err = await _phecdacore.transformClass.call(void 0, instance);
|
|
@@ -66,7 +66,7 @@ var UndefinedException = class extends Exception {
|
|
|
66
66
|
super(message, 500, "Undefined error");
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
|
|
69
|
+
_chunkXHKBG2VAjs.__name.call(void 0, UndefinedException, "UndefinedException");
|
|
70
70
|
|
|
71
71
|
// src/exception/forbidden.ts
|
|
72
72
|
var ForbiddenException = class extends Exception {
|
|
@@ -74,7 +74,7 @@ var ForbiddenException = class extends Exception {
|
|
|
74
74
|
super(message, 403, "Forbidden resource");
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
-
|
|
77
|
+
_chunkXHKBG2VAjs.__name.call(void 0, ForbiddenException, "ForbiddenException");
|
|
78
78
|
|
|
79
79
|
// src/exception/bad-request.ts
|
|
80
80
|
var BadRequestException = class extends Exception {
|
|
@@ -82,7 +82,7 @@ var BadRequestException = class extends Exception {
|
|
|
82
82
|
super(message, 400, "Bad Request");
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
|
-
|
|
85
|
+
_chunkXHKBG2VAjs.__name.call(void 0, BadRequestException, "BadRequestException");
|
|
86
86
|
|
|
87
87
|
// src/exception/not-found.ts
|
|
88
88
|
var NotFoundException = class extends Exception {
|
|
@@ -90,7 +90,7 @@ var NotFoundException = class extends Exception {
|
|
|
90
90
|
super(message, 404, "Not Found");
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
-
|
|
93
|
+
_chunkXHKBG2VAjs.__name.call(void 0, NotFoundException, "NotFoundException");
|
|
94
94
|
|
|
95
95
|
// src/exception/conflict.ts
|
|
96
96
|
var ConflictException = class extends Exception {
|
|
@@ -98,7 +98,7 @@ var ConflictException = class extends Exception {
|
|
|
98
98
|
super(message, 409, "Conflict");
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
|
-
|
|
101
|
+
_chunkXHKBG2VAjs.__name.call(void 0, ConflictException, "ConflictException");
|
|
102
102
|
|
|
103
103
|
// src/exception/bad-gateway.ts
|
|
104
104
|
var BadGatewayException = class extends Exception {
|
|
@@ -106,7 +106,7 @@ var BadGatewayException = class extends Exception {
|
|
|
106
106
|
super(message, 502, "Bad Gatrway");
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
-
|
|
109
|
+
_chunkXHKBG2VAjs.__name.call(void 0, BadGatewayException, "BadGatewayException");
|
|
110
110
|
|
|
111
111
|
// src/exception/invalid-input.ts
|
|
112
112
|
var InvalidInputException = class extends Exception {
|
|
@@ -114,7 +114,7 @@ var InvalidInputException = class extends Exception {
|
|
|
114
114
|
super(message, 502, "Invalid Input");
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
|
-
|
|
117
|
+
_chunkXHKBG2VAjs.__name.call(void 0, InvalidInputException, "InvalidInputException");
|
|
118
118
|
|
|
119
119
|
// src/exception/media-type.ts
|
|
120
120
|
var UnsupportedMediaTypeException = class extends Exception {
|
|
@@ -122,7 +122,7 @@ var UnsupportedMediaTypeException = class extends Exception {
|
|
|
122
122
|
super(message, 415, "Unsupported Media Type");
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
|
-
|
|
125
|
+
_chunkXHKBG2VAjs.__name.call(void 0, UnsupportedMediaTypeException, "UnsupportedMediaTypeException");
|
|
126
126
|
|
|
127
127
|
// src/exception/payload-large.ts
|
|
128
128
|
var PayloadLargeException = class extends Exception {
|
|
@@ -130,7 +130,7 @@ var PayloadLargeException = class extends Exception {
|
|
|
130
130
|
super(message, 413, "Payload Too Large");
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
|
-
|
|
133
|
+
_chunkXHKBG2VAjs.__name.call(void 0, PayloadLargeException, "PayloadLargeException");
|
|
134
134
|
|
|
135
135
|
// src/exception/timeout.ts
|
|
136
136
|
var TimeoutException = class extends Exception {
|
|
@@ -138,7 +138,7 @@ var TimeoutException = class extends Exception {
|
|
|
138
138
|
super(message, 408, "Request Timeout");
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
|
-
|
|
141
|
+
_chunkXHKBG2VAjs.__name.call(void 0, TimeoutException, "TimeoutException");
|
|
142
142
|
|
|
143
143
|
// src/exception/unauthorized.ts
|
|
144
144
|
var UnauthorizedException = class extends Exception {
|
|
@@ -146,7 +146,7 @@ var UnauthorizedException = class extends Exception {
|
|
|
146
146
|
super(message, 401, "Unauthorized");
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
|
-
|
|
149
|
+
_chunkXHKBG2VAjs.__name.call(void 0, UnauthorizedException, "UnauthorizedException");
|
|
150
150
|
|
|
151
151
|
// src/exception/unavailable-service.ts
|
|
152
152
|
var ServiceUnavailableException = class extends Exception {
|
|
@@ -154,7 +154,7 @@ var ServiceUnavailableException = class extends Exception {
|
|
|
154
154
|
super(message, 503, "Service Unavailable");
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
|
-
|
|
157
|
+
_chunkXHKBG2VAjs.__name.call(void 0, ServiceUnavailableException, "ServiceUnavailableException");
|
|
158
158
|
|
|
159
159
|
// src/exception/framework.ts
|
|
160
160
|
var FrameworkException = class extends Exception {
|
|
@@ -162,21 +162,21 @@ var FrameworkException = class extends Exception {
|
|
|
162
162
|
super(`[phecda-server] ${message}`, 500, "Framework Error");
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
|
-
|
|
165
|
+
_chunkXHKBG2VAjs.__name.call(void 0, FrameworkException, "FrameworkException");
|
|
166
166
|
|
|
167
167
|
// src/context.ts
|
|
168
168
|
var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
|
|
169
169
|
|
|
170
170
|
// src/filter.ts
|
|
171
|
-
var defaultFilter = /* @__PURE__ */
|
|
171
|
+
var defaultFilter = /* @__PURE__ */ _chunkXHKBG2VAjs.__name.call(void 0, (e) => {
|
|
172
172
|
if (!(e instanceof Exception)) {
|
|
173
|
-
|
|
174
|
-
if (!
|
|
173
|
+
_chunkXHKBG2VAjs.log.call(void 0, e.message, "error");
|
|
174
|
+
if (!_chunkXHKBG2VAjs.IS_LOG_BAN)
|
|
175
175
|
console.error(e.stack);
|
|
176
176
|
e = new UndefinedException(e.message || e);
|
|
177
177
|
} else {
|
|
178
|
-
|
|
179
|
-
if (!
|
|
178
|
+
_chunkXHKBG2VAjs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
|
|
179
|
+
if (!_chunkXHKBG2VAjs.IS_LOG_BAN)
|
|
180
180
|
console.error(e.stack);
|
|
181
181
|
}
|
|
182
182
|
return e.data;
|
|
@@ -194,7 +194,7 @@ var Histroy = (_class = class {constructor() { _class.prototype.__init.call(this
|
|
|
194
194
|
return false;
|
|
195
195
|
}
|
|
196
196
|
}, _class);
|
|
197
|
-
|
|
197
|
+
_chunkXHKBG2VAjs.__name.call(void 0, Histroy, "Histroy");
|
|
198
198
|
|
|
199
199
|
// src/context.ts
|
|
200
200
|
var guardRecord = {};
|
|
@@ -207,13 +207,13 @@ var _Context = class {
|
|
|
207
207
|
constructor(data) {
|
|
208
208
|
this.data = data;
|
|
209
209
|
this.history = new Histroy();
|
|
210
|
-
if (
|
|
210
|
+
if (_chunkXHKBG2VAjs.IS_DEV)
|
|
211
211
|
data._context = this;
|
|
212
212
|
}
|
|
213
213
|
usePipe(args) {
|
|
214
214
|
return Promise.all(args.map((item) => {
|
|
215
215
|
if (item.pipe && !_Context.pipeRecord[item.pipe]) {
|
|
216
|
-
if (
|
|
216
|
+
if (_chunkXHKBG2VAjs.IS_STRICT)
|
|
217
217
|
throw new FrameworkException(`can't find pipe named '${item.pipe}'`);
|
|
218
218
|
else
|
|
219
219
|
return _Context.pipeRecord.default(item, this.data);
|
|
@@ -223,7 +223,7 @@ var _Context = class {
|
|
|
223
223
|
}
|
|
224
224
|
useFilter(arg, filter = "default") {
|
|
225
225
|
if (!_Context.filterRecord[filter]) {
|
|
226
|
-
if (
|
|
226
|
+
if (_chunkXHKBG2VAjs.IS_STRICT)
|
|
227
227
|
throw new FrameworkException(`can't find filter named '${filter}'`);
|
|
228
228
|
else
|
|
229
229
|
return _Context.filterRecord.default(arg, this.data);
|
|
@@ -234,7 +234,7 @@ var _Context = class {
|
|
|
234
234
|
for (const guard of guards) {
|
|
235
235
|
if (this.history.record(guard, "guard")) {
|
|
236
236
|
if (!(guard in _Context.guardRecord)) {
|
|
237
|
-
if (
|
|
237
|
+
if (_chunkXHKBG2VAjs.IS_STRICT)
|
|
238
238
|
throw new FrameworkException(`can't find guard named '${guard}'`);
|
|
239
239
|
continue;
|
|
240
240
|
}
|
|
@@ -253,7 +253,7 @@ var _Context = class {
|
|
|
253
253
|
for (const interceptor of interceptors) {
|
|
254
254
|
if (this.history.record(interceptor, "interceptor")) {
|
|
255
255
|
if (!(interceptor in _Context.interceptorRecord)) {
|
|
256
|
-
if (
|
|
256
|
+
if (_chunkXHKBG2VAjs.IS_STRICT)
|
|
257
257
|
throw new FrameworkException(`can't find interceptor named '${interceptor}'`);
|
|
258
258
|
continue;
|
|
259
259
|
}
|
|
@@ -272,7 +272,7 @@ var _Context = class {
|
|
|
272
272
|
const ret = [];
|
|
273
273
|
for (const m of plugins) {
|
|
274
274
|
if (!(m in _Context.pluginRecord)) {
|
|
275
|
-
if (
|
|
275
|
+
if (_chunkXHKBG2VAjs.IS_STRICT)
|
|
276
276
|
throw new FrameworkException(`can't find middleware named '${m}'`);
|
|
277
277
|
continue;
|
|
278
278
|
}
|
|
@@ -282,46 +282,46 @@ var _Context = class {
|
|
|
282
282
|
}
|
|
283
283
|
};
|
|
284
284
|
var Context = _Context;
|
|
285
|
-
|
|
286
|
-
|
|
285
|
+
_chunkXHKBG2VAjs.__name.call(void 0, Context, "Context");
|
|
286
|
+
_chunkXHKBG2VAjs.__publicField.call(void 0, Context, "filterRecord", {
|
|
287
287
|
default: defaultFilter
|
|
288
288
|
});
|
|
289
|
-
|
|
289
|
+
_chunkXHKBG2VAjs.__publicField.call(void 0, Context, "pipeRecord", {
|
|
290
290
|
default: defaultPipe
|
|
291
291
|
});
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
292
|
+
_chunkXHKBG2VAjs.__publicField.call(void 0, Context, "guardRecord", {});
|
|
293
|
+
_chunkXHKBG2VAjs.__publicField.call(void 0, Context, "interceptorRecord", {});
|
|
294
|
+
_chunkXHKBG2VAjs.__publicField.call(void 0, Context, "pluginRecord", {});
|
|
295
295
|
function addPlugin(key, handler) {
|
|
296
296
|
if (Context.pluginRecord[key] && Context.pluginRecord[key] !== handler)
|
|
297
|
-
|
|
297
|
+
_chunkXHKBG2VAjs.log.call(void 0, `overwrite Plugin "${String(key)}"`, "warn");
|
|
298
298
|
Context.pluginRecord[key] = handler;
|
|
299
299
|
}
|
|
300
|
-
|
|
300
|
+
_chunkXHKBG2VAjs.__name.call(void 0, addPlugin, "addPlugin");
|
|
301
301
|
function addPipe(key, handler) {
|
|
302
302
|
if (Context.pipeRecord[key] && Context.pipeRecord[key] !== handler)
|
|
303
|
-
|
|
303
|
+
_chunkXHKBG2VAjs.log.call(void 0, `overwrite Pipe "${String(key)}"`, "warn");
|
|
304
304
|
Context.pipeRecord[key] = handler;
|
|
305
305
|
}
|
|
306
|
-
|
|
306
|
+
_chunkXHKBG2VAjs.__name.call(void 0, addPipe, "addPipe");
|
|
307
307
|
function addFilter(key, handler) {
|
|
308
308
|
if (Context.filterRecord[key] && Context.filterRecord[key] !== handler)
|
|
309
|
-
|
|
309
|
+
_chunkXHKBG2VAjs.log.call(void 0, `overwrite Filter "${String(key)}"`, "warn");
|
|
310
310
|
Context.filterRecord[key] = handler;
|
|
311
311
|
}
|
|
312
|
-
|
|
312
|
+
_chunkXHKBG2VAjs.__name.call(void 0, addFilter, "addFilter");
|
|
313
313
|
function addGuard(key, handler) {
|
|
314
314
|
if (Context.guardRecord[key] && Context.guardRecord[key] !== handler)
|
|
315
|
-
|
|
315
|
+
_chunkXHKBG2VAjs.log.call(void 0, `overwrite Guard "${String(key)}"`, "warn");
|
|
316
316
|
Context.guardRecord[key] = handler;
|
|
317
317
|
}
|
|
318
|
-
|
|
318
|
+
_chunkXHKBG2VAjs.__name.call(void 0, addGuard, "addGuard");
|
|
319
319
|
function addInterceptor(key, handler) {
|
|
320
320
|
if (Context.interceptorRecord[key] && Context.interceptorRecord[key] !== handler)
|
|
321
|
-
|
|
321
|
+
_chunkXHKBG2VAjs.log.call(void 0, `overwrite Interceptor "${String(key)}"`, "warn");
|
|
322
322
|
Context.interceptorRecord[key] = handler;
|
|
323
323
|
}
|
|
324
|
-
|
|
324
|
+
_chunkXHKBG2VAjs.__name.call(void 0, addInterceptor, "addInterceptor");
|
|
325
325
|
function isAopDepInject(meta, { guards, interceptors, plugins } = {}) {
|
|
326
326
|
const pluginSet = new Set(plugins);
|
|
327
327
|
const guardSet = new Set(guards);
|
|
@@ -355,17 +355,17 @@ function isAopDepInject(meta, { guards, interceptors, plugins } = {}) {
|
|
|
355
355
|
...filterSet
|
|
356
356
|
].filter((i) => !Context.filterRecord[i]);
|
|
357
357
|
if (missPlugins.length)
|
|
358
|
-
|
|
358
|
+
_chunkXHKBG2VAjs.log.call(void 0, `${_picocolors2.default.white(`Plugin [${missPlugins.join(",")}]`)} doesn't exist`, "warn");
|
|
359
359
|
if (missGuards.length)
|
|
360
|
-
|
|
360
|
+
_chunkXHKBG2VAjs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
|
|
361
361
|
if (missInterceptors.length)
|
|
362
|
-
|
|
362
|
+
_chunkXHKBG2VAjs.log.call(void 0, `${_picocolors2.default.cyan(`Interceptor [${missInterceptors.join(",")}]`)} doesn't exist`, "warn");
|
|
363
363
|
if (missPipes.length)
|
|
364
|
-
|
|
364
|
+
_chunkXHKBG2VAjs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
|
|
365
365
|
if (missFilters.length)
|
|
366
|
-
|
|
366
|
+
_chunkXHKBG2VAjs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
|
|
367
367
|
}
|
|
368
|
-
|
|
368
|
+
_chunkXHKBG2VAjs.__name.call(void 0, isAopDepInject, "isAopDepInject");
|
|
369
369
|
|
|
370
370
|
|
|
371
371
|
|
|
@@ -54,10 +54,10 @@ function setConfig(key, conf, force = true) {
|
|
|
54
54
|
}
|
|
55
55
|
__name(setConfig, "setConfig");
|
|
56
56
|
function Mix(InternalClass, ExtendClass) {
|
|
57
|
-
return class extends
|
|
57
|
+
return class extends InternalClass {
|
|
58
58
|
constructor(...args) {
|
|
59
|
-
super(
|
|
60
|
-
Object.assign(this, new
|
|
59
|
+
super();
|
|
60
|
+
Object.assign(this, new ExtendClass(...args));
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
}
|