phecda-server 7.0.0 → 7.0.1
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/README.md +10 -10
- package/bin/cli.mjs +1 -1
- package/dist/{chunk-RLFCI3RG.js → chunk-4LLLQOMF.js} +0 -1
- package/dist/{chunk-WTJKTICN.mjs → chunk-AIAO6SV6.mjs} +2 -3
- package/dist/{chunk-5SUY5UVC.js → chunk-DPPDWBYO.js} +28 -29
- package/dist/{chunk-LBH4RXQQ.mjs → chunk-E7EAPAGM.mjs} +1 -2
- package/dist/{chunk-VDOICQ2U.mjs → chunk-MKRHYZCL.mjs} +2 -3
- package/dist/{chunk-MDPW6WGF.mjs → chunk-NQ55PA2X.mjs} +0 -1
- package/dist/{chunk-H7OCHDZT.js → chunk-XKK2SQ7W.js} +53 -54
- package/dist/{chunk-KRUOHWFR.js → chunk-ZWPOWMZP.js} +20 -21
- package/dist/helper.js +3 -4
- package/dist/helper.mjs +2 -3
- package/dist/http/elysia/index.js +40 -41
- package/dist/http/elysia/index.mjs +3 -4
- package/dist/http/express/index.js +37 -38
- package/dist/http/express/index.mjs +2 -3
- package/dist/http/fastify/index.js +38 -39
- package/dist/http/fastify/index.mjs +3 -4
- package/dist/http/h3/index.js +38 -39
- package/dist/http/h3/index.mjs +2 -3
- package/dist/http/hono/index.js +34 -35
- package/dist/http/hono/index.mjs +2 -3
- package/dist/http/hyper-express/index.js +35 -36
- package/dist/http/hyper-express/index.mjs +2 -3
- package/dist/http/koa/index.js +37 -38
- package/dist/http/koa/index.mjs +2 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +44 -47
- package/dist/index.mjs +6 -9
- package/dist/rpc/bullmq/index.js +11 -12
- package/dist/rpc/bullmq/index.mjs +2 -3
- package/dist/rpc/electron/index.js +8 -9
- package/dist/rpc/electron/index.mjs +2 -3
- package/dist/rpc/kafka/index.js +10 -11
- package/dist/rpc/kafka/index.mjs +2 -3
- package/dist/rpc/nats/index.js +11 -12
- package/dist/rpc/nats/index.mjs +2 -3
- package/dist/rpc/rabbitmq/index.js +12 -13
- package/dist/rpc/rabbitmq/index.mjs +2 -3
- package/dist/rpc/redis/index.js +10 -11
- package/dist/rpc/redis/index.mjs +2 -3
- package/dist/rpc/web-ext/index.js +1 -1
- package/dist/rpc/web-ext/index.mjs +0 -1
- package/dist/rpc/ws/index.js +7 -8
- package/dist/rpc/ws/index.mjs +2 -3
- package/dist/test.js +6 -7
- package/dist/test.mjs +2 -3
- package/package.json +2 -2
- package/dist/chunk-5SUY5UVC.js.map +0 -1
- package/dist/chunk-6JAHCTOT.mjs +0 -334
- package/dist/chunk-6JAHCTOT.mjs.map +0 -1
- package/dist/chunk-EDAWJVJ4.js +0 -246
- package/dist/chunk-EDAWJVJ4.js.map +0 -1
- package/dist/chunk-H7OCHDZT.js.map +0 -1
- package/dist/chunk-KRUOHWFR.js.map +0 -1
- package/dist/chunk-KUGU3UGO.js +0 -334
- package/dist/chunk-KUGU3UGO.js.map +0 -1
- package/dist/chunk-LBH4RXQQ.mjs.map +0 -1
- package/dist/chunk-MDPW6WGF.mjs.map +0 -1
- package/dist/chunk-RLFCI3RG.js.map +0 -1
- package/dist/chunk-TTHYUNOT.mjs +0 -246
- package/dist/chunk-TTHYUNOT.mjs.map +0 -1
- package/dist/chunk-VDOICQ2U.mjs.map +0 -1
- package/dist/chunk-WTJKTICN.mjs.map +0 -1
- package/dist/core-BOo3uGFX.d.ts +0 -49
- package/dist/core-CF45G79J.d.mts +0 -49
- package/dist/helper.js.map +0 -1
- package/dist/helper.mjs.map +0 -1
- package/dist/http/elysia/index.js.map +0 -1
- package/dist/http/elysia/index.mjs.map +0 -1
- package/dist/http/express/index.js.map +0 -1
- package/dist/http/express/index.mjs.map +0 -1
- package/dist/http/fastify/index.js.map +0 -1
- package/dist/http/fastify/index.mjs.map +0 -1
- package/dist/http/h3/index.js.map +0 -1
- package/dist/http/h3/index.mjs.map +0 -1
- package/dist/http/hono/index.js.map +0 -1
- package/dist/http/hono/index.mjs.map +0 -1
- package/dist/http/hyper-express/index.js.map +0 -1
- package/dist/http/hyper-express/index.mjs.map +0 -1
- package/dist/http/koa/index.js.map +0 -1
- package/dist/http/koa/index.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/rpc/bullmq/index.js.map +0 -1
- package/dist/rpc/bullmq/index.mjs.map +0 -1
- package/dist/rpc/electron/index.js.map +0 -1
- package/dist/rpc/electron/index.mjs.map +0 -1
- package/dist/rpc/kafka/index.js.map +0 -1
- package/dist/rpc/kafka/index.mjs.map +0 -1
- package/dist/rpc/nats/index.js.map +0 -1
- package/dist/rpc/nats/index.mjs.map +0 -1
- package/dist/rpc/rabbitmq/index.js.map +0 -1
- package/dist/rpc/rabbitmq/index.mjs.map +0 -1
- package/dist/rpc/redis/index.js.map +0 -1
- package/dist/rpc/redis/index.mjs.map +0 -1
- package/dist/rpc/web-ext/index.js.map +0 -1
- package/dist/rpc/web-ext/index.mjs.map +0 -1
- package/dist/rpc/ws/index.js.map +0 -1
- package/dist/rpc/ws/index.mjs.map +0 -1
- package/dist/test.js.map +0 -1
- package/dist/test.mjs.map +0 -1
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk4LLLQOMFjs = require('./chunk-4LLLQOMF.js');
|
|
11
11
|
|
|
12
12
|
// src/helper.ts
|
|
13
13
|
var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
|
|
@@ -17,14 +17,14 @@ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
// src/pipe.ts
|
|
20
|
-
var defaultPipe = /* @__PURE__ */
|
|
20
|
+
var defaultPipe = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, ({ arg }) => {
|
|
21
21
|
return arg;
|
|
22
22
|
}, "defaultPipe");
|
|
23
23
|
|
|
24
24
|
// src/exception/base.ts
|
|
25
25
|
var Exception = class extends Error {
|
|
26
26
|
static {
|
|
27
|
-
|
|
27
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "Exception");
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
|
|
@@ -37,7 +37,7 @@ var Exception = class extends Error {
|
|
|
37
37
|
message: this.message,
|
|
38
38
|
description: this.description,
|
|
39
39
|
status: this.status,
|
|
40
|
-
[
|
|
40
|
+
[_chunk4LLLQOMFjs.ERROR_SYMBOL]: true
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
};
|
|
@@ -45,7 +45,7 @@ var Exception = class extends Error {
|
|
|
45
45
|
// src/exception/undefine.ts
|
|
46
46
|
var UndefinedException = class extends Exception {
|
|
47
47
|
static {
|
|
48
|
-
|
|
48
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "UndefinedException");
|
|
49
49
|
}
|
|
50
50
|
constructor(message) {
|
|
51
51
|
super(message, 500, "Undefined error");
|
|
@@ -55,7 +55,7 @@ var UndefinedException = class extends Exception {
|
|
|
55
55
|
// src/exception/validate.ts
|
|
56
56
|
var ValidateException = class extends Exception {
|
|
57
57
|
static {
|
|
58
|
-
|
|
58
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "ValidateException");
|
|
59
59
|
}
|
|
60
60
|
constructor(message) {
|
|
61
61
|
super(message, 400, "Validate exception");
|
|
@@ -65,7 +65,7 @@ var ValidateException = class extends Exception {
|
|
|
65
65
|
// src/exception/forbidden.ts
|
|
66
66
|
var ForbiddenException = class extends Exception {
|
|
67
67
|
static {
|
|
68
|
-
|
|
68
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "ForbiddenException");
|
|
69
69
|
}
|
|
70
70
|
constructor(message) {
|
|
71
71
|
super(message, 403, "Forbidden resource");
|
|
@@ -75,7 +75,7 @@ var ForbiddenException = class extends Exception {
|
|
|
75
75
|
// src/exception/bad-request.ts
|
|
76
76
|
var BadRequestException = class extends Exception {
|
|
77
77
|
static {
|
|
78
|
-
|
|
78
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "BadRequestException");
|
|
79
79
|
}
|
|
80
80
|
constructor(message) {
|
|
81
81
|
super(message, 400, "Bad Request");
|
|
@@ -85,7 +85,7 @@ var BadRequestException = class extends Exception {
|
|
|
85
85
|
// src/exception/not-found.ts
|
|
86
86
|
var NotFoundException = class extends Exception {
|
|
87
87
|
static {
|
|
88
|
-
|
|
88
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "NotFoundException");
|
|
89
89
|
}
|
|
90
90
|
constructor(message) {
|
|
91
91
|
super(message, 404, "Not Found");
|
|
@@ -95,7 +95,7 @@ var NotFoundException = class extends Exception {
|
|
|
95
95
|
// src/exception/conflict.ts
|
|
96
96
|
var ConflictException = class extends Exception {
|
|
97
97
|
static {
|
|
98
|
-
|
|
98
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "ConflictException");
|
|
99
99
|
}
|
|
100
100
|
constructor(message) {
|
|
101
101
|
super(message, 409, "Conflict");
|
|
@@ -105,7 +105,7 @@ var ConflictException = class extends Exception {
|
|
|
105
105
|
// src/exception/bad-gateway.ts
|
|
106
106
|
var BadGatewayException = class extends Exception {
|
|
107
107
|
static {
|
|
108
|
-
|
|
108
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "BadGatewayException");
|
|
109
109
|
}
|
|
110
110
|
constructor(message) {
|
|
111
111
|
super(message, 502, "Bad Gatrway");
|
|
@@ -115,7 +115,7 @@ var BadGatewayException = class extends Exception {
|
|
|
115
115
|
// src/exception/invalid-input.ts
|
|
116
116
|
var InvalidInputException = class extends Exception {
|
|
117
117
|
static {
|
|
118
|
-
|
|
118
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "InvalidInputException");
|
|
119
119
|
}
|
|
120
120
|
constructor(message) {
|
|
121
121
|
super(message, 502, "Invalid Input");
|
|
@@ -125,7 +125,7 @@ var InvalidInputException = class extends Exception {
|
|
|
125
125
|
// src/exception/media-type.ts
|
|
126
126
|
var UnsupportedMediaTypeException = class extends Exception {
|
|
127
127
|
static {
|
|
128
|
-
|
|
128
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "UnsupportedMediaTypeException");
|
|
129
129
|
}
|
|
130
130
|
constructor(message) {
|
|
131
131
|
super(message, 415, "Unsupported Media Type");
|
|
@@ -135,7 +135,7 @@ var UnsupportedMediaTypeException = class extends Exception {
|
|
|
135
135
|
// src/exception/payload-large.ts
|
|
136
136
|
var PayloadLargeException = class extends Exception {
|
|
137
137
|
static {
|
|
138
|
-
|
|
138
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "PayloadLargeException");
|
|
139
139
|
}
|
|
140
140
|
constructor(message) {
|
|
141
141
|
super(message, 413, "Payload Too Large");
|
|
@@ -145,7 +145,7 @@ var PayloadLargeException = class extends Exception {
|
|
|
145
145
|
// src/exception/timeout.ts
|
|
146
146
|
var TimeoutException = class extends Exception {
|
|
147
147
|
static {
|
|
148
|
-
|
|
148
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "TimeoutException");
|
|
149
149
|
}
|
|
150
150
|
constructor(message) {
|
|
151
151
|
super(message, 408, "Request Timeout");
|
|
@@ -155,7 +155,7 @@ var TimeoutException = class extends Exception {
|
|
|
155
155
|
// src/exception/unauthorized.ts
|
|
156
156
|
var UnauthorizedException = class extends Exception {
|
|
157
157
|
static {
|
|
158
|
-
|
|
158
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "UnauthorizedException");
|
|
159
159
|
}
|
|
160
160
|
constructor(message) {
|
|
161
161
|
super(message, 401, "Unauthorized");
|
|
@@ -165,7 +165,7 @@ var UnauthorizedException = class extends Exception {
|
|
|
165
165
|
// src/exception/unavailable-service.ts
|
|
166
166
|
var ServiceUnavailableException = class extends Exception {
|
|
167
167
|
static {
|
|
168
|
-
|
|
168
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "ServiceUnavailableException");
|
|
169
169
|
}
|
|
170
170
|
constructor(message) {
|
|
171
171
|
super(message, 503, "Service Unavailable");
|
|
@@ -175,7 +175,7 @@ var ServiceUnavailableException = class extends Exception {
|
|
|
175
175
|
// src/exception/framework.ts
|
|
176
176
|
var FrameworkException = class extends Exception {
|
|
177
177
|
static {
|
|
178
|
-
|
|
178
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "FrameworkException");
|
|
179
179
|
}
|
|
180
180
|
constructor(message) {
|
|
181
181
|
super(`[phecda-server] ${message}`, 500, "Framework Error");
|
|
@@ -185,7 +185,7 @@ var FrameworkException = class extends Exception {
|
|
|
185
185
|
// src/exception/timer.ts
|
|
186
186
|
var TimerException = class extends Exception {
|
|
187
187
|
static {
|
|
188
|
-
|
|
188
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "TimerException");
|
|
189
189
|
}
|
|
190
190
|
constructor(message) {
|
|
191
191
|
super(message, 0, "Timer Error");
|
|
@@ -195,7 +195,7 @@ var TimerException = class extends Exception {
|
|
|
195
195
|
// src/exception/worker.ts
|
|
196
196
|
var WorkerException = class extends Exception {
|
|
197
197
|
static {
|
|
198
|
-
|
|
198
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "WorkerException");
|
|
199
199
|
}
|
|
200
200
|
constructor(message) {
|
|
201
201
|
super(message, 0, "Worker Error");
|
|
@@ -203,14 +203,14 @@ var WorkerException = class extends Exception {
|
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
// src/filter.ts
|
|
206
|
-
var defaultFilter = /* @__PURE__ */
|
|
206
|
+
var defaultFilter = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (e) => {
|
|
207
207
|
if (!(e instanceof Exception)) {
|
|
208
|
-
|
|
209
|
-
if (
|
|
208
|
+
_chunk4LLLQOMFjs.log.call(void 0, e.message, "error");
|
|
209
|
+
if (_chunk4LLLQOMFjs.LOG_LEVEL <= 0) console.error(e.stack);
|
|
210
210
|
e = new UndefinedException(e.message || e);
|
|
211
211
|
} else {
|
|
212
|
-
|
|
213
|
-
if (
|
|
212
|
+
_chunk4LLLQOMFjs.log.call(void 0, `[${e.constructor.name}] ${e.message}`, "error");
|
|
213
|
+
if (_chunk4LLLQOMFjs.LOG_LEVEL <= 0) console.error(e.stack);
|
|
214
214
|
}
|
|
215
215
|
return e.data;
|
|
216
216
|
}, "defaultFilter");
|
|
@@ -219,7 +219,7 @@ var defaultFilter = /* @__PURE__ */ _chunkRLFCI3RGjs.__name.call(void 0, (e) =>
|
|
|
219
219
|
var debug = _debug2.default.call(void 0, "phecda-server(Context)");
|
|
220
220
|
var Context = (_class = class _Context {
|
|
221
221
|
static {
|
|
222
|
-
|
|
222
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "Context");
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
|
|
@@ -236,11 +236,11 @@ var Context = (_class = class _Context {
|
|
|
236
236
|
// protected canGetCtx = true
|
|
237
237
|
constructor(data) {
|
|
238
238
|
this.data = data;
|
|
239
|
-
if (
|
|
239
|
+
if (_chunk4LLLQOMFjs.IS_DEV)
|
|
240
240
|
data._context = this;
|
|
241
241
|
this.ctx = new Proxy(data, {
|
|
242
242
|
get(target, p) {
|
|
243
|
-
if (!(p in target))
|
|
243
|
+
if (!(p in target)) _chunk4LLLQOMFjs.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);
|
|
244
244
|
return target[p];
|
|
245
245
|
},
|
|
246
246
|
set(target, p, newValue) {
|
|
@@ -278,7 +278,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
|
|
|
278
278
|
const { paramsType, data: { ctxs, tag, params, func } } = meta;
|
|
279
279
|
try {
|
|
280
280
|
let res;
|
|
281
|
-
const nextHandler = /* @__PURE__ */
|
|
281
|
+
const nextHandler = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (index) => {
|
|
282
282
|
return async () => {
|
|
283
283
|
if (index === guards.length) {
|
|
284
284
|
const instance = moduleMap.get(tag);
|
|
@@ -302,7 +302,7 @@ ${_picocolors2.default.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
|
|
|
302
302
|
return res;
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
|
-
|
|
305
|
+
_chunk4LLLQOMFjs.__name.call(void 0, next, "next");
|
|
306
306
|
const ret = await guards[index](this.ctx, next);
|
|
307
307
|
if (ret !== void 0) {
|
|
308
308
|
res = ret;
|
|
@@ -347,12 +347,12 @@ function addPipe(key, pipe) {
|
|
|
347
347
|
if (Context.pipeRecord[key] && Context.pipeRecord[key] !== pipe) debug(`overwrite Pipe "${String(key)}"`, "warn");
|
|
348
348
|
Context.pipeRecord[key] = pipe;
|
|
349
349
|
}
|
|
350
|
-
|
|
350
|
+
_chunk4LLLQOMFjs.__name.call(void 0, addPipe, "addPipe");
|
|
351
351
|
function addFilter(key, filter) {
|
|
352
352
|
if (Context.filterRecord[key] && Context.filterRecord[key] !== filter) debug(`overwrite Filter "${String(key)}"`, "warn");
|
|
353
353
|
Context.filterRecord[key] = filter;
|
|
354
354
|
}
|
|
355
|
-
|
|
355
|
+
_chunk4LLLQOMFjs.__name.call(void 0, addFilter, "addFilter");
|
|
356
356
|
function addGuard(key, guard, priority = 0) {
|
|
357
357
|
if (Context.guardRecord[key] && Context.guardRecord[key].value !== guard) debug(`overwrite Guard "${String(key)}"`, "warn");
|
|
358
358
|
Context.guardRecord[key] = {
|
|
@@ -360,7 +360,7 @@ function addGuard(key, guard, priority = 0) {
|
|
|
360
360
|
priority
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
|
-
|
|
363
|
+
_chunk4LLLQOMFjs.__name.call(void 0, addGuard, "addGuard");
|
|
364
364
|
function addAddon(key, addon, priority = 0) {
|
|
365
365
|
if (Context.addonRecord[key] && Context.addonRecord[key].value !== addon) debug(`overwrite Addon "${String(key)}"`, "warn");
|
|
366
366
|
Context.addonRecord[key] = {
|
|
@@ -368,14 +368,14 @@ function addAddon(key, addon, priority = 0) {
|
|
|
368
368
|
priority
|
|
369
369
|
};
|
|
370
370
|
}
|
|
371
|
-
|
|
371
|
+
_chunk4LLLQOMFjs.__name.call(void 0, addAddon, "addAddon");
|
|
372
372
|
|
|
373
373
|
// src/http/helper.ts
|
|
374
374
|
function resolveDep(ret, key) {
|
|
375
375
|
if (key) return _optionalChain([ret, 'optionalAccess', _ => _[key]]);
|
|
376
376
|
return ret;
|
|
377
377
|
}
|
|
378
|
-
|
|
378
|
+
_chunk4LLLQOMFjs.__name.call(void 0, resolveDep, "resolveDep");
|
|
379
379
|
|
|
380
380
|
// src/decorators/helper.ts
|
|
381
381
|
function shallowClone(obj) {
|
|
@@ -383,11 +383,11 @@ function shallowClone(obj) {
|
|
|
383
383
|
...obj
|
|
384
384
|
};
|
|
385
385
|
}
|
|
386
|
-
|
|
386
|
+
_chunk4LLLQOMFjs.__name.call(void 0, shallowClone, "shallowClone");
|
|
387
387
|
function mergeObject(...args) {
|
|
388
388
|
return Object.assign({}, ...args);
|
|
389
389
|
}
|
|
390
|
-
|
|
390
|
+
_chunk4LLLQOMFjs.__name.call(void 0, mergeObject, "mergeObject");
|
|
391
391
|
|
|
392
392
|
// src/helper.ts
|
|
393
393
|
function createControllerMetaMap(meta, filter) {
|
|
@@ -403,14 +403,14 @@ function createControllerMetaMap(meta, filter) {
|
|
|
403
403
|
});
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
|
|
406
|
+
_chunk4LLLQOMFjs.__name.call(void 0, handleMeta, "handleMeta");
|
|
407
407
|
handleMeta();
|
|
408
|
-
|
|
408
|
+
_chunk4LLLQOMFjs.HMR.call(void 0, handleMeta);
|
|
409
409
|
return metaMap;
|
|
410
410
|
}
|
|
411
|
-
|
|
411
|
+
_chunk4LLLQOMFjs.__name.call(void 0, createControllerMetaMap, "createControllerMetaMap");
|
|
412
412
|
function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
|
|
413
|
-
if (
|
|
413
|
+
if (_chunk4LLLQOMFjs.IS_PURE) return;
|
|
414
414
|
const addonSet = /* @__PURE__ */ new Set();
|
|
415
415
|
const guardSet = /* @__PURE__ */ new Set();
|
|
416
416
|
const pipeSet = /* @__PURE__ */ new Set();
|
|
@@ -455,34 +455,34 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
|
|
|
455
455
|
...filterSet
|
|
456
456
|
].filter((i) => !Context.filterRecord[i]);
|
|
457
457
|
function exit() {
|
|
458
|
-
if (
|
|
459
|
-
|
|
458
|
+
if (_chunk4LLLQOMFjs.IS_STRICT) {
|
|
459
|
+
_chunk4LLLQOMFjs.log.call(void 0, "Does not meet strict mode requirements", "error");
|
|
460
460
|
process.exit(1);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
|
|
463
|
+
_chunk4LLLQOMFjs.__name.call(void 0, exit, "exit");
|
|
464
464
|
if (missAddons.length) {
|
|
465
|
-
|
|
465
|
+
_chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.white(`Addon [${missAddons.join(",")}]`)} doesn't exist`, "warn");
|
|
466
466
|
exit();
|
|
467
467
|
}
|
|
468
468
|
if (missGuards.length) {
|
|
469
|
-
|
|
469
|
+
_chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
|
|
470
470
|
exit();
|
|
471
471
|
}
|
|
472
472
|
if (missPipes.length) {
|
|
473
|
-
|
|
473
|
+
_chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
|
|
474
474
|
exit();
|
|
475
475
|
}
|
|
476
476
|
if (missFilters.length) {
|
|
477
|
-
|
|
477
|
+
_chunk4LLLQOMFjs.log.call(void 0, `${_picocolors2.default.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
|
|
478
478
|
exit();
|
|
479
479
|
}
|
|
480
|
-
warningSet.forEach((warn) =>
|
|
480
|
+
warningSet.forEach((warn) => _chunk4LLLQOMFjs.log.call(void 0, warn, "warn"));
|
|
481
481
|
if (warningSet.size) exit();
|
|
482
482
|
}
|
|
483
|
-
|
|
483
|
+
_chunk4LLLQOMFjs.__name.call(void 0, handleMeta, "handleMeta");
|
|
484
484
|
handleMeta();
|
|
485
|
-
|
|
485
|
+
_chunk4LLLQOMFjs.HMR.call(void 0, handleMeta);
|
|
486
486
|
return {
|
|
487
487
|
addonSet,
|
|
488
488
|
guardSet,
|
|
@@ -490,7 +490,7 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
|
|
|
490
490
|
filterSet
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
|
-
|
|
493
|
+
_chunk4LLLQOMFjs.__name.call(void 0, detectAopDep, "detectAopDep");
|
|
494
494
|
function joinUrl(base, ...paths) {
|
|
495
495
|
const joinedPath = [
|
|
496
496
|
base,
|
|
@@ -498,7 +498,7 @@ function joinUrl(base, ...paths) {
|
|
|
498
498
|
].filter((p) => p).map((path) => path.replace(/(^\/)/g, "")).join("/");
|
|
499
499
|
return `/${joinedPath}`;
|
|
500
500
|
}
|
|
501
|
-
|
|
501
|
+
_chunk4LLLQOMFjs.__name.call(void 0, joinUrl, "joinUrl");
|
|
502
502
|
|
|
503
503
|
|
|
504
504
|
|
|
@@ -531,4 +531,3 @@ _chunkRLFCI3RGjs.__name.call(void 0, joinUrl, "joinUrl");
|
|
|
531
531
|
|
|
532
532
|
|
|
533
533
|
exports.defaultPipe = defaultPipe; exports.Exception = Exception; exports.UndefinedException = UndefinedException; exports.ValidateException = ValidateException; exports.ForbiddenException = ForbiddenException; exports.BadRequestException = BadRequestException; exports.NotFoundException = NotFoundException; exports.ConflictException = ConflictException; exports.BadGatewayException = BadGatewayException; exports.InvalidInputException = InvalidInputException; exports.UnsupportedMediaTypeException = UnsupportedMediaTypeException; exports.PayloadLargeException = PayloadLargeException; exports.TimeoutException = TimeoutException; exports.UnauthorizedException = UnauthorizedException; exports.ServiceUnavailableException = ServiceUnavailableException; exports.FrameworkException = FrameworkException; exports.TimerException = TimerException; exports.WorkerException = WorkerException; exports.Context = Context; exports.addPipe = addPipe; exports.addFilter = addFilter; exports.addGuard = addGuard; exports.addAddon = addAddon; exports.resolveDep = resolveDep; exports.shallowClone = shallowClone; exports.mergeObject = mergeObject; exports.createControllerMetaMap = createControllerMetaMap; exports.detectAopDep = detectAopDep; exports.joinUrl = joinUrl;
|
|
534
|
-
//# sourceMappingURL=chunk-H7OCHDZT.js.map
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk4LLLQOMFjs = require('./chunk-4LLLQOMF.js');
|
|
8
8
|
|
|
9
9
|
// src/meta.ts
|
|
10
10
|
var Meta = class {
|
|
11
11
|
static {
|
|
12
|
-
|
|
12
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "Meta");
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
|
|
@@ -38,11 +38,11 @@ function defaultServerInject() {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
_chunk4LLLQOMFjs.__name.call(void 0, defaultServerInject, "defaultServerInject");
|
|
42
42
|
var phecdaNamespace = /* @__PURE__ */ new Map();
|
|
43
43
|
var ServerPhecda = (_class = class {
|
|
44
44
|
static {
|
|
45
|
-
|
|
45
|
+
_chunk4LLLQOMFjs.__name.call(void 0, this, "ServerPhecda");
|
|
46
46
|
}
|
|
47
47
|
__init() {this.moduleMap = /* @__PURE__ */ new Map()}
|
|
48
48
|
__init2() {this.meta = []}
|
|
@@ -54,7 +54,7 @@ var ServerPhecda = (_class = class {
|
|
|
54
54
|
|
|
55
55
|
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);_class.prototype.__init6.call(this);
|
|
56
56
|
defaultServerInject();
|
|
57
|
-
const { namespace = "default", parseModule = /* @__PURE__ */
|
|
57
|
+
const { namespace = "default", parseModule = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (module) => module, "parseModule"), parseMeta = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (meta) => meta, "parseMeta"), generators = [] } = options;
|
|
58
58
|
phecdaNamespace.set(namespace, this);
|
|
59
59
|
this.parseMeta = parseMeta;
|
|
60
60
|
this.parseModule = parseModule;
|
|
@@ -64,20 +64,20 @@ var ServerPhecda = (_class = class {
|
|
|
64
64
|
for (const model of models) await this.buildDepModule(model);
|
|
65
65
|
this.hmr();
|
|
66
66
|
this.generateCode().then(() => {
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
process.exit(
|
|
67
|
+
if (_chunk4LLLQOMFjs.IS_ONLY_GENERATE) {
|
|
68
|
+
_chunk4LLLQOMFjs.log.call(void 0, "Only generate code");
|
|
69
|
+
process.exit(_chunk4LLLQOMFjs.PS_EXIT_CODE.EXIT);
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
__init6() {this.generateCode = /* @__PURE__ */
|
|
73
|
+
__init6() {this.generateCode = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, async () => {
|
|
74
74
|
return Promise.all(this.generators.map((generator) => {
|
|
75
75
|
debug(`generate "${generator.name}" code to ${generator.path}`);
|
|
76
76
|
return generator.output(this.meta);
|
|
77
77
|
}));
|
|
78
78
|
}, "generateCode")}
|
|
79
79
|
hmr() {
|
|
80
|
-
|
|
80
|
+
_chunk4LLLQOMFjs.HMR.call(void 0, async (oldModels, newModels) => {
|
|
81
81
|
debug("reload models ");
|
|
82
82
|
await this.replace(oldModels, newModels);
|
|
83
83
|
this.generateCode();
|
|
@@ -119,7 +119,7 @@ var ServerPhecda = (_class = class {
|
|
|
119
119
|
if (this.moduleMap.has(tag)) {
|
|
120
120
|
module = this.moduleMap.get(tag);
|
|
121
121
|
if (!module) {
|
|
122
|
-
|
|
122
|
+
_chunk4LLLQOMFjs.log.call(void 0, `Exist Circular-Dependency or Multiple modules with the same tag [${String(tag)}]`, "warn");
|
|
123
123
|
return {
|
|
124
124
|
module: this.createProxyModule(tag),
|
|
125
125
|
tag
|
|
@@ -127,8 +127,8 @@ var ServerPhecda = (_class = class {
|
|
|
127
127
|
}
|
|
128
128
|
if (this.modelMap.get(module) !== Model && !this.modelSet.has(Model)) {
|
|
129
129
|
this.modelSet.add(Model);
|
|
130
|
-
if (module instanceof Model)
|
|
131
|
-
else
|
|
130
|
+
if (module instanceof Model) _chunk4LLLQOMFjs.log.call(void 0, `Module taged ${String(tag)} has been overridden`);
|
|
131
|
+
else _chunk4LLLQOMFjs.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Model.name}"`, "warn");
|
|
132
132
|
}
|
|
133
133
|
return {
|
|
134
134
|
module,
|
|
@@ -151,7 +151,7 @@ var ServerPhecda = (_class = class {
|
|
|
151
151
|
}
|
|
152
152
|
this.meta.push(...getMetaFromInstance(module, tag, Model.name).map(this.parseMeta).filter((item) => !!item));
|
|
153
153
|
debug(`init module "${String(tag)}"`);
|
|
154
|
-
if (!
|
|
154
|
+
if (!_chunk4LLLQOMFjs.IS_ONLY_GENERATE) await _phecdacore.invokeInit.call(void 0, module);
|
|
155
155
|
debug(`add module "${String(tag)}"`);
|
|
156
156
|
this.moduleMap.set(tag, module);
|
|
157
157
|
this.modelMap.set(module, Model);
|
|
@@ -213,7 +213,7 @@ async function Factory(models, opts = {}) {
|
|
|
213
213
|
await phecda.start(models);
|
|
214
214
|
return phecda;
|
|
215
215
|
}
|
|
216
|
-
|
|
216
|
+
_chunk4LLLQOMFjs.__name.call(void 0, Factory, "Factory");
|
|
217
217
|
function useS(nsOrModel, namespace) {
|
|
218
218
|
if (!nsOrModel) {
|
|
219
219
|
namespace = "default";
|
|
@@ -226,7 +226,7 @@ function useS(nsOrModel, namespace) {
|
|
|
226
226
|
if (nsOrModel && typeof nsOrModel !== "string") return serverPhecda.get(nsOrModel);
|
|
227
227
|
else return serverPhecda;
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
_chunk4LLLQOMFjs.__name.call(void 0, useS, "useS");
|
|
230
230
|
function getMetaFromInstance(instance, tag, name) {
|
|
231
231
|
const propertyKeys = _phecdacore.getMetaKey.call(void 0, instance).filter((item) => typeof item === "string");
|
|
232
232
|
const baseMeta = _phecdacore.getMergedMeta.call(void 0, instance, void 0);
|
|
@@ -240,7 +240,7 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
240
240
|
func: i
|
|
241
241
|
};
|
|
242
242
|
if (baseMeta.controller) {
|
|
243
|
-
if (typeof tag !== "string")
|
|
243
|
+
if (typeof tag !== "string") _chunk4LLLQOMFjs.log.call(void 0, `can't use Tag with ${typeof tag} on controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
|
|
244
244
|
metaData.controller = baseMeta.controller;
|
|
245
245
|
metaData[baseMeta.controller] = {
|
|
246
246
|
...baseMeta[baseMeta.controller],
|
|
@@ -278,7 +278,7 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
278
278
|
return new Meta(deepFreeze(metaData), getParamTypes(instance, i) || []);
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
|
-
|
|
281
|
+
_chunk4LLLQOMFjs.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
|
|
282
282
|
function deepFreeze(object) {
|
|
283
283
|
Object.freeze(object);
|
|
284
284
|
Object.getOwnPropertyNames(object).forEach((prop) => {
|
|
@@ -286,13 +286,13 @@ function deepFreeze(object) {
|
|
|
286
286
|
});
|
|
287
287
|
return object;
|
|
288
288
|
}
|
|
289
|
-
|
|
289
|
+
_chunk4LLLQOMFjs.__name.call(void 0, deepFreeze, "deepFreeze");
|
|
290
290
|
function getParamTypes(Model, key) {
|
|
291
291
|
const paramTypes = Reflect.getMetadata("design:paramtypes", Model, key);
|
|
292
292
|
if (typeof paramTypes === "function") return paramTypes();
|
|
293
293
|
else return paramTypes;
|
|
294
294
|
}
|
|
295
|
-
|
|
295
|
+
_chunk4LLLQOMFjs.__name.call(void 0, getParamTypes, "getParamTypes");
|
|
296
296
|
|
|
297
297
|
|
|
298
298
|
|
|
@@ -303,4 +303,3 @@ _chunkRLFCI3RGjs.__name.call(void 0, getParamTypes, "getParamTypes");
|
|
|
303
303
|
|
|
304
304
|
|
|
305
305
|
exports.Meta = Meta; exports.emitter = emitter; exports.defaultServerInject = defaultServerInject; exports.phecdaNamespace = phecdaNamespace; exports.ServerPhecda = ServerPhecda; exports.Factory = Factory; exports.useS = useS;
|
|
306
|
-
//# sourceMappingURL=chunk-KRUOHWFR.js.map
|
package/dist/helper.js
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkXKK2SQ7Wjs = require('./chunk-XKK2SQ7W.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunk4LLLQOMFjs = require('./chunk-4LLLQOMF.js');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -21,5 +21,4 @@ var _chunkRLFCI3RGjs = require('./chunk-RLFCI3RG.js');
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
exports.HMR =
|
|
25
|
-
//# sourceMappingURL=helper.js.map
|
|
24
|
+
exports.HMR = _chunk4LLLQOMFjs.HMR; exports.RELAUNCH = _chunk4LLLQOMFjs.RELAUNCH; exports.RELOAD = _chunk4LLLQOMFjs.RELOAD; exports.createControllerMetaMap = _chunkXKK2SQ7Wjs.createControllerMetaMap; exports.detectAopDep = _chunkXKK2SQ7Wjs.detectAopDep; exports.joinUrl = _chunkXKK2SQ7Wjs.joinUrl; exports.mergeObject = _chunkXKK2SQ7Wjs.mergeObject; exports.resolveDep = _chunkXKK2SQ7Wjs.resolveDep; exports.shallowClone = _chunkXKK2SQ7Wjs.shallowClone;
|
package/dist/helper.mjs
CHANGED
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
mergeObject,
|
|
6
6
|
resolveDep,
|
|
7
7
|
shallowClone
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-E7EAPAGM.mjs";
|
|
9
9
|
import {
|
|
10
10
|
HMR,
|
|
11
11
|
RELAUNCH,
|
|
12
12
|
RELOAD
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-NQ55PA2X.mjs";
|
|
14
14
|
export {
|
|
15
15
|
HMR,
|
|
16
16
|
RELAUNCH,
|
|
@@ -22,4 +22,3 @@ export {
|
|
|
22
22
|
resolveDep,
|
|
23
23
|
shallowClone
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=helper.mjs.map
|