phecda-server 6.1.0 → 7.0.0-alpha.1

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 (82) hide show
  1. package/assets/ps.json +24 -24
  2. package/bin/cli.mjs +165 -157
  3. package/dist/{chunk-NL6QBQAR.js → chunk-7YQ57BQS.js} +21 -22
  4. package/dist/chunk-GSPBHZBH.js +534 -0
  5. package/dist/{chunk-J7B24YSE.mjs → chunk-HMVLXNV3.mjs} +5 -14
  6. package/dist/{chunk-TVT62GIX.js → chunk-J5CFUN4V.js} +8 -1
  7. package/dist/{chunk-JDV2XJYE.js → chunk-MBCHNDAY.js} +27 -36
  8. package/dist/{chunk-2CFYUXPM.mjs → chunk-V7EI76QQ.mjs} +136 -141
  9. package/dist/{chunk-G7TD2VB7.mjs → chunk-WHJ5FALK.mjs} +7 -0
  10. package/dist/{chunk-3H3T54IC.mjs → chunk-XYVMNY2X.mjs} +4 -5
  11. package/dist/{core-P1CsH6jz.d.mts → core-BIcUwV18.d.mts} +1 -1
  12. package/dist/{core-BlN0Spy9.d.ts → core-CYwEPfN4.d.ts} +1 -1
  13. package/dist/helper.d.mts +4 -6
  14. package/dist/helper.d.ts +4 -6
  15. package/dist/helper.js +3 -3
  16. package/dist/helper.mjs +2 -2
  17. package/dist/{server → http}/elysia/index.d.mts +5 -5
  18. package/dist/{server → http}/elysia/index.d.ts +5 -5
  19. package/dist/{server → http}/elysia/index.js +80 -62
  20. package/dist/{server → http}/elysia/index.mjs +50 -32
  21. package/dist/{server → http}/express/index.d.mts +5 -5
  22. package/dist/{server → http}/express/index.d.ts +5 -5
  23. package/dist/{server → http}/express/index.js +71 -55
  24. package/dist/{server → http}/express/index.mjs +42 -26
  25. package/dist/{server → http}/fastify/index.d.mts +5 -5
  26. package/dist/{server → http}/fastify/index.d.ts +5 -5
  27. package/dist/{server → http}/fastify/index.js +72 -72
  28. package/dist/{server → http}/fastify/index.mjs +47 -47
  29. package/dist/{server → http}/h3/index.d.mts +5 -5
  30. package/dist/{server → http}/h3/index.d.ts +5 -5
  31. package/dist/http/h3/index.js +160 -0
  32. package/dist/{server → http}/h3/index.mjs +68 -62
  33. package/dist/{server → http}/hono/index.d.mts +5 -5
  34. package/dist/{server → http}/hono/index.d.ts +5 -5
  35. package/dist/{server → http}/hono/index.js +69 -54
  36. package/dist/{server → http}/hono/index.mjs +41 -26
  37. package/dist/{server → http}/hyper-express/index.d.mts +5 -5
  38. package/dist/{server → http}/hyper-express/index.d.ts +5 -5
  39. package/dist/{server → http}/hyper-express/index.js +69 -56
  40. package/dist/{server → http}/hyper-express/index.mjs +41 -28
  41. package/dist/{server → http}/koa/index.d.mts +5 -5
  42. package/dist/{server → http}/koa/index.d.ts +5 -5
  43. package/dist/{server → http}/koa/index.js +71 -55
  44. package/dist/{server → http}/koa/index.mjs +42 -26
  45. package/dist/index.d.mts +52 -41
  46. package/dist/index.d.ts +52 -41
  47. package/dist/index.js +59 -81
  48. package/dist/index.mjs +39 -61
  49. package/dist/{meta-KtfiBIde.d.ts → meta-BXKLFTgG.d.mts} +2 -3
  50. package/dist/{meta-KtfiBIde.d.mts → meta-BXKLFTgG.d.ts} +2 -3
  51. package/dist/rpc/bullmq/index.d.mts +6 -6
  52. package/dist/rpc/bullmq/index.d.ts +6 -6
  53. package/dist/rpc/bullmq/index.js +24 -24
  54. package/dist/rpc/bullmq/index.mjs +14 -14
  55. package/dist/rpc/kafka/index.d.mts +3 -3
  56. package/dist/rpc/kafka/index.d.ts +3 -3
  57. package/dist/rpc/kafka/index.js +25 -21
  58. package/dist/rpc/kafka/index.mjs +15 -11
  59. package/dist/rpc/nats/index.d.mts +3 -3
  60. package/dist/rpc/nats/index.d.ts +3 -3
  61. package/dist/rpc/nats/index.js +22 -21
  62. package/dist/rpc/nats/index.mjs +13 -12
  63. package/dist/rpc/rabbitmq/index.d.mts +3 -3
  64. package/dist/rpc/rabbitmq/index.d.ts +3 -3
  65. package/dist/rpc/rabbitmq/index.js +23 -22
  66. package/dist/rpc/rabbitmq/index.mjs +12 -11
  67. package/dist/rpc/redis/index.d.mts +3 -3
  68. package/dist/rpc/redis/index.d.ts +3 -3
  69. package/dist/rpc/redis/index.js +24 -20
  70. package/dist/rpc/redis/index.mjs +15 -11
  71. package/dist/test.d.mts +3 -3
  72. package/dist/test.d.ts +3 -3
  73. package/dist/test.js +6 -6
  74. package/dist/test.mjs +2 -2
  75. package/dist/{types-JVT0mgLD.d.ts → types-BtbL49Zs.d.mts} +2 -1
  76. package/dist/{types-DIw7B6Up.d.ts → types-VFzEM7LL.d.ts} +5 -5
  77. package/dist/{types-BvD3B5Ny.d.mts → types-h40T3cRG.d.mts} +5 -5
  78. package/dist/{types-t9D1fU6G.d.mts → types-m3IEDKjP.d.ts} +2 -1
  79. package/package.json +23 -23
  80. package/register/loader.mjs +366 -367
  81. package/dist/chunk-DVTBLV6I.js +0 -539
  82. package/dist/server/h3/index.js +0 -154
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); } 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; } var _class; var _class2; var _class3;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); } 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; } var _class; var _class2; var _class3; var _class4; var _class5;
2
2
 
