phecda-server 5.2.5 → 5.2.6

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.
Files changed (77) hide show
  1. package/dist/{chunk-JJJ7AUEF.mjs → chunk-5E2AVYP2.mjs} +2 -2
  2. package/dist/{chunk-6QLTBEXP.js → chunk-AUAAKHWS.js} +38 -38
  3. package/dist/{chunk-2O6X54P5.mjs → chunk-BZKJ5NBU.mjs} +1 -1
  4. package/dist/{chunk-MGADYFW4.mjs → chunk-LHLQIQPH.mjs} +27 -25
  5. package/dist/{chunk-2NTXVYQC.mjs → chunk-MESZCLSS.mjs} +0 -2
  6. package/dist/{chunk-MKZOLLJS.js → chunk-N4ULJDEQ.js} +43 -41
  7. package/dist/{chunk-6T4UZ4LV.js → chunk-QYX5Q7KO.js} +60 -60
  8. package/dist/{chunk-H2FWLKXN.js → chunk-RVWBJ6LV.js} +1 -3
  9. package/dist/{core-C3cON4Um.d.ts → core-Bc2ENEHX.d.mts} +7 -5
  10. package/dist/{core-BIm7dkko.d.mts → core-dx9E5x2N.d.ts} +7 -5
  11. package/dist/helper.d.mts +1 -1
  12. package/dist/helper.d.ts +1 -1
  13. package/dist/helper.js +3 -3
  14. package/dist/helper.mjs +2 -2
  15. package/dist/index.d.mts +16 -18
  16. package/dist/index.d.ts +16 -18
  17. package/dist/index.js +50 -68
  18. package/dist/index.mjs +20 -38
  19. package/dist/rpc/bullmq/index.d.mts +3 -3
  20. package/dist/rpc/bullmq/index.d.ts +3 -3
  21. package/dist/rpc/bullmq/index.js +12 -12
  22. package/dist/rpc/bullmq/index.mjs +2 -2
  23. package/dist/rpc/kafka/index.d.mts +3 -3
  24. package/dist/rpc/kafka/index.d.ts +3 -3
  25. package/dist/rpc/kafka/index.js +12 -12
  26. package/dist/rpc/kafka/index.mjs +2 -2
  27. package/dist/rpc/nats/index.d.mts +3 -3
  28. package/dist/rpc/nats/index.d.ts +3 -3
  29. package/dist/rpc/nats/index.js +11 -11
  30. package/dist/rpc/nats/index.mjs +2 -2
  31. package/dist/rpc/rabbitmq/index.d.mts +3 -3
  32. package/dist/rpc/rabbitmq/index.d.ts +3 -3
  33. package/dist/rpc/rabbitmq/index.js +13 -13
  34. package/dist/rpc/rabbitmq/index.mjs +2 -2
  35. package/dist/rpc/redis/index.d.mts +3 -3
  36. package/dist/rpc/redis/index.d.ts +3 -3
  37. package/dist/rpc/redis/index.js +11 -11
  38. package/dist/rpc/redis/index.mjs +2 -2
  39. package/dist/server/elysia/index.d.mts +3 -3
  40. package/dist/server/elysia/index.d.ts +3 -3
  41. package/dist/server/elysia/index.js +20 -20
  42. package/dist/server/elysia/index.mjs +3 -3
  43. package/dist/server/express/index.d.mts +3 -3
  44. package/dist/server/express/index.d.ts +3 -3
  45. package/dist/server/express/index.js +18 -18
  46. package/dist/server/express/index.mjs +2 -2
  47. package/dist/server/fastify/index.d.mts +3 -3
  48. package/dist/server/fastify/index.d.ts +3 -3
  49. package/dist/server/fastify/index.js +19 -19
  50. package/dist/server/fastify/index.mjs +3 -3
  51. package/dist/server/h3/index.d.mts +3 -3
  52. package/dist/server/h3/index.d.ts +3 -3
  53. package/dist/server/h3/index.js +18 -18
  54. package/dist/server/h3/index.mjs +2 -2
  55. package/dist/server/hono/index.d.mts +3 -3
  56. package/dist/server/hono/index.d.ts +3 -3
  57. package/dist/server/hono/index.js +17 -17
  58. package/dist/server/hono/index.mjs +2 -2
  59. package/dist/server/hyper-express/index.d.mts +3 -3
  60. package/dist/server/hyper-express/index.d.ts +3 -3
  61. package/dist/server/hyper-express/index.js +17 -17
  62. package/dist/server/hyper-express/index.mjs +2 -2
  63. package/dist/server/koa/index.d.mts +3 -3
  64. package/dist/server/koa/index.d.ts +3 -3
  65. package/dist/server/koa/index.js +18 -18
  66. package/dist/server/koa/index.mjs +2 -2
  67. package/dist/test.d.mts +3 -3
  68. package/dist/test.d.ts +3 -3
  69. package/dist/test.js +14 -14
  70. package/dist/test.mjs +11 -11
  71. package/dist/{types-CdQey96H.d.ts → types-BlIBlnVT.d.mts} +1 -2
  72. package/dist/{types-CdQey96H.d.mts → types-BlIBlnVT.d.ts} +1 -2
  73. package/dist/{types-CIZbw8S2.d.ts → types-CJSkC9tO.d.ts} +1 -1
  74. package/dist/{types-ByP1fKMe.d.mts → types-Dp5ixUqW.d.mts} +1 -1
  75. package/dist/{types-C5sdDiDQ.d.ts → types-PY43OKEP.d.ts} +1 -1
  76. package/dist/{types-B-y2TwhC.d.mts → types-vF4Hvnvo.d.mts} +1 -1
  77. package/package.json +2 -2
