phecda-server 7.0.0-alpha.0 → 7.0.0-alpha.10
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 +24 -24
- package/assets/schema.json +55 -55
- package/bin/cli.mjs +31 -18
- package/dist/chunk-4LLLQOMF.js +152 -0
- package/dist/{chunk-BGXSMOLX.js → chunk-6OQ2SB5W.js} +138 -70
- package/dist/{chunk-SW5IKE5H.js → chunk-G7JFKM2M.js} +136 -89
- package/dist/{chunk-MBCHNDAY.js → chunk-KCPBITYZ.js} +24 -24
- package/dist/{chunk-HMVLXNV3.mjs → chunk-MUI6MTUO.mjs} +1 -1
- package/dist/chunk-NQ55PA2X.mjs +152 -0
- package/dist/{chunk-5622RBNB.mjs → chunk-YCES6ABN.mjs} +125 -57
- package/dist/{chunk-P75VKZJY.mjs → chunk-Z7NAAE4M.mjs} +94 -47
- package/dist/{core-BIcUwV18.d.mts → core-CUTbX_IS.d.ts} +5 -3
- package/dist/{core-CYwEPfN4.d.ts → core-DIfgUKIU.d.mts} +5 -3
- package/dist/helper.d.mts +8 -6
- package/dist/helper.d.ts +8 -6
- package/dist/helper.js +8 -3
- package/dist/helper.mjs +10 -5
- package/dist/http/elysia/index.d.mts +4 -4
- package/dist/http/elysia/index.d.ts +4 -4
- package/dist/http/elysia/index.js +43 -44
- package/dist/http/elysia/index.mjs +9 -10
- package/dist/http/express/index.d.mts +4 -4
- package/dist/http/express/index.d.ts +4 -4
- package/dist/http/express/index.js +40 -41
- package/dist/http/express/index.mjs +9 -10
- package/dist/http/fastify/index.d.mts +4 -4
- package/dist/http/fastify/index.d.ts +4 -4
- package/dist/http/fastify/index.js +41 -42
- package/dist/http/fastify/index.mjs +9 -10
- package/dist/http/h3/index.d.mts +4 -4
- package/dist/http/h3/index.d.ts +4 -4
- package/dist/http/h3/index.js +41 -42
- package/dist/http/h3/index.mjs +9 -10
- package/dist/http/hono/index.d.mts +4 -4
- package/dist/http/hono/index.d.ts +4 -4
- package/dist/http/hono/index.js +37 -39
- package/dist/http/hono/index.mjs +5 -7
- package/dist/http/hyper-express/index.d.mts +4 -4
- package/dist/http/hyper-express/index.d.ts +4 -4
- package/dist/http/hyper-express/index.js +38 -39
- package/dist/http/hyper-express/index.mjs +8 -9
- package/dist/http/koa/index.d.mts +4 -4
- package/dist/http/koa/index.d.ts +4 -4
- package/dist/http/koa/index.js +40 -41
- package/dist/http/koa/index.mjs +9 -10
- package/dist/index.d.mts +46 -40
- package/dist/index.d.ts +46 -40
- package/dist/index.js +48 -42
- package/dist/index.mjs +21 -15
- package/dist/{meta-BXKLFTgG.d.mts → meta-CR-D39hQ.d.mts} +7 -5
- package/dist/{meta-BXKLFTgG.d.ts → meta-CR-D39hQ.d.ts} +7 -5
- package/dist/rpc/bullmq/index.d.mts +5 -5
- package/dist/rpc/bullmq/index.d.ts +5 -5
- package/dist/rpc/bullmq/index.js +15 -14
- package/dist/rpc/bullmq/index.mjs +4 -3
- package/dist/rpc/kafka/index.d.mts +4 -4
- package/dist/rpc/kafka/index.d.ts +4 -4
- package/dist/rpc/kafka/index.js +15 -14
- package/dist/rpc/kafka/index.mjs +3 -2
- package/dist/rpc/nats/index.d.mts +4 -4
- package/dist/rpc/nats/index.d.ts +4 -4
- package/dist/rpc/nats/index.js +14 -13
- package/dist/rpc/nats/index.mjs +4 -3
- package/dist/rpc/rabbitmq/index.d.mts +4 -4
- package/dist/rpc/rabbitmq/index.d.ts +4 -4
- package/dist/rpc/rabbitmq/index.js +16 -15
- package/dist/rpc/rabbitmq/index.mjs +4 -3
- package/dist/rpc/redis/index.d.mts +4 -4
- package/dist/rpc/redis/index.d.ts +4 -4
- package/dist/rpc/redis/index.js +14 -13
- package/dist/rpc/redis/index.mjs +4 -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-h40T3cRG.d.mts → types-BF1TDbFV.d.ts} +4 -3
- package/dist/{types-BtbL49Zs.d.mts → types-DYRu0vic.d.ts} +4 -3
- package/dist/{types-VFzEM7LL.d.ts → types-DYviSl5B.d.mts} +4 -3
- package/dist/{types-m3IEDKjP.d.ts → types-DqH1qA-q.d.mts} +4 -3
- package/package.json +8 -5
- package/register/export.mjs +30 -0
- package/register/index.mjs +50 -40
- package/register/loader.mjs +384 -367
- package/register/utils.mjs +60 -56
- package/dist/chunk-J5CFUN4V.js +0 -73
- package/dist/chunk-WHJ5FALK.mjs +0 -73
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ERROR_SYMBOL,
|
|
3
|
-
|
|
3
|
+
HMR,
|
|
4
|
+
IS_DEV,
|
|
5
|
+
IS_PURE,
|
|
6
|
+
IS_STRICT,
|
|
4
7
|
LOG_LEVEL,
|
|
5
8
|
__name,
|
|
6
9
|
log
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NQ55PA2X.mjs";
|
|
8
11
|
|
|
9
12
|
// src/helper.ts
|
|
10
|
-
import
|
|
13
|
+
import pc2 from "picocolors";
|
|
11
14
|
|
|
12
15
|
// src/context.ts
|
|
13
16
|
import Debug from "debug";
|
|
17
|
+
import pc from "picocolors";
|
|
14
18
|
|
|
15
19
|
// src/pipe.ts
|
|
16
20
|
var defaultPipe = /* @__PURE__ */ __name(({ arg }) => {
|
|
@@ -228,21 +232,48 @@ var Context = class _Context {
|
|
|
228
232
|
};
|
|
229
233
|
static guardRecord = {};
|
|
230
234
|
static addonRecord = {};
|
|
235
|
+
ctx;
|
|
236
|
+
canGetCtx;
|
|
231
237
|
constructor(data) {
|
|
232
238
|
this.data = data;
|
|
233
|
-
|
|
239
|
+
this.canGetCtx = true;
|
|
240
|
+
if (IS_DEV)
|
|
234
241
|
data._context = this;
|
|
242
|
+
const that = this;
|
|
243
|
+
this.ctx = new Proxy(data, {
|
|
244
|
+
get(target, p) {
|
|
245
|
+
if (IS_DEV && !that.canGetCtx) throw new FrameworkException("ctx must be obtained within the same request cycle in controller");
|
|
246
|
+
if (!(p in target)) log(`attribute "${p}" does not exist on ctx, which might be due to a missing AOP role (such as a guard).`, "warn", data.tag);
|
|
247
|
+
return target[p];
|
|
248
|
+
},
|
|
249
|
+
set(target, p, newValue) {
|
|
250
|
+
target[p] = newValue;
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
235
254
|
}
|
|
236
255
|
static getAop(meta, opts) {
|
|
237
256
|
const { globalGuards = [], globalFilter = "default", globalPipe = "default" } = opts;
|
|
238
|
-
const { data: { guards, filter, params } } = meta;
|
|
239
|
-
|
|
240
|
-
guards:
|
|
257
|
+
const { data: { guards, filter, params, tag, func } } = meta;
|
|
258
|
+
const resolved = {
|
|
259
|
+
guards: [
|
|
241
260
|
...globalGuards,
|
|
242
261
|
...guards
|
|
243
|
-
]
|
|
244
|
-
pipe:
|
|
245
|
-
filter:
|
|
262
|
+
],
|
|
263
|
+
pipe: params.map((item) => item.pipe || globalPipe),
|
|
264
|
+
filter: filter || globalFilter
|
|
265
|
+
};
|
|
266
|
+
if (process.env.DEBUG) {
|
|
267
|
+
const { guards: guards2, pipe, filter: filter2 } = resolved;
|
|
268
|
+
debug(`func "${tag}-${func}" aop:
|
|
269
|
+
${pc.magenta(`Guard ${guards2.join("->")}[${guards2.filter((g) => g in this.guardRecord).join("->")}]`)}
|
|
270
|
+
${pc.blue(`Pipe ${pipe.join("-")}[${pipe.map((p) => p in this.pipeRecord ? p : "default").join("-")}]`)}
|
|
271
|
+
${pc.red(`Filter ${filter2}[${filter2 || "default"}]`)}`);
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
guards: this.getGuards(resolved.guards),
|
|
275
|
+
pipe: this.getPipe(resolved.pipe),
|
|
276
|
+
filter: this.getFilter(resolved.filter)
|
|
246
277
|
};
|
|
247
278
|
}
|
|
248
279
|
async run({ guards, filter, pipe }, successCb, failCb) {
|
|
@@ -255,27 +286,33 @@ var Context = class _Context {
|
|
|
255
286
|
if (index === guards.length) {
|
|
256
287
|
const instance = moduleMap.get(tag);
|
|
257
288
|
if (ctxs) {
|
|
258
|
-
ctxs.forEach((ctx) => instance[ctx] = this.
|
|
289
|
+
ctxs.forEach((ctx) => instance[ctx] = this.ctx);
|
|
259
290
|
}
|
|
260
291
|
const args = await Promise.all(params.map((item, i) => pipe[i]({
|
|
261
292
|
arg: resolveDep(this.data[item.type], item.key),
|
|
262
293
|
reflect: paramsType[item.index],
|
|
263
294
|
...item
|
|
264
|
-
}, this.
|
|
295
|
+
}, this.ctx)));
|
|
296
|
+
if (IS_DEV) {
|
|
297
|
+
Promise.resolve().then(() => {
|
|
298
|
+
this.canGetCtx = false;
|
|
299
|
+
});
|
|
300
|
+
}
|
|
265
301
|
res = await instance[func](...args);
|
|
302
|
+
this.canGetCtx = true;
|
|
266
303
|
} else {
|
|
267
304
|
let nextPromise;
|
|
268
305
|
async function next() {
|
|
269
306
|
return nextPromise = nextHandler(index + 1)().then((ret2) => {
|
|
270
307
|
if (ret2 !== void 0) {
|
|
271
|
-
debug(`The ${index + 1}th guard rewrite the response value.`);
|
|
308
|
+
debug(`The ${index + 1}th guard on "${tag}-${func}" rewrite the response value.`);
|
|
272
309
|
res = ret2;
|
|
273
310
|
}
|
|
274
311
|
return res;
|
|
275
312
|
});
|
|
276
313
|
}
|
|
277
314
|
__name(next, "next");
|
|
278
|
-
const ret = await guards[index](this.
|
|
315
|
+
const ret = await guards[index](this.ctx, next);
|
|
279
316
|
if (ret !== void 0) {
|
|
280
317
|
res = ret;
|
|
281
318
|
} else {
|
|
@@ -288,7 +325,7 @@ var Context = class _Context {
|
|
|
288
325
|
await nextHandler(0)();
|
|
289
326
|
return successCb(res);
|
|
290
327
|
} catch (e) {
|
|
291
|
-
const err = await filter(e, this.
|
|
328
|
+
const err = await filter(e, this.ctx);
|
|
292
329
|
return failCb(err);
|
|
293
330
|
}
|
|
294
331
|
}
|
|
@@ -316,17 +353,17 @@ var Context = class _Context {
|
|
|
316
353
|
}
|
|
317
354
|
};
|
|
318
355
|
function addPipe(key, pipe) {
|
|
319
|
-
if (Context.pipeRecord[key] && Context.pipeRecord[key] !== pipe)
|
|
356
|
+
if (Context.pipeRecord[key] && Context.pipeRecord[key] !== pipe) debug(`overwrite Pipe "${String(key)}"`, "warn");
|
|
320
357
|
Context.pipeRecord[key] = pipe;
|
|
321
358
|
}
|
|
322
359
|
__name(addPipe, "addPipe");
|
|
323
360
|
function addFilter(key, filter) {
|
|
324
|
-
if (Context.filterRecord[key] && Context.filterRecord[key] !== filter)
|
|
361
|
+
if (Context.filterRecord[key] && Context.filterRecord[key] !== filter) debug(`overwrite Filter "${String(key)}"`, "warn");
|
|
325
362
|
Context.filterRecord[key] = filter;
|
|
326
363
|
}
|
|
327
364
|
__name(addFilter, "addFilter");
|
|
328
365
|
function addGuard(key, guard, priority = 0) {
|
|
329
|
-
if (Context.guardRecord[key] && Context.guardRecord[key].value !== guard)
|
|
366
|
+
if (Context.guardRecord[key] && Context.guardRecord[key].value !== guard) debug(`overwrite Guard "${String(key)}"`, "warn");
|
|
330
367
|
Context.guardRecord[key] = {
|
|
331
368
|
value: guard,
|
|
332
369
|
priority
|
|
@@ -334,7 +371,7 @@ function addGuard(key, guard, priority = 0) {
|
|
|
334
371
|
}
|
|
335
372
|
__name(addGuard, "addGuard");
|
|
336
373
|
function addAddon(key, addon, priority = 0) {
|
|
337
|
-
if (Context.addonRecord[key] && Context.addonRecord[key].value !== addon)
|
|
374
|
+
if (Context.addonRecord[key] && Context.addonRecord[key].value !== addon) debug(`overwrite Addon "${String(key)}"`, "warn");
|
|
338
375
|
Context.addonRecord[key] = {
|
|
339
376
|
value: addon,
|
|
340
377
|
priority
|
|
@@ -342,32 +379,12 @@ function addAddon(key, addon, priority = 0) {
|
|
|
342
379
|
}
|
|
343
380
|
__name(addAddon, "addAddon");
|
|
344
381
|
|
|
345
|
-
// src/hmr.ts
|
|
346
|
-
function HMR(cb) {
|
|
347
|
-
if (IS_HMR) globalThis.__PS_HMR__?.push(cb);
|
|
348
|
-
}
|
|
349
|
-
__name(HMR, "HMR");
|
|
350
|
-
|
|
351
382
|
// src/http/helper.ts
|
|
352
383
|
function resolveDep(ret, key) {
|
|
353
384
|
if (key) return ret?.[key];
|
|
354
385
|
return ret;
|
|
355
386
|
}
|
|
356
387
|
__name(resolveDep, "resolveDep");
|
|
357
|
-
function argToReq(params, args, headers) {
|
|
358
|
-
const req = {
|
|
359
|
-
body: {},
|
|
360
|
-
query: {},
|
|
361
|
-
params: {},
|
|
362
|
-
headers
|
|
363
|
-
};
|
|
364
|
-
params.forEach((param) => {
|
|
365
|
-
if (param.key) req[param.type][param.key] = args[param.index];
|
|
366
|
-
else req[param.type] = args[param.index];
|
|
367
|
-
});
|
|
368
|
-
return req;
|
|
369
|
-
}
|
|
370
|
-
__name(argToReq, "argToReq");
|
|
371
388
|
|
|
372
389
|
// src/rpc/helper.ts
|
|
373
390
|
import { hostname } from "os";
|
|
@@ -409,6 +426,7 @@ function createControllerMetaMap(meta, filter) {
|
|
|
409
426
|
}
|
|
410
427
|
__name(createControllerMetaMap, "createControllerMetaMap");
|
|
411
428
|
function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
|
|
429
|
+
if (IS_PURE) return;
|
|
412
430
|
const addonSet = /* @__PURE__ */ new Set();
|
|
413
431
|
const guardSet = /* @__PURE__ */ new Set();
|
|
414
432
|
const pipeSet = /* @__PURE__ */ new Set();
|
|
@@ -427,8 +445,10 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
|
|
|
427
445
|
guardSet.add(item);
|
|
428
446
|
});
|
|
429
447
|
meta.forEach(({ data }) => {
|
|
448
|
+
if (!data.controller) return;
|
|
449
|
+
if (typeof data.tag !== "string") warningSet.add(`Tag of controller "${data.name}" should be a string`);
|
|
430
450
|
if (data.controller !== controller) {
|
|
431
|
-
if (data[controller]) warningSet.add(`
|
|
451
|
+
if (data[controller]) warningSet.add(`Should use ${controller} controller to decorate class "${data.name}"`);
|
|
432
452
|
return;
|
|
433
453
|
}
|
|
434
454
|
if (data.filter) filterSet.add(data.filter);
|
|
@@ -450,11 +470,31 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
|
|
|
450
470
|
const missFilters = [
|
|
451
471
|
...filterSet
|
|
452
472
|
].filter((i) => !Context.filterRecord[i]);
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
473
|
+
function exit() {
|
|
474
|
+
if (IS_STRICT) {
|
|
475
|
+
log("Does not meet strict mode requirements", "error");
|
|
476
|
+
process.exit(1);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
__name(exit, "exit");
|
|
480
|
+
if (missAddons.length) {
|
|
481
|
+
log(`${pc2.white(`Addon [${missAddons.join(",")}]`)} doesn't exist`, "warn");
|
|
482
|
+
exit();
|
|
483
|
+
}
|
|
484
|
+
if (missGuards.length) {
|
|
485
|
+
log(`${pc2.magenta(`Guard [${missGuards.join(",")}]`)} doesn't exist`, "warn");
|
|
486
|
+
exit();
|
|
487
|
+
}
|
|
488
|
+
if (missPipes.length) {
|
|
489
|
+
log(`${pc2.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
|
|
490
|
+
exit();
|
|
491
|
+
}
|
|
492
|
+
if (missFilters.length) {
|
|
493
|
+
log(`${pc2.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
|
|
494
|
+
exit();
|
|
495
|
+
}
|
|
457
496
|
warningSet.forEach((warn) => log(warn, "warn"));
|
|
497
|
+
if (warningSet.size) exit();
|
|
458
498
|
}
|
|
459
499
|
__name(handleMeta, "handleMeta");
|
|
460
500
|
handleMeta();
|
|
@@ -467,6 +507,14 @@ function detectAopDep(meta, { guards, addons } = {}, controller = "http") {
|
|
|
467
507
|
};
|
|
468
508
|
}
|
|
469
509
|
__name(detectAopDep, "detectAopDep");
|
|
510
|
+
function joinUrl(base, ...paths) {
|
|
511
|
+
const joinedPath = [
|
|
512
|
+
base,
|
|
513
|
+
...paths
|
|
514
|
+
].filter((p) => p).map((path) => path.replace(/(^\/)/g, "")).join("/");
|
|
515
|
+
return `/${joinedPath}`;
|
|
516
|
+
}
|
|
517
|
+
__name(joinUrl, "joinUrl");
|
|
470
518
|
|
|
471
519
|
export {
|
|
472
520
|
defaultPipe,
|
|
@@ -492,12 +540,11 @@ export {
|
|
|
492
540
|
addFilter,
|
|
493
541
|
addGuard,
|
|
494
542
|
addAddon,
|
|
495
|
-
HMR,
|
|
496
543
|
resolveDep,
|
|
497
|
-
argToReq,
|
|
498
544
|
genClientQueue,
|
|
499
545
|
shallowClone,
|
|
500
546
|
mergeObject,
|
|
501
547
|
createControllerMetaMap,
|
|
502
|
-
detectAopDep
|
|
548
|
+
detectAopDep,
|
|
549
|
+
joinUrl
|
|
503
550
|
};
|
|
@@ -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-CR-D39hQ.js';
|
|
3
3
|
|
|
4
4
|
declare abstract class Generator {
|
|
5
5
|
private _path;
|
|
@@ -30,13 +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
|
+
createProxyModule(tag: PropertyKey): {};
|
|
36
37
|
protected buildDepModule(Model: Construct): Promise<{
|
|
37
38
|
module: any;
|
|
38
39
|
tag: PropertyKey;
|
|
39
40
|
}>;
|
|
41
|
+
replace(oldModels: Construct[], newModels: Construct[]): Promise<void>;
|
|
40
42
|
has(modelOrTag: Construct | PropertyKey): boolean;
|
|
41
43
|
get<Model extends Construct>(modelOrTag: Model | PropertyKey): InstanceType<Model>;
|
|
42
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-CR-D39hQ.mjs';
|
|
3
3
|
|
|
4
4
|
declare abstract class Generator {
|
|
5
5
|
private _path;
|
|
@@ -30,13 +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
|
+
createProxyModule(tag: PropertyKey): {};
|
|
36
37
|
protected buildDepModule(Model: Construct): Promise<{
|
|
37
38
|
module: any;
|
|
38
39
|
tag: PropertyKey;
|
|
39
40
|
}>;
|
|
41
|
+
replace(oldModels: Construct[], newModels: Construct[]): Promise<void>;
|
|
40
42
|
has(modelOrTag: Construct | PropertyKey): boolean;
|
|
41
43
|
get<Model extends Construct>(modelOrTag: Model | PropertyKey): InstanceType<Model>;
|
|
42
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-CR-D39hQ.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
|
|
|
@@ -20,6 +21,7 @@ declare function detectAopDep(meta: Meta[], { guards, addons }?: {
|
|
|
20
21
|
guardSet: Set<string>;
|
|
21
22
|
pipeSet: Set<string>;
|
|
22
23
|
filterSet: Set<string>;
|
|
23
|
-
};
|
|
24
|
+
} | undefined;
|
|
25
|
+
declare function joinUrl(base: string, ...paths: string[]): string;
|
|
24
26
|
|
|
25
|
-
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-CR-D39hQ.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
|
|
|
@@ -20,6 +21,7 @@ declare function detectAopDep(meta: Meta[], { guards, addons }?: {
|
|
|
20
21
|
guardSet: Set<string>;
|
|
21
22
|
pipeSet: Set<string>;
|
|
22
23
|
filterSet: Set<string>;
|
|
23
|
-
};
|
|
24
|
+
} | undefined;
|
|
25
|
+
declare function joinUrl(base: string, ...paths: string[]): string;
|
|
24
26
|
|
|
25
|
-
export { HMR,
|
|
27
|
+
export { HMR, RELAUNCH, RELOAD, createControllerMetaMap, detectAopDep, genClientQueue, joinUrl, mergeObject, resolveDep, shallowClone };
|
package/dist/helper.js
CHANGED
|
@@ -6,16 +6,21 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
var _chunkG7JFKM2Mjs = require('./chunk-G7JFKM2M.js');
|
|
9
10
|
|
|
10
|
-
var _chunkSW5IKE5Hjs = require('./chunk-SW5IKE5H.js');
|
|
11
|
-
require('./chunk-J5CFUN4V.js');
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
|
|
14
|
+
var _chunk4LLLQOMFjs = require('./chunk-4LLLQOMF.js');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
exports.HMR = _chunk4LLLQOMFjs.HMR; exports.RELAUNCH = _chunk4LLLQOMFjs.RELAUNCH; exports.RELOAD = _chunk4LLLQOMFjs.RELOAD; exports.createControllerMetaMap = _chunkG7JFKM2Mjs.createControllerMetaMap; exports.detectAopDep = _chunkG7JFKM2Mjs.detectAopDep; exports.genClientQueue = _chunkG7JFKM2Mjs.genClientQueue; exports.joinUrl = _chunkG7JFKM2Mjs.joinUrl; exports.mergeObject = _chunkG7JFKM2Mjs.mergeObject; exports.resolveDep = _chunkG7JFKM2Mjs.resolveDep; exports.shallowClone = _chunkG7JFKM2Mjs.shallowClone;
|
package/dist/helper.mjs
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
|
-
HMR,
|
|
3
|
-
argToReq,
|
|
4
2
|
createControllerMetaMap,
|
|
5
3
|
detectAopDep,
|
|
6
4
|
genClientQueue,
|
|
5
|
+
joinUrl,
|
|
7
6
|
mergeObject,
|
|
8
7
|
resolveDep,
|
|
9
8
|
shallowClone
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import
|
|
9
|
+
} from "./chunk-Z7NAAE4M.mjs";
|
|
10
|
+
import {
|
|
11
|
+
HMR,
|
|
12
|
+
RELAUNCH,
|
|
13
|
+
RELOAD
|
|
14
|
+
} from "./chunk-NQ55PA2X.mjs";
|
|
12
15
|
export {
|
|
13
16
|
HMR,
|
|
14
|
-
|
|
17
|
+
RELAUNCH,
|
|
18
|
+
RELOAD,
|
|
15
19
|
createControllerMetaMap,
|
|
16
20
|
detectAopDep,
|
|
17
21
|
genClientQueue,
|
|
22
|
+
joinUrl,
|
|
18
23
|
mergeObject,
|
|
19
24
|
resolveDep,
|
|
20
25
|
shallowClone
|
|
@@ -1,12 +1,12 @@
|
|
|
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
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-DYviSl5B.mjs';
|
|
4
|
+
import { F as Factory } from '../../core-DIfgUKIU.mjs';
|
|
5
5
|
import 'node:http';
|
|
6
|
-
import '../../meta-
|
|
6
|
+
import '../../meta-CR-D39hQ.mjs';
|
|
7
7
|
import 'phecda-core';
|
|
8
8
|
|
|
9
|
-
interface ElysiaCtx extends
|
|
9
|
+
interface ElysiaCtx extends HttpCtx {
|
|
10
10
|
type: 'elysia';
|
|
11
11
|
app: Elysia$1;
|
|
12
12
|
context: Context;
|
|
@@ -1,12 +1,12 @@
|
|
|
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
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
3
|
+
import { H as HttpCtx, a as HttpOptions } from '../../types-BF1TDbFV.js';
|
|
4
|
+
import { F as Factory } from '../../core-CUTbX_IS.js';
|
|
5
5
|
import 'node:http';
|
|
6
|
-
import '../../meta-
|
|
6
|
+
import '../../meta-CR-D39hQ.js';
|
|
7
7
|
import 'phecda-core';
|
|
8
8
|
|
|
9
|
-
interface ElysiaCtx extends
|
|
9
|
+
interface ElysiaCtx extends HttpCtx {
|
|
10
10
|
type: 'elysia';
|
|
11
11
|
app: Elysia$1;
|
|
12
12
|
context: Context;
|