3
3
 
4
4
 
@@ -6,6 +6,7 @@
6
6
 
7
7
 
8
8
 
9
+ var _chunk7YQ57BQSjs = require('./chunk-7YQ57BQS.js');
9
10
 
10
11
 
11
12
 
@@ -23,7 +24,6 @@
23
24
 
24
25
 
25
26
 
26
- var _chunkJDV2XJYEjs = require('./chunk-JDV2XJYE.js');
27
27
 
28
28
 
29
29
 
@@ -31,8 +31,8 @@ var _chunkJDV2XJYEjs = require('./chunk-JDV2XJYE.js');
31
31
 
32
32
 
33
33
 
34
+ var _chunkMBCHNDAYjs = require('./chunk-MBCHNDAY.js');
34
35
 
35
- var _chunkNL6QBQARjs = require('./chunk-NL6QBQAR.js');
36
36
 
37
37
 
38
38
 
@@ -56,9 +56,9 @@ var _chunkNL6QBQARjs = require('./chunk-NL6QBQAR.js');
56
56
 
57
57
 
58
58
 
59
+ var _chunkGSPBHZBHjs = require('./chunk-GSPBHZBH.js');
59
60
 
60
61
 
61
- var _chunkDVTBLV6Ijs = require('./chunk-DVTBLV6I.js');
62
62
 
63
63
 
64
64
 
@@ -70,14 +70,13 @@ var _chunkDVTBLV6Ijs = require('./chunk-DVTBLV6I.js');
70
70
 
71
71
 
72
72
 
73
-
74
- var _chunkTVT62GIXjs = require('./chunk-TVT62GIX.js');
73
+ var _chunkJ5CFUN4Vjs = require('./chunk-J5CFUN4V.js');
75
74
 
76
75
  // src/types.ts
77
76
  var ResponseSymbol = Symbol("response");
78
77
  var CustomResponse = class {
79
78
  static {
80
- _chunkTVT62GIXjs.__name.call(void 0, this, "CustomResponse");
79
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "CustomResponse");
81
80
  }
82
81
 
83
82
  };
@@ -90,35 +89,35 @@ function _ts_decorate(decorators, target, key, desc) {
90
89
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
91
90
  return c > 3 && r && Object.defineProperty(target, key, r), r;
92
91
  }
93
- _chunkTVT62GIXjs.__name.call(void 0, _ts_decorate, "_ts_decorate");
92
+ _chunkJ5CFUN4Vjs.__name.call(void 0, _ts_decorate, "_ts_decorate");
94
93
  function _ts_metadata(k, v) {
95
94
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
96
95
  }
97
- _chunkTVT62GIXjs.__name.call(void 0, _ts_metadata, "_ts_metadata");
96
+ _chunkJ5CFUN4Vjs.__name.call(void 0, _ts_metadata, "_ts_metadata");
98
97
  var ServerBase = (_class = class extends _phecdacore.Base {constructor(...args2) { super(...args2); _class.prototype.__init.call(this); }
99
98
  static {
100
- _chunkTVT62GIXjs.__name.call(void 0, this, "ServerBase");
99
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "ServerBase");
101
100
  }
102
- __init() {this.emitter = exports.emitter = _chunkNL6QBQARjs.emitter}
101
+ __init() {this.emitter = exports.emitter = _chunk7YQ57BQSjs.emitter}
103
102
  }, _class);
104
103
  var HttpBase = class extends ServerBase {
105
104
  static {
106
- _chunkTVT62GIXjs.__name.call(void 0, this, "HttpBase");
105
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "HttpBase");
107
106
  }
108
107
 
109
108
  };
110
109
  _ts_decorate([
111
- _chunkJDV2XJYEjs.Ctx,
110
+ _chunkMBCHNDAYjs.Ctx,
112
111
  _ts_metadata("design:type", typeof HttpContext === "undefined" ? Object : HttpContext)
113
112
  ], HttpBase.prototype, "context", void 0);
114
113
  var RpcBase = class extends ServerBase {
115
114
  static {
116
- _chunkTVT62GIXjs.__name.call(void 0, this, "RpcBase");
115
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "RpcBase");
117
116
  }
118
117
 
119
118
  };
120
119
  _ts_decorate([
121
- _chunkJDV2XJYEjs.Ctx,
120
+ _chunkMBCHNDAYjs.Ctx,
122
121
  _ts_metadata("design:type", typeof RpcContext === "undefined" ? Object : RpcContext)
123
122
  ], RpcBase.prototype, "context", void 0);
