phecda-server 5.3.2 → 6.0.0

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 (69) hide show
  1. package/dist/chunk-2UTKBEZE.mjs +233 -0
  2. package/dist/{chunk-NT6HEBC6.mjs → chunk-HDQAT2IM.mjs} +63 -62
  3. package/dist/{chunk-UIKQNJN3.js → chunk-LYEZ6RGX.js} +62 -61
  4. package/dist/chunk-PALEEADE.js +233 -0
  5. package/dist/{chunk-RZ7IXJYQ.js → chunk-TZYATAJX.js} +12 -30
  6. package/dist/{chunk-3IPYLGY2.mjs → chunk-YUXERDQ6.mjs} +13 -31
  7. package/dist/{core-dx9E5x2N.d.ts → core-Blq8frmr.d.ts} +4 -3
  8. package/dist/{core-Bc2ENEHX.d.mts → core-D2oL8Ge0.d.mts} +4 -3
  9. package/dist/helper.js +2 -2
  10. package/dist/helper.mjs +1 -1
  11. package/dist/index.d.mts +9 -10
  12. package/dist/index.d.ts +9 -10
  13. package/dist/index.js +27 -27
  14. package/dist/index.mjs +6 -6
  15. package/dist/rpc/bullmq/index.d.mts +1 -1
  16. package/dist/rpc/bullmq/index.d.ts +1 -1
  17. package/dist/rpc/bullmq/index.js +6 -6
  18. package/dist/rpc/bullmq/index.mjs +1 -1
  19. package/dist/rpc/kafka/index.d.mts +1 -1
  20. package/dist/rpc/kafka/index.d.ts +1 -1
  21. package/dist/rpc/kafka/index.js +5 -5
  22. package/dist/rpc/kafka/index.mjs +1 -1
  23. package/dist/rpc/nats/index.d.mts +1 -1
  24. package/dist/rpc/nats/index.d.ts +1 -1
  25. package/dist/rpc/nats/index.js +5 -5
  26. package/dist/rpc/nats/index.mjs +1 -1
  27. package/dist/rpc/rabbitmq/index.d.mts +1 -1
  28. package/dist/rpc/rabbitmq/index.d.ts +1 -1
  29. package/dist/rpc/rabbitmq/index.js +6 -6
  30. package/dist/rpc/rabbitmq/index.mjs +1 -1
  31. package/dist/rpc/redis/index.d.mts +1 -1
  32. package/dist/rpc/redis/index.d.ts +1 -1
  33. package/dist/rpc/redis/index.js +6 -6
  34. package/dist/rpc/redis/index.mjs +1 -1
  35. package/dist/server/elysia/index.d.mts +1 -1
  36. package/dist/server/elysia/index.d.ts +1 -1
  37. package/dist/server/elysia/index.js +15 -15
  38. package/dist/server/elysia/index.mjs +2 -2
  39. package/dist/server/express/index.d.mts +1 -1
  40. package/dist/server/express/index.d.ts +1 -1
  41. package/dist/server/express/index.js +14 -14
  42. package/dist/server/express/index.mjs +1 -1
  43. package/dist/server/fastify/index.d.mts +1 -1
  44. package/dist/server/fastify/index.d.ts +1 -1
  45. package/dist/server/fastify/index.js +15 -15
  46. package/dist/server/fastify/index.mjs +2 -2
  47. package/dist/server/h3/index.d.mts +1 -1
  48. package/dist/server/h3/index.d.ts +1 -1
  49. package/dist/server/h3/index.js +12 -12
  50. package/dist/server/h3/index.mjs +1 -1
  51. package/dist/server/hono/index.d.mts +1 -1
  52. package/dist/server/hono/index.d.ts +1 -1
  53. package/dist/server/hono/index.js +13 -13
  54. package/dist/server/hono/index.mjs +1 -1
  55. package/dist/server/hyper-express/index.d.mts +1 -1
  56. package/dist/server/hyper-express/index.d.ts +1 -1
  57. package/dist/server/hyper-express/index.js +13 -13
  58. package/dist/server/hyper-express/index.mjs +1 -1
  59. package/dist/server/koa/index.d.mts +1 -1
  60. package/dist/server/koa/index.d.ts +1 -1
  61. package/dist/server/koa/index.js +14 -14
  62. package/dist/server/koa/index.mjs +1 -1
  63. package/dist/test.d.mts +1 -1
  64. package/dist/test.d.ts +1 -1
  65. package/dist/test.js +2 -2
  66. package/dist/test.mjs +1 -1
  67. package/package.json +2 -2
  68. package/dist/chunk-2HVTWYS2.js +0 -279
  69. package/dist/chunk-SXOZVIKW.mjs +0 -279
