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.
Files changed (41) hide show
  1. package/dist/{chunk-ODUYOCDF.js → chunk-2HVTWYS2.js} +37 -37
  2. package/dist/{chunk-N4ULJDEQ.js → chunk-3D7AROG2.js} +36 -25
  3. package/dist/{chunk-BZKJ5NBU.mjs → chunk-3IPYLGY2.mjs} +1 -1
  4. package/dist/{chunk-LHLQIQPH.mjs → chunk-ECSI4QBK.mjs} +18 -7
  5. package/dist/{chunk-RVWBJ6LV.js → chunk-GHFSIZUO.js} +2 -10
  6. package/dist/{chunk-QYX5Q7KO.js → chunk-RZ7IXJYQ.js} +60 -60
  7. package/dist/{chunk-ORQAEOSE.mjs → chunk-SXOZVIKW.mjs} +2 -2
  8. package/dist/{chunk-MESZCLSS.mjs → chunk-UXD62LGG.mjs} +2 -10
  9. package/dist/helper.js +3 -3
  10. package/dist/helper.mjs +2 -2
  11. package/dist/index.d.mts +3 -3
  12. package/dist/index.d.ts +3 -3
  13. package/dist/index.js +43 -43
  14. package/dist/index.mjs +6 -6
  15. package/dist/rpc/bullmq/index.js +12 -12
  16. package/dist/rpc/bullmq/index.mjs +2 -2
  17. package/dist/rpc/kafka/index.js +12 -12
  18. package/dist/rpc/kafka/index.mjs +2 -2
  19. package/dist/rpc/nats/index.js +11 -11
  20. package/dist/rpc/nats/index.mjs +2 -2
  21. package/dist/rpc/rabbitmq/index.js +13 -13
  22. package/dist/rpc/rabbitmq/index.mjs +2 -2
  23. package/dist/rpc/redis/index.js +11 -11
  24. package/dist/rpc/redis/index.mjs +2 -2
  25. package/dist/server/elysia/index.js +32 -32
  26. package/dist/server/elysia/index.mjs +3 -3
  27. package/dist/server/express/index.js +30 -30
  28. package/dist/server/express/index.mjs +2 -2
  29. package/dist/server/fastify/index.js +31 -31
  30. package/dist/server/fastify/index.mjs +3 -3
  31. package/dist/server/h3/index.js +30 -30
  32. package/dist/server/h3/index.mjs +2 -2
  33. package/dist/server/hono/index.js +29 -29
  34. package/dist/server/hono/index.mjs +2 -2
  35. package/dist/server/hyper-express/index.js +29 -29
  36. package/dist/server/hyper-express/index.mjs +2 -2
  37. package/dist/server/koa/index.js +30 -30
  38. package/dist/server/koa/index.mjs +2 -2
  39. package/dist/test.js +6 -6
  40. package/dist/test.mjs +2 -2
  41. package/package.json +2 -1
@@ -5,10 +5,10 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkQYX5Q7KOjs = require('../../chunk-QYX5Q7KO.js');
8
+ var _chunkRZ7IXJYQjs = require('../../chunk-RZ7IXJYQ.js');
9
9
 
10
10
 
