phecda-server 5.0.0-beta.20 → 5.0.0-beta.21

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkWNTTAFLCjs = require('../../chunk-WNTTAFLC.js');
5
+ var _chunk562XCEUUjs = require('../../chunk-562XCEUU.js');
6
6
 
7
7
 
8
8
 
@@ -14,7 +14,7 @@ async function bind(ch, queue, { moduleMap, meta }, opts) {
14
14
  const existQueue = /* @__PURE__ */ new Set();
15
15
  const { globalGuards = [], globalInterceptors = [] } = opts || {};
16
16
  function handleMeta() {
17
- _chunkXHKBG2VAjs.IS_DEV && _chunkWNTTAFLCjs.isAopDepInject.call(void 0, meta, {
17
+ _chunkXHKBG2VAjs.IS_DEV && _chunk562XCEUUjs.isAopDepInject.call(void 0, meta, {
18
18
  guards: globalGuards,
19
19
  interceptors: globalInterceptors
20
20
  });
@@ -35,14 +35,14 @@ async function bind(ch, queue, { moduleMap, meta }, opts) {
35
35
  await ch.assertQueue(queue2);
36
36
  if (!metaMap.has(tag)) {
37
37
  queue2 && ch.sendToQueue(queue2, Buffer.from(JSON.stringify({
38
- data: new (0, _chunkWNTTAFLCjs.BadRequestException)(`service "${tag}" doesn't exist`).data,
38
+ data: new (0, _chunk562XCEUUjs.BadRequestException)(`service "${tag}" doesn't exist`).data,
39
39
  error: true,
40
40
  id
41
41
  })));
42
42
  return;
43
43
  }
44
44
  const meta2 = metaMap.get(tag);
45
- const context = new (0, _chunkWNTTAFLCjs.Context)({
45
+ const context = new (0, _chunk562XCEUUjs.Context)({
46
46
  type: "rabbitmq",
47
47
  moduleMap,
48
48
  meta: meta2,
@@ -2,7 +2,7 @@ import {
2
2
  BadRequestException,
3
3
  Context,
4
4
  isAopDepInject
5
- } from "../../chunk-PXI5J4LR.mjs";
5
+ } from "../../chunk-AL36AJMH.mjs";
6
6
  import {
7
7
  IS_DEV,
8
8
  __name
@@ -1,5 +1,5 @@
1
1
  import Redis from 'ioredis';
2
- import { P, F as Factory, T as ToControllerMap } from '../../core-d11fe855.js';
2
+ import { P, F as Factory, T as ToClientMap } from '../../core-895ed04d.js';
3
3
  import 'phecda-core';
4
4
  import 'node:http';
5
5
 
@@ -16,6 +16,6 @@ interface RedisCtx extends P.BaseContext {
16
16
  }
17
17
  declare function bind(redis: Redis, channel: string, { moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: Options): void;
18
18
 
19
- declare function createClient<S extends Record<string, any>>(redis: Redis, queue: string, controllers: S): ToControllerMap<S>;
19
+ declare function createClient<S extends Record<string, any>>(redis: Redis, queue: string, controllers: S): ToClientMap<S>;
20
20
 
21
21
  export { Options, RedisCtx, bind, createClient };
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkWNTTAFLCjs = require('../../chunk-WNTTAFLC.js');
5
+ var _chunk562XCEUUjs = require('../../chunk-562XCEUU.js');
6
6
 
7
7
 
8
8
 
@@ -15,7 +15,7 @@ function bind(redis, channel, { moduleMap, meta }, opts) {
15
15
  const pub = new (0, _ioredis2.default)(redis.options);
16
16
  const { globalGuards = [], globalInterceptors = [] } = opts || {};
17
17
  function handleMeta() {
18
- _chunkXHKBG2VAjs.IS_DEV && _chunkWNTTAFLCjs.isAopDepInject.call(void 0, meta, {
18
+ _chunkXHKBG2VAjs.IS_DEV && _chunk562XCEUUjs.isAopDepInject.call(void 0, meta, {
19
19
  guards: globalGuards,
20
20
  interceptors: globalInterceptors
21
21
  });
@@ -34,14 +34,14 @@ function bind(redis, channel, { moduleMap, meta }, opts) {
34
34
  const { tag, args, id, queue } = data;
35
35
  if (!metaMap.has(tag)) {
36
36
  queue && pub.publish(queue, JSON.stringify({
37
- data: new (0, _chunkWNTTAFLCjs.BadRequestException)(`service "${tag}" doesn't exist`).data,
37
+ data: new (0, _chunk562XCEUUjs.BadRequestException)(`service "${tag}" doesn't exist`).data,
38
38
  error: true,
39
39
  id
40
40
  }));
41
41
  return;
42
42
  }
43
43
  const meta2 = metaMap.get(tag);
44
- const context = new (0, _chunkWNTTAFLCjs.Context)({
44
+ const context = new (0, _chunk562XCEUUjs.Context)({
45
45
  type: "redis",
46
46
  moduleMap,
47
47
  redis,
@@ -2,7 +2,7 @@ import {
2
2
  BadRequestException,
3
3
  Context,
4
4
  isAopDepInject
5
- } from "../../chunk-PXI5J4LR.mjs";
5
+ } from "../../chunk-AL36AJMH.mjs";
6
6
  import {
7
7
  IS_DEV,
8
8
  __name
@@ -1,5 +1,5 @@
1
1
  import { Request, Response, Router } from 'express';
2
- import { P, F as Factory } from '../../core-d11fe855.js';
2
+ import { P, F as Factory } from '../../core-895ed04d.js';
3
3
  import 'phecda-core';
4
4
  import 'node:http';
5
5
 
@@ -6,7 +6,7 @@ var _chunkEVF2CXTPjs = require('../../chunk-EVF2CXTP.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkWNTTAFLCjs = require('../../chunk-WNTTAFLC.js');
9
+ var _chunk562XCEUUjs = require('../../chunk-562XCEUU.js');
10
10
 
11
11
 
12
12
 
@@ -25,7 +25,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
25
25
  plugins: [],
26
26
  ...options
27
27
  };
28
- _chunkXHKBG2VAjs.IS_DEV && _chunkWNTTAFLCjs.isAopDepInject.call(void 0, meta, {
28
+ _chunkXHKBG2VAjs.IS_DEV && _chunk562XCEUUjs.isAopDepInject.call(void 0, meta, {
29
29
  plugins,
30
30
  guards: globalGuards,
31
31
  interceptors: globalInterceptors
@@ -52,22 +52,22 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
52
52
  req[_chunkXHKBG2VAjs.MODULE_SYMBOL] = moduleMap;
53
53
  req[_chunkXHKBG2VAjs.META_SYMBOL] = meta;
54
54
  next();
55
- }, ..._chunkWNTTAFLCjs.Context.usePlugin(plugins), async (req, res, next) => {
55
+ }, ..._chunk562XCEUUjs.Context.usePlugin(plugins), async (req, res, next) => {
56
56
  const { body } = req;
57
57
  async function errorHandler(e) {
58
- const error = await _chunkWNTTAFLCjs.Context.filterRecord.default(e);
58
+ const error = await _chunk562XCEUUjs.Context.filterRecord.default(e);
59
59
  return res.status(error.status).json(error);
60
60
  }
61
61
  _chunkXHKBG2VAjs.__name.call(void 0, errorHandler, "errorHandler");
62
62
  if (!Array.isArray(body))
63
- return errorHandler(new (0, _chunkWNTTAFLCjs.BadRequestException)("data format should be an array"));
63
+ return errorHandler(new (0, _chunk562XCEUUjs.BadRequestException)("data format should be an array"));
64
64
  try {
65
65
  return Promise.all(body.map((item, i) => {
66
66
  return new Promise(async (resolve) => {
67
67
  const { tag } = item;
68
68
  const meta2 = metaMap.get(tag);
69
69
  if (!meta2)
70
- return resolve(await _chunkWNTTAFLCjs.Context.filterRecord.default(new (0, _chunkWNTTAFLCjs.BadRequestException)(`"${tag}" doesn't exist`)));
70
+ return resolve(await _chunk562XCEUUjs.Context.filterRecord.default(new (0, _chunk562XCEUUjs.BadRequestException)(`"${tag}" doesn't exist`)));
71
71
  const [name, method] = tag.split("-");
72
72
  const { paramsType, data: { ctx, params, guards, interceptors, filter } } = meta2;
73
73
  const instance = moduleMap.get(name);
@@ -80,9 +80,10 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
80
80
  moduleMap,
81
81
  tag,
82
82
  next,
83
+ data: req.data,
83
84
  ..._chunkEVF2CXTPjs.argToReq.call(void 0, params, item.args, req.headers)
84
85
  };
85
- const context = new (0, _chunkWNTTAFLCjs.Context)(contextData);
86
+ const context = new (0, _chunk562XCEUUjs.Context)(contextData);
86
87
  try {
87
88
  await context.useGuard([
88
89
  ...globalGuards,
@@ -130,7 +131,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
130
131
  req[_chunkXHKBG2VAjs.MODULE_SYMBOL] = moduleMap;
131
132
  req[_chunkXHKBG2VAjs.META_SYMBOL] = meta;
132
133
  next();
133
- }, ..._chunkWNTTAFLCjs.Context.usePlugin(plugins2), async (req, res, next) => {
134
+ }, ..._chunk562XCEUUjs.Context.usePlugin(plugins2), async (req, res, next) => {
134
135
  const instance = moduleMap.get(tag);
135
136
  const contextData = {
136
137
  type: "express",
@@ -144,9 +145,10 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
144
145
  body: req.body,
145
146
  params: req.params,
146
147
  headers: req.headers,
148
+ data: req.data,
147
149
  next
148
150
  };
149
- const context = new (0, _chunkWNTTAFLCjs.Context)(contextData);
151
+ const context = new (0, _chunk562XCEUUjs.Context)(contextData);
150
152
  try {
151
153
  for (const name in header)
152
154
  res.set(name, header[name]);
@@ -200,7 +202,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
200
202
  createRoute();
201
203
  if (_chunkXHKBG2VAjs.IS_DEV) {
202
204
  _optionalChain([globalThis, 'access', _3 => _3.__PS_HMR__, 'optionalAccess', _4 => _4.push, 'call', _5 => _5(async () => {
203
- _chunkWNTTAFLCjs.isAopDepInject.call(void 0, meta, {
205
+ _chunk562XCEUUjs.isAopDepInject.call(void 0, meta, {
204
206
  plugins,
205
207
  guards: globalGuards,
206
208
  interceptors: globalInterceptors
@@ -6,7 +6,7 @@ import {
6
6
  BadRequestException,
7
7
  Context,
8
8
  isAopDepInject
9
- } from "../../chunk-PXI5J4LR.mjs";
9
+ } from "../../chunk-AL36AJMH.mjs";
10
10
  import {
11
11
  APP_SYMBOL,
12
12
  IS_DEV,
@@ -80,6 +80,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
80
80
  moduleMap,
81
81
  tag,
82
82
  next,
83
+ data: req.data,
83
84
  ...argToReq(params, item.args, req.headers)
84
85
  };
85
86
  const context = new Context(contextData);
@@ -144,6 +145,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
144
145
  body: req.body,
145
146
  params: req.params,
146
147
  headers: req.headers,
148
+ data: req.data,
147
149
  next
148
150
  };
149
151
  const context = new Context(contextData);
@@ -1,5 +1,5 @@
1
1
  import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback } from 'fastify';
2
- import { P, F as Factory } from '../../core-d11fe855.js';
2
+ import { P, F as Factory } from '../../core-895ed04d.js';
3
3
  import 'phecda-core';
4
4
  import 'node:http';
5
5
 
@@ -6,7 +6,7 @@ var _chunkEVF2CXTPjs = require('../../chunk-EVF2CXTP.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkWNTTAFLCjs = require('../../chunk-WNTTAFLC.js');
9
+ var _chunk562XCEUUjs = require('../../chunk-562XCEUU.js');
10
10
 
11
11
 
12
12
 
@@ -28,7 +28,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
28
28
  moduleMap,
29
29
  meta
30
30
  };
31
- _chunkXHKBG2VAjs.IS_DEV && _chunkWNTTAFLCjs.isAopDepInject.call(void 0, meta, {
31
+ _chunkXHKBG2VAjs.IS_DEV && _chunk562XCEUUjs.isAopDepInject.call(void 0, meta, {
32
32
  plugins,
33
33
  guards: globalGuards,
34
34
  interceptors: globalInterceptors
@@ -51,9 +51,12 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
51
51
  moduleMap,
52
52
  meta
53
53
  };
54
+ fastify.decorateRequest("data", {});
55
+ fastify.decorateRequest(_chunkXHKBG2VAjs.MODULE_SYMBOL);
56
+ fastify.decorateRequest(_chunkXHKBG2VAjs.META_SYMBOL);
54
57
  fastify.register((fastify2, _opts, done2) => {
55
58
  plugins.forEach((p) => {
56
- const plugin = _chunkWNTTAFLCjs.Context.usePlugin([
59
+ const plugin = _chunk562XCEUUjs.Context.usePlugin([
57
60
  p
58
61
  ])[0];
59
62
  if (plugin) {
@@ -64,19 +67,19 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
64
67
  fastify2.post(route, async (req, res) => {
65
68
  const { body } = req;
66
69
  async function errorHandler(e) {
67
- const error = await _chunkWNTTAFLCjs.Context.filterRecord.default(e);
70
+ const error = await _chunk562XCEUUjs.Context.filterRecord.default(e);
68
71
  return res.status(error.status).send(error);
69
72
  }
70
73
  _chunkXHKBG2VAjs.__name.call(void 0, errorHandler, "errorHandler");
71
74
  if (!Array.isArray(body))
72
- return errorHandler(new (0, _chunkWNTTAFLCjs.BadRequestException)("data format should be an array"));
75
+ return errorHandler(new (0, _chunk562XCEUUjs.BadRequestException)("data format should be an array"));
73
76
  try {
74
77
  return Promise.all(body.map((item, i) => {
75
78
  return new Promise(async (resolve) => {
76
79
  const { tag } = item;
77
80
  const meta2 = metaMap.get(tag);
78
81
  if (!meta2)
79
- return resolve(await _chunkWNTTAFLCjs.Context.filterRecord.default(new (0, _chunkWNTTAFLCjs.BadRequestException)(`"${tag}" doesn't exist`)));
82
+ return resolve(await _chunk562XCEUUjs.Context.filterRecord.default(new (0, _chunk562XCEUUjs.BadRequestException)(`"${tag}" doesn't exist`)));
80
83
  const [name, method] = tag.split("-");
81
84
  const { paramsType, data: { ctx, params, guards, interceptors, filter } } = meta2;
82
85
  const instance = moduleMap.get(name);
@@ -88,12 +91,13 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
88
91
  response: res,
89
92
  moduleMap,
90
93
  tag,
94
+ data: req.data,
91
95
  ..._chunkEVF2CXTPjs.argToReq.call(void 0, params, item.args, req.headers)
92
96
  };
93
- const context = new (0, _chunkWNTTAFLCjs.Context)(contextData);
97
+ const context = new (0, _chunk562XCEUUjs.Context)(contextData);
94
98
  try {
95
99
  if (!params)
96
- throw new (0, _chunkWNTTAFLCjs.BadRequestException)(`"${tag}" doesn't exist`);
100
+ throw new (0, _chunk562XCEUUjs.BadRequestException)(`"${tag}" doesn't exist`);
97
101
  await context.useGuard([
98
102
  ...globalGuards,
99
103
  ...guards
@@ -139,7 +143,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
139
143
  const methodTag = `${tag}-${method}`;
140
144
  const { paramsType, data: { interceptors, guards, params, plugins: plugins2, filter, ctx } } = metaMap.get(methodTag);
141
145
  fastify.register((fastify2, _opts, done2) => {
142
- _chunkWNTTAFLCjs.Context.usePlugin(plugins2).forEach((p) => {
146
+ _chunk562XCEUUjs.Context.usePlugin(plugins2).forEach((p) => {
143
147
  p[Symbol.for("skip-override")] = true;
144
148
  fastify2.register(p);
145
149
  });
@@ -157,9 +161,10 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
157
161
  query: req.query,
158
162
  body: req.body,
159
163
  params: req.params,
160
- headers: req.headers
164
+ headers: req.headers,
165
+ data: req.data
161
166
  };
162
- const context = new (0, _chunkWNTTAFLCjs.Context)(contextData);
167
+ const context = new (0, _chunk562XCEUUjs.Context)(contextData);
163
168
  try {
164
169
  for (const name in header)
165
170
  res.header(name, header[name]);
@@ -204,7 +209,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
204
209
  done();
205
210
  if (_chunkXHKBG2VAjs.IS_DEV) {
206
211
  _optionalChain([globalThis, 'access', _4 => _4.__PS_HMR__, 'optionalAccess', _5 => _5.push, 'call', _6 => _6(async () => {
207
- _chunkWNTTAFLCjs.isAopDepInject.call(void 0, meta, {
212
+ _chunk562XCEUUjs.isAopDepInject.call(void 0, meta, {
208
213
  plugins,
209
214
  guards: globalGuards,
210
215
  interceptors: globalInterceptors
@@ -6,7 +6,7 @@ import {
6
6
  BadRequestException,
7
7
  Context,
8
8
  isAopDepInject
9
- } from "../../chunk-PXI5J4LR.mjs";
9
+ } from "../../chunk-AL36AJMH.mjs";
10
10
  import {
11
11
  APP_SYMBOL,
12
12
  IS_DEV,
@@ -51,6 +51,9 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
51
51
  moduleMap,
52
52
  meta
53
53
  };
54
+ fastify.decorateRequest("data", {});
55
+ fastify.decorateRequest(MODULE_SYMBOL);
56
+ fastify.decorateRequest(META_SYMBOL);
54
57
  fastify.register((fastify2, _opts, done2) => {
55
58
  plugins.forEach((p) => {
56
59
  const plugin = Context.usePlugin([
@@ -88,6 +91,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
88
91
  response: res,
89
92
  moduleMap,
90
93
  tag,
94
+ data: req.data,
91
95
  ...argToReq(params, item.args, req.headers)
92
96
  };
93
97
  const context = new Context(contextData);
@@ -157,7 +161,8 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
157
161
  query: req.query,
158
162
  body: req.body,
159
163
  params: req.params,
160
- headers: req.headers
164
+ headers: req.headers,
165
+ data: req.data
161
166
  };
162
167
  const context = new Context(contextData);
163
168
  try {
@@ -1,5 +1,5 @@
1
1
  import { H3Event, Router } from 'h3';
2
- import { P, F as Factory } from '../../core-d11fe855.js';
2
+ import { P, F as Factory } from '../../core-895ed04d.js';
3
3
  import 'phecda-core';
4
4
  import 'node:http';
5
5
 
@@ -6,7 +6,7 @@ var _chunkEVF2CXTPjs = require('../../chunk-EVF2CXTP.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkWNTTAFLCjs = require('../../chunk-WNTTAFLC.js');
9
+ var _chunk562XCEUUjs = require('../../chunk-562XCEUU.js');
10
10
 
11
11
 
12
12
 
@@ -25,7 +25,7 @@ function bindApp(router, { moduleMap, meta }, options = {}) {
25
25
  plugins: [],
26
26
  ...options
27
27
  };
28
- _chunkXHKBG2VAjs.IS_DEV && _chunkWNTTAFLCjs.isAopDepInject.call(void 0, meta, {
28
+ _chunkXHKBG2VAjs.IS_DEV && _chunk562XCEUUjs.isAopDepInject.call(void 0, meta, {
29
29
  plugins,
30
30
  guards: globalGuards,
31
31
  interceptors: globalInterceptors
@@ -54,27 +54,27 @@ function bindApp(router, { moduleMap, meta }, options = {}) {
54
54
  router.post(route, _h3.eventHandler.call(void 0, {
55
55
  onRequest: [
56
56
  prePlugin,
57
- ..._chunkWNTTAFLCjs.Context.usePlugin(plugins).map((p) => _h3.defineRequestMiddleware.call(void 0, p))
57
+ ..._chunk562XCEUUjs.Context.usePlugin(plugins).map((p) => _h3.defineRequestMiddleware.call(void 0, p))
58
58
  ],
59
59
  handler: async (event) => {
60
60
  const body = await _h3.readBody.call(void 0, event, {
61
61
  strict: true
62
62
  });
63
63
  async function errorHandler(e) {
64
- const error = await _chunkWNTTAFLCjs.Context.filterRecord.default(e);
64
+ const error = await _chunk562XCEUUjs.Context.filterRecord.default(e);
65
65
  _h3.setResponseStatus.call(void 0, event, error.status);
66
66
  return error;
67
67
  }
68
68
  _chunkXHKBG2VAjs.__name.call(void 0, errorHandler, "errorHandler");
69
69
  if (!Array.isArray(body))
70
- return errorHandler(new (0, _chunkWNTTAFLCjs.BadRequestException)("data format should be an array"));
70
+ return errorHandler(new (0, _chunk562XCEUUjs.BadRequestException)("data format should be an array"));
71
71
  try {
72
72
  return Promise.all(body.map((item, i) => {
73
73
  return new Promise(async (resolve) => {
74
74
  const { tag } = item;
75
75
  const meta2 = metaMap.get(tag);
76
76
  if (!meta2)
77
- return resolve(await _chunkWNTTAFLCjs.Context.filterRecord.default(new (0, _chunkWNTTAFLCjs.BadRequestException)(`"${tag}" doesn't exist`)));
77
+ return resolve(await _chunk562XCEUUjs.Context.filterRecord.default(new (0, _chunk562XCEUUjs.BadRequestException)(`"${tag}" doesn't exist`)));
78
78
  const [name, method] = tag.split("-");
79
79
  const { paramsType, data: { params, guards, interceptors, filter, ctx } } = metaMap.get(tag);
80
80
  const instance = moduleMap.get(name);
@@ -85,9 +85,10 @@ function bindApp(router, { moduleMap, meta }, options = {}) {
85
85
  meta: meta2,
86
86
  moduleMap,
87
87
  tag,
88
+ data: event.data,
88
89
  ..._chunkEVF2CXTPjs.argToReq.call(void 0, params, item.args, _h3.getRequestHeaders.call(void 0, event))
89
90
  };
90
- const context = new (0, _chunkWNTTAFLCjs.Context)(contextData);
91
+ const context = new (0, _chunk562XCEUUjs.Context)(contextData);
91
92
  try {
92
93
  await context.useGuard([
93
94
  ...globalGuards,
@@ -134,7 +135,7 @@ function bindApp(router, { moduleMap, meta }, options = {}) {
134
135
  router[http.type](http.route, _h3.eventHandler.call(void 0, {
135
136
  onRequest: [
136
137
  prePlugin,
137
- ..._chunkWNTTAFLCjs.Context.usePlugin(plugins2).map((p) => _h3.defineRequestMiddleware.call(void 0, p))
138
+ ..._chunk562XCEUUjs.Context.usePlugin(plugins2).map((p) => _h3.defineRequestMiddleware.call(void 0, p))
138
139
  ],
139
140
  handler: async (event) => {
140
141
  const instance = moduleMap.get(tag);
@@ -147,11 +148,12 @@ function bindApp(router, { moduleMap, meta }, options = {}) {
147
148
  headers: _h3.getRequestHeaders.call(void 0, event),
148
149
  params: _h3.getRouterParams.call(void 0, event),
149
150
  query: _h3.getQuery.call(void 0, event),
151
+ data: event.data,
150
152
  body: needBody ? await _h3.readBody.call(void 0, event, {
151
153
  strict: true
152
154
  }) : void 0
153
155
  };
154
- const context = new (0, _chunkWNTTAFLCjs.Context)(contextData);
156
+ const context = new (0, _chunk562XCEUUjs.Context)(contextData);
155
157
  try {
156
158
  _h3.setHeaders.call(void 0, event, header);
157
159
  await context.useGuard([
@@ -194,7 +196,7 @@ function bindApp(router, { moduleMap, meta }, options = {}) {
194
196
  createRoute();
195
197
  if (_chunkXHKBG2VAjs.IS_DEV) {
196
198
  _optionalChain([globalThis, 'access', _3 => _3.__PS_HMR__, 'optionalAccess', _4 => _4.push, 'call', _5 => _5(async () => {
197
- _chunkWNTTAFLCjs.isAopDepInject.call(void 0, meta, {
199
+ _chunk562XCEUUjs.isAopDepInject.call(void 0, meta, {
198
200
  plugins,
199
201
  guards: globalGuards,
200
202
  interceptors: globalInterceptors
@@ -6,7 +6,7 @@ import {
6
6
  BadRequestException,
7
7
  Context,
8
8
  isAopDepInject
9
- } from "../../chunk-PXI5J4LR.mjs";
9
+ } from "../../chunk-AL36AJMH.mjs";
10
10
  import {
11
11
  APP_SYMBOL,
12
12
  IS_DEV,
@@ -85,6 +85,7 @@ function bindApp(router, { moduleMap, meta }, options = {}) {
85
85
  meta: meta2,
86
86
  moduleMap,
87
87
  tag,
88
+ data: event.data,
88
89
  ...argToReq(params, item.args, getRequestHeaders(event))
89
90
  };
90
91
  const context = new Context(contextData);
@@ -147,6 +148,7 @@ function bindApp(router, { moduleMap, meta }, options = {}) {
147
148
  headers: getRequestHeaders(event),
148
149
  params: getRouterParams(event),
149
150
  query: getQuery(event),
151
+ data: event.data,
150
152
  body: needBody ? await readBody(event, {
151
153
  strict: true
152
154
  }) : void 0
@@ -1,6 +1,6 @@
1
1
  import Router, { RouterParamContext } from '@koa/router';
2
2
  import { DefaultContext, DefaultState } from 'koa';
3
- import { P, F as Factory } from '../../core-d11fe855.js';
3
+ import { P, F as Factory } from '../../core-895ed04d.js';
4
4
  import 'phecda-core';
5
5
  import 'node:http';
6
6
 
@@ -6,7 +6,7 @@ var _chunkEVF2CXTPjs = require('../../chunk-EVF2CXTP.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkWNTTAFLCjs = require('../../chunk-WNTTAFLC.js');
9
+ var _chunk562XCEUUjs = require('../../chunk-562XCEUU.js');
10
10
 
11
11
 
12
12
 
@@ -25,7 +25,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
25
25
  plugins: [],
26
26
  ...options
27
27
  };
28
- _chunkXHKBG2VAjs.IS_DEV && _chunkWNTTAFLCjs.isAopDepInject.call(void 0, meta, {
28
+ _chunkXHKBG2VAjs.IS_DEV && _chunk562XCEUUjs.isAopDepInject.call(void 0, meta, {
29
29
  plugins,
30
30
  guards: globalGuards,
31
31
  interceptors: globalInterceptors
@@ -52,23 +52,23 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
52
52
  ctx[_chunkXHKBG2VAjs.MODULE_SYMBOL] = moduleMap;
53
53
  ctx[_chunkXHKBG2VAjs.META_SYMBOL] = meta;
54
54
  await next();
55
- }, ..._chunkWNTTAFLCjs.Context.usePlugin(plugins), async (ctx, next) => {
55
+ }, ..._chunk562XCEUUjs.Context.usePlugin(plugins), async (ctx, next) => {
56
56
  const { body } = ctx.request;
57
57
  async function errorHandler(e) {
58
- const error = await _chunkWNTTAFLCjs.Context.filterRecord.default(e);
58
+ const error = await _chunk562XCEUUjs.Context.filterRecord.default(e);
59
59
  ctx.status = error.status;
60
60
  ctx.body = error;
61
61
  }
62
62
  _chunkXHKBG2VAjs.__name.call(void 0, errorHandler, "errorHandler");
63
63
  if (!Array.isArray(body))
64
- return errorHandler(new (0, _chunkWNTTAFLCjs.BadRequestException)("data format should be an array"));
64
+ return errorHandler(new (0, _chunk562XCEUUjs.BadRequestException)("data format should be an array"));
65
65
  try {
66
66
  return Promise.all(body.map((item, i) => {
67
67
  return new Promise(async (resolve) => {
68
68
  const { tag } = item;
69
69
  const meta2 = metaMap.get(tag);
70
70
  if (!meta2)
71
- return resolve(await _chunkWNTTAFLCjs.Context.filterRecord.default(new (0, _chunkWNTTAFLCjs.BadRequestException)(`"${tag}" doesn't exist`)));
71
+ return resolve(await _chunk562XCEUUjs.Context.filterRecord.default(new (0, _chunk562XCEUUjs.BadRequestException)(`"${tag}" doesn't exist`)));
72
72
  const [name, method] = tag.split("-");
73
73
  const { paramsType, data: { params, guards, interceptors, filter, ctx: CTX } } = meta2;
74
74
  const instance = moduleMap.get(name);
@@ -80,10 +80,11 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
80
80
  moduleMap,
81
81
  parallel: true,
82
82
  next,
83
+ data: ctx.data,
83
84
  ..._chunkEVF2CXTPjs.argToReq.call(void 0, params, item.args, ctx.headers),
84
85
  tag
85
86
  };
86
- const context = new (0, _chunkWNTTAFLCjs.Context)(contextData);
87
+ const context = new (0, _chunk562XCEUUjs.Context)(contextData);
87
88
  try {
88
89
  await context.useGuard([
89
90
  ...globalGuards,
@@ -131,7 +132,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
131
132
  ctx[_chunkXHKBG2VAjs.MODULE_SYMBOL] = moduleMap;
132
133
  ctx[_chunkXHKBG2VAjs.META_SYMBOL] = meta;
133
134
  await next();
134
- }, ..._chunkWNTTAFLCjs.Context.usePlugin(plugins2), async (ctx, next) => {
135
+ }, ..._chunk562XCEUUjs.Context.usePlugin(plugins2), async (ctx, next) => {
135
136
  const instance = moduleMap.get(tag);
136
137
  const contextData = {
137
138
  type: "koa",
@@ -144,9 +145,10 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
144
145
  params: ctx.params,
145
146
  body: ctx.request.body,
146
147
  headers: ctx.headers,
148
+ data: ctx.data,
147
149
  next
148
150
  };
149
- const context = new (0, _chunkWNTTAFLCjs.Context)(contextData);
151
+ const context = new (0, _chunk562XCEUUjs.Context)(contextData);
150
152
  try {
151
153
  for (const name in header)
152
154
  ctx.set(name, header[name]);
@@ -195,7 +197,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
195
197
  createRoute();
196
198
  if (_chunkXHKBG2VAjs.IS_DEV) {
197
199
  _optionalChain([globalThis, 'access', _3 => _3.__PS_HMR__, 'optionalAccess', _4 => _4.push, 'call', _5 => _5(async () => {
198
- _chunkWNTTAFLCjs.isAopDepInject.call(void 0, meta, {
200
+ _chunk562XCEUUjs.isAopDepInject.call(void 0, meta, {
199
201
  plugins,
200
202
  guards: globalGuards,
201
203
  interceptors: globalInterceptors
@@ -6,7 +6,7 @@ import {
6
6
  BadRequestException,
7
7
  Context,
8
8
  isAopDepInject
9
- } from "../../chunk-PXI5J4LR.mjs";
9
+ } from "../../chunk-AL36AJMH.mjs";
10
10
  import {
11
11
  APP_SYMBOL,
12
12
  IS_DEV,
@@ -80,6 +80,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
80
80
  moduleMap,
81
81
  parallel: true,
82
82
  next,
83
+ data: ctx.data,
83
84
  ...argToReq(params, item.args, ctx.headers),
84
85
  tag
85
86
  };
@@ -144,6 +145,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
144
145
  params: ctx.params,
145
146
  body: ctx.request.body,
146
147
  headers: ctx.headers,
148
+ data: ctx.data,
147
149
  next
148
150
  };
149
151
  const context = new Context(contextData);
package/dist/test.d.ts CHANGED
@@ -2,7 +2,7 @@ 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, c as PickFunc } from './core-d11fe855.js';
5
+ import { F as Factory, d as PickFunc } from './core-895ed04d.js';
6
6
 
7
7
  declare function TestFactory<T extends Construct[]>(...Modules: T): Promise<{
8
8
  get<C extends T[number]>(Module: C): InstanceType<C>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-server",
3
- "version": "5.0.0-beta.20",
3
+ "version": "5.0.0-beta.21",
4
4
  "description": "provide express middlewares, `nestjs` format",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -103,6 +103,7 @@
103
103
  "amqplib": "^0.10.3",
104
104
  "chokidar": "^3.5.3",
105
105
  "express": "^4.18.2",
106
+ "fast-glob": "^3.3.2",
106
107
  "fastify": "^4.25.1",
107
108
  "h3": "^1.9.0",
108
109
  "ioredis": "^5.3.2",