@@ -1,13 +1,13 @@
1
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; }
2
2
 
3
- var _chunk2HVTWYS2js = require('../../chunk-2HVTWYS2.js');
3
+ var _chunkPALEEADEjs = require('../../chunk-PALEEADE.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
- var _chunkRZ7IXJYQjs = require('../../chunk-RZ7IXJYQ.js');
10
+ var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
11
11
 
12
12
 
13
13
  var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
@@ -19,14 +19,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/elysia");
19
19
  function bind(app, data, opts = {}) {
20
20
  const { globalGuards, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe } = opts;
21
21
  const { moduleMap, meta } = data;
22
- const metaMap = _chunkRZ7IXJYQjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
+ const metaMap = _chunkTZYATAJXjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
23
23
  const { controller, http, func, tag } = meta2.data;
24
24
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
25
25
  debug(`register method "${func}" in module "${tag}"`);
26
26
  return true;
27
27
  }
28
28
  });
29
- _chunkRZ7IXJYQjs.detectAopDep.call(void 0, meta, {
29
+ _chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
30
30
  plugins: [
31
31
  ...globalPlugins,
32
32
  ...parallelPlugins
@@ -36,27 +36,27 @@ function bind(app, data, opts = {}) {
36
36
  });
37
37
  registerRoute();
38
38
  async function registerRoute() {
39
- _chunkRZ7IXJYQjs.Context.usePlugin(globalPlugins, "elysia").forEach((p) => p(app));
39
+ _chunkTZYATAJXjs.Context.usePlugin(globalPlugins, "elysia").forEach((p) => p(app));
40
40
  const parallelRouter = new (0, _elysia.Elysia)();
41
- _chunkRZ7IXJYQjs.Context.usePlugin(parallelPlugins, "elysia").forEach((p) => p(parallelRouter));
41
+ _chunkTZYATAJXjs.Context.usePlugin(parallelPlugins, "elysia").forEach((p) => p(parallelRouter));
42
42
  if (parallelRoute) {
43
43
  parallelRouter.post(parallelRoute, async (c) => {
44
44
  const { body } = c;
45
45
  async function errorHandler(e) {
46
- const error = await _chunkRZ7IXJYQjs.Context.filterRecord.default(e);
46
+ const error = await _chunkTZYATAJXjs.Context.filterRecord.default(e);
47
47
  c.set.status = error.status;
48
48
  return error;
49
49
  }
50
50
  _chunkGHFSIZUOjs.__name.call(void 0, errorHandler, "errorHandler");
51
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkRZ7IXJYQjs.BadRequestException)("data format should be an array"));
51
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkTZYATAJXjs.BadRequestException)("data format should be an array"));
52
52
  try {
53
53
  return Promise.all(body.map((item, i) => {
54
54
  return new Promise(async (resolve) => {
55
55
  const { tag, func } = item;
56
56
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
57
- if (!metaMap.has(tag)) return resolve(await _chunkRZ7IXJYQjs.Context.filterRecord.default(new (0, _chunkRZ7IXJYQjs.BadRequestException)(`module "${tag}" doesn't exist`)));
57
+ if (!metaMap.has(tag)) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`module "${tag}" doesn't exist`)));
58
58
  const meta2 = metaMap.get(tag)[func];
59
- if (!meta2) return resolve(await _chunkRZ7IXJYQjs.Context.filterRecord.default(new (0, _chunkRZ7IXJYQjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
59
+ if (!meta2) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
60
60
  const { data: { params } } = meta2;
61
61
  const contextData = {
62
62
  type: "elysia",
@@ -68,7 +68,7 @@ function bind(app, data, opts = {}) {
68
68
  tag,
69
69
  func,
70
70
  app,
71
- ..._chunkRZ7IXJYQjs.argToReq.call(void 0, params, item.args, c.headers),
71
+ ..._chunkTZYATAJXjs.argToReq.call(void 0, params, item.args, c.headers),
72
72
  getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => c.cookie[key].value, "getCookie"),
73
73
  setCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key, value, opts2 = {}) => c.cookie[key].set({
74
74
  ...opts2,
@@ -79,7 +79,7 @@ function bind(app, data, opts = {}) {
79
79
  setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
80
80
  setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus")
81
81
  };
82
- const context = new (0, _chunkRZ7IXJYQjs.Context)(contextData);
82
+ const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
83
83
  context.run({
84
84
  globalGuards,
85
85
  globalInterceptors,
@@ -102,7 +102,7 @@ function bind(app, data, opts = {}) {
102
102
  const { data: { define, plugins, http } } = meta2;
103
103
  const funcRouter = new (0, _elysia.Elysia)();
104
104
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
105
- _chunkRZ7IXJYQjs.Context.usePlugin(plugins, "elysia").forEach((p) => p(funcRouter));
105
+ _chunkTZYATAJXjs.Context.usePlugin(plugins, "elysia").forEach((p) => p(funcRouter));
106
106
  funcRouter[http.type](http.prefix + http.route, async (c) => {
107
107
  debug(`invoke method "${func}" in module "${tag}"`);
108
108
  const contextData = {
@@ -127,7 +127,7 @@ function bind(app, data, opts = {}) {
127
127
  setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => Object.assign(c.set.headers, headers), "setResHeaders"),
128
128
  setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => c.set.status = status, "setResStatus")
129
129
  };
130
- const context = new (0, _chunkRZ7IXJYQjs.Context)(contextData);
130
+ const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
131
131
  if (http.headers) c.set.headers = http.headers;
132
132
  return context.run({
133
133
  globalGuards,
@@ -147,7 +147,7 @@ function bind(app, data, opts = {}) {
147
147
  }
148
148
  _chunkGHFSIZUOjs.__name.call(void 0, bind, "bind");
149
149
  function Elysia(opts) {
150
- return _chunk2HVTWYS2js.Define.call(void 0, "elysia", opts);
150
+ return _chunkPALEEADEjs.Define.call(void 0, "elysia", opts);
151
151
  }
152
152
  _chunkGHFSIZUOjs.__name.call(void 0, Elysia, "Elysia");
153
153
 
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  Define
3
- } from "../../chunk-SXOZVIKW.mjs";
3
+ } from "../../chunk-2UTKBEZE.mjs";
4
4
  import {
5
5
  BadRequestException,
6
6
  Context,
7
7
  argToReq,
8
8
  createControllerMetaMap,
9
9
  detectAopDep
10
- } from "../../chunk-3IPYLGY2.mjs";
10
+ } from "../../chunk-YUXERDQ6.mjs";
11
11
  import {
12
12
  __name
13
13
  } from "../../chunk-UXD62LGG.mjs";
@@ -1,6 +1,6 @@
1
1
  import { Request, Response, Router, RequestHandler } from 'express';
2
2
  import { H as HttpContext, a as HttpOptions } from '../../types-Dgxirc9f.mjs';
3
- import { F as Factory } from '../../core-Bc2ENEHX.mjs';
3
+ import { F as Factory } from '../../core-D2oL8Ge0.mjs';
4
4
  import 'node:http';
5
5
  import '../../types-BlIBlnVT.mjs';
6
6
  import 'phecda-core';
@@ -1,6 +1,6 @@
1
1
  import { Request, Response, Router, RequestHandler } from 'express';
2
2
  import { H as HttpContext, a as HttpOptions } from '../../types-BCJhmpQh.js';
3
- import { F as Factory } from '../../core-dx9E5x2N.js';
3
+ import { F as Factory } from '../../core-Blq8frmr.js';
4
4
  import 'node:http';
5
5
  import '../../types-BlIBlnVT.js';
6
6
  import 'phecda-core';
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkRZ7IXJYQjs = require('../../chunk-RZ7IXJYQ.js');
8
+ var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
9
9
 
10
10
 
11
11
  var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
@@ -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 = _chunkRZ7IXJYQjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
20
+ const metaMap = _chunkTZYATAJXjs.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
- _chunkRZ7IXJYQjs.detectAopDep.call(void 0, meta, {
27
+ _chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
28
28
  plugins: [
29
29
  ...globalPlugins,
30
30
  ...parallelPlugins
@@ -33,29 +33,29 @@ function bind(router, data, opts = {}) {
33
33
  interceptors: globalInterceptors
34
34
  });
35
35
  registerRoute();
36
- _chunkRZ7IXJYQjs.HMR.call(void 0, async () => {
36
+ _chunkTZYATAJXjs.HMR.call(void 0, async () => {
37
37
  router.stack = originStack;
38
38
  registerRoute();
39
39
  });
40
40
  async function registerRoute() {
41
- _chunkRZ7IXJYQjs.Context.usePlugin(globalPlugins, "express").forEach((p) => router.use(p));
41
+ _chunkTZYATAJXjs.Context.usePlugin(globalPlugins, "express").forEach((p) => router.use(p));
42
42
  if (parallelRoute) {
43
- router.post(parallelRoute, ..._chunkRZ7IXJYQjs.Context.usePlugin(parallelPlugins, "express"), async (req, res, next) => {
43
+ router.post(parallelRoute, ..._chunkTZYATAJXjs.Context.usePlugin(parallelPlugins, "express"), async (req, res, next) => {
44
44
  const { body } = req;
45
45
  async function errorHandler(e) {
46
- const error = await _chunkRZ7IXJYQjs.Context.filterRecord.default(e);
46
+ const error = await _chunkTZYATAJXjs.Context.filterRecord.default(e);
47
47
  return res.status(error.status).json(error);
48
48
  }
49
49
  _chunkGHFSIZUOjs.__name.call(void 0, errorHandler, "errorHandler");
50
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkRZ7IXJYQjs.BadRequestException)("data format should be an array"));
50
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkTZYATAJXjs.BadRequestException)("data format should be an array"));
51
51
  try {
52
52
  return Promise.all(body.map((item, i) => {
53
53
  return new Promise(async (resolve) => {
54
54
  const { tag, func } = item;
55
55
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
56
- if (!metaMap.has(tag)) return resolve(await _chunkRZ7IXJYQjs.Context.filterRecord.default(new (0, _chunkRZ7IXJYQjs.BadRequestException)(`module "${tag}" doesn't exist`)));
56
+ if (!metaMap.has(tag)) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`module "${tag}" doesn't exist`)));
57
57
  const meta2 = metaMap.get(tag)[func];
58
- if (!meta2) return resolve(await _chunkRZ7IXJYQjs.Context.filterRecord.default(new (0, _chunkRZ7IXJYQjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
58
+ if (!meta2) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
59
59
  const { data: { params } } = meta2;
60
60
  const contextData = {
61
61
  type: "express",
@@ -69,7 +69,7 @@ function bind(router, data, opts = {}) {
69
69
  func,
70
70
  next,
71
71
  app: router,
72
- ..._chunkRZ7IXJYQjs.argToReq.call(void 0, params, item.args, req.headers),
72
+ ..._chunkTZYATAJXjs.argToReq.call(void 0, params, item.args, req.headers),
73
73
  getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
74
74
  setCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key, value, opts2) => res.cookie(key, value, opts2 || {}), "setCookie"),
75
75
  delCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => res.cookie(key, "", {
@@ -79,7 +79,7 @@ function bind(router, data, opts = {}) {
79
79
  setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
80
80
  setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (code) => res.status(code), "setResStatus")
81
81
  };
82
- const context = new (0, _chunkRZ7IXJYQjs.Context)(contextData);
82
+ const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
83
83
  context.run({
84
84
  globalGuards,
85
85
  globalInterceptors,
@@ -100,7 +100,7 @@ function bind(router, data, opts = {}) {
100
100
  const meta2 = metaMap.get(tag)[func];
101
101
  const { data: { plugins, http } } = meta2;
102
102
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
103
- router[http.type](http.prefix + http.route, ..._chunkRZ7IXJYQjs.Context.usePlugin(plugins, "express"), async (req, res, next) => {
103
+ router[http.type](http.prefix + http.route, ..._chunkTZYATAJXjs.Context.usePlugin(plugins, "express"), async (req, res, next) => {
104
104
  debug(`invoke method "${func}" in module "${tag}"`);
105
105
  const contextData = {
106
106
  type: "express",
@@ -125,7 +125,7 @@ function bind(router, data, opts = {}) {
125
125
  setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => res.set(headers), "setResHeaders"),
126
126
  setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (code) => res.status(code), "setResStatus")
127
127
  };
128
- const context = new (0, _chunkRZ7IXJYQjs.Context)(contextData);
128
+ const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
129
129
  if (http.headers) res.set(http.headers);
130
130
  await context.run({
131
131
  globalGuards,
@@ -5,7 +5,7 @@ import {
5
5
  argToReq,
6
6
  createControllerMetaMap,
7
7
  detectAopDep
8
- } from "../../chunk-3IPYLGY2.mjs";
8
+ } from "../../chunk-YUXERDQ6.mjs";
9
9
  import {
10
10
  __name
11
11
  } from "../../chunk-UXD62LGG.mjs";
@@ -1,6 +1,6 @@
1
1
  import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback, FastifyRegisterOptions, FastifyPluginOptions, RouteShorthandOptions } from 'fastify';
2
2
  import { H as HttpContext, a as HttpOptions } from '../../types-Dgxirc9f.mjs';
3
- import { F as Factory } from '../../core-Bc2ENEHX.mjs';
3
+ import { F as Factory } from '../../core-D2oL8Ge0.mjs';
4
4
  import 'node:http';
5
5
  import '../../types-BlIBlnVT.mjs';
6
6
  import 'phecda-core';
@@ -1,6 +1,6 @@
1
1
  import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback, FastifyRegisterOptions, FastifyPluginOptions, RouteShorthandOptions } from 'fastify';
2
2
  import { H as HttpContext, a as HttpOptions } from '../../types-BCJhmpQh.js';
3
- import { F as Factory } from '../../core-dx9E5x2N.js';
3
+ import { F as Factory } from '../../core-Blq8frmr.js';
4
4
  import 'node:http';
5
5
  import '../../types-BlIBlnVT.js';
6
6
  import 'phecda-core';
@@ -1,13 +1,13 @@
1
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; }
2
2
 
3
- var _chunk2HVTWYS2js = require('../../chunk-2HVTWYS2.js');
3
+ var _chunkPALEEADEjs = require('../../chunk-PALEEADE.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
- var _chunkRZ7IXJYQjs = require('../../chunk-RZ7IXJYQ.js');
10
+ var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
11
11
 
12
12
 
13
13
  var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
@@ -18,14 +18,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/fastify");
18
18
  function bind(fastify, data, opts = {}) {
19
19
  const { globalGuards, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe, fastifyOpts } = opts;
20
20
  const { moduleMap, meta } = data;
21
- const metaMap = _chunkRZ7IXJYQjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
21
+ const metaMap = _chunkTZYATAJXjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
22
22
  const { controller, http, func, tag } = meta2.data;
23
23
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _2 => _2.type])) {
24
24
  debug(`register method "${func}" in module "${tag}"`);
25
25
  return true;
26
26
  }
27
27
  });
28
- _chunkRZ7IXJYQjs.detectAopDep.call(void 0, meta, {
28
+ _chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
29
29
  plugins: [
30
30
  ...globalPlugins,
31
31
  ...parallelPlugins
@@ -34,12 +34,12 @@ function bind(fastify, data, opts = {}) {
34
34
  interceptors: globalInterceptors
35
35
  });
36
36
  fastify.register((fastify2, _, done) => {
37
- _chunkRZ7IXJYQjs.Context.usePlugin(globalPlugins, "fastify").forEach((p) => {
37
+ _chunkTZYATAJXjs.Context.usePlugin(globalPlugins, "fastify").forEach((p) => {
38
38
  p[Symbol.for("skip-override")] = true;
39
39
  fastify2.register(p);
40
40
  });
41
41
  fastify2.register((fastify3, _opts, done2) => {
42
- _chunkRZ7IXJYQjs.Context.usePlugin(parallelPlugins, "fastify").forEach((p) => {
42
+ _chunkTZYATAJXjs.Context.usePlugin(parallelPlugins, "fastify").forEach((p) => {
43
43
  p[Symbol.for("skip-override")] = true;
44
44
  fastify3.register(p);
45
45
  });
@@ -47,19 +47,19 @@ function bind(fastify, data, opts = {}) {
47
47
  fastify3.post(parallelRoute, async (req, res) => {
48
48
  const { body } = req;
49
49
  async function errorHandler(e) {
50
- const error = await _chunkRZ7IXJYQjs.Context.filterRecord.default(e);
50
+ const error = await _chunkTZYATAJXjs.Context.filterRecord.default(e);
51
51
  return res.status(error.status).send(error);
52
52
  }
53
53
  _chunkGHFSIZUOjs.__name.call(void 0, errorHandler, "errorHandler");
54
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkRZ7IXJYQjs.BadRequestException)("data format should be an array"));
54
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkTZYATAJXjs.BadRequestException)("data format should be an array"));
55
55
  try {
56
56
  return Promise.all(body.map((item, i) => {
57
57
  return new Promise(async (resolve) => {
58
58
  const { tag, func } = item;
59
59
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
60
- if (!metaMap.has(tag)) return resolve(await _chunkRZ7IXJYQjs.Context.filterRecord.default(new (0, _chunkRZ7IXJYQjs.BadRequestException)(`module "${tag}" doesn't exist`)));
60
+ if (!metaMap.has(tag)) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`module "${tag}" doesn't exist`)));
61
61
  const meta2 = metaMap.get(tag)[func];
62
- if (!meta2) return resolve(await _chunkRZ7IXJYQjs.Context.filterRecord.default(new (0, _chunkRZ7IXJYQjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
62
+ if (!meta2) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
63
63
  const { data: { params } } = meta2;
64
64
  const contextData = {
65
65
  type: "fastify",
@@ -72,7 +72,7 @@ function bind(fastify, data, opts = {}) {
72
72
  tag,
73
73
  func,
74
74
  app: fastify3,
75
- ..._chunkRZ7IXJYQjs.argToReq.call(void 0, params, item.args, req.headers),
75
+ ..._chunkTZYATAJXjs.argToReq.call(void 0, params, item.args, req.headers),
76
76
  // @ts-expect-error need @fastify/cookie
77
77
  getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => req.cookies[key], "getCookie"),
78
78
  // @ts-expect-error need @fastify/cookie
@@ -83,7 +83,7 @@ function bind(fastify, data, opts = {}) {
83
83
  setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => res.headers(headers), "setResHeaders"),
84
84
  setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (code) => res.status(code), "setResStatus")
85
85
  };
86
- const context = new (0, _chunkRZ7IXJYQjs.Context)(contextData);
86
+ const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
87
87
  context.run({
88
88
  globalGuards,
89
89
  globalInterceptors,
@@ -107,7 +107,7 @@ function bind(fastify, data, opts = {}) {
107
107
  const { data: { plugins, define, http } } = meta2;
108
108
  if (!_optionalChain([http, 'optionalAccess', _3 => _3.type])) continue;
109
109
  fastify2.register((fastify3, _opts, done2) => {
110
- _chunkRZ7IXJYQjs.Context.usePlugin(plugins, "fastify").forEach((p) => {
110
+ _chunkTZYATAJXjs.Context.usePlugin(plugins, "fastify").forEach((p) => {
111
111
  p[Symbol.for("skip-override")] = true;
112
112
  fastify3.register(p);
113
113
  });
@@ -138,7 +138,7 @@ function bind(fastify, data, opts = {}) {
138
138
  setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => res.headers(headers), "setResHeaders"),
139
139
  setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (code) => res.status(code), "setResStatus")
140
140
  };
141
- const context = new (0, _chunkRZ7IXJYQjs.Context)(contextData);
141
+ const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
142
142
  if (http.headers) res.headers(http.headers);
143
143
  return context.run({
144
144
  globalGuards,
@@ -162,7 +162,7 @@ function bind(fastify, data, opts = {}) {
162
162
  }
163
163
  _chunkGHFSIZUOjs.__name.call(void 0, bind, "bind");
164
164
  function Fastify(opts) {
165
- return _chunk2HVTWYS2js.Define.call(void 0, "fastify", opts);
165
+ return _chunkPALEEADEjs.Define.call(void 0, "fastify", opts);
166
166
  }
167
167
  _chunkGHFSIZUOjs.__name.call(void 0, Fastify, "Fastify");
168
168
 
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  Define
3
- } from "../../chunk-SXOZVIKW.mjs";
3
+ } from "../../chunk-2UTKBEZE.mjs";
4
4
  import {
5
5
  BadRequestException,
6
6
  Context,
7
7
  argToReq,
8
8
  createControllerMetaMap,
9
9
  detectAopDep
10
- } from "../../chunk-3IPYLGY2.mjs";
10
+ } from "../../chunk-YUXERDQ6.mjs";
11
11
  import {
12
12
  __name
13
13
  } from "../../chunk-UXD62LGG.mjs";
@@ -1,5 +1,5 @@
1
1
  import { H3Event, Router, _RequestMiddleware } from 'h3';
2
- import { F as Factory } from '../../core-Bc2ENEHX.mjs';
2
+ import { F as Factory } from '../../core-D2oL8Ge0.mjs';
3
3
  import { H as HttpContext, a as HttpOptions } from '../../types-Dgxirc9f.mjs';
4
4
  import 'phecda-core';
5
5
  import '../../types-BlIBlnVT.mjs';
@@ -1,5 +1,5 @@
1
1
  import { H3Event, Router, _RequestMiddleware } from 'h3';
2
- import { F as Factory } from '../../core-dx9E5x2N.js';
2
+ import { F as Factory } from '../../core-Blq8frmr.js';
3
3
  import { H as HttpContext, a as HttpOptions } from '../../types-BCJhmpQh.js';
4
4
  import 'phecda-core';
5
5
  import '../../types-BlIBlnVT.js';
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkRZ7IXJYQjs = require('../../chunk-RZ7IXJYQ.js');
7
+ var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
8
8
 
9
9
 
10
10
  var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
@@ -16,14 +16,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/h3");
16
16
  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
- const metaMap = _chunkRZ7IXJYQjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
19
+ const metaMap = _chunkTZYATAJXjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
20
20
  const { controller, http, func, tag } = meta2.data;
21
21
  if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
22
22
  debug(`register method "${func}" in module "${tag}"`);
23
23
  return true;
24
24
  }
25
25
  });
26
- _chunkRZ7IXJYQjs.detectAopDep.call(void 0, meta, {
26
+ _chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
27
27
  plugins: [
28
28
  ...globalPlugins,
29
29
  ...parallelPlugins
@@ -35,7 +35,7 @@ function bind(router, data, opts = {}) {
35
35
  async function registerRoute() {
36
36
  if (parallelRoute) {
37
37
  router.post(parallelRoute, _h3.eventHandler.call(void 0, {
38
- onRequest: _chunkRZ7IXJYQjs.Context.usePlugin([
38
+ onRequest: _chunkTZYATAJXjs.Context.usePlugin([
39
39
  ...globalPlugins,
40
40
  ...parallelPlugins
41
41
  ], "h3").map(_h3.defineRequestMiddleware),
@@ -44,20 +44,20 @@ function bind(router, data, opts = {}) {
44
44
  strict: true
45
45
  });
46
46
  async function errorHandler(e) {
47
- const error = await _chunkRZ7IXJYQjs.Context.filterRecord.default(e);
47
+ const error = await _chunkTZYATAJXjs.Context.filterRecord.default(e);
48
48
  _h3.setResponseStatus.call(void 0, event, error.status);
49
49
  return error;
50
50
  }
51
51
  _chunkGHFSIZUOjs.__name.call(void 0, errorHandler, "errorHandler");
52
- if (!Array.isArray(body)) return errorHandler(new (0, _chunkRZ7IXJYQjs.BadRequestException)("data format should be an array"));
52
+ if (!Array.isArray(body)) return errorHandler(new (0, _chunkTZYATAJXjs.BadRequestException)("data format should be an array"));
53
53
  try {
54
54
  return Promise.all(body.map((item, i) => {
55
55
  return new Promise(async (resolve) => {
56
56
  const { tag, func } = item;
57
57
  debug(`(parallel)invoke method "${func}" in module "${tag}"`);
58
- if (!metaMap.has(tag)) return resolve(await _chunkRZ7IXJYQjs.Context.filterRecord.default(new (0, _chunkRZ7IXJYQjs.BadRequestException)(`module "${tag}" doesn't exist`)));
58
+ if (!metaMap.has(tag)) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`module "${tag}" doesn't exist`)));
59
59
  const meta2 = metaMap.get(tag)[func];
60
- if (!meta2) return resolve(await _chunkRZ7IXJYQjs.Context.filterRecord.default(new (0, _chunkRZ7IXJYQjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
60
+ if (!meta2) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
61
61
  const { data: { params } } = meta2;
62
62
  const contextData = {
63
63
  type: "h3",
@@ -69,7 +69,7 @@ function bind(router, data, opts = {}) {
69
69
  func,
70
70
  parallel: true,
71
71
  app: router,
72
- ..._chunkRZ7IXJYQjs.argToReq.call(void 0, params, item.args, _h3.getRequestHeaders.call(void 0, event)),
72
+ ..._chunkTZYATAJXjs.argToReq.call(void 0, params, item.args, _h3.getRequestHeaders.call(void 0, event)),
73
73
  getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => _h3.getCookie.call(void 0, event, key), "getCookie"),
74
74
  setCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key, value, opts2) => _h3.setCookie.call(void 0, event, key, value, opts2), "setCookie"),
75
75
  delCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => _h3.deleteCookie.call(void 0, event, key), "delCookie"),
@@ -77,7 +77,7 @@ function bind(router, data, opts = {}) {
77
77
  setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => _h3.setResponseHeaders.call(void 0, event, headers), "setResHeaders"),
78
78
  setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (code) => _h3.setResponseStatus.call(void 0, event, code), "setResStatus")
79
79
  };
80
- const context = new (0, _chunkRZ7IXJYQjs.Context)(contextData);
80
+ const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
81
81
  context.run({
82
82
  globalGuards,
83
83
  globalInterceptors,
@@ -99,7 +99,7 @@ function bind(router, data, opts = {}) {
99
99
  if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
100
100
  const needBody = params.some((item) => item.type === "body");
101
101
  router[http.type](http.prefix + http.route, _h3.eventHandler.call(void 0, {
102
- onRequest: _chunkRZ7IXJYQjs.Context.usePlugin([
102
+ onRequest: _chunkTZYATAJXjs.Context.usePlugin([
103
103
  ...globalPlugins,
104
104
  ...plugins
105
105
  ], "h3").map(_h3.defineRequestMiddleware),
@@ -126,7 +126,7 @@ function bind(router, data, opts = {}) {
126
126
  setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (code) => _h3.setResponseStatus.call(void 0, event, code), "setResStatus"),
127
127
  delCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => _h3.deleteCookie.call(void 0, event, key), "delCookie")
128
128
  };
129
- const context = new (0, _chunkRZ7IXJYQjs.Context)(contextData);
129
+ const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
130
130
  _h3.setHeaders.call(void 0, event, http.headers || {});
131
131
  return context.run({
132
132
  globalGuards,
@@ -4,7 +4,7 @@ import {
4
4
  argToReq,
5
5
  createControllerMetaMap,
6
6
  detectAopDep
7
- } from "../../chunk-3IPYLGY2.mjs";
7
+ } from "../../chunk-YUXERDQ6.mjs";
8
8
  import {
9
9
  __name
10
10
  } from "../../chunk-UXD62LGG.mjs";
@@ -1,6 +1,6 @@
1
1
  import { Context, Hono, MiddlewareHandler } from 'hono';
2
2
  import { H as HttpContext, a as HttpOptions } from '../../types-Dgxirc9f.mjs';
3
- import { F as Factory } from '../../core-Bc2ENEHX.mjs';
3
+ import { F as Factory } from '../../core-D2oL8Ge0.mjs';
4
4
  import 'node:http';
5
5
  import '../../types-BlIBlnVT.mjs';
6
6
  import 'phecda-core';
@@ -1,6 +1,6 @@
1
1
  import { Context, Hono, MiddlewareHandler } from 'hono';
2
2
  import { H as HttpContext, a as HttpOptions } from '../../types-BCJhmpQh.js';
3
- import { F as Factory } from '../../core-dx9E5x2N.js';
3
+ import { F as Factory } from '../../core-Blq8frmr.js';
4
4
  import 'node:http';
5
5
  import '../../types-BlIBlnVT.js';
6
6
  import 'phecda-core';