11
- var _chunkRVWBJ6LVjs = require('../../chunk-RVWBJ6LV.js');
11
+ var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.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 = _chunkQYX5Q7KOjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
20
+ const metaMap = _chunkRZ7IXJYQjs.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
- _chunkQYX5Q7KOjs.detectAopDep.call(void 0, meta, {
27
+ _chunkRZ7IXJYQjs.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
- _chunkQYX5Q7KOjs.Context.usePlugin(globalPlugins, "koa").forEach((p) => router.use(p));
37
+ _chunkRZ7IXJYQjs.Context.usePlugin(globalPlugins, "koa").forEach((p) => router.use(p));
38
38
  if (parallelRoute) {
39
- router.post(parallelRoute, ..._chunkQYX5Q7KOjs.Context.usePlugin(parallelPlugins, "koa"), async (ctx, next) => {
39
+ router.post(parallelRoute, ..._chunkRZ7IXJYQjs.Context.usePlugin(parallelPlugins, "koa"), async (ctx, next) => {
40
40
  const { body } = ctx.request;
41
41
  async function errorHandler(e) {
42
- const error = await _chunkQYX5Q7KOjs.Context.filterRecord.default(e);
42
+ const error = await _chunkRZ7IXJYQjs.Context.filterRecord.default(e);
43
43
  ctx.status = error.status;
44
44
  ctx.body = error;
45
45
  }
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"));
46
+ _chunkGHFSIZUOjs.__name.call(void 0, errorHandler, "errorHandler");
47
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkRZ7IXJYQjs.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 _chunkQYX5Q7KOjs.Context.filterRecord.default(new (0, _chunkQYX5Q7KOjs.BadRequestException)(`module "${tag}" doesn't exist`)));
53
+ if (!metaMap.has(tag)) return resolve(await _chunkRZ7IXJYQjs.Context.filterRecord.default(new (0, _chunkRZ7IXJYQjs.BadRequestException)(`module "${tag}" doesn't exist`)));
54
54
  const meta2 = metaMap.get(tag)[func];
55
- if (!meta2) return resolve(await _chunkQYX5Q7KOjs.Context.filterRecord.default(new (0, _chunkQYX5Q7KOjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
55
+ if (!meta2) return resolve(await _chunkRZ7IXJYQjs.Context.filterRecord.default(new (0, _chunkRZ7IXJYQjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
56
56
  const { data: { params } } = meta2;
57
57
  const contextData = {
58
58
  type: "koa",
@@ -63,19 +63,19 @@ function bind(router, data, opts = {}) {
63
63
  parallel: true,
64
64
  next,
65
65
  app: router,
66
- ..._chunkQYX5Q7KOjs.argToReq.call(void 0, params, item.args, ctx.headers),
66
+ ..._chunkRZ7IXJYQjs.argToReq.call(void 0, params, item.args, ctx.headers),
67
67
  tag,
68
68
  func,
69
- getCookie: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (key) => ctx.cookies.get(key), "getCookie"),
70
- setCookie: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (key, value, opts2) => ctx.cookies.set(key, value, opts2), "setCookie"),
71
- delCookie: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (key) => ctx.cookies.set(key, "", {
69
+ getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => ctx.cookies.get(key), "getCookie"),
70
+ setCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key, value, opts2) => ctx.cookies.set(key, value, opts2), "setCookie"),
71
+ delCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => ctx.cookies.set(key, "", {
72
72
  expires: /* @__PURE__ */ new Date(0)
73
73
  }), "delCookie"),
74
- redirect: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (url) => ctx.redirect(url), "redirect"),
75
- setResHeaders: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (headers) => ctx.set(headers), "setResHeaders"),
76
- setResStatus: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (status) => ctx.status = status, "setResStatus")
74
+ redirect: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (url) => ctx.redirect(url), "redirect"),
75
+ setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => ctx.set(headers), "setResHeaders"),
76
+ setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => ctx.status = status, "setResStatus")
77
77
  };
78
- const context = new (0, _chunkQYX5Q7KOjs.Context)(contextData);
78
+ const context = new (0, _chunkRZ7IXJYQjs.Context)(contextData);
79
79
  context.run({
80
80
  globalGuards,
81
81
  globalInterceptors,
@@ -96,7 +96,7 @@ function bind(router, data, opts = {}) {
96
96
  const meta2 = metaMap.get(tag)[func];
97
97
  const { data: { plugins, http } } = meta2;
98
98
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
99
- router[http.type](http.prefix + http.route, ..._chunkQYX5Q7KOjs.Context.usePlugin(plugins, "koa"), async (ctx, next) => {
99
+ router[http.type](http.prefix + http.route, ..._chunkRZ7IXJYQjs.Context.usePlugin(plugins, "koa"), async (ctx, next) => {
100
100
  debug(`invoke method "${func}" in module "${tag}"`);
101
101
  const contextData = {
102
102
  type: "koa",
@@ -111,16 +111,16 @@ function bind(router, data, opts = {}) {
111
111
  body: ctx.request.body,
112
112
  headers: ctx.headers,
113
113
  next,
114
- getCookie: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (key) => ctx.cookies.get(key), "getCookie"),
115
- setCookie: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (key, value, opts2) => ctx.cookies.set(key, value, opts2), "setCookie"),
116
- delCookie: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (key) => ctx.cookies.set(key, "", {
114
+ getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => ctx.cookies.get(key), "getCookie"),
115
+ setCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key, value, opts2) => ctx.cookies.set(key, value, opts2), "setCookie"),
116
+ delCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => ctx.cookies.set(key, "", {
117
117
  expires: /* @__PURE__ */ new Date(0)
118
118
  }), "delCookie"),
119
- redirect: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (url) => ctx.redirect(url), "redirect"),
120
- setResHeaders: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (headers) => ctx.set(headers), "setResHeaders"),
121
- setResStatus: /* @__PURE__ */ _chunkRVWBJ6LVjs.__name.call(void 0, (status) => ctx.status = status, "setResStatus")
119
+ redirect: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (url) => ctx.redirect(url), "redirect"),
120
+ setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => ctx.set(headers), "setResHeaders"),
121
+ setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => ctx.status = status, "setResStatus")
122
122
  };
123
- const context = new (0, _chunkQYX5Q7KOjs.Context)(contextData);
123
+ const context = new (0, _chunkRZ7IXJYQjs.Context)(contextData);
124
124
  if (http.headers) ctx.set(http.headers);
125
125
  await context.run({
126
126
  globalGuards,
@@ -139,13 +139,13 @@ function bind(router, data, opts = {}) {
139
139
  }
140
140
  }
141
141
  }
142
- _chunkRVWBJ6LVjs.__name.call(void 0, registerRoute, "registerRoute");
143
- _chunkQYX5Q7KOjs.HMR.call(void 0, async () => {
142
+ _chunkGHFSIZUOjs.__name.call(void 0, registerRoute, "registerRoute");
143
+ _chunkRZ7IXJYQjs.HMR.call(void 0, async () => {
144
144
  router.stack = originStack;
145
145
  registerRoute();
146
146
  });
147
147
  }
148
- _chunkRVWBJ6LVjs.__name.call(void 0, bind, "bind");
148
+ _chunkGHFSIZUOjs.__name.call(void 0, bind, "bind");
149
149
 
150
150
 
151
151
  exports.bind = bind;
@@ -5,10 +5,10 @@ import {
5
5
  argToReq,
6
6
  createControllerMetaMap,
7
7
  detectAopDep
8
- } from "../../chunk-BZKJ5NBU.mjs";
8
+ } from "../../chunk-3IPYLGY2.mjs";
9
9
  import {
10
10
  __name
11
- } from "../../chunk-MESZCLSS.mjs";
11
+ } from "../../chunk-UXD62LGG.mjs";
12
12
 
13
13
  // src/server/koa/bind.ts
14
14
  import Debug from "debug";
package/dist/test.js CHANGED
@@ -1,14 +1,14 @@
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 _chunkN4ULJDEQjs = require('./chunk-N4ULJDEQ.js');
3
+ var _chunk3D7AROG2js = require('./chunk-3D7AROG2.js');
4
4
 
5
5
 
6
- var _chunkRVWBJ6LVjs = require('./chunk-RVWBJ6LV.js');
6
+ var _chunkGHFSIZUOjs = require('./chunk-GHFSIZUO.js');
7
7
 
8
8
  // src/test.ts
9
9
  var _phecdacore = require('phecda-core');
10
10
  async function TestFactory(...Modules) {
11
- const { moduleMap, modelMap } = await _chunkN4ULJDEQjs.Factory.call(void 0, Modules);
11
+ const { moduleMap, modelMap } = await _chunk3D7AROG2js.Factory.call(void 0, Modules);
12
12
  return {
13
13
  get(Model) {
14
14
  const tag = _phecdacore.getTag.call(void 0, Model);
@@ -19,7 +19,7 @@ async function TestFactory(...Modules) {
19
19
  }
20
20
  };
21
21
  }
22
- _chunkRVWBJ6LVjs.__name.call(void 0, TestFactory, "TestFactory");
22
+ _chunkGHFSIZUOjs.__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);
@@ -59,11 +59,11 @@ async function TestHttp(app, { moduleMap, meta }, isAgent = true) {
59
59
  }
60
60
  });
