moost 0.0.1-beta.2 → 0.0.1-beta.3

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.
@@ -16,7 +16,7 @@ function getMoostMate() {
16
16
  return moostMate;
17
17
  }
18
18
 
19
- const prefix = '__moost_';
19
+ const prefix = '__moost__';
20
20
  function useCacheObject(name, def) {
21
21
  const cc = wooks.useCurrentWooksContext().getCtx().customContext;
22
22
  const key = prefix + name;
@@ -37,9 +37,10 @@ function useControllerMeta() {
37
37
  getMethodMeta: () => getMoostMate().read(controller, method),
38
38
  };
39
39
  }
40
- function setComposableControllerContext(controller, method) {
41
- setCacheObject('controller', controller);
42
- setCacheObject('method', method);
40
+ function setComposableControllerContext(data) {
41
+ setCacheObject('controller', data.controller);
42
+ setCacheObject('method', data.method);
43
+ setCacheObject('pathBuilder', data.pathBuilder);
43
44
  }
44
45
 
45
46
  async function runPipes(pipes, meta, restoreCtx) {
@@ -106,7 +107,7 @@ function getNewMoostInfact() {
106
107
  }
107
108
 
108
109
  function bindHandler(getInstance, method, wooksApp, options) {
109
- wooksApp.on(options.httpMethod, options.path, async () => {
110
+ const pathBuilder = wooksApp.on(options.httpMethod, options.path, async () => {
110
111
  const { restoreCtx } = wooks.useCurrentWooksContext();
111
112
  const { reqId, rawRequest } = wooks.useRequest();
112
113
  const infact = getMoostInfact();
@@ -115,7 +116,11 @@ function bindHandler(getInstance, method, wooksApp, options) {
115
116
  rawRequest.on('end', () => infact.unregisterScope(scopeId));
116
117
  const instance = await getInstance();
117
118
  restoreCtx();
118
- setComposableControllerContext(instance, method);
119
+ setComposableControllerContext({
120
+ controller: instance,
121
+ method: method,
122
+ pathBuilder: pathBuilder,
123
+ });
119
124
  let response;
120
125
  let responseOverwritten = false;
121
126
  const before = [];
@@ -125,10 +130,12 @@ function bindHandler(getInstance, method, wooksApp, options) {
125
130
  response = reply;
126
131
  responseOverwritten = true;
127
132
  }
133
+ // init interceptors
128
134
  for (const handler of options.interceptorHandlers) {
129
135
  restoreCtx();
130
136
  await handler((fn) => { before.push(fn); }, (fn) => { after.unshift(fn); }, (fn) => { onError.unshift(fn); });
131
137
  }
138
+ // params
132
139
  let args = [];
133
140
  try {
134
141
  restoreCtx();
@@ -138,12 +145,14 @@ function bindHandler(getInstance, method, wooksApp, options) {
138
145
  response = e;
139
146
  }
140
147
  if (!response) {
148
+ // fire before interceptors
141
149
  for (const handler of before) {
142
150
  restoreCtx();
143
151
  await handler(replyFn);
144
152
  if (responseOverwritten)
145
153
  break;
146
154
  }
155
+ // fire request handler
147
156
  if (!responseOverwritten) {
148
157
  try {
149
158
  restoreCtx();
@@ -154,6 +163,7 @@ function bindHandler(getInstance, method, wooksApp, options) {
154
163
  }
155
164
  }
156
165
  }
166
+ // fire after interceptors
157
167
  if (response instanceof Error) {
158
168
  for (const handler of onError) {
159
169
  restoreCtx();
@@ -180,6 +190,7 @@ async function applyPipesToArgs(argsPipes) {
180
190
  }
181
191
 
182
192
  function getInstanceOwnMethods(instance) {
193
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
183
194
  const proto = Object.getPrototypeOf(instance);
184
195
  return [
185
196
  ...Object.getOwnPropertyNames(proto),
@@ -187,8 +198,10 @@ function getInstanceOwnMethods(instance) {
187
198
  ].filter(m => typeof instance[m] === 'function');
188
199
  }
189
200
 
201
+ /* istanbul ignore file */
190
202
  const banner = () => `[moost][${new Date().toISOString().replace('T', ' ').replace(/\.\d{3}z$/i, '')}] `;
191
203
 
204
+ /* istanbul ignore file */
192
205
  function log(text) {
193
206
  console.log('' + '' + banner() + text + '');
194
207
  }
@@ -199,6 +212,7 @@ function logError(error) {
199
212
  console.error('' + '' + banner() + error + '');
200
213
  }
201
214
 
215
+ /* istanbul ignore file */
202
216
  function panic(error) {
203
217
  logError(error);
204
218
  return new Error(error);
@@ -237,6 +251,7 @@ function bindControllerMethods(getInstance, classConstructor, wooksApp, options)
237
251
  const methodMeta = getMoostMate().read(fakeInstance, method) || {};
238
252
  if (!methodMeta.httpHandler || !methodMeta.httpHandler.length)
239
253
  continue;
254
+ // preparing interceptors
240
255
  const interceptors = [...(opts.interceptors || []), ...(meta.interceptors || []), ...(methodMeta.interceptors || [])].sort((a, b) => a.priority - b.priority);
241
256
  const interceptorHandlers = [];
242
257
  for (const { handler } of interceptors) {
@@ -253,6 +268,7 @@ function bindControllerMethods(getInstance, classConstructor, wooksApp, options)
253
268
  interceptorHandlers.push(handler);
254
269
  }
255
270
  }
271
+ // preparing pipes
256
272
  const pipes = [...(opts.pipes || []), ...(meta.pipes || []), ...(methodMeta.pipes || [])];
257
273
  const argsPipes = [];
258
274
  for (const p of methodMeta.params || []) {
@@ -261,6 +277,7 @@ function bindControllerMethods(getInstance, classConstructor, wooksApp, options)
261
277
  pipes: [...pipes, ...(p.pipes || [])].sort((a, b) => a.priority - b.priority),
262
278
  });
263
279
  }
280
+ // preparing provide
264
281
  const provide = { ...(opts.provide || {}), ...(meta.provide || {}) };
265
282
  for (const { method: httpMethod, path: httpPath } of methodMeta.httpHandler) {
266
283
  const path = typeof httpPath === 'string' ? httpPath : typeof method === 'string' ? method : '';
@@ -296,24 +313,58 @@ function Optional() {
296
313
  }
297
314
  function Required() {
298
315
  const mate = getMoostMate();
299
- return mate.apply(mate.decorate('required', true), mate.decorateClass((meta, key, index) => {
316
+ return mate.apply(mate.decorate('required', true),
317
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
318
+ mate.decorateClass((meta, key, index) => {
300
319
  if (typeof index !== 'number' && meta && ['string', 'symbol'].includes(typeof key)) {
320
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
301
321
  meta.requiredProps = meta.requiredProps || [];
322
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
302
323
  meta.requiredProps.push(key);
303
324
  }
304
325
  return meta;
305
326
  }));
306
327
  }
307
328
 
329
+ /**
330
+ * Hook to the Response Status
331
+ * @decorator
332
+ * @param resolver - resolver function
333
+ * @param label - field label
334
+ * @paramType unknown
335
+ */
308
336
  function Resolve(resolver, label) {
309
337
  return (target, key, index) => {
310
338
  fillLabel(target, key, index, label);
311
339
  getMoostMate().decorate('resolver', resolver)(target, key, index);
312
340
  };
313
341
  }
342
+ /**
343
+ * Hook to the Response Status
344
+ * @decorator
345
+ * @paramType TStatusHook
346
+ */
314
347
  const StatusHook = Resolve(() => wooks.useStatus(), 'status');
348
+ /**
349
+ * Hook to the Response Header
350
+ * @decorator
351
+ * @param name - header name
352
+ * @paramType THeaderHook
353
+ */
315
354
  const HeaderHook = (name) => Resolve(() => wooks.useRespHeader(name), name);
355
+ /**
356
+ * Hook to the Response Cookie
357
+ * @decorator
358
+ * @param name - header name
359
+ * @paramType TCookieHook
360
+ */
316
361
  const CookieHook = (name) => Resolve(() => wooks.useRespCookie(name), name);
362
+ /**
363
+ * Parse Authorisation Header
364
+ * @decorator
365
+ * @param name - define what to take from the Auth header
366
+ * @paramType string
367
+ */
317
368
  function Authorization(name) {
318
369
  return Resolve(() => {
319
370
  var _a, _b;
@@ -332,21 +383,50 @@ function Authorization(name) {
332
383
  }
333
384
  }, 'authorization');
334
385
  }
386
+ /**
387
+ * Get Request Header Value
388
+ * @decorator
389
+ * @param name - header name
390
+ * @paramType string
391
+ */
335
392
  function Header(name) {
336
393
  return Resolve(() => {
337
394
  const headers = wooks.useHeaders();
338
395
  return headers[name];
339
396
  }, 'header: ' + name);
340
397
  }
398
+ /**
399
+ * Get Request Cookie Value
400
+ * @decorator
401
+ * @param name - cookie name
402
+ * @paramType string
403
+ */
341
404
  function Cookie(name) {
342
405
  return Resolve(() => wooks.useCookies().getCookie(name), 'cookie: ' + name);
343
406
  }
407
+ /**
408
+ * Get Param Value from url parh
409
+ * @decorator
410
+ * @param name - param name
411
+ * @paramType string
412
+ */
344
413
  function Param(name) {
345
414
  return Resolve(() => wooks.useRouteParams().getRouteParam(name), name);
346
415
  }
416
+ /**
417
+ * Get Parsed Params from url parh
418
+ * @decorator
419
+ * @paramType object
420
+ */
347
421
  function Params() {
348
422
  return Resolve(() => wooks.useRouteParams().routeParams, 'params');
349
423
  }
424
+ /**
425
+ * Get Query Item value or the whole parsed Query as an object
426
+ * @decorator
427
+ * @param name - query item name (optional)
428
+ * @paramType string | object
429
+ */
350
430
  function Query(name) {
351
431
  return Resolve(() => {
352
432
  const { jsonSearchParams, urlSearchParams } = wooks.useSearchParams();
@@ -360,33 +440,86 @@ function Query(name) {
360
440
  return Object.keys(json).length ? json : undefined;
361
441
  }, name || 'Query');
362
442
  }
443
+ /**
444
+ * Get Requested URL
445
+ * @decorator
446
+ * @paramType string
447
+ */
363
448
  function Url() {
364
449
  return Resolve(() => wooks.useRequest().url, 'url');
365
450
  }
451
+ /**
452
+ * Get Requested HTTP Method
453
+ * @decorator
454
+ * @paramType string
455
+ */
366
456
  function Method() {
367
457
  return Resolve(() => wooks.useRequest().method, 'http_method');
368
458
  }
459
+ /**
460
+ * Get Raw Request Instance
461
+ * @decorator
462
+ * @paramType IncomingMessage
463
+ */
369
464
  function Req() {
370
465
  return Resolve(() => wooks.useRequest().rawRequest, 'request');
371
466
  }
467
+ /**
468
+ * Get Request Unique Identificator (UUID)
469
+ * @decorator
470
+ * @paramType string
471
+ */
372
472
  function ReqId() {
373
473
  return Resolve(() => wooks.useRequest().reqId(), 'reqId');
374
474
  }
475
+ /**
476
+ * Get Request IP Address
477
+ * @decorator
478
+ * @paramType string
479
+ */
375
480
  function Ip(opts) {
376
481
  return Resolve(() => wooks.useRequest().getIp(opts), 'ip');
377
482
  }
483
+ /**
484
+ * Get Request IP Address list
485
+ * @decorator
486
+ * @paramType string[]
487
+ */
378
488
  function IpList() {
379
489
  return Resolve(() => wooks.useRequest().getIpList(), 'ipList');
380
490
  }
491
+ /**
492
+ * Get Raw Response Object
493
+ * @decorator
494
+ * @param options - passthrough options
495
+ * @paramType string
496
+ */
381
497
  function Res(options) {
382
498
  return Resolve(() => wooks.useResponse().rawResponse(options), 'response');
383
499
  }
500
+ /**
501
+ * Provide Const Value
502
+ * @decorator
503
+ * @param value - provided value
504
+ * @param label - label of the field
505
+ * @paramType unknown
506
+ */
384
507
  function Const(value, label) {
385
508
  return Resolve(() => value, label);
386
509
  }
510
+ /**
511
+ * Get Parsed Request Body
512
+ * @decorator
513
+ * @paramType object | string | unknown
514
+ */
387
515
  function Body() {
388
516
  return Resolve(() => wooks.useBody().parseBody(), 'body');
389
517
  }
518
+ /**
519
+ * Get Raw Request Body Buffer
520
+ * @decorator
521
+ * @paramType Promise<Buffer>
522
+ */
390
523
  function RawBody() {
391
524
  return Resolve(() => wooks.useBody().rawBody(), 'body');
392
525
  }
@@ -399,6 +532,14 @@ function fillLabel(target, key, index, name) {
399
532
  }
400
533
  }
401
534
 
535
+ /**
536
+ * Mark the Class as Injectable to enable it to be used in dependency injection
537
+ * @decorator
538
+ * @param scope - Scope for injection ("FOR_REQUEST" | "SINGLETON" | true)
539
+ * FOR_REQUEST - will create a new instance for each incoming request
540
+ * SINGLETON | true - will create a new instance only once
541
+ * @param label - field label
542
+ */
402
543
  function Injectable(scope = true) {
403
544
  return getMoostMate().decorate('injectable', scope);
404
545
  }
@@ -408,6 +549,11 @@ const insureInjectable = getMoostMate().decorate((meta) => {
408
549
  return meta;
409
550
  });
410
551
 
552
+ /**
553
+ * Set Class as a Controller
554
+ * @decorator
555
+ * @param prefix - define the prefix for all the paths of this controller
556
+ */
411
557
  function Controller(prefix) {
412
558
  const mate = getMoostMate();
413
559
  return mate.apply(insureInjectable, mate.decorate('controller', { prefix: prefix || '' }));
@@ -486,17 +632,36 @@ function IsBoolean(...args) {
486
632
  return Validate(valido$1.validoIsBoolean(...args));
487
633
  }
488
634
 
635
+ const valido = new valido$1.Valido({
636
+ getDtoMeta(value, _type) {
637
+ let type = _type;
638
+ if (!type) {
639
+ type = mate.getConstructor(value);
640
+ }
641
+ const mate$1 = getMoostMate();
642
+ return mate$1.read(type);
643
+ },
644
+ getDtoParamMeta(value, type, key) {
645
+ const mate = getMoostMate();
646
+ return mate.read(type, key);
647
+ },
648
+ });
649
+ function getMoostValido() {
650
+ return valido;
651
+ }
652
+
489
653
  class Moost {
490
654
  constructor(options) {
491
655
  this.options = options;
492
656
  this.pipes = [...sharedPipes];
493
657
  this.interceptors = [];
494
- this.provide = {};
658
+ this.provide = infact.createProvideRegistry([infact.Infact, getMoostInfact], [mate.Mate, getMoostMate], [valido$1.Valido, getMoostValido]);
495
659
  this.unregisteredControllers = [];
496
660
  }
497
661
  async listen(port, hostname, cb) {
498
662
  var _a, _b, _c;
499
663
  this.wooksApp = new wooks.Wooks((_a = this.options) === null || _a === void 0 ? void 0 : _a.wooksOptions);
664
+ this.setProvideRegistry(infact.createProvideRegistry([wooks.Wooks, () => this.wooksApp], [Moost, () => this]));
500
665
  const _port = Number(((_b = this.options) === null || _b === void 0 ? void 0 : _b.port) || port);
501
666
  const _hostname = ((_c = this.options) === null || _c === void 0 ? void 0 : _c.hostname) || hostname;
502
667
  if (!_port) {
@@ -544,10 +709,13 @@ class Moost {
544
709
  instance = controller;
545
710
  infact.setProvideRegByInstance(instance, provide);
546
711
  }
712
+ // getInstance - instance factory for resolving SINGLETON and FOR_REQUEST instance
547
713
  const getInstance = instance ? () => Promise.resolve(instance) : async () => {
714
+ // if (!instance) {
548
715
  infact.silent();
549
716
  const instance = await infact.get(controller, provide);
550
717
  infact.silent(false);
718
+ // }
551
719
  return instance;
552
720
  };
553
721
  const classConstructor = mate.isConstructor(controller) ? controller : mate.getConstructor(controller);
@@ -605,10 +773,20 @@ class Moost {
605
773
  }
606
774
  return this;
607
775
  }
776
+ /**
777
+ * Register new entried to provide as dependency injections
778
+ * @param provide - Provide Registry (use createProvideRegistry from '\@prostojs/infact')
779
+ * @returns
780
+ */
608
781
  setProvideRegistry(provide) {
609
782
  this.provide = { ...this.provide, ...provide };
610
783
  return this;
611
784
  }
785
+ /**
786
+ * Register controllers (similar to @ImportController decorator)
787
+ * @param controllers - list of target controllers (instances)
788
+ * @returns
789
+ */
612
790
  registerControllers(...controllers) {
613
791
  this.unregisteredControllers.push(...controllers);
614
792
  return this;
@@ -674,24 +852,6 @@ function typeError(value, targetType, label) {
674
852
  throw new wooks.WooksError(400, `${prefix}${JSON.stringify(value)} is not a ${targetType} type`);
675
853
  }
676
854
 
677
- const valido = new valido$1.Valido({
678
- getDtoMeta(value, _type) {
679
- let type = _type;
680
- if (!type) {
681
- type = mate.getConstructor(value);
682
- }
683
- const mate$1 = getMoostMate();
684
- return mate$1.read(type);
685
- },
686
- getDtoParamMeta(value, type, key) {
687
- const mate = getMoostMate();
688
- return mate.read(type, key);
689
- },
690
- });
691
- function getMoostValido() {
692
- return valido;
693
- }
694
-
695
855
  const DEFAULT_ERROR_LIMIT = 10;
696
856
  function firstString(errors) {
697
857
  const keys = Object.keys(errors);
package/dist/moost.d.ts CHANGED
@@ -13,18 +13,53 @@ import { Wooks } from 'wooks';
13
13
 
14
14
  export declare const All: (path?: string) => MethodDecorator;
15
15
 
16
+ /**
17
+ * Parse Authorisation Header
18
+ * @decorator
19
+ * @param name - define what to take from the Auth header
20
+ * @paramType string
21
+ */
16
22
  export declare function Authorization(name: 'username' | 'password' | 'bearer' | 'raw' | 'type'): ParameterDecorator;
17
23
 
24
+ /**
25
+ * Get Parsed Request Body
26
+ * @decorator
27
+ * @paramType object | string | unknown
28
+ */
18
29
  export declare function Body(): ParameterDecorator;
19
30
 
20
31
  export declare function Circular<T = unknown>(resolver: () => TClassConstructor<T>): ParameterDecorator;
21
32
 
33
+ /**
34
+ * Provide Const Value
35
+ * @decorator
36
+ * @param value - provided value
37
+ * @param label - label of the field
38
+ * @paramType unknown
39
+ */
22
40
  export declare function Const(value: unknown, label?: string): ParameterDecorator;
23
41
 
42
+ /**
43
+ * Set Class as a Controller
44
+ * @decorator
45
+ * @param prefix - define the prefix for all the paths of this controller
46
+ */
24
47
  export declare function Controller(prefix?: string): ClassDecorator;
25
48
 
49
+ /**
50
+ * Get Request Cookie Value
51
+ * @decorator
52
+ * @param name - cookie name
53
+ * @paramType string
54
+ */
26
55
  export declare function Cookie(name: string): ParameterDecorator;
27
56
 
57
+ /**
58
+ * Hook to the Response Cookie
59
+ * @decorator
60
+ * @param name - header name
61
+ * @paramType TCookieHook
62
+ */
28
63
  export declare const CookieHook: (name: string) => ParameterDecorator;
29
64
 
30
65
  export declare const Delete: (path?: string) => MethodDecorator;
@@ -37,26 +72,69 @@ export declare const Get: (path?: string) => MethodDecorator;
37
72
 
38
73
  export declare function getMoostMate(): Mate<TMoostMetadata>;
39
74
 
75
+ /**
76
+ * Get Request Header Value
77
+ * @decorator
78
+ * @param name - header name
79
+ * @paramType string
80
+ */
40
81
  export declare function Header(name: string): ParameterDecorator;
41
82
 
83
+ /**
84
+ * Hook to the Response Header
85
+ * @decorator
86
+ * @param name - header name
87
+ * @paramType THeaderHook
88
+ */
42
89
  export declare const HeaderHook: (name: string) => ParameterDecorator;
43
90
 
44
91
  export declare function HttpMethod(method: '*' | 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS', path?: string): MethodDecorator;
45
92
 
93
+ /**
94
+ * Set Class as a Controller
95
+ * @decorator
96
+ * @param controller - target controller (instance) to import
97
+ * @param provide - provide registry for the target controller
98
+ */
46
99
  export declare function ImportController(controller: TFunction | TObject, provide?: TProvideRegistry): ClassDecorator;
47
100
 
101
+ /**
102
+ * Set Class as a Controller
103
+ * @decorator
104
+ * @param prefix - redefine the prefix for all the paths of this controller
105
+ * @param controller - point to a controller (instance) to import
106
+ * @param provide - provide registry for the target controller
107
+ */
48
108
  export declare function ImportController(prefix: string, controller: TFunction | TObject, provide?: TProvideRegistry): ClassDecorator;
49
109
 
50
110
  export declare function Inject(type: string | TClassConstructor): ParameterDecorator;
51
111
 
112
+ /**
113
+ * Mark the Class as Injectable to enable it to be used in dependency injection
114
+ * @decorator
115
+ * @param scope - Scope for injection ("FOR_REQUEST" | "SINGLETON" | true)
116
+ * FOR_REQUEST - will create a new instance for each incoming request
117
+ * SINGLETON | true - will create a new instance only once
118
+ * @param label - field label
119
+ */
52
120
  export declare function Injectable(scope?: true | TInjectableScope): ClassDecorator;
53
121
 
54
122
  export declare function Intercept(handler: TCallableClassFunction<TInterceptorFn>, priority?: TInterceptorPriority): ClassDecorator & MethodDecorator;
55
123
 
124
+ /**
125
+ * Get Request IP Address
126
+ * @decorator
127
+ * @paramType string
128
+ */
56
129
  export declare function Ip(opts?: {
57
130
  trustProxy: boolean;
58
131
  }): ParameterDecorator;
59
132
 
133
+ /**
134
+ * Get Request IP Address list
135
+ * @decorator
136
+ * @paramType string[]
137
+ */
60
138
  export declare function IpList(): ParameterDecorator;
61
139
 
62
140
  export declare function IsArray<T = unknown>(opts?: TValidateArrayOptions<T>): PropertyDecorator & ParameterDecorator;
@@ -71,6 +149,11 @@ export declare function IsTypeOf(type: 'string' | 'object' | 'number' | 'boolean
71
149
 
72
150
  export declare function Label(value: string): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
73
151
 
152
+ /**
153
+ * Get Requested HTTP Method
154
+ * @decorator
155
+ * @paramType string
156
+ */
74
157
  export declare function Method(): ParameterDecorator;
75
158
 
76
159
  export declare class Moost {
@@ -92,14 +175,35 @@ export declare class Moost {
92
175
  protected bindController(controller: TFunction | TObject, provide: TProvideRegistry, globalPrefix: string, replaceOwnPrefix?: string): Promise<void>;
93
176
  applyGlobalPipes(...items: (TPipeFn | TPipeData)[]): this;
94
177
  applyGlobalInterceptors(...items: (TInterceptorData['handler'] | TInterceptorData)[]): this;
178
+ /**
179
+ * Register new entried to provide as dependency injections
180
+ * @param provide - Provide Registry (use createProvideRegistry from '\@prostojs/infact')
181
+ * @returns
182
+ */
95
183
  setProvideRegistry(provide: TProvideRegistry): this;
184
+ /**
185
+ * Register controllers (similar to @ImportController decorator)
186
+ * @param controllers - list of target controllers (instances)
187
+ * @returns
188
+ */
96
189
  registerControllers(...controllers: (TObject | TFunction)[]): this;
97
190
  }
98
191
 
99
192
  export declare function Optional(): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
100
193
 
194
+ /**
195
+ * Get Param Value from url parh
196
+ * @decorator
197
+ * @param name - param name
198
+ * @paramType string
199
+ */
101
200
  export declare function Param(name: string): ParameterDecorator;
102
201
 
202
+ /**
203
+ * Get Parsed Params from url parh
204
+ * @decorator
205
+ * @paramType object
206
+ */
103
207
  export declare function Params(): ParameterDecorator;
104
208
 
105
209
  export declare const Patch: (path?: string) => MethodDecorator;
@@ -110,25 +214,64 @@ export declare function Provide(type: string | TClassConstructor, fn: TProvideFn
110
214
 
111
215
  export declare const Put: (path?: string) => MethodDecorator;
112
216
 
217
+ /**
218
+ * Get Query Item value or the whole parsed Query as an object
219
+ * @decorator
220
+ * @param name - query item name (optional)
221
+ * @paramType string | object
222
+ */
113
223
  export declare function Query(name?: string): ParameterDecorator;
114
224
 
225
+ /**
226
+ * Get Raw Request Body Buffer
227
+ * @decorator
228
+ * @paramType Promise<Buffer>
229
+ */
115
230
  export declare function RawBody(): ParameterDecorator;
116
231
 
232
+ /**
233
+ * Get Raw Request Instance
234
+ * @decorator
235
+ * @paramType IncomingMessage
236
+ */
117
237
  export declare function Req(): ParameterDecorator;
118
238
 
239
+ /**
240
+ * Get Request Unique Identificator (UUID)
241
+ * @decorator
242
+ * @paramType string
243
+ */
119
244
  export declare function ReqId(): ParameterDecorator;
120
245
 
121
246
  declare function Required_2(): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
122
247
  export { Required_2 as Required }
123
248
 
249
+ /**
250
+ * Get Raw Response Object
251
+ * @decorator
252
+ * @param options - passthrough options
253
+ * @paramType string
254
+ */
124
255
  export declare function Res(options?: {
125
256
  passthrough: boolean;
126
257
  }): ParameterDecorator;
127
258
 
259
+ /**
260
+ * Hook to the Response Status
261
+ * @decorator
262
+ * @param resolver - resolver function
263
+ * @param label - field label
264
+ * @paramType unknown
265
+ */
128
266
  export declare function Resolve(resolver: () => unknown, label?: string): ParameterDecorator;
129
267
 
130
268
  export declare const resolvePipe: TPipeFn;
131
269
 
270
+ /**
271
+ * Hook to the Response Status
272
+ * @decorator
273
+ * @paramType TStatusHook
274
+ */
132
275
  export declare const StatusHook: ParameterDecorator;
133
276
 
134
277
  declare type TAny = any;
@@ -268,6 +411,11 @@ declare interface TValidatePipeOptions {
268
411
  errorLimit?: number;
269
412
  }
270
413
 
414
+ /**
415
+ * Get Requested URL
416
+ * @decorator
417
+ * @paramType string
418
+ */
271
419
  export declare function Url(): ParameterDecorator;
272
420
 
273
421
  export declare function useControllerMeta<T extends TMoostMetadata = TMoostMetadata>(): {