phecda-server 7.0.0-alpha.2 → 7.0.0-alpha.4
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/assets/ps.json +1 -1
- package/assets/schema.json +55 -55
- package/bin/cli.mjs +1 -0
- package/dist/{chunk-NQIFUZL4.js → chunk-6EBEME3I.js} +51 -51
- package/dist/{chunk-XYVMNY2X.mjs → chunk-A53KNKY4.mjs} +1 -1
- package/dist/{chunk-HMVLXNV3.mjs → chunk-KUGFI6SC.mjs} +1 -1
- package/dist/{chunk-3FHZB3Z5.mjs → chunk-MMG73S64.mjs} +1 -1
- package/dist/{chunk-7YQ57BQS.js → chunk-PKSWGQLW.js} +18 -18
- package/dist/{chunk-MBCHNDAY.js → chunk-QCOBXM7F.js} +24 -24
- package/dist/{chunk-WHJ5FALK.mjs → chunk-QD3QR3NW.mjs} +3 -3
- package/dist/{chunk-J5CFUN4V.js → chunk-RQSQRZL4.js} +3 -3
- package/dist/helper.js +3 -3
- package/dist/helper.mjs +2 -2
- package/dist/http/elysia/index.js +40 -40
- package/dist/http/elysia/index.mjs +3 -3
- package/dist/http/express/index.js +37 -37
- package/dist/http/express/index.mjs +2 -2
- package/dist/http/fastify/index.js +38 -38
- package/dist/http/fastify/index.mjs +3 -3
- package/dist/http/h3/index.js +37 -37
- package/dist/http/h3/index.mjs +2 -2
- package/dist/http/hono/index.js +35 -35
- package/dist/http/hono/index.mjs +2 -2
- package/dist/http/hyper-express/index.js +35 -35
- package/dist/http/hyper-express/index.mjs +2 -2
- package/dist/http/koa/index.js +37 -37
- package/dist/http/koa/index.mjs +2 -2
- package/dist/index.js +38 -38
- package/dist/index.mjs +4 -4
- package/dist/rpc/bullmq/index.js +14 -14
- package/dist/rpc/bullmq/index.mjs +2 -2
- package/dist/rpc/kafka/index.js +14 -14
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/nats/index.js +13 -13
- package/dist/rpc/nats/index.mjs +2 -2
- package/dist/rpc/rabbitmq/index.js +15 -15
- package/dist/rpc/rabbitmq/index.mjs +2 -2
- package/dist/rpc/redis/index.js +13 -13
- package/dist/rpc/redis/index.mjs +2 -2
- package/dist/test.d.mts +1 -1
- package/dist/test.d.ts +1 -1
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/package.json +2 -2
- package/register/index.mjs +41 -40
- package/register/loader.mjs +36 -11
package/assets/ps.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"unimport": {
|
|
16
16
|
"dirs": ["."],
|
|
17
17
|
"dirsScanOptions": {
|
|
18
|
-
"filePatterns": ["*.{service,controller,module,rpc,
|
|
18
|
+
"filePatterns": ["*.{service,controller,module,rpc,solo,guard,extension,pipe,filter,addon}.ts"]
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"virtualFile": {},
|
package/assets/schema.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"type": "object",
|
|
4
|
-
"properties": {
|
|
5
|
-
"resolve": {
|
|
6
|
-
"type": "array",
|
|
7
|
-
"items": {
|
|
8
|
-
"type": "object",
|
|
9
|
-
"properties": {
|
|
10
|
-
"source": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"description": "The middle name of the imported file."
|
|
13
|
-
},
|
|
14
|
-
"importer": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "The middle name of the importer file."
|
|
17
|
-
},
|
|
18
|
-
"path": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
|
|
21
|
-
"description": "Redirect path"
|
|
22
|
-
},
|
|
23
|
-
"filename": {
|
|
24
|
-
"type": "string",
|
|
25
|
-
"optional": true,
|
|
26
|
-
|
|
27
|
-
"description": "generate split chunk,only work in vite"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"required": ["source", "path", "importer"]
|
|
31
|
-
},
|
|
32
|
-
"description": "Resolve and redirect modules path"
|
|
33
|
-
},
|
|
34
|
-
"moduleFile": {
|
|
35
|
-
"type": "array",
|
|
36
|
-
"items": {
|
|
37
|
-
"type": "string"
|
|
38
|
-
},
|
|
39
|
-
"description": "Including the module's file middle name, such as controller mapping to xx.controller.ts"
|
|
40
|
-
},
|
|
41
|
-
"virtualFile": {
|
|
42
|
-
"type": "object",
|
|
43
|
-
"additionalProperties": {
|
|
44
|
-
"type": "string"
|
|
45
|
-
},
|
|
46
|
-
"description": "Virtual module, just like in Vite."
|
|
47
|
-
},
|
|
48
|
-
"unimport": {
|
|
49
|
-
"type": "object",
|
|
50
|
-
"description": "Includes the arguments passed to unimport and 'dtsPath' that specifies the location for generating type files."
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
"required": ["resolve"]
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"resolve": {
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"source": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "The middle name of the imported file."
|
|
13
|
+
},
|
|
14
|
+
"importer": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "The middle name of the importer file."
|
|
17
|
+
},
|
|
18
|
+
"path": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
|
|
21
|
+
"description": "Redirect path"
|
|
22
|
+
},
|
|
23
|
+
"filename": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"optional": true,
|
|
26
|
+
|
|
27
|
+
"description": "generate split chunk,only work in vite"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"required": ["source", "path", "importer"]
|
|
31
|
+
},
|
|
32
|
+
"description": "Resolve and redirect modules path"
|
|
33
|
+
},
|
|
34
|
+
"moduleFile": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "string"
|
|
38
|
+
},
|
|
39
|
+
"description": "Including the module's file middle name, such as controller mapping to xx.controller.ts"
|
|
40
|
+
},
|
|
41
|
+
"virtualFile": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"additionalProperties": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
},
|
|
46
|
+
"description": "Virtual module, just like in Vite."
|
|
47
|
+
},
|
|
48
|
+
"unimport": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"description": "Includes the arguments passed to unimport and 'dtsPath' that specifies the location for generating type files."
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
"required": ["resolve"]
|
|
55
|
+
}
|
package/bin/cli.mjs
CHANGED
|
@@ -124,6 +124,7 @@ cli
|
|
|
124
124
|
startChild(file, options['--'])
|
|
125
125
|
console.log(`${pc.green('->')} press ${pc.green('e')} to exit`)
|
|
126
126
|
console.log(`${pc.green('->')} press ${pc.green('r')} to relaunch`)
|
|
127
|
+
console.log(`${pc.green('->')} press ${pc.green('c')} to clear terminal`)
|
|
127
128
|
|
|
128
129
|
process.stdin.on('data', async (data) => {
|
|
129
130
|
const input = data.toString().trim().toLocaleLowerCase()
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkRQSQRZL4js = require('./chunk-RQSQRZL4.js');
|
|
9
9
|
|
|
10
10
|
// src/helper.ts
|
|
11
11
|
var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
|
|
@@ -15,14 +15,14 @@ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
// src/pipe.ts
|
|
18
|
-
var defaultPipe = /* @__PURE__ */
|
|
18
|
+
var defaultPipe = /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, ({ arg }) => {
|
|
19
19
|
return arg;
|
|
20
20
|
}, "defaultPipe");
|
|
21
21
|
|
|
22
22
|
// src/exception/base.ts
|
|
23
23
|
var Exception = class extends Error {
|
|
24
24
|
static {
|
|
25
|
-
|
|
25
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "Exception");
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
|
|
@@ -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
|
+
[_chunkRQSQRZL4js.ERROR_SYMBOL]: true
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
};
|
|
@@ -43,7 +43,7 @@ var Exception = class extends Error {
|
|
|
43
43
|
// src/exception/undefine.ts
|
|
44
44
|
var UndefinedException = class extends Exception {
|
|
45
45
|
static {
|
|
46
|
-
|
|
46
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "UndefinedException");
|
|
47
47
|
}
|
|
48
48
|
constructor(message) {
|
|
49
49
|
super(message, 500, "Undefined error");
|
|
@@ -53,7 +53,7 @@ var UndefinedException = class extends Exception {
|
|
|
53
53
|
// src/exception/validate.ts
|
|
54
54
|
var ValidateException = class extends Exception {
|
|
55
55
|
static {
|
|
56
|
-
|
|
56
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "ValidateException");
|
|
57
57
|
}
|
|
58
58
|
constructor(message) {
|
|
59
59
|
super(message, 400, "Validate exception");
|
|
@@ -63,7 +63,7 @@ var ValidateException = class extends Exception {
|
|
|
63
63
|
// src/exception/forbidden.ts
|
|
64
64
|
var ForbiddenException = class extends Exception {
|
|
65
65
|
static {
|
|
66
|
-
|
|
66
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "ForbiddenException");
|
|
67
67
|
}
|
|
68
68
|
constructor(message) {
|
|
69
69
|
super(message, 403, "Forbidden resource");
|
|
@@ -73,7 +73,7 @@ var ForbiddenException = class extends Exception {
|
|
|
73
73
|
// src/exception/bad-request.ts
|
|
74
74
|
var BadRequestException = class extends Exception {
|
|
75
75
|
static {
|
|
76
|
-
|
|
76
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "BadRequestException");
|
|
77
77
|
}
|
|
78
78
|
constructor(message) {
|
|
79
79
|
super(message, 400, "Bad Request");
|
|
@@ -83,7 +83,7 @@ var BadRequestException = class extends Exception {
|
|
|
83
83
|
// src/exception/not-found.ts
|
|
84
84
|
var NotFoundException = class extends Exception {
|
|
85
85
|
static {
|
|
86
|
-
|
|
86
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "NotFoundException");
|
|
87
87
|
}
|
|
88
88
|
constructor(message) {
|
|
89
89
|
super(message, 404, "Not Found");
|
|
@@ -93,7 +93,7 @@ var NotFoundException = class extends Exception {
|
|
|
93
93
|
// src/exception/conflict.ts
|
|
94
94
|
var ConflictException = class extends Exception {
|
|
95
95
|
static {
|
|
96
|
-
|
|
96
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "ConflictException");
|
|
97
97
|
}
|
|
98
98
|
constructor(message) {
|
|
99
99
|
super(message, 409, "Conflict");
|
|
@@ -103,7 +103,7 @@ var ConflictException = class extends Exception {
|
|
|
103
103
|
// src/exception/bad-gateway.ts
|
|
104
104
|
var BadGatewayException = class extends Exception {
|
|
105
105
|
static {
|
|
106
|
-
|
|
106
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "BadGatewayException");
|
|
107
107
|
}
|
|
108
108
|
constructor(message) {
|
|
109
109
|
super(message, 502, "Bad Gatrway");
|
|
@@ -113,7 +113,7 @@ var BadGatewayException = class extends Exception {
|
|
|
113
113
|
// src/exception/invalid-input.ts
|
|
114
114
|
var InvalidInputException = class extends Exception {
|
|
115
115
|
static {
|
|
116
|
-
|
|
116
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "InvalidInputException");
|
|
117
117
|
}
|
|
118
118
|
constructor(message) {
|
|
119
119
|
super(message, 502, "Invalid Input");
|
|
@@ -123,7 +123,7 @@ var InvalidInputException = class extends Exception {
|
|
|
123
123
|
// src/exception/media-type.ts
|
|
124
124
|
var UnsupportedMediaTypeException = class extends Exception {
|
|
125
125
|
static {
|
|
126
|
-
|
|
126
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "UnsupportedMediaTypeException");
|
|
127
127
|
}
|
|
128
128
|
constructor(message) {
|
|
129
129
|
super(message, 415, "Unsupported Media Type");
|
|
@@ -133,7 +133,7 @@ var UnsupportedMediaTypeException = class extends Exception {
|
|
|
133
133
|
// src/exception/payload-large.ts
|
|
134
134
|
var PayloadLargeException = class extends Exception {
|
|
135
135
|
static {
|
|
136
|
-
|
|
136
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "PayloadLargeException");
|
|
137
137
|
}
|
|
138
138
|
constructor(message) {
|
|
139
139
|
super(message, 413, "Payload Too Large");
|
|
@@ -143,7 +143,7 @@ var PayloadLargeException = class extends Exception {
|
|
|
143
143
|
// src/exception/timeout.ts
|
|
144
144
|
var TimeoutException = class extends Exception {
|
|
145
145
|
static {
|
|
146
|
-
|
|
146
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "TimeoutException");
|
|
147
147
|
}
|
|
148
148
|
constructor(message) {
|
|
149
149
|
super(message, 408, "Request Timeout");
|
|
@@ -153,7 +153,7 @@ var TimeoutException = class extends Exception {
|
|
|
153
153
|
// src/exception/unauthorized.ts
|
|
154
154
|
var UnauthorizedException = class extends Exception {
|
|
155
155
|
static {
|
|
156
|
-
|
|
156
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "UnauthorizedException");
|
|
157
157
|
}
|
|
158
158
|
constructor(message) {
|
|
159
159
|
super(message, 401, "Unauthorized");
|
|
@@ -163,7 +163,7 @@ var UnauthorizedException = class extends Exception {
|
|
|
163
163
|
// src/exception/unavailable-service.ts
|
|
164
164
|
var ServiceUnavailableException = class extends Exception {
|
|
165
165
|
static {
|
|
166
|
-
|
|
166
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "ServiceUnavailableException");
|
|
167
167
|
}
|
|
168
168
|
constructor(message) {
|
|
169
169
|
super(message, 503, "Service Unavailable");
|
|
@@ -173,7 +173,7 @@ var ServiceUnavailableException = class extends Exception {
|
|
|
173
173
|
// src/exception/framework.ts
|
|
174
174
|
var FrameworkException = class extends Exception {
|
|
175
175
|
static {
|
|
176
|
-
|
|
176
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "FrameworkException");
|
|
177
177
|
}
|
|
178
178
|
constructor(message) {
|
|
179
179
|
super(`[phecda-server] ${message}`, 500, "Framework Error");
|
|
@@ -183,7 +183,7 @@ var FrameworkException = class extends Exception {
|
|
|
183
183
|
// src/exception/timer.ts
|
|
184
184
|
var TimerException = class extends Exception {
|
|
185
185
|
static {
|
|
186
|
-
|
|
186
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "TimerException");
|
|
187
187
|
}
|
|
188
188
|
constructor(message) {
|
|
189
189
|
super(message, 0, "Timer Error");
|
|
@@ -193,7 +193,7 @@ var TimerException = class extends Exception {
|
|
|
193
193
|
// src/exception/worker.ts
|
|
194
194
|
var WorkerException = class extends Exception {
|
|
195
195
|
static {
|
|
196
|
-
|
|
196
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "WorkerException");
|
|
197
197
|
}
|
|
198
198
|
constructor(message) {
|
|
199
199
|
super(message, 0, "Worker Error");
|
|
@@ -201,14 +201,14 @@ var WorkerException = class extends Exception {
|
|
|
201
201
|
};
|
|
202
202
|
|
|
203
203
|
// src/filter.ts
|
|
204
|
-
var defaultFilter = /* @__PURE__ */
|
|
204
|
+
var defaultFilter = /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (e) => {
|
|
205
205
|
if (!(e instanceof Exception)) {
|
|
206
|
-
|
|
207
|
-
if (
|
|
206
|
+
_chunkRQSQRZL4js.log.call(void 0, e.message, "error");
|
|
207
|
+
if (_chunkRQSQRZL4js.LOG_LEVEL <= 0) console.error(e.stack);
|
|
208
208
|
e = new UndefinedException(e.message || e);
|
|
209
209
|
} else {
|
|
210
|
-
|
|
211
|
-
if (
|
|
210
|
+
_chunkRQSQRZL4js.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
|
|
211
|
+
if (_chunkRQSQRZL4js.LOG_LEVEL <= 0) console.error(e.stack);
|
|
212
212
|
}
|
|
213
213
|
return e.data;
|
|
214
214
|
}, "defaultFilter");
|
|
@@ -217,7 +217,7 @@ var defaultFilter = /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (e) =>
|
|
|
217
217
|
var debug = _debug2.default.call(void 0, "phecda-server(Context)");
|
|
218
218
|
var Context = (_class = class _Context {
|
|
219
219
|
static {
|
|
220
|
-
|
|
220
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "Context");
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
|
|
@@ -232,7 +232,7 @@ var Context = (_class = class _Context {
|
|
|
232
232
|
static __initStatic4() {this.addonRecord = {}}
|
|
233
233
|
constructor(data) {
|
|
234
234
|
this.data = data;
|
|
235
|
-
if (
|
|
235
|
+
if (_chunkRQSQRZL4js.IS_HMR)
|
|
236
236
|
data._context = this;
|
|
237
237
|
}
|
|
238
238
|
static getAop(meta, opts) {
|
|
@@ -264,7 +264,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
|
|
|
264
264
|
const { paramsType, data: { ctxs, tag, params, func } } = meta;
|
|
265
265
|
try {
|
|
266
266
|
let res;
|
|
267
|
-
const nextHandler = /* @__PURE__ */
|
|
267
|
+
const nextHandler = /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (index) => {
|
|
268
268
|
return async () => {
|
|
269
269
|
if (index === guards.length) {
|
|
270
270
|
const instance = moduleMap.get(tag);
|
|
@@ -288,7 +288,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
|
|
|
288
288
|
return res;
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
|
-
|
|
291
|
+
_chunkRQSQRZL4js.__name.call(void 0, next, "next");
|
|
292
292
|
const ret = await guards[index](this.data, next);
|
|
293
293
|
if (ret !== void 0) {
|
|
294
294
|
res = ret;
|
|
@@ -333,12 +333,12 @@ function addPipe(key, pipe) {
|
|
|
333
333
|
if (Context.pipeRecord[key] && Context.pipeRecord[key] !== pipe) debug(`overwrite Pipe "${String(key)}"`, "warn");
|
|
334
334
|
Context.pipeRecord[key] = pipe;
|
|
335
335
|
}
|
|
336
|
-
|
|
336
|
+
_chunkRQSQRZL4js.__name.call(void 0, addPipe, "addPipe");
|
|
337
337
|
function addFilter(key, filter) {
|
|
338
338
|
if (Context.filterRecord[key] && Context.filterRecord[key] !== filter) debug(`overwrite Filter "${String(key)}"`, "warn");
|
|
339
339
|
Context.filterRecord[key] = filter;
|
|
340
340
|
}
|
|
341
|
-
|
|
341
|
+
_chunkRQSQRZL4js.__name.call(void 0, addFilter, "addFilter");
|
|
342
342
|
function addGuard(key, guard, priority = 0) {
|
|
343
343
|
if (Context.guardRecord[key] && Context.guardRecord[key].value !== guard) debug(`overwrite Guard "${String(key)}"`, "warn");
|
|
344
344
|
Context.guardRecord[key] = {
|
|
@@ -346,7 +346,7 @@ function addGuard(key, guard, priority = 0) {
|
|
|
346
346
|
priority
|
|
347
347
|
};
|
|
348
348
|
}
|
|
349
|
-
|
|
349
|
+
_chunkRQSQRZL4js.__name.call(void 0, addGuard, "addGuard");
|
|
350
350
|
function addAddon(key, addon, priority = 0) {
|
|
351
351
|
if (Context.addonRecord[key] && Context.addonRecord[key].value !== addon) debug(`overwrite Addon "${String(key)}"`, "warn");
|
|
352
352
|
Context.addonRecord[key] = {
|
|
@@ -354,20 +354,20 @@ function addAddon(key, addon, priority = 0) {
|
|
|
354
354
|
priority
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
|
-
|
|
357
|
+
_chunkRQSQRZL4js.__name.call(void 0, addAddon, "addAddon");
|
|
358
358
|
|
|
359
359
|
// src/hmr.ts
|
|
360
360
|
function HMR(cb) {
|
|
361
|
-
if (
|
|
361
|
+
if (_chunkRQSQRZL4js.IS_HMR) _optionalChain([globalThis, 'access', _ => _.__PS_HMR__, 'optionalAccess', _2 => _2.push, 'call', _3 => _3(cb)]);
|
|
362
362
|
}
|
|
363
|
-
|
|
363
|
+
_chunkRQSQRZL4js.__name.call(void 0, HMR, "HMR");
|
|
364
364
|
|
|
365
365
|
// src/http/helper.ts
|
|
366
366
|
function resolveDep(ret, key) {
|
|
367
367
|
if (key) return _optionalChain([ret, 'optionalAccess', _4 => _4[key]]);
|
|
368
368
|
return ret;
|
|
369
369
|
}
|
|
370
|
-
|
|
370
|
+
_chunkRQSQRZL4js.__name.call(void 0, resolveDep, "resolveDep");
|
|
371
371
|
function argToReq(params, args, headers) {
|
|
372
372
|
const req = {
|
|
373
373
|
body: {},
|
|
@@ -381,14 +381,14 @@ function argToReq(params, args, headers) {
|
|
|
381
381
|
});
|
|
382
382
|
return req;
|
|
383
383
|
}
|
|
384
|
-
|
|
384
|
+
_chunkRQSQRZL4js.__name.call(void 0, argToReq, "argToReq");
|
|
385
385
|
|
|
386
386
|
// src/rpc/helper.ts
|
|
387
387
|
var _os = require('os');
|
|
388
388
|
function genClientQueue(key) {
|
|
389
389
|
return `PS-${key ? `${key}-` : ""}${_os.hostname.call(void 0, )}-${process.pid}`;
|
|
390
390
|
}
|
|
391
|
-
|
|
391
|
+
_chunkRQSQRZL4js.__name.call(void 0, genClientQueue, "genClientQueue");
|
|
392
392
|
|
|
393
393
|
// src/decorators/helper.ts
|
|
394
394
|
function shallowClone(obj) {
|
|
@@ -396,11 +396,11 @@ function shallowClone(obj) {
|
|
|
396
396
|
...obj
|
|
397
397
|
};
|
|
398
398
|
}
|
|
399
|
-
|
|
399
|
+
_chunkRQSQRZL4js.__name.call(void 0, shallowClone, "shallowClone");
|
|
400
400
|
function mergeObject(...args) {
|
|
401
401
|
return Object.assign({}, ...args);
|
|
402
402
|
}
|
|
403
|
-
|
|
403
|
+
_chunkRQSQRZL4js.__name.call(void 0, mergeObject, "mergeObject");
|
|
404
404
|
|
|
405
405
|
// src/helper.ts
|
|
406
406
|
function createControllerMetaMap(meta, filter) {
|
|
@@ -416,12 +416,12 @@ function createControllerMetaMap(meta, filter) {
|
|
|
416
416
|
});
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
|
-
|
|
419
|
+
_chunkRQSQRZL4js.__name.call(void 0, handleMeta, "handleMeta");
|
|
420
420
|
handleMeta();
|
|
421
421
|
HMR(handleMeta);
|
|
422
422
|
return metaMap;
|
|
423
423
|
}
|
|
424
|
-
|
|
424
|
+
_chunkRQSQRZL4js.__name.call(void 0, createControllerMetaMap, "createControllerMetaMap");
|
|
425
425
|
function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
|
|
426
426
|
const addonSet = /* @__PURE__ */ new Set();
|
|
427
427
|
const guardSet = /* @__PURE__ */ new Set();
|
|
@@ -465,29 +465,29 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
|
|
|
465
465
|
...filterSet
|
|
466
466
|
].filter((i) => !Context.filterRecord[i]);
|
|
467
467
|
function exit() {
|
|
468
|
-
if (
|
|
468
|
+
if (_chunkRQSQRZL4js.IS_STRICT) process.exit(5);
|
|
469
469
|
}
|
|
470
|
-
|
|
470
|
+
_chunkRQSQRZL4js.__name.call(void 0, exit, "exit");
|
|
471
471
|
if (missAddons.length) {
|
|
472
|
-
|
|
472
|
+
_chunkRQSQRZL4js.log.call(void 0, `${_picocolors2.default.white(`Addon [${missAddons.join(",")}]`)} doesn't exist`, "warn");
|
|
473
473
|
exit();
|
|
474
474
|
}
|
|
475
475
|
if (missGuards.length) {
|
|
476
|
-
|
|
476
|
+
_chunkRQSQRZL4js.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
|
|
477
477
|
exit();
|
|
478
478
|
}
|
|
479
479
|
if (missPipes.length) {
|
|
480
|
-
|
|
480
|
+
_chunkRQSQRZL4js.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
|
|
481
481
|
exit();
|
|
482
482
|
}
|
|
483
483
|
if (missFilters.length) {
|
|
484
|
-
|
|
484
|
+
_chunkRQSQRZL4js.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
|
|
485
485
|
exit();
|
|
486
486
|
}
|
|
487
|
-
warningSet.forEach((warn) =>
|
|
487
|
+
warningSet.forEach((warn) => _chunkRQSQRZL4js.log.call(void 0, warn, "warn"));
|
|
488
488
|
if (warningSet.size) exit();
|
|
489
489
|
}
|
|
490
|
-
|
|
490
|
+
_chunkRQSQRZL4js.__name.call(void 0, handleMeta, "handleMeta");
|
|
491
491
|
handleMeta();
|
|
492
492
|
HMR(handleMeta);
|
|
493
493
|
return {
|
|
@@ -497,7 +497,7 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
|
|
|
497
497
|
filterSet
|
|
498
498
|
};
|
|
499
499
|
}
|
|
500
|
-
|
|
500
|
+
_chunkRQSQRZL4js.__name.call(void 0, detectAopDep, "detectAopDep");
|
|
501
501
|
|
|
502
502
|
|
|
503
503
|
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkRQSQRZL4js = require('./chunk-RQSQRZL4.js');
|
|
7
7
|
|
|
8
8
|
// src/meta.ts
|
|
9
9
|
var Meta = class {
|
|
10
10
|
static {
|
|
11
|
-
|
|
11
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "Meta");
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
|
|
@@ -37,11 +37,11 @@ function defaultServerInject() {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
_chunkRQSQRZL4js.__name.call(void 0, defaultServerInject, "defaultServerInject");
|
|
41
41
|
var phecdaNamespace = /* @__PURE__ */ new Map();
|
|
42
42
|
var ServerPhecda = (_class = class {
|
|
43
43
|
static {
|
|
44
|
-
|
|
44
|
+
_chunkRQSQRZL4js.__name.call(void 0, this, "ServerPhecda");
|
|
45
45
|
}
|
|
46
46
|
__init() {this.moduleMap = /* @__PURE__ */ new Map()}
|
|
47
47
|
__init2() {this.meta = []}
|
|
@@ -53,7 +53,7 @@ var ServerPhecda = (_class = class {
|
|
|
53
53
|
|
|
54
54
|
constructor(options) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);
|
|
55
55
|
defaultServerInject();
|
|
56
|
-
const { namespace = "default", parseModule = /* @__PURE__ */
|
|
56
|
+
const { namespace = "default", parseModule = /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (module) => module, "parseModule"), parseMeta = /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, (meta) => meta, "parseMeta"), generators = [] } = options;
|
|
57
57
|
phecdaNamespace.set(namespace, this);
|
|
58
58
|
this.parseMeta = parseMeta;
|
|
59
59
|
this.parseModule = parseModule;
|
|
@@ -61,8 +61,8 @@ var ServerPhecda = (_class = class {
|
|
|
61
61
|
}
|
|
62
62
|
async start(models) {
|
|
63
63
|
for (const model of models) await this.buildDepModule(model);
|
|
64
|
-
const generateCode = /* @__PURE__ */
|
|
65
|
-
if (
|
|
64
|
+
const generateCode = /* @__PURE__ */ _chunkRQSQRZL4js.__name.call(void 0, async () => {
|
|
65
|
+
if (_chunkRQSQRZL4js.IS_HMR) {
|
|
66
66
|
return Promise.all(this.generators.map((generator) => {
|
|
67
67
|
debug(`generate "${generator.name}" code to ${generator.path}`);
|
|
68
68
|
return generator.output(this.meta);
|
|
@@ -70,9 +70,9 @@ var ServerPhecda = (_class = class {
|
|
|
70
70
|
}
|
|
71
71
|
}, "generateCode");
|
|
72
72
|
generateCode().then(() => {
|
|
73
|
-
if (
|
|
73
|
+
if (_chunkRQSQRZL4js.IS_ONLY_GENERATE) process.exit(4);
|
|
74
74
|
});
|
|
75
|
-
if (
|
|
75
|
+
if (_chunkRQSQRZL4js.IS_HMR) {
|
|
76
76
|
if (!globalThis.__PS_HMR__) globalThis.__PS_HMR__ = [];
|
|
77
77
|
_optionalChain([globalThis, 'access', _2 => _2.__PS_HMR__, 'optionalAccess', _3 => _3.push, 'call', _4 => _4(async (files) => {
|
|
78
78
|
debug("reload files ");
|
|
@@ -128,8 +128,8 @@ var ServerPhecda = (_class = class {
|
|
|
128
128
|
if (!module) throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${String(tag)}--[module] ${Model}`);
|
|
129
129
|
if (this.modelMap.get(module) !== Model && !this.modelSet.has(Model)) {
|
|
130
130
|
this.modelSet.add(Model);
|
|
131
|
-
if (module instanceof Model)
|
|
132
|
-
else
|
|
131
|
+
if (module instanceof Model) _chunkRQSQRZL4js.log.call(void 0, `Module taged ${String(tag)} has been overridden`);
|
|
132
|
+
else _chunkRQSQRZL4js.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Model.name}"`, "warn");
|
|
133
133
|
}
|
|
134
134
|
return {
|
|
135
135
|
module,
|
|
@@ -152,7 +152,7 @@ var ServerPhecda = (_class = class {
|
|
|
152
152
|
}
|
|
153
153
|
this.meta.push(...getMetaFromInstance(module, tag, Model.name).map(this.parseMeta).filter((item) => !!item));
|
|
154
154
|
debug(`init module "${String(tag)}"`);
|
|
155
|
-
if (!
|
|
155
|
+
if (!_chunkRQSQRZL4js.IS_ONLY_GENERATE) await _phecdacore.invokeInit.call(void 0, module);
|
|
156
156
|
debug(`add module "${String(tag)}"`);
|
|
157
157
|
this.moduleMap.set(tag, module);
|
|
158
158
|
this.modelMap.set(module, Model);
|
|
@@ -175,7 +175,7 @@ async function Factory(models, opts = {}) {
|
|
|
175
175
|
await phecda.start(models);
|
|
176
176
|
return phecda;
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
_chunkRQSQRZL4js.__name.call(void 0, Factory, "Factory");
|
|
179
179
|
function useS(nsOrModel, namespace) {
|
|
180
180
|
if (!nsOrModel) {
|
|
181
181
|
namespace = "default";
|
|
@@ -188,7 +188,7 @@ function useS(nsOrModel, namespace) {
|
|
|
188
188
|
if (nsOrModel && typeof nsOrModel !== "string") return serverPhecda.get(nsOrModel);
|
|
189
189
|
else return serverPhecda;
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
_chunkRQSQRZL4js.__name.call(void 0, useS, "useS");
|
|
192
192
|
function getMetaFromInstance(instance, tag, name) {
|
|
193
193
|
const propertyKeys = _phecdacore.getMetaKey.call(void 0, instance).filter((item) => typeof item === "string");
|
|
194
194
|
const baseMeta = _phecdacore.getMergedMeta.call(void 0, instance, void 0);
|
|
@@ -202,7 +202,7 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
202
202
|
func: i
|
|
203
203
|
};
|
|
204
204
|
if (baseMeta.controller) {
|
|
205
|
-
if (typeof tag !== "string")
|
|
205
|
+
if (typeof tag !== "string") _chunkRQSQRZL4js.log.call(void 0, `can't use Tag with ${typeof tag} on controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
|
|
206
206
|
metaData.controller = baseMeta.controller;
|
|
207
207
|
metaData[baseMeta.controller] = {
|
|
208
208
|
...baseMeta[baseMeta.controller],
|
|
@@ -240,7 +240,7 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
240
240
|
return new Meta(deepFreeze(metaData), getParamTypes(instance, i) || []);
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
|
-
|
|
243
|
+
_chunkRQSQRZL4js.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
|
|
244
244
|
function deepFreeze(object) {
|
|
245
245
|
Object.freeze(object);
|
|
246
246
|
Object.getOwnPropertyNames(object).forEach((prop) => {
|
|
@@ -248,11 +248,11 @@ function deepFreeze(object) {
|
|
|
248
248
|
});
|
|
249
249
|
return object;
|
|
250
250
|
}
|
|
251
|
-
|
|
251
|
+
_chunkRQSQRZL4js.__name.call(void 0, deepFreeze, "deepFreeze");
|
|
252
252
|
function getParamTypes(Model, key) {
|
|
253
253
|
return Reflect.getMetadata("design:paramtypes", Model, key);
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
_chunkRQSQRZL4js.__name.call(void 0, getParamTypes, "getParamTypes");
|
|
256
256
|
|
|
257
257
|
|
|
258
258
|
|