phecda-server 7.0.0-alpha.8 → 7.0.0-alpha.9
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-VSGYTGHY.js → chunk-5RBTN33A.js} +22 -2
- package/dist/{chunk-B45BN7LY.mjs → chunk-7ZGYJ5OW.mjs} +88 -54
- package/dist/{chunk-SGMQZRP6.mjs → chunk-CVPZWDXU.mjs} +2 -23
- package/dist/{chunk-7EMAZGYO.js → chunk-FX3LDQII.js} +59 -80
- package/dist/{chunk-YKP4ODZA.mjs → chunk-FXTJ3BJ6.mjs} +23 -3
- package/dist/{chunk-QJIAXSLZ.js → chunk-KJUD2BKE.js} +103 -69
- package/dist/{chunk-7NWDKK7D.mjs → chunk-ODVWOXVB.mjs} +1 -1
- package/dist/{chunk-BBNJVYVX.js → chunk-V5EYXVJT.js} +24 -24
- package/dist/{core-BcKywWLd.d.mts → core-BDkhrEyf.d.mts} +4 -3
- package/dist/{core-BGEsBtTG.d.ts → core-D_cz0tKa.d.ts} +4 -3
- package/dist/helper.d.mts +6 -5
- package/dist/helper.d.ts +6 -5
- package/dist/helper.js +6 -3
- package/dist/helper.mjs +8 -5
- package/dist/http/elysia/index.d.mts +3 -3
- package/dist/http/elysia/index.d.ts +3 -3
- package/dist/http/elysia/index.js +41 -45
- package/dist/http/elysia/index.mjs +4 -8
- package/dist/http/express/index.d.mts +3 -3
- package/dist/http/express/index.d.ts +3 -3
- package/dist/http/express/index.js +38 -42
- package/dist/http/express/index.mjs +4 -8
- package/dist/http/fastify/index.d.mts +3 -3
- package/dist/http/fastify/index.d.ts +3 -3
- package/dist/http/fastify/index.js +39 -43
- package/dist/http/fastify/index.mjs +4 -8
- package/dist/http/h3/index.d.mts +3 -3
- package/dist/http/h3/index.d.ts +3 -3
- package/dist/http/h3/index.js +39 -43
- package/dist/http/h3/index.mjs +3 -7
- package/dist/http/hono/index.d.mts +3 -3
- package/dist/http/hono/index.d.ts +3 -3
- package/dist/http/hono/index.js +35 -39
- package/dist/http/hono/index.mjs +3 -7
- package/dist/http/hyper-express/index.d.mts +3 -3
- package/dist/http/hyper-express/index.d.ts +3 -3
- package/dist/http/hyper-express/index.js +36 -40
- package/dist/http/hyper-express/index.mjs +3 -7
- package/dist/http/koa/index.d.mts +3 -3
- package/dist/http/koa/index.d.ts +3 -3
- package/dist/http/koa/index.js +38 -42
- package/dist/http/koa/index.mjs +4 -8
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +40 -42
- package/dist/index.mjs +4 -6
- package/dist/{meta-B_HW7cWh.d.mts → meta-BX5jhe4Z.d.mts} +1 -2
- package/dist/{meta-B_HW7cWh.d.ts → meta-BX5jhe4Z.d.ts} +1 -2
- package/dist/rpc/bullmq/index.d.mts +3 -3
- package/dist/rpc/bullmq/index.d.ts +3 -3
- package/dist/rpc/bullmq/index.js +14 -14
- package/dist/rpc/bullmq/index.mjs +3 -3
- package/dist/rpc/kafka/index.d.mts +3 -3
- package/dist/rpc/kafka/index.d.ts +3 -3
- package/dist/rpc/kafka/index.js +14 -14
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/nats/index.d.mts +3 -3
- package/dist/rpc/nats/index.d.ts +3 -3
- package/dist/rpc/nats/index.js +13 -13
- package/dist/rpc/nats/index.mjs +3 -3
- package/dist/rpc/rabbitmq/index.d.mts +3 -3
- package/dist/rpc/rabbitmq/index.d.ts +3 -3
- package/dist/rpc/rabbitmq/index.js +15 -15
- package/dist/rpc/rabbitmq/index.mjs +3 -3
- package/dist/rpc/redis/index.d.mts +3 -3
- package/dist/rpc/redis/index.d.ts +3 -3
- package/dist/rpc/redis/index.js +13 -13
- package/dist/rpc/redis/index.mjs +3 -3
- package/dist/test.d.mts +3 -3
- package/dist/test.d.ts +3 -3
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/dist/{types-DEQb_e59.d.mts → types-B-rUM9Fm.d.mts} +1 -1
- package/dist/{types-PFPIQWVF.d.ts → types-CMeuFoyd.d.ts} +1 -1
- package/dist/{types-C2SQ9U9V.d.mts → types-DKVhyZk_.d.mts} +1 -1
- package/dist/{types-CYF0vha6.d.ts → types-MxxtkZXw.d.ts} +1 -1
- package/package.json +1 -1
- package/register/index.mjs +20 -11
- package/register/loader.mjs +12 -27
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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; } var _class;
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk5RBTN33Ajs = require('./chunk-5RBTN33A.js');
|
|
7
7
|
|
|
8
8
|
// src/meta.ts
|
|
9
9
|
var Meta = class {
|
|
10
10
|
static {
|
|
11
|
-
|
|
11
|
+
_chunk5RBTN33Ajs.__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
|
+
_chunk5RBTN33Ajs.__name.call(void 0, defaultServerInject, "defaultServerInject");
|
|
41
41
|
var phecdaNamespace = /* @__PURE__ */ new Map();
|
|
42
42
|
var ServerPhecda = (_class = class {
|
|
43
43
|
static {
|
|
44
|
-
|
|
44
|
+
_chunk5RBTN33Ajs.__name.call(void 0, this, "ServerPhecda");
|
|
45
45
|
}
|
|
46
46
|
__init() {this.moduleMap = /* @__PURE__ */ new Map()}
|
|
47
47
|
__init2() {this.meta = []}
|
|
@@ -51,9 +51,9 @@ var ServerPhecda = (_class = class {
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
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);
|
|
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);_class.prototype.__init6.call(this);
|
|
55
55
|
defaultServerInject();
|
|
56
|
-
const { namespace = "default", parseModule = /* @__PURE__ */
|
|
56
|
+
const { namespace = "default", parseModule = /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (module) => module, "parseModule"), parseMeta = /* @__PURE__ */ _chunk5RBTN33Ajs.__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,63 +61,58 @@ var ServerPhecda = (_class = class {
|
|
|
61
61
|
}
|
|
62
62
|
async start(models) {
|
|
63
63
|
for (const model of models) await this.buildDepModule(model);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
debug(`generate "${generator.name}" code to ${generator.path}`);
|
|
68
|
-
return generator.output(this.meta);
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
}, "generateCode");
|
|
72
|
-
generateCode().then(() => {
|
|
73
|
-
if (_chunkVSGYTGHYjs.IS_ONLY_GENERATE) process.exit(4);
|
|
64
|
+
this.hmr();
|
|
65
|
+
this.generateCode().then(() => {
|
|
66
|
+
if (_chunk5RBTN33Ajs.IS_ONLY_GENERATE) process.exit(4);
|
|
74
67
|
});
|
|
75
|
-
if (_chunkVSGYTGHYjs.IS_DEV) {
|
|
76
|
-
if (!globalThis.__PS_HMR__) globalThis.__PS_HMR__ = [];
|
|
77
|
-
_optionalChain([globalThis, 'access', _2 => _2.__PS_HMR__, 'optionalAccess', _3 => _3.push, 'call', _4 => _4(async (files) => {
|
|
78
|
-
debug("reload files ");
|
|
79
|
-
for (const file of files) {
|
|
80
|
-
const models2 = await Promise.resolve().then(() => _interopRequireWildcard(require(file)));
|
|
81
|
-
for (const i in models2) {
|
|
82
|
-
if (_phecdacore.isPhecda.call(void 0, models2[i])) await this.add(models2[i]);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
generateCode();
|
|
86
|
-
})]);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
async add(Model) {
|
|
90
|
-
const tag = _phecdacore.getTag.call(void 0, Model);
|
|
91
|
-
const oldInstance = await this.del(tag);
|
|
92
|
-
const { module: newModule } = await this.buildDepModule(Model);
|
|
93
|
-
if (oldInstance && this.dependenceGraph.has(tag)) {
|
|
94
|
-
debug(`replace module "${String(tag)}"`);
|
|
95
|
-
[
|
|
96
|
-
...this.dependenceGraph.get(tag)
|
|
97
|
-
].forEach((tag2) => {
|
|
98
|
-
const module = this.moduleMap.get(tag2);
|
|
99
|
-
for (const key in module) {
|
|
100
|
-
if (module[key] === oldInstance) module[key] = newModule;
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
68
|
}
|
|
105
|
-
async
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
69
|
+
__init6() {this.generateCode = /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, async () => {
|
|
70
|
+
return Promise.all(this.generators.map((generator) => {
|
|
71
|
+
debug(`generate "${generator.name}" code to ${generator.path}`);
|
|
72
|
+
return generator.output(this.meta);
|
|
73
|
+
}));
|
|
74
|
+
}, "generateCode")}
|
|
75
|
+
hmr() {
|
|
76
|
+
_chunk5RBTN33Ajs.HMR.call(void 0, async (oldModels, newModels) => {
|
|
77
|
+
debug("reload models ");
|
|
78
|
+
await this.replace(oldModels, newModels);
|
|
79
|
+
this.generateCode();
|
|
80
|
+
});
|
|
117
81
|
}
|
|
82
|
+
// async add(Model: Construct) {
|
|
83
|
+
// const tag = getTag(Model)
|
|
84
|
+
// const oldInstance = await this.del(tag)
|
|
85
|
+
// const { module: newModule } = await this.buildDepModule(Model)
|
|
86
|
+
// if (oldInstance && this.dependenceGraph.has(tag)) {
|
|
87
|
+
// debug(`replace module "${String(tag)}"`);
|
|
88
|
+
// [...this.dependenceGraph.get(tag)!].forEach((tag) => {
|
|
89
|
+
// const module = this.moduleMap.get(tag)
|
|
90
|
+
// for (const key in module) {
|
|
91
|
+
// if (module[key] === oldInstance)
|
|
92
|
+
// module[key] = newModule
|
|
93
|
+
// }
|
|
94
|
+
// })
|
|
95
|
+
// }
|
|
96
|
+
// }
|
|
97
|
+
// async del(modelOrTag: Construct | PropertyKey) {
|
|
98
|
+
// const tag = typeof modelOrTag === 'function' ? getTag(modelOrTag) : modelOrTag
|
|
99
|
+
// if (!this.moduleMap.has(tag))
|
|
100
|
+
// return
|
|
101
|
+
// const module = this.moduleMap.get(tag)
|
|
102
|
+
// debug(`unmount module "${String(tag)}"`)
|
|
103
|
+
// await invokeUnmount(module)
|
|
104
|
+
// debug(`del module "${String(tag)}"`)
|
|
105
|
+
// this.moduleMap.delete(tag)
|
|
106
|
+
// this.modelMap.delete(module)
|
|
107
|
+
// for (let i = this.meta.length - 1; i >= 0; i--) {
|
|
108
|
+
// if (this.meta[i].data.tag === tag)
|
|
109
|
+
// this.meta.splice(i, 1)
|
|
110
|
+
// }
|
|
111
|
+
// return module
|
|
112
|
+
// }
|
|
118
113
|
async destroy() {
|
|
119
114
|
debug("destroy all");
|
|
120
|
-
|
|
115
|
+
this.replace(Object.values(this.modelMap), []);
|
|
121
116
|
}
|
|
122
117
|
createProxyModule(tag) {
|
|
123
118
|
const that = this;
|
|
@@ -133,6 +128,9 @@ var ServerPhecda = (_class = class {
|
|
|
133
128
|
has(_target, prop) {
|
|
134
129
|
return Reflect.has(that.moduleMap.get(tag), prop);
|
|
135
130
|
},
|
|
131
|
+
ownKeys() {
|
|
132
|
+
return Reflect.ownKeys(that.moduleMap.get(tag));
|
|
133
|
+
},
|
|
136
134
|
getPrototypeOf() {
|
|
137
135
|
return Reflect.getPrototypeOf(that.moduleMap.get(tag));
|
|
138
136
|
},
|
|
@@ -148,7 +146,7 @@ var ServerPhecda = (_class = class {
|
|
|
148
146
|
if (this.moduleMap.has(tag)) {
|
|
149
147
|
module = this.moduleMap.get(tag);
|
|
150
148
|
if (!module) {
|
|
151
|
-
|
|
149
|
+
_chunk5RBTN33Ajs.log.call(void 0, `Exist Circular-Dependency or Multiple modules with the same tag [${String(tag)}]`, "warn");
|
|
152
150
|
return {
|
|
153
151
|
module: this.createProxyModule(tag),
|
|
154
152
|
tag
|
|
@@ -156,8 +154,8 @@ var ServerPhecda = (_class = class {
|
|
|
156
154
|
}
|
|
157
155
|
if (this.modelMap.get(module) !== Model && !this.modelSet.has(Model)) {
|
|
158
156
|
this.modelSet.add(Model);
|
|
159
|
-
if (module instanceof Model)
|
|
160
|
-
else
|
|
157
|
+
if (module instanceof Model) _chunk5RBTN33Ajs.log.call(void 0, `Module taged ${String(tag)} has been overridden`);
|
|
158
|
+
else _chunk5RBTN33Ajs.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Model.name}"`, "warn");
|
|
161
159
|
}
|
|
162
160
|
return {
|
|
163
161
|
module,
|
|
@@ -180,7 +178,7 @@ var ServerPhecda = (_class = class {
|
|
|
180
178
|
}
|
|
181
179
|
this.meta.push(...getMetaFromInstance(module, tag, Model.name).map(this.parseMeta).filter((item) => !!item));
|
|
182
180
|
debug(`init module "${String(tag)}"`);
|
|
183
|
-
if (!
|
|
181
|
+
if (!_chunk5RBTN33Ajs.IS_ONLY_GENERATE) await _phecdacore.invokeInit.call(void 0, module);
|
|
184
182
|
debug(`add module "${String(tag)}"`);
|
|
185
183
|
this.moduleMap.set(tag, module);
|
|
186
184
|
this.modelMap.set(module, Model);
|
|
@@ -189,6 +187,42 @@ var ServerPhecda = (_class = class {
|
|
|
189
187
|
tag
|
|
190
188
|
};
|
|
191
189
|
}
|
|
190
|
+
async replace(oldModels, newModels) {
|
|
191
|
+
const oldModules = (await Promise.all(oldModels.map(async (model) => {
|
|
192
|
+
const tag = _phecdacore.getTag.call(void 0, model);
|
|
193
|
+
if (!this.has(tag)) return;
|
|
194
|
+
const module = this.moduleMap.get(tag);
|
|
195
|
+
debug(`unmount module "${String(tag)}"`);
|
|
196
|
+
await _phecdacore.invokeUnmount.call(void 0, module);
|
|
197
|
+
debug(`del module "${String(tag)}"`);
|
|
198
|
+
this.moduleMap.delete(tag);
|
|
199
|
+
this.modelMap.delete(module);
|
|
200
|
+
for (let i = this.meta.length - 1; i >= 0; i--) {
|
|
201
|
+
if (this.meta[i].data.tag === tag) this.meta.splice(i, 1);
|
|
202
|
+
}
|
|
203
|
+
return module;
|
|
204
|
+
}))).filter((item) => item);
|
|
205
|
+
for (const model of newModels) {
|
|
206
|
+
debug(`mount module: ${model.name}`);
|
|
207
|
+
await this.buildDepModule(model);
|
|
208
|
+
}
|
|
209
|
+
debug("replace old modules");
|
|
210
|
+
for (const module of oldModules) {
|
|
211
|
+
const tag = _phecdacore.getTag.call(void 0, module);
|
|
212
|
+
if (this.dependenceGraph.has(tag)) {
|
|
213
|
+
[
|
|
214
|
+
...this.dependenceGraph.get(tag)
|
|
215
|
+
].forEach((depTag) => {
|
|
216
|
+
const depModule = this.moduleMap.get(depTag);
|
|
217
|
+
if (depModule) {
|
|
218
|
+
for (const key in depModule) {
|
|
219
|
+
if (depModule[key] === module) depModule[key] = this.moduleMap.get(tag);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
192
226
|
has(modelOrTag) {
|
|
193
227
|
return this.moduleMap.has(typeof modelOrTag === "function" ? _phecdacore.getTag.call(void 0, modelOrTag) : modelOrTag);
|
|
194
228
|
}
|
|
@@ -203,7 +237,7 @@ async function Factory(models, opts = {}) {
|
|
|
203
237
|
await phecda.start(models);
|
|
204
238
|
return phecda;
|
|
205
239
|
}
|
|
206
|
-
|
|
240
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Factory, "Factory");
|
|
207
241
|
function useS(nsOrModel, namespace) {
|
|
208
242
|
if (!nsOrModel) {
|
|
209
243
|
namespace = "default";
|
|
@@ -216,7 +250,7 @@ function useS(nsOrModel, namespace) {
|
|
|
216
250
|
if (nsOrModel && typeof nsOrModel !== "string") return serverPhecda.get(nsOrModel);
|
|
217
251
|
else return serverPhecda;
|
|
218
252
|
}
|
|
219
|
-
|
|
253
|
+
_chunk5RBTN33Ajs.__name.call(void 0, useS, "useS");
|
|
220
254
|
function getMetaFromInstance(instance, tag, name) {
|
|
221
255
|
const propertyKeys = _phecdacore.getMetaKey.call(void 0, instance).filter((item) => typeof item === "string");
|
|
222
256
|
const baseMeta = _phecdacore.getMergedMeta.call(void 0, instance, void 0);
|
|
@@ -230,7 +264,7 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
230
264
|
func: i
|
|
231
265
|
};
|
|
232
266
|
if (baseMeta.controller) {
|
|
233
|
-
if (typeof tag !== "string")
|
|
267
|
+
if (typeof tag !== "string") _chunk5RBTN33Ajs.log.call(void 0, `can't use Tag with ${typeof tag} on controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
|
|
234
268
|
metaData.controller = baseMeta.controller;
|
|
235
269
|
metaData[baseMeta.controller] = {
|
|
236
270
|
...baseMeta[baseMeta.controller],
|
|
@@ -268,7 +302,7 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
268
302
|
return new Meta(deepFreeze(metaData), getParamTypes(instance, i) || []);
|
|
269
303
|
});
|
|
270
304
|
}
|
|
271
|
-
|
|
305
|
+
_chunk5RBTN33Ajs.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
|
|
272
306
|
function deepFreeze(object) {
|
|
273
307
|
Object.freeze(object);
|
|
274
308
|
Object.getOwnPropertyNames(object).forEach((prop) => {
|
|
@@ -276,13 +310,13 @@ function deepFreeze(object) {
|
|
|
276
310
|
});
|
|
277
311
|
return object;
|
|
278
312
|
}
|
|
279
|
-
|
|
313
|
+
_chunk5RBTN33Ajs.__name.call(void 0, deepFreeze, "deepFreeze");
|
|
280
314
|
function getParamTypes(Model, key) {
|
|
281
315
|
const paramTypes = Reflect.getMetadata("design:paramtypes", Model, key);
|
|
282
316
|
if (typeof paramTypes === "function") return paramTypes();
|
|
283
317
|
else return paramTypes;
|
|
284
318
|
}
|
|
285
|
-
|
|
319
|
+
_chunk5RBTN33Ajs.__name.call(void 0, getParamTypes, "getParamTypes");
|
|
286
320
|
|
|
287
321
|
|
|
288
322
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5RBTN33Ajs = require('./chunk-5RBTN33A.js');
|
|
4
4
|
|
|
5
5
|
// src/decorators/param.ts
|
|
6
6
|
var _phecdacore = require('phecda-core');
|
|
@@ -10,42 +10,42 @@ function BaseParam(data) {
|
|
|
10
10
|
_phecdacore.setMeta.call(void 0, target, property, index, data);
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
_chunk5RBTN33Ajs.__name.call(void 0, BaseParam, "BaseParam");
|
|
14
14
|
function Body(key = "") {
|
|
15
15
|
return BaseParam({
|
|
16
16
|
type: "body",
|
|
17
17
|
key
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Body, "Body");
|
|
21
21
|
function Head(key) {
|
|
22
22
|
return BaseParam({
|
|
23
23
|
type: "headers",
|
|
24
24
|
key: key.toLowerCase()
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Head, "Head");
|
|
28
28
|
function Query(key = "") {
|
|
29
29
|
return BaseParam({
|
|
30
30
|
type: "query",
|
|
31
31
|
key
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Query, "Query");
|
|
35
35
|
function Param(key) {
|
|
36
36
|
return BaseParam({
|
|
37
37
|
type: "params",
|
|
38
38
|
key
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Param, "Param");
|
|
42
42
|
function Arg(target, k, index) {
|
|
43
43
|
BaseParam({
|
|
44
44
|
type: "args",
|
|
45
45
|
key: `${index}`
|
|
46
46
|
})(target, k, index);
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Arg, "Arg");
|
|
49
49
|
|
|
50
50
|
// src/decorators/aop.ts
|
|
51
51
|
|
|
@@ -56,7 +56,7 @@ function Guard(...guards) {
|
|
|
56
56
|
});
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Guard, "Guard");
|
|
60
60
|
function Addon(...addons) {
|
|
61
61
|
return (target, property) => {
|
|
62
62
|
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
@@ -64,7 +64,7 @@ function Addon(...addons) {
|
|
|
64
64
|
});
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Addon, "Addon");
|
|
68
68
|
function Filter(filter) {
|
|
69
69
|
return (target, property) => {
|
|
70
70
|
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
@@ -72,7 +72,7 @@ function Filter(filter) {
|
|
|
72
72
|
});
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Filter, "Filter");
|
|
76
76
|
function Pipe(pipe) {
|
|
77
77
|
return (target, property, index) => {
|
|
78
78
|
if (typeof index === "number") {
|
|
@@ -86,7 +86,7 @@ function Pipe(pipe) {
|
|
|
86
86
|
});
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Pipe, "Pipe");
|
|
90
90
|
|
|
91
91
|
// src/decorators/http.ts
|
|
92
92
|
|
|
@@ -100,7 +100,7 @@ function Route(route, type) {
|
|
|
100
100
|
});
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Route, "Route");
|
|
104
104
|
function Header(headers) {
|
|
105
105
|
return (target, property) => {
|
|
106
106
|
_phecdacore.setMeta.call(void 0, target, property, void 0, {
|
|
@@ -110,31 +110,31 @@ function Header(headers) {
|
|
|
110
110
|
});
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Header, "Header");
|
|
114
114
|
function Get(route = "") {
|
|
115
115
|
return Route(route, "get");
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Get, "Get");
|
|
118
118
|
function Post(route = "") {
|
|
119
119
|
return Route(route, "post");
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Post, "Post");
|
|
122
122
|
function Put(route = "") {
|
|
123
123
|
return Route(route, "put");
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Put, "Put");
|
|
126
126
|
function Search(route = "") {
|
|
127
127
|
return Route(route, "search");
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Search, "Search");
|
|
130
130
|
function Patch(route = "") {
|
|
131
131
|
return Route(route, "patch");
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Patch, "Patch");
|
|
134
134
|
function Delete(route = "") {
|
|
135
135
|
return Route(route, "delete");
|
|
136
136
|
}
|
|
137
|
-
|
|
137
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Delete, "Delete");
|
|
138
138
|
function Controller(prefix = "") {
|
|
139
139
|
return (target) => {
|
|
140
140
|
_phecdacore.setMeta.call(void 0, target, void 0, void 0, {
|
|
@@ -145,7 +145,7 @@ function Controller(prefix = "") {
|
|
|
145
145
|
});
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
|
|
148
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Controller, "Controller");
|
|
149
149
|
|
|
150
150
|
// src/decorators/rpc.ts
|
|
151
151
|
|
|
@@ -159,7 +159,7 @@ function Queue(queue = "", isEvent) {
|
|
|
159
159
|
});
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Queue, "Queue");
|
|
163
163
|
function Rpc() {
|
|
164
164
|
return (target) => {
|
|
165
165
|
_phecdacore.setMeta.call(void 0, target, void 0, void 0, {
|
|
@@ -167,11 +167,11 @@ function Rpc() {
|
|
|
167
167
|
});
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Rpc, "Rpc");
|
|
171
171
|
|
|
172
172
|
// src/decorators/ctx.ts
|
|
173
173
|
|
|
174
|
-
var Ctx = /* @__PURE__ */
|
|
174
|
+
var Ctx = /* @__PURE__ */ _chunk5RBTN33Ajs.__name.call(void 0, (target, property) => {
|
|
175
175
|
_phecdacore.setMeta.call(void 0, target, _phecdacore.SHARE_KEY, void 0, {
|
|
176
176
|
ctxs: [
|
|
177
177
|
property
|
|
@@ -200,7 +200,7 @@ function Define(key, value) {
|
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
|
-
|
|
203
|
+
_chunk5RBTN33Ajs.__name.call(void 0, Define, "Define");
|
|
204
204
|
|
|
205
205
|
|
|
206
206
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Construct } from 'phecda-core';
|
|
2
|
-
import { b as MetaData, M as Meta, E as Emitter } from './meta-
|
|
2
|
+
import { b as MetaData, M as Meta, E as Emitter } from './meta-BX5jhe4Z.mjs';
|
|
3
3
|
|
|
4
4
|
declare abstract class Generator {
|
|
5
5
|
private _path;
|
|
@@ -30,14 +30,15 @@ declare class ServerPhecda {
|
|
|
30
30
|
generators: Generator[];
|
|
31
31
|
constructor(options: Options);
|
|
32
32
|
start(models: Construct[]): Promise<void>;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
generateCode: () => Promise<void[]>;
|
|
34
|
+
hmr(): void;
|
|
35
35
|
destroy(): Promise<void>;
|
|
36
36
|
createProxyModule(tag: PropertyKey): {};
|
|
37
37
|
protected buildDepModule(Model: Construct): Promise<{
|
|
38
38
|
module: any;
|
|
39
39
|
tag: PropertyKey;
|
|
40
40
|
}>;
|
|
41
|
+
replace(oldModels: Construct[], newModels: Construct[]): Promise<void>;
|
|
41
42
|
has(modelOrTag: Construct | PropertyKey): boolean;
|
|
42
43
|
get<Model extends Construct>(modelOrTag: Model | PropertyKey): InstanceType<Model>;
|
|
43
44
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Construct } from 'phecda-core';
|
|
2
|
-
import { b as MetaData, M as Meta, E as Emitter } from './meta-
|
|
2
|
+
import { b as MetaData, M as Meta, E as Emitter } from './meta-BX5jhe4Z.js';
|
|
3
3
|
|
|
4
4
|
declare abstract class Generator {
|
|
5
5
|
private _path;
|
|
@@ -30,14 +30,15 @@ declare class ServerPhecda {
|
|
|
30
30
|
generators: Generator[];
|
|
31
31
|
constructor(options: Options);
|
|
32
32
|
start(models: Construct[]): Promise<void>;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
generateCode: () => Promise<void[]>;
|
|
34
|
+
hmr(): void;
|
|
35
35
|
destroy(): Promise<void>;
|
|
36
36
|
createProxyModule(tag: PropertyKey): {};
|
|
37
37
|
protected buildDepModule(Model: Construct): Promise<{
|
|
38
38
|
module: any;
|
|
39
39
|
tag: PropertyKey;
|
|
40
40
|
}>;
|
|
41
|
+
replace(oldModels: Construct[], newModels: Construct[]): Promise<void>;
|
|
41
42
|
has(modelOrTag: Construct | PropertyKey): boolean;
|
|
42
43
|
get<Model extends Construct>(modelOrTag: Model | PropertyKey): InstanceType<Model>;
|
|
43
44
|
}
|
package/dist/helper.d.mts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import 'phecda-core';
|
|
1
|
+
import { M as Meta, C as ControllerMeta } from './meta-BX5jhe4Z.mjs';
|
|
2
|
+
import { Construct } from 'phecda-core';
|
|
3
3
|
|
|
4
|
-
declare function HMR(cb: (
|
|
4
|
+
declare function HMR(cb: (oldModels: Construct[], newModels: Construct[]) => any): void;
|
|
5
|
+
declare function RELOAD(oldModels: Construct[], newModels: Construct[]): Promise<void>;
|
|
6
|
+
declare function RELAUNCH(): void;
|
|
5
7
|
|
|
6
8
|
declare function resolveDep(ret: any, key: string): any;
|
|
7
|
-
declare function argToReq(params: ControllerMetaData['params'], args: any[], headers: Record<string, any>): any;
|
|
8
9
|
|
|
9
10
|
declare function genClientQueue(key?: string): string;
|
|
10
11
|
|
|
@@ -23,4 +24,4 @@ declare function detectAopDep(meta: Meta[], { guards, addons }?: {
|
|
|
23
24
|
};
|
|
24
25
|
declare function joinUrl(base: string, ...paths: string[]): string;
|
|
25
26
|
|
|
26
|
-
export { HMR,
|
|
27
|
+
export { HMR, RELAUNCH, RELOAD, createControllerMetaMap, detectAopDep, genClientQueue, joinUrl, mergeObject, resolveDep, shallowClone };
|
package/dist/helper.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import 'phecda-core';
|
|
1
|
+
import { M as Meta, C as ControllerMeta } from './meta-BX5jhe4Z.js';
|
|
2
|
+
import { Construct } from 'phecda-core';
|
|
3
3
|
|
|
4
|
-
declare function HMR(cb: (
|
|
4
|
+
declare function HMR(cb: (oldModels: Construct[], newModels: Construct[]) => any): void;
|
|
5
|
+
declare function RELOAD(oldModels: Construct[], newModels: Construct[]): Promise<void>;
|
|
6
|
+
declare function RELAUNCH(): void;
|
|
5
7
|
|
|
6
8
|
declare function resolveDep(ret: any, key: string): any;
|
|
7
|
-
declare function argToReq(params: ControllerMetaData['params'], args: any[], headers: Record<string, any>): any;
|
|
8
9
|
|
|
9
10
|
declare function genClientQueue(key?: string): string;
|
|
10
11
|
|
|
@@ -23,4 +24,4 @@ declare function detectAopDep(meta: Meta[], { guards, addons }?: {
|
|
|
23
24
|
};
|
|
24
25
|
declare function joinUrl(base: string, ...paths: string[]): string;
|
|
25
26
|
|
|
26
|
-
export { HMR,
|
|
27
|
+
export { HMR, RELAUNCH, RELOAD, createControllerMetaMap, detectAopDep, genClientQueue, joinUrl, mergeObject, resolveDep, shallowClone };
|
package/dist/helper.js
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
var _chunkFX3LDQIIjs = require('./chunk-FX3LDQII.js');
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
var _chunk7EMAZGYOjs = require('./chunk-7EMAZGYO.js');
|
|
12
|
-
require('./chunk-VSGYTGHY.js');
|
|
13
12
|
|
|
14
13
|
|
|
14
|
+
var _chunk5RBTN33Ajs = require('./chunk-5RBTN33A.js');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -20,4 +20,7 @@ require('./chunk-VSGYTGHY.js');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
exports.HMR = _chunk5RBTN33Ajs.HMR; exports.RELAUNCH = _chunk5RBTN33Ajs.RELAUNCH; exports.RELOAD = _chunk5RBTN33Ajs.RELOAD; exports.createControllerMetaMap = _chunkFX3LDQIIjs.createControllerMetaMap; exports.detectAopDep = _chunkFX3LDQIIjs.detectAopDep; exports.genClientQueue = _chunkFX3LDQIIjs.genClientQueue; exports.joinUrl = _chunkFX3LDQIIjs.joinUrl; exports.mergeObject = _chunkFX3LDQIIjs.mergeObject; exports.resolveDep = _chunkFX3LDQIIjs.resolveDep; exports.shallowClone = _chunkFX3LDQIIjs.shallowClone;
|
package/dist/helper.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
HMR,
|
|
3
|
-
argToReq,
|
|
4
2
|
createControllerMetaMap,
|
|
5
3
|
detectAopDep,
|
|
6
4
|
genClientQueue,
|
|
@@ -8,11 +6,16 @@ import {
|
|
|
8
6
|
mergeObject,
|
|
9
7
|
resolveDep,
|
|
10
8
|
shallowClone
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import
|
|
9
|
+
} from "./chunk-CVPZWDXU.mjs";
|
|
10
|
+
import {
|
|
11
|
+
HMR,
|
|
12
|
+
RELAUNCH,
|
|
13
|
+
RELOAD
|
|
14
|
+
} from "./chunk-FXTJ3BJ6.mjs";
|
|
13
15
|
export {
|
|
14
16
|
HMR,
|
|
15
|
-
|
|
17
|
+
RELAUNCH,
|
|
18
|
+
RELOAD,
|
|
16
19
|
createControllerMetaMap,
|
|
17
20
|
detectAopDep,
|
|
18
21
|
genClientQueue,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Elysia as Elysia$1, Context, LocalHook, InputSchema, RouteSchema, SingletonBase } from 'elysia';
|
|
2
2
|
import { BaseMacro } from 'elysia/dist/types';
|
|
3
|
-
import { H as HttpCtx, a as HttpOptions } from '../../types-
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-DKVhyZk_.mjs';
|
|
4
|
+
import { F as Factory } from '../../core-BDkhrEyf.mjs';
|
|
5
5
|
import 'node:http';
|
|
6
|
-
import '../../meta-
|
|
6
|
+
import '../../meta-BX5jhe4Z.mjs';
|
|
7
7
|
import 'phecda-core';
|
|
8
8
|
|
|
9
9
|
interface ElysiaCtx extends HttpCtx {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Elysia as Elysia$1, Context, LocalHook, InputSchema, RouteSchema, SingletonBase } from 'elysia';
|
|
2
2
|
import { BaseMacro } from 'elysia/dist/types';
|
|
3
|
-
import { H as HttpCtx, a as HttpOptions } from '../../types-
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-CMeuFoyd.js';
|
|
4
|
+
import { F as Factory } from '../../core-D_cz0tKa.js';
|
|
5
5
|
import 'node:http';
|
|
6
|
-
import '../../meta-
|
|
6
|
+
import '../../meta-BX5jhe4Z.js';
|
|
7
7
|
import 'phecda-core';
|
|
8
8
|
|
|
9
9
|
interface ElysiaCtx extends HttpCtx {
|