61
61
  }
62
- _chunkRVWBJ6LVjs.__name.call(void 0, module, "module");
62
+ _chunkGHFSIZUOjs.__name.call(void 0, module, "module");
63
63
  Agent.module = module;
64
64
  return Agent;
65
65
  }
66
- _chunkRVWBJ6LVjs.__name.call(void 0, TestHttp, "TestHttp");
66
+ _chunkGHFSIZUOjs.__name.call(void 0, TestHttp, "TestHttp");
67
67
 
68
68
 
69
69
 
package/dist/test.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Factory
3
- } from "./chunk-LHLQIQPH.mjs";
3
+ } from "./chunk-ECSI4QBK.mjs";
4
4
  import {
5
5
  __name
6
- } from "./chunk-MESZCLSS.mjs";
6
+ } from "./chunk-UXD62LGG.mjs";
7
7
 
8
8
  // src/test.ts
9
9
  import { getTag } from "phecda-core";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-server",
3
- "version": "5.3.1",
3
+ "version": "5.3.3",
4
4
  "description": "server framework that provide IOC/type-reuse/http&rpc-adaptor",
5
5
  "author": "fgsreally",
6
6
  "license": "MIT",
@@ -145,6 +145,7 @@
145
145
  "fs-extra": "^11.2.0",
146
146
  "picocolors": "^1.0.0",
147
147
  "reflect-metadata": "^0.1.13",
148
+ "ts-mixer": "^6.0.4",
148
149
  "phecda-core": "3.1.1"
149
150
  },
150
151
  "devDependencies": {