124
123
 
@@ -126,125 +125,106 @@ _ts_decorate([
126
125
 
127
126
  var PFilter = class extends ServerBase {
128
127
  static {
129
- _chunkTVT62GIXjs.__name.call(void 0, this, "PFilter");
128
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "PFilter");
130
129
  }
131
130
 
132
131
  constructor(tag) {
133
132
  super();
134
133
  this.key = tag || _phecdacore.getTag.call(void 0, this);
135
- _chunkDVTBLV6Ijs.addFilter.call(void 0, this.key, this.use.bind(this));
134
+ _chunkGSPBHZBHjs.addFilter.call(void 0, this.key, this.use.bind(this));
136
135
  this.onUnmount(() => {
137
- delete _chunkDVTBLV6Ijs.Context.filterRecord[this.key];
136
+ delete _chunkGSPBHZBHjs.Context.filterRecord[this.key];
138
137
  });
139
138
  }
140
139
  };
141
140
 
142
141
  // src/modules/guard.ts
143
142
 
144
- var PGuard = class extends ServerBase {
143
+ var PGuard = (_class2 = class extends ServerBase {
145
144
  static {
146
- _chunkTVT62GIXjs.__name.call(void 0, this, "PGuard");
145
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "PGuard");
147
146
  }
148
147
 
148
+ __init2() {this.priority = 0}
149
149
  constructor(tag) {
150
- super();
150
+ super();_class2.prototype.__init2.call(this);;
151
151
  this.key = tag || _phecdacore.getTag.call(void 0, this);
152
- _chunkDVTBLV6Ijs.addGuard.call(void 0, this.key, this.use.bind(this));
152
+ _chunkGSPBHZBHjs.addGuard.call(void 0, this.key, this.use.bind(this), this.priority);
153
153
  this.onUnmount(() => {
154
- delete _chunkDVTBLV6Ijs.Context.guardRecord[this.key];
154
+ delete _chunkGSPBHZBHjs.Context.guardRecord[this.key];
155
155
  });
156
156
  }
157
- };
158
-
159
- // src/modules/interceptor.ts
160
-
161
- var PInterceptor = class extends ServerBase {
162
- static {
163
- _chunkTVT62GIXjs.__name.call(void 0, this, "PInterceptor");
164
- }
165
-
166
- constructor(tag) {
167
- super();
168
- this.key = tag || _phecdacore.getTag.call(void 0, this);
169
- this.onUnmount(() => {
170
- delete _chunkDVTBLV6Ijs.Context.interceptorRecord[this.key];
171
- });
172
- _chunkDVTBLV6Ijs.addInterceptor.call(void 0, this.key, this.use.bind(this));
173
- }
174
- };
157
+ }, _class2);
175
158
 
176
159
  // src/modules/pipe.ts
177
160
 
178
161
  var PPipe = class extends ServerBase {
179
162
  static {
180
- _chunkTVT62GIXjs.__name.call(void 0, this, "PPipe");
163
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "PPipe");
181
164
  }
182
165
 
183
166
  constructor(tag) {
184
167
  super();
185
168
  this.key = tag || _phecdacore.getTag.call(void 0, this);
186
- _chunkDVTBLV6Ijs.addPipe.call(void 0, this.key, this.use.bind(this));
169
+ _chunkGSPBHZBHjs.addPipe.call(void 0, this.key, this.use.bind(this));
187
170
  this.onUnmount(() => {
188
- delete _chunkDVTBLV6Ijs.Context.pipeRecord[this.key];
171
+ delete _chunkGSPBHZBHjs.Context.pipeRecord[this.key];
189
172
  });
190
173
  }
191
174
  };
192
175
 
193
- // src/modules/plugin.ts
176
+ // src/modules/addon.ts
194
177
 
195
- var PPlugin = class extends ServerBase {
178
+ var PAddon = (_class3 = class extends ServerBase {
196
179
  static {
197
- _chunkTVT62GIXjs.__name.call(void 0, this, "PPlugin");
180
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "PAddon");
198
181
  }
199
182
 
183
+ __init3() {this.priority = 0}
200
184
  constructor(tag) {
201
- super();
185
+ super();_class3.prototype.__init3.call(this);;
202
186
  this.key = tag || _phecdacore.getTag.call(void 0, this);
203
- _chunkDVTBLV6Ijs.addPlugin.call(void 0, this.key, this.use.bind(this));
187
+ _chunkGSPBHZBHjs.addAddon.call(void 0, this.key, this.use.bind(this), this.priority);
204
188
  this.onUnmount(() => {
205
- delete _chunkDVTBLV6Ijs.Context.pluginRecord[this.key];
189
+ delete _chunkGSPBHZBHjs.Context.addonRecord[this.key];
206
190
  });
207
191
  }
208
- };
192
+ }, _class3);
209
193
 
210
194
  // src/modules/extension.ts
211
195
 
212
196
  var PExtension = class extends ServerBase {
213
197
  static {
214
- _chunkTVT62GIXjs.__name.call(void 0, this, "PExtension");
198
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "PExtension");
215
199
  }
216
200
 
