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
|
@@ -1,10 +1,10 @@
|
|
|
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
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkRZ7IXJYQjs = require('./chunk-RZ7IXJYQ.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkGHFSIZUOjs = require('./chunk-GHFSIZUO.js');
|
|
8
8
|
|
|
9
9
|
// src/decorators/param.ts
|
|
10
10
|
var _phecdacore = require('phecda-core');
|
|
@@ -14,7 +14,7 @@ function BaseParam(data) {
|
|
|
14
14
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
15
15
|
if (!state.params) state.params = [
|
|
16
16
|
..._optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _ => _.params]) || []
|
|
17
|
-
].map(
|
|
17
|
+
].map(_chunkRZ7IXJYQjs.shallowClone);
|
|
18
18
|
const existItem = state.params.find((item) => item.index === index);
|
|
19
19
|
if (existItem) Object.assign(existItem, data);
|
|
20
20
|
else state.params.push({
|
|
@@ -24,42 +24,42 @@ function BaseParam(data) {
|
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
_chunkGHFSIZUOjs.__name.call(void 0, BaseParam, "BaseParam");
|
|
28
28
|
function Body(key = "") {
|
|
29
29
|
return BaseParam({
|
|
30
30
|
type: "body",
|
|
31
31
|
key
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Body, "Body");
|
|
35
35
|
function Head(key) {
|
|
36
36
|
return BaseParam({
|
|
37
37
|
type: "headers",
|
|
38
38
|
key: key.toLowerCase()
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Head, "Head");
|
|
42
42
|
function Query(key = "") {
|
|
43
43
|
return BaseParam({
|
|
44
44
|
type: "query",
|
|
45
45
|
key
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Query, "Query");
|
|
49
49
|
function Param(key) {
|
|
50
50
|
return BaseParam({
|
|
51
51
|
type: "params",
|
|
52
52
|
key
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Param, "Param");
|
|
56
56
|
function Arg(target, k, index) {
|
|
57
57
|
BaseParam({
|
|
58
58
|
type: "args",
|
|
59
59
|
key: `${index}`
|
|
60
60
|
})(target, k, index);
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Arg, "Arg");
|
|
63
63
|
|
|
64
64
|
// src/decorators/aop.ts
|
|
65
65
|
|
|
@@ -76,7 +76,7 @@ function Guard(...guards) {
|
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Guard, "Guard");
|
|
80
80
|
function Plugin(...plugins) {
|
|
81
81
|
return (target, k) => {
|
|
82
82
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
@@ -90,7 +90,7 @@ function Plugin(...plugins) {
|
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Plugin, "Plugin");
|
|
94
94
|
function Interceptor(...interceptors) {
|
|
95
95
|
return (target, k) => {
|
|
96
96
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
@@ -104,13 +104,13 @@ function Interceptor(...interceptors) {
|
|
|
104
104
|
});
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Interceptor, "Interceptor");
|
|
108
108
|
function Filter(filter) {
|
|
109
109
|
return (target, k) => {
|
|
110
110
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => state.filter = filter);
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Filter, "Filter");
|
|
114
114
|
function Pipe(pipe) {
|
|
115
115
|
return (target, k, index) => {
|
|
116
116
|
if (typeof index === "number") {
|
|
@@ -122,86 +122,86 @@ function Pipe(pipe) {
|
|
|
122
122
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => state.pipe = pipe);
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Pipe, "Pipe");
|
|
126
126
|
|
|
127
127
|
// src/decorators/http.ts
|
|
128
128
|
|
|
129
129
|
function Route(route, type) {
|
|
130
130
|
return (target, k) => {
|
|
131
131
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
132
|
-
state.http =
|
|
132
|
+
state.http = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.http || _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _5 => _5.http]), {
|
|
133
133
|
route,
|
|
134
134
|
type
|
|
135
135
|
});
|
|
136
136
|
});
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Route, "Route");
|
|
140
140
|
function Header(headers) {
|
|
141
141
|
return (target, k) => {
|
|
142
142
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
143
|
-
if (!state.http) state.http =
|
|
144
|
-
state.http =
|
|
145
|
-
headers:
|
|
143
|
+
if (!state.http) state.http = _chunkRZ7IXJYQjs.mergeObject.call(void 0, _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _6 => _6.http]));
|
|
144
|
+
state.http = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.http, {
|
|
145
|
+
headers: _chunkRZ7IXJYQjs.mergeObject.call(void 0, _optionalChain([state, 'access', _7 => _7.http, 'optionalAccess', _8 => _8.headers]), headers)
|
|
146
146
|
});
|
|
147
147
|
});
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Header, "Header");
|
|
151
151
|
function Get(route = "") {
|
|
152
152
|
return Route(route, "get");
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Get, "Get");
|
|
155
155
|
function Post(route = "") {
|
|
156
156
|
return Route(route, "post");
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Post, "Post");
|
|
159
159
|
function Put(route = "") {
|
|
160
160
|
return Route(route, "put");
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Put, "Put");
|
|
163
163
|
function Patch(route = "") {
|
|
164
164
|
return Route(route, "patch");
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Patch, "Patch");
|
|
167
167
|
function Delete(route = "") {
|
|
168
168
|
return Route(route, "delete");
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Delete, "Delete");
|
|
171
171
|
function Controller(prefix = "") {
|
|
172
172
|
return (target) => {
|
|
173
173
|
_phecdacore.setPropertyState.call(void 0, target, void 0, (state) => {
|
|
174
174
|
state.controller = "http";
|
|
175
|
-
state.http =
|
|
175
|
+
state.http = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.http || _optionalChain([_phecdacore.getState.call(void 0, target), 'optionalAccess', _9 => _9.http]), {
|
|
176
176
|
prefix
|
|
177
177
|
});
|
|
178
178
|
});
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Controller, "Controller");
|
|
182
182
|
|
|
183
183
|
// src/decorators/rpc.ts
|
|
184
184
|
|
|
185
185
|
function Event(isEvent = true) {
|
|
186
186
|
return (target, k) => {
|
|
187
187
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
188
|
-
state.rpc =
|
|
188
|
+
state.rpc = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.rpc || _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _10 => _10.rpc]), {
|
|
189
189
|
isEvent
|
|
190
190
|
});
|
|
191
191
|
});
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Event, "Event");
|
|
195
195
|
function Queue(queue = "") {
|
|
196
196
|
return (target, k) => {
|
|
197
197
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
198
|
-
state.rpc =
|
|
198
|
+
state.rpc = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.rpc || _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _11 => _11.rpc]), {
|
|
199
199
|
queue
|
|
200
200
|
});
|
|
201
201
|
});
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
|
-
|
|
204
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Queue, "Queue");
|
|
205
205
|
function Rpc() {
|
|
206
206
|
return (target) => {
|
|
207
207
|
_phecdacore.setPropertyState.call(void 0, target, void 0, (state) => {
|
|
@@ -209,11 +209,11 @@ function Rpc() {
|
|
|
209
209
|
});
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Rpc, "Rpc");
|
|
213
213
|
|
|
214
214
|
// src/decorators/ctx.ts
|
|
215
215
|
|
|
216
|
-
var Ctx = /* @__PURE__ */
|
|
216
|
+
var Ctx = /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (target, key) => {
|
|
217
217
|
_phecdacore.setPropertyState.call(void 0, target, _phecdacore.SHARE_KEY, (state) => {
|
|
218
218
|
if (!state.ctxs) state.ctxs = /* @__PURE__ */ new Set([
|
|
219
219
|
..._optionalChain([_phecdacore.getState.call(void 0, target), 'optionalAccess', _12 => _12.ctxs]) || []
|
|
@@ -228,9 +228,9 @@ function Define(key, value) {
|
|
|
228
228
|
const parentState = _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _13 => _13.params]) || [];
|
|
229
229
|
if (!state.params) state.params = [
|
|
230
230
|
...parentState
|
|
231
|
-
].map(
|
|
231
|
+
].map(_chunkRZ7IXJYQjs.shallowClone);
|
|
232
232
|
const existItem = state.params.find((item) => item.index === index);
|
|
233
|
-
if (existItem) existItem.define =
|
|
233
|
+
if (existItem) existItem.define = _chunkRZ7IXJYQjs.mergeObject.call(void 0, existItem.define, {
|
|
234
234
|
[key]: value
|
|
235
235
|
});
|
|
236
236
|
else state.params.push({
|
|
@@ -244,12 +244,12 @@ function Define(key, value) {
|
|
|
244
244
|
}
|
|
245
245
|
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
246
246
|
const parentState = _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _14 => _14.define]);
|
|
247
|
-
if (!state.define) state.define =
|
|
247
|
+
if (!state.define) state.define = _chunkRZ7IXJYQjs.mergeObject.call(void 0, parentState);
|
|
248
248
|
state.define[key] = value;
|
|
249
249
|
});
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
|
|
252
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Define, "Define");
|
|
253
253
|
|
|
254
254
|
|
|
255
255
|
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkGHFSIZUOjs = require('./chunk-GHFSIZUO.js');
|
|
7
7
|
|
|
8
8
|
// src/meta.ts
|
|
9
9
|
var Meta = class {
|
|
10
10
|
static {
|
|
11
|
-
|
|
11
|
+
_chunkGHFSIZUOjs.__name.call(void 0, this, "Meta");
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
|
|
@@ -31,7 +31,7 @@ async function Factory(models, opts = {}) {
|
|
|
31
31
|
const modelMap = /* @__PURE__ */ new WeakMap();
|
|
32
32
|
const modelSet = /* @__PURE__ */ new WeakSet();
|
|
33
33
|
const dependenceGraph = /* @__PURE__ */ new Map();
|
|
34
|
-
const { parseModule = /* @__PURE__ */
|
|
34
|
+
const { parseModule = /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (module) => module, "parseModule"), parseMeta = /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (meta2) => meta2, "parseMeta"), generators } = opts;
|
|
35
35
|
if (!_phecdacore.getInject.call(void 0, "watcher")) {
|
|
36
36
|
_phecdacore.setInject.call(void 0, "watcher", ({ eventName, instance, key, options }) => {
|
|
37
37
|
const fn = typeof instance[key] === "function" ? instance[key].bind(instance) : (v) => instance[key] = v;
|
|
@@ -55,12 +55,12 @@ async function Factory(models, opts = {}) {
|
|
|
55
55
|
}
|
|
56
56
|
return module;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
_chunkGHFSIZUOjs.__name.call(void 0, del, "del");
|
|
59
59
|
async function destroy() {
|
|
60
60
|
debug("destroy all");
|
|
61
61
|
for (const [tag] of moduleMap) await del(tag);
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
_chunkGHFSIZUOjs.__name.call(void 0, destroy, "destroy");
|
|
64
64
|
async function add(Model) {
|
|
65
65
|
const tag = _phecdacore.getTag.call(void 0, Model);
|
|
66
66
|
const oldInstance = await del(tag);
|
|
@@ -77,7 +77,7 @@ async function Factory(models, opts = {}) {
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
_chunkGHFSIZUOjs.__name.call(void 0, add, "add");
|
|
81
81
|
async function buildDepModule(Model) {
|
|
82
82
|
const paramtypes = getParamTypes(Model);
|
|
83
83
|
let module;
|
|
@@ -87,8 +87,8 @@ async function Factory(models, opts = {}) {
|
|
|
87
87
|
if (!module) throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${String(tag)}--[module] ${Model}`);
|
|
88
88
|
if (modelMap.get(module) !== Model && !modelSet.has(Model)) {
|
|
89
89
|
modelSet.add(Model);
|
|
90
|
-
if (module instanceof Model)
|
|
91
|
-
else
|
|
90
|
+
if (module instanceof Model) _chunkGHFSIZUOjs.log.call(void 0, `Module taged ${String(tag)} has been overridden`);
|
|
91
|
+
else _chunkGHFSIZUOjs.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Model.name}"`, "warn");
|
|
92
92
|
}
|
|
93
93
|
return {
|
|
94
94
|
module,
|
|
@@ -111,7 +111,7 @@ async function Factory(models, opts = {}) {
|
|
|
111
111
|
}
|
|
112
112
|
meta.push(...getMetaFromInstance(module, tag, Model.name).map(parseMeta).filter((item) => !!item));
|
|
113
113
|
debug(`init module "${String(tag)}"`);
|
|
114
|
-
if (!
|
|
114
|
+
if (!_chunkGHFSIZUOjs.IS_ONLY_GENERATE) await _phecdacore.invokeHandler.call(void 0, "init", module);
|
|
115
115
|
debug(`add module "${String(tag)}"`);
|
|
116
116
|
moduleMap.set(tag, module);
|
|
117
117
|
modelMap.set(module, Model);
|
|
@@ -120,21 +120,21 @@ async function Factory(models, opts = {}) {
|
|
|
120
120
|
tag
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
_chunkGHFSIZUOjs.__name.call(void 0, buildDepModule, "buildDepModule");
|
|
124
124
|
for (const model of models) await buildDepModule(model);
|
|
125
125
|
async function generateCode() {
|
|
126
|
-
if (generators &&
|
|
126
|
+
if (generators && _chunkGHFSIZUOjs.IS_HMR) {
|
|
127
127
|
return Promise.all(generators.map((generator) => {
|
|
128
128
|
debug(`generate "${generator.name}" code to ${generator.path}`);
|
|
129
129
|
return generator.output(meta);
|
|
130
130
|
}));
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
_chunkGHFSIZUOjs.__name.call(void 0, generateCode, "generateCode");
|
|
134
134
|
generateCode().then(() => {
|
|
135
|
-
if (
|
|
135
|
+
if (_chunkGHFSIZUOjs.IS_ONLY_GENERATE) process.exit(4);
|
|
136
136
|
});
|
|
137
|
-
if (
|
|
137
|
+
if (_chunkGHFSIZUOjs.IS_HMR) {
|
|
138
138
|
if (!globalThis.__PS_HMR__) globalThis.__PS_HMR__ = [];
|
|
139
139
|
_optionalChain([globalThis, 'access', _2 => _2.__PS_HMR__, 'optionalAccess', _3 => _3.push, 'call', _4 => _4(async (files) => {
|
|
140
140
|
debug("reload files ");
|
|
@@ -156,7 +156,7 @@ async function Factory(models, opts = {}) {
|
|
|
156
156
|
destroy
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
_chunkGHFSIZUOjs.__name.call(void 0, Factory, "Factory");
|
|
160
160
|
function getMetaFromInstance(instance, tag, name) {
|
|
161
161
|
const vars = _phecdacore.getExposeKey.call(void 0, instance).filter((item) => typeof item === "string");
|
|
162
162
|
const baseState = _phecdacore.getState.call(void 0, instance);
|
|
@@ -171,7 +171,7 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
171
171
|
func: i
|
|
172
172
|
};
|
|
173
173
|
if (baseState.controller) {
|
|
174
|
-
if (typeof tag !== "string")
|
|
174
|
+
if (typeof tag !== "string") _chunkGHFSIZUOjs.log.call(void 0, `can't use Tag with ${typeof tag} on controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
|
|
175
175
|
initState(state);
|
|
176
176
|
meta.controller = baseState.controller;
|
|
177
177
|
meta[baseState.controller] = {
|
|
@@ -179,11 +179,14 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
179
179
|
...state[baseState.controller]
|
|
180
180
|
};
|
|
181
181
|
const params = [];
|
|
182
|
-
for (const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (
|
|
182
|
+
for (const item of state.params || []) {
|
|
183
|
+
const newItem = {
|
|
184
|
+
...item
|
|
185
|
+
};
|
|
186
|
+
if (!newItem.pipe) newItem.pipe = state.pipe || baseState.pipe;
|
|
187
|
+
if (!newItem.define) newItem.define = {};
|
|
188
|
+
params.unshift(newItem);
|
|
189
|
+
if (item.index === 0) break;
|
|
187
190
|
}
|
|
188
191
|
meta.ctxs = ctxs;
|
|
189
192
|
meta.params = params;
|
|
@@ -211,21 +214,29 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
211
214
|
])
|
|
212
215
|
];
|
|
213
216
|
}
|
|
214
|
-
return new Meta(meta, getParamTypes(instance, i) || []);
|
|
217
|
+
return new Meta(deepFreeze(meta), getParamTypes(instance, i) || []);
|
|
215
218
|
});
|
|
216
219
|
}
|
|
217
|
-
|
|
220
|
+
_chunkGHFSIZUOjs.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
|
|
221
|
+
function deepFreeze(object) {
|
|
222
|
+
Object.freeze(object);
|
|
223
|
+
Object.getOwnPropertyNames(object).forEach((prop) => {
|
|
224
|
+
if (object[prop] !== null && (typeof object[prop] === "object" || typeof object[prop] === "function") && !Object.isFrozen(object[prop])) deepFreeze(object[prop]);
|
|
225
|
+
});
|
|
226
|
+
return object;
|
|
227
|
+
}
|
|
228
|
+
_chunkGHFSIZUOjs.__name.call(void 0, deepFreeze, "deepFreeze");
|
|
218
229
|
function getParamTypes(Model, key) {
|
|
219
230
|
return Reflect.getMetadata("design:paramtypes", Model, key);
|
|
220
231
|
}
|
|
221
|
-
|
|
232
|
+
_chunkGHFSIZUOjs.__name.call(void 0, getParamTypes, "getParamTypes");
|
|
222
233
|
function initState(state) {
|
|
223
234
|
if (!state.define) state.define = {};
|
|
224
235
|
if (!state.plugins) state.plugins = /* @__PURE__ */ new Set();
|
|
225
236
|
if (!state.guards) state.guards = /* @__PURE__ */ new Set();
|
|
226
237
|
if (!state.interceptors) state.interceptors = /* @__PURE__ */ new Set();
|
|
227
238
|
}
|
|
228
|
-
|
|
239
|
+
_chunkGHFSIZUOjs.__name.call(void 0, initState, "initState");
|
|
229
240
|
var createPhecda = Factory;
|
|
230
241
|
|
|
231
242
|
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
IS_ONLY_GENERATE,
|
|
4
4
|
__name,
|
|
5
5
|
log
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UXD62LGG.mjs";
|
|
7
7
|
|
|
8
8
|
// src/meta.ts
|
|
9
9
|
var Meta = class {
|
|
@@ -179,11 +179,14 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
179
179
|
...state[baseState.controller]
|
|
180
180
|
};
|
|
181
181
|
const params = [];
|
|
182
|
-
for (const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (
|
|
182
|
+
for (const item of state.params || []) {
|
|
183
|
+
const newItem = {
|
|
184
|
+
...item
|
|
185
|
+
};
|
|
186
|
+
if (!newItem.pipe) newItem.pipe = state.pipe || baseState.pipe;
|
|
187
|
+
if (!newItem.define) newItem.define = {};
|
|
188
|
+
params.unshift(newItem);
|
|
189
|
+
if (item.index === 0) break;
|
|
187
190
|
}
|
|
188
191
|
meta.ctxs = ctxs;
|
|
189
192
|
meta.params = params;
|
|
@@ -211,10 +214,18 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
211
214
|
])
|
|
212
215
|
];
|
|
213
216
|
}
|
|
214
|
-
return new Meta(meta, getParamTypes(instance, i) || []);
|
|
217
|
+
return new Meta(deepFreeze(meta), getParamTypes(instance, i) || []);
|
|
215
218
|
});
|
|
216
219
|
}
|
|
217
220
|
__name(getMetaFromInstance, "getMetaFromInstance");
|
|
221
|
+
function deepFreeze(object) {
|
|
222
|
+
Object.freeze(object);
|
|
223
|
+
Object.getOwnPropertyNames(object).forEach((prop) => {
|
|
224
|
+
if (object[prop] !== null && (typeof object[prop] === "object" || typeof object[prop] === "function") && !Object.isFrozen(object[prop])) deepFreeze(object[prop]);
|
|
225
|
+
});
|
|
226
|
+
return object;
|
|
227
|
+
}
|
|
228
|
+
__name(deepFreeze, "deepFreeze");
|
|
218
229
|
function getParamTypes(Model, key) {
|
|
219
230
|
return Reflect.getMetadata("design:paramtypes", Model, key);
|
|
220
231
|
}
|
|
@@ -15,6 +15,7 @@ var PS_EXIT_CODE;
|
|
|
15
15
|
|
|
16
16
|
// src/utils.ts
|
|
17
17
|
var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
|
|
18
|
+
var _tsmixer = require('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](`${_picocolors2.default.magenta("[phecda-server]")} ${_picocolors2.default.gray(`${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`)} ${_picocolors2.default[color](msg)} ${_picocolors2.default.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
|
|
|
56
48
|
|
|
@@ -63,4 +55,4 @@ __name(Mix, "Mix");
|
|
|
63
55
|
|
|
64
56
|
|
|
65
57
|
|
|
66
|
-
exports.__name = __name; exports.ERROR_SYMBOL = ERROR_SYMBOL; exports.IS_HMR = IS_HMR; exports.IS_ONLY_GENERATE = IS_ONLY_GENERATE; exports.IS_STRICT = IS_STRICT; exports.LOG_LEVEL = LOG_LEVEL; exports.PS_EXIT_CODE = PS_EXIT_CODE; exports.setLogger = setLogger; exports.log = log; exports.
|
|
58
|
+
exports.__name = __name; exports.ERROR_SYMBOL = ERROR_SYMBOL; exports.IS_HMR = IS_HMR; exports.IS_ONLY_GENERATE = IS_ONLY_GENERATE; exports.IS_STRICT = IS_STRICT; exports.LOG_LEVEL = LOG_LEVEL; exports.PS_EXIT_CODE = PS_EXIT_CODE; exports.setLogger = setLogger; exports.log = log; exports.Mixin = _tsmixer.Mixin;
|