@@ -4,10 +4,10 @@
4
4
 
5
5
 
6
6
 
7
- var _chunk6T4UZ4LVjs = require('../../chunk-6T4UZ4LV.js');
7
+ var _chunkQYX5Q7KOjs = require('../../chunk-QYX5Q7KO.js');
8
8
 
9
9
 
10
- var _chunkH2FWLKXNjs = require('../../chunk-H2FWLKXN.js');
10
+ var _chunkRVWBJ6LVjs = require('../../chunk-RVWBJ6LV.js');
11
11
 
12
12
  // src/server/hono/bind.ts
13
13
  var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
@@ -15,14 +15,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/hono");
15
15
  function bind(router, data, opts = {}) {
16
16
  const { globalGuards, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe } = opts;
17
17
  const { moduleMap, meta } = data;
18
- const metaMap = _chunk6T4UZ4LVjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
18
+ const metaMap = _chunkQYX5Q7KOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
19
19
  const { controller, http, func, tag } = meta2.data;
20
20
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
21
21
  debug(`register method "${func}" in module "${tag}"`);
22
22
  return true;
23
23
  }
24
24
  });
25
- _chunk6T4UZ4LVjs.detectAopDep.call(void 0, meta, {
25
+ _chunkQYX5Q7KOjs.detectAopDep.call(void 0, meta, {
26
26
  plugins: [
27
27
  ...globalPlugins,
28
28
  ...parallelPlugins
@@ -32,25 +32,25 @@ function bind(router, data, opts = {}) {
32
32
  });
33
33
  registerRoute();
34
34
  async function registerRoute() {
35
- _chunk6T4UZ4LVjs.Context.usePlugin(globalPlugins, "hono").forEach((p) => router.use(p));
35
+ _chunkQYX5Q7KOjs.Context.usePlugin(globalPlugins, "hono").forEach((p) => router.use(p));
36
36
  if (parallelRoute) {
37
- router.post(parallelRoute, ..._chunk6T4UZ4LVjs.Context.usePlugin(parallelPlugins, "hono"), async (c) => {
37
+ router.post(parallelRoute, ..._chunkQYX5Q7KOjs.Context.usePlugin(parallelPlugins, "hono"), async (c) => {
38
38
  const body = await c.req.json();
39
39
  async function errorHandler(e) {
40
- const error = await _chunk6T4UZ4LVjs.Context.filterRecord.default(e);
40
+ const error = await _chunkQYX5Q7KOjs.Context.filterRecord.default(e);
41
41
  c.status(error.status);
42
42
  return c.json(error);
43
43
  }
44
- _chunkH2FWLKXNjs.__name.call(void 0, errorHandler, "errorHandler");
45
- if (!Array.isArray(body)) return errorHandler(new (0, _chunk6T4UZ4LVjs.BadRequestException)("data format should be an array"));
44
+ _chunkRVWBJ6LVjs.__name.call(void 0, errorHandler, "errorHandler");
45
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkQYX5Q7KOjs.BadRequestException)("data format should be an array"));
46
46
  try {
47
47
  return Promise.all(body.map((item, i) => {
48
48
  return new Promise(async (resolve) => {
49
49
  const { tag, func } = item;
50
50
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
51
- if (!metaMap.has(tag)) return resolve(await _chunk6T4UZ4LVjs.Context.filterRecord.default(new (0, _chunk6T4UZ4LVjs.BadRequestException)(`module "${tag}" doesn't exist`)));
51
+ if (!metaMap.has(tag)) return resolve(await _chunkQYX5Q7KOjs.Context.filterRecord.default(new (0, _chunkQYX5Q7KOjs.BadRequestException)(`module "${tag}" doesn't exist`)));
52
52
  const meta2 = metaMap.get(tag)[func];
53
- if (!meta2) return resolve(await _chunk6T4UZ4LVjs.Context.filterRecord.default(new (0, _chunk6T4UZ4LVjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
53
+ if (!meta2) return resolve(await _chunkQYX5Q7KOjs.Context.filterRecord.default(new (0, _chunkQYX5Q7KOjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
54
54
  const { data: { params } } = meta2;
55
55
  const contextData = {
56
56
  type: "hono",
@@ -62,9 +62,9 @@ function bind(router, data, opts = {}) {
62
62
  tag,
63
63
  func,
64
64
  app: router,
65
- ..._chunk6T4UZ4LVjs.argToReq.call(void 0, params, item.args, c.req.header())
65
+ ..._chunkQYX5Q7KOjs.argToReq.call(void 0, params, item.args, c.req.header())
66
66
  };
67
- const context = new (0, _chunk6T4UZ4LVjs.Context)(contextData);
67
+ const context = new (0, _chunkQYX5Q7KOjs.Context)(contextData);
68
68
  context.run({
69
69
  globalGuards,
70
70
  globalInterceptors,
@@ -86,7 +86,7 @@ function bind(router, data, opts = {}) {
86
86
  const { data: { params, plugins, http } } = meta2;
87
87
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
88
88
  const needBody = params.some((item) => item.type === "body");
89
- router[http.type](http.prefix + http.route, ..._chunk6T4UZ4LVjs.Context.usePlugin(plugins, "hono"), async (c) => {
89
+ router[http.type](http.prefix + http.route, ..._chunkQYX5Q7KOjs.Context.usePlugin(plugins, "hono"), async (c) => {
90
90
  debug(`invoke method "${func}" in module "${tag}"`);
91
91
  const contextData = {
92
92
  type: "hono",
@@ -101,7 +101,7 @@ function bind(router, data, opts = {}) {
101
101
  headers: c.req.header(),
102
102
  app: router
103
103
  };
104
- const context = new (0, _chunk6T4UZ4LVjs.Context)(contextData);
104
+ const context = new (0, _chunkQYX5Q7KOjs.Context)(contextData);
105
105
  if (http.headers) {
106
106
  for (const name in http.headers) c.header(name, http.headers[name]);
107
107
  }
@@ -122,9 +122,9 @@ function bind(router, data, opts = {}) {
122
122
  }
123
123
  }
124
124
  }
125
- _chunkH2FWLKXNjs.__name.call(void 0, registerRoute, "registerRoute");
125
+ _chunkRVWBJ6LVjs.__name.call(void 0, registerRoute, "registerRoute");
126
126
  }
127
- _chunkH2FWLKXNjs.__name.call(void 0, bind, "bind");
127
+ _chunkRVWBJ6LVjs.__name.call(void 0, bind, "bind");
128
128
 
129
129
 
130
130
  exports.bind = bind;
@@ -4,10 +4,10 @@ import {
4
4
  argToReq,
5
5
  createControllerMetaMap,
6
6
  detectAopDep
7
- } from "../../chunk-2O6X54P5.mjs";
7
+ } from "../../chunk-BZKJ5NBU.mjs";
8
8
  import {
9
9
  __name
10
- } from "../../chunk-2NTXVYQC.mjs";
10
+ } from "../../chunk-MESZCLSS.mjs";
11
11
 
12
12
  // src/server/hono/bind.ts
13
13
  import Debug from "debug";
@@ -1,8 +1,8 @@
1
1
  import { Request, Response, Router, MiddlewareHandler } from 'hyper-express';
2
- import { a as HttpContext, H as HttpOptions } from '../../types-ByP1fKMe.mjs';
3
- import { F as Factory } from '../../core-BIm7dkko.mjs';
2
+ import { a as HttpContext, H as HttpOptions } from '../../types-Dp5ixUqW.mjs';
3
+ import { F as Factory } from '../../core-Bc2ENEHX.mjs';
4
4
  import 'node:http';
5
- import '../../types-CdQey96H.mjs';
5
+ import '../../types-BlIBlnVT.mjs';
6
6
  import 'phecda-core';
7
7
 
8
8
  interface HyperExpressCtx extends HttpContext {
@@ -1,8 +1,8 @@
1
1
  import { Request, Response, Router, MiddlewareHandler } from 'hyper-express';
2
- import { a as HttpContext, H as HttpOptions } from '../../types-C5sdDiDQ.js';
3
- import { F as Factory } from '../../core-C3cON4Um.js';
2
+ import { a as HttpContext, H as HttpOptions } from '../../types-PY43OKEP.js';
3
+ import { F as Factory } from '../../core-dx9E5x2N.js';
4
4
  import 'node:http';
5
- import '../../types-CdQey96H.js';
5
+ import '../../types-BlIBlnVT.js';
6
6
  import 'phecda-core';
7
7
 
8
8
  interface HyperExpressCtx extends HttpContext {
@@ -4,10 +4,10 @@
4
4
 
5
5
 
6
6
 
7
- var _chunk6T4UZ4LVjs = require('../../chunk-6T4UZ4LV.js');
7
+ var _chunkQYX5Q7KOjs = require('../../chunk-QYX5Q7KO.js');
8
8
 
9
9
 
10
- var _chunkH2FWLKXNjs = require('../../chunk-H2FWLKXN.js');
10
+ var _chunkRVWBJ6LVjs = require('../../chunk-RVWBJ6LV.js');
11
11
 
12
12
  // src/server/hyper-express/bind.ts
13
13
  var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
@@ -15,14 +15,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/hyper-express");
15
15
  function bind(router, data, opts = {}) {
16
16
  const { globalGuards, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe } = opts;
17
17
  const { moduleMap, meta } = data;
18
- const metaMap = _chunk6T4UZ4LVjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
18
+ const metaMap = _chunkQYX5Q7KOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
19
19
  const { controller, http, func, tag } = meta2.data;
20
20
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
21
21
  debug(`register method "${func}" in module "${tag}"`);
22
22
  return true;
23
23
  }
24
24
  });
25
- _chunk6T4UZ4LVjs.detectAopDep.call(void 0, meta, {
25
+ _chunkQYX5Q7KOjs.detectAopDep.call(void 0, meta, {
26
26
  plugins: [
27
27
  ...globalPlugins,
28
28
  ...parallelPlugins
@@ -32,26 +32,26 @@ function bind(router, data, opts = {}) {
32
32
  });
33
33
  registerRoute();
34
34
  async function registerRoute() {
35
- _chunk6T4UZ4LVjs.Context.usePlugin(globalPlugins, "hyper-express").forEach((p) => router.use(p));
35
+ _chunkQYX5Q7KOjs.Context.usePlugin(globalPlugins, "hyper-express").forEach((p) => router.use(p));
36
36
  if (parallelRoute) {
37
37
  router.post(parallelRoute, {
38
- middlewares: _chunk6T4UZ4LVjs.Context.usePlugin(parallelPlugins, "hyper-express")
38
+ middlewares: _chunkQYX5Q7KOjs.Context.usePlugin(parallelPlugins, "hyper-express")
39
39
  }, async (req, res, next) => {
40
40
  const body = await req.json();
41
41
  async function errorHandler(e) {
42
- const error = await _chunk6T4UZ4LVjs.Context.filterRecord.default(e);
42
+ const error = await _chunkQYX5Q7KOjs.Context.filterRecord.default(e);
43
43
  return res.status(error.status).json(error);
44
44
  }
45
- _chunkH2FWLKXNjs.__name.call(void 0, errorHandler, "errorHandler");
46
- if (!Array.isArray(body)) return errorHandler(new (0, _chunk6T4UZ4LVjs.BadRequestException)("data format should be an array"));
45
+ _chunkRVWBJ6LVjs.__name.call(void 0, errorHandler, "errorHandler");
46
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkQYX5Q7KOjs.BadRequestException)("data format should be an array"));
47
47
  try {
48
48
  return Promise.all(body.map((item, i) => {
49
49
  return new Promise(async (resolve) => {
50
50
  const { tag, func } = item;
51
51
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
52
- if (!metaMap.has(tag)) return resolve(await _chunk6T4UZ4LVjs.Context.filterRecord.default(new (0, _chunk6T4UZ4LVjs.BadRequestException)(`module "${tag}" doesn't exist`)));
52
+ if (!metaMap.has(tag)) return resolve(await _chunkQYX5Q7KOjs.Context.filterRecord.default(new (0, _chunkQYX5Q7KOjs.BadRequestException)(`module "${tag}" doesn't exist`)));
53
53
  const meta2 = metaMap.get(tag)[func];
54
- if (!meta2) return resolve(await _chunk6T4UZ4LVjs.Context.filterRecord.default(new (0, _chunk6T4UZ4LVjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
54
+ if (!meta2) return resolve(await _chunkQYX5Q7KOjs.Context.filterRecord.default(new (0, _chunkQYX5Q7KOjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
55
55
  const { data: { params } } = meta2;
56
56
  const contextData = {
57
57
  type: "hyper-express",
@@ -65,9 +65,9 @@ function bind(router, data, opts = {}) {
65
65
  func,
66
66
  next,
67
67
  app: router,
68
- ..._chunk6T4UZ4LVjs.argToReq.call(void 0, params, item.args, req.headers)
68
+ ..._chunkQYX5Q7KOjs.argToReq.call(void 0, params, item.args, req.headers)
69
69
  };
70
- const context = new (0, _chunk6T4UZ4LVjs.Context)(contextData);
70
+ const context = new (0, _chunkQYX5Q7KOjs.Context)(contextData);
71
71
  context.run({
72
72
  globalGuards,
73
73
  globalInterceptors,
@@ -89,7 +89,7 @@ function bind(router, data, opts = {}) {
89
89
  const { data: { params, plugins, http } } = meta2;
90
90
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
91
91
  const needBody = params.some((item) => item.type === "body");
92
- router[http.type](http.prefix + http.route, ..._chunk6T4UZ4LVjs.Context.usePlugin(plugins, "hyper-express"), async (req, res, next) => {
92
+ router[http.type](http.prefix + http.route, ..._chunkQYX5Q7KOjs.Context.usePlugin(plugins, "hyper-express"), async (req, res, next) => {
93
93
  debug(`invoke method "${func}" in module "${tag}"`);
94
94
  const contextData = {
95
95
  type: "hyper-express",
@@ -106,7 +106,7 @@ function bind(router, data, opts = {}) {
106
106
  headers: req.headers,
107
107
  next
108
108
  };
109
- const context = new (0, _chunk6T4UZ4LVjs.Context)(contextData);
109
+ const context = new (0, _chunkQYX5Q7KOjs.Context)(contextData);
110
110
  if (http.headers) {
111
111
  for (const name in http.headers) res.set(name, http.headers[name]);
112
112
  }
@@ -127,9 +127,9 @@ function bind(router, data, opts = {}) {
127
127
  }
128
128
  }
129
129
  }
130
- _chunkH2FWLKXNjs.__name.call(void 0, registerRoute, "registerRoute");
130
+ _chunkRVWBJ6LVjs.__name.call(void 0, registerRoute, "registerRoute");
131
131
  }
132
- _chunkH2FWLKXNjs.__name.call(void 0, bind, "bind");
132
+ _chunkRVWBJ6LVjs.__name.call(void 0, bind, "bind");
133
133
 
134
134
 
135
135
  exports.bind = bind;
@@ -4,10 +4,10 @@ import {
4
4
  argToReq,
5
5
  createControllerMetaMap,
6
6
  detectAopDep
7
- } from "../../chunk-2O6X54P5.mjs";
7
+ } from "../../chunk-BZKJ5NBU.mjs";
8
8
  import {
9
9
  __name
10
- } from "../../chunk-2NTXVYQC.mjs";
10
+ } from "../../chunk-MESZCLSS.mjs";
11
11
 
12
12
  // src/server/hyper-express/bind.ts
13
13
  import Debug from "debug";
@@ -1,9 +1,9 @@
1
1
  import Router, { RouterParamContext } from '@koa/router';
2
2
  import { DefaultContext, DefaultState } from 'koa';
3
- import { a as HttpContext, H as HttpOptions } from '../../types-ByP1fKMe.mjs';
4
- import { F as Factory } from '../../core-BIm7dkko.mjs';
3
+ import { a as HttpContext, H as HttpOptions } from '../../types-Dp5ixUqW.mjs';
4
+ import { F as Factory } from '../../core-Bc2ENEHX.mjs';
5
5
  import 'node:http';
6
- import '../../types-CdQey96H.mjs';
6
+ import '../../types-BlIBlnVT.mjs';
7
7
  import 'phecda-core';
8
8
 
9
9
  interface KoaCtx extends HttpContext {
@@ -1,9 +1,9 @@
1
1
  import Router, { RouterParamContext } from '@koa/router';
2
2
  import { DefaultContext, DefaultState } from 'koa';
3
- import { a as HttpContext, H as HttpOptions } from '../../types-C5sdDiDQ.js';
4
- import { F as Factory } from '../../core-C3cON4Um.js';
3
+ import { a as HttpContext, H as HttpOptions } from '../../types-PY43OKEP.js';
4
+ import { F as Factory } from '../../core-dx9E5x2N.js';
5
5
  import 'node:http';
6
- import '../../types-CdQey96H.js';
6
+ import '../../types-BlIBlnVT.js';
7
7
  import 'phecda-core';
8
8
 
9
9
  interface KoaCtx extends HttpContext {
@@ -5,10 +5,10 @@
5
5
 
6
6
 
7
7
 
8
- var _chunk6T4UZ4LVjs = require('../../chunk-6T4UZ4LV.js');
8
+ var _chunkQYX5Q7KOjs = require('../../chunk-QYX5Q7KO.js');
9
9
 
10
10
 
11
- var _chunkH2FWLKXNjs = require('../../chunk-H2FWLKXN.js');
11
+ var _chunkRVWBJ6LVjs = require('../../chunk-RVWBJ6LV.js');
12
12
 
13
13
  // src/server/koa/bind.ts
14
14
  var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
@@ -17,14 +17,14 @@ function bind(router, data, opts = {}) {
17
17
  const { globalGuards, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe } = opts;
18
18
  const { moduleMap, meta } = data;
19
19
  const originStack = router.stack.slice(0, router.stack.length);
20
- const metaMap = _chunk6T4UZ4LVjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
20
+ const metaMap = _chunkQYX5Q7KOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
21
  const { controller, http, func, tag } = meta2.data;
22
22
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
23
23
  debug(`register method "${func}" in module "${tag}"`);
24
24
  return true;
25
25
  }
26
26
  });
27
- _chunk6T4UZ4LVjs.detectAopDep.call(void 0, meta, {
27
+ _chunkQYX5Q7KOjs.detectAopDep.call(void 0, meta, {
28
28
  plugins: [
29
29
  ...globalPlugins,
30
30
  ...parallelPlugins
@@ -34,25 +34,25 @@ function bind(router, data, opts = {}) {
34
34
  });
35
35
  registerRoute();
36
36
  async function registerRoute() {
37
- _chunk6T4UZ4LVjs.Context.usePlugin(globalPlugins, "koa").forEach((p) => router.use(p));
37
+ _chunkQYX5Q7KOjs.Context.usePlugin(globalPlugins, "koa").forEach((p) => router.use(p));
38
38
  if (parallelRoute) {
39
- router.post(parallelRoute, ..._chunk6T4UZ4LVjs.Context.usePlugin(parallelPlugins, "koa"), async (ctx, next) => {
39
+ router.post(parallelRoute, ..._chunkQYX5Q7KOjs.Context.usePlugin(parallelPlugins, "koa"), async (ctx, next) => {
40
40
  const { body } = ctx.request;
41
41
  async function errorHandler(e) {
42
- const error = await _chunk6T4UZ4LVjs.Context.filterRecord.default(e);
42
+ const error = await _chunkQYX5Q7KOjs.Context.filterRecord.default(e);
43
43
  ctx.status = error.status;
44
44
  ctx.body = error;
45
45
  }
46
- _chunkH2FWLKXNjs.__name.call(void 0, errorHandler, "errorHandler");
47
- if (!Array.isArray(body)) return errorHandler(new (0, _chunk6T4UZ4LVjs.BadRequestException)("data format should be an array"));
46
+ _chunkRVWBJ6LVjs.__name.call(void 0, errorHandler, "errorHandler");
47
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkQYX5Q7KOjs.BadRequestException)("data format should be an array"));
48
48
  try {
49
49
  return Promise.all(body.map((item, i) => {
50
50
  return new Promise(async (resolve) => {
51
51
  const { tag, func } = item;
52
52
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
53
- if (!metaMap.has(tag)) return resolve(await _chunk6T4UZ4LVjs.Context.filterRecord.default(new (0, _chunk6T4UZ4LVjs.BadRequestException)(`module "${tag}" doesn't exist`)));
53
+ if (!metaMap.has(tag)) return resolve(await _chunkQYX5Q7KOjs.Context.filterRecord.default(new (0, _chunkQYX5Q7KOjs.BadRequestException)(`module "${tag}" doesn't exist`)));
54
54
  const meta2 = metaMap.get(tag)[func];
55
- if (!meta2) return resolve(await _chunk6T4UZ4LVjs.Context.filterRecord.default(new (0, _chunk6T4UZ4LVjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
55
+ if (!meta2) return resolve(await _chunkQYX5Q7KOjs.Context.filterRecord.default(new (0, _chunkQYX5Q7KOjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
56
56
  const { data: { params } } = meta2;
57
57
  const contextData = {
58
58
  type: "koa",
@@ -63,11 +63,11 @@ function bind(router, data, opts = {}) {
63
63
  parallel: true,
64
64
  next,
65
65
  app: router,
66
- ..._chunk6T4UZ4LVjs.argToReq.call(void 0, params, item.args, ctx.headers),
66
+ ..._chunkQYX5Q7KOjs.argToReq.call(void 0, params, item.args, ctx.headers),
67
67
  tag,
68
68
  func
69
69
  };
70
- const context = new (0, _chunk6T4UZ4LVjs.Context)(contextData);
70
+ const context = new (0, _chunkQYX5Q7KOjs.Context)(contextData);
71
71
  context.run({
72
72
  globalGuards,
73
73
  globalInterceptors,
@@ -88,7 +88,7 @@ function bind(router, data, opts = {}) {
88
88
  const meta2 = metaMap.get(tag)[func];
89
89
  const { data: { plugins, http } } = meta2;
90
90
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
91
- router[http.type](http.prefix + http.route, ..._chunk6T4UZ4LVjs.Context.usePlugin(plugins, "koa"), async (ctx, next) => {
91
+ router[http.type](http.prefix + http.route, ..._chunkQYX5Q7KOjs.Context.usePlugin(plugins, "koa"), async (ctx, next) => {
92
92
  debug(`invoke method "${func}" in module "${tag}"`);
93
93
  const contextData = {
94
94
  type: "koa",
@@ -104,7 +104,7 @@ function bind(router, data, opts = {}) {
104
104
  headers: ctx.headers,
105
105
  next
106
106
  };
107
- const context = new (0, _chunk6T4UZ4LVjs.Context)(contextData);
107
+ const context = new (0, _chunkQYX5Q7KOjs.Context)(contextData);
108
108
  if (http.headers) {
109
109
  for (const name in http.headers) ctx.set(name, http.headers[name]);
110
110
  }
@@ -125,13 +125,13 @@ function bind(router, data, opts = {}) {
125
125
  }
126
126
  }
127
127
  }
128
- _chunkH2FWLKXNjs.__name.call(void 0, registerRoute, "registerRoute");
129
- _chunk6T4UZ4LVjs.HMR.call(void 0, async () => {
128
+ _chunkRVWBJ6LVjs.__name.call(void 0, registerRoute, "registerRoute");
129
+ _chunkQYX5Q7KOjs.HMR.call(void 0, async () => {
130
130
  router.stack = originStack;
131
131
  registerRoute();
132
132
  });
133
133
  }
134
- _chunkH2FWLKXNjs.__name.call(void 0, bind, "bind");
134
+ _chunkRVWBJ6LVjs.__name.call(void 0, bind, "bind");
135
135
 
136
136
 
137
137
  exports.bind = bind;
@@ -5,10 +5,10 @@ import {
5
5
  argToReq,
6
6
  createControllerMetaMap,
7
7
  detectAopDep
8
- } from "../../chunk-2O6X54P5.mjs";
8
+ } from "../../chunk-BZKJ5NBU.mjs";
9
9
  import {
10
10
  __name
11
- } from "../../chunk-2NTXVYQC.mjs";
11
+ } from "../../chunk-MESZCLSS.mjs";
12
12
 
13
13
  // src/server/koa/bind.ts
14
14
  import Debug from "debug";
package/dist/test.d.mts CHANGED
@@ -2,11 +2,11 @@ import * as supertest from 'supertest';
2
2
  import { Test } from 'supertest';
3
3
  import { Server } from 'node:http';
4
4
  import { Construct } from 'phecda-core';
5
- import { F as Factory } from './core-BIm7dkko.mjs';
6
- import { P as PickFunc } from './types-CdQey96H.mjs';
5
+ import { F as Factory } from './core-Bc2ENEHX.mjs';
6
+ import { P as PickFunc } from './types-BlIBlnVT.mjs';
7
7
 
8
8
  declare function TestFactory<T extends Construct[]>(...Modules: T): Promise<{
9
- get<C extends T[number]>(Module: C): InstanceType<C>;
9
+ get<C extends T[number]>(Model: C): InstanceType<C>;
10
10
  }>;
11
11
  type SuperTestRequest<T> = {
12
12
  [K in keyof T]: T[K] extends (...args: infer R) => any ? (...args: R) => Test : never;
package/dist/test.d.ts CHANGED
@@ -2,11 +2,11 @@ import * as supertest from 'supertest';
2
2
  import { Test } from 'supertest';
3
3
  import { Server } from 'node:http';
4
4
  import { Construct } from 'phecda-core';
5
- import { F as Factory } from './core-C3cON4Um.js';
6
- import { P as PickFunc } from './types-CdQey96H.js';
5
+ import { F as Factory } from './core-dx9E5x2N.js';
6
+ import { P as PickFunc } from './types-BlIBlnVT.js';
7
7
 
8
8
  declare function TestFactory<T extends Construct[]>(...Modules: T): Promise<{
9
- get<C extends T[number]>(Module: C): InstanceType<C>;
9
+ get<C extends T[number]>(Model: C): InstanceType<C>;
10
10
  }>;
11
11
  type SuperTestRequest<T> = {
12
12
  [K in keyof T]: T[K] extends (...args: infer R) => any ? (...args: R) => Test : never;
package/dist/test.js CHANGED
@@ -1,32 +1,32 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
2
2
 
3
- var _chunkMKZOLLJSjs = require('./chunk-MKZOLLJS.js');
3
+ var _chunkN4ULJDEQjs = require('./chunk-N4ULJDEQ.js');
4
4
 
5
5
 
6
- var _chunkH2FWLKXNjs = require('./chunk-H2FWLKXN.js');
6
+ var _chunkRVWBJ6LVjs = require('./chunk-RVWBJ6LV.js');
7
7
 
8
8
  // src/test.ts
9
9
  var _phecdacore = require('phecda-core');
10
10
  async function TestFactory(...Modules) {
11
- const { moduleMap, constructorMap } = await _chunkMKZOLLJSjs.Factory.call(void 0, Modules);
11
+ const { moduleMap, modelMap } = await _chunkN4ULJDEQjs.Factory.call(void 0, Modules);
12
12
  return {
13
- get(Module) {
14
- const tag = _phecdacore.getTag.call(void 0, Module);
15
- const instance = moduleMap.get(tag);
16
- if (!instance) throw new Error(`module "${String(tag)}" doesn't exist`);
17
- if (constructorMap.get(tag) !== Module) throw new Error(`module "${Module.name}" and "${String(tag)}" in modulemap are different modules`);
18
- return instance;
13
+ get(Model) {
14
+ const tag = _phecdacore.getTag.call(void 0, Model);
15
+ const module = moduleMap.get(tag);
16
+ if (!module) throw new Error(`module "${String(tag)}" doesn't exist`);
17
+ if (modelMap.get(module) !== Model) throw new Error(`module "${Model.name}" and "${String(tag)}" in modulemap are different modules`);
18
+ return module;
19
19
  }
20
20
  };
21
21
  }
22
- _chunkH2FWLKXNjs.__name.call(void 0, TestFactory, "TestFactory");
22
+ _chunkRVWBJ6LVjs.__name.call(void 0, TestFactory, "TestFactory");
23
23
  async function TestHttp(app, { moduleMap, meta }, isAgent = true) {
24
24
  const { default: request, agent } = await Promise.resolve().then(() => _interopRequireWildcard(require("supertest")));
25
25
  const Agent = agent(app);
26
26
  function module(Module) {
27
27
  const tag = _phecdacore.getTag.call(void 0, Module);
28
- const instance = moduleMap.get(tag);
29
- if (!instance) throw new Error(`module "${String(tag)}" doesn't exist`);
28
+ const module2 = moduleMap.get(tag);
29
+ if (!module2) throw new Error(`module "${String(tag)}" doesn't exist`);
30
30
  return new Proxy({}, {
31
31
  get(_target, p) {
32
32
  const { data } = meta.find(({ data: data2 }) => data2.name === Module.name && data2.func === p && data2.tag === tag);
@@ -59,11 +59,11 @@ async function TestHttp(app, { moduleMap, meta }, isAgent = true) {
59
59
  }
60
60
  });
61
61
  }
62
- _chunkH2FWLKXNjs.__name.call(void 0, module, "module");
62
+ _chunkRVWBJ6LVjs.__name.call(void 0, module, "module");
63
63
  Agent.module = module;
64
64
  return Agent;
65
65
  }
66
- _chunkH2FWLKXNjs.__name.call(void 0, TestHttp, "TestHttp");
66
+ _chunkRVWBJ6LVjs.__name.call(void 0, TestHttp, "TestHttp");
67
67
 
68
68
 
69
69
 
package/dist/test.mjs CHANGED
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  Factory
3
- } from "./chunk-MGADYFW4.mjs";
3
+ } from "./chunk-LHLQIQPH.mjs";
4
4
  import {
5
5
  __name
6
- } from "./chunk-2NTXVYQC.mjs";
6
+ } from "./chunk-MESZCLSS.mjs";
7
7
 
8
8
  // src/test.ts
9
9
  import { getTag } from "phecda-core";
10
10
  async function TestFactory(...Modules) {
11
- const { moduleMap, constructorMap } = await Factory(Modules);
11
+ const { moduleMap, modelMap } = await Factory(Modules);
12
12
  return {
13
- get(Module) {
14
- const tag = getTag(Module);
15
- const instance = moduleMap.get(tag);
16
- if (!instance) throw new Error(`module "${String(tag)}" doesn't exist`);
17
- if (constructorMap.get(tag) !== Module) throw new Error(`module "${Module.name}" and "${String(tag)}" in modulemap are different modules`);
18
- return instance;
13
+ get(Model) {
14
+ const tag = getTag(Model);
15
+ const module = moduleMap.get(tag);
16
+ if (!module) throw new Error(`module "${String(tag)}" doesn't exist`);
17
+ if (modelMap.get(module) !== Model) throw new Error(`module "${Model.name}" and "${String(tag)}" in modulemap are different modules`);
18
+ return module;
19
19
  }
20
20
  };
21
21
  }
@@ -25,8 +25,8 @@ async function TestHttp(app, { moduleMap, meta }, isAgent = true) {
25
25
  const Agent = agent(app);
26
26
  function module(Module) {
27
27
  const tag = getTag(Module);
28
- const instance = moduleMap.get(tag);
29
- if (!instance) throw new Error(`module "${String(tag)}" doesn't exist`);
28
+ const module2 = moduleMap.get(tag);
29
+ if (!module2) throw new Error(`module "${String(tag)}" doesn't exist`);
30
30
  return new Proxy({}, {
31
31
  get(_target, p) {
32
32
  const { data } = meta.find(({ data: data2 }) => data2.name === Module.name && data2.func === p && data2.tag === tag);
@@ -43,7 +43,6 @@ interface ControllerMeta extends Meta {
43
43
  data: ControllerMetaData;
44
44
  }
45
45
 
46
- declare const UNMOUNT_SYMBOL = "__PS_UNMOUNT__";
47
46
  declare const ERROR_SYMBOL = "__PS_ERROR__";
48
47
  declare const IS_HMR: boolean;
49
48
  declare const IS_ONLY_GENERATE: boolean;
@@ -105,4 +104,4 @@ declare class CustomResponse<Value> {
105
104
  }
106
105
  type ExtractResponse<Class extends CustomResponse<any>> = Class extends CustomResponse<infer Value> ? Value : never;
107
106
 
108
- export { type BaseContext as B, type ControllerMetaData as C, type DefaultOptions as D, type Emitter as E, IS_HMR as I, LOG_LEVEL as L, type MetaData as M, type OmitFunction as O, type PickFunc as P, type ServiceMetaData as S, type ToClientMap as T, UNMOUNT_SYMBOL as U, type BaseError as a, type ToClientInstance as b, type ToClientFn as c, type BaseReturn as d, type BaseRequestType as e, CustomResponse as f, type ExtractResponse as g, Meta as h, type ControllerMeta as i, ERROR_SYMBOL as j, IS_ONLY_GENERATE as k, IS_STRICT as l, PS_EXIT_CODE as m };
107
+ export { type BaseContext as B, type ControllerMetaData as C, type DefaultOptions as D, type Emitter as E, IS_HMR as I, LOG_LEVEL as L, type MetaData as M, type OmitFunction as O, type PickFunc as P, type ServiceMetaData as S, type ToClientMap as T, type BaseError as a, type ToClientInstance as b, type ToClientFn as c, type BaseReturn as d, type BaseRequestType as e, CustomResponse as f, type ExtractResponse as g, Meta as h, type ControllerMeta as i, ERROR_SYMBOL as j, IS_ONLY_GENERATE as k, IS_STRICT as l, PS_EXIT_CODE as m };
@@ -43,7 +43,6 @@ interface ControllerMeta extends Meta {
43
43
  data: ControllerMetaData;
44
44
  }
45
45
 
46
- declare const UNMOUNT_SYMBOL = "__PS_UNMOUNT__";
47
46
  declare const ERROR_SYMBOL = "__PS_ERROR__";
48
47
  declare const IS_HMR: boolean;
49
48
  declare const IS_ONLY_GENERATE: boolean;
@@ -105,4 +104,4 @@ declare class CustomResponse<Value> {
105
104
  }
106
105
  type ExtractResponse<Class extends CustomResponse<any>> = Class extends CustomResponse<infer Value> ? Value : never;
107
106
 
108
- export { type BaseContext as B, type ControllerMetaData as C, type DefaultOptions as D, type Emitter as E, IS_HMR as I, LOG_LEVEL as L, type MetaData as M, type OmitFunction as O, type PickFunc as P, type ServiceMetaData as S, type ToClientMap as T, UNMOUNT_SYMBOL as U, type BaseError as a, type ToClientInstance as b, type ToClientFn as c, type BaseReturn as d, type BaseRequestType as e, CustomResponse as f, type ExtractResponse as g, Meta as h, type ControllerMeta as i, ERROR_SYMBOL as j, IS_ONLY_GENERATE as k, IS_STRICT as l, PS_EXIT_CODE as m };
107
+ export { type BaseContext as B, type ControllerMetaData as C, type DefaultOptions as D, type Emitter as E, IS_HMR as I, LOG_LEVEL as L, type MetaData as M, type OmitFunction as O, type PickFunc as P, type ServiceMetaData as S, type ToClientMap as T, type BaseError as a, type ToClientInstance as b, type ToClientFn as c, type BaseReturn as d, type BaseRequestType as e, CustomResponse as f, type ExtractResponse as g, Meta as h, type ControllerMeta as i, ERROR_SYMBOL as j, IS_ONLY_GENERATE as k, IS_STRICT as l, PS_EXIT_CODE as m };
@@ -1,4 +1,4 @@
1
- import { D as DefaultOptions, B as BaseContext } from './types-CdQey96H.js';
1
+ import { D as DefaultOptions, B as BaseContext } from './types-BlIBlnVT.js';
2
2
 
3
3
  interface RpcServerOptions extends DefaultOptions {
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import { IncomingHttpHeaders } from 'node:http';
2
- import { D as DefaultOptions, B as BaseContext } from './types-CdQey96H.mjs';
2
+ import { D as DefaultOptions, B as BaseContext } from './types-BlIBlnVT.mjs';
3
3
 
4
4
  interface HttpOptions extends DefaultOptions {
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { IncomingHttpHeaders } from 'node:http';
2
- import { D as DefaultOptions, B as BaseContext } from './types-CdQey96H.js';
2
+ import { D as DefaultOptions, B as BaseContext } from './types-BlIBlnVT.js';
3
3
 
4
4
  interface HttpOptions extends DefaultOptions {
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { D as DefaultOptions, B as BaseContext } from './types-CdQey96H.mjs';
1
+ import { D as DefaultOptions, B as BaseContext } from './types-BlIBlnVT.mjs';
2
2
 
3
3
  interface RpcServerOptions extends DefaultOptions {
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-server",
3
- "version": "5.2.5",
3
+ "version": "5.2.6",
4
4
  "description": "server framework that provide IOC/type-reuse/http&rpc-adaptor",
5
5
  "author": "fgsreally",
6
6
  "license": "MIT",
@@ -145,7 +145,7 @@
145
145
  "fs-extra": "^11.2.0",
146
146
  "picocolors": "^1.0.0",
147
147
  "reflect-metadata": "^0.1.13",
148
- "phecda-core": "3.0.1"
148
+ "phecda-core": "3.0.2"
149
149
  },
150
150
  "devDependencies": {
151
151
  "@koa/router": "^12.0.1",