201
+
202
+
217
203
  constructor(tag) {
218
204
  super();
219
205
  const key = this.key = tag || _phecdacore.getTag.call(void 0, this);
220
206
  if (this.pipe) {
221
- _chunkDVTBLV6Ijs.addPipe.call(void 0, key, this.pipe.bind(this));
207
+ _chunkGSPBHZBHjs.addPipe.call(void 0, key, this.pipe.bind(this));
222
208
  this.onUnmount(() => {
223
- delete _chunkDVTBLV6Ijs.Context.pipeRecord[key];
209
+ delete _chunkGSPBHZBHjs.Context.pipeRecord[key];
224
210
  });
225
211
  }
226
- if (this.plugin) {
227
- _chunkDVTBLV6Ijs.addPlugin.call(void 0, key, this.plugin.bind(this));
212
+ if (this.addon) {
213
+ _chunkGSPBHZBHjs.addAddon.call(void 0, key, this.addon.bind(this), this.addonPriority);
228
214
  this.onUnmount(() => {
229
- delete _chunkDVTBLV6Ijs.Context.pluginRecord[key];
230
- });
231
- }
232
- if (this.intercept) {
233
- _chunkDVTBLV6Ijs.addInterceptor.call(void 0, key, this.intercept.bind(this));
234
- this.onUnmount(() => {
235
- delete _chunkDVTBLV6Ijs.Context.interceptorRecord[key];
215
+ delete _chunkGSPBHZBHjs.Context.addonRecord[key];
236
216
  });
237
217
  }
238
218
  if (this.guard) {
239
- _chunkDVTBLV6Ijs.addGuard.call(void 0, key, this.guard.bind(this));
219
+ _chunkGSPBHZBHjs.addGuard.call(void 0, key, this.guard.bind(this), this.guardPriority);
240
220
  this.onUnmount(() => {
241
- delete _chunkDVTBLV6Ijs.Context.guardRecord[key];
221
+ delete _chunkGSPBHZBHjs.Context.guardRecord[key];
242
222
  });
243
223
  }
244
224
  if (this.filter) {
245
- _chunkDVTBLV6Ijs.addFilter.call(void 0, key, this.filter.bind(this));
225
+ _chunkGSPBHZBHjs.addFilter.call(void 0, key, this.filter.bind(this));
246
226
  this.onUnmount(() => {
247
- delete _chunkDVTBLV6Ijs.Context.filterRecord[key];
227
+ delete _chunkGSPBHZBHjs.Context.filterRecord[key];
248
228
  });
249
229
  }
250
230
  }
@@ -254,7 +234,7 @@ var PExtension = class extends ServerBase {
254
234
  var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
255
235
  var Generator = class {
256
236
  static {
257
- _chunkTVT62GIXjs.__name.call(void 0, this, "Generator");
237
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "Generator");
258
238
  }
259
239
 
260
240
  constructor(path) {
@@ -269,12 +249,12 @@ var Generator = class {
269
249
  };
270
250
 
271
251
  // src/generator/rpc.ts
272
- var RPCGenerator = (_class2 = class extends Generator {constructor(...args3) { super(...args3); _class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this); }
252
+ var RPCGenerator = (_class4 = class extends Generator {constructor(...args3) { super(...args3); _class4.prototype.__init4.call(this);_class4.prototype.__init5.call(this); }
273
253
  static {
274
- _chunkTVT62GIXjs.__name.call(void 0, this, "RPCGenerator");
254
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "RPCGenerator");
275
255
  }
276
- __init2() {this.name = "RPC"}
277
- __init3() {this.classMap = {}}
256
+ __init4() {this.name = "RPC"}
257
+ __init5() {this.classMap = {}}
278
258
  getContent() {
279
259
  let content = "";
280
260
  for (const name in this.classMap) {
@@ -302,15 +282,15 @@ var RPCGenerator = (_class2 = class extends Generator {constructor(...args3) { s
302
282
  }
303
283
  return this.getContent();
304
284
  }
305
- }, _class2);
285
+ }, _class4);
306
286
 
307
287
  // src/generator/http.ts
308
- var HTTPGenerator = (_class3 = class extends Generator {constructor(...args4) { super(...args4); _class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this); }
288
+ var HTTPGenerator = (_class5 = class extends Generator {constructor(...args4) { super(...args4); _class5.prototype.__init6.call(this);_class5.prototype.__init7.call(this); }
309
289
  static {
310
- _chunkTVT62GIXjs.__name.call(void 0, this, "HTTPGenerator");
290
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "HTTPGenerator");
311
291
  }
312
- __init4() {this.name = "HTTP"}
313
- __init5() {this.classMap = {}}
292
+ __init6() {this.name = "HTTP"}
293
+ __init7() {this.classMap = {}}
314
294
  getContent() {
315
295
  let content = "";
316
296
  for (const name in this.classMap) {
@@ -343,7 +323,7 @@ return ret
343
323
  }
344
324
  return this.getContent();
345
325
  }
346
- }, _class3);
326
+ }, _class5);
347
327
 
348
328
  // src/index.ts
349
329
 
@@ -424,6 +404,4 @@ return ret
424
404
 
425
405
 
426
406
 
427
-
428
-
429
- exports.Arg = _chunkJDV2XJYEjs.Arg; exports.BadGatewayException = _chunkDVTBLV6Ijs.BadGatewayException; exports.BadRequestException = _chunkDVTBLV6Ijs.BadRequestException; exports.BaseParam = _chunkJDV2XJYEjs.BaseParam; exports.Body = _chunkJDV2XJYEjs.Body; exports.ConflictException = _chunkDVTBLV6Ijs.ConflictException; exports.Context = _chunkDVTBLV6Ijs.Context; exports.Controller = _chunkJDV2XJYEjs.Controller; exports.Ctx = _chunkJDV2XJYEjs.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkJDV2XJYEjs.Define; exports.Delete = _chunkJDV2XJYEjs.Delete; exports.ERROR_SYMBOL = _chunkTVT62GIXjs.ERROR_SYMBOL; exports.Exception = _chunkDVTBLV6Ijs.Exception; exports.Factory = _chunkNL6QBQARjs.Factory; exports.Filter = _chunkJDV2XJYEjs.Filter; exports.ForbiddenException = _chunkDVTBLV6Ijs.ForbiddenException; exports.FrameworkException = _chunkDVTBLV6Ijs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkJDV2XJYEjs.Get; exports.Guard = _chunkJDV2XJYEjs.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkJDV2XJYEjs.Head; exports.Header = _chunkJDV2XJYEjs.Header; exports.HttpBase = HttpBase; exports.IS_HMR = _chunkTVT62GIXjs.IS_HMR; exports.IS_ONLY_GENERATE = _chunkTVT62GIXjs.IS_ONLY_GENERATE; exports.IS_STRICT = _chunkTVT62GIXjs.IS_STRICT; exports.Interceptor = _chunkJDV2XJYEjs.Interceptor; exports.InvalidInputException = _chunkDVTBLV6Ijs.InvalidInputException; exports.LOG_LEVEL = _chunkTVT62GIXjs.LOG_LEVEL; exports.Meta = _chunkNL6QBQARjs.Meta; exports.Mixin = _chunkTVT62GIXjs.Mixin; exports.NotFoundException = _chunkDVTBLV6Ijs.NotFoundException; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PInterceptor = PInterceptor; exports.PPipe = PPipe; exports.PPlugin = PPlugin; exports.PS_EXIT_CODE = _chunkTVT62GIXjs.PS_EXIT_CODE; exports.Param = _chunkJDV2XJYEjs.Param; exports.Patch = _chunkJDV2XJYEjs.Patch; exports.PayloadLargeException = _chunkDVTBLV6Ijs.PayloadLargeException; exports.Pipe = _chunkJDV2XJYEjs.Pipe; exports.Plugin = _chunkJDV2XJYEjs.Plugin; exports.Post = _chunkJDV2XJYEjs.Post; exports.Put = _chunkJDV2XJYEjs.Put; exports.Query = _chunkJDV2XJYEjs.Query; exports.Queue = _chunkJDV2XJYEjs.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkJDV2XJYEjs.Route; exports.Rpc = _chunkJDV2XJYEjs.Rpc; exports.RpcBase = RpcBase; exports.Search = _chunkJDV2XJYEjs.Search; exports.ServerBase = ServerBase; exports.ServerPhecda = _chunkNL6QBQARjs.ServerPhecda; exports.ServiceUnavailableException = _chunkDVTBLV6Ijs.ServiceUnavailableException; exports.TimeoutException = _chunkDVTBLV6Ijs.TimeoutException; exports.TimerException = _chunkDVTBLV6Ijs.TimerException; exports.UnauthorizedException = _chunkDVTBLV6Ijs.UnauthorizedException; exports.UndefinedException = _chunkDVTBLV6Ijs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkDVTBLV6Ijs.UnsupportedMediaTypeException; exports.ValidateException = _chunkDVTBLV6Ijs.ValidateException; exports.WorkerException = _chunkDVTBLV6Ijs.WorkerException; exports.addFilter = _chunkDVTBLV6Ijs.addFilter; exports.addGuard = _chunkDVTBLV6Ijs.addGuard; exports.addInterceptor = _chunkDVTBLV6Ijs.addInterceptor; exports.addPipe = _chunkDVTBLV6Ijs.addPipe; exports.addPlugin = _chunkDVTBLV6Ijs.addPlugin; exports.defaultPipe = _chunkDVTBLV6Ijs.defaultPipe; exports.defaultServerInject = _chunkNL6QBQARjs.defaultServerInject; exports.emitter = _chunkNL6QBQARjs.emitter; exports.getLogger = _chunkTVT62GIXjs.getLogger; exports.log = _chunkTVT62GIXjs.log; exports.phecdaNamespace = _chunkNL6QBQARjs.phecdaNamespace; exports.setLogger = _chunkTVT62GIXjs.setLogger; exports.useS = _chunkNL6QBQARjs.useS;
407
+ exports.Addon = _chunkMBCHNDAYjs.Addon; exports.Arg = _chunkMBCHNDAYjs.Arg; exports.BadGatewayException = _chunkGSPBHZBHjs.BadGatewayException; exports.BadRequestException = _chunkGSPBHZBHjs.BadRequestException; exports.BaseParam = _chunkMBCHNDAYjs.BaseParam; exports.Body = _chunkMBCHNDAYjs.Body; exports.ConflictException = _chunkGSPBHZBHjs.ConflictException; exports.Context = _chunkGSPBHZBHjs.Context; exports.Controller = _chunkMBCHNDAYjs.Controller; exports.Ctx = _chunkMBCHNDAYjs.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkMBCHNDAYjs.Define; exports.Delete = _chunkMBCHNDAYjs.Delete; exports.ERROR_SYMBOL = _chunkJ5CFUN4Vjs.ERROR_SYMBOL; exports.Exception = _chunkGSPBHZBHjs.Exception; exports.Factory = _chunk7YQ57BQSjs.Factory; exports.Filter = _chunkMBCHNDAYjs.Filter; exports.ForbiddenException = _chunkGSPBHZBHjs.ForbiddenException; exports.FrameworkException = _chunkGSPBHZBHjs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkMBCHNDAYjs.Get; exports.Guard = _chunkMBCHNDAYjs.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkMBCHNDAYjs.Head; exports.Header = _chunkMBCHNDAYjs.Header; exports.HttpBase = HttpBase; exports.IS_HMR = _chunkJ5CFUN4Vjs.IS_HMR; exports.IS_ONLY_GENERATE = _chunkJ5CFUN4Vjs.IS_ONLY_GENERATE; exports.IS_STRICT = _chunkJ5CFUN4Vjs.IS_STRICT; exports.InvalidInputException = _chunkGSPBHZBHjs.InvalidInputException; exports.LOG_LEVEL = _chunkJ5CFUN4Vjs.LOG_LEVEL; exports.Meta = _chunk7YQ57BQSjs.Meta; exports.Mixin = _chunkJ5CFUN4Vjs.Mixin; exports.NotFoundException = _chunkGSPBHZBHjs.NotFoundException; exports.PAddon = PAddon; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PPipe = PPipe; exports.PS_EXIT_CODE = _chunkJ5CFUN4Vjs.PS_EXIT_CODE; exports.Param = _chunkMBCHNDAYjs.Param; exports.Patch = _chunkMBCHNDAYjs.Patch; exports.PayloadLargeException = _chunkGSPBHZBHjs.PayloadLargeException; exports.Pipe = _chunkMBCHNDAYjs.Pipe; exports.Post = _chunkMBCHNDAYjs.Post; exports.Put = _chunkMBCHNDAYjs.Put; exports.Query = _chunkMBCHNDAYjs.Query; exports.Queue = _chunkMBCHNDAYjs.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkMBCHNDAYjs.Route; exports.Rpc = _chunkMBCHNDAYjs.Rpc; exports.RpcBase = RpcBase; exports.Search = _chunkMBCHNDAYjs.Search; exports.ServerBase = ServerBase; exports.ServerPhecda = _chunk7YQ57BQSjs.ServerPhecda; exports.ServiceUnavailableException = _chunkGSPBHZBHjs.ServiceUnavailableException; exports.TimeoutException = _chunkGSPBHZBHjs.TimeoutException; exports.TimerException = _chunkGSPBHZBHjs.TimerException; exports.UnauthorizedException = _chunkGSPBHZBHjs.UnauthorizedException; exports.UndefinedException = _chunkGSPBHZBHjs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkGSPBHZBHjs.UnsupportedMediaTypeException; exports.ValidateException = _chunkGSPBHZBHjs.ValidateException; exports.WorkerException = _chunkGSPBHZBHjs.WorkerException; exports.addAddon = _chunkGSPBHZBHjs.addAddon; exports.addFilter = _chunkGSPBHZBHjs.addFilter; exports.addGuard = _chunkGSPBHZBHjs.addGuard; exports.addPipe = _chunkGSPBHZBHjs.addPipe; exports.defaultPipe = _chunkGSPBHZBHjs.defaultPipe; exports.defaultServerInject = _chunk7YQ57BQSjs.defaultServerInject; exports.emitter = _chunk7YQ57BQSjs.emitter; exports.getLogger = _chunkJ5CFUN4Vjs.getLogger; exports.log = _chunkJ5CFUN4Vjs.log; exports.phecdaNamespace = _chunk7YQ57BQSjs.phecdaNamespace; exports.runMiddleware = _chunkJ5CFUN4Vjs.runMiddleware; exports.setLogger = _chunkJ5CFUN4Vjs.setLogger; exports.useS = _chunk7YQ57BQSjs.useS;
package/dist/index.mjs CHANGED
@@ -1,4 +1,14 @@
1
1
  import {
2
+ Factory,
3
+ Meta,
4
+ ServerPhecda,
5
+ defaultServerInject,
6
+ emitter,
7
+ phecdaNamespace,
8
+ useS
9
+ } from "./chunk-XYVMNY2X.mjs";
10
+ import {
11
+ Addon,
2
12
  Arg,
3
13
  BaseParam,
4
14
  Body,
@@ -11,11 +21,9 @@ import {
11
21
  Guard,
12
22
  Head,
13
23
  Header,
14
- Interceptor,
15
24
  Param,
16
25
  Patch,
17
26
  Pipe,
18
- Plugin,
19
27
  Post,
20
28
  Put,
21
29
  Query,
@@ -23,16 +31,7 @@ import {
23
31
  Route,
24
32
  Rpc,
25
33
  Search
26
- } from "./chunk-J7B24YSE.mjs";
27
- import {
28
- Factory,
29
- Meta,
30
- ServerPhecda,
31
- defaultServerInject,
32
- emitter,
33
- phecdaNamespace,
34
- useS
35
- } from "./chunk-3H3T54IC.mjs";
34
+ } from "./chunk-HMVLXNV3.mjs";
36
35
  import {
37
36
  BadGatewayException,
38
37
  BadRequestException,
@@ -52,13 +51,12 @@ import {
52
51
  UnsupportedMediaTypeException,
53
52
  ValidateException,
54
53
  WorkerException,
54
+ addAddon,
55
55
  addFilter,
56
56
  addGuard,
57
- addInterceptor,
58
57
  addPipe,
59
- addPlugin,
60
58
  defaultPipe
61
- } from "./chunk-2CFYUXPM.mjs";
59
+ } from "./chunk-V7EI76QQ.mjs";
62
60
  import {
63
61
  ERROR_SYMBOL,
64
62
  IS_HMR,
@@ -70,8 +68,9 @@ import {
70
68
  __name,
71
69
  getLogger,
72
70
  log,
71
+ runMiddleware,
73
72
  setLogger
74
- } from "./chunk-G7TD2VB7.mjs";
73
+ } from "./chunk-WHJ5FALK.mjs";
75
74
 
76
75
  // src/types.ts
77
76
  var ResponseSymbol = Symbol("response");
@@ -146,35 +145,19 @@ var PGuard = class extends ServerBase {
146
145
  __name(this, "PGuard");
147
146
  }
148
147
  key;
148
+ priority = 0;
149
149
  constructor(tag) {
150
150
  super();
151
151
  this.key = tag || getTag2(this);
152
- addGuard(this.key, this.use.bind(this));
152
+ addGuard(this.key, this.use.bind(this), this.priority);
153
153
  this.onUnmount(() => {
154
154
  delete Context.guardRecord[this.key];
155
155
  });
156
156
  }
157
157
  };
158
158
 
159
- // src/modules/interceptor.ts
160
- import { getTag as getTag3 } from "phecda-core";
161
- var PInterceptor = class extends ServerBase {
162
- static {
163
- __name(this, "PInterceptor");
164
- }
165
- key;
166
- constructor(tag) {
167
- super();
168
- this.key = tag || getTag3(this);
169
- this.onUnmount(() => {
170
- delete Context.interceptorRecord[this.key];
171
- });
172
- addInterceptor(this.key, this.use.bind(this));
173
- }
174
- };
175
-
176
159
  // src/modules/pipe.ts
177
- import { getTag as getTag4 } from "phecda-core";
160
+ import { getTag as getTag3 } from "phecda-core";
178
161
  var PPipe = class extends ServerBase {
179
162
  static {
180
163
  __name(this, "PPipe");
@@ -182,7 +165,7 @@ var PPipe = class extends ServerBase {
182
165
  key;
183
166
  constructor(tag) {
184
167
  super();
185
- this.key = tag || getTag4(this);
168
+ this.key = tag || getTag3(this);
186
169
  addPipe(this.key, this.use.bind(this));
187
170
  this.onUnmount(() => {
188
171
  delete Context.pipeRecord[this.key];
@@ -190,53 +173,50 @@ var PPipe = class extends ServerBase {
190
173
  }
191
174
  };
192
175
 
193
- // src/modules/plugin.ts
194
- import { getTag as getTag5 } from "phecda-core";
195
- var PPlugin = class extends ServerBase {
176
+ // src/modules/addon.ts
177
+ import { getTag as getTag4 } from "phecda-core";
178
+ var PAddon = class extends ServerBase {
196
179
  static {
197
- __name(this, "PPlugin");
180
+ __name(this, "PAddon");
198
181
  }
199
182
  key;
183
+ priority = 0;
200
184
  constructor(tag) {
201
185
  super();
202
- this.key = tag || getTag5(this);
203
- addPlugin(this.key, this.use.bind(this));
186
+ this.key = tag || getTag4(this);
187
+ addAddon(this.key, this.use.bind(this), this.priority);
204
188
  this.onUnmount(() => {
205
- delete Context.pluginRecord[this.key];
189
+ delete Context.addonRecord[this.key];
206
190
  });
207
191
  }
208
192
  };
209
193
 
210
194
  // src/modules/extension.ts
211
- import { getTag as getTag6 } from "phecda-core";
195
+ import { getTag as getTag5 } from "phecda-core";
212
196
  var PExtension = class extends ServerBase {
213
197
  static {
214
198
  __name(this, "PExtension");
215
199
  }
216
200
  key;
201
+ guardPriority;
202
+ addonPriority;
217
203
  constructor(tag) {
218
204
  super();
219
- const key = this.key = tag || getTag6(this);
205
+ const key = this.key = tag || getTag5(this);
220
206
  if (this.pipe) {
221
207
  addPipe(key, this.pipe.bind(this));
222
208
  this.onUnmount(() => {
223
209
  delete Context.pipeRecord[key];
224
210
  });
225
211
  }
226
- if (this.plugin) {
227
- addPlugin(key, this.plugin.bind(this));
228
- this.onUnmount(() => {
229
- delete Context.pluginRecord[key];
230
- });
231
- }
232
- if (this.intercept) {
233
- addInterceptor(key, this.intercept.bind(this));
212
+ if (this.addon) {
213
+ addAddon(key, this.addon.bind(this), this.addonPriority);
234
214
  this.onUnmount(() => {
235
- delete Context.interceptorRecord[key];
215
+ delete Context.addonRecord[key];
236
216
  });
237
217
  }
238
218
  if (this.guard) {
239
- addGuard(key, this.guard.bind(this));
219
+ addGuard(key, this.guard.bind(this), this.guardPriority);
240
220
  this.onUnmount(() => {
241
221
  delete Context.guardRecord[key];
242
222
  });
@@ -348,6 +328,7 @@ return ret
348
328
  // src/index.ts
349
329
  export * from "phecda-core";
350
330
  export {
331
+ Addon,
351
332
  Arg,
352
333
  BadGatewayException,
353
334
  BadRequestException,
@@ -376,24 +357,21 @@ export {
376
357
  IS_HMR,
377
358
  IS_ONLY_GENERATE,
378
359
  IS_STRICT,
379
- Interceptor,
380
360
  InvalidInputException,
381
361
  LOG_LEVEL,
382
362
  Meta,
383
363
  Mixin,
384
364
  NotFoundException,
365
+ PAddon,
385
366
  PExtension,
386
367
  PFilter,
387
368
  PGuard,
388
- PInterceptor,
389
369
  PPipe,
390
- PPlugin,
391
370
  PS_EXIT_CODE,
392
371
  Param,
393
372
  Patch,
394
373
  PayloadLargeException,
395
374
  Pipe,
396
- Plugin,
397
375
  Post,
398
376
  Put,
399
377
  Query,
@@ -413,17 +391,17 @@ export {
413
391
  UnsupportedMediaTypeException,
414
392
  ValidateException,
415
393
  WorkerException,
394
+ addAddon,
416
395
  addFilter,
417
396
  addGuard,
418
- addInterceptor,
419
397
  addPipe,
420
- addPlugin,
421
398
  defaultPipe,
422
399
  defaultServerInject,
423
400
  emitter,
424
401
  getLogger,
425
402
  log,
426
403
  phecdaNamespace,
404
+ runMiddleware,
427
405
  setLogger,
428
406
  useS
429
407
  };
@@ -41,9 +41,9 @@ interface BaseContext {
41
41
  }
42
42
  interface DefaultOptions {
43
43
  globalGuards?: string[];
44
- globalInterceptors?: string[];
45
44
  globalFilter?: string;
46
45
  globalPipe?: string;
46
+ globalAddons?: string[];
47
47
  }
48
48
  interface BaseError {
49
49
  [ERROR_SYMBOL]: true;
@@ -91,8 +91,7 @@ interface ControllerMetaData extends ServiceMetaData {
91
91
  guards: string[];
92
92
  pipe?: string;
93
93
  filter?: string;
94
- interceptors: string[];
95
- plugins: string[];
94
+ addons: string[];
96
95
  }
97
96
  type MetaData = ControllerMetaData | ServiceMetaData;
98
97
  declare class Meta {
@@ -41,9 +41,9 @@ interface BaseContext {
41
41
  }
42
42
  interface DefaultOptions {
43
43
  globalGuards?: string[];
44
- globalInterceptors?: string[];
45
44
  globalFilter?: string;
46
45
  globalPipe?: string;
46
+ globalAddons?: string[];
47
47
  }
48
48
  interface BaseError {
49
49
  [ERROR_SYMBOL]: true;
@@ -91,8 +91,7 @@ interface ControllerMetaData extends ServiceMetaData {
91
91
  guards: string[];
92
92
  pipe?: string;
93
93
  filter?: string;
94
- interceptors: string[];
95
- plugins: string[];
94
+ addons: string[];
96
95
  }
97
96
  type MetaData = ControllerMetaData | ServiceMetaData;
98
97
  declare class Meta {
@@ -1,17 +1,17 @@
1
1
  import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
2
- import { F as Factory } from '../../core-P1CsH6jz.mjs';
3
- import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-t9D1fU6G.mjs';
4
- import { T as ToClientMap } from '../../meta-KtfiBIde.mjs';
2
+ import { F as Factory } from '../../core-BIcUwV18.mjs';
3
+ import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-BtbL49Zs.mjs';
4
+ import { T as ToClientMap } from '../../meta-BXKLFTgG.mjs';
5
5
  import 'phecda-core';
6
6
 
7
7
  interface BullmqCtx extends RpcContext {
8
8
  type: 'bullmq';
9
9
  }
10
- interface BullmqOptions {
10
+ type BullmqOptions = Omit<RpcServerOptions, 'globalAddons'> & {
11
11
  workerOpts?: WorkerOptions;
12
12
  queueOpts?: QueueOptions;
13
- }
14
- declare function create({ moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: BullmqOptions & RpcServerOptions): Promise<{
13
+ };
14
+ declare function create({ moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: BullmqOptions): Promise<{
15
15
  workerMap: Record<string, Worker<any, any, string>>;
16
16
  queueMap: Record<string, Queue<any, any, string>>;
17
17
  }>;
@@ -1,17 +1,17 @@
1
1
  import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
2
- import { F as Factory } from '../../core-BlN0Spy9.js';
3
- import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-JVT0mgLD.js';
4
- import { T as ToClientMap } from '../../meta-KtfiBIde.js';
2
+ import { F as Factory } from '../../core-CYwEPfN4.js';
3
+ import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-m3IEDKjP.js';
4
+ import { T as ToClientMap } from '../../meta-BXKLFTgG.js';
5
5
  import 'phecda-core';
6
6
 
7
7
  interface BullmqCtx extends RpcContext {
8
8
  type: 'bullmq';
9
9
  }
10
- interface BullmqOptions {
10
+ type BullmqOptions = Omit<RpcServerOptions, 'globalAddons'> & {
11
11
  workerOpts?: WorkerOptions;
12
12
  queueOpts?: QueueOptions;
13
- }
14
- declare function create({ moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: BullmqOptions & RpcServerOptions): Promise<{
13
+ };
14
+ declare function create({ moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: BullmqOptions): Promise<{
15
15
  workerMap: Record<string, Worker<any, any, string>>;
16
16
  queueMap: Record<string, Queue<any, any, string>>;
17
17
  }>;