phecda-server 6.0.2 → 7.0.0-alpha.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 (83) hide show
  1. package/bin/cli.mjs +160 -157
  2. package/dist/{chunk-HDQAT2IM.mjs → chunk-5622RBNB.mjs} +118 -90
  3. package/dist/chunk-BGXSMOLX.js +265 -0
  4. package/dist/{chunk-F3W3NN7F.mjs → chunk-HMVLXNV3.mjs} +5 -14
  5. package/dist/{chunk-GHFSIZUO.js → chunk-J5CFUN4V.js} +18 -3
  6. package/dist/{chunk-XCND2QW3.js → chunk-MBCHNDAY.js} +27 -36
  7. package/dist/{chunk-WXFZZZRY.mjs → chunk-P75VKZJY.mjs} +101 -137
  8. package/dist/chunk-SW5IKE5H.js +503 -0
  9. package/dist/{chunk-UXD62LGG.mjs → chunk-WHJ5FALK.mjs} +17 -2
  10. package/dist/core-BIcUwV18.d.mts +47 -0
  11. package/dist/core-CYwEPfN4.d.ts +47 -0
  12. package/dist/helper.d.mts +4 -6
  13. package/dist/helper.d.ts +4 -6
  14. package/dist/helper.js +3 -3
  15. package/dist/helper.mjs +2 -2
  16. package/dist/{server → http}/elysia/index.d.mts +5 -5
  17. package/dist/{server → http}/elysia/index.d.ts +5 -5
  18. package/dist/{server → http}/elysia/index.js +80 -62
  19. package/dist/{server → http}/elysia/index.mjs +50 -32
  20. package/dist/{server → http}/express/index.d.mts +5 -5
  21. package/dist/{server → http}/express/index.d.ts +5 -5
  22. package/dist/{server → http}/express/index.js +71 -55
  23. package/dist/{server → http}/express/index.mjs +42 -26
  24. package/dist/{server → http}/fastify/index.d.mts +5 -5
  25. package/dist/{server → http}/fastify/index.d.ts +5 -5
  26. package/dist/{server → http}/fastify/index.js +72 -72
  27. package/dist/{server → http}/fastify/index.mjs +47 -47
  28. package/dist/{server → http}/h3/index.d.mts +5 -5
  29. package/dist/{server → http}/h3/index.d.ts +5 -5
  30. package/dist/http/h3/index.js +160 -0
  31. package/dist/{server → http}/h3/index.mjs +68 -62
  32. package/dist/{server → http}/hono/index.d.mts +5 -5
  33. package/dist/{server → http}/hono/index.d.ts +5 -5
  34. package/dist/{server → http}/hono/index.js +69 -54
  35. package/dist/{server → http}/hono/index.mjs +41 -26
  36. package/dist/{server → http}/hyper-express/index.d.mts +5 -5
  37. package/dist/{server → http}/hyper-express/index.d.ts +5 -5
  38. package/dist/{server → http}/hyper-express/index.js +69 -56
  39. package/dist/{server → http}/hyper-express/index.mjs +41 -28
  40. package/dist/{server → http}/koa/index.d.mts +5 -5
  41. package/dist/{server → http}/koa/index.d.ts +5 -5
  42. package/dist/{server → http}/koa/index.js +71 -55
  43. package/dist/{server → http}/koa/index.mjs +42 -26
  44. package/dist/index.d.mts +53 -41
  45. package/dist/index.d.ts +53 -41
  46. package/dist/index.js +62 -78
  47. package/dist/index.mjs +46 -62
  48. package/dist/{meta-KtfiBIde.d.ts → meta-BXKLFTgG.d.mts} +2 -3
  49. package/dist/{meta-KtfiBIde.d.mts → meta-BXKLFTgG.d.ts} +2 -3
  50. package/dist/rpc/bullmq/index.d.mts +6 -6
  51. package/dist/rpc/bullmq/index.d.ts +6 -6
  52. package/dist/rpc/bullmq/index.js +24 -24
  53. package/dist/rpc/bullmq/index.mjs +14 -14
  54. package/dist/rpc/kafka/index.d.mts +3 -3
  55. package/dist/rpc/kafka/index.d.ts +3 -3
  56. package/dist/rpc/kafka/index.js +25 -21
  57. package/dist/rpc/kafka/index.mjs +15 -11
  58. package/dist/rpc/nats/index.d.mts +3 -3
  59. package/dist/rpc/nats/index.d.ts +3 -3
  60. package/dist/rpc/nats/index.js +22 -21
  61. package/dist/rpc/nats/index.mjs +13 -12
  62. package/dist/rpc/rabbitmq/index.d.mts +3 -3
  63. package/dist/rpc/rabbitmq/index.d.ts +3 -3
  64. package/dist/rpc/rabbitmq/index.js +23 -22
  65. package/dist/rpc/rabbitmq/index.mjs +12 -11
  66. package/dist/rpc/redis/index.d.mts +3 -3
  67. package/dist/rpc/redis/index.d.ts +3 -3
  68. package/dist/rpc/redis/index.js +24 -20
  69. package/dist/rpc/redis/index.mjs +15 -11
  70. package/dist/test.d.mts +3 -3
  71. package/dist/test.d.ts +3 -3
  72. package/dist/test.js +6 -6
  73. package/dist/test.mjs +2 -2
  74. package/dist/{types-JVT0mgLD.d.ts → types-BtbL49Zs.d.mts} +2 -1
  75. package/dist/{types-DIw7B6Up.d.ts → types-VFzEM7LL.d.ts} +5 -5
  76. package/dist/{types-BvD3B5Ny.d.mts → types-h40T3cRG.d.mts} +5 -5
  77. package/dist/{types-t9D1fU6G.d.mts → types-m3IEDKjP.d.ts} +2 -1
  78. package/package.json +24 -24
  79. package/dist/chunk-7SYPUIBY.js +0 -539
  80. package/dist/chunk-LYEZ6RGX.js +0 -237
  81. package/dist/core-2SNw8m2B.d.mts +0 -30
  82. package/dist/core-BmJJLUqj.d.ts +0 -30
  83. package/dist/server/h3/index.js +0 -154
@@ -0,0 +1,265 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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; } var _class;
2
+
3
+
4
+
5
+
6
+ var _chunkJ5CFUN4Vjs = require('./chunk-J5CFUN4V.js');
7
+
8
+ // src/meta.ts
9
+ var Meta = class {
10
+ static {
11
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "Meta");
12
+ }
13
+
14
+
15
+ constructor(data, paramsType) {
16
+ this.data = data;
17
+ this.paramsType = paramsType;
18
+ }
19
+ };
20
+
21
+ // src/core.ts
22
+ require('reflect-metadata');
23
+ var _events = require('events'); var _events2 = _interopRequireDefault(_events);
24
+ var _phecdacore = require('phecda-core');
25
+ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
26
+ var debug = _debug2.default.call(void 0, "phecda-server(createPhecda)");
27
+ var emitter = new (0, _events2.default)();
28
+ function defaultServerInject() {
29
+ if (!_phecdacore.getInject.call(void 0, "watcher")) {
30
+ _phecdacore.setInject.call(void 0, "watcher", ({ eventName, instance, property, options }) => {
31
+ const fn = typeof instance[property] === "function" ? instance[property].bind(instance) : (v) => instance[property] = v;
32
+ if (_optionalChain([options, 'optionalAccess', _ => _.once])) emitter.once(eventName, fn);
33
+ else emitter.on(eventName, fn);
34
+ return () => {
35
+ emitter.off(eventName, fn);
36
+ };
37
+ });
38
+ }
39
+ }
40
+ _chunkJ5CFUN4Vjs.__name.call(void 0, defaultServerInject, "defaultServerInject");
41
+ var phecdaNamespace = /* @__PURE__ */ new Map();
42
+ var ServerPhecda = (_class = class {
43
+ static {
44
+ _chunkJ5CFUN4Vjs.__name.call(void 0, this, "ServerPhecda");
45
+ }
46
+ __init() {this.moduleMap = /* @__PURE__ */ new Map()}
47
+ __init2() {this.meta = []}
48
+ __init3() {this.modelMap = /* @__PURE__ */ new WeakMap()}
49
+ __init4() {this.modelSet = /* @__PURE__ */ new WeakSet()}
50
+ __init5() {this.dependenceGraph = /* @__PURE__ */ new Map()}
51
+
52
+
53
+
54
+ constructor(options) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);
55
+ defaultServerInject();
56
+ const { namespace = "default", parseModule = /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (module) => module, "parseModule"), parseMeta = /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (meta) => meta, "parseMeta"), generators = [] } = options;
57
+ phecdaNamespace.set(namespace, this);
58
+ this.parseMeta = parseMeta;
59
+ this.parseModule = parseModule;
60
+ this.generators = generators;
61
+ }
62
+ async start(models) {
63
+ for (const model of models) await this.buildDepModule(model);
64
+ const generateCode = /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, async () => {
65
+ if (_chunkJ5CFUN4Vjs.IS_HMR) {
66
+ return Promise.all(this.generators.map((generator) => {
67
+ debug(`generate "${generator.name}" code to ${generator.path}`);
68
+ return generator.output(this.meta);
69
+ }));
70
+ }
71
+ }, "generateCode");
72
+ generateCode().then(() => {
73
+ if (_chunkJ5CFUN4Vjs.IS_ONLY_GENERATE) process.exit(4);
74
+ });
75
+ if (_chunkJ5CFUN4Vjs.IS_HMR) {
76
+ if (!globalThis.__PS_HMR__) globalThis.__PS_HMR__ = [];
77
+ _optionalChain([globalThis, 'access', _2 => _2.__PS_HMR__, 'optionalAccess', _3 => _3.push, 'call', _4 => _4(async (files) => {
78
+ debug("reload files ");
79
+ for (const file of files) {
80
+ const models2 = await Promise.resolve().then(() => _interopRequireWildcard(require(file)));
81
+ for (const i in models2) {
82
+ if (_phecdacore.isPhecda.call(void 0, models2[i])) await this.add(models2[i]);
83
+ }
84
+ }
85
+ generateCode();
86
+ })]);
87
+ }
88
+ }
89
+ async add(Model) {
90
+ const tag = _phecdacore.getTag.call(void 0, Model);
91
+ const oldInstance = await this.del(tag);
92
+ const { module: newModule } = await this.buildDepModule(Model);
93
+ if (oldInstance && this.dependenceGraph.has(tag)) {
94
+ debug(`replace module "${String(tag)}"`);
95
+ [
96
+ ...this.dependenceGraph.get(tag)
97
+ ].forEach((tag2) => {
98
+ const module = this.moduleMap.get(tag2);
99
+ for (const key in module) {
100
+ if (module[key] === oldInstance) module[key] = newModule;
101
+ }
102
+ });
103
+ }
104
+ }
105
+ async del(tag) {
106
+ if (!this.moduleMap.has(tag)) return;
107
+ const module = this.moduleMap.get(tag);
108
+ debug(`unmount module "${String(tag)}"`);
109
+ await _phecdacore.invokeUnmount.call(void 0, module);
110
+ debug(`del module "${String(tag)}"`);
111
+ this.moduleMap.delete(tag);
112
+ this.modelMap.delete(module);
113
+ for (let i = this.meta.length - 1; i >= 0; i--) {
114
+ if (this.meta[i].data.tag === tag) this.meta.splice(i, 1);
115
+ }
116
+ return module;
117
+ }
118
+ async destroy() {
119
+ debug("destroy all");
120
+ for (const [tag] of this.moduleMap) await this.del(tag);
121
+ }
122
+ async buildDepModule(Model) {
123
+ const paramtypes = getParamTypes(Model);
124
+ let module;
125
+ const tag = _phecdacore.getTag.call(void 0, Model);
126
+ if (this.moduleMap.has(tag)) {
127
+ module = this.moduleMap.get(tag);
128
+ if (!module) throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${String(tag)}--[module] ${Model}`);
129
+ if (this.modelMap.get(module) !== Model && !this.modelSet.has(Model)) {
130
+ this.modelSet.add(Model);
131
+ if (module instanceof Model) _chunkJ5CFUN4Vjs.log.call(void 0, `Module taged ${String(tag)} has been overridden`);
132
+ else _chunkJ5CFUN4Vjs.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Model.name}"`, "warn");
133
+ }
134
+ return {
135
+ module,
136
+ tag
137
+ };
138
+ }
139
+ this.moduleMap.set(tag, void 0);
140
+ debug(`instantiate module "${String(tag)}"`);
141
+ if (paramtypes) {
142
+ const paramtypesInstances = [];
143
+ for (const i in paramtypes) {
144
+ const { module: sub, tag: subTag } = await this.buildDepModule(paramtypes[i]);
145
+ paramtypesInstances[i] = sub;
146
+ if (!this.dependenceGraph.has(subTag)) this.dependenceGraph.set(subTag, /* @__PURE__ */ new Set());
147
+ this.dependenceGraph.get(subTag).add(tag);
148
+ }
149
+ module = this.parseModule(new Model(...paramtypesInstances));
150
+ } else {
151
+ module = this.parseModule(new Model());
152
+ }
153
+ this.meta.push(...getMetaFromInstance(module, tag, Model.name).map(this.parseMeta).filter((item) => !!item));
154
+ debug(`init module "${String(tag)}"`);
155
+ if (!_chunkJ5CFUN4Vjs.IS_ONLY_GENERATE) await _phecdacore.invokeInit.call(void 0, module);
156
+ debug(`add module "${String(tag)}"`);
157
+ this.moduleMap.set(tag, module);
158
+ this.modelMap.set(module, Model);
159
+ return {
160
+ module,
161
+ tag
162
+ };
163
+ }
164
+ has(modelOrTag) {
165
+ return this.moduleMap.has(typeof modelOrTag === "function" ? _phecdacore.getTag.call(void 0, modelOrTag) : modelOrTag);
166
+ }
167
+ get(modelOrTag) {
168
+ const tag = typeof modelOrTag === "function" ? _phecdacore.getTag.call(void 0, modelOrTag) : modelOrTag;
169
+ if (!this.has(tag)) throw new Error(`module "${tag.toString()}" doesn't exist`);
170
+ return this.moduleMap.get(tag);
171
+ }
172
+ }, _class);
173
+ async function Factory(models, opts = {}) {
174
+ const phecda = new ServerPhecda(opts);
175
+ await phecda.start(models);
176
+ return phecda;
177
+ }
178
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Factory, "Factory");
179
+ function useS(nsOrModel, namespace) {
180
+ if (!nsOrModel) {
181
+ namespace = "default";
182
+ } else {
183
+ if (typeof nsOrModel === "string") namespace = nsOrModel;
184
+ else if (!namespace) namespace = "default";
185
+ }
186
+ if (!phecdaNamespace.has(namespace)) throw new Error(`namespace "${namespace}" doesn't exist`);
187
+ const serverPhecda = phecdaNamespace.get(namespace);
188
+ if (nsOrModel && typeof nsOrModel !== "string") return serverPhecda.get(nsOrModel);
189
+ else return serverPhecda;
190
+ }
191
+ _chunkJ5CFUN4Vjs.__name.call(void 0, useS, "useS");
192
+ function getMetaFromInstance(instance, tag, name) {
193
+ const propertyKeys = _phecdacore.getMetaKey.call(void 0, instance).filter((item) => typeof item === "string");
194
+ const baseMeta = _phecdacore.getMergedMeta.call(void 0, instance, void 0);
195
+ const ctxs = baseMeta.ctxs;
196
+ return propertyKeys.filter((i) => typeof instance[i] === "function").map((i) => {
197
+ const meta = _phecdacore.getMergedMeta.call(void 0, instance, i);
198
+ const metaData = {
199
+ ...meta,
200
+ name,
201
+ tag,
202
+ func: i
203
+ };
204
+ if (baseMeta.controller) {
205
+ if (typeof tag !== "string") _chunkJ5CFUN4Vjs.log.call(void 0, `can't use Tag with ${typeof tag} on controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
206
+ metaData.controller = baseMeta.controller;
207
+ metaData[baseMeta.controller] = {
208
+ ...baseMeta[baseMeta.controller],
209
+ ...meta[baseMeta.controller]
210
+ };
211
+ const params = _phecdacore.getMetaParams.call(void 0, instance, i).map((item) => _phecdacore.getMergedMeta.call(void 0, instance, i, item));
212
+ params.forEach((item, index) => {
213
+ if (!item.pipe) item.pipe = meta.pipe || baseMeta.pipe;
214
+ if (!item.define) item.define = {};
215
+ item.index = index;
216
+ });
217
+ metaData.ctxs = ctxs;
218
+ metaData.params = params;
219
+ metaData.filter = meta.filter || baseMeta.filter;
220
+ metaData.define = {
221
+ ...baseMeta.define,
222
+ ...meta.define
223
+ };
224
+ for (const item of [
225
+ "addons",
226
+ "guards"
227
+ ]) {
228
+ const set = new Set(baseMeta[item]);
229
+ if (meta[item]) {
230
+ meta[item].forEach((part) => {
231
+ set.delete(part);
232
+ set.add(part);
233
+ });
234
+ }
235
+ metaData[item] = [
236
+ ...set
237
+ ];
238
+ }
239
+ }
240
+ return new Meta(deepFreeze(metaData), getParamTypes(instance, i) || []);
241
+ });
242
+ }
243
+ _chunkJ5CFUN4Vjs.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
244
+ function deepFreeze(object) {
245
+ Object.freeze(object);
246
+ Object.getOwnPropertyNames(object).forEach((prop) => {
247
+ if (object[prop] !== null && (typeof object[prop] === "object" || typeof object[prop] === "function") && !Object.isFrozen(object[prop])) deepFreeze(object[prop]);
248
+ });
249
+ return object;
250
+ }
251
+ _chunkJ5CFUN4Vjs.__name.call(void 0, deepFreeze, "deepFreeze");
252
+ function getParamTypes(Model, key) {
253
+ return Reflect.getMetadata("design:paramtypes", Model, key);
254
+ }
255
+ _chunkJ5CFUN4Vjs.__name.call(void 0, getParamTypes, "getParamTypes");
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+ exports.Meta = Meta; exports.emitter = emitter; exports.defaultServerInject = defaultServerInject; exports.phecdaNamespace = phecdaNamespace; exports.ServerPhecda = ServerPhecda; exports.Factory = Factory; exports.useS = useS;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __name
3
- } from "./chunk-UXD62LGG.mjs";
3
+ } from "./chunk-WHJ5FALK.mjs";
4
4
 
5
5
  // src/decorators/param.ts
6
6
  import { setMeta } from "phecda-core";
@@ -57,22 +57,14 @@ function Guard(...guards) {
57
57
  };
58
58
  }
59
59
  __name(Guard, "Guard");
60
- function Plugin(...plugins) {
60
+ function Addon(...addons) {
61
61
  return (target, property) => {
62
62
  setMeta2(target, property, void 0, {
63
- plugins
63
+ addons
64
64
  });
65
65
  };
66
66
  }
67
- __name(Plugin, "Plugin");
68
- function Interceptor(...interceptors) {
69
- return (target, property) => {
70
- setMeta2(target, property, void 0, {
71
- interceptors
72
- });
73
- };
74
- }
75
- __name(Interceptor, "Interceptor");
67
+ __name(Addon, "Addon");
76
68
  function Filter(filter) {
77
69
  return (target, property) => {
78
70
  setMeta2(target, property, void 0, {
@@ -218,8 +210,7 @@ export {
218
210
  Param,
219
211
  Arg,
220
212
  Guard,
221
- Plugin,
222
- Interceptor,
213
+ Addon,
223
214
  Filter,
224
215
  Pipe,
225
216
  Route,
@@ -17,13 +17,19 @@ var PS_EXIT_CODE;
17
17
  var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
18
18
  var _tsmixer = require('ts-mixer');
19
19
  var time;
20
- var internalLogger = console;
20
+ var internalLogger;
21
21
  function setLogger(logger) {
22
22
  internalLogger = logger;
23
23
  }
24
24
  __name(setLogger, "setLogger");
25
+ function getLogger() {
26
+ return internalLogger;
27
+ }
28
+ __name(getLogger, "getLogger");
25
29
  function log(msg, level = "log") {
30
+ if (internalLogger) internalLogger[level](msg);
26
31
  const logLevel = {
32
+ debug: -1,
27
33
  info: 0,
28
34
  log: 1,
29
35
  warn: 2,
@@ -31,6 +37,7 @@ function log(msg, level = "log") {
31
37
  }[level];
32
38
  if (logLevel < LOG_LEVEL) return;
33
39
  const color = {
40
+ debug: "bgMagenta",
34
41
  error: "red",
35
42
  info: "gray",
36
43
  warn: "yellow",
@@ -40,9 +47,17 @@ function log(msg, level = "log") {
40
47
  const current = Date.now();
41
48
  const interval = time && current - time ? `+${current - time}` : "";
42
49
  time = current;
43
- internalLogger[level](`${_picocolors2.default.magenta("[phecda-server]")} ${_picocolors2.default.gray(`${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`)} ${_picocolors2.default[color](msg)} ${_picocolors2.default.gray(interval)}`);
50
+ console[level](`${_picocolors2.default.magenta("[phecda-server]")} ${_picocolors2.default.gray(`${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`)} ${_picocolors2.default[color](msg)} ${_picocolors2.default.gray(interval)}`);
44
51
  }
45
52
  __name(log, "log");
53
+ function runMiddleware(ctx, middleware) {
54
+ return new Promise((resolve) => {
55
+ middleware(ctx.getRequest(), ctx.getResponse(), resolve);
56
+ });
57
+ }
58
+ __name(runMiddleware, "runMiddleware");
59
+
60
+
46
61
 
47
62
 
48
63
 
@@ -55,4 +70,4 @@ __name(log, "log");
55
70
 
56
71
 
57
72
 
58
- exports.__name = __name; exports.ERROR_SYMBOL = ERROR_SYMBOL; exports.IS_HMR = IS_HMR; exports.IS_ONLY_GENERATE = IS_ONLY_GENERATE; exports.IS_STRICT = IS_STRICT; exports.LOG_LEVEL = LOG_LEVEL; exports.PS_EXIT_CODE = PS_EXIT_CODE; exports.setLogger = setLogger; exports.log = log; exports.Mixin = _tsmixer.Mixin;
73
+ exports.__name = __name; exports.ERROR_SYMBOL = ERROR_SYMBOL; exports.IS_HMR = IS_HMR; exports.IS_ONLY_GENERATE = IS_ONLY_GENERATE; exports.IS_STRICT = IS_STRICT; exports.LOG_LEVEL = LOG_LEVEL; exports.PS_EXIT_CODE = PS_EXIT_CODE; exports.setLogger = setLogger; exports.getLogger = getLogger; exports.log = log; exports.runMiddleware = runMiddleware; exports.Mixin = _tsmixer.Mixin;
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkGHFSIZUOjs = require('./chunk-GHFSIZUO.js');
3
+ var _chunkJ5CFUN4Vjs = require('./chunk-J5CFUN4V.js');
4
4
 
5
5
  // src/decorators/param.ts
6
6
  var _phecdacore = require('phecda-core');
@@ -10,42 +10,42 @@ function BaseParam(data) {
10
10
  _phecdacore.setMeta.call(void 0, target, property, index, data);
11
11
  };
12
12
  }
13
- _chunkGHFSIZUOjs.__name.call(void 0, BaseParam, "BaseParam");
13
+ _chunkJ5CFUN4Vjs.__name.call(void 0, BaseParam, "BaseParam");
14
14
  function Body(key = "") {
15
15
  return BaseParam({
16
16
  type: "body",
17
17
  key
18
18
  });
19
19
  }
20
- _chunkGHFSIZUOjs.__name.call(void 0, Body, "Body");
20
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Body, "Body");
21
21
  function Head(key) {
22
22
  return BaseParam({
23
23
  type: "headers",
24
24
  key: key.toLowerCase()
25
25
  });
26
26
  }
27
- _chunkGHFSIZUOjs.__name.call(void 0, Head, "Head");
27
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Head, "Head");
28
28
  function Query(key = "") {
29
29
  return BaseParam({
30
30
  type: "query",
31
31
  key
32
32
  });
33
33
  }
34
- _chunkGHFSIZUOjs.__name.call(void 0, Query, "Query");
34
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Query, "Query");
35
35
  function Param(key) {
36
36
  return BaseParam({
37
37
  type: "params",
38
38
  key
39
39
  });
40
40
  }
41
- _chunkGHFSIZUOjs.__name.call(void 0, Param, "Param");
41
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Param, "Param");
42
42
  function Arg(target, k, index) {
43
43
  BaseParam({
44
44
  type: "args",
45
45
  key: `${index}`
46
46
  })(target, k, index);
47
47
  }
48
- _chunkGHFSIZUOjs.__name.call(void 0, Arg, "Arg");
48
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Arg, "Arg");
49
49
 
50
50
  // src/decorators/aop.ts
51
51
 
@@ -56,23 +56,15 @@ function Guard(...guards) {
56
56
  });
57
57
  };
58
58
  }
59
- _chunkGHFSIZUOjs.__name.call(void 0, Guard, "Guard");
60
- function Plugin(...plugins) {
59
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Guard, "Guard");
60
+ function Addon(...addons) {
61
61
  return (target, property) => {
62
62
  _phecdacore.setMeta.call(void 0, target, property, void 0, {
63
- plugins
63
+ addons
64
64
  });
65
65
  };
66
66
  }
67
- _chunkGHFSIZUOjs.__name.call(void 0, Plugin, "Plugin");
68
- function Interceptor(...interceptors) {
69
- return (target, property) => {
70
- _phecdacore.setMeta.call(void 0, target, property, void 0, {
71
- interceptors
72
- });
73
- };
74
- }
75
- _chunkGHFSIZUOjs.__name.call(void 0, Interceptor, "Interceptor");
67
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Addon, "Addon");
76
68
  function Filter(filter) {
77
69
  return (target, property) => {
78
70
  _phecdacore.setMeta.call(void 0, target, property, void 0, {
@@ -80,7 +72,7 @@ function Filter(filter) {
80
72
  });
81
73
  };
82
74
  }
83
- _chunkGHFSIZUOjs.__name.call(void 0, Filter, "Filter");
75
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Filter, "Filter");
84
76
  function Pipe(pipe) {
85
77
  return (target, property, index) => {
86
78
  if (typeof index === "number") {
@@ -94,7 +86,7 @@ function Pipe(pipe) {
94
86
  });
95
87
  };
96
88
  }
97
- _chunkGHFSIZUOjs.__name.call(void 0, Pipe, "Pipe");
89
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Pipe, "Pipe");
98
90
 
99
91
  // src/decorators/http.ts
100
92
 
@@ -108,7 +100,7 @@ function Route(route, type) {
108
100
  });
109
101
  };
110
102
  }
111
- _chunkGHFSIZUOjs.__name.call(void 0, Route, "Route");
103
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Route, "Route");
112
104
  function Header(headers) {
113
105
  return (target, property) => {
114
106
  _phecdacore.setMeta.call(void 0, target, property, void 0, {
@@ -118,31 +110,31 @@ function Header(headers) {
118
110
  });
119
111
  };
120
112
  }
121
- _chunkGHFSIZUOjs.__name.call(void 0, Header, "Header");
113
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Header, "Header");
122
114
  function Get(route = "") {
123
115
  return Route(route, "get");
124
116
  }
125
- _chunkGHFSIZUOjs.__name.call(void 0, Get, "Get");
117
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Get, "Get");
126
118
  function Post(route = "") {
127
119
  return Route(route, "post");
128
120
  }
129
- _chunkGHFSIZUOjs.__name.call(void 0, Post, "Post");
121
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Post, "Post");
130
122
  function Put(route = "") {
131
123
  return Route(route, "put");
132
124
  }
133
- _chunkGHFSIZUOjs.__name.call(void 0, Put, "Put");
125
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Put, "Put");
134
126
  function Search(route = "") {
135
127
  return Route(route, "search");
136
128
  }
137
- _chunkGHFSIZUOjs.__name.call(void 0, Search, "Search");
129
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Search, "Search");
138
130
  function Patch(route = "") {
139
131
  return Route(route, "patch");
140
132
  }
141
- _chunkGHFSIZUOjs.__name.call(void 0, Patch, "Patch");
133
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Patch, "Patch");
142
134
  function Delete(route = "") {
143
135
  return Route(route, "delete");
144
136
  }
145
- _chunkGHFSIZUOjs.__name.call(void 0, Delete, "Delete");
137
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Delete, "Delete");
146
138
  function Controller(prefix = "") {
147
139
  return (target) => {
148
140
  _phecdacore.setMeta.call(void 0, target, void 0, void 0, {
@@ -153,7 +145,7 @@ function Controller(prefix = "") {
153
145
  });
154
146
  };
155
147
  }
156
- _chunkGHFSIZUOjs.__name.call(void 0, Controller, "Controller");
148
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Controller, "Controller");
157
149
 
158
150
  // src/decorators/rpc.ts
159
151
 
@@ -167,7 +159,7 @@ function Queue(queue = "", isEvent) {
167
159
  });
168
160
  };
169
161
  }
170
- _chunkGHFSIZUOjs.__name.call(void 0, Queue, "Queue");
162
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Queue, "Queue");
171
163
  function Rpc() {
172
164
  return (target) => {
173
165
  _phecdacore.setMeta.call(void 0, target, void 0, void 0, {
@@ -175,11 +167,11 @@ function Rpc() {
175
167
  });
176
168
  };
177
169
  }
178
- _chunkGHFSIZUOjs.__name.call(void 0, Rpc, "Rpc");
170
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Rpc, "Rpc");
179
171
 
180
172
  // src/decorators/ctx.ts
181
173
 
182
- var Ctx = /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (target, property) => {
174
+ var Ctx = /* @__PURE__ */ _chunkJ5CFUN4Vjs.__name.call(void 0, (target, property) => {
183
175
  _phecdacore.setMeta.call(void 0, target, _phecdacore.SHARE_KEY, void 0, {
184
176
  ctxs: [
185
177
  property
@@ -208,8 +200,7 @@ function Define(key, value) {
208
200
  }
209
201
  };
210
202
  }
211
- _chunkGHFSIZUOjs.__name.call(void 0, Define, "Define");
212
-
203
+ _chunkJ5CFUN4Vjs.__name.call(void 0, Define, "Define");
213
204
 
214
205
 
215
206
 
@@ -235,4 +226,4 @@ _chunkGHFSIZUOjs.__name.call(void 0, Define, "Define");
235
226
 
236
227
 
237
228
 
238
- exports.BaseParam = BaseParam; exports.Body = Body; exports.Head = Head; exports.Query = Query; exports.Param = Param; exports.Arg = Arg; exports.Guard = Guard; exports.Plugin = Plugin; exports.Interceptor = Interceptor; exports.Filter = Filter; exports.Pipe = Pipe; exports.Route = Route; exports.Header = Header; exports.Get = Get; exports.Post = Post; exports.Put = Put; exports.Search = Search; exports.Patch = Patch; exports.Delete = Delete; exports.Controller = Controller; exports.Queue = Queue; exports.Rpc = Rpc; exports.Ctx = Ctx; exports.Define = Define;
229
+ exports.BaseParam = BaseParam; exports.Body = Body; exports.Head = Head; exports.Query = Query; exports.Param = Param; exports.Arg = Arg; exports.Guard = Guard; exports.Addon = Addon; exports.Filter = Filter; exports.Pipe = Pipe; exports.Route = Route; exports.Header = Header; exports.Get = Get; exports.Post = Post; exports.Put = Put; exports.Search = Search; exports.Patch = Patch; exports.Delete = Delete; exports.Controller = Controller; exports.Queue = Queue; exports.Rpc = Rpc; exports.Ctx = Ctx; exports.Define = Define;