phecda-server 5.0.0-alpha.11 → 5.0.0-alpha.13

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 (37) hide show
  1. package/dist/{chunk-JJG37LHY.mjs → chunk-BADPI5WG.mjs} +25 -21
  2. package/dist/{chunk-KGMDCF26.mjs → chunk-DJO45NRZ.mjs} +6 -2
  3. package/dist/{chunk-C36XJ7D3.js → chunk-GWLM5DEJ.js} +7 -3
  4. package/dist/{chunk-MZBE4NIO.mjs → chunk-HQ5RLYMA.mjs} +1 -1
  5. package/dist/{chunk-ANH53I6B.js → chunk-INPMEA67.js} +33 -37
  6. package/dist/{chunk-P5LJBZPN.js → chunk-MFCPWVO5.js} +65 -61
  7. package/dist/{chunk-2AI7ID6X.js → chunk-SSZS3GSQ.js} +2 -2
  8. package/dist/{chunk-KKTRNKCF.mjs → chunk-Y7AOZMC2.mjs} +15 -19
  9. package/dist/{core-39d78b79.d.ts → core-11dd822c.d.ts} +8 -5
  10. package/dist/index.d.ts +26 -25
  11. package/dist/index.js +77 -62
  12. package/dist/index.mjs +32 -17
  13. package/dist/rpc/kafka/index.d.ts +1 -1
  14. package/dist/rpc/kafka/index.js +9 -9
  15. package/dist/rpc/kafka/index.mjs +3 -3
  16. package/dist/rpc/rabbitmq/index.d.ts +1 -1
  17. package/dist/rpc/rabbitmq/index.js +9 -9
  18. package/dist/rpc/rabbitmq/index.mjs +3 -3
  19. package/dist/rpc/redis/index.d.ts +1 -1
  20. package/dist/rpc/redis/index.js +9 -9
  21. package/dist/rpc/redis/index.mjs +3 -3
  22. package/dist/server/express/index.d.ts +1 -1
  23. package/dist/server/express/index.js +24 -24
  24. package/dist/server/express/index.mjs +4 -4
  25. package/dist/server/fastify/index.d.ts +1 -1
  26. package/dist/server/fastify/index.js +22 -22
  27. package/dist/server/fastify/index.mjs +4 -4
  28. package/dist/server/h3/index.d.ts +1 -1
  29. package/dist/server/h3/index.js +21 -21
  30. package/dist/server/h3/index.mjs +4 -4
  31. package/dist/server/koa/index.d.ts +1 -1
  32. package/dist/server/koa/index.js +24 -24
  33. package/dist/server/koa/index.mjs +4 -4
  34. package/dist/test.d.ts +5 -4
  35. package/dist/test.js +45 -43
  36. package/dist/test.mjs +42 -40
  37. package/package.json +2 -2
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkP5LJBZPNjs = require('../../chunk-P5LJBZPN.js');
5
+ var _chunkMFCPWVO5js = require('../../chunk-MFCPWVO5.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkC36XJ7D3js = require('../../chunk-C36XJ7D3.js');
9
+ var _chunkGWLM5DEJjs = require('../../chunk-GWLM5DEJ.js');
10
10
 
11
11
  // src/rpc/rabbitmq/bind.ts
12
12
  async function bind(ch, queue, { moduleMap, meta }, opts) {
@@ -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
- _chunkP5LJBZPNjs.isAopDepInject.call(void 0, meta, {
17
+ _chunkGWLM5DEJjs.IS_DEV && _chunkMFCPWVO5js.isAopDepInject.call(void 0, meta, {
18
18
  guards: globalGuards,
19
19
  interceptors: globalInterceptors
20
20
  });
@@ -24,7 +24,7 @@ async function bind(ch, queue, { moduleMap, meta }, opts) {
24
24
  metaMap.set(`${name}-${method}`, item);
25
25
  }
26
26
  }
27
- _chunkC36XJ7D3js.__name.call(void 0, handleMeta, "handleMeta");
27
+ _chunkGWLM5DEJjs.__name.call(void 0, handleMeta, "handleMeta");
28
28
  handleMeta();
29
29
  await ch.assertQueue(queue);
30
30
  ch.consume(queue, async (msg) => {
@@ -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, _chunkP5LJBZPNjs.BadRequestException)(`service "${tag}" doesn't exist`).data,
38
+ data: new (0, _chunkMFCPWVO5js.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, _chunkP5LJBZPNjs.Context)({
45
+ const context = new (0, _chunkMFCPWVO5js.Context)({
46
46
  type: "rabbitmq",
47
47
  moduleMap,
48
48
  meta: meta2,
@@ -101,13 +101,13 @@ async function bind(ch, queue, { moduleMap, meta }, opts) {
101
101
  }, {
102
102
  noAck: true
103
103
  });
104
- if (_chunkC36XJ7D3js.IS_DEV) {
104
+ if (_chunkGWLM5DEJjs.IS_DEV) {
105
105
  _optionalChain([globalThis, 'access', _2 => _2.__PS_HMR__, 'optionalAccess', _3 => _3.push, 'call', _4 => _4(async () => {
106
106
  handleMeta();
107
107
  })]);
108
108
  }
109
109
  }
110
- _chunkC36XJ7D3js.__name.call(void 0, bind, "bind");
110
+ _chunkGWLM5DEJjs.__name.call(void 0, bind, "bind");
111
111
 
112
112
  // src/rpc/rabbitmq/client.ts
113
113
  var _events = require('events');
@@ -155,7 +155,7 @@ async function createClient(ch, queue, controllers) {
155
155
  }
156
156
  return ret;
157
157
  }
158
- _chunkC36XJ7D3js.__name.call(void 0, createClient, "createClient");
158
+ _chunkGWLM5DEJjs.__name.call(void 0, createClient, "createClient");
159
159
 
160
160
 
161
161
 
@@ -2,11 +2,11 @@ import {
2
2
  BadRequestException,
3
3
  Context,
4
4
  isAopDepInject
5
- } from "../../chunk-JJG37LHY.mjs";
5
+ } from "../../chunk-BADPI5WG.mjs";
6
6
  import {
7
7
  IS_DEV,
8
8
  __name
9
- } from "../../chunk-KGMDCF26.mjs";
9
+ } from "../../chunk-DJO45NRZ.mjs";
10
10
 
11
11
  // src/rpc/rabbitmq/bind.ts
12
12
  async function bind(ch, queue, { moduleMap, meta }, opts) {
@@ -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
- isAopDepInject(meta, {
17
+ IS_DEV && isAopDepInject(meta, {
18
18
  guards: globalGuards,
19
19
  interceptors: globalInterceptors
20
20
  });
@@ -1,5 +1,5 @@
1
1
  import Redis from 'ioredis';
2
- import { P, F as Factory, T as ToControllerMap } from '../../core-39d78b79.js';
2
+ import { P, F as Factory, T as ToControllerMap } from '../../core-11dd822c.js';
3
3
  import 'phecda-core';
4
4
 
5
5
  interface Options {
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkP5LJBZPNjs = require('../../chunk-P5LJBZPN.js');
5
+ var _chunkMFCPWVO5js = require('../../chunk-MFCPWVO5.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkC36XJ7D3js = require('../../chunk-C36XJ7D3.js');
9
+ var _chunkGWLM5DEJjs = require('../../chunk-GWLM5DEJ.js');
10
10
 
11
11
  // src/rpc/redis/bind.ts
12
12
  var _ioredis = require('ioredis'); var _ioredis2 = _interopRequireDefault(_ioredis);
@@ -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
- _chunkP5LJBZPNjs.isAopDepInject.call(void 0, meta, {
18
+ _chunkGWLM5DEJjs.IS_DEV && _chunkMFCPWVO5js.isAopDepInject.call(void 0, meta, {
19
19
  guards: globalGuards,
20
20
  interceptors: globalInterceptors
21
21
  });
@@ -25,7 +25,7 @@ function bind(redis, channel, { moduleMap, meta }, opts) {
25
25
  metaMap.set(`${name}-${method}`, item);
26
26
  }
27
27
  }
28
- _chunkC36XJ7D3js.__name.call(void 0, handleMeta, "handleMeta");
28
+ _chunkGWLM5DEJjs.__name.call(void 0, handleMeta, "handleMeta");
29
29
  handleMeta();
30
30
  redis.subscribe(channel);
31
31
  redis.on("message", async (channel2, msg) => {
@@ -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, _chunkP5LJBZPNjs.BadRequestException)(`service "${tag}" doesn't exist`).data,
37
+ data: new (0, _chunkMFCPWVO5js.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, _chunkP5LJBZPNjs.Context)({
44
+ const context = new (0, _chunkMFCPWVO5js.Context)({
45
45
  type: "redis",
46
46
  moduleMap,
47
47
  redis,
@@ -96,13 +96,13 @@ function bind(redis, channel, { moduleMap, meta }, opts) {
96
96
  }
97
97
  }
98
98
  });
99
- if (_chunkC36XJ7D3js.IS_DEV) {
99
+ if (_chunkGWLM5DEJjs.IS_DEV) {
100
100
  _optionalChain([globalThis, 'access', _3 => _3.__PS_HMR__, 'optionalAccess', _4 => _4.push, 'call', _5 => _5(async () => {
101
101
  handleMeta();
102
102
  })]);
103
103
  }
104
104
  }
105
- _chunkC36XJ7D3js.__name.call(void 0, bind, "bind");
105
+ _chunkGWLM5DEJjs.__name.call(void 0, bind, "bind");
106
106
 
107
107
  // src/rpc/redis/client.ts
108
108
  var _crypto = require('crypto');
@@ -150,7 +150,7 @@ function createClient(redis, queue, controllers) {
150
150
  }
151
151
  return ret;
152
152
  }
153
- _chunkC36XJ7D3js.__name.call(void 0, createClient, "createClient");
153
+ _chunkGWLM5DEJjs.__name.call(void 0, createClient, "createClient");
154
154
 
155
155
 
156
156
 
@@ -2,11 +2,11 @@ import {
2
2
  BadRequestException,
3
3
  Context,
4
4
  isAopDepInject
5
- } from "../../chunk-JJG37LHY.mjs";
5
+ } from "../../chunk-BADPI5WG.mjs";
6
6
  import {
7
7
  IS_DEV,
8
8
  __name
9
- } from "../../chunk-KGMDCF26.mjs";
9
+ } from "../../chunk-DJO45NRZ.mjs";
10
10
 
11
11
  // src/rpc/redis/bind.ts
12
12
  import Redis from "ioredis";
@@ -15,7 +15,7 @@ function bind(redis, channel, { moduleMap, meta }, opts) {
15
15
  const pub = new Redis(redis.options);
16
16
  const { globalGuards = [], globalInterceptors = [] } = opts || {};
17
17
  function handleMeta() {
18
- isAopDepInject(meta, {
18
+ IS_DEV && isAopDepInject(meta, {
19
19
  guards: globalGuards,
20
20
  interceptors: globalInterceptors
21
21
  });
@@ -1,5 +1,5 @@
1
1
  import { Request, Response, Router } from 'express';
2
- import { P, F as Factory } from '../../core-39d78b79.js';
2
+ import { P, F as Factory } from '../../core-11dd822c.js';
3
3
  import 'phecda-core';
4
4
 
5
5
  interface ExpressCtx extends P.BaseContext {
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunk2AI7ID6Xjs = require('../../chunk-2AI7ID6X.js');
3
+ var _chunkSSZS3GSQjs = require('../../chunk-SSZS3GSQ.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunkP5LJBZPNjs = require('../../chunk-P5LJBZPN.js');
8
+ var _chunkMFCPWVO5js = require('../../chunk-MFCPWVO5.js');
9
9
 
10
10
 
11
11
 
@@ -13,7 +13,7 @@ var _chunkP5LJBZPNjs = require('../../chunk-P5LJBZPN.js');
13
13
 
14
14
 
15
15
 
16
- var _chunkC36XJ7D3js = require('../../chunk-C36XJ7D3.js');
16
+ var _chunkGWLM5DEJjs = require('../../chunk-GWLM5DEJ.js');
17
17
 
18
18
  // src/server/express/bind.ts
19
19
  function bindApp(app, { moduleMap, meta }, options = {}) {
@@ -24,12 +24,12 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
24
24
  plugins: [],
25
25
  ...options
26
26
  };
27
- _chunkP5LJBZPNjs.isAopDepInject.call(void 0, meta, {
27
+ _chunkGWLM5DEJjs.IS_DEV && _chunkMFCPWVO5js.isAopDepInject.call(void 0, meta, {
28
28
  plugins,
29
29
  guards: globalGuards,
30
30
  interceptors: globalInterceptors
31
31
  });
32
- app[_chunkC36XJ7D3js.APP_SYMBOL] = {
32
+ app[_chunkGWLM5DEJjs.APP_SYMBOL] = {
33
33
  moduleMap,
34
34
  meta
35
35
  };
@@ -44,29 +44,29 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
44
44
  metaMap.set(methodTag, item);
45
45
  }
46
46
  }
47
- _chunkC36XJ7D3js.__name.call(void 0, handleMeta, "handleMeta");
47
+ _chunkGWLM5DEJjs.__name.call(void 0, handleMeta, "handleMeta");
48
48
  async function createRoute() {
49
49
  app.post(route, (req, _res, next) => {
50
- req[_chunkC36XJ7D3js.MERGE_SYMBOL] = true;
51
- req[_chunkC36XJ7D3js.MODULE_SYMBOL] = moduleMap;
52
- req[_chunkC36XJ7D3js.META_SYMBOL] = meta;
50
+ req[_chunkGWLM5DEJjs.MERGE_SYMBOL] = true;
51
+ req[_chunkGWLM5DEJjs.MODULE_SYMBOL] = moduleMap;
52
+ req[_chunkGWLM5DEJjs.META_SYMBOL] = meta;
53
53
  next();
54
- }, ..._chunkP5LJBZPNjs.Context.usePlugin(plugins), async (req, res) => {
54
+ }, ..._chunkMFCPWVO5js.Context.usePlugin(plugins), async (req, res) => {
55
55
  const { body } = req;
56
56
  async function errorHandler(e) {
57
- const error = await _chunkP5LJBZPNjs.Context.filterRecord.default(e);
57
+ const error = await _chunkMFCPWVO5js.Context.filterRecord.default(e);
58
58
  return res.status(error.status).json(error);
59
59
  }
60
- _chunkC36XJ7D3js.__name.call(void 0, errorHandler, "errorHandler");
60
+ _chunkGWLM5DEJjs.__name.call(void 0, errorHandler, "errorHandler");
61
61
  if (!Array.isArray(body))
62
- return errorHandler(new (0, _chunkP5LJBZPNjs.BadRequestException)("data format should be an array"));
62
+ return errorHandler(new (0, _chunkMFCPWVO5js.BadRequestException)("data format should be an array"));
63
63
  try {
64
64
  return Promise.all(body.map((item) => {
65
65
  return new Promise(async (resolve) => {
66
66
  const { tag } = item;
67
67
  const meta2 = metaMap.get(tag);
68
68
  if (!meta2)
69
- return resolve(await _chunkP5LJBZPNjs.Context.filterRecord.default(new (0, _chunkP5LJBZPNjs.BadRequestException)(`"${tag}" doesn't exist`)));
69
+ return resolve(await _chunkMFCPWVO5js.Context.filterRecord.default(new (0, _chunkMFCPWVO5js.BadRequestException)(`"${tag}" doesn't exist`)));
70
70
  const contextData = {
71
71
  type: "express",
72
72
  request: req,
@@ -76,7 +76,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
76
76
  parallel: true,
77
77
  tag
78
78
  };
79
- const context = new (0, _chunkP5LJBZPNjs.Context)(contextData);
79
+ const context = new (0, _chunkMFCPWVO5js.Context)(contextData);
80
80
  const [name, method] = tag.split("-");
81
81
  const { paramsType, handlers, data: { params, guards, interceptors, filter } } = meta2;
82
82
  const instance = moduleMap.get(name);
@@ -124,10 +124,10 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
124
124
  const methodTag = `${tag}-${method}`;
125
125
  const { paramsType, handlers, data: { interceptors, guards, params, plugins: plugins2, filter } } = metaMap.get(methodTag);
126
126
  app[http.type](http.route, (req, _res, next) => {
127
- req[_chunkC36XJ7D3js.MODULE_SYMBOL] = moduleMap;
128
- req[_chunkC36XJ7D3js.META_SYMBOL] = meta;
127
+ req[_chunkGWLM5DEJjs.MODULE_SYMBOL] = moduleMap;
128
+ req[_chunkGWLM5DEJjs.META_SYMBOL] = meta;
129
129
  next();
130
- }, ..._chunkP5LJBZPNjs.Context.usePlugin(plugins2), async (req, res) => {
130
+ }, ..._chunkMFCPWVO5js.Context.usePlugin(plugins2), async (req, res) => {
131
131
  const instance = moduleMap.get(tag);
132
132
  const contextData = {
133
133
  type: "express",
@@ -138,7 +138,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
138
138
  parallel: false,
139
139
  tag: methodTag
140
140
  };
141
- const context = new (0, _chunkP5LJBZPNjs.Context)(contextData);
141
+ const context = new (0, _chunkMFCPWVO5js.Context)(contextData);
142
142
  try {
143
143
  for (const name in header)
144
144
  res.set(name, header[name]);
@@ -159,7 +159,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
159
159
  }
160
160
  const args = await context.usePipe(params.map(({ type, key, pipeOpts, index, pipe }) => {
161
161
  return {
162
- arg: _chunk2AI7ID6Xjs.resolveDep.call(void 0, req[type], key),
162
+ arg: _chunkSSZS3GSQjs.resolveDep.call(void 0, req[type], key),
163
163
  pipeOpts,
164
164
  pipe,
165
165
  key,
@@ -187,12 +187,12 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
187
187
  });
188
188
  }
189
189
  }
190
- _chunkC36XJ7D3js.__name.call(void 0, createRoute, "createRoute");
190
+ _chunkGWLM5DEJjs.__name.call(void 0, createRoute, "createRoute");
191
191
  handleMeta();
192
192
  createRoute();
193
- if (_chunkC36XJ7D3js.IS_DEV) {
193
+ if (_chunkGWLM5DEJjs.IS_DEV) {
194
194
  _optionalChain([globalThis, 'access', _7 => _7.__PS_HMR__, 'optionalAccess', _8 => _8.push, 'call', _9 => _9(async () => {
195
- _chunkP5LJBZPNjs.isAopDepInject.call(void 0, meta, {
195
+ _chunkMFCPWVO5js.isAopDepInject.call(void 0, meta, {
196
196
  plugins,
197
197
  guards: globalGuards,
198
198
  interceptors: globalInterceptors
@@ -203,7 +203,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
203
203
  })]);
204
204
  }
205
205
  }
206
- _chunkC36XJ7D3js.__name.call(void 0, bindApp, "bindApp");
206
+ _chunkGWLM5DEJjs.__name.call(void 0, bindApp, "bindApp");
207
207
 
208
208
 
209
209
  exports.bindApp = bindApp;
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  resolveDep
3
- } from "../../chunk-MZBE4NIO.mjs";
3
+ } from "../../chunk-HQ5RLYMA.mjs";
4
4
  import {
5
5
  BadRequestException,
6
6
  Context,
7
7
  isAopDepInject
8
- } from "../../chunk-JJG37LHY.mjs";
8
+ } from "../../chunk-BADPI5WG.mjs";
9
9
  import {
10
10
  APP_SYMBOL,
11
11
  IS_DEV,
@@ -13,7 +13,7 @@ import {
13
13
  META_SYMBOL,
14
14
  MODULE_SYMBOL,
15
15
  __name
16
- } from "../../chunk-KGMDCF26.mjs";
16
+ } from "../../chunk-DJO45NRZ.mjs";
17
17
 
18
18
  // src/server/express/bind.ts
19
19
  function bindApp(app, { moduleMap, meta }, options = {}) {
@@ -24,7 +24,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
24
24
  plugins: [],
25
25
  ...options
26
26
  };
27
- isAopDepInject(meta, {
27
+ IS_DEV && isAopDepInject(meta, {
28
28
  plugins,
29
29
  guards: globalGuards,
30
30
  interceptors: globalInterceptors
@@ -1,5 +1,5 @@
1
1
  import { FastifyRequest, FastifyReply, FastifyInstance, FastifyPluginCallback } from 'fastify';
2
- import { P, F as Factory } from '../../core-39d78b79.js';
2
+ import { P, F as Factory } from '../../core-11dd822c.js';
3
3
  import 'phecda-core';
4
4
 
5
5
  interface FastifyCtx extends P.BaseContext {
@@ -1,18 +1,18 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunk2AI7ID6Xjs = require('../../chunk-2AI7ID6X.js');
3
+ var _chunkSSZS3GSQjs = require('../../chunk-SSZS3GSQ.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunkP5LJBZPNjs = require('../../chunk-P5LJBZPN.js');
8
+ var _chunkMFCPWVO5js = require('../../chunk-MFCPWVO5.js');
9
9
 
10
10
 
11
11
 
12
12
 
13
13
 
14
14
 
15
- var _chunkC36XJ7D3js = require('../../chunk-C36XJ7D3.js');
15
+ var _chunkGWLM5DEJjs = require('../../chunk-GWLM5DEJ.js');
16
16
 
17
17
  // src/server/fastify/bind.ts
18
18
  function bindApp(app, { moduleMap, meta }, options = {}) {
@@ -23,11 +23,11 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
23
23
  plugins: [],
24
24
  ...options
25
25
  };
26
- app.server[_chunkC36XJ7D3js.APP_SYMBOL] = {
26
+ app.server[_chunkGWLM5DEJjs.APP_SYMBOL] = {
27
27
  moduleMap,
28
28
  meta
29
29
  };
30
- _chunkP5LJBZPNjs.isAopDepInject.call(void 0, meta, {
30
+ _chunkGWLM5DEJjs.IS_DEV && _chunkMFCPWVO5js.isAopDepInject.call(void 0, meta, {
31
31
  plugins,
32
32
  guards: globalGuards,
33
33
  interceptors: globalInterceptors
@@ -43,16 +43,16 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
43
43
  metaMap.set(methodTag, item);
44
44
  }
45
45
  }
46
- _chunkC36XJ7D3js.__name.call(void 0, handleMeta, "handleMeta");
46
+ _chunkGWLM5DEJjs.__name.call(void 0, handleMeta, "handleMeta");
47
47
  handleMeta();
48
48
  return (fastify, _, done) => {
49
- fastify[_chunkC36XJ7D3js.APP_SYMBOL] = {
49
+ fastify[_chunkGWLM5DEJjs.APP_SYMBOL] = {
50
50
  moduleMap,
51
51
  meta
52
52
  };
53
53
  fastify.register((fastify2, _opts, done2) => {
54
54
  plugins.forEach((p) => {
55
- const plugin = _chunkP5LJBZPNjs.Context.usePlugin([
55
+ const plugin = _chunkMFCPWVO5js.Context.usePlugin([
56
56
  p
57
57
  ])[0];
58
58
  if (plugin) {
@@ -63,19 +63,19 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
63
63
  fastify2.post(route, async (req, res) => {
64
64
  const { body } = req;
65
65
  async function errorHandler(e) {
66
- const error = await _chunkP5LJBZPNjs.Context.filterRecord.default(e);
66
+ const error = await _chunkMFCPWVO5js.Context.filterRecord.default(e);
67
67
  return res.status(error.status).send(error);
68
68
  }
69
- _chunkC36XJ7D3js.__name.call(void 0, errorHandler, "errorHandler");
69
+ _chunkGWLM5DEJjs.__name.call(void 0, errorHandler, "errorHandler");
70
70
  if (!Array.isArray(body))
71
- return errorHandler(new (0, _chunkP5LJBZPNjs.BadRequestException)("data format should be an array"));
71
+ return errorHandler(new (0, _chunkMFCPWVO5js.BadRequestException)("data format should be an array"));
72
72
  try {
73
73
  return Promise.all(body.map((item) => {
74
74
  return new Promise(async (resolve) => {
75
75
  const { tag } = item;
76
76
  const meta2 = metaMap.get(tag);
77
77
  if (!meta2)
78
- return resolve(await _chunkP5LJBZPNjs.Context.filterRecord.default(new (0, _chunkP5LJBZPNjs.BadRequestException)(`"${tag}" doesn't exist`)));
78
+ return resolve(await _chunkMFCPWVO5js.Context.filterRecord.default(new (0, _chunkMFCPWVO5js.BadRequestException)(`"${tag}" doesn't exist`)));
79
79
  const contextData = {
80
80
  type: "fastify",
81
81
  request: req,
@@ -85,13 +85,13 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
85
85
  parallel: true,
86
86
  tag
87
87
  };
88
- const context = new (0, _chunkP5LJBZPNjs.Context)(contextData);
88
+ const context = new (0, _chunkMFCPWVO5js.Context)(contextData);
89
89
  const [name, method] = tag.split("-");
90
90
  const { paramsType, handlers, data: { params, guards, interceptors, filter } } = meta2;
91
91
  const instance = moduleMap.get(name);
92
92
  try {
93
93
  if (!params)
94
- throw new (0, _chunkP5LJBZPNjs.BadRequestException)(`"${tag}" doesn't exist`);
94
+ throw new (0, _chunkMFCPWVO5js.BadRequestException)(`"${tag}" doesn't exist`);
95
95
  await context.useGuard([
96
96
  ...globalGuards,
97
97
  ...guards
@@ -137,13 +137,13 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
137
137
  const methodTag = `${tag}-${method}`;
138
138
  const { paramsType, handlers, data: { interceptors, guards, params, plugins: plugins2, filter } } = metaMap.get(methodTag);
139
139
  fastify.register((fastify2, _opts, done2) => {
140
- _chunkP5LJBZPNjs.Context.usePlugin(plugins2).forEach((p) => {
140
+ _chunkMFCPWVO5js.Context.usePlugin(plugins2).forEach((p) => {
141
141
  p[Symbol.for("skip-override")] = true;
142
142
  fastify2.register(p);
143
143
  });
144
144
  fastify2[http.type](http.route, async (req, res) => {
145
- req[_chunkC36XJ7D3js.MODULE_SYMBOL] = moduleMap;
146
- req[_chunkC36XJ7D3js.META_SYMBOL] = meta;
145
+ req[_chunkGWLM5DEJjs.MODULE_SYMBOL] = moduleMap;
146
+ req[_chunkGWLM5DEJjs.META_SYMBOL] = meta;
147
147
  const instance = moduleMap.get(tag);
148
148
  const contextData = {
149
149
  type: "fastify",
@@ -154,7 +154,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
154
154
  parallel: false,
155
155
  tag: methodTag
156
156
  };
157
- const context = new (0, _chunkP5LJBZPNjs.Context)(contextData);
157
+ const context = new (0, _chunkMFCPWVO5js.Context)(contextData);
158
158
  try {
159
159
  for (const name in header)
160
160
  res.header(name, header[name]);
@@ -170,7 +170,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
170
170
  return cache;
171
171
  const args = await context.usePipe(params.map(({ type, key, pipe, pipeOpts, index }) => {
172
172
  return {
173
- arg: _chunk2AI7ID6Xjs.resolveDep.call(void 0, req[type], key),
173
+ arg: _chunkSSZS3GSQjs.resolveDep.call(void 0, req[type], key),
174
174
  pipe,
175
175
  pipeOpts,
176
176
  key,
@@ -197,9 +197,9 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
197
197
  });
198
198
  }
199
199
  done();
200
- if (_chunkC36XJ7D3js.IS_DEV) {
200
+ if (_chunkGWLM5DEJjs.IS_DEV) {
201
201
  _optionalChain([globalThis, 'access', _8 => _8.__PS_HMR__, 'optionalAccess', _9 => _9.push, 'call', _10 => _10(async () => {
202
- _chunkP5LJBZPNjs.isAopDepInject.call(void 0, meta, {
202
+ _chunkMFCPWVO5js.isAopDepInject.call(void 0, meta, {
203
203
  plugins,
204
204
  guards: globalGuards,
205
205
  interceptors: globalInterceptors
@@ -209,7 +209,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
209
209
  }
210
210
  };
211
211
  }
212
- _chunkC36XJ7D3js.__name.call(void 0, bindApp, "bindApp");
212
+ _chunkGWLM5DEJjs.__name.call(void 0, bindApp, "bindApp");
213
213
 
214
214
 
215
215
  exports.bindApp = bindApp;
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  resolveDep
3
- } from "../../chunk-MZBE4NIO.mjs";
3
+ } from "../../chunk-HQ5RLYMA.mjs";
4
4
  import {
5
5
  BadRequestException,
6
6
  Context,
7
7
  isAopDepInject
8
- } from "../../chunk-JJG37LHY.mjs";
8
+ } from "../../chunk-BADPI5WG.mjs";
9
9
  import {
10
10
  APP_SYMBOL,
11
11
  IS_DEV,
12
12
  META_SYMBOL,
13
13
  MODULE_SYMBOL,
14
14
  __name
15
- } from "../../chunk-KGMDCF26.mjs";
15
+ } from "../../chunk-DJO45NRZ.mjs";
16
16
 
17
17
  // src/server/fastify/bind.ts
18
18
  function bindApp(app, { moduleMap, meta }, options = {}) {
@@ -27,7 +27,7 @@ function bindApp(app, { moduleMap, meta }, options = {}) {
27
27
  moduleMap,
28
28
  meta
29
29
  };
30
- isAopDepInject(meta, {
30
+ IS_DEV && isAopDepInject(meta, {
31
31
  plugins,
32
32
  guards: globalGuards,
33
33
  interceptors: globalInterceptors
@@ -1,5 +1,5 @@
1
1
  import { H3Event, Router } from 'h3';
2
- import { P, F as Factory } from '../../core-39d78b79.js';
2
+ import { P, F as Factory } from '../../core-11dd822c.js';
3
3
  import 'phecda-core';
4
4
 
5
5
  interface H3Ctx extends P